problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p02708 | s607671043 | Accepted | #input
N, K = map(int, input().split())
#output
mod = pow(10, 9) + 7
answer = 0
for i in range(K, N+2):
answer += ((N*(N+1)//2) - ((N-i)*(N-i+1)//2) - (i*(i-1)//2) + 1) % mod
print(answer % mod) |
p03017 | s839831524 | Accepted | N, A, B, C, D = map(int, input().split())
S = "#" + input() + "#"
# twoblock = S[A:].count("##")
def twoblock(start, end):
return S[start : end + 1].count("##")
tripledot = S[B - 1 : D + 2].count("...")
if twoblock(A, C) or twoblock(B, D):
print("No")
exit()
if C > D:
if tripledot == 0:
print("No")
exit()
print("Yes")
|
p03705 | s697458174 | Accepted | N, A, B = map(int, input().split())
print(0 if (N == 1 and A != B) or A > B else (A + B * (N - 1)) - (A * (N - 1) + B) + 1) |
p03804 | s601299178 | Wrong Answer | def f(s):
if s==".":
return 1
else:
return 0
N,M=map(int,input().split())
A=[]
for _ in range(N):
A.append(list(map(f,input())))
B=[]
for _ in range(M):
B.append(list(map(f,input())))
F=False
for i in range(N-M+1):
for j in range(N-M+1):
G=True
for k in range(M):
G=G and (A[j+k][i:i+M]==B[k])
if G:
print("Yes")
else:
print("No")
|
p03427 | s494741374 | Accepted | s = input()
if s[1:].count("9") == len(s)-1:
print(9*(len(s)-1)+int(s[0]))
else:
print(9*(len(s)-1)+int(s[0])-1) |
p03012 | s132762996 | Accepted | n = int(input())
w = list(map(int,input().split()))
count = 0
min = 1000
for t in range(1,n):
count = abs(sum(w[:t]) - sum(w[t:n]))
if count < min:
min = count
print(min)
|
p02688 | s498923120 | Accepted | import sys; input = sys.stdin.buffer.readline
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")
def getlist():
return list(map(int, input().split()))
#処理内容
def main():
N, K = getlist()
D = defaultdict(int)
for i in range(K):
d = int(input())
A = getlist()
for j in A:
D[j] += 1
ans = N - len(D)
print(ans)
if __name__ == '__main__':
main() |
p02596 | s806901538 | Accepted | k = int(input())
n = 0
for i in range(10**6 + 1):
n += 7 * pow(10, i, k)
n %= k
if n % k == 0:
print(i+1)
exit()
print(-1) |
p02933 | s317664707 | Accepted | a = int(input())
s = input()
if a >= 3200:
print (s)
else:
print("red") |
p03359 | s491225504 | Accepted | from sys import stdin,stdout
def main():
line=stdin.readline()
parts=line.split()
a=int(parts[0])
b = int(parts[1])
if b>=a:
stdout.write(str(a))
else:
stdout.write(str(a-1))
main() |
p03324 | s521818445 | Wrong Answer | d, n = map(int, input().split())
ans = 100**d * (n)
if n==100:
ans+=1
print(ans) |
p03407 | s659624577 | Wrong Answer | a,b,c=map(int,raw_input().split())
if a+b>=c:
print "yes"
else:
print "no" |
p02612 | s582998632 | Wrong Answer | n = int(input())
ans = 1000 - n % 1000
print(ans)
|
p02987 | s080800648 | Accepted | S=input()
if S[0]==S[1] and S[2]==S[3] and S[0]!=S[2]:
print("Yes")
elif S[0]==S[2] and S[1]==S[3] and S[0]!=S[1]:
print("Yes")
elif S[0]==S[3] and S[1]==S[2] and S[0]!=S[1]:
print("Yes")
else:
print("No") |
p03043 | s145134776 | Wrong Answer | import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()
def resolve():
n,k=map(int,input().split())
ans=0
for i in range(1,n):
cnt=0
while i<k:
i*=2
cnt+=1
ans+=(1/n)*(1/2**cnt)
print(ans)
resolve() |
p02910 | s926351350 | Accepted | s = list(input())
a = 0
for i in range(len(s)):
if i%2 == 0 and s[i] == 'L':
a += 1
print('No')
break
elif i%2 != 0 and s[i] == 'R':
a += 1
print('No')
break
if a == 0:
print('Yes') |
p02576 | s126841298 | Wrong Answer | n,x,t=map(int,input().split())
for i in range(1,t):
if x*i>=n:
print(i*t)
break |
p03281 | s604217128 | Accepted | N = int(input())
Ans = 0
for i in range(1, N+1, 2):
count = 0
for j in range(1, i+1):
if i % j == 0:
count += 1
if count == 8:
Ans += 1
print(Ans)
|
p02917 | s079576834 | Accepted | n = int(input())
b = list(map(int, input().split()))
s = b[0] + b[-1]
for i in range(n-2):
s += min(b[i], b[i+1])
print(s) |
p03345 | s004324770 | Wrong Answer | def resolve():
'''
code here
'''
A, B, C, K = [int(item) for item in input().split()]
if K % 2 == 0:
res = B - A
else:
res = A -B
print(A-B)
if __name__ == "__main__":
resolve()
|
p03796 | s831857857 | Accepted | N = int(input())
ans = 1
for i in range(N):
ans *= i + 1
ans %= 10**9 + 7
print(ans) |
p03434 | s634224184 | Wrong Answer | n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
Ali,Bob=0,0
for i in range(0,n-1,2):
Ali +=a[i]
Bob +=a[i+1]
print(Ali-Bob) |
p02880 | s136634427 | Wrong Answer | n = int(input())
c = "No"
for i in range(1,9):
if n % i == 0 and n // i < 10:
c = "Yes"
break
print(c)
|
p02963 | s174045671 | Accepted | S = int(input())
ans = [0, 0, 10 ** 9, 1]
x = (10 ** 9 - S % 10 ** 9) % 10 ** 9
y = (S + x) // 10 ** 9
ans.append(x)
ans.append(y)
print(*ans) |
p03693 | s634294253 | Wrong Answer | r, g, b = map(int, input().split())
print('Yes' if (10 * g + b) % 4 == 0 else 'N0') |
p02912 | s411648386 | Accepted | import heapq
n, m = map(int, input().split())
an = list(map(int, input().split()))
an = [-1 * i for i in an]
heapq.heapify(an)
for _ in range(m):
x = heapq.heappop(an)
x = int(x/2)
heapq.heappush(an, x)
print(-1 * sum(an)) |
p03779 | s854772984 | Accepted | X=int(input())
S=[0]*10**6
goukei=0
for i in range(10**6):
goukei+=i
S[i]=goukei
for i in range(10**6):
if X<=S[i]:
print(i)
exit()
#print(S[(10**6)-1])
|
p03013 | s747240037 | Accepted | N,M = list(map(int,input().split()))
a = [int(input()) for i in range(M)]
a_complement = list((set(list(range(N+1))) ^ set(a)))
cnt = {s: 0 for s in range(-2,N+1)}
cnt[0] = 1
for i in a_complement:
cnt[i] += cnt[i-1] + cnt[i-2]
print(cnt[N] % 1000000007) |
p03797 | s485776692 | Accepted | n, m = map(int, input().split())
if 2*n <= m:
print(n + (m-2*n)//4)
else:
print(m//2) |
p02842 | s266663947 | Accepted | N = int(input())
for i in range(N+1):
X = i * 1.08
if int(X) == N:
print(i)
exit()
print(':(') |
p03220 | s155540704 | Wrong Answer | N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
ans = 0
m = A
for i in range(N):
if m > abs(T - H[i] * 0.006 - A):
m = abs(T - H[i] * 0.006 - A)
ans = i + 1
print(ans) |
p03252 | s951381852 | Wrong Answer | s=input()
t=input()
a,b=len(set(s)),len(set(t))
if not a==b:
print('No')
exit()
l=len(s)
for i in range(1,l):
if (s[i]==s[i-1] and t[i]!=t[i-1]) or (s[i]!=s[i-1] and t[i]==t[i-1]):
print('No')
exit()
print('Yes') |
p02831 | s306161536 | Accepted | import fractions as f
A,B=map(int,input().split())
print(int((A*B)/f.gcd(A,B))) |
p03612 | s116468290 | Wrong Answer | n = int(input())
p = [int(i) for i in input().split()]
ans = 0
for i in range(n - 1):
if p[i] == i + 1 and p[i + 1] == i + 2:
p[i], p[i + 1] = p[i + 1], p[i]
ans += 1
elif p[i] == i + 1:
p[i], p[i + 1] = p[i + 1], p[i]
ans += 1
print(ans)
|
p03679 | s031916290 | Wrong Answer | x,a,b = map(int,(input().split()))
hantei = b - a
if hantei < 0:
print("delicious")
elif x > hantei:
print("safe")
else:
print("dangerous") |
p02584 | s238892495 | Accepted | X, K, D = map(int, input().split())
if X == 0:
if K % 2 == 0:
print(0)
else:
print(abs(D))
exit(0)
X = abs(X)
if X > 0:
k = X - K * D
if k >= 0:
print(k)
else:
kouho1 = X % D
kouho2 = abs(kouho1 - D)
sho = X // D
if (K - sho) % 2 == 0:
print(kouho1)
else:
print(kouho2)
exit(0)
|
p03493 | s561319249 | Accepted | a = input()
count = 0
for i in range(3):
if int(a[i]) == 1:
count += 1
print(count) |
p02823 | s637927929 | Wrong Answer | N, A, B = list(map(int,input().split(" ")))
if (B-A)%2 == 0:
print((B-A//2))
else:
if N - A >= B:
print(B)
else:
print(N-A) |
p03261 | s278719912 | Accepted | N=int(input())
word_set=set()
last_tail=""
for i in range(N):
W=input()
if W in word_set:
print("No")
break
else:
word_set.add(W)
if len(word_set)>1 and last_tail!=W[0]:
print("No")
break
else:
last_tail=W[-1]
else:
print("Yes") |
p02833 | s394677164 | Wrong Answer | import math
# n = 1000000000000000000
n = int(input())
# nが奇数ならば必ず0
if n % 2 or n < 10:
print(0)
else:
s = 0
for p in range(0, 50):
if 10 * (5 ** p) < n:
s += math.floor(n / (10 * (5 ** p)))
else:
break
print(s)
# 298023223876953125
# 1490116119384765625
# 1000000000000000000
# dividers = [(p, 5 ** p) for p in range(1, 26)]
|
p02959 | s270409952 | Wrong Answer | a = (int)(input())
mons = list(map(int, input().split(" ")))
yuu = list(map(int, input().split(" ")))
count = 0
for i in range(a):
if yuu[i] >= mons[i]:
yuu[i] -= mons[i]
mons[i] = 0
count += mons[i]
if yuu[i] >= mons[i + 1]:
yuu[i] -= mons[i + 1]
mons[i + 1] = 0
count += mons[i + 1]
else:
mons[i + 1] -= yuu[i]
count += yuu[i]
else:
mons[i] -= yuu[i]
count += yuu[i]
print(count) |
p03611 | s663457632 | Accepted | n=int(input())
l=[0]*(10**5+1)
v=list(map(int,input().split()))
for i in range(n):
x=v[i]
if x==0:
l[0]+=1
l[1]+=1
elif x==10**5:
l[x-1]+=1
l[x]+=1
else:
l[x-1]+=1
l[x]+=1
l[x+1]+=1
l.sort()
print(l[-1]) |
p03293 | s347981096 | Wrong Answer | S=list(str(input()))
T=list(str(input()))
for i in range(len(S)//2 +2):
if S==T:
print('Yes')
exit()
a=S.pop(-1)
S.insert(0,a)
print('No') |
p02676 | s153986101 | Accepted | # ABC168
# B (Triple Dots)
K = int(input())
S = input()
a = len(S)
if a <= K:
print(S)
else:
print(str(S[0:K])+'...')
|
p03281 | s390618002 | Wrong Answer | N = int(input())
def check_divisor(number):
divisors = 0
for j in range(1, number+1, 2):
if not (number%j):
divisors += 1
if divisors == 9: return False
if divisors == 8: return True
else: return False
count = 0
for i in range(1, N+1, 2):
if check_divisor(i):
count += 1 |
p03380 | s254530851 | Accepted | import bisect
n,*A=map(int,open(0).read().split());A.sort();m=A[-1];i=bisect.bisect_right(A,m/2)
print(m,[A[i-1],A[i]][abs(A[i-1]-m/2)>abs(A[i]-m/2)]) |
p02923 | s794916437 | Accepted | n = int(input())
h = list(map(int, input().split()))
ans = 0
i = 0
while i < n-1:
k = 0
while h[i] >= h[i+1]:
k+=1
i+=1
if i >= n-1: break
if k > ans:
ans = k
i+=1
print(ans) |
p02881 | s584981145 | Accepted | N = int(input())
def low_divisors(N):
K=1
low_divs = []
while K*K <= N:
if N%K == 0:
low_divs.append(K)
K += 1
return low_divs
L_divs = low_divisors(N)
D = []
for i in range(len(L_divs)):
D.append(L_divs[i]+N//L_divs[i])
print(min(D)-2) |
p03069 | s406838636 | Wrong Answer | N=int(input())
S=input()
cnt=0
for i in range(N):
if S[i]==".":
cnt+=1
else:
break
print(S.count(".")-cnt) |
p03077 | s469836317 | Accepted | import math
n = int(input())
n_list = [int(input()) for i in range(5)]
#print(n_list)
n_min = min(n_list)
ans = math.ceil(n/n_min) + 4
print(ans) |
p03105 | s411817866 | Wrong Answer | a, b, c = map(int, input().split())
for i in range(0, 99):
if a > b or i == c:
print(i)
break
b = b - a |
p02923 | s555978031 | Accepted | n=int(input())
h=list(map(int,input().split()))
l=[]
for i in range(n-1):
if h[i+1]-h[i]<=0:
l.append(1)
else:
l.append(0)
ans=0
mn=0
for j in range(len(l)):
if l[j]==0:
ans=0
else:
ans+=1
mn=max(ans,mn)
print(max(mn,ans)) |
p02706 | s452241989 | Accepted | N, M = map(int, input().split())
data = list(map(int, input().split()))
if N - sum(data) >= 0:
print(N-sum(data))
else:
print(-1) |
p03721 | s164087963 | Accepted | N, K = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort()
s = 0
for a, b in AB:
s += b
if s >= K:
ans = a
break
print(ans)
|
p03773 | s629549605 | Accepted | a, b = map(int, input().split())
print((a + b) % 24) |
p02694 | s050917180 | Accepted | X=int(input())
a=100
i=0
while a<X:
a+=int(a//100)
i+=1
print(i) |
p03220 | s563782499 | Wrong Answer | n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
ans_num = 1
ans_para = h[0]
for i, r in enumerate(h):
deg = t - (r * 0.006)
ans_para_deg = t - (ans_para * 0.006)
if (a - ans_para_deg) >= (a - deg):
ans_para = r
ans_num = i+1
print(ans_num) |
p03017 | s579798004 | Wrong Answer | n,a,b,c,d=[int(i) for i in input().split()]
s=input()
flag = '...' in s
ans = flag or (a>b == c>d)
if '##' in s:
ans=False
print('Yes' if ans else 'No') |
p04011 | s131893993 | Accepted | n = int(input())
k = int(input())
x = int(input())
y = int(input())
if n < k: print(x * n)
else: print(x * k + y * (n - k)) |
p02833 | s667006353 | Wrong Answer | N = int(input())
if N%2 == 1:
print(0)
elif N == 0:
print(1)
else:
c = 0
k = 10
while k <= N:
c += (N // k)
k *= 5
print(c) |
p03077 | s614028374 | Wrong Answer | import math
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
t_list = [A, B, C, D, E]
min_t = 10*20
min_i = 0
for i in range(5):
min_t = min(min_t, t_list[i])
t_1 = math.ceil(N/min_t)
t_1 = int((N+min_t-1) / min_t)
print(t_1+4)
|
p02678 | s182066941 | Accepted | n,m = map(int,input().split())
peer = [[] for _ in range(n)]
for _ in range(m):
a,b = map(int,input().split())
a -= 1
b -= 1
peer[a].append(b)
peer[b].append(a)
now = [0]
seen = [0 for _ in range(n)]
ans = [0 for _ in range(n)]
seen[0] = 1
while now:
last = now
now = []
for x in last:
for y in peer[x]:
if seen[y] == 0:
seen[y] = 1
now.append(y)
ans[y] = x
ans = ans[1:]
print('Yes')
for x in ans:
print(x+1) |
p02780 | s294238243 | Accepted | n, k = map(int, input().split())
ns = list(map(int, input().split()))
cnt = sum(ns[:k])
max_cnt = cnt
for i in range(n - k):
cnt += ns[i+k]
cnt -= ns[i]
max_cnt = max(max_cnt, cnt)
print((max_cnt+k)/2)
|
p03427 | s186834906 | Wrong Answer | N = input()
l = len(N)
if int(N[0]) > 1:
print(9 * (l - 1) + int(N[0]) - 1)
else:
print(9 * (l - 1)) |
p04020 | s906903312 | Accepted | N = int(input())
A = []
a = []
for i in range(N):
x = int(input())
if x==0:
b = a[:]
A.append(b)
a = []
else:
a.append(x)
A.append(a)
cnt = 0
for a in A:
c = sum(a)
cnt += c//2
print(cnt) |
p03435 | s449089495 | Accepted | g = []
for i in range(3):
g.append(list(map(int, input().split())))
for i in range(1,3):
offset = g[i][0] - g[0][0]
if not ((g[i][1] - g[0][1] == offset) and (g[i][2] - g[0][2] == offset)):
print("No")
exit()
print("Yes") |
p03261 | s340381832 | Wrong Answer | n=int(input())
W=[]
ans=0
s="a"
for i in range(n):
w=input()
W.append(w)
if i>0 and s[len(s)-1]==w[0]:
ans=1
s=w
for i in range(n):
if W.count(W[i])!=1:
ans=0
if ans==0:
print("No")
else:
print("Yes") |
p03495 | s835748425 | Accepted | N, K = map(int, input().split())
A = [int(i) for i in input().split()]
A.sort()
a = []
a.append(A[0])
c = []
c.append(1)
for i in range(N-1):
if A[i] == A[i+1]:
c[-1] += 1
else:
a.append(A[i+1])
c.append(1)
ans = 0
if len(a) <= K:
ans = 0
else:
c.sort()
for i in range(len(a)-K):
ans += c[i]
print(ans)
|
p02702 | s327120120 | Accepted | S=input()
DP=[0]*len(S)
now=0
for i in range(len(S)-1,-1,-1):
now=(now+pow(10,len(S)-1-i,2019)*int(S[i]))%2019
DP[i]=now
DP.append(0)
from collections import Counter
C=Counter(DP)
ANS=0
for c in C.values():
ANS+=c*(c-1)//2
print(ANS) |
p02629 | s239146284 | Wrong Answer | N=int(input())
c=[]
alpha=['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']
while N>=26:
n=N%26
N//=26
c.insert(0,alpha[n-1])
if N!=0:
c.insert(0,alpha[N-1])
c=''.join(c)
print(c)
|
p02753 | s052651420 | Accepted | s = input()
if s=="BBB" or s =="AAA":
print("No")
else:
print("Yes")
|
p03059 | s278799037 | Accepted | a,b,t = map(int,input().split())
n = 0
ans = 0
while n+a <= t:
ans += b
n += a
print(ans) |
p02675 | s437402109 | Accepted | N = int(input())
amari = N % 10
if amari in {2, 4, 5, 7, 9}:
print('hon')
elif amari in {0, 1, 6, 8}:
print('pon')
else:
print('bon')
|
p03611 | s817607713 | Accepted | import collections
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
a.append(a[i]+1)
a.append(a[i]-1)
c = collections.Counter(a)
print(c.most_common()[0][1]) |
p02792 | s294327217 | Wrong Answer | n = int(input())
ans = 0
for i in range(1, 10):
for j in range(1, 10):
for k in range(1, n+1):
a = 0
b = 0
K = str(k)
if K[0] == str(i) and K[-1] == str(j):
a += 1
if K[0] == str(j) and K[-1] == str(i):
b += 1
ans += a*b
print(ans)
|
p03778 | s367885315 | Accepted | W,a,b = map(int,input().split())
ans = max(a,b)-(min(a,b)+ W)
if ans <= 0:
ans = 0
print(ans) |
p03012 | s999273090 | Accepted | n=int(input())
w=list(map(int,input().split()))
goukei=sum(w)
ans=goukei
wk=0
for i in range(n):
wk+=w[i]
sa=abs(goukei-2*wk)
if sa<=ans:
ans=sa
else:
break
print(ans) |
p03673 | s869285088 | Accepted | from collections import deque
n = int(input())
a_li = list(map(int, input().split()))
b_li = deque()
for i in range(len(a_li)):
if i % 2 == 0:
b_li.append(a_li[i])
else:
b_li.appendleft(a_li[i])
if len(a_li) % 2 == 0:
print(*b_li)
else:
print(*list(b_li)[::-1])
|
p02861 | s644883816 | Accepted | import itertools
import math
N = int(input())
AB = [[0] * 2 for i in range(N)]
P = list()
ans = 0
for i in range(1,N+1):
P.append(i)
for j in range(N):
A,B = map( int ,input().split())
AB[j][0] = A
AB[j][1] = B
#print(AB)
for list in itertools.permutations(P, N):
for l in range(len(list)-1):
dic=math.sqrt((AB[list[l+1]-1][0]-AB[list[l]-1][0])**2+(AB[list[l+1]-1][1]-AB[list[l]-1][1])**2)
ans += dic/math.factorial(N)
print(ans) |
p02690 | s664259057 | Accepted |
x = int(input())
def ans():
for a in range(-1000, 1000):
for b in range(-1000, 1000):
if a**5 - b**5 == x:
return print(a, b)
ans() |
p02882 | s303240528 | Accepted | import math
def main():
a, b, x = map(int, input().split())
V = a**2 * b
if x <= V/2:
rad = math.atan(a * b**2 / (2*x))
print(math.degrees(rad))
else:
rad = math.atan(2 * (a**2 * b - x) / a**3)
print(math.degrees(rad))
main() |
p03827 | s744163118 | Accepted | input()
a=[0]
for i in input():a+=a[-1]+1-2*(i=='D'),
print(max(a)) |
p03862 | s357688855 | Accepted | n,x=map(int,input().split())
a=list(map(int,input().split()))
ans=0
for i in range(1,n):
num=x
num2=a[i-1]+a[i]-x
if num2>0:
ans+=num2
a[i]=max(a[i]-num2,0)
print(ans)
|
p03681 | s688987689 | Accepted | import math
N, M = map(int, input().split())
mod = 10**9+7
if abs(N-M) > 1:
print(0)
exit()
if N < M:
N, M = M, N
if N == M:
ans = math.factorial(N)
ans %= mod
ans *= math.factorial(M)
ans %= mod
ans *= 2
ans %= mod
else:
ans = math.factorial(M)
ans %= mod
ans *= math.factorial(N)
ans %= mod
print(ans) |
p02791 | s852979735 | Accepted | N = int(input())
P = [int(i) for i in input().split()]
min_v = float("inf")
ans = 0
for p in P:
min_v = min(min_v, p)
if p == min_v:
ans += 1
print(ans)
|
p03695 | s957597126 | Accepted | n = int(input())
a = list(map(int,input().split()))
cnt = [0] * 9
for i in a:
x = min(i // 400, 8)
if x >= 8:
cnt[8] += 1
else:
cnt[x] = 1
if sum(cnt[:8]) == 0:
l = 1
r = cnt[8]
else:
l = sum(cnt[:8])
r = l+cnt[8]
print(l, r) |
p03705 | s452595592 | Accepted | n, a, b = map(int, input().split())
print(max(0, b*(n-1)+a - (a*(n-1)+b) + 1)) |
p03252 | s505733248 | Accepted | s = input()
t = input()
dict_st = {}
dict_ts = {}
for x, y in zip(s, t):
if x not in dict_st:
dict_st[x] = y
else:
if dict_st[x] != y:
print("No")
break
if y not in dict_ts:
dict_ts[y] = x
else:
if dict_ts[y] != x:
print("No")
break
else:
print("Yes")
|
p02882 | s897721047 | Accepted | import math
a,b,x = map(int,input().split())
bottle = a * b
water = x / a
if water <= bottle / 2:
a2 = 2 * water / b
ans = math.degrees(math.atan(b / a2))
else:
if x == a * b:
ans = 90
else:
b2 = 2 * water / a - b
water2 = water - (b2 * a)
b3 = 2 * water2 / a
ans = math.degrees(math.atan(b3 / a))
print(ans) |
p02743 | s900307527 | Accepted | a, b, c = map(int, input().split())
if c - a - b <= 0:
print('No')
quit()
if (c-(a+b))**2 > 4*a*b:
print('Yes')
else:
print('No')
|
p03150 | s271390254 | Accepted | S = list(input())
tf = [False for _ in range(7)]
key = list("keyence")
for n in range(7):
if S[n] == key[n]:
tf[n] = True
else:
break
for n in range(1, 8):
if S[-n] == key[-n]:
tf[-n] = True
else:
break
if all(tf):
print("YES")
else:
print("NO") |
p03617 | s419234405 | Accepted | Q, H, S, D = [int(x) for x in input().strip().split()]
N = int(input())
min_QHS = min(Q * 4, H * 2, S)
if min_QHS * 2 <= D:
print(N * min_QHS)
else:
print(D * (N // 2) + (N % 2) * min_QHS) |
p02765 | s590808242 | Accepted | N, R = map(int, input().split())
if N >= 10:
print(R)
else:
print(R + 100 * (10 - N)) |
p02775 | s285256260 | Accepted | #!/usr/bin/python3.6
import sys
input = sys.stdin.readline
INF = 10**9
a = [int(item) for item in list(input().rstrip())]
n = len(a)
# DP[i-th item][0:pay just / 1:pay over]
dp = [[INF] * 2 for _ in range(n + 1)]
dp[0][0] = 0
for i, item in enumerate(a):
dp[i+1][0] = min(dp[i+1][0], dp[i][0] + item, dp[i][1] + item)
dp[i+1][1] = min(dp[i+1][1], dp[i][0] + 10 - item + 1, dp[i][1] + 10 - item - 1)
print(min(dp[n])) |
p02765 | s658909058 | Accepted | N, R = map(int, input().split())
if N >= 10:
print(R)
else:
print(R + 100 * (10 - N)) |
p03416 | s684483054 | Accepted | #print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
from collections import Counter
def resolve():
A,B=pin()
cnt=0
for i in range(A,B+1):
temp=str(i)
if temp==temp[::-1]:cnt+=1
print(cnt)
#%%submit!
resolve()
|
p03711 | s955784769 | Wrong Answer | a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]
acount = 0
bcount = 0
ccount = 0
x, y = input().split()
for i in range(0, 7):
if int(x) == a[i] or int(y) == a[i]:
acount += 1
for i in range(0, 4):
if int(x) == b[i] or int(y) == b[i]:
bcount += 1
for i in range(0, 1):
if int(x) == c[0] or int(y) == c[0]:
ccount += 2
if acount == 2 or bcount == 2 or ccount == 2:
print("YES")
else:
print("NO")
|
p03693 | s576535932 | Accepted | a = int(input().replace(' ', ''))
if a % 4 == 0:
print('YES')
else:
print('NO') |
p02596 | s330533180 | Accepted | import sys
from collections import defaultdict
K = int(input())
n = len(str(K))
r = 7 % K
dict = defaultdict(bool) # int/bool/list....
dict[r] = True
orgr = r
d = 1
for _ in range(K + 1):
if r == 0:
print(d)
break
d += 1
r = (10 * r + 7) % K
if dict[r]:
print(-1)
sys.exit()
dict[r] = True |
p03472 | s477000153 | Accepted | n, h = map(int, input().split())
a = []
b = []
for i in range(n):
a1, b1 = map(int, input().split())
a.append(a1)
b.append(b1)
ind = n - 1
a.sort()
b.sort()
ans = 0
while h > 0:
if(ind >= 0 and b[ind] > a[n - 1]):
h -= b[ind]
ind -= 1
ans += 1
else:
ans += (h + a[n - 1] - 1) // a[n - 1]
h = 0
print(ans)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.