problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p02584 | s345131070 | Accepted | X, K, D = map(int,input().split())
ans = 0
ref = abs(X) // D
if ref >= K:
ans = abs(X) - K * D
else:
ans = abs(X) - ref * D
K = K - ref
if K % 2 == 1:
ans = abs(ans - D)
else:
pass
print(ans) |
p04019 | s026179499 | Accepted | from collections import*
s=input()
c=Counter(s)
if (c["S"]==0 and c["N"]>0) or (c["N"]==0 and c["S"]>0) or (c["E"]==0 and c["W"]>0) or (c["W"]==0 and c["E"]>0):
print("No")
else:
print("Yes")
|
p02786 | s797530578 | Accepted | H = int(input())
tmp = 1
counter = 0
while tmp <= H:
tmp = tmp*2
counter += 1
print(tmp - 1) |
p02706 | s484430988 | Wrong Answer | N,M = map(int, input().split())
A = list(map(int, input().split()))
task = 0
for i in range(M):
task += A[i]
answer = task
if answer > 0:
print(N - task)
else:
print(-1)
|
p02790 | s904758810 | Wrong Answer | a, b = map(int, input().split())
A = int(pow(a, b))
B = int(pow(b, a))
if A > B:
print(A)
else:
print(B) |
p02953 | s283541791 | Accepted | N = int(input())
H = list(map(int, input().split()))
h = H[0]
for i in range(N):
if H[i] >= h:
h=H[i]
elif H[i]-h == -1:
continue
else:
print('No')
exit()
print('Yes') |
p02628 | s716924563 | Accepted | n, k = input().split()
n = int(n)
k = int(k)
listnum = input().split()
newlist = []
sumnum = 0
listnum = [int(n) for n in listnum]
newlist = sorted(listnum)
for b in range(k):
sumnum = sumnum + newlist[b]
print(sumnum) |
p03013 | s971950363 | Wrong Answer | N, M=map(int, input().split())
mod=10**9+7
pre=-1
hole=[]
for i in range(M):
a=int(input())
hole.append(a-1-pre)
pre=a
hole.append(N-pre)
dp=[0]*(N+3)
dp[1]=1
dp[2]=1
for i in range(3,N+3):
dp[i]=(dp[i-1]+dp[i-2])%mod
if len(hole)==1:
print(dp[N+1])
#print(dp)
#print(hole)
ans=1
for h in hole:
ans*=dp[h]
ans%=mod
print(ans) |
p02777 | s610085301 | Wrong Answer | s,t = input().split()
a,b = map(int,input().split())
u = input()
if u == "red":
print(a-1,b)
else:
print(a,b-1)
|
p03679 | s421959420 | Accepted | def main():
x, a, b = (int(i) for i in input().split())
day = -a+b
if day <= 0:
print("delicious")
elif day <= x:
print("safe")
else:
print("dangerous")
if __name__ == '__main__':
main()
|
p02705 | s584168419 | Accepted | import numpy as np
r=int(input())
print(2*r*np.pi) |
p03126 | s164283840 | Accepted | #ABC-118-B
N, M = map(int, input().split())
memo = [0]*(M+1)
for _ in range(N):
Ki, *A = map(int, input().split())
for item in A:
memo[int(item)] += 1
ans = 0
for i in range(1, M+1):
if memo[i] == N:
ans += 1
print(ans) |
p02873 | s261107328 | Accepted | s = input()
n = len(s)
a = [0]*(n+1)
yama = []
tani = []
for i in range(n):
if s[i] == '<':
a[i+1] = a[i] + 1
for i in range(n)[::-1]:
if s[i] == '>':
a1 = a[i+1] + 1
if i != 0:
if s[i-1] == '<':
a[i] = max(a[i], a1)
else:
a[i] = a1
else:
a[i] = a1
ans = sum(a)
print(ans) |
p03281 | s282224607 | Accepted | N = int(input())
B = 0
for i in range(N):
A = 0
for j in range(i+1):
if (i+1) % (j+1) == 0:
A += 1
if A == 8 and (i+1) % 2 == 1:
B += 1
print(B) |
p03339 | s669182363 | Accepted | #!/usr/bin/env python3
n = int(input())
s = input()
e = [0]*n
w = [0]*n
for i in range(n):
if s[n-1-i] == "E":e[i] = e[i-1]+1
else: e[i] = e[i-1]
if s[i] == "W":w[i] = w[i-1]+1
else: w[i] = w[i-1]
#print(e,w,s)
ans = e[n-2]
for i in range(1,n):
#print(i,ans)
if i == n-1:
ans = min(ans,w[i-1])
else: ans = min(ans,w[i-1]+e[n-2-i])
print(ans)
|
p03239 | s195092380 | Wrong Answer | N, T = map(int,input().split())
ans = 10000
for _ in range(N):
c,t = map(int,input().split())
if t <= T:
ans = min(ans,c)
print("TLE" if ans==10000 else ans)
|
p03720 | s655876362 | Wrong Answer | n,m=map(int,input().split())
l={}
for i in range(m):
p,q=map(int,input().split())
if not p in l:
l[p]=1
else:
l[p]+=1
if not q in l:
l[q] = 1
else:
l[q] += 1
for k,v in sorted(l.items()):
print(v) |
p02615 | s813611249 | Accepted | n=int(input())
l=sorted(list(map(int,input().split())),reverse=1)
from heapq import heapify, heappop, heappush
h=[-l[0]]
ans=0
for i in range(1,n):
p=-heappop(h)
ans+=p
heappush(h,-l[i])
heappush(h,-l[i])
print(ans) |
p03262 | s634202030 | Accepted | from fractions import gcd
from functools import reduce
n,x=list(map(int,input().split()))
X=list(map(int,input().split()))
Y=[abs(X[i]-x) for i in range(n)]
print(reduce(gcd,Y)) |
p02775 | s358917777 | Wrong Answer | N = input()
N = reversed(N)
cnt = 0
up = False
for s in N:
n = int(s)
if up:
n += 1
up = False
if n <= 5:
cnt += n
elif n == 10:
up = True
else:
cnt += 10 - n
up = True
if up:
cnt += 1
print(cnt) |
p03001 | s108332102 | Accepted | w,h,x,y = map(int, input().split())
ans = 0
if w/2 == x and h/2 == y:
ans = 1
print(w*h/2, ' ', ans) |
p02996 | s318985866 | Wrong Answer | n = int(input())
ab = [[] for _ in range(n)]
az = [None] * n
bz = [None] * n
task = set()
flag = True
for i in range(n):
ab[i] = list(map(int, input().split()))
az[i], bz[i] = ab[i]
for a, b in ab:
if (a, b) in task:
flag = False
else:
task.add((a, b))
if a > b:
flag = False
if sum(az) > max(bz):
flag = False
else:
flag = True
print("Yes") if flag else print("No")
|
p02854 | s187671894 | Accepted | N=int(input())
A=list(map(int,input().split()))
B=sum(A)
b=0
ans=202020202020
for a in A:
b+=a
ans=min(ans,abs(B-b*2))
print(ans) |
p02642 | s646155651 | Accepted | # MAX = int(1e6)+2
n = int(input())
lis = list(map(int,input().split()))
lis.sort()
MAX = lis[-1]
lis2 = [0]*(MAX+1)
# lis.sort()
# m = max(lis)
ans = 0
for num in lis:
for i in range(num, MAX+1, num):
lis2[i] += 1
for j in set(lis):
if lis2[j] == 1:
ans += 1
print(ans) |
p02829 | s459617605 | Accepted | A = int(input())
B = int(input())
print(6-A-B)
|
p03543 | s683920615 | Accepted | s = input()
if s[0] == s[1] == s[2] or s[1] == s[2] == s[3]:
print("Yes")
else:
print("No") |
p03696 | s216778655 | Accepted | n = int(input())
s = str(input())
l = []
left, right = 0, 0
for c in s:
if c == ')':
if l == []:
left += 1
else:
l.pop()
else:
l.append(1)
right = len(l)
print('(' * left + s + ')' * right) |
p02963 | s492775690 | Wrong Answer | S=int(input())
#S=x1y2-x2y1
#S+x2y1=x1y2
#S+y1=10**9y2 (x1=10**9, x2=1)
#S+y1ใ10**9ใฎๅๆฐใซใชใใใใซy1ใๆฑบใใ
Y1=10**9-S%(10**9)
Y2=(S+Y1)//(10**9)
print(10**9,Y1,1,Y2,0,0) |
p02756 | s028088794 | Accepted | ans = input()
q = int(input())
r = 0
p = ""
for i in range(q):
d = input().split()
if len(d)==1:
r += 1
else:
f = int(d[1])
c = d[2]
if (f+r)%2 == 1:
p += c
else:
ans += c
ans = p[::-1] + ans
if r%2:
ans = ans[::-1]
print(ans) |
p02900 | s245159318 | Accepted | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
def gcd(a, b):
while b: a, b = b, a % b
return a
def lcm(a, b):
return a * b // gcd(a, b)
def prime_factorize(m):
pf={}
for i in range(2, int(m**0.5)+1):
while m % i == 0:
pf[i] = pf.get(i, 0) + 1
m //= i
if m > 1: pf[m] = 1
return pf
a,b = map(int, input().split())
g = gcd(a,b)
pf = prime_factorize(g)
print(len(pf.keys()) + 1)
|
p03719 | s405471044 | Accepted | import sys
input = sys.stdin.readline
A, B, C = [int(x) for x in input().split()]
if A <= C <= B:
print("Yes")
else:
print("No") |
p02882 | s847983256 | Accepted | a,b,x = map(int, input().split())
import math
if 2*x <= a**2 *b:
print(math.degrees(math.atan((a*b**2)/(2*x))))
else:
print(math.degrees(math.atan((2*a**2*b -2*x)/(a**3))))
|
p02987 | s467128526 | Accepted | let = set(input())
print({True: 'Yes', False: 'No'}[len(let) == 2])
|
p03041 | s325241697 | Wrong Answer | s=input()
f=int(s[:2])
b=int(s[2:4])
if (b>=13 or b==00)and f>=13 :
print('NA')
elif (b>=13 or b==00)and f<=12 :
print('MMYY')
elif b<=12 and (f>=13 or f==00) :
print('YYMM')
else:
print('AMBIGUOUS') |
p03408 | s161579312 | Wrong Answer | from collections import defaultdict
blue=int(input())
blueList = []
for i in range(blue):
blueList.append(input())
red=int(input())
redList = []
for i in range(red):
redList.append(input())
dict = defaultdict(int)
for b in blueList:
dict[b] += 1
for r in redList:
dict[r] -= 1
max = -10000
for s in dict:
if dict[s] > max:
max = dict[s]
print(max) |
p03767 | s466676711 | Wrong Answer | N = int(input())
INT_LIST_SORETED = sorted([int(s) for s in input().split()])
SECOND_INT_LIST_MAX = [val for idx, val in enumerate(INT_LIST_SORETED)
if idx >= N and idx % 2 == 0]
print(sum(SECOND_INT_LIST_MAX))
|
p03696 | s611252891 | Wrong Answer | n = int(input())
s = input()
ans = s
if s.count(")") == 0:
ans += ")"*(s.count("("))
print (ans)
exit()
if s.count("(") == 0:
ans = "("*(s.count(")")) + ans
print (ans)
exit()
lef2 = s.rindex(")")
rit2 = s.index("(")
ans = s
ans += ")"*(n-(lef2+1))
ans = "("*rit2 + ans
lef = ans.count("(")
rit = ans.count(")")
if lef > rit:
ans += ")"*(lef-rit)
print (ans)
elif lef == rit:
print (ans)
else:
ans = "("*(rit-lef) + ans
print (ans) |
p02693 | s378993927 | Accepted | K = int(input())
A,B = map(int, input().split())
for num in range(A, B+1, 1):
if num % K == 0:
print('OK')
break
else:
print('NG') |
p02717 | s760193924 | Wrong Answer | x,y,z = map(int,input().split())
tmp = x
x = y
y = tmp
print(x,y,z)
tmp = x
x = z
z = tmp
print(x,y,z) |
p02792 | s382805747 | Wrong Answer | N = int(input())
lst = [[0 for i in range(10)]for j in range(10)]
ans = 0
for i in range(N):
tmp = list(str(i))
lst[int(tmp[0])][int(tmp[-1])]+=1
for i in range(10):
for j in range(10):
if i == 0 or j == 0:
continue
if i == j:
ans+=lst[i][j]**2
else:
ans+=lst[i][j]*lst[j][i]
print(ans) |
p02645 | s065758637 | Accepted | def main():
input_name = input()
print(input_name[0:3])
if __name__=='__main__':
main()
|
p04012 | s455022242 | Accepted | w = str(input())
count = 0
for i in w:
if w.count(i) % 2 == 0:
pass
else:
count = 1
break
print("Yes" if count == 0 else "No") |
p03962 | s653926219 | Accepted | a, b, c = map(int, input().split())
if a == b == c:
print(1)
elif a == b or b == c or c == a:
print(2)
else:
print(3)
|
p03324 | s349244895 | Accepted | d, n = map(int, input().split())
if n == 100:
n += 1
print((100**d)*n) |
p03672 | s606435893 | Accepted | s = list(input())
ss = s[::]
for i in range(len(s)):
if len(ss) == 1:
break
ss.pop()
if len(ss) % 2 == 0:
n = len(ss) // 2
if ss[:n] == ss[n:]:
break
if len(ss) == 1:
print(-1)
else:
print(len(ss))
|
p03524 | s934683453 | Accepted | from collections import defaultdict
def solve():
S = input()
counter = defaultdict(int)
for ch in S:
counter[ch] += 1
vals = sorted([counter["a"],counter["b"],counter["c"]])
if vals[1] - vals[0] <= 1 and vals[2] - vals[0] <= 1:
print('YES')
else:
print('NO')
if __name__ == '__main__':
solve()
|
p02675 | s807977560 | Wrong Answer | N = int(input())
count = 0
while N > 0:
digit = N % 10
N //= 10
count += 1
if count == 2:
print('pon')
elif count == 1:
print('hon')
elif count == 3:
print('bon') |
p03471 | s970483834 | Accepted |
N, Y = map(int, input().split())
total = 0
for a in range(N+1):
for b in range(N+1-a):
c = N -a -b
total = a*10000 + b*5000 + c*1000
if (total == Y) and (a+b+c==N) and (c>=0):
print(a, b, c)
exit()
print(-1,-1,-1) |
p03623 | s224653900 | Accepted | x, a, b = map(int, input().split())
print('A' if abs(x-a) < abs(x-b) else 'B')
|
p03243 | s482423970 | Accepted | n=int(input())
for i in range(1,10):
if n<=i*111:
print(i*111)
break
else:
pass |
p03699 | s489314739 | Wrong Answer | n=int(input())
s=sorted([int(input()) for _ in range(n)],reverse=True)
for i in range(n,0,-1):
ss=sum(s[:i])
if ss%10>0:
print(ss)
break
else:
print(0) |
p02572 | s905735111 | Accepted | n = int(input())
al = list(map(int, input().split()))
ans = sum(al)**2
for a in al:
ans -= a**2
mod = 10**9+7
print((ans//2)%mod) |
p02577 | s293096333 | Accepted | N = input()
s = 0
for n in N:
s += int(n)
if s % 9 == 0:
print('Yes')
else:
print('No') |
p02718 | s342167267 | Accepted | def main():
n, m = map(int, input().split())
num_list = list(map(int, input().split()))
vote_num = sum(num_list)
count = 0
for i in range(n):
if vote_num * 1/(4*m) <= num_list[i]:
count += 1
print('Yes' if count >= m else 'No')
if __name__ == '__main__':
main() |
p03487 | s512183846 | Accepted | from collections import Counter
N = int(input())
a = list(map(int, input().split()))
ans = 0
for k, v in Counter(a).items():
if k < v:
ans += v - k
elif k > v:
ans += v
print(ans)
|
p02766 | s772136928 | Accepted | [N,K] = list(map(int,input().split()))
if N<K:
print(1)
else:
i=N
j=0
while i>=K:
i = i/K
j=j+1
print(j+1) |
p03592 | s909818926 | Accepted | n, m, k = map(int, input().split())
for x in range(n+1):
for y in range(m+1):
num_of_blacks = x*m + y*n - 2*x*y
if num_of_blacks == k:
print('Yes')
exit()
print('No') |
p03161 | s016741816 | Accepted | def main():
import sys
input = sys.stdin.readline
n,m = map(int,input().split())
l = list(map(int,input().split()))
dp = [0]+ [100000000000]*(n-1)
for i in range(1,n):
for j in range(1,m+1):
if i-j >= 0:
dp[i] = min(dp[i],dp[i-j]+abs(l[i]-l[i-j]))
print(dp[n-1])
if __name__ == "__main__":
main() |
p03632 | s972446950 | Accepted | a,b,c,d=map(int,input().split())
if a<=c and b<=d:
if b-c>0:
print(b-c)
else:
print(0)
elif a>=c and b>=d:
if d-a>0:
print(d-a)
else:
print(0)
elif a<=c and b>=d:
print(d-c)
elif a>=c and b<=d:
print (b-a)
|
p02708 | s423952514 | Accepted | n,k=map(int,input().split())
ans=0
for i in range(k,n+2):
a=0.5*i*(i-1)
b=0.5*n*(n+1)-0.5*(n-i)*(n-i+1)
ans+=int(b-a+1)
print(ans%(10**9+7)) |
p02572 | s805498709 | Wrong Answer | n = int(input())
a_s = list(map(int, input().split()))
ans = 0
for i in range(n):
for j in range(i+1, n):
ans += int(a_s[i] * a_s[j] % (1e9 + 7))
print(ans)
|
p03137 | s882339821 | Wrong Answer | N,M = map(int,input().split())
lc = list(map(int,input().split()))
lc.sort()
#print(lc)
diff = []
for i in range(M-1):
diff.append(lc[i+1]-lc[i])
#print(diff)
diff.sort()
diff_min = diff[:M-N]
print(sum(diff_min)) |
p03427 | s659992256 | Accepted | n = input()
digit = len(n) - 1
if n.count('9') == len(n):
print(9*len(n))
else:
if digit > 0:
if n[1:].count('9') == len(n[1:]):
print(9*digit + int(n[0]))
else:
print(9*digit + int(n[0])-1)
else:
print(n[0]) |
p03721 | s837082011 | Accepted | def main():
MAX = 100010
n,k = map(int,input().split())
m = {}
for x in range(100010):
m[x] = 0
for x in range(n):
a,b = map(int,input().split())
m[a] += b
if k == 0:
print(m.keys()[0])
return
for key,value in m.items():
k-=value
if k <= 0:
print(key)
return
if __name__ == '__main__':
main()
|
p03774 | s840767738 | Accepted | N, M = map(int, input().split())
a = [0] * N
b = [0] * N
for i in range(N):
a[i],b[i] = map(int,input().split())
c = [0] * M
d = [0] * M
for i in range(M):
c[i],d[i] = map(int,input().split())
for i in range(N):
MIN = 10**9
for j in range(M):
if abs(a[i]-c[j])+abs(b[i]-d[j]) < MIN:
MIN = abs(a[i]-c[j])+abs(b[i]-d[j])
cnt = j+1
print(cnt)
|
p03251 | s820029346 | Accepted | n, m, x, y = map(int, input().split())
X = list(map(int, input().split()))
Y = list(map(int, input().split()))
for i in range(x + 1, y + 1):
if max(X) < i and min(Y) >= i:
print("No War")
exit()
print("War") |
p02790 | s352401083 | Accepted | a,b= input().split()
print(str(min(int(a),int(b)))*int(str(max(int(a),int(b)))))
|
p03557 | s036959410 | Wrong Answer | import numpy as np
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(readline())
a = np.array(readline().split(), dtype=np.int32)
b = np.array(readline().split(), dtype=np.int32)
c = np.array(readline().split(), dtype=np.int32)
a.sort()
b.sort()
c.sort()
cnt_a = np.searchsorted(a, b, side='left')
cnt_c = np.searchsorted(c, -b, side='left')
answer = (cnt_a * cnt_c).sum()
print(answer)
|
p02773 | s306541444 | Wrong Answer | n = int(input())
a = [input() for _ in range(n)]
a_dict = {i:0 for i in set(a)}
for i in a:
for j in a_dict:
if i == j:
a_dict[j] += 1
ans = []
for key, value in a_dict.items():
if value == max(a_dict.values()):
ans.append(key)
ans.sort()
print(ans) |
p02780 | s170237141 | Accepted | N,K = map(int,input().split())
P = list(map(int,input().split()))
Q = [(P[i]+1)/2 for i in range(N)]
max,tmp = sum(Q[0:K]),sum(Q[0:K])
for i in range(N-K):
tmp = tmp + Q[K+i] - Q[i]
if max < tmp:
max = tmp
print(max)
|
p02882 | s227883195 | Accepted | a,b,x = map(int, input().split())
import math
if x==a*a*b:
print(0)
exit()
if x > (a*a*b)/2:
theta = math.atan(((a*a*a)/(a*a*b-x))/2)
else:
theta = math.atan((2*x) / (a*b*b))
print(90-math.degrees(theta)) |
p03944 | s681532837 | Accepted | W,H,N=map(int,input().split())
a1,a2,a3,a4=0,W,0,H
for i in range(N):
x,y,a=map(int,input().split())
if a==1:a1=max(a1,x)
elif a==2:a2=min(a2,x)
elif a==3:a3=max(a3,y)
else:a4=min(a4,y)
if a1>=a2 or a3>=a4:
print(0)
exit()
if a1>=W or a2<=0 or a3>=H or a4<=0:
print(0)
exit()
print((a2-a1)*(a4-a3)) |
p04019 | s446247401 | Accepted | # A - Wanna go back home
ss=input()
n=ss.count('N')
w=ss.count('W')
s=ss.count('S')
e=ss.count('E')
ns=False
if n>0 and s>0:
ns=True
elif n==0 and s>0:
ns=False
elif n>0 and s==0:
ns=False
elif n==0 and s==0:
ns=True
we=False
if w>0 and e>0:
we=True
elif w==0 and e>0:
we=False
elif w>0 and e==0:
we=False
elif w==0 and e==0:
we=True
if ns==True and we==True:
print('Yes')
else:
print('No') |
p03011 | s045980420 | Accepted | a = map(int, input().split())
a = list(a)
a.sort()
print (a[0] + a[1]) |
p02742 | s040550658 | Accepted | H,W = map(int,input().split())
if (H == 1) or (W ==1):
print(1)
elif (H*W) % 2 == 0:
print(int(H*W/2))
else:
print(int(H*(W-1)/2+(H/2+1)))
|
p02836 | s099995882 | Accepted | s=input()
t=s[::-1]
cnt=0
for i in range(len(t)//2):
if s[i]!=t[i]: cnt+=1
print(cnt) |
p02547 | s887409642 | Wrong Answer | n = int(input())
count = 0
max_count = 0
for i in range(n):
input_elements = input().split()
if input_elements[0] == input_elements[1]:
count += 1
else:
max_count = count
count = 0
if max_count < count:
max_count = count
if max_count >= 3:
print("Yes")
else:
print("No")
|
p03986 | s074268784 | Accepted | x = input()
s_q = []
arc = []
for i, v in enumerate(x):
if v == 'S':
s_q.append(v)
else:
if len(s_q) > 0:
s_q.pop()
else:
arc.append(v)
print(len(s_q)+len(arc))
|
p03437 | s347668136 | Accepted | import math
a, b = map(int, input().split())
if(a % b == 0):
print(-1)
else:
i = math.gcd(a, b)
c = a // i
d = b // i
print(c * d * i + a) |
p02922 | s862348961 | Accepted | def main() -> None:
A, B = map(int, input().split())
now, cnt = 1, 0
while True:
if now >= B:
break
now += A - 1
cnt += 1
print(cnt)
if __name__ == '__main__':
main()
|
p03075 | s473421106 | Wrong Answer | a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
d1 = b - a
d2 = c - b
d3 = d - c
d4 = e - d
if d1 <= k and d2 <= k and d3 <= k and d4 <= k:
print('Yay!')
else:
print(':(') |
p03013 | s986563774 | Accepted | n, m, *a = map(int, open(0).read().split())
div = 1000000007
broken = set(a)
f = [0] * (n + 1)
f[0] = 1
if 1 not in broken:
f[1] = 1
for i in range(2, n + 1):
if i in broken:
continue
f[i] = (f[i - 1] + f[i - 2]) % div
print(f[-1])
|
p03327 | s718094421 | Accepted | n = int(input())
if 1 <= n <= 999:
print('ABC')
else:
print('ABD') |
p03485 | s867004790 | Wrong Answer | a, b = map(int, input().split())
if (a + b) % 2 == 0:
print((a+b)/2)
else:
print((a+b+1)/2) |
p03109 | s149359565 | Accepted | s = input()
m = int(s[5:7])
d = int(s[8:10])
tt = m * 100 + d
print('Heisei' if tt <= 430 else 'TBD') |
p03282 | s268047122 | Wrong Answer | s = list(str(input()))
s = list(map(int, s))
k = int(input())
flag = True
for i in range(len(s)):
if s[i] != 1:
flag = False
else:
pass
if flag:
print(1)
else:
for i in range(len(s)):
if s[i] != 1:
print(s[i])
break
|
p02761 | s785380294 | Wrong Answer | n,m = map(int,input().split())
d = dict()
for i in range(m):
k,v = map(int,input().split())
if k in d:
if d[k] !=v:
print(-1)
exit()
else:
d[k] = v
res = ""
for i in (1,n+1):
if i not in d:
d[i] = 0
res += str(d[i])
res = int(res)
if res == 0:
print(-1)
exit()
print(res) |
p04020 | s038215008 | Wrong Answer | n = int(input())
a = [int(input()) for _ in range(n)]
ans, tmp = 0, 0
for ai in a:
ans += (ai + tmp) // 2
tmp = 0
if ai != 0:
tmp = (ai + tmp) % 2
print(ans)
|
p02600 | s470384309 | Accepted | def main():
X=int(input())
X=X//100
print(10 - X//2)
main()
|
p03962 | s511280603 | Wrong Answer | a,b,c=(map(int,input().split()))
if a!=b!=c:
print(3)
elif a==b==c:
print(1)
else:
print(2) |
p02899 | s637184317 | Wrong Answer | N = int(input())
A = [int(i) for i in input().split()]
li = ["" for i in range(N)]
for i in range(N):
li[A[i]-1] = str(i)
print(" ".join(li)) |
p04044 | s333607914 | Accepted | N, L = list(map(int, input().strip().split()))
strl = [input().strip() for s in range(N)]
strl = sorted(strl)
s = ''
for t in strl:
s += str(t)
print(s) |
p02714 | s039714558 | Accepted | n=int(input())
s=input()
r,g,b=s.count('R'),s.count('G'),s.count('B')
cnt=0
for i in range(n):
d=0
while 1:
d+=1
j=i+d
k=j+d
if not k<n:
break
if not (s[i]==s[j] or s[j]==s[k] or s[k]==s[i]):
cnt+=1
print(r*g*b-cnt) |
p02657 | s421408048 | Wrong Answer | #169A https://atcoder.jp/contests/abc169/tasks/abc169_a
# 1. ๅ
ฅๅใๅใๅใใใจ
# ในใใผในๅบๅใใฎๅ
ฅๅใๆดๆฐใจใใฆๅใๅใใใ2 5ใใโใใa=2, b=5ใใจใชใ
a, b = map(int, input().split())
print(a)
print(b)
# 2. ๅใๅใฃใ็ตๆใไฝฟใฃใฆ็ฎ็ใฎ่จ็ฎใใใใใจ
answer = a * b
# 3. ๅบๅใใใใจ
print(answer)
|
p02879 | s770898426 | Accepted | a,b=map(int,input().split())
if a<10 and b<10:
print(a*b)
else:
print(-1) |
p03971 | s666366870 | Accepted | # B - Qualification simulator
N,A,B = map(int,input().split())
S = input()
domestic,foreign = 0,0
for i in range(N):
s = S[i]
if s=='a':
if domestic+foreign<A+B:
print('Yes')
domestic += 1
else:
print('No')
elif s=='b':
if domestic+foreign<A+B and foreign<B:
print('Yes')
foreign += 1
else:
print('No')
else:
print('No') |
p02683 | s869922493 | Wrong Answer | n, m, x = map(int, input().split())
b = []
for _ in range(n):
c, *a = list(map(int, input().split()))
b.append((c, a))
mc = 100001
k = [0 for _ in range(n)]
def search(i, cost, k):
if i == n:
return cost if min(k) >= x else mc
else:
return min(search(i + 1, cost + b[i][0], [k[idx] + b[i][1][idx] for idx in range(m)]), search(i + 1, cost, [e for e in k]))
ans = search(0, 0, [0 for _ in range(m)])
if ans == mc:
ans = -1
print(ans)
|
p03854 | s271078865 | Accepted | s = input()
while 1:
for x in ('dream', 'dreamer', 'erase', 'eraser'):
if s.endswith(x):
s = s[:-len(x)]
break
else:
print('NO')
break
if not s:
print('YES')
break |
p03745 | s078419596 | Accepted | N = int(input())
A = list(map(int, input().split()))
ans = 0
plus = ""
for i in range(N):
if plus != "":
if plus:
if A[i-1] > A[i]:
ans += 1
plus = ""
else:
if A[i-1] < A[i]:
ans += 1
plus = ""
if i < N-1 and plus == "":
if A[i] < A[i+1]:
plus = True
elif A[i] > A[i+1]:
plus = False
print(ans+1) |
p02880 | s979796444 | Wrong Answer | n = int(input())
for x in range(1, 9 + 1):
a = n / x
if a < 10:
print('Yes')
else:
print('No') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.