problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p03761 | s112052339 | Accepted | n=int(input())
d={chr(i):51 for i in range(97,97+26)}
for i in range(n):
s=input()
for key in d:
d[key]=min(d[key],s.count(key))
ans=''
for key in d:
ans+=key*d[key]
print(ans)
|
p02628 | s661494918 | Accepted | # じょえチャンネルおもしろいよ~~~
# https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
print(sum(a[:k])) |
p02613 | s704954689 | Accepted | num=int(input().rstrip())
cases=[]
for i in range(num):
cases.append(input().rstrip())
target=['AC','WA','TLE','RE']
result=[0,0,0,0]
for j in range(len(target)):
for i in range(len(cases)):
if cases[i]==target[j]:
result[j]=result[j]+1
for i in range(len(target)):
print(target[i]+' x '+str(result[i]))
|
p03448 | s696201792 | Accepted | A=int(input())
B=int(input())
C=int(input())
x=int(input())
ans=0
L=[500*a+100*b+50*c for c in range(C+1) for b in range(B+1) for a in range(A+1)]
print(L.count(x)) |
p03672 | s166037733 | Accepted | S=input()
A = ""
B = ""
if len(S)%2 == 0:
N = len(S)//2-1
else : N = len(S)//2
while True:
for i in range(N):
A += S[i]
B += S[i+N]
if A == B:
print(len(A)*2)
break
else:
N -= 1
A = ""
B = "" |
p03623 | s186125679 | Wrong Answer | x,a,b = map(int,input().split())
print(min(abs(x-a),abs(x-b))) |
p03556 | s273441615 | Accepted | N = int(input())
print((int(N**(1/2)))**2) |
p02918 | s543499494 | Accepted | N,K=map(int,input().split())
S=input()
e=(S[0]=='L')+(S[-1]=='R')
i=S.count("RL")
c=max(i-K,0)*2+max(e-max(K-i,0),0)
print(N-max(c,1))
|
p02684 | s867887022 | Wrong Answer | n, k = map(int, input().split())
a = list(map(int, input().split()))
i = 0
ans = 0
root = [-1] * n
flag = [False] * n
j = 0
while flag[a[i] - 1] == False:
flag[a[i] - 1] = True
root[j] = a[i]
i = a[i] - 1
j += 1
s_i = root.index(a[i])
x = 0
for i in range(k % (j - s_i)):
ans = root[x]
x = root[x] - 1
print(ans) |
p02910 | s695144525 | Accepted | S = str(input())
check = 1
for i in range(len(S)):
if i%2==0 and S[i]=='L':
check = 0
break
elif i%2==1 and S[i]=='R':
check = 0
break
if check == 1:
print('Yes')
else:
print('No') |
p02933 | s260179103 | Accepted | a = int(input())
b = input()
if a < 3200 and b:
print("red")
else:
print(b)
|
p03779 | s790013152 | Accepted | import collections
target = int(raw_input())
t = 0
while(target):
target -= min(target, t + 1)
t +=1
print t |
p03011 | s283700271 | Wrong Answer | P, Q, R = map(int, input().split())
List =[P+Q, Q+R, R+P]
List.sort
print(List[0]) |
p02731 | s686155300 | Accepted | L = int(input())
y = L / 3
V = (y * ((y - L) ** 2)) / 4
print(V) |
p02909 | s095171904 | Accepted | S=input()
if "Sunny"==S:
print("Cloudy")
elif "Cloudy"==S:
print("Rainy")
elif "Rainy"==S:
print("Sunny")
|
p02714 | s915185584 | Accepted | N = int(input())
S = '0'
S += input()
R_count = 0
G_count = 0
B_count = 0
for i in range(1, N + 1):
if S[i] == 'R':
R_count += 1
if S[i] == 'G':
G_count += 1
if S[i] == 'B':
B_count += 1
res = R_count * G_count * B_count
for i in range(1, N + 1):
for j in range(i + 1, N + 1):
if 2 * j - i > N:
break
temp = []
temp += S[i] + S[j] + S[2 * j - i]
temp.sort()
if temp[0] == 'B' and temp[1] == 'G' and temp[2] == 'R':
res -= 1
print(res) |
p03487 | s130321050 | Wrong Answer | n = int(input())
a = list(map(int, input().split()))
a.sort()
b = list(set(a))
ans = 0
for i in range(len(b)):
if a.count(b[i]) != b[i]:
ans += min(abs(a.count(b[i]) - b[i]), a.count(b[i]))
print(ans) |
p03817 | s071147431 | Wrong Answer | x = int(input())
loop = 6+5
if x%loop <= 6:
mod = 1
else:
mod = 2
print(2*(x//loop)+mod) |
p02683 | s943653102 | Wrong Answer | import numpy
N,M,X = map(int,input().split())
A = numpy.array([[int(i) for i in input().split()] for _ in range(N)])
ans = 10**6
for i in range(2**N) :
i = format(i,'b').zfill(N)
s = 0
check = numpy.array([0]*(M+1))
for j in range(N) :
if i[j] == '0' :
continue
check += A[j][0:]
# print('i = {},j = {},check = {}'.format(i,j,check))
if all (check[m] >= X for m in range(1,M)) :
ans = min(ans,check[0])
print(ans) |
p03545 | s827815278 | Wrong Answer | #!/usr/bin/env python3
s = input()
def dfs(i, n, ns):
if i == 3:
if n == 7:
print(ns + '=7')
return
else:
return
dfs(i+1, n + int(s[i+1]), ns + '+' + s[i+1])
dfs(i+1, n - int(s[i+1]), ns + '-' + s[i+1])
dfs(0, int(s[0]), s[0]) |
p02787 | s733487837 | Wrong Answer | import sys
H,N = map(int, input().split())
D=list()
for i in range(N):
a,b = map(int, input().split())
D.append((a, b, a/b))
ans = 0
M = list(sorted(D, key=lambda tup: tup[2], reverse=True))
ans = (H // M[0][0]) * M[0][1]
H = H % M[0][0]
if H == 0:
print(ans)
sys.exit()
dp = [[H]]
mi = float("inf")
for d in M:
mp = (H // d[0]) * d[1]
if H % d[0] != 0:
mp += d[1]
if mi > mp:
mi = mp
ans += mi
print(ans) |
p02726 | s887338803 | Accepted | def main():
N,X,Y=map(int,input().split())
C=[0]*N
for i in range(1,N):
for j in range(i+1,N+1):
C[min(j-i,abs(X-i)+1+abs(j-Y))]+=1
for i in range(1,N):
print(C[i])
main()
|
p04045 | s843669443 | Accepted | n, k = map(int, input().split())
D = set(list(input().split()))
for i in range(n, n*10+1):
if set(str(i))&D == set():
print(i)
break |
p02916 | s672718951 | Accepted | n = int(input())
a, b, c = [list(map(int, input().split())) for _ in range(3)]
s = sum(b)
for i in range(n - 1):
if a[i] + 1 == a[i + 1]:
s += c[a[i] - 1]
print(s) |
p02583 | s101162196 | Accepted | n = int(input())
l = list(map(int, input().split())) # list()でリスト化、それを変数に代入。
count = 0
l.sort()
for i in range(n-2):
for j in range(i+1,n-1):
if l[i] == l[j]:
continue
for k in range(j+1,n):
if l[j] == l[k] or l[i] == l[k]:
continue
if l[i] + l[j] > l[k]:
count += 1
print(count)
|
p03163 | s547446443 | Wrong Answer | N,W = map(int,input().split())
wv = [list(map(int,input().split())) for _ in range(N)]
dp = [[0]*(W+1) for _ in range(N+1)]
dp[0][W] = 0
for i in range(N):
for j in range(W+1):
if j- wv[i][0] >= 0:
dp[i+1][j] = max(dp[i+1][j], dp[i][j-wv[i][0]] + wv[i][1])
else:
dp[i+1][j] = max(dp[i+1][j], dp[i][j])
ans = 0
for k in range(N+1):
ans = max(ans, max(dp[k]))
print(ans)
|
p02677 | s880725920 | Accepted | import math
def get_distance(x1, y1, x2, y2):
d = math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
return d
a, b, h, m = list(map(int, input().split()))
point_h = [
a * math.cos(math.radians((90 - 30*h)-m/2.0)),
a * math.sin(math.radians((90 - 30*h)-m/2.0))
]
point_m = [
b * math.cos(math.radians(90 - 6*m)),
b * math.sin(math.radians(90 - 6*m))
]
print(get_distance(point_h[0], point_h[1], point_m[0], point_m[1])) |
p03146 | s707447972 | Wrong Answer | s = int(input())
a = s
c = 0
while a != 1:
if a%2 == 0:
a = int(a/2)
c += 1
else:
a = int(3*a+1)
c += 1
print(c+2) |
p03069 | s460978754 | Accepted | n = int(input())
s = input()
white = s.count('.')
black = n - white
w = 0
b = 0
y = [white]
for i in range(n):
if s[i] == '#':
b += 1
else: w += 1
y.append(b+white-w)
if w == white:
break
print(min(y)) |
p02854 | s178315613 | Accepted | n=int(input())
a=list(map(int,input().split()))
s=sum(a)
ans = 12345678901234
cnt = 0
for i in range(n):
cnt += a[i]
ans = min(ans,abs(s-cnt - cnt))
print(ans) |
p03785 | s519252606 | Wrong Answer | n, c, k = map(int, input().split())
arr = sorted([int(input()) for _ in range(n)])
ans = 0
cnt = 0
tmp_t = 0
for t in arr:
if cnt == 0:
tmp_t = t
cnt += 1
if cnt >= c:
ans += 1
cnt = 0
elif t - tmp_t > k:
ans += 1
cnt = 1
tmp_t = t
if cnt:
ans += 1
print(ans)
|
p03994 | s201196063 | Wrong Answer | S = list(input())
N = int(input())
'''
ordの位置
#z = 122
#a = 97
左の文字からNで'a'に出来るかを確認
aに出来るならaにして使った分をNから引く
繰り返して行き一番最後にあまりをすべて使う'''
for i, s in enumerate(S):
if ord(s) - 97 > 0 and 122 - ord(s) < N:
S[i] = "a"
N -= 123 - ord(s)
else:
S[i] = (chr((ord(S[i]) + N) % 122 ))
print("".join(S)) |
p02910 | s497183256 | Wrong Answer | s = input()
flg = 0
for i in range(len(s)):
if i % 2 == 0 and (s[i] != "L" and s[i] != "U" and s[i] != "D"):
flg = 1
elif i % 2 == 1 and (s[i] != "R" and s[i] != "U" and s[i] != "D"):
flg = 1
else:
continue
if flg == 0:
print("YES")
else:
print("NO")
|
p02603 | s128686491 | Accepted | N = int(input())
A = list(map(int, input().split()))
money = 1000
stock = 0
i = 0
while i < N - 1:
if A[i + 1] > A[i]:
# 全額buy
stock += money // A[i]
money -= (money // A[i]) * A[i]
# print('buy', i)
# print(money, stock)
if A[i + 1] < A[i]:
money += stock * A[i]
stock = 0
if i == N - 2 and stock > 0:
money += stock * A[-1]
stock = 0
# print(i, money, stock)
i += 1
print(money)
|
p02789 | s363835794 | Wrong Answer | N = int("0" <= "N" <= "100")
M = int("0" <= "N" <= "M")
if N == M:
print("yes")
if N > M:
print("No") |
p02897 | s867382085 | Wrong Answer | n = int(input())
count = 0
result = 0
for i in range(n+1):
if n % 2 ==0:
pass
else:
count +=1
result = count / n
print(result) |
p03109 | s643352646 | Wrong Answer | s = input()
if s[5] == 0 and int(s[6]) <=4:
print('Heisei')
else:
print('TBD') |
p03284 | s180758148 | Accepted | n, k = map(int, input().split())
if n % k == 0:
ans = 0
else:
ans = 1
print(ans)
|
p02665 | s299856389 | Accepted | n,*a=map(int,open(0).read().split())
t,v,w=sum(a),1,1
for q in a:
w=min(2*(w-q),t:=t-q)
v+=w
if w<0:print(-1);exit()
print(v)
|
p02862 | s325856283 | Accepted | from functools import reduce
x,y=list(map(int,input().split()))
mod = 10 ** 9 + 7
if (2 * y - x) % 3 != 0 or (2 * x - y) % 3 != 0:
print("0")
exit()
a,b = (2 * y - x) // 3, (2 * x - y) // 3
r = max(a,b)
if min(a,b) < 0:
print("0")
else:
numerator = reduce(lambda x, y: x * y % mod, range(a + b - r + 1, a + b + 1))
denominator = reduce(lambda x, y: x * y % mod, range(1 , r + 1))
print(numerator * pow(denominator, mod - 2, mod) % mod) |
p02707 | s867107111 | Accepted | import collections
N = int(input())
A = list(map(int,input().split()))
c = collections.Counter(A)
for i in range(1, N + 1):
print(c[i]) |
p02756 | s621701371 | Accepted | s = input()
q = int(input())
qs = [input().split() for i in range(q)]
n = False
left= right = ""
for operation in qs:
if operation[0] == '1':
n = not n
if operation[0] == '2':
t , f, c = operation
f = int(f)
if n:
f = 1 if f != 1 else 2
if f == 1:
left=c+left
elif f == 2:
right+=c
s = left+s+right
print(s[::-1] if n else s) |
p02657 | s380924054 | Wrong Answer | a , b = (input().split(' '))
a = int(a[0])
b = int(b[0])
print(a*b) |
p02658 | s034195656 | Wrong Answer | n = int(input())
a = []
a = input().split()
b = 1
for num in range(n):
b = b * num
print(b) |
p02994 | s431259173 | Accepted | n,l = map(int,input().split())
lst = [l+i-1 for i in range(1,n+1)]
if 0 in lst:
print(sum(lst))
else:
if l > 0:
print(sum(lst)-l)
if l < 0:
print(sum(lst)-(l+n-1))
|
p02957 | s290500459 | Accepted | a,b = map(int,input().split())
sa = max(a,b) - min(a,b)
if sa % 2 == 0:
print((a + b) // 2)
else:
print('IMPOSSIBLE') |
p03835 | s959997933 | Wrong Answer | k,s=map(int,input().split())
x=[0]*k
for i in range(0,k):
x[i]=i
x.append(k)
a=int(s/3)-1
count=0
for i in range(0,len(x)):
stemp=s-x[i]
for j in range(0,min(k+1,stemp)):
if stemp-x[j] in x:
count=count+1
print(count)
|
p02823 | s114757671 | Accepted | n, a, b = map(int, input().split())
print((b-a)//2 + min(a-1,n-b) + 1 if (b-a)%2 else (b-a)//2) |
p03778 | s540717509 | Accepted | w,a,b=map(int,input().split())
if a<b:
print(b-a-w if b-a-w>0 else 0)
else:
print(a-b-w if a-b-w>0 else 0)
|
p03345 | s470796792 | Accepted | a,b,c,k = map(int,input().split())
if k % 2 == 0:
ans = a - b
else:
ans = b - a
print(ans) |
p04012 | s853326942 | Accepted | w = input()
w = list(w)
import collections
co = collections.Counter(w)
li = co.values()
for i in li:
if i % 2 == 1:
print('No')
exit()
print('Yes') |
p03220 | s350734290 | Accepted | n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
l = []
for i in h:
l.append(abs(a - (t - i * 0.006)))
print(l.index(min(l)) + 1) |
p02836 | s779074756 | Accepted | s = input()
ans = 0
for a, b in zip(s, s[::-1]):
if a != b:
ans += 1
print(ans // 2) |
p04033 | s878808520 | Accepted | a,b = map(int,input().split())
if b<0 and (b-a+1)%2==0:
print("Positive")
elif b<0 and (b-a+1)%2==1:
print("Negative")
elif a<0 and b>=0:
print("Zero")
elif a==0:
print("Zero")
elif a>0:
print("Positive") |
p03317 | s141705053 | Accepted | n,k = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
k -= 1
cnt = -(-(n-1)//k)
print(cnt) |
p03815 | s381165815 | Accepted | x = int(input())
a = (x // 11) * 2
if x % 11 == 0:
b = 0
elif x % 11 <= 6:
b = 1
else:
b = 2
print(a + b) |
p02755 | s955870779 | Wrong Answer | a,b=map(int,input().split())
import math
a_min=math.ceil(a/0.08)
a_max=math.floor((a+1)/0.08)
b_min=math.ceil(b/0.1)
b_max=math.floor((b+1)/0.1)
if a_max<b_min or b_max<a_min:
ans=-1
else:
ans=max(a_min,b_min)
print(ans) |
p03994 | s156559406 | Accepted | s = list(input())
k = int(input())
for i in range(len(s)):
if ord("z")<ord(s[i])+k and s[i]!="a":
k =k-(ord("z")-ord(s[i])+1)
s[i]="a"
if i==len(s)-1 and 0<k:
k=k%26
s[i]=chr(ord(s[i])+k)
print("".join(s)) |
p04012 | s767184239 | Accepted | import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')
w = input()
import collections
c = collections.Counter(w)
for k, v in c.items():
if v % 2 != 0:
print('No')
quit()
print('Yes')
|
p02995 | s463740155 | Accepted | a,b,c,d=map(int,input().split())
from fractions import gcd
m=(c*d)//gcd(c,d)
A=b//c-(a-1)//c # a-bのうち、cの倍数のもの
B=b//d-(a-1)//d # a-bのうち、dの倍数のもの
C=b//m-(a-1)//m # a-bのうち、cとdの最小公倍数の倍数のもの
ans=(b-a+1)-(A+B-C)
print(ans) |
p02731 | s595722148 | Accepted | x = int(input())
num = x // 3
rem = x % 3
if rem == 1:
res = (num+1)*(num**2)
elif rem == 2:
res = ((num + 1) ** 2) * num
else:
res = num ** 3
res2 = (x/3)**3
if res > res2:
print(res)
else:
print(res2) |
p02881 | s833036318 | Accepted | n = int(input())
ans = float("inf")
for i in range(1, int(n**0.5)+2):
if n%i == 0:
a = n//i
t = i+a-2
ans = min(ans, t)
print(ans) |
p02785 | s143392317 | Wrong Answer | def main():
N, K = map(int,input().split())
H = list(map(int,input().split()))
H.sort()
print(sum(H[:-K]))
return
main() |
p03485 | s263382654 | Accepted | a,b=map(int,input().split())
import math
print(math.ceil((a+b)/2))
|
p03109 | s755696342 | Wrong Answer | s = input()
if int(s[0:3]) <= 2019 and int(s[6]) <= 4 and int(s[8:9]) <= 30:
print("Heisei")
else:
print("TBD")
|
p03944 | s580850377 | Accepted | W,H,N = map(int,input().split())
L = 0
R = W
D = 0
U = H
for _ in range(N):
x,y,a = map(int,input().split())
if a == 1:
L = max(L,x)
if a == 2:
R = min(R,x)
if a == 3:
D = max(D,y)
if a == 4:
U = min(U,y)
x = max(0,R-L)
y = max(0,U-D)
answer = x*y
print(answer)
|
p02742 | s734408829 | Accepted | import math
a,b=map(int,input().split())
if a==1 or b==1:
k=1
else:
k=math.ceil((a*b)/2)
print(k)
|
p02612 | s714003735 | Wrong Answer | N = int(input())
a = 1000 - (N % 1000)
print(a) |
p03827 | s578326773 | Wrong Answer | n=int(input())
s=list(str(input()))
x=0
ans=-1
for i in range(n):
ans=max(ans,x)
if s[i]=="I":
x+=1
else:
x-=1
print(ans) |
p03419 | s567822827 | Accepted | n,m=list(map(int, input().split()))
check=0
if n==1 or m==1:
if n*m!=1:
check=max(n,m)-2
print(max((n-2)*(m-2),0)+check)
|
p02700 | s148587704 | Accepted | def get_ints():
return list(map(int, input().split()))
a, b, c, d = get_ints()
while True:
c -= b
if c <= 0:
print('Yes')
exit(0)
a -= d
if a <= 0:
print('No')
exit(0)
|
p03150 | s877951148 | Accepted | S = input()
k = "keyence"
if S == k:
print("YES")
else:
ans = "NO"
s = S
for i in range(8):
S = list(s)
del S[i:i+(len(S)-7)]
if "".join(S) in k:
ans = "YES"
break
print(ans) |
p03721 | s941491286 | Accepted | n,k=map(int,input().split())
ab=[]
for _ in range(n):
ab.append(list(map(int,input().split())))
ab.sort(key=lambda x:x[0])
i=0
j=0
ans=0
while j<k:
j+=ab[i][1]
ans=ab[i][0]
i+=1
print(ans)
|
p03544 | s879436009 | Accepted | n = int(input())
ryuka = [0] * (n+1)
for i in range(n+1):
if i==0:
ryuka[i] = 2
elif i==1:
ryuka[i] = 1
else:
ryuka[i] = ryuka[i-2] + ryuka[i-1]
print(ryuka[-1]) |
p02759 | s258886684 | Accepted | print((int(input()) + 1)//2) |
p02790 | s608998517 | Wrong Answer | A,B = list(map(int,input().split()))
para_a = str(B)
para_b = str(A)
for i in range(A-1):
para_a = para_a + str(B)
for i in range(B-1):
para_b = para_b + str(A)
N = [para_a,para_b]
print(N)
sorted(N)
print(N[0])
|
p02658 | s440153079 | Accepted | def main():
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
if 0 in A:
print('0')
return
prod=1
for a in A:
prod*=a
if prod> 1000000000000000000:
print('-1')
return
print(prod)
ans=main()
|
p04020 | s371517552 | Accepted | n = int(input())
A = [int(input()) for _ in range(n)]
ans = 0
temp = 0
for i in range(n):
ans += (A[i]+temp)//2
if A[i] != 0:
temp = (A[i]+temp)%2
else:
temp = 0
print(ans) |
p03796 | s701455186 | Wrong Answer | n = int(input())
ans = 1
dummy1,dummy2 = divmod(n,2)
for i in range(1,dummy1+1):
ans *= i
ans *= n+1-i
ans = ans % (10**9+7)
if dummy2 == 1:
ans *= (dummy2+1)
print(ans)
|
p02594 | s519915773 | Accepted |
n = int(input())
if(n >= 30):
print("Yes")
else:
print("No") |
p03695 | s424166802 | Accepted | n=int(input())
a=list(map(int,input().split()))
b=[0 for i in range(15)]
for some in a:
b[some//400]+=1
ans=0
for i in range(8):
if b[i]>0:
ans+=1
mini=ans
for i in range(8,15):
ans+=b[i]
if mini==0:
mini=1
print(mini,ans)
|
p02701 | s458221098 | Wrong Answer | n=int(input())
dic=[]
for i in range(n):
if not i in dic:
dic.append(i)
print(len(dic)) |
p02613 | s182838229 | Accepted | import sys
input = sys.stdin.readline
N = int(input())
S_list = [input() for _ in range(N)]
AC_c = 0
WA_c = 0
TLE_c = 0
RE_c = 0
for S in S_list:
if S == "AC\n":
AC_c += 1
elif S == "WA\n":
WA_c += 1
elif S == "TLE\n":
TLE_c += 1
else:
RE_c += 1
print("AC x " + str(AC_c))
print("WA x " + str(WA_c))
print("TLE x " + str(TLE_c))
print("RE x " + str(RE_c)) |
p02702 | s797996674 | Accepted | def main():
n, mods = 0, [1]+[0]*2019
d = 1
for i in reversed(input()):
n = (n+int(i)*d)%2019
d = d*10%2019
mods[n] += 1
print(sum([i*(i-1)//2 for i in mods]))
main() |
p02778 | s775911159 | Accepted | from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")
# 処理内容
def main():
S = input()[:-1]
print("x" * len(S))
if __name__ == '__main__':
main() |
p03419 | s552814641 | Accepted | n,m=map(int,input().split())
m-=2
n-=2
if m<0:
m=1
if n<0:
n=1
print(m*n) |
p02847 | s259013677 | Accepted | import sys
# input = sys.stdin.buffer.readline
def getN():
return int(input())
def getNM():
return map(int, input().split())
def getlist():
return list(map(int, input().split()))
import math
import heapq
from collections import defaultdict, Counter, deque
MOD = 10**9 + 7
INF = 10**15
def main():
date = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]
print(7 - date.index(input().strip()))
if __name__ == '__main__':
main()
"""
9999
3
2916
""" |
p02817 | s404998973 | Accepted | S,T = map(str,input().split())
print(T+S) |
p03210 | s124812711 | Accepted | x = int(input())
if x == 3 or x == 5 or x == 7:
print("YES")
else:
print("NO") |
p03815 | s652822610 | Accepted | x=int(input())
a=x//11
b=x%11
if b==0:
print(2*a)
elif b>0 and b<7:
print(2*a+1)
else:
print(2*a+2) |
p03017 | s163791696 | Wrong Answer | N, A, B, C, D = map(int, input().split())
N-=1
A-=1
B-=1
C-=1
D-=1
S = input()
massesExist = True
overtakeFlag = False if C > D else True
proceedableFlag = True
if max(A, B, C, D) > N:
massesExist = False
for i in range(B, D-1):
if S[i-1] == "." and S[i] == "." and S[i+1] == ".":
overtakeFlag = True
for i in range(B, max(C, D)-1):
if S[i]=="#" and S[i+1]=="#":
proceedableFlag = False
if overtakeFlag and proceedableFlag and massesExist:
print("Yes")
else:
print("No")
|
p02775 | s788383004 | Wrong Answer | # coding: utf-8
n = input().rstrip()
count = 0
c = 0
for i in range(len(n)):
num = int(n[-i-1])
if c + num <= 5:
count += c + num
c = 0
else:
count += 10 - num - c
c = 1
print(count + c) |
p03208 | s842224473 | Accepted | import itertools
import math
import fractions
import functools
import copy
n, k = map(int, input().split())
h = []
for i in range(n):
h.append(int(input()))
h.sort()
minimum = 10**10
for i in range(n-k+1):
minimum = min(minimum,h[i+k-1]-h[i])
print(minimum) |
p02571 | s065448761 | Accepted | S = [i for i in input()]
T = [i for i in input()]
N = len(T)
ans = 10**10
for i in range(len(S)-N+1):
X = S[i:i+N]
a = N
for j in range(N):
if X[j] == T[j]:
a -= 1
ans = min(ans, a)
print(ans) |
p03962 | s263161918 | Wrong Answer | a,b,c=map(int,input().split())
if (a!=b,b!=c,a!=c):
print(3)
elif(a==b,b!=c):
print(2)
elif(b==c,c!=a):
print(2)
elif(c==a,a!=b):
print(2)
else:
print(1) |
p02555 | s492417150 | Wrong Answer | import math
S = int(input())
if S < 3:
print(0)
else:
n = S//3
surp = S%3
ans = 0
while n > 0:
ans += (math.factorial(surp+n-1)//math.factorial(surp)//math.factorial(n-1))
ans = ans % 1000000007
n = n - 1
print(ans) |
p03639 | s362897900 | Accepted | #ARC080-C
n = int(input())
a = list(map(int,input().split()))
four = 0
even = 0
odd = 0
for i in a:
if i%4 == 0:
four += 1
elif i % 2 == 0:
even += 1
else:
odd += 1
if even > 0 and even % 2 == 1:
odd += 1
if four + 1 >= odd:
print('Yes')
else:
print('No') |
p02797 | s592829913 | Wrong Answer | n = input()
m = n.split()
p = [int(i) for i in m]
a = []
for i in range(p[0]):
if i < p[1]:
a.append(str(p[2]))
else:
a.append(str(p[2]+1))
A = " ".join(a)
print(A) |
p03639 | s867565749 | Accepted | N = int(input())
a=0;b=0;c=0
L = list(map(int,input().split()))
for i in range(N):
if L[i]%4 == 0:
c += 1
elif L[i]%2 == 0:
b += 1
else:
a += 1
t = a+b+c
#print(a,b,c)
ans = "No"
if a == 0:
ans = "Yes"
elif c >= a:
ans = "Yes"
elif b == 0 and a == c+1:
ans ="Yes"
print(ans) |
p03998 | s375125687 | Accepted | #ABC045
s = [input() for _ in range(3)]
a = ["a","b","c"]
turn = 0
c = True
while c:
if s[turn] == "":
print(a[turn].upper())
break
else:
x = s[turn][0]
s[turn] = s[turn][1:]
turn = a.index(x) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.