problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p02843 | s654104490 | Wrong Answer | x=int(input())
n = x//100
k = x %100
if n >= 101 :
print(1)
elif n*1 <= k <= n*5:
print(1)
else:
print(0) |
p03720 | s381868979 | Wrong Answer | n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
city = {}
for i in ab:
for j in i:
if j not in city:
city[j] = 1
else:
city[j] += 1
for number in range(n):
if number in city:
print(city[number])
else:
print(0) |
p02705 | s712701548 | Accepted | import math
r = int(input())
print(math.ceil(2*math.pi*r*100)/100) |
p02556 | s691673437 | Accepted | n = int(input())
point_dict1 = {}
point_dict2 = {}
for i in range(n):
x, y = map(int, input().split())
point_dict1[x + y] = (x, y)
point_dict2[y - x] = (x, y)
min_point1 = min(point_dict1)
max_point1 = max(point_dict1)
min_point2 = min(point_dict2)
max_point2 = max(point_dict2)
print(max(max_point1 - min_po... |
p02982 | s495044813 | Accepted | from math import sqrt
N, D = map(int, input().split())
X_list = [input().split() for i in range(N)]
cnt = 0
for x in range(N-1):
d = 0
tmp = 0
for y in range(x+1, N):
d = 0
tmp = 0
while d < D:
x_d = int(X_list[x][d])
y_d = int(X_list[y][d])
tmp +=... |
p03250 | s787334095 | Accepted | ABC = list(map(int, input().split()))
ABC.sort(reverse=True)
print(int(''.join(map(str, ABC[:2]))) + int(ABC[-1])) |
p02665 | s152753576 | Accepted | N = int(input())
A = [int(i) for i in input().split()]
L, R = [A[-1]], [A[-1]]
for i in range(1, N+1):
L.append((L[-1]+1)//2+A[-1-i])
R.append((R[-1]+A[-1-i]))
L = L[::-1]
R = R[::-1]
if L[0] >= 2:
print(-1)
exit()
ans = 1
p = 1
for i in range(1, N+1):
ans += min(p*2, R[i])
p = min(p*2, R[i])... |
p03494 | s949084833 | Wrong Answer | a = int(input())
b = list(map(int,input().split()))
b.sort()
ans = 0
n = b[0]
while n % 2 ==0:
ans +=1
n = n/2
print(ans) |
p03077 | s530146017 | Wrong Answer | n = int(input())
li = []
for i in range(5):
a = int(input())
li.append(a)
li.sort()
if n//li[0] >= 1:
print(n//li[0] + 5)
else:
print(5) |
p02879 | s870416893 | Accepted | n,m=map(int,input().split())
if 0<n<10 and 0<m<10:
print(n*m)
else:
print(-1) |
p02753 | s608696097 | Wrong Answer | A=list(input())
A.sort()#sortメソッドは破壊的
print("Yes" if A[1]!=A[2] else "No") |
p02880 | s774866804 | Wrong Answer | N = int(input())
if N > 81:
print('No')
else:
for i in range(1, 10):
for j in range(1, 10):
if N == i * j:
print('Yes')
exit()
print('No') |
p03030 | s666960068 | Accepted | N=int(input())
S=[""]*N
T=[""]*N
for i in range(N):
S[i]=list(input().split())
S[i][1]=-int(S[i][1])
T[i]=S[i]
S.sort(key=lambda x:(x[0],x[1]))
for i in range(N):
for j in range(N):
if(T[j]==S[i]):
print(j+1) |
p02628 | s851288948 | Accepted | N, K = map(int, input().split())
P = list(map(int, input().split()))
print(sum(sorted(P)[:K])) |
p02972 | s806476453 | Accepted | n = int(input())
a = list(map(int, input().split()))
box = [0] * n
ans = []
for i in range(n-1, -1, -1):
ms = sum(box[i::i+1])
if ms % 2 != a[i]:
box[i] = 1
ans.append(i+1)
print(len(ans))
print(*ans)
|
p03284 | s174754413 | Wrong Answer | def main():
n, k = map(int, input().split())
print(n%k)
if __name__ == '__main__':
main() |
p02641 | s104319956 | Accepted | x, n = map(int, input().split())
ps = list(map(int, input().split()))
for i in range(101):
sub = x - i
if sub not in ps:
print(sub)
break
add = x + i
if add not in ps:
print(add)
break |
p02859 | s176737417 | Accepted | r = int(input())
print(r**2) |
p03435 | s123136859 | Wrong Answer | a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ans='Yes'
if a[1]-a[0]!=b[1]-b[0] or a[2]-a[1]!=b[2]-b[1]:
ans='No'
elif b[0]-a[0]!=b[1]-a[1] or b[2]-a[2]!=b[1]-a[1]:
ans='No'
elif c[0]!=a[2]+b[0] or c[1]!=a[2]+b[1] or c[2]!=a[2]+b[2]:
ans='No'
print(ans) |
p03624 | s737814207 | Accepted | def searchstring(s) :
start = ord('a')
end = ord('z')
stringlist = [0] * 256
for i in range(len(s)) :
stringlist[ord(s[i])] += 1
for i in range(start, end + 1) :
if stringlist[i] == 0 :
return chr(i)
return None
s = input()
print(searchstring(s)) |
p02554 | s498020440 | Wrong Answer | n = int(input())
if(n == 1):
print(0)
elif(n==2):
print(2)
else:
print((n*(n-1)+10**(n-2))%(10**9+7)) |
p02933 | s948093176 | Accepted | a = int(input())
s = input()
print(s if a >= 3200 else 'red') |
p02995 | s649381724 | Wrong Answer | import fractions
a, b, c, d = map(int, input().split())
ans = 0
def lcm(x, y):
return (x * y) // fractions.gcd(x, y)
def k(x):
return x - (x//c + x//d - x//lcm(c, d))
print(k(b)-k(a)) |
p02556 | s178847386 | Wrong Answer | N = int(input())
x,y = map(int,input().split())
minx, miny = x,y
maxx, maxy = x,y
maxdist = 0
for i in range(N-1):
x,y = map(int,input().split())
dist1 = abs(minx - x) + abs(miny - y)
dist2 = abs(maxx - x) + abs(maxy - y)
if dist1 > maxdist:
maxx = x
maxy = y
maxdist = dist1
elif dist2 > maxdist:
... |
p02792 | s294979664 | Accepted | N = int(input())
a = [[0 for _ in range(10)] for _ in range(10)]
ans = 0
for i in range(1, N+1):
a[int(str(i)[0])][int(str(i)[-1])] += 1
for i in range(10):
for j in range(10):
ans += a[i][j]*a[j][i]
print(ans) |
p03210 | s554381527 | Accepted | print('YES' if int(input())in[3,5,7] else 'NO') |
p03469 | s991908442 | Accepted | s = input()
print("2018" + s[4:])
|
p03796 | s438521777 | Accepted | import math
n = int(input())
power = math.factorial(n)
print(power%(10**9+7)) |
p03221 | s206039256 | Wrong Answer | N,M = map(int,input().split())
Turm = []
num = []
for i in range(N):
num.append([])
for i in range(M):
n,v = map(int,input().split())
Turm.append((n,v))
num[n-1].append(v)
for i in range(N):
num[i].sort()
for n,v in Turm:
print('00000'+str(n)[-6::],'00000'+str(num[n-1].index(v)+1)[-6::]) |
p03860 | s353946110 | Accepted | a,b,c = input().split()
ans = "A" + b[0] + "C"
print(ans)
|
p02572 | s803794009 | Accepted | n = int(input())
a = list(map(int, input().split()))
mod = 10**9 + 7
aa = [a[0] % mod]
for i in range(1, n-1):
aa.append((aa[i-1] + a[i]) % mod)
ans = 0
for i in range(n-1):
ans += ((aa[i] * a[i+1]) % mod)
print(ans % mod) |
p03434 | s731975345 | Accepted | # input
N = int(input())
A = list(map(int, input().split()))
# check
res = 0
Alice_Turn = True
while A:
max_a = max(A)
if Alice_Turn:
res += max_a
Alice_Turn = False
else:
res -= max_a
Alice_Turn = True
A.remove(max_a)
print(res) |
p02814 | s055051336 | Accepted | import math
from functools import reduce
n,m = map(int, input().split())
A = list(map(int, input().split()))
def lcm_base(x,y):
return x*y//math.gcd(x,y)
def lcm(target_list):
return reduce(lcm_base, target_list)
A_gcd = reduce(math.gcd, A)
flg = True
for a in A:
if a//A_gcd%2==0:
flg = False
break
... |
p02725 | s351318970 | Wrong Answer | def main():
K, N = map(int, input().split())
A = list(map(int, input().split()))
shiftA = A[1:] + [K]
subA = [shiftA[i] - A[i] for i in range(N)]
maxA = max(subA)
subA.remove(maxA)
print(sum(subA))
if __name__ == '__main__':
main() |
p03285 | s777810083 | Accepted | n = int(input())
a = [i*4 for i in range(n//4 + 1)]
b = [i*7 for i in range(n//7 + 1)]
c =set()
for i in a:
for j in b:
if i+j != 0 and i+j <=n:
c.add(i+j)
if n in c:
print('Yes')
else:
print('No') |
p02552 | s528802748 | Accepted | x = input()
if int(x) == 1:
print("0")
else:
print("1") |
p02681 | s147647813 | Accepted | s = input()
t = input()
flag = True
for i in range(len(s)):
if s[i] is not t[i]:
flag = False
if flag is True:
print("Yes")
else:
print("No") |
p02771 | s426309171 | Accepted | def inpl():
return list(map(int, input().split()))
A = inpl()
A.sort()
print("Yes" if A[0] != A[2] and (A[0] == A[1] or A[1] == A[2]) else "No")
|
p03804 | s547481233 | Wrong Answer | n,m=map(int,input().split())
x,y=[],[]
for i in range(n):
x.append(input())
for i in range(m):
y.append(input())
for i in range(n-m+1):
for j in range(n-m+1):
if x[i][j]==y[0][0]:
if m==1:
print('Yes')
exit()
for k in range(m):
if x[i+k][j:j+n-m+1]!=y[k]:
conti... |
p03037 | s268606473 | Wrong Answer | def mi():
return map(int, input().split())
'''
3 4
*G*S
G**S
*G*S
'''
n,m = mi()
l = -1
r = 1e10
for i in range(m):
a,b=mi()
l = max(l,a)
r = min(r,b)
print(r-l+1) |
p03250 | s542772771 | Accepted | a, b, c = map(str, input().split())
max = int(a+b) + int(c)
if max < int(a) + int(b+c):
max = int(a) + int(b+c)
elif max < int(c+a) + int(b):
max = int(c+a) + int(b)
print(max) |
p02572 | s722270060 | Accepted | # coding: utf-8
# Your code here!
import sys
readline = sys.stdin.readline
read = sys.stdin.read
n,*a = map(int,read().split())
MOD = 10**9+7
i2 = (MOD+1)//2
r = sum(a)
r *= r
r -= sum(i*i for i in a)
r *= i2
print(r%MOD)
|
p03804 | s473573287 | Accepted | n, m = map(int, input().split())
a = [" "] * n
for i in range(n):
a[i] = input()
b = [" "] * m
for i in range(m):
b[i] = input()
flag = False
for i in range(n-m+1):
if flag: break
for j in range(n-m+1):
suba = a[i:i+m]
for k in range(len(suba)):
suba[k] = suba[k][j:j+m]
... |
p02793 | s384909129 | Wrong Answer | from functools import reduce
from fractions import gcd
N = int(input())
A = list(map(int, input().split()))
C = list(set(A))
lcm = A[0]
for i in range(1, len(C)):
lcm = lcm * C[i] // gcd(lcm, C[i])
MOD = 10 ** 9 + 7
ans = 0
for i, a in enumerate(A):
ans += lcm // a
ans %= MOD
print(ans)
|
p02773 | s538221573 | Wrong Answer | from collections import Counter
n = int(input())
s = []
for i in range(n):
s.append(input())
s.sort()
cnt = Counter(s).most_common()
print(cnt[0][0])
if len(cnt) > 1:
for i in range(1, n):
if cnt[i-1][1] == cnt[i][1]:
print(cnt[i][0])
else:
break
|
p03475 | s372887682 | Accepted | n = int(input())
data = []
for i in range(n-1):
c,s,f = map(int,input().split())
s //= f
data.append((c,s,f))
for i in range(n):
if i == n-1:
print(0)
break
for j in range(i,n-1):
if j == i:
ans = data[j][0]+data[j][1]*data[j][2]
continue
ans =... |
p02719 | s370328852 | Accepted | N, K = map(int, input().split())
x = abs(N -(N//K)*K)
y = abs(N - (N//K + 1)*K)
if x < y:
print(x)
else:
print(y) |
p02866 | s048324056 | Accepted | from collections import Counter
MOD = 998244353
N = int(input())
D = list(map(int, input().split()))
cnt_D = Counter(D)
if D[0] != 0 or cnt_D.get(0, 0) != 1:
print(0)
else:
prev = 1
ans = 1
for i in range(1, max(D) + 1):
v = cnt_D.get(i, 0)
ans *= pow(prev, v, MOD)
ans %= MOD
... |
p02645 | s171405590 | Wrong Answer | import random
S = str(input())
A = list(S)
N = random.sample(A, k=3)
print(N[0]+N[1]+N[2]) |
p02813 | s583973698 | Wrong Answer | import itertools
N=int(input())
I=[str(i) for i in range(1,N+1)]
P=''.join(input().split())
Q=''.join(input().split())
li=list(itertools.permutations(I,N))
a=0
b=0
for i in range(len(li)):
if(''.join(li[i])==P):
a=i+1
elif(''.join(li[i])==Q):
b=i+1
print(abs(b-a)) |
p03043 | s508261591 | Accepted | n, k = [int(v) for v in input().split()]
rate = []
for i in range(1, n + 1):
if i >= k:
rate.append(1)
continue
for s in range(1, k):
score = i * (2 ** s)
if score >= k:
rate.append(1 / (2 ** s))
break
print(sum(rate) / len(rate))
|
p02553 | s298590096 | Accepted | A, B, C, D = map(int, input().split())
if A <= 0 <= B or C <= 0 <= D:
x = 0
else:
x = -float('inf')
print(max(A * C, B * D, A * D, B * C, x))
|
p02780 | s918064458 | Accepted | n,k = map(int, input().split())
p = list(map(int, input().split()))
b = p[:k]
#print(b)
for i in range(k):
b[i] = (b[i]+1)/2
a = sum(b)
a_max = sum(b)
#print(a)
for i in range(n-k):
a -= (p[i]+1)/2
a += (p[i+k]+1)/2
if (a > a_max):
a_max = a
print(a_max)
|
p03000 | s568718402 | Wrong Answer | N,X=map(int,input().split())
L=list(map(int,input().split()))
D=int(0)
count=int(1)
for i in range(N-1):
D+=L[i]
if D<=X:
count+=1
else:
break
print(count) |
p02684 | s923046018 | Wrong Answer | n, k = map(int, input().split())
a = [0] + list(map(int, input().split()))
a1 = [0] * (n+1)
step = 1
start = 0
while(True):
start += 1
a1[step] += 1
step = a[step]
if a1[step] == 1:
break
c = step
gap = 0
while(True):
gap += 1
step = a[step]
if step == c:
break
k = (k+n*gap... |
p03274 | s964687152 | Accepted | N,K=map(int,input().split())
L=list(map(int,input().split()))
ans=float("inf")
for i in range(N-K+1):
ans=min(ans,abs(L[i])+abs(L[i+K-1]-L[i]),abs(L[i+K-1])+abs(L[i+K-1]-L[i]))
print(ans) |
p03285 | s122548139 | Accepted | N = int(input())
min = N//4+1
count = 0
for i in range(min):
for j in range(min):
cost = i*4+j*7
if cost == N:
count += 1
else:
continue
if count >= 1:
print("Yes")
else:
print("No") |
p02689 | s139911100 | Accepted | n, m =map(int, input().split())
H=list(map(int, input().split()))
cnt=[0]*n
for i in range(m):
a, b = map(int, input().split())
if H[a-1]>H[b-1]:
cnt[b-1]+=1
elif H[b-1]>H[a-1]:
cnt[a-1]+=1
else:
cnt[a-1]+=1
cnt[b-1]+=1
print(cnt.count(0)) |
p03433 | s576869954 | Accepted | N = int(input())
A = int(input())
if N % 500 <= A:
print("Yes")
else:
print("No")
|
p03309 | s436984810 | Wrong Answer | n = int(input())
l = list(map(int, input().split()))
l = [(l[i] - (i + 1)) for i in range(n)]
l = list(map(abs, l))
a = int(sum(l)/n)
s = [abs(l[i] - a - 1) for i in range(n)]
l = [abs(l[i] - a) for i in range(n)]
print(sum(l) if sum(l) < sum(s) else sum(s))
|
p03109 | s917262326 | Accepted | s = input()
if s > "2019/04/30":
print("TBD")
else: print("Heisei")
|
p03698 | s023708587 | Accepted | s=input()
li=[]
result='yes'
for i in s:
if i in li:
result='no'
li.append(i)
print(result) |
p03657 | s584377764 | Accepted | a, b = map(int, input().split())
if a%3 == 0 or b%3==0 or (a+b)%3==0:
print('Possible')
else:
print('Impossible') |
p02596 | s268279139 | Accepted | K = int(input())
tmp = 7
for i in range(K):
if tmp%K == 0:
print(i+1)
exit()
tmp = (tmp*10+7)%K
print(-1) |
p02615 | s634249301 | Accepted | N = int(input())
A = list(map(int, input().split()))
if N == 2:
print(max(A))
exit(0)
A.sort(reverse=True)
ans = A[0]
cur = 1
for ix in range(len(A[2:])):
ans += A[cur]
if ix & 1:
cur += 1
print(ans)
|
p02744 | s525310258 | Accepted | def solve():
N = int(input())
ans = ['a']
for i in range(N - 1):
newest_ans = []
for a in ans:
A = [ord(b) for b in a]
for t in range(min(A), max(A) + 2):
newest_ans.append(a + chr(t))
ans = newest_ans
for a in sorted(ans):
print(a)... |
p02747 | s453571163 | Wrong Answer | a=input()
flg=0
for i in range(len(a)//2):
if not a[2*i]=='h' and a[2*i+1]=='i':
flg=1
if len(a)%2!=0 or flg==1:
print("No")
else:
print("Yes") |
p04030 | s267941398 | Accepted | a=list(input())
s=''
for i in a:
if i == '0':
s=s+'0'
elif i == '1':
s=s+'1'
else:
s=s[0:-1]
print(s) |
p03455 | s540327337 | Wrong Answer | a,b=map(int,input().split())
if (a+b)%2==0:
print('Even')
else:
print('Odd') |
p03448 | s732575828 | Accepted | import itertools
A = range(int(input()) + 1)
B = range(int(input()) + 1)
C = range(int(input()) + 1)
X = int(input())
count = 0
for i in itertools.product(A, B, C):
if i[0] * 500 + i[1] * 100 + i[2] * 50 == X:
count += 1
print(count) |
p03360 | s212871873 | Wrong Answer | 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(): retur... |
p02664 | s023866040 | Accepted | t = input()
ans = t.replace('?','D')
print(ans) |
p03417 | s138668426 | Wrong Answer | a, b = map(int, input().split())
a, b = min(a,b), max(a,b)
if a==1 and b==1:
print(1)
elif a == 1:
print(b-2)
elif a == 2:
if b == 2:
print(0)
else:
print(4)
else:
print( (a-2) * (b-2))
|
p02628 | s580997816 | Accepted | n,k=map(int,input().split())
pp=list(map(int,input().split()))
pp.sort()
#print(pp)
count=0
for i in range(k):
count+=pp[i]
print(count)
|
p03565 | s280491737 | Wrong Answer | S = input()
T = input()
def match(k):
flag = True
for i in range(len(T)):
if S[i+k] != T[i] and S[i+k]!="?":
flag = False
break
return flag
flag = False
for k in range(len(S)-len(T)+1):
# print(k)
if match(k):
S = S[:k] + T + S[k+len(T):]
flag = True... |
p02556 | s845525301 | Accepted | n = int(input())
XY = [tuple(map(int, input().split())) for _ in range(n)]
# 左下右上
mi = min(XY, key=lambda x: x[0] + x[1])
ma = max(XY, key=lambda x: x[0] + x[1])
ans1 = ma[0]-mi[0] + ma[1]-mi[1]
# 左上右下
mi = min(XY, key=lambda x: x[0] + (10**9)-x[1])
ma = min(XY, key=lambda x: (10**9)-x[0] + x[1])
ans2 = abs(ma[0]-mi[... |
p03836 | s819796182 | Accepted | # https://atcoder.jp/contests/abc051/tasks/abc051_c
sx, sy, tx, ty = map(int, input().split())
ans = []
ans.append('R' * (tx - sx) + 'U' * (ty - sy))
ans.append('L' * (tx - sx) + 'D' * (ty - sy))
ans.append('D' + 'R' * (tx - sx + 1) + 'U' * (ty - sy + 1) + 'L')
ans.append('U' + 'L' * (tx - sx + 1) + 'D' * (ty - sy + 1... |
p02773 | s228432501 | Accepted | # row = [int(x) for x in input().rstrip().split(" ")]
# n = int(input().rstrip())
# s = input().rstrip()
def resolve():
import sys
input = sys.stdin.readline
n = int(input().rstrip())
s_list = [input().rstrip() for _ in range(n)]
from collections import Counter
c = Counter(s_list)
max_c... |
p03105 | s773135948 | Wrong Answer | a,b,c=map(int,input().split())
d=a//b
if d>=c:
print(c)
else:
print(d) |
p03681 | s165806230 | Wrong Answer | n,m=map(int,input().split())
if n==m:
temp=1
for i in range(1,n+1):
temp=(temp*i)%(10**9+7)
print((2*((temp*temp)%(10**9+7)))%(10**9+7))
elif abs(n-m)==1:
temp1=1
temp2=1
for i in range(1,n+1):
temp1=(temp1*(i%(10**9+7)))%(10**9+7)
for j in range(1,n+1):
temp2=(temp2*(j... |
p02718 | s130749899 | Wrong Answer | N,M = map(int,input().split())
A = list(map(int,input().split()))
A.sort(reverse = True)
num = 0
for i in A:
num += i
if A[M-1] >= num//4*M:
print('Yes')
else:
print('No') |
p02602 | s694949716 | Wrong Answer | N,K=map(int,input().split())
A=list(map(int,input().split()))
dictS={}
dictS[0]=1
P=180*170141183460469231731687303715884105727**2+1
# P=10**9+7
for n in range (1,N+1):
if n-1<K:
dictS[n]=(A[n-1]*dictS[n-1])%P
else:
dictS[n]=(A[n-1]*dictS[n-1]/A[n-1-K])%P
if n>K:
if dictS[n]>dic... |
p02744 | s216684437 | Accepted | n=int(input())
ans=[]
def rec(i,s):
if i == n:
print(s)
return
else:
for j in range(len(set(s)) + 1):
rec(i+1,s+chr(ord("a")+j))
rec(1,"a") |
p03659 | s078585307 | Accepted | N = int(input())
a = list(map(int, input().split()))
sunuke = 0
arai = sum(a)
p = []
for i in range(len(a)-1):
sunuke += a[i]
arai -= a[i]
p.append(abs(sunuke - arai))
print(min(p)) |
p03495 | s189489244 | Wrong Answer | n, k = map(int, input().split())
a = list(map(int, input().split()))
s = {}
for i in range(n):
if a[i] in s.keys():
s[a[i]] = s[a[i]] + 1
else:
s[a[i]] = 1
print(s)
cnt = 0
while len(s) > k:
cnt = cnt + min(s.values())
s.pop(min(s, key=s.get))
print(cnt)
|
p02659 | s864584396 | Accepted | from decimal import Decimal
A, B = input().split()
A = Decimal(A)
B = Decimal(B)
ans = A * B
print(int(ans)) |
p03017 | s360849163 | Wrong Answer | import sys
n, a, b, c, d = map(int, input().split())
a, b, c, d = a - 1, b - 1, c - 1, d - 1
s = input()
flg = False
for i in range(a, d + 1):
if s[i] == '#' and s[i + 1] == '#':
print('No')
sys.exit()
for i in range(b, d):
if 0 < i and i + 1 < n:
if s[i - 1] == '.' and s[i] == '.' an... |
p03109 | s197337348 | Wrong Answer | s = input()
if s[0::3] <= "2019" and s[5::6] <= "04" and s[8::9] <= "30":
print("Heisei")
else:
print("TBD") |
p03699 | s291281228 | Accepted | N = int(input())
P = [int(input()) for _ in range(N)]
POINT = [False] * (10 ** 4 + 101)
POINT[0] = True
LP = len(POINT)
for p in P:
for i in range(10**4,-1,-1):
POINT[i+p] = POINT[i] | POINT[i+p]
ans = 0
for i in range(LP):
if POINT[i] and i % 10 != 0:
ans = max(i,ans)
print(ans)
|
p03773 | s862987042 | Wrong Answer | # AtCoder
A, B = map(int, input().split())
ans = A + B
if ans > 24:
ans = ans - 24
print(ans)
|
p03998 | s893604784 | Accepted | a = input()
b = input()
c = input()
d = 'A'
while True:
if d == 'A':
if len(a) == 0:
break
s = a[0]
a = a[1:]
elif d == 'B':
if len(b) == 0:
break
s = b[0]
b = b[1:]
else:
if len(c) == 0:
break
s = c[0]
c = c[1:]
if s == 'a':
d = 'A'
elif s == 'b':
... |
p02554 | s154602647 | Accepted | n = int(input())
a = 10**9+7
def mod(i,j):
ans = 1
for _ in range(j):
ans = (ans*i)%a
return(ans)
print(((mod(10,n)-mod(9,n)*2+mod(8,n))%a)) |
p03419 | s724427423 | Accepted | h,w = map(int,input().split())
if (w == 2 or h == 2):
print(0)
else:
print(max(1,h-2)*max(1,w-2)) |
p03339 | s873875527 | Wrong Answer | n=int(input())
s=str(input())
s=list(s)
tempw=s.count("W")
ans=n-tempw
if s[0]=="W":
ans=ans-1
cnt=n-tempw
for i in range(1,n):
if s[i-1]=="W":
cnt=cnt+1
if s[i]=="E":
cnt=cnt-1
ans=min(ans,cnt)
print(ans) |
p03695 | s995325596 | Wrong Answer | n = int(input())
a = list(map(int,input().split()))
color = [0]*8
nizi = 0
for i in range(n):
if a[i] >= 3200:
nizi += 1
else:
if color[a[i]//400] == 0:
color[a[i]//400] += 1
print(max(1,sum(color)),min(8,sum(color) + nizi))
|
p02768 | s735419138 | Accepted | def cmb(n, r, p):
r = min(r, n - r)
upper = 1
for i in range(n, n - r, -1):
upper = (upper * i) % p
lower = 1
for i in range(1, r + 1):
lower = (lower * i) % p
# フェルマーの小定理よりp素数ならupper**(p-2)は逆元
return (upper * pow(lower, p - 2, p)) % p
mod = pow(10, 9) + 7
n, a, b = map(in... |
p03061 | s298845949 | Accepted | import fractions
N = int(input())
A = list(map(int, input().split()))
left = [0] * (N+1)
right = [0] * (N+1)
for i in range(N):
left[i+1] = (fractions.gcd(left[i], A[i]))
right[N-i-1] = (fractions.gcd(right[N - i],A[N - 1 - i]))
ans = 0
for i in range(N):
ans = max(ans, fractions.gcd(left[i], right[i+1])... |
p02639 | s282753776 | Accepted | def main():
s = list(map(int,input().split()))
for i, n in enumerate(s):
if n == 0:
print(i+1)
if __name__ == '__main__':
main() |
p02817 | s650277164 | Wrong Answer | str= input().split(" ")
str.sort()
ans = str[0]+str[1]
print(ans) |
p02684 | s448352770 | Accepted | N, K = map(int, input().split())
A = list(map(lambda a: int(a) - 1, input().split()))
T = [A[:]]
for _ in range(64):
prev = T[-1]
T.append([prev[a] for a in prev])
now = 0
for d, P in enumerate(T):
if ((1 << d) & K) > 0:
now = P[now]
print(now + 1)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.