problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03030
s570198386
Accepted
from collections import defaultdict n = int(input()) restaurants = defaultdict(list) for i in range(n): s, p = input().split() p = int(p) restaurants[s].append([p, i]) cnt = 0 for k, v in sorted(restaurants.items(), key=lambda x: x[0]): for p, i in sorted(v, key=lambda x: -x[0]): print(i + 1)
p02787
s306853979
Accepted
def run(): H, N = map(int, input().split()) ab_li = [tuple(map(int, input().split())) for n in range(N)] dp = [0]*(H+1) for i in range(1, H+1): new_li = [] for n in range(N): a, b = ab_li[n] if a <= i: new_li.append(dp[i-a]+b) else: new_li.append(b) dp[i] = min(new_li) print(dp[-1]) if __name__ == '__main__': run()
p03434
s620274702
Wrong Answer
n=int(input()) s=list(map(int,input().split())) s=sorted(s) #Alice,Bob a=[] b=[] for i in range(n): if i%2==0: a.append(s[i]) else: b.append(s[i]) print(sum(a)-sum(b))
p02690
s933413846
Accepted
X = int(input()) C = 0 for i in range(-1000,1000): if C == 1: break for j in range(-1000,1000): if i**5-j**5 == X: print(i,j) C += 1 break
p03145
s395767265
Accepted
c,a,b = map(int,input().split()) print(a*c//2)
p03435
s606410083
Accepted
l = [list(map(int, input().split())) for i in range(3)] t = True for i in range(3): if not l[i][0] - l[i-1][0] == l[i][1] - l[i-1][1] == l[i][2] - l[i-1][2] or not l[0][i] - l[0][i-1] == l[1][i] - l[1][i-1] == l[2][i] - l[2][i-1]: t = False if t == True: print("Yes") else: print("No")
p02729
s344908140
Accepted
n,m = map(int, input().split()) ans = (n*(n-1))//2 + (m*(m-1))//2 print(ans)
p02639
s344306428
Accepted
X=list(map(int,input().split())) for i in range(5): if X[i]==0: ans = i+1 print(ans)
p02831
s742772070
Accepted
a,b = map(int,input().split()) import fractions def lcm(x, y): return (x * y) // fractions.gcd(x, y) print(lcm(a, b))
p02957
s503068728
Accepted
def main(): A,B = map(int,input().split()) if ((A+B)/2)%1 != 0: print("IMPOSSIBLE") else: print(int((A+B)/2)) if __name__=="__main__": main()
p02714
s892885880
Accepted
n = int(input()) s = input() r = [] g = [] b = [0]*40000 for i,j in enumerate(s): if j == 'R': r.append(i) if j == 'G': g.append(i) if j == 'B': b[i] += 1 cnt = len(r)*len(g)*sum(b) for i in r: for j in g: if b[2*j-i] == 1 : cnt -= 1 if b[2*i-j] == 1 : cnt -= 1 if (i+j)%2 == 0 and b[(i+j)//2] == 1: cnt -= 1 print(cnt)
p02690
s549788279
Accepted
x = int(input()) for a in range(-118, 120): a_5 = a*a*a*a*a for b in range(-119, 119): b_5 = b*b*b*b*b if a_5 - b_5 == x: print(a, b) break else: continue break
p02817
s181140302
Accepted
s,t = input().split() print(t+s)
p03208
s279851587
Wrong Answer
N, K = map(int, input().split()) h = [int(input()) for _ in range(N)] h.sort() diff = [h[i+1] - h[i] for i in range(N-1)] cost = 10*9 for i in range(len(diff)-((K-1)-1)): cost = min(sum(diff[i:i+K-1]), cost) print(cost)
p03371
s063431997
Accepted
price_A, price_B, price_AB, num_A, num_B = map(int,input().split()) AandB = price_A * num_A + price_B * num_B if num_A >= num_B: minAB = price_AB*num_B*2 + price_A*(num_A-num_B) else: minAB = price_AB*num_A*2 + price_B*(num_B-num_A) maxAB = price_AB * max(num_A, num_B) * 2 print(min(AandB, minAB, maxAB))
p03861
s026946917
Accepted
a,b,x = list(map(int,input().split())) a1 = a//x if a%x else a//x-1 a2 = b//x print(a2-a1)
p04012
s695585577
Accepted
import collections def calc_double(n): return n%2 a=input() b=collections.Counter(a) values=zip(*b.most_common()) c=list(values) e=c[1] d=list(map(int,e)) if sum(map(calc_double,d))==0: print('Yes') else: print('No')
p02873
s003752495
Accepted
s=input() sl=len(s) l=[0 for i in range(sl+1)] for i in range(sl): if s[i]=='<': l[i+1]=max(l[i]+1, l[i+1]) for i in reversed(range(sl)): # reversed(range(sl)) if s[i]=='>': l[i]=max(l[i+1]+1, l[i]) print(sum(l))
p04012
s206879670
Wrong Answer
import sys readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines read = sys.stdin.buffer.read sys.setrecursionlimit(10 ** 7) INF = float('inf') w = input() import collections c = collections.Counter(w) print(c) for k, v in c.items(): if v % 2 != 0: print('No') quit() print('Yes')
p02595
s137086127
Accepted
n,d=map(int,input().split()) ans=0 for i in range(n): x,y=map(int,input().split()) if x**2+y**2<=d**2: ans+=1 print(ans)
p02725
s796264580
Accepted
k,n=list(map(int,input().split())) a=list(map(int,input().split())) a.sort() max_l=0 for i in range(n-1): if(a[i+1]-a[i] > max_l): max_l=a[i+1]-a[i] if(a[0]+(k-a[n-1]) > max_l): max_l=a[0]+(k-a[n-1]) print(k-max_l)
p03910
s958894846
Accepted
n = int(input()) cnt = 0 pbm = 0 for i in range(1, 10**6): cnt += i if cnt >= n: pbm = i break ans = [] for i in range(pbm, 0, -1): if i <= n: ans.append(i) n -= i for i in ans: print(i)
p02765
s214834991
Wrong Answer
a,b=map(int,input().split()) print(b if a>=10 else b+100*(10-b))
p02699
s057828352
Accepted
S, W = [int(_) for _ in input().split()] if W >= S: print("unsafe") else: print("safe")
p03012
s553918804
Accepted
N = int(input()) W = [int(w) for w in input().split()] S1 = 0 S2 = 0 ans = [] for i in range(N): S2 = sum(W) - S1 ans.append(abs(S2 - S1)) S1 = 0 S2 = 0 for j in range(i + 1): S1 += W[j] print(min(ans))
p02838
s703057804
Accepted
def main(): n = int(input()) a = [int(i) for i in input().split()] mod = 10**9 + 7 b = 1 c = 0 for k in range(60): s = sum(ai & b for ai in a) // b c = (c + s * (n - s) * b) % mod b *= 2 print(c) if __name__ == '__main__': main()
p03434
s764701049
Accepted
n=int(input()) a=sorted(list(map(int,input().split())),reverse=True) ans=sum(a[::2])-sum(a[1::2]) print(ans)
p02773
s238459000
Accepted
from collections import defaultdict def main(): N = int(input()) vote = defaultdict(int) for i in range(N): vote[input()] += 1 max_vote = max(vote.values()) new_vote = sorted(list(vote.items()), key= lambda x : x[0]) new_vote = sorted(new_vote, key= lambda x : x[1], reverse = True) for k, v in new_vote: if v == max_vote: print(k) else: break if __name__ == "__main__": main()
p02702
s973877213
Accepted
M=2019;t=1;p=0;c=[0]*M;r=0 for x in(input()+'0')[::-1]:p=(int(x)*t%M+p)%M;r+=c[p];c[p]+=1;t=t*10%M print(r)
p04030
s639235567
Accepted
s = input() ans = "" for i in s: if i == "0": ans += "0" elif i == "1": ans += "1" else: if ans: ans = ans[:-1] print(ans)
p02731
s489858515
Wrong Answer
L = int(input()) ans = 0 for i in range(L): for j in range(L): if i + j <= L: ans = max(ans, i * j * (L - i - j)) print(ans)
p03037
s412203439
Accepted
n,m = map(int, input().split()) a = [list(map(int, input().split())) for _ in range(m)] l_max = 0 r_min = 100000000 for i in range(m): if (l_max < a[i][0]): l_max = a[i][0] for i in range(m): if (r_min > a[i][1]): r_min = a[i][1] print(max(r_min-l_max+1, 0))
p02835
s990306584
Accepted
*a,=map(int,open(0).read().split());print('bwuisnt'[sum(a)<22::2])
p02963
s604501292
Accepted
#!/usr/bin/env python3 s = int(input()) print(10**9, 1*(s<10**18), 10**9 - s%10**9, s // 10**9 + 1*(s<10**18),0,0)
p02842
s495353383
Wrong Answer
import math N = int(input()) a = math.ceil(N/1.08) b = math.floor((N+1)/1.08) tmp = list(range(a,b+1)) print(tmp[0] if tmp else ':(')
p03478
s569011200
Wrong Answer
N,A,B=map(int,input().split()) ans=0 for x in range(1,N+1): temp=0 for y in str(x): temp+=int(y) if temp>=A and temp<=B: ans+=temp print(ans)
p02829
s063474984
Wrong Answer
A = int(input()) B = int(input()) if A != B != 1: print(1) elif A != B != 2: print(2) else: print(3)
p02628
s714685751
Wrong Answer
N, K = map(int, input().split()) p = list(map(int, input().split())) p.sort total=0 for i in range(K): total += p[i] print(total)
p02584
s113669156
Accepted
v = input().split(" ") x = int(v[0]) k = int(v[1]) d = int(v[2]) if (x == 0): if (k % 2 == 0): ans = 0 else: ans = d else: if ((k * d) > abs(x)): y = abs(x) // d ans = abs(abs(x) - y * d) if ((k - y) % 2 == 1): ans = abs(d - ans) else: ans = abs(x) - k * d print(ans)
p04031
s045921246
Wrong Answer
import math import numpy as np n = int(input()) *a, = map(int, input().split()) ave = math.ceil(sum(a)/n) m = int(np.median(a)) ans = [0, 0] for _a in a: ans[0] += (ave-_a)**2 ans[1] += (m-_a)**2 print(min(ans))
p03103
s397092654
Accepted
n, m = map(int, input().split()) l = [] for i in range(n): a = list(map(int, input().split())) l.append(a) l.sort() ans = 0 for i in range(n): if l[i][1] <= m: m -= l[i][1] ans += l[i][0] * l[i][1] else: ans += m * l[i][0] break print(ans)
p03416
s549940321
Accepted
import numpy as np a,b=map(int,input().split()) ans=0 def check(x): s=str(x) for i in range(len(s)): if(s[i]!=s[len(s)-1-i]):return False return True for i in range(a,b+1): if(check(i)):ans+=1 print(ans)
p02691
s152833897
Accepted
n = int(input()) a = list(map(int,input().split())) add1 = [] sub1 = [] for i in range(n): add1.append(a[i] + i) sub1.append(i - a[i]) dict1 = {} dict2 = {} for i in add1: if i in dict1: dict1[i] += 1 else: dict1[i] = 1 for i in sub1: if i in dict2: dict2[i] += 1 else: dict2[i] = 1 ans = 0 for k,v in dict1.items(): if k in dict2: ans += v * dict2[k] print(ans)
p03657
s056829923
Accepted
a, b = map(int, input().split()) if a%3 == 0 or b%3 == 0 or (a+b)%3 == 0: print("Possible") else: print("Impossible")
p02754
s757151973
Accepted
n, a, b = map(int, input().split()) print(n // (a + b) * a + min(a, n % (a + b)))
p02708
s037646564
Wrong Answer
print(1)
p02683
s247416061
Accepted
#C N,M,X = map(int,input().split()) C = [] A = [] for c in range(N): p = list(map(int,input().split())) C.append(p[0]) A.append(p[1:]) minCost = sum(C) exist = False for i in range(2 ** N): rikai = [0] * M cost = 0 for n in range(N): if i >> n & 1 == 0: cost+=C[n] for m in range(M): rikai[m]+=A[n][m] ok = True for m in range(M): if rikai[m] < X: ok = False if ok: exist = True minCost = min(minCost,cost) if exist: print(minCost) else: print(-1)
p02553
s025968424
Accepted
a,b,c,d = map(int, input().split()) print(max(a*c, a*d, b*c, b*d))
p02766
s443329441
Accepted
n, k = map(int, input().split()) ans = '' while n > 0: ans = str(n % k) + ans n //= k print(len(ans))
p02613
s468196192
Wrong Answer
N = int(input()) result=[0,0,0,0] for i in range(N): S=input() if S == "AC": result[0] += 1 elif S == "WA": result[1] += 1 elif S == "TLE": result[2] += 1 else: result[3] += 1 print("AC × " + str(result[0])) print("WA × " + str(result[1])) print("TLE × " + str(result[2])) print("RE × " + str(result[3]))
p02727
s577929874
Accepted
X,Y,A,B,C=list(map(int,input().split())) A_l=list(map(int,input().split())) B_l=list(map(int,input().split())) C_l=list(map(int,input().split())) A_l.sort(reverse=True) B_l.sort(reverse=True) C_l.sort() A_after_l=A_l[:X] B_after_l=B_l[:Y] ans=[A_after_l,B_after_l] ans=sum(ans,[]) ans.sort() import heapq heapq.heapify(ans) for i in C_l: N=heapq.heappop(ans) if N < i: heapq.heappush(ans,i) else: heapq.heappush(ans,N) print(sum(ans))
p03030
s938211870
Wrong Answer
N = int(input()) SP = [input().split() for _ in range(N)] for k in range(N): City = "zzzzzzzzzzzzzz" Point = 0 Num = 0 for i in range(len(SP)): if SP[i][0] < City: City = SP[i][0] for j in range(len(SP)): if SP[j][0] == City and int(SP[j][1]) > Point: Point = int(SP[j][1]) Num = j print(Num+1) SP[Num][0] = "zzzzzzzzzzzzzzzzz" SP[Num][1] = 0
p03250
s865107279
Wrong Answer
a,b,c=map(int,input().split()) print(max([a*10+b+c,a+b*10+c]))
p03041
s248607613
Wrong Answer
S = input() l, r = int(S[:2]), int(S[2:]) if 0<l<13 and 0<r<13: print("AMBIGUOUS") elif 0<l<13: print("MMYY") elif 0<r<13: print("YYMM") else: print("NA")
p02624
s635699063
Accepted
n=int(input()) ans=0 for i in range(1,n+1): k=n//i ans=ans+i*k*(k+1)//2 print(ans)
p02897
s005100945
Wrong Answer
n = int(input()) if n > 1: print( int(n/2) / n ) else: print(1)
p03951
s831160454
Wrong Answer
N = int(input()) s = input() t = input() ans = N*2 for n in range(N): if s[n:] == t[:N-n]: ans -= len(s[n:]) print(ans)
p03556
s087237924
Accepted
n = int(input()) for i in range(1,n+1): if(i**2 > n): print((i-1)**2) quit() print(1)
p03761
s508771238
Accepted
# solution import math import io import string data = int(input()) array = [input().rstrip() for _ in range(data)] sets = {c: [] for c in string.ascii_lowercase} for i in range(data): for c in string.ascii_lowercase: k = array[i].count(c) sets[c].append(k) strs = '' for c in string.ascii_lowercase: strs += c * min(sets[c]) print(strs)
p03286
s983257874
Accepted
n=int(input()) x="" while n!=0: x=str(n%2)+x n=-(n//2) print(0 if x=="" else x)
p02924
s455412190
Accepted
N = int(input()) print(N*(N-1)//2)
p03456
s612384817
Wrong Answer
a, b = map(int, input().split()) ab = a*10+b ans = 'No' for i in range(1, 101): if i*i == ab: ans='Yes' break print(ans)
p02785
s840200468
Accepted
N, K = map(int, input().split()) H = list(map(int, input().split())) H.sort(reverse=True) print(sum(H[K:]))
p03163
s110848015
Accepted
import sys def input(): return sys.stdin.readline().strip() def main(): # i have too make index as weight and value as value import numpy as np N, W = map(int, input().split()) dp = np.zeros(W + 1, int) for i in range(N): w, v = map(int, input().split()) np.maximum(dp[:-w] + v, dp[w:], out=dp[w:]) # print(dp[:-w],dp[w:] ) print(dp[-1]) if __name__ == "__main__": main()
p03261
s911769943
Accepted
n=int(input()) a=[] for i in range(n): a.append(input()) frag='Yes' for i in range(n): if a.count(a[i])!=1: frag='No' break for i in range(n-1): if a[i][-1]!=a[i+1][0]: frag='No' break print(frag)
p03254
s613156843
Accepted
n, x = map(int, input().split()) a = sorted(map(int, input().split())) ans = 0 for i in range(n): x -= a[i] if x < 0: break if i == n-1: if x > 0: break ans += 1 print(ans)
p03264
s814251956
Accepted
k = int(input()) even = k // 2 odd = k - even print(even * odd)
p03017
s884580974
Wrong Answer
n, a, b, c, d = map(int, input().split()) s = input() ans = 'Yes' if s.find('##') > -1: ans = 'No' else: if d < c: if s[b-1:d].find('...') == -1: ans = 'No' print(ans)
p04020
s982399897
Accepted
N = int(input()) A = [0] + [int(input()) for _ in range(N)] ans = 0 for i in range(1,N+1): if A[i] != 0: ans += A[i-1] A[i] -= A[i-1] ans += A[i]//2 A[i] = A[i]%2 print(ans)
p02743
s384207485
Accepted
#import sys #import numpy as np import math #from fractions import Fraction import itertools from collections import deque from collections import Counter #import heapq #from fractions import gcd #input=sys.stdin.readline import bisect a,b,c=map(int,input().split()) if 4*a*b<(c-a-b)**2 and (c-a-b)>0: print("Yes") else: print("No")
p03150
s519131461
Accepted
# Problem B - KEYENCE String # input s = input() s_l = len(s) # initialization is_ok = False # check for i in range(s_l): for j in range(i, s_l): tmp_s = s[:i] + s[j:] if tmp_s=='keyence': is_ok = True break # output if is_ok: print("YES") else: print("NO")
p03745
s393947432
Wrong Answer
N=int(input()) A=input() flag = [] for i in range(N-1): if A[i]<=A[i+1]: flag.append(1) elif i>0 and A[i]==A[i+1]: flag.append(flag[i-1]) else: flag.append(-1) ans = 1 c = 1 for i in range(N-2): if flag[i]!=flag[i+1] and c!=0: ans+=1 c=0 else: c+=1 print(ans)
p02801
s633038732
Accepted
#!/usr/bin/env python3 c = input() c = ord(c) + 1 print(chr(c))
p02700
s216354509
Wrong Answer
S_list = list(map(int,input().split())) A,B,C,D = S_list takahashi ,aoki = A, C while takahashi > 0 or aoki > 0: aoki = aoki - B if aoki <=0: break takahashi = takahashi - D if takahashi > aoki: result = "Yes" else: result = "No" print(result)
p03817
s666873875
Wrong Answer
x = int(input()) if 7 <= x <= 11: print(2) elif x <= 6: print(1) else: a, b = divmod(x, 11) if b == 0: print(2*a) else: print(2*a+1)
p03719
s793493178
Accepted
line = input().split() l = [int(s) for s in line] if -100 <= l[0] <= l[2] <= l[1]<=100: print("Yes") else: print("No")
p02813
s080997957
Wrong Answer
input() s1 = input().split(" ") s2 = input().split(" ") ss1 = [int(i) for i in s1] ss2 = [int(i) for i in s2] import itertools a=0 b=0 c = 0 for i in itertools.permutations([int(i) for i in range(1,9)]): c+=1 if list(i) == ss1: a=c if list(i) == ss2: b=c print(abs(a-b))
p02801
s256099524
Accepted
C=input() uni_num = ord(C) print(chr(uni_num+1))
p02645
s064455921
Accepted
name = input() print(name[:3])
p03387
s732361668
Accepted
A = [int(x) for x in input().split()] A.sort() reg = 0 diff_1 = (A[2] - A[0]) // 2 reg += diff_1 diff_2 = (A[2] - A[1]) // 2 reg += diff_2 A[0] += 2 * diff_1 A[1] += 2 * diff_2 A.sort() if A[0]==A[1]==A[2]: print(reg) elif A[0]==A[1]: print(reg+1) else: print(reg+2)
p03639
s458948624
Accepted
n = int(input()) a = list(map(int, input().split())) cnt2 = sum(i % 4 == 2 for i in a) cnt4 = sum(i % 4 == 0 for i in a) print('Yes 'if n <= 2 * cnt4 + max(1, cnt2) else 'No')
p03633
s764843872
Accepted
from fractions import gcd def lcm(a,b): return a*b//gcd(a,b) N=int(input()) ans=1 for i in range(N): t=int(input()) ans=lcm(ans,t) print(ans)
p03555
s856307271
Accepted
c1 = input() c2 = input() if c1 == c2[::-1]: print('YES') else: print('NO')
p02606
s947585030
Accepted
l,r,d = map(int,input().split()) ans = 0 for i in range(l,r+1): if i%d == 0: ans += 1 print(ans)
p03281
s783087740
Accepted
def make_divisors(n): divisors = [] for i in range(1, int(n**0.5)+1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n//i) divisors.sort() return divisors n=int(input()) if n<105: print(0) exit() ans=1 for i in range(106,n+1): if i%2==0: continue l=make_divisors(i) if len(l)==8: ans+=1 print(ans)
p02627
s620808059
Accepted
def main(): alpha = input() if alpha.isupper(): print('A') else: print('a') if __name__ == '__main__': main()
p04019
s218173708
Wrong Answer
S = input().strip() C = {"N":0,"S":0,"E":0,"W":0} for i in range(len(S)): C[S[i]] += 1 if C["N"]==C["S"] and C["E"]==C["W"]: print("Yes") else: print("No")
p02785
s780924127
Accepted
N, K = map(int, input().split()) H_list = list(map(int, input().split())) H_list = list(reversed(sorted(H_list))) H_list = H_list[K:] print(sum(H_list))
p03481
s588776394
Accepted
x,y=map(int,input().split()) ans = 0 while x<=y: ans += 1 x *=2 print(ans)
p04045
s403386104
Wrong Answer
n,k = map(int,input().split()) d = list(map(str, input().split())) while True: print([i in d for i in list(str(n))]) if sum([i in d for i in list(str(n))]) == 0: print(n) break n+= 1
p03494
s129896595
Accepted
# -*- coding: utf-8 -*- N = int(input()) A = [int(i) for i in input().split()] ans = [] for i in range(N): count = 0 while True: if A[i] % 2 != 0: ans.append(count) break else: A[i] /= 2 count += 1 print(min(ans))
p03637
s190049020
Wrong Answer
n = int(input()) a = list(map(int, input().split())) cnt2 = 0 cnt4 = 0 for i in range(n): if(a[i] % 4 == 0): cnt4 += 1 elif(a[i] % 2 == 0): cnt2 += 1 if((cnt4 * 2 + 1) >= n or cnt2 >= (n - (cnt4 * 2 + 1) + (cnt4 > 0))): print("Yes") else: print("No")
p02881
s728809328
Wrong Answer
import math minimum = 10**14 def prime_divisors(X): L=[] for i in range(2,math.floor(X**0.5)): if X % i == 0: L.append(i) return L N = int(input()) L = prime_divisors(N) L.append(1) for prime in L: if (prime-1 + N//prime - 1) < minimum: minimum = (prime-1 + N//prime - 1) print(minimum)
p02860
s245108677
Accepted
n=int(input()) s=input() if n%2==1: print("No") else: if s[0:(n//2)]==s[n//2:(n+1)]: print ("Yes") else: print("No")
p03219
s574473725
Accepted
X,Y = map(int,input().split()) print(int(X + Y/2))
p03417
s607553954
Accepted
n, m = map(int,input().split()) if m >= 3 and n >= 3: print((m-2) * (n-2)) elif (m == 2 or n == 2): print(0) elif m >= 3 or n >= 3: print((max(m,n)-2) * min(m,n)) else: if (m * n) % 2 == 0: print(0) else: print(m * n)
p03493
s524774992
Accepted
s = list(input()) print(s.count('1'))
p02570
s852345090
Wrong Answer
# -*- coding: utf-8 -*- D, T, S = map(int, input().split()) #print(D, T, S) t = D/S if t <= T: print('yes') else: print('no')
p02618
s816075082
Accepted
# -*- coding: utf-8 -*- D = int(input()) c = [int(i) for i in input().split()] s = [] for i in range(D): s.append([int(j) for j in input().split()]) for i, s_i in enumerate(s): print(s_i.index(max(s_i)) + 1)
p02597
s507427428
Wrong Answer
# -*- coding: utf-8 -*- N=int(input()) C=input() J=0 ans=0 for i in range(N): if C[i]=="W": for j in range(J,N): if i+j>N:break if C[N-1-j]=="R": ans+=1 #print(i,N-1-j) J=j+1 break if i+J>N:break print(ans)