problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p03067 | s793042884 | Wrong Answer | a,b,c, = map(int,input().split())
if a<b:
if c<b:
print("Yes")
else:
print("No")
else:
if b<c:
print("Yes")
else:
print("No") |
p02820 | s490442736 | Accepted | n,k = map(int,input().split())
r,s,p = map(int,input().split())
t = input()
ta = []
for i in range(n) :
ta.append([t[i],1])
for i in range(n-k) :
if ta[i][0] == ta[i+k][0] and ta[i][1] == ta[i+k][1]:
ta[i+k][1] = 0
ans = 0
for i in range(n) :
if ta[i][1] == 1 :
if ta[i][0] == 'r' :
ans += p
if ta[i][0] == 's' :
ans += r
if ta[i][0] == 'p' :
ans += s
print(ans) |
p03327 | s385841988 | 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()))
n = ni()
if n < 1000:
print('ABC')
else:
print('ABD') |
p03095 | s078473974 | Accepted | def main():
from collections import Counter
MOD = 10 ** 9 + 7
N = int(input())
S = input()
ctr = Counter(S)
ret = 1
for count in ctr.values():
ret = (ret * (count + 1)) % MOD
print(ret - 1)
if __name__ == '__main__':
main()
|
p02783 | s654583302 | Wrong Answer | h, a = map(int, input().split(" "))
print((h // a) + 1) |
p02742 | s426300928 | Wrong Answer | import math
H,W = map(int,input().split())
print(math.ceil(H*W/2))
|
p02606 | s962982537 | Accepted | L,R,d = map(int,input().split())
cnt = 0
for i in range(L,R+1):
if i%d == 0:
cnt += 1
print(cnt) |
p02897 | s761551141 | Accepted | N=int(input())
print(len(range(1,N+1,2))/N) |
p02982 | s303665332 | Accepted | import math
n, d = map(int, input().split())
l = []
for i in range(n):
l.append(list(map(int, input().split())))
ans = 0
for i in range(n):
for j in range(i + 1, n):
sum = 0
if i != j:
for k in range(d):
sum += (l[i][k] -l[j][k]) ** 2
dis = math.sqrt(sum)
if dis % 1 == 0:
ans += 1
print(ans) |
p04011 | s830339211 | Accepted |
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
if N <= K:
print(N * X)
else:
print(K * X + (N-K) * Y) |
p02881 | s726635321 | Accepted | import math
N = int(input())
def factortwo(N):
factors = []
for i in range(1, int(math.sqrt(N))+1):
if N % i == 0:
factors.append((i, N // i))
return factors
print(sum(factortwo(N)[-1]) - 2) |
p03380 | s089993446 | Accepted | import sys
readline = sys.stdin.readline
N = int(readline())
A = list(map(int,readline().split()))
# 最も大きい数と、その1/2との差が最も小さい数を選ぶ
A = sorted(A, reverse = True)
one = A[0]
diff = one
ans = -1
for i in range(1,len(A)):
if abs(one / 2 - A[i]) < diff:
diff = abs(one / 2 - A[i])
ans = A[i]
print(one, ans) |
p02690 | s739814832 | Accepted | import sys
def resolve():
x=int(input())
i=1
while 1:
for j in range(i):
if x==i**5-j**5:
print(i,j)
sys.exit()
elif x==i**5+j**5:
print(i, -1*j)
sys.exit()
i+=1
resolve() |
p02594 | s940662655 | Accepted | x = int(input())
if x >= 30:
print("Yes")
else:
print("No") |
p03408 | s623608561 | Accepted | from collections import Counter
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(readline())
s = [readline().decode().rstrip() for _ in range(n)]
m = int(readline())
t = [readline().decode().rstrip() for _ in range(m)]
sc = Counter(s)
tc = Counter(t)
ans = 0
for k, v in sc.items():
if k in tc.keys():
ans = max(ans, v-tc[k])
else:
ans = max(ans, v)
print(ans) |
p02702 | s478482712 | Accepted | S = [int(a) for a in input()[::-1]]
m = 2019
N = len(S)
s = 0
p = 1
X = [0] * 2019
X[0] = 1
ans = 0
for a in S:
s = (s + a * p) % m
ans += X[s]
X[s] += 1
p = p * 10 % m
print(ans) |
p02951 | s059918788 | Accepted | a, b, c = map(int, input().split())
print(max(0, c -(a-b)))
|
p02622 | s652415128 | Accepted | s = input()
t = input()
count = 0
for i in range(len(s)):
if s[i] != t[i]:
count += 1
print(count) |
p02683 | s649911666 | Accepted | n, m, x = [int(i) for i in input().split()]
books = [[int(i) for i in input().split()] for j in range(n)]
def check(lst):
return all([i >= x for i in lst])
ans = float("inf")
for k in range(1<<n):
lst = [sum([(books[i][sub+1] if (k & 1<<i != 0) else 0) for i in range(n)]) for sub in range(m)]
if check(lst):
ans = min(ans, sum([(books[i][0] if (k & 1<<i != 0) else 0) for i in range(n)]))
print(-1 if ans == float("inf") else ans) |
p04019 | s066504304 | Accepted | string = input()
news = "NEWS"
flg = [False for _ in range(4)]
for s in string:
for i in range(4):
if s == news[i]:
flg[i] = True
break
if flg[0] != flg[3] or flg[1] != flg[2]:
print("No")
else:
print("Yes") |
p03145 | s596023192 | Accepted | a,b,c = map(int, input().split())
print((a*b)//2) |
p03910 | s951097344 | Accepted | import math
N = int(input())
n = int(math.ceil((-1 + math.sqrt(1 + 8 * N)) / 2))
d = n * (n + 1) // 2 - N
for i in range(1, n + 1):
if i != d:
print(i)
|
p02959 | s193875390 | Wrong Answer | n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
count = 0
print(a)
print(b)
for i in range(n):
if b[i] >= a[i] + a[i+1]:
count += a[i] + a[i+1]
a[i+1] = 0
elif b[i] > a[i] and b[i] < a[i] + a[i+1]:
count += b[i]
a[i+1] -= b[i] - a[i]
elif a[i] >= b[i]:
count += b[i]
print(count)
|
p03448 | s743875058 | Accepted | A, B, C, X = [int(input()) for _ in range(4)]
print([500 * a + 100 * b + 50 * c for c in range(C + 1) for b in range(B + 1) for a in range(A + 1)].count(X)) |
p02747 | s571559823 | Wrong Answer | s=input()
n=len(s)
t=set(s)
buf=0
for i in range(1,n):
if s[i-1]=='h' and s[i]=='i':
buf+=1
if buf>=1 and n%2==0 and len(t)==2:
print('Yes')
else:
print('No') |
p03469 | s745362154 | Accepted | S=input()
s=[]
for i in range(len(S)):
if i==3:
s.append("8")
else:
s.append(S[i])
print("".join(s)) |
p03457 | s134121988 | Wrong Answer | N = int(input())
pairs = [list(map(int, input().split())) for _ in range(N)]
x0 = 0
y0 = 0
t0 = 0
res = "Yes"
for t, x, y in pairs:
dx = x - x0
dy = y - y0
if dx + dy != t - t0:
tmp = t - t0 - (dx + dy)
if tmp < 0 or tmp % 2 != 0:
res = "No"
break
x0 += x
y0 += y
t0 += t
print(res) |
p02957 | s325142963 | Accepted | a,b=map(int,input().split())
if(abs(b-a)%2==0):
print(abs(b-a)//2+min(a,b))
else:
print('IMPOSSIBLE') |
p03673 | s885082232 | Wrong Answer | n=int(input())
l=list(map(int,input().split()))
al=[]
for i in l:
al.append(i)
al[::-1]
print(al) |
p02731 | s951687413 | Accepted | L = int(input())
print(L * L * L / 27)
|
p02608 | s494095630 | Wrong Answer | n = int(input())
for i in range(1,n+1):
ans = 0
for x in range(35):
for y in range(35):
for z in range(35):
if (x+y+z)**2 -(x*y+y*z+z*x) == i and x>=1 and y>=1 and z>=1:
ans += 1
print(ans)
|
p03672 | s757986691 | Wrong Answer | s = input()
n = -2
while len(s) > abs(n):
if s[:(len(s[:n])//2)] == s[(len(s[:n])//2):n]:
print(len(s[:(len(s[:n])//2)])*2)
n -= 2 |
p02582 | s424601272 | Accepted | S = input()
if S == "RRR":
print(3)
elif "RR" in S:
print(2)
elif "R" in S:
print(1)
else:
print(0)
|
p03672 | s228093749 | Accepted | s = list(input())
length = len(s)
for i in range(length):
s.pop()
if len(s)%2 == 0:
if s[:len(s)//2] == s[len(s)//2:]:
print(len(s))
exit()
else:
continue
|
p02922 | s186771631 | Wrong Answer | A, B = map(int, input().split())
if (B-1)%(A-1) == 0:
print((B-1)/(A-1))
else:
print((B-1)//(A-1) +1) |
p03087 | s900788618 | Wrong Answer | n,q = map(int,input().split())
s = input()
lr=[list(map(int,input().split())) for i in range(q)]
l=[0]*n
r=[0]*n
lcnt=0
rcnt=0
for i in range(n-1):
if s[i]=="A" and s[i+1] == "C":
# lcnt+=1
rcnt+=1
l[i+1]=1
r[i+1]=rcnt
print(l)
print(r)
for i in lr:
# print(max(0,r[i[1]-1]-r[i[0]-1]-l[i[0]-1]))
print(max(0,r[i[1]-1]-r[i[0]-1])) |
p03264 | s721889597 | Wrong Answer | N=int(input())
if N%2==1:
print((N//2+1)*N//2) |
p02859 | s265815665 | Accepted | print(int(input())**2) |
p03723 | s992953296 | Wrong Answer | A, B, C = map(int, input().strip().split())
ans = 0
while A != B and B != C and (A % 2) + (B % 2) + (C % 2) == 0:
A, B, C = (B + C) // 2, (A + C) // 2, (A + B) // 2
ans += 1
if A == B == C:
ans = -1
print(ans) |
p02988 | s362557543 | Accepted | N = int(input())
P = list(map(int, input().split()))
ans = 0
for i in range(1, N-1):
if P[i-1] > P[i] > P[i+1] or P[i-1] < P[i] < P[i+1]:
ans += 1
print(ans) |
p02785 | s766456680 | Accepted | N,K = map(int,input().split())
H = list(map(int,input().split()))
sort = sorted(H, reverse = True)
ans = 0
for i in range(N):
if i+1 > K:
ans += sort[i]
print(ans) |
p02793 | s264590049 | Accepted | # -*- coding: utf-8 -*-
import fractions
def min_kou(a):
ans = a[0]
for i in range(1, len(a)):
ans = ans * a[i] // fractions.gcd(ans, a[i])
return ans
def main():
N = int(input())
A = list(map(int, input().split()))
min_res = min_kou(A)
ans = 0
for i in A:
ans += min_res // i
print(ans % 1000000007)
if __name__ == '__main__':
main() |
p02624 | s196919109 | Wrong Answer | #172D
#Sum of Divisors
n=int(input())
ans=0
for i in range(1,n+1):
j=1
while i*j<=n:
ans+=i*j
j+=1
print(i,j,ans)
print(ans) |
p02842 | s537064029 | Accepted | N = int(input())
Tax = False
for i in range(50000):
if int(i*1.08) == N:
Tax = True
break
if Tax:
print(i)
else:
print(':(') |
p03803 | s331763373 | Accepted | a,b=map(lambda x:(int(x)+11)%13,input().split());print("Alice"if a>b else"Draw"if a==b else"Bob") |
p02548 | s071124444 | Wrong Answer | def get_divisors_number(n):
arr = []
temp = n
for i in range(2, int(-(-n**0.5//1))+1):
if temp%i==0:
cnt=0
while temp%i==0:
cnt+=1
temp //= i
arr.append(cnt)
if temp!=1:
arr.append(1)
if arr==[]:
arr.append(1)
divisorsNumber = 1
for i in arr:
divisorsNumber *= (i+1)
return divisorsNumber
N = int(input())
result = 0
for i in range(N-1):
result += get_divisors_number(i+1)
print(result) |
p03773 | s660524528 | Accepted | a,b=map(int,input().split())
if a+b<24:
print(a+b)
else:
print(a+b-24) |
p02687 | s700041155 | Accepted | def main():
s = input()
if s == 'ABC':
print('ARC')
else:
print('ABC')
if __name__ == '__main__':
main()
|
p03659 | s871173005 | Accepted | n = int(input())
A = list(map(int,input().split()))
total = sum(A)
x = 0
ans = float("inf")
for i in range(n-1):
x += A[i]
y = total - x
ans = min(ans,abs(x-y))
print(ans) |
p02675 | s108572978 | Wrong Answer | n = str(input("n:"))
N = n[-1]
if N == "3":
print("bon")
elif N == "0" :
print("pon")
elif N == "1" :
print("pon")
elif N == "6":
print("pon")
elif N == "8":
print("pon")
else:
print("hon") |
p02765 | s902934072 | Accepted | N,R = map(int,input().split())
if N >= 10:
print(R)
else:
print(R+100*(10-N)) |
p02582 | s560351042 | Accepted | S = input()
s = list(S)
a = 0
for i in s:
if i == 'R':
a += 1
if a != 2:
print(a)
elif s[1] == 'R':
print(2)
else:
print(1)
|
p02645 | s719782066 | Wrong Answer | s = str(input())
print(s[5:8]) |
p03208 | s775060756 | Wrong Answer | n,k = map(int,input().split())
h = [int(input()) for i in range(n)]
h.sort()
minh = h[0]
for i in range(n-k+1):
minh = min(minh,h[i+k-1]-h[i])
print(minh) |
p03000 | s294179646 | Wrong Answer | def intMap(): return map(int,input().split())
def intList(): return list(map(int, input().split()))
n,x = intMap()
l = intList()
d = 0
i = 0
while d <= x:
d = d + l[i]
i += 1
if i >= n: break
# ans = min(i,n)
print(i)
|
p02678 | s108048674 | Accepted | from collections import deque
N,M=map(int,input().split())
d=dict()
for i in range(M):
a,b=map(int,input().split())
d.setdefault(a,set()).add(b)
d.setdefault(b,set()).add(a)
s=set()#ラベルを貼った場所に置く
label=dict()
A=deque()
A.append(1)
while A:
a=A.popleft()
b=d[a]
b-=s
for i in b:
if i not in label:
label[i]=a
A.append(i)
k=deque(sorted(label.keys()))
a=k.popleft()
print("Yes")
for i in k:
print(label[i]) |
p02659 | s378529873 | Accepted | a, b = map(float, input().split())
ib = round(b * 100 + 0.1)
res = int(a) * ib // 100
print(res) |
p03761 | s775151570 | Wrong Answer | n = int(input())
#n, m = list(map(int, input().split()))
s = []
for i in range(n):
s.append(input())
a = s[0]
ans = []
for i in range(len(a)):
flag = True
for j in range(1, n):
if not(a[i] in s[j]):
flag = False
if flag == True:
ans += a[i]
ans.sort()
for a in ans:
print(a, end="")
|
p02661 | s817793328 | Accepted | import sys
input = sys.stdin.buffer.readline
N = int(input())
A, B = [], []
for i in range(N):
_a, _b = map(int, (input().split()))
A.append(_a); B.append(_b)
A.sort(); B.sort()
if N%2: # 奇数
ans = B[N//2] - A[N//2] + 1
else: # 偶数
ans = (B[N//2] + B[N//2-1]) - (A[N//2] + A[N//2-1]) + 1
print(ans) |
p03645 | s200639144 | Wrong Answer | N, M = map(int,input().split())
ll = [[i for i in input().split()]for j in range(M)]
a = [0]*N
b = [0]*N
for i in range(M):
if ll[i][0] == 1:
a[ll[i][1]-1] += 1
if ll[i][1] == N:
b[ll[i][0]-1] += 1
for i in range(N):
if a[i] != 0 and b[i] != 0:
print("POSSIBLE")
exit()
else:
pass
print("IMPOSSIBLE")
|
p03127 | s675746304 | Wrong Answer | from fractions import gcd
def main():
n = int(input())
As = list(map(int, input().split()))
print(n)
print(As)
ans = gcd(As[0], As[1])
for i in range(2, n):
ans = gcd(ans, As[i])
print(ans)
if __name__ == "__main__":
main()
|
p03799 | s538783497 | Accepted | N, M = map(int, input().split())
if N > M/2:
ans = M//2
else:
ans = N
M -= 2*N
ans += M//4
print(ans) |
p03944 | s012017321 | Accepted | W, H, N = map(int, input().split())
u, U, v, V = 0, W, 0, H
for _ in range(N):
x, y, a = map(int,input().split())
if a == 1:
u = max(u,x)
if a == 2:
U = min(U,x)
if a == 3:
v = max(v,y)
if a == 4:
V = min(V,y)
f = lambda x:x if x > 0 else 0
print(f(U-u)*f(V-v)) |
p02732 | s305727391 | Wrong Answer | #input
N = int(input())
A = list(map(int, input().split()))
#output
from collections import Counter
L = Counter(A)
original_answer = 0
for i in range(1, N):
original_answer += ( L[i] * (L[i]-1) )// 2
for i in range(N):
print(original_answer - (L[A[i]]*(L[A[i]]-1))//2 + ((L[A[i]]-1)*(L[A[i]]-2))//2) |
p02767 | s319097249 | Accepted | N= int(input())
X = list(map(int,input().split()))
def calc(n):
ans = 0
for x in X:
ans += (x-n)**2
return ans
ans = 100000000
for n in range(100):
ans = min(ans,calc(n))
print(ans) |
p03962 | s118557883 | Accepted | a = list(map(int, input().split()))
print(len(set(a))) |
p03251 | s591447541 | Wrong Answer |
n, m, X, Y = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
#s = int(input())
z_min = X+1
z_max = Y
print(z_max)
print(z_min)
if Y-X > 0:
if z_min <= max(x) and z_max >= min(y) and min(y)-max(x)>0:
print("No War")
exit()
print("War") |
p02577 | s709552642 | Accepted | #B
N=list(input())
for i in range(len(N)):
N[i]=int(N[i])
num=sum(N)
if num%9==0:
ans='Yes'
else:
ans='No'
print(ans) |
p02952 | s756131770 | Accepted | a = int(input())
total = 0
for i in range(1,a+1):
if i<10 or 99<i<1000 or 9999<i<100000:
total+=1
print(total) |
p03059 | s288862352 | Wrong Answer | a,b,t=map(int,input().split())
print(int(b*(t+0.5)//a)) |
p03720 | s696624166 | Accepted | N,M = map(int,input().split())
a =[0]*M
b =[0]*M
ans = [0]*N
for i in range(M):
a[i],b[i] = map(int,input().split())
for _ in range(M):
ans[a[_]-1]+=1
ans[b[_]-1]+=1
for j in range(N):
print(ans[j]) |
p03448 | s339328402 | Wrong Answer | a=int(input())
b=int(input())
c=int(input())
x=int(input())
s=50*c
print(len([1 for i in range(a+1) for m in range(b+1) if 0<=x-500*i+100*m<=s])) |
p02702 | s820287767 | Accepted | number = str(input())[::-1]
remainderDictionary = {0: 1}
sum = 0
x = 1
for i in number:
x = (x * 10) % 2019
sum = (sum + int(i) * x) % 2019
remainderValue = remainderDictionary.get(sum,0) + 1
remainderDictionary[sum] = remainderValue
ans = 0
for i in remainderDictionary:
value = remainderDictionary[i]
ans += value * (value - 1) // 2 # N C 2
print(ans) |
p02645 | s068184422 | Accepted | s = input()
print(s[0:3]) |
p02597 | s805434547 | Accepted | N=int(input())
c=input()
print(c[:c.count('R')].count('W')) |
p03456 | s127396667 | Accepted | import math
a, b = map(int, input().split())
c = str(a) + str(b)
d = math.sqrt(int(c))
if d.is_integer() == True:
print("Yes")
else:
print("No") |
p02742 | s718437440 | Accepted | [H, W] = list(map(int, input().split()))
area = H*W
if H == 1 or W == 1:
print(1)
else:
if area%2 == 0:
print(int(area/2))
if area%2 == 1:
print(area//2 + 1)
|
p03485 | s446519397 | Accepted | a, b = map(int, input().split())
m = (a+b+1)//2
print(m) |
p03486 | s063104405 | Wrong Answer | #!/usr/bin/env python3
def main():
s = list(input())
t = list(input())
com = set(s) & set(t)
for c in com:
s.remove(c)
t.remove(c)
s.sort()
t.sort(reverse=True)
if s < t:
print("Yes")
else:
print("No")
main()
|
p02899 | s799716886 | Wrong Answer | n = int(input())
num = list(map(int, input().split()))
ans = [0]*n
j = 1
for i in num:
ans[i-1] = j
j += 1
print(ans) |
p03814 | s772129486 | Accepted | s = input()
left = s.index('A')+1
right = len(s)-s[::-1].index('Z')
ans = right - left + 1
print(ans)
|
p02793 | s189357936 | Accepted | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,pprint,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))
n = inp()
aa = inpl()
g = 1
for a in aa:
g = a*g//fractions.gcd(a,g)
g %= mod
res = 0
for a in aa:
res += g*pow(a,mod-2,mod)
res %= mod
print(res) |
p03804 | s708087347 | Accepted | n,m = map(int,input().split())
ag = []
for i in range(n):
ag.append(list(input()))
bg = []
for i in range(m):
bg.append(list(input()))
for i in range(n-m+1):
for j in range(n-m+1):
u = []
for k in range(m):
u.append(ag[j+k][i:i+m])
if u == bg:
print("Yes")
exit()
print("No")
|
p03627 | s750966297 | Accepted | n=int(input())
a=list(map(int,input().split()))
a.sort()
l=0
w=0
c=0
for i in range(n-1,0,-1):
if a[i]==a[i-1] and l==0:
l=a[i]
a[i]=0
a[i-1]=0
elif a[i]==a[i-1] and w==0:
w=a[i]
print(l*w)
break
if w==0:
print(0) |
p03457 | s178165194 | Accepted | n = int(input())
ti,xi,yi = 0,0,0
found = True
for _ in range(n):
t, x, y = map(int, input().split())
root = abs(x-xi)+abs(y-yi)
if root > (t-ti) or (t-ti-root)&1:
found = False
ti,xi,yi = t,x,y
print("Yes" if found else "No") |
p02795 | s693603290 | Accepted | h=int(input())
w=int(input())
n=int(input())
d=max(h,w)
ans=1
while d*ans<n:
ans+=1
print(ans) |
p02584 | s354544551 | Accepted | [X, K, D] = list(map(int, input().split()))
X = abs(X)
Y = K%2
if X//D < K:
if (X//D)%2 == Y:
X = X%D
else:
X = D-X%D
else:
X=X-K*D
print(X) |
p02793 | s401057083 | Accepted | def gcd(a, b):
while b:
a, b = b, a % b
return a
def lcm(a, b):
return a * b // gcd (a, b)
n=int(input())
a=list(map(int,input().split()))
l=1
for i in range(0,n):
l=lcm(l,a[i])
ans=0
for i in range(0,n):
ans=ans+l//a[i]
print (ans%(10**9+7)) |
p02725 | s654392045 | Accepted | perimeter, n = map(int, input().split())
houses = list(map(int, input().split()))
e = []
max = 0
for i in range(n-1) :
e.append(houses[i + 1] - houses[i])
e.append(perimeter - houses[n-1] + houses[0])
for i in range(n):
if e[i] > max:
max = e[i]
print(perimeter - max)
|
p03472 | s437784622 | Accepted | n,h=map(int,input().split())
a,b=[],[]
for i in range(n):
inp=list(map(int,input().split()))
a.append(inp[0])
b.append(inp[1])
am=max(a)
b.sort()
b.reverse()
c=0
for i in b:
if i<am:
break
c+=1
h-=i
if h<=0:
break
c+=max((h-1)//am+1,0)
print(c) |
p02972 | s570296893 | Wrong Answer | N = int(input())
a = list(map(int, input().split()))
b = [0 for _ in range(N)]
b[N-1] = a[N-1]
for i in reversed(range(N)):
sum = 0
for j in range(2, N):
if i*j < N:
sum += b[i*j]
else:
break
if sum%2 == a[i]:
b[i] = 0
else:
b[i] = 1
ans = [str(i+1) for i, x in enumerate(b) if x == 1]
print(len(ans))
if len(ans) != 0:
print(" ".join(ans)) |
p02621 | s690135684 | Accepted | import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()
def resolve():
a=int(input())
print(a+a**2+a**3)
resolve() |
p03455 | s702101546 | Accepted | a, b = map(int, input().split())
if (a*b)%2 == 0:
print("Even")
else:
print("Odd") |
p02622 | s578732366 | Accepted | S = input()
T = input()
ls = list(S)
ln = len(ls)
ans = 0
for i in range(ln):
if S[i] != T[i]:
ans += 1
print(ans) |
p03284 | s554103841 | Accepted | n, k = map(int, input().split())
print(int(n % k > 0)) |
p04005 | s627638926 | Wrong Answer | a, b, c = map(int, input().split())
if (a % 2 == 0)|(b % 2 == 0)|(c % 2 == 0):
print(0)
else:
print(min(a*b, b*c)) |
p03796 | s362273679 | Accepted | N = int(input())
p = 1
for i in range(N):
p *= i + 1
p %= 1000000007
print(p) |
p02640 | s096325720 | Accepted | line = list(map(int, input().split()))
if line[1] % 2 != 0:
print("No")
elif line[0] * 4 >= line[1] and line[0] * 2 <= line[1]:
print("Yes")
else:
print("No")
|
p03778 | s941387779 | Wrong Answer | w, a, b = map(int, input().split())
print(max(b-a-w, a-b-w)) |
p03281 | s676792613 | Accepted | n = int(input())
y = 0
for i in range(1, n+1, 2):
x = 0
for j in range(1, i+1):
if i % j == 0:
x += 1
if x == 8:
y += 1
print(y) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.