problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p02621 | s390808570 | Accepted | a = int(input())
print(a*a*a+a*a+a) |
p03544 | s554861350 | Accepted | N = int(input())
if N == 1:
print(1)
else:
L = [0] * (N + 1)
L[0] = 2
L[1] = 1
for i in range(2, N + 1):
L[i] = L[i - 1] + L[i - 2]
print(L[N])
|
p02897 | s096832993 | Wrong Answer | def main():
n=int(input())
print(n//2+n%2)
if __name__ == '__main__':
main() |
p03011 | s266405684 | Wrong Answer | p,q,r = map(int, input().split())
# p,q,r = map(int, "1 3 4".split())
print(r-q + r-p) |
p02765 | s697968048 | Wrong Answer | N,R = [int(i) for i in input().split()]
if N < 10:
print(R + (100 * (N- 2)))
else:
print(R) |
p02602 | s547947440 | Accepted | N, K = map(int, input().split())
A = [int(i) for i in input().split()]
for i in range(K, N):
prev = A[i - K]
curr = A[i]
if prev < curr:
print('Yes')
else:
print('No')
|
p02596 | s500388543 | Wrong Answer | k = int(input())
if(k % 2 == 0):
print(-1)
else:
if(k % 7 == 0):
print(1)
else:
a = 1
amari = 7 % k
while(a < k):
a += 1
amari = (amari*10 + 7) % k
if(amari == 0):
print(a)
break
if(a == k):
print(-1) |
p02720 | s038003489 | Accepted | K = int(input())
from collections import deque
d = deque()
d = deque([1,2,3,4,5,6,7,8,9])
n = 0
for i in range(K-1):
x = d[0]
if not x % 10 == 0:
d.append((10 * x) + (x % 10) - 1)
d.append((10 * x) + (x % 10))
if not x % 10 == 9:
d.append((10 * x) + (x % 10) + 1)
d.popleft()
print(d[0... |
p03131 | s418365716 | Accepted | k, a, b = map(int, input().split())
if 2 >= b-a or a >= k:
print(k+1)
else:
print(b + ((k-a+1)//2-1)*(b-a) + ((k-a+1)%2)) |
p03487 | s954104034 | Accepted | def main():
N = int(input())
A = [int(i) for i in input().split()]
from collections import Counter
ans = 0
c = Counter(A)
for k, v in c.items():
if k < v:
ans += v - k
elif v < k:
ans += v
print(ans)
if __name__ == '__main__':
main()
|
p02771 | s584373564 | Wrong Answer | arr=list(map(int,input().split()))
cnt=0
if(arr[0]==arr[1]):
cnt+=1
if(arr[0]==arr[2]):
cnt+=1
if(arr[1]==arr[2]):
cnt+=1
if(cnt==3):
print("NO")
else:
print("Yes") |
p03075 | s082881066 | Wrong Answer | a,b,c,d,e,f = [ int(input()) for i in range(6) ]
if b-a<=f and c-b<=f and d-c<=f and e-d<=f:
print("Yay!")
else:
print(":(") |
p02695 | s981052242 | Wrong Answer | import itertools
abcd = []
N,M,Q = map(int,input().split())
for i in range(Q):
a,b,c,d = map(int,input().split())
abcd.append([a,b,c,d])
A = (list(itertools.permutations(list(range(1,M+1)),N)))
ans = 0
for i in A: #(1,2,3,4)
_sum = 0
for j in abcd: #[2 4 1 86568]
if i[j[1]-1] - i[j[0]-1] ==... |
p02987 | s141109116 | Accepted | #copy
s = input()
print("Yes" if len(set(s)) == 2 else "No") |
p03309 | s596315529 | Accepted | n = int(input())
a = list(map(int,input().split()))
l = [a[i]-i-1 for i in range(n)]
b = sorted(l)[n//2]
ans = 0
for i in range(n):
ans += abs(a[i]-b-i-1)
print(ans) |
p03284 | s242667914 | Wrong Answer | a,b = map(int, input().split())
print(a%b) |
p02708 | s889405167 | Accepted | n, k = map(int, input().split())
mod = 10**9 + 7
n_list = [0]*(n+1)
for i in range(n+1):
n_list[i] = (10**100 + i) % mod
s = [0]*(n+1)
s[0] = n_list[0]
for i in range(1, n+1):
s[i] = (s[i-1] + n_list[i]) % mod
#print(s)
count = 0
for i in range(k, n+1):
min_sum = s[i-1] % mod
max_sum = (s[n] - s[n-i... |
p03557 | s665611421 | Wrong Answer | from bisect import bisect_left, bisect_right
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
C.sort()
cnt = 0
for b in B:
cnt += bisect_left(A, b) * bisect_right(C, b)
print(cnt) |
p04031 | s501758019 | Wrong Answer | N = input()
A = list(map(int, input().split()))
num = round(sum(A) // len(A))
cost = [(a - num)**2 for a in A]
print(sum(cost)) |
p03038 | s137670705 | Wrong Answer | n,m=map(int,input().split())
a=sorted(map(int,input().split()))
c={}
for _ in range(m):
bx, cx =map(int,input().split())
c[cx]=bx
c_sort=dict(sorted(c.items(),reverse=1))
c_list=[]
for j in c_sort:
for _ in range(c_sort[j]):
if len(c_list)>=n+1:
break
c_list.append(j)
c_len=len(c_list)
sum=0
... |
p03774 | s098746667 | Wrong Answer | n, m = map(int, input().split())
p = [list(map(int, input().split())) for i in range(n + m)]
for a, b in p[:n]:
x = [abs(a - c) + abs(b - d) for c, d in p[n:]]
print(x.index(min(x)) + 1) |
p04029 | s571740502 | Accepted | N = int(input())
a = (N * (N + 1)) // 2
print(a) |
p02773 | s753748764 | Accepted | import collections
n = int(input())
c = collections.Counter([ input() for i in range(n) ])
ma = max(c.values())
print(*sorted([ i for i, j in c.items() if j == ma ]), sep='\n') |
p02994 | s966715129 | Accepted | n, l = map(int, input().split())
apple = list(range(l, l + n))
ans = 0
if 0 in apple:
ans = sum(apple)
elif abs(apple[0]) < abs(apple[-1]):
ans = sum(apple[1:])
else:
ans = sum(apple[:-1])
print(ans) |
p02730 | s288789311 | Wrong Answer | s = input()
n = len(s)
def f(s):
n = len(s)
if n % 2 == 0:
return s[:n // 2] == s[n // 2:]
else:
return s[:n // 2] == s[n // 2 + 1:]
if f(s) and f(s[:(n - 1)//2 + 1]) and f(s[(n + 3) // 2 - 1:]):
print('Yes')
else:
print('No')
|
p02847 | s325333243 | Accepted | x = input()
youbi = {
'SUN': 7
, 'MON': 6
, 'TUE': 5
, 'WED': 4
, 'THU': 3
, 'FRI': 2
, 'SAT': 1
}
print(youbi[x]) |
p04011 | s472995071 | Accepted | x = []
for i in range(4):
x.append(int(input()))
if x[0] > x[1]:
print(x[1]*x[2]+(x[0]-x[1])*x[3])
else:
print(x[0]*x[2]) |
p03017 | s386626921 | Accepted | n,a,b,c,d = map(int,input().split())
s = input()
if d<c:
if "##" not in s[a-1:d] and '...' in s[b-2:d+1]:
print('Yes')
else:
print('No')
else:
if "##" not in s[a-1:d]:
print('Yes')
else:
print('No') |
p02766 | s113415804 | Wrong Answer | n,k = map(int,input().split())
for i in range(1,10 ** 9):
if n - k ** i < k:
print(i)
break
|
p03289 | s309773915 | Accepted | S = input()
ans = 'AC'
if S[:1] != 'A':
print('WA')
exit()
if S[2:-1].count('C') != 1:
print('WA')
exit()
X = S[1:].split('C')
for x in X:
if x.islower():
pass
else:
print('WA')
exit()
print(ans) |
p02911 | s929525444 | Wrong Answer | n, k, q = map(int, input().split())
scores = {i: 0 for i in range(1, n+1)}
for _ in range(q):
n = int(input())
scores[n] += 1
print(scores)
for i, score in sorted(scores.items()):
if k + score - q > 0:
print('YES')
else:
print('NO')
|
p02624 | s419721100 | Wrong Answer | n = int(input())
l = [0 for _ in range(n+1)]
l[1] = 1
for i in range(n+1):
for j in range(i-1, 0, -1):
if i % j == 0:
l[i] = l[j] + 1
break
ans = 0
for k in range(n+1):
print(k * l[k])
ans += (k * l[k])
print(ans)
|
p03284 | s635826306 | Wrong Answer | n, k = map(int, input().split())
print(n/k if n%k==0 else 1) |
p02842 | s701576043 | Accepted | from math import ceil, floor
n = int(input())
res = ceil(n/1.08)
if floor(res*1.08) == n:
print(res)
else:
print(":(") |
p03386 | s240299386 | Accepted | import math
a , b , k = map(int , input().split())
ans = set()
for i in range(min(k , math.ceil((b - a + 1) / 2))):
ans.add(a + i)
ans.add(b - i)
ans = sorted(list(ans))
print('\n'.join([str(n) for n in ans])) |
p02748 | s894759765 | Accepted | #設定
import sys
input = sys.stdin.buffer.readline
#ライブラリインポート
from collections import defaultdict
con = 10 ** 9 + 7
#入力受け取り
def getlist():
return list(map(int, input().split()))
#処理内容
def main():
A, B, M = getlist()
a = getlist()
b = getlist()
am = min(a)
bm = min(b)
ans = am + bm
for i in range(M):
x, y, c... |
p02608 | s910562686 | Accepted | n = int(input())
from collections import defaultdict
d = defaultdict(int)
ul=int(n**0.5)
for i in range(1,ul):
for j in range(1,ul):
for k in range(1,ul):
d[i**2+j**2+k**2+i*j+j*k+k*i]+=1
for j in range(1,n+1):
print(d.get(j,0))
# print(d[j] if d[j] else 0)
|
p03252 | s163681432 | Accepted | S = input()
T = input()
N = len(S)
start = [-1 for i in range(26)]
goal = [-1 for i in range(26)]
a = ord('a')
ans = 'Yes'
for i in range(N):
s = ord(S[i])-a
t = ord(T[i])-a
if start[s] != -1 and start[s] != t:
ans = 'No'
if goal[t] != -1 and goal[t] != s:
ans = 'No'
start[s] = t
... |
p02754 | s043416046 | Accepted | n, a, b = map(int, input().split())
good = n//(a+b)*a
resd = min(a, n%(a+b))
print(good+resd) |
p03471 | s538238644 | Wrong Answer | n, y = map(int, input().split())
ans = 0
t = int(y/10000)
y -= t*10000
f = int(y/5000)
y -= f*5000
h = int(y/1000)
y -= h*1000
if t+f+h != n or y != 0:
print("-1 -1 -1")
else:
print(t,f,h)
|
p03997 | s378829410 | Wrong Answer | a=int(input())
b=int(input())
h=int(input())
print(int((a+b)*h/0.5)) |
p02939 | s494254397 | Wrong Answer | s = input()
l = s[0]
i = 1
c = 1
while(i < len(s)-1):
if(s[i] == l):
l = s[i:i+2]
i += 2
c += 1
else:
l = s[i]
i += 1
c += 1
if(s[-1] != l):c += 1
print(c) |
p03286 | s384516414 | Accepted | N = int(input())
ans = ""
if N==0:
print(0)
else:
while N!=0:
ans+=str(N%2)
N=-(N//2)
print(ans[::-1]) |
p02862 | s992177258 | Wrong Answer | X,Y=map(int,input().split())
MOD=10**9+7
def modinv(a):
return pow(a,MOD-2,MOD)
if (2*X-Y)%3!=0 or (2*Y-X)%3!=0:
print(0)
else:
x=(2*Y-X)//3
y=(2*X-Y)//3
r=1
n=x+y
k=min(x,y)
for i in range(k):
r*=(n-i)
r*=modinv(i+1)
r%=MOD
print(r) |
p02754 | s433534837 | Accepted | n,a,b=map(int,input().split())
kuri=n//(a+b)
ama=n%(a+b)
ans=kuri*a+min(a,ama)
print(ans) |
p03607 | s686025907 | Accepted | n = int(input())
key = dict()
for i in range(n):
a = int(input())
if a not in key:
key[a] = 1
elif key[a] == 1:
key[a] = 0
else:
key[a] = 1
ans = 0
for value in key.values():
ans += value
print(ans) |
p03385 | s825262953 | Accepted | s=set(input())
print(["No","Yes"][len(s)==3]) |
p02819 | s061765212 | Wrong Answer | import math
n = 10**5+1
x = int(input())
nums = [1 for i in range(n)]
for i in range(2, int(math.sqrt(n))):
if nums[i] == 0:
continue
if (i>x):
print(i)
exit()
for j in range(i+1, n):
if j%i==0:
nums[j] = 0
|
p02719 | s911798400 | Accepted | N, K = list(map(int, input().split()))
ans = N % K if N%K < abs( N%K -K) else abs( N%K -K)
print(ans) |
p03997 | s828086195 | Accepted | a = int(input())
b = int(input())
h = int(input())
S = (a+b)*h//2
print(S) |
p03282 | s505709772 | Accepted | s = list(input())
k = int(input())
ans = "1"
cnt = 0
for i in s:
if i == "1":
cnt += 1
elif cnt < k:
ans = str(i)
break
print(ans)
|
p03319 | s701773641 | Accepted | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
n, k, *a = map(int, readline().split())
print((n - 2) // (k - 1) + 1)
|
p02910 | s109246330 | Wrong Answer | s = input()
ans = 0
for i in range(len(s)):
if ans != 0:
print('No')
exit()
if i % 2 == 0:
if s[i] == 'L':
ans += 1
else:
if s[i] == 'R':
ans += 1
print('Yes') |
p02647 | s697463036 | Accepted | n,k = map(int,input().split())
A = list(map(int, input().split()))
from itertools import accumulate
for i in range(k):
imos = [0]*(n+1)
for j in range(n):
d = A[j]
l = max(0, j-d)
r = min(n-1, j+d)
imos[l] += 1
imos[r+1] -= 1
imos = list(accumulate(imos))
for j i... |
p03767 | s664832620 | Accepted | n = int(input())
a = list(map(int, input().split()))
a.sort(reverse = True)
ans = 0
for i in range(n):
ans += a[2 * i + 1]
print(ans) |
p02862 | s022594787 | Accepted | x,y=map(int,input().split())
n=x+y
if x/y>2 or y/x>2 or n%3!=0:
print(0)
exit()
n//=3
r=min(x-n,y-n)
m=10**9+7
a=b=1
for i in range(r):
a=a*(n-i)%m
b=b*(i+1)%m
print(a*pow(b,m-2,m)%m) |
p03086 | s504995988 | Accepted | s = input()
l = ["A", "C", "G", "T"]
ans = 0
c = 0
for i in range(len(s)):
if s[i] in l:
c += 1
if c > ans:
ans = c
else:
c = 0
print(ans) |
p02678 | s770124067 | Accepted | from collections import deque
n, m = map(int, input().split())
root = [[] for _ in range(n)]
adj = [-1 for _ in range(n)]
for _ in range(m):
r,c = map(int, input().split())
root[r-1].append(c-1)
root[c-1].append(r-1)
explor = deque()
explor.append(0)
while explor:
tmp = explor.popleft()
for i in root[tmp... |
p02765 | s368215712 | Accepted | N,R=map(int,input().split())
if N >= 10:
print(R)
else:
print(R+(100*(10-N)))
|
p03494 | s802924580 | Accepted | N = int(input())
a = list(map(int,input().split()))
count = 0
while True:
#リストの中をすべて2で割る
odd_cnt = 0
for i in range(N):
if a[i] % 2 == 1:
odd_cnt += 1
a[i] = a[i] / 2
#奇数が一つでもあればbreak. そうでなければカウント追加してループ続行
if odd_cnt > 0:
break
else:
count += 1
... |
p02688 | s068256773 | Accepted | n,k=map(int,input().split())
ans=[1]*n
for i in range(k):
d=int(input())
a=list(map(int,input().split()))
for i in range(d):
ans[a[i]-1]=0
print(sum(ans)) |
p02873 | s287641990 | Accepted |
def main():
from itertools import groupby
s = list(input())
f = 0
ans = 0
for k,v in groupby(s):
d = len(tuple(v))
left = d if k==">" else 0
right = d if k=="<" else 0
if f>left:
ans += d*(d+1)//2 - left
else:
ans += -1*f + d*(d+1)//2
f = right
print(ans)
if __na... |
p03448 | s131759958 | Wrong Answer | a,b,c,x =[int(input(i)) for i in range(4)]
ans = 0
for i in range(a+1):
for j in range(b+1):
for k in range(c+1):
if 500*i+100*j+50*k==x:
ans+=1
print(ans)
|
p03760 | s347257107 | Wrong Answer | O = input()
E = input()
print(*[O+E for O,E in zip(O,E)], sep='') |
p03711 | s236603063 | Wrong Answer | def func(a):
if a in (1,3,5,7,8,10,12):
return "a"
elif a in (4,6,9,11):
return "b"
else:
return "c"
x, y = [int(i) for i in input().split()]
x_group = func(x)
y_group = func(x)
if x_group == y_group:
print("Yes")
else:
print("No") |
p03910 | s345070156 | Accepted | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)
N = int(input())
cnt = 0
s = set()
for i in range(1, N+1):
cnt += i
s.add(i)
if cnt>=N:
break
if N!=cnt:
s.remove(cnt-N)
for i in s:
print(i) |
p02712 | s413905370 | Wrong Answer | n = int(input())
s = 0
for i in range(n+1):
if i % 3 != 0 or i % 5 != 0:
s += i
print(s) |
p03495 | s856450248 | Accepted | N, K = map(int, input().split())
A = list(map(int, input().split()))
Ad = {a:0 for a in set(A)}
if len(set(A)) <= K:
print(0)
else:
cnt = 0
for a in A:
Ad[a] += 1
Ad = sorted(Ad.items(), key=lambda x: x[1])
for i in range(len(set(A))-K):
cnt += Ad[i][1]
print(cnt) |
p03617 | s152346168 | Accepted | Q,H,S,D = map(int, input().split())
N = int(input())
H = min(H, Q * 2)
S = min(S, H * 2)
D = min(D, S * 2)
#print(S, D)
ans = (N // 2) * D + (N - (N // 2) * 2) * S
print(ans) |
p03331 | s254372083 | Wrong Answer | def get_digit_sum(n):
result = 0
while n > 0:
result += n % 10
n //= 10
return result
def main():
ab_sum = int(input())
answer = float("inf")
for i in range(1, ab_sum // 2):
answer = min(answer, get_digit_sum(i) + get_digit_sum(ab_sum - i))
print(answer)
if __name... |
p02951 | s874917489 | Accepted | A,B,C = map(int, input().split())
print(C-(A-B) if C > (A-B) else 0) |
p02756 | s608778368 | Accepted | from collections import deque
s=deque(input());q=int(input());rev=0
for i in range(q):
p=list(map(str,input().split()))
if p[0]=="1":rev^=1
else:
z,f,c=p
if f=="1":
if rev:s.append(c)
else:s.appendleft(c)
else:
if rev:s.appendleft(c)
el... |
p03408 | s888317821 | Accepted | N = int(input())
s = [input() for i in range(N)]
from collections import Counter
sc = Counter(s)
M = int(input())
for i in range(M):
sc[input()] -= 1
print(max(0,max(sc.values())))
|
p03109 | s495719612 | Wrong Answer | s=input()
l=list(map(int,s.split("/")))
if l[0] <=2018 or l[0] ==2019 and (l[1]<=3 or l[1] ==4 and l[2]<=30):
print('TBD')
else:
print("Heisei") |
p03544 | s511929102 | Wrong Answer | N = int(input())
R = [None] * (N+1)
R[0] = 2
if N == 0:
print(R[0])
exit()
R[1] =1
if N == 1:
print(R[1])
exit()
if N > 2:
for i in range(2, N+1):
R[i] = R[i-1] + R[i-2]
print(R[N]) |
p02621 | s496485278 | Accepted | a=int(input())
print( a+a*a + a*a*a)
|
p02583 | s467137659 | Accepted | # Begin Header {{{
from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combi... |
p03328 | s147440709 | Accepted | a, b = map(int, input().split())
res = 0
for i in range(b-a):
res += i
print(res - a) |
p03860 | s115497435 | Accepted |
def read_int():
return int(input().strip())
def read_ints():
return list(map(int, input().strip().split(' ')))
def solve():
return ''.join([c[0] for c in input().strip().split(' ')])
if __name__ == '__main__':
print(solve())
|
p03095 | s145284603 | Accepted | from collections import Counter
from functools import reduce
from operator import mul
def plus_one(n):
return n + 1
N = int(input())
S = Counter(list(input()))
print((reduce(mul, map(plus_one, S.values())) - 1) % (10 ** 9 + 7))
|
p02802 | s019540460 | Wrong Answer | mondaisu , teisyutukaisu = map(int,input().split())
flag = []
penalog = []
for i in range(mondaisu):
flag.append(0)
penalog.append(0)
for i in range(teisyutukaisu):
bango , kekka = input().split()
bango = int(bango)
if flag[bango-1] == 1:
continue
if kekka == 'WA':
penalog[bango-1] = penalog[ba... |
p02972 | s357540558 | Accepted | n = int(input())
a = list(map(int, input().split()))
b = [-1] * n
for i in range(n, 0, -1):
cnt = sum(b[j - 1] for j in range(i + i, n + 1, i))
b[i - 1] = int(a[i - 1] != cnt % 2)
print(sum(b))
if sum(b) > 0:
print(*[i + 1 for i in range(n) if b[i] == 1])
|
p02702 | s976378986 | Wrong Answer | N = input()
a = 0
for i in range(len(N)):
if N[i] == 0:
continue
for j in range(len(N)):
if i > j:
continue
if int(N[i:j + 1]) == 0:
continue
#print(N[i:j + 1])
if int(N[i:j + 1]) % 2019 == 0:
a += 1
print(N[i:j + 1])
print(a)
|
p03285 | s886030821 | Accepted | n = int(input())
for i in range(0, int(100/7)+1):
x = n - i * 7
if (x == 0 or x % 4 == 0):
print('Yes')
exit()
elif (x < 4):
break
print('No')
|
p02958 | s635928694 | Accepted | n = int(input())
p = list(map(int, input().split()))
res = 0
for i in range(n):
if i + 1 == p[i]:
res += 1
# print(n, res)
if res >= n - 2:
print('YES')
else:
print('NO')
|
p03944 | s528221986 | Accepted | w, h, n = map(int, input().split())
left_x = 0
right_x = w
up_y = h
down_y = 0
for _ in range(n):
x, y, a = map(int, input().split())
if a == 1:
left_x = max(left_x, x)
elif a == 2:
right_x = min(right_x, x)
elif a == 3:
down_y = max(down_y, y)
else:
up_y = min(up_y, ... |
p02608 | s126765565 | Accepted | n=int(input())
l=[0]*(n)
for x in range(1,101):
for y in range(1,101):
for z in range(1,101):
k=x**2+y**2+z**2+x*y+x*z+y*z
if k<=n:
l[k-1]+=1
print(*l,sep="\n") |
p03331 | s371584159 | Wrong Answer | import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
rr = lambda: sys.stdin.buffer.readline().rstrip()
rs = lambda: sys.stdin.buffer.readline().split()
ri = lambda: int(sys.stdin.buffer.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: l... |
p03479 | s327783418 | Accepted | x,y = map(int,input().split())
#2^60 = 1,152,921,504,606,846,976 > 10^18である。
for i in range(61):
if y < x * 2**i:
print(i)
exit()
|
p02953 | s821778891 | Wrong Answer | N = int(input())
H = list(map(int, input().split()))[::-1]
high = H[0]
for i in range(1, N):
if high - H[i] < -1:
print("No")
exit()
else:
high = H[i]
print("Yes") |
p02578 | s067401962 | Accepted | # -*- coding: utf-8 -*-
n = int(input())
a = list(map(int, input().split()))
l = []
for i in range(len(a) - 1):
if a[i + 1] < a[i]:
l.append(a[i]-a[i + 1])
a[i + 1] = a[i]
print(sum(l))
|
p03145 | s658752082 | Accepted | import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
def main():
x, y, z = MII()
print(x*y//2)
if __name__ == '__main__':
main()
|
p02661 | s031505361 | Wrong Answer | N=int(input())
A=[]
B=[]
for _ in range(N):
a,b=map(int,input().split())
A.append(a)
B.append(b)
if N%2==0:
A.sort()
B.sort()
c=int(N/2)
d=A[c-1]+B[c-1]
e=A[c]+B[c]
f=e-d
print(f+1)
else:
A.sort()
B.sort()
c=int(N/2)
print(B[c]-A[c]+1) |
p03681 | s521532069 | Accepted | import math
n,m = map(int,input().split())
mod = 10**9+7
fact_n = math.factorial(n) % mod
fact_m = math.factorial(m) % mod
if abs(n-m) >= 2:
print(0)
exit()
elif n == m:
print((fact_n * fact_m * 2) % mod)
else:
print((fact_n * fact_m) % mod) |
p03106 | s123354059 | Accepted | a, b, k = map(int, input().split())
ls = []
for i in range(1, min(a, b)+1):
if a%i==0 and b%i==0:
ls.append(i)
ls = ls[::-1]
print(ls[k-1]) |
p02612 | s205137144 | Accepted | N = int(input())
print(f"{-N % 1000}") |
p03723 | s057143460 | Wrong Answer | A,B,C = map(int,input().split())
if A == B and B == C and C == A:
print(-1)
else:
count = 0
while(A%2==0 and B%2 == 0 and C%2==0):
A_ = A
B_ = B
A = (B+C)/2
B = (A_+C)/2
C = (A_+B_)/2
print(A,B,C)
count+=1
print(count) |
p02772 | s725915383 | Wrong Answer | n = int(input())
L = list(map(int,input().split()))
L = [x for x in L if x%2 ==0]
for i in range(len(L)):
if L[i]%3 == 0 or L[i]%5== 0:
flag = True
else:
flag =False
break
#print(L)
if len(L) == 0:
print("DENIED")
exit()
if flag:
print("APPROVED")
else:
print("DENIED") |
p03075 | s901297778 | Accepted | a = []
for i in range(5):
tmp = input()
a.append(int(tmp))
k = int(input())
ans = True
for i in range(len(a)):
for j in range(i, len(a)):
if(a[j] - a[i] > k):
ans = False
if ans:
print("Yay!")
else:
print(":(") |
p03719 | s139223931 | Accepted | A, B, C = map(int, input().split())
if C >= A and C <= B :
print("Yes")
else :
print("No") |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.