problem_id
stringclasses 428
values | submission_id
stringlengths 10
10
| status
stringclasses 2
values | code
stringlengths 5
816
|
|---|---|---|---|
p02779
|
s383425615
|
Accepted
|
#coding:utf-8
n=int(input())
A=list(map(int,input().split()))
if len(A)==len(set(A)):
print('YES')
else:
print('NO')
|
p02873
|
s385764695
|
Wrong Answer
|
n =input()
a=n.count("<")
b =n.count(">")
c = a+b
print(int((c-1)*c/2))
|
p03605
|
s691893519
|
Accepted
|
n = int(input())
if n // 10 == 9 or n % 10 == 9:
print('Yes')
else:
print('No')
|
p03087
|
s037335240
|
Wrong Answer
|
S = input()
ans = 0
ACGT = ["A","C","G","T"]
for i in range(len(S)):
for j in range(i,len(S)+1):
clipped_list = list(S[i:j])
clipped = set(clipped_list)
for acgt in ACGT:
try:
clipped.remove(acgt)
except:
pass
if clipped == set():
ans = max(ans,len(clipped_list))
print(ans)
|
p02548
|
s258070762
|
Accepted
|
N = int(input())
ans = 0
for i in range(1, N):
ans += (N - 1) // i
print(ans)
|
p03759
|
s232517923
|
Accepted
|
a,b,c=map(int,input().split())
if b-a==c-b:
print('YES')
else:
print('NO')
|
p02995
|
s194302771
|
Accepted
|
import fractions
A, B, C, D = [int(i) for i in input().split()]
result = B+1 - A
def lcm(a, b):
return (a * b) // fractions.gcd(a, b)
def wareru(min_num, max_num, waru):
return (max_num)//waru - (min_num-1)//waru
result -= wareru(A, B, C) + wareru(A, B, D) - wareru(A, B, lcm(C,D))
print(result)
|
p02987
|
s825782207
|
Accepted
|
S = input()
slist = list(S)
sset = set(slist)
if slist.count(slist[0]) == 2 and len(sset) == 2:
print("Yes")
else:
print("No")
|
p02639
|
s137640104
|
Accepted
|
A = list(map(int, input().split()))
print(A.index(0)+1)
|
p02772
|
s916457006
|
Wrong Answer
|
input()
a = list(map(int, input().split()))
b = []
for i in range(len(a)):
if (a[i] % 2) == 0:
if (((a[i] % 3) == 0) or ((a[i] % 5) == 0)):
b.append(True)
else:
b.append(False)
if (len(b) == 0) or (False in b):
print("APPROVED")
else:
print("DENIED")
|
p02603
|
s432077540
|
Wrong Answer
|
n=int(input())
a=list(map(int, input().split()))
delta_a = [0] * (n-1)
for i in range(n-1):
delta_a[i] = a[i+1] - a[i]
stock = 0
money = 1000
for i in range(n-1):
if delta_a[i] > 0 and (delta_a[i-1] <= 0 or i == 0):
stock = money // a[i]
money = money % a[i]
elif delta_a[i] < 0 and delta_a[i-1] >= 0 and stock != 0:
money += stock * a[i]
stock = 0
if stock != 0:
money += stock * a[n-1]
print(money)
|
p02729
|
s174715405
|
Accepted
|
n,m=map(int,input().split())
k=n*(n-1)/2
l=m*(m-1)/2
k=int(k)
l=int(l)
if n>=2 and m>=2:
print(k+l)
elif n>=2 and m<2:
print(k)
elif n<2 and m>=2:
print(l)
else:
print(0)
|
p02786
|
s284711729
|
Accepted
|
H=int(input())
enemy=1
ans=0
while H>0:
ans+=enemy
H//=2
enemy*=2
print(ans)
|
p02622
|
s369079512
|
Accepted
|
S=input()
T=input()
ans = 0
for s, t in zip(S, T):
if s != t:
ans += 1
print(ans)
|
p03262
|
s844700891
|
Accepted
|
from math import gcd
n, x = map(int, input().split())
x = list(map(lambda xi: abs(int(xi) - x), input().split()))
g = x[0]
for xi in x:
g = gcd(g, xi)
print(g)
|
p02725
|
s838297783
|
Wrong Answer
|
k, n = map(int, input().split())
a = list(map(int, input().split()))
if len(a) == n:
if 0 in a:
a.remove(0)
a.sort()
ans = 0
n = 1
for i in a:
try:
ans += a[n] - a[n-1]
n += 1
except:
pass
print(ans)
|
p03282
|
s372068719
|
Accepted
|
s = input()
k = int(input())
l = len(s)
pos = 0
for i in range(l):
if s[i] != "1":
pos = i
break
if k - 1 < pos:
print(s[k - 1])
else:
print(s[pos])
|
p03059
|
s494135884
|
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():
A, B, T = LI()
ans = T // A * B
print(ans)
if __name__ == '__main__':
resolve()
|
p03309
|
s311168459
|
Accepted
|
import statistics
NN = int(input())
AA = list(map(int,input().split()))
BB = [0]*NN
for nn in range(1,NN+1):
BB[nn-1] = AA[nn-1] - nn
#print(BB)
MBB = statistics.median(BB)
CC = list(map(lambda x: x - MBB, BB))
#print(CC)
ACC = list(map(lambda x: abs(x),CC))
ANS = sum(ACC)
print(int(ANS))
|
p03075
|
s463389091
|
Accepted
|
import sys
rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.buffer.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7
li = [ri() for _ in range(6)]
print(':(' if li[4] - li[0] > li[5] else 'Yay!')
|
p03239
|
s587934867
|
Accepted
|
N,T = map(int, input().split())
ct=[list(map(int, input().split())) for _ in range(N)]
#print(ct)
max=1001
for i in range(N):
if ct[i][1]>T:
continue
else:
if ct[i][0]<max:
max=ct[i][0]
if max==1001:
print('TLE')
else:
print(max)
|
p02714
|
s054640618
|
Wrong Answer
|
from collections import Counter
from functools import reduce
n = int(input())
s = input()
kw = Counter(s)
ans = reduce(lambda x, y: x * y, kw.values())
for i in range(n - 2):
for j in range(i + 1, n - 1):
k = 2 * j - i
if j < k <= n - 1 and s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
ans -= 1
print(ans)
|
p03910
|
s911662748
|
Wrong Answer
|
import sys
def sum_(i):
return i * (i + 1) // 2
if __name__ == "__main__":
N = int(input())
sum_score = 0
if N == 1:
print(1)
sys.exit(0)
for i in range(1, N + 1):
if sum_(i) <= N:
sum_score = sum_(i)
else:
break
for x in list(range(1, i - 1)) + [(N - sum_score) + (i - 1)]:
print(x)
|
p02766
|
s374373571
|
Wrong Answer
|
N, K = map(int, input().split())
#%%time
i = 0
ans = 0
while i <= 10**9:
if N < K:
ans = 1
break
elif N == K:
ans = 2
break
elif K**i < N:
i += 1
else :
ans = i
break
print(ans)
|
p02727
|
s567533283
|
Accepted
|
X, Y, A, B, C = map(int, input().split())
red = list(map(int, input().split()))
green = list(map(int, input().split()))
no = list(map(int, input().split()))
red = sorted(red, reverse=True)[:X]
green = sorted(green, reverse=True)[:Y]
no = sorted(no, reverse = True)[:X+Y]
co = sorted(red+green)
for i in range(len(no)):
if no[i]>co[i]:
co[i] = no[i]
else:
break
print(sum(co))
|
p03681
|
s234317509
|
Accepted
|
n, m = map(int, input().split())
MOD = 10**9 + 7
if abs(n - m) > 1:
print(0)
elif n == m:
ans = 1
for i in range(2, n + 1):
ans *= i
ans %= MOD
# xoxoxo... とoxoxox... 、どっちを先にするかで2種類
print(2 * ans * ans % MOD)
else:
ans = 1
for i in range(2, n + 1):
ans *= i
ans %= MOD
for i in range(2, m + 1):
ans *= i
ans %= MOD
print(ans)
|
p04045
|
s386771397
|
Accepted
|
n,k=map(int,input().split())
d=set(map(int,input().split()))
d_=set((1,2,3,4,5,6,7,8,9,0))
abl=d_-d
ans=''
a0=True
a1=True
for i in str(n):
if a0 and int(i) in abl:
ans+=str(i)
elif a0:
b=[ai for ai in abl if int(i)<ai]
if len(b)==0:
a1=False
break
b.sort()
ans+=str(b[0])
a0=False
else:
ans+=str(min(abl))
if a1==False:
print(str(min(abl-{0}))+str(min(abl))*len(str(n)))
else:
print(ans)
|
p03059
|
s220781861
|
Accepted
|
a,b,t = list(map(int,input().split()))
print(t//a*b)
|
p03705
|
s227118987
|
Wrong Answer
|
n,a,b=map(int,input().split())
if (b-a+1)>n or a>b:exit(print(0))
mi=b+(n-1)*a
ma=a+(n-1)*b
print(ma-mi+1)
|
p02923
|
s202946747
|
Wrong Answer
|
n = int(input())
H = list(map(int, input().split()))
cnt = 0
ans = 0
tmp = H[0]
for h in H[1:]:
if h <= tmp:
cnt += 1
ans = max(ans, cnt)
tmp = h
if ans > 0:
ans -= 1
print(ans)
|
p02796
|
s442716039
|
Accepted
|
n = int(input())
L = []
for i in range(n):
a,b = map(int,input().split())
L.append([a+b,a-b])
L.sort()
ans = 0
right = -10**10
for i in range(n):
if L[i][1] >= right:
ans += 1
right = max(right,L[i][0])
print(ans)
|
p03067
|
s097276164
|
Wrong Answer
|
a,b,c=map(int,input().split())
if a>b>c or a<b<c:
print("No")
else:
print("Yes")
|
p02952
|
s546263294
|
Wrong Answer
|
N=int(input())
count=0
if N//100000==1:
count=90909
elif N//10000>0:
count=N%10000+910
elif N//1000>0:
count=909
elif N//100>0:
count=N%100+10
elif N//10>0:
count=9
else:
count=N%10
print(count)
|
p03986
|
s081370030
|
Accepted
|
x=input()
a=0
ans=0
for i in range(len(x)):
if x[i]=="T":
a=a+1
if a>ans:
ans=a
else:
a=a-1
print(ans*2)
|
p03328
|
s366037562
|
Wrong Answer
|
a,b = map(int,input().split())
l = [i*(i+1)//2 for i in range(1,101)]
ans = 1
for i in range(100):
a += 1
b += 1
if a in l and b in l:
print(ans)
break
else:
ans += 1
|
p03471
|
s168659076
|
Accepted
|
N,Y=map(int,input().split())
answer=0
for n in range(0,N+1):
for n_ in range(0,N+1-n):
n__=N-n-n_
if 10000*n+5000*n_+1000*n__==Y:
answer=1
kotae=str(n)+' '+str(n_)+' '+str(n__)
break
if answer==0:
print(-1,-1,-1)
else:
print(kotae)
|
p02708
|
s696701521
|
Accepted
|
N, K = map(int, input().split(" "))
mod = 10 ** 9 + 7
ans = 0
for k in range(K, N + 2):
ans += (k * (2 * N + 1 - k) // 2) - (k * (k - 1) // 2) + 1
ans %= mod
print(ans)
|
p03623
|
s588958874
|
Wrong Answer
|
a, b, c = [int(x) for x in input().split()]
if a - b > a - c:
print("B")
else:
print("A")
|
p03679
|
s100195060
|
Accepted
|
x, a, b = list(map(int, input().split()))
if a - b >= 0:
print('delicious')
elif b - a <= x:
print('safe')
else:
print('dangerous')
|
p02681
|
s062492618
|
Accepted
|
s = input()
t = input()
cnt = len(s)
if s[:cnt] == t[:cnt]:
if len(t) == cnt + 1:
print('Yes')
exit()
print('No')
|
p02811
|
s050356823
|
Accepted
|
K, X = [int(i) for i in input().split()]
if K*500 >= X:
print('Yes')
else:
print('No')
|
p02952
|
s442104478
|
Accepted
|
#136_B
n=int(input())
print(sum([len(str(i))%2==1 for i in range(1,n+1)]))
|
p02659
|
s198247123
|
Accepted
|
from decimal import Decimal
a, b = map(Decimal, input().split())
print(int(a * b))
|
p02802
|
s969386075
|
Accepted
|
# -*- coding: utf-8 -*-
import numpy as np
n, m = map(int, input().split())
ac = np.zeros(n)
wa = np.zeros(n)
for _ in range(m):
p, s = input().split()
p = int(p) - 1
if ac[p] == 1:
continue
if s == "WA":
wa[p] += 1
else:
ac[p] = 1
acc = 0
wac = 0
for a, w in zip(ac, wa):
if a == 1:
acc += 1
wac += w
print(acc, int(wac))
|
p02836
|
s479575024
|
Wrong Answer
|
s = list(input())
n = len(s)
res = 0
for i in range(n):
if s[i] != s[n-1-i]:
res += 1
print(res)
|
p03417
|
s244627550
|
Wrong Answer
|
a,b = map(int, input().split())
if (a == 1) :
if (b == 1):
print(1)
else:
print(b -2)
else :
print((a-2)*(b-2))
|
p03059
|
s011699332
|
Accepted
|
a,b,t = map(int,input().split())
print( t//a * b)
|
p03698
|
s162759151
|
Accepted
|
s = input()
if len(s)==len(set(s)):
print('yes')
else:
print('no')
|
p02784
|
s529026005
|
Accepted
|
h,n=map(int,input().split())
a=list(map(int,input().split()))
if sum(a)>=h:
print('Yes')
else:
print('No')
|
p03544
|
s493389161
|
Accepted
|
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy
N = int(input())
a, b = 2, 1
for i in range(1, N):
a, b = b, a + b
print(b)
|
p03254
|
s218300949
|
Wrong Answer
|
N,M = map(int,input().split())
L = input().split()
L = sorted(L)
total = 0
i = 0
while M > 0 and i < N:
M -= int(L[0])
L.pop(0)
total += 1
i += 1
print(total)
|
p03720
|
s942966293
|
Accepted
|
# Begin Header {{{
from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement
# }}} End Header
# _________コーディングはここから!!___________
t = defaultdict(int)
n, m = map(int, input().split())
for i in range(m):
a, b = map(int, input().split())
t[a]+=1
t[b]+=1
for j in range(1, n+1):
print(t[j])
|
p02627
|
s178707266
|
Wrong Answer
|
a=input()
if a.islower():
print('B')
else:
print('A')
|
p03852
|
s783609683
|
Accepted
|
c = input()
print("vowel" if c in ["a","e","i","o","u"] else "consonant")
|
p03338
|
s182629102
|
Accepted
|
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product
def resolve():
n=int(input())
s=str(input())
print(max(len(set(s[:i])&set(s[i:])) for i in range(n)))
resolve()
|
p03345
|
s551729544
|
Accepted
|
A,B,C,K=map(int,input().split())
if K%2==0:
val=A-B
if abs(val)>pow(10,18):
print("Unfair")
else:
print(val)
else:
val=B-A
if abs(val)>pow(10,18):
print("Unfair")
else:
print(val)
|
p03106
|
s599605889
|
Accepted
|
import math
a,b,k = map(int,input().split())
g = math.gcd(a,b)
c = 0
i = 1
for i in range(g,0,-1) :
if g%i == 0 :
c+=1
if c==k :
break
print(i)
|
p02939
|
s162073886
|
Accepted
|
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy
import decimal
if __name__ == "__main__":
s = input()
d = ""
c = ""
ans = 0
for i in s:
d += i
if d != c:
c = d
d = ""
ans+=1
print(ans)
|
p02608
|
s528486157
|
Accepted
|
n = int(input())
ans = [0]*n
for x in range(1,101):
for y in range(1,101):
for z in range(1,101):
b = x**2 + y**2 + z**2 + x*y + x*z + y*z - 1
if b < n:
ans[b] += 1
for a in ans:
print(a)
|
p02548
|
s115994311
|
Wrong Answer
|
from math import sqrt
n=int(input())
k=int(sqrt(n))
ans=0
for c in range(1,n):
for b in range(1,k):
if n%b==0:
ans+=2
if k*k==n:
ans+=1
print(ans)
|
p02615
|
s322315313
|
Wrong Answer
|
N = int(input())
*A, = map(int, input().split())
A = sorted(A, reverse=True)
ans = sum(A[:-1])
print(ans)
|
p02790
|
s478685331
|
Wrong Answer
|
a, b = map(int,input().split())
a_b = len(str(a))*b
b_a = len(str(b))*a
if a_b <= b_a:
print(a_b)
else:
print(b_a)
|
p03759
|
s084570250
|
Accepted
|
a, b, c = map(int, input().split())
if b - a == c - b:
print("YES")
else:
print("NO")
|
p03617
|
s182978484
|
Wrong Answer
|
p = list(map(int, input().split()))
n = int(input())
l = []
s = [0.25, 0.5, 1, 2]
l = [[p[0]*4, 0], [p[1]*2, 1], [p[2], 2], [p[3]/2, 3]]
l.sort()
def only1L():
return min(p[0]*4, p[0]*2+p[1], p[1]*2, p[2])
if (s[l[0][1]] == 2):
print(int(p[l[0][1]] * (n // s[l[0][1]])) + only1L())
elif (n == 1):
print(only1L())
else:
print(int(l[0][0] * (n / s[l[0][1]])))
|
p02695
|
s052402661
|
Accepted
|
import itertools
N,M,Q = map(int,input().split())
abcd = [list(map(int,input().split())) for _ in range(Q)]
def func(A):
res = 0
for i in range(Q):
a,b,c,d = abcd[i]
a -= 1
b -= 1
if A[b]-A[a]==c:
res += d
return res
ans = 0
for A in itertools.combinations_with_replacement([i+1 for i in range(M)],N):
A = list(A)
A.sort()
ans = max(ans,func(A))
print(ans)
|
p03861
|
s586559964
|
Wrong Answer
|
a,b,x = map(int,input().split())
print(b//x - a//x + 1)
|
p03943
|
s373000072
|
Accepted
|
a,b,c=map(int,input().split())
if max(a,b,c)==a+b+c-max(a,b,c):
print("Yes")
else:
print("No")
|
p03250
|
s767464439
|
Accepted
|
a,b,c = map(int,input().split())
print(max(a,b,c)*9+a+b+c)
|
p03042
|
s837786080
|
Accepted
|
def is_month(t):
return 1 <= int(t) <= 12
s = input()
pre, suf = s[:2], s[2:]
if is_month(pre) and is_month(suf):
print('AMBIGUOUS')
elif not is_month(pre) and not is_month(suf):
print('NA')
elif is_month(pre) and not is_month(suf):
print('MMYY')
else:
print('YYMM')
|
p03416
|
s440503796
|
Accepted
|
a, b = map(int, input().split())
ans = 0
for i in range(a, b + 1):
for j in range(len(str(i))):
if str(i)[j] != str(i)[(-1) * j - 1]:
break
else:
ans += 1
print(ans)
|
p03013
|
s634508842
|
Accepted
|
n, m = map(int, input().split())
a = [0]*m
for i in range(m):
a[i] = int(input())
mod = 10**9 + 7
dp = [-1]*(n+1)
dp[0] = 1
dp[1] = 1
for i in range(m):
dp[a[i]] = 0
#print(dp)
for i in range(n-1):
if dp[i+2] == -1:
dp[i+2] = (dp[i+1] + dp[i]) % mod
elif dp[i+2] == 0:
dp[i+2] = 0
#print(dp)
print(dp[n] % mod)
|
p03624
|
s001975827
|
Accepted
|
l=["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"]
A=list(input())
A=set(A)
for i in range(26):
if l[i] in A:
pass
else:
print(l[i])
exit()
print("None")
|
p03017
|
s394462034
|
Wrong Answer
|
N, A, B, C, D = (int(i) for i in input().split())
S = input()
bef = ''
row_dot_max = 0
count = 0
for i, s in enumerate(S):
if bef == '#' and s == '#' and i <= A-1:
print('No')
exit()
if s == '.':
count += 1
else:
row_dot_max = max(row_dot_max, count)
count = 0
bef = s
if C > D:
if row_dot_max >= 3:
print('Yes')
else:
print('No')
else:
print('Yes')
|
p02765
|
s110211078
|
Wrong Answer
|
def main():
n, r = map(int,input().split())
if n >= 10:
print(r)
else:
print(r + 100* (10 - r))
main()
|
p02862
|
s992050200
|
Accepted
|
a,b = map(int,input().split())
mod = 10**9+7
x = (2*a-b)//3
y = (2*b-a)//3
if (2*a-b)%3 != 0 or (2*b-a)%3 != 0 or 2*b < a or 2*a < b or (a+b)%3 != 0:
print(0)
exit()
def comb(n,r):
fact = 1
invfact = 1
for i in range(r):
fact *= n-i
fact %= mod
invfact *= i+1
invfact %=mod
return fact*pow(invfact,mod-2,mod)%mod
print(comb(x+y,y))
|
p02819
|
s639422843
|
Accepted
|
import math
def isPrime(y):
if y == 2 or y == 3:
return True
for i in range(2, int(math.sqrt(x) + 2)):
if y % i == 0:
return False
return True
x = int(input())
while not isPrime(x):
x += 1
print(x)
|
p03043
|
s612827734
|
Accepted
|
import math
n, k = map(int, input().split())
# for small
score = 0
times = []
for i in range(1, min(n + 1, k)):
times.append(math.ceil(math.log2((k / i))))
if len(times):
bottom_max = times[0]
for t in times:
score += 2 ** (bottom_max - t)
score /= 2 ** (bottom_max) * n
# for big
big = [i for i in range(k, max(k, n + 1))]
score += len(big) / n
print('{:.10f}'.format(score))
|
p02814
|
s679248815
|
Accepted
|
import math
from functools import reduce
N,M=map(int,input().split())
A=[int(x)//2 for x in input().split()]
def lcm_base(x, y):
return (x * y) // math.gcd(x, y)
def lcm(*numbers):
return reduce(lcm_base, numbers, 1)
LCM=lcm(*A)
for a in A:
if LCM//a%2==0:
print(0)
break
else:
print((M//LCM+1)//2)
|
p03103
|
s777624320
|
Accepted
|
n, m = map(int, input().split())
L = sorted([list(map(int, input().split())) for _ in range(n)])
ans = 0
for l in L:
tmp = min(l[1], m)
ans += l[0]*tmp
m -= tmp
if m == 0:
break
print(ans)
|
p03160
|
s552018246
|
Accepted
|
N = int(input())
h = input().split()
h = [int(i) for i in h]
dp = [0] * N
dp[0] = 0
dp[1] = abs(h[1]-h[0])
for i in range(1, N-1):
dp[i+1] = min(dp[i] + abs(h[i]-h[i+1]), dp[i-1] + abs(h[i-1]-h[i+1]))
print(dp[N-1])
|
p03327
|
s851544747
|
Accepted
|
n = int(input())
if n < 1000:
print('ABC')
else:
print('ABD')
|
p02547
|
s302968847
|
Accepted
|
n = int(input())
d = []
for _ in range(n):
d.append(list(map(int, input().split())))
cnt = 0
for i in d:
if i[0] == i[1]:
cnt += 1
else:
cnt = 0
if cnt >= 3:
print('Yes')
exit()
print('No')
|
p03011
|
s283469855
|
Accepted
|
li = list(map(int,input().split()))
li.sort()
ans = 0
for i in range(2):
ans = ans + li[i]
else:
print(ans)
|
p02699
|
s887518321
|
Accepted
|
import math
import sys
readline = sys.stdin.readline
def main():
s, w = map(int, readline().rstrip().split())
print("unsafe" if s <= w else "safe")
if __name__ == '__main__':
main()
|
p02615
|
s832594635
|
Accepted
|
N=int(input())
A=list(int(x) for x in input().split())
A.sort()
sum = 0
for i in range(N-1):
k=i+1
sum+=A[N-int(k/2)-1]
print(sum)
|
p02621
|
s696642804
|
Wrong Answer
|
a=int(input())
print(a*2+a+a*3)
|
p03059
|
s884584468
|
Wrong Answer
|
a,b,c=map(int,input().split());print((a//c)*b)
|
p02695
|
s288725651
|
Accepted
|
n, m, q = map(int, input().split())
e = [list(map(int, input().split())) for i in range(q)]
w = [0]*n
res = 0
def dfs(x, y):
global w, res
if x == n:
tmp = 0
for a, b, c, d in e:
if w[b-1]-w[a-1] == c: tmp += d
res = max(res, tmp)
return
for i in range(y, m+1):
w[x] = i
dfs(x+1, i)
dfs(0, 1)
print(res)
|
p03814
|
s459860328
|
Accepted
|
import sys
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
s = input()
flg = False
idx_A = 0
idx_Z = -1
for idx, i in enumerate(s):
if i == "A" and not flg:
idx_A = idx
flg = True
if i == "Z" and flg:
idx_Z = idx
print(max(0, idx_Z - idx_A + 1))
if __name__ == '__main__':
resolve()
|
p03380
|
s310759234
|
Accepted
|
def main():
n = int(input())
A = list(map(int, input().split()))
A.sort()
m = A.pop()
B = [[a, abs(a - (m / 2))] for a in A]
B.sort(key = lambda x: x[1])
print('{} {}'. format(m, B[0][0]))
if __name__ == '__main__':
main()
|
p02778
|
s398534670
|
Wrong Answer
|
s = input()
for _ in range(len(s)):
print('x')
|
p03408
|
s291499182
|
Wrong Answer
|
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]
ss=set(s)
ans = [1]
for i in ss:
ans.append(s.count(i)-t.count(i))
print(max(ans))
|
p03625
|
s953198604
|
Accepted
|
from collections import Counter as C
_ = input()
a = C([int(x) for x in input().split()])
b = [0] * 2
for k, v in a.items():
if 4 <= v:
b.append(k)
if 2 <= v:
b.append(k)
else:
b.sort()
print(b[-1] * b[-2])
|
p03387
|
s393270602
|
Accepted
|
a, b, c = sorted([int(x) for x in input().split()])
ans = c - b
a += ans
if (c - a) % 2 == 0:
print(ans + (c - a) // 2)
else:
print(ans + (c - a) // 2 + 2)
|
p03943
|
s218725114
|
Wrong Answer
|
L=list(map(int,input().split()))
print('Yes' if sum(L)%2==0 else 'No')
|
p02777
|
s348013485
|
Accepted
|
s,t = input().split()
a,b = map(int, input().split())
u = input()
if u == s:
a -= 1
elif u == t:
b -= 1
print("{} {}".format(a, b))
|
p02712
|
s285156512
|
Wrong Answer
|
import numpy as np
import sys
import math
# n = map(int,input().split())
ans = 0
n = int(input())
for x in range(n):
if x % 3 == 0 and x % 5 == 0:
continue
if x % 3 == 0:
continue
if x % 5 == 0:
continue
ans += x
print(ans)
|
p02759
|
s662578919
|
Accepted
|
n=int(input())
if n%2:
print(n//2 + 1)
else:
print(n//2)
|
p02859
|
s533046062
|
Accepted
|
r = int(input())
print(r*r)
|
p02912
|
s785819707
|
Accepted
|
import heapq
from typing import List
def main():
n, m = map(int, input().split())
v = map(int, input().split())
print(pdt(v, m))
def pdt(v: List[int], m: int) -> int:
vv = [-a for a in v]
heapq.heapify(vv)
for _ in range(m):
k = -heapq.heappop(vv)
k = k // 2
heapq.heappush(vv, -k)
return -sum(vv)
if __name__ == '__main__':
main()
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.