problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p03524 | s235887191 | Accepted | #!/usr/bin/env python3
s = input()
abc_cnt = [s.count("a"),s.count("b"),s.count("c")]
if max(abc_cnt) - min(abc_cnt) > 1:
print("NO")
else:
print("YES") |
p02823 | s587415110 | Wrong Answer | n, a, b = map(int, input().split())
ans = INF = 1 << 60
# 2で割って余り1ならすれ違わない
if (b - a) % 2 == 0:
ans = (b - a) // 2
# 左で落ち合う
ans = min(ans, b - 1)
# 右で落ち合う
ans = min(ans, n - a)
print(ans) |
p03037 | s681424961 | Wrong Answer | n,m = map(int,input().split())
a = []
lmax = 0
rmin = 10**6
for i in range(m):
a.append(list(map(int,input().split())))
if a[i][0] > lmax:
lmax = a[i][0]
if a[i][1] < rmin:
rmin = a[i][1]
print(1+rmin-lmax) |
p02621 | s072329421 | Accepted | #A_Calc
A = int(input())
#計算
out = int(A + A**2 + A**3)
# 出力
print(out)
|
p03711 | s785721668 | Accepted | l1 = [1,3,5,7,8,10,12]
l2 = [4,6,9,11]
l3 = [2]
a,b = map(int,input().split())
f = False
if a in l1 and b in l1:
f = True
if a in l2 and b in l2:
f = True
print("Yes" if f else "No") |
p03548 | s484700232 | Accepted | X,Y,Z=map(int,input().split())
print((X-Z)//(Y+Z))
|
p02860 | s246806020 | Accepted | N = int(input())
S = list(input())
i = N/2
if N % 2 != 0:
print("No")
exit()
if S[:int(i)] == S[int(i):]:
print("Yes")
else:
print("No") |
p02873 | s951097556 | Accepted | s = input()
a = [0]* (len(s)+1)
for i in range(len(s)):
if s[i] == '<':
a[i+1] = a[i]+1
s = s[::-1]
for i in range(len(s)):
if s[i] == '>':
a[len(s)-i-1] = max(a[len(s)-i-1], a[len(s)-i]+1)
print(sum(a))
|
p03407 | s357789948 | Wrong Answer | a,b,c=map(int,input().split())
if 2*(a+b)>=c:
print("Yes")
else:
print("No") |
p02972 | s295660934 | Accepted | def main():
N = int(input())
A = [int(i) for i in input().split()]
B = [0]*N
for i in range(N)[::-1]:
cur_sum = -B[i]
for j in range(i, N, i+1):
cur_sum += B[j]
if cur_sum % 2 != A[i] % 2:
B[i] = 1
# print(B)
ans = [i+1 for i, b in enumerate(B) if b]
print(len(ans))
if ans:
print(*ans)
if __name__ == '__main__':
main()
|
p03328 | s366242023 | Wrong Answer | a,b=map(int,input().split())
A=[]
for i in range(1,1000):
A.append((i*(i+1))//2)
for i in range(10*6):
if (a+i) in A and (b+i) in A:
print(i)
exit() |
p03076 | s368189959 | Accepted | A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
Menu = [A,B,C,D,E]
ans = 0
mint = 9
maxt = 0
for i in Menu :
ans += (i+9)//10
maxt = max(i%10, maxt)
if i%10 != 0 :
mint = min(i%10, mint)
if maxt == 0 :
ans = ans * 10
else :
ans = ans * 10 - 10 + mint
print(ans)
|
p02641 | s908843230 | Accepted | x,n = map(int, input().split())
p = list(map(int, input().split()))
ans = -1
i = 1
if x not in p:
print(x)
exit()
while ans == -1:
temp = x -i
if temp not in p:
ans = temp
break
temp = x + i
if temp not in p:
ans = temp
break
i += 1
print(ans) |
p03617 | s027736747 | Accepted | import sys
input = sys.stdin.readline
Q, H, S, D = map(int, input().split())
N = int(input()) * 4
res = 0
res += (N // 8) * min(Q * 8, H * 4, S * 2, D)
N %= 8
res += (N // 4) * min(Q * 4, H * 2, S)
N %= 4
res += (N // 2) * min(Q * 2, H * 1)
N %= 2
res += N * Q
print(res) |
p02621 | s592637667 | Wrong Answer | import random
a=random.randint(1,10)
print(str(a+a*a+a*a*a)) |
p03997 | s179028209 | Accepted | a, b, h = [int(input()) for i in range(3)]
print(int((a+b)*h/2)) |
p02647 | s320957995 | Accepted | n,k=map(int,input().split())
a=list(map(int,input().split()))
for _ in range(min(k,41)):
b=[0]*(n+1)
for i in range(n):
l=max(0,i-a[i])
r=min(n,i+a[i]+1)
b[l]+=1
b[r]-=1
for i in range(n-1):
b[i+1]+=b[i]
a=b[:n]
print(*a) |
p02951 | s063486615 | Accepted | a, b, c = map(int, input().split())
print(max(0, b + c - a)) |
p02695 | s006561521 | Accepted | import itertools
n,m,q = map(int,input().split())
num = [list(map(int,input().split())) for i in range(q)]
number = []
for i in range(m):
number.append(i+1)
a = list(itertools.combinations_with_replacement(number,n))
length = len(a)
memo = [0] * length
ans = 0
for i in range(length):#組み合わせの数回す
sum = 0
for j in range(q):
if a[i][num[j][1]-1] - a[i][num[j][0]-1] == num[j][2]:
sum += num[j][3]
ans = max(sum,ans)
print(ans) |
p03699 | s938639844 | Wrong Answer | N = int(input())
S = []
for _ in range(N):
S.append(int(input()))
s = sum(S)
S.sort()
i = 0
while s != 0:
if s % 10 != 0:
break
s -= S[i]
i += 1
if s >= 0:
print(s)
else:
print(0) |
p02690 | s971573546 | Accepted | import numpy as np
def main():
x = int(input())
A = np.arange(-120, 120)
a = A ** 5
for i, a_1 in enumerate(a):
for j, a_2 in enumerate(a):
if a_1 - a_2 == x:
print(A[i], A[j])
return
if __name__ == "__main__":
main()
|
p02572 | s580431937 | Accepted | N = int(input())
A = list(map(int,input().split()))
ans = 0
s = 0
def mod(x):
return int(x % int(1e+9 + 7))
for i in reversed(range(N-1)):
s += A[i+1]
s = mod(s)
ans += A[i] * s
ans = mod(ans)
print(int(ans)) |
p03126 | s094487416 | Accepted | n, m = map(int, input().split())
count = {}
for i in range(1, m + 1):
count[i] = 0
for i in range(n):
a = list(map(int, input().split()))
for j in range(1, len(a)):
count[a[j]] += 1
ans = 0
for k, v in count.items():
if v == n:
ans += 1
print(ans)
|
p02756 | s920653741 | Wrong Answer | s = list(input())
n=int(input())
l = [input().split(" ") for _ in range(n)]
for i in range(n):
if l[i][0]=='1':
s=s[::-1]
elif l[i][0]=='2':
if l[i][1]==1:
s = s+[l[i][2]]
else:
s.append(l[i][2])
print(''.join(s))
|
p02987 | s471835937 | Accepted | s = list(input())
if s[0] == s[1] and s[2] == s[3] and s[0] != s[2]:
print('Yes')
elif s[0] == s[3] and s[1] == s[2] and s[0] != s[1]:
print('Yes')
elif s[0] == s[2] and s[1] == s[3] and s[0] != s[1]:
print('Yes')
else:
print('No') |
p02624 | s054669294 | Wrong Answer | def culcSum(n:int)->int:
return n * culcDivisor(n)
def culcDivisor(n:int)->int:
cnt = 0
for idx in range(1, n+1):
if n % idx == 0:
cnt += 1
return cnt
n :int = int(input())
ans = 0
for idx in range(1, n+1):
ans += culcSum(n)
print(ans)
|
p03150 | s745357280 | Wrong Answer | # from pprint import pprint
# import math
# import collections
# n = int(input())
s = input()
# n, k = map(int, input().split(' '))
# a = list(map(int, input().split(' ')))
K = 'keyence'
if K in s:
splitted = s.split(K)
if len([spl for spl in splitted if len(spl) > 0]) > 1:
print('NO')
else:
print('YES')
else:
print('NO')
|
p02923 | s255466485 | Accepted | N = int(input())
H = list(map(int, input().split()))
ans = []
count = 0
for j in range(N):
if (j == N - 1):
ans.append(count)
count = 0
break
if (H[j] < H[j + 1]):
ans.append(count)
count = 0
continue
elif (H[j] >= H[j + 1]):
count += 1
print(max(ans))
|
p02677 | s059317787 | Wrong Answer | import math
import decimal
a,b,h,m = map(int,input().split())
long = m/60*360
short = h*30+(m/60*30)
kakudo = abs(long-short)
if kakudo > 180:
kakudo -= 180
dum = kakudo/180*3.141592653589793238462643
radi = math.cos(dum)
ans = a**2 + b**2 - (2*a*b*radi)
ans = ans ** (1/2)
print(ans)
|
p02963 | s413805202 | Wrong Answer | n = int(input())
z = 1000000000
if n==z*z:
print(z, 0, z, 0, 0, 0)
elif n > z:
a = n//z
b = n%z
print(a+1, b, 0, z, 1, 0)
else:
print(n, 0, 1, 1, 0, 0) |
p03457 | s321805210 | Wrong Answer | n = int(input())
lst = [list(map(int, input().split())) for _ in range(n)]
ans = 'No'
for line in lst:
t, x, y = line
if t < x + y:
break
if t % 2 == 0 and x + y % 2 != 0:
break
if t % 2 != 0 and x + y % 2 == 0:
break
if t - x - y % 2 == 0:
ans = 'Yes'
print(ans) |
p02687 | s562064905 | Wrong Answer | s = input()
ans = "ABC"
if s == "ABC":
print("ARC")
print(ans)
|
p03645 | s029716988 | Wrong Answer | import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7
def main():
N, M = map(int, readline().split())
path = [[] for _ in range(N+1)]
for _ in range(M):
a,b = map(int, readline().split())
path[a].append(b)
path[b].append(a)
print(path[1])
print(path[N])
if set(path[1])&set(path[N]):
print('POSSIBLE')
else:
print('IMPOSSIBLE')
if __name__ == '__main__':
main() |
p03817 | s897795844 | Accepted | x = int(input())
a = x % 11
if a == 0:
ans = (x // 11) * 2
elif a < 7:
ans = (x // 11) * 2 + 1
else:
ans = (x // 11) * 2 + 2
print(ans) |
p03037 | s904034846 | Accepted | import sys
sys.setrecursionlimit(10**6)
n, m = map(int, input().split())
L = []; R = []
for _ in range(m):
l, r = map(int, input().split())
L.append(l)
R.append(r)
maxL = max(L)
minR = min(R)
ans = max(0, minR-maxL+1)
print(ans) |
p03711 | s715102578 | Wrong Answer | a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
x, y = map(int,input().split())
if a.count(x) == a.count(y) or b.count(x) == b.count(y):
print("Yes")
else:
print("No") |
p02786 | s641173052 | Accepted | from math import log
H = int(input())
print(sum(
2 ** i
for i in range(int(log(H, 2)) + 1)
)) |
p02754 | s369616582 | Accepted | N, A, B = map(int, input().strip().split())
tmp = N // (A+B)
ans = tmp * A
remain = N - (tmp * (A+B))
if (remain >= A) :
ans += A
else:
ans += remain
print(ans) |
p03449 | s427753304 | Wrong Answer | import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
b = np.array(list(map(int, input().split())))
ans = 0
for i in range(n-1):
temp = sum(a[:i+1])+sum(b[i:n])
ans = max(ans, temp)
print(ans) |
p03487 | s871252654 | Accepted | n=int(input())
a=sorted(list(map(int,input().split())))
def groupby():
global a
a2=[[a[0],1]]
for i in range(1,len(a)):
if a2[-1][0]==a[i]:
a2[-1][1]+=1
else:
a2.append([a[i],1])
return a2
b=groupby()
ans=0
for i in b:
if i[0]>i[1]:
ans+=i[1]
else:
ans+=(i[1]-i[0])
print(ans)
|
p03986 | s737186030 | Wrong Answer |
X = input()
N = len(X)
l, r = 0, N
while l < N and X[l] == 'T':
l += 1
while r > 0 and X[r-1] == 'S':
r -= 1
s = X[l:r].count('S')
t = r - l - s
ans = N - min(s, t) * 2
print(ans) |
p02784 | s739671161 | Wrong Answer | H , N = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
twice = False
if len(A) <= N:
while(H>0):
H = H - N
print(A)
for i in A:
if H == i:
twice = True
if twice == True:
print("Yes")
else:
print("No")
|
p03795 | s870444628 | Wrong Answer | n = int(input())
a = n % 15
my_result = n * 800 - (n - a) / 15
print(int(my_result)) |
p03351 | s120270818 | Accepted | a,b,c,d=input().split()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
if abs(a-c)<=d:
print("Yes")
elif abs(a-b)<=d and abs(b-c)<=d:
print("Yes")
else:
print("No") |
p03761 | s478942398 | Accepted | import collections
n = int(input())
s = [input() for i in range(n)]
c_1 = collections.Counter(s[0])
for i in range(1,len(s)):
tmp = {}
c_2 = collections.Counter(s[i])
for k in c_1:
tmp[k] = min(c_1[k],c_2[k])
c_1 = tmp
result = ""
for i in c_1:
for j in range(c_1[i]):
result += i
print("".join(sorted(result))) |
p03971 | s242211010 | Accepted | n,a,b = map(int,input().split())
s = input()
i,f = 0,0
for x in s:
ok = False
if x=='a':
if i+f<a+b:
ok = True
i+=1
elif x=='b':
if f<b and i+f<a+b:
ok = True
f += 1
print('Yes' if ok else 'No') |
p03673 | s148749984 | Accepted | n = int(input())
nums = [i for i in input().split()]
ans = nums[1::2][::-1] + nums[::2]
if n == 1:
print(''.join(nums))
elif n % 2 != 0:
print(' '.join(ans[::-1]))
else:
print(' '.join(ans))
|
p02602 | s623279987 | Wrong Answer | n,k = map(int,input().split())
a = list(map(int,input().split()))
prev=1
start = a[0:k]
for i in start:
prev *= i
ans = []
for i in range(k+1,n+1):
tmp = a[i-k:i]
res = 1
for i in tmp:
res *= i
if prev >= res:
ans.append('No')
else:
ans.append('Yes')
prev = res
print('\n'.join(ans)) |
p02730 | s099138696 | Wrong Answer | def kaibun(x):
for i in range(int(len(x)/2)):
if(x[i] != x[(-1) - i]):
return 0
return 1
def main():
s = input()
s_num = len(s)
num1 = kaibun(s[:int((s_num - 1)/2)])
num2 = kaibun(s[int((s_num + 3)/2 - 1):s_num])
if(num1 == 1 and num2 == 1):
print('Yes')
else:
print('No')
if __name__ == '__main__':
main()
|
p02789 | s147245628 | Accepted | import sys
I = list(map(int, input().split()))
N = I[0]
M = I[1]
if not 1 <= N or not N <= 100:
print("error")
sys.exit()
if not 0 <= M or not M <= N:
print("error")
sys.exit()
if N == M:
print("Yes")
else:
print("No")
|
p02664 | s385389246 | Accepted | N = list(input())
for i,a in enumerate(N):
if a == "?":
N[i] = "D"
print(''.join(N[0:len(N)]))
|
p02882 | s736153152 | Accepted | import math
a,b,x=map(int,input().split())
def f(a,b,deg):
theta=math.radians(deg)
if b*math.tan(math.pi/2-theta)<=a:
return b*b*math.tan(math.pi/2-theta)*a/2
else:
return a*a*b-a*a*math.tan(theta)*a/2
l=0
r=90
while r-l>=10**-6:
mid=(l+r)/2
#print(mid,f(a,b,mid))
if x-10**-6<=f(a,b,mid)<=x+10**-6:
print(mid)
exit(0)
if f(a,b,mid)>x:
l=mid
else:
r=mid
print(l)
|
p03210 | s148754255 | Accepted | def resolve():
N = int(input())
print("YES" if N in [7, 5, 3] else "NO")
if '__main__' == __name__:
resolve() |
p03001 | s224378159 | Wrong Answer | w, h, x, y = map(float, input().split())
if x in [0, w] or y in [0, h]:
print(max(min(x*h, (w-x)*h), min(y*w, (h-y)*w)), 0)
elif x/y == w/h:
print(max(min(x*h, (w-x)*h), min(y*w, (h-y)*w)), 1)
elif x/(h-y) == w/h:
print(max(min(x*h, (w-x)*h), min(y*w, (h-y)*w)), 1)
else:
print(max(min(x*h, (w-x)*h), min(y*w, (h-y)*w)), 0) |
p02747 | s228829781 | Wrong Answer | S = input()
def main(S):
for i, s in enumerate(S):
if i % 2 == 0:
if s == 'h': continue
else : return "No"
else:
if s == 'i': continue
else : return "No"
else: return "Yes"
if __name__ == "__main__":
answer = main(S)
print(answer)
|
p02631 | s941183383 | Accepted | n = int(input())
a = [int(i) for i in input().split()]
x = 0
for i in a:
x ^= i
a = map(lambda i:x^i, a)
for i in a:
print(i, end = " ")
print()
|
p03407 | s493305436 | Accepted | A, B, C = map(int, input().split())
if A + B >= C:
print('Yes')
else:
print('No') |
p03210 | s000829350 | Wrong Answer | X = int(input())
print('YES' if X in [3, 5, 7] else 'No') |
p03449 | s803209799 | Wrong Answer | N = int(input())
A = [[int(i) for i in input().split()] for j in range(2)]
count = 0
Max = 0
for i in range(N):
for j in range(i+1):
count += A[0][j]
for j in range(N-i):
count += A[1][i+j]
Max = max(Max, count)
print(Max)
|
p03644 | s851357445 | Accepted | n = int(input())
count = 0
for i in range (10):
if 2**i <= n:
count = 2**i
print(count) |
p02952 | s352482484 | Accepted | N = int(input())
ans = 0
if len(str(N)) % 2 != 0:
sub = 10 ** (len(str(N))) - N - 1
for i in range(len(str(N)), 0, -2):
ans += 10 ** i - 10 ** (i-1)
ans -= sub
print(ans)
else:
digits = len(str(N)) - 1
for i in range(digits, 0, -2):
ans += 10 ** i - 10 ** (i-1)
print(ans)
|
p02888 | s434336747 | Accepted | n=int(input())
l=list(map(int,input().split()))
l.sort(reverse=True)
ans=0
for i in range(0,n-2):
for j in range(i+1,n-1):
left = j
right = n
while right-left>1:
mid = (left + right)//2
if l[i]+l[j]>l[mid] and l[i]+l[mid]>l[j] and l[mid]+l[j]>l[i]:
left = mid
else:
right = mid
#print(i,j,left)
ans+=(left-j)
print(ans) |
p02615 | s858825352 | Accepted | from sys import stdin
N = int(input())
A = [int(x) for x in stdin.readline().rstrip().split()]
A.sort(reverse=True)
ans = A[0]
cnt = 2
for i in range(1,N):
ans += (A[i]*2)
cnt += 2
if cnt >= N:
if cnt > N:
ans -= A[i]
break
if N == 2:
ans = max(A)
print(ans) |
p02612 | s845774709 | Accepted | N = int(input())
print((10000-N)%1000)
|
p02731 | s032215418 | Accepted | l = int(input())
print((l/3)**3) |
p03000 | s845694566 | Wrong Answer | def main():
N, X = map(int, input().split())
L = list(map(int, input().split()))
D = 0
for cnt in range(2, N + 1):
D += L[cnt - 1]
if D > X:
cnt -= 1
break
print(cnt)
if __name__ == "__main__":
main()
|
p03103 | s860901235 | Accepted | n,m = map(int,input().split())
energy = sorted([tuple(map(int,input().split())) for _ in range(n)])
ret = 0
ind = 0
while(m):
a,b = energy[ind]
if b > m:
ret += a * m
m = 0
else:
ret += a * b
m -= b
ind += 1
print(ret) |
p03371 | s386334831 | Accepted | a, b, c, x, y = map(int, input().split())
A = a * x + b * y
if x <= y: B = c * x * 2 + b * (y-x)
else: B = c * y * 2 + a * (x-y)
C = c * max(x, y) * 2
print(min(A, B, C)) |
p02842 | s131555216 | Accepted | import math
def main():
n = int(input())
tax = 1.08
ans = math.ceil(n / tax)
ans_check = ans * tax
if math.floor(ans * tax) == n:
print(ans)
else:
print(":(")
if __name__ == "__main__":
main() |
p03804 | s144244290 | Accepted | n,m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
for i in range(n-m+1):
for j in range(n-m+1):
tnp = 0
for k in range(m):
for l in range(m):
if (a[i+k][j+l]!=b[k][l]):
tnp += 1
if (tnp==0):
print("Yes")
exit()
print("No") |
p02697 | s863054463 | Wrong Answer | from sys import stdin
N, M = [int(x) for x in stdin.readline().rstrip().split()]
if N % 2 == 1:
for i in range(M):
print(i + 1, 2 * M - i)
else:
print(1, 2 * M + 1)
for i in range(1, M):
print(i + 1, 2 * M - i)
|
p03210 | s566554727 | Wrong Answer | a=input()
a=int(a)
if a==3 or 5 or 7:
print("YES")
else:
print("NO") |
p02993 | s345996952 | Accepted | s = input()
for i in range(len(s)-1):
if s[i] == s[i+1]:
print("Bad")
exit()
print("Good") |
p02712 | s648995137 | Accepted | n=int(input())
res=0
F=0
for i in range(1,n+1):
if i%3==0 or i%5==0:
F+=i
else:
res+=i
print(res) |
p03371 | s729937770 | Accepted | # -*- coding: utf-8 -*-
def main():
A, B, C, X, Y = map(int, input().split())
if A + B <= 2 * C:
ans = (A * X + B * Y)
else:
if X <= Y:
ans = min(2 * C * X + B * (Y - X), 2 * C * Y)
else:
ans = min(2 * C * Y + A * (X - Y), 2 * C * X)
print(ans)
if __name__ == "__main__":
main() |
p03408 | s847683809 | Accepted | n = int(input())
s=[input() for _ in range(n)]
m = int(input())
t=[input() for _ in range(m)]
from collections import defaultdict
d=defaultdict(int)
for plus_word in s:
d[plus_word]+=1
for minus_word in t:
d[minus_word]-=1
print(max(max(d.values()), 0)) |
p02607 | s384166717 | Accepted | n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(n):
if ((i+1) * a[i]) % 2 != 0:
ans += 1
print(ans) |
p02576 | s081687220 | Wrong Answer | N, X, T = map(int, input().split())
time = (N // X + 1) * T
print(time) |
p03759 | s085375870 | Wrong Answer | a,b,c=map(int,input().split())
if (b-c)==(c-b):
print('YES')
else:
print('NO') |
p03761 | s312814907 | Accepted | MAX_N = 50
n = int(input())
C = [[0] * 26 for _ in range(n)]
for i in range(n):
S = input()
for s in S:
C[i][ord(s) - ord('a')] += 1
res = ''
for i in range(26):
t = MAX_N + 1
for j in range(n):
t = min(t, C[j][i])
res += chr(i + ord('a')) * t
print(res)
|
p03073 | s223869058 | Accepted | S = input()
b = 1
B = 0
for i in S:
if int(i) != int(b):
B += 1
b = not b
l = len(S)
print(min(B, l - B)) |
p03679 | s360382024 | Accepted | x,a,b=map(int,input().split())
if (b-a) <= 0:
print('delicious')
elif (b-a) <= x:
print('safe')
else:
print('dangerous') |
p02813 | s973176912 | Accepted | import itertools
N = int(input())
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
ite = [x for x in range(1, N + 1)]
ite = itertools.permutations(ite)
a = 0
b = 0
s = 1
for i in ite:
if i == p:
a = s
if i == q:
b = s
s += 1
if a > b:
total = a - b
else:
total = b - a
print(total) |
p03721 | s074498458 | Wrong Answer | input_lines = list(map(int, input().split()))
tmp_list = []
for i in range(input_lines[0]):
num_list = list(map(int, input().split()))
appended_num = num_list[0]
#tmp_list.append(appended_num)
tmp_list.extend([appended_num for i in range(num_list[1])])
index = len(tmp_list) - len(list(set(tmp_list)))
new_tmp_list = sorted(tmp_list)
print(new_tmp_list[index - input_lines[1]])
|
p02694 | s934832702 | Accepted | x=int(input())
ans=0
now=100
while now<x:
now*=1.01
now=int(now)
ans+=1
print(ans) |
p03478 | s241620964 | Wrong Answer | N, A, B = map(int,input().split())
su =0
for i in range(1,N+1):
si = str(i)
c = 0
for s in si:
c += int(s)
if A <= c <= B:
su += c
print(su)
|
p03435 | s694555278 | Accepted | grid = [list(map(int, input().split())) for _ in range(3)]
B = [x for x in grid[0]]
b = B[0]
A = [grid[i][0] - b for i in range(3)]
res = True
for i, a in enumerate(A):
for j, b in enumerate(B):
if grid[i][j] != a + b:
res = False
break
else:
continue
break
print('Yes' if res else 'No')
|
p02742 | s379667817 | Accepted | # coding: utf-8
from math import ceil
H, W = map(int, input().split())
if H == 1 or W == 1:
print(1)
else:
print(ceil(H * W / 2)) |
p02706 | s106194519 | Accepted | n,m=map(int,input().split())
a=list(map(int,input().split()))
ans=n-sum(a)
if ans >=0:
print(ans)
else:
print(-1) |
p02756 | s986200240 | Accepted | from collections import deque
s = input()
Q = int(input())
dq = deque(list(s))
reversed_state = False
for q in range(Q):
query = input().split()
if len(query) == 1:
reversed_state = not reversed_state
else:
T,F,c = list(query)
if F == '1':
if reversed_state == False:
dq.appendleft(c)
else:
dq.append(c)
else:
if reversed_state == False:
dq.append(c)
else:
dq.appendleft(c)
print(''.join(dq)) if reversed_state == False else print(''.join(list(dq)[::-1])) |
p02987 | s139692821 | Wrong Answer | s=input()
s=sorted(s)
if s[0]==s[1] and s[2]==s[3]:
print("Yes")
else:
print("No") |
p02732 | s249084131 | Wrong Answer | n=int(input())
a=[int(s) for s in input().split()]
for i in range(0,n):
print(a.count(a[i])-1) |
p03623 | s759867866 | Accepted | x, a, b = map(int, input().split())
xa = abs(x - a)
xb = abs(x - b)
if xa < xb:
print('A')
else:
print('B')
|
p03001 | s258710528 | Accepted | w,h,x,y = map(int,input().split())
xx = w-x
yy = h-y
if x == xx and y == yy:
a = 1
else:
a = 0
print(w*h/2,a) |
p03105 | s989073624 | Accepted | a,b,c=list(map(int,input().split()))
print(min(b//a,c)) |
p03838 | s467854153 | Wrong Answer | x, y = map(int, input().split())
res =0
if x == y:
res = 0
elif x==-y:
res = 1
elif x >= 0 and y >= 0:
if x > y:
res = abs(x-y) + 2
if x < y:
res = abs(x-y)
elif x < 0 and y < 0:
if x > y:
res = abs(x-y) + 2
if x < y:
res = abs(x-y)
elif x < 0 and y >=0:
a1 = abs(x) + abs(y)
rx, ry = -x, -y
res= min(abs(rx-y), abs(ry- x), abs(x + y))
print(res)
|
p02910 | s716005403 | Accepted | S=list(input())
for i in range(len(S)):
#奇数処理
if i%2==0:
if S[i]=="L":
print("No")
exit()
#偶数処理
if i%2==1:
if S[i]=="R":
print("No")
exit()
print("Yes") |
p02988 | s378673072 | Accepted | n = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(1,n-1):
if max(p[i-1],p[i],p[i+1]) != p[i] and min(p[i-1],p[i],p[i+1]) != p[i]:
count += 1
print(count) |
p02600 | s753369806 | Accepted | (N, ) = [int(n) for n in input().split()]
print(10 - N // 200)
|
p03351 | s480225070 | Accepted | a,b,c,d = map(int, input().split())
if abs(a-c)<=d:print('Yes')
elif abs(a-b)<=d and abs(b-c)<=d: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.