problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p03282 | s819475547 | Accepted | s = list(input())
k = int(input())
for i in range(len(s)):
if s[i] != "1":
break
if k-1 < i:
print("1")
else:
print(s[i]) |
p03435 | s003592320 | Accepted | m=lambda:map(int,input().split())
a,b,c=m();d,e,f=m();g,h,i=m()
print(['No','Yes'][d-a==e-b==f-c and g-a==h-b==i-c]) |
p02612 | s732091762 | Wrong Answer | print(1000-(int(input())%1000)) |
p03067 | s806752950 | Accepted | a,b,c=list(map(int ,input().split()))
ans_range=range(a,b)
ans_range1=range(b,a)
if(c in ans_range or c in ans_range1):
print("Yes")
else:
print("No")
|
p03493 | s752564223 | Accepted | print(input().count('1')) |
p03077 | s536262633 | Accepted | import math
n = int(input())
tra = [int(input()) for i in range(5)]
print(math.ceil(n/min(tra))+4) |
p03699 | s193060303 | Wrong Answer | #!/usr/bin/env python3
n = int(input())
s = [int(input()) for _ in range(n)]
s_5 = [s[i] for i in range(n) if s[i] % 10 == 5]
# maxはsumから5の倍数ならそのまま、10の倍数ならminの5の倍数をひく
sum_s = sum(s)
s_5.sort()
if sum_s % 10 == 5:
print(sum_s)
else:
if len(s_5) == 0:
print(0)
else: print(sum_s - s_5[0]) |
p03943 | s738839708 | Wrong Answer | a = list(map(int,input().split()))
hanbun = int(sum(a)/2)
isOK = False
for i in range(3):
if hanbun==a[i]:
isOK = True
if isOK:
print('Yes')
else:
print('No')
|
p03997 | s547547200 | Accepted | a = int(input())
b = int(input())
h = int(input())
print(int(h*(a+b)/2)) |
p03861 | s929509805 | Wrong Answer | a,b,x = map(int, input().split())
if a//x==a/x:
A=a//x
else:
A=a//x+1
B=b//x
print(0 if B-A==0 else B-A+1)
|
p02957 | s314493290 | Accepted | a, b = map(int, input().split())
x = a + b
if x % 2 == 0:
print(x // 2)
else:
print("IMPOSSIBLE") |
p02796 | s877236123 | Accepted | import sys
input = sys.stdin.readline
N = int(input())
robots, count = [], 0
for x in range(N):
X, L = map(int, input().split())
robots.append((X+L, X-L))
robots.sort()
node = -10**12
for end, start in robots:
if start >= node:
node = end
count += 1
print(count)
|
p03475 | s053709400 | Accepted | from math import ceil
n = int(input())
cs = []
ss = []
fs = []
for _ in range(n-1):
c, s, f = map(int, input().split())
cs.append(c)
ss.append(s)
fs.append(f)
for i in range(n):
t = 0
for j in range(i, n-1):
if t < ss[j]:
t = ss[j]
t = ceil(t / fs[j]) * fs[j]
... |
p03163 | s093988460 | Wrong Answer | n,w=[int(i) for i in input().split()]
wi=[]
val=[]
for i in range(n):
k=[int(i) for i in input().split()]
wi.append(k[0])
val.append(k[1])
dp=[[-1]*10**5]*105
def solve(pos,we):
if we>w:
return float("-inf")
if pos>=n:
return 0
if dp[pos][we]!=-1:
return dp[pos][we]
a... |
p02615 | s257001461 | Accepted | from heapq import *
N,*A = map(int, open(0).read().split())
ai = [x * (-1) for x in A]
heapify(ai)
ans = heappop(ai) * (-1)
searching = 1
for i in range(N-2):
if i % 2 == 0:
temp = heappop(ai) * (-1)
ans += temp
print(ans) |
p02953 | s129272755 | Accepted | #!/usr/bin/env python3
def solve(a):
for i in range(len(a)-1):
if a[i+1] - a[i] <= -2:
return "No"
elif a[i+1] - a[i] == -1:
a[i+1] += 1
return "Yes"
def main():
N = int(input())
A = [0] + list(map(int,input().split()))
print(solve(A))
if __name__ == '__main... |
p02859 | s172976961 | Accepted | r = int(input())
print(int(r**2))
|
p04033 | s947563152 | Wrong Answer | a, b = map(int, input().split())
if a>0:
print('Positive')
elif b<0:
print('Negative')
else:
print('Zero') |
p02989 | s784745636 | Wrong Answer | N = int(input())
d = [int(i) for i in input().split()]
l = len(d) // 2
boundary = d[l - 1]
next_d = boundary
for i in d[l:]:
if i > boundary:
next_d = i
break
print(next_d - boundary)
|
p03077 | s419244584 | Wrong Answer | n = int(input())
a = []
ans = 1
for i in range(5):
a.append(int(input()))
for i in a:
if n>i:
if n%i == 0:
ans += n//i
else:
ans += n//i+1
n = n%i
else:
ans += 1
print(ans) |
p03210 | s882288250 | Wrong Answer | a = int(input())
if a == 3 | a == 5 | a == 7:
print('YES')
else:
print('NO') |
p03486 | s349728789 | Wrong Answer | s = sorted(input())
t = sorted(input())
flag1 = True
flag2 = False
if len(s) < len(t):
for i in range(len(s)):
if s[i] != t[i]:
flag1 = False
break
else:
flag1 = False
for i in range(min(len(s), len(t))):
if s[i] < t[i]:
flag2 = True
break
if flag1 or flag2:
... |
p03438 | s045783391 | Wrong Answer | n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
cnt = 0
for i in range(n):
if A[i] > B[i]:
cnt -= (A[i] - B[i])
else:
cnt += (B[i] - A[i])//2
print('Yes' if cnt > 0 else 'No') |
p02759 | s387193913 | Wrong Answer | N = int(input())
K = N % 2
S = (N + K) / 2
print(S) |
p02647 | s560895562 | Accepted | import sys
input = sys.stdin.readline
from itertools import accumulate
N,K=map(int,input().split())
A=list(map(int,input().split()))
for tests in range(K):
B=[0]*(N+1)
for i in range(N):
B[max(0,i-A[i])]+=1
B[min(N,i+A[i]+1)]-=1
A=list(accumulate(B))
flag=1
for i in range(N):
... |
p02747 | s219852391 | Accepted | def solve(s):
return "Yes" if "hi" * (len(s) // 2) == s else "No"
assert solve("hihi") == "Yes"
assert solve("hi") == "Yes"
assert solve("ha") == "No"
assert solve("hii") == "No"
s = input()
print(solve(s)) |
p02719 | s070213473 | Accepted | n,k = map(int,input().split())
if n % k > -(n % k - k):
print(-(n % k - k))
else:
print(n % k) |
p03136 | s692640750 | Accepted | N = int(input())
L = list(map(int, input().split()))
most = max(L)
if 2*most < sum(L):
print("Yes")
else:
print("No") |
p02988 | s310764380 | Accepted | n = int(input())
p = list(map(int, input().split()))
cnt = 0
for i in range(1, n-1):
if(p[i-1] < p[i] and p[i] < p[i+1]):
cnt += 1
elif(p[i-1] > p[i] and p[i] > p[i+1]):
cnt += 1
print(cnt) |
p02813 | s663386081 | Accepted | import itertools
n = int(input())
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
li = list(itertools.permutations(range(1, n+1), n))
a = li.index(p)
b = li.index(q)
print(abs(a-b)) |
p03037 | s670091486 | Accepted | N, M = map(int, input().split())
left = 1
right = N
for _ in range(M):
L, R = map(int, input().split())
left = max(left, L)
right = min(right, R)
if left > right:
print(0)
else:
print(right - left + 1)
|
p02787 | s505608265 | Wrong Answer | import numpy as np
h, n = map(int, input().split())
ab = np.array([list(map(int, input().split()))])
a, b = ab[:, 0], ab[:, 1]
dp = np.zeros(h+1, dtype=np.int)
for i in range(1, h+1):
dp[i] = np.min(dp[np.maximum(i-a, 0)] + b)
print(dp[h])
|
p03681 | s739674636 | Wrong Answer | a,b = map(int,input().split())
div = int(10e9+7)
if abs(a-b)>1:
print(0)
else:
if a != b:
x = 1
y = 1
for i in range(2,a+1):
x *= i
x %= div
for i in range(2,b+1):
y *= i
y %= div
print(x*y%div)
else:
print(a*b*... |
p03795 | s197827344 | Wrong Answer | e = int(input())
print(int(e/15))
print(e*800 - (int(e/15)*200)) |
p02571 | s762869953 | Accepted | S = input()
T = input()
ans = len(T)
for S_start in range(len(S) - len(T) + 1):
correct = 0
for i in range(len(T)):
if T[i] != S[S_start + i]:
correct += 1
ans = min(ans, correct)
#print(ans)
print(ans) |
p03814 | s790471216 | Accepted | s = input()
st = None
en = None
for i in range(len(s)):
if st is None and s[i] == 'A':
st = i
if en is None and s[-i-1] == 'Z':
en = -i - 1
print(len(s[st:en]) + 1) |
p03745 | s026223890 | Accepted | def main():
n, *a = map(int, open(0).read().split())
c = 1
f = 0
d = [-1,1]
for i, j in zip(a, a[1:]):
if i == j:
continue
else:
g = d[i < j]
if f * g == -1:
f = 0
c += 1
else:
f = g
print(c)
if __name__ == '__main... |
p02951 | s611049464 | Accepted | A,B,C = (int(x) for x in input().split())
ans = B+C-A
if ans>=0:
print(ans)
else:
print(0)
|
p03239 | s694632135 | Accepted | N, T = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(N)]
ans, sav = 1001, 0
for i in A:
if i[1] <= T:
sav = i[0]
if ans > sav:
ans = sav
if ans > 1000:
ans = "TLE"
print(ans)
|
p02645 | s083108235 | Accepted | s = input()
print(s[0]+s[1]+s[2]) |
p03495 | s605677240 | Accepted | import sys
from collections import Counter
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, K, *A = map(int, read().split())
counter = Counter(A)
M = len(counter.keys())
value = sorted(cou... |
p02771 | s458086965 | Accepted | A,B,C= map(int,input().split())
if A == B == C :
print('No')
elif A == B :
print('Yes')
elif B == C :
print('Yes')
elif A == C :
print('Yes')
else:
print('No') |
p02972 | s397943086 | Wrong Answer | n = int(input())
a = list(map(int, input().split()))
ans = [0]*n
for i in reversed(range(1,n)):
if sum(ans[(i-i)::i])%2 != a[i]:
ans[i] += 1
if sum(ans) != a[0]:
ans[0] += 1
print(" ".join(map(str, ans))) |
p02767 | s428464328 | Accepted | n = int(input())
x = list(map(int,input().split()))
a = min(x)
b = max(x) + 1
ans = 10 ** 8
for p in range(a,b):
m = 0
for i in range(n):
m += (x[i] - p) ** 2
ans = min(ans,m)
print(ans) |
p03711 | s797597462 | Accepted | x, y = map(int, input().split())
g1 = [1, 3, 5, 7, 8, 10, 12]
g2 = [4, 6, 9, 11]
g3 = [2]
if x in g1 and y in g1:
print("Yes")
elif x in g2 and y in g2:
print("Yes")
elif x in g3 and y in g3:
print("Yes")
else:
print("No") |
p02595 | s430615777 | Accepted | from math import sqrt
n, d = map(int, input().split())
cnt = 0
for i in range(n):
x, y = map(int, input().split())
if sqrt(x ** 2 + y ** 2) <= d:
cnt += 1
print(cnt) |
p02714 | s702225234 | Accepted | n=int(input())
s=input()
from collections import Counter
ans = s.count("R") * s.count("G") * s.count("B")
for step in range(1,n//2+2):
for start in range(n):
# print(start,step,start+2*step,n)
if start+2*step>=n:
# print("out!")
break
ans-=len(set((s[start], s[star... |
p03059 | s104727678 | Wrong Answer | A, B, T = map(int, input().split(' '))
print(B * T // A)
|
p03261 | s230425834 | Accepted | import sys
readline = sys.stdin.readline
def main():
n = int(readline())
w1 = readline().rstrip()
l = w1[-1]
words = set()
words.add(w1)
for _ in range(n-1):
w = readline().rstrip()
if w[0] == l and w not in words:
l = w[-1]
words.add(w)
else:
... |
p03095 | s968390832 | Accepted | from collections import Counter
N = int(input())
S = list(input())
ans = 1
for v in Counter(S).values():
ans *= v+1
print((ans-1)%1000000007) |
p03041 | s354336588 | Accepted | n, k = list(map(int, input().split()))
s=input()
before = s[0:k-1]
low = s[k-1]
low = low.lower()
after = s[k:]
print(before+low+after) |
p02995 | s666229635 | Accepted | import math
A, B, C, D = map(int, input().split())
# 対象となる数の個数
num = B - A + 1
# Cで割り切れる数の個数
C_div = B // C - (A - 1) // C
# Dで割り切れる数の個数
D_div = B // D - (A - 1) // D
# CでもDでも割り切れる数の個数
CandD = (C * D) // math.gcd(C, D)
CandD_div = B // CandD - (A - 1) // CandD
# CもしくはDで割り切れる数の個数
CorD_div = C_div + D_div - CandD_div
re... |
p02714 | s743623703 | Accepted | n = int(input())
s = input()
(r,g,b) = (0,0,0)
for i in s:
if i == "R":
r += 1
elif i == "G":
g += 1
else:
b += 1
a = r*g*b
t = 0
for i in range(n-2):
for j in range(i+1,n-1):
if 2*j-i <= n-1 and s[i]!=s[j] and s[j]!=s[2*j-i] and s[2*j-i]!=s[i]:
t += 1
print (a-t) |
p03076 | s207263733 | Wrong Answer | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
abcde = list(map(int, read().split()))
check = sorted([abcde[0] % 10, abcde[1] % 10, abcde[2] % 10, abcde[3] % 10, abcde[4] % 10])
for i in range(5):
if check[0] == 0:
... |
p02802 | s629861926 | Accepted | import numpy as np
N,M=map(int,input().split())
wa=np.zeros(N+1)
ac=np.zeros(N+1)
for _ in range(M):
p,S=input().split()
if S=='AC' and ac[int(p)]==0:
ac[int(p)]+=1
elif S=='AC' and ac[int(p)]>0:
pass
elif ac[int(p)]==0:
wa[int(p)]+=1
print(int(sum(ac)), int(np.dot(ac>0,wa))) |
p02958 | s079277695 | Wrong Answer | n = input()
p = list(map(int,input().split()))
ps = sorted(p)
d_p = []
d_ps = []
for i,q in enumerate(p):
if q != ps[i]:
d_p.append(q)
d_ps.append(ps[i])
if len(d_p) > 2:
print('No')
elif len(d_p) == 2:
d_p.sort()
if d_p == d_ps:
print('Yes')
else:
print('No')
else:
print('Yes') |
p02603 | s234481040 | Wrong Answer | n = int(input())
a = list(map(int, input().split()))
b = sorted(a, reverse=True)
money = 1000
kabu = 0
for i in range(n-1):
if a[i] < a[i+1]:
kabu += money // a[i]
money -= a[i] * kabu
elif a[i] > a[i+1]:
money += a[i] * kabu
kabu = 0
print(money + a[-1] * kabu)
|
p02708 | s351546023 | Accepted | N, K = map(int, input().split())
MOD = 10**9 + 7
def f(t):
return (N-t+1)*t+1
ans = 0
for i in range(K, N+2):
ans += f(i)
ans %= MOD
print(ans) |
p03210 | s556731706 | Accepted | age = int(input())
if age == 3 or age == 5 or age == 7:
print('YES')
else:
print('NO')
|
p03030 | s841350516 | Accepted | n = int(input())
r = []
for i in range(n):
s, p = input().split()
r.append((i + 1, s, int(p)))
r.sort(key=lambda x: (x[1], -x[2]))
for ri in r:
print(ri[0]) |
p03345 | s935344836 | Accepted | # -*- coding: utf-8 -*-
'''
A, B, C, K = map(int, input().split())
for i in range(K):
a = A
b = B
c = C
A = b + c
B = a + c
C = a + b
ans = A - B
if ans >= 10**8:
ans = 'Unfair'
elif ans >*10**8:
ans = 'Unfair'
print(ans)
'''
A, B, C, K= map(int, input().split())
if K%2==1:
... |
p03075 | s966517520 | Wrong Answer | a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
if e-a<k:
print("Yay!")
else:
print(":(") |
p02888 | s744960858 | Wrong Answer | import bisect
n=int(input())
l=sorted(list(map(int,input().split())))
cnt=0
for i in range(0,n-2):
for j in range(i+1,n-1):
p=bisect.bisect_right(l,l[i]+l[j]-1)
print(cnt)
|
p02778 | s059218550 | Accepted | S = input()
print('x'*len(S)) |
p02696 | s109180580 | Accepted | A,B,N = map(int,input().split())
if B<=N:
print(int((A*(B-1))/B)-(A*int((B-1)/B)))
else:
print(int((A*N)/B)-(A*int(N/B))) |
p02784 | s406012009 | Accepted | h,a = map(int,input().split())
li = list(map(int,input().split()))
if sum(li)>=h:
print("Yes")
else:
print("No") |
p02712 | s836434955 | Wrong Answer | num = int(input())
result = 0
for fizzbuzz in range(num):
if fizzbuzz % 3 == 0 and fizzbuzz % 5 == 0:
continue
elif fizzbuzz % 3 == 0:
continue
elif fizzbuzz % 5 == 0:
continue
result += fizzbuzz
print(result) |
p03799 | s029323184 | Wrong Answer | N, M = map(int, input().split())
while N * 2 <= M:
M -= 2
N += 1
print(N - 1)
|
p03556 | s178787935 | Accepted | n=int(input())
ans=1
while (ans+1)**2<=n:
ans+=1
print(ans**2) |
p02783 | s604674283 | Accepted | from sys import stdin
lines = stdin.readlines()
H, A = map(int, lines[0].split())
cnt = 1
while cnt <= 10000:
if cnt * A >= H:
print(cnt)
break
cnt += 1
|
p03013 | s639041159 | Accepted | n, m = list(map(int, input().split()))
a = []
for i in range(m):
a.append(int(input()))
mod = 1000000007
memo = [-1]*(n+1)
memo[0] = 0
for k in range(m):
memo[a[k]] = 0
for i in range(1, n+1):
if memo[i] != -1:
pass
elif i <= 2:
memo[i] = memo[i-1] + 1
else:
memo[i] = me... |
p03380 | s000100661 | Accepted | n=int(input())
a=list(map(int, input().split()))
a.sort(reverse=True)
ideal = a[0]//2
dif_mn = 10**9
for i in range(1,n):
tmp = a[0]-a[i] if a[i] > ideal else a[i]
dif = ideal-tmp
if dif < dif_mn:
r = a[i]
dif_mn = dif
print(a[0], r)
|
p02939 | s589143102 | Accepted | s=input()
c=0
s2=""
s3=""
for i in s:
s3+=i
if s2!=s3:
c+=1
s2=s3
s3=""
print(c) |
p02793 | s165865778 | Accepted | import math
import fractions
def lcm(x, y):
return (x * y) // fractions.gcd(x, y)
N = int(input())
l = list(map(int, input().split()))
MODp = 1000000007
K = 1
for i in range(N):
K = lcm(K,l[i])
Ans = 0
for i in range(N):
Ans += ((K // l[i]))
Ans = Ans % MODp
print(Ans) |
p02584 | s170048161 | Wrong Answer | X, K, D = map(int, input().split())
if abs(X) < K * D:
t1 = X % D
t2 = D - t1
print(min(t1, t2))
else:
t1 = abs(abs(X) - K * D)
t2 = abs(abs(X) - (K - 1) * D)
print(min(t1, t2)) |
p03075 | s340796515 | Accepted | L=[int(input()) for _ in range(6)];print(["Yay!",":("][L[4]-L[0]>L[5]])
|
p02576 | s958164114 | Wrong Answer | n,x,t=map(int,input().split())
print((int(n/x)+1)*t) |
p03478 | s188320072 | Accepted | n,a,b = map(int, input().split())
res = 0
for i in range(1, n+1):
tot = i%10 + i//10%10 + i//100%10 + i//1000%10 + i//10000
if tot >= a and tot <= b:
res += i
print(res) |
p03469 | s829277401 | Wrong Answer | N = list(input())
N[0] = "2"
N[1] = "0"
N[2] = "1"
N[3] = "8"
print(N)
date = ''.join(N)
print(date) |
p02647 | s075686983 | Accepted | import sys
def input():return sys.stdin.readline()[:-1]
def N(): return int(input())
def NM():return map(int,input().split())
def L():return list(NM())
def LN(n):return [N() for i in range(n)]
def LL(n):return [L() for i in range(n)]
n,k=NM()
l=L()
dp=[]
from itertools import accumulate
for _ in range(min(100,k)):
... |
p02923 | s540431028 | Wrong Answer | N=int(input())
h=list(map(int, input().split()))
cnt=0
ans=0
for i in range(N-1):
if h[i]>=h[i+1]:
cnt+=1
else:
if cnt>=ans:
ans=cnt
cnt=0
print(cnt) |
p02706 | s995542685 | Wrong Answer | N, M = map(int, input().split())
A = map(int, input().split())
if sum(A) > N:
print(-1)
else:
print(N - sum(A)) |
p02711 | s333822930 | Accepted | num = input()
if '7' in num:
print("Yes")
else:
print("No") |
p02939 | s651752239 | Accepted | def main():
word = list(input())
dp = [0] * len(word)
dp[0] = 1
dp[1] = 1
if word[0] != word[1]:
dp[1] = 2
for i in range(2, len(word)):
if word[i] != word[i - 1]:
dp[i] = dp[i - 1] + 1
else:
dp[i] = dp[i - 3] + 2
print(dp[len(word) - 1])
if ... |
p03779 | s040671921 | Wrong Answer | import math
x=int(input())
a=10**5
b=0
while abs(a-b)>0.01:
y=(a+b)/2
if (y**2+y)/2>x:
a=y
else:
b=y
print(math.ceil(b)) |
p02682 | s574537094 | Accepted | A,B,C,K=map(int,input().split())
tot=0
all=K
if K-A>=0:
tot+=A*1
all-=A
if all-B>=0:
tot+=B*0
all-=B
if all-C>=0:
tot+=-1*C
else:
tot+=-1*all
else:
tot+=0*all
else:
tot+=1*all
print(tot) |
p03644 | s987123019 | Accepted | n = int(input())
ans = 1
while ans*2<=n:
ans *= 2
print(ans)
|
p02554 | s261409493 | Accepted | n = int(input())
print((10 ** n - 2 * 9 ** n + 8 ** n) % (10 ** 9 + 7)) |
p03860 | s365000488 | Accepted | A = list(input().split())
print(A[0][0]+A[1][0]+A[2][0])
|
p03211 | s711702916 | Accepted | small=list()
S=list(input())
for i in range(len(S)-2):
small.append(abs(int(S[i]+S[i+1]+S[i+2])-753))
print(min(small)) |
p02660 | s790148466 | Accepted | from bisect import bisect_right
N = int(input())
Nroot = int(N**(1/2))
an = [i*(i+1)//2 for i in range(50)]
ans = 0
for i in range(2, Nroot):
count = 0
if N%i == 0:
Ni = N//i
count = 1
while Ni%i == 0:
count += 1
Ni = Ni//i
ans += bisect_right(an, count) -1
N = N//(i**co... |
p02732 | s519188533 | Accepted | from collections import Counter
n = int(input())
a = [int(x) for x in input().split()]
A = Counter(a)
total = sum([A[i] * (A[i] - 1) //2 for i in A.keys()])
for i in range(n):
tmp = a[i]
print(total - A[tmp] +1) |
p03062 | s492233153 | Accepted | N = int(input())
A = [int(x) for x in input().split()]
minux_count = 0
minimum_abs = 10**9+1
if_zero_exists = False
for a in A:
if a < 0:
minux_count += 1
if a == 0:
if_zero_exists = True
if abs(a) < minimum_abs:
minimum_abs = abs(a)
answer = 0
for a in A:
answer += abs(a)
if i... |
p02832 | s602519026 | Accepted | n = int(input())
a = list(map(int, input().split()))
cnt = 1
ans = 0
if 1 not in a:
print(-1)
exit()
for num in a:
if num == cnt:
cnt+=1
else:
ans+=1
print(ans) |
p03017 | s233888102 | Accepted | N, A, B, C, D = map(int, input().split())
S = input()
for i in range(A, max(C, D)):
if S[i-1:i+1] == '##':
print('No')
exit(0)
if C < D:
print('Yes')
exit(0)
for i in range(B-1, D):
if S[i-1:i+2] == '...':
print('Yes')
exit(0)
print('No')
|
p02742 | s374010016 | Wrong Answer | H, W = map(int, input().split())
if H % 2 == 0:
print(H * W // 2)
elif W % 2 == 0:
print(W * H // 2)
else:
print((H - 1) * W // 2 + W // 2 + 1) |
p03612 | s088821430 | Wrong Answer | n = int(input())
p_li = list(map(int,input().split()))
dum = 0
ans = 0
flag = 0
count = 0
for i in range(n):
if i+1 == p_li[i]:
ans += 1
if flag == 1:
if dum == i-1:
count += 1
flag = 0
else:
flag = 1
dum = i
#div,mod = div... |
p02791 | s514169505 | Accepted | N = int(input())
P = list(map(int, input().split()))
ret = 0
currmin = P[0]
for i in range(N):
if P[i] <= currmin:
currmin = P[i]
ret += 1
print(ret) |
p02873 | s760418827 | Accepted | S = input()
A = [0 for _ in range(len(S) + 1)]
for idx in range(len(S)):
if S[idx] == "<":
A[idx + 1] = max(A[idx + 1], A[idx] + 1)
for idx in reversed(range(len(S))):
if S[idx] == ">":
A[idx] = max(A[idx], A[idx + 1] + 1)
print(sum(A))
|
p03986 | s567719945 | Wrong Answer | x = input()
print(len(x) - min(x[:x.rfind("T")].count("S"), x[x.find("S"):].count("T")) * 2)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.