problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p02880 | s858500320 | Accepted | n = int(input())
a = []
for i in range(1,10):
for j in range(1,10):
a.append(i*j)
if n in a:
print('Yes')
else:
print('No')
|
p02897 | s889114641 | Accepted | n = int(input())
count = 0
for i in range(1, n+1):
if i % 2 != 0:
count += 1
a = count / n
print(a) |
p02583 | s637587614 | Accepted | n = int(input())
a = [int(x) for x in input().split()]
result = 0
for a_i in range(n):
for b_i in range(a_i+1, n):
for c_i in range(b_i+1, n):
l_a = a[a_i]
l_b = a[b_i]
l_c = a[c_i]
if l_a == l_b or l_b == l_c or l_a == l_c:
continue
if l_a + l_b > l_c and l_b + l_c > l_a and l_c + l_a > l_b:
result += 1
print(result) |
p03220 | s983034607 | Accepted | import sys
readline = sys.stdin.readline
N = int(readline())
T,A = map(int,readline().split())
H = list(map(int,readline().split()))
ans = [None] * N
for i in range(len(H)):
ans[i] = (abs(A - (T - H[i] * 0.006)), i)
ans = sorted(ans, key = lambda x:x[0])
print(ans[0][1] + 1) |
p03659 | s163250210 | Wrong Answer | N = int(input())
a = list(map(int, input().split()))
accum=[0]
for i in range(N):
accum.append(accum[i]+a[i])
accum.remove(0)
print(accum)
S=accum[-1]
lst=[]
for i in range(N-1):
lst.append(abs(S-accum[i]*2))
print(min(lst)) |
p03162 | s321297191 | Accepted | N = int(input())
ABC = []
for _ in range(N):
ABC.append(list(map(int, input().split())))
table = [[0]*3 for i in range(N)]
for i in range(0, N):# i日目
if i == 0:
table[i] = ABC[i]
else:
for j in range(3): #a,b,c
table[i][j] = max(
[table[i-1][j1] + ABC[i][j] for j1 in range(3) if not j1 == j ]
)
# print(table)
print(max(table[-1])) |
p03379 | s345074448 | Accepted | n = int(input())
x = list(map(int, input().split()))
x_sort = sorted(x)
half_l = x_sort[(n-1)//2]
half_r = x_sort[(n)//2]
for i in range(n):
if x[i] <= half_l:
print(half_r)
else:
print(half_l)
|
p03730 | s599320776 | Wrong Answer | a,b,c=map(int,input().split())
for i in range(1,b+1):
if a*i%b==c:
print("YES")
break
else:
continue
print("NO") |
p03208 | s865704858 | Wrong Answer | N, K = map(int, input().split())
H = [int(input()) for _ in range(N)]
H.sort()
hmax1 = H[-1]
hmin1 = H[-K]
hmax2 = H[K - 1]
hmin2 = H[0]
print(min(hmax1 - hmin1, hmax2 - hmin2)) |
p03632 | s596348492 | Wrong Answer | l = list(map(int,input().split()))
if l[1]<l[2]:
print(0)
else:
ls = sorted(l)
print(ls[2]-ls[1]) |
p03077 | s557021590 | Accepted | N = int(input())
tmp = [0 for i in range(5)]
for i in range(5):
tmp[i] = int(input())
tmp_min = min(tmp)
base = 0
if N % tmp_min == 0:
base = N // tmp_min
else:
base = N // tmp_min + 1
print(base + 4) |
p03262 | s397550562 | Accepted | import fractions
N,X=map(int,input().split())
xlist=list(map(int,input().split()))
xlist2=[]
for i in range(N):
xlist2.append(abs(xlist[i]-X))
#print(xlist2)
answer=xlist2[0]
for i in range(1,N):
answer=fractions.gcd(answer,xlist2[i])
print(answer) |
p02916 | s004065266 | Accepted | n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
su = 0
n1 = len(a)
for i in a:
su += b[i-1]
for i in range(n1-1):
if a[i] == a[i+1] -1:
su += c[a[i]-1]
print(su) |
p02951 | s416256902 | Accepted | a,b,c=map(int,input().split())
if c-(a-b)>0:
print(c-(a-b))
else:
print("0")
|
p02995 | s605927407 | Accepted | from fractions import gcd
a, b, c, d = map(int, input().split())
print((b - (b // c + b // d - b // int(c * d / (gcd(c, d))))) - ((a - 1) - ((a - 1) // c + (a - 1) // d - (a - 1) // int(c * d / (gcd(c, d)))))) |
p03695 | s431147663 | Wrong Answer | N=int(input())
*A,=map(int,input().split())
s=list(map(lambda x: x//400, A))
mm=len(set([i for i in s if i<8]))
o=len([i for i in s if 8<=i]) # 色を変えられる人
print(min(mm,1),min(N,mm+o)) |
p02993 | s921977057 | Accepted | S=input()
a=(str(S)[0])
b=(str(S)[1])
c=(str(S)[2])
d=(str(S)[3])
if(int(a)==int(b)):
print("Bad")
elif(int(b)==int(c)):
print("Bad")
elif(int(c)==int(d)):
print("Bad")
else:
print("Good") |
p02996 | s373694792 | Accepted | def main():
N = int(input())
A = []
for _ in range(N):
a, b = map(int, input().split())
A.append(tuple([b,a]))
A.sort()
total = 0
for a, b in A:
total+=b
if a < total:
print('No')
return
print('Yes')
main() |
p03910 | s094254006 | Accepted | n = int(input())
a = []
m = 0
for i in range(n):
if m >= n: break
a.append(i+1)
m += i+1
if m == n:
print(*a)
else:
a.remove(m-n)
print(*a)
|
p03067 | s906075187 | Accepted | #!/usr/bin/env python3
import sys
def input():
return sys.stdin.readline()[:-1]
def main():
A, B, C = map(int, input().split())
if A < C < B:
print('Yes')
elif B < C < A:
print('Yes')
else:
print('No')
if __name__ == '__main__':
main()
|
p02862 | s572661713 | Accepted | import math
x,y = map(int,input().split())
mod = pow(10,9)+7
if (2*x-y)% 3 != 0 or (2*y-x)% 3 != 0 or ((2 * y - x) / 3 < 0) or ((2 * x - y) / 3 < 0):
print(0)
else:
n = int((2 * y - x) / 3)
m = int((2 * x - y) / 3)
P = [1]*(n + m + 1)
for i in range(1, n+m+1):
P[i] = P[i-1]*i
P[i] %= mod
print((P[n+m]*pow(P[n],mod-2,mod)*pow(P[m],mod-2,mod)) % mod) |
p02796 | s806385640 | Wrong Answer | from operator import itemgetter
n = int(input())
ans = n
A = []
for i in range(n):
x, l = [int(i) for i in input().split()]
A.append([x-l, x+l])
A = sorted(A, key = itemgetter(0))
cur_end = A[0][1]
for i in range(n-1):
if cur_end > A[i+1][0]:
ans -= 1
cur_end = min(A[i+1][1], cur_end)
print(ans) |
p02880 | s246562622 | Accepted | n = int(input())
print("Yes" if sum([n == x * y for x in range(1, 10) for y in range(1, 10)]) else "No") |
p03862 | s908411506 | Wrong Answer | n,x = list(map(int,input().split()))
a = list(map(int,input().split()))
op=0
for i in range(len(a)-1):
s = a[i]+a[i+1]
if (s < x):
continue
else:
diff = s - x
op += diff
a[i+1] -= diff
print(op) |
p02835 | s684131824 | Accepted | a,b,c = map(int,input().split())
n = a + b + c
if n >= 22 : print("bust")
else:print("win") |
p03086 | s200276704 | Wrong Answer | S = list(input())
maxIndex = len(S)
result = 0
for index in range(len(S)):
counter = 0
for tmp in range(index, maxIndex):
if S[tmp] in ["A", "C", "G", "T"]:
counter += 1
if tmp == maxIndex:
if counter > result:
result = counter
break
continue
if counter > result:
result = counter
break
if result == maxIndex: break
print(result) |
p03910 | s554534995 | Accepted | import math
N = int(input())
ans = int((-1+math.sqrt(1+8*N))/2)
if (ans*(ans+1))//2<N:
ans += 1
k = (ans*(ans+1))//2-N
if k == 0:
for i in range(ans):
print(i+1)
else:
for i in range(ans):
if i+1 != k:
print(i+1) |
p03219 | s862652222 | Accepted | X, Y = map(int, input().split())
print(int(X+(Y/2))) |
p02621 | s459547204 | Accepted | #
import sys
input=sys.stdin.readline
def main():
a=int(input())
print(a+a**2+a**3)
if __name__=="__main__":
main()
|
p03011 | s227075519 | Wrong Answer | p,q,r=map(int,input().split())
if p+q<q+r and p+q<p+r:
print(p+q)
if p+r<p+q and p+r<q+r:
print(p+r)
if q+r<p+r and q+r<p+q:
print(q+r)
if p+r==q+r and p+r<p+q:
print(p+r)
if p+q==q+r and p+q<p+r:
print(p+q)
if r+q==p+r and r+q<p+q:
print(r+q)
if p==q==r:
print(p+q) |
p02759 | s086153922 | Wrong Answer | N=int(input())
print(N//2+1)
|
p04005 | s338853621 | Wrong Answer | import math
x, y, z = list(map(int, input().split()))
print(x*y*math.ceil(z/2) - x*y*math.floor(z/2)) |
p02832 | s526015904 | Wrong Answer | N = int(input())
Ar =list(map(int,input().split()))
cnt=1
for i in range(N):
if Ar[i]==cnt:
cnt+=1
print(N-cnt+1) |
p02793 | s592481696 | Accepted | from fractions import gcd
from functools import reduce
n = int(input())
lst = list(map(int, input().split()))
ans = 0
mod = 10**9+7
lcd = reduce(lambda x,y : x*y//gcd(x,y), lst)
for i in lst:
ans += lcd//i
print(ans%mod)
|
p03657 | s059189083 | Accepted | def resolve():
a, b = map(int, input().split())
ans = str()
if a % 3 == 0 or b % 3 == 0 or (a+b) % 3 == 0:
ans = "Possible"
else:
ans = "Impossible"
print(ans)
resolve() |
p02860 | s911008401 | Accepted | n = int(input())
s = input()
def judge(s):
if len(s) % 2 == 1:
print("No")
return
for i in range(0, len(s)//2):
if(s[i] != s[len(s)//2 + i]):
print("No")
return
print("Yes")
return
judge(s) |
p03136 | s562916582 | Accepted | n = int(input())
l = sorted(list(map(int, input().split())), reverse=True)
cnt = 0
for i in l[1:]:
cnt += i
if cnt > l[0]:
print('Yes')
else:
print('No') |
p03827 | s339810214 | Accepted | N = int(input())
S = str(input())
M = 0
Sum = 0
for x in S:
if x == 'I':
Sum += 1
else:
Sum -= 1
M = max(M, Sum)
print(M)
|
p03796 | s966937368 | Accepted | N = int(input())
ans = 1
for i in range(1,N+1):
ans *= i
if ans > 10**9 + 7:
ans %= 10**9 + 7
print(ans) |
p02628 | s361284284 | Accepted | N, K = map(int, input().split())
fruits = map(int, input().split())
print(sum(sorted(fruits)[:K])) |
p02773 | s158039364 | Wrong Answer | import collections
count = input()
l = []
for i in range(int(count)):
l.append(input())
c = collections.Counter(l)
#print(l)
#print(c)
#print(c.most_common()[0][1])
max_count = c.most_common()[0][1]
for i in c.most_common():
if i[1] != max_count:
exit()
print(i[0])
|
p02814 | s415753878 | Accepted | from math import gcd
N, M = map(int, input().split())
A = list(map(int, input().split()))
B = [a//2 for a in A]
LCM = 1
for i in range(N):
LCM = LCM * B[i] // gcd(LCM, B[i])
for i in range(N):
if LCM // B[i] % 2 == 0:
print(0)
exit()
print((M//LCM + 1)//2) |
p02963 | s730930184 | Accepted | S=int(input())
X1=0
Y1=0
X2=10**9
Y2=1
X3=-S%X2
Y3=(X3+S)//X2
ans=[X1,Y1,X2,Y2,X3,Y3]
print(*ans) |
p02678 | s213480943 | Accepted | import queue
from collections import defaultdict
n,m = map(int,input().split())
g = defaultdict(set)
ans = [0]*n
for _ in range(m):
a,b = map(int,input().split())
a -= 1
b -= 1
g[a].add(b)
g[b].add(a)
visited = [False]*n
visited[0] = True
q = queue.Queue()
q.put(0)
while not q.empty():
v = q.get()
for p in g[v]:
if not visited[p]:
ans[p] = v
q.put(p)
visited[p] = True
print('Yes')
for x in ans[1:]:
print(x+1) |
p03472 | s475815685 | Accepted | n,h,*d=map(int,open(0).read().split());a=max(d[::2]);b=sorted(d[1::2]);c=0
while b and(h>0)*(b[-1]>a):h-=b.pop();c+=1
while b and b[-1]>a>0<h:h-=b.pop();c+=1
print(c-(-h//a)*(h>0)) |
p02699 | s139275937 | Accepted | S,W = map(int,input().split())
if (S > W):
print("safe")
else:
print("unsafe") |
p03077 | s514764773 | Wrong Answer | import math
n=int(input())
t=[int(input()) for i in range(5)]
ans=0
ans+=math.ceil(n/t[0])
time=math.ceil(n/t[0])
for i in range(4):
if t[i+1]>=t[i]:
ans+=1
else:
ans+=abs(math.ceil(n/t[i+1])-math.ceil(n/t[i]))+1
print(ans) |
p03254 | s811922833 | Accepted | n,x=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
count=0
if x<a[0]:
print(0)
exit()
for i in range(n):
if x>=a[i]:
x-=a[i]
count+=1
else:
print(count)
exit()
if x>0:
print(count-1)
else:
print(count) |
p03105 | s997156682 | Accepted | a,b,c = map(int,input().split())
if b//a >= c:
print(c)
else:
print(b//a)
|
p03487 | s730417851 | Accepted | from collections import Counter
n=int(input())
a=list(map(int,input().split()))
b=Counter(a)
count=0
for i in b:
if b[i]<i:
count+=b[i]
else:
count+=(b[i]-i)
print(count) |
p02888 | s478353215 | Wrong Answer | N=int(input())
L=list(map(int,input().split()))
ans=0
c=[0]*2101
for i in L:c[i]+=1
for i in range(2100):c[i+1]=c[i]+c[i+1]
for i in range(N):
for j in range(N):
if i!=j:
l,r=abs(L[i]-L[j])+1,L[i]+L[j]
s=c[r]-c[l]
if l<=L[i] and L[i]<r:s-=1
if l<=L[j] and L[j]<r:s-=1
ans+=max(s,0)
print(ans//6) |
p02786 | s152576943 | Wrong Answer | h=int(input())
c=0
while h==0:
h==h//2
c=+1
print(c*2-1)
|
p02951 | s610315351 | Wrong Answer | a, b, c = (int(i) for i in input().split())
print(max(0, c - (b - c))) |
p03592 | s112825312 | Wrong Answer | n,m,k = map(int,input().split())
ans = 'No'
for i in range(m+1):
for j in range(n+1):
if i*n + j*m - i*j == k:
ans = 'Yes'
print(ans)
|
p02691 | s518691903 | Wrong Answer | n = int(input())
A = list(map(int, input().split()))
dic = {}
ans = 0
for i, a in enumerate(A):
L = i + a
if L not in dic:
dic[L] = 1
else:
dic[L] += 1
for j in range(n):
R = j - a
if R in dic:
ans += dic[R]
print(ans) |
p03210 | s409378034 | Accepted | n=int(input())
print(['NO','YES'][n==3 or n==5 or n==7]) |
p03131 | s902253022 | Accepted | import copy
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement
from math import floor, ceil, sqrt, factorial, log
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict
from heapq import heappop, heappush, heappushpop
from itertools import product
import sys
stdin = sys.stdin
mod = 10**9 + 7
def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))
K, A, B = na()
if B - A > 1:
print(1 + (B - A) * ((K - A + 1) // 2) + (A - 1) + ((K - A + 1) % 2))
else:
print(1 + K)
|
p03861 | s120255343 | Accepted | a,b,x = map(int,input().split())
print(b//x -(a-1)//x) |
p02759 | s244426032 | Accepted | ans = 0
N = int(input())
if(N%2):
ans = N//2 +1
else:
ans = N//2
print(ans) |
p02957 | s151236937 | Wrong Answer | A,B = map(int,input().split())
k = (A + B) / 2
answer = 0
if A - k >= 0 and -B + k >=0 :
answer = 1
elif -A + k >=0 and B - k >= 0 :
answer = 1
if answer == 1 and (A + B) % 2 == 0 :
print(k)
else :
print("IMPOSSIBLE") |
p03657 | s662610711 | Accepted | A,B=map(int,input().split())
print("Impossible" if (A+B)%3!=0 and A%3!=0 and B%3!=0 else "Possible") |
p03035 | s688739578 | Wrong Answer | A,B=map(int,input().split())
if A<=5:
print(0)
elif A>=6 and A<=12:
print(B/2)
elif A>=13:
print(B) |
p03317 | s137860752 | Wrong Answer | x, y = map(int,input().split())
li = list(map(int,input().split()))
a = li.index(1) #1より前にある数
b = x-1-a #1より後にある数
if a%(y-1) == 0 and b%(y-1) == 0:
print(a//(y-1)+b//(y-1))
elif a%(y-1) == 0 or b%(y-1) == 0:
print(a//(y-1)+b//(y-1)+1)
else:
print(a//(y-1)+b//(y-1)+2) |
p03637 | s236562236 | Accepted | N = int(input())
n = list(map(int, input().split()))
n4 = len(list(filter(lambda x: x % 4 == 0, n)))
no = len(list(filter(lambda x: x % 2 == 1, n)))
if n4 + no < N:
no += 1
if no <= n4 + 1:
print('Yes')
else:
print('No')
|
p03324 | s140439393 | Accepted | d,n = map(int,input().split())
ans = n * 100**d
if n == 100:
ans += 100**d
print(ans) |
p03479 | s424814100 | Wrong Answer | import math
X, Y = map(int, input().split())
print(int(math.log2(Y/X))+1) |
p02818 | s356248996 | Accepted | a, b, k = map(int, input().split())
if k > a + b:
ans_a = 0
ans_b = 0
elif a >= k:
ans_a = a - k
ans_b = b
else:
ans_a = 0
ans_b = b - (k - a)
print(ans_a, ans_b)
|
p03705 | s703677008 | Wrong Answer | n,a,b = map(int,input().split())
k = a - b + 2 + n
ans = 1
for i in range(n):
ans *= (k-i)
for i in range(n):
ans = ans//(n-i)
print(ans)
|
p03011 | s108710950 | Accepted | A=list(map(int,input().split()))
print(min(A[0]+A[1],A[1]+A[2],A[2]+A[0])) |
p03105 | s778036170 | Accepted | a,b,c = map(int,input().split())
print(c if a*c<=b else b//a) |
p03077 | s242371254 | Accepted | import math
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
x = min(a, b, c, d, e)
print(int(math.ceil(n/x) + 4))
|
p04011 | s760842492 | Accepted | n = int(input())
k = int(input())
x = int(input())
y = int(input())
ans = x * min(n, k) + y * max(0, n-k)
print(ans) |
p03759 | s706718720 | Wrong Answer | a,b,c=map(int,input().split());print('YNEOS'[a+c!=b::2]) |
p02691 | s854931422 | Wrong Answer | n=int(input())
li = list(map(int,input().split()))
a=0
for i in range(n):
for j in range(n):
if li[i] + li[j] and abs(i-j):
a+=1
print(a/2) |
p03387 | s606923143 | Accepted | a,b,c = map(int, input().split())
sum = (a+b+c)
if a == b == c:
print(0)
exit()
else:
for i in range(max(a,b,c)*3, 200, 3):
if (i - sum) % 2 == 0:
print((i - sum)//2)
exit() |
p02996 | s344426718 | Accepted | import sys
import math
N = int(input())
timelis = []
for _ in range(N):
A,B = map(int, input().split())
timelis.append([A,B])
timelis = sorted(timelis,key=lambda x: x[1])
sum_time = 0
for i in timelis:
need = i[0]
deadline = i[1]
sum_time = sum_time + need
if sum_time > deadline:
print("No")
sys.exit()
print("Yes")
|
p03639 | s405865270 | Accepted | n = int(input())
a = list(map(int, input().split()))
odd, four = 0, 0
for x in a:
if x % 2 == 1:
odd += 1
if x % 4 == 0:
four += 1
two = n - odd - four
if two > 0:
odd += 1
if four + 1 >= odd:
print('Yes')
else:
print('No') |
p02572 | s077736435 | Accepted | def li():
return [int(x) for x in input().split()]
N = int(input())
A = li()
d = 10**9 + 7
B = [A[i] % d for i in range(len(A))]
s = 0
s2 = 0
for i in range(len(B)):
s += B[i]
s = s
s2 += B[i] ** 2
s2 = s2
ans = ((s**2 - s2) // 2) % d
print(ans) |
p03720 | s660407913 | Wrong Answer | n, m = map(int, input().split())
ll = [0] + [ 0 for _ in range(n)]
for i in range(m):
a, b = map(int, input().split())
ll[a] += 1
ll[b] += 1
for l in ll[1:]:
print()
|
p03385 | s134613635 | Accepted | def main():
s = list(input())
if set(s) == {"a", "b", "c"}:
print("Yes")
else:
print("No")
if __name__ == "__main__":
main()
|
p02802 | s811124985 | Wrong Answer | import collections
import sys
N,M = map(int,input().split())
P = []
S = []
for i in range(M):
p, s = map(str, input().split())
P.append(int(p))
S.append(s)
if M == 0:
print(0,0)
sys.exit()
c = collections.Counter(P)
values, counts = zip(*c.most_common())
result = [0]*len(values)
penalty = 0
d = dict(zip(values,result))
for i in range(M):
if S[i] == 'WA' and d[P[i]] == 0:
penalty += 1
elif S[i] == 'AC':
d[P[i]] = 1
sum = 0
for i in values:
sum += d[i]
print(sum,penalty)
|
p03000 | s500304507 | Accepted | n, x = map(int, input().split())
l = list(map(int, input().split()))
L = [0]
a = 0;b = 0
for i in l:
a += i
L.append(a)
for j in L:
if j<=x:
b += 1
print(b)
|
p03017 | s709618955 | Wrong Answer | N,A,B,C,D = map(int,input().split())
S = ['#']+list(input())
CanReach = True
CanChange = False
for i in range(A,C):
if S[i] == '#' and S[i+1] == '#':
Canreach = False
for i in range(B,D):
if S[i] == '#' and S[i+1] == '#':
Canreach = False
if C < D:
CanChange = True
for i in range(B,D-1):
if S[i] == '.' and S[i+1] == '.' and S[i+2] == '.':
CanChange = True
if CanReach and CanChange:
print('Yes')
else:
print('No') |
p03086 | s488897409 | Wrong Answer | S=input()
flag =0
ans =0
for i in range(len(S)):
for j in range(len(S)-i):
if S[i+j] == 'A' or S[i+j] == 'G' or S[i+j] == 'T' or S[i+j] == 'C':
flag +=1
else:
ans = max(ans,flag)
flag =0
break
print(ans) |
p02727 | s509949481 | Wrong Answer | x,y, a, b, c= map(int,input().split())
red = list(map(int,input().split()))
green = list(map(int,input().split()))
trans = list(map(int,input().split()))
fr = sorted(red, reverse= True)
fg = sorted(green, reverse= True)
candidate = fr + fg + trans
candidate = sorted(candidate, reverse= True)
candidate = candidate[:x+y]
print(sum(candidate))
|
p02642 | s754332728 | Wrong Answer | from collections import Counter
def undivisible(A):
m = max(A)
dp = [True] * (m+1)
A.sort()
for a in A:
if dp[a]:
k = a * 2
while k <= m:
dp[k] = False
k += a
cnt = Counter(A)
ans = 0
for a in A:
if dp[a] and cnt[a] == 1:
ans += 1
return ans
n = int(input())
A = list(map(int, input().split()))
undivisible(A)
|
p03625 | s708080211 | Accepted | def resolve():
n = int(input())
a = list(map(int, input().split()))
t = dict()
for i in a:
if t.get(i):
t[i] += 1
else:
t[i] = 1
a, b = 0, 0
for k in t:
if t[k] >= 4:
a = max(a, k)
b = max(b, k)
elif t[k] >= 2:
if k > a:
b = a
a = k
print(a*b)
resolve() |
p02795 | s380135424 | Accepted | H = int(input())
W = int(input())
N = int(input())
max_h_w = max([H, W])
min_h_w = max([H, W])
count = 0
for i in range(min_h_w):
N -= max_h_w
count += 1
if N <= 0:
break
print(count) |
p02951 | s991579172 | Wrong Answer | A, B, C = map(int, input().split())
print(C - (A-B) ) |
p02963 | s589531653 | Wrong Answer | s = int(input())
print(0,0,10**9,1,s//(10**9),s%(10**9)) |
p03352 | s521663723 | Accepted | import math
x = int(input())
L = []
for i in range(2,int(math.floor(math.sqrt(x)))+1):
for j in range(x//i + 1):
if i ** j <= x:
L.append(i ** j)
if L == []:
print("1")
else:
print(max(L))
|
p03524 | s942223599 | Accepted | from collections import Counter
S=input()
d = {'a':0,'b':0,'c':0}
for i in S:
d[i] += 1
if max(d.values())-min(d.values()) <=1:
print('YES')
else:
print('NO') |
p03986 | s572526462 | Wrong Answer | X = input()
for i in range(len(X)):
if X[i] == "S":
ans = i * 2
break
for i in range(len(X)):
if X[-1 -i] == "T":
ans = max(ans, i * 2)
break
print(ans) |
p02796 | s515750411 | Wrong Answer | s=int(input())
t=[]
for i in range(s):
u,l=map(int,input().split())
t.append((u-l,u+l-1))
t.sort(key=lambda x: x[1])
d=-10*10
ans=0
for i in range(s):
if d<t[i][0]:
ans+=1
d=t[i][1]
print(ans)
|
p02601 | s600928457 | Accepted | #X = int(input())
#S = str(input())
A, B, C = map(int, input().split())
#C = list(map(int, input().split()))
ans = 0
while A >= B:
B *= 2
ans += 1
#print(A, B, C, ans)
while B >= C:
C *= 2
ans += 1
K = int(input())
#print(ans)
if ans <= K:
print("Yes")
else:
print("No")
|
p02957 | s700455622 | Wrong Answer | A,B=map(int,input().split())
if (A+B)%2==0:
print(A+B//2)
else:
print('IMPOSSIBLE') |
p02888 | s323067127 | Accepted | from bisect import bisect_left,bisect_right
n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
for i in range(n-2):
for j in range(i+1,n-1):
bc=l[i]+l[j]
idx=bisect_left(l,bc)
ans+=idx-j-1
print(ans)
|
p02582 | s235869433 | Accepted | S=input()
if S=="RRR":
print(3)
elif S=="RRS" or S=="SRR":
print(2)
elif S.count("R")>0:
print(1)
else:
print(0)
|
p04011 | s292582739 | Accepted | n=int(input())
k=int(input())
x=int(input())
y=int(input())
if n>=k:
b=n-k
print(k*x+b*y)
else:
print(n*x) |
p03017 | s877055517 | Accepted | n,a,b,c,d=map(int,input().split())
s=input()
print('YNeos'['##' in s[a-1:max(c,d)] or not(c<d or '...' in s[b-2:d+1])::2]) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.