problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p03251 | s854516540 | Accepted | n,m,x,y = map(int,input().split())
X = list(map(int,input().split()))
Y = list(map(int,input().split()))
X.append(x)
Y.append(y)
if max(X)<min(Y):
print("No War")
else:
print("War") |
p03785 | s054041007 | Accepted | N, C, K = map(int, input().split())
T = []
for _ in range(N):
T.append(int(input()))
T = sorted(T)
# print(N, C, K)
# print(*T, end="\n")
# 現在の時刻
# 前から詰めていく (容量制約を忘れない)
count = 0
i = 0
while i < N:
timax = T[i] + K
# 乗せた人数
c = 0
count += 1
while i < N and c < C and T[i] <= timax:
c += 1
i += 1
print(count) |
p02702 | s169453101 | Accepted | s = input()
n = len(s)
p = 0
ten = 1
cnt = [0] * 2019
cnt[0] = 1
ans = 0
for i in reversed(s):
p = (p + int(i) * ten) % 2019
ans += cnt[p]
cnt[p] += 1
ten = ten * 10 % 2019
print(ans)
|
p02584 | s270800273 | Accepted | import sys
def input():
return sys.stdin.readline().rstrip()
def main():
X,K,D =map(int,input().split())
ans =10**19
if X >= K*D:
print(X-K*D)
elif -X>= K*D:
print(-X - K*D)
else:
X =abs(X)
c =X//D
if (K-c)%2 ==0:
print(X-c*D)
else:
print(D*(c+1)-X)
if __name__ == "__main__":
main()
|
p03250 | s967897300 | Accepted | a,b,c = sorted(map(int,input().split()))
print(10*c+b+a) |
p02622 | s912035882 | Accepted | from collections import deque
S = list(input())
T = list(input())
dqS = deque(S)
dqT = deque(T)
cnt = 0
while dqS:
tempS = dqS.popleft()
tempT = dqT.popleft()
if tempS != tempT:
cnt += 1
print(cnt) |
p02916 | s411893900 | Accepted | N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
M=0
i=0
while i < N:
M += B[A[i]-1]
if i>=1:
if A[i]-A[i-1]==1:
M += C[A[i-1]-1]
i += 1
print(M) |
p03821 | s940284896 | Wrong Answer | #!/usr/bin/env python
n = int(input())
a = [0 for _ in range(n)]
b = [0 for _ in range(n)]
for i in range(n):
a[i], b[i] = map(int, input().split())
ans = 0
for i in reversed(range(n)):
if i!=0:
a[i] += ans
if a[i]%b[i] == 0:
continue
else:
ans += (a[i]//b[i]+1)*b[i]-a[i]
print(ans)
|
p02708 | s295123328 | Accepted | n,k=map(int,input().split())
r=[0]
l=[0]
ans=0
INF=10**9+7
for i in range(n+1):
a=r[i]+i
b=l[i]+n-i
r.append(a)
l.append(b)
#print(r)
#print(l)
for i in range(k,n+2):
min_wa=r[i]
max_wa=l[i]
ans+=max_wa-min_wa+1
print(ans%INF)
|
p03042 | s068370482 | Accepted | S=input()
if 1<=int(S[:2])<=12:
if 1<=int(S[2:])<=12:
print("AMBIGUOUS")
elif 0<=int(S[2:])<=99:
print("MMYY")
elif 0<=int(S[:2])<=99:
if 1<=int(S[2:])<=12:
print("YYMM")
elif 0<=int(S[2:])<=99:
print("NA")
|
p02627 | s186075186 | Wrong Answer | val = 'b'
if val in 'abcdefghijklmnopqrstuvwxyz':
ans = 'a'
else:
ans = 'A'
print(ans) |
p03251 | s242249726 | Accepted | N, M, X, Y = list(map(int, input().split(" ")))
x_coord = list(map(int, input().split(" ")))
y_coord = list(map(int, input().split(" ")))
is_war = True
for Z in range(X, Y+1):
if X < Z <= Y and max(x_coord) < Z and min(y_coord) >= Z:
is_war = False
break
if is_war:
print("War")
else:
print("No War") |
p02603 | s575732233 | Wrong Answer | n = int(input())
ls = list(map(int, input().split()))
curr = 1000
stock = 0
for i in range(n - 1):
if ls[i] < ls[i + 1]:
stock = curr // ls[i]
curr -= stock * ls[i]
elif ls[i] > ls[i + 1]:
curr += stock * ls[i]
stock = 0
curr += stock * ls[i + 1]
stock = 0
print(curr)
|
p02996 | s241964316 | Accepted | N = int(input())
BA = []
for i in range(N):
A,B = map(int,input().split())
BA.append([B,A])
BA.sort()
check = True
sum_A = 0
for j in range(N):
sum_A += BA[j][1]
if sum_A > BA[j][0]:
check = False
break
print("Yes" if check else "No") |
p03730 | s574081836 | Wrong Answer | A,B,C = map(int, input().split())
for i in range(1,B+1):
if A*i % B == C:
print('Yes')
break
else:
print('No') |
p02597 | s199134019 | Accepted | n = int(input())
C = list(input())
a, b = 0, 0
for i in range(n):
if C[i] == "R":
a += 1
ans = max(a, b)
for i in range(n):
if C[i] == "R":
a -= 1
else:
b += 1
tmp = max(a, b)
ans = min(ans, tmp)
print(ans) |
p02987 | s350120330 | Accepted | S = list(input())
set_S = list(set(S))
if(len(set_S)==2):
if((S.count(set_S[0])==2) and (S.count(set_S[1])==2)):
print('Yes')
else:
print('No')
else:
print('No') |
p03486 | s678837981 | Accepted | s = input()
t = input()
S = sorted(s)
T = sorted(t,reverse=True)
#print(S,T)
ans = "W"
for i in range(min(len(s),len(t))):
if S[i] > T[i]:
ans = "No"
break
elif ans == "W" and S[i] == T[i]:
ans = "W"
elif ans == "W" and S[i] < T[i]:
ans = "Yes"
break
if ans == "W":
if len(s) < len(t):
ans = "Yes"
else:
ans = "No"
print(ans) |
p03797 | s626463896 | Accepted | N,M = list(map(int,input().strip().split()))
if 2*N > M:
res = M // 2
else:
res = (M - 2*N)//4 + N
print(res) |
p02959 | s901195012 | Accepted | n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
cnt=0
for i in range(n):
if a[i]>=b[i]:
cnt+=b[i]
a[i]-=b[i]
b[i]=0
elif a[i]<b[i]:
cnt+=a[i]
b[i]-=a[i]
a[i]=0
temp=b[i]
cnt+=min(b[i], a[i+1])
b[i]=max(b[i]-a[i+1], 0)
a[i+1]=max(a[i+1]-temp, 0)
print(cnt) |
p03637 | s506826890 | Accepted | from collections import defaultdict
d = defaultdict(int)
d=[0]*3
n = int(input())
for i in list(map(int, input().split())):
if i % 4 == 0:
d[2] += 1
elif i % 2 == 0:
d[1] += 1
else:
d[0] += 1
t = d[2] - d[1]
if (d[0] <= d[2]) or ((d[0] == d[2] + 1) and (d[1] == 0)):
print("Yes")
else:
print("No")
|
p03433 | s895880619 | Accepted | amount = int(input())
n_1yen = int(input())
fraction = amount % 500
if fraction <= n_1yen:
print('Yes')
else:
print('No')
|
p03548 | s458933224 | Wrong Answer | x, y, z = map(int, input().split())
ans = 0
for i in range(z, 10**5):
if (x-i) % (y+i) == 0:
ans = (x-i) / (y+i)
break
print(int(ans)) |
p03274 | s088372776 | Accepted | N,K = map(int,input().split())
X = list(map(int,input().split()))
ls = []
rs = []
for x in X:
if x < 0:
ls.append(-x)
else:
rs.append(x)
ls.reverse()
ans = float('inf')
if len(ls) >= K:
ans = min(ans, ls[K-1])
if len(rs) >= K:
ans = min(ans, rs[K-1])
for l in range(1,K):
if l > len(ls): break
r = K-l
if r > len(rs): continue
ans = min(ans, ls[l-1]*2 + rs[r-1])
ans = min(ans, rs[r-1]*2 + ls[l-1])
print(ans) |
p03861 | s928126040 | Accepted | a,b,x = map(int,input().split())
print(b//x-(a-1)//x) |
p03637 | s992544008 | Wrong Answer | N=int(input())
A=list(map(int,input().split()))
cntf=0
cntno=0
for i in A:
if i%4==0:
cntf+=1
if i%2==1:
cntno+=1
if cntno>2:
print('No')
elif cntno==0:
print('Yes')
elif cntno==1:
if cntf>0:
print('Yes')
else:
print('No')
else:
if N==3 and cntf>0:
print('Yes')
elif N>3 and cntf>1:
print('Yes')
else:
print('No')
|
p03494 | s814028934 | Accepted | n = int(input())
a = list(map(int,input().split()))
cnt = 0
e = 0
while e == 0:
for i in range(n):
if a[i] % 2 == 0:
a[i] = a[i]/2
if i == n-1:
cnt += 1
else:
e = 1
break
print(cnt) |
p02948 | s938627405 | Accepted | import sys
from heapq import heapify, heappop, heappush
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, M = lr()
jobs = [[] for _ in range(M+1)]
for _ in range(N):
a, b = lr()
if a > M:
continue
jobs[a].append(b)
answer = 0
candidate = []
for i in range(1, M+1):
for job in jobs[i]:
heappush(candidate, -job)
if candidate:
answer += heappop(candidate)
answer *= -1
print(answer)
# 31 |
p03319 | s553074353 | Wrong Answer | from math import ceil
N, K = map(int, input().split())
A = list(map(int, input().split()))
if K >= N:
print(1)
exit()
one = A.index(1)
print(ceil((one)/(K-1)) + ceil((N-one-1)/(K-1)))
|
p02689 | s555929507 | Accepted | from collections import defaultdict
n, m = map(int, input().split())
h_s = list(map(int, input().split()))
roads = defaultdict(list)
for i in range(m):
a, b = map(int, input().split())
roads[a].append(b)
roads[b].append(a)
ans = n
for i in range(n):
for couho in roads[i + 1]:
if h_s[i] <= h_s[couho - 1]:
ans -= 1
break
print(ans)
|
p02813 | s960623252 | Accepted | import sys
import itertools
import math
input = sys.stdin.readline
N=int(input())
P=list(map(int,input().split()))
Q=list(map(int,input().split()))
jisyo=[]
for i in range(1,N+1):
jisyo.append(i)
ans =[]
for v in itertools.permutations(jisyo, N):
ans.append(list(v))
print(abs(ans.index(P)-ans.index(Q))) |
p02548 | s091634095 | Wrong Answer | n = int(input())
count = 0
for i in range(1, n//2):
temp = n // i
if temp * i < n:
count += temp
else:
count += temp - 1
print(count + n//2)
|
p02953 | s250978138 | Accepted | n = int(input())
h = list(map(int,input().split()))
bh = h[0]
for i in range(1,n):
if bh>h[i]:
print("No")
exit()
elif h[i]>bh:
bh = h[i]-1
else:
bh = h[i]
print("Yes") |
p03639 | s223705463 | Accepted | n = int(input())
a = list(map(int, input().split()))
cnt_1 = 0
for i in a:
if i % 2 != 0:
cnt_1 += 1
cnt_2 = 0
for i in a:
if i % 2 == 0 and i % 4 != 0:
cnt_2 += 1
cnt_4 = 0
for i in a:
if i % 4 == 0:
cnt_4 += 1
if cnt_4*2 + 1 >= n:
print("Yes")
else:
if cnt_4*2 + cnt_2 >= n:
print("Yes")
else:
print("No")
|
p03986 | s326108773 | Accepted | import sys
def main():
input = sys.stdin.readline
X = input().rstrip()
ans = len(X)
s_cnt = 0
for x in X:
if x == 'S': s_cnt += 1
elif s_cnt > 0:
s_cnt -= 1
ans -= 2
print(ans)
if __name__ == '__main__':
main() |
p03327 | s748346554 | Accepted | n=int(input())
print('ABC' if n<1000 else 'ABD')
|
p02939 | s721137422 | Accepted | import sys
input = sys.stdin.readline
s = input().rstrip()
l = [0]*len(s)
k=0
for i in range(1,len(s)-1):
if s[i] == s[i-1] and l[i-1] == 0:
l[i]=1
l[i+1]=1
if len(s) >1 and s[-1] == s[-2] and l[-2] == 0:
l[-2] = 1
l[-1]=1
print(len(s)-sum(l)//2)
|
p03041 | s377612359 | Accepted | n, k = map(int, input().split())
s = list(input())
if s[k - 1] == "A":
s[k - 1] = "a"
elif s[k - 1] == "B":
s[k - 1] = "b"
else:
s[k - 1] = "c"
print("".join(s))
|
p03633 | s207158707 | Accepted | # coding: utf-8
# Your code here!
import fractions
from functools import reduce
N=int(input())
L=[]
for i in range(N):
L.append(int(input()))
def lcm_base(x, y):
return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
return reduce(lcm_base, numbers, 1)
print(lcm_list(L)) |
p02772 | s887628365 | Accepted | import sys
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
if a[i]%2==0:
if a[i]%3!=0 and a[i]%5!=0:
print("DENIED")
sys.exit()
print("APPROVED") |
p02838 | s285360236 | Wrong Answer | def cin():
in_ = list(map(int,input().split()))
if len(in_) == 1: return in_[0]
else: return in_
N = cin()
A = cin()
INF = 1e9 + 7
res = [0 for _ in range(65)]
for i in range(65):
c0 = 0
c1 = 0
for j in range(N):
if bool(A[j] & (1 << i)): c1 += 1
else: c0 += 1
res[i] = c0 * c1
ans = 0
for i in range(65): ans = (ans + (2 ** i) * res[i]) % INF
print(int(ans)) |
p03071 | s614249248 | Wrong Answer | a,b = map(int,input().split())
if a > b:print(2*b-1)
elif b < a: print(2*a-1)
else:print(a+b)
|
p02689 | s545395127 | Accepted | N, M = map(int, input().split())
H = list(map(int, input().split()))
AB = dict()
for _ in range(M):
a, b = map(int, input().split())
if a not in AB:
AB[a] = [H[b-1]]
else:
AB[a].append(H[b-1])
if b not in AB:
AB[b] = [H[a-1]]
else:
AB[b].append(H[a-1])
cnt = 0
for n in range(1, N+1):
if (n not in AB.keys()) or (max(AB[n]) < H[n-1]):
cnt += 1
print(cnt)
|
p03719 | s350921596 | Wrong Answer | a, b, c = input().split()
print("Yes" if a <= c <= b else "No") |
p03639 | s030263462 | Wrong Answer | n=int(input())
a=list(map(int,input().split()))
b=0
c=0
for i in range(n):
if a[i]%2==0:
if a[i]%4==0:
c+=1
else:
b+=1
if b==0:
print("Yes") if n<=3*c else print("No")
else:
print("Yes") if n<=3*c+b-1 else print("No") |
p03293 | s394108673 | Wrong Answer | s=input()
t=input()
total=False
for i in range(len(s)):
s=s[len(s)-1]+s[0:len(s)-1]
print(s)
if s==t:
print("Yes")
total=True
break
if total==False:
print("No") |
p03221 | s117199374 | Wrong Answer | n,m=map(int,input().split())
py=[list(map(int,(str(_+1)+' '+input()).split())) for _ in range(m)]
py.sort(key=lambda x:str(x[1])+','+str(x[2]))
print(py)
a=[]
pi=0
x=0
b='00000'
ans=[]
for pyi in py:
if pyi[1]!=pi:
x=1
pi=pyi[1]
else:
x+=1
ans.append([pyi[0],(b+str(pyi[1]))[-6:]+(b+str(x))[-6:]])
ans.sort(key=lambda x:x[0])
for ansi in ans:
print(ansi[1])
|
p02946 | s241078331 | Wrong Answer | K,X = map(int,input().split())
for i in range(X-K,X+K):
print(i,end='')
|
p02909 | s015547593 | Accepted | s = input()
if s == 'Sunny':
print('Cloudy')
elif s == 'Cloudy':
print('Rainy')
else:
print('Sunny') |
p02946 | s271113613 | Wrong Answer | #入力:N,M(int:整数)
def input2():
return map(int,input().split())
k,x=input2()
st=x-k+1
fi=x+k-1
for i in range(st,fi+1):
print(i,end="") |
p03611 | s496234865 | Accepted | from collections import defaultdict
N = int(input())
actions = [int(i) for i in input().split()]
d = defaultdict(int)
for a in actions:
d[a-1] += 1
d[a] += 1
d[a+1] += 1
print(sorted(d.items(), key=lambda x: -x[1])[0][1])
|
p02987 | s749950816 | Wrong Answer | import collections
s = input()
s = list(s)
s = collections.Counter(s)
s = list(s.values())
flag = False
for i in s:
if i!=2:
flag = True
if flag==True:
print('NO')
else:
print('YES') |
p03261 | s641372934 | Accepted | import sys
from collections import defaultdict
N = int(input())
memo = defaultdict(int)
for i in range(N):
tmp = input()
memo[tmp] += 1
if i==0:
last = tmp[-1]
continue
if memo[tmp]==2:
print("No")
sys.exit()
else:
if last != tmp[0]:
print("No")
sys.exit()
last = tmp[-1]
else:
print("Yes") |
p02993 | s756047989 | Accepted | S = input()
prev_si = ''
flag = False
for si in S:
#print(prev_si, si)
if si == prev_si:
#print('Bad')
flag = True
prev_si = si
if flag:
print('Bad')
else:
print('Good') |
p02813 | s676439076 | Accepted | import itertools
n = int(input())
p = [int(i) for i in input().split()]
q = [int(i) for i in input().split()]
init = sorted(p)
# print(p, q, init)
countp, countq, count = 0, 0, 0
for array in itertools.permutations(init, n):
# print(array)
count += 1
if(list(array) == p):
countp = count
if(list(array) == q):
countq = count
print(abs(countp-countq))
|
p02924 | s712523389 | Accepted | n = int(input())
print(n * (n - 1) // 2) |
p03329 | s512610411 | Accepted |
import numpy as np
inf=10**7
n=int(input())
coin=[6**x for x in range(10)]
coin+=[9**x for x in range(1,10)]
dp=[0]*(n+1)
for (i,x) in enumerate(dp):
dp[i]+=inf
dp[0]=0
for i in range(n+1):
for x in coin:
if(i+x<=n):
dp[i+x]=min(dp[i+x],dp[i]+1)
print(dp[-1]) |
p03679 | s657464119 | Accepted | # -*- coding: utf-8 -*-
#----------
X,A,B = list(map(int, input().rstrip().split()))
#----------
d=-A+B
print( "delicious" if d <= 0 else "safe" if d <= X else "dangerous")
|
p03761 | s309824585 | Accepted | n = int(input())
l = []
for i in range(n):
l.append(sorted(input()))
l.sort(key=len)
ans = []
for i in l[0]:
for j in range(1, n):
if i not in l[j]:
break
else:
l[j].remove(i)
else:
ans.append(i)
print(*ans, sep="") |
p02622 | s221163371 | Wrong Answer | s=input();t=input();
cnt=0
for i in range(len(s)):
if s[i]==t[i]:
cnt+=1
print(cnt) |
p02939 | s905711258 | Accepted | S = input().strip()
k = 0
l = ""
r = ""
for s in S:
r += s
if l == r:
continue
l = r
r = ""
k += 1
print(k)
|
p02600 | s277620518 | Accepted | n = int(input())
if n < 600:
print(8)
elif n < 800:
print(7)
elif n < 1000:
print(6)
elif n < 1200:
print(5)
elif n < 1400:
print(4)
elif n < 1600:
print(3)
elif n < 1800:
print(2)
elif n < 2000:
print(1) |
p03785 | s922742650 | Accepted | N, C, K = map(int, input().split())
T = [int(input()) for _ in range(N)]
T = sorted(T)
S = []
for i in range(N):
S.append(T[i] + K)
ans = 0
bus = 0
count = 0
for i in range(N):
if T[i] <= bus and count < C:
count += 1
else:
bus = S[i]
count = 1
ans += 1
print(ans)
|
p02707 | s399172285 | Wrong Answer | from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
for _ in range(1, n):
print(c[_]) |
p02660 | s210992837 | Accepted | N = int(input())
D = {}
for k in range(2,10**6):
while N%k<1:
N//=k
D[k]=D.get(k,0)+1
a = 0
for i in D.values():
t = 0
c = 0
while t+c<i:
c+=1
t+=c
a+=c
print(a+(N>1)) |
p02924 | s264435351 | Wrong Answer | N = int(input())
print(N*(N-1)/2) |
p02916 | s800182967 | Accepted | n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
sum = 0
for i in range(n):
now = a[i] - 1
pre = a[i-1] - 1
sum += b[ now ]
if i > 0 and now - 1 == pre:
sum += c[ pre ]
print(sum)
|
p04012 | s828285863 | Accepted | w = sorted(input())
if len(w)%2==1:
print("No")
else:
ans = ("Yes")
for i in range(1,len(w),2):
if not w[i]==w[i-1]:
ans = ("No")
print(ans)
|
p04012 | s248686758 | Accepted | w = str(input())
d ={}
flg = True
for i in range(len(w)):
temp = w[i]
if temp in d:
d[temp] += 1
else:
d[temp] = 1
for i in d.values():
if i %2 !=0:
flg= False
if flg == True:
print("Yes")
else:
print("No") |
p02959 | s774440626 | Accepted | n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ans = 0
for i in range(n-1,-1,-1):
ans += min(a[i]+a[i+1],b[i])
a[i] = max(a[i]-max(b[i]-a[i+1],0),0)
print(ans)
|
p02556 | s488293452 | Wrong Answer | import sys
#import time
from collections import deque, Counter, defaultdict
#from fractions import gcd
import bisect
import heapq
#import math
import itertools
import numpy as np
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
inf = 10**18
MOD = 1000000007
ri = lambda : int(input())
rs = lambda : input().strip()
rl = lambda : list(map(int, input().split()))
n = ri()
a = []
for i in range(n):
x,y = rl()
a.append((x,y, x+y))
a = sorted(a, key=lambda x: x[2])
print(abs(a[-1][0]- a[0][0]) + abs(a[-1][1]-a[0][1])) |
p03075 | s805160682 | Wrong Answer | a=[int(input()) for i in range(5)]
print(a)
k=int(input())
for i in range(4):
for j in range(i+1,5):
print(a[j]-a[i])
if a[j]-a[i]>k:
print(":)")
exit()
print("Yay!") |
p03693 | s566464014 | Accepted | r, g, b = map(str, input().split())
a = int(r + g + b)
if a % 4 == 0:
print('YES')
else:
print('NO') |
p02924 | s114312197 | Accepted | n = int(input())
"""求める最大の余りの合計は1〜N-1の合計に等しい"""
result = n*(n-1)//2
print(result) |
p03481 | s649159486 | Accepted | x, y = map(int, input().split())
ans = len(str(bin(y // x))) -2
print(ans)
|
p02552 | s400237694 | Accepted | print(1 if int(input())<1 else 0) |
p02755 | s787068911 | Wrong Answer | import math
A, B = list(map(int, input().split()))
amax = math.ceil((A + 1) / 8 * 100) - 1
amin = math.ceil(A / 8 * 100)
bmax = math.ceil((B + 1) * 10) - 1
bmin = math.ceil(B / 10 * 10)
if amin > bmax or bmin > amax:
print(-1)
else:
print(int(max(amin, bmin)))
|
p03331 | s437902320 | Accepted | def readInt():
return list(map(int,input().split()))
n = int(input())
l = []
for i in range(1,n):
ans = 0
j = i
k = n-i
while j>0:
ans += int(j%10)
j = int(j/10)
while k>0:
ans += int(k%10)
k = int(k/10)
l.append(ans)
# print(l)
print(min(l)) |
p02779 | s677029143 | Accepted | n = int(input())
a_ = list(map(int,input().split()))
import collections
cnt = list(collections.Counter(a_))
print('YES' if len(cnt) == n else 'NO')
|
p04030 | s410364743 | Accepted | s = input()
out_s = []
for i in range(len(s)):
if s[i] == '0' or s[i] == '1':
out_s.append(s[i])
elif s[i] == 'B':
if len(out_s) != 0:
del out_s[-1]
tmp = ''
for i in range(len(out_s)):
tmp += out_s[i]
print(tmp)
|
p03206 | s518378755 | Accepted | nancy = int(input())
print("Christmas" + (25-nancy)*" Eve") |
p02922 | s434004316 | Accepted | import math
A, B = map(int, input().split())
cnt = 1 + math.ceil( (B-A) / (A-1) )
print(cnt) |
p03785 | s185841945 | Accepted | import numpy as np
n, c, k = [int(a) for a in input().split()]
t = []
for _ in range(n):
t.append(int(input()))
t = np.asarray(t)
t = np.sort(t)
ans = 0
count = 0
lim = 0
for i in range(t.shape[0]):
if count == 0:
lim = t[i] + k
count += 1
elif t[i] <= lim and count < c:
count += 1
else:
lim = t[i] + k
ans += 1
count = 1
print(ans+1) |
p03543 | s594677729 | Wrong Answer | from collections import Counter as C
print("Yes" if len(C(input())) <= 2 else "No") |
p03062 | s181995369 | Accepted | # AtCoder
N = int(input())
A = list(map(int, input().split()))
ans = 0
s = 0
m = float('inf')
for i in A:
i = abs(i)
s += i
m = min(m, i)
minus_num = len(list(filter(lambda x: x < 0, A)))
if minus_num % 2 == 0:
print(s)
else:
print(s-2*m)
|
p02631 | s249220724 | Wrong Answer | n = int(input())
a = list(map(int, input().split()))
ans = []
for i in range(n):
x = 0
for j in range(n):
if i != j:
if x == 0:
x = a[j]
else:
x ^= a[j]
ans.append(x)
print(ans) |
p03730 | s029033665 | Accepted | A, B, C = map(int, input().split())
make = False
for i in range(1, B+1):
rem = (A * i) % B
if rem == C:
make = True
break
if make:
print("YES")
else:
print("NO") |
p02951 | s723993812 | Wrong Answer | a,b,c = map(int,input().split())
print(c-(a-b)) |
p02958 | s947986107 | Wrong Answer | n=int(input())
l=[int(x) for x in input().split()]
cnt=0
x=0
y=0
b=0
for i in range(n):
if(i+1!=l[i]):
cnt+=1
if(cnt==1):
x=l[i]
elif(cnt==2):
y=l[i]
elif(cnt>0):
b=1
break
if(b==1):
print("NO")
elif(l[x-1]!=y and l[y-1]!=x):
print("NO")
else:
print("YES") |
p03338 | s814810171 | Accepted | import collections
N = int(input())
S = input()
m = 0
index = 0
for i in range(N):
a = set(S[:i])
b = set(S[i:])
common_char = a & b
if len(common_char) > m:
m = len(common_char)
index = i
print(m) |
p03759 | s288233953 | Accepted | a,b,c = map(int,input().split())
if b-a==c-b:
print('YES')
else:
print('NO')
|
p02829 | s655893440 | Wrong Answer | A = int(input())
B = int(input())
for i in range(3):
if (i == A):
break
elif(i == B):
break
else:
print(i)
|
p04045 | s551766203 | Wrong Answer | import math
n,k=map(int,input().split())
l=set(map(int,input().split()))
s=n
p=set()
for i in range(10):
if i not in l:
p.add(i)
if k==1 and 0 in l:
print(n)
else:
d=math.floor(math.log(n, 10)+1)
for i in p:
n=n+i*(10**d)
d=d+1
print(n)
|
p02732 | s185213892 | Accepted | from collections import Counter
import math
n = int(input())
aa = list(map(int, input().split()))
ctr = Counter(aa)
cmb2 = [0] * 200001
for n in range(2, 200001):
r = 2
num = 1
for i in range(1, r + 1):
num = num * (n - i + 1) // i
cmb2[n] = num
x = 0
for k, v in ctr.items():
x += cmb2[v]
for a in aa:
k = ctr[a] - 1
print(x - k) |
p02813 | s384706054 | Accepted | import itertools
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
l = []
for i in range(1, N + 1):
l.append(i)
p = list(itertools.permutations(l, N))
print(abs((p.index(tuple(P)) + 1) - (p.index(tuple(Q)) + 1 ))) |
p03252 | s359846384 | Accepted | S = input()
T = input()
ListS = []
ListT = []
Alphabet = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
for i in range(26):
ListS.append(S.count(Alphabet[i]))
ListT.append(T.count(Alphabet[i]))
ListS.sort()
ListT.sort()
print("Yes" if ListS == ListT else "No")
|
p02556 | s157148952 | Wrong Answer | N = int(input())
dists = []
while N:
x, y = map(int, input().split())
dists.append((x, y, x+y))
N -= 1
dists.sort(key=lambda x: x[2])
print(abs(dists[0][0] - dists[-1][0]) + abs(dists[0][1] - dists[-1][1]))
|
p02814 | s905910068 | Accepted | import fractions
from functools import reduce
def lcm_base(x, y):
return (x * y) // fractions.gcd(x, y)
def lcm(numbers):
return reduce(lcm_base, numbers, 1)
n,m = map(int, input().split())
a = list(map(int, input().split()))
lcm_a = a[0]
for i in a[1:]:
lcm_a = lcm_a * i // fractions.gcd(lcm_a,i)
if lcm_a > m * 2:
print(0)
exit()
if all([(lcm_a // i) % 2 for i in a]):
ans = (m - lcm_a // 2) // lcm_a + 1
print(ans)
else:
print(0)
|
p03696 | s593390743 | Wrong Answer | N = int(input())
S = input()
d = [0] * (N + 1)
for i in range(N):
d[i + 1] = d[i] + int(S[i] == "(") - int(S[i] == ")")
a = d[-1]
b = min(d)
print("(" * -a + S + ")" * (b - a))
|
p03545 | s339441739 | Accepted | l=[int(i) for i in input()]
ans_c=[['+','+','+'],['+','+','-'],['+','-','+'],['-','+','+'],['+','-','-'],['-','+','-'],['-','-','+'],['-','-','-'],]
for i in ans_c:
num=l[0]
for j in range(3):
if i[j]=='+':
num+=l[j+1]
else:
num-=l[j+1]
if num==7:
print(str(l[0])+i[0]+str(l[1])+i[1]+str(l[2])+i[2]+str(l[3])+'=7')
exit() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.