problem_id
stringclasses 428
values | submission_id
stringlengths 10
10
| status
stringclasses 2
values | code
stringlengths 5
816
|
|---|---|---|---|
p02953
|
s615289312
|
Accepted
|
import sys
#import numpy as np
import math
from fractions import Fraction
import itertools
input=sys.stdin.readline
n=int(input())
a=list(map(int,input().split()))
s=set()
for i in range(n-1):
if a[n-1-i-1]>1+a[n-i-1]:
print("No")
exit()
elif a[n-i-2]==a[n-i-1]+1:
a[n-i-2]-=1
s.add(i)
for i in range(n-1):
if a[i]>a[i+1] and i in s:
print("No")
exit()
print("Yes")
|
p03617
|
s900790021
|
Wrong Answer
|
p = list(map(int, input().split()))
n = int(input())
l = []
s = [0.25, 0.5, 1, 2]
l = [[p[0]*4, 0], [p[1]*2, 1], [p[2], 2], [p[3]/2, 3]]
l.sort()
def only1L():
return min(p[0]*4, p[0]*2+p[1], p[1]*2, p[2])
if (n == 1):
print(only1L())
elif (s[l[0][1]] == 2):
print(int(p[l[0][1]] * (n // s[l[0][1]])) + only1L())
else:
print(int(l[0][0] * (n // s[l[0][1]])))
|
p02596
|
s434916148
|
Accepted
|
k = int(input())
seed = 0
flag = 1
for i in range(k):
seed = (10*seed +7)%k
if seed == 0: print(i+1); flag = 0; break
if flag: print(-1)
|
p02848
|
s036538673
|
Wrong Answer
|
n = int(input())
s = list(input())
alp = [chr(ord('A') + i) for i in range(26)]
ans = []
for a in s:
i = (alp.index(a) + 2) % 26
ans.append(alp[i])
print(''.join(ans))
|
p03131
|
s843252653
|
Accepted
|
K, A, B = map(int, input().split())
if A+2 >= B or A >= K:
print(K+1)
else:
print(B + ((K-A+1)//2-1)*(B-A) + ((K-A+1)%2))
|
p02645
|
s877151895
|
Wrong Answer
|
import random
S = input()
a=len(S)
b=[random.randrange(a-2)]
b.append(random.randint(b[0]+1,a-2))
b.append(random.randint(b[1]+1,a-1))
c=[S[b[i]] for i in range(3)]
print(c[0]+c[1]+c[2])
|
p04019
|
s346951696
|
Accepted
|
s=str(input())
if s.count("W")==0 and s.count("E")==0 and s.count("S")==0 and s.count("N")==0:
print("Yes")
elif s.count("W")>0 and s.count("E")>0 and s.count("S")==0 and s.count("N")==0:
print("Yes")
elif s.count("W")==0 and s.count("E")==0 and s.count("S")>0 and s.count("N")>0:
print("Yes")
elif s.count("W")>0 and s.count("E")>0 and s.count("S")>0 and s.count("N")>0:
print("Yes")
else:
print("No")
|
p02547
|
s471394798
|
Wrong Answer
|
n = int(input())
cnt = 0
flg = False
for i in range(n):
d1, d2 = map(int, input().split())
if cnt == 0 and d1 == d2:
cnt += 1
if cnt > 0:
if d1 == d2:
cnt += 1
else:
cnt = 0
if cnt == 3:
flg = True
if flg:
print('Yes')
else:
print('No')
|
p02888
|
s586921379
|
Accepted
|
import bisect
N = int(input())
L = list(map(int, input().split()))
L = sorted(L)
count = 0
for i in range(1,N-1):
for j in range(i+1,N):
posi = bisect.bisect_right(L,L[j]-L[i])
if i-posi > 0:
count += i-posi
print(count)
|
p03087
|
s529272470
|
Accepted
|
n,q=map(int,input().split())
s=list(input())
ac=[0]*n
for i in range(1,n):
ac[i]=ac[i-1]
if s[i-1]+s[i]=='AC':
ac[i]+=1
#print(*ac)
for _ in range(q):
l,r=map(int,input().split())
print(ac[r-1]-ac[l-1])
|
p02953
|
s653050397
|
Accepted
|
N = int(input())
H = list(map(int, input().split()))
f = True
now = H[0]
for i in range(0,N - 1):
#print(i, now)
#次が1以上小さい
if now - H[i + 1] >= 1:
f = not f
break
#次の方が1以上大きい
elif H[i + 1] - now >= 1:
now = H[i + 1] - 1
if f:
print("Yes")
else:
print("No")
|
p02766
|
s113938441
|
Accepted
|
n,k = map(int, input().split())
ans = 0
while n > 0:
n /= k
n = int(n)
ans += 1
print(ans)
|
p03485
|
s873484340
|
Accepted
|
a,b = map(int,input().split())
c = (a+b)/2
print(int((a+b+1)/2))
|
p03657
|
s082138831
|
Wrong Answer
|
# 出力
a, b = map(int, input().split())
# 処理&出力
if a / 3 >= 1 :
print('Possible')
elif b / 3 >= 1:
print('Possible')
elif (a + b) /3 >= 1:
print('Possible')
else:
print('Impossible')
|
p03437
|
s044758080
|
Wrong Answer
|
X, Y = map(int, input().split())
if Y % X == 0 or X % Y == 0:
ans = -1
else:
ans = X
if ans > 10**18:
ans = -1
if X == 1:
ans = Y + 1
print(ans)
|
p02556
|
s574899786
|
Accepted
|
def f(x, y):
return x-y, x+y
n = int(input())
p = [list(map(int, input().split())) for i in range(n)]
max_x = -2000000000
min_x = 2000000000
max_y = -2000000000
min_y = 2000000000
for xi, yi in p:
f1, f2 = f(xi, yi)
max_x = max(max_x, f1)
min_x = min(min_x, f1)
max_y = max(max_y, f2)
min_y = min(min_y, f2)
print(max(max_x - min_x, max_y - min_y))
|
p02861
|
s694723845
|
Accepted
|
import math
n = int(input())
s_amount = 0
l = [list(map(int, input().split())) for _ in range(n)]
for i in range(n):
for j in range(i):
s_amount += math.sqrt((l[i][0] - l[j][0]) ** 2 + (l[i][1] - l[j][1]) ** 2)
print(s_amount / sum([i for i in range(n)]) * (n-1))
|
p02711
|
s077604545
|
Wrong Answer
|
N = input()
for n in N:
if n == '7':
ans = 'Yes'
else:
ans = 'No'
print(ans)
|
p02682
|
s410033420
|
Accepted
|
a, b, c, k = map(int, input().split())
print(min(k, a) - max(k - a - b, 0))
|
p02832
|
s104428644
|
Wrong Answer
|
N = int(input())
a = []
a = list(map(int,input().split()))
index = 0
count = 0
searchNum = 1
for j in range(N):
if a[j] ==searchNum:
searchNum += 1
continue
else:
count +=1
print(count)
|
p03474
|
s472166529
|
Wrong Answer
|
import sys
a,b = map(int,input().split())
s = list(input())
print(s)
if s[a] != "-":
print("NO")
sys.exit()
s[s.index("-")] = "1"
print(s)
for i in range(len(s)):
if s[i].isdigit():
if int(s[i]) >= 6 or int(s[i]) <= 0:
print("No")
sys.exit()
else:
print("No")
sys.exit()
print("Yes")
|
p03449
|
s171301821
|
Accepted
|
N = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
ans_list = []
for k in range (0,N+1):
A1_sum = 0
A2_sum = 0
for i in range(0,N):
if i <= k-1:
A1_sum += A1[i]
for i in range(0,N):
if i >= k-1:
A2_sum += A2[i]
ans = A1_sum + A2_sum
ans_list.append(ans)
print(max(ans_list))
|
p02622
|
s029030293
|
Wrong Answer
|
S = input()
T = input()
count = 0
for s, t in zip(S, T):
if s != t:
count += 1
print(int((count+1)/2))
|
p03817
|
s586686605
|
Accepted
|
x = int(input())
ans = x // 11 * 2
nokori = x % 11
if nokori > 6:
print(ans + 2)
elif nokori == 0:
print(ans)
else:
print(ans + 1)
|
p02630
|
s165819164
|
Wrong Answer
|
N = int(input())
abc = 'abcdefghijklmnopqrstuvwxyz'
ans = ''
while N > 0:
N -= 1
ans = abc[(N%26)] + ans
N //= 26
print(ans)
|
p04011
|
s285298406
|
Accepted
|
n,k,x,y=int(input()),int(input()),int(input()),int(input())
if n<k:print(x*n)
else:print(x*k+y*(n-k))
|
p02717
|
s604779939
|
Accepted
|
X,Y,Z = input().split()
print(Z,X,Y)
|
p02923
|
s564358888
|
Accepted
|
#abc139 c
n=int(input())
h=list(map(int,input().split()))
ans=0
cnt=0
for i in range(n-1):
if h[i]>=h[i+1]:
cnt+=1
else:
ans=max(ans,cnt)
cnt=0
ans=max(ans,cnt)
print(ans)
|
p02784
|
s566017395
|
Accepted
|
H,N = map(int,input().split())
A = list(map(int, input().split()))
#print(H,N)
#print(A)
for i in range(N):
H -= A[i]
if H <= 0:
print('Yes')
else:
print('No')
|
p02796
|
s122738374
|
Wrong Answer
|
N = int(input())
XL = [tuple(map(int,input().split())) for i in range(N)]
XL.sort(key=lambda x: x[0]+x[1])
right = -float('inf')
ans = 0
s = -1e9
for x,l in XL:
t = x+l-1
if s <= right:
right = t
ans += 1
print(ans)
|
p03041
|
s595829336
|
Wrong Answer
|
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.buffer.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7
a, b = rm()
s = rr()
print(s.replace(s[b-1], s[b-1].lower()))
|
p03971
|
s788442219
|
Wrong Answer
|
n, a, b = map(int, input().split())
s = input()
success = 0
foreigner = 0
count = 0
for i in s:
if i == "a" and success <= a + b:
print("Yes")
success += 1
elif i == "b" and success <= a + b and foreigner <= b:
print("Yes")
success += 1
foreigner += 1
else:
print("No")
count += 1
if success == a + b:
break
for _ in range(n - count):
print("No")
|
p03107
|
s913207627
|
Wrong Answer
|
s=list(map(int,input()))
count=0
k=len(s)-2
i=0
while i<=k:
if s[i]!=s[i+1]:
s.remove(s[i])
s.remove(s[i])
k-=2
count+=2
else:
i+=2
print(count)
|
p02777
|
s360752094
|
Accepted
|
S,T = input().split()
A,B = map(int,input().split())
U = input()
if U == S:
print(A-1, B)
else:
print(A, B-1)
|
p03150
|
s717119013
|
Accepted
|
def main():
word = input()
target = "keyence"
target_length = len(target)
answer = "NO"
if word[:target_length] == target or word[-target_length:] == target:
answer = "YES"
else:
for i in range(1, target_length):
if word[:i] == target[:i] and word[-target_length + i:] == target[-target_length + i:]:
answer = "YES"
break
print(answer)
if __name__ == '__main__':
main()
|
p02775
|
s684142341
|
Accepted
|
s = list(input())
s.reverse()
s += ["0"]
n = len(s)
dp = [[10**7 for _ in range(2)] for _ in range(n+1)]
dp[0][0] = 0
for i in range(n):
for j in range(2):
x = int(s[i]) + j
for a in range(10):
kurisagaru = False
if a >= x:
b = 0
else:
b = 10 + a - x
kurisagaru = True
dp[i+1][kurisagaru] = min(dp[i+1][kurisagaru], dp[i][j]+a+b)
print(dp[n][0])
|
p04029
|
s838532479
|
Accepted
|
n = int(input())
print(n * (n + 1) // 2)
|
p02582
|
s631543217
|
Wrong Answer
|
def main():
from sys import setrecursionlimit, stdin, stderr
from os import environ
from collections import defaultdict, deque, Counter
from math import ceil, floor
from itertools import accumulate, combinations, combinations_with_replacement
setrecursionlimit(10**6)
dbg = (lambda *something: stderr.write("\033[92m{}\033[0m".format(str(something)+'\n'))) if 'TERM_PROGRAM' in environ else lambda *x: 0
input = lambda: stdin.readline().rstrip()
LMIIS = lambda: list(map(int,input().split()))
II = lambda: int(input())
P = 10**9+7
INF = 10**18+10
print(Counter(input())['R'])
main()
|
p03657
|
s576208965
|
Accepted
|
a,b=map(int,input().split())
print('Possible') if a+b>=3 and (a%3==0 or b%3==0 or (a+b)%3==0) else print('Impossible')
|
p03625
|
s998715598
|
Wrong Answer
|
from collections import Counter
n = int(input())
al = list(map(int, input().split()))
c = Counter(al)
l4 = []
l2 = []
for k, v in c.items():
if v >= 4:
l4.append(k)
elif v >= 2:
l2.append(k)
s1, s2 = 0, 0
l4 = sorted(l4, reverse=True)
l2 = sorted(l2, reverse=True)
if len(l4) > 0:
s1 = l4[0]*2
if len(l2) >= 2:
s2 = l2[0] * l2[1]
if s1 != 0 or s2 != 0:
print(max(s1, s2))
else:
print(0)
|
p02694
|
s839816979
|
Wrong Answer
|
x = int(input());
year = 0;
money = 100;
while money < x:
money = 1.01* money;
year = year + 1;
print(year);
|
p03836
|
s735797928
|
Accepted
|
sx,sy,tx,ty = map(int, input().split( ))
u = ty-sy
r = tx-sx
print("R"* r+ "U"*u + "L"*r + "D"*u + "D"
+ "R"* (r+1)+ "U"*(u+1) + "L" + "U" + "L"*(r+1) + "D"*(u+1) +"R")
|
p03607
|
s162455417
|
Accepted
|
import collections
n = int(input())
l = []
for i in range(n):
l.append(int(input()))
a = collections.Counter(l)
cnt = 0
for k,v in a.items():
if v%2 != 0:
cnt += 1
print(cnt)
|
p03077
|
s715808149
|
Accepted
|
n = int(input())
A = []
for i in range(5):
A.append(int(input()))
ma = min(A)
if n <= ma:
print(5)
exit()
else:
if n % ma == 0:
print(5 + n//ma - 1)
else:
print(5 + n//ma)
|
p03486
|
s847012000
|
Wrong Answer
|
def main():
s = list(input())
t = list(input())
s = sorted(s)
t = sorted(t)
print(s)
print(t)
shrt = False
for i in range(len(t)):
if s[0] < t[i]:
shrt = True
break
if shrt :
print("Yes")
else:
print("No")
main()
|
p03779
|
s414951798
|
Accepted
|
x = int(input())
ans = 0
for i in range(1, x+1):
ans = (i * (i+1)) / 2
if ans >= x:
print(i)
break
|
p03838
|
s187883500
|
Accepted
|
x, y = map(int, input().split())
d = abs(abs(x) - abs(y))
if 0 <= x < y or x < y <= 0:
print(d)
elif y <= 0 <= x or x < 0 < y:
print(d+1)
elif 0 < y < x or y < x < 0:
print(d+2)
else:
raise Exception
|
p02935
|
s956448421
|
Accepted
|
import sys
n, *lst = map(int, sys.stdin.read().split())
lst.sort()
res = lst[0]
for v in lst[1:]:
res = (res + v) / 2
print(res)
|
p02688
|
s238503470
|
Accepted
|
def main():
N,K=map(int,input().split())
ans=[i for i in range(1,N+1)]
for _ in range(K):
d = int(input())
A=[int(_) for _ in input().split()]
for a in A:
if a in ans:
ans.remove(a)
print(len(ans))
main()
|
p02916
|
s502231289
|
Wrong Answer
|
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
cnt = sum(b)
for i in range(n):
if i<=n-2 and (a[i+1] - a[i] == 1):
cnt += c[i]
print(cnt)
|
p03030
|
s643470667
|
Accepted
|
N = int(input())
res = []
for i in range(N) :
S , P = input().split()
res.append((S , int(P) , i+1))
res_sort = sorted(res, key = lambda x:(x[0],-x[1]))
for i in range(N) :
print(res_sort[i][2])
|
p02602
|
s318953547
|
Wrong Answer
|
N,K=map(int,input().split())
A=list(map(int,input().split()))
AA=[]
point=1
for i in range(N-K+1):
for j in range(K):
point*=A[i+j]
AA.append(point)
point=1
for n in range(N-K):
if AA[n]<AA[n+1]:
print('Yes')
elif AA[n]>=AA[n+1]:
print('No')
|
p02627
|
s840527503
|
Accepted
|
a = input()
if a in "qwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnm":
print ("a")
else :
print("A")
|
p03672
|
s356518445
|
Wrong Answer
|
n = input()
num = len(n)-2
for i in range(num,0,2):
f = int(i/2)
if s[:f]==s[f:i]:
print(i)
break
|
p03698
|
s248296583
|
Accepted
|
s = input()
n = len(s)
for i in range(n):
for j in range(i+1, n):
if s[i] == s[j]:
print('no')
exit()
print('yes')
|
p03107
|
s375232046
|
Accepted
|
S = input()
cnt1 = 0
cnt0 = 0
for s in S:
if s == '1':
cnt1 += 1
else:
cnt0 += 1
print(min(cnt1, cnt0) * 2)
|
p02756
|
s866170842
|
Wrong Answer
|
S = input()
Q = int(input())
#inp = [input().split() for _ in range(Q)]
# 無駄なところ除く
cnt = 0
for i in range(Q):
inp = input().split()
if len(inp) == 1:
cnt += 1
#S = S[::-1]
else:
if cnt % 2 != 0:
S = S[::-1]
cnt = 0
f, c = inp[1:]
if int(f) == 1:
S = c + S
else:
S = S + c
print(S)
|
p03797
|
s805043027
|
Wrong Answer
|
n, m = map(int, input().split())
if m > 0:
rem = m - 2*n
print(n+rem//4)
else:
print(0)
|
p03105
|
s755786278
|
Wrong Answer
|
a, b, c = map(int, input().split())
if a * c <= b:
print(a * c)
else:
print(b // a)
|
p04012
|
s368357048
|
Wrong Answer
|
w=input()
for i in range(len(w)):
if w.count(w[i])%2!=0:
print('No')
break
if w.count(w[i])%2==0:
print('Yes')
break
|
p02819
|
s432415232
|
Accepted
|
from math import sqrt, floor
def is_prime(x: int) -> bool:
if x <= 1:
return False
for i in range(2, floor(sqrt(x))):
if x % i == 0:
return False
return True
x = int(input())
while not is_prime(x):
x += 1
print(x)
|
p03479
|
s358486928
|
Accepted
|
X, Y = map(int, input().split())
count = 0
while X <= Y:
X *= 2
count += 1
print(count)
|
p03545
|
s051547987
|
Accepted
|
#他の人の回答例 後から見返す用
A = input()
n = len(A)-1
for i in range(2**n):
pn = ['-']*n
for j in range(n):
if ((i>>j)&1):
pn[n-1-j] = '+'
ans = A[0]+pn[0]+A[1]+pn[1]+A[2]+pn[2]+A[3]
if eval(ans) == 7:
print(ans+'=7')
break
|
p02924
|
s196103122
|
Accepted
|
N=int(input())
print(N*(N-1)//2)
|
p02663
|
s492226084
|
Wrong Answer
|
abc = [int(e) for e in input().split()]
H1 = abc[0]
M1 = abc[1]
H2 = abc[2]
M2 = abc[3]
K = abc[4]
start_time = H1 + M1/60
end_time = H2 + M2/60
valid_time = (end_time-start_time) * 60
if valid_time % K == 0:
valid_time = valid_time - 1
execution_time = valid_time // K
ans = execution_time * K
print(int(ans))
|
p02582
|
s361330824
|
Accepted
|
S=input()
if S[0]==S[1]==S[2]:
if S[0]=='R':
print(3)
else:
print(0)
elif S[0]==S[1]:
if S[0]=='R':
print(2)
else:
print(1)
elif S[1]==S[2]:
if S[1]=='R':
print(2)
else:
print(1)
else:
print(1)
|
p03544
|
s597503922
|
Wrong Answer
|
n = int(input())
l0 = 2
l1 = 1
sum_ = 0
for i in range(n-1):
sum_ = l0 + l1
l0 = l1
l1 = sum_
print(sum_)
|
p02988
|
s893378398
|
Accepted
|
N = int(input())
P = [int(i) for i in input().split()]
ans = 0
for i in range(N - 2):
if P[i] < P[i + 1] < P[i + 2] or P[i] > P[i + 1] > P[i + 2]:
ans += 1
print(ans)
|
p02912
|
s233453004
|
Wrong Answer
|
N,M = map(int,input().split())
A = sorted(list(map(int,input().split())),reverse = True)
while M > 0:
A[0] //= 2
M -= 1
for i in range(1,M):
if i < N and A[i] >= A[0]:
A[i] //= 2
else:
M -= i-1
A.sort(reverse = True)
break
print(sum(A))
|
p03821
|
s362463035
|
Accepted
|
n = int(input())
ab=[]
for i in range(n):
a,b = map(int,input().split())
ab.append([a,b])
ans = 0
for i in range(n-1,-1,-1):
c = (ab[i][0]+ans)%ab[i][1]
if c!=0:
ans += ab[i][1]-c
print(ans)
|
p03720
|
s108056479
|
Accepted
|
n,m=map(int, input().split())
r=[0]*n
for _ in range(m):
a,b=map(int, input().split())
r[a-1]+=1
r[b-1]+=1
for i in r:
print(i)
|
p02988
|
s356257900
|
Accepted
|
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(1, n-1):
if sorted([a[i-1], a[i], a[i+1]])[1]==a[i]:
ans+=1
print(ans)
|
p03721
|
s600626508
|
Accepted
|
n,k=map(int,input().split())
B=[0]*100001
for i in range(1,n+1):
a,b=map(int,input().split())
B[a]+=b
for j in range(1,10**5+1):
k-=B[j]
if k<=0:
print(j)
break
|
p03711
|
s896744122
|
Accepted
|
x, y = map(int, input().split())
check = [1,2,1,3,1,3,1,1,3,1,3,1]
if check[x-1]==check[y-1]:
print("Yes")
else:
print("No")
|
p02583
|
s633803925
|
Wrong Answer
|
from itertools import permutations
N = int(input())
L = list(map(int, input().split()))
ans = 0
for l in permutations(L, 3):
if set(l) != 3:
continue
if sum(l) - max(l) > max(l):
ans += 1
print(ans)
|
p03971
|
s415353442
|
Wrong Answer
|
n,a,b = map(int, input().split())
s = input()
c = 0
bi = 0
for i in range(n):
if s[i] == "a" and c < a+b:
print("Yes")
c += 1
elif s[i] == "b" and c < a+b and bi <= b:
print("Yes")
bi += 1
c += 1
else:
print("No")
|
p02789
|
s527294850
|
Accepted
|
n,m=input().split();print("Yes"if m==n else"No")
|
p03282
|
s656823026
|
Accepted
|
s = input()
k = int(input())
c1 = 0
num = ""
for c in s:
if c == "1":
c1 += 1
else:
num = c
break
if k <= c1:
print("1")
else:
print(num)
|
p02628
|
s392287196
|
Accepted
|
n,k=map(int,input().split())
p=list(map(int,input().split()))
p2=sorted(p)
ans=sum(p2[0:k])
print(ans)
|
p02683
|
s319003184
|
Accepted
|
N,M,X = map(int,input().split())
A = [list(map(int,input().split())) for n in range(N)]
a = 10**9
for i in range(2**N):
S = (M+1)*[0]
for j in range(N):
if (i>>j)&1:
S = [S[k]+A[j][k] for k in range(M+1)]
if all([X<=s for s in S[1:]]):
a = min(a,S[0])
if a==10**9:
print(-1)
else:
print(a)
|
p02640
|
s717565013
|
Accepted
|
def main():
x, y = map(int, input().split())
for i in range(x+1):
for j in range(x+1):
if i+j == x and 2*i + 4*j == y:
print("Yes")
return
print("No")
if __name__ == "__main__":
main()
|
p03796
|
s845597440
|
Wrong Answer
|
N = int(input())
x = 1
for i in range(1,N+1):
x = x*i
if x >= 10**9+7:
x = x-10**9-7
print(x%(10**+7))
|
p03779
|
s924327983
|
Wrong Answer
|
X = int(input())
for i in range(X):
if i*(i+1)//2 >= X:
print(i)
break
|
p03360
|
s879642583
|
Accepted
|
A, B, C = [int(i) for i in input().split()]
K = int(input())
m = max(A, B, C)
print(sum([A, B, C]) - m + m * 2 ** K)
|
p03721
|
s374932783
|
Wrong Answer
|
N, K = map(int, input().split())
A=[]
for i in range(N):
a, b = map(int, input().split())
A.append([a, b])
A.sort(key=lambda x:x[0])
cnt = 0
for i in range(N):
cnt += A[i][1]
if cnt >= N:
print(A[i][0])
break
|
p03493
|
s332419948
|
Accepted
|
a = map(str, input())
counter_list = []
for n in a:
counter_list.append(n)
print(counter_list.count('1'))
|
p03481
|
s801434787
|
Wrong Answer
|
X, Y = map(int, input().split())
ans = 1
while X <= Y:
X *= 2
ans += 1
print(ans)
|
p03385
|
s482771119
|
Accepted
|
s=input()
if s=="abc" or s=="acb" or s=="bac" or s=="bca" or s=="cab" or s=="cba":
print("Yes")
else:
print("No")
|
p03778
|
s378543747
|
Accepted
|
w,a,b=map(int,input().split())
if abs(a-b)>w:
print(abs(a-b)-w)
else:
print(0)
|
p03485
|
s904706735
|
Accepted
|
a, b = map(int, input().split())
if (a+b) % 2 == 0:
ans = (a+b) / 2
else:
ans = (a+b) // 2 + 1
print(int(ans))
|
p02973
|
s862336240
|
Accepted
|
import bisect
n = int(input())
A = [int(input()) for i in range(n)]
m = 10**9
X = []
for a in A:
i = bisect.bisect_right(X, -a)
if i == len(X):
X.append(-a)
else:
X[i] = -a
print(len(X))
|
p02597
|
s138534195
|
Accepted
|
N = int(input())
S = input()
r = S.count('R')
ans = r - S[:r].count('R')
print(ans)
|
p02595
|
s853670864
|
Accepted
|
R = lambda: map(int, raw_input().split())
n, d = R()
d = d ** 2
ans = 0
for i in xrange(n):
x, y = R()
if x ** 2 + y ** 2 <= d:
ans += 1
print ans
|
p04044
|
s886243023
|
Wrong Answer
|
import sys
a = list(map(int, input().split()))
b = []
for i in sys.stdin:
b.append(i)
b.sort()
c = ""
for j in b:
c += j
print(c)
|
p02854
|
s606577366
|
Wrong Answer
|
n = int(input())
a = list(map(int, input().split()))
result = 2020202020
for i in range(1, n-1):
result = min(result, abs(sum(a[:i+1]) - sum(a[i+1:])))
print(result)
|
p02584
|
s177813912
|
Accepted
|
import sys
input = sys.stdin.readline
x, k, d = map(int, input().split())
tmp = abs(x) // d
if k < tmp:
result = abs(abs(x) - d*k)
elif tmp%2 == k%2:
result = abs(abs(x) - d*tmp)
else:
a = result = abs(abs(x) - d*tmp)
result = abs(abs(a) - d)
print(result)
|
p03971
|
s183224901
|
Accepted
|
n, a, b = map(int, input().split())
s = input()
count = 0
countB = 0
for i in range(n):
if s[i] == 'a':
if count < a+b:
print('Yes')
count += 1
else:
print('No')
elif s[i] == 'b':
if count < a+b and countB < b:
print('Yes')
count += 1
countB += 1
else:
print('No')
else:
print('No')
|
p04031
|
s369397828
|
Accepted
|
n=int(input())
lst=list(map(int,input().split()))
ave=sum(lst)/n
if ave%1>=0.5:
import math
ave=math.ceil(ave)
else:
ave//=1
ans=0
for i in lst:
ans+=(abs(i-ave))**2
print(int(ans))
|
p03455
|
s242196605
|
Accepted
|
a,b = map(int,input().split())
if a*b%2 == 0:
print("Even")
else:
print("Odd")
|
p02730
|
s500897263
|
Wrong Answer
|
import sys
S = input()
N = len(S)
if (not S.islower()):
sys.exit()
if (N < 3 or N > 99):
sys.exit()
if (N%2 == 0):
sys.exit()
av = (N-1)/2
av = int(av)
av2 = (N+3)/2
av2 = int(av2)
pal = S[0:av]
pal2 = S[av2-1:N]
if (pal == pal2[::-1]):
if (pal == pal[::-1] and pal2 == pal2[::-1]):
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.