problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p03037 | s623539718 | Accepted | n,m=map(int,input().split())
low=1
high=n
for _ in range(m):
l,r=map(int,input().split())
low=max(l,low)
high=min(r,high)
if high-low+1>=0:
print(high-low+1)
else:
print(0) |
p02621 | s749127301 | Accepted | import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7
a = i()
print(a+a**2+a**3) |
p02882 | s813191357 | Wrong Answer | a,b,x = map(int,input().split())
import numpy as np
if x<=(a*a*b)/2:
A = 2*x/(a*b*b)
Z = A
print(np.arctan(Z)*180/(np.pi))
else:
A = 2*a*a*b-2*x
B = A/(a*a*a)
Z = B
print(np.arctan(Z)*180/np.pi) |
p02613 | s248053215 | Accepted | N = int(input())
l = []
for i in range(N):
l.append(input())
AC = l.count('AC')
WA = l.count('WA')
TLE = l.count('TLE')
RE = l.count('RE')
print("AC x {}".format(AC))
print("WA x {}".format(WA))
print("TLE x {}".format(TLE))
print("RE x {}".format(RE)) |
p03951 | s892903707 | Wrong Answer | n = int(input())
s = str(input())
t = str(input())
if s == t:
print(n)
else:
for i in range(1, n):
l = s[:i + 1] + t
if l[:n] == s:
print(len(l))
break |
p02584 | s129265873 | Wrong Answer | x, k, d = list(map(int, input().split()))
x = abs(x)
p = 0
if(x - k*d >=0):
p = x - k*d
else:
p = x%d
if (k - x/d)%2 == 1:
p = p-d
print(abs(p))
|
p02917 | s029460807 | Wrong Answer | N = int(input())
Bs = list(map(int, input().split()))
As = [Bs[0]]
As.extend(Bs)
#print(Bs)
#print(As)
for index, B in enumerate(Bs[1:]):
if B < As[index]:
As[index] = B
print(sum(As))
|
p04033 | s006259558 | Accepted | from bisect import bisect_right
a, b = (int(x) for x in input().split())
if a <= 0 and 0 <= b: #0を含む
print('Zero')
elif 0 < a and 0 < b: #すべて正
print('Positive')
else: #すべて負
print('Positive' if (b - a + 1)%2 == 0 else 'Negative')
|
p03437 | s330618046 | Accepted | x,y=map(int,input().split())
if x%y==0:
print(-1)
else:
print(x) |
p02753 | s040041699 | Accepted | N = input()
ans = 'No' if 'AAA'==N or 'BBB'==N else 'Yes'
print(ans) |
p03324 | s702218031 | Wrong Answer | L, R = map(int,input().split())
print((100**L)*int((R-1)/99)+R) |
p03815 | s871414582 | Wrong Answer | x = int(input())
if x > 11:
if x % 11 == 0:
print(int(x*2/11))
else:
print(int(x*2/11)+1)
elif x < 7:
print(1)
else:
print(2) |
p03785 | s946470161 | Wrong Answer | from sys import stdin
n,c,k = [int(x) for x in stdin.readline().rstrip().split()]
li = [int(stdin.readline().rstrip()) for _ in range(n)]+[10**10]
li.sort()
time = li[0]
bus = 0
hito = 0
for i in li:
hito += 1
if i-time > k or hito > c:
bus += 1
hito = 0
time = i
print(bus) |
p02621 | s625476911 | Accepted | a=int(input())
print(a**2+a+a**3) |
p03208 | s738755644 | Accepted | #普通にソートしてから、配列のK個づつ区切ってパターンを調べればN - K + 1回の比較で行ける
N, K = map(int, input().split())
h = [int(input()) for _ in range(N)]
h.sort()
distances = [h[i + K -1] - h[i] for i in range(N -K + 1)]
ans = min(distances)
print(ans) |
p02847 | s802799114 | Wrong Answer | s= input ("please enter the day")
if s == "SAT" :
print ("1 \n It is Saturday today, and tomorrow will be Sunday")
elif s == "SUN" :
print ("7 \n It is Sunday today, and seven days later, it will be Sunday again.")
elif s == "MON" :
print (" 6 \n It is monday today, and six days later, it will be Sunday again.")
elif s == "TUE" :
print (" 5 \n It is thusday today, and five days later, it will be Sunday again.")
elif s =="WED" :
print (" 4 \n It is wednsday today, and four days later, it will be Sunday again.")
elif s == "THU" :
print ("3 \n It is thusday today, and three days later, it will be Sunday again.")
else:
print ("2 \n It is friday today, and two days later, it will be Sunday again.") |
p03611 | s229562384 | Accepted | import collections
s = int(input())
a = list(map(int, input().split()))
sum = []
for i in a:
sum.append(i)
sum.append(i+1)
sum.append(i-1)
print(collections.Counter(sum).most_common()[0][1]) |
p03136 | s013455552 | Accepted | n = int(input())
a = list(map(int, input().split()))
asum = sum(a)
amax = max(a)
if amax < asum-amax:
print("Yes")
else:
print("No") |
p03075 | s765876544 | Accepted | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
#from operator import itemgetter
#inf = 10**17
#mod = 10**9 + 7
a = [int(input()) for _ in range(5)]
k = int(input())
if a[-1]-a[0] > k:
print(':(')
else:
print('Yay!')
if __name__ == '__main__':
main() |
p02792 | s958224283 | Accepted | n = int(input())
di = [[0]*9 for _ in range(9)]
for i in range(1, n+1):
p = list(str(i))
if p[-1] == '0':
continue
di[int(p[0])-1][int(p[-1])-1]+=1
result = 0
for i in range(9):
for j in range(9):
c = di[i][j]
d = di[j][i]
result+=c*d
print(result) |
p02675 | s095252912 | Accepted | N = int(input())
if N % 10 in [2, 4, 5, 7, 9]:
print('hon')
elif N % 10 in [0, 1, 6, 8]:
print('pon')
elif N % 10 in [3]:
print('bon') |
p02989 | s584500807 | Accepted | N = int(input())
d = list(sorted(map(int, input().split())))
c = len(d)//2
print(d[c]-d[c-1] if d[c]!=d[c-1] else 0)
|
p02641 | s035080805 | Wrong Answer | X,N=[int(x) for x in input().split(" ")]
if N==0: print(X)
else:
a=[int(x) for x in input().split(" ")]
i=1
res=0
if not X in a:
res=X
while True:
X+=i*(-1)**i
if not X in a:
res=X
break
i+=1
print(res) |
p03705 | s588387811 | Wrong Answer | N, A, B = map(int, input().split())
if A > B:
print(0)
exit()
if A == B:
if N == 1:
print(1)
exit()
else:
print(0)
exit()
print((N-2)*(B-A)+1) |
p03524 | s745590116 | Wrong Answer | S = input()
temp = ["a", "b", "c"]
abc = [S.count(x) for x in temp]
abc.sort(reverse=True)
if abc.count(0) > 0:
print("No")
elif abc[0] == abc[1] == abc[2]:
print("YES")
elif abc[0] == abc[1] == abc[2]+1:
print("YES")
elif abc[0] == abc[1]+1 == abc[2]+1:
print("YES")
else:
print("No") |
p03329 | s118692565 | Wrong Answer | n = int(input())
# a進法でのnの桁和
def func(n,a):
res = 0
while n > 0:
res += n%a
n //= a
return res
mini = 10**6
for i in range(n):
tmp = func(i,6) + func(n-i,9)
mini = min(mini,tmp)
print(mini) |
p03804 | s129643550 | Wrong Answer | N,M = [int(i) for i in input().split()]
a = []
for i in range(N):
array = input()
a.append(array)
b = []
for i in range(M):
line = input()
b.append(line)
for i in range(N-M+1):
for j in range(N-M+1):
ans = 'Yes'
for n in range(M):
for m in range(M):
if a[i+n][j+m] == b[n][m]:
pass
#print(i,j,n,m)
else:
ans = 'No'
print(ans) |
p02718 | s619702671 | Accepted | N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
print('No') if(A[M - 1] < sum(A) / (4 * M)) else print('Yes')
|
p02765 | s543405925 | Accepted | n, r = map(int, input().split())
if n < 10: print(100*(10-n)+r)
else: print(r) |
p03252 | s964523764 | Accepted | S, T = [0] * 26, [0] * 26
for s in input():
S[ord(s) - ord('a')] += 1
for t in input():
T[ord(t) - ord('a')] += 1
S.sort()
T.sort()
ans = 'Yes' if S == T else 'No'
print(ans)
|
p03317 | s773695144 | Accepted | import math
n, k = map(int, input().split())
[int(i) for i in input().split()]
print(math.ceil((n-k) / (k - 1) + 1)) |
p02601 | s076252060 | Wrong Answer | import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))
a, b, c = map(int, input().split())
k = int(input())
for _ in range(k):
if a > b:
b *= 2
else:
c *= 2
if a < b < c:
print('Yes')
else:
print('No') |
p02729 | s540472111 | Accepted | n,m = map(int,input().split())
ans = 0
ans += n*(n-1)//2
ans += m*(m-1)//2
print(ans) |
p03773 | s179154853 | Wrong Answer | A, B = map(int, input().split())
print(A+B -24*((A+B)//24) if A+B > 24 else A+B) |
p03146 | s895308995 | Wrong Answer | def main():
s = int(input())
a_set = set()
a = s
for i in range(1, 1000000):
if a % 2 == 0:
a = a // 2
else:
a = a * 3 + 1
if a in a_set:
print(i + 1)
exit()
a_set.add(a)
if __name__ == '__main__':
main()
|
p03095 | s492171955 | Accepted |
import collections
n = int(input())
s = list(input())
ans = 1
c = collections.Counter(s)
for i in set(s):
ans *= (c[i] + 1)
print((ans - 1) % (pow(10, 9) + 7))
|
p03386 | s013102061 | Wrong Answer | """
author : halo2halo
date : 24, Jan, 2020
"""
import sys
# import itertools
# import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
A, B, K = map(int, readline().split())
ans=''
if B - A <= 2 * K:
ans += '\n'.join(str(x) for x in range(A, B + 1))
else:
ans += '\n'.join(str(x) for x in range(A, A + K))
ans+='\n'
ans += '\n'.join(str(x) for x in range(B + 1 - K, B + 1))
print(ans) |
p02731 | s413000834 | Accepted | L = int(input())
print((L/3)**3) |
p03061 | s228361312 | Accepted | from fractions import gcd
n = int(input())
a = list(map(int, input().split()))
l = [0]*(n+1)
r = [0]*(n+1)
for i in range(n):
l[i+1] = gcd(l[i], a[i])
r[n-i-1] = gcd(r[n-i], a[n-i-1])
m = [0]*n
for i in range(n):
m[i] = gcd(l[i], r[i+1])
print(max(m)) |
p03475 | s620533974 | Accepted | N = int(input())
A = list()
for i in range(N-1):
A.append(list(map(int, input().split())))
for i in range(N):
ans = 0
j = i
while(j < N-1):
C = A[j][0]
S = A[j][1]
F = A[j][2]
if(S > ans):
ans = S
else:
if(ans % F != 0):
ans = ((ans//F)+1)*F
ans += C
j += 1
print(ans) |
p02911 | s327002120 | Wrong Answer | n,k,q=map(int,input().split())
lst=[0]*n
for i in range(q):
person=int(input())
lst[person-1]+=1
for p in range(n):
temp=k-q+lst[p-1]
if temp<=0:
print("No")
else:
print("Yes") |
p03680 | s344962528 | Accepted | N = int(input())
l = [int(input()) for i in range(N)]
index = 0
count = 0
for j in range(N):
index = l[index] - 1
count += 1
if index == 1:
print(count)
exit()
print(-1) |
p03319 | s362251470 | Accepted | n, k = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
ans = (n - 1) // (k - 1)
if (n - 1) % (k - 1) != 0:
ans += 1
print(ans)
|
p03239 | s329910579 | Accepted | n,t=map(int,input().split())
ct=[]
ans=[]
for i in range(n):
ct=[int(x) for x in input().split()]
if ct[1] <=t:
ans.append(ct[0])
if ans==[]:
print("TLE")
else:
print(min(ans))
|
p03038 | s342955377 | Accepted | import sys
input = sys.stdin.readline
N, M = map(int, input().split())
A = sorted(list(map(int, input().split())))[::-1]
BC = sorted([list(map(int, input().split())) for _ in range(M)], key=lambda x: x[1])
ans = 0
for a in A:
if N == 0:
break
while len(BC) > 0 and BC[-1][1] > a and N != 0:
b, c = BC.pop()
i = min(N, b)
ans += i * c
N -= i
if N >= 1:
ans += a
N -= 1
print(ans)
|
p02628 | s015681697 | Accepted | N, K = map(int, input().split())
P = [int(x) for x in input().split()]
P.sort()
i = 0
k = 0
for j in P:
if k == K:
break
i += j
k += 1
print(i) |
p03472 | s421336842 | Accepted | n,h=map(int,input().split())
p=[]
for i in range(n):
a,b=map(int,input().split())
p.append([a,0])
p.append([b,1])
p=sorted(p,key=lambda x:-x[0])
i=0
ans=0
while h>0:
if p[i][1]==1:
h-=p[i][0]
ans+=1
i+=1
else:
ans-=(-h//p[i][0])
break
print(ans) |
p03723 | s969085147 | Accepted | import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy
A, B, C = map(int, input().split())
s = set()
cnt = 0
while A % 2 == B % 2 == C % 2 == 0:
if (A, B, C) in s:
cnt = -1
break
s.add((A, B, C))
A, B, C = B // 2 + C // 2, C // 2 + A // 2, A // 2 + B // 2
cnt += 1
print(cnt) |
p02951 | s952609205 | Wrong Answer | a, b, c = map(int, input().split())
print(min(0, c-(a-b)))
|
p03136 | s598414886 | Wrong Answer | """
author : halo2halo
date : 16, Jan, 2020
"""
import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
N = int(readline())
L = list(map(int, readline().split()))
S = sum(L)
ans = True
for i in L:
if S >= i+i:
ans = False
break
print('Yes' if ans else 'No')
|
p03437 | s108502710 | Accepted | x,y=map(int,input().split())
if x%y==0:
print(-1)
else:
print(x) |
p02717 | s315845185 | Accepted | x, y, z = input().split()
print(z,x,y) |
p02780 | s265771384 | Accepted | n, k = map(int, input().split())
def modify(x):
return int(x) + 1
l = list(map(modify, input().split()))
s = sum(l[:k])
m = s
for i in range(k, n):
s += l[i]
s -= l[i-k]
m = max(s, m)
print(m/2) |
p03723 | s229218485 | Accepted | a,b,c=list(map(int,input().split()))
n=0
H=[]
while True:
S=[a,b,c]
if S in H:
print("-1")
exit()
H.append(S)
if a%2!=0 or b%2!=0 or c%2!=0:
print(n)
exit()
else:
A=a/2
B=b/2
C=c/2
a=int(B+C)
b=int(A+C)
c=int(A+B)
n+=1 |
p02693 | s402536374 | Wrong Answer | k = int(input())
a, b = map(int, input().split())
if k <= b - a or a % k == 0 or b % k == 0:
print('OK')
else:
print('NG') |
p03107 | s925263097 | Wrong Answer | S=input()
ans=0
r=b=0
for s in S:
if s=='0':
if b>0:
b-=0
ans+=2
else:
r+=1
else:
if r>0:
r-=1
ans+=2
else:
b+=1
print(ans) |
p03208 | s395394323 | Wrong Answer | n, k = list(map(int, input().split()))
h = [int(input()) for i in range(n)]
h = sorted(h)
mins = 10000000000
for i in range(n - k+1):
cost = max(h[i:i+k]) - min(h[i:i+k])
if cost < mins:
mins = cost
print(cost) |
p03695 | s514068852 | Accepted | # coding: utf-8
def main():
_ = int(input())
A = list(map(int, input().split()))
B = [0] * 9
mn, mx = 0, 0
for a in A:
a //= 400
if a > 7: a = 8
B[a] += 1
for i in range(8):
if B[i] > 0: mn += 1
mx = mn + B[8]
if mn == 0: mn += 1
print(mn, mx)
if __name__ == "__main__":
main()
|
p03061 | s510328575 | Accepted | import fractions
n = int(input())
a = list(map(int, input().split()))
l = [0]*(n+1)
l[1] = a[0]
r = [0]*(n+1)
r[n-1] = a[n-1]
for i in range(1, n):
l[i+1] = fractions.gcd(l[i], a[i])
r[n-1-i] = fractions.gcd(r[n-i], a[n-1-i])
m = 0
for i in range(n):
m = max(m, fractions.gcd(l[i], r[i+1]))
print(m)
|
p02756 | s128842165 | Accepted | from collections import deque
s = deque(list(input()))
q = int(input())
rev = True
for i in range(q):
q = list(input().split())
if(int(q[0]) == 1):
rev = rev ^ True
else:
n = int(q[1])
if((n == 1 and rev) or (n == 2 and not rev)):
s.appendleft(q[2])
else:
s.append(q[2])
txt = ''
if rev:
txt = ''.join(s)
else:
while not(not s):
txt += s.pop()
print(txt)
|
p02817 | s259365570 | Accepted | s, t = input().split()
print(t + s)
|
p03161 | s593366422 | Accepted | import itertools,sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,K = LI()
h = LI()
dp = [float('INF')]*N
dp[0] = 0
for i,j in itertools.product(range(1,N),range(1,K+1)):
if i-j>=0:
dp[i] = min(dp[i],dp[i-j]+abs(h[i]-h[i-j]))
print(dp[-1])
|
p04005 | s876409370 | Accepted | A, B, C = map(int, input().split())
if not A % 2 or not B % 2 or not C % 2:
print(0)
else:
print(min(A * B, B * C, A * C)) |
p02793 | s128815798 | Accepted | from fractions import gcd
from functools import reduce
N = int(input())
A = list(map(int, input().split()))
lcm = reduce(lambda a, b: a * b // gcd(a, b), A)
print(sum(lcm // a for a in A) % 1000000007)
|
p02712 | s119557283 | Wrong Answer | n = int(input())
ans = 0
for i in range(n):
if i % 5 != 0 and i % 3 != 0:
ans+=i
print(ans) |
p03815 | s578447018 | Wrong Answer | import math
x = int(input())
print(math.ceil(x/5.5))
|
p02724 | s516059670 | Wrong Answer | def resolve():
s = int(input())
zandaka = s % 500
zandaka2 = zandaka % 5
ureshii_500 = (s - zandaka)/500*1000
ureshii2 = (zandaka - zandaka2)/5*5
goukei = ureshii2 + ureshii_500
print(goukei)
resolve()
|
p03475 | s595460006 | Accepted | n = int(input())
C = []
S = []
F = []
for _ in range(n-1):
c, s, f = map(int, input().split())
C.append(c)
S.append(s)
F.append(f)
def f(n, s, f):
if n <= s:
return s
if n % f == 0:
return n
else:
return n // f * f + f
for i in range(n-1):
now = S[i] + C[i]
for j in range(i+1, n-1):
now = f(now, S[j], F[j]) + C[j]
print(now)
print(0) |
p02753 | s512252390 | Wrong Answer | s = input()
s = set(list(s))
if len(s) == 1:
print('Yes')
else:
print('No') |
p02972 | s848792940 | Wrong Answer | N = int(input())
A = list(map(int, input().split()))
B = [0 for _ in range(N)]
B = B[:N//2] + A[N//2:]
for i in range(2, N+1):
for j in range(N//(i+1), N//i):
S = sum(B[m] for m in range(2*j+1, N, i))
B[j] = (S + A[j]) % 2
C = []
for i in range(N):
if B[i] == 1:
C.append(i+1)
print(len(C))
for i in range(len(C)):
if i != len(C) - 1:
print(C[i], end = ' ')
else:
print(C[i]) |
p03475 | s237956288 | Wrong Answer | n = int(input())
c = [0 for i in range(n-1)]
s = [0 for i in range(n-1)]
f = [0 for i in range(n-1)]
for i in range(n-1) :
c[i],s[i],f[i] = map(int,input().split())
for i in range(0,n-1) :
ans = 0
for j in range(i,n-1) :
if s[j] <= ans and ans%f[j] == 0 :
ans += c[j]
elif s[j] > ans :
ans += c[j] + (s[j]-ans)
elif ans%f[j] != 0 :
ans += c[j] + ans - (ans//f[j]+1)*f[j]
print(ans)
print(0) |
p03030 | s545162140 | Wrong Answer | n = int(input())
sp = [input().split() for i in range(n)]
sp = [s+str(100-int(i)) for s, i in sp]
print(*sorted(range(1, n+1), key=lambda x: sp[x-1]), sep='\n')
|
p02922 | s297698475 | Accepted | a, b = map(int, input().split())
out = 1
i = 0
while(True):
if out >= b:
print(i)
break
else:
out += a - 1
i += 1
|
p02612 | s211705301 | Accepted | n = int(input())
if n % 1000 == 0: print(0)
else: print(1000 - n % 1000) |
p02888 | s020719933 | Accepted | import bisect
n = int(input())
l = sorted(list(map(int, input().split())))
ans = 0
for i in range(n-1):
for j in range(i+1, n):
ans += bisect.bisect_left(l, l[i]+l[j]) - (j+1)
print(ans) |
p02843 | s968463871 | Accepted | x = int(input())
kosuu, amari = x // 100, x % 100
ans = 0
for i in range(kosuu):
amari -= 5
if amari <= 0:
ans = 1
break
print(ans)
|
p03127 | s525303433 | Accepted | n = int(input())
a= list(map(int,input().split()))
from fractions import gcd
ans =0
for i in range(n-1):
if i==0:
ans = gcd(a[i],a[i+1])
else:
ans = gcd(ans,a[i+1])
print(ans) |
p03719 | s276167042 | Accepted | A, B, C = map(int, input().split())
print('Yes' if A <= C and C <= B else 'No') |
p03730 | s350201545 | Accepted | import math
A,B,C = map(int,input().split())
num = math.gcd(math.gcd(A,B),C)
A = A//num
B = B//num
C = C//num
for i in range(1,100000):
if (A*i)%B == 1:
print('YES')
exit()
print('NO') |
p02783 | s041598774 | Wrong Answer | H,A = map(int,input().split())
print(H//A + 1) |
p04011 | s098873213 | Accepted | # AtCoder Beginner Contest 044
# A - 高橋君とホテルイージー / Tak and Hotels (ABC Edit)
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
total = 0
if N > K:
total = X*K + Y*(N-K)
else:
total = X*N
print(total) |
p03760 | s584881903 | Wrong Answer | o=input()
e=input()
ans=""
for i in range(len(e)):
ans+=o[(i+1)//2]
ans+=e[(i+1)//2]
if len(o)!=len(e):
ans+=o[len(o)-1]
print(ans)
|
p04044 | s147598151 | Wrong Answer | try:
N, L = map(int, input().split())
l = []
for i in range(N):
l.append(input())
l_ = sorted(l)
print(l_)
except EOFError:
pass |
p03612 | s901767160 | Accepted | import sys
readline = sys.stdin.readline
def main():
N = int(readline())
P = list(map(int, readline().rstrip().split()))
l = ['x' if p == i+1 else 'o' for i, p in enumerate(P)]
l = ''.join(l)
ll = l.replace('xx', '')
ans = (len(l) - len(ll)) // 2 + ll.count('x')
print(ans)
if __name__ == '__main__':
main() |
p03438 | s271068824 | Accepted | def ceil(a, b):
return (a + b - 1) // b
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = sum(b) - sum(a)
for _a, _b in zip(a, b):
if _a < _b:
n -= ceil(_b - _a, 2)
if n >= 0:
print('Yes')
else:
print('No')
|
p03264 | s645716866 | Wrong Answer | x = int(input())
if x % 2 == 0:
print((x/2)**2)
else:
print((x+1)/2*(x-1)/2)
|
p03042 | s429933870 | Accepted | def main():
s=input()
s1=int(s[:2])
s2=int(s[2:])
yymm = 1 <= s2 <= 12
mmyy = 1 <= s1 <= 12
if yymm and mmyy:
print("AMBIGUOUS")
elif yymm:
print("YYMM")
elif mmyy:
print("MMYY")
else:
print("NA")
if __name__ == "__main__":
main() |
p03221 | s047627596 | Accepted | N, M = map(int, input().split())
P = []
Y = []
d = {}
ans = [0] * M
for i in range(1,N+1):
d[i] = []
for i in range(M):
p,y = map(int, input().split())
d[p].append((i,y))
for k in d.keys():
d[k] = sorted(d[k], key=lambda x: x[1])
for i in range(len(d[k])):
ans[d[k][i][0]] = '{}{}'.format(str(k).zfill(6),str(i+1).zfill(6))
for i in range(len(ans)):
print(ans[i]) |
p02570 | s916730205 | Accepted | str = input().split()
if len(str) != 3:
print("input values is not three")
else:
a = int(str[0])
b = int(str[1])
c = int(str[2])
if a <= b * c:
print("Yes")
else:
print("No") |
p03387 | s685201956 | Wrong Answer | abc = list(map(int,input().split()))
abc.sort()
memo1 = abc[2]-abc[0]
memo2 = abc[2]-abc[1]
if memo1%2 == memo2%2:
print((memo1+memo2)//2)
else:
print(((memo1+memo2)//2)+1)
|
p04045 | s007743357 | Accepted | n,k = map(int,input().split())
d = list(map(str,input().split()))
while True:
sn = str(n)
l = len(sn)
flag = True
for i in range(l):
if sn[i] in d:
flag = False
break
if flag:
print(n)
exit()
n += 1
|
p03659 | s682088090 | Accepted | N = int(input())
A = list(map(int, input().split()))
s = 0
l = sum(A)
r = []
for a in A[:-1]:
s += a
k = abs(l - 2*s)
r.append(k)
r.sort()
print(r[0]) |
p03617 | s843561645 | Accepted | Q,H,S,D = map(int,input().split())
N = int(input())
num = min(4*Q,2*H,S)
if num*2 <= D:
print(N*num)
elif N % 2 == 0:
print(N*D//2)
else:
print(N//2*D+num) |
p03821 | s776653644 | 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=list(reversed(a))
b=list(reversed(b))
ans=0
for i in range(n):
if a[i]<=b[i]:
ok=b[i]-a[i]
else:
ok=-(-a[i]//b[i])*b[i]-a[i]
a=[j+ok for j in a]
ans+=ok
print(ans) |
p03069 | s033225615 | Accepted | from sys import stdin
n = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()
kuro = s.count("#")
shiro = n-kuro
mi = shiro
k = 0
sh = shiro
for i in range(n):
if s[i] == "#":
k += 1
else:
sh -= 1
mi = min(mi,k+sh)
print(mi) |
p03838 | s086397177 | Accepted | x, y = map(int, input().split())
print(min(abs(~x+y), abs(y+x))+1)
|
p02946 | s162804963 | Accepted | k, x = map(int, input().split())
for i in range(x - k + 1, x + k):
print(i, end=" ")
|
p02759 | s891157861 | Accepted | import math
s = int(input())
print(math.ceil(s / 2)) |
p03137 | s663635305 | Wrong Answer | import numpy as np
import sys
n, m = map(int, input().split())
if n >= m:
print(0)
sys.exit()
x = [int(i) for i in input().split()]
x = np.array(sorted(x))
diff = np.abs(np.diff(x))
diff = sorted(diff)
print(sum(diff[:-n + 1])) |
p03319 | s314548033 | Accepted | n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
ans=1
n=n-k
while n>0:
n=n-k+1
ans+=1
print(ans) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.