problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p02621 | s128807746 | Accepted | a = int(input())
print(a + a ** 2 + a ** 3)
|
p03107 | s313948971 | Accepted | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
s = input()
n = len(s)
last = []
ans = 0
i = 0
last = []
while i<n:
if last and s[i]!=last[-1]:
ans += 2
last.pop()
i += 1
else:
last.append(s[i])
i += 1
print(ans) |
p03617 | s378172391 | Wrong Answer | q,h,s,d=map(int,input().split())
n=int(input())
ans=0
if n%2:
ans+=min(4*q,2*h,s)
n-=1
print(int(ans+n*min(4*q,2*h,s,d/2))) |
p03852 | s789453069 | Accepted | x = str(input())
if x == "a" or x == "i" or x == "u" or x == "e" or x == "o":
print("vowel")
else:
print("consonant") |
p02578 | s827585472 | Wrong Answer | n = int(input())
wa = 0
m = 0
l = list(map(int, input().split()))
for i in range(1, n):
m = max(l[i], m)
if m >= l[i]:
wa += m - l[i]
print(wa) |
p03071 | s902054481 | Accepted | a, b = map(int, input().split())
ans = max(a+a-1, a+b, b+b-1)
print(ans) |
p02971 | s517353869 | Accepted | n = int(input())
A = [int(input()) for _ in range(n)]
maxA = max(A)
maxIdx = A.index(maxA)
for i in range(n):
if i != maxIdx:
print(maxA)
else:
print(max(A[:i] + A[i + 1:])) |
p03795 | s459559911 | Wrong Answer | n = int(input())
cash_out = 600 * n
count_back = n//15
cash_in = 200 *count_back
cash_net = cash_out - cash_in
print(cash_net) |
p03681 | s200698278 | Wrong Answer | # C - Reconciled?
N, M = map(int,input().split())
S = 1
for i in range(1,min(N,M)):
S *= i % 1000000007
ans = 0
if abs(N-M) > 1:
ans = 0
elif abs(N-M) == 1:
ans = S*S*max(N,M)
else:
ans = S*S*2
ans = ans % 1000000007
print(ans)
|
p03035 | s534390740 | Accepted | A,B = map(int,input().split())
if A >= 13:
print(B)
elif A >= 6 and A <= 12:
print(int(B/2))
elif A <= 5:
print(0) |
p03379 | s984280756 | Accepted | n = int(input())
X = list(map(int, input().split()))
S = sorted(X)
t = S[n//2]
s = S[n//2-1]
for i in range(n):
if X[i] >= t: print(s)
else: print(t) |
p02693 | s081454888 | Wrong Answer | import math
#def getTotal(now_depo, now_year, goal):
# if(now_depo >= goal):
# return now_year
# else:
# return getTotal(math.floor(now_depo * 1.01), now_year + 1, goal)
goal = int(input())
depo = 100
#print(getTotal(depo, 0, goal))
now_year = 0
while (True):
depo = math.floor(depo * 1.01)
now_year += 1
if(depo >= goal):
print(now_year)
break |
p03814 | s432658564 | Accepted | S = input()
A = S.index("A")
Z = len(S) - S[::-1].index("Z")
print(Z-A)
|
p02555 | s015013734 | Accepted | import math
s = int(input())
if s < 3:
print("0")
else:
bar = (s // 3) - 1
ans = 0
for i in range(bar+1):
if i == 0:
ans += 1
else:
val = s - 3 * (i+1)
count = math.factorial(val+i) // (math.factorial(val) * math.factorial(i))
ans += count % (10**9+7)
print(ans%(10**9+7)) |
p02785 | s548845303 | Wrong Answer | N,K = map(int,input().split())
H = list(map(int,input().split()))
if K==0:
print(sum(H))
elif N>K:
x=max(H)
print(sum(H)-x)
else:
print(0) |
p02995 | s161063727 | Accepted | from fractions import gcd
a,b,c,d = map(int, input().split())
x = (c*d) // gcd(c,d)
c1, d1, cd1 = b // c, b // d, b // x
c2, d2, cd2 = (a-1) // c, (a-1) // d, (a-1) // x
ans = (c1+d1-cd1) - (c2+d2-cd2)
print(b-a+1-ans) |
p03860 | s135916458 | Accepted | a,s,c = input().split()
print("A"+s[0]+"C") |
p03673 | s571606302 | Accepted | from collections import deque
n = int(input())
A = list(map(str, input().split()))
b = deque()
for i in range(n):
if i % 2 == n % 2:
b.append(A[i])
else:
b.appendleft(A[i])
print(" ".join(list(b))) |
p02707 | s522948617 | Accepted | n = int(input())
a = [int(x) for x in input().split()]
buka = [0]*n
for i in range(n-1):
buka[a[i]-1] += 1
for i in range(n):
print(buka[i]) |
p03131 | s439179895 | Wrong Answer | K, A, B = map(int, input().split())
if B - A <= 2 or K <= A:
print(K + 1)
else:
print(A + ((K - A + 1) // 2) * (B - A) + ((K - A + 1) // 2)) |
p03261 | s129164458 | Accepted | if __name__ == "__main__":
n = int(input())
w = list()
for i in range(n):
w.append(input())
t = set(w)
if len(t) != n:
print('No')
exit()
end = w[0][-1]
for i in range(1, n):
if w[i][0] != end:
print('No')
exit()
end = w[i][-1]
print('Yes')
|
p03043 | s675408411 | Wrong Answer | n,k = map(int, input().split())
rate_total = []
for i in range(1,n+1):
score = i
rate = 1/n
while(score < 10):
rate *= (1/2)
score *= 2
rate_total.append(rate)
print(sum(rate_total)) |
p03137 | s989555317 | Accepted |
def solve():
if N >= M:
return 0
elif N == 1:
cnt = abs(X[-1] - X[0])
return cnt
L = [0] * (M-1)
for i in range(len(L)):
L[i] = X[i+1] - X[i]
L.sort()
return sum(L[:M-N])
if __name__=="__main__":
N,M = list(map(int, input().split()))
X = list(map(int, input().split()))
X.sort()
print(solve())
|
p02578 | s140317505 | Accepted | n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(1,n):
if a[i]<a[i-1]:
ans+=a[i-1]-a[i]
a[i]=a[i-1]
print(ans) |
p02951 | s844090739 | Wrong Answer | A,B,C=map(int,input().split());print(C-A+B) |
p04020 | s534919786 | Accepted |
def read_int():
return int(input().strip())
def read_ints():
return list(map(int, input().strip().split(' ')))
def solve():
N = read_int()
answer = 0
last = 0
for _ in range(N):
a = read_int()
if a != 0:
answer += (last+a)//2
last = (last+a)%2
else:
last = 0
return answer
if __name__ == '__main__':
print(solve())
|
p03673 | s509295396 | Accepted | n=int(input())
a=input().split()
numbers=[b for b in a]
n=len(numbers)
if n%2==0:
kisuu=numbers[1::2]
guusuu=numbers[0::2]
kisuu.reverse()
kotae=kisuu+guusuu
else:
kisuu=numbers[1::2]
guusuu=numbers[0::2]
guusuu.reverse()
kotae=guusuu+kisuu
answer=''
for z in kotae:
answer+=str(z)
answer+=' '
print(answer)
|
p02621 | s812021449 | Wrong Answer | a=int(input())
print(a+a^2+a^3) |
p03331 | s691046134 | Accepted | from sys import stdin
import math
N = int(stdin.readline().rstrip())
A=0
B=N-A
def sum_of_digit(n):
total = 0
s = str(n)
for i in range(len(s)):
total = total + int(s[i:i+1])
return total
minimum = 9999999999
for a in range(1,N):
a_total = sum_of_digit(a)
b = N - a
b_total = sum_of_digit(b)
minimum = min(minimum, a_total + b_total)
print(minimum)
|
p02778 | s710773251 | Accepted | S=input()
ans=''
for _ in range(len(S)):
ans+='x'
print(ans) |
p02854 | s733554440 | Accepted | import sys
def input(): return sys.stdin.readline().strip()
def resolve():
from itertools import accumulate
N = int(input()) # len(A)
A = list(map(int, input().split()))
zenbu=sum(A)
B = [0] + A
B = list(accumulate(B))
C = [zenbu]*(N+1)
import numpy as np
B=np.array(B)
C=np.array(C)
D=C-B
ans=10**18
for i in range(1, N):
ans = min(abs(B[i]-D[i]),ans)
print(ans)
resolve() |
p03387 | s321479830 | Wrong Answer | import sys
import math
a, b, c = map(int, input().split())
ma=max(a, max(b, c))
if 3 *ma %2 ==(a + b + c)%2:
print((3 * ma) - (a + b + c)// 2)
else:
print((3 * (ma+1)) - (a + b + c)// 2)
|
p03745 | s609339587 | Accepted | n=int(input())
a=list(map(int,input().split()))
x=[]
ans=1
for i in range(n-1):
if a[i+1]==a[i]:
continue
x.append(a[i+1]-a[i])
flag=True
for i in range(len(x)-1):
if flag==False:
flag=True
continue
if x[i]<0 and x[i+1]>0 or x[i]>0 and x[i+1]<0:
ans+=1
flag=False
print(ans)
|
p02546 | s591374339 | Accepted | S=input()
if S[-1:]=="s":
print(S+"es")
else:
print(S+"s") |
p02760 | s864677911 | Accepted | a=[list(map(int,input().split())) for _ in range(3)]
f=[[0]*3 for _ in range(3)]
for _ in range(int(input())):
x=int(input())
for i in range(3):
for j in range(3):
if x==a[i][j]:
f[i][j]=1
ans=0
for i in range(3):
if all(f[i][j] for j in range(3)) or all(f[j][i] for j in range(3)):
ans=1
if f[0][0]==f[1][1]==f[2][2]==1 or f[0][2]==f[1][1]==f[2][0]==1:
ans=1
print("Yes" if ans else "No") |
p03067 | s934989330 | Accepted | a, b, c = map(int, input().split())
if a < b:
if a < c and c < b:
print('Yes')
else:
print('No')
else:
if b < c and c < a:
print('Yes')
else:
print('No') |
p03293 | s022847721 | Accepted | s, t = input(), input()
for i in range(len(t)):
if s == t:
print('Yes')
exit()
s = s[1:] + s[:1]
print('No') |
p02595 | s247310237 | Wrong Answer | n, d = map(int, input().split())
count = 0
for i in range(n):
x, y = map(int, input().split())
if pow((pow(x, 2) + pow(y, 2)), 0.5) >= d:
count += 1
print(count) |
p02576 | s973709192 | Wrong Answer | n, x, t = map(int, input().split())
if n%x == 0:
print(n//x * t)
else:
print((n//x + 1)+t) |
p03625 | s447936842 | Wrong Answer | import collections
N = int(input())
A = [int(x) for x in input().split()]
c = collections.Counter(A)
cc = {k:v for k, v in c.items() if v>1}
if len(cc) > 1:
ccc = sorted(list(cc.keys()))[-2:]
print(ccc[0] * ccc[1])
elif len(cc)==1 and max(cc.values()) > 3:
print(cc.popitem()[0] * 2)
else:
print(0) |
p02732 | s522363596 | Accepted | n=int(input())
li=list(map(int,input().split()))
d={}
dif={-1}
ans={}
for i in range(n):
if li[i] not in dif:
dif|={li[i]}
if d.get(li[i])!=None:
d[li[i]]+=1
else:
d[li[i]]=1
dif.remove(-1)
g=0
for i in dif:
g+=d[i]*(d[i]-1)//2
for i in dif:
ans[i]=g-(d[i]-1)*d[i]//2+(d[i]-2)*(d[i]-1)//2
for i in li:
print(ans[i]) |
p03338 | s871865767 | Accepted | n = int(input())
s = input()
lst = []
for i in range(1,n-1):
left = s[:i]
right = s[i:]
cnt = 0
for j in set(left):
if j in set(right):
cnt += 1
lst.append(cnt)
if not lst:
print(0)
else:
print(max(lst)) |
p03774 | s238255127 | Wrong Answer | n,m=map(int,input().split())
l_n=[list(map(int,input().split())) for _ in range(n)]
l_m=[list(map(int,input().split())) for _ in range(m)]
for i,j in l_n:
distance=0
cnt = 0
ans = float ( "inf" )
for k,l in enumerate(l_m):
a,b=l
distance=(i-a)**2+(j-b)**2
if ans>distance:
ans=min(ans,distance)
cnt=k+1
print(cnt)
|
p02640 | s193363995 | Accepted | def main():
X, Y = map(int, input().split())
flag = False
for i in range(0, X+1):
for j in range(0, X+1):
if i + j == X and i*2 + j*4 == Y:
flag = True
if flag:
print("Yes")
else:
print("No")
if __name__ == '__main__':
main() |
p03146 | s040737727 | Accepted | import sys
s = int(input())
def collatz(n):
if n%2 == 0:
return (n//2)
else:
return 3*n+1
A = [s]
while True:
A.append(collatz(A[-1]))
for i in range(0,len(A)):
for j in range(0,len(A)):
if A[i] == A[j] and i!= j:
print(j+1)
sys.exit(0)
|
p03282 | s526244853 | Accepted | txt = input()
n = int(input())
for i in range(n):
if txt[i] != '1':
print(txt[i])
break
else:
print("1") |
p02795 | s036325926 | Wrong Answer | h=int(input())
w=int(input())
n=int(input())
x = n/(h if w <= h else w)
print(x if int(x) == x else int(x)+1) |
p02771 | s716445105 | Wrong Answer | a,b,c=map(int,input().split())
if a==b and b==c: print('No')
elif a!=b and b!=c:print('No')
else:print('Yes') |
p03371 | s046235506 | Wrong Answer | a,b,c,x,y=map(int,input().split());print(min(c*2*min(x,y)+abs(x-y)*min(a,b,2*c),a*x+b*y)) |
p02848 | s282654045 | Accepted | n = int(input())
s = input()
mozi = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
for x in s:
number = mozi.index(x) + n
if number > 25:
number = number - 26
print(mozi[number], end="")
|
p02720 | s731932424 | Wrong Answer | def lunlun(x):
c=0
l=list(str(x))
for i in range(len(l)):
l[i]=int(l[i])
l.sort()
c=0
for i in range(1,len(l)):
if abs(l[i]-l[i-1])<=1:
c=c+1
if c==len(l)-1:
return True
else:
return False
n=int(input())
c=0
i=1
while c!=n:
if lunlun(i):
c=c+1
i=i+1
print(i-1) |
p03274 | s859206039 | Accepted | import bisect
n,k = map(int,input().split())
x = list(map(int,input().split()))
zero = bisect.bisect(x,0)
left = [0] + (x[:zero])[::-1]
right = [0] + x[zero:]
ans = 10**12
for i in range(min(k+1,len(left))):
j = k-i
if j >= len(right):
continue
ans = min(ans,2*right[j]-left[i],-2*left[i]+right[j])
print(ans) |
p03106 | s725957872 | Accepted | # 与えられた数値の桁数と桁値の総和を計算する.
def calc_digit_sum(num):
digits = sums = 0
while num > 0:
digits += 1
sums += num % 10
num //= 10
return digits, sums
cnt = 0
a, b, k = map(int, input().split())
for num in range(max(a, b), -1, -1):
if a % num == 0 and b % num == 0:
cnt += 1
if k == cnt:
print(num)
exit() |
p02823 | s331120168 | Accepted | n, a, b = map(int, input().split())
if (b - a) % 2 == 0:
print(-(-(b - a) // 2))
else:
print(min(a - 1 + -(-(b - a + 1) // 2), n - b + -(-(b - a) // 2))) |
p02983 | s860765676 | Accepted | L,R = map(int,input().split())
ans = 4000
for i in range(L,R+1):
for j in range(i+1,R+1):
ans = min(ans,i*j%2019)
if ans == 0:
break
else:
continue
break
print(ans)
|
p02608 | s254751700 | Accepted | N = int(input())
l = [0] + [0] * N
for x in range(1, 101):
for y in range(1, 101):
for z in range(1, 101):
temp = x**2 + y**2 + z**2 + x * y + y * z + z * x
if temp <= N:
l[temp] += 1
# print(l)
for i in range(1, N + 1):
print(l[i])
|
p03011 | s348318734 | Accepted | pqr = list(map(int, input().split()))
print(sum(pqr) - max(pqr)) |
p03437 | s152027174 | Accepted | X,Y = map(int,input().split())
if X%Y == 0:
print(-1)
else:
print(X) |
p03997 | s419509490 | Wrong Answer | a=int(input())
b=int(input())
h=int(input())
print((a+b)*h/2) |
p02603 | s296162043 | Accepted | n,*a=map(int,open(0).read().split())
ans=1000
for i,j in zip(a,a[1:]):
if i<j:
ans+=ans//i*abs(i-j)
print(ans) |
p02818 | s805232681 | Accepted | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
inf = 10**17
mod = 10**9+7
a, b, k = map(int, input().split())
x = y = 0
if a < k: x = 0
elif k < a:
print(a - k, b)
exit(0)
else: x = k - a
k -= a
if b < k: y = 0
else: y = b - k
print(x, y)
|
p03785 | s752697041 | Accepted | n,C,T=map(int,input().split())
t=[int(input()) for i in range(n)]
t.sort()
res=t[0]+T
cnt=1
ans=0
for i in range(1,n):
if t[i]<=res and cnt<C:
cnt+=1
elif t[i]>res or cnt==C:
ans+=1
res=t[i]+T
cnt=1
print(ans+1) |
p02838 | s272339506 | Wrong Answer | import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
K = 60
bit_nums = [0 for _ in range(K)]
ans = 0
mod = 10 ** 9 + 7
for i in range(K):
bit_nums[i] = np.sum(A >> i & 1)
ans = 0
for i in range(K):
ans += (2 ** i) * (bit_nums[i] * (N - bit_nums[i]))
ans %= mod
print(ans)
|
p03059 | s855438525 | Wrong Answer | a,b,t = map(int,input().split())
ans = t//a*5
print(ans)
|
p02957 | s185265383 | Accepted | a, b = map(int, input().split())
if a > b:
K = a+b
else:
K = b+a
if K % 2 == 0:
print(K//2)
else:
print('IMPOSSIBLE') |
p02665 | s989955874 | Accepted | N = int(input())
nums = list(map(int, input().split()))
nodes = []
currentLeaf = 1
fail = False
#check from top
for i in range(N + 1):
nodes.append(currentLeaf)
currentLeaf = (currentLeaf-nums[i])*2
if (currentLeaf < 0):
fail = True
break
if (fail):
print(-1)
else:
#check from bottom
currentLeaf = 0
totalNode = 0
for i in reversed(range(N+1)):
currentLeaf += nums[i]
currentLeaf = min(currentLeaf, nodes[i])
totalNode += currentLeaf
if (fail):
print(-1)
else:
print(totalNode) |
p02994 | s874690197 | Accepted | N,L=map(int,input().split())
taste=list(range(L,N+L))
taste2=[]
for i in range(N):
taste2.append((taste[i])**2)
X=0
for i in range(N):
if taste2[i]==min(taste2):
X+=taste[i]
print(sum(taste)-X) |
p02627 | s889089844 | Wrong Answer | a = input()
if a.isupper:
print('A')
else:
print('a') |
p03633 | s500444197 | Accepted | from math import gcd
n = int(input())
t = list([int(input()) for _ in range(n)])
x = 1
for i in t:
x = x*i//gcd(x,i)
print(x) |
p03145 | s765200236 | Accepted | AB, BC, CA = map(int, input().split())
print(AB*BC//2) |
p03030 | s876107214 | Accepted | N = int(input())
R_L = []
for n in range(N):
S,P = input().split()
R_L.append([S,int(P)])
R_L2 = R_L.copy()
R_L2.sort( key=lambda x:(x[0],-x[1]))
for r in R_L2:
print(R_L.index(r)+1) |
p04019 | s195333375 | Accepted | A = set(list(input()))
if len(A) == 2 and("S" in A and "N" in A ):
print("Yes")
elif len(A) == 2 and ("W" in A and "E" in A):
print("Yes")
elif len(A) == 4:
print("Yes")
else:
print("No") |
p02829 | s822499990 | Accepted | a=int(input())
b=int(input())
print(6-(a+b)) |
p03286 | s527865475 | Wrong Answer | n=int(input())
ans=[]
while n!=0:
r=n%2
ans.append(r)
n=int((n-r)/(-2))
ans.reverse()
for i in ans:
print(i,end='')
|
p03282 | s765588935 | Accepted | S = [int(i) for i in input()]
K = int(input())
if sum(S)==len(S):
print(1)
else:
for i in range(len(S)):
if S[i]!=1:
print(S[i])
break
elif S[i]==1 and K-1<=i:
print(1)
break |
p02780 | s339222304 | Accepted | n, k = map(int, input().split())
P = list(map(int, input().split()))
P_ac = [sum(P[:k])]
for i in range(n-k):
P_ac.append(P_ac[-1]-P[i]+P[i+k])
print((max(P_ac)+k)/2) |
p03419 | s726435245 | Accepted | N, M = map(int, input().split())
print(abs((N-2)*(M-2))) |
p02707 | s656536602 | Accepted | N = int(input())
A = list(map(int,input().split()))
ans = [0] * N
for i in range(N-1):
ans[A[i]-1] += 1
for i in range(N):
print(ans[i]) |
p02707 | s155224077 | Wrong Answer | N = int(input())
now = 1
sum = 0
for i in sorted(list(map(int,input().split()))):
if(now == i):
sum += 1
else:
for j in range(i - now -1):
print(0)
print(sum)
sum = 1
now = i
else:
print(sum)
while(now < N):
print(0)
now += 1
|
p03438 | s575877220 | Accepted | N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = [_b-_a for _a, _b in zip(a, b)]
x, y = 0, 0
for _c in c:
if _c > 0:
x += _c//2
else:
y -= _c
if x >= y:
print('Yes')
else:
print('No') |
p03721 | s701646482 | Accepted |
def main2():
import heapq
n,k = map(int,input().split(" "))
q = []
for i in range(n):
a,b = map(int,input().split(" "))
heapq.heappush(q,(a,b))
while k>0:
a,b = heapq.heappop(q)
k-=b
print(a)
main2() |
p02939 | s810852336 | Accepted | s = input()
l = len(s)
dp = [[0, 0] for _ in range(l + 1)]
dp[1][0] = 1
for i in range(2, l + 1):
if s[i - 1] != s[i - 2]:
dp[i][0] = dp[i - 1][0] + 1
dp[i][0] = max(dp[i][0], dp[i - 1][1] + 1)
dp[i][1] = dp[i - 2][0] + 1
print(max(dp[-1]))
|
p02995 | s041589547 | Accepted | import math
A,B,C,D = map(int,input().split())
#C,Dの最小公倍数
E = C*D//math.gcd(C,D)
def num_mult(fro,to,mult):
goal = to//mult
if fro % mult == 0:
start = fro // mult
else:
start = fro // mult + 1
return goal - start + 1
ans = B-A+1
#Cの倍数
ans -= num_mult(A,B,C)
#Dの倍数
ans -= num_mult(A,B,D)
#C,Dの公倍数
ans += num_mult(A,B,E)
print(ans) |
p02664 | s931591724 | Accepted | t = input()
s = list(t)
for i in range(len(s)):
if s[i] == '?':
if i > 0 and s[i - 1] == 'P':
s[i] = 'D'
elif i < len(s) - 1 and s[i + 1] == 'D':
s[i] = 'P'
else:
s[i] = 'D'
print(''.join(s))
|
p02714 | s227198863 | Accepted | import math
n = int(input())
s = input()
r = s.count("R")
g = s.count("G")
b = s.count("B")
ans = r * g * b
for i in range(n-2):
for j in range(i+1,math.ceil((i+n)/2)):
if s[i] != s[j] and s[j] != s[j*2-i] and s[j*2-i] != s[i]:
ans -= 1
print(ans) |
p02829 | s934200515 | Wrong Answer | A=int(input())
B=int(input())
ans=[1,2,3]
ans.remove(A)
ans.remove(B)
print(ans)
|
p02601 | s674436293 | Accepted | a,b,c = map(int,input().split())
k = int(input())
for _ in range(k):
if b <= a:
b*=2
elif c <= b:
c*=2
if c > b > a:
print('Yes')
else:
print('No') |
p02952 | s278376598 | Wrong Answer | # coding: utf-8
num = int(input())
if num < 10:
print(num)
elif num < 100:
print(9)
elif num < 1000:
print(10 + int(num % 100))
elif num < 10000:
print(10 + 999)
elif num < 100000:
print(9 + 1000 + num % 1000)
elif num == 100000:
print(90909) |
p03998 | s383273743 | Accepted | s = {c:list(input()) for c in "abc"}
x = "a"
while s[x]:
x = s[x].pop(0)
print(x.upper()) |
p02982 | s828862628 | Wrong Answer | n,d = map(int,input().split())
import numpy as np
xlist = [list(map(int,input().split())) for i in range(n)]
xarray = np.array(xlist)
ans = 0
for i in range(n):
for j in range(i+1,n):
if np.linalg.norm(xarray[i]-xarray[j])%1!=0:
ans+=1
print(ans) |
p03131 | s035582946 | Wrong Answer | K,A,B=map(int,input().split())
bis=1
if K==1:
bis+=1
elif A>=B-1 or K-A+1<=0:
bis+=K
else:
if int((K-(A-1)))%2==0:
bis=int(A+(B-A)*(K-(A-1))/2)
else:
bis=A+(B-A)*int((K-(A-1))//2)+1
print(bis) |
p03211 | s103465698 | Accepted | s = input()
ans = []
for i in range(len(s)-2):
ans.append(abs(int(s[i:i+3])-753))
print(min(ans))
|
p03103 | s106652161 | Accepted | n, m = map(int, input().split())
ab = [tuple(map(int, input().split())) for _ in range(n)]
ab.sort()
ans = 0
for a, b in ab:
buy = [m, b][0 <= m-b]
m -= buy
ans += a*buy
print(ans)
|
p02777 | s049026633 | Accepted | col = input().split()
num = list(map(int, input().split()))
col2 = input()
if col[0] == col2:
print(num[0] - 1, num[1])
elif col[1] == col2:
print(num[0], num[1] - 1)
|
p03013 | s813281307 | Accepted | n,m=map(int,input().split())
flag=list(1 for _ in range(n+1))
count=list(0 for _ in range(n+1))
ans=0
for i in range(m):
x=int(input())
flag[x]=0
if n==1:
ans=1
else:
if flag[1]==1:
count[1]=1
if flag[2]==1:
count[2]=count[1]+1
for i in range(3,n+1):
if flag[i]==1:
count[i]=count[i-1]+count[i-2]
ans=count[n]
print(ans%(10**9+7))
|
p03720 | s396328912 | Accepted | n, m = map(int, input().split())
num = [0] * n
for x in range(0, m):
a, b = map(int, input().split())
num[a-1] += 1
num[b-1] += 1
for x in range(0, n):
print(num[x])
|
p03485 | s458888186 | Accepted | import math
a,b = map(int,input().split())
print(math.ceil((a+b)/2)) |
p03796 | s121102195 | Accepted | n = int(input())
t = 10 ** 9 + 7
ans = 1
for i in range(1, n + 1):
ans *= i
ans %= t
print(ans)
|
p02818 | s208961477 | Wrong Answer | a,b,k = map(int,input().split())
if a >= k:
print(str(a - k) + " " + str(b))
else:
print("0" + " " + str(b - k + a)) |
p03448 | s709366594 | Wrong Answer | a = int(input())
b = int(input())
c = int(input())
x = int(input())
cnt = 0
for h in range(0,c):
for i in range(0,b):
for j in range(0,a):
if (x == ((500 * j) + (100 * i) + (50 * h))):
cnt = cnt +1
print(cnt)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.