problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p02729 | s330458586 | Accepted | n, m = [int(x) for x in input().strip().split(" ")]
import math
def c(n, r):
if n <= 1:
return 0
return int(math.factorial(n) / (math.factorial(r) * math.factorial(n - r)))
print(c(n, 2) + c(m, 2))
|
p03605 | s608126831 | Accepted | n = int(input())
if n % 10 == 9 or n // 10 == 9:
print("Yes")
else:
print("No")
|
p02660 | s467090481 | Accepted | from collections import Counter
def factorization(n):
a=[]
for i in range(2,int(n**.5)+1):
while n%i==0:
n//=i
a.append(i)
if n!=1:
a.append(n)
return a
n=int(input())
A=factorization(n)
B=Counter(A)
count=0
for key,value in B.items():
for i in range(1,value+1):
if n%(key**i)==0:
count+=1
n//=(key**i)
else:break
print(count) |
p03796 | s506371650 | Accepted | from sys import stdin
import math
if __name__ == "__main__":
_in = [_.rstrip() for _ in stdin.readlines()]
N = int(_in[0]) # type:int
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
cnt = math.factorial(N)%(10**9+7)
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
print(cnt)
|
p02688 | s739425150 | Accepted | N, K = list(map(int, input().split()))
d = list()
d = [d + list(input().split()) for i in range(K * 2)]
print(N - len(set(sum(d[1::2], [])))) |
p03835 | s781782342 | Accepted | k, s = map(int, input().split())
ans = 0
for i in range(k + 1):
for j in range(i, k + 1):
if j <= s - i - j <= k:
l = s - i - j
if i == j == l:
ans += 1
elif i == j or j == l:
ans += 3
elif i != j != l:
ans += 6
print(ans) |
p03910 | s045687590 | Accepted | n = int(input())
if n == 1 or n == 2:
print(n)
exit()
now = 0
ans = []
for i in range(1, n):
now += i
ans.append(i)
if now >= n:
break
amari = now - n
for i in ans:
if i == amari:
continue
else:
print(i)
|
p02971 | s698859946 | Accepted | import sys
input = sys.stdin.readline
max_a = 0
big_a = 0
max_index = 0
n = int(input())
for i in range(n):
a = int(input())
if max_a < a:
max_index = i
big_a = max_a
max_a = a
elif max_a == a:
max_index = -1
elif big_a < a:
big_a = a
else:
continue
for i in range(n):
print([max_a, big_a][i == max_index]) |
p03481 | s288761587 | Accepted | x,y = map(int,input().split())
ans=1
tmp=x
for i in range(x,y+1):
if tmp*2>y:
break
tmp*=2
ans+=1
print(ans) |
p02601 | s276531523 | Wrong Answer | a,b,c=map(int,input().split())
k=int(input())
s=0
for i in range(4):
if b*(2**i)>a:
s=i
break
b*=2**s
t=0
for i in range(4):
if c*(2**i)>b:
t=i
break
if s+t>=k:
print("No")
else:
print("Yes") |
p03745 | s684475670 | Wrong Answer | n = int(input())
a = list(map(int,input().split()))
i = 2
ans = 0
while i<n:
if a[i-2]>=a[i-1] and a[i-1]<a[i]:
ans += 1
i += 2
elif a[i-2]<=a[i-1] and a[i-1]>a[i]:
ans += 1
i += 2
else:
i += 1
if i == n:
ans += 1
print(ans) |
p03592 | s419002794 | Wrong Answer | n, m, k = map(int, input().split())
for i in range(n):
for j in range(m):
if i*m+j*n-2*(i*j) == k:
print('Yes')
exit()
else:
print('No')
|
p02989 | s308955856 | Accepted | n = int(input())
dl = list(map(int,input().split()))
dl.sort()
if n % 2 != 0:
print(0)
exit()
left = dl[(n//2)-1]
right = dl[(n//2)]
print(right-left)
|
p02576 | s739639013 | Wrong Answer | N,T,X = map(int,input().split())
if N % X == 0:
print(T*N//X)
else:
print(T*(N//X+1)) |
p03251 | s200090667 | Accepted | n,m,X,Y=map(int,input().split())
x=max(X,max(map(int,input().split())))
y=min(Y,min(map(int,input().split())))
print(["War","No War"][x<y]) |
p02708 | s468400881 | Wrong Answer | # coding: utf-8
# Your code here!
line= list(map(int,input().split()))
N = line[0]
K = line[1]
#0~Nの連続した整数から
#kこ以上選ぶ
answer = 0
for i in range (K,N+2):
minit = i*(i-1)/2
maximum = (2*N-i+1)*i/2
num = maximum-minit+1
answer += num
print(int(answer))
|
p03773 | s562518550 | Wrong Answer | S_list = list(map(int,input("入力:").split()))
ans = S_list[0] + S_list[1]
if ans <24 :
result = ans
else:
result = ans - 24
print(result) |
p03475 | s020544101 | Wrong Answer | n=int(input())
a=[list(map(int,input().split())) for _ in range(n-1)]
ans=[]
for i in range(n-1):
now=a[i][0]+a[i][1]
for j in range(i+1,n-1):
c,s,f=a[j]
if s==now:
d=0
elif s>now:
d=s-now
else:
d=now%f
now+=c+d
ans+=[now]
ans+=[0]
print(*ans,sep="\n") |
p02917 | s638408580 | Wrong Answer | N = int(input())
B = list(map(int,input().split()))
for i in range(N-2):
if(B[i]>B[i+1]):
B[i] = B[i+1]
ans = B[0]
for i in B:
ans += i
print(ans)
|
p02578 | s711960821 | Accepted | s = int(input())
arr = list(map(int, input().split()))
ans = 0
for i in range(1,s):
if arr[i] < arr[i-1]:
ans += (arr[i-1]-arr[i])
arr[i] = arr[i-1]
print(ans)
|
p03107 | s320129356 | Accepted | s = input()
z = s.count('0')
o = s.count('1')
print(min(z,o)*2) |
p02597 | s096206347 | Accepted | n=int(input())
c=str(input())
c=list(c)
t1=[0]*n
t2=[0]*n
for i in range(len(c)):
if c[i]=="R":
t1[i]=1
else:
t2[i]=1
if sum(t1)==len(c) or sum(t2)==len(c):
print(0)
else:
ans=0
t=sum(t1)
for i in range(n):
if t2[i]==1:
ans=ans+1
t=t-1
if t1[i]==1:
t=t-1
if t==0:
break
print(ans) |
p02595 | s694779763 | Accepted | N, D = map(int, input().split())
D2 = D**2
count = 0
for i in range(N):
X, Y = map(int, input().split())
if (X**2 + Y**2 <= D2):
count += 1
print(count) |
p02603 | s456967307 | Wrong Answer | import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
dp = [0]*(N+1)
dp[0] = 1000
for i in range(N):
for j in range(i):
dp[i+1] = max(dp[i+1], dp[j]%A[j]+dp[j]//A[j]*A[i])
print(max(dp)) |
p02765 | s785802010 | Accepted | n,r = map(int, input().split())
if n < 10:
k = 100*(10-n)
s = r + k
else:
s = r
print(s) |
p02922 | s927734966 | Accepted | from math import ceil
A, B = map(int, input().split())
print(ceil((B-1)/(A-1))) |
p02793 | s314235111 | Accepted | n=int(input())
a=list(map(int,input().split()))
mod=10**9+7
from math import gcd
ans=a[0]
for i in range(1,n):
ans=ans*a[i]//gcd(ans,a[i])
s=sum(pow(x,mod-2,mod) for x in a)
print(s*ans%mod)
|
p02760 | s992849706 | Accepted | A=open(0).read().split()
print('YNeos'[all(t-set(map(A.index,A[10:])) for t in({0,1,2},{3,4,5},{6,7,8},{0,3,6},{1,4,7},{2,5,8},{0,4,8},{2,4,6}))::2]) |
p03371 | s456686847 | Accepted | def main():
a, b, c, x, y = (int(i) for i in input().split())
v1 = 2*c*max(x, y)
v2 = 2*c*min(x, y) + (y-x if x < y else x-y)*(b if x < y else a)
v3 = a*x + b*y
print(min(v1, v2, v3))
if __name__ == '__main__':
main()
|
p03457 | s888975167 | Accepted | n = int(input())
TP = [[0, 0, 0]]
for _ in range(n):
TP.append(list(map(int, input().split())))
for i in range(1, n + 1):
td = TP[i][0] - TP[i-1][0]
pd = abs(TP[i][1] - TP[i-1][1]) + abs(TP[i][2] - TP[i-1][2])
if td >= pd and td % 2 == pd % 2:
continue
else:
print('No')
exit()
print('Yes') |
p04019 | s111069897 | Accepted | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
S = read().decode()
N, W, S, E = 'N' in S, 'W' in S, 'S' in S, 'E' in S
cond1 = not N ^ S
cond2 = not W ^ E
print('Yes' if cond1 and cond2 else 'No') |
p02690 | s735102287 | Accepted | import math
import sys
x=int(input())
for i in range(0,500):
for j in range(-200,i):
if i**5-j**5==x:
print(i,j)
sys.exit() |
p02866 | s126878960 | Wrong Answer | from collections import Counter
P = 998244353
N = int(input())
D = [int(x) for x in input().split()]
def solve():
if D[0] != 0:
return 0
total = 1
max_d = max(D)
counter = Counter(D)
for i in range(max_d + 1):
if i not in counter:
return 0
if i > 1:
total *= (counter[i - 1] ** counter[i] % P)
return total
print(solve()) |
p03471 | s186021951 | Accepted | n, Y = map(int, input().split())
for x in range(n+1):
for y in range(n-x+1):
z = n-x-y
if 0 <= z <= n and 10000*x+5000*y+1000*z == Y:
print(x,y,z)
exit()
print(-1,-1,-1) |
p02708 | s424132397 | Accepted | n, k = map(int, input().split())
mod = 10 ** 9 + 7
ans = 0
for i in range(k, n+2):
ans += int(n*(n+1)/2 - (n-i)*(n - i + 1)/2 - (i-1)*i/2 + 1)
print(ans%mod) |
p03592 | s827701241 | Accepted | N,M,K = map(int,input().split())
for n in range(N+1):
for m in range(M+1):
if K == m*N+n*M-2*(n*m):
print('Yes')
exit()
print('No') |
p03639 | s147473331 | Accepted | n, *a = map(int, open(0).read().split())
cnt4 = 0
cnt2 = 0
cnt_not = 0
for num in a:
if num % 4 == 0:
cnt4 += 1
elif num % 2 != 0:
cnt_not += 1
else:
cnt2 += 1
if 0 < cnt2:
r = 1
else:
r = 0
#print(cnt_not, r, cnt4)
if cnt_not + r < cnt4 + 2:
print('Yes')
else:
print('No') |
p02623 | s181382490 | Accepted | import itertools
n,m,k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
acc_A = [0]+list(itertools.accumulate(A))
acc_B = [0]+list(itertools.accumulate(B))
ans, j = 0, m
for i in range(n+1):
if acc_A[i] > k:
break
while acc_A[i] + acc_B[j] > k:
j -= 1
ans = max(ans, i+j)
print(ans)
|
p02879 | s069283763 | Accepted | a,b=map(int,input().split())
if a>=1 and a<=9 and b>=1 and b<=9:
print(a*b)
else:
print(-1) |
p02678 | s517510152 | Accepted | N, M = map(int, input().split())
node =[[] for _ in range(N)]
for _ in range(M):
x, y = map(int, input().split())
node[x-1].append(y-1)
node[y-1].append(x-1)
ct = [-1]*N
i = 0
queue = []
ct[0] = 0
queue.append(0)
while len(queue) != 0:
v = queue.pop(0)
for e in node[v]:
if ct[e] == -1:
ct[e] = v
queue.append(e)
print('Yes')
for i in range(1,N):
print(ct[i]+1) |
p03632 | s187655635 | Wrong Answer | A,B,C,D = map(int,input().split())
if B <= C:
print(0)
else:
print(min(B,D)-max(A,C))
|
p04019 | s694018088 | Accepted | l = list(input())
n = l.count('N')
w = l.count('W')
s = l.count('S')
e = l.count('E')
if n == s or (n != 0 and s != 0):
if w == e or (w != 0 and e != 0):
print('Yes')
exit(0)
print('No') |
p02777 | s358658990 | Accepted | s,t = input().split()
a,b = map(int,input().split())
u = input()
if u == s:
a -= 1
else:
b -= 1
print(a,b) |
p03109 | s641879677 | Accepted | Y, M, D = map(int, input().split('/'))
if Y <= 2019 and M <= 4 and D <= 30:
print('Heisei')
else:
print('TBD')
|
p02582 | s744534563 | Accepted | S = input()
if "RRR" in S:
print(3)
elif "RR" in S:
print(2)
elif "R" in S:
print(1)
else:
print(0) |
p03073 | s705995549 | Accepted | #参考 : AtCoder # 14682107
s = input()
len = len(s)
if len == 1:
print(0)
exit()
even = s[::2]
odd = s[1::2]
#偶数番目に0が並ぶと仮定したときの異物の数
# 0101...
odd_zero = odd.count("0")
even_one = even.count("1")
#奇数番目に0が並ぶと仮定したときの異物の数
# 1010...
odd_one = odd.count("1")
even_zero = even.count("0")
print(min(odd_zero + even_one, odd_one + even_zero)) |
p02608 | s989064911 | Wrong Answer | n = int(input())
l = int(n**(0.3))
for a in range(n):
s=0
for i in range(l):
if((3*i+3)**2-(3*(i**2)+6*i+3)==a+1):
s+=1
continue
for j in range(l-i):
for k in range(l-i-j):
if((i+j+k+3)**2-(i*j+j*k+k*i+2*i+2*j+2*k+3)==a+1):
s+=1
print(s) |
p02687 | s340492920 | Accepted | S=input()
if S=="ABC" :
print("ARC")
else :
print("ABC") |
p02695 | s396649886 | Accepted | from itertools import combinations_with_replacement
N, M, Q = map(int, input().split())
Q = [tuple(map(int, input().split())) for _ in range(Q)]
res = 0
for A in combinations_with_replacement(range(1, M + 1), N):
point = 0
for a, b, c, d in Q:
if A[b - 1] - A[a - 1] == c:
point += d
res = max(point, res)
print(res) |
p02584 | s891664626 | Wrong Answer | x, k, d = list(map(int, input().split()))
if (x // d) >= k:
print(x - d*(k))
else:
if (k-(x//d)) %2 ==0:
print(x%d)
else:
print(min(x%d+d,abs(x%d-d))) |
p02795 | s790894341 | Accepted | h=int(input())
n=int(input())
w=int(input())
v=max(h,n)
print((w+v-1)//v)
|
p02861 | s792015461 | Accepted | import sys
import math
N = int(input())
X = []
Y = []
for i in range(N):
x, y = map(int, sys.stdin.readline().split())
X.append(x)
Y.append(y)
sum = 0
for i in range(N - 1):
for j in range(i, N):
sum += math.sqrt((X[i] - X[j]) ** 2 + (Y[i] - Y[j]) ** 2)
ans = sum / (N / 2)
print(ans) |
p03637 | s543227755 | Accepted | N = int(input())
A = list(map(int,input().split()))
x = 0
y = 0
for a in A:
if a%4==0:
x+=1
elif a%2==0:
y+=1
if N//2<=x+y//2:
print("Yes")
else:
print("No") |
p02744 | s242620482 | Accepted | def main():
number = int(input())
queue = ["a"]
for i in range(number - 1):
now_queue = []
for now in queue:
limit = ord(max(now)) + 2
for j in range(ord("a"), limit):
now_queue.append(now + chr(j))
queue = now_queue
for q in queue:
print(q)
if __name__ == '__main__':
main()
|
p03386 | s196066901 | Accepted | A, B, K = map(int, input().split())
S = sorted(list(set([i for i in range(A, min(A + K, B))] + [i for i in range(max(A, B - K + 1), B + 1)])))
for s in S:
print(s)
|
p03943 | s200936957 | Accepted | l = [int(x) for x in input().split()]
if l[2]==l[0]+l[1] or l[0]==l[1]+l[2] or l[1]==l[0]+l[2]:
print ('Yes')
else:
print ('No')
|
p02602 | s618130746 | Accepted | n,k=map(int,input().split())
a=list(map(int,input().split()))
for (i,j)in zip(a[k:],a[:-k]):
if j<i:
print("Yes")
else:
print("No") |
p02843 | s426825432 | Wrong Answer | import math
X=int(input())
if X>3000:
print(1)
elif X<100:
print(0)
else:
i=1
while i<=X:
if 100*i<X and 105*i>X:
print(1)
quit()
i+=1
print(0) |
p02731 | s442655919 | Accepted | L = int(input())
print((L / 3)**3)
|
p03037 | s358990486 | Accepted | # C - Prison
N,M = map(int,input().split())
L,R = 1,N
for _ in range(M):
l,r = map(int,input().split())
L,R = max(L,l),min(R,r)
print(max(0,R-L+1)) |
p03719 | s358072670 | Accepted | a,b,c = map(int,input().split())
if a <= c and b >= c:
print('Yes')
else:
print('No') |
p03486 | s734503795 | Accepted | S = input()
T = input()
S_len = len(S)
T_len = len(T)
S_sorted = sorted(S)
T_sorted = sorted(T, reverse=True)
ans = True
for i in range(min(S_len, T_len)):
s = ord(S_sorted[i])
t = ord(T_sorted[i])
if s < t:
print('Yes')
exit(0)
if s == t:
continue
else:
print('No')
exit(0)
if S_len >= T_len:
print('No')
else:
print('Yes')
|
p03136 | s060699790 | Accepted | N = int(input())
L = list(map(int, input().split()))
print('Yes' if max(L) < sum(L) - max(L) else 'No')
|
p04011 | s695254972 | Wrong Answer | #合計宿泊数
N = input()
#通常宿泊数
K = input()
#通常宿泊費
X = input()
#割引宿泊費
Y = input()
#宿泊日数カウント
S = 1
#合計金額カウント
P = 0
#通常宿泊出力
while S <= int(K):
P = P + int(X)
S = S + 1
#割引宿泊出力
while S <= int(N):
P = P + int(Y)
S = S + 1
#合計金額出力
print(P) |
p02843 | s295245321 | Accepted | n=int(input())
print(int(n%100<=n//100*5)) |
p03328 | s894493407 | Wrong Answer | a, b = map(int, input().split())
s = [0] * 1002
for i in range(1002):
s[i] = s[i - 1] + i
if (s[i - 1] - a == s[i] - b ):
print(s[i - 1] - a)
break
print(s)
|
p02995 | s335858541 | Wrong Answer | from fractions import gcd
def lcm(x, y):
return (x * y) // gcd(x, y)
def solve():
A,B,C,D = map(int, input().split())
c = B//C - A//C
if A % C == 0:
c += 1
d = B//D - A//D
if B % C == 0:
d += 1
r = lcm(C,D)
e = B//r - A//r
return (B-A+1) - (c+d-e)
print(solve()) |
p03012 | s728091997 | Accepted | N=int(input())
W=list(map(int,input().split()))
totalS=sum(W)
S1=W[0]
ans=totalS-S1
for i in range(1,N):
S1+=W[i]
ans=min(ans,abs(totalS-S1*2))
print(ans) |
p02578 | s026854563 | Wrong Answer | #ABC177 C
N = int(input())
A = list(map(int,input().split()))
max = A[0]
F = [0]
for i in range(1,N):
if max > A[i]:
F.append(max - A[i])
else:
max = A[i]
F.append(0)
print(F)
print(sum(F))
|
p02702 | s339099722 | Wrong Answer | s = input()
cnt = 0
ans = []
for i in range(0, len(s) - 3):
j = i
num = ''
while j < len(s):
juhuku = 0
num += s[j]
if int(num) % 2019 == 0 and num != '0':
print(i, j)
if j not in ans:
ans.append(j)
juhuku = ans.count(i - 1)
cnt += 1 + juhuku
j += 1
cnt, ans
|
p02935 | s365340408 | Accepted | N = int(input())
v = list(map(int, input().split()))
v.sort()
ans = (v[0]+v[1])/2
for i in range(2, N):
ans = (ans + v[i])/2
print(ans) |
p02630 | s894172397 | Wrong Answer | n = int(input())
line = list(map(int, input().split()))
q = int(input())
for i in range(0, q):
b, c = map(int, input().split())
line = [c if j is b else j for j in line]
print(sum(line)) |
p03328 | s849150217 | Accepted | import math, sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from copy import deepcopy
from functools import lru_cache
from heapq import heapify, heappop, heappush
from itertools import accumulate, combinations, permutations
input = sys.stdin.readline
mod = 10**9 + 7
ns = lambda: input().strip()
ni = lambda: int(input().strip())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
a, b = nm()
print((b - a) * (b - a - 1) // 2 - a) |
p02838 | s269947471 | Accepted | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n = int(input())
A = list(map(int, input().split()))
res = 0
for i in range(60):
cnt = 0
for a in A:
cnt += (a >> i) & 1
res += (cnt * (n - cnt) % mod) * (1 << i) % mod
res %= mod
print(res)
if __name__ == '__main__':
resolve()
|
p02601 | s356509910 | Accepted | a, b, c = map(int, input().split())
k = int(input())
while k:
if a >= b:
b *= 2
else:
break
k -= 1
while k:
if b >= c:
c *= 2
else:
break
k -= 1
if a < b and b < c:
print("Yes")
else:
print("No") |
p02726 | s846873339 | Wrong Answer | N,X,Y=tuple(int(num) for num in input().split(" "))
A=[i for i in range(1,N+1) if i < (X+Y)/2-0.5]
B=[i for i in range(1,N+1) if i > (X+Y)/2+0.5]
Ans=[i for i in range(1,N)]
Ans.reverse()
for a,b in [(a,b) for a in A for b in B if a<=X or Y<=b]:
inc=abs(a-X)+abs(b-Y)+1
dec=abs(b-a)
Ans[inc-1]+=1
Ans[dec-1]-=1
for a in Ans:
print(a)
|
p03254 | s306874977 | Accepted | # coding: utf-8
def main():
_, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
ans = 0
for i in a:
x -= i
if x < 0:
break
else:
ans += 1
if x > 0 and ans > 0:
ans -= 1
print(ans)
if __name__ == "__main__":
main()
|
p02732 | s138887377 | Accepted | from collections import defaultdict, deque, Counter
import sys
input = sys.stdin.readline
def main():
n = int(input())
A = list(map(int, input().split()))
cnt = Counter(A)
cnt_common = cnt.most_common()
ans = 0
for i in range(len(cnt_common)):
num, val = cnt_common[i]
ans += val * (val - 1) // 2
for i in A:
c = cnt[i]
print(ans - c * (c - 1) // 2 + (c-1) * (c-2) // 2 )
if __name__ == '__main__':
main() |
p03329 | s624043361 | Accepted | from functools import lru_cache
import sys
sys.setrecursionlimit(10**6)
n=int(input())
@lru_cache(None)
def solve(n):
if n==0:
return 0
if n==1:
return 1
ans=n
cur=6
while cur<=n:
ans=min(ans,1+solve(n-cur))
cur*=6
cur=9
while cur<=n:
ans=min(ans,1+solve(n-cur))
cur*=9
return ans
print(solve(n))
|
p02719 | s974329343 | Wrong Answer | import sys
n,k = map(int,input().split())
m = n
c = 0
r = True
if n%k == 0:
print(0)
sys.exit()
while r == True:
if k >= 2*m:
r = False
elif k >= m:
c += 1
r = False
else:
print(n%k)
sys.exit()
print(abs(n-(c*k))) |
p02987 | s214156953 | Accepted | import collections
def resolve():
S = list(input())
counter_S = collections.Counter(S)
if len(counter_S) != 2:
print("No")
return
for value in counter_S.values():
if value != 2:
print("No")
return
print("Yes")
resolve() |
p02779 | s803136429 | Wrong Answer | N = int(input())
seq = input().split()
if len(seq) != len(set(seq)):
print('YES')
else:
print('NO') |
p02753 | s910799720 | Accepted | s = list(input())
s.sort()
if s[0]==s[2]:
print('No')
else:
print('Yes') |
p03037 | s794896897 | Accepted | n,m=map(int, input().split())
l_ans=1
r_ans=n
for i in range(m):
l,r=map(int, input().split())
l_ans=max(l_ans,l)
r_ans=min(r_ans,r)
if r_ans>=l_ans:
print(r_ans-l_ans+1)
else:
print(0) |
p03137 | s012911359 | Accepted | import sys
import numpy as np
n, m = map(int, sys.stdin.readline().split())
x = np.array(sys.stdin.readline().split(), dtype=np.int64)
x.sort()
def main():
d = np.sort(x[1:] - x[:-1])[::-1]
d = np.concatenate((np.array([0]), np.cumsum(d)))
res = d[m-1] - d[min(n, m) - 1]
print(res)
if __name__ == '__main__':
main() |
p03803 | s580073405 | Accepted | A, B = map(int, input().split())
if A == 1 and B == 1:
print('Draw')
elif A == 1 and B != 1:
print('Alice')
elif B == 1 and A != 1:
print('Bob')
elif A > B:
print('Alice')
elif B > A:
print('Bob')
else:
print('Draw')
|
p02843 | s470225352 | Accepted | # coding: utf-8
def main():
X = int(input())
C = X // 100
print([0, 1][X >= C * 100 and X <= C * 105])
if __name__ == "__main__":
main()
|
p03352 | s203901446 | Accepted | # ABC097 B Exponential
x = int(input())
ans = 0
for i in range(1,33):
for j in range(2,10):
t = i**j
if t <= x:
ans = max(t,ans)
print(ans) |
p03524 | s222550374 | Wrong Answer | from collections import Counter
s = dict(Counter(input()))
a = [x for x in s.values()]
ans = "NO"
if len(a) == 1 and a[0] == 1: ans = "YES"
elif len(a) == 3 and (a[0] == a[1] >= a[2] or a[0] > a[1] == a[2]): ans = "YES"
print(ans) |
p02987 | s267507485 | Wrong Answer | S=sorted(list(input()))
if S[0]==S[1] and S[2]==S[3]:
print("Yes")
else:
print("No") |
p02972 | s916484446 | Accepted | import sys
input=sys.stdin.readline
n=int(input())
l=tuple(map(int,input().split()))
ret=[]
ll=[0]*n
ans=0
for i in range(n,0,-1):
s=l[i-1]
for j in range(2,n//i+1):
s-=ll[j*i-1]
s%=2
ll[i-1]=s
ans+=s
if s:ret.append(i)
print(ans)
if ans:print(*ret,sep=" ") |
p02988 | s578873373 | Accepted | n = int(input())
L = list(map(int, input().split()))
count = 0
for i in range(1,n-1):
if (L[i-1] < L[i] and L[i] < L[i+1]) or (L[i-1] > L[i] and L[i] > L[i+1]):
count += 1
print(count) |
p03434 | s880092807 | Wrong Answer | N = int(input()) #入力値
A = sorted(map(int, input().split()), reverse = True)
Bob=0
Alice=0
print(A)
for i in range(0,N):
if i % 2 == 0: # Bobが偶数なら実行
Alice=Alice+int(A[i])
else:
Bob=Bob+int(A[i])
print(Alice-Bob)
|
p02982 | s761539346 | Wrong Answer | N, D = list(map(int, input().split()))
X = []
cnt = 0
dist2 = 0
for i in range(N):
tmp = list(map(int, input().split()))
X.append(tmp)
for i in range(N):
for j in range(i,N):
for n in range(D):
dist2 += (X[i][n] - X[j][n])**2
a = dist2 **0.5
if a == int(a) and a != 0:
cnt += 1
dist2 = 0
print(cnt) |
p02641 | s287823493 | Accepted | X, N = map(int, input().split())
p = list(map(int, input().split()))
ans = 0
for i in range(102):
if i not in p:
if abs(i-X)<abs(ans-X):
ans = i
print(ans)
|
p02756 | s265822996 | Accepted | I = input
s = I()
q = int(I())
a = [], []
i = 0
for _ in range(q):
x = I()
if x[0] == '1':
i ^= 1
else:
f = int(x[2]) - 1
a[i ^ f].append(x[4])
print(''.join(reversed(a[i])) + (s[::-1] if i else s) + ''.join(a[i^1])) |
p03219 | s536832502 | Wrong Answer | X,Y=map(int, input().split())
print(X+Y/2) |
p03815 | s729294707 | Accepted | import math
x=int(input())
div,mod=divmod(x,11)
alpha=math.ceil(mod/6)
print(div*2+alpha) |
p02612 | s907643450 | Accepted | N=int(input())
if N%1000==0:
print(0)
else:
print(1000-N%1000) |
p02570 | s202138946 | Accepted | import sys
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline
def main():
D, T, S = [int(x) for x in input().split()]
if T * S >= D:
print("Yes")
else:
print("No")
if __name__ == '__main__':
main()
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.