problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02862
s488234544
Accepted
MOD = 10 ** 9 + 7 def choose(n,r): num = 1 den = 1 for i in range(r): num *= n-i num %= MOD for i in range(r): den *= i+1 den %= MOD return num * pow(den, MOD-2, MOD) % MOD def solve(x,y): if (x+y)%3!=0: return 0 k = (x+y)//3 if x<k or y<k: return 0 return choose(k, min(y-k, x-k)) print(solve(*map(int, input().split())))
p03145
s330000455
Accepted
a,b,c = map(int,input().split()) print(a * b // 2)
p03639
s134463642
Accepted
n=int(input()) a=list(map(int,input().split())) temp=[0]*n for i in range(n): if a[i]%4==0: temp[i]=2 elif a[i]%2==0: temp[i]=1 if n%2!=0 and sum(temp)>=n-1: print("Yes") elif sum(temp)>=n: print("Yes") else: print("No")
p03087
s568338879
Accepted
from itertools import accumulate n,q = map(int,input().split()) s = input() l = [list(map(int,input().split())) for _ in range (q)] flg =[] for i in range(n-1): if s[i:i+2]=="AC": flg.append(1) else: flg.append(0) flg2 = [0]+flg flg2 = list(accumulate(flg2)) for i in l: print(flg2[i[1]-1]-flg2[i[0]-1])
p04033
s061534454
Accepted
a, b = map(int, input().split()) if a <= 0 and b >= 0: print("Zero") elif a>0: print("Positive") else: if abs(b-a)%2 == 0: print("Negative") else: print("Positive")
p03695
s420334871
Wrong Answer
n=int(input()) a=list(map(int,input().split())) rate=[0]*9 ansmin=0 ansmax=0 a.sort() over=0 for i in a: for j in range(1,9): if 400*(j-1) <= i <= 400*j-1: rate[j]=1 break elif i >= 3200: over+=1 break ansmin = rate.count(1) ansmax = rate.count(1) if over != 0: if ansmax + over >= 8: ansmax = 8 else: ansmax = ansmax + over #print(rate) print(ansmin, ansmax)
p02935
s388080436
Accepted
# ABC138C n = int(input()) v = list(map(int, input().split())) v = sorted(v) ans = (v[0] + v[1]) / 2 for i in range(2, len(v)): ans = (ans + v[i]) / 2 print(ans)
p03286
s048404170
Accepted
N = int(input()) def base(x, n): ret = [] while x != 0: ret.append( x % abs(n)) if n < 0: x = - ( (-x)//n ) else: x //= n return ret if N == 0: print(0) else: print("".join(map(str, reversed(base(N, -2)))))
p02952
s724100108
Accepted
N = int(input()) count = 0 for i in range(1,N+1): if int(len(str(i))) % 2 == 1: count += 1 print(count)
p03565
s767354807
Wrong Answer
# zentansaku S = input() T = input() Ns = len(S) Nt = len(T) cand = [] N = max(0, Ns - Nt + 1) for i in range(N): for j in range(Nt): s = S[i + j] t = T[j] if s == t or s == "?": continue else: break else: pre = S[:i].replace("?", "a") cand.append(pre + T) if not cand: print("UNRESTORABLE") else: cand.sort() print(cand[0])
p03472
s976309609
Wrong Answer
N, H = map(int, input().split()) A = [] B = [] Amax = 0 for _ in range(N): a, b = map(int, input().split()) Amax = max(a, Amax) B.append(b) B.sort(reverse=True) res = 0 for b in B: if b > Amax: if H < b: print(res) exit() H -= b res += 1 else: break print(res + (H // Amax + int(H % Amax != 0)))
p02694
s224680814
Accepted
i = 1 d = 100 n = int(input()) if n == 100: print(0) else: while True: d = int(d * 1.01) if n <= d: break i = i + 1 print(i)
p03471
s144862320
Wrong Answer
n,s = map(int, input().split()) for x in range(n): if x > 2000: break for y in range(n): if y > 2000: break tmp = n-x-y if (x*10000+y*5000+tmp*1000) == s and 0<=tmp<=2000: print('{} {} {}'.format(x,y,tmp)) exit(0) print('-1 -1 -1')
p04005
s266236027
Accepted
A,B,C = map(int,input().split()) if (A%2)*(B%2)*(C%2)==0: print(0) else: print(min(A*B,B*C,C*A))
p03475
s751553705
Accepted
n=int(input()) l=[] for _ in range(n-1): c,s,f=map(int,input().split()) for i,t in enumerate(l): if t>s: t=-(-t//f)*f else: t=s l[i]=t+c l+=[s+c] for i in l+[0]: print(i)
p02829
s319114039
Accepted
l = [1, 2, 3] for i in range(2): l.remove(int(input())) print(l[0])
p02818
s577845138
Accepted
A,B,K=map(int,input().split()) if A<K: K=K-A A=0 else: A=A-K K=0 if K!=0: if K>B: B=0 else: B=B-K print(A,B)
p02829
s066785806
Accepted
ans = [1, 2, 3] ans.remove(int(input())) ans.remove(int(input())) print(ans[0])
p02831
s982828956
Wrong Answer
import fractions a, b = map(int, input().split()) def lcm(x, y): return x*y/fractions.gcd(x, y) print(lcm(a, b))
p03673
s043078610
Accepted
def INT(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(map(int, input().split())) from collections import deque n = INT() a = LI() b = deque() for i in range(n): if i % 2 == 0: b.append(a[i]) else: b.appendleft(a[i]) if (-1)**n == -1: b.reverse() print(*b)
p02708
s479790176
Accepted
import numpy as np from itertools import combinations n,K = map(int,input().split()) num_ls = [i for i in range(n+1)] csum_num_ls = list(np.cumsum(num_ls)) mod = 1000000007 ans = 0 for k in range(K,n+1): smallest = csum_num_ls[k-1] biggest = csum_num_ls[-1] - csum_num_ls[-k-1] ans_k = biggest - smallest + 1 ans += ans_k ans %= mod ans += 1 print(ans)
p02888
s770190141
Wrong Answer
N = int(input()) L = list(map(int, input().split())) L.sort() from itertools import combinations ans = 0 for a, b, c in combinations(L, r=3): ans += a + b < c print(ans)
p03723
s908365588
Accepted
A,B,C=list(map(int,input().split())) if A == B == C: if A%2==1 or B%2==1 or C%2==1: print(0) exit() else: print(-1) exit() for i in range(10**9): if A%2==1 or B%2==1 or C%2==1: print(i) exit() A,B,C=(B+C)//2,(A+C)//2,(A+B)//2
p03254
s468380639
Accepted
n, x = map(int, input().split()) a = list(map(int, input().split())) c = 0 a_sorted = sorted(a) for i in range(n): x -= a_sorted[i] if x > 0 and i <= n-2: c += 1 elif x == 0: c += 1 else: break print(c)
p02933
s758572278
Accepted
a = int(input()) s = input() if a >= 3200: print(s) else: print("red")
p02711
s217154564
Wrong Answer
from math import gcd k = int(input()) ans = 0 for i in range(1, k+1): for j in range(1, k+1): for l in range(1, k+1): ans += gcd(gcd(i, j), l) print(ans)
p03478
s110263630
Accepted
n, a, b = map(int, input().split()) ans = 0 def calculate_digit_sum(n): digit_sum = 0 for digit in str(n): digit_sum += int(digit) return digit_sum for num in range(1, n + 1): if a <= calculate_digit_sum(num) and calculate_digit_sum(num) <= b: ans += num print(ans)
p02646
s288948809
Accepted
A,V = map(int, input().split()) B,W = map(int, input().split()) T = int(input()) if A <= B: B += W*T A += V*T if A >= B: ans = "YES" else: ans = "NO" else: B -= W*T A -= V*T if A <= B: ans = "YES" else: ans = "NO" print(ans)
p03137
s002838311
Wrong Answer
N, M = map(int,input().split()) X = list(map(int,input().split())) if len(X)<2: print(0) else: X.sort() diffs = [] for i in range(M-1): diffs.append(abs(X[i+1]-X[i])) diffs.sort(reverse=True) print(X[M-1]-X[0]-sum(diffs[:N]))
p03145
s846398977
Accepted
AB, BC, CA = map(int,input().split()) print(AB*BC//2)
p02793
s005221090
Wrong Answer
import sys sys.setrecursionlimit(4100000) import math N = int(input()) import fractions a = list(map(int, input().split())) koubai = a[0] for i in range(1, N): koubai = koubai * a[i] // fractions.gcd(koubai, a[i]) if(koubai >=1000000000000007): break ans = int(0) for i in range(N): ans += koubai // a[i] ans %= 1000000007 print(ans)
p03338
s650862293
Accepted
N=int(input()) S=input() ans=0 for i in range(1,N): temp=0 check1=set(S[:i]) check2=set(S[i:]) for s in check1: if s in check2: temp+=1 ans=max(ans,temp) print(ans)
p02818
s389020496
Wrong Answer
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement from math import floor, ceil, sqrt, factorial, log from bisect import bisect_left, bisect_right from collections import Counter, defaultdict from heapq import heappop, heappush, heappushpop from itertools import product import sys stdin = sys.stdin mod = 10**9 + 7 def ns(): return stdin.readline().rstrip() def ni(): return int(ns()) def na(): return list(map(int, stdin.readline().split())) a, b, k = na() takahashi = a - min((k + 1) // 2, a) aoki = b - min(k // 2, b) print(takahashi, aoki)
p02690
s470849632
Accepted
x = int(input()) for i in range(-130, 130): for j in range(-130, 130): if i**5 - j**5 == x: print(i, j) exit()
p03264
s086505323
Wrong Answer
k = int(input()) if k%2 == 0: print(k*k/4) else: print(k**2/4-1/4)
p02719
s339964696
Accepted
N, K = map(int, input().split()) ans_list = [int(N % K), K - int(N % K)] print(min(ans_list))
p04045
s155893394
Wrong Answer
def main(): n,k=map(int,input().split()) d=set(map(int,input().split())) ln=[int(i) for i in list(str(n))] l=len(ln) flag=True x=min(set(range(10))-d) for i in range(l): if flag: while ln[i] in d: ln[i]+=1 flag=False else: ln[i]=x print(''.join([str(i) for i in ln])) if __name__=='__main__': main()
p03067
s740715684
Wrong Answer
a, b, c = map(int, input().split()) print('Yes' if a <= c <= b or a >= b >= c else 'No')
p03487
s024183828
Accepted
N = int(input()) A = [int(x) for x in input().split()] d = {} for a in A: if a not in d: d[a] = 1 else: d[a] += 1 ans = 0 for i in d: if i<=d[i]: ans += d[i]-i else: ans += d[i] print(ans)
p02935
s689178405
Wrong Answer
n = int(input()) v = list(map(int,input().split())) asa = 0 for i in range(1,n): v[n-i-1] = (v[n-i-1] + v[n-i])/2 print(v[0])
p03076
s957930929
Wrong Answer
T = [int(input()) for _ in range(5)] lst1 = [] lst2 = [] for i in range(5): if T[i]%10 == 0: lst1.append([0,T[i]]) else: lst2.append([T[i]%10,T[i]]) lst2 = sorted(lst2, reverse=True) lst = lst1 + lst2 print(lst) ans = 0 for i in range(5): ans += lst[i][1] if lst[i][0] == 0: pass else: ans += 10 - lst[i][0] ans -= 10 - lst[i][0] print(ans)
p02696
s075781776
Wrong Answer
import math a, b, n = map(int,input().split()) # N = int(input()) # al = list(map(int,input().split())) lst = [] if b >= n: x = n else: if b != 1: x = b-1 else: x = 1 ans = math.floor(a * x / b) - a * math.floor(x / b) print(ans)
p03719
s533451107
Wrong Answer
a,b,c=input().split() print("Yes" if c>=a and c<=b else "No")
p02548
s533789997
Accepted
from math import floor N = int(input()) ans = 0 for A in range(1, N+1): if N % A == 0: ans += N//A-1 else: ans += N//A print(ans)
p02678
s996819547
Accepted
from collections import deque N,M=map(int,input().split()) G=[[] for _ in range(N+1)] for i in range(M): a,b=map(int,input().split()) G[a].append(b) G[b].append(a) ans=[0]*(N+1) d=deque([1]) while d: c=d.popleft() for g in G[c]: if not ans[g]: d.append(g) ans[g]=c print('Yes') for i in range(2, N+1): print(ans[i])
p02973
s625072937
Accepted
# https://atcoder.jp/contests/abc134/tasks/abc134_e import bisect N = int(input()) A = [] for _ in range(N): a = int(input()) A.append(a) A.reverse() INF = float('inf') dp = [INF for _ in range(N)] for a in A: target_index = bisect.bisect_right(dp, a) # print(a, target_index) dp[target_index] = a # print(dp) print(bisect.bisect_left(dp, INF))
p02971
s300224833
Wrong Answer
n = int(input()) a = [int(input()) for x in range(n)] x = max(a) import copy for i in range(n): if(a[i] < x): print(x) else: b = sorted(list(set(a)), reverse=True) if(len(b) == 1): print(x) else: print(b[1])
p02910
s214049015
Wrong Answer
S=list(input().split()) N=len(S) for i in range(0,N-1,2): if S[i]=="L" or S[i+1]=="R": print("No") else: print("Yes")
p02628
s253194005
Accepted
N,K=map(int,input().split()) P=list(map(int,input().split())) P=sorted(P) ans=0 for i in range(K): ans+=P[i] print(ans)
p02811
s726228770
Accepted
K, X = map(int, input().split()) if X <= K*500: print('Yes') else: print('No')
p03331
s330817027
Accepted
#template def inputlist(): return [int(j) for j in input().split()] #template #issueから始める N = int(input()) def wa(N) : #kakuketanowa S = str(N) array = list(map(int,S)) return sum(array) ans = 10**9+7 for i in range(1,N): l = i r = N-i suma = wa(l) + wa(r) ans = min(ans,suma) print(ans)
p03944
s512219523
Wrong Answer
w,h,n = map(int, input().split()) x1,x2,y1,y2 = 0,0,0,0 for _ in range(n): x,y,a = map(int, input().split()) if a == 1: x1 = max(x1, x) if a == 2: x2 = max(x2, w-x) if a == 3: y1 = max(y1, y) if a == 4: y2 = max(y2, h-y) w -= x1+x2 h -= y1+y2 if w*h <= 0: print(0) else: print(w*h)
p02621
s024078172
Accepted
a = int(input()) print(a+a**2+a**3)
p03797
s102572376
Wrong Answer
n, m = [int(i) for i in input().split()] if n >= 2 * m: print(round(m / 2)) else: print(n + round((m - 2 * n) / 4))
p02577
s971452143
Wrong Answer
s = input() is_mul = sum([int(i) for i in s])%9 if is_mul: print("Yes") else: print("No")
p03696
s106429199
Accepted
def main(): N = int(input()) S = input() brackets = [0, 0] for i in range(len(S)): if S[i] == ")": if brackets[0] > 0: brackets[0] -= 1 else: brackets[1] += 1 elif S[i] == "(": brackets[0] += 1 print(brackets[1] * "(" + S + brackets[0] * ")") main()
p02732
s628830366
Accepted
import copy N = int(input()) A = list(map(int, input().split())) a_types = set(A) count_dict = [0] * N for each in A: count_dict[each - 1] += 1 all_types = 0 for value in count_dict: all_types += value * (value - 1) // 2 # result_dict = {} # for each in a_types: # result_dict[each] = all_types - count_dict[each] + 1 for a in A: print(all_types - count_dict[a - 1] + 1)
p03997
s966382082
Wrong Answer
a = int(input()) b = int(input()) h = int(input()) print((a+b)*(h/2))
p02765
s919303852
Accepted
n, r = map(int, input().split()) if (n >= 10): print(r) else: print(r+100*(10-n))
p03544
s409675411
Wrong Answer
N = int(input()) L0 = 2 L1 = 1 if N == 1: print(L1) else: for i in range(N-1): L1, L0 = L1 + L0, L1 print(L1)
p03962
s137423163
Accepted
# ペンキの種類を求めよ abc = input() ls_abc = abc.split() len_abc = len(ls_abc) for i in range(len_abc): ls_abc[i] = int(ls_abc[i]) # print(ls_abc) counter = {} # この状態では,カウンターがからッぽ.0にするためには18.19行目 for i in range(len_abc): x = ls_abc[i] if not x in counter: counter[x] = 0 counter[x] = counter[x] + 1 print(len(counter))
p02724
s809004307
Wrong Answer
N = int(input()) A = N//500 B = (N-A)//5 print(A*1000+B*5)
p03434
s773452295
Accepted
N = int(input()) A = list(map(int, input().split())) A.sort(reverse=False) ans = 0 for i in range(N): if i % 2 == 0: ans += A[i] else: ans -= A[i] print(abs(ans))
p03543
s446855907
Accepted
a=input() if a[0]==a[1]==a[2] or a[1]==a[2]==a[3]:print("Yes") else:print("No")
p02761
s568092643
Accepted
n,m=(int(i) for i in input().split()) l=[None,None,None] answer='unknown' for i in range(m): a,b=(int(i) for i in input().split()) if l[n-a]==None: l[n-a]=b elif l[n-a]!=b: answer='-1' break if l[0]==None: l[0]=0 for i in range(3): if l[i]==None: if i!=n-1: l[i]=0 else: l[i]=1 r=l[2]*10**2+l[1]*10+l[0] if len(str(r))!=n: answer='-1' if answer=='-1': print('-1') else: print(r)
p03774
s040979183
Accepted
n,m = map(int,input().split()) a = [input().split() for i in range(n)] b = [input().split() for i in range(m)] for i in range(n): distance = 10000000000 for j in range(m): temp = abs(int(a[i][0]) - int(b[j][0])) + abs(int(a[i][1]) - int(b[j][1])) if distance > temp: ans = j + 1 distance = min(temp,distance) print(ans)
p02802
s817595604
Wrong Answer
N, M = map(int, input().split()) PS = [list(map(str, input().split())) for _ in range(M)] ac_cnt, wa_cnt = 0, 0 n_and_ac = {} for n in range(N): n_and_ac[str(n + 1)] = 0 for ps in PS: if ps[1] == "AC" and n_and_ac[ps[0]] == 0: n_and_ac[ps[0]] += 1 ac_cnt += 1 if ps[1] == "WA" and n_and_ac[ps[0]] == 0: wa_cnt += 1 print(str(ac_cnt) + " " + str(wa_cnt))
p02947
s742959090
Wrong Answer
N = int(input()) Dic = {} for _ in range(N): st = input() st=''.join(sorted(st)) if st not in Dic: Dic[st]=0 else: Dic[st]+=Dic[st]+1 print(sum(Dic.values()))
p03696
s658560098
Accepted
import sys sys.setrecursionlimit(10 ** 5 + 10) def input(): return sys.stdin.readline().strip() def resolve(): N = int(input()) S = str(input()) stack_rem = 0 need_left = 0 for i in range(N): if S[i] == '(': stack_rem += 1 elif stack_rem > 0: stack_rem -= 1 else: need_left += 1 need_right = stack_rem print('('*need_left+S+')'*need_right) resolve()
p02994
s154431537
Accepted
num = 0 n,l = map(int, input().split()) if l <= 0 < l+n-1: for i in range(1,n+1): num += (l+i-1) elif l > 0: for i in range(2,n+1): num += (l+i-1) else: for i in range(1,n): num += (l+i-1) print(num)
p02571
s844057111
Wrong Answer
S=input() T=input() def count_letter(A,B): score=0 for i in range(len(A)): if A[i]==B[i]: score+=1 return score count_max=0 for i in range(len(S)-len(T)): count_max=max(count_max,count_letter(S[i:i+len(T)],T)) print(len(T)-count_max)
p03730
s878881789
Accepted
A, B, C = map(int, input().split()) b = False for a in range(1, B): if A*a-C >= 0: if (A*a-C)%B == 0: b = True print("YNEOS"[not(b)::2])
p04029
s611215165
Accepted
n=int(input()) print(n*(n+1)//2)
p02606
s018163388
Accepted
l,r,d= list(map(int, input().strip().split())) if r%d==0: s=r//d else: s=r//d if l%d==0: t=l//d else: t=l//d+1 print(s-t+1)
p02972
s997156216
Accepted
N = int(input()) B = [int(i) for i in input().split()] S = [0]*N cnt = 0 for i in range(N-1, -1, -1): A = S[i::i+1] if sum(A)%2 == B[i]: continue elif sum(A)%2 == 0 and B[i] == 1: S[i] += 1 cnt += 1 elif sum(A)%2 == 1 and B[i] == 0: S[i] += 1 cnt += 1 print(cnt) l = [] for i in range(N): if S[i] == 1: l.append(i+1) print(" ".join(map(str,l)))
p02836
s309714957
Wrong Answer
s=input() t=s[::-1] num=0 for i in range(len(s)): if s[i]!=t[i]: num+=1 print(num)
p02843
s273834659
Accepted
x = int(input()) dp = [0]*(x + 105 + 1) dp[100] = 1 dp[101] = 1 dp[102] = 1 dp[103] = 1 dp[104] = 1 dp[105] = 1 for i in range(100,x-105+25): for j in range(100,106): dp[i+j] = max(dp[i] , dp[i+j]) print(dp[x])
p03474
s046895335
Accepted
A, B = map(int, input().split()) S = input() if S[0:A].isdecimal() and S[A+1:A+1+B].isdecimal() and S[A] == '-': print('Yes') else: print('No')
p02642
s082718438
Accepted
n = int(input()) a = list(map(int, input().split())) cnt = [0] * ((10 ** 6) + 1) for elem in a: cnt[elem] += 1 unique = [] for i in range((10 ** 6) + 1): if cnt[i] == 1: unique.append(i) cnt = [0] * ((10 ** 6) + 1) a = list(set(a)) for elem in a: for m in range(elem * 2, (10 ** 6) + 1, elem): cnt[m] = 1 ans = 0 for elem in unique: if cnt[elem] == 0: ans += 1 print(ans)
p03854
s214022335
Accepted
S = input() T = ["dream", "dreamer", "erase", "eraser"] S = S[::-1] for i in range(4): T[i] = T[i][::-1] can = True i = 0 while i < len(S): can2 = False for t in T: if S[i:i + len(t)] == t: can2 = True i += len(t) - 1 if can2 == False: can = False break i += 1 if can: print("YES") else: print("NO")
p02748
s321391181
Accepted
#B #入力 A,B,M=map(int,input().split()) a=list(map(int,input().split())) b=list(map(int,input().split())) d=[list(map(int,input().split())) for i in range(M)] #処理 x=min(a)+min(b) for i in d: t=a[i[0]-1]+b[i[1]-1]-i[2] if t<x: x=t print(x)
p03457
s688168933
Accepted
N = int(input()) pt, px, py = 0, 0, 0 can = True for i in range(N): t, x, y = map(int, input().split()) T, X, Y = t - pt, abs(x - px), abs(y - py) if T < X + Y or T % 2 != (X + Y) % 2: can = False pt, px, py = t, x, y print('Yes' if can else 'No')
p02860
s060387724
Wrong Answer
b=int(input()) a=input() c=[] for i in range(b): c.append(a[i]) #a = list(map(int,input().split())) #b = list(map(int,input().split())) d = b/2-1 e = b/2 if b==1: print("No") elif c[:3]==c[3:]: print("Yes") else: print("No")
p03076
s274936986
Accepted
x = [int(input()) for _ in range(5)] res = [] diff = [] for i in range(5): tmp = 0 if(x[i] % 10 == 0): tmp = (x[i] // 10) * 10 else: tmp = (x[i] // 10 + 1) * 10 res.append(tmp) diff.append(tmp - x[i]) print(sum(res) - max(diff))
p03796
s259514074
Accepted
N = int(input()) ans = 1 for i in range(1, N+1): ans = i * ans % (10**9+7) print(ans)
p02576
s677652958
Accepted
import sys sys.setrecursionlimit(10**7) def input(): return sys.stdin.readline().rstrip() def main(): N, X, T = map(int, input().split()) c = 0 t = 0 while c < N: c += X t += T print(t) if __name__ == '__main__': main()
p03017
s799372281
Wrong Answer
N,A,B,C,D = map(int, input().split()) S = input() if "##" in S: print("No") elif D < C and ("..." not in S[B-2:]): print("No") else: print("Yes")
p02572
s989329031
Accepted
n = int(input()) a = list(map(int, input().split())) ans = sum(a) ** 2 for i in a: ans -= i ** 2 print((ans // 2) % (10 ** 9 + 7))
p03479
s236004150
Wrong Answer
x, y = (int(x) for x in input().split()) from numpy import log2 ans = int(log2(y/x)) + 1 print(ans)
p02897
s139490061
Wrong Answer
n=int(input()) answer = 0 if n%2 == 0: answer = 1/(n//2) else: answer = 1/(n//2+1) print(answer)
p03017
s027134619
Accepted
import sys, math from functools import lru_cache from itertools import accumulate sys.setrecursionlimit(10**9) MOD = 10**9+7 def input(): return sys.stdin.readline()[:-1] def mi(): return map(int, input().split()) def ii(): return int(input()) def i2(n): tmp = [list(mi()) for i in range(n)] return [list(i) for i in zip(*tmp)] N, A, B, C, D = mi() S = input() f = (not '##' in S[A-1:C]) and (not '##' in S[B-1:D]) if C > D: f = f and ('...' in S[B-2:D+1]) print('Yes' if f else 'No')
p02922
s319325402
Accepted
A, B = map(int, input().split()) # A*x-(x-1) >= B # (A-1)*x >= B-1 # x >= ceil((B-1)/(A-1)) print(-(-(B-1)//(A-1)))
p02727
s782821278
Wrong Answer
import heapq 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.sort(); q.sort(); r.sort(); p.reverse(); q.reverse(); r.reverse(); ans = [sum(p[:X]) + sum(q[:Y])] que = [] for pi in p: heapq.heappush(que, pi) for qi in q: heapq.heappush(que, qi) for i in range(min(C, X + Y + 1)): minimum = heapq.heappop(que) ans.append(ans[-1] - minimum + r[i]) print(max(ans))
p02910
s411994160
Accepted
s = input() odd = ["R", "U", "D"] even = ["L", "U", "D"] isYes = True for i in range(len(s)): if i % 2 == 0: if s[i] not in odd: isYes = False break elif i % 2 != 0: if s[i] not in even: isYes = False break if isYes: print("Yes") else: print("No")
p02819
s220385277
Wrong Answer
x = int(input()) for val in range(x, x**1000) : if x ==2 : print(x) break elif ((2** val) % val) == 2 : print (val) break else : continue
p02842
s554051334
Wrong Answer
import math n=int(input()) for i in range(n): if math.floor(i*1.08)==n: print(i) break elif math.floor(i*1.08)>n: print(":(") break
p03994
s309669283
Accepted
s = input() K = int(input()) alpha = "abcdefghijklmnopqrstuvwxyz" inv_alpha = "azyxwvutsrqponmlkjihgfedcb" D = {inv_alpha[i]: i for i in range(26)} n = len(s) for i in range(n): if i == n - 1: x = K % 26 print(alpha[(26-D[s[i]]+x)%26], end = '') else: if K >= D[s[i]]: K -= D[s[i]] print('a', end = '') else: print(s[i], end = '') print()
p03339
s251958255
Wrong Answer
n = int(input()) s = input() cnt = [0]*n for i in range(n): cnt[i] = s[0:i].count("w") + s[i+1:n].count("e") print(min(cnt))
p02594
s844127249
Wrong Answer
X=int(input('X=')) if X>=30: print('Yes') else: print('No')
p02597
s171796437
Wrong Answer
n=int(input()) c=list(input()) f=0 f2=0 wcnt=0 wcnt2=0 rcnt=0 cnt=0 for i in range(n): if f and c[i]=="R": cnt+=1 if c[i]=="R": f=1 rcnt+=1 if c[i]=="W": wcnt2+=1 if f==0 and c[i]=="W": wcnt+=1 ans=[rcnt,wcnt2] if cnt>=wcnt: ans.append(cnt) print(min(ans))