problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02628
s376914017
Wrong Answer
N, K = map(int, input().split()) p = list(map(int, input().split())) p = sorted(p, reverse=True) ans = 0 for k in range(K): ans += p[k]
p03239
s957230291
Accepted
n, t = map(int, input().split()) res = 1000 + 1 for i in range(n): ci, ti = map(int, input().split()) if ti <= t: res = min(res, ci) if res == 1001: print("TLE") else: print(res)
p03075
s484345236
Accepted
a = int(input()) b = int(input()) c = int(input()) d = int(input()) e = int(input()) k = int(input()) x = [a, b, c, d] y = [b, c, d, e] def chk(x, y): return(abs(x - y)) result = 'Yay!' for i in x: for j in y: if i != j: if chk(i, j) > k: result = ':(' print(result)
p02754
s151914239
Wrong Answer
n,a,b = map(int, input().split()) count = (a+b) // n if count == 0: count = 2 con = count*(a+b) if con - n > b: con -= b if con - n > a: print(a*(count-1)) else: print(a*(count-1)+(a+b)*(count-1) + a -n-1) else: print(a*count)
p02618
s626618891
Accepted
import random D = int(input()) c = list(map(int,input().split())) s = [list(map(int,input().split())) for k in range(D)] def score(t): ret = 0 last = [0]*26 for k in range(D): last[t[k]-1] = k+1 ret += s[k][t[k]-1] for i in range(26): ret -= c[i]*(k+1-last[i]) return...
p03997
s830543446
Accepted
params = [int(input()) for i in range(3)] a = params[0] b = params[1] h = params[2] print(int((a + b)*h/2))
p02714
s243426360
Accepted
import sys import collections sys.setrecursionlimit(10 ** 8) input = sys.stdin.readline def main(): N = int(input()) S = input().strip() c = collections.Counter(S) ans = c["R"] * c["G"] * c["B"] for i in range(N): for j in range(i + 1, N): if j + j - i > N - 1: ...
p02987
s106592375
Wrong Answer
s = list(input()) ans = "Yes" s.sort() if s[0] != s[1]: ans = "No" elif s[2] != s[3]: ans = "No" print(ans)
p03548
s711609782
Accepted
X,Y,Z=map(int,input().split()) print((X-Z)//(Y+Z))
p02801
s706239039
Accepted
import string C = input() R = string.ascii_lowercase for i, r in enumerate(R): if r == C: print(R[i + 1])
p03000
s409719542
Wrong Answer
n,x = map(int,input().split()) l_list = list(map(int,input().split())) total = 0 ans = 0 for i in range(n): if total <= x: ans += 1 else: break total += l_list[i] print(ans)
p03795
s568270614
Wrong Answer
n = int(input()) y_count = 0 x = 800*n for i in range(1,n): if i%15==0: y_count+=1 print(x-y_count*200)
p03210
s674442731
Accepted
x = int(input()) if x==3 or x==5 or x==7: print('YES') else: print('NO')
p03803
s195855832
Accepted
# AtCoder abc054 a # ストレッチ課題 # 入力 alice, bob = map(int, input().split()) # 判定 if alice == bob: print("Draw") elif (alice == 1) or ((bob != 1) and (alice > bob)): print("Alice") else: print("Bob")
p02663
s232937685
Accepted
a, b, c, d, e = map(int, input().split()) hour = e // 60 min = e % 60 a += hour b += min if b >= 60: a += b // 60 b %= 60 ans = 0 if b > d: c -= 1 ans += 60 - (b - d) else: ans += (d - b) if c >= a: ans += 60 * (c - a) else: print(0) exit() print(ans)
p03061
s996792253
Accepted
from collections import deque from fractions import gcd n = int(input()) a = list(map(int,input().split())) l = a[0] r = a[-1] ll = deque([l]) rl = deque([r]) for i in range(1,n-1): l = gcd(l,a[i]) r = gcd(r,a[-(i+1)]) ll.append(l) rl.appendleft(r) llas = ll.pop() rlas = rl.popleft() res = max(llas,rl...
p02829
s438094104
Wrong Answer
a = int(input()) b = int(input()) if a == 1 and b == 2: print(3) elif a == 2 and b == 3: print(1) else: print(2)
p03998
s151389060
Accepted
S = {i:list(input()) for i in "abc"} s = "a" while S[s]: s = S[s].pop(0) print(s.upper())
p03241
s074101739
Accepted
n,m=map(int,input().split()) def divisor(n): ass=[] for i in range(1,int(n**0.5)+1): if n%i==0: ass.append(i) if i!=n//i:ass.append(n//i) return ass ans=0 for i in divisor(m): if m//i>=n:ans=max(ans,i) print(ans)
p02835
s257622815
Wrong Answer
print("Yes" if sum(list(map(int,input().split())))>=22 else "No")
p03145
s294418105
Accepted
ab,bc,ca = map(int,input().split()) import math print(math.floor(ab * bc / 2))
p03131
s821577858
Accepted
import sys sys.setrecursionlimit(10 ** 8) input = sys.stdin.readline def main(): K, A, B = [int(x) for x in input().split()] if B - A <= 2 or K <= A: print(K + 1) return ans = A K -= (A - 1) ans += (K // 2) * (B - A) ans += K % 2 print(ans) if __name__ == '__main__': ...
p02688
s536755352
Wrong Answer
N, K = map(int, input().split()) numlist = [] for i in range(K*2): numlist.append(list(map(int,input().split()))) anslist=[] i=0 while i<K*2: if not i%2==0: anslist.append(numlist[i]) i+=1 checklist=str(anslist) ans=0 j=1 while j<N+1: check=j if str(check) not in checklist: ans+=1 ...
p03095
s157867296
Accepted
n = int(input()) s = str(input()) mod = 10**9+7 d = {} for i in range(n): if s[i] not in d: d[s[i]] = 1 else: d[s[i]] += 1 ans = 1 for v in d.values(): ans *= (v+1)%mod ans -= 1 print(ans%mod)
p02596
s861637054
Accepted
k=int(input()) x=7 for i in range(1,k+1): if x%k==0: print(i) break x=(x*10+7)%k else: print(-1)
p02622
s431889229
Accepted
s = input() t = input() count = 0 for i in range(len(s)): if s[i] != t[i]: count+=1 print(count)
p02753
s260276153
Wrong Answer
# 1 s = input() if (s[:2] == "AA" or s[:2] == "BB" or s[-2:] == "AA" or s[-2:] == "BB"): print("No") else: print("Yes")
p02601
s550574682
Accepted
a,b,c=map(int,input().split()) k=int(input()) num=0 while a>=b: b*=2 num+=1 if b>a: break while b>=c: c*=2 num+=1 if c>b: break if num<=k: print("Yes") else: print("No")
p02918
s889107179
Accepted
N, K = map(int, input().split()) S = input() ans = 0 for i in range(N): if S[i] == 'L': if i - 1 < 0: continue if S[i - 1] == 'L': ans += 1 else: if i + 1 >= N: continue if S[i + 1] == 'R': ans += 1 X = min(len([s for s in S.spli...
p03471
s757746093
Wrong Answer
n, y = map(int, input().split()) ans = [-1] * 3 i = 0 while i < n: j = 0 while j < n-i: if i*10000 + j*5000 + (n-i-j)*1000 == y: ans[0] = i ans[1] = j ans[2] = n-i-j j += 1 i += 1 print(ans[0], ans[1], ans[2])
p04011
s882189317
Accepted
n = int(input()) k = int(input()) x = int(input()) y = int(input()) if n<=k: print(n*x) else: print(k*x+y*(n-k))
p03721
s387896738
Wrong Answer
def main(): N, K = (int(i) for i in input().split()) A = [] B = [] from bisect import bisect_left for i in range(N): a, b = (int(i) for i in input().split()) A.append(a) B.append(b) from itertools import accumulate B = list(accumulate(B)) idx = bisect_left(B, K) ...
p03485
s570097852
Accepted
import math def main(): nums = [int(x) for x in input().split()] ave = sum(nums)/len(nums) print(math.ceil(ave)) if __name__=='__main__': main()
p03239
s249177067
Accepted
n, T = map(int, input().split()) ans = 100000 for i in range(n): c, t = map(int, input().split()) if t <= T: ans = min(ans, c) if ans == 100000: print("TLE") else: print(ans)
p02729
s397784907
Accepted
N,M=map(int,input().split()) ans=0 if N>1: ans += N*(N-1)//2 else: pass if M>1: ans += M*(M-1)//2 else: pass print(ans)
p02952
s908971874
Wrong Answer
n = int(input()) cnt=0 for i in range(1,n): if len(str(i))%2 != 0: cnt += 1 print(cnt)
p02982
s514311332
Wrong Answer
n,d=map(int,input().split()) dis = [list(map(int,input().split())) for i in range(n)] def is_square(n): res=n**0.5 return res.is_integer() cnt=0 for j in range(n-1): dist = 0 for i in range(d): dist += (dis[j][i]-dis[j+1][i])**2 if is_square(dist) == True: cnt+=1 dist = 0 for i in ra...
p02952
s768533490
Accepted
N = int(input()) ans = 0 for i in range(1,N+1): if 10000 <= i <= 99999 or 100 <= i <= 999 or 1 <= i <= 9: ans += 1 print(ans)
p02675
s491659122
Wrong Answer
N=int(input()) M=N%10 if M==2 or 4 or 5 or 7 or 9: print("hon\n") elif M==3: print("bon\n") else: print("pon\n")
p02584
s270984825
Wrong Answer
x,k,d = map(int,input().split()) n = (-x+k*d)//(2*d) cur = float('inf') if n < 0: print(x-k*d) else: if n == 0: L = [0,1] else: L = [n-1,n,n+1] for i in range(len(L)): cur = min(cur, abs(x+L[i]*d-(k-L[i])*d)) print(cur)
p02647
s035510839
Wrong Answer
import math import numpy as np def action(A): B = np.array([0] * N) for i in range(N): s = math.ceil(i - A[i] - 0.5) e = math.ceil(i + A[i] + 0.5) if s < 0: s = 0 if e > N: e = N B[s:e] += 1 return B N, K = map(int, input().split()) A = np.array([int(s) for s in input().split()]...
p02660
s316613238
Accepted
N = int(input()) ans = 0 f = 2 while True: if N%f==0: c = 0 while N%f==0: N /= f c += 1 n = 1 while n*(n+1)//2<=c: n += 1 ans += n-1 if f*f>N: break f += 1 if N>1: ans += 1 print(ans)
p03474
s505010860
Wrong Answer
def is_number(num): try: int(num) return True except: return False A, B = map(int, input().split()) S = input() for i in range(A): if not is_number(S[i]): print("No") exit() if S[A] != "-": print("No") exit() for i in range(A + 1, B): if not is_number(S[i...
p02971
s073776780
Accepted
N = int(input()) A = [int(input()) for i in range(N)] firstVal = max(A) firstInd = A.index(firstVal) secondVal = max(A[0:firstInd] + A[firstInd+1:]) for i in range(firstInd): print(firstVal) print(secondVal) for i in range(N-firstInd-1): print(firstVal)
p03815
s476099237
Wrong Answer
# -*- coding: utf-8 -*- """ Created on Thu Jun 11 17:09:47 2020 @author: sd18016 """ x = int(input()) if x <= 6: print("1") elif x <= 11: print("2") else: a = x // 11 b = x % 11 if b == 0: print(2*a) elif b < 6: print(2*a+2) else: print(2*a+1)
p03331
s953218682
Accepted
n=int(input()) a=10*5 def k(n): s=tuple(map(int,tuple(str(n)))) return sum(s) for i in range(1,n): s=k(i)+k(n-i) if a>s: a=s print(a)
p03095
s736843363
Accepted
MOD = 10**9 + 7 N = int(input()) S = input() lis = [1] * 26 for i in range(N): lis[ord(S[i])-ord('a')] += 1 ans = 1 for i in range(26): ans *= lis[i] ans %= MOD print(ans - 1)
p02832
s392229393
Wrong Answer
N=int(input()) A=list(map(int,input().split())) if A.count(1)==0: print('-1') exit() if A==sorted(A): print('0') exit() ans=0 j=1 for i in range(N): if A[i]==j: ans+=1 j+=1 print('OK') else: print('a') print(N-ans)
p03607
s167748661
Wrong Answer
N=int(input()) A=[int(input()) for _ in range(N)] A.sort() ans=0 b=A[0] c=0 for i in range(N): if b!=A[i]: ans+=(c%2) b=A[i] c=1 else: c+=1 print(ans)
p02754
s114126143
Accepted
N, A, B = map(int, input().split()) q, r = divmod(N, A + B) ans = 0 ans += q * A ans += min(r, A) print(ans)
p03773
s510944099
Wrong Answer
A, B = list(map(int, input().split())) if A+B > 24: print(A+B-24) else: print(A+B)
p04045
s511902077
Accepted
import sys n,k=map(int,input().split()) d=list(map(int,input().split())) allowed=set() for i in d: allowed.add(i) for i in range(n,10**7): b=str(i) c=set() for j in range(len(b)): c.add(int(b[j])) if allowed.intersection(c)==set(): print(i) sys.exit()
p02695
s730516809
Accepted
n, m, q = map(int, input().split()) abcd = [list(map(int, input().split())) for _ in range(q)] from itertools import combinations_with_replacement as cwr AList = list(cwr(range(1, m+1), n)) maxPoint = 0 for A in AList: point = 0 for abc in abcd: a = abc[0] b = abc[1] c = abc[2] d = abc[3] if ...
p02727
s588328004
Accepted
x, y, a, b, c = map(int, input().split()) p_list = sorted(list(map(int, input().split()))) q_list = sorted(list(map(int, input().split()))) r_list = sorted(list(map(int, input().split()))) p_list = p_list[a - x:] q_list = q_list[b - y:] pqr_list = p_list + q_list + r_list pqr_list = sorted(pqr_list,reverse=True) pqr_...
p02759
s799591597
Wrong Answer
x=int(input()) print(round(x/2))
p03632
s736823656
Accepted
a,b,c,d = map(int, input().split()) if a >= c: if a >= d: print(0) elif b >= d: print(d-a) else: print(b-a) else: if b <= c: print(0) elif b <= d: print(b-c) else: print(d-c)
p03107
s731558317
Accepted
# coding: utf-8 import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) S = sr() red = S.count('0') blue = S.count('1') answer = 2 * min(red, blue) print(answer)
p03407
s907068558
Accepted
n=input().rstrip().split() if int(n[0])+int(n[1])>=int(n[2]): print("Yes") else: print("No")
p02714
s674657454
Wrong Answer
from collections import defaultdict def resolve(): s = input() cnt = defaultdict(int) cnt[0] += 1 tmp = 0 for i, c in enumerate(s[::-1]): c = int(c) tmp = (tmp + c * pow(10, i, 2019)) % 2019 cnt[tmp] += 1 ans = sum(c * (c - 1) // 2 for c in cnt.values()) print(ans...
p02918
s564550398
Accepted
N,K = (int(x) for x in input().split()) S = list(input()) ans = N count = 0 for i in range(N-1): if S[i] == S[i+1]: count += 1 print(min(N-1,count+2*K))
p03721
s528186873
Accepted
N, K = map(int, input().split()) count = 0 arr = [list(map(int, input().split())) for _ in range(N)] arr.sort() for i in arr: count += i[1] if count >= K: print(i[0]) exit() print(arr[-1][0])
p03317
s918066411
Accepted
import math n, k = map(int, input().split()) aa = tuple(map(int, input().split())) p = 0 for i in range(n): if aa[i] == 1: p = i break n -= 1 k -= 1 x = math.ceil(n / k) print(x)
p02862
s047665452
Accepted
x, y = map(int, input().split()) if (x + y) % 3 != 0: print(0) exit() a = (x + y) // 3 x -= a y -= a if x < 0 or y < 0: print(0) exit() mod = 10 ** 9 + 7 def combination(n, r): x = 1 y = 1 for i in range(r): x = x * (n - i) % mod y = y * (r - i) % mod return (x * pow(y, m...
p02787
s442512330
Accepted
import sys input = sys.stdin.readline h, n = map(int, input().split()) magics = [] max_cost = 0 for _ in range(n): at, cost = map(int, input().split()) max_cost = max(max_cost, cost) magics.append((at, cost)) dp = [float('inf')] * (h+max_cost) dp[0] = 0 for i in range(len(dp)): for at, cost in magic...
p02859
s944397592
Wrong Answer
line = int(input()) print(int((line * line * 3.14) / (1 * 1 * 3.14)))
p02899
s598024160
Accepted
#!/usr/bin/env python3 N = int(input()) A = [int(s) for s in input().split()] print(' '.join([str(s) for _, s in sorted(zip(A, list(range(1, N+1))))]))
p03472
s241929401
Accepted
n,h,*ab = map(int,open(0).read().split()) a_max = max(ab[::2]) b_sort = sorted(ab[1::2],reverse = True) ans = 0 i = 0 while h>0: if i<n and b_sort[i] > a_max: h -= b_sort[i] i += 1 ans += 1 else: ans += -(-h//a_max) h = 0 print(ans)
p02773
s687366078
Accepted
count = 0 ans = [] dic = {} n = int(input()) for i in range(n): s = input() number = dic.get(s, 0) + 1 count = max(count, number) dic[s] = number for key in dic: if dic[key] == count: ans.append(key) ans.sort() for k in ans: print(k)
p02583
s836258705
Wrong Answer
n = int(input()) l = list(map(int, input().split())) ans = 0 for i in range(n): for j in range(n): for k in range(n): if l[i] != l[j] and l[j] != l[k]: if i + j > k: if j + k > i: if k + i > j: ans += 1 print(ans)
p02660
s187473765
Accepted
#!/usr/bin/env python3 c = 0 m = int(input()) 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 for i in pf: for j in range(pf[i]): pf[i] -= j + 1 c += 1 if pf[i] < 0: c -= 1 break elif pf[i] == 0...
p03592
s276364736
Accepted
N,M,K = map(int,input().split()) ans = "No" for k in range(N+1): for l in range(M+1): if k*(M-l) + l*(N-k) == K: ans = "Yes" print(ans)
p02882
s361928892
Wrong Answer
import math a, b, x = map(int,input().split()) if 2 *x <= a *b **2: p1 = a * b ** 2 p2 = 2 * x else: p1 = 2 * (a ** 2 * b - x) p2 = a ** 3 sit = math.atan(p1 / p2) print(math.degrees(sit))
p02702
s910634344
Wrong Answer
from queue import deque S = deque(input()) y = 2019 U = [0] * y t = int(S.pop()) U[0] = 1 k = 10 for s in reversed(S): t = t + int(s) * k t %= y U[t] += 1 k *= 10 k %= y cnt = 0 for u in U: cnt = cnt + u * (u - 1) // 2 print(cnt)
p04020
s144152203
Wrong Answer
N = int(input()) A = [int(input()) for _ in range(N)] ans = 0 for i in range(N): ans += A[i]//2 A[i] %= 2 for i in range(N-1): if A[i] + A[i+1] == 2: ans += 1 A[i+1] = 0 print(ans)
p02684
s354285480
Wrong Answer
N,K=map(int, input().split()) A = list(map(int, input().split())) where = [0 for k in range(N)] where[0]=1 loop=0 for k in range(N): where[k+1] = A[where[k]-1] if where[k+1] in where[0:k]: li = where[0:k] end = k+1 start = li.index(where[k+1]) loop = end -start break lo...
p03803
s415091700
Accepted
a,b = map(int,input().split()) list = [2,3,4,5,6,7,8,9,10,11,12,13,1] if list.index(a) > list.index(b): print('Alice') elif list.index(a) == list.index(b): print('Draw') else: print('Bob')
p03495
s649631380
Accepted
from collections import Counter N,K=map(int,input().split()) B=Counter(input().split()) count=0 values=sorted(B.values()) for i in range(len(B)-K): count+=values[i] print(count)
p02939
s603411812
Accepted
S = input() count = 1 i = 1 word = S[0] while i < len(S): if word != S[i]: word = S[i] i += 1 else: word = S[i: i+2] i += 2 count += 1 if i != len(S): count -= 1 print(count)
p02708
s213119226
Wrong Answer
N,K=map(int,input().split()) a=(N*(N+1)*(N+2)-(K*(K-1)*(3*N-2*K+4)))/6 print(a%(10**9+7))
p03339
s968196685
Accepted
n=int(input()) s=input() ecount=s.count("E") wcount=0 mn=n for i in range(n): if s[i]=="E": ecount-=1 count=ecount+wcount if mn>count: mn=count else: count=ecount+wcount if mn>count: mn=count wcount+=1 print(mn)
p02639
s685590767
Wrong Answer
A = list(map(int, input().split())) print(A.index(0))
p02802
s293195886
Accepted
import sys input = sys.stdin.readline n,m=map(int,input().split()) num=[0]*(n+1) numcnt=[0]*(n+1) ans=0 cnt=0 for i in range(m): p,s=map(str,input().split()) p=int(p) if s=="WA": num[p]+=1 if s=="AC" and numcnt[p]!=1: ans+=num[p] cnt+=1 numcnt[p]=1 print(cnt,ans)
p03038
s935595632
Wrong Answer
def main(): n, m = [int(i) for i in input().split()] a = [int(i) for i in input().split()] bc = [] for _ in range(m): b, c = map(int, input().split()) bc.append((b, c)) total = 0 for num, v in sorted(bc, key=lambda x: x[-1]): total += num a.extend([v]*num) ...
p03835
s207293228
Wrong Answer
import math k, s = map(int, input().split()) res = 0 for x in range(k+1): for y in range(k+1): if x+y < s: z = s - x - y res += 1 print(res)
p02683
s600016780
Accepted
import numpy as np N,M,X = map(int,input().split()) A = np.array([list(map(int,input().split())) for _ in range(N)]) c = 10**10 for i in range(2**N): C = np.array([0]*(M+1)) for j in range(N): if ((i >> j) & 1): C += A[j] for j in range(1,M+1): if C[j] < X: break ...
p02836
s272329214
Accepted
#入力 S = input() #扱いやすくするためリスト化 ls = list(S) #反転させたものもリスト化する lsr = list(reversed(ls)) count = 0 #反転前後リストで不一致の要素数をカウント for i in range(len(ls)): if ls[i] != lsr[i]: count += 1 #結果(書いてみればわかるが1つ書き直すべき時は反転させたリストと元のリストは2つ不一致が生まれる) print(count//2)
p02888
s354775721
Accepted
N=int(input()) L=sorted(list(map(int,input().split()))) ans=0 for i in range(0,N-1): for j in range(i+1,N): D=L[i]+L[j] l=j r=N while r-l>1: med=(l+r)//2 if D>L[med]: l=med else: r=med ans+=l-j print(ans)
p03309
s307747489
Accepted
import numpy as np n = int(input()) a = np.array(list(map(int, input().split()))) for i in range(n): a[i] = a[i]-(i+1) b = int(np.median(a)) ans = 10**18 ans_lis = [b-1, b, b+1] for i in ans_lis: ans = min(ans, np.sum(np.abs(a-i))) print(ans)
p02768
s792768670
Wrong Answer
mod = 10 ** 9 + 7 n, a, b = map(int, input().split()) comb = [1] * (b + 1) for i in range(b): comb[i+1] = comb[i] * (n - i) // (i + 1) % mod count = pow(2, n, mod) - 1 - comb[a] - comb[b] print(count % mod)
p03013
s328686755
Wrong Answer
n,m = map(int,input().split()) a = [int(input()) for nesya in range(m)] hoge = [1]*(n+1) for i in range(m): hoge[a[i]] = 0 for j in range(1,n+1): if hoge[j] == 0: continue else: hoge[j] = hoge[j-1] + hoge[j-2] hoge[j] = hoge[j] % (10**9+7) print(hoge[j]%(10**9+7))
p03067
s322613745
Accepted
A,B,C=map(int, input().split()) if A<C and B>C: print('Yes') elif B<C and A>C: print('Yes') else: print('No')
p02701
s443706135
Accepted
N=int(input()) sup=[] for i in range(0,N): sup.append(str(input())) print(len(list(set(sup))))
p02628
s547508114
Accepted
N, K = map(int, input().split()) p = [int(x) for x in input().split()] p.sort() price = 0 if N > 0: for j in range(K): price += p[j] print(price)
p03997
s529883170
Accepted
a = int(input()) b = int(input()) h = int(input()) print(int((a + b) * h / 2))
p02910
s540553152
Wrong Answer
s = list(input()) k = 0 for i in range(0,len(s),2): if s[i] == ('R' or 'U' or 'D'): k = 1 for j in range(1,len(s),2): if s[j] == ('L' or 'U' or 'D'): k = 1 else: k = 0 if k==1: print('Yes') else: print('No')
p02792
s991757263
Accepted
n = int(input()) tb = [[0 for _ in range(10)] for _ in range(10)] for i in range(1,n+1): t = int(str(i)[0]) b = int(str(i)[-1]) tb[t][b] += 1 ans = 0 for l in range(10): for m in range(10): ans += tb[l][m] * tb[m][l] print(ans)
p02909
s670429442
Accepted
w = ["Sunny", "Cloudy", "Rainy"] s = input() print(w[(w.index(s) + 1) % 3])
p03309
s927300931
Wrong Answer
n = int(input()) a = list(map(int , input().split())) b = [a[i] - (i+1) for i in range(n)] print(b) b.sort() ans = 10 ** 10 for j in range(3): bi = b[((n-1)//2+j)%n] s = 0 for i in range(n): s += abs(b[i] - bi) print(((n-1)//2+j)%n, s) ans = min(ans, s) print(ans)
p02923
s531181221
Wrong Answer
N = int(input()) H = list(map(int, input().split())) a, b = 0, 0 for i in range(N-1): if H[i] >= H[i+1]: b += 1 else: a = max(a, b) b = 0 print(a)
p03448
s582963194
Accepted
A = int(input()) B = int(input()) C = int(input()) X = int(input()) ans = 0 for i in range(A + 1): for j in range(B + 1): for k in range(C + 1): total = 500 * i + 100 * j + 50 * k if X == total: ans += 1 print(ans)