problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p03345 | s005423906 | Accepted | a,b,c,n = map(int, input().split())
ans = (-1)**n*a+(-1)**(n-1)*b
if abs(ans)>10**18:
print('Unfair')
else:
print(int(ans))
|
p03472 | s320950322 | Accepted | import math
n,h=map(int,input().split())
ans=0
m=0
b=[]
for i in range(n):
a,B=map(int,input().split())
b.append(B)
m=max(m,a)
b=sorted(b,reverse=True)
for i in range(len(b)):
if b[i]<m:
break
else:
h-=b[i]
ans=i+1
if h<1:
print(ans)
exit()
print(ans+math.ceil(h/m))
|
p02765 | s298255665 | Wrong Answer | N, R = map(int, input().split())
if N >= 10:
print(R)
else:
print(R - (100 * (10 - N))) |
p04005 | s948607077 | Accepted | #AtCoder Grand Contest 004 a
a,b,c=map(int,input().split())
if a%2==1 and b%2==1 and c%2==1:
print(min(a*b,b*c,c*a))
else:
print(0) |
p03059 | s956481014 | Accepted | a, b, t = map(int, input().split())
print(b*(t//a)) |
p03281 | s353053068 | Accepted | N = int(input())
ans = 0
for i in range(1, N+1, 2):
divisor = 0
for j in range(1, i+1, 2):
if i%j == 0:
divisor += 1
if divisor == 8:
ans += 1
print(ans) |
p02660 | s251489337 | Wrong Answer | N = int(input())
a = [0 for i in range(int(N**0.5)+1)]
c = 0
i = 2
m = 0
while i < N**0.5:
if N % i == 0:
a[i] += 1
N = N / i
m = i
i -= 1
i += 1
if N == 1:
break
for j in range(2, m+1):
if a[j] != 0:
d = 0
while a[j] > d:
a[j] -= d+1
d += 1
c += d
print(c+1, end='') |
p02645 | s110149879 | Wrong Answer | s=input()
print(s[0:2]) |
p03107 | s636355213 | Accepted | s=list(input())
a=s.count('0')
b=s.count('1')
print(min(b,a)*2) |
p03657 | s103233004 | Accepted | A, B = map(int,input().split())
if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0 :
print( "Possible" )
else:
print( "Impossible" ) |
p02624 | s400049695 | Wrong Answer | N = int(input())
ans = 0
for i in range(1, N+1):
b = N // i
ans += i * b * (b+1) / 2
print(ans) |
p03994 | s126462067 | Accepted | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
goal = ord("z") + 1
s = input()
k = int(input())
n = len(s)
ans = [0] * n
for i,si in enumerate(s):
if si == "a":ans[i] = "a"
elif goal - ord(si) <= k:
k -= goal - ord(si)
ans[i] = "a"
else:
ans[i] = si
m = k % 26
ans[-1] = chr((ord(ans[-1]) - ord("a") + m)%26 + ord("a"))
print(*ans,sep="") |
p02596 | s991669975 | Accepted | k = int(input())
rem = 7%k
alreadys = [False]*k
alreadys[rem] = True
ans = 1
while True:
if rem == 0:
print(ans)
exit()
ans += 1
rem = (rem*10+7)%k
if alreadys[rem]:
print(-1)
exit()
alreadys[rem] = True |
p03487 | s117615211 | Accepted | import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce
rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7
ri()
a = rl()
d = collections.Counter(a)
ans = 0
for k, v in d.items():
if k <= v:
ans += (v-k)
else:
ans += v
print(ans)
|
p02622 | s012531203 | Accepted | s=input()
t=input()
p=0
for i in range(len(s)):
if(s[i]!=t[i]):
p+=1
print(p) |
p02859 | s011691534 | Accepted | r = int(input())
print(r**2) |
p02882 | s592032597 | Accepted | import math
from decimal import Decimal
A,B,X = map(Decimal, input().split())
s = X / A
if s == A*B:
print(0)
exit()
if s > A * B / 2:
Bu = 2 * s / A - B
s -= A*Bu
B -= Bu
A2 = 2 * s / B
print(math.degrees(math.atan(B/(A2))))
|
p03545 | s651263280 | Wrong Answer | ABCD = str(input())
n = len(ABCD)-1
ABCD_ = ''
output = ''
for i in range(2**n):
ABCD_ = ABCD[0]
for j in range(n):
if ((i >> j)&1) == 1:
ABCD_ = ABCD_ + '+' + ABCD[j+1]
else:
ABCD_ = ABCD_ + '-' + ABCD[j+1]
if eval(ABCD_) == 7:
output = ABCD_
print(output) |
p02957 | s237778933 | Accepted | a,b=map(int,input().split())
if((a+b)%2)==0:
print((a+b)//2)
else:
print("IMPOSSIBLE") |
p03479 | s639774289 | Accepted | X, Y = map(int, input().split(' '))
count = 0
while X <= Y:
count += 1
X *= 2
print(count)
|
p03719 | s888582960 | Accepted | a,b,c=map(int,input().split())
print("Yes" if c>=a and c<=b else "No") |
p03827 | s501551140 | Wrong Answer | #2020-04-29
x = 0
lst = [0]
n = int(input())
s = list(input())
for i in range(n-1):
if s[i] == 'I':
x += 1
lst.append(x)
else:
x -= 1
lst.append(x)
print(max(lst)) |
p03774 | s615188824 | Wrong Answer | N,M=map(int,input().split())
AB=[list(map(int,input().split())) for i in range(N)]
CD=[list(map(int,input().split())) for j in range(M)]
for i in range(N):
d=(10**8)*2
ans=0
for j in range(M):
if abs(AB[i][0]-CD[j][0])+abs(AB[i][1]-CD[j][1])<d:
d=abs(AB[i][0]-CD[j][0])+abs(AB[i][1]-CD[j][1])
ans=j+1
print(ans) |
p03251 | s406768865 | Accepted | n,m,x,y = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
a.append(x)
b.append(y)
a =sorted(a)
b =sorted(b)
if a[-1]<b[0]:
print('No War')
else:
print('War') |
p02838 | s439241441 | Wrong Answer | import queue
import numpy as np
import math
n = int(input())
A = list(map(int, input().split()))
A = np.array(A,np.int64)
ans = 0
for i in range(60 + 1):
count1 = 0
for a in A:
count1 += (a >> i) & 1
count0 = len(A) - count1
ans += count1*count0 * pow(2, i)
ans%=1000000007
print(ans) |
p03699 | s457741984 | Accepted | def inp():
return(int(input()))
n = inp()
scores = [0]
for i in range(n):
scores.append(inp())
scores = sorted(scores)
d = 0
for s in scores:
sm = sum(scores)
if sm % 10 == 0:
sm -= s
if sm % 10 != 0:
d = sm
break
print(d)
|
p03719 | s644159580 | Accepted | import math
a,b,c=map(int,input().split())
print("Yes" if a<=c<=b else "No" )
|
p02608 | s035729489 | Accepted | N = int(input())
n = int(N**(1/2))
ans_list = [0]*(N)
for i in range(1,n):
for j in range(1,n):
for k in range(1,n):
index = i**2+j**2+k**2+i*j+j*k+k*i
if index>N:
break
ans_list[index-1] += 1
for i in ans_list:
print(i)
|
p03261 | s064489241 | Accepted | n=int(input())
w=[input() for _ in range(n)]
if len(set(w))!=n:
print("No")
else:
ans="Yes"
for i in range(1,n):
if w[i][0]!=w[i-1][-1]:
ans="No"
break
print(ans) |
p02835 | s645912128 | Wrong Answer | a, b, c = map(int, input().split())
k = a+b+c
if k >= 22:
print("win")
else:
print("bust") |
p03998 | s903299941 | Accepted | A=input()
B=input()
C=input()
ListA=list(A)
ListB=list(B)
ListC=list(C)
pile = "a"
res = ""
for i in range(400):
if pile == "a":
pile = ListA.pop(0)
elif pile == "b":
pile = ListB.pop(0)
else:
pile = ListC.pop(0)
if len(ListA) == 0 and pile == "a":
res = "A"
break
elif len(ListB) == 0 and pile == "b":
res = "B"
break
elif len(ListC) == 0 and pile == "c":
res = "C"
break
else:
pass
print(res) |
p03449 | s316329456 | Accepted | n=int(input())
A =list(map(int,input().split()))
B =list(map(int,input().split()))
ans = 0
for i in range(n):
ans = max(sum(A[0:i+1:1])+sum(B[i:n:1]),ans)
print(ans) |
p02790 | s740077632 | Wrong Answer | a=[v for v in input().split()]
u=int(a[0])
for i in range (0,u):
print(a[1],end='') |
p03220 | s627432791 | Accepted | n = int(input())
t,a = map(int, input().split())
h = list(map(int, input().split()))
ans = 1000000
cnt = 0
T = [0 for i in range(n)]
for i in range(n) :
T[i] = t - h[i]*0.006
q = abs(a - T[i])
if (q < ans) :
ans = q
cnt = i+1
print(cnt) |
p02618 | s780224601 | Wrong Answer | #B問題
D = int(input())
cs = list(map(int, input().split()))
ss = [input().split() for l in range(D)]
for i in range(D):
print((i+1)%26) |
p02987 | s228143504 | Accepted | def main():
from collections import Counter
S = list(input())
if len(Counter(S))==2:
print("Yes")
else:
print("No")
if __name__=="__main__":
main() |
p02647 | s170240495 | Wrong Answer | n, k = map(int, input().split())
a = list(map(int, input().split()))
for _ in range(k):
on = [0 for _ in range(n+1)]
for i in range(n):
left = max(i - a[i], 0)
right = min(i + a[i] + 1, n)
on[left] += 1
on[right] -= 1
for j in range(1, n+1):
on[j] += on[j-1]
if on.count(n) == n:
break
a = on[:]
print(*a[:n]) |
p03835 | s245261085 | Accepted | p = input().split()
k = int(p[0])
s = int(p[1])
x = -1
y = -1
z = 0
answer = 0
for num in range(k+1):
x += 1
y = -1
for n in range(k+1):
y += 1
z = s - x - y
if 0 <= z and z <= k:
answer += 1
print(answer) |
p03804 | s966017011 | Accepted | n, m = map(int, input().split())
a = []
b = []
for _ in range(n):
a.append(input())
for _ in range(m):
b.append(input())
flag = 0
cnt = 0
for i in range(n-m+1):
for j in range(n-m+1):
for k in range(m):
if a[i+k][j:j+m] == b[k]:
cnt += 1
if cnt == m:
flag = 1
cnt = 0
if flag == 1:
print('Yes')
else:
print('No') |
p02601 | s961739469 | Accepted | A,B,C = map(int,input().split())
K = int(input())
for i in range(0,K+1):
for j in range(0,K+1):
for h in range(0,K+1):
if A*(2**i)<B*(2**j)<C*(2**h) and (i+j+h)<=K:
print("Yes")
exit()
print("No") |
p02603 | s882091216 | Accepted | N = int(input())
A = list(map(int,input().split()))
money = 1000
kabu = 0
p = [1]*N
for i in range(N-1):
if A[i] < A[i+1]:
p[i] = 0
elif A[i] > A[i+1]:
p[i] = 2
for i in range(N-1):
if A[i] < A[i+1] and p[i] == 0 and kabu == 0:
kabu = money//A[i]
money -= (A[i]*kabu)
elif A[i] > A[i+1] and p[i] == 2:
money += (kabu*A[i])
kabu = 0
money += (A[-1]*kabu)
print(money) |
p02987 | s143473825 | Wrong Answer | s=input()
result=''
count=0
for i in s:
if result != i:
result==i
count+=1
if count==2:
print('Yes')
else:
print('No') |
p02742 | s254544623 | Wrong Answer | H, W = list(map(int, input().split()))
### 片方だけ奇数のマスには行くことができない
### Hが偶数、Wが偶数の場合 → H*W // 2
### Hが奇数、Wが偶数の場合 → H*W // 2 (Wが奇数の場合も同様)
### Hが奇数、Wが奇数の場合 → H*W // 2 + 1
if H % 2 != 0 and W % 2 != 0:
print(H * W // 2 + 1)
else:
print(H * W // 2) |
p02724 | s127687783 | Accepted | x = int(input())
sum = 0
sum += (x // 500) * 1000
x = x - (x // 500) * 500
sum += (x // 5) * 5
print(sum)
|
p02755 | s268103421 | Wrong Answer | import math
#Input
A,B= map(int, input().split())
#Process
Ans = -1
tmp08_min = math.ceil(A / 0.08)
tmp08_max = tmp08_min + 13
tmp10_min = math.ceil(B / 0.10)
tmp10_max = tmp10_min + 10
tmp_min = min(tmp08_min, tmp10_min)
tmp_max = max(tmp08_max, tmp10_max)
cnt = 0
while cnt < tmp_max - tmp_min:
if(A == int((tmp_min + cnt) * 0.08) and B == int((tmp_min + cnt) * 0.10)):
Ans = tmp10_min + cnt
break
cnt += 1
#Output
print(Ans) |
p03835 | s359923797 | Wrong Answer | k,s=map(int,input().split())
p=0
for i in range(k+1):
for j in range(k+1):
if s- i - j <= k:
p += 1
print(p) |
p02723 | s270764714 | Wrong Answer | def coffee_like(s):
if (s[2] == s[3]) and (s[4] == s[5]):
return 'Yes'
else:
return 'No'
coffee_like(s=input()) |
p03416 | s774906725 | Accepted | a, b = map(int, input().split())
ans = 0
for i in range(a, b + 1):
s = str(i)
if s[0] == s[-1] and s[1] == s[-2]:
ans += 1
print(ans)
|
p04020 | s779905280 | Wrong Answer | n=int(input())
a=[int(input()) for i in range(n)]
r=[0]*(n+2)
ans=0
for i in range(n):
if n==1:
ans+=a[i]//2
r[i]=a[i]%2
continue
if i==n-1:
a[i]+=r[i-1]
ans+=a[i]//2
continue
a[i]+=r[i-1]
ans+=a[i]//2
a[i]-=r[i-1]
r[i]=a[i]%2
print(ans)
|
p03723 | s475455719 | Accepted | # -*- coding: utf-8 -*-
a,b,c=map(int,input().split())
ans=0
while True:
if a%2==1 or b%2==1 or c%2==1:
break
if a==b==c:
ans=-1
break
ans+=1
na=(b+c)/2
nb=(c+a)/2
nc=(a+b)/2
a=na
b=nb
c=nc
print(ans)
|
p03433 | s160279022 | Wrong Answer | int_list = [int(input()) for i in range(2)]
if int_list[0] % 500 <= int_list[1]:
print("yes")
else:
print("no") |
p03210 | s913226542 | Accepted | x = int(input())
if x==3 or x==5 or x==7:
print('YES')
else:
print('NO') |
p02706 | s506774287 | Accepted | import math
N,M = map(int,input().split())
A = list(input().split())
homework=0
for i in range(M):
homework=homework + int(A[i])
ans=N - homework
if ans < 0:
print("-1")
else:
print(ans) |
p03331 | s064539524 | Wrong Answer | def sumNum(num, sums):
if num == 0:
return sums
sums += num % 10
num = num // 10
return sumNum(num, sums)
N = int(input())
keta = 100001
for A in range(2, N):
B = N - A
_A = sumNum(A, 0)
_B = sumNum(B, 0)
ret = _A + _B
if keta <= ret:
continue
keta = ret
print(keta)
|
p04045 | s550428069 | Accepted | n, k = map(int, input().split())
data = list(map(int, input().split()))
ng = set(data)
for i in range(n, 10*n+1):
if all(int(c) not in ng for c in str(i)):
print(i)
break |
p03109 | s857333930 | Wrong Answer | s = input()
if int(s[5:6]) <=4:
print('Heisei')
else:
print('TBD') |
p02603 | s214143102 | Wrong Answer | N = int(input())
A = list(map(int, input().split()))
money = 1000
cnt = 0
if A[0] < A[1]:
cnt += 1000 // A[0]
money -= cnt * A[0]
for i in range(1, N-1):
if A[i] <= A[i - 1] and A[i] < A[i + 1]:
cnt += money // A[i]
money -= cnt * A[i]
elif A[i] >= A[i-1] and A[i] > A[i + 1]:
money += cnt * A[i]
cnt = 0
if cnt != 0:
money += cnt * A[N - 1]
cnt = 0
print(money) |
p02603 | s689235520 | Accepted | n = int(input())
a = list(map(int, input().split()))
ans = 1000
for i in range(n - 1):
if a[i] < a[i + 1]:
ans = ans % a[i] + (ans // a[i]) * a[i + 1]
print(ans)
|
p03951 | s066052568 | Wrong Answer | n = int(input())
s = input()
t = input()
char = set()
for i in range(n):
char.add(s[i])
char.add(t[i])
print(len(char))
|
p02786 | s443134036 | Wrong Answer | def main():
import math
H = int(input())
if H == 1:
print(1)
else:
if H%2 != 0:
H += 1
count = int(math.log(H,2))
ans = 0
for i in range(count):
ans += 2**(i)
if i == count-1:
ans += 2**(i+1)
print(ans)
if __name__ == '__main__':
main() |
p03030 | s201661818 | Wrong Answer | n=int(input())
rec=[]
for i in range(n):
a,b=input().split()
rec.append([a,int(b),i+1])
rec.sort()
for i in rec:
print(i[2]) |
p02646 | s533563799 | Accepted | a,v = map(int,input().split())
b,w = map(int,input().split())
t = int(input())
m = abs(a-b)
if a>b:
if (v-w)*t>=m:
print("YES")
else:
print("NO")
else:
if (v-w)*t>=m:
print("YES")
else:
print("NO")
|
p03799 | s434168588 | Accepted | N, M = map(int, input().split())
m = min(N, M//2)
N = N-m
M = M - m * 2
if N == 0:
print(m + M//4)
else:
print(m) |
p03086 | s309673427 | Accepted | S=input()
ans=cur=0
for c in S:
if c in 'ACGT':
cur+=1
ans=max(ans,cur)
else:
cur=0
print(ans)
|
p02963 | s585976479 | Accepted | # (0,0),(a,b),(c,d)
# (10**9, 1)(x,y)
# 10**9 * y - x == S
# S = 10**9 * a + bとおくと
# y = a + 1
# x = 10**9- b
S=int(input())
if S==10**18:
print(0,0,10**9,0,0,10**9)
exit(0)
DIV=10**9
a = S//DIV
b = S%DIV
x = 10**9-b
y = a + 1
if x>10**9:
print(x)
if y>10**9:
print(y)
print(0,0,10**9,1,x,y)
|
p03331 | s767955021 | Wrong Answer | def f(x):
return x%10+f(x//10) if x else 0
n = int(input())
print(min([f(i)+f(n-i) for i in range(0,n+1)])) |
p03417 | s932640983 | Accepted | N, M = map(int, input().split())
#四つ角:4回
#辺上:6回
#内側:9回
if N==1 and M==1:
print(1)
elif N == 1 or M ==1:
#端:2回
#その他:3回
print(max(N-2,M-2))
else:
print((N-2)*(M-2))
|
p03210 | s100254539 | Accepted | print("YES" if input() in ["3","5","7"] else "NO") |
p03487 | s999847416 | Accepted | from collections import Counter
input();a=Counter(map(int,input().split()))
print(sum(j if i>j else j-i for i,j in a.items())) |
p02584 | s939809068 | Accepted | X, K, D = list(map(int, input().split()))
X = abs(X)
zan = X%D
K2 = K-X//D
if K2 < 0:
print(X-D*K)
else:
if K2%2 == 0:
print(zan)
else:
print(D-zan) |
p02784 | s808847460 | Accepted | H, N = map(int, input().split())
A = map(int, input().split())
a_sum = sum(A)
if H - a_sum <= 0:
print('Yes')
else:
print('No') |
p03286 | s932736611 | Wrong Answer | n = int(input())
ans = ''
while n != 0:
if n%2 != 0:
n -= 1
ans = '1' + ans
else:
ans = '0' + ans
n = n//(-2)
print(ans) |
p03611 | s955555838 | Accepted | n = int(input())
a = list(map(int, input().split()))
l = [0]*(10**5+3)
for i in range(n):
l[a[i]] += 1
l[a[i]+1] += 1
l[a[i]+2] += 1
max_ = 0
for e in l:
max_ = max(max_, e)
print(max_) |
p02570 | s192557236 | Accepted | D, T, S = map(int, input().split())
if D <= T * S:
print('Yes')
else:
print('No') |
p02933 | s855144899 | Wrong Answer | #a>=3200 のとき 出力s
#a<3200 のとき 出力’red'
#標準入力
#aは数字でユーザーが入力する
a = int (input())
if a >= 3200:
print('s')
else:
print('red')
|
p03548 | s389716730 | Wrong Answer | x,y,z=map(int,input().split())
if x%(y+z)<=z:
print(x//(y+z))
else:
print(x//(y+z)-1) |
p03434 | s066546143 | Wrong Answer | # -*- coding: utf-8 -*-
n = int(input())
a = list(map(int, input().split()))
alice = 0
bob = 0
sorted_a = sorted(a)
for i in sorted_a:
alice += sorted_a.pop()
bob += sorted_a.pop()
print(alice - bob)
|
p03799 | s480309431 | Accepted | n, m = map(int, input().split())
print(m // 2 if m <= 2 * n else n + (m - 2 * n) // 4)
|
p02630 | s107766000 | Accepted | from collections import Counter
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
pairs = list(tuple(map(int, input().split())) for _ in range(Q))
init_sum = sum(A)
counter = Counter(A)
total = init_sum
for b, c in pairs:
total -= counter[b] * b
total += counter[b] * c
counter[c] += counter[b]
del counter[b]
print(total)
|
p02570 | s849146950 | Wrong Answer | n , m, p = map(int, input().split())
#lst = list(map(int, input().split()))
if int(n/p) <= m:
print("Yes")
else:
print('No') |
p02613 | s784055821 | Accepted | N = int(input())
count_AC = 0
count_WA = 0
count_TLE = 0
count_RE = 0
for i in range(N):
tmp = str(input())
if tmp == "AC":
count_AC += 1
elif tmp == "WA":
count_WA += 1
elif tmp == "TLE":
count_TLE += 1
else:
count_RE += 1
print("AC x " + str(count_AC))
print("WA x " + str(count_WA))
print("TLE x " + str(count_TLE))
print("RE x " + str(count_RE)) |
p03161 | s214256509 | Accepted | N, K = map(int, input().rstrip().split(' '))
frog_lst = list(map(int, input().rstrip().split(' ')))
frog_jump_lst = []
def frog_jump(frog_jump_lst=[], index=0):
if not frog_jump_lst:
frog_jump_lst.append(0)
else:
now_pos = frog_lst[index]
k = min(K, len(frog_jump_lst))
pattern = [abs(now_pos - frog_lst[index-i]) + frog_jump_lst[-i] for i in range(1,k+1)]
frog_jump_lst.append(min(pattern))
for j in range(N):
frog_jump(frog_jump_lst, j)
print(frog_jump_lst[-1]) |
p02683 | s660350641 | Accepted | import numpy as np
n,m,x=map(int,input().split())
ca=[]
for _ in range(n):
ca.append(list(map(int,input().split())))
# print(ca)
minimum=10**7
for i in range(2**n):
# print(i)
tmp=[]
tmp2=[0]*(m+1)
cnt=0
for j in range(n):
if ((i >> j) & 1):
tmp.append(ca[j])
cnt+=1
# print(tmp)
for k in range(cnt):
for l in range(m+1):
tmp2[l]+=tmp[k][l]
# print(tmp2)
if min(tmp2[1:])>=x:
minimum=min(minimum,tmp2[0])
print(minimum if minimum < 10**7 else '-1') |
p03107 | s149956772 | Accepted | S = input()
count0 = 0
count1 = 0
for i in range(len(S)):
if S[i] == '0':
count0 += 1
else:
count1 += 1
print(min(count0,count1)*2)
|
p03449 | s071110314 | Accepted | import numpy as np
def main():
n = int(input())
As = [list(map(int, input().split())) for _ in range(2)]
cumsum0 = np.cumsum(As[0])
cumsum1 = np.cumsum(As[1])
ans = -float('inf')
for i in range(n):
ans_temp = cumsum0[i] + (cumsum1[n-1] - cumsum1[i]) + As[1][i]
ans = max(ans, ans_temp)
print(ans)
if __name__ == "__main__":
main()
|
p02660 | s466327036 | Accepted | def prime_factor(n):
ass=[]
for i in range(2,int(n**0.5)+1):
while n%i==0:ass.append(i);n//=i
if n!=1:ass.append(n)
return ass
n = int(input())
ans = 0
pf = prime_factor(n)
from collections import Counter
c = Counter(pf)
for i in c.keys():
v = c[i]
for j in range(1, 10**20):
if j>v:
break
ans += 1
v -= j
print(ans) |
p02627 | s811030099 | Accepted | a = input()
if a.upper() == a:
print('A')
else:
print('a') |
p03011 | s641121372 | Accepted | P,Q,R=map(int,input().split())
L=sorted([P,Q,R])
print(L[0]+L[1]) |
p03109 | s974237947 | Accepted | a = input()
b = a[: 4] + a[5 : 7] + a[8 :]
c = int(b)
if c <= 20190430:
print('Heisei')
else:
print('TBD')
|
p02963 | s651638330 | Accepted | A = int(input())
a = 10**9 - A % (10**9)
b = A // (10**9) + 1
if b > 10**9:
print(0, 0, 10**9, 0, 0, 10**9)
else:
print(0, 0, 10**9, 1, a, b) |
p03556 | s831427919 | Wrong Answer | import math
n = int(input())
m = math.sqrt(n)
print(math.floor(m))
|
p02793 | s047707535 | Accepted | n=int(input())
a=[int(x) for x in input().rstrip().split()]
now=1
mod=10**9+7
def lcm(a,b):#最小公倍数
ori_a=a
ori_b=b
while b!=0:
a,b=b,a%b
return (ori_a*ori_b)//a
for i in a:
now=lcm(i,now)
# print(now)
print(sum([now//i for i in a])%mod)
|
p02859 | s245759739 | Accepted | a = int(input())
print(a**2) |
p03943 | s019743799 | Accepted | a,b,c = map(int, input().split())
if a+b==c or b+c==a or a+c==b:
print('Yes')
else:
print('No') |
p02772 | s089685745 | Wrong Answer | n = int(input())
a = list(map(int,input().split()))
count = 0
for i in range(n):
if a[i]%2 == 0:
if a[i]%3 == 0 or a[i]%5 == 0:
count += 1
else:
count -=200
print("APPROVED" if count >=1 else "DENIED") |
p04044 | s300642388 | Accepted | n, l = map(int, input().split())
s = [input() for i in range(n)]
s_s = sorted(s)
print("".join(s_s))
|
p02916 | s884585325 | Accepted | N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
k = 0
ans = 0
for i in range(len(A)):
if i == 0:
ans += B[A[i]-1]
k = A[i]
else:
if A[i]-k == 1:
ans += B[A[i]-1]
ans += C[A[i]-2]
k = A[i]
else:
ans += B[A[i]-1]
k = A[i]
print(ans) |
p02607 | s310687902 | Accepted | n = int(input())
list = [int(i) for i in input().split()]
ans = 0
for i in range(n):
if i%2==0 and list[i]%2==1:
ans += 1
print(ans)
|
p02760 | s522059825 | Wrong Answer | a1_list = list(map(int, input().split()))
a2_list = list(map(int, input().split()))
a3_list = list(map(int, input().split()))
a1_list.extend(a2_list)
a1_list.extend(a3_list)
n = int(input())
nums = []
for _ in range(n):
x = int(input())
nums.append(x)
result = "No"
patterns = [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 4, 8], [3, 4, 6]]
for p in patterns:
if a1_list[p[0]] in nums and a1_list[p[1]] in nums and a1_list[p[2]] in nums:
result = "Yes"
break
print(result) |
p03696 | s628271100 | Accepted | n=int(input())
s=input()
while True:
cum=[0]*(len(s)+1)
for i,c in enumerate(s):
cum[i+1]=cum[i]-1 if c==')' else cum[i]+1
min_=min(cum)
if min_<0:
s='('*abs(min_)+s
continue
r=cum[-1]
if r>0:
s=s+')'*r
continue
print(s)
exit() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.