problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p03711 | s507132928 | Accepted | x,y=map(int,input().split())
A=[1,3,5,7,8,10,12]
B=[4,6,9,11]
if x==2 or y==2:
print('No')
elif (x in A and y in A) or (x in B and y in B):
print('Yes')
else:
print('No') |
p03043 | s267423071 | Accepted | import math
n,k=map(int,input().split())
temp=0
for i in range(1,n+1):
if k<i:temp+=1
else:temp+=2**(-math.ceil(math.log(k/i,2)))
print(temp/n)
|
p03126 | s932400249 | Accepted | N,M = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(N)]
fond = [0]*(M+1)
for i in A:
for j in i[1:]:
fond[j] += 1
print(fond.count(N)) |
p03211 | s153913782 | Wrong Answer | S = list(input())
ans = 1000
L = len(S)
for i in range(L):
if L - 1 < i + 2:
break
s = int("".join(S[i:i+3]))
ans = min(ans,753-s)
print(ans)
|
p03633 | s169906569 | Wrong Answer | from functools import reduce
from fractions import gcd
N = int(input())
T = []
for i in range(N):
T.append(int(input()))
x = reduce(gcd,T)
sum=0
for i in T:
sum*=(x*i)
print(sum) |
p03773 | s386051012 | Wrong Answer | a,b = map(int,input().split())
x = (a+b)%24
if x==0:
x=24
print(x) |
p02661 | s107868418 | Wrong Answer | import statistics
n=int(input())
a = [[int(i) for i in input().split()] for j in range(n)]
min=[i[0] for i in a]
max=[i[1] for i in a]
if n%2==0:
print(int(statistics.median(max)-statistics.median(min))*2+1)
else:
print(int(statistics.median(max)-statistics.median(min))+1) |
p02801 | s815501379 | Wrong Answer | val = input("enter the character")
i=ord(val)
i = i+1
chr(i)
print("", chr(i)) |
p03387 | s908591082 | Wrong Answer | A,B,C=map(int,input().split())
s=[A,B,C]
t=sorted(s)
u=(t[2]-t[0],t[2]-t[1],0)
if u[0]%2==0 and u[1]%2==0:
print((u[0]+u[1])/2)
elif u[0]%2==1 and u[1]%2==1:
print(1+u[0]//2+u[1]//2)
else:
print(u[0]//2+u[1]//2+2)
|
p02708 | s740442432 | Accepted | MOD = 10 ** 9 + 7
n,k = map(int,input().split())
ans = 0
for i in range(k,n+2):
add = -i**2 + i*(n+1) + 1
add %= MOD
ans += add
ans %= MOD
print(ans)
|
p03943 | s660390690 | Accepted | a, b, c = map(int, input().split())
if a+b == c:
print('Yes')
elif a+c == b:
print('Yes')
elif b+c == a:
print('Yes')
else:
print('No') |
p03695 | s339231220 | Wrong Answer | n = int(input())
a = list(map(int,input().split()))
x = [0]*8
m = 0
for i in a:
if i//400<8:
x[i//400]+=1
else:
m+=1
ans1 = max(1,8-x.count(0))
ans2 = ans1+m
print(ans1,ans2) |
p04033 | s835459021 | Wrong Answer | a = list(map(int,input().split()))
if a[0] == 0 or a[1] == 0:
print("Zero")
elif a[0] == abs(a[0]) and a[1] == abs(a[1]):
print("Positive")
elif a[0] != abs(a[0]) and a[1] != abs(a[1]):
print("Negative")
elif a[0] != abs(a[0]) or a[1] != abs(a[1]):
print("Zero") |
p03211 | s795314290 | Wrong Answer | S = input()
num = ""
l = len(S)
dis = float("inf")
for i in range(l-2):
num = S[i:i+3]
if abs(787-int(num)) < dis:
dis = abs(753-int(num))
print(dis) |
p03261 | s597584944 | Wrong Answer | n=int(input())
w=[]
flag=True
for i in range(n):
w.append(input())
for i in range(n-1):
if w[i][-1]!=w[i+1][0]:
flag=False
for i in range(n-1):
for j in range(i+1,n):
if(w[i]!=w[j]):
flag=False
if flag==True:
print("Yes")
else:
print("No")
|
p03407 | s811557285 | Accepted | a,b,c=map(int,input().split())
if a+b>=c:
print("Yes")
else:
print("No") |
p02766 | s208960015 | Accepted | N, K = map(int, input().split())
out = []
while 1:
out.append(N%K)
N = int(N/K)
if N == 0:
break
elif 0 < N <= K-1:
out.append(K-1)
break
print(len(out)) |
p03386 | s121953973 | Wrong Answer | A, B, K = map(int, input().split())
for a in range(A, A+K):
print(a)
for b in range(B-K+1, B+1):
print(b) |
p03612 | s577807314 | Wrong Answer | n=int(input())
*p,=map(int,input().split())
order=1
cnt=0
a=[]
for i in p:
if i==order:
a.append(False)
else:
a.append(True)
order+=1
for i in range(n-1):
if a[i]==False and a[i+1]==False:
a[i]=True
a[i+1]=True
cnt+=1
elif a[i]==False and a[i+1]==True:
a[i]=True
a[i+1]=True
cnt+=1
print(cnt)
|
p03835 | s292102351 | Accepted | k,s=map(int,input().split())
ans=0
for x in range(k+1): #xは 0~kまで x=0,1,2,.....k
for y in range(x,k+1): #yはx~k+1まで,
z = s-(x+y) #zはxとyできまる, このときxyzの組み合わせが確定して評価する.
if z>k or z<y:
continue
if x == y and y == z: #x=y=z
ans+=1
elif x==y or y == z or z==x:
ans+=3
else:
ans+=6
print(ans) |
p02982 | s212182659 | Accepted | import numpy as np
N, D = map(int, input().split())
X = np.array([list(map(int, input().split())) for i in range(N)])
ans = 0
for n in range(N):
for i in range(n+1, N):
if np.linalg.norm(X[n]-X[i]).is_integer():
ans += 1
print(ans) |
p02760 | s165436796 | Wrong Answer | d=[list(map(int,input().split()))for i in range(3)]
row=int(input())
num=[int(input()) for j in range(row)]
bingo=0
for a in range(3):
if d[0][a] and d[1][a] and d[2][a] in num:
bingo=bingo+1
if d[a][0] and d[a][1] and d[a][2] in num:
bingo=bingo+1
if d[1][1] and d[2][2] and d[0][0] in num:
bingo=bingo+1
if d[0][1] and d[2][2] and d[1][0] in num:
bingo=bingo+1
if bingo>0:
print('Yes')
else:
print('No') |
p02802 | s749463175 | Wrong Answer | n,m = map(int,input().split())
l=list(input().split() for _ in range(m))
q=[0]*n
w=0
a=0
for i in l:
if q[int(i[0])-1]==0:
if i[1]=="WA":
w+=1
elif i[1]=="AC":
a+=1
q[int(i[0])-1]+=1
print(a,w) |
p02742 | s287258594 | Wrong Answer | h,w = map(int,input().split())
print((h * w)/2) |
p03293 | s501114309 | Wrong Answer | s = input()
t = input()
flag = True
for i in range(len(s)):
if s[i] != t[-i-1]:
flag = False
if flag:
print("Yes")
else:
print("No")
|
p02603 | s709981431 | Accepted | n = int(input())
rates = list(map(int, input().split(' ')))
pocket = 1000
kabu = 0
for i,rate in enumerate(rates):
day = i+1
if day == n:
pocket += kabu*rate
kabu = 0
break
if rate < rates[i+1]:
#買えるだけ買う
buy_kabu = pocket // rate
pocket -= buy_kabu*rate
kabu += buy_kabu
elif rate > rates[i+1]:
#売れるだけ売る
pocket += kabu*rate
kabu = 0
print(pocket) |
p02946 | s176051636 | Accepted | k, x = map(int, input().split())
print(' '.join(map(str, list(range(x - (k - 1), x + k))))) |
p02836 | s735549368 | Accepted | s = input()
ans = 0
for i in range(len(s) // 2):
if s[i] != s[len(s) - i - 1]: ans += 1
print(ans)
|
p03221 | s989931362 | Accepted | #!/usr/bin/env python3
n, m = list(map(int, input().split()))
py = []
city = {i+1: [] for i in range(n)}
for i in range(m):
p, y = list(map(int, input().split()))
city[p].append(y)
py.append([p, y])
for i in city.values():
i.sort()
# print(city)
ans = {i+1: {} for i in range(n)}
for key, value in city.items():
for i in range(len(value)):
ans[key][value[i]] = i+1
for p, y in py:
# print(p, ans[p][y])
print("{:06}{:06}".format(p, ans[p][y]))
|
p03607 | s687907068 | Wrong Answer | n=int(input())
a=[int(input()) for i in range(n)]
a=sorted(a)
ans=[]
num=1
for i in range(n-1):
if a[i]==a[i+1]:
num+=1
else:
if num%2!=0:
ans.append(a[i])
if i+1==n-1:
ans.append(a[i])
num=1
print(len(ans)) |
p02697 | s752362174 | Wrong Answer | n,m=map(int,input().split())
for i in range (m):
a=i+1
b=2*m-i
print (a)
print (b)
|
p03221 | s943596596 | Accepted | n, m = map(int, input().split())
dic = dict()
for i in range(m):
p, y = map(int, input().split())
if not p in dic:
dic[p] = []
dic[p].append((y, i+1))
ans = []
for p, l in dic.items():
l.sort()
for i, x in enumerate(l):
ans.append([x[1], str(p).zfill(6) + str(i + 1).zfill(6)])
ans.sort()
for x in ans:
print(x[1]) |
p02779 | s527514520 | Accepted | A=int(input())
B=list(map(int,input().split()))
C=len(set(B))
if A==C:
print('YES')
else:
print('NO')
|
p03001 | s469954205 | Wrong Answer | w,h,x,y = list(map(int, input().split()))
a = max(min(x*h, (w-x)*h), min(y*w, (h-y)*w))
if(min(x*h, (w-x)*h) == min(y*w, (h-y)*w)):
print(a/1.0,1)
else:
print(a/1.0,0) |
p02753 | s390660003 | Accepted | str = input()
count_A = str.count('A')
count_B = str.count('B')
if count_A > 0 and count_B > 0:
print('Yes')
else :
print("No") |
p02697 | s526340845 | Wrong Answer | n,m = map(int,input().split())
#1,2,3,4,...,n
#m個用意されてる
for i in range(1, min(m+1, (n-1)//2+1)):
print(n//2+1-i, n//2+i) |
p03592 | s370209695 | Accepted | n,m,k=map(int,input().split())
#同じ行、列で2回押すのはノーカウントにできる
#行、列で押した回数を独立にできる
#nのうちp、mのうちq押す
#p*m+q*n-p*q
cnt=0
for p in range(n+1):
for q in range(m+1):
if p*m+q*n-2*p*q==k:
cnt+=1
if cnt>0:
print("Yes")
else:
print("No") |
p03379 | s533329409 | Wrong Answer | N = int(input())
X = list(map(str,input().split()))
X_ = sorted(X)
for x in X:
if x <= X_[(N//2)-1]:
print(X_[(N)//2])
else:
print(X_[(N)//2-1]) |
p02832 | s014788374 | Accepted | n = int(input())
A = [int(x) for x in input().split()]
k = 1
for a in A:
if a == k:
k += 1
if k == 1:
print(-1)
else:
print(n - k + 1) |
p04011 | s108734776 | Accepted | N = int(input())
K = int(input())
X = int(input())
Y = int(input())
if N>=K:
print(K*X+(N-K)*Y)
else:
print(N*X)
|
p02627 | s929785069 | Wrong Answer | s = input()
print('s') |
p03565 | s794219721 | Accepted | import re
def solve(s, t):
s = s.replace('?', '.')
ls, lt = len(s), len(t)
if ls < lt:
return 'UNRESTORABLE'
ans = []
for i in range(ls - lt + 1):
m = re.match(s[i:i + lt], t)
if m is None:
continue
ans.append((s[:i] + t + s[i + lt:]).replace('.', 'a'))
if not ans:
return 'UNRESTORABLE'
return min(ans)
s = input().strip()
t = input().strip()
print(solve(s, t)) |
p03556 | s177000401 | Accepted | import math
N = int(input())
for n in range(N):
num = N - n
sqrt_num = math.sqrt(num)
if (int(sqrt_num) == sqrt_num):
print(num)
break |
p03434 | s770669614 | Accepted | N = int(input())
c = list(map(int,input().split()))
c.sort(reverse = True)
#print(c[::2])
#print(c[1::2])
diff = sum(c[::2])-sum(c[1::2])
print(diff) |
p03785 | s970252268 | Accepted | def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
n,c,k = iim()
time = []
for _ in range(n):
time.append(ii())
time.sort()
bus = 0
fst = time[0]
ans = 0
for item in time:
if bus <= c-1 and item <= k+fst:
bus += 1
else:
bus = 1
ans += 1
fst = item
print(ans if bus == 0 else ans+1) |
p03150 | s875722751 | Wrong Answer | import sys
input = sys.stdin.readline
# B - KEYENCE String
def is_keyence_string():
for i in range(1, len(key)):
left = key[:i]
right = key[i-len(key):]
if S.startswith(left) and S.endswith(right):
return True
return False
S = input()
key = 'keyence'
if S.startswith(key):
print('YES')
elif S.endswith(key):
print('YES')
else:
if is_keyence_string():
print('YES')
else:
print('NO')
|
p03637 | s233905524 | Wrong Answer | n = int(input())
a = list(map(int, input().split()))
b, c, d = 0, 0, 0
for i in a:
if i % 4 == 0:
b += 1
elif i % 2 == 0:
c += 1
else:
d += 1
if c == 1:
d += 1
if b + 1 >= d:
print("Yes")
else:
print("No") |
p02684 | s195650994 | Accepted | n, k = map(int, input().split())
A = list(map(int, input().split()))
L = [1]
S = {1}
while A[L[-1]-1] not in S:
last = L[-1]-1
L.append(A[last])
S |= {A[last]}
a = A[L[-1]-1]
j = L.index(a)
r = len(L)
l = r - j
if k+1 <= j:
print(L[k])
else:
print(L[j+(k-j)%l])
|
p03827 | s808653780 | Accepted | n=int(input())
s=input()
x=[0]*(n+1)
for i in range(n):
if s[i]=="I":
x[i+1]=x[i]+1
elif s[i]=="D":
x[i+1]=x[i]-1
print(max(x)) |
p02730 | s195540313 | Accepted | s = input()
flag = False
for i in range(len(s)//2):
if s[i] != s[len(s)-i-1]:
flag = True
for i in range((len(s)//2)//2+1):
if s[i] != s[len(s)//2-i-1]:
flag = True
if flag:
print("No")
else:
print("Yes")
|
p03730 | s509601739 | Accepted | a, b, c = map(int, input().split())
num = a
for i in range(b+1):
if num % b == c:
print("YES")
break
num += a
else:
print("NO")
|
p03471 | s359212188 | Wrong Answer | N, Y = map(int, input().split())
def f():
for i in range(N+1):
for j in range(9):
k = N-i-j
if i*10000+j*5000+k*1000 == Y:
print(i, j, k)
return
print(-1,-1,-1)
f() |
p02623 | s628689299 | Wrong Answer | a = input().split()
a = [int(a)for a in a]
lis = []
b = input().split()
b = [int(b)for b in b]
c = input().split()
c = [int(c)for c in c]
for i in b:
lis.append(i)
for i in c:
lis.append(i)
lis.sort()
count = 0
time = a[2]
honn = 0
while time >= lis[count] and count <= len(lis)-1 :
time = time - lis[count]
if count >= len(lis)-1 :
honn += 1
break
else:
count += 1
honn += 1
print(honn)
|
p03474 | s376275957 | Accepted | p = input().split()
a = int(p[0])
b = int(p[1])
v = input()
s = list(v)
answer = False
for i in range(len(s)):
q = s[i]
if i == a:
if q == '-':
answer = True
else:
answer = False
break
else:
if q == '-':
answer = False
break
else:
answer = True
if answer:
print('Yes')
else:
print('No') |
p02621 | s153671377 | Accepted | a = int(input())
print(str(a + a * a + a * a * a)) |
p02705 | s957172724 | Wrong Answer | import sys
input = sys.stdin.readline
R = int(input())
L = 2 * R * 3.141592 |
p02556 | s492059520 | Accepted | n = int(input())
maxda = -10**18
minda = 10**18
maxdb = -10**18
mindb = 10**18
for i in range(n):
x,y = map(int,input().split())
maxda = max(maxda, x-y)
minda = min(minda, x-y)
maxdb = max(maxdb, x+y)
mindb = min(mindb, y+x)
print(max(maxda-minda, maxdb-mindb)) |
p04033 | s422815232 | Wrong Answer | a,b=map(int,input().split())
if a<0 and b>0:
print('Zero')
elif a>0:
print('Positive')
else:
if (b-a)%2==0:
print('Negative')
else:
print('Pisitive') |
p03611 | s101844200 | Accepted | from collections import Counter
N = int(input())
A = list(map(int, input().split()))
cnt = Counter(A)
ans = 0
for a in range(max(A) + 1):
ans = max(ans, cnt[a - 1] + cnt[a] + cnt[a + 1])
print(ans)
|
p03557 | s372553780 | Wrong Answer | def main():
from bisect import bisect_left
n, *abc = map(int, open(0).read().split())
a, b, c = abc[:n], abc[n:2 * n], abc[2 * n:]
a, b, c = sorted(a), sorted(b), sorted(c)
ans = 0
for i in c:
j = bisect_left(b, i)
for k in b[:j]:
l = bisect_left(a, k)
ans += l
print(i, j, l)
print(ans)
if __name__ == '__main__':
main()
|
p02909 | s605463705 | Wrong Answer | s = input()
weather = {"Sunny":"Cloudy", "Cloudy":"Rainy","Rainy":"Sunny"}
print (weather)
|
p03557 | s350701623 | Wrong Answer |
from bisect import bisect_right
from bisect import bisect_left
def main():
n=int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort()
C.sort()
sum=0
for i in range(n):
cnt=1
cnt*= bisect_right(A,B[i])
cnt*= n-bisect_left(A,B[i])
sum+=cnt
print(sum)
if __name__ == '__main__':
main()
|
p03745 | s916515904 | Accepted | n = int(input())
a = list(map(int,input().split()))
x = 0
cnt = 1
for i in range(1,n):
temp = a[i] - a[i-1]
if x == 0:
x = temp
elif x * temp<0:
cnt += 1
x =0
print(cnt) |
p02879 | s127675375 | Accepted | a, b = map(int, input().split())
if 0<a<10 and 0<b<10:
print(a*b)
else:
print(-1) |
p02767 | s632897018 | Wrong Answer | lenght = int(input())
people = [int(i) for i in input().split()]
resultList = []
for i in range(min(people), max(people)):
mylist = []
for j in people:
mylist.append((j - i) ** 2)
resultList.append(sum(mylist))
if(len(resultList) == 0):
print(people[0])
else:
print(min(resultList)) |
p02773 | s274386922 | Accepted | n = int(input())
s = [input() for i in range(n)]
# 辞書作成
s_dict = dict()
for i in s:
if i not in s_dict:
s_dict[i] = 1
else:
s_dict[i] += 1
m = max(s_dict.values())
ans = []
for k, v in s_dict.items():
if v == m:
ans.append(k)
ans.sort()
# ソート
print(*ans, sep="\n")
|
p02939 | s365097631 | Accepted | S = input()
ans = 0
Si = ""
now = ""
for s in S:
now += s
if Si != now:
ans += 1
Si = now
now = ""
print(ans)
|
p04034 | s880261381 | Wrong Answer | n,m=map(int,input().split())
check=[False]*n
check[0]=True
for i in range(m):
x,y=map(int,input().split())
x-=1
y-=1
if check[x]:
check[y]=True
else:
continue
ans=0
check[0]=False
for i in range(n):
if check[i]:
ans+=1
print(ans)
|
p03659 | s104984518 | Wrong Answer | N=int(input())
*A,=map(int,input().split())
count=[0]*(N+1)
i=1
while i<N+1:
count[i]=count[i-1]+A[i-1]
i+=1
ans=abs(count[-1])
k=1
while k<N+1:
ans=min(ans,abs(count[-1]-2*count[k]))
k+=1
if N==2:
print(abs(A[1]-A[0]))
else:
print(ans) |
p04029 | s660943126 | Accepted | n = int(input())
print(n*(n+1) // 2) |
p02823 | s113663535 | Accepted | N,A,B = map(int,input().split())
if (B-A) % 2 == 0:
print((B-A)//2)
elif A-1 <= N-B:
print((A+B-1)//2)
else:
print(N+1-(B+A+1)//2) |
p02548 | s437921147 | Accepted | N = int(input())
A = 1
ans = 0
while A*A < N:
if N%A == 0:
ans += N//A-A
else:
ans += N//A-A+1
A += 1
ans = 2*ans - A + 1
print(ans) |
p03835 | s531514872 | Wrong Answer | import bisect
k,s=map(int, input().split())
p=[]
for i in range(k+1):
p.append(i)
pp=[]
for i in p:
for j in p:
pp.append(i+j)
pp.sort()
ans=0
for x in pp:
if pp[bisect.bisect_right(pp,s-x)-1]==s-x:
ans+=1
print(ans) |
p03693 | s964713759 | Accepted | r, g, b = map(int, input().split())
a = r * 100 + g * 10 + b
if a % 4 == 0 :
print('YES')
else:
print("NO")
|
p03293 | s092515373 | Accepted | import sys
s = list(input())
t = list(input())
for i in range(len(s)):
s = list(s[-1])+s
s.pop()
if s == t:
print('Yes')
sys.exit()
print('No') |
p03059 | s804510645 | Accepted | import sys
input = lambda: sys.stdin.readline().rstrip()
def main():
a, b, t = map(int, input().split())
ans = 0
i = 1
sec = 0
while sec <= t+0.5:
ans += b
sec = a * i
i += 1
print(ans-b)
if __name__ == '__main__':
main() |
p02842 | s669787253 | Accepted | """Boot-camp-for-Beginners_Easy004_B_Tax-Rate_25-August-2020.py"""
import numpy as np
import sys
N=int(input())
X=N/1.08
if int(int(np.ceil(X))*1.08)==N:
print(int(np.ceil(X)))
else:
print(":(") |
p04020 | s455127922 | Accepted | N = int(input())
A = [int(input()) for _ in range(N)]
ans = 0
cnt = 0
for i in range(N):
if A[i] != 0:
ans += (A[i]+cnt)//2
cnt = (A[i]+cnt)%2
else:
cnt = 0
print(ans) |
p03723 | s443126599 | Wrong Answer | a, b, c = map(int, input().split())
if a == b == c:
print(-1)
else:
cnt = 0
while (a % 2 == 0 and b % 2 == 0 and c % 2 == 0):
a, b, c = (b+c)//2, (a+c)//2, (a+b)//2
cnt += 1
print(cnt) |
p02973 | s980776048 | Accepted | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
from bisect import bisect_left, bisect_right
n = int(readline())
a = [int(readline()) for _ in range(n)]
inf = float('inf')
memo = [inf] * n
for aa in a[::-1]:
memo[bisect_right(memo, aa)] = aa
print(bisect_left(memo, inf))
|
p03163 | s955231013 | Accepted | import numpy as np
N, W = map(int, input().split())
dp = np.zeros(W+1)
for i in range(N):
w, v = map(int, input().split())
dp[w:] = np.maximum(dp[w:], dp[:-w] + v)
print(int(dp.max())) |
p03803 | s648911332 | Accepted | # -*- coding: utf-8 -*-
a, b = map(int, input().split())
a = 14 if a == 1 else a
b = 14 if b == 1 else b
if a > b:
print('Alice')
elif a < b:
print('Bob')
else:
print('Draw') |
p03998 | s532340931 | Wrong Answer | # -*- coding: utf-8 -*-
SA,SB,SC = [input().strip() for _ in range(3)]
S_dic={}
S_dic['a']=SA
S_dic['b']=SB
S_dic['c']=SC
turn="a"
while True:
if S_dic[turn] == "":
print(turn.upper())
break
turn = S_dic[turn][0]
S_dic[turn] = S_dic[turn][1:]
|
p04029 | s639057328 | Accepted | n = int(input())
ans = n * (n+1) // 2
print(ans) |
p03720 | s988799474 | Wrong Answer | n, m = map(int, input().split())
ll = [0] + [ 0 for _ in range(n)]
for i in range(m):
a, b = map(int, input().split())
ll[a] += 1
ll[b] += 1
for l in ll[1:]:
print()
|
p03379 | s599194061 | Wrong Answer | def main():
N = int(input())
X = [int(_) for _ in input().split()]
Y = sorted(X)
mid = (Y[(N-1)//2] + Y[N//2]) / 2
for i in range(N):
print(Y[N//2] if X[i] <= mid else print(Y[(N-1)//2]))
return
if __name__ == '__main__':
main()
|
p03221 | s540139100 | Accepted | from collections import defaultdict
n, m = map(int, input().split())
PY = [tuple(map(int, input().split())) for _ in range(m)]
sorted_PY = sorted(PY)
cnt = 1
now = sorted_PY[0][0]
d = defaultdict(int)
for p, y in sorted_PY:
if now != p:
cnt = 1
now = p
d[y] = (p, cnt)
cnt += 1
for p, y in PY:
l, r = map(str, d[y])
l = '0'*(6-len(l)) + l
r = '0'*(6-len(r)) + r
print(l+r)
|
p02831 | s130330964 | Wrong Answer | A,B=map(int,input().split())
x=min(A,B)
y=max(A,B)
check=1
##x<=y
#####while break##############
if y%x==0:
print(y)
else:
root=round((x**(1/2)))
for i in range(2,root):
if x%i==0 and y%i==0:
x/=i
y/=i
check*=i
# print(check)
i=2
#print(x,y)
root=round((x**(1/2)))
print(int(check*x*y))
|
p03814 | s418428130 | Wrong Answer | s=input()
print(s.find("Z")-s.find("A")+1) |
p03146 | s803152426 | Accepted | def main():
s = int(input())
ak = s
k = 1
history = set([ak])
while True:
k += 1
if ak%2 == 0:
ak = ak//2
else:
ak = ak*3 + 1
if ak in history:
print(k)
break
else:
history = history | set([ak])
main() |
p02797 | s973873048 | Wrong Answer | N, K, S = map(int, input().split())
INF = 10**9
ans = []
if S % 2 == 0:
s = S // 2
ans.extend([s] * (K+1))
ans.extend([INF] * (N-(K+1)))
else:
k = K // 2 + 1
ans.extend([S//2, S//2+1] * k)
if K % 2 == 0:
ans.pop()
ans.extend([INF] * (N-len(ans)))
print(' '.join([str(x) for x in ans]))
|
p02718 | s357910697 | Accepted | from decimal import *
n , m = map(int, input().split())
arr = list(map(int, input().split()))
check = Decimal(1/(4*m)) * sum(arr)
count = 0
for i in arr:
if i < check:
continue
else:
count+=1
if count >= m:
print("Yes")
else:
print("No")
|
p02848 | s765977746 | Wrong Answer | import sys
def main():
input = sys.stdin.readline
n = int(input())
s = input()
first = ord("A") - 1
last = ord("Z")
increment = lambda x: chr(ord(x)+n) if ord(x)+n <= last else chr(first + (ord(x)+n - last))
new_s = "".join(map(increment, s))
print(new_s)
if __name__ == '__main__':
main()
|
p02948 | s742910198 | Accepted | from heapq import heappop, heappush
n, m, *AB = map(int, open(0).read().split())
B = [[] for _ in range(m)]
for a, b in zip(AB[::2], AB[1::2]):
if a <= m:
B[a-1].append(b)
ans = 0
heap = []
for b in B:
for x in b:
heappush(heap, -x)
if heap:
ans -= heappop(heap)
print(ans)
|
p03041 | s681586523 | Wrong Answer | n, k = map(lambda x: int(x), input().split())
s = input()
str = ""
for i in range(n):
if i == k:
str += s[i].upper()
else:
str += s[i]
print(str)
|
p03672 | s818227662 | Accepted | s=input()
cnt=len(s)-2
while cnt>0:
#print(s[0:cnt//2],s[cnt//2:cnt])
if s[0:cnt//2]==s[cnt//2:cnt]:
break
cnt-=2
print(cnt)
|
p03472 | s572060630 | Wrong Answer | N, H = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(N)]
max_a = sorted(ab, key=lambda x: -x[0])[0][0]
bs = [b for a,b in ab if b > max_a]
sum_bs = sum(bs)
if H <= sum_bs:
print(len(bs))
else:
H -= sum_bs
print((H+max_a-1)//max_a + len(bs))
|
p03693 | s599118687 | Wrong Answer | a,b,c= map(int, input().split())
if (100*a+10*b+c) % 2 == 1:
print('YES')
else:
print('NO')
|
p03623 | s724177085 | Wrong Answer | x,a,b = map(int,input().split())
kyori1 = abs(x - a)
kyori2 = abs(x - a)
if kyori1 < kyori2:
print('A')
else:
print('B') |
p03449 | s518144622 | Wrong Answer | n=int(input())
a1=list(map(int,input().split()))
a2=list(map(int,input().split()))
mi=min(sum(a1[1:]),sum(a2[:-1]))
for i in range(2,n-1):
tmp=sum(a1[i:])+sum(a2[:i-1])
if tmp<mi: mi=tmp
print(sum(a1)+sum(a2)-mi) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.