problem_id
stringclasses 428
values | submission_id
stringlengths 10
10
| status
stringclasses 2
values | code
stringlengths 5
816
|
|---|---|---|---|
p02548
|
s276121228
|
Wrong Answer
|
import numpy as np
N=int(input())
div = np.zeros(N+1, np.int64)
for n in range(1, N+1):
for m in range(n, N+1, n):
div[m] += 1
print(sum(div))
|
p02987
|
s639299737
|
Accepted
|
s=input()
t=list(set(s))
if len(t)==2:
cnt1=0
cnt2=0
for i in s:
if i==t[0]:
cnt1+=1
elif i==t[1]:
cnt2+=1
if cnt1==2 and cnt2==2:
print('Yes')
exit()
print('No')
|
p03219
|
s717529985
|
Accepted
|
A,B = map(int,input().split())
print(A + B//2)
|
p03380
|
s904807096
|
Wrong Answer
|
def main():
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
l = a[0]
r = 0
chk = 10**9+1
for x in a:
if abs(x-l//2) < chk:
r = x
chk = abs(x-l//2)
print(l, r)
if __name__ == "__main__":
main()
|
p02627
|
s595160980
|
Wrong Answer
|
s = input()
if 'a' <= s <= 'z':
print(s.upper())
else:
print(s.lower())
|
p02658
|
s056825825
|
Accepted
|
import sys
N = int(input())
A = sorted(list(map(int,input().split())))
res = 1
for i in A:
if res > 10**18:
print(-1)
sys.exit()
res *= i
if res > 10**18:
print(-1)
else:
print(res)
|
p03617
|
s018091626
|
Accepted
|
q,h,s,d = map(int, input().split())
n = int(input())
if 2*q < h: h = 2*q
if h*2 < s: s = h*2
if s*2 < d: d = s*2
print(n//2*d + n%2*s)
|
p03804
|
s922139575
|
Accepted
|
n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
r = n - m + 1
for i_r in range(r):
for j_r in range(r):
ok = True
for i in range(m):
for j in range(m):
if a[i_r + i][j_r + j] != b[i][j]:
ok = False
if ok:
print('Yes')
exit(0)
print('No')
|
p03352
|
s813598355
|
Accepted
|
x = int(input())
pr = [1]
for i in range(2,32):
for j in range(2,10):
if (i**j <= 1000)&(i**j not in pr):
pr.append(i**j)
print(max([k for k in pr if k <= x]))
|
p03254
|
s616032244
|
Wrong Answer
|
n, k = map(int, input().split())
a = list(map(int, input().split()))
sum = 0
ans = 0
a.sort()
for i in range(n):
sum += a[i]
if sum <= k:
ans += 1
else:
break
print(ans)
|
p02633
|
s960270367
|
Accepted
|
import math
#print(math.cos(math.radians(90)))
#exit()
x = int(input())
print(360//math.gcd(360,x))
|
p03000
|
s106194619
|
Accepted
|
n, x = map(int, input().split())
l = list(int(i) for i in input().split())
d = 0
cnt = 1
for i in range(n):
d += l[i]
if d <= x:
cnt += 1
print(cnt)
|
p02627
|
s738602158
|
Accepted
|
str = input()
if str.isupper()==True:
print("A")
else:
print("a")
|
p03435
|
s119366865
|
Accepted
|
from itertools import permutations
C = [list(map(int, input().split())) for _ in range(3)]
A = [0, 1, 2]
ans = []
for x in permutations(A, 3):
temp = 0
for j in range(3):
temp += C[j][x[j]]
ans.append(temp)
if len(set(ans)) == 1:
print("Yes")
else:
print("No")
|
p02691
|
s384464672
|
Accepted
|
N=int(input())
ls=[int(s) for s in input().split()]
dicA={}
dicB={}
for i in range(N):
a=i+ls[i]
if a in dicA:
dicA[a]+=1
else:
dicA[a]=1
b=i-ls[i]
if b in dicB:
dicB[b]+=1
else:
dicB[b]=1
ans=0
for a,na in dicA.items():
if a in dicB:
ans+=na*dicB[a]
print(ans)
|
p03761
|
s486361170
|
Accepted
|
n=int(input())
l = [input() for i in range(n)]
L = [[0]*26 for i in range(n)]
s = ''
for i in range(n):
for j in l[i]:
L[i][ord(j)-97] += 1
M = L[0]
for k in range(1,n):
for g in range(26):
M[g] = min(L[k][g],M[g])
for a in range(26):
for b in range(M[a]):
s += chr(a+97)
print(s)
|
p02555
|
s565021235
|
Accepted
|
def ncr(n, r, p):
num = den = 1
for i in range(r):
num = (num * (n - i)) % p
den = (den * (i + 1)) % p
return (num * pow(den,
p - 2, p)) % p
s = int(input())
mod = 10**9+7
if s<3:
res =0
elif s==3:
res = 1
else:
res = 0
for i in range(1, s//3+1):
n = s-2*i-1
r = i-1
res = (res%mod + ncr(n, r, mod)%mod)%mod
print(res)
|
p02628
|
s578442180
|
Wrong Answer
|
k=int(input()[-1])
print(sum(sorted(list(map(int,input().split())))[:k]))
|
p03555
|
s664769916
|
Wrong Answer
|
c1 = input()
c2 = input()
if c1[0] == c2[2] and c1[1] == c2[1] and c1[2] == c2[0]:
print("Yes")
else:
print("No")
|
p02602
|
s679434397
|
Accepted
|
import numpy as np
n, k = map(int, input().split())
points = list(map(int, input().split()))
base = 1
for i, point in enumerate(points[k:]):
if point>points[i]:
print('Yes')
else:
print('No')
|
p02952
|
s973065601
|
Accepted
|
from sys import *
n = int(stdin.readline())
ans = 0
for i in range(1, n + 1):
s = str(i)
if len(s) % 2 is 1:
ans += 1
print(ans)
|
p02724
|
s982922927
|
Accepted
|
x=int(input())
happy=0
while(x-500>=0):
x-=500
happy+=1000
while(x-5>=0):
x-=5
happy+=5
print(happy)
|
p02661
|
s505237022
|
Accepted
|
import numpy as np
def resolve():
N = int(input())
A = np.zeros(N)
B = np.zeros(N)
for i in range(N):
A[i],B[i] = map(int,input().split())
Amed = np.median(A)
Bmed = np.median(B)
if N % 2 == 0:
print(int((Bmed - Amed) * 2 + 1))
else:
print(int(Bmed - Amed +1))
resolve()
|
p02646
|
s971239415
|
Wrong Answer
|
A,V = [int(i) for i in input().split() ]
B,W = [int(i) for i in input().split() ]
T = int(input())
print ( "YES" if A+(V*T) >= B+(W*T) else "NO" )
|
p02948
|
s854804781
|
Accepted
|
n,m=map(int,input().split())
jobs=[]
for i in range(n):
a,b=map(int,input().split())
jobs.append((a,-b))
jobs.sort(reverse=True)
import heapq
hp=[]
ans=0
for i in range(1,m+1):
while jobs and jobs[-1][0]<=i:
heapq.heappush(hp,jobs.pop()[1])
if hp:
ans-=heapq.heappop(hp)
print(ans)
|
p03693
|
s397363678
|
Wrong Answer
|
r,g,b = map(int,input().split())
if (r*100+g*10+b)%4==0:
print("Yes")
else:
print("No")
|
p02547
|
s057999755
|
Wrong Answer
|
N = int(input())
flag = 0
ans = "No"
for i in range(N):
A,B = input().split()
if flag == 3:
ans = "Yes"
if A == B:
flag += 1
else:
flag = 0
print(ans)
|
p03624
|
s992581476
|
Wrong Answer
|
import sys
s=list(input())
s=list(set(s))
s.sort()
#print(s)
for i in range(26):
if i+1 >= len(s):
print(chr(ord("a")+i))
sys.exit()
if chr(ord("a")+i)!=s[i]:
print(chr(ord("a")+i))
sys.exit()
print("None")
|
p02775
|
s237893101
|
Accepted
|
s=input()
n=len(s)
dp=0,1
for i in range(n):
si=int(s[i])
a=min(dp[0]+si,dp[1]+10-si)
b=min(dp[0]+si+1,dp[1]+10-(si+1))
dp=a,b
print(dp[0])
|
p02695
|
s821077032
|
Accepted
|
import itertools
N, M, Q = map(int, input().split())
ABCD = [list(map(int, input().split())) for _ in range(Q)]
# 1 ~ Mまでの数を用いたN項の重複数列を作成する
arrs = []
for arr in itertools.combinations_with_replacement(range(1, M + 1), N):
arrs.append(list(arr))
answer = - float("inf")
for arr in arrs:
tmp = 0
for a, b, c, d in ABCD:
if arr[b - 1] - arr[a - 1] == c:
tmp += d
answer = max(answer, tmp)
print(answer)
|
p02791
|
s723139555
|
Accepted
|
N = int(input())
P = list(map(int,input().split()))
ans = 1
min = P[0]
for i in P[1:]:
if min >= i:
ans += 1
min = i
print(ans)
|
p02772
|
s810781881
|
Wrong Answer
|
n=int(input())
l=list(map(int,input().split()))
print(l)
cnt=0
for i in range(n):
if l[i]%2 !=0:
cnt+=1
if cnt==n:
print('DENIED')
for i in range(n):
if l[i]%2 ==0 and l[i]%3 !=0 and l[i]%5 !=0:
print('DENIED')
exit()
print('APPROVED')
|
p02916
|
s803356593
|
Accepted
|
n=int(input())
a,b,c=list(map(int,input().split())),list(map(int,input().split())),list(map(int,input().split()))
count=b[a[0]-1]
for i in range(1,n):
if a[i]-a[i-1]==1:
count+=c[a[i-1]-1]
count+=b[a[i]-1]
print(count)
|
p03103
|
s266588480
|
Accepted
|
n_store, n_drink = [int(i) for i in input().split()]
stores = [[int(i) for i in input().split()] for _ in range(n_store)] # price, n_stock
stores.sort(key=lambda x: x[0], reverse=True) # priceでソート
ans = 0
while n_drink:
store = stores.pop()
price, n_stock = store
n_buy = min(n_stock, n_drink) # stockがなくなるかn_drinkに到達するまで買う
ans += n_buy * price
n_drink -= n_buy
print(ans)
|
p03076
|
s850932571
|
Wrong Answer
|
import math
a = []
mini = 9
flag = False
for i in range(5):
x = int(input())
if x%10==0:
a.append(x)
else:
flag = True
if x%10<mini :
mini = x%10
a.append(math.ceil(x/10)*10)
if flag:
print(sum(a)-mini)
else:
print(sum(a))
|
p02645
|
s629719098
|
Accepted
|
S = input()
print(S[0:3])
|
p03219
|
s209234298
|
Accepted
|
#!/usr/bin/env python3
X, Y = [int(str) for str in input().strip().split()]
print(X + Y // 2)
|
p02747
|
s288610192
|
Accepted
|
s = input()
s = s.replace("hi", "")
if s:
print("No")
else:
print("Yes")
|
p02897
|
s888260608
|
Accepted
|
import math
n=int(input())
print(math.ceil(n/2)/n)
|
p03264
|
s392452756
|
Wrong Answer
|
n = int(input())
if n%2 == 0:
print((n//2)**2)
else:
print(n//2*(n//2-1))
|
p03407
|
s487661788
|
Wrong Answer
|
a,b,c=map(int,input().split())
if c<=a+b*2:
print('Yes')
else:
print('No')
|
p02683
|
s638868852
|
Wrong Answer
|
n,m,x = map(int,input().split())
li = [list(map(int,input().split())) for i in range(n)]
ans = 10**30
cost = 0
score = [0]*m
for i in range(1<<(n+1)):
for j in range(n):
if (j>>i)&1:
for k in range(m):
score[k] += li[j][k+1]
cost += li[j][0]
if min(score)>=x:
ans = min(ans,cost)
score = [0]*m
cost = 0
if ans==10**30:
print(-1)
else:
print(ans)
|
p03838
|
s579436739
|
Accepted
|
x, y = map(int, input().split())
if x*y < 0:
print(abs(abs(x)-abs(y))+1)
elif x*y == 0:
if x < y:
print(y-x)
else:
print(x-y+1)
else:
if x < y:
print(y-x)
else:
print(x-y+2)
|
p02765
|
s258388987
|
Accepted
|
N,R=map(int,input().split())
if N<10:
print(R+(10-N)*100)
else:
print(R)
|
p02678
|
s580559536
|
Accepted
|
import queue
n,m=list(map(int,input().split()))
graph = [[] for i in range(n)]
for i in range(m):
x,y = list(map(int,input().split()))
graph[x-1].append(y-1)
graph[y-1].append(x-1)
v = [-1 for i in range(n)]
v[0] = [0]
q = queue.Queue()
q.put(0)
while not q.empty():
x = q.get()
for y in graph[x]:
if v[y]!=(-1):
continue
q.put(y)
v[y] = x
print("Yes")
for i in range(1,n):
print(v[i]+1)
|
p02552
|
s972133433
|
Accepted
|
print(1^int(input()))
|
p02676
|
s969035670
|
Wrong Answer
|
k = int(input())
s = input()
s_2 = int(len(s))
if s_2 > k:
tmp = s[k:]
s = s[:k]
a = ["." for i in range(s_2-k)]
s += "".join(a)
ans = s
else:
ans = s
print(s)
|
p02677
|
s777414486
|
Accepted
|
import math
def main():
A, B, H, M = map(float, input().split())
R = H/12 + M*0.5/360
r = M/60
cos = math.cos((R-r)*2*math.pi)
C = math.sqrt(A*A + B*B - 2*A*B*cos)
print(C)
if __name__ == '__main__':
main()
|
p02717
|
s955874581
|
Accepted
|
x, y, z = map(str, input().split())
print(z, x, y)
|
p02831
|
s745462987
|
Wrong Answer
|
A,B=map(int,input().split())
def larger(x,y):
if x>y:
return x
else:
return y
L=larger(A,B)
S=A+B-L
#rが最大公約数
r=100000
n=100000
if L%S==0:
r=S
else:
for i in range(0,L):
if n!=0:
r=L%S
n=S%r
elif n==0:
break
#最小公倍数求める
p=(L*S)//r
print(p)
|
p02823
|
s388280353
|
Accepted
|
def main():
N, A, B = map(int, input().split())
diff = abs(A-B)
if diff%2 == 0:
ans = diff//2
else:
# 端に行く
# 一回端のままになる => 偶数のときと同じ
ans = min(A-1, N-B)
diff -= 1; ans += 1
ans += diff//2
print(ans)
if __name__ == "__main__":
main()
|
p02697
|
s204046306
|
Accepted
|
n,m = map(int,input().split())
if n%2:
for i in range(1,m+1):
print(i,n-i+1)
else:
for i in range(1,m+1):
if n-2*i+1>n//2:
print(i,n-i+1)
else:
print(i,n-i)
|
p03487
|
s309519808
|
Accepted
|
N=int(input())
a=list(map(int,input().split()))
dict={}
count=0
for i in a:
if i not in dict:
dict[i] = 1
continue
dict[i] += 1
for i,j in dict.items():
if i > j:
count += j
elif i < j:
count += j-i
print(count)
|
p03162
|
s962947616
|
Wrong Answer
|
N=int(input())
ABC=[]
for i in range(N):
ABC+=[[int(i) for i in input().split()]]
DP=[[0,0,0] for i in range(N)]
for i in range(N):
for j in range(3):
DP[i][j]=ABC[i][j]+max(DP[max(i-1,0)][(j+1)%3],DP[max(i-1,0)][(j+2)%3])
print(max(DP[N-1]))
|
p02797
|
s535977215
|
Wrong Answer
|
import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)
N, K, S = map(int, read().split())
if S != 1:
ans = [S] * K + [1] * (N - K)
else:
ans = [S] * K + [S + 1] * (N - K)
print(*ans)
|
p02713
|
s620040556
|
Accepted
|
import math
k = int(input())
ans = 0
IJ = [[0 for j in range(k+1)] for i in range(k+1)]
for i in range(1, k+1):
for j in range(1, k+1):
IJ[i][j] = math.gcd(i, j)
for i in range(1, k+1):
for j in range(1, k+1):
for h in range(1, k+1):
ans += math.gcd(IJ[i][j], h)
print(ans)
|
p03760
|
s458311336
|
Accepted
|
o, e = [list(input()) for _ in range(2)]
ans = ''
for i in range(len(o)):
ans += o[i]
if i == len(o)-1 and len(o) != len(e):
break
ans += e[i]
print(ans)
|
p02833
|
s573137606
|
Accepted
|
N = int(input())
count = 0
if N%2==1:
print(0)
exit()
powNum = 1
while 2*pow(5,powNum) <= N:
count += N//(2*pow(5,powNum))
powNum+=1
print(count)
|
p02766
|
s819932246
|
Accepted
|
n, k =list(map(int, input().split()))
l = []
while True:
l.append(n % k)
n = n // k
if n == 0:
break
ans = len(l)
print(ans)
|
p02982
|
s727888314
|
Accepted
|
import math
from itertools import combinations
N,D = map(int,input().split())
X = [list(map(int,input().split())) for _ in range(N)]
combination = list(combinations(range(N),2))
cnt = 0
for i,j in combination:
distance = 0
for k in range(D):
distance += abs(X[i][k] - X[j][k]) ** 2
distance = math.sqrt(distance)
if distance == math.floor(distance):
cnt += 1
print(cnt)
|
p02612
|
s217521392
|
Accepted
|
a = int(input())
b = a % 1000
if b != 0:
ans = 1000 - b
else:
ans = b
print(ans)
|
p02957
|
s676468423
|
Accepted
|
a,b = map(int,input().split())
if (a+b)%2==0:
print((a+b)//2)
else:
print("IMPOSSIBLE")
|
p02694
|
s684549588
|
Accepted
|
X = int(input())
S = 100
Y = 0
while X > S:
S += S // 100
Y += 1
print(Y)
|
p02596
|
s364746599
|
Accepted
|
k = int(input())
m = 7
if(k%2==0):
print("-1")
else:
i = 1
while True:
m = m%k
if(m==0):
print(i)
break
if(i>k):
print("-1")
break
m *= 10
m += 7
i += 1
|
p03109
|
s420525586
|
Accepted
|
s = input()
a = int(s[5])
b = int(s[6])
if a == 0 and b <= 4:
print('Heisei')
else:
print('TBD')
|
p03612
|
s483052115
|
Accepted
|
N = int(input())
P = list(map(int, input().split()))
c = 0
prev = False
for i, p in enumerate(P):
if p == i+1:
c += 1
if prev:
c -= 1
prev = not prev
else:
prev = False
print(c)
|
p02881
|
s165350787
|
Wrong Answer
|
# encoding:utf-8
import copy
import random
import bisect #bisect_left これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import bisect
mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000
def LI(): return list(map(int, sys.stdin.readline().split()))
N = int(input())
ans = 10 ** 12
for i in range(1, math.ceil(N**0.5)+1):
if N / i == N // i:
print(i, N // i)
ans = min(ans, i + N // i - 2)
print(ans)
|
p03657
|
s574021740
|
Wrong Answer
|
print(['P','Imp'][eval(input().replace(' ','+'))%3>0]+'ossible')
|
p02761
|
s050411438
|
Wrong Answer
|
N, M = map(int, input().split())
ans = []
neg = 0
for n in range(N):
ans.append(-1)
for m in range(M):
s, c = map(int, input().split())
if ans[s-1] == -1:
ans[s-1] = c
elif ans[s-1] == c:
pass
else:
neg = -1
break
if ans[0] == 0:
neg = -1
for j in range(len(ans)):
if ans[j] == -1:
ans[j] = 0
if neg == -1:
print(neg)
else:
print("".join([str(i) for i in ans]))
|
p02783
|
s421249318
|
Accepted
|
H, A = list(map(int, input().split()))
ans = (H + A - 1 ) // A
print(int(ans))
|
p03469
|
s854859056
|
Accepted
|
s = list(input())
s[3] = "8"
print("".join(s))
|
p03524
|
s325066546
|
Accepted
|
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = 0
S=input()
C=collections.Counter(S)
C["a"]=C["a"]
C["b"]=C["b"]
C["c"]=C["c"]
print("YES" if max(C.values())-min(C.values()) <= 1 else "NO")
# print(C)
|
p03745
|
s496970496
|
Accepted
|
N = int(input())
A = list(map(int, input().split()))
p = 0
res = 0
while p < N:
while p + 1 < N and A[p] == A[p + 1]:
p += 1
if p + 1 < N and A[p] < A[p + 1]:
while p + 1 < N and A[p] <= A[p + 1]:
p += 1
elif p + 1 < N and A[p] > A[p + 1]:
while p + 1 < N and A[p] >= A[p + 1]:
p += 1
res += 1
p += 1
print(res)
|
p03543
|
s526026236
|
Accepted
|
n = str(input())
if n[0]==n[1]==n[2] or n[1]==n[2]==n[3]:
print("Yes")
else:
print("No")
|
p02854
|
s601725493
|
Accepted
|
N = int(input())
A = list(map(int, input().split()))
s = [0]*(N+1)
for i in range(N):
s[i+1] = s[i] + A[i]
ans = float('inf')
for i in range(1,N):
ans = min(abs(s[N]-s[i]-s[i]),ans)
print(ans)
|
p02628
|
s348847678
|
Accepted
|
N, K = map(int, input().split())
P = list(map(int, input().split()))
P.sort()
print(sum(P[:K]))
|
p02775
|
s847400392
|
Accepted
|
n=input()
m=list(n)
l=[int(i) for i in m]
l.reverse()
l.append(0)
k=l
ans=0
for i in range(len(l)):
if k[i]<5:
ans+=k[i]
elif k[i]==5:
if k[i+1]>=5:
k[i+1]+=1
ans+=5
else:
ans+=10-k[i]
k[i+1]+=1
print(ans)
|
p02687
|
s186045471
|
Accepted
|
S = input()
if S[1] == 'B':
print('ARC')
else:
print('ABC')
|
p02833
|
s328114666
|
Accepted
|
def solve():
_N = int(input())
N = _N
ans = 0
if N % 2 == 0:
div = 10
while N // div > 0:
ans += N//div
div *= 5
print(ans)
solve()
|
p03665
|
s597382887
|
Accepted
|
N, P = map(int, input().split())
O = sum([int(a) % 2 for a in input().split()])
E = N - O
fa = [1]
for i in range(1, 51):
fa.append(fa[-1] * i)
ans = 0
for i in range(P, O+1, 2):
ans += fa[O] // (fa[i] * fa[O-i])
print(ans * 2**E)
|
p03109
|
s813103186
|
Accepted
|
s=input()
print("Heisei" if s<="2019/04/30" else "TBD")
|
p03435
|
s981235619
|
Accepted
|
def check(a,b):
for i in range(3):
diffc[i] = c[i][a]-c[i][b]
diffr[i] = c[a][i]-c[b][i]
if diffc[0] != diffc[1] or diffc[1] != diffc[2] or diffr[0] != diffr[1] or diffr[1] != diffr[2]:
print("No")
exit()
c = [[int(i) for i in input().split()] for i in range(3)]
diffr = [0]*3
diffc = [0]*3
check(0,1)
check(1,2)
print("Yes")
|
p03767
|
s016363928
|
Accepted
|
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
print(sum(A[i] for i in range(1, 2 * N + 1, 2)))
|
p02717
|
s499880637
|
Wrong Answer
|
def abc(x,y,z):
A = z
B = x
C = y
return A,B,C
print(abc(1,2,3))
|
p02802
|
s670143783
|
Accepted
|
n,m=map(int,input().split())
li=[input().split() for i in range(m)]
ac=set()
wa=0
q=[[0,-1] for i in range(n+1)]
for x,y in li:
if y=="AC" and q[int(x)][1]==-1: #AC出したらこれまでのwaを答えに足して、それ以降はカウントされないようにする
wa+=q[int(x)][0]
q[int(x)][1]=0
ac.add(x)
elif y=="WA" and q[int(x)][1]==-1:
q[int(x)][0]+=1
print(len(ac),wa)
|
p03693
|
s212181858
|
Wrong Answer
|
r, g, b = input().split()
a = int(r + g + b)
if a % 4 == 0:
print('Yes')
else:
print('No')
|
p03994
|
s752718868
|
Accepted
|
s=input()
n=len(s)
k=int(input())
ans=[]
for i in range(n):
if i==n-1:
ans.append(chr(((ord(s[i])-97+k)%26)+97))
else:
if s[i]=="a":
ans.append("a")
else:
if 26-(ord(s[i])-97)<=k:
ans.append("a")
k-=(26-(ord(s[i])-97))
else:
ans.append(s[i])
print("".join(ans))
|
p02888
|
s793401088
|
Accepted
|
from bisect import bisect_left, bisect_right
n = int(input())
stick = list(map(int, input().split()))
stick.sort()
count = 0
for i in range(n - 1, -1, -1):
for j in range(i - 1, -1, -1):
l = bisect_right(stick, stick[i] - stick[j])
r = bisect_left(stick, stick[i] + stick[j]) # [l, r) が範囲
if j <= l:
break
count += min(r, j) - l
print(count)
|
p03998
|
s252957068
|
Accepted
|
dic = {}
dic.setdefault('a',str(input())+'A')
dic.setdefault('b',str(input())+'B')
dic.setdefault('c',str(input())+'C')
dare = dic['a'][0]
dic['a'] = dic['a'][1:]
while len(dic['a'])>0 and len(dic['b'])>0 and len(dic['c'])>0:
tmp = dic[dare][0]
dic[dare] = dic[dare][1:]
dare = tmp
print(dare)
|
p02556
|
s805681668
|
Accepted
|
n=int(input())
alist=[]
blist=[]
for i in range(n):
x,y=map(int, input().split())
alist.append(x+y)
blist.append(x-y)
print(max(max(alist)-min(alist),max(blist)-min(blist)))
|
p03419
|
s051394521
|
Accepted
|
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()
def resolve():
N, M = LI()
ans = (1 if N == 1 else N - 2) * (1 if M == 1 else M - 2)
print(ans)
if __name__ == '__main__':
resolve()
|
p03206
|
s476015743
|
Accepted
|
d = int(input())
print('Christmas' if d==25 else 'Christmas Eve' if d==24 else 'Christmas Eve Eve' if d == 23 else 'Christmas Eve Eve Eve')
|
p03699
|
s797404894
|
Accepted
|
import copy
n=int(input())
s=[int(input()) for i in range(n)]
Sum=[]
if sum(s)%10 != 0:
print(sum(s))
exit()
for i in s:
c=copy.copy(s)
c.remove(i)
baisu=sum(c)
#print(c)
if baisu % 10 != 0:
Sum.append(baisu)
if len(Sum) == 0:
print(0)
else:
print(max(Sum))
|
p02713
|
s158549723
|
Accepted
|
import math
k=int(input())
s=0
for i in range(1,k+1):
for j in range(1, k+1):
tmp=math.gcd(i,j)
for h in range(1, k+1):
s+=math.gcd(tmp,h)
print(s)
|
p03285
|
s910499924
|
Accepted
|
x = int(input())
flag = False
for i in range(26):
left = x-4*i
if left>=0 and left%7==0:
flag=True
break
if flag:
print("Yes")
else:
print("No")
|
p03627
|
s009582856
|
Accepted
|
n = int(input())
A = list(map(int, input().split()))
from collections import Counter
C = Counter(A)
A = sorted(list(set(A)))[::-1]
flag = False
x = 0
for a in A:
if flag == False:
if C[a] >= 4:
print(a ** 2)
exit()
elif C[a] >= 2:
flag = True
x = a
elif flag == True and C[a] >= 2:
print(a * x)
exit()
else:
print(0)
|
p02786
|
s908109494
|
Accepted
|
n = int(input())
i = 1
while ( i * 2 <= n):
i *= 2
print(i*2-1)
|
p02555
|
s972642439
|
Wrong Answer
|
from functools import lru_cache
import sys
sys.setrecursionlimit(2000)
s = int(input())
mod = 10 ** 9 + 7
@lru_cache(maxsize=1000)
def dfs(n):
if n <= 2:
return 0
elif 3 <= n <= 6:
return 1
else:
count = 1
for i in range(3, n + 1):
count += dfs(n - i)
count %= mod
return count % mod
ans = dfs(s)
print(ans)
|
p02659
|
s122397937
|
Wrong Answer
|
from math import floor
a, b = map(float, input().split())
ans = floor(a * b)
print(ans)
|
p03494
|
s012203746
|
Wrong Answer
|
n=int(input())
a=list(map(int,input().split()))
count=0
while(1):
for i in range(n):
if a[i]%2==1:
break
else:
a[i]=a[i]//2
count+=1
else:
break
print(count)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.