problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p02594 | s542721821 | Wrong Answer | print("暑いのか…?")
x=input()
x=int(x)
if -40<=x and x<=40:
if x>=30:
print('これは意外っ!猛暑っ!!')
elif x<30:
print('やれやれだぜ')
else:
print("さては究極生命体だな!!?")
|
p03107 | s060669128 | Accepted | s = list(input())
print(len(s) - abs(s.count("1")-s.count("0"))) |
p03835 | s250214547 | Wrong Answer | import sys
in1 = sys.stdin.readlines()
#in1 = ['5 15']
K, S = map(int, in1[0].split())
RC = 0
for idx1 in range(K + 1):
for idx2 in range(K + 1):
if S - idx1 - idx2 <= K:
RC += 1
print(RC)
|
p03309 | s340718846 | Wrong Answer | N=int(input())
A=list(map(int,input().split()))
def abs(x):
if x>=0:
return x
else:
return x*(-1)
B=[]
for i in range(N):
B.append(A[i]-i-1)
B.sort()
if N%2==0:
b=(B[N//2]+B[N//2-1])//2
else:
b=B[N//2-1]
sad=0
for j in range(N):
sad=sad+abs(B[j]-b)
print(sad)
|
p02996 | s073550858 | Wrong Answer | n = int(input())
a = []
b = []
for i in range(n):
A, B = [int(i) for i in input().split()]
a.append(A)
b.append(B)
works = []
for i in range(n):
works.append((b[i], a[i]))
works.sort()
t = 0
for b, a in works:
t += a
if t > b:
print('No')
break
print("Yes") |
p02702 | s581382216 | Accepted | def main():
n, mods = 0, [1]+[0]*2019
d = 1
for i, j in enumerate(reversed(input())):
# n = (n+int(j)*pow(10, i, 2019))%2019
n = (n+int(j)*d)%2019
d=d*10%2019
mods[n] += 1
print(sum([i*(i-1)//2 for i in mods]))
main() |
p03251 | s720098828 | Wrong Answer | n, m, x, y = map(int, input().split())
xx = list(map(int, input().split()))
yy = list(map(int, input().split()))
print([x]+xx)
xxx = max(xx + [x])
yyy = min(yy + [y])
if xxx < yyy:
print("No War")
else:
print("War")
|
p02951 | s608457219 | Wrong Answer | A,B,C=map(int,input().split(" "))
print(C-(A-B)) |
p02707 | s434666812 | Wrong Answer | N = int(input())
A = list(map(int,input().split()))
A1 = set(A)
A1 = list(A1)
list(A1).sort()
for i in A1:
print(A.count(i))
for i in range(N-len(A1)):
print(0)
|
p02682 | s838779712 | Wrong Answer | def resolve():
A, B, C, K= map(int, input().split())
if A < K:
if B < (K-A):
print(A - (K-A-B))
else:
print(A)
else:
print(A)
if __name__ == "__main__":
resolve() |
p02730 | s616298494 | Wrong Answer | def isBatch(s):
for i in range(len(s)//2):
if s[i] != s[-i-1]:
return False
return True
def main():
s = input()
condtion1 = (len(s) - 1) // 2
condtion2 = (len(s) + 3) // 2
flag = False
for i, j in [(1, condtion1), (condtion2, len(s))]:
if isBatch(s[i-1:j]):
flag = True
else:
flag = False
if flag:print("Yes")
else: print("No")
if __name__ == "__main__":
main() |
p03804 | s486252265 | Accepted | n, m = map(int, input().split())
a = [input() for i in range(n)]
b = "".join([input() for i in range(m)])
ans = "No"
for i in range(n-m+1):
for j in range(n-m+1):
s = ""
for k in range(m):
s+=a[i+k][j:j+m]
if s==b:
ans = "Yes"
print(ans) |
p02684 | s797830430 | Wrong Answer | n,k = map(int,input().split())
a = list(map(int,input().split()))
t = 1
tl = [1]
ts = {1}
for i in range(len(a)):
t = a[t-1]
if t in ts:
break
else:
tl.append(t)
ts.add(t)
tl2 = tl[tl.index(t):len(tl)]
print(tl)
print(tl2)
if k < len(tl):
ans = tl[k]
else:
k = k - (len(tl) - len(tl2))
j = k % len(tl2)
ans = tl2[j]
print(ans) |
p03379 | s364744341 | Wrong Answer | n = int(input())
x = list(map(int,input().split()))
y = sorted(x)
a,b = y[n//2],y[n//2-1]
for xi in x:
if xi == a:
print(b)
else:
print(a) |
p03105 | s523505041 | Wrong Answer | import math
A,B,C = map(int,input().split())
if B/A>C:
print(C)
elif B/A<C:
print(math.floor(B/A)) |
p03371 | s563336664 | Accepted | from collections import Counter
a, b, ab, x, y = map(int, input().split())
if a+b >= ab*2:
if x < y:
less, more = x, y
cost_l, cost_m = a, b
else:
less, more = y, x
cost_l, cost_m = b, a
cost = less*ab*2
more -= less
less = 0
if cost_m < ab * 2:
cost += more*cost_m
else:
cost += more*ab*2
print(cost)
else:
print(a*x+b*y) |
p03239 | s419926919 | Wrong Answer | n,t = map(int, input().split())
y = 10**5
c = [list(map(int,input().split())) for i in range(n)]
for i in range(n):
if c[i][1]<t:
y=min(y,c[i][0])
if y != 10**5:
print(y)
else:
print("TLE") |
p02694 | s847445141 | Accepted | def main():
x = int(input())
tmp = 100
for i in range(1,10**10):
tmp = int(tmp*1.01)
if tmp >= x:
print(i)
return
if __name__ == '__main__':
main()
|
p03487 | s427246285 | Wrong Answer | n=int(input())
a=list(map(int,input().split()))
from collections import Counter
d=Counter(a)
ans=0
for k, v in d.items():
if v != k:
ans+=min(v, abs(k-v))
print(ans) |
p02829 | s463873132 | Accepted |
A = int(input())
B = int(input())
for i in range(1, 4):
if i != A and i != B:
print(i)
break |
p02714 | s289912664 | Accepted | n = int(input())
s = input()
cnt = s.count('R') * s.count('G') * s.count('B')
for i in range(n):
for j in range(n):
if 0 <= i - j <= i and 0 <= i + j <= n-1:
x1, x2, x3 = s[i - j], s[i], s[i + j]
if x1 != x2 and x1 != x3 and x2 != x3:
cnt -= 1
print(cnt) |
p03433 | s592053758 | Wrong Answer | N = int(input())
A = int(input())
if (N%500) < A:
print("Yes")
else:
print("No") |
p03944 | s478659785 | Wrong Answer | import sys
W, H, N = map(int, sys.stdin.readline().split(" "))
Map = [list(map(int,sys.stdin.readline().split(" "))) for i in range(N)]
L = 0
R = W
B = 0
T = H
for i in Map:
if i[2] == 1:
l = i[0]
L = max(L, l)
if i[2] == 2:
r = i[0]
R = min(R, r)
if i[2] == 3:
b = i[0]
B = max(B, b)
if i[2] == 4:
t = i[0]
T = min(T, t)
print((R - L) * (T - B)) |
p02629 | s661500541 | Accepted | 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"]
n = int(input())
ans = []
a = 0
for num in range(1, 12):
a += 26 ** num
if n <= a:
n -= (a - 26 ** num)
break
for i in range(num, 0, -1):
for j in range(26):
if n <= 26 ** (i-1) * (j+1):
n -= 26 ** (i-1) * j
ans.append(alpha[j])
break
print("".join(ans)) |
p02775 | s319487635 | Wrong Answer | # print('input >>')
N = input()
N = reversed(N)
ans = 0
nxt = False
for n in N:
i_n = int(n) + nxt
if i_n % 10 >= 6:
ans += 10 - i_n % 10
nxt = True
else:
ans += i_n % 10
nxt = False
# print(N, ans)
# print('-----output-----')
print(ans) |
p03069 | s465770064 | Accepted | N = int(input())
S = input().strip()
bcnt = S.count("#")
wcnt = N - bcnt
ans = wcnt
cntb = 0
cntw = 0
for i in range(N):
if S[i] == "#":
cntb += 1
else:
cntw += 1
ans = min(ans, cntb + wcnt - cntw)
print(ans)
|
p02598 | s680090824 | Accepted | import math
N,K=map(int,input().split())
A=[int(x) for x in input().split()]
A=sorted(A)
left=0
right=max(A)
mid=max((left+right)//2,1)
while(right-left>=1):
numofcut=0
for i in range(N):
numofcut+=math.ceil(A[i]/mid)-1
#print(numofcut)
if numofcut>K:
left=mid+1
else:
right=mid
mid=max((left+right)//2,1)
if mid==1:
break
print(mid) |
p03469 | s316767313 | Wrong Answer | S=input()
S[3]=="8"
print(S) |
p02792 | s547978795 | Accepted | N = int(input())
l = [[0 for _ in range(10)]for _ in range(10)]
for i in range(1,N+1):
i = str(i)
if i[0] == '0' or i[-1] == '0':
pass
else:
l[int(i[0])][int(i[-1])] += 1
ans = 0
for i in range(1,10):
for j in range(1,10):
ans += l[i][j]*l[j][i]
print(ans) |
p03705 | s986618922 | Wrong Answer | N, A, B = map(int, input().split())
if A > B:
print(0)
elif A == B:
print(1)
elif B-A >N:
print(0)
else:
X = N-B+A
print((B-A)*X+1)
|
p02790 | s280299040 | Accepted | a, b = input().split()
print(min(a * int(b), b * int(a))) |
p02910 | s328428114 | Wrong Answer | S = input()
S1 = S[0::2]
S2 = S[1::2]
S_count = S1.count('R') + S1.count('U') + S1.count('D')+ S2.count('L') + S2.count('U') + S2.count('D')
if len(S) == S_count:
print('YES')
else:
print('NO')
|
p03644 | s088780955 | Accepted | def resolve():
print(2 ** (len(bin(int(input()))) - 3))
if __name__ == '__main__':
resolve() |
p03605 | s528546796 | Wrong Answer | arr=raw_input()
ans="No"
for i in range(len(arr)):
if arr[0]==9:
ans = "Yes"
elif arr[1]==9:
ans = "Yes"
print ans |
p02657 | s603286779 | Accepted | # 1.入力をプログラムで扱えるように受け取ること
a, b = map(int, input().split())
# 2.受け取った入力値を使って、適切に処理(計算)すること
answer = a * b
# 3.計算した結果を出力すること
print(answer) |
p02873 | s336036594 | Wrong Answer | s = input()
n = len(s)
a = [0]*(n+1)
for i in range(n):
if s[i] == '<':
a[i+1] = max(a[i] + 1, a[i+1])
for i in range(-1, -n, -1):
if s[i] == '>':
a[i-1] = max(a[i] + 1, a[i-1])
print(sum(a)) |
p02833 | s646427771 | Wrong Answer | n = int(input())
if(n%2 == 1):
print(0)
else:
count = 0
n = n//2
val = n/5
while(int(val) != 0):
count += int(val)
val = val/5
print(count) |
p03095 | s604864096 | Accepted | from collections import Counter
N=int(input())
S=input()
mod = 10**9+7
d = Counter(S)
ans = 1
for v in d.values():
ans *= v+1
ans %=mod
print(ans-1) |
p03774 | s798187711 | Accepted | N, M = map(int, input().split())
ab = [[int(i) for i in input().split()] for _ in range(N)]
cd = [[int(i) for i in input().split()] for _ in range(M)]
for a, b in ab:
n = float('inf')
ans = 0
for i, tmp in enumerate(cd):
c, d = tmp
m = abs(a-c)+abs(b-d)
if n > m:
n = m
ans = i+1
print(ans)
|
p02723 | s527280552 | Accepted | s = input()
ret = "No"
if s[2] == s[3] and s[4]==s[5]:
ret = "Yes"
print("{}".format(ret)) |
p02951 | s083914979 | Wrong Answer | A, B, C = input().split()
A = int(A)
B = int(B)
C = int(C)
if A-B-C<=0:
print('0')
else:
print(-1*(A-B-C)) |
p03067 | s495829614 | Wrong Answer | a, b, c = map(int, input().split())
if a < b < c or c < b < a:
print('No')
else:
print('Yes') |
p02597 | s153893145 | Accepted | n = int(input())
c = input()
ans = 0
l, r = 0, n-1
while True:
while True:
if c[l] == "W":
break
if l >= r:
break
l += 1
while True:
if c[r] == "R":
break
if l >= r:
break
r -= 1
if l >= r:
break
ans += 1
l += 1
r -= 1
print(ans) |
p03380 | s030760033 | Accepted | n = int(input())
a = [int(i) for i in input().split()]
a.sort()
amax = a[-1]
tmp1 = amax + 1
for i in a[:n-1]:
tmp2 = i - amax/2
if tmp2 > tmp1:
break
else:
r = i
tmp1 = abs(tmp2)
print(amax, r) |
p02814 | s987048857 | Accepted | import sys
def gcd(x, y):
if x % y == 0:
return y
return gcd(y, x % y)
n, m = map(int, input().split())
a = list(map(int, input().split()))
cur = a[0]
for x in a[1:]:
g = gcd(cur, x)
if (cur // 2) % g != (x // 2) % g:
print(0)
sys.exit(0)
else:
cur = cur // g * x
if cur > m * 2:
print(0)
sys.exit(0)
print((m + cur // 2) // cur)
|
p03317 | s440225194 | Wrong Answer |
N, K = map(int, input().split())
A = list(map(int, input().split()))
print(N // (K-1)) |
p02717 | s448101444 | Accepted | X,Y,Z = map(int,input().split())
print(Z,X,Y) |
p03435 | s471317745 | Accepted | c1 = list(map(int,input().split()))
c2 = list(map(int,input().split()))
c3 = list(map(int,input().split()))
if c1[0]+c2[1]+c3[2] == c1[1]+c2[2]+c3[0] == c1[2]+c2[0]+c3[1]:
print("Yes")
else:
print("No") |
p02676 | s087506429 | Wrong Answer | k=int(input())
s=str(input())
if k>len(s):
print(s)
else:
print(s[0:k]+'...') |
p02708 | s595998152 | Accepted | N, K = map(int, input().split())
mod = 10**9 + 7
ans = 0
for i in range(K, N + 2):
ans += (((N*(N + 1) // 2) - ((N - i)*(N - i + 1) // 2)) - ((i - 1)*i // 2) + 1) % mod
print(ans % mod) |
p03767 | s054882515 | Accepted | N = int(input())
A = list(map(int, input().split()))
A=sorted(A)
t=0
for i in range(N):
a=A[3*N-i*2-2]
t+=a
print(t) |
p03077 | s613176562 | Accepted | n = int(input())
t = [int(input()) for _ in range(5)]
m = min(t)
print((n+m-1)//m+4) |
p03455 | s358709485 | Accepted | a,b = map(int,input().split())
if a%2 == 0 or b%2 == 0:
print("Even")
else:
print("Odd") |
p02576 | s812937023 | Accepted | N,X,T = list(map(int, input().split()))
a = N//X
b = N%X
if b > 0:
a+=1
print(a*T) |
p03162 | s622896148 | Wrong Answer | import sys
input = sys.stdin.readline #文字列入力では注意!
N = int(input())
a,b,c = map(int,input().split())
dp = [[a,b,c]]
for i in range(N-1):
a,b,c = map(int,input().split())
A = max(dp[i][1]+a,dp[i][2]+a)
B = max(dp[i][2]+b,dp[i][0]+b)
C = max(dp[i][0]+c,dp[i][1]+c)
dp.append([A,B,C])
print(dp)
print(max(dp[-1]))
|
p02948 | s982644729 | Wrong Answer | N, M = map(int,input().split())
A_B = [list(map(int, input().split())) for i in range(N)]
day = 0
ans = 0
A_B = sorted(A_B, key=lambda x:(-x[1], -x[0]))
#print(A_B)
for i in range(N):
#print(day)
for j in range(i, N):
if day + A_B[j][0] <= M:
ans += A_B[j][1]
break
day += 1
print(ans) |
p02712 | s250764530 | Accepted | n=int(input())
ans=0
for i in range(n+1):
if i%3!=0 and i%5!=0:
ans+=i
print(ans) |
p03286 | s643947840 | Accepted | n = int(input())
if n == 0:
print('0')
exit()
s = ''
while n != 0:
s = str(n%2)+s
n //= 2
n *= -1
print(s) |
p03438 | s299309904 | Wrong Answer | n = int(input())
dat1 = list(map(int,input().split()))
dat2 = list(map(int,input().split()))
dat1.sort()
dat2.sort()
can = True
for i in range(n):
if dat1[i] > dat2[i]:
can = False
print("Yes" if can else "No")
|
p03971 | s485159447 | Wrong Answer | x = list(map(int,input().split()))
n = x[0]
a = x[1]
b = x[2]
s = input()
c = 0
k = 0
for i in range(0,n):
if(s[i] == "c"):
print("No")
continue
elif(s[i] == "a"):
if(c < a + b):
print("yes")
c = c + 1
else:
print("No")
else:
if(c < a + b and k < b):
print("Yes")
c = c + 1
k = k + 1
else:
print("No")
k = k + 1 |
p03061 | s890174846 | Accepted | import math
n = int(input())
a = list(map(int,input().split()))
left = [0]*(n+1)
right = [0]*(n+1)
for i in range(n):
left[i+1] = math.gcd(left[i],a[i])
for i in range(n-1,-1,-1):
right[i] = math.gcd(right[i+1],a[i])
ans = 0
for i in range(n):
tmp = math.gcd(left[i],right[i+1])
ans = max(tmp,ans)
print(ans) |
p03469 | s670988232 | Accepted | s=input()
s="2018"+s[4:]
print(s) |
p03131 | s210879922 | Accepted | k, a, b = map(int, input().split())
if b <= a + 1:
print(k + 1)
else:
n = (k - (a - 1)) // 2
r = (k - (a - 1)) % 2
if r == 0:
print(n * b - (n - 1) * a)
elif r == 1:
print(n * b - (n - 1) * a + 1) |
p02726 | s049357974 | Accepted | def D():
N, X, Y = map(int, input().split())
dist = {i: 0 for i in range(1,N)}
for i in range(1, N+1):
for j in range(i+1, N+1):
distance = min(j-i, abs(i-X)+abs(j-Y)+1)
#print(i, j, distance)
dist[distance] += 1
for i in dist:
print(dist[i])
D() |
p03001 | s283550527 | Wrong Answer | W, H, x, y = map(int, input().split())
print(W*H/2, end=' ')
print(1 if W*y==x**H else 0) |
p04019 | s998797829 | Wrong Answer | S = input()
a = S.count('N') - S.count('S')
b = S.count('E') - S.count('W')
if a == 0 and b == 0:
print('Yes')
else:
print('No') |
p02576 | s931132572 | Wrong Answer | import sys
def main(lines):
line=lines
if __name__ == '__main__':
lines = []
for l in sys.stdin:
lines.append(l.rstrip('\r\n'))
main(lines)
|
p02691 | s839090406 | Accepted | def main():
from collections import Counter as ct
n = int(input())
a = list(map(int, input().split()))
npa = ct([i+1+j for i, j in enumerate(a)])
nma = ct([i+1-j for i, j in enumerate(a)])
cnt = 0
for i, j in npa.items():
cnt += j*nma[i]
print(cnt)
main()
|
p02683 | s776605972 | Accepted | N,M,X =map(int,input().split())
CA = [list(map(int,input().split())) for i in range(N)]
ans = float('inf')
for bit in range(1 << N):
book = [0]*M
cost = 0
for i in range(N):
if(bit >> i) & 1:
cost += CA[i][0]
for c in range(M):
book[c] += (CA[i][c+1])
# print(book)
if all(X <= a for a in book):
ans = min(ans,cost)
if ans == float('inf'):
print(-1)
else:
print(ans) |
p02953 | s532353796 | Wrong Answer | n=int(input())
list=list(map(int,input().split()))
for i in range(1,n):
if list[i-1]>list[i]:
list[i-1]-=1
if list[i]==max(list[0:i]):
continue
else:
print("No")
break
else:print("Yes") |
p03087 | s038455957 | Accepted | n, q = map(int, input().split())
s = str(input())
cum = [0]*n
for i in range(n):
if i == 0:
continue
if s[i-1] == 'A' and s[i] == 'C':
cum[i] = cum[i-1]+1
else:
cum[i] = cum[i-1]
#print(cum)
for i in range(q):
l, r = map(int, input().split())
l, r = l-1, r-1
print(cum[r]-cum[l]) |
p03785 | s093173666 | Accepted | N,C,K = map(int,input().split())
T = sorted([int(input()) for _ in range(N)])
bus = 1
tmp_bus = 1
bus_time = T[0] + K
for t in T[1:]:
if tmp_bus < C and t <= bus_time:
tmp_bus += 1
else:
bus += 1
bus_time = t + K
tmp_bus = 1
print(bus) |
p02873 | s031671461 | Accepted | S = input()
prev = ">"
terrain = []
curr = 0
for c in S:
if c == prev:
curr += 1
else:
prev = c
terrain.append(curr)
curr = 1
terrain += [curr]
ans = (terrain[0] * (terrain[0] + 1)) // 2
for up, down in zip(terrain[1::2], terrain[2::2]):
if up < down:
up, down = down, up
down -= 1
ans += (up * (up + 1)) // 2
ans += (down * (down + 1)) // 2
if len(terrain) % 2 == 0:
ans += terrain[-1] * (terrain[-1] + 1) // 2
print(ans)
|
p04043 | s648016310 | Wrong Answer | def test():
arr = input()
arr = arr.split()
arr = sorted(arr)
if arr==[5, 5, 7]:
print("YES")
else:
print("NO")
test()
|
p02993 | s292016879 | Accepted | x = input ()
a = 'Good'
for i in range (3):
if x[i] == x[i+1]:
a = 'Bad'
break
print (a) |
p03163 | s757912510 | Accepted | import sys
import numpy as np
def main():
n, w = map(int, sys.stdin.buffer.readline().split())
dp = np.zeros(w+1, dtype = int)
for x in sys.stdin.buffer.readlines():
w, v = map(int, x.split())
np.maximum(dp[w:] , dp[:-w] + v, out = dp[w:])
print(dp.max())
if __name__ == '__main__':
main() |
p03059 | s506871433 | Accepted | A,B,T = map(int, input().split())
count = 0
for i in range(A, T+1, A):
count += B
print(count) |
p02582 | s527132097 | Accepted | LL = input()
count = 0
maxcount = 0
for ll in LL:
if ll == "R":
count+= 1
else:
count = 0
if maxcount <= count:
maxcount = count
print(maxcount) |
p03087 | s157175922 | Accepted | n, q = map(int, input().split())
s = input()
lr = [0] * q
def inp(l: list) -> list:
return [int(l[0]) - 1, int(l[1]) - 1]
for i in range(q):
lr[i] = tuple(inp(input().split()))
count = [0]*n
for i in range(1, n):
if s[i-1] == 'A' and s[i] == 'C':
count[i] = count[i-1] + 1
else:
count[i] = count[i-1]
# print(count)
for l, r in lr:
print(count[r] - count[l])
|
p02647 | s375197718 | Wrong Answer |
N,K=map(int,input().split())
A=list(map(int,input().split()))
B=[0]*N
sousa=0
kaisuu=max(K,42)
while sousa<kaisuu:
for i in range(N):
ma=i+A[i]+1
if ma>N:
ma=N
mi=i-A[i]
if mi<0:
mi=0
for j in range(mi,ma):
B[j]+=1
A=list(B)
B=[0]*N
sousa+=1
A=[str(k) for k in A]
print(" ".join(A)) |
p03672 | s592784315 | Accepted | s = input()
n = len(s)
for i in range(2, n, 2):
left = int((n-i)/2)
tmp1 = s[0:left]
tmp2 = s[left:n-i]
if (tmp1 == tmp2):
print(left * 2)
break |
p02702 | s080398104 | Accepted | s=input()
s_rev=s[::-1]
mod_count=[0]*2019
mod_count[0]=1
d=1
num=0
for char in s_rev:
num=num+int(char)*d
num=num%2019
d=d*10
d=d%2019
#print(type(num),type(mod_count))
mod_count[num]=mod_count[num]+1
ans=0
for cnt in mod_count:
ans=ans+cnt*(cnt-1)/2
print(int(ans)) |
p03548 | s526439974 | Accepted | def ABC_78_B():
X,Y,Z = map(int, input().split())
sum=0
N=0
while sum<= X:
sum = Y*N+Z*(N+1)
N+=1
print(N-2)
if __name__ == '__main__':
ABC_78_B() |
p02989 | s477541411 | Wrong Answer | N = int(input())
points = list(map(int, input().split()))
ans = 0
for k in range(int(sum(points)/2)):
arc_list = []
abc_list = []
for point in points:
if point >= k:
arc_list.append(point)
else:
abc_list.append(point)
if len(arc_list) == len(abc_list):
ans += 1
print(ans) |
p02793 | s601872239 | 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()))
b=a[0]
ans=0
for i in range(1,n):
b=lcm(a[i],b)
for i in range(n):
ans += b//a[i]
print(ans%(10**9 + 7)) |
p03042 | s422547591 | Accepted | s = input()
i1 = int(s[:2])
i2 = int(s[2:])
def f(i):
if (0 < i < 13):
return 1
elif (0 < i < 100):
return 2
else:
return 0
f1 = f(i1)
f2 = f(i2)
if (f1 == 1):
if (f2 == 1):
print("AMBIGUOUS")
else:
print("MMYY")
else:
if (f2 == 1):
print("YYMM")
else:
print("NA")
|
p02759 | s326450891 | Accepted | n=int(input())
if n%2==0:
print(n//2)
else:
print(n//2+1) |
p03705 | s577327226 | Wrong Answer | n, a, b = map(int, input().split())
fst = (n - 1) * b + a
sec = (n - 1) * a + b
print(fst - sec + 1) |
p02690 | s634643016 | Accepted | x = int(input())
d = {}
for i in range(1000):
b = (-1000+i)**5
d[b] = -1000+i
for i in range(1000):
a = i**5
d[a] = i
if a-x in d:
b = d[a-x]
a = i
break
print(a,b) |
p03041 | s403070974 | Wrong Answer | n, k = map(lambda x: int(x), input().split())
s = input()
str = ""
for i in range(n):
if i - 1 == k:
str += s[i].lower()
else:
str += s[i]
print(str) |
p03038 | s732444497 | Accepted | from collections import Counter
import heapq
N,M = map(int,input().split())
A = Counter(list(map(int,input().split())))
cards = []
for x,y in A.items():
heapq.heappush(cards, (-x,y))
for _ in range(M):
b,c = map(int,input().split())
heapq.heappush(cards, (-c,b))
cnt = N
ans = 0
while cnt <= N:
v,c = heapq.heappop(cards)
v *= -1
if cnt-c < 0:
ans += v*cnt
break
else:
ans += v*c
cnt -= c
print(ans)
|
p03012 | s672905138 | Accepted | n=int(input())
w=list(map(int,input().split()))
k=sum(w)
s1=w[0]
mi=abs(k-2*w[0])
for i in range(1,n-1):
s1=s1+w[i]
if abs(k-2*s1)<mi:
mi=abs(k-2*s1)
print(mi) |
p02959 | s566757973 | Wrong Answer | N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
A.reverse()
B.reverse()
cnt = 0
tmp = 0
tmp2 = 0
for i in range(N):
if A[i] >= B[i]:
cnt += B[i]
else:
tmp = B[i] - A[i]
cnt += A[i]
if A[i+1] >= tmp:
cnt += tmp
else:
cnt += A[i+1]
A[i+1] = 0
print(cnt) |
p03095 | s082901984 | Wrong Answer | from collections import Counter
n = int(input())
s = input()
mod = 10**9 + 7
c = Counter(s)
ans = 1
for i in range(ord("a"), ord("z")+1):
ans *= (c[chr(i)] + 1)
print(ans - 1) |
p02802 | s347679205 | Accepted | N,M = map(int,input().split())
AC = set()
WA = [0]*N
for i in range(M):
k,l = input().split()
k = int(k)
if l=="WA":
if not k in AC:
WA[k-1] += 1
else:
if not k in AC:
AC.add(k)
counter = 0
for i in AC:
counter += WA[i-1]
print("{} {}".format(len(AC),counter)) |
p03069 | s209407333 | Accepted | N,S = open(0).read().split()
N = int(N)
w = S.count('.')
ans = float('inf')
ws = [0] * (N+1)
for i in range(1,N+1):
ws[i] = ws[i-1]
if S[i-1] == '.':
ws[i] += 1
for i in range(N+1):
ans = min(ans,i-2*ws[i]+w)
print(ans) |
p03012 | s427659155 | Wrong Answer | N=int(input())
W=list(map(int,input().split()))
val=0
total=sum(W)
while True:
for i in range(N):
val+=W[i]
if val>=total//2:
break
break
print(val-(total-val)) |
p03069 | s757020716 | Wrong Answer | N = int(input())
S = input()
ind = S.find('#')
if ind == -1:
print(0)
else:
print(S.count('.', ind))
|
p03494 | s317793048 | Wrong Answer | n=int(input())
l=list(map(int,input().split()))
s=float('inf')
for a in l:
c=0
while 1:
if a%2!=0:
break
a/=2
c+=1
s=min(s,c)
print(c)
|
p03385 | s301752609 | Wrong Answer | s = input()
s = sorted(s)
if s == "abc":
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.