problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p03555 | s840429859 | Accepted | a=input()
b=input()
c=''
for i in range(3):
c+=a[2-i]
if(c==b):
print("YES")
else:
print("NO")
|
p02601 | s800818810 | Wrong Answer | array = list(map(int, input().split(' ')))
K = int(input())
for i in range(K):
if array[2] == max(array):
if array[0] > array[1]:
array[1] = array[1] * 2
else:
array[0] = array [0] * 2
else:
array[2] = array[2] * 2
if array[0] < array[1] and array[1] < array[2]:
print('Yes')
else:
print('No') |
p02792 | s677058185 | Wrong Answer | N=int(input())
c=[[0]*10]*10
for n in range(1,N+1):
c[int(str(n)[0])][int(str(n)[-1])]+=1
sum=0
for i in range(10):
for j in range(10):
sum+=c[i][j]*c[j][i]
print(sum)
|
p02801 | s002660000 | Wrong Answer | a=input()
print('chr(ord(a)+1)')
|
p03494 | s742947915 | Wrong Answer | l = list(map(int,input().split()))
cnt = 0
while True:
if len([i for i in l if i%2 == 1]) == 0:
cnt += 1
l = [int(s/2) for s in l]
else:
break
print(cnt) |
p03673 | s507148266 | Accepted | from collections import deque
n = int(input())
a = list(map(str, input().split()))
b = deque()
if n%2:
flag = False
else:
flag = True
for i in range(n):
if flag:
if (i+1)%2:
b.append(a[i])
else:
b.appendleft(a[i])
else:
if (i+1)%2:
b.appendleft(a[i])
else:
b.append(a[i])
res = list(b)
print(' '.join(res)) |
p03377 | s475041761 | Accepted | A, B, X = map(int, input().split())
if (X >= A and X <= A + B):
print("YES")
else:
print("NO")
|
p02900 | s367816558 | Accepted | import math
from fractions import gcd
a, b = map(int, input().split())
g = gcd(a, b)
sqrt = math.floor(g ** 0.5)
factors = [1]
z = g
for i in range(2, sqrt + 1):
if not z % i:
factors.append(i)
while z % i == 0:
z //= i
if z > 1:
factors.append(z)
print(len(factors)) |
p02718 | s712596984 | Accepted | import math
n,m = map(int,input().split())
li = list(map(int,input().split()))
wa = 0
for i in li :
wa+=i
for i in li :
if i < math.ceil((wa/float(4*m))) :
n -= 1
if n>=m:
print("Yes")
else:
print("No")
|
p03324 | s644376339 | Accepted | x, y = map(int, input().split())
if x == 0:
if y == 100:
print(101)
else:
print(y)
elif x == 1:
if y == 100:
print(10100)
else:
print(y*100)
else:
if y == 100:
print(1010000)
else:
print(y*10000)
|
p02608 | s802741218 | Wrong Answer | n = int(input())
result_list = [0] * n
half = int(n/2)
for x in range(1, half):
for y in range(1, half):
for z in range(1, half):
calculated_n = x**2 + y**2 + z**2 + x*y + y*z + z*x
if calculated_n <= n+1:
result_list[calculated_n-1] += 1
print(result_list) |
p02696 | s017017542 | Accepted | # coding: utf-8
A, B, N = map(int, input().split())
num = min(B-1, N)
print(A * num // B - A * (num // B)) |
p02917 | s453141668 | Accepted |
N= int(input())
B = list(map(int,input().split()))
A = [0]*N
A[0] = B[0]
for i in range(len(A)-2):
A[i+1] = min(B[i],B[i+1])
A[-1] = B[-1]
#print(A)
print(sum(A)) |
p03838 | s236831216 | Accepted | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
x, y = map(int, read().split())
def f(x, y):
# + のみ
if x <= y:
yield y - x
# 反転、+
if -x <= y:
yield 1 + x + y
# +、反転
if x <= -y:
yield 1 - x - y
# 反転、+、反転
if -x <= -y:
yield 2 - y + x
x = min(f(x, y))
print(x) |
p03795 | s136357929 | Accepted | n=int(input())
print(800*n-200*(n//15)) |
p03761 | s482083828 | Accepted | def intersect_list(lst1, lst2):
arr = []
lst = lst1.copy()
for element in lst2:
try:
lst.remove(element)
except ValueError:
pass
else:
arr.append(element)
return arr
n = int(input())
a0 = list(input())
for i in range(n-1):
a = list(input())
a0 = intersect_list(a0, a)
print("".join(sorted(a0))) |
p03943 | s272526568 | Wrong Answer | a, b, c = map(int, input().split())
if a + b == c or a + c == b or b + c ==a:
print("YES") |
p03077 | s838376709 | Wrong Answer | n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
m = min(a,b,c,d,e)
if n%m!=0:
t = n//m +5
else:
t = n/m +4
print(t) |
p02613 | s385117953 | Accepted | def main():
n = int(input())
d = {}
for _ in range(n):
s = input()
d[s] = d.get(s, 0) + 1
print('AC x ' + str(d.get('AC', 0)))
print('WA x ' + str(d.get('WA', 0)))
print('TLE x ' + str(d.get('TLE', 0)))
print('RE x ' + str(d.get('RE', 0)))
if __name__ == '__main__':
main() |
p03657 | s630960622 | Accepted | A, B = list(map(int,input().split()))
if A%3 == 0 or B%3 == 0 or (A+B)%3 == 0:
print('Possible')
else:
print('Impossible') |
p03086 | s894065993 | Wrong Answer | s = input()
ACGT = ["A","C","G","T"]
ans = 0
ANS = [0]
for i in range(len(s)):
if s[i] in ACGT:
ans += 1
else:
ANS.append(ans)
ans = 0
print(max(ANS)) |
p03250 | s866658477 | Accepted | A,B,C = sorted(map(int, input().split()))
print(A+B+C*10) |
p02847 | s729128176 | Wrong Answer | s = input()
if s =='SUN':
print(7)
elif s == 'SAT':
print(1)
elif s == 'FRI':
print(2)
elif s == 'THU':
print(3)
elif s == 'WED':
print(4)
elif s == 'TUS':
print(5)
elif s == 'MON':
print(6) |
p04005 | s995007645 | Accepted | a,b,c=map(int,input().split())
if a%2==0 or b%2==0 or c%2==0:
print(0)
else:
x=[a,b,c]
x.sort()
print(x[0]*x[1]) |
p03665 | s350527831 | Accepted | a, b = map(int, input().split())
c = [int(i)&1 for i in input().split()]
odd = sum(c)
val = 0
if odd:
val = 2**(a-1)
else:
val = 2**a*(1-b)
print(val) |
p03210 | s437625882 | Accepted | x=int(input())
ans=["NO","YES"][x==7 or x==5 or x==3]
print(ans) |
p03103 | s644237284 | Wrong Answer | N, M = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N)]
AB.sort()
ans = 0
for i in range(N):
#まだ足りないケース
if M > AB[i][1]:
ans += AB[i][0] * AB[i][1]
M -= AB[i][1]
else:
ans += AB[i][0] * M
print(ans) |
p02622 | s242090662 | Accepted | S=input()
T=input()
c=0
for i in range(len(S)):
if S[i] != T[i]:
c+=1
print(c) |
p02820 | s727231960 | Accepted | n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()
score = 0
def rsp(hand: str) -> int:
if hand == 'r':
return p
elif hand == 's':
return r
else:
return s
for i in range(k):
score += rsp(t[i])
twice = True
for j in range(i+k, n, k):
if t[j] == t[j-k]:
if twice:
twice = False
else:
twice = True
score += rsp(t[j])
else:
twice = True
score += rsp(t[j])
print(score) |
p02718 | s234555720 | Wrong Answer | (n, m) = [int(s) for s in input().split()]
a = [int(s) for s in input().split()]
t = sum(a)
a = sorted(a)
chosen = a[-m:]
r = 1 / (4 * m) * t
c = ['Yes' if a >= r else 'No' for a in chosen]
c = set(c)
ans = 'Yes' if len(c) == 1 else 'No'
print(ans)
|
p02847 | s205209567 | Accepted | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
S = sr()
day = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']
day = day[::-1]
i = day.index(S)
print((i+1))
|
p02613 | s267795866 | Accepted | n = int(input())
l = []
i = 1
while i<=n:
a = input()
l.append(a)
i+=1
print("AC x "+ str(l.count("AC")))
print("WA x "+ str(l.count("WA")))
print("TLE x "+ str(l.count("TLE")))
print("RE x "+ str(l.count("RE"))) |
p02553 | s431301157 | Accepted | a,b,c,d = map(int, input().split())
print(max(a*c,a*d,b*c,b*d)) |
p02684 | s582535976 | Wrong Answer | N, K = map(int, input().split())
A = list(map(int, input().split()))
r = [0]*N
now = 0
r[now]=1
for i in range(N):
now = A[now]-1
if r[now] == 0:
r[now] = i+2
else:
x1 = r[now]
x2 = i+1
break
print(x1, x2)
print(r)
roop_num = x2 - x1 + 1
x = (K-x1+1) % roop_num
print(x)
if K < x1:
print(r.index(K+1)+1)
else:
print(r.index(x1 + x)+1)
|
p02546 | s955101719 | Accepted | s = input()
if s[-1] == "s":
print(s + "es")
else:
print(s+"s") |
p03592 | s494823357 | Accepted | n, m, k = map(int, input().split())
for i in range(n + 1):
for j in range(m + 1):
if i * (m - j) + j *(n - i) == k:
print("Yes")
break
else:
continue
break
else:
print("No") |
p03127 | s059556444 | Accepted | import numpy as np
n = int(input())
a = list(map(int,input().split()))
ans = a[0]
for i in range(1,len(a)):
ans = np.gcd(a[i],ans)
print(ans) |
p03474 | s786522070 | Accepted | a, b = map(int,input().split())
s = input()
if len(s) == a + b + 1 and s[a] == '-' and s.count('-') ==1:
print('Yes')
else:
print('No') |
p03815 | s649106698 | Accepted | x = int(input())
ans = (x // 11) * 2
if x % 11 > 6:
ans += 2
elif x % 11 > 0:
ans += 1
print(ans) |
p02630 | s340920540 | Wrong Answer | n=int(input())
a=list(map(int,input().split()))
ans=sum(a)
q=int(input())
dp=[0]*(10**5+1)
for i in range(1,10**5+1):
dp[i]=a.count(i)
for j in range(min(q,1000)):
b,c=map(int,input().split())
ans+=(c-b)*dp[b]
dp[c]+=dp[b]
dp[b]=0
print(ans) |
p02832 | s095260581 | Wrong Answer | N = int(input())
a = list(map(int,input().split()))
BS = 1
for i in range(N):
if a[i] == BS:
BS += 1
if a[i] == 1:
print(-1)
else:
print(N+1-BS) |
p02641 | s983362018 | Wrong Answer | X,N = map(int,input().split())
P = list(map(int,input().split()))
result = 0
if N == 0:
result = X
else:
list = [i for i in range(101)]
for i in P:
list.remove(i)
if len(list) == 0:
result = 0
else:
min = 100
for i in list:
if min > abs(X-i):
min = abs(X - i)
result = i
print(result) |
p04034 | s637233040 | Accepted | n, m = map(int, input().split())
red = [1] + [0] * (n - 1)
num = [1] * n
for i in range(m):
x, y = map(int, input().split())
if red[x - 1] == 1:
red[y - 1] = 1
if num[x - 1] == 1:
red[x - 1] = 0
num[x - 1] -= 1
num[y - 1] += 1
print(sum(red)) |
p02922 | s254473701 | Accepted | a,b = map(int, input().split())
i = a
c = 1
while int(i) < int(b):
i += int(a) - 1
c += 1
if int(b) == 1:
print(0)
else:
print(c) |
p02783 | s478148494 | Wrong Answer | h,a=map(int,input().split())
x=h//a
print(x+1)
|
p02678 | s766384449 | Accepted | n, m = map(int, input().split())
to = [[] for i in range(n + 1)]
for i in range(m):
a, b = map(int, input().split())
to[a].append(b)
to[b].append(a)
ans = [-1] * (n+1)
import collections
q = collections.deque([1])
while q:
now = q.popleft()
for t in to[now]:
if ans[t] == -1:
q.append((t))
ans[t] = now
if (-1) in ans[2:]:
print('No')
else:
print('Yes')
for a in ans[2:]:
print(a)
|
p02719 | s888465627 | Wrong Answer | n,k = map(int,input().split())
left = 0
right = 10**19
while right - left >1:
middle = (right + left)//2
if middle < abs(middle - k) :
left = middle
else:
right = middle
if n == 0:
print(0)
elif k//n==2:
print(n)
elif n % k == 0:
print(0)
else:
print(min(left,abs(n-k),n)) |
p03264 | s913962420 | Accepted | def main():
k = int(input())
if k % 2:
res = (k // 2) * (k - k // 2)
else:
res = (k // 2) ** 2
print(res)
if __name__ == '__main__':
main() |
p02664 | s164540395 | Accepted | s = list(str(input()))
for i in range(len(s)):
if s[i] == '?':
s[i] = 'D'
print(''.join(s)) |
p02946 | s759971720 | Accepted | #!/usr/bin/env python3
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main():
K, X = map(int, readline().split())
print(*list(range(X - K + 1, X + K)))
if __name__ == '__main__':
main()
|
p02785 | s470531926 | Accepted | a,b = map(int,input().split())
arr = list(map(int,input().split()))
arr.sort(reverse = True)
if b>=a:
print(0)
else:
print(sum(arr[b:])) |
p02952 | s421470002 | Accepted | N = int(input())
ctr = 0
for i in range (1, N+1):
if (i>0 and i<10) or (i>99 and i<1000) or (i>9999 and i<100000):
ctr += 1
print(ctr) |
p03633 | s006129772 | Accepted | import fractions
N = int(input())
a = []
for _ in range(N):
a.append(int(input()))
ans = a[0]
for i in range(1, N):
ans = ans * a[i] // fractions.gcd(ans, a[i])
print(ans) |
p03796 | s005972648 | Accepted | n = int(input())
result = 1
limit = 10**9+7
for i in range(1, n+1):
result = result*i % limit
print(result)
|
p03243 | s220688473 | Accepted | # -*- coding: utf-8 -*-
#入力
N = int(input())
#処理
for i in range(N, 1000):
if i%111==0:
print(i)
break |
p03011 | s017029021 | Accepted | p,q,r = map(int, input().split())
print(p + q + r - max(p,q,r)) |
p03011 | s252821963 | Wrong Answer | n=list(map(int, input().strip().split()))
lis1=[]
for i in range(0,len(n)):
for a in range(0,len(n)):
if n[i]!=n[a]:
z=(int(n[a])+int(n[i]))
lis1.append(str(z))
minscore='9999999999'
for i in range(0,len(lis1)):
if float(minscore)>float(lis1[i]):
minscore=lis1[i]
print(minscore)
|
p03146 | s000071412 | Wrong Answer | def f(n):
if n%2 == 0:
return n//2
else:
return 3*n+1
s = int(input())
ans = 0
u = s
i = 1
t = [0]*1000010
t[0] = s
while 1:
i += 1
u = f(u)
if t[u]!=0:
ans = i
break
else:
t[u] = 1
print(ans) |
p03555 | s109516135 | Wrong Answer | c1 = list(input())
c2 = list(input())
if c1[0] == c2[-1] and c1[-1] == c2[0]:
print('Yes')
else:
print('No') |
p02618 | s293947299 | Wrong Answer | D = int(input())
for i in range(D):
print((i+1) % 26)
|
p02789 | s697487790 | Accepted | n,m=map(int,input().split())
print("Yes" if n==m else "No") |
p03434 | s868411726 | Wrong Answer | n = int(input())
l = sorted(map(int, input().split()))
a = 0
b = 0
for i in range(n):
if i % 2 == 0:
a += l.pop()
else:
b += l.pop()
print(a) |
p02719 | s668899944 | Wrong Answer | def abstract(a, b):
return abs(a - b)
N, K = [int(x) for x in input().split()]
A = N
min_temp = A
if N == 1 or K == 1:
print(0)
elif N == 0:
print(K)
elif N == 2 or K == 2:
print(2)
else:
while True:
min_temp = abstract(A, K)
if A < min_temp:
break
elif A == min_temp:
break
A = min_temp
print(A) |
p03416 | s750625561 | Accepted | A,B = map(int,input().split())
cnt = 0
for i in range(A,B+1):
a = str(i)
b = a[::-1]
if a==b:
cnt += 1
print(cnt) |
p03592 | s864849611 | Accepted | N,M,K = map(int,input().split())
ans = 'No'
for n in range(N+1):
for m in range(M+1):
tmp = ((N-n)*m + (M-m)*n)
if tmp==K:
ans = 'Yes'
print(ans) |
p02860 | s759625025 | Accepted | n = int(input())
s = input()
if n % 2 == 1:
print("No")
elif s[:n//2] == s[n//2:] :
print("Yes")
else:
print("No")
|
p02802 | s067907847 | Wrong Answer | N, M = map(int, input().split())
pS = []
for _ in range(M):
pS.append(input().split())
current = 0
penalty = 0
state = [False] * (N+1)
for i in pS:
if i[1] == "WA" and (not state[int(i[0])]):
penalty += 1
elif i[1] == "AC" and (not state[int(i[0])]):
current += 1
state[int(i[0])] = True
print(current, penalty)
|
p03254 | s751855428 | Accepted | #!/usr/bin/env python
# coding: utf-8
# In[17]:
N,x = map(int, input().split())
a = list(map(int, input().split()))
# In[18]:
a_sum = sum(a)
if a_sum == x:
print(N)
elif a_sum < x:
print(N-1)
else:
for i in range(N):
if x < sum(sorted(a, reverse=False)[:i+1]):
print(i)
break
# In[ ]:
|
p03131 | s645793161 | Accepted | K, A, B = map(int, input().split())
if B-A <= 2:
print(K+1)
exit(0)
if 1+(K-2) < A:
print(K+1)
exit(0)
exchange_times, last = divmod(K-(A-1), 2)
profit = B - A
ans = A + exchange_times * profit + last
print(ans)
|
p03524 | s593783172 | Wrong Answer | S = input()
from collections import Counter
C = Counter(S)
if len(C.keys()) == 1:
if sum(C.values()) >= 2:
print("NO")
else:
print("YES")
elif len(C.keys()) == 2:
if sum(C.values()) < 3:
print("YES")
else:
print("NO")
else:
print("YES")
|
p03387 | s302906997 | Accepted | a,b,c=sorted(list(map(int,input().split())))
ans=c-b
if (b-a)%2==0:
print(ans+(b-a)//2)
else:
print(ans+(b-a)//2+2) |
p02659 | s513289501 | Wrong Answer | #!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
# = input()
# = int(input())
a, b = map(float, input().split())
# = list(map(int, input().split()))
# = [int(input()) for i in range(N)]
#
# c = collections.Counter()
print(int(int(a) * b))
|
p02771 | s164432881 | Accepted | A, B, C = [int(i) for i in input().split()]
if A == B and A != C:
print("Yes")
elif B == C and B != A:
print("Yes")
elif A == C and A != B:
print("Yes")
else:
print("No") |
p03035 | s350499772 | Accepted | N,price = map(int, input().split())
if N >= 13:
print(price)
elif N >= 6:
print(price // 2)
else:
print("0") |
p02765 | s928313666 | Accepted | n,r=map(int,input().split())
if n>=10:
print(r)
else:
print(r+100*(10-n)) |
p02630 | s520310656 | Accepted | def main():
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
MAX = 10 ** 5
total = sum(A)
counts = [0] * (MAX + 1)
for v in A:
counts[v] += 1
for _ in range(Q):
B, C = list(map(int, input().split()))
diff = C - B
t = counts[B]
counts[B] = 0
counts[C] += t
total += diff * t
print(total)
if __name__ == "__main__":
main() |
p03625 | s021547474 | Accepted | import sys
n = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
ans = []
for i in range(0,n-1):
if(a[i]==a[i+1]):
ans.append(a[i])
if len(ans) <2:
print(0)
sys.exit()
if (ans[0]==ans[1] and ans[1]!=ans[2]):
print(ans[0]*ans[2])
sys.exit()
print(ans[0]*ans[1]) |
p03030 | s567938144 | Accepted | from collections import defaultdict
def main():
N = int(input())
restaurant = defaultdict(list)
for i in range(N):
tmp = input().split()
restaurant[tmp[0]].append((int(tmp[1]), i+1))
name_list = sorted(list(restaurant.keys()))
for n in name_list:
tmp = sorted(restaurant[n], key=lambda x: x[0], reverse=True)
for t in tmp:
print(t[1])
if __name__ == "__main__":
main()
|
p02754 | s751162428 | Accepted | n,a,b=map(int,input().split())
answer=0
if a==0:
answer=0
elif b==0:
answer=n
elif a==1 and b==1:
answer=n//2
else:
while n>a+b:
answer+=n//(a+b)*a
n-=n//(a+b)*(a+b)
if n>a:
answer+=a
else:
answer+=n
print(answer) |
p03324 | s576646458 | Accepted | d, n = map(int, input().split())
if n == 100:
n = 101
print(100**d * n) |
p02578 | s488288677 | Wrong Answer | N=int(input())
A=list(map(int,input().split()))
a=0
for i in range(N-1):
if (A[i+1]-A[i])>=0:
a=a+(A[i+1]-A[i])
else:
a=a
print(a) |
p02676 | s667024501 | Wrong Answer | k=int(input())
s=input()
if(len(s)<k):
print(s)
else:
print(s[:7]+"...") |
p03827 | s115739039 | Accepted | N = int(input())
S = input()
x = 0
a = []
for i in range(N):
if S[i] == 'I':
x += 1
else:
x -= 1
a.append(x)
a.append(0)
a = sorted(a)
ans = a[N]
print(ans) |
p03699 | s484993812 | Accepted | N,*S=map(int,open(0))
S.sort()
ans=sum(S)
i=0
if ans%10==0:
while i<N:
if S[i]%10>0:
ans-=S[i]
break
i+=1
if i==N:
print(0)
else:
print(ans) |
p03385 | s079327381 | Accepted | S = list(input())
if len(set(S)) == 3:
print('Yes')
else:
print('No') |
p02646 | s388181554 | Wrong Answer | a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
if (v-w)*t >= b-a:
print("YES")
else:
print("NO")
|
p02924 | s407703774 | Accepted | n=int(input())
print(n*(n-1)//2) |
p02765 | s127549891 | Accepted | n,r = map(int,input().split())
if n >= 10:
print(r)
else:
print(r+100*(10-n)) |
p02641 | s597962237 | Accepted | x, n = map(int, input().split())
if n == 0:
print(x)
else:
p = [int(_) for _ in input().split()]
for i in range(100):
if x-i not in p:
print(x-i)
break
if x+i not in p:
print(x+i)
break |
p03632 | s049543104 | Wrong Answer | a, b, c, d = map(int, input().split())
if (b < c) or (d < a):
print(0)
elif a <= c:
print(b - c)
else:
print(d - a)
|
p02911 | s426302589 | Accepted | n, k, q = map(int, input().split())
point = [k - q for _ in range(n)]
for _ in range(q):
a = int(input())
point[a - 1] += 1
for p in point:
if p <= 0:
print("No")
else:
print("Yes") |
p03163 | s549601130 | Wrong Answer | n,w=map(int,input().split())
dp=[-1]*(w+1)
dp[0]=0
for _ in range(n):
a,d=map(int,input().split())
for b in range(w,a-1,-1):
if dp[b-a]!=-1:
dp[b]=max(dp[b],d+dp[b-a])
print(dp[b]) |
p03281 | s922043894 | 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 count == 8 and i%2 != 0:
ans += 1
print(ans) |
p03659 | s702099789 | Wrong Answer | N=int(input())
A=list(map(int,input().split()))
X=sum(A)
for i in range(1,N):
A[i]+=A[i-1]
ans=1000000007
for i in range(N-1):
x=abs(X-2*A[i])
ans=min(ans,x)
print(ans)
|
p03910 | s549725954 | Accepted | N = int(input())
k = 1
while k * (k + 1) // 2 < N:
k += 1
ans = list(range(1, k+1))
v = k * (k + 1) // 2 - N
if v > 0:
ans.remove(v)
for i in ans:
print(i)
|
p03379 | s456384827 | Wrong Answer | import statistics
n=int(input())
x=list(map(int,input().split()))
x.sort()
for i in range(n):
a=x[:i]+x[i+1:]
print(a[n//2-1]) |
p02881 | s768355239 | Accepted | import math
n = int(input())
start = int(math.sqrt(n)+0.5)
l =[]
for i in range(1,start+1):
if n % i == 0:
a = i
b = n // i
l.append(a+b-2)
print(min(l)) |
p02783 | s019821737 | Accepted | def main():
h, a = map(int, input().split())
ans = 0
while h > 0:
h -= a
ans += 1
print(ans)
if __name__ == '__main__':
main()
|
p03252 | s347922123 | Accepted | from collections import Counter
s = Counter(input())
t = Counter(input())
sv = sorted(s.values())
tv = sorted(t.values())
if sv == tv:
print("Yes")
else:
print("No") |
p03625 | s376414542 | Accepted | import collections
N = int(input())
A = list(map(int, input().split()))
A = collections.Counter(A).most_common()
N = len(A)
ans = [0]
for i in range(N):
if A[i][1] >= 4:
ans.append(A[i][0]**2)
ref = []
for j in range(N):
if A[j][1] >= 2:
ref.append(A[j][0])
ref = sorted(ref)
if len(ref) >= 2:
ans.append(ref[-2]*ref[-1])
print(max(ans))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.