problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p03352 | s890288446 | Accepted | X=int(input())
a_max=1
for b in range(2,X//2):
a=1
p=2
while a<X:
a=b**p
p+=1
if X >= a > a_max:
a_max=a
print(a_max)
|
p03665 | s267989102 | Wrong Answer | n,p=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n):
a[i]=a[i]%2
one=sum(a)
zero=n-one
if p==1 and one==0:
print(0)
exit()
print(2**(n-1)) |
p02784 | s305461659 | Accepted | h, n = map(int, input().split())
a = list(map(int, input().split()))
if sum(a)>= h:
print('Yes')
else:
print('No') |
p02701 | s874530251 | Accepted | def mapint_inp():
return map(int, input().split())
def intinp():
return int(input())
N = intinp()
item_set = set()
ans = 0
for _ in range(N):
S = input()
if S in item_set: continue
item_set.add(S)
ans += 1
print(ans) |
p02910 | s187940456 | Accepted | S = input()
odd_li = ['R', 'U', 'D']
even_li = ['L', 'U', 'D']
for i in range(len(S)):
if i%2==0: #偶数
if not S[i] in odd_li:
print('No')
exit()
else:
if not S[i] in even_li:
print('No')
exit()
print('Yes')
|
p02687 | s303313950 | Wrong Answer | import random
S = ['ABC', 'ARC']
print(random.choice(S)) |
p03106 | s033373661 | Accepted | import sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *
from math import *
from fractions import *
sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()
A, B, K = map(int, input().split())
X = [i for i in range(100, 0, -1) ... |
p02660 | s079702660 | Accepted | import math
n = int(input())
m = n
answer = 0
i = 2
while i ** 2 <= m:
t = 0
while n % i == 0:
n //= i
t += 1
answer += int((-1+math.sqrt(1+8*t)) / 2)
i += 1
if n > 1000000:
answer += 1
print(answer)
|
p03485 | s382464219 | Accepted | import math
a,b = map(int,input().split())
x = math.ceil((a+b)/2)
print(x) |
p02597 | s770650582 | Accepted | import collections
n = int(input())
s = input()
count = collections.Counter(s)
ans = 0
if "R" in count.keys():
if count["R"] != n:
r_count = collections.Counter(s[:count["R"]])
if r_count["R"] == 0:
ans = count["R"]
else:
ans = r_count["W"]
print(ans) |
p02659 | s785950143 | Accepted | A, B = map(float, input().split())
a = int(A)
b = round(B * 100)
print(a * b // 100)
|
p03419 | s910845512 | Wrong Answer | H, W =[int(i) for i in input().split()]
if H==1:
print(min(0, W-2))
elif W==1:
print(min(0, H-2))
else:
print(min(H-2, 0)*min(W-2, 0)) |
p03696 | s230195751 | Wrong Answer | from collections import deque
N=int(input())
S=input()
stack= []
ans=""
for i in range(N):
if S[i]=="(":
stack.append(S[i])
else:
if len(stack)>0:
ans += stack.pop()+")"
else:
ans = "(" + ans + ")"
nokori=len(stack)
ans += nokori * "(" + nokori * ")"
print(ans) |
p03455 | s534521704 | Accepted | a,b=map(int,input().split())
if a*b%2 == 0 :
print("Even")
else :
print("Odd") |
p02952 | s328828689 | Wrong Answer | a=int(input())
if a<10:
print(a)
if 10<=a<100:
print(9)
if 100<=a<1000:
print(9+a-100)
if 1000<=a<=10000:
print(909)
if 10000<=a<100000:
print(909+a-10000)
if a==1000000:
print(90909) |
p03797 | s273829122 | Accepted | # solution
nim, mike= map(int, input().split())
if 2*nim>=mike:
data=mike//2
else:
data=nim+(mike-2*nim)//4
print(data) |
p02554 | s906849107 | Accepted | N = int(input())
mod = 10**9+7
if N == 1:
print(0)
elif N == 2:
print(2)
else:
tmp = 2*(pow(10,N,mod)-pow(9,N,mod))-(pow(10,N,mod)-pow(8,N,mod))
print(tmp%mod)
|
p03759 | s387812987 | Wrong Answer | a,b,c = map(int,input().split())
x = b - a
y = c - b
if x is y:
print('YES')
else:
print('NO') |
p03723 | s871562343 | Accepted | a,b,c = map(int,input().split())
ans = 0
p = 0
for i in range(c):
if int(a/2)*2==a and int(b/2)*2==b and int(c/2)*2==c:
if a == b and b == c:
break
ans += 1
x = b / 2 + c / 2
y = a / 2 + c / 2
z = b / 2 + a / 2
a = x
b = y
c = z
else:... |
p02572 | s694069608 | Wrong Answer | n=int(input())
*a,=map(int,input().split())
s=sum(a)%(10**9+7)
c=0
for i in range(n):
amod=a[i]%(10**9+7)
c+=(s-amod)*amod
print(c%(10**9+7)//2) |
p03760 | s158396914 | Accepted | O = input()
E = input()
num = len(O) + len(E)
password =''
for i in range(1, num+1):
if i % 2 ==0:
n = i // 2
password += E[n-1]
else:
n = i // 2 + 1
password += O[n-1]
print(password) |
p02771 | s699533131 | Wrong Answer | A,B,C=list(map(int, input().split()))
if A==B:
if A==C:
print("no")
else:
print("yes")
elif A==C:
if A==B:
print("no")
else:
print("yes")
elif B==C:
if B==A:
print("no")
else:
print("yes")
else:
print("no") |
p03672 | s900000025 | Accepted | s = list(input())
while True:
s.pop()
if s[:len(s)//2] == s[len(s)//2:]:
print(len(s))
break |
p03485 | s631926875 | Accepted | a, b = map(int, input().split())
ave=(a+b)/2
if ave-int(ave)==0:
print(int(ave))
else:
print(int(ave)+1)
|
p02627 | s259158268 | Accepted | N = input()
if N.isupper():
print("A")
else:
print("a")
|
p02832 | s589201901 | Wrong Answer | N = int(input())
A = list(map(int, input().split()))
crash = 0
cnt = 1
for i in A:
if i == cnt:
cnt += 1
else:
crash += 1
if cnt == 0:
print(-1)
else:
print(crash)
|
p04033 | s347382610 | Accepted | N = tuple([int(j) for j in input().split(' ')])
#0が含まれたら0
if N[0] <= 0 and N[1] >= 0:
print("Zero")
elif N[0] < 0 and N[1] < 0:
if (N[0] * - 1 - N[1] * - 1) % 2 == 0:
print("Negative")
else:
print("Positive")
elif N[0] > 0 and N[1] > 0:
print("Positive")
|
p02628 | s942390459 | Accepted | N, K = input().split()
IK = int(K)
P = list(map(int, input().split()))
Sorted_P = sorted(P)
S = 0
i = 0
while i < IK:
S = S + Sorted_P[i]
i = i + 1
print(S) |
p02742 | s891351014 | Wrong Answer | h,w = map(int, input().split())
if h==1 or w == 1:
print(1)
exit()
if w%2!=0:
x,y = w//2 + 1, w-(w//2+1)
else:
x = y = w//2
print(x*round(h/2) + y * h//2) |
p03720 | s569894823 | Wrong Answer | import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())
N,M = MI()
from collections import defaultdict
d = defaultdict(int)
for i in range(M):
a,b = MI()
d[a] += 1
d[b] += 1
print(sum(d[i] for i in d.keys()))
|
p03639 | s467636421 | Wrong Answer | n = int(input())
a = list(map(int,input().split()))
c1 = 0
c2 = 0
c4 = 0
for i in range(n):
if a[i] % 4 == 0:
c4 += 1
elif a[i] % 2 == 0:
c2 += 1
elif a[i] == 1:
c1 += 1
n -= c2
n += 1
f = n // 2
if c4 >= f:
print('Yes')
quit()
else:
print('No')
|
p02699 | s766952175 | Accepted | s, w = [int(s) for s in input().split(" ")]
if w >= s:
print("unsafe")
else:
print("safe") |
p03210 | s532261920 | Wrong Answer | i=int(input())
if(i==7 or i==5 or i==3):
print("Yes")
else:
print("No") |
p02819 | s280535612 | Wrong Answer | X = int(input())
while True:
flag = 0
for i in range(2, X+1): #2からXまでのループ
if (X+1) % i == 0: #対象はX+1という数
flag = 1
break
if flag == 1:
X += 1
continue
break
print(X + 1)
|
p02659 | s256798878 | Accepted | #decimalを使った別解
import decimal
deci = decimal.Decimal
a,b = input().split()
x,y = deci(a),deci(b)
ans = (x*y).quantize(deci('0'),rounding=decimal.ROUND_FLOOR)
print(ans) |
p03105 | s546074604 | Accepted | A,B,C = map(int,input().split())
print(min(B//A,C)) |
p03331 | s660624782 | Accepted | N = int(input())
if N % 10 == 0:
print(10)
else:
ls = list(str(N))
for i in range(len(ls)):
ls[i] = int(ls[i])
print(sum(ls)) |
p03252 | s171928599 | Accepted | S = input()
T = input()
def chr_count(S):
count = [0]*1000
for i in S:
count[ord(i)] += 1
return count
Sc = chr_count(S)
Tc = chr_count(T)
Sc.sort()
Tc.sort()
if Sc == Tc:
print("Yes")
else:
print("No") |
p03760 | s666424037 | Accepted | o = list(input())
e = list(input())
pw = []
for i in range(len(o)+len(e)):
if i % 2 == 0:
pw.append(o[i//2])
else:
pw.append(e[(i-1)//2])
print("".join(pw)) |
p02576 | s146126088 | Accepted | import math
n, x, t = map(int, input().split())
count = math.ceil(n / x)
time = t * count
print(time) |
p02996 | s370228849 | Accepted | import sys
readline = sys.stdin.readline
from operator import itemgetter
def main():
N = int(readline())
AB = [list(map(int, readline().rstrip().split())) for _ in range(N)]
AB.sort(key=itemgetter(1))
t = 0
for a, b in AB:
t += a
if t > b:
print('No')
return
... |
p03160 | s205340330 | Accepted | n = int(input())
H = list(map(int,input().split()))
Dp = [0] * n
Dp[1] = abs(H[1] - H[0])
for i in range(2, n):
Dp[i] = min(Dp[i-1] + abs(H[i] - H[i-1]), Dp[i-2] + abs(H[i] - H[i-2]))
print(Dp[-1])
|
p03109 | s757807720 | Accepted | y,m,d=map(int,input().split("/"))
if m<=4:
print("Heisei")
else:
print("TBD") |
p03219 | s478064819 | Accepted | a=list(map(int,input().split()))
print(int(a[0]+(a[1]/2)))
|
p03761 | s977528423 | Accepted | N=int(input())
from collections import Counter
tmp=list(input())
da=Counter(tmp)
for _ in range(N-1):
tmp=list(input())
tmpd=Counter(tmp)
for k, v in da.items():
if not tmpd[k]:
da[k]=0
else:
da[k]=min(v, tmpd[k])
ans=""
for k, v in da.items():
ans+=str(k)*v
a="".join(sorted(ans))
print(a) |
p02829 | s379969451 | Accepted | A = input()
B = input()
print(int(6/(int(A)*int(B)))) |
p02700 | s000275853 | Accepted | import math
a,b,c,d= map(int,input().split())
n=math.ceil(float(a)/d)
m=math.ceil(float(c)/b)
if m<=n:
print("Yes")
else:
print("No") |
p02682 | s673471872 | Wrong Answer | x = input().split()
a = int(x[0])
b = int(x[1])
c = int(x[2])
k = int(x[3])
if(a > k): # a > k
print(a-k)
exit()
elif(a == k):
print(a)
exit()
elif(k-a < b): # k > a
print(a)
exit()
elif(k-a == b):
print(a)
exit()
elif(k-a-b != 0):
x = k - a - b
print(a-x)
exit()
|
p03105 | s061245374 | Accepted | a,b,c = map(int,input().split())
print(min(b//a,c)) |
p02598 | s795247525 | Wrong Answer | n,k=map(int,input().split())
l=list(map(int,input().split()))
#(ng,ok]type
if k==0:print(max(l));exit()
def enough(x):
return sum((i)//x for i in l )<=k
ok,ng=10**9,0
# [ok,ng)type->eraseng,ok=ok,ng
while abs(ok-ng)>1:
mid=(ok+ng)//2
if enough(mid):ok=mid
else:ng=mid
print(ok) |
p03644 | s384447256 | Accepted | # -*- coding: utf-8 -*-
exp=[1,2,4,8,16,32,64,128]
n=int(input())
for i in range(8):
if n<exp[i]:
print(exp[i-1])
break
|
p03994 | s324295693 | Wrong Answer | # -*- coding: utf-8 -*-
S = list(input())
K = int(input())
for i in range(len(S)-1):
if S[i] == 'a':
continue
d = ord('z') - ord(S[i]) + 1
if K >= d:
S[i] = 'a'
K -= d
# print(K, d)
if K > 0:
j = ord(S[-1]) + K % 26
S[-1] = chr(j)
print(''.join(S)) |
p02720 | s508638635 | Accepted | from collections import deque
K = int(input())
que = deque([1,2,3,4,5,6,7,8,9])
for i in range(K):
v = que.popleft()
if v%10!=0:
que.append(10*v+v%10-1)
que.append(10*v+v%10)
if v%10!=9:
que.append(10*v+v%10+1)
print(v) |
p02714 | s992942057 | Wrong Answer | n = int(input())
s = input()
S = list(s[i] for i in range(n))
T = set(S)
x = 0
if len(T)<=2:
print(0)
else:
for i in range(n-2):
for j in range(i+1, n-1):
for k in range(j+1, n):
if {s[i], s[j], s[k]}=={"R", "G", "B"} and i+k != 2*j:
x += 1
print(x)
|
p02742 | s622757887 | Accepted | from collections import *
from itertools import *
from bisect import *
from heapq import *
import copy
import math
from fractions import gcd
import sys
#input = sys.stdin.readline
#N=int(input())
#A=list(map(int,input().split()))
#XY=[list(map(int,input().split())) for i in range(N)]
H,Y=map(int,input().split())
if... |
p03605 | s148288508 | Accepted | N = input()
print('Yes' if N[0]=='9' or N[1]=='9' else 'No') |
p03038 | s950985014 | Wrong Answer | N, M = map(int, input().split())
A = list(map(int, input().split()))
SA = sorted(A)
for _ in range(M):
B, C = map(int, input().split())
for i in range(B):
if SA[i] >= C:
continue
if SA[i] < C:
SA[i] = C
print(sum(SA)) |
p03438 | s902683322 | Accepted | def main():
import sys
def input(): return sys.stdin.readline().rstrip()
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
s = 0
sm = 0
for x, y in zip(a,b):
tmp = y-x
sm += tmp
if tmp > 0:
tmp //= 2
s +... |
p02818 | s485817086 | Accepted | import sys
A, B, K = map(int, input().split())
if A >= K:
A -= K
print(A, B)
sys.exit()
else:
K -= A
A = 0
if B >= K:
B -= K
else:
B = 0
print(A, B) |
p02897 | s723407482 | Accepted | import math
N = int(input())
odd = math.ceil(N/2)
print(odd/N) |
p02768 | s864810239 | Wrong Answer | from functools import reduce
def cmb(r):
numerator = reduce(lambda x, y: x * y % mod, [n - r + k + 1 for k in range(r)])
denominator = reduce(lambda x, y: x * y % mod, [k + 1 for k in range(r)])
return numerator * pow(denominator, mod - 2, mod) % mod
n,a,b = map(int,(input().split()))
ans=0
mod=10**9+7
ans... |
p02711 | s555795763 | Wrong Answer | s = int(input())
sum = 0
for i in range(1,s+1):
if i%3 == 0 and i%5 == 0:
j=0
elif i%3==0 or i%5==0:
j=0
else:
sum += i
print(sum) |
p02953 | s035369392 | Accepted | n = int(input())
h = list(map(int,input().split()))
tmp = h[0] - 1
for i in range(1,n):
if tmp == h[i]:
tmp = h[i]
elif tmp < h[i]:
tmp = h[i] - 1
else:
print('No')
exit()
print("Yes") |
p02952 | s437633525 | Accepted | N = int(input())
count = 0
for i in range(1, N+1):
str_i = str(i)
order = len(list(str_i))
if order % 2 != 0:
count += 1
print(count) |
p02996 | s676997978 | Accepted | import sys
n = int(input())
ab = []
for i in range(n):
a,b = map(int,input().split())
ab.append([a,b])
ab = sorted(ab,key=lambda x:x[1])
limit = 0
for i in range(n):
limit += ab[i][0]
if limit > ab[i][1]:
print("No")
sys.exit()
print("Yes") |
p03455 | s259853015 | Accepted | a, b = map(int, input().split())
answer = a * b
if answer % 2 == 0:
print('Even')
else:
print('Odd') |
p03071 | s060495139 | Accepted | #!/usr/bin/env python3
a, b = map(int, input().split())
print(max(a+b, a*2-1, b*2-1))
|
p02773 | s525534129 | Wrong Answer | n = int(input())
li = []
lia = []
ans = 0
f = 1
for i in range(n):
li.append(input())
li.sort()
for i in range(n-1):
if li[i] == li[i+1]:
f += 1
if f == ans:
lia.append(li[i+1])
if f > ans:
lia = []
ans = f
lia.append(li[i+1])
else:
... |
p02811 | s439826574 | Accepted | kx=input().rstrip().split(" ")
k=int(kx[0])
x=int(kx[1])
if 500*k>=x:
print("Yes")
else:
print("No") |
p02813 | s618205485 | Accepted | import math
N = int(input())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))
def g(a):
if a == []:
return(1)
else:
b = sorted(a)
for i in range(0,len(a)):
if a[0] == b[i]:
a.pop(0)
return(i * math.factorial(len(a)) + g(a)... |
p02833 | s231775484 | Wrong Answer | from bisect import bisect_right, bisect_left
from itertools import groupby, permutations, combinations
from fractions import gcd
import numpy as np
from sys import stdin, stderr
def lcm(x, y):
return (x * y) // gcd(x, y)
def main():
N = int(input())
if N % 2 == 1:
return 0
d = 10
m = 1
... |
p02922 | s859282384 | Wrong Answer | #B
a,b = map(int,input().split())
if b == 1:
print(0)
elif a >= b:
print(1)
else:
print((b-a)//a + 2) |
p03434 | s044972249 | Accepted | sumajedan = 0
sumadva = 0
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse = True)
for x in range(n):
if x%2 == 0:
sumajedan=sumajedan + a[x]
else:
sumadva = sumadva + a[x]
print(sumajedan - sumadva) |
p03605 | s393943354 | Accepted | import sys
N = int(input())
if N < 10 or N > 99:
sys.exit()
if int(str(N)[0:1]) == 9 or int(str(N)[-1]) == 9:
print("Yes")
else:
print("No") |
p02879 | s713344586 | Accepted | a,b = map(int, input().split())
print(a*b if a <10 and b<10 else -1) |
p03264 | s894590854 | Accepted | k = int(input())
odd = 0
for i in range(1, k+1):
if i%2==0:
odd += 1
even = k - odd
print(even * odd)
|
p03761 | s244990140 | Wrong Answer | n = int(input())
L = [sorted(str(input())) for _ in range(n)]
m = float('inf')
for s in L:
m = min(m, len(s))
ans = ''
for i in range(m):
for j in range(1, n):
if L[0][i] != L[j][i]:
break
else:
ans = ans + L[0][i]
print(ans)
|
p03251 | s170288856 | Accepted | import sys
N,M,X,Y=list(map(int,input().split()))
x=list(map(int,input().split()))
y=list(map(int,input().split()))
x.sort()
y.sort()
for Z in range(X+1,Y+1,1):
if x[-1]<Z and y[0]>=Z:
print("No War")
sys.exit()
print("War")
|
p03131 | s861878677 | Accepted | k,a,b=map(int,input().split())
import sys
if k<a-1 or b-a <2:
print(k+1)
sys.exit()
if (k+1-a) %2 ==0:
print(a+(b-a)*(k+1-a)//2)
else:
print(a+(b-a)*((k-a)//2)+1)
|
p02547 | s747823865 | Accepted | # author: Taichicchi
# created: 19.09.2020 21:01:22
import sys
N = int(input())
c = 0
for i in range(N):
d1, d2 = map(int, input().split())
if d1 == d2:
c += 1
else:
c = 0
if c == 3:
print("Yes")
exit()
print("No")
|
p03943 | s702069700 | Accepted | a, b, c = map(int, input().split())
if a + b == c or a + c == b or b + c == a:
print("Yes")
else:
print("No")
|
p02753 | s796639603 | Accepted | s = input()
if s == "AAA" or s == "BBB":
print("No")
else:
print("Yes")
|
p03437 | s574123469 | Accepted | from fractions import gcd
def main():
x, y = map(int, input().split())
if x % y == 0:
print("-1")
else:
print(x)
if __name__ == "__main__":
main()
|
p04019 | s835223720 | Wrong Answer | import sys
from collections import Counter
inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())
s = input()
cnt = 0
if not ("N" in s and "S" in s):
... |
p03103 | s509096265 | Accepted | N, M=map(int, input().split()) #複数数値入力 「A B」みたいなスペース空いた入力のとき
AB=[[int(i) for i in input().split()] for j in range(N)] # 二次元配列入力 二次元マップみたいな入力のとき
AB.sort(key=lambda x: x[0])
money = 0
ct = M
for i in AB:
money += min(ct, i[1]) * i[0]
ct = ct - min(ct, i[1])
if ct == 0:
break
print(money)
|
p03162 | s712094210 | Accepted | import sys
n=int(input())
dp=[0,0,0]
for _ in range(n):
c=list(map(int,input().split()))
ndp=[0,0,0]
for i in range(3):
for j in range(3):
if i!=j:
ndp[j]=max(ndp[j],dp[i]+c[i])
dp=ndp
print(max(dp))
|
p03796 | s357260599 | Accepted | def main():
N = int(input())
power = 1
for i in range(1,N+1):
power *= i
power %= (10**9) + 7
return power
print(main())
|
p02947 | s067264644 | Accepted | N = int(input())
S = []
for _ in range(N):
tmp=sorted(input())
S.append(tmp)
for i in range(len(S)):
S[i]=''.join(S[i])
import collections
from math import factorial
res=0
dic = {}
for tmp in S:
if tmp in dic.keys():
res+=dic[tmp]
dic[tmp]+=1
else:
dic[tmp]=1
print(int(r... |
p02645 | s747974395 | Accepted | #!/usr/bin/env python3
s = input()
print(s[:3])
|
p03555 | s475215020 | Accepted | r=input()
g=input()
if r==g[::-1]:
print("YES")
else:
print("NO")
|
p03605 | s966584090 | Accepted | N=input()
if N.count("9")>=1:
print("Yes")
else:
print("No") |
p02972 | s294530524 | Wrong Answer | n = int(input())
a = [0]+list(map(int,input().split()))
ans = [-1]*(n+1)
for i in range(n,0,-1):
res = 0
for j in range(i+i,n+1,i):
res += ans[j]
ans[i] = a[i]-(res%2)
p = []
for ind,v in enumerate(ans):
if v== -1:continue
if v == 1:p.append(ind)
print(len(p))
print(*p)
|
p03495 | s831865679 | Wrong Answer | from collections import Counter
n, k = map(int, input().split())
s = list(map(int, input().split()))
num = Counter(s)
ans = 0
i = 0
if len(num) <= k:
print(0)
else:
cnt = len(num) - k
for v in sorted(num.values()):
if cnt == i:
break
ans += v
i += 1
print(ans) |
p03221 | s070317778 | Wrong Answer | N,M = map(int,input().split())
PY = [list(map(int,input().split())) + [i] for i in range(M)]
PY.sort()
print(PY)
pnow = PY[0][0]
c = 1
ans = [-1 for i in range(M)]
for i in range(M):
if pnow != PY[i][0]:
c = 1
pnow = PY[i][0]
ans[PY[i][2]] = str(PY[i][0]).zfill(6) + str(c).zfill(6)
c += ... |
p02657 | s068063229 | Accepted | A, B = list(map(int, input().split()))
print(A*B) |
p02848 | s687825165 | Accepted | import sys
from collections import defaultdict
from collections import deque
import numpy as np
import heapq
from heapq import heappush, heappop
import itertools
#read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)
N = int(input())
A = list(input())
fo... |
p02995 | s459586394 | Accepted | A, B, C, D = map(int, input().split())
import fractions
g = fractions.gcd(C, D)
ac = (A-1)//C
bc = B//C
c = bc-ac
ad = (A-1)//D
bd = B//D
d = bd-ad
cdg = (C*D)//g
acd = (A-1)//cdg
bcd = B//cdg
cd = bcd-acd
ans = B-A+1-c-d+cd
print(ans) |
p02546 | s814157564 | Accepted | from collections import Counter
import math
import statistics
import itertools
a=input()
# b=input()
# c=[]
# for i in a:
# c.append(int(i))
# A,B,C= map(int,input().split())
# f = list(map(int,input().split()))
# g = [input() for _ in range(a)]
# h = []
# for i in range(a):
# h.append(list(map(int,input().spli... |
p02959 | s731734017 | Accepted | n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
cnt = min(a[0], b[0])
b[0] -= min(a[0], b[0])
for i in range(1, n):
if b[i-1] > 0:
cnt += min(a[i], b[i-1])
a[i] -= b[i-1]
if a[i] > 0:
cnt += min(a[i], b[i])
b[i] -= min(a[i], b[i])
cnt += ... |
p02767 | s711196441 | Accepted | N=int(input())
A=list(map(int,input().split()))
P=(sum(A))//N
P0=P-1
P1=P+1
M,M1,M0=0,0,0
for i in A:
M+=(i-P)**2
M1+=(i-P1)**2
M0+=(i-P0)**2
print(min(M,M1,M0))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.