problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p04011
s162119245
Accepted
#入力 N = int(input()) K = int(input()) X = int(input()) Y = int(input()) #計算 if N <= K: result = X * N else: result = (X * K) + (Y * (N - K)) #出力 print(result)
p02718
s865626951
Accepted
N, M = map(int,input().split()) A = list(map(int,input().split())) A.sort(reverse=True) S = sum(A) if A[M-1] >= S / (4*M): print("Yes") else: print("No")
p03836
s873211581
Wrong Answer
sx, sy, tx, ty = map(int,input().split()) keiro = "" for i in range(ty-sy): keiro += "U" for i in range(tx-sx): keiro += "R" keiro0 = keiro keiro = "" for i in range(ty-sy): keiro += "D" for i in range(tx-sx): keiro += "L" keiro1 = keiro ans = keiro0+keiro1+"LU"+keiro0+"RDDR"+keiro1+"LU" print(ans)
p03220
s958469689
Accepted
N = int(input()) T, A = map(int, input().split()) delta = float('inf') H = list(map(int, input().split())) for i in range(N): # H = int(input()) if delta > abs((T - H[i] * 0.006) - A): delta = abs((T - H[i] * 0.006) - A) answer = i + 1 print(answer)
p03251
s230048546
Accepted
n, m, X, Y = map(int, input().split()) x = list(map(int, input().split())) y = list(map(int, input().split())) x.sort(reverse=True) xmax = max(x[0], X) y.sort() ymin = min(y[0], Y) if ymin - xmax > 0: print("No War") else: print("War")
p03261
s593818435
Accepted
l=[input() for _ in range(int(input()))] for i,w in enumerate(l): if i and (l[i][0]!=l[i-1][-1] or w in l[:i]): exit(print('No')) print('Yes')
p03495
s288245119
Accepted
n,k = list(map(int, input().split())) a = list(map(int, input().split())) from collections import Counter ca = Counter(a) # 個数が少ないものを何個削れば良いか数える c = sorted(ca.values()) print(sum(c[:-k]))
p02795
s701244685
Accepted
import math H = int(input()) W = int(input()) N = int(input()) print(min(math.ceil(N / H), math.ceil(N / W)))
p02971
s676019049
Wrong Answer
n=int(input()) l=[int(input()) for _ in range(n)] #print(l) k=l k.sort() dic_lst={} for i in l: if i not in dic_lst: dic_lst[i]=1 else: dic_lst[i]+=1 for i in l: max_num=max(dic_lst.keys()) if i<max_num: print(max_num) if i==max_num: if dic_lst[i]>1: print(max_num) elif dic_lst[i]==1: print(k[1])
p02783
s690632991
Accepted
h,a = [int(x) for x in input().split()] n = 0 while(h>0): h = h - a n = n + 1 print(n)
p02718
s505079260
Wrong Answer
N, M = map(int, input().split()) A = [int(i) for i in input().split()] total = sum(A) for i in range(len(A)): if (A[i] / total) < (1 / M): print('{}'.format('No')) exit() print('{}'.format('Yes'))
p02861
s969989037
Accepted
n = int(input()) a = [list(map(int,input().split()))for i in range(n)] ans = 0 for i in range(n): for j in range(n): ans += ((a[i][0]-a[j][0])**2 + (a[i][1]-a[j][1])**2)**0.5 print(ans/n)
p02755
s294200429
Accepted
# -*- coding: utf-8 -*- import math a, b = map(int, input().split()) for i in range(0, 10001): if math.floor(0.08*i) == a: if math.floor(0.10*i) == b: print(i) exit() print(-1)
p03254
s675897932
Accepted
N, x = map(int, input().split()) A_list = list(map(int, input().split())) A_list = sorted(A_list) for i in range(N): x -= A_list[i] if x <= 0: break print(i+1) if x == 0 else print(i)
p03778
s452235152
Wrong Answer
w,a,b=map(int,input().split()) print(0 if w+a>=b else abs(w+a-b))
p03637
s000648201
Accepted
n = int(input()) l = list(map(int, input().split())) even = len([i for i in l if i % 2 == 0]) four = len([i for i in l if i % 4 == 0]) even_wo_four = even - four if four >= n//2: print('Yes') elif n - four * 2 == even_wo_four: print('Yes') else: print('No')
p02924
s046891796
Accepted
N = int(input()) if N==1: print(0) else: print((N-1)*N//2)
p03719
s534166010
Wrong Answer
N,_,*L=map(int,open(0).read().split()) for n in range(N):print(L.count(n+1))
p02948
s021139872
Wrong Answer
import heapq N , M =map(int,input().split()) L = [[] for _ in range(M + 1)] for i in range(N): a,b = map(int,input().split()) if a <= M: L[a].append(-b) work = [] heapq.heapify(work) ans = 0 for i in range(M,-1,-1): for j in range(len(L[i])): heapq.heappush(work,L[i][j]) if len(work) > 0: ans -= heapq.heappop(work) print(ans)
p03448
s474259751
Accepted
# -*- coding: utf-8 -*- A = int(input()) B = int(input()) C = int(input()) X = int(input()) count = 0 for i in range(A + 1): for j in range(B + 1): for k in range(C + 1): if 500 * i + 100 * j + 50 * k == X: count += 1 print(count)
p03695
s331749622
Wrong Answer
N=int(input()) A=[int(i) for i in input().split()] col=[0 for i in range(8)] fre=0 for a in A: if a<3200: col[a//400]+=1 else: fre+=1 ans=0 # print(col) for c in col: if c>0: ans+=1 MIN=1 if ans==0 else ans ans+=fre MAX=ans if ans<=8 else 8 print(MIN,MAX)
p02778
s850125223
Wrong Answer
import sys input = sys.stdin.readline print(len(input()) * 'X')
p03672
s492104570
Accepted
def solve(): s = input() for i in range(2,len(s)): ed = len(s)-i mid = ed//2 if s[:mid] == s[mid:ed]: print(len(s[:ed])) return if __name__=='__main__': solve()
p03673
s009028926
Wrong Answer
# dequeでいくわ from collections import deque n = int(input()) a = list(input().split()) ans = deque() for i in range(n): if i % 2 == 0: ans.append(a[i]) else: ans.appendleft(a[i]) print(" ".join(ans))
p02633
s435681703
Wrong Answer
k = int(input()) if 1 <= k <= 179: num = 360 / k if isinstance(num, int): print(num) else: print(360 * k)
p02615
s322145793
Accepted
n = int(input()) a = list(map(int, input().split())) a = sorted(a, reverse=True) ans = 0 for i in range(1, n): ans += a[i // 2] print(ans)
p03264
s403264322
Accepted
k = int(input()) even = k//2 odd = k - even print(odd*even)
p03719
s490924058
Wrong Answer
a,b,c = map(int,input().split()) print("Yes" if a<=b<=c else "No")
p03254
s309689865
Accepted
N,X=map(int,input().split()) a=list(map(int,input().split())) a.sort() b=0 for i in range(0,N): if X>=a[i]: X=X-a[i] b+=1 if i==len(a)-1 and (X+a[i])!=a[i]: b-=1 break else: break print(b)
p04033
s190519376
Wrong Answer
a,b = map(int,input().split()) if a == 0 or b == 0: print("Zero") else: if 0<a<=b<=10**9+1: print("Positive") elif a<=0<=b<=10**9+1: print("Zero") elif a<=b<0: if (b-a+1%2)==0: print("Positive") else: print("Negative")
p03487
s508415547
Wrong Answer
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from collections import Counter def main(): N = int(input()) A = list(map(int, input().split())) result = 0 for key, value in Counter(A).items(): result += min(value, abs(value - key)) print(result) if __name__ == "__main__": main()
p02811
s255719514
Wrong Answer
#!/usr/bin/python3 # -*- coding: utf-8 -*- K, X = [int(x) for x in input().split()] if K * 500 >= X: print("yes") else: print("No")
p03665
s565425366
Wrong Answer
def impossible(a,b,P): if(b == 0 and P == 1): return True if(a == 0 and b == 1 and P == 0): return True return False N,P = map(int,input().split()) lists = list(map(int,input().split())) dp = [0] * 2 for l in lists: if(l % 2 == 0): dp[0] += 1 else: dp[1] += 1 if(impossible(dp[0],dp[1],P)): ans = 0 else: ans = 2 ** (dp[0] + dp[1] - 1) print(ans)
p03448
s628613593
Accepted
a = int(input()) b = int(input()) c = int(input()) x = int(input()) counter = 0 for i in range(a+1): oturi = x-500*i if oturi < 0: break else: for j in range(b+1): oturi_2 = oturi-100*j if oturi_2 < 0: break else: if oturi_2 // 50 <= c: counter += 1 print(counter)
p02702
s808904718
Wrong Answer
S = str(input()) li = [] dic = {} ans = 0 s = 0 d = 1 for i in range(len(S)): s += int(S[len(S)-1-i]) * d s = s % 2019 if s == 0: ans += 1 elif s not in li: li.append(s) elif s not in dic: dic[s] = 2 else: dic[s] += 1 d *= 10 d = d % 2019 li = list(dic.values()) for l in li: ans += l * (l-1) // 2 print(ans)
p03339
s335529465
Wrong Answer
n = int(input()) s = input() e = [0] * (n + 1) w = [0] * (n + 1) for i in range(len(s)): if s[i] == "E": e[i+1] = e[i] + 1 w[i+1] = w[i] else: w[i+1] = w[i] + 1 e[i+1] = e[i] t = [0] * n ans = 10 ** 9 for i in range(0, n): t = w[i] + e[n] - e[i] ans = min(ans, t) print(ans)
p02772
s932480253
Accepted
# -*- coding: utf-8 -*- # input n = int(input()) a = list(map(int, input().split())) for i in range(n): if a[i] % 6 == 0: pass elif a[i] % 10 == 0: pass elif a[i] % 2 > 0: pass else: print('DENIED') exit() print('APPROVED')
p03665
s423026799
Accepted
import sys def input(): return sys.stdin.readline().rstrip() N,P=map(int,input().split()) A=list(map(int,input().split())) temp=0 for i in range(N): if A[i]%2==1: temp+=1 if temp==0: print(1<<N if P == 0 else 0) else: print(1<<(N-1))
p02772
s930782090
Wrong Answer
N=int(input()) A=list(map(int,input().split())) def linersearch(N,A): for i in range(N): if A[i]%2==0: if A[i]%3==0 or A[i]%5==0: return "APPROVED" else: return "DENIED" linersearch(N,A)
p04020
s482032240
Wrong Answer
N = int(input()) A = [int(input()) for _ in range(N)] A.append(0) A.sort() con = False ans = 0 for i in range(N): if A[i] >=2: ans += A[i]//2 A[i] -= A[i]//2 mm = min(A[i+1],A[i]) ans += mm A[i+1] -= mm A[i] -= mm print(ans)
p02727
s327646163
Accepted
from collections import deque x, y, a, b, c = map(int, input().split()) p = list(map(int, input().split())) q = list(map(int, input().split())) r = list(map(int, input().split())) p_1 = deque(sorted(p)) q_1 = deque(sorted(q)) r_1 = sorted(r) while len(p_1) > x: p_1.popleft() while len(q_1) > y: q_1.popleft() pqr = deque(sorted(list(p_1) + list(q_1) + r_1)) i = 0 ans = 0 while i < x+y: ans += pqr.pop() i += 1 print(ans)
p02606
s218360604
Accepted
L,R,d= (int(x) for x in input().split()) count = 0 for i in range(L,R+1): if i % d ==0: count += 1 print(count)
p03219
s661269297
Accepted
a,b = map(int, input().split()) print(a+b//2)
p02879
s997045897
Wrong Answer
a,b =map(int,input().split()) n=a*b if 1<= n<= 9: if 1<= a<=20: if 1<= b<= 20: print(a*b) else: print(-1)
p03160
s012739100
Wrong Answer
#DPまとめコンテストA問題より infinity=10**6 N = int(input()) h = list(map(int,input().split())) dp=[infinity]*N dp[0]=0 for i in range(N-1): dp[i+1] = min(dp[i+1],dp[i]+abs(h[i+1]-h[i])) if i>=1: dp[i+1] = min(dp[i+1],dp[i-1]+abs(h[i+1]-h[i-1])) print(dp[N-1])
p03478
s734133551
Wrong Answer
n, a, b = map(int, input().split()) x = 0 for i in range(n+1): q = i // 1000 qi = i % 1000 w = qi // 100 wi = qi % 100 e = wi // 10 ei = wi % 10 r = ei sum = q + w + e + r if sum >= a and sum <= b: x += i print(x)
p03698
s797731061
Wrong Answer
S = list(input()) s = set(S) L = len(S) l = len(s) if L == l: print('Yes') else: print('No')
p02771
s992865993
Accepted
import sys from collections import * import heapq import math import bisect from itertools import permutations,accumulate,combinations,product from fractions import gcd def input(): return sys.stdin.readline()[:-1] mod=pow(10,9)+7 a,b,c=map(int,input().split()) if a==b and b!=c: print("Yes") elif b==c and c!=a: print("Yes") elif c==a and a!=b: print("Yes") else: print("No")
p03943
s839074709
Wrong Answer
a=input().split(" ") sum1=int(a[0])+int(a[1]) sum2=int(a[0])+int(a[2]) sum3=int(a[1])+int(a[2]) print(sum1) print(sum2) print(sum3) if sum1==int(a[2]) or sum2==int(a[1]) or sum3==int(a[0]): print("Yes") else: print("No")
p02689
s692385715
Accepted
n,m = list(map(int,input().split())) harr = list(map(int,input().split())) ans = [True] * n for i in range(m): a,b = list(map(int,input().split())) s = harr[a-1]; t = harr[b-1] if s > t: ans[b-1] = False elif s < t: ans[a-1] = False else: ans[a-1] = ans[b-1] = False print(sum(ans))
p02818
s319321320
Accepted
# ABC149 # B Greesy Takahashi # takはA枚、aokiはB枚、TAKはK回 a, b, k = map(int, input().split()) if k > a: if k - a > b: print(0,0) else: print(0,b - (k - a)) else: print(a-k,b)
p03474
s266818655
Accepted
n,m=map(int,input().split()) inl=list(input()) try: for t in range(n): int(inl[t]) for s in range(m): int(inl[n+1+s]) if inl[n]=="-": print("Yes") else: print("No") except Exception as e: print("No")
p02622
s297966265
Accepted
S = input() T = input() count = 0 for i in range(len(S)): if S[i] != T[i]: count += 1 print(count)
p03633
s367917929
Accepted
import fractions n = int(input()) t = [int(input()) for _ in range(n)] ans = t[0] for i in range(1,n): ans = ans * t[i] // fractions.gcd(ans, t[i]) print(ans)
p03427
s965881554
Wrong Answer
N=list(str(input())) print(int(N[0])-1+9*(len(N)-1))
p02600
s721359524
Accepted
def main(): x = int(input()) if x <=599: print("8") elif x <= 799: print("7") elif x <= 999: print("6") elif x <= 1199: print("5") elif x<=1399: print("4") elif x<=1599: print("3") elif x<=1799: print("2") else: print("1") main()
p03329
s656940416
Accepted
A = [1,6,9,36,81,216,729,1296,6561,7776,46656,59049] N = int(input()) dp = [N] * (N+1) dp[0] = 0 for i in range(1, N+1): for j in A: if i >= j: dp[i] = min(dp[i], dp[i - j] + 1) print(dp[N])
p02793
s404046865
Accepted
n = int(input()) a = list(map(int, input().split())) from fractions import gcd from functools import reduce def lcm(x,y): return (x*y)//gcd(x,y) mod = 10**9+7 l = reduce(lcm, a) % mod ans = 0 for i in range(n): ans += l * pow(a[i], mod - 2, mod) ans %= mod print(ans)
p02546
s948515322
Accepted
def main(): from sys import stdin import re readline = stdin.readline N=str(readline().rstrip()) if ( re.match(r'.*s$',N )): print(N + 'es') else: print(N + 's') main()
p03827
s629730120
Wrong Answer
n = int(input()) s = input() bag = [] cnt = 0 for i in s: if i == "I": cnt += 1 bag.append(cnt) else: cnt -= 1 bag.append(cnt) print(max(bag))
p03555
s626454098
Wrong Answer
c1=input() c2=input() print("YES" if c1==c2[::-1] else "No")
p02717
s850446119
Wrong Answer
a,b,c = map(int, input().split()) tmp = a a = b b = tmp tmp = a a = c c = a print("{} {} {}".format(a,b,c))
p02775
s314717429
Accepted
a,b=1,0 for c in map(int,input()):a,b=min(a+10-c-1,b+c+1),min(a+10-c,b+c) print(b)
p03827
s851829936
Accepted
N = input() S = list(input()) cnt = 0 cnt_max = 0 for i in S: if i == 'I': cnt += 1 if cnt > cnt_max: cnt_max = cnt elif i == 'D': cnt -= 1 print(cnt_max)
p03773
s546013851
Wrong Answer
n=sum(list(map(int,input().split())));print(n-24 if n>=4 else n)
p03324
s987522254
Wrong Answer
# 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(): d,n=map(int,input().split()) val=100**d if d==0 and n==100: print(101) elif d==1 and n==100: print(10100) elif d == 2 and n == 100: print(10010000) else: print(val*n) resolve()
p03035
s570282946
Accepted
A, B = map(int, input().split()) if(A>=13): print(B) elif(6<=A<=12): print(int(B/2)) elif(A<=5): print("0")
p03657
s831606804
Accepted
A, B = [int(i) for i in input().split()] if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0: print('Possible') else : print('Impossible')
p03838
s492193654
Accepted
#agc008-a x,y=map(int,input().split()) ans=float('inf') #反転させるかどうか決めた後のx,yの上下関係を考える #0,0 if y-x>0: ans=min(ans,y-x) #1,0 if -x<=y: ans=min(ans,1+y+x) #0,1 if x<=-y: ans=min(ans,1+-y-x) #1,1 if -x<=-y: ans=min(ans,2+-y+x) print(ans)
p02958
s338200539
Wrong Answer
n=int(input()) p=list( map(int, input().split())) ans=0 for i in range(n): if p[i]==i+1: ans=ans+1 if ans<=2: print('Yes') else: print('No')
p03835
s716187872
Accepted
K,S = [int(i) for i in input().split()] count = 0 for i in range(K+1): for j in range(K+1): k = S - i - j if 0 <= k and k <= K: count += 1 print(count)
p03239
s486376627
Accepted
n,t=map(int,input().split()) c=[] time=[] re=[] l=[] for i in range(n): a,b=map(int,input().split()) c.append(a) time.append(b) for i in range(n): if time[i]>t: re.append(i) for j in range(n): if j in re: continue else: l.append(c[j]) if len(l)==0: print('TLE') else: print(min(l))
p03419
s651961144
Wrong Answer
n, m = map(int, input().split()) ret = 0 if (n >= 3) and (m >= 3): ret += (n-2) * (m-2) if (n == 1) and (m >= 3): ret += m - 2 if (m == 1) and (n >= 3): ret += n - 2 print(ret)
p03827
s432299280
Accepted
n = int(input()) s = input() x = 0 xmax = 0 for s0 in s: if s0 == 'I': x += 1 else: x -= 1 if x > xmax: xmax = x print(xmax)
p03250
s714669166
Accepted
l = sorted(list(map(str, input().split())), reverse=True) print(int(l[0]+l[1]) + int(l[2]))
p03481
s002892938
Accepted
x, y = map(int, input().split()) count = 0 while x <= y: x *= 2 count += 1 print(count)
p02595
s791876747
Accepted
n, d = map(int, input().split()) i = 0 for _ in range(n): x, y = map(int, input().split()) dis = (x**2 + y**2) **0.5 if dis <= d: i += 1 print(int(i))
p03037
s582067253
Accepted
N,M = map(int, input().split()) l=0 r=N for _ in range(M): ll,rr=map(int,input().split()) l = max(l,ll) r = min(r,rr) ans = r - l + 1 print(ans if ans > 0 else 0)
p02582
s079451214
Accepted
s = input() if 'RRR' in s: print(3) elif 'RR' in s: print(2) elif 'R' in s: print(1) else: print(0)
p03862
s405112409
Wrong Answer
N, x = list(map(int,input().split())) a = list(map(int,input().split())) result = 0 for i in range(N-1): n = a[i] + a[i+1] - x if n > 0: result += n a[i+1] -= n if a[i+1] < 0: a[i+1] = 0 print(result, a)
p03910
s319883779
Wrong Answer
n = int(input()) if n == 1 or n == 2: print(n) else: a = [] m = 0 for i in range(1, n): if m > n: break a.append(i) m += i for i in range(len(a) ** 2): g = [] for j in range(len(a)): if ((i >> j) & 1): g.append(a[j]) if sum(g) == n: print(*g) break
p03659
s043244640
Accepted
N = int(input()) A = list(map(int,input().split())) B = [0] for a in A: B.append(B[-1] + a) ans = float('inf') for i in range(1,N): tmp = abs(B[-1]-B[i] - B[i]) ans = min(ans, tmp) print(ans)
p03352
s179809931
Accepted
X = int(input()) if X == 1: print(1) exit() def it(): for i in range(2, X): x = i*i if x > X: return 0 while x*i <= X: x *= i yield x print(max(it()))
p03075
s654794138
Accepted
lst = list(int(input()) for _ in range(6)) print("Yay!" if lst[4] - lst[0] <= lst[5] else ":(")
p02939
s856313868
Accepted
S = input() dp = [0] * len(S) dp[0] = 1 dp[1] = 1 if S[0] == S[1] else 2 for i in range(2, len(S)): if S[i] != S[i - 1]: dp[i] = dp[i - 1] + 1 # ここは自明 else: dp[i] = dp[i - 3] + 2 print(dp[-1])
p03241
s883547795
Wrong Answer
from math import sqrt N, M = map(int, input().split()) ans = 1 for i in range(1, int(sqrt(M))): if M % i == 0 and M / N >= i: ans = i print(ans)
p03699
s900533757
Accepted
def main(): n = int(input()) s = [] for _ in range(n): ss = int(input()) s.append(ss) sm = sum(s) if sm % 10 != 0: print(sm) return s.sort() for i, ss in enumerate(s): if ss % 10 != 0: print(sm - ss) return print(0) if __name__ == '__main__': main()
p03126
s176141340
Wrong Answer
N,M=map(int,input().split()) KA=[] A=[] a=0 for i in range(N): KA.append(list(map(int,input().split()))) for i in range(N): KA[i].remove(KA[i][0]) for i in range(N): for j in range(len(KA[i])): A.append(KA[i][j]) print(A) for i in range(1,M+1): if N==A.count(i): a+=1 print(a)
p02881
s904216370
Accepted
import math N = int(input()) sq = math.floor(math.sqrt(N)) ans = N for i in range(1, sq + 1): if(N % i == 0): ans = i + N // i - 2 print(ans)
p03545
s039925465
Accepted
from itertools import product A,B,C,D=map(int,input()) O=["+","-"] X=product(O,repeat=3) for (p,q,r) in X: T="{}{}{}{}{}{}{}".format(A,p,B,q,C,r,D) if eval(T)==7: print("{}=7".format(T)) break
p03544
s517457827
Accepted
def lucas(n, memo={}): if n == 0: return 2 elif n == 1: return 1 elif n in memo: return memo[n] else: memo[n] = lucas(n - 1, memo) + lucas(n - 2, memo) return lucas(n - 1) + lucas(n - 2) n = int(input()) print(lucas(n))
p03419
s208368486
Accepted
import bisect,collections,copy,itertools,math,string import sys def I(): return int(sys.stdin.readline().rstrip()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) def main(): n,m = LI() if n > m: n,m = m,n ans = 0 if n == 1: ans = abs(m-2) elif n == 2: ans = 0 else: ans = (n-2)*(m-2) print(ans) main()
p02983
s075493042
Accepted
mod = 2019 l, r = map(int, input().split()) m = min(r, l + mod) MN=[] for i in range(l, m): for j in range(i+1, m+1): cand = i * j % mod if cand: MN.append(cand) else: print(0) exit() print(min(MN))
p04031
s068895233
Wrong Answer
num = int(input()) str_line = input().split(" ") num_line = [int(n) for n in str_line] ave = 0 for i in range(num): ave += num_line[i] ave = -(-ave//num) wa = 0 for i in range(num): temp = num_line[i] - ave wa += temp*temp print(wa)
p02689
s085140496
Accepted
n,m = map(int, input().split(' ')) h = list(map(int, input().split(' '))) a = [list(map(int, input().split(' '))) for _ in range(m)] res = [set() for _ in range(n)] for i,j in a: res[i-1].add(j-1) res[j-1].add(i-1) ans = 0 res = [j if j != set() else set([i]) for i,j in enumerate(res)] for i in range(n): for j in res[i]: if i == j: ans += 1 break if h[i] <= h[j]: break else: ans += 1 print(ans)
p02784
s855693638
Accepted
a,b=map(int, input().split()) s=sum(map(int, input().split())) print('Yes' if s >= a else 'No')
p02571
s046656463
Accepted
s1 = str(input()) s2 = str(input()) diff=[] for i in range(0,len(s1)-len(s2)+1): str1 = s1[i:i+len(s2)] #print(str1) val=0 for i in range(len(str1)): if(abs(ord(str1[i])-ord(s2[i])) > 0): val += 1 diff.append(val) print(min(diff))
p03971
s606781799
Accepted
n,a,b = map(int,input().split()) s=input() AB=0 B=0 for i in range(n): if s[i] =='a': if AB<a+b: AB+=1 print('Yes') else: print('No') elif s[i] =='b': B+=1 if AB<a+b and B<=b: AB+=1 print('Yes') else: print('No') else: print('No')
p02923
s868936120
Accepted
#!/usr/bin/env python3 n, *h = map(int, open(0).read().split()) r = [0] * n for i in range(1, n): if h[i - 1] >= h[i]: r[i] = r[i - 1] + 1 else: r[i] = 0 print(max(r))
p03109
s196058286
Accepted
import sys sys.setrecursionlimit(10**9) INF=10**18 MOD=10**9+7 def input(): return sys.stdin.readline().rstrip() def main(): l=list(map(int,input().split('/'))) if l[0]<2019 or l[1]<=4: print('Heisei') else: print('TBD') if __name__ == '__main__': main()