problem_id
stringclasses 428
values | submission_id
stringlengths 10
10
| status
stringclasses 2
values | code
stringlengths 5
816
|
|---|---|---|---|
p02873
|
s174454267
|
Accepted
|
s=input()
l=len(s)
a=[0 for i in range(l+1)]
for i in range(l):
if s[i]=='<':
a[i+1]=max(a[i+1],a[i]+1)
#print(a)
for i in range(l-1,-1,-1):
if s[i]=='>':
a[i]=max(a[i+1]+1,a[i])
#print(a)
print(sum(a))
|
p03109
|
s409837596
|
Wrong Answer
|
S = input()
print('Heisei' if S <= '2019/4/30' else "TBD")
|
p02754
|
s650860087
|
Wrong Answer
|
N, A, B = map(int, input().split())
num = N // (A + B) * A
num += N % (A + B)
print(num)
|
p02687
|
s601141404
|
Accepted
|
S = str(input())
if S == 'ABC':
print('ARC')
elif S == 'ARC':
print('ABC')
|
p02817
|
s119637127
|
Wrong Answer
|
s,t = map(str, input().split())
print(s+t)
|
p02747
|
s156395185
|
Accepted
|
s = input()
hitachi = 'hi'
l = len(s) // 2
print('Yes' if hitachi*l == s else 'No')
|
p03659
|
s443071131
|
Accepted
|
n = int(input())
a = list(map(int,input().split()))
S = sum(a)
sum =[0]*n
sum[0] = a[0]
su =0
ar =0
min = 10**20
for i in range(1,n):
sum[i] = sum[i-1] + a[i]
su = sum[i-1]
ar = S - su
if abs(su-ar) < min:
min = abs(su-ar)
print(min)
|
p03699
|
s770020129
|
Accepted
|
N = int(input())
S = sorted([int(input()) for _ in range(N)])
sumofS = sum(S)
if sumofS % 10 != 0:
print(sumofS)
quit()
for s in S:
if s % 10 != 0:
print(sumofS-s)
quit()
print(0)
|
p02995
|
s179812471
|
Wrong Answer
|
from math import ceil
A, B, C, D = map(int, input().split())
Cdiff = ceil(B/C) - ceil((A-1)/C)
Ddiff = ceil(B/D) - ceil((A-1)/D)
CDdiff = ceil(B/(C*D) ) - ceil((A-1)/(C*D))
res = Cdiff+Ddiff-CDdiff
print((B-A)-res)
|
p03779
|
s856279901
|
Wrong Answer
|
import math
X = int(input())
m = math.sqrt(X * 2)
if int(m) * (int(m) + 1) == X * 2:
print(int(m))
else:
print(math.ceil(m))
|
p03061
|
s326018123
|
Accepted
|
import fractions
N = int(input())
A = list(map(int, input().split()))
DP_first = [0] * N
DP_last = [0] * N
DP_first[0] = A[0]
DP_last[0] = A[-1]
for i in range(1, N):
DP_first[i] = fractions.gcd(DP_first[i-1], A[i])
DP_last[i] = fractions.gcd(DP_last[i-1], A[-1-i])
ans = max(DP_first[N-2], DP_last[N-2])
for i in range(1, N-1):
ans = max(ans, fractions.gcd(DP_first[i-1], DP_last[N-2-i]))
print(ans)
|
p02882
|
s365323898
|
Wrong Answer
|
from math import tan, atan2, pi, degrees
def f(theta):
if theta < thres:
return V - a ** 3 * tan(theta) / 2
else:
return a * b * b / tan(theta) / 2
eps = 1e-7
a, b, x = map(int, input().split())
V = a * a * b
thres = atan2(b, a)
bad, good = pi / 2, 0
while bad - good > eps:
mid = (bad + good) / 2
if f(mid) >= x:
good = mid
else:
bad = mid
print(degrees(good))
|
p03486
|
s439543521
|
Accepted
|
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
if ("".join(s) < "".join(t)):
print("Yes")
else:
print("No")
|
p02627
|
s667265300
|
Wrong Answer
|
from sys import stdin
from collections import defaultdict as dd
from collections import deque as dq
import itertools as it
from math import sqrt, log, log2
from fractions import Fraction
a = input()
print(a.swapcase())
|
p02818
|
s542069166
|
Accepted
|
#!/usr/bin/env python3
A, B, K = list(map(int, input().split()))
nokori = K
if A > 0:
if K <= A:
nokori = 0
A = A - K
else:
nokori = K - A
A = 0
if nokori > 0 and B > 0:
if nokori <= B:
B = B - nokori
nokori = 0
else:
nokori -= B
B = 0
ans = "{} {}".format(A, B)
print(ans)
|
p02714
|
s524336215
|
Wrong Answer
|
N = int(input())
S = input()
ans=0
for i in range(1,N-1):
for j in range(i+1,N):
for k in range(j+1,N+1):
if S[i-1] != S[j-1] and S[i-1] != S[k-1] and S[j-1] != S[k-1]:
ans+=1
print(ans)
|
p02765
|
s317018749
|
Accepted
|
N,R = map(int,input().split())
if N>=10:
Ans = R
else:
Ans = R+100*(10-N)
print(Ans)
|
p03351
|
s904929366
|
Wrong Answer
|
a, b, c, d = map(int, input().split())
if abs(a-b) <= d and abs(b-c) <= d:
print("Yes")
print("No")
|
p02802
|
s019675952
|
Wrong Answer
|
N,M=map(int,input().split())
AC=WA=[0] * (N + 1)
cnt_AC=cnt_WA=0
for i in range(M):
p,s=input().split()
p=int(p)
if AC[p]==0:
if s=='WA':
cnt_WA+=1
if s=='AC':
AC[p]=1
cnt_AC=sum(AC)
print(cnt_AC,cnt_WA)
|
p02658
|
s178684385
|
Wrong Answer
|
N = int(input())
A = list(map(int,input().split()))
a = A[0]
for i in range(1,N) :
a = a*A[i]
if a > 10**18:
print(-1)
break
else :
continue
print(a)
|
p03331
|
s323496978
|
Wrong Answer
|
n = int(input())
a = 2
b = n - 2
def sum_dig(dig):
dig = str(dig)
soma = 0
for d in dig:
soma += int(d)
return soma
st = 0
if(n != 2):
menor_s = 10^5
else:
menor_s = 2
while(a < b):
st = sum_dig(a) + sum_dig(b)
if(st < menor_s):
menor_s = st
a += 1
b -= 1
print(menor_s)
|
p03745
|
s876523603
|
Accepted
|
N = int(input())
input_array = list(map(int, input().split()))
upper = False
lower = False
res = 1
for i in range(len(input_array) - 1):
if input_array[i] == input_array[i + 1]:
continue
elif input_array[i] < input_array[i + 1]:
upper = True
else:
lower = True
if upper is True and lower is True:
res += 1
upper = False
lower = False
print(res)
|
p02987
|
s525443650
|
Accepted
|
#ABC132 A
S = str(input())
T = [S[0],S[1],S[2],S[3]]
T.sort()
if T[0] == T[1] and T[2] == T[3] and T[1] != T[2]:
print("Yes")
else:
print("No")
|
p02718
|
s048070764
|
Accepted
|
n , m = map(int,input().split())
arr = list(map(int,input().split()))
add = sum(arr)
miniVotes = add/(4*m)
cnt = 0
for i in range(len(arr)):
if arr[i]>=miniVotes:
cnt+=1
if(cnt>=m):
print("Yes")
else:
print("No")
|
p02639
|
s303636127
|
Accepted
|
def main():
x=list(map(int,input().split()))
for i in range(5):
if x[i] == 0:
print(i+1)
main()
|
p02802
|
s671830837
|
Accepted
|
N,M=map(int,input().split())
ac=[0]*N
wa=[0]*N
for i in range(M):
p,s=input().split()
if s=="WA" and ac[int(p)-1]==0:
wa[int(p)-1]+=1
elif s=="AC" and ac[int(p)-1]==0:
ac[int(p)-1]+=1
penalty=[wa[k] for k in [i for i,j in enumerate(ac) if j!=0]]
print("%d %d" % (sum(ac),sum(penalty)))
|
p02789
|
s287523901
|
Wrong Answer
|
a,b=map(int,input().split())
print("Yes" if a==b else "Np")
|
p02706
|
s784218783
|
Accepted
|
N, M = map(int, input().split())
A = list(map(int, input().split()))
if sum(A) > N:
print(-1)
else:
print(N - sum(A))
|
p02761
|
s334332313
|
Wrong Answer
|
NM = list(map(int, input().split()))
N = NM[0]
M = NM[1]
sc = []
for i in range(M):
addList = list(map(int, input().split()))
sc.append(addList)
a = 10**(N-1)
while a < 10**N:
j = str(a)
bingo = True
for l in sc:
if int(j[l[0]-1]) != l[1]:
bingo = False
if bingo:
break
else:
a += 1
if a == 10**N and bingo == False:
print(-1)
else:
print(a)
|
p03011
|
s421815823
|
Accepted
|
T = sorted(list(map(int,input().split())))
print(T[0]+T[1])
|
p04031
|
s733723893
|
Accepted
|
N = int(input())
A = list(map(int, input().split()))
answer = 10 ** 15
for i in range(-100,101):
tmp = 0
for m in A:
tmp += (m-i) ** 2
answer = min(answer, tmp)
print(answer)
|
p02693
|
s470389859
|
Accepted
|
k = int(input())
a, b = map(int, input().split())
for i in range(a, b+1):
if i % k == 0:
print('OK')
exit()
print('NG')
|
p03821
|
s099279097
|
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 = a[::-1]
b = b[::-1]
ans = 0
tmp = 0
for i in range(n):
if b[i]==1:
continue
else:
t = (a[i]+ans) % b[i]
ans += b[i]-t
print(ans)
|
p02694
|
s278544540
|
Accepted
|
X = int(input())
money = 100
for i in range(10**12):
money = int(money * 1.01)
if money >= X:
print(i+1)
break
|
p03543
|
s088794682
|
Wrong Answer
|
import collections
c = collections.Counter(list(map(int, list(input()))))
print("Yes" if(c.most_common()[0][1] >= 3) else "No")
|
p03861
|
s816954172
|
Accepted
|
n, k, x = map(int,input().split())
if n == 0:
print(k//x + 1)
else:
if n%x == 0:
print(k//x - n//x + 1)
else:
print(k//x - n//x)
|
p03681
|
s614871687
|
Wrong Answer
|
n,m = map(int,input().split())
if abs(n-m) > 1:
print(0)
elif n == m:
cnt = 1
for i in range(2,n+1):
cnt *= i
print((cnt**2)*2 % 1000000007)
else:
a = max(n,m)
cnt = 1
for i in range(2,a+1):
cnt *= i
b = min(n,m)
cnt2 = 1
for i in range(2,b+1):
cnt2 *= i
print(cnt*cnt2 % 100000007)
|
p03659
|
s852606031
|
Accepted
|
N=int(input())
a=list(map(int,input().split()))
A=[0]*(N+1)
B=sum(a)
for i in range(N):
A[i+1]=A[i]+a[i]
t=10**15
for i in range(1,N):
t=min(t,abs(2*A[i]-B))
print(t)
|
p02582
|
s025393675
|
Wrong Answer
|
s=input()
c=0
ans=0
for i in range(len(s)):
if(s[i]=='R'):
c+=1
else:
ans=max(ans,c)
if(c):
ans=max(ans,c)
print(ans)
|
p03494
|
s576254551
|
Wrong Answer
|
input()
num_list = list(map(int, input().split()))
max_cnt = 0
for num in num_list:
num_cnt = 0
while True:
if num % 2 == 1:
if num_cnt > max_cnt: max_cnt = num_cnt
break
else:
num = num / 2
num_cnt += 1
print(max_cnt)
|
p03385
|
s996484167
|
Accepted
|
S = input()
if "a" in S and "b" in S and "c" in S:
print("Yes")
else:
print("No")
|
p03962
|
s059012683
|
Accepted
|
# 入力 : a b c
a, b, c = map(int, input().split())
# ペンキの色の種類の個数を出力せよ。
set = {a,b,c}
print(len(set))
|
p02689
|
s164962774
|
Accepted
|
import sys
input = sys.stdin.readline
from heapq import heappush
N, M = map(int, input().split())
H = list(map(int, input().split()))
x = [True] * N
for _ in range(M):
a, b = map(int, input().split())
a -= 1
b -= 1
if H[a] == H[b]:
x[a] = False
x[b] = False
elif H[a] > H[b]:
x[b] = False
else:
x[a] = False
ans = 0
for i in range(N):
if x[i]:
ans += 1
print(ans)
|
p02958
|
s498901860
|
Accepted
|
def main():
N = int(input())
p = list(map(int, input().split()))
diff = 0
for i in range(N):
if (i+1) != p[i]:
diff += 1
if (diff == 2) | (diff == 0):
return "YES"
return "NO"
if __name__ == '__main__':
print(main())
|
p02952
|
s267895491
|
Wrong Answer
|
n = input()
int_n = int(n)
sum = 9
for i in range(1,len(n),1):
if i%2 == 0:
if i == (len(n)-1):
sum += int_n - int("9"*i)
else:
sum += int("9"*(i+1)) - int("9"*i)
print(sum)
|
p02682
|
s265910933
|
Accepted
|
A,B,C,K=list(map(int,input().split()))
if A+B>=K:
if A>K:
print(K)
else:
print(A)
else:
F=K-(A+B)
print(A-F)
|
p03680
|
s353959572
|
Accepted
|
N = int(input())
a = [int(input()) - 1 for _ in range(N)]
seen = [0] * N
seen[0] = 1
i = 0
ans = 1
while a[i] != 1:
i = a[i]
if not seen[i]:
ans += 1
seen[i] = 1
else:
break
else:
print(ans)
exit()
print(-1)
|
p03281
|
s872681116
|
Accepted
|
N = int(input())
ans = 0
for n in range(1, N+1, 2):
c = 0
for i in range(1, n+1):
if n % i == 0:
c += 1
if c == 8:
ans += 1
print(ans)
|
p03433
|
s045337821
|
Accepted
|
N,A = (int(input()) for i in range(2))
B = N % 500
if B <= A:
print("Yes")
else:
print("No")
|
p03286
|
s107465835
|
Accepted
|
N = int(input())
S = ""
#素因数分解
while N:
if N%(-2) == 0:
S = "0"+S
else:
S = "1"+S
#余りとなった部分を引く
N -= 1
N = N/(-2)
if S=="":
S="0"
print(S)
|
p03821
|
s578675544
|
Accepted
|
import sys
N = int(sys.stdin.readline().strip())
data = []
for _ in range(N):
a, b = map(int, sys.stdin.readline().strip().split())
data.append((a, b))
ans = 0
adds = 0
for i in range(N):
a, b = data[N-1-i]
a += adds
r = (a - 1) // b
target = b * (r + 1)
tmp = target - a
ans += tmp
adds += tmp
print(ans)
|
p02819
|
s788206795
|
Wrong Answer
|
ans = int(input())
ok = 1
while ok:
for i in range(2,ans+1):
if ans % i == 0:
ok = 0
if ok == 0:
print(ans)
else:
ans+=1
|
p02918
|
s394542782
|
Wrong Answer
|
def run_length(s) -> list:
res = [[s[0], 1]]
for i in range(1, len(s)):
if res[-1][0] == s[i]:
res[-1][1] += 1
else:
res.append([s[i], 1])
return res
N, K = map(int, input().split())
S = input()
RL = run_length(S)
tmp = 0
for r, l in RL:
tmp += l - 1
if K >= len(RL) - 2:
answer = N - 1
else:
answer = tmp + K * 2
print(answer)
|
p02583
|
s486431497
|
Accepted
|
N=int(input())
L=list(map(int,input().split()))
ans=0
for i in range(N):
for j in range(N):
for k in range(N):
a,b,c=L[i],L[j],L[k]
if i<j<k and a!=b and b!=c and c!=a:
if a+b>c and b+c>a and c+a>b:
ans+=1
#print(a,b,c)
print(ans)
|
p02793
|
s476556266
|
Wrong Answer
|
n = int(input())
a = list(map(int, input().split()))
def gcd(x, y):
if y == 0:
return x
return gcd(y, x % y)
def lcm(x, y):
return x * y // gcd(x, y)
l = a[0]
for x in a:
l = lcm(l, x)
law = 10 ** 9 + 7
ans = 0
for x in a:
ans += l // x
print(ans)
|
p02854
|
s910353073
|
Accepted
|
n = int(input())
a = list(map(int, input().split()))
s = [0]
for i in range(n):
s.append(a[i]+s[i])
m = 100000000000000
for i in range(len(s)):
m = min(m, abs((s[i] - s[0]) - (s[len(s) - 1] - s[i])))
print(m)
|
p02811
|
s427697878
|
Wrong Answer
|
import sys
# input=sys.stdin.readline
val = input()
array = val.split(' ')
a = array[0]*500
if a<array[1]:
print("Yes")
else:
print("No")
sys.exit()
|
p03407
|
s666764446
|
Accepted
|
a, b, c = map(int, input().split())
print("Yes" if a+b>=c else "No")
|
p03386
|
s149487503
|
Wrong Answer
|
A, B, K = map(int, input().split())
if abs(A - B) >= 2 * K:
for i in range(K):
print(A + i)
for j in range(K):
print(B - j)
else:
for k in range(A, B+1):
print(k)
|
p03252
|
s432165264
|
Wrong Answer
|
s=input()
t=input()
d=dict(zip(s, t))
judge=0
for i in d:
for j in d:
"""if d[i]==j:
if i!=d[j]:
judge+=1"""
if i==j:
judge+=1
if d[i]==d[j]:
judge+=1
if judge==0:
print("Yes")
else:
print("No")
|
p02555
|
s753545340
|
Wrong Answer
|
s = int(input())
table = [1, 0, 0]
for i in range(s):
table.append(table[i]+table[i+2])
print(table[s])
|
p02796
|
s627370134
|
Accepted
|
def main():
import sys
input = sys.stdin.readline
N = int(input())
XL = []
for i in range(N):
x, l = map(int, input().split())
XL.append((x, l))
XL.sort(key=lambda p: p[1] + p[0])
ans = 0
prev = -10**10
for i in range(N):
x, l = XL[i]
if x - l >= prev:
ans += 1
prev = x + l
print(ans)
if __name__ == '__main__':
main()
|
p03220
|
s232824266
|
Wrong Answer
|
import numpy as np
N=int(input())
T,A=map(int,input().split())
H=list(map(int,input().split()))
h=np.array(H)
a=np.zeros(N)
t=np.zeros(N)
res=0
for i in range(N):
t[i]=T
for j in range(N):
a[j]=A
s=(t-(a-0.006*h))**2
c=sorted(s)
for k in range(N):
if s[k]==c[0]:
res=k+1
print(res)
|
p02952
|
s557732586
|
Accepted
|
#!/usr/bin/python3
# -*- coding:utf-8 -*-
def main():
n = int(input())
count = 0
for i in range(1, n+1):
if len(str(i)) % 2 == 1:
count += 1
print(count)
if __name__=='__main__':
main()
|
p03251
|
s899365023
|
Wrong Answer
|
import sys
N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
for Z in range(X+1,Y+1):
if max(x) >= Z and Z <= min(y):
print("No War")
sys.exit()
print('War')
|
p02973
|
s276190449
|
Accepted
|
import bisect, collections
n = int(input())
num = collections.deque([])
for i in range(n):
a = int(input())
temp = bisect.bisect_left(num, a)
if temp == 0:
num.appendleft(a)
else:
num[temp - 1] = a
print(len(num))
|
p02687
|
s188288018
|
Wrong Answer
|
s = print()
if s == "ABC":
print("ARC")
else:
print("ABC")
|
p03760
|
s852181492
|
Wrong Answer
|
a = list(input())
b = list(input())
def big(a,b):
if a > b:
return a
else:
return b
def plus(a,b):
c = a[i]
d = b[i]
return c+d
e = ""
for i in range(len(big(a,b))):
e += plus(a,b)
print(e)
|
p03136
|
s638007287
|
Wrong Answer
|
# coding: utf-8
# Your code here!
n = int(input())
l = list(map(int, input().split()))
m = sum(l)
a = 0
for i in range(n):
if l[i] >= m - l[i]:
print("NO")
a = 1
break
if a == 0:
print("YES")
|
p02778
|
s923856233
|
Accepted
|
s=input()
n=len(s)
print('x'*n)
|
p02995
|
s564646330
|
Wrong Answer
|
def getDivCount( a, b, x ):
count=0
if a==0 :
count+=1
if a<=x :
ai = x
else:
ai = (a//x)*x
if ai<a :
ai +=x
if ai<=b :
count+=1
count+=(b-ai)//x
return count
a,b,c,d = map(int, input().split())
count = b-a+1
count -= getDivCount(a,b,c)
if c!=d :
count -= getDivCount(a,b,d)
count += getDivCount(a,b,c*d)
print(count)
|
p03633
|
s461469508
|
Wrong Answer
|
import fractions
def a(A, B):
C = fractions.gcd(A, B)
return (A * B)/C
N = int(input())
T = []
for _ in range(N):
T.append(int(input()))
T = sorted(T)
C = T[0]
if N > 1:
for i in range(1, N):
C = a(C, T[i])
print(C)
|
p02935
|
s443206608
|
Accepted
|
N = int(input())
v = list(map(int, input().split()))
v = sorted(v)
ans = v[0]
for i in v[1:]:
ans = (ans + i) / 2
print(ans)
|
p02973
|
s842368631
|
Wrong Answer
|
from collections import Counter
N = int(input())
A = []
maximum = 0
minimum = float('inf')
count = 0
for i in range(N):
a = int(input())
A.append(a)
maximum = max(maximum,a)
if a <= minimum:
minimum = a
count += 1
c = Counter(A)
print(max(count,max(c.values())))
|
p03338
|
s653186441
|
Wrong Answer
|
n=int(input())
s=input()
count = 0
for i in range(n-1):
a=s[:i + 1]
b=s[i+1:]
temp = 0
for j in range(26):
if chr(96+j) in a and chr(96+j) in b:
temp += 1
count = max(temp, count)
print(count)
|
p02684
|
s056778374
|
Accepted
|
_,k,*a=map(int,open(0).read().split());a=[0]+a;p=1
while k:p=~-k%2*p or a[p];a=[a[b]for b in a];k//=2
print(p)
|
p03371
|
s012601300
|
Accepted
|
a, b, c, x, y = map(int, input().split())
num = min(a + b, c * 2)
a = min(a, c * 2)
b = min(b, c * 2)
s = min(x, y)
if x > y:
print(num * s + a * (x - s))
else:
print(num * s + b * (y - s))
|
p02695
|
s085836555
|
Accepted
|
from itertools import combinations
n,m,q = map(int, input().split())
abcd = [list(map(int, input().split())) for _ in range(q)]
ans = 0
for case in combinations([i for i in range(1,n+m)],n):
now = 0
A = [x-i for i,x in enumerate(case)]
for i in range(q):
a,b,c,d = abcd[i]
if A[b-1]-A[a-1] == c:
now += d
ans = max(now,ans)
print(ans)
|
p03293
|
s764740179
|
Accepted
|
s = input()
t = input()
ans = "No"
for _ in range(len(s)+1):
s = s[-1] + s[:-1]
if s == t:
ans = "Yes"
break
print(ans)
|
p03035
|
s763264237
|
Wrong Answer
|
a,b = map(int,input().split())
if a>12:
print(b)
elif a>5:
print(b/2)
else:
print(0)
|
p03633
|
s672720024
|
Wrong Answer
|
import sys
import fractions
sys.setrecursionlimit(200000000)
N = int(input())
NUMS = [int(input()) for _ in range(N)]
NUMS = list(set(NUMS))
def gcd(num1, num2):
if num2 == 0:
return num1
else:
return gcd(num2, num1 % num2)
res = NUMS[0]
for num in NUMS[1:]:
res = res * num / max(fractions.gcd(res, num), 1)
print(int(res))
|
p02723
|
s882946372
|
Wrong Answer
|
S='coffee'
a=S[2]
b=S[3]
c=S[4]
d=S[5]
if a == b and c == d:
print("yes")
else:
print("no")
|
p03860
|
s234652740
|
Accepted
|
l=list(map(str,input().split()))
# print(l)
l2=list(l[1])
axc=str('A'+l2[0]+'C')
print(axc)
|
p03327
|
s785833430
|
Wrong Answer
|
n = int(input())
if 1 <= n < 1000:
print('ABC' + str(n).zfill(3))
else:
n -= 999
print('ABD' + str(n).zfill(3))
|
p02873
|
s484134616
|
Wrong Answer
|
import itertools as it
s = input()
n = len(s)
a = [0]*(n+1)
for i in range(n):
if s[i] == "<":
a[i+1] = +1
if s[i] == ">":
a[i+1] = -1
l = [0]*(n+1)
for i in range(n):
if i < n-1:
if s[i] == ">" and s[i+1] == "<":
l[i+1] = 0
else:
l[i+1] += l[i] + a[i+1]
else:
l[i+1] += l[i] + a[i+1]
m = min(l)
r = [i + abs(m) for i in l]
print(sum(r))
|
p02596
|
s338532473
|
Accepted
|
k = int(input())
n = 0
for i in range(k+1):
n += pow(10, i, k)*7
n %= k
if n==0:
print(i+1)
break
else:
print(-1)
|
p03605
|
s090412570
|
Wrong Answer
|
s = str(input())
if s[0] == 9 or s[1] == 9:
print("Yes")
else:
print("No")
|
p03250
|
s789022181
|
Accepted
|
import itertools
t = input().split()
ans = 0
for i in itertools.permutations(t, 3):
ans = max(ans, int(i[0]+i[1])+int(i[2]))
#print(i, i[0]+i[1],i[2])
#print(ans)
print(ans)
|
p02933
|
s575742642
|
Accepted
|
a = int(input())
s = input()
if a >= 3200:
print(s)
else:
print('red')
|
p02760
|
s794879941
|
Accepted
|
def resolve():
a = []
bingo = [(0,3,6),(1,4,7),(2,5,8),(0,1,2),(3,4,5)
,(6,7,8),(0,4,8),(2,4,6)]
for _ in range(3):
a += list(map(int,input().split()))
for i in range(int(input())):
r = int(input())
if r in a:
a[a.index(r)]=0
ans = 'No'
for i in bingo:
if a[i[0]] == 0 and a[i[1]]==0 and a[i[2]]==0:
ans ='Yes'
print(ans)
resolve()
|
p03681
|
s267731331
|
Wrong Answer
|
from math import factorial
n,m=map(int,input().split())
mod=10**9+7
f=factorial(n)
if abs(n-m)>1:
print(0)
elif abs(n-m)==1:
print((f**2)%mod)
else :
print((2*f**2)%mod)
|
p02811
|
s421334782
|
Wrong Answer
|
l = [int(i) for i in input().split()]
K, X = l
if K * 500 > X:
print('Yes')
else:
print("No")
|
p02777
|
s114282363
|
Accepted
|
def main():
s, t = input().split()
a, b = map(int, input().split())
u = input()
if s == u:
print(a-1, b)
else:
print(a, b-1)
if __name__ == "__main__":
main()
|
p03289
|
s130556640
|
Wrong Answer
|
s = input()
flg = 1
if (s[0] != 'A'):
flg = 0
cnt = 0
for i in s[2:-2]:
if (i == 'C'): cnt+= 1
if (cnt != 1):
flg = 0
cap = 0
for i in s:
if ('A' <= i <= 'Z'): cap += 1
if (cap != 2):
flg = 0
if (flg): print("AC")
else: print("WA")
|
p03360
|
s768269780
|
Accepted
|
a, b, c = map(int, input().split())
k = int(input())
print(a + b + c + max(a, b, c) * (2 ** k - 1))
|
p02601
|
s315919500
|
Wrong Answer
|
a,b,c=map(int,input().split())
k=int(input())
for i in range(k+1):
if a>b:
b=b*2
else:
if b>c:
c=c*2
else:
break
if a<b<c:
print('Yes')
else:
print('No')
|
p03077
|
s606608034
|
Wrong Answer
|
import math
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
t = 0
t += math.ceil(N / A)
t += math.ceil(A / B)
t += math.ceil(B / C)
t += math.ceil(C / D)
t += math.ceil(D / E)
print(t)
|
p02720
|
s912596238
|
Accepted
|
from collections import deque
K = int(input())
l = [9,8,7,6,5,4,3,2,1]
lunlun = deque(l)
ans = l
for _ in range(K - 9):
x = lunlun.pop()
tmp = 10 * x + (x % 10)
if x % 10 != 0:
lunlun.appendleft(tmp - 1)
ans.append(tmp - 1)
lunlun.appendleft(tmp)
ans.append(tmp)
if x % 10 != 9:
lunlun.appendleft(tmp + 1)
ans.append(tmp + 1)
ans.sort()
print(ans[K - 1])
|
p02786
|
s700232770
|
Accepted
|
h = int(input())
count = 0
while h > 1 :
h = h // 2
count += 1
sum = 0
for i in range(count+1) :
sum = sum + 2**i
print(sum)
|
p02681
|
s203594620
|
Accepted
|
s = input()
t = input()
if (s == t[:-1]) & (len(s) + 1 == len(t)):
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.