problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p03815 | s629736962 | Accepted | x = int(input())
if x <= 6:
print(1)
elif x % 11 == 0:
print((x // 11)*2)
elif x % 11 <= 6:
print((x // 11)*2 + 1)
else:
print((x // 11)*2 + 2) |
p03131 | s675018625 | Wrong Answer | k,a,b=map(int,input().split())
ans=(b-a)*(k//(a+1))+(k-k//(a+1)) if k>=a+1 else 1+k
print(ans) |
p03695 | s343625697 | Accepted | N = int(input())
A = list(map(int,input().split()))
cs = [0]*9
for a in A:
if a >= 3200:
cs[-1] += 1
else:
cs[a//400] += 1
mn = len([1 for c in cs[:-1] if c>0])
if mn==0:
print(1,N)
else:
print(mn,mn+cs[-1]) |
p03286 | s088923463 | Accepted | import sys
def encode(n:int) -> str:
if n == 0:
return '0'
if n == 1:
return '1'
if n % 2 == 1:
ans = '{}1'.format(encode((n-1) // (-2)))
sys.stderr.write('{} for {}'.format(ans, n))
sys.stderr.write('\n')
return ans
if n % 2 == 0:
ans = '{}0'.format(encode(n // (-2)))
sys.stderr.write('{} for {}'.format(ans, n))
sys.stderr.write('\n')
return ans
n = int(input())
ans = encode(n)
print(ans)
|
p04029 | s401033191 | Wrong Answer | s = 0
i = 1
while i <= 100:
s = s + i
i += 1
print(s) |
p02817 | s839794329 | Accepted | a = input().split()
a = a[::-1]
a = ''.join(a)
print(a) |
p03317 | s986416362 | Accepted | n,k=map(int,input().split())
a=list(map(int,input().split()))
print(-(-(n-1)//(k-1)))
|
p03815 | s583118972 | Wrong Answer | x = int(input())
s = x // 11
t = x % 11
if t > 6:
print(s * 2 + 2)
else:
print(s * 2 + 1) |
p02556 | s836185656 | Wrong Answer | import sys
import itertools
N = int(input())
Z = [list(map(int,input().split())) for _ in range(N)]
ans = 0
ZX = sorted(Z,key=lambda x: x[0])
ZY = sorted(Z,key=lambda x: x[1])
ZZ = [ZX[0],ZX[-1],ZY[0],ZY[-1]]
for x in itertools.combinations(ZZ,2):
ans = max(ans, abs(x[0][0]-x[1][0])+abs(x[0][1]-x[1][1]))
print(ans) |
p03206 | s363608270 | Accepted | D = int(input())
A = ["Christmas"]
for i in range(25 - D):
A.append("Eve")
S = ' '.join(A)
print(S)
|
p03711 | s988530924 | Accepted | x,y = map(int,input().split())
# al = list(map(int,input().split()))
a =[1,3,5,7,8,10,12]
b = [4, 6,9,11]
c = [2]
if x in a and y in a:
print('Yes')
elif x in b and y in b:
print('Yes')
elif x in c and y in c:
print('Yes')
else:
print('No')
|
p03067 | s265995329 | Wrong Answer | a, b, c = map(int, input().split())
a, c = sorted([a, c])
print('Yes' if a <= c and c <= b else "No") |
p04033 | s915361067 | Accepted | a,b = map(int,input().split())
if a > 0:
print("Positive")
elif a <= 0 and 0 <= b:
print("Zero")
else:
if a % 2 == b % 2:
print("Negative")
else:
print("Positive") |
p02660 | s987669568 | Wrong Answer | sosuu = [2]
A = int(input())
for L in range(3, A+1, 2): # 2 以外の素数は奇数なので
for L2 in sosuu:
if L % L2 == 0:
break # 素数でないことがわかったらそれ以上ループする必要はない
else: # break で抜けることがなかったら L は素数(Python 特有の制御構文)
sosuu.append(L)
ans=0
for i in sosuu:
if A%i==0:
ans+=1
A/=i
print(ans) |
p02570 | s793111316 | Wrong Answer | D,T,S=map(int,input().split())
if D/S<=15:
print('Yes')
else:
print('No') |
p02761 | s735544528 | Wrong Answer | f=lambda:map(int,input().split())
N,M=f()
q=[list(f()) for _ in [0]*M]
res=-1
for i in range(10**(N-1),10**N):
for j in range(M):
if str(i)[q[j][0]-1]!=str(q[j][1]):
break
else:
res=i
break
print(res) |
p02645 | s980734498 | Wrong Answer | # -*- coding: utf-8 -*-
_in = input()
# if True:
# print(_in)
# else:
# print(_in)
print(_in[1:3]) |
p02748 | s766730321 | Accepted | A,B,M = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = min(a) + min(b)
for i in range(M):
x,y,d = map(int,input().split())
c = min(c,a[x-1]+b[y-1]-d)
print(c) |
p03408 | s511372631 | Wrong Answer | from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for _ in range(m)]
cnt = Counter(s)
ans = 0
for k, v in cnt.items():
if k in t:
pass
else:
ans = max(ans, v)
print(ans) |
p03448 | s188170740 | Accepted | A,B,C,X = [int(input()) for _ in range(4)]
ans = 0
for a in range(A+1):
for b in range(B+1):
for c in range(C+1):
if a*500+b*100+c*50 == X:
ans += 1
print(ans) |
p02823 | s041098370 | Accepted | import sys
sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inl = lambda: [int(x) for x in sys.stdin.readline().split()]
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))
def solve():
n, a, b = inl()
if (b - a) % 2 == 0:
return (b - a) // 2
k = min(a - 1, n - b)
return k + 1 + (b - a) // 2
print(solve())
|
p03038 | s002771170 | Wrong Answer | N,M=map(int,input().split())
A=list(map(int,input().split()))
B=[0]*M
C=[0]*M
D=[]
for i in range(M):
B[i],C[i]=map(int,input().split())
D+=[C[i]]*B[i]
D.reverse()
A.sort()
for i in range(sum(B)):
if A[i] < D[i]:
A[i]=D[i]
else:
break
if i==N-1:
break
print(sum(A))
|
p02689 | s034856341 | Accepted | n,m = map(int,input().split())
l = list(map(int,input().split()))
d = {}
each = []
for i in range(m):
sou,des = map(int,input().split())
each.append(sou)
each.append(des)
if sou not in d:
d[sou] = [des]
else:
d[sou].append(des)
if des not in d:
d[des] = [sou]
else:
d[des].append(sou)
#print(d)
#print(dic)
count = 0
for i in d:
flag = True
for j in d[i]:
if l[i-1] <= l[j-1]:
flag = False
break
if flag:
count += 1
count += (n - len(set(each)))
print(count) |
p02952 | s202653199 | Wrong Answer | n = int(input())
total = 0
for i in range(n+1):
if (len(str(i))%2 != 0):
total += 1
print(total)
|
p02888 | s621464113 | Accepted | n = int(input())
l = sorted(map(int, input().split()))
cnt = 0
m = n-1
g = []
for i in range(n):
for j in range(i):
g.append(l[i]+l[j])
g = sorted(g,reverse = True)
for i in g:
while l[m] >= i:
m-=1
cnt += n-m-1
print(n*(n-1)*(n-2)//6-cnt) |
p02970 | s118285145 | Accepted | a,b = map(int,input().split())
c = -(-a//(b*2+1))
print(c)
|
p02996 | s306587057 | Wrong Answer | import heapq
n = int(raw_input())
heap = [map(int, raw_input().split(' '))[::-1] for _ in range(n)]
heapq.heapify(heap)
def f(heap):
t = 0
while(heap):
nd,ct = heapq.heappop(heap)
gap = nd - t
while(heap and heap[0][0] == nd):
u,v = heapq.heappop(heap)
ct += v
gap -= v
if gap < 0: return False
while(heap and heap[0][1] <= gap):
_,v = heapq.heappop(heap)
gap -= v
t += v
return True
print 'Yes' if f(heap) else 'No' |
p02759 | s812197549 | Accepted | N = int(input())
S = N // 2
if N % 2 == 0:
print(S)
elif N % 2 == 1:
print(S+1) |
p03137 | s880424375 | Wrong Answer | N,M = map(int,input().split())
X = sorted(list(map(int,input().split())))
B=[]
#print(X)
for i in range(M-1):
B.append(abs(abs(X[i+1])-abs(X[i])))
B.sort()
#print(B)
print(sum(B[:-(N-1)]))
|
p02789 | s757605196 | Wrong Answer | N, M = map(int, input().split())
if N >= M: print('Yes')
else: print('No') |
p02924 | s247149578 | Accepted | n=int(input())
res=n*(n-1)//2
print(res) |
p02646 | s830801373 | Accepted | A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
dist = abs(B-A)
spd = V-W
ans = "YES"
if spd*T < dist:
ans = "NO"
print(ans)
|
p03076 | s788371198 | Accepted | a = [int(input()) for i in range(5)]
#10で割った余りが0でないもののうち、余りが一番小さい品を最後に注文するのが最も早くなる
last = -1
for i in range(5):
if a[i] % 10 != 0:
last = i
break
if last == -1:
last = 0
else:
for i in range(5):
if a[i] % 10 < a[last] % 10 and a[i] % 10 != 0:
last = i
ans = 0
for i in range(5):
if i == last:
continue
ans += a[i]
if ans % 10 != 0:
ans += 10 - (a[i] % 10)
ans += a[last]
print(ans) |
p04019 | s607541576 | Accepted | import sys
input = sys.stdin.readline
S = list(input())[: -1]
n = S.count("N") > 0
e = S.count("E") > 0
s = S.count("S") > 0
w = S.count("W") > 0
if n and s or (n == 0 and (s == 0)):
if e and w or (e == 0 and (w == 0)):
print("Yes")
exit(0)
print("No") |
p03778 | s185723572 | Accepted | W,a,b =map(int,input().split())
if b>=a:
if b-(a+W)<0:print(0)
else:print(b-(a+W))
else :
if a-(b+W)<0:print(0)
else:print(a-(b+W))
|
p03910 | s323734595 | Accepted | n = int(input())
num = 0
for k in range(1,n+1):
#print(k)
if k*(k+1) >=2*n:
break
if k*(k+1) == 2*n:
for i in range(k):
print(i+1)
else:
num = k*(k+1)//2-n
#print(num,k*(k+1)//2)
for i in range(k):
if i+1 == num:
continue
else:
print(i+1) |
p02665 | s905914344 | Accepted | def main():
n = int(input())
a = list(map(int, input().split()))
dp = []
now = 1
ans = 0
for i in range(n+1):
if a[i] > now:
print(-1)
return
else:
dp.append(now)
now -= a[i]
now *= 2
now = 0
for i in range(n, -1, -1):
now += a[i]
ans += min(now, dp[i])
print(ans)
main()
|
p02723 | s532951691 | Accepted | s=input()
ans = 'No'
if s[2] == s[3]:
if s[4] == s[5]:
ans = 'Yes'
print(ans) |
p02730 | s430437938 | Accepted | s=input()
if len(s)%2==1:
n1=(len(s)-1)//2
n2=(len(s)+2)//2
s1=s[0:n1]
s2=s[n2:len(s)]
if s==s[::-1] and s1==s1[::-1] and s2==s2[::-1]:
print("Yes")
else:
print("No")
|
p03548 | s014642783 | Wrong Answer | x, y, z = map(int, input().split())
ans = 0
while x >= y + z:
ans += 1
x -= y + z
print(ans)
|
p02801 | s786834072 | Accepted | C = input()
ABC = [chr(i) for i in range(97, 97+26)]
index = ABC.index(C)
next = index + 1
print(ABC[next]) |
p03043 | s824656207 | Accepted | n,k = map(int,input().split())
import math
def succ(m): #サイコロの目がmの時、kを超えるようにコインの表を出し続ける最小の回数
res = 0
while True:
if m < k:
res += 1
m *= 2
if m >= k:
return res
def pos():
res = 0
for i in range (1, n+1):
m = n*2**succ(i)
res += 1/m
return res
print(pos()) |
p03723 | s254530838 | Wrong Answer | a,b,c = map(int,input().split())
acnt = 0
bcnt = 0
ccnt = 0
cnt = 0
if a == b == c and a%2 == 0:
print(-1)
exit()
while acnt%2 != 1 and bcnt%2 != 1 and ccnt%2 != 1:
cnt += 1
acnt = (b+c)//2
bcnt = (a+c)//2
ccnt = (a+b)//2
a = acnt
b = bcnt
c = ccnt
print(cnt) |
p03262 | s123532891 | Accepted | N,X = map(int, input().split())
x = [int(i) for i in input().split()]
x.append(X)
x.sort()
from fractions import gcd
ans = 0
for i in range(N):
ans = gcd(ans, x[i+1] - x[i])
print(ans) |
p02630 | s917930183 | Wrong Answer | import collections
n = int(input())
a = list(map(int, input().split()))
q = int(input())
bc = [list(map(int, input().split())) for _ in range(q)]
ans_count = []
count = collections.Counter(a)
for i in range(q):
num = count[bc[i][0]]
count[bc[i][0]] = 0
count[bc[i][1]] += num
ans_count.append(count)
for ans in ans_count:
total = 0
for key, value in zip(count.keys(), count.values()):
total += int(key) * int(value)
print(total) |
p03160 | s101328507 | Accepted | n = int(input())
h = list(map(int,input().split()))
dp = [0] * n
for i in range(1,n):
if i == 1:
dp[i] = abs(h[1] - h[0])
else:
dp[i] = min(abs(h[i] - h[i-1]) + dp[i-1], abs(h[i] - h[i-2]) + dp[i-2])
print(dp[-1])
|
p02958 | s685304080 | Accepted | n=int(input())
P=list(map(int,input().split()))
Q=list([i+1 for i in range(n)])
cnt=0
for i in range(n):
if P[i]!=Q[i]:
cnt+=1
print('YES' if cnt<=2 else 'NO')
|
p03087 | s360709967 | Wrong Answer | n, q = map(int, input().split())
s = input()
L = [0]*len(s)
for i in range(1,len(s)):
L[i] = L[i-1]
if s[i-1] == "A" and s[i] == "C":
L[i] += 1
print(L)
for _ in range(q):
l, r = map(int, input().split())
print(L[r-1]-L[l-1])
|
p02578 | s747104382 | Wrong Answer | N=input()
list=[int(x) for x in input().split()]
i=0
kei=0
k=0
while(i!=len(list)-1):
if(list[i]>list[i+1]):
kei+=list[i]-list[i+1]
list[i+1]=list[i]
print(kei)
i+=1
print(kei) |
p03479 | s932859448 | Accepted | X, Y = map(int, input().split())
Z = X
c = 0
while Z <= Y:
c += 1
Z = 2 * Z
print(c) |
p02723 | s407499683 | Accepted | s = input()
if s[2] == s[3] and s[4] == s[5]:
print("Yes")
else:
print("No") |
p02639 | s613877537 | Accepted | def main():
from builtins import int, map, list, print
import sys
sys.setrecursionlimit(10 ** 6)
input = (lambda: (sys.stdin.readline()).rstrip())
input_list = (lambda: input().split())
input_number = (lambda: int(input()))
input_number_list = (lambda: list(map(int, input_list())))
x = input_number_list()
print(x.index(0)+1)
if __name__ == '__main__':
main()
|
p02958 | s069790852 | Accepted | N = int(input())
P = [int(i) for i in input().split()]
Q = sorted(P)
ans = 0
for p, q in zip(P, Q):
if p != q:
ans += 1
if ans == 0 or ans == 2:
print('YES')
else:
print('NO') |
p04031 | s016454102 | Wrong Answer | def resolve():
n = int(input())
ans = 0
a = list(map(int, input().split()))
y = sum(a) / n
for x in a:
if x == y:
continue
ans += (x-y)**2
print(round(ans))
resolve() |
p02582 | s850904984 | Accepted | # input 長さ3の文字列
input_s = input();
output = 0;
if "R" in input_s:
output = 1;
if "RR" in input_s:
output = 2;
if "RRR" in input_s:
output = 3;
print(output); |
p02691 | s131924512 | Accepted | from collections import Counter
N = int(input())
A = list(map(int, input().split()))
i_plus_A = Counter([i + A[i] for i in range(N)])
i_minus_A = [i - A[i] for i in range(N)]
i_minus_A = [x for x in i_minus_A if x > 0]
print(sum(i_plus_A[x] for x in i_minus_A)) |
p02995 | s455400060 | Accepted | # -*- coding: utf-8 -*-
"""
Created on Fri May 15 00:52:33 2020
@author: Kanaru Sato
"""
import fractions
def divnum(x,y,n):
if x%n == 0:
return y//n - x//n + 1
else:
return y//n - x//n
a,b,c,d = list(map(int,input().split()))
cd = (c*d)//fractions.gcd(c,d)
ans = divnum(a,b,c) + divnum(a,b,d) - divnum(a,b,cd)
print(b-a+1-ans) |
p03131 | s392415940 | Wrong Answer | k, a, b = map(int, input().split())
if k > a+2 and b > a:
x = 1 + k
t = (k-a+1)//2
y = t * (b-a) + (k-t*2) + 1
print(max(x,y))
exit()
else:
z = 1 + k
print(z) |
p03544 | s563256123 | Accepted | n=int(input())
A = [-1]*(n+2)
A[0]=2
A[1]=1
for i in range(2,n+1):
A[i] = A[i-1] + A[i-2]
print(A[n]) |
p03745 | s985407196 | Accepted | import sys
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
if N <= 2:
print(1)
sys.exit()
A = [A[0]] + [y for x,y in zip(A,A[1:]) if x != y]
sq = np.diff(A)
ans = 1
flg = 0
prev = sq[0]
for i in range(1, len(sq)):
if flg==1:
prev = sq[i]
flg = 0
continue
current = sq[i]
if (prev * current) > 0:
continue
else:
ans += 1
prev = current
flg = 1
print(ans) |
p02759 | s122433216 | Wrong Answer | # -*- coding: utf-8 -*-
n = int(input())
if n%2 == 0:
print(int(n/2))
else:
print(int(n//2)) |
p02983 | s118975735 | Accepted | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
l,r = inpl()
r = min(r,l+3000)
res = INF
for i in range(l,r):
for j in range(i+1,r+1):
res = min(res, (i*j)%2019)
print(res) |
p03997 | s822720657 | Accepted | print(int((int(input())+int(input()))/2*int(input()))) |
p04029 | s458431010 | Wrong Answer | sub = int(input())
print((1+sub) * sub / 2) |
p02606 | s365677137 | Accepted | L, R, d = map(int, input().split())
ans = 0
for i in range(L, R+1):
if i % d == 0:
ans += 1
print(ans) |
p03163 | s817281047 | Wrong Answer | #4
N,W=map(int,input().split())
A=[[0]]+[[int(x) for x in input().split()] for i in range(N)]
dp=[[0 for i in range(W+1)] for j in range(N+1)]
for i in range(1,N+1):
for sum_w in range(W+1):
w=A[i][0]
v=A[i][1]
if sum_w-w>=0:
dp[i][sum_w]=max(dp[i][sum_w],dp[i-1][sum_w-w]+v)
else:
dp[i][sum_w]=dp[i-1][sum_w]
print(dp[N][W]) |
p02995 | s634612256 | Accepted | import math
A,B,C,D = map(int,input().split())
BIkaCbaisuC = B//C
AIkaCbaisuC = (A-1)//C
ABkanCbaisuC = BIkaCbaisuC - AIkaCbaisuC
BIkaDbaisuC = B//D
AIkaDbaisuC = (A-1)//D
ABkanDbaisuC = BIkaDbaisuC - AIkaDbaisuC
cd = math.floor(C*D/math.gcd(C,D))
BIkacdbaisuC = B//cd
AIkacdbaisuC = (A-1)//cd
ABkancdbaisuC = BIkacdbaisuC - AIkacdbaisuC
print(B-A+1-ABkanCbaisuC-ABkanDbaisuC+ABkancdbaisuC)
|
p02595 | s480343407 | Accepted |
N, D = map(int, input().split())
X = [0] * N
Y = [0] * N
num = 0
for i in range(N):
X[i], Y[i] = map(int, input().split())
if (X[i]**2+Y[i]**2)**0.5 <= D:
num += 1
print(num) |
p03607 | s065448373 | Wrong Answer | n=int(raw_input())
a=[]
for i in range(0,n,1):
x=int(raw_input())
for j in range(0,len(a),1):
if x == a[j]:
a.pop(j)
break
a.append(x)
if len(a) == 0:
a.append(x)
print len(a)
|
p02912 | s317093180 | Accepted | import heapq
N, M = map(int, input().split())
A = list(map(lambda x: int(x) * -1, input().split()))
heapq.heapify(A)
for _ in range(M):
discount = (-1) * heapq.heappop(A)
discount //= 2
heapq.heappush(A, -discount)
print(-sum(A)) |
p02640 | s716716692 | Accepted | x, y = map(int, input().split())
ans = "No"
for i in range(x + 1):
if i * 2 + (x - i) * 4 == y:
ans = "Yes"
break
print(ans)
|
p02948 | s678673518 | Accepted | import heapq
N,M = map(int,(input().split()))
A = [0]*N
B = [0]*N
mission = [[] for _ in range(M+1)]
work = 0
for i in range(N):
if i <= M:
heapq.heapify(mission[i])
A[i],B[i] = map(int,(input().split()))
if A[i] <= M:
mission[A[i]].append(-B[i])
for day in range(1,M+1):
for i in range(len(mission[day])):
heapq.heappush(mission[0],mission[day][i])
if mission[0]:
work += heapq.heappop(mission[0])
print(-work) |
p03681 | s987034662 | Accepted | from math import *
N,M = map(int,input().split())
if abs(N-M)==0:
ans = 2*factorial(N)*factorial(M)
elif abs(N-M)==1:
ans = factorial(N)*factorial(M)
else:
ans = 0
print(ans%(10**9+7)) |
p03076 | s591286012 | Accepted | li,lia = [],[]
total = 0
for i in range(5):
a = input()
li.append(a)
for i in range(5):
lia.append(li[i][-1])
lib = [int(s) for s in lia]
b = lib.count(0)
for i in range(b):
lib.remove(0)
for i in range(5):
total += (int(li[i])//10+1)*10
if len(lib) >= 1:
total -= 10*(1+b)
else:
total -= 10*(b)
if len(lib) >= 1:
total += min(lib)
if total <= 0:
print(0)
else:
print(total) |
p03623 | s433525126 | Accepted | L=list(map(int,input().split()))
A=abs(L[0]-L[1])
B=abs(L[0]-L[2])
if min(A,B)==A:
print("A")
else:
print("B") |
p02725 | s291799430 | Accepted | K,N=map(int,input().split())
A=list(map(int,input().split()))
a=[]
for i in range(len(A)-1):
a.append(A[i+1]-A[i])
a.append(K-A[-1]+A[0])
print(sum(a)-max(a)) |
p03705 | s089357591 | Accepted | N, A, B = map(int, input().split())
print(max(0, B*(N-2) - A*(N-2) +1))
|
p03408 | s873658260 | Accepted | from collections import Counter
n = int(input())
s_inputs = [input() for i in range(n)]
m = int(input())
t_inputs = [input() for i in range(m)]
s_count = Counter(s_inputs)
t_count = Counter(t_inputs)
ans=0
for s in set(s_inputs+t_inputs):
tmp = s_count[s]-t_count[s]
if tmp>ans:
ans=tmp
print(ans)
|
p03695 | s218198249 | Accepted | N = int(input())
A = list(map(int,input().split()))
C = []
D = 0
ans = []
for a in A:
if a<3200:
C+=[a//400]
else:
D+=1
if D==0:
ans = [len(set(C)),len(set(C))]
else:
if len(C)==0:
ans = [1,D]
else:
ans = [len(set(C)),len(set(C))+D]
print(*ans) |
p03106 | s336894421 | Accepted | # author: Taichicchi
# created: 10.09.2020 08:12:15
import sys
A, B, K = map(int, input().split())
cnt = 0
ls = []
for k in range(1, max(A, B) + 1):
if (A % k == 0) & (B % k == 0):
cnt += 1
ls.append(k)
print(ls[-K]) |
p02924 | s794861806 | Accepted | def main():
n = int(input())
print((n*(n+1))//2 - n)
if __name__ == '__main__':
main()
|
p03309 | s706098462 | Accepted | import statistics
n = int(input())
A = list(map(int, input().split()))
A_1 = [A[i] - (i+1) for i in range(n)]
m = int(statistics.median(A_1))
A_2 = [abs(m - A_1[i]) for i in range(n)]
print(sum(A_2))
|
p03345 | s907804950 | Accepted | A, B, C, K = map(int,input().split())
ans = A - B
if abs(ans) > 10 ** 18:
print('Unfair')
elif K % 2 == 1:
ans *= -1
print(ans)
else:
print(ans) |
p03672 | s130653493 | Accepted | from sys import stdin
s = stdin.readline().rstrip()
len_s = len(s)
for i in range(int(len_s/2+1)):
if i != 0:
if s[0:int(-i+len_s/2)] == s[int(-i+len_s/2):(len_s-i*2)]:
print(len_s-i*2)
break
|
p03059 | s788215041 | Accepted | A,B,D=map(int,input().split())
count=0
D+=0.5
while True:
if D-A>=0:
count+=1
D-=A
else:
print(count*B)
exit()
|
p02819 | s953939165 | Accepted | import sys
X = int(input())
def is_prime(X):
for i in range(2,X):
if X % i == 0:
return False
return True
if is_prime(X):
print(X)
sys.exit(0)
else:
while True:
if X%2 == 0:
X+=1
else:
if is_prime(X):
print(X)
sys.exit(0)
X+=2 |
p03474 | s182190694 | Wrong Answer | A,B=map(int,input().split())
S=input()
if str.isdigit(S[:A])==True and str.isdigit(S[-4:])==True and S[A]=="-":
print("Yes")
else:
print("No") |
p02779 | s370847207 | Accepted | N=int(input())
A=list(map(int,input().split()))
A1=set(A)
ans="NO"
if len(A)==len(A1):
ans="YES"
print(ans) |
p02701 | s958080466 | Accepted | n=int(input())
S=[input() for i in range(n)]
print(len(set(S))) |
p03860 | s975988971 | Wrong Answer | a,b,c=list(map(str,input().split()))
c=b[0]
print('A '+c+' C')
|
p03323 | s216095226 | Accepted | A,B = map(int,input().split())
if A > 8 or B > 8 :
print(":(")
else:
print("Yay!") |
p02995 | s766421285 | Wrong Answer | import fractions
A, B, C, D = map(int, input().split())
def func(x,y):
if(x<0):
assert()
if(y<=0):
assert()
# print(x,y,int(x/y))
# return int((x/y))
# print(x,y,x//y)
return (x//y)
# print(func(100,10))
lcm = (C * D) / int(fractions.gcd(C, D))
print(int( B - func(B, C) - func(B, D) + func(B, lcm) - A + 1 + func(A-1, C) + func(A-1, D) - func(A-1, lcm)))
|
p02624 | s330051093 | Accepted | def solve(n):
ans = 0
for i in range(1,n+1):
y = n//i
ans += (y*(y+1)*i)/2
return ans
def main():
n = int(input())
print(int(solve(n)))
if __name__ == "__main__":
main() |
p02791 | s411496370 | Accepted | n = int(input())
p = list(map(int,input().split()))
count = 0
MIN = p[0]
for i in range(n):
if p[i] <= MIN:
count += 1
MIN = p[i]
if MIN == 1:
break
print(count) |
p03345 | s777914518 | Accepted | a, b, _, k = map(int, input().split())
print((a - b)*((-1)**(k % 2))) |
p04011 | s739717901 | Accepted | n=int(input())
k=max([0,n-int(input())])
x=int(input())
y=int(input())
print(x*(n-k)+y*k) |
p03042 | s355554190 | Accepted | s=input()
a=int(s[:2])
b=int(s[2:])
if (a > 12 or a == 0) and (b > 12 or b == 0):
print("NA")
elif a > 12 or a == 0:
print("YYMM")
elif b > 12 or b == 0:
print("MMYY")
else: print("AMBIGUOUS") |
p03723 | s144090670 | Accepted | # 適当に10**5ぐらい回して無限に続けられたら-1でよくね?
A, B, C = map(int, input().split())
def update(A, B, C):
return B // 2 + C // 2, C // 2 + A // 2, A // 2 + B // 2
for i in range(10 ** 5):
if A & 1 or B & 1 or C & 1:
print(i)
exit()
A, B, C = update(A, B, C)
print(-1)
|
p03607 | s667103246 | Accepted | n=int(input())
ab = []
for _ in range(n):
a= int(input())
ab.append(a)
ab.sort()
memo = 1
ans = 0
for i in range(n):
if i == n-1:
ans += memo%2
elif ab[i] == ab[i+1]:
memo += 1
else:
ans += memo%2
memo = 1
print(ans) |
p02732 | s196774531 | Accepted | n = int(input())
inp = list(map(int,input().split()))
d = {}
for x in inp:
d[x] = d.get(x, 0) + 1
v = [0 for _ in range(n+1)]
for x, y in d.items():
v[x] = (y)*(y-1)//2
tot = sum(v)
for i in range(n):
print(tot-v[inp[i]]+((d[inp[i]]-1)*(d[inp[i]]-2)//2)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.