problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p03679 | s232849286 | Wrong Answer | X,a,b=map(int,input().split())
if a+X>=b:
print("delicious")
else:
print("dangerous")
|
p03624 | s919393274 | Accepted | s = input()
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"]
for i in range(len(s)) :
if s[i] in alpha :
alpha.remove(s[i])
if alpha :
print(alpha[0])
else :
print("None")
|
p02909 | s310451942 | Accepted | S = input()
if S == "Sunny":
print("Cloudy")
elif S == "Cloudy":
print("Rainy")
else:
print("Sunny")
|
p03041 | s444108996 | Wrong Answer | n,k = map(int,input().split())
s = list(input())
for i in range(n):
temp = str(s[i])
print(type(temp))
if i == k - 1:
s[i] = temp.lower()
S = ''.join(s)
print(S) |
p02833 | s197900211 | Accepted | N = int(input())
if N % 2 == 1:
print(0)
exit()
ans = 0
N //= 2
i = 1
while N >= 5 ** i:
ans += (N // 5 ** i)
i += 1
print(ans)
|
p03854 | s722247596 | Accepted | S = input()
S_ = (S
.replace('eraser', '')
.replace('erase', '')
.replace('dreamer', '')
.replace('dream', '')
)
if S_ == '':
print('YES')
else:
print('NO') |
p03457 | s022550555 | Wrong Answer | N = int(input())
a=[0]*(N+1)
a[0]=[0,0,0]
for i in range(1,N+1):
a[i]=[int(j) for j in input().split()]
flag = True
for i in range(N):
distance = abs(a[i][1]-a[i+1][1]) + abs(a[i][2]-a[i+1][2])
del_t = a[i+1][0]-a[i][0]
if del_t - distance < 0 or (del_t - distance)%2 != 0:
flag = False
if flag:
print("Yes")
else:
print("NO")
|
p02702 | s621118375 | Accepted | S = list(input())
N = len(S)
num = 0
cnt = [0]*2019
cnt[0] = 1
d = 1
#T[i]: i+1文字目以降を数とみなしたときの数
for i in range(N-1, -1, -1):
num += int(S[i]) * d
num %= 2019
# num = (num + int(S[i]) * 10 ** (N- i -1)) % 2019
cnt[num] += 1
d *= 10
d %= 2019
ans = 0
for c in cnt:
ans += c * (c-1) // 2
print(ans) |
p03380 | s140826913 | Wrong Answer | n=int(input())
a=[0]+sorted(list(map(int,input().split())))
x=a[-1]
m=a[-1]
for i in a:
if m>abs(i-x/2):y=i
print(x,y) |
p03252 | s308883483 | Accepted | from collections import defaultdict
S = tuple(input())
T = tuple(input())
# S->T と T->S の変換表
s_to_t = defaultdict(set)
t_to_s = defaultdict(set)
for s,t in zip(S,T):
s_to_t[s].add(t)
t_to_s[t].add(s)
# 1対1対応しているか
flag = True
for v in s_to_t.values():
if len(v) > 1:
flag = False
for v in t_to_s.values():
if len(v) > 1:
flag = False
# print
if flag:
print("Yes")
else:
print("No") |
p03106 | s464397771 | Wrong Answer | import sys
a,b,k = map(int,input().split())
tmp=0
ind=1
while True:
if a%ind==0 and b%ind==0:
tmp+=1
if tmp==k:
print(ind)
sys.exit()
ind+=1
|
p03545 | s702716488 | Accepted | from itertools import product
a,b,c,d=map(int,input())
for op1,op2,op3 in product((1,-1),repeat=3):
if a+op1*b+op2*c+op3*d==7:
x='+'if op1==1else'-'
y='+'if op2==1else'-'
z='+'if op3==1else'-'
print('{}{}{}{}{}{}{}=7'.format(a,x,b,y,c,z,d))
exit()
|
p02790 | s459013359 | Accepted | a,b = map(int,input().split())
c = min(a,b)
d = max(a,b)
print(str(c)*d) |
p03416 | s589273836 | Wrong Answer | a,b = map(int,input().split())
cnt = 0
for i in range(a,b):
if str(i) == str(i)[::-1]:
cnt+=1
print(cnt) |
p02994 | s145224109 | Accepted | import math
N, L = map(int, input().split())
sum = 0
minimum = 99999
for i in range(1,N+1):
aji = L + i - 1
sum += aji
if (math.fabs(minimum) > math.fabs(aji)):
minimum = aji
print(sum - minimum) |
p02688 | s203669503 | Accepted | n,k=map(int,input().split())
n=[i+1 for i in range(n)]
for i in range(k):
d=int(input())
a=list(map(int,input().split()))
for j in a:
if j in n:
n.remove(j)
print(len(n)) |
p02796 | s513847403 | Wrong Answer | def solve(XL, N):
XL.sort(key=lambda x:x[0])
count = N
for i in range(1, N):
if XL[i][0] < XL[i-1][1]:
XL[i][1] = XL[i-1][1]
count -= 1
return count
N = int(input())
XL = []
for i in range(N):
x, l = map(int, input().split(' '))
XL.append([x-l, x+l])
print(solve(XL, N)) |
p02765 | s117136874 | Accepted | N,R=map(int,input().split())
if N < 10:
print(R+(100*(10-N)))
else:
print(R) |
p03555 | s906733229 | Accepted | A=input()
B=input()
X="NO"
if A[0]==B[2] and A[1]==B[1] and A[2]==B[0]:
X="YES"
print(X) |
p03773 | s296100820 | Accepted | A, B = map(int, input().split())
print((A+B) % 24)
|
p02600 | s830038417 | Wrong Answer | x=int(input())
if x>=400 and x<=599:
print(8)
elif x>=600 and x<=799:
print(7)
elif x>=800 and x<=999:
print(6)
elif x>=1000 and x<=1199:
print(5)
elif x>=1200 and x<=1399:
print(4)
elif x>=1300 and x<=1499:
print(3)
elif x>=1500 and x<=1699:
print(2)
elif x>=1600 and x<=1799:
print(1) |
p03137 | s218625345 | Wrong Answer | N, M = map(int, input().split())
X = sorted(list(map(int, input().split())))
Y = []
for i in range(M-1):
Y.append(X[i+1] - X[i])
Y.sort()
print(sum(Y[:-N+1])) |
p04031 | s789532087 | Wrong Answer | N = int(input())
lst = list(map(int, input().split()))
avg = round(sum(lst), N)
result = 0
for i in lst:
result += (i - avg)**2
print(result)
|
p02873 | s010818487 | Wrong Answer | S = input()
n = len(S) + 1
num = [0] * n
for i in range(n-1):
if S[i] == '<':
num[i + 1] = max(num[i] + 1, num[i + 1])
for i in range(n-2, 0, -1):
if S[i] == '>':
num[i] = max(num[i + 1] + 1, num[i])
print(sum(num))
|
p03971 | s100138830 | Accepted | N, A, B = map(int, input().split())
S = input()
passed = 0
foreigner = 0
for s in S:
if s == "c":
print("No")
elif s == "a":
if passed < A + B:
print("Yes")
passed += 1
else:
print("No")
elif s == "b":
if passed < A + B and foreigner < B:
print("Yes")
passed += 1
foreigner += 1
else:
print("No") |
p03208 | s663316579 | Wrong Answer | n,k=map(int,input().split())
h=sorted([int(input()) for _ in range(n)])
ans=10**9
for i in range(n-k):
ans=min(h[k+i]-h[i],ans)
print(ans) |
p03548 | s136126260 | Accepted |
x,y,z = map(int, raw_input().split())
cumul = x / (y + z)
x %= y + z
if x < z:
cumul -=1
print max(cumul,0) |
p02697 | s340852844 | Wrong Answer | N,M= list(map(int , input().split()))
for i in range (M):
n = i+1
print (n,N-n)
|
p03061 | s492503682 | Accepted | #abc125 c
n=int(input())
a=list(map(int,input().split()))
def gcd(a,b):
if b==0:
return a
return gcd(b,a%b)
fl_gcd=[0]*(n+1)
fr_gcd=[0]*(n+1)
for i in range(n):
fl_gcd[i+1]=gcd(fl_gcd[i],a[i])
fr_gcd[n-i-1]=gcd(fr_gcd[n-i],a[n-1-i])
#print(fr_gcd)
#print(fl_gcd)
ans=0
for i in range(n):
lr_gcd=gcd(fl_gcd[i],fr_gcd[i+1])
ans=max(ans,lr_gcd)
print(ans) |
p02582 | s461859734 | Accepted | W = input()
if 'RRR' in W:
print(3)
elif 'RR' in W:
print(2)
elif 'R' in W:
print(1)
else:
print(0)
|
p03474 | s709785848 | Wrong Answer | a, b = map(int, input().split())
s = input()
flag = 0
if s[a] == "-":
if s[a:].isdecimal() and s[a+1:].isdecimal():
flag = 1
else:
flag = 0
if flag:
print("Yes")
else:
print("No") |
p02582 | s805795826 | Wrong Answer | a=input()
b=0
count=0
for i in range(0,len(a)-1):
if a[i]=='R' and a[i+1]=='R':
count+=1
if a[i]=='R' and a[i+1]!='R':
count+=1
b=max(b,count)
count=0
print(b)
|
p02578 | s135212439 | Wrong Answer | N = int(input())
pre = 0
ans = 0
for a in input().split():
a = int(a)
ans += max(a-pre, 0)
pre = max(pre, a)
print(ans) |
p02546 | s941291483 | Accepted | s = input()
if s[-1] == 's':
print(s + 'es')
else:
print(s + 's') |
p02577 | s424328641 | Wrong Answer | N = list(input())
if len(N) < 2:
if int(N[0]) == 9:
print('Yes')
else:
print('No')
elif len(N) >= 2:
l = [int(n) for n in N]
a = sum(l)
if a % 9 == 0:
print('Yes')
else:
print('No') |
p02730 | s382682555 | Accepted | S = input()
N = len(S)
# [0:N//2] == [(N+1)//2:N]
A = int(N//2)
B = int((N+1)//2)
flag = True
if S[0:A] == S[B:N][::-1]:
N = A
A = int(N // 2)
B = int((N + 1) // 2)
if S[0:A] == S[B:N][::-1]:
print("Yes")
flag = False
if flag:
print("No")
|
p03657 | s725024955 | Accepted | a,b=map(int,input().split())
if a%3 == 0:
print("Possible")
elif b%3 == 0:
print("Possible")
elif (a+b)%3 == 0:
print("Possible")
else:
print("Impossible") |
p03779 | s635334258 | Accepted | x = int(input())
for i in range(1,10**5):
a = int(i*(i+1)/2)
if x<=a:
print(i)
exit()
|
p03943 | s284595744 | Accepted | L=list(map(int,input().split()))
L.sort()
if L[0]+L[1]==L[2]:
print('Yes')
else:
print('No') |
p02719 | s386714646 | Accepted | N, K = map(int, input().split())
print(min(N % K, K - N % K)) |
p02665 | s217440296 | Accepted | n = int(input())
a = list(map(int, input().split()))
s = sum(a)
k = 1-a[0]
s -= a[0]
ans = 1
for i in range(1,n+1):
if k*2 <= s:
k *= 2
else:
k = s
ans += k
k -= a[i]
s -= a[i]
if k == 0 and s == 0:
print(ans)
else:
print(-1) |
p03456 | s863141539 | Accepted | # coding: utf-8
# Your code here!
a, b = map(int,input().split())
s = int(str(a)+str(b))
if s ** 0.5 == int(s ** 0.5):
print('Yes')
else:
print('No') |
p02645 | s060231695 | Wrong Answer | S=input()
print("S"[:3])
|
p02766 | s727364691 | Accepted | import sys
n,k = map(int,input().split())
if n == 1:
print(1)
sys.exit()
i = 0
num = 1
while True:
if n < num:
break
num *= k
i += 1
print(i)
|
p02701 | s720857617 | Wrong Answer | n = int(input())
counter = 0
s = "TEMP"
list = []
while n > 0:
s = input()
list.append(s)
counter = 0
for item in list:
if item == s:
counter = counter - 1
counter = counter + 1
n = n - 1
print(counter) |
p02963 | s193696332 | Accepted | S = int(input())
# X1 = X1 = 0
# S = X2 * Y3 - X3 * Y2
# X2 = 10^9, X3 = 1
# S = 10^9 * Y3 - Y2
Y3 = (S + 10**9 - 1) // 10**9
Y2 = 10**9 * Y3 - S
print(0, 0, 10**9, Y2, 1, Y3) |
p03472 | s554409695 | Accepted | import math
n, h = map(int, input().split())
a = [0] * n
b = [0] * n
for i in range(n):
a[i], b[i] = map(int, input().split())
m = max(a)
b.sort(reverse=True)
ans = 0
for i in range(n):
if m <= b[i]:
h -= b[i]
ans += 1
if h <= 0:
print(ans)
exit()
ans += math.ceil(h / m)
print(ans)
|
p03910 | s015351832 | Wrong Answer | n=int(input())
num=[i*(i+1)//2 for i in range(4500)]
ans=""
while n>0:
for i in range(4500):
if num[i]==n:
ans+=str(i)
n-=i
break
elif i>1 and num[i]>n and num[i-1]:
ans+=str(i)
n-=i
break
for i in range(len(ans)):
print(ans[len(ans)-1-i]) |
p02989 | s210509594 | Accepted | N=int(input())
List=list(map(int, input().split()))
List=sorted(List)
print(List[int(N/2)]-List[int((N/2)-1)]) |
p03067 | s118715241 | Accepted | a,b,c=map(int,input().split())
if a>c>b or a<c<b:
print('Yes')
else:
print('No') |
p03250 | s799438183 | Wrong Answer | l = list(map(int,input().split()))
l.sort(reverse = 1)
print(l)
print(l[0]*10 +l[1] + l[2]) |
p03639 | s536320946 | Accepted | n = int(input())
A = list(map(int, input().split()))
num_4 = 0
num_2 = 0
num_odd = 0
for i in A:
if i % 4 == 0:
num_4 += 1
elif i % 2 == 0:
num_2 += 1
num_odd = n - num_2 - num_4
if n - num_4*2 == num_2 or n - num_4 * 2 == 1 or num_2 > n//2 or num_4 + 1 > n//2:
print("Yes")
else:
print("No") |
p04034 | s065983100 | Wrong Answer | from collections import defaultdict
n, m = map(int, input().split())
r = set()
r.add(1)
d = defaultdict(int)
for i in range(m):
x, y = map(int, input().split())
d[x] -= 1
d[y] += 1
if x in r:
r.add(y)
ans = len(list(r))
for e in d:
if d[e] == -1 and e in r:
ans -= 1
print(ans) |
p02748 | s755741191 | Accepted | A, B, M = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = min(A) + min(B)
for _ in range(M):
x, y, c = map(int, input().split())
x -= 1
y -= 1
ans = min(ans, A[x]+B[y]-c)
print(ans)
|
p02624 | s941477368 | Accepted | def main():
n = int(input())
cnt = [1] * (n + 1)
for i in range(2, n + 1):
cnt[i] += 1
for j in range(i * 2, n + 1, i):
cnt[j] += 1
#print(cnt)
res = 0
for i in range(1, n + 1):
res += i * cnt[i]
print(res)
if __name__ == '__main__':
main() |
p03721 | s213868175 | Accepted | n, k = map(int, input().split())
nums = []
for _ in range(n):
ab = list(map(int, input().split()))
nums.append(ab)
sn = sorted(nums)
i = 0
while k > 0:
if sn[i][1] < k:
k -= sn[i][1]
else:
print(sn[i][0])
break
i += 1
|
p02973 | s337547501 | Accepted | from bisect import bisect_right
N, *A = map(int, open(0).read().split())
x = [1] * (N + 1)
for i in range(N):
j = bisect_right(x, -A[i])
x[j] = -A[i]
print(sum(v != 1 for v in x))
|
p02947 | s435504433 | Accepted | n = int(input())
l = []
ans = 0
for i in range(n):
s = "".join(sorted(list(input())))
l.append(s)
l.sort()
cnt = 1
for i in range(1, n):
if l[i] != l[i-1]:
ans += cnt*(cnt-1)//2
cnt = 1
else:
cnt += 1
ans += cnt*(cnt-1)//2
print(ans) |
p03617 | s351392856 | Accepted | Q, H, S, D = map(int, input().split())
N = int(input())
kouho = []
mv = int(1e9)
if N % 2 == 0:
for i, j in zip([Q, H, S, D], [0.25, 0.5, 1, 2]):
kouho.append(int((N // j)*i))
else:
for i, j in zip([Q, H, S, D], [0.25, 0.5, 1, 2]):
kouho.append(int((N // j)*i))
for i, j in zip([Q, H, S], [0.25, 0.5, 1]):
mv = int(min(i // j, mv))
kouho[-1] += mv
print(min(kouho))
|
p03672 | s389985800 | Accepted | def oddmoji(x):
lx=int(len(x)/2)
if x[:lx]==x[lx:]:
return True
else:
return False
s=input()
ls=len(s)
for i in range(ls-2, 0, -2):
if oddmoji(s[:i]):
print(i)
break |
p03448 | s652444328 | Accepted | a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for i in range(a+1):
for j in range(b+1):
for k in range(c+1):
if i*500 + j*100 + k*50 == x:
count+=1
print(count) |
p02725 | s718274050 | Accepted | K, N = map(int, input().split())
house = list(map(int,input().split()))
min = house[N - 1] - house[0]
for i in range(N - 1):
if K - (house[i + 1] - house[i]) < min:
min = K - (house[i + 1] - house[i])
print(min) |
p02612 | s706871604 | Accepted | N= int(input())
S=N%1000
if S !=0:
print(abs(S-1000))
else:
print(0) |
p02754 | s774655480 | Accepted | # -*- coding: utf-8 -*-
# スペース区切りの文字列の入力
st = input().split()
#商
div = int(st[0]) // (int(st[1]) + int(st[2]))
#余り
rem = int(st[0]) % (int(st[1]) + int(st[2]))
if(rem < int(st[1])):
print(div * int(st[1]) + rem)
else:
print(div * int(st[1]) + int(st[1]))
|
p02630 | s777594153 | Wrong Answer | import sys
readline = sys.stdin.readline
N = int(readline())
A = list(map(int, readline().split()))
x = [0] * (10**5+5)
for a in A:
x[a] += 1
s = sum(A)
Q = int(readline())
for _ in range(Q):
b, c = map(int, readline().split())
s += (c - b) * x[b]
print(s)
x[c] += x[b]
|
p02681 | s253381914 | Accepted | s = input()
t = input()
if len(t) == len(s) + 1:
if s == t[:len(t) - 1]:
print("Yes")
else:
print("No")
else:
print("No") |
p02854 | s688317258 | Wrong Answer | n = int(input())
l = list(map(int,input().split()))
from itertools import accumulate
cum = list(accumulate(l))
if cum[-1]%2==0 and cum[-1]//2 in cum:
print(0)
exit()
mid = -(-cum[-1]//2)
i=0
while True:
if cum[i] >= mid:
x = i
break
else: i+=1
j=0
while True:
if (cum[x]-j)*2 == cum[-1]-j:
print(j)
break
else: j+=1
|
p03407 | s526691193 | Accepted | #cotest_temp
#n = int(input())
a,b,c = map(int,input().split())
#lst1 = list(map(int,input().split()))
if a + b >= c:
print("Yes")
else:
print("No") |
p03274 | s771982176 | Accepted | # 連続するK本のろうそくに火をつけるので、最小となる組を全探索する
N, K = map(int, input().split())
X = list(map(int, input().split()))
ans = float("INF")
for i in range(N - K + 1):
lr = abs(X[i]) + abs(X[i] - X[i + K - 1])
rl = abs(X[i + K - 1]) + abs(X[i + K - 1] - X[i])
ans = min(ans, min([lr, rl]))
print(ans) |
p02697 | s183393059 | Accepted | N,M = map(int,input().split())
if N%2:
for i in range(M):
print(i+1, M*2-i)
else:
b = M//2
a = M - b
for i in range(a):
print(i+1, a*2-i)
for i in range(b):
print(a*2+1+i, M*2+1-i) |
p03815 | s289128186 | Accepted | x=int(input())
count=0
t=x//11
k=x-(t*11)
if k==0:
count+=2*t
elif 1<=k<=6:
count+=2*t+1
else:
count+=2*t+2
print(count) |
p02598 | s446886738 | Accepted | N, K = map(int, input().split())
A=list(map(int,input().split()))
A.sort()
right = A[-1]+1
left = 0
flag = True
mid = (left+right)//2
minN = right
result = mid
while right-left>1 and flag:
mid = (left+right)//2
count = 0
for i in A:
count += (i-1)//mid
if count <= K:
right = mid
if minN>mid:
minN = mid
result = mid
elif count > K:
left = mid
print(result)
|
p02973 | s060459337 | Accepted | import bisect
from collections import deque
N=int(input())
que=deque([-1])
for i in range(N):
a=int(input())
if que[0]<a:
i=bisect.bisect_left(que, a)
que[i-1]=a
else:
que.appendleft(a)
print(len(que))
#print(que) |
p02939 | s049249739 | Accepted | def main():
S = input()
cnt = 0
before, current = '', ''
for i, c in enumerate(S):
current += c
if current != before:
before = current
current = ''
cnt += 1
print(cnt)
if __name__ == '__main__':
main() |
p03471 | s475780170 | Accepted | n, money = map(int, input().split())
ans = [-1, -1, -1]
flag = False
money = money // 1000
for i_1 in range(n+1):
for j_5 in range(n - i_1 + 1):
if (money - i_1 - j_5 * 5) == 10 * (n - i_1 - j_5):
flag = True
ans = [i_1, j_5, n - i_1 - j_5]
if flag:
break
print(ans[2], ans[1], ans[0])
|
p03281 | s938568334 | Accepted | N = int(input())
ans = 0
for i in range(1, N+1, 2):
d = 0
for k in range(1, i+1):
if i % k == 0:
d += 1
if d == 8:
ans += 1
print(ans) |
p02786 | s978539170 | Accepted | a = int(input())
def Rec(a):
if a == 1:
return 1
return 1 + Rec(a//2)*2
print(Rec(a))
|
p03625 | s276237508 | Accepted | input();a=list(map(int,input().split()));d={}
for i in a:
if i in d:
d[i] += 1
else:
d[i] = 1
d={i:j for i,j in d.items() if j>1}
if len(d)<2:
print(0)
else:
d=sorted(d.items(),key=lambda x:(-x[0],-x[1]))
print(d[0][0]*d[1][0] if d[0][1]<4 else d[0][0]*d[0][0]) |
p02836 | s937397968 | Accepted | s = input()
ans = 0
for i in range(len(s)//2):
if s[i] != s[-1-i]:
ans += 1
print(ans) |
p02873 | s714955917 | Accepted | s=input()
l=[0]*(len(s)+1)
for i in range(len(s)):
if s[i]=='<':
l[i+1]=l[i]+1
for i in range(len(s)-1,-1,-1):
if s[i]=='>':
l[i]=max(l[i],l[i+1]+1)
print(sum(l)) |
p03796 | s009678845 | Wrong Answer | N = int(input())
P = 1
for i in range(2,N+1):
P = P*i
P = P % (100000007)
print(P)
|
p03419 | s950780176 | Accepted | n,m = map(int,input().split())
if n >= 3 and m >= 3:
ans = (n-2) * (m-2)
elif n >= 3 and m==1:
ans = n-2
elif m >= 3 and n==1:
ans = m-2
elif n==1 and m==1:
ans = 1
else:
ans = 0
print(ans)
|
p03644 | s532688618 | Accepted | n = int(input())
precount = 0
if n==1:
ans = 1
for i in range(1, n+1):
tmp = i
flag = 1
count = 0
while flag :
flag = 0
if i%2 == 0:
i = i//2
flag = 1
count += 1
if precount < count :
precount = count
ans = tmp
print(ans) |
p02912 | s912222435 | Accepted | import heapq
from math import ceil
n,m = map(int,input().split())
A = list(map(int,input().split()))
hq = list(map(lambda x:-1*x ,A))
heapq.heapify(hq)
for i in range(m):
a = heapq.heappop(hq)
a = ceil(a/2)
heapq.heappush(hq,a)
print(-1*sum(hq))
|
p03623 | s101763122 | Accepted | x,a,b=map(int,input().split())
if abs(x-a)<abs(x-b):
print("A")
else:
print("B")
|
p02873 | s029573174 | Accepted | s = input().replace('><','> <').split()
ans = 0
#print(list(s))
for st in s:
lt = st.count('<')
gt = len(st) - lt
if lt > gt:
gt -= 1
else:
lt -= 1
ans += (lt*lt+lt)//2 + (gt*gt+gt)//2
print(ans) |
p02552 | s562576090 | Wrong Answer | x = input()
if x==0:
print(1)
else:
print(0) |
p03760 | s028141522 | Wrong Answer | O = input()
E = input()
print("".join(o + e for o, e in zip(O, E)))
|
p02608 | s522696584 | Accepted | n = int(input())
lst = [0] * 10**6
for x in range(1, 101):
for y in range(1, 101):
for z in range(1, 101):
t = (x**2 + y**2 + z**2 + (x+y+z)**2) // 2
lst[t] += 1
for i in range(1, n+1):
print(lst[i]) |
p03243 | s518190335 | Accepted | def main():
N = int(input())
for i in range(N, 1000):
s = str(i)
if s[0] == s[1] and s[1] == s[2]:
print(i)
break
main() |
p02802 | s796342438 | Wrong Answer | import sys
inputs = sys.stdin.readlines()
n, m = map(int, inputs[0].split())
P, S = [], []
for s in inputs[1:]:
x, y = s.split()
P.append(int(x)-1)
S.append(y)
num_ac = num_wa = 0
acs = [0]*n
for p, s in zip(P, S):
if acs[p]:
continue
if s == 'WA':
num_wa += 1
else:
acs[p] = 1
num_ac += 1
print(*[num_ac, num_wa]) |
p02570 | s222865043 | Accepted | d,t,s = map(int,input().split())
print("Yes" if d <= t*s else "No") |
p03000 | s850095112 | Wrong Answer | line = input()
num = (int)(line.split(" ")[0])
limit = (int)(line.split(" ")[1])
x = 0
count = 0
line = input()
for i in range(num):
if x > limit:
break
x += (int)(line.split(" ")[i])
count += 1
print(count) |
p02765 | s866558124 | Accepted | N,R=map(int,input().split())
if N<10:
print(R+100*(10-N))
else:
print(R) |
p03075 | s251175974 | Accepted | a, b, c, d, e, k = [int(input()) for _ in range(6)]
if e-a > k:
print(':(')
else:
print('Yay!') |
p03011 | s296072638 | Accepted | p,q,r=map(int,input().split())
print(min(p+q,p+r,q+r)) |
p03623 | s695211813 | Accepted | x,a,b = map(int,input().split())
if abs(a-x)>abs(b-x):
print("B")
else:
print("A") |
p03339 | s672251588 | Accepted | n = int(input())
s = input()
cnt = 0
W, E = [], []
w, e = 0, 0
for i in range(n):
W.append(w); E.append(e)
if s[i] == 'W':
w += 1
if s[-i-1] == 'E':
e += 1
print(min([w+e for (w, e) in zip(W, E[::-1])])) |
p02554 | s359723210 | Accepted | n = int(input())
MOD = 1000000007
def mod(n):
return n % MOD
def modpow(a, n): #mod(a**n)を高速で求める
res = 1
digit = len(str(bin(n))) - 2
for i in range(digit):
if (n >> i) & 1:
res *= mod(a)
res = mod(res)
a = mod(a**2)
return mod(res)
ans = modpow(10, n)
ans -= 2*modpow(9, n)
ans += modpow(8, n)
print(mod(ans)) |
p03309 | s713262992 | Wrong Answer | import statistics
N = int(input())
A = list(map(int, input().split()))
cnt = 1
for i in range(N):
A[i] = A[i] - cnt
cnt += 1
A.sort(reverse=True)
medA = statistics.median(A)
ans = 0
cnt = 1
for j in range(N):
ans += abs(A[j] - medA)
cnt += 1
print(ans) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.