problem_id
stringclasses 428
values | submission_id
stringlengths 10
10
| status
stringclasses 2
values | code
stringlengths 5
816
|
|---|---|---|---|
p03377
|
s671552856
|
Accepted
|
a,b,x = map(int, input().split())
if a <= x and a+b >= x:
print('YES')
else:
print('NO')
|
p03352
|
s264620705
|
Accepted
|
import sys
X = int(input())
if not ( 1 <= X <= 1000 ):
sys.exit()
result = 1
for I in range(1,32):
for J in range(2,10):
if I ** J <= X and result <= I ** J:
result = I ** J
print(result)
|
p02880
|
s772697431
|
Wrong Answer
|
n = int(input())
f = [i * x for i in range(1,10) for x in range(1,10)]
if n in f:
print("yes")
else:
print("no")
|
p03627
|
s046600345
|
Accepted
|
from collections import Counter
N=int(input())
L=list(map(int,input().split()))
Z=[]
M=Counter(L)
for i,j in M.items():
if j>=2:
Z.append(i)
if j>=4:
Z.append(i)
V=sorted(Z)
if len(V)<2:
print(0)
else:
print(V[-1]*V[-2])
|
p02595
|
s535559594
|
Accepted
|
import math
N,D = input().split()
P = []
for i in range(int(N)):
X,Y = input().split()
P.append(math.sqrt(int(X)**2 + int(Y)**2))
answer = [i for i in P if i <= int(D)]
print(len(answer))
|
p02596
|
s662339895
|
Wrong Answer
|
K = int(input())
i = 0
ret = -1
if K % 5 != 0 and K % 2 != 0:
N = 1
if K % 7 == 0:
L = K * 9 // 7
else:
L = K * 9
while True:
if N % L == 1:
ret = i
break
N = (N * 10 )% L
i += 1
print(ret)
|
p02595
|
s356999863
|
Accepted
|
n, d = input().split(' ')
n = int(n)
d = int(d)
res = 0
while n > 0 :
x, y = input().split(' ')
x = int(x)
y = int(y)
if (((x**2)+(y**2))**0.5) <= d:
res += 1
n -= 1
print(res)
|
p02775
|
s084177286
|
Accepted
|
N=input()
r=0
m=int(N[-1])
for i in range(len(N)-1,0,-1):
n=m
m=int(N[i-1])
if n<5:
r+=n
elif n==5:
if m<5:
r+=n
else:
r+=10-n
m+=1
else:
r+=10-n
m+=1
r+=m if m<6 else 11-m
print(r)
|
p02847
|
s595239681
|
Wrong Answer
|
s = input()
if(s == 'SUN'):
print(7)
elif(s == 'MON'):
print(6)
elif(s == 'TUE'):
print(5)
elif(s == 'WED'):
print()
elif(s == '4'):
print()
elif(s == 'THU'):
print(3)
elif(s == 'FRI'):
print(2)
elif(s == 'SAT'):
print(1)
|
p02719
|
s792785797
|
Accepted
|
N, K = map(int, input().split())
ans = min((N % K), abs((N % K) - K))
print(ans)
|
p03339
|
s244734431
|
Accepted
|
N = int(input())
S = list(input())
ans = [0]*N
ans[0] = S[1:].count("E")
for i in range(1, N):
ans[i] += (ans[i-1] + int(S[i-1]=="W") - int(S[i]=="E"))
print(min(ans))
|
p03623
|
s236969127
|
Wrong Answer
|
x, a, b = map(int,input().split())
if abs(x - a) < (x - b):
r = 'A'
else:
r = 'B'
print(r)
|
p02768
|
s801889622
|
Wrong Answer
|
def comb(n_, k_, mod_=10**9+7):
ans_ = 1
for i in range(1,k_+1):
ans_ *= ((n_+1-i)/i)
ans_ = ans_%mod_
return round(ans_//1%mod_)
n,a,b = map(int, input().split())
ans_tmp = (2**n-1)#%mod
for i in [a,b]:
tmp = comb(n,i)
ans_tmp -= tmp
print(ans_tmp%(10**9+7))
|
p02690
|
s675450764
|
Accepted
|
X = int(input())
def solve() :
for a in range(-1000, 1000) :
for b in range(-1000, 1000) :
if (a ** 5) - (b ** 5) == X :
return (a, b)
print(*solve())
|
p02859
|
s985292430
|
Wrong Answer
|
def main():
num = int(input())
return num*num
|
p03681
|
s691273181
|
Accepted
|
def factorial(a):
result = 1
for i in range(1,a+1):
result *= i
result %= 1000000007
return result
N, M = map(int, input().split())
if N == M:
ans = 2*(factorial(N)**2) %1000000007
elif abs(N-M) == 1:
ans = max(N,M)*(factorial(min(N,M))**2) %1000000007
else:
ans =0
print(ans)
|
p03821
|
s743673498
|
Wrong Answer
|
n = int(input())
a,b=[],[]
for i in range(n):
x,y = map(int,input().split())
a.append(x)
b.append(y)
a=list(reversed(a))
b=list(reversed(b))
ans=0
OK=0
for i in range(n):
tmp=a[i]+OK
if tmp<=b[i]:
ok=b[i]-tmp
else:
ok=-(-tmp//b[i])*b[i]-tmp
OK=OK+ok
print(OK)
|
p03475
|
s578491232
|
Accepted
|
n = int(input())
a = []
for i in range(n-1):
a.append(list(map(int, input().split())))
for i in range(n-1):
total = a[i][1]
for j in range(i, n-1):
total = max(a[j][1], total)
total += (a[j][2] - total%a[j][2])%a[j][2]
total += a[j][0]
print(total)
print(0)
|
p03495
|
s870620121
|
Wrong Answer
|
N, K = map(int, input().split())
A = list(map(int, input().split()))
import collections
A_tuple = collections.Counter(A).most_common()[::-1]
print(len(A_tuple))
if len(A_tuple) < K:
print(0)
else:
ans = 0
for i in range(len(A_tuple)-K):
ans += A_tuple[i][1]
print(ans)
|
p02771
|
s539528021
|
Accepted
|
A,B,C=map(int,input().split())
if A==B:
if A==C:
print("No")
else:
print("Yes")
else:
if A==C:
print("Yes")
elif C==B:
print("Yes")
else:
print("No")
|
p03487
|
s310889373
|
Accepted
|
import collections
n=int(input())
a=list(map(int,input().split()))
l=list(set(a))
m=collections.Counter(a)
ans=0
for i in range(len(l)):
if m[l[i]]<l[i]:
ans+=m[l[i]]
else:
ans+=m[l[i]]-l[i]
print(ans)
|
p02712
|
s329541327
|
Wrong Answer
|
N = int(input())
s = 0
for i in range(1,N):
if (i % 15 != 0)&(i % 3 != 0)&(i % 5 != 0):
s += i
print(s)
|
p02600
|
s206761841
|
Accepted
|
x = int(input())
if x < 600:
print(8)
elif x < 800:
print(7)
elif x < 1000:
print(6)
elif x < 1200:
print(5)
elif x < 1400:
print(4)
elif x < 1600:
print(3)
elif x < 1800:
print(2)
elif x < 2000:
print(1)
|
p02918
|
s374871411
|
Accepted
|
N, K = map(int, input().split(' '))
S = input()
groups = 1
for s0, s1 in zip(S, S[1:]):
if s0 != s1:
groups += 1
groups = max(1, groups - 2 * K)
print(N - groups)
|
p03219
|
s059326366
|
Accepted
|
x, y = map(int, input().split())
print(x + y//2)
|
p03243
|
s606043742
|
Accepted
|
n=int(input())
while True:
if len(set(str(n)))==1:
print(n)
break
n+=1
|
p03657
|
s479202240
|
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")
|
p02761
|
s182311253
|
Accepted
|
n, m = [int(i) for i in input().split()]
sc = [list(map(int, input().split())) for _ in range(m)]
ans = -1
for i in range(10**(n-1) if n > 1 else 0, 10**n):
for s, c in sc:
if str(i)[s-1] != str(c):
break
else:
ans = i
break
print(ans)
|
p02836
|
s729063044
|
Accepted
|
S = input()
s = list(S)
num = len(s)
cnt = 0
for i in range(num // 2):
if s[i] != s[num - 1 - i]:
cnt += 1
print(cnt)
|
p03695
|
s599301023
|
Wrong Answer
|
n = int(input())
rate = list(map(int,input().split()))
ratecolor = 0
free = 0
ratecolor = 0
color = [0]*9
for i in range(n):
if(rate[i] >= 3200):
free += 1
break
for j in range(9):
if(rate[i] < j*400 + 400):
if(color[j] == 0):
color[j] += 1
ratecolor += 1
break
print(ratecolor if ratecolor != 0 else 1,ratecolor+free)
|
p02743
|
s704090669
|
Wrong Answer
|
import math
a, b, c = map(int, input().split())
ans="No"
if a**2+b**2+c**2>2*(a*b+b*c+c*a):
ans="Yes"
print(ans)
|
p03861
|
s766175244
|
Accepted
|
a,b,x=map(int,input().split())
c=a-1
max=b//x+1
min=c//x+1
if c==-1:
min=0
else:
pass
print(max-min)
|
p03612
|
s595523384
|
Accepted
|
n=int(input())
p=list(map(int,input().split()))
ans=0
count=0
for i in range(n):
if p[i] == i+1:
ans+=1
count+=1
else:
count=0
if count==2:
ans-=1
count=0
print(ans)
|
p03137
|
s337744421
|
Accepted
|
def main():
N, M = map(int, input().split())
X = [int(a) for a in input().split()]
if N >= M:
print(0)
else:
X.sort()
dlist = list()
for i in range(M-1):
d = abs(X[i] - X[i+1])
dlist.append(d)
dlist.sort()
print(sum(dlist[:len(dlist) - (N-1)]))
if __name__ == "__main__":
main()
|
p03854
|
s808027523
|
Accepted
|
S = input()[::-1]
kari = ['dream', 'dreamer', 'erase', 'eraser']
words = [i[::-1] for i in kari]
l = len(S)
cnt = ''
for i in range(l):
cnt += S[i]
if cnt in words:
cnt = ''
if cnt!='':
print('NO')
else:
print('YES')
|
p03011
|
s020520358
|
Wrong Answer
|
p,q,r = map(int,input().split())
print(min(p+q,p+r,r*q))
|
p03555
|
s166848808
|
Accepted
|
A = input()
B = input()
if A[0] == B[2] and A[1] == B[1] and A[2] == B[0]:
print("YES")
else:
print("NO")
|
p03680
|
s189314859
|
Accepted
|
import sys
inputs = list(map(int, sys.stdin))
ai = inputs[1]
for i in range(inputs[0]):
if (ai == 2):
print(i + 1)
break
ai = inputs[ai]
else:
print(-1)
|
p04031
|
s739579538
|
Accepted
|
n = int(input())
a = list(map(int, input().split()))
m = sum(a) // n
ans = 0
for x in a:
ans += (x - m) ** 2
ansp = 0
for x in a:
ansp += (x - m - 1) ** 2
print(min(ans, ansp))
|
p03827
|
s007293948
|
Accepted
|
# https://atcoder.jp/contests/abc052/tasks/abc052_b
N = int(input())
S = input()
max_count = 0
curr_count = 0
for s in S:
if s == 'I':
curr_count += 1
elif s == 'D':
curr_count -= 1
if curr_count > max_count:
max_count = curr_count
print(max_count)
|
p03862
|
s329757868
|
Accepted
|
n, x = map(int, input().split())
al = list(map(int, input().split()))
cnt = 0
for i in range(n-1):
if al[i] + al[i+1] > x:
if al[i+1] > (al[i] + al[i+1]) - x:
cnt += al[i] + al[i+1] - x
al[i+1] -= (al[i] + al[i+1] - x)
else:
cnt += al[i+1] + al[i] - x
al[i+1] = 0
al[i] = x
print(cnt)
# print(al)
|
p02995
|
s766351779
|
Wrong Answer
|
import math
import fractions
a,b,c,d=map(int,input().split())
base=b-a+1
n_c=1+(b-c+1)//c-(a+c-1)//c+1
n_d=1+(b-d+1)//d-(a+d-1)//d+1
cd=c*d/fractions.gcd(c,d)
n_cd=1+(b-cd+1)//cd-(a+cd-1)//cd+1
print(base-n_c-n_d+n_cd)
|
p03449
|
s773478764
|
Wrong Answer
|
import numpy
n = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
ans = 0
for i in range(n):
ans = max(ans, sum(A1[:i+1])+sum(A2[i:]), sum(A2[:i+1])+sum(A1[i:]))
print(ans)
|
p03145
|
s172245716
|
Accepted
|
a=sorted(list(map(int,input().split())))
print(a[0]*a[1]//2)
|
p04031
|
s243751920
|
Wrong Answer
|
n = int(input())
a = list(map(int, input().split()))
i = 0
m = 100
M = -100
while i < n:
if a[i]<m:
m = a[i]
if a[i]>M:
M = a[i]
i+=1
s1 = (m + M)//2
s2 = s1 + 1
i = 0
x1 = 0
x2 = 0
while i < n:
x1 += (s1-a[i])**2
x2 += (s2-a[i])**2
i+=1
if x1<x2:
ans = x1
else:
ans = x2
print(ans)
|
p03106
|
s228368137
|
Wrong Answer
|
A, B, K = map(int, input().split())
cnt = 0
for i in range(A+1, 1, -1):
if A % i == 0 and B % i == 0:
cnt += 1
if cnt == K:
print(i)
exit()
|
p02693
|
s918346999
|
Accepted
|
k = int(input())
list = list(map(int, input().split()))
a = list[0]
b = list[1]
for i in range(a,b+1):
if i % k ==0:
print("OK")
break
if i==b:
print("NG")
|
p03251
|
s474917972
|
Wrong Answer
|
n,m,x,y=map(int,input().split())
l_x=sorted(list(map(int,input().split())))
l_y=sorted(list(map(int,input().split())))
print("War" if l_x[-1] >= l_y[0] else "No War")
|
p02760
|
s414890286
|
Accepted
|
A=[]
B=[False]*9
for i in range(3):
A+=[int(i) for i in input().split()]
n=int(input())
for _ in range(n):
b=int(input())
for i in range(9):
if b==A[i]:
B[i]=True
C=[[1,2,3],[4,5,6],[7,8,9],[1,4,7],[2,5,8],[3,6,9],[1,5,9],[3,5,7]]
ans=False
for a,b,c in C:
if B[a-1] and B[b-1] and B[c-1]:
ans=True
print("Yes" if ans else "No")
|
p03457
|
s728680174
|
Accepted
|
def move_time(x1,y1,x2,y2):
return abs(x1-x2)+abs(y1-y2)
n = int(input())
t1 = 0
x1 = 0
y1 = 0
isYes = True
for i in range(n):
t2,x2,y2 = map(int,input().split())
tm = move_time(x1,y1,x2,y2)
#print(tm,t2,x2,y2)
if tm>(t2-t1):
isYes = False
elif ((t2-t1)-tm)%2==1:
isYes = False
t1 = t2
x1 = x2
y1 = y2
if isYes:
print('Yes')
else:
print('No')
|
p03221
|
s575893409
|
Accepted
|
N, M = map(int, input().split())
ol = []
def zeros(x):
xt = str(x)
k = 6 - len(xt)
return "0" * k + xt
for i in range(M):
p,y = map(int, input().split())
ol.append((p,y))
l = sorted(ol)
res = {}
t=0
for i in range(M):
if l[i][0] == l[i-1][0]:
t+=1
else:
t=1
res[l[i]] = zeros(l[i][0])+ zeros(t)
for i in ol:
print(res[i])
|
p02833
|
s131440168
|
Wrong Answer
|
import math
N = int(input())
cnt = 0
if N%2==1:
print(0)
else :
for i in range(1,30):
cnt +=math.floor(N//5**i)
if N < 5**i:
break
print(cnt)
|
p02970
|
s012262137
|
Accepted
|
import math
N,D = list(map(int,input().split()))
print(math.ceil(N/(2*D+1)))
|
p03285
|
s975889932
|
Accepted
|
x = 4
y = 7
a=int(input())
ans = 'No'
for i in range(20):
for j in range(14):
if (x * i) + (y * j) == a:
ans = 'Yes'
print(ans)
|
p02678
|
s767472481
|
Wrong Answer
|
from collections import deque
n,m=map(int,input().split())
g=[[] for i in range(n)]
for i in range(m):
a,b=map(int,input().split())
a,b=a-1,b-1
g[a].append(b)
g[b].append(a)
def bfs(u):
queue=deque([u])
d=[None]*n
d[u]=0
while queue:
v=queue.popleft()
for i in g[v]:
if d[i]==None:
d[i]=d[v]+1
queue.append(i)
return d
d=bfs(0)
if None in d:
print("No")
else:
print("Yes")
for i in range(1,n):
print(d[i])
|
p02922
|
s928066922
|
Accepted
|
a, b = [int(i) for i in input().split()]
if b == 1:
print(0)
exit()
n = int((b-2) / (a-1))
print(n+1)
|
p02838
|
s605766736
|
Accepted
|
from math import log, ceil
N = int(input())
A = list(map(int, input().split()))
#print(ceil(log(max(A)+1,2)))
keta = ceil(log(max(A)+1,2))
X = [0] * keta
for a in A:
work = a
i = 0
while work > 0:
X[i] += work % 2
i += 1
work = work // 2
ans = 0
mod = int(1e9+7)
for i in range(len(X)):
ans += X[i] * (N-X[i]) * 2**i
ans = ans % mod
print(ans)
|
p02718
|
s903321330
|
Accepted
|
n,m = map(int,input().split())
line = sorted(list(map(int,input().split())),reverse = True)
sums = sum(line)
if sums % (4*m) != 0:
least = sums//(4*m) + 1
else:
least = sums//(4*m)
box = []
for i in line:
if i >= least:
box.append(i)
if len(box) >= m:
print("Yes")
else:
print("No")
|
p02952
|
s618217836
|
Accepted
|
n = int(input())
c = 0
for i in range(1, n+1):
if len(str(i)) % 2 == 1:
c += 1
print(c)
|
p03730
|
s335868115
|
Accepted
|
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions,pprint
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()))
n = 10**6
a,b,c = inpl()
for i in range(1,n):
if (a*i)%b == c:
print('YES')
break
else:
print('NO')
|
p02597
|
s919642159
|
Accepted
|
N = int(input())
stones = input()
total_count_R = stones.count('R')
left_count_R = stones[0:total_count_R].count('R')
answer = total_count_R - left_count_R
print(answer)
|
p03030
|
s168391326
|
Accepted
|
n = int(input())
dic = []
for i in range(n):
inp = input().split()
dic.append([inp[0], 100-int(inp[1]), i+1])
temp = ''
for j in range(10):
try:
temp += str(ord(dic[i][0][j])-80)
except:
temp += '00'
dic[i][0] = int(temp)
dic = sorted(dic)
for i in range(n):
print(dic[i][2])
|
p03637
|
s188238772
|
Accepted
|
N = int(input())
a = list(map(int, input().split()))
p1, p2, p4 = (0, 0, 0)
for ai in a:
if ai % 4 == 0:
p4 += 1
elif ai % 2 == 0:
p2 += 1
else:
p1 += 1
ans = 'Yes'
if p4 + 1 < p1 or (p4 + 1 == p1 and p2 != 0):
ans = 'No'
print(ans)
|
p02624
|
s292081389
|
Accepted
|
n = int(input())
ans = (n + 1) * n // 2
for i in range(2, n + 1):
j = 1
while i * j <= n:
ans += i * j
j += 1
print(ans)
|
p02688
|
s212629296
|
Accepted
|
N,K = map(int,input().split())
B = [0]*N
for i in range(K):
d = int(input())
A = list(map(int,input().split()))
for j in range(N):
if j+1 in A:
B[j] = 1
print(B.count(0))
|
p03759
|
s954226695
|
Accepted
|
a,b,c = map(int,input().split())
if b-a==c-b:
print("YES")
else:
print("NO")
|
p02859
|
s667532761
|
Accepted
|
r = int(input())
print(r**2)
|
p02699
|
s767670810
|
Accepted
|
s, w = map(int, input().split())
if w >= s:
print('unsafe')
else:
print('safe')
|
p02842
|
s593113144
|
Accepted
|
import math
N = int(input())
for i in range(N+1):
if math.floor(i*1.08) == N:
print(i)
exit()
print(':(')
|
p02802
|
s138607987
|
Accepted
|
N, M = map(int, input().split())
ans = 0
pen = 0
w = [0]*(N+1)
ac = [False]*(N+1)
for _ in range(M):
p, s = input().split()
if s == "AC" and not ac[int(p)]:
pen += w[int(p)]
ac[int(p)] = True
ans += 1
elif s == "WA":
w[int(p)] += 1
print(ans, pen)
|
p03323
|
s705380139
|
Accepted
|
A,B=map(int,input().split())
if A>8 or B>8:
print(':(')
else:
print('Yay!')
|
p02982
|
s764462636
|
Wrong Answer
|
def f(x,y):
A=0
for i in range(len(x)):
A+=(x[i]-y[i])*(x[i]-y[i])
return A
M=20
N,D=map(int,input().split())
X=[]
for _ in range(N):
X.append(tuple(map(int,input().split())))
S=set()
k=0
L=M*M*D
while k*k<=L:
S.add(k*k)
k+=1
K=0
for i in range(N):
for j in range(i+1,N):
K+=(f(X[i],X[j]) in S)
print(K)
|
p03779
|
s992251576
|
Wrong Answer
|
x = int(input())
for i in range(1,10**5):
ans = (i*(i+1)//2)
if ans > x:
print(i)
break
|
p03262
|
s804410775
|
Accepted
|
N,X = map(int,input().split())
x = list(map(int,input().split()))
x.append(X)
x.sort()
Mindif = x[1]-x[0]
import math
for i in range(1,N):
Mindif = math.gcd(Mindif,x[i+1]-x[i])
print(Mindif)
|
p03774
|
s579360026
|
Wrong Answer
|
N,M = map(int,input().split())
a = [list(map(int,input().split())) for x in range(N)]
c = [list(map(int,input().split())) for x in range(M)]
min_cpoint = -1
num_stack = 51
for i in range(N):
for j in range(M):
if num_stack > abs(a[i][0]-c[j][0]) + abs(a[i][1]-c[j][1]):
num_stack = abs(a[i][0]-c[j][0]) + abs(a[i][1]-c[j][1])
min_cpoint = j+1
print(min_cpoint)
min_cpoint = -1
num_stack = 51
|
p03495
|
s426083812
|
Wrong Answer
|
n,k=map(int,input().split())
a=[int(i)for i in input().split()]
d=[0 for i in range(max(a))]
for i in a:
d[i-1]+=1
ans=sum(sorted(d)[:k-1])
print(ans)
|
p02613
|
s861687928
|
Accepted
|
n = int(input())
li = [input() for i in range(n)]
print("AC x " + str(li.count("AC")))
print("WA x " + str(li.count("WA")))
print("TLE x " + str(li.count("TLE")))
print("RE x " + str(li.count("RE")))
|
p02791
|
s137075806
|
Wrong Answer
|
N=int(input())
p=list(map(int,input().split()))
a=[]
for i in range(1,N):
if p[i-1]>=p[i]:
a.append(p[i])
c=set(a)
print(len(c)+1)
|
p02731
|
s311795265
|
Wrong Answer
|
a = int(input())
if a < 3:
print(0)
else:
yy = a / 3
print(yy**3)
|
p03417
|
s236870999
|
Wrong Answer
|
n,m=map(int,input().split())
if n>=3 and m>=3:
print(n*m-(n-2)*(m-2))
elif n==1 or m==1:
print(2)
|
p04044
|
s158234892
|
Wrong Answer
|
n, l = map(int, input().split())
d = {input() for _ in range(n)}
print(sorted(d))
|
p02854
|
s893249483
|
Accepted
|
n = int(input())
a = list(map(int, input().split()))
b = sum(a)
c = 0
for i in range(n):
c += a[i]
if c >= b / 2:
k = i
break
cut1 = c - (b - c)
cut2 = b - c + a[k] - (c - a[k])
ans = min(cut1, cut2)
print(ans)
|
p02607
|
s111284926
|
Accepted
|
N = int(input())
a = list(map(int, input().split()))
answer = 0
for i, e in enumerate(a):
i += 1
if i % 2 != 0 and e % 2 != 0:
answer += 1
print(answer)
|
p02691
|
s893282933
|
Accepted
|
import collections
n = int(input())
a = [0] + list(map(int,input().split()))
a_pos = [a[i]+i for i in range(1,n+1)]
a_neg = [-a[i]+i for i in range(1,n+1)]
#print(a_pos)
#print(a_neg)
c_pos = collections.Counter(a_pos)
c_neg = collections.Counter(a_neg)
#print(c_pos)
#print(c_neg)
ans = 0
for c in c_pos:
ans += c_pos[c] * c_neg[c]
print(ans)
|
p03127
|
s791783772
|
Wrong Answer
|
n = int(input())
A = sorted(list(map(int, input().split())))
work = sum(A[1:])
temp = work % A[0]
result = temp if temp!=0 else A[0]
print(result)
|
p02748
|
s876298936
|
Accepted
|
a,b,m=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
#print(a,b,m)
#print(A)
#print(B)
total = 10**5+10**5
#print(total)
for i in range(m):
x,y,c=map(int,input().split())
#print(x,y,c)
D = (A[x-1] + B[y-1] - c)
if total > D:
total = D
#print(D)
A.sort()
B.sort()
if total > (A[0] + B[0]):
total = (A[0] + B[0])
print(total)
|
p02697
|
s115327578
|
Accepted
|
N,M=map(int,input().split())
ans=[]
if N%2==1:
for i in range(M):
ans.append([i+1,N-i])
else:
for i in range(M//2):
ans.append([i+1,2*M-i+1])
for j in range(M-M//2):
ans.append([j+M//2+1,2*M-M//2-j])
for k in ans:
print(*k,sep=' ')
|
p02647
|
s748296304
|
Accepted
|
N,K = map(int,input().split())
A = list(map(int,input().split()))
while True:
if K == 0:
break
imosu = [0 for i in range(N+2)]
for i in range(N):
l = max(0,i-A[i])
r = min(N-1,i+A[i])
imosu[l] += 1
imosu[r+1] -= 1
A = [imosu[0]]
for i in imosu[1:N]:
A.append(A[-1]+i)
K -= 1
if min(A) == N:
break
print(*A)
|
p02615
|
s564120352
|
Accepted
|
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
n -= 1
idx = 0
score = a[idx]
n -= 1
idx += 1
while n > 0:
if n > 1:
score += a[idx] * 2
n -= 2
idx += 1
else:
score += a[idx]
n -= 1
print(score)
|
p03281
|
s261857388
|
Wrong Answer
|
from random import*;print(randint(0,5))
|
p03351
|
s498004402
|
Wrong Answer
|
data_a,data_b,data_c,data_d = [int(x) for x in input().split()]
length_1 = data_a - data_b
length_2 = data_b - data_c
length_3 = data_a - data_c
if length_3 <= data_d:
print('Yes')
elif length_1 <= data_d and length_2 <= data_d:
print('Yes')
else:
print('No')
|
p04033
|
s559414031
|
Wrong Answer
|
a,b=map(int,input().split())
if (a<=0 and b>=0) or (b<=0 and a>=0):
print("Zero")
elif a>0 and b>0:
print("Positive")
else:
if b-a%2==1:
print("Positive")
else:
print("Negative")
|
p03136
|
s088632285
|
Wrong Answer
|
a=input()
b=list(map(int,input().split()))
b.sort()
if sum(b)-max(b)-max(b)<=0:
print("Yes")
else:
print("No")
|
p03000
|
s652912938
|
Wrong Answer
|
N, X = map(int, input().split())
L = list(map(int, input().split()))
ans = 1
d = 0
for i in range(N):
d += L[0]
if d <= X:
ans += 1
print(ans)
|
p02554
|
s538234141
|
Accepted
|
# -*- coding: utf-8 -*-
import math
N = int(input())
ans = (10**N) - 9**N - 9**N + 8**N
ans = ans % ((10**9)+7)
print(ans)
|
p03632
|
s236026111
|
Accepted
|
A,B,C,D=map(int,input().split())
minX=max(A,C)
maxX=min(B,D)
if(maxX-minX<0):
print(0)
else:
print(maxX-minX)
|
p02916
|
s672165215
|
Wrong Answer
|
n=int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
m=0
# 0で初期化すると最初が1の時にだめ
at=0
for i,ai in enumerate(a):
m+=b[ai-1]
if ai == at+1:
m+=c[at-1]
at=ai
print(m)
|
p02554
|
s754406958
|
Accepted
|
n=int(input())
mod=10**9+7
ans=10**n-2*9**n+8**n
print(ans%mod)
|
p03210
|
s420971726
|
Wrong Answer
|
X=int(input())
if X==7 or X==5 or X==3:
print("Yes")
else:
print("No")
|
p02713
|
s772743855
|
Accepted
|
from math import gcd
k = int(input())
ans = 0
for x in range(1,k+1):
for y in range(1,k+1):
for z in range(1,k+1):
ans += gcd(gcd(x,y),z)
print(ans)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.