problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p02690 | s260510169 | Accepted | M=120
c=M*M
exec(c*2*f'i,j=c%M,c//M;c-=i**5-j**5!={input()}or exit(print(i,j));') |
p02909 | s980189214 | Accepted | S = input()
if S == 'Sunny':
print('Cloudy')
elif S == 'Cloudy':
print('Rainy')
else:
print('Sunny')
|
p03351 | s041597515 | Accepted | a,b,c,d=map(int,input().split())
if abs(a-c)<=d or (abs(a-b)<=d and abs(c-b)<=d):print("Yes")
else:print("No") |
p02910 | s821666233 | Wrong Answer | ipt = str(input())
S = ipt.split()
gs = 1
ks = 0
rtu = "Yes"
while gs <= len(S) - 1:
if S[ks] == "L":
rtu = "No"
break
elif S[gs] == "R":
rtu = "No"
break
gs += 1
ks += 1
print(rtu) |
p02615 | s532365619 | Wrong Answer | n = int(input())
a = sorted(list(map(int, input().split())))[::-1]
ans = 0
min_a = a[0]
for i in range(len(a)-1):
ans += min_a
if min_a > a[i+1]:
min_a = a[i+1]
print(ans) |
p03556 | s330332490 | Accepted |
n = int(input())
x = 1
while x ** 2 <= n:
x += 1
print((x-1) ** 2)
|
p03605 | s175499327 | Accepted | '''
問題:
今、日本は 9 月 9 日です。
二桁の整数 N が与えられるので、十進法で N に 9 が含まれるか答えてください。
'''
'''
制約:
10 ≦ N ≦ 99
'''
# 標準入力から N を取得する
n = int(input())
result = ""
if n % 10 == 9: # 1の位が 9
result = "Yes"
elif 90 <= n % 100 < 100: # 10の位が 9
result = "Yes"
else:
result = "No"
print(result)
|
p02727 | s331799133 | Accepted | a,b,red,green,cl = map(int,input().split())
r = sorted(list(map(int,input().split())))[::-1]
g = sorted(list(map(int,input().split())))[::-1]
c = sorted(list(map(int,input().split())))[::-1]
s = sorted(r[:a]+g[:b]+c)[::-1]
print(sum(s[:a+b]))
|
p02768 | s246930694 | Accepted | n,a,b=map(int,input().split())
mod=10**9+7
A=1
for i in range(n,n-a,-1):
A*=i
A%=mod
y=1
for i in range(1,a+1):
y*=i
y%=mod
A*=pow(y,10**9+5,mod)
A%=mod
B=1
for i in range(n,n-b,-1):
B*=i
B%=mod
y=1
for i in range(1,b+1):
y*=i
y%=mod
B*=pow(y,10**9+5,mod)
B%=mod
print((pow(2,n,mod)-1-A-B)%mod)
|
p03087 | s675151566 | Wrong Answer | n,q=map(int,input().split())
s=input()
cnt=[0]*(n+1)
for i in range(1,n+1):
cnt[i]=s.count('AC',0,i)
for _ in range(q):
l,r=map(int,input().split())
print(cnt[r]-cnt[l-1]) |
p03145 | s551231093 | Accepted | a,b,c=map(int,input().split())
ans=a*b//2
print(ans) |
p03910 | s967191920 | Accepted | n = int(input())
def ok(x):
return x*(x+1)//2 >= n
for x in range(1,n+1):
if ok(x):
ans = []
v = x*(x+1)//2 - n
for i in range(1,x+1):
if i == v:continue
ans.append(i)
break
else:continue
print(*ans) |
p03264 | s317468802 | Accepted | k = int(input())
if k % 2 == 0:
odd = k // 2
even = k // 2
else:
odd = k // 2
even = k // 2 + 1
print(odd * even)
|
p03131 | s438102295 | Wrong Answer | k, a, b = map(int,input().split())
if b - a <= 2:
print(k+1)
else:
if ((k-(a-1))//2) <= 2:
print(((k-(a-1))//2)*(b)+((k-(a-1))//2)%2)
else:
print(((k-(a-1))//2)*(b-a)+((k-(a-1))//2)%2) |
p03254 | s278944210 | Accepted | N, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
n = 0
if x > sum(a):
print(N-1)
exit()
for i in a:
if x >= i:
x -= i
n += 1
else:
break
print(n) |
p02628 | s187284811 | Accepted | n,k=map(int,input().split())
p=list(map(int,input().split()))
print(sum(sorted(p)[:k])) |
p03339 | s563955046 | Accepted | inf = float('inf')
n = int(input())
s = input()
right_e = s.count("E")
left_w = 0
cnt = inf
for e in s:
if e == "W":
cnt = min(cnt, right_e + left_w)
left_w += 1
else:
right_e -= 1
cnt = min(cnt, right_e + left_w)
print(cnt) |
p03565 | s134281292 | Accepted | s = input()
t = input()
l0 = len(s)
l = len(t)
def chk(n):
x = s[n:n+l]
flg = True
for j in range(l):
if x[j] != t[j] and x[j] != "?":
flg = False
return flg
res = []
for i in range(l0 - l + 1):
if chk(i):
res.append(i)
ans = []
if not res:
print("UNRESTORABLE")
else:
p = res[-1]
y = s[:p] + t + s[p+l:]
z = y.replace("?", "a")
print(z)
|
p02773 | s879289454 | Accepted | #C
#入力
N=int(input())
S=[input() for i in range(N)]
#処理
result={}
for i in S:
if i in result:
result[i]+=1
else:
result[i]=1
x=max(result.values())
Z=[]
for i in result.items():
if i[1]==x:
Z.append(i[0])
Z.sort()
for i in Z:
print(i) |
p02973 | s946675836 | Wrong Answer | from queue import deque
n = int(input())
a = deque([int(input()) for _ in range(n)])
point = 0
while len(a) >= 2:
point += 1
li = []
now = a.popleft()
for i in range(1,len(a)+1):
j = a.popleft()
if j <= now:
li += [j]
a = deque(li[:])
if a:
point += 1
print(point) |
p02742 | s260482503 | Accepted | a, b= map(int, input().split())
if (a==1)or(b==1):
print('1')
elif a*b%2==0:
c=(a*b)//2
print(c)
else:
c=((a*b)//2)+1
print(c) |
p04043 | s823703214 | Accepted | # -*- coding: utf-8 -*-
# スペース区切りの整数の入力
A, B, C = map(int, input().split())
# 文字列の入力
#s = input()
#print(s[0:K-1]+s[K-1].lower()+s[K:N])
if A*B*C == 5*5*7:
print("YES")
else:
print("NO")
|
p02598 | s744783629 | Wrong Answer | #!/usr/bin/env python3
from math import ceil
EPS = 1e-8
n, k = map(int, input().split())
a = list(map(int, input().split()))
def f(p):
c = 0
for x in a:
c += (x + p - 1) // p - 1
return c
ok, ng = 0, max(a)
while abs(ok - ng) > 1:
m = (ok + ng) / 2
if f(m) > k:
ok = m
else:
ng = m
print(ceil(ok) + 1)
|
p02726 | s519867425 | Accepted | N,X,Y=map(int,input().split())
k=[0]*(N-1)
for i in range(N):
for j in range(i+1,N):
k[min(j-i,abs(j+1-Y)+1+abs(i+1-X))-1]+=1
for i in range(N-1):
print(k[i]) |
p02866 | s444944443 | Wrong Answer | MOD = 998244353
N = int(input())
D = list(map(int,input().split()))
lis = [0] * (max(D)+1)
for i in D:
lis[i] += 1
if lis[0] == 0 or lis[0] > 1:
print(0)
exit()
ans = 1
for i in range(1,len(lis)):
ans *= pow(lis[i-1],lis[i], MOD)
ans %= MOD
print(ans)
|
p02660 | s447339917 | Accepted | def f(n):
res = []
for p in range(2, int(n**0.5)):
k = 0
while(n % p == 0):
n //= p
k += 1
if k:
res.append((p, k))
if n != 1:
res.append((n,1))
return res
n = int(input())
ans = 0
r = f(n)
for p,k in r:
tmp = 0
cur = 1
while(k>=cur):
tmp += 1
k -= cur
cur += 1
ans += tmp
print(ans) |
p02973 | s238570881 | Wrong Answer | n = int(input())
a = [int(input()) for i in range(n)]
cnt = 0
ans = 0
for i in range(1,n):
if a[i] <= a[i-1]:
cnt += 1
else:
ans = max(ans, cnt)
cnt = 0
ans = max(ans, cnt)
print (ans + 1) |
p02773 | s638568749 | Accepted | def resolve():
N = int(input())
S = [str(input()) for _ in range(N)]
words = dict(zip(set(S), [0] * len(S)))
for s in S:
if s in words:
words[s] += 1
words = sorted(words.items(), key=lambda x: x[1], reverse=True)
mx = words[0][1]
words = sorted(words, key=lambda x: x[0])
for word in words:
if word[1] == mx:
print(word[0])
return
resolve() |
p03069 | s572439315 | Wrong Answer | N = int(input())
S = input()
max_w = S.count(".")
ans = float("inf")
b, w = 0, max_w
for s in S:
if s == "#":
b += 1
else:
w -= 1
ans = min(ans, b+w)
print(ans) |
p02641 | s612401182 | Accepted | x,n=map(int,input().split())
import sys
if n==0:
print(x)
sys.exit()
p=list(map(int,input().split()))
if x not in p:
print(x)
sys.exit()
min=x
max=x
while True:
min-=1
max+=1
if min not in p:
ans=min
break
if max not in p:
ans=max
break
print(ans) |
p02582 | s696738275 | Accepted | S = input()
count = 0
mcount = 0
for i in range(len(S)):
if(S[i] == 'S'):
count = 0
elif(S[i] == 'R'):
count += 1
if(count>mcount):
mcount = count
print(mcount)
|
p03150 | s061621093 | Accepted | S = input()
if S == "keyence":
print("YES")
exit()
for i in range(len(S)-1):
for j in range(i+1, len(S)):
if S[:i]+S[j:] == "keyence":
print("YES")
exit()
print("NO") |
p02946 | s276125441 | Accepted | import sys
lines = [s.rstrip("\n") for s in sys.stdin.readlines()]
k, x = [int(num) for num in lines.pop(0).split(" ")]
lis = [str(n) for n in range(x - k + 1, x + k)]
print(" ".join(lis))
|
p02661 | s180850137 | Wrong Answer | from sys import stdin
input = stdin.readline
N = int(input())
ab = [list(map(int, input().split())) for _ in range(N)]
ab.sort()
ran = []
for a, b in ab:
ran.append(b - a + 1)
ran.sort()
if N % 2 == 0:
print(ran[N // 2] * 2 - 1)
else:
print(ran[N // 2])
|
p02748 | s663204015 | Accepted | A,B,M=map(int,input().split())
Rcost=list(map(int,input().split()))
Lcost=list(map(int,input().split()))
ans=min(Rcost)+min(Lcost)
for i in range(M):
x,y,c=map(int,input().split())
tmp=Rcost[x-1]+Lcost[y-1]-c
ans=min(tmp,ans)
print(ans) |
p03487 | s168952570 | Wrong Answer | n = int(input())
a = list(map(int, input().split()))
from collections import defaultdict
d = defaultdict(int)
for num in a:
d[num]+=1
ans=0
for k,v in d.items():
ans+=min(v,abs(k-v))
print(ans) |
p03645 | s742910971 | Wrong Answer | n,m=map(int,input().split())
ark={}
for i in range(m):
a,b=map(int,input().split())
ark[a]=b
ark[b]=a
for i in range(2,n):
if ark[1]==i and ark[i]==n:
print('POSSIBLE')
exit()
print('IMPOSSIBLE')
|
p03548 | s770741985 | Accepted | MM = input().split()
X = int(MM[0])
Y = int(MM[1])
Z = int(MM[2])
x = 0
while True:
if x*(Y+Z)+Z >X:
break
else:
x +=1
print(x-1) |
p03478 | s112701482 | Accepted | n,a,b = map(int, input().split())
total = 0
for i in range(1,n+1):
array = list(map(int,str(i)))
if a<= sum(array) and sum(array)<=b :
total += i
print(total)
|
p02732 | s635764225 | Wrong Answer | import numpy as np
import functools
import math
import collections
import scipy
import fractions
import itertools
def solve():
n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)
s = 0
for i in list(c.values()):
s += i*(i-1)//2
print(c)
for i in a:
print(s-(c[i]-1))
return 0
if __name__ == "__main__":
solve()
|
p02618 | s327098158 | Accepted | D = int(input())
c = list(map(int, input().split()))
s = []
for i in range(D):
s.append(list(map(int, input().split())))
last = [0] * 26
for d in range(D):
max = 0
argmax = -1
for t in range(26):
if max < s[d][t]:
max = s[d][t]
argmax = t
print(argmax + 1) |
p03665 | s564051070 | Wrong Answer | N,P = map(int,input().split())
A = list(map(int,input().split()))
ZeroOne = [0,0]
for a in A:
if(a % 2 == 0):
ZeroOne[0] += 1
else:
ZeroOne[1] += 1
print(2 ** (ZeroOne[0]+ZeroOne[1] - 1))
|
p02836 | s812253764 | Accepted | X=input()
def split(w):
return [all for all in w]
before=split(X[0:int(len(X)/2)])
after=split(X[int(len(X)/2):])
c=0
ans=0
reverse=-1
if len(X)%2==1:
after=after[1:]
for i in after:
if after[c]!=before[reverse]:
ans+=1
c+=1
reverse-=1
print(ans) |
p03797 | s891707267 | Accepted | s,c=map(int,input().split())
if 2*s<=c: print((s+c//2)//2)
else: print(c//2) |
p02689 | s452657814 | Accepted | N,M=map(int, input().split())
H = list(map(int, input().split()))
#AB=[list(map(int,list(input().split()))) for i in range(M)]
good = list(range(1,N+1))
good = [1]*N
for j in range(M):
a,b=map(int, input().split())
#print(a,b)
if H[a-1]>H[b-1]:
#good.remove(b)
good[b-1] = 0
elif H[a-1]<H[b-1]:
#good.remove(a)
good[a-1] = 0
elif H[a-1]==H[b-1]:
good[a-1] = 0
good[b-1] = 0
#print(good)
print(sum(good)) |
p02572 | s434016005 | Accepted | n = int(input())
A = list(map(int, input().split()))
mod = 10 ** 9 + 7
summ = 0
quadsum = 0
for k in range(n):
summ = (summ + A[k]) % mod
quadsum = (quadsum + A[k]*A[k])%mod
ans = (summ*summ)%mod - quadsum
if ans % 2 == 1:
ans += mod
ans = (ans/2)%mod
print(int(ans)) |
p02612 | s760197325 | Wrong Answer | n = int(input())
if n%1000 == 1:
print(0)
else:
print(1000-n%1000) |
p02622 | s913854852 | Accepted | s = input()
t = input()
ans = 0
for i in range(len(s)):
if s[i] != t[i]:
ans += 1
print(ans)
|
p03011 | s141826736 | Accepted | a,b,c = map(int,input().split())
dummy = max(a,b,c)
print(a+b+c-dummy) |
p02909 | s568615741 | Accepted | S = input()
if S == 'Sunny':
print('Cloudy')
elif S == 'Cloudy':
print('Rainy')
else:
print('Sunny') |
p03250 | s633241441 | Accepted | A,B,C = map(int,input().split())
li = [A,B,C]
li.sort(reverse = True)
ans1 = li[0]*10+li[1]
ans2 =li[2]
ans = ans1 + ans2
print(ans) |
p03150 | s116676892 | Accepted | S=input()
T='keyence'
if S.count(T)>0:
print('YES')
exit()
for i in range(1, 7):
if S[:i]==T[:i] and S[-7+i:]==T[-7+i:]:
print('YES')
exit()
print('NO') |
p03105 | s239173496 | Accepted | A,B,C = map(int,input().split())
print(min(C,B//A)) |
p03644 | s007608811 | Accepted | N = int(input())
ans = 0
res = 0
for i in range(1,N+1):
tmp = i
cnt = 0
while True:
if tmp%2 == 0:
cnt += 1
tmp = tmp//2
else:
break
if ans <= cnt:
res = i
ans = cnt
print(res) |
p02612 | s508374509 | Wrong Answer | print(int(input())%1000) |
p02627 | s612867263 | Accepted | a = input()
if a == a.lower(): print("a")
else: print("A")
|
p02596 | s480626801 | Wrong Answer | import math
k = int(input())
sevens = []
for i in range(1, 6):
sevens.append("7"*i)
sevens2 = [int(s) for s in sevens]
ans = []
for i in range(0, len(sevens)):
if sevens2[i]%k == 0:
ans.append(i+1)
if ans:
print(min(ans))
elif k%2 == 0:
print(-1)
elif k ==5:
print(-1)
elif k ==9:
print(-1)
else:
print(k-1) |
p03239 | s384605419 | Accepted | N, T = map(int,input().split())
cost_min = 1e9
for i in range(N):
c, t = map(int,input().split())
if t <= T:
if c < cost_min:
cost_min = c
if cost_min == 1e9:
print("TLE")
else:
print(cost_min) |
p02612 | s608348800 | Accepted | import math
N = int(input())
x = math.ceil(N/1000) * 1000
print(x-N) |
p03494 | s845190047 | Accepted | N=int(input())
A=list(map(int, input().split()))
B=[0] * N
for i in range(N):
while A[i] % 2 == 0:
A[i] /= 2
B[i] += 1
print(min(B)) if min(B) > 0 else print(0) |
p02939 | s469567889 | Accepted | S = input()
ans, prev, cur = 0, "", ""
for s in S:
cur += s
if cur != prev:
ans += 1
prev, cur = cur, ""
print(ans) |
p02695 | s131056085 | Wrong Answer | from itertools import combinations_with_replacement as cmb
n,m,q=map(int,input().split())
abcd=[]
for i in range(q):
ll=map(int,input().split())
ll=[ww-1 for ww in ll]
abcd.append(ll)
ans=0
for li in cmb(range(1,m+1),n):
kari=0
for i in abcd:
if li[i[1]]-li[i[0]]==i[2]+1:
kari+=i[3]+1
print(li,kari)
ans=max(ans,kari)
print(ans) |
p03471 | s133921123 | Accepted | N, Y = map(int, input().split())
a = 0
for i in range(N+1):
for ii in range(N+1):
iii = N - i - ii
if iii < 0:
break
ans = 10000 * i + 5000 * ii + 1000 * iii
if ans == Y:
print(i,ii,iii)
a += 1
break
if a != 0:
break
if a == 0:
print(-1,-1,-1)
|
p03030 | s604326116 | Accepted | n = int(input())
sList = []
for i in range(n):
sList.append(list(input().split())+[i+1])
sList[i][1] = -1*int(sList[i][1])
sList.sort()
for i in sList:
print(i[2])
|
p02833 | s536384563 | Accepted | n = int(input())
if n%2 == 0:
i = 1
ans = 0
while 2*pow(5,i) <= n:
ans += n//(2*pow(5,i))
i += 1
print(ans)
else:
print(0) |
p03011 | s369603433 | Accepted | P, Q, R = list(map(int, input().split()))
print(min(P+Q, Q+R, R+P))
|
p02836 | s198139218 | Wrong Answer | a=list(str(input()))
b=a[::-1]
cnt = 0
for i in range(len(a)):
if a[i] != b[i]:
cnt+=1
print(cnt) |
p03438 | s619147658 | Wrong Answer | def check():
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
diff = sum(B)-sum(A)
if diff < 0:
return 'No'
cnt = 0
for i in range(N):
cnt += max(B[i]-A[i],0)
if diff*2 < cnt:
return 'No'
return 'Yes'
print(check()) |
p02753 | s418646722 | Accepted | s = input()
if s == 'AAA' or s == 'BBB':
print('No')
else:
print('Yes')
|
p02697 | s645622647 | Wrong Answer | N, M = map(int, input().split())
for i in range(1,M+1):
print(i, N-i+1) |
p03486 | s280728154 | Wrong Answer | s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
s="".join(s)
t="".join(t)
for i in range(min(len(s),len(t))):
if ord(s[i])==ord(t[i]):
continue
elif ord(s[i])<ord(t[i]):
print("Yes")
break
else:
print("No")
else:
print("No") |
p03795 | s869915156 | Wrong Answer | N = int(input())
import math
x=N*800
y=(math.ceil(N/15)-N//15)*200
print(x-y) |
p02881 | s240634102 | Accepted | import math
n=int(input())
for i in reversed(range(1,int(math.sqrt(n))+1)):
if n%i == 0:
ans = i+n//i-2
break
print(ans)
|
p02720 | s717367306 | Accepted | import sys
sys.setrecursionlimit(10**6)
def DFS(num):
A.add(int(num))
n=int(num[-1])
for i in (max(n-1,0),n,min(n+1,9)):
i=str(i)
A.add(int(num+i))
if len(num)<=8:DFS(num+i)
n=int(input())
A=set()
for i in range(1,10):
DFS(str(i))
A=sorted(A)
print(A[n-1]) |
p03721 | s918128193 | Wrong Answer | n,k=map(int,input().split())
a=[[int(i) for i in input().split()] for i in range(n)]
b=[0]*((10**5)+1)
for i in a:
b[i[0]]+=i[1]
x=0
for i in range(10**5):
x+=b[i]
if x>=k:
print(i)
exit() |
p03485 | s359061036 | Accepted | import math
A, B = map(int, input().split())
print(math.ceil((A+B)/2)) |
p02755 | s569050107 | Wrong Answer | import math
A, B = [int(i) for i in input().split()]
ans = []
for i in range(10):
for j in range(10):
A_float = A + 0.1 * i
B_float = B + 0.1 * j
x_a = math.floor(A_float / 0.08)
x_b = math.floor(B_float / 0.1)
if x_a == x_b:
ans.append(x_a)
if len(ans) > 0:
print(min(ans))
else:
print(-1) |
p03495 | s279040064 | Wrong Answer | n,k = map(int,input().split())
a = list(map(int,input().split()))
if(len(set(a)) <= k):
print(0)
else:
dic_a = {x:0 for x in set(a)}
for i in a:
dic_a[i] += 1
sum = 0
af = sorted(dic_a.items(), key=lambda x: x[0])
for i in range(k,len(set(a))):
sum += af[i][1]
print(sum) |
p02829 | s096102500 | Wrong Answer | import sys
read=sys.stdin.buffer.read
A,B=map(int,read().split())
l=[1,2,3]
res = filter(lambda x:x!=A and x!=B, l)
print(res) |
p03351 | s615595430 | Accepted | a,b,c,d=map(int,input().split())
print("Yes" if (abs(b-a)<=d and abs(c-b)<=d) or abs(c-a)<=d else "No")
|
p03612 | s549957349 | Accepted | n = int(raw_input())
count = 0
res = 0
ais = map(int , raw_input().split())
for i,a in enumerate(ais):
if a == i +1:
count += 1
else:
#flush the count
res += (count + 1)/2# + 1
count = 0
if count: res += (count+1)/2
print res |
p03345 | s812149724 | Accepted | a, b, c, k = map(int, input().split())
ans = a - b
if abs(ans) > 1e18 :
print("Unfair")
elif k % 2 == 0 :
print(ans)
else :
print(-ans)
|
p02706 | s303271633 | Accepted | N, M = map(int, input().split(' '))
syuku = list(map(int, input().split(' ')))
result = N - sum(syuku)
print(result) if result >= 0 else print('-1')
|
p02631 | s733673161 | Accepted | N = int(input())
a = 0
l = []
for i in map(int,input().split()):
l.append(i)
a = a ^ i
for i in l:
print(a ^ i) |
p02756 | s000456798 | Wrong Answer | print("xy") |
p03962 | s811625741 | Wrong Answer | print(len(set(input()))-1) |
p03799 | s719762734 | Wrong Answer | s,c = map(int,input().split(" "))
count = 0
if s == 0:
print(c // 3)
else:
count += min(s,c // 2)
c -= s * 2
count += c // 4
print(count)
|
p02866 | s260193921 | Wrong Answer | from collections import Counter
N = int(input())
*D, = map(int, input().split())
mod = 998244353
c = Counter(D)
v = max(D)
if c[0]!=1 or v>N-1:
print(0)
else:
ans = 1
for i in range(1, v+1):
ans *= (c[i-1]**c[i])
ans %= mod
print(ans) |
p03106 | s814747445 | Accepted | A, B, K = map(int, input().split())
ans = []
for i in range(1, 101):
if A % i == 0 and B % i == 0:
ans.append(i)
print(ans[-K])
|
p02732 | s853817482 | Wrong Answer | from collections import Counter
n=int(input())
a=list(map(int,input().split()))
C=Counter(a)
#print(C)
total=0
for k,v in C.items():
if v>=2:
total+=v*(v-1)//2
print(total)
for i in range(n):
V=C[a[i]]
ans=total-(V*(V-1))//2+((V-1)*(V-2))//2
print(ans) |
p02690 | s716616337 | Accepted | import sys
import heapq
from decimal import Decimal
input = sys.stdin.readline
x = int(input())
for i in range(1,1000):
for j in range(-1000,1000):
if i**5 - j**5 == x:
print(i,j)
exit(0) |
p02917 | s660347195 | Accepted | n=int(input())
b=list(map(int,input().split()))
ans=0
a=[]
a.append(b[0])
for i in range(1,n-1):
a.append(min(b[i-1],b[i]))
a.append(b[n-2])
for i in range(n):
ans+=a[i]
print(ans)
|
p02725 | s187481462 | Accepted | k, n = [int(elem) for elem in input().split()]
a_lst = [int(elem) for elem in input().split()]
diff = []
for i, a in enumerate(a_lst[:-1]):
diff.append(a_lst[i+1] - a)
diff.append((a_lst[0] + k) - a_lst[-1])
res = sum(diff) - max(diff)
print(res) |
p02744 | s397262022 | Wrong Answer | from itertools import permutations
N = int(input())
ans = []
for p in permutations(range(N)):
D = [-1] * N
A = []
for i in range(N):
for j in range(N):
if D[j] < p[i]:
D[j] = p[i]
A.append(j)
break
ans.append(A)
ans.sort()
for a in ans:
s = ''.join(map(lambda x:chr(x+97),a))
print(s) |
p02726 | s909969470 | Accepted | n,x,y=map(int,input().split())
anslist = [0]*(n)
temp = 0
for i in range(1,n):
for j in range(i+1,n+1):
temp = min(abs(j-i),(abs(x-i)+1+abs(y-j)),(abs(y-i)+1+abs(x-j)))
anslist[temp] += 1
anslist.pop(0)
for i in anslist:
print(i) |
p02688 | s231059037 | Accepted | n,k = map(int,input().split())
d = []
a = []
for _ in range(k):
d.append(int(input()))
a.append(list(map(int,input().split())))
ans = [1] * n
for i in range(k):
for j in range(d[i]):
if ans[a[i][j]-1] == 1:
ans[a[i][j]-1] = 0
print(sum(ans)) |
p02594 | s655308643 | Accepted | x = int(input())
if x>= 30 :
print('Yes')
else:
print('No') |
p04044 | s031159990 | Wrong Answer | n, l = map(int, input().split())
a = [[] * l for i in range(n)]
for i in range(n):
I = input()
for j in range(l):
a[i].append(I[j])
# print(a)
b = a
for i in range(l):
b = sorted(b, key=lambda x: x[i])
ans = []
for i in range(n):
ans.append("".join(b[i]))
print("".join(ans))
|
p03067 | s508409861 | Accepted | a, b, c = map(int, input().split())
if a<c<b or b<c<a:
print('Yes')
else:
print('No') |
p03000 | s425807440 | Accepted | N,X = map(int,input().split())
L = list(map(int,input().split()))
counter = 1
total = 0
for l in L:
total+=l
if(total <=X):counter+=1
print(counter)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.