problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03075
s058761285
Wrong Answer
a,b=5,10 for i in range(5): i=int(input()) a+=(i-1)//10 if 0<i%10<b: b=i%10 print(a*10-(10-b))
p03319
s869206567
Wrong Answer
from math import ceil def myAnswer(N:int,K:int,A:list) -> int: if(N == K): return 1 total = K *ceil(N/K) - (ceil(N/K) - 1) ans = ceil(N/K) # print(total,ans) if(total < N): ans += 1 return ans def modelAnswer(): return def main(): N,K = map(int,input().split()) A = list(map(int,input()...
p03524
s424075648
Accepted
s = str(input()) if len(s) == 1: print('YES') exit() d = {} for i in range(len(s)): if s[i] not in d: d[s[i]] = 1 else: d[s[i]] += 1 #print(d) if len(s) == 2 and len(d) == 2: print('YES') exit() if len(d) > 2: if max(d.values())-min(d.values()) <= 1: print('YES') ...
p02832
s906026349
Accepted
n=int(input()) A=list(map(int,input().split())) if 1 not in A: print(-1) exit() bef=1 ans=0 for i in A: if i==bef: bef+=1 else: ans+=1 print(ans)
p04043
s252883481
Wrong Answer
import sys, math def input(): return sys.stdin.readline()[:-1] def main(): A = list(map(int,input().split())) if A.count(5) == 2 and A.count(7) == 1: print("Yes") else: print("No") if __name__ == '__main__': main()
p02630
s443085921
Accepted
from math import * from collections import * n=int(input()) a=list(map(int,input().split())) f=Counter(a) q=int(input()) r=sum(a) for i in range(q): b,c=map(int,input().split()) re=f[b] del f[b] if(c in f): f[c]+=re else: f[c]=re r+=(c-b)*re print(r)
p02795
s113427788
Accepted
import math H = int(input()) W = int(input()) N = int(input()) print(math.ceil (N / max(H, W)))
p03250
s862197115
Accepted
v = sorted([int(i) for i in input().split()]) print(v[2]*10+v[1]+v[0])
p03379
s053040540
Accepted
import copy N = int(input()) list_x = list(map(int,input().split())) sorted_x = copy.copy(list_x) sorted_x.sort() L = sorted_x[(N-1)//2] M = sorted_x[(N+1)//2] base = (L+M)/2 for i in list_x: if i >= base: print(L) else: print(M)
p03633
s696477098
Accepted
from fractions import gcd from functools import reduce def lcm(a,b): return (a*b)//gcd(a,b) def lcm_list(l): return reduce(lcm, l) def solve(): N = int(input()) T = [int(input()) for _ in range(N)] print(lcm_list(T)) solve()
p02995
s197672012
Accepted
a,b,c,d = map(int,input().split()) e = b - a + 1 ans_ca = a//c ans_cb = b//c ans_c = ans_cb - ans_ca if a%c== 0: ans_c += 1 ans_da = a//d ans_db = b//d ans_d = ans_db - ans_da if a%d == 0: ans_d += 1 x = c y = d for i in range(b): n = y%x if n == 0: break y = x x = n z = int(c*d/x) ans_cda = a//z an...
p02706
s986611526
Accepted
n,m=map(int,input().split()) L=list(map(int,input().split())) total = sum(L) ans = n-total if ans <0: print(-1) else: print(ans)
p02754
s741592134
Wrong Answer
N, A, B = map(int, input().split()) print(A * N // (A + B) + min(A, N % (A + B)))
p04033
s987955224
Accepted
a, b = map(int, input().split()) if a <= 0 <= b: print("Zero") elif 0 < a <= b: print("Positive") elif a < 0 and 0 < b: if a % 2 == 0: print("Positive") else: print("Negative") else: if (b - a) % 2 == 0: print("Negative") else: print("Positive")
p02910
s348971198
Accepted
s = str(input()) odd = ['R', 'U', 'D'] even = ['L', 'U', 'D'] flag = True for i in range(len(s)): if i%2==1: if s[i] not in even: flag = False break elif i%2==0: if s[i] not in odd: flag = False break if flag: print('Yes') else: print('...
p03659
s527815445
Accepted
# coding: utf-8 # Your code here! N=int(input()) A=list(map(int,input().split())) me=A[0] you=sum(A)-A[0] ans=abs(me-you) for i in range(1,N-1): me+=A[i] you-=A[i] ans=min(ans,abs(me-you)) print(ans)
p02838
s156834431
Accepted
import numpy as np n = int(input()) mod = 10**9+7 a = np.array(list(map(int,input().split()))) ans = 0 for i in range(60): #aをiビット右にずらす、iは60桁目まで、&1で対象のビットが1のもの以外を0にその数をカウントする。 b = np.count_nonzero(a >>i&1) ans += ((2**i)*(n-b)*b)%mod print(ans%mod)
p03386
s281901509
Wrong Answer
A, B, K = map(int, input().split()) for i in range(A , A + K): print(i) for j in range(B - K + 1, B + 1): print(j)
p03665
s322308186
Accepted
def main(): import math n,p=map(int,input().split()) a=list(map(int,input().split())) x=[i for i in a if i%2==0] y=[i for i in a if i%2==1] def comb(n,r): return math.factorial(n)//(math.factorial(r)*math.factorial(n-r)) xl,yl=len(x),len(y) ans=0 for i in range(xl+1): for j in range(y...
p02683
s781565386
Accepted
n,m,x = map(int,input().split()) c = [[int(i) for i in input().split()] for _ in range(n)] inf = float("inf") ans = inf for i in range(1<<n): cnt = [0]*m cost = 0 for j in range(n): if i >> j & 1: cost += c[j][0] for k in range(1,m+1): cnt[k-1] += c[j][k] ...
p03379
s743136001
Wrong Answer
n = int(input()) x = sorted(list(map(int, input().split()))) def median(l): i = ((len(l)+1)//2) - 1 return l[i] for i in range(len(x)): print(median(x[:i] + x[i+1:]))
p03607
s065895509
Accepted
N = int(input()) A = [int(input()) for _ in range(N)] dic = {} for i in range(N): if A[i] in dic.keys(): dic[A[i]] += 1 else: dic[A[i]] = 1 cnt = 0 for j in dic.keys(): if dic[j] % 2 == 1: cnt += 1 print(cnt)
p03835
s019513815
Wrong Answer
import itertools s,k = map(int,input().split()) permutations_lis = list(itertools.product(range(k),repeat=3)) cnt = 0 for i in permutations_lis: if i[0] + i[1] + i[2] == s: cnt += 1 print(cnt)
p02918
s071231836
Accepted
from itertools import groupby N,K = map(int,input().split()) S = input() gnum = len(list(groupby(S))) if gnum<=2*K-1: print(N-1) else: print(min(N-(gnum-2*K),N-1))
p03745
s970483718
Wrong Answer
N = int(input()) A = list(map(int,input().split())) i = 1 cnt = 0 while i < N-1: if A[i-1] <= A[i] <= A[i+1] or A[i-1] >= A[i] >= A[i+1]: i += 1 continue else: cnt += 1 i += 2 print(cnt+1)
p03795
s299025369
Accepted
import sys input = sys.stdin.readline sys.setrecursionlimit(10 ** 6) # MOD = 10 ** 9 + 7 # INF = float("inf") def main(): n = int(input()) x = n * 800 y = (n // 15) * 200 print(x - y) if __name__ == '__main__': main()
p02602
s874057696
Accepted
NK = list(map(int, input().split(' '))) N = NK[0] K = NK[1] A = list(map(int, input().split(' '))) for i in range(K, N): if (A[i-K] < A[i]): print('Yes') else: print('No')
p02756
s676013538
Accepted
import collections s = collections.deque(list(input())) q = int(input()) cnt = 0 for i in range(q): fc = input().split() if fc[0] == '1': cnt += 1 else: if cnt == 1: fc[1] = '1' if fc[1] == '2' else '2' if fc[1] == '1': s.appendleft(fc[2]) else: ...
p02866
s972255404
Wrong Answer
N=int(input()) D=list(map(int,input().split())) if D[0]!=0: print(0) exit() B=[0]*N for d in D: B[d]+=1 if B[0]!=1: print(0) exit() ans=1 for i in range(1,N): if B[i]==0:break ans*=B[i-1]**B[i] print(ans)
p03360
s936345017
Wrong Answer
A, B, C = map(int, input().split()) K = int(input()) print(A + B + C - max(A, B, C) + max(A, B, C) ** K)
p03544
s995937790
Accepted
n=int(input()) a=2 b=1 if n==1: print(1) else: for i in range(n-1): if i%2==0: a=a+b else: b=a+b print(max(a,b))
p02705
s508939870
Wrong Answer
# -*- coding: utf-8 -*- R = int(input()) print(R * 3.141592)
p02547
s934219732
Wrong Answer
n = int(input()) d = [tuple(map(int, input().split())) for _ in range(n)] ans=0 for k in d: if k[0] == k[1]: ans+=1 print("YNeos"[ans<3::2])
p03264
s825648393
Accepted
from itertools import combinations # input K = int(input()) # check cnt = len( [ 1 for c in list(combinations(list(range(1, K + 1)), 2)) if (c[0] + c[1]) % 2 == 1 ] ) print(cnt)
p03264
s097599116
Accepted
k = int(input()) a = (k // 2) * ((k + 1) // 2) print(a)
p02725
s021384148
Wrong Answer
K,N=map(int,input().split()) l=list(map(int,input().split())) l.sort() d1=l[len(l)-1]-l[0] for j in range(len(l)): if l[j]>K/2: l[j]-=K l.sort() d2=l[len(l)-1]-l[0] print(min(d1,d2))
p03449
s649314093
Accepted
n=int(input()) a1=list(map(int,input().split())) a2=list(map(int,input().split())) S=[0]*n for i in range(n): S[i]=sum(a1[0:i+1])+sum(a2[i:n]) print(max(S))
p02697
s475508579
Accepted
def main(): n, m = map(int, input().split()) p = (m+1)//2 q = m//2 l = 0 r = 2*p-1 for i in range(p): print(l+1, r+1) l += 1 r -= 1 l = 2*p r = l+2*q for i in range(q): print(l+1, r+1) l += 1 r -= 1 main()
p03494
s118999020
Wrong Answer
N = int(input()) A = list(map(int,input().split())) cnt=0 for i in range(N): #print(cnt) if all(A) % 2 == 0: A = list(map(lambda x: x/2,A)) #print(A) else: break cnt += 1 print(cnt)
p02578
s639034938
Accepted
import sys input = sys.stdin.readline N = int(input()) L = list(map(int, input().split())) if N == 1: print(0) else: x = 0 for i in range(0,len(L)-1): if L[i] > L[i + 1]: x = x + (L[i] - L[i + 1]) L[i + 1] = L[i + 1] + (L[i] - L[i + 1]) print(x)
p02780
s573397222
Accepted
N, K = map(int, input().split()) P = list(map(int, input().split())) Pe = [(i+1)/2 for i in P] maxsum = -1 cur = sum(Pe[0:K]) maxsum = cur for i in range(1, N-K+1): cur = cur - Pe[i-1] + Pe[i+K-1] if cur > maxsum: maxsum = cur print(maxsum)
p02829
s935571108
Accepted
a, b = [int(input().strip()) for i in range(2)] ans = {1, 2, 3} ans.remove(a) ans.remove(b) a = ans.pop() print(a)
p02951
s027741062
Wrong Answer
a, b, c = map(int, input().split()) print(min(a, b+c))
p02973
s235082286
Wrong Answer
# https://atcoder.jp/contests/abc134/tasks/abc134_e  from bisect import bisect_left N = int(input()) A = [int(input()) for _ in range(N)] LIS = [A[0]] cnt = 0 for a in A: if a > LIS[-1]: LIS.append(a) else: ind = bisect_left(LIS, a) LIS[ind] = a if ind == 0: cnt ...
p02641
s895557838
Accepted
x,n=map(int,input().split()) if n==0: print(x) else: plist=list(map(int,input().split())) if x not in plist: print(x) else: for i in range(100000): if x-i-1 not in plist: print(x-i-1) break elif x+i+1 not in plist and x-i-1 in plist: print(x+i+1) break ...
p03067
s668060848
Accepted
A, B, C = map(int, input().split()) print("Yes" if A<C<B or B<C<A else "No")
p03711
s587290581
Accepted
x,y=map(int,input().split()) a=[1,3,5,7,8,10,12] b=[4,6,9,11] c=[2] if ((x in a)and(y in a))\ or((x in b)and(y in b))\ or((x in c)and(y in c)): print('Yes') else: print('No')
p03387
s634578192
Accepted
A, B, C = map(int, input().split()) if (3 * max(A, B, C) - (A + B + C)) % 2 == 0: print((3 * max(A, B, C) - (A + B + C)) // 2) else: print((3 * max(A, B, C) - (A + B + C)) // 2 + 2)
p02785
s014280567
Accepted
N, K = map(int, input().split(' ')) H_list = list(map(int, input().split(' '))) H_list.sort(reverse = True) del H_list[0:K] print(sum(H_list))
p02707
s239100122
Accepted
import collections n=int(input()) a=list(map(int,input().split())) c=collections.Counter(a) for x in range(1,n+1): print(c[x])
p02584
s042376518
Wrong Answer
x,k,d=[int(i) for i in input().strip().split(" ")] if x//d>=k: print(x-d*k) else: if (k-x//d)%2==0: print(x%d) else: print(d-(x%d))
p04012
s799416159
Accepted
w = input() dict_ = {} for i in w: dict_.setdefault(i, 0) dict_[i] +=1 flg = True for v in dict_.values(): if v % 2 != 0: flg = False break if flg: print("Yes") else: print("No")
p02623
s476252625
Accepted
N, M, K = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) a, b = [0], [0] for i in range(N): a.append(a[i] + A[i]) for i in range(M): b.append(b[i] + B[i]) ans, j = 0, M for i in range(N + 1): if a[i] > K: break while b[j] > K - a[i]: j -= 1 ...
p03720
s782474329
Accepted
n,m = map(int,input().split()) ans = [0] * n for i in range(m): a,b = map(int, input().split()) ans[a-1] += 1 ans[b-1] += 1 for x in ans: print(x)
p02958
s103891744
Wrong Answer
n = int(input()) p = list(map(int, input().split())) a = range(1, n+1) count = n for i in range(n): if p[i]==a[i]: n -= 1 if n==2 or n==0: print("Yes") else: print("No")
p02836
s995027537
Accepted
INT = lambda: int(input()) INTM = lambda: map(int,input().split()) STRM = lambda: map(str,input().split()) STR = lambda: str(input()) LIST = lambda: list(map(int,input().split())) LISTS = lambda: list(map(str,input().split())) def do(): s=STR() l=len(s) ct=0 for i in range(l//2): if s[i]!=s[-1-i...
p02862
s554855128
Accepted
from functools import reduce x,y=list(map(int,input().split())) mod = 10 ** 9 + 7 if (2 * y - x) % 3 != 0 or (2 * x - y) % 3 != 0: print("0") exit() a,b = (2 * y - x) // 3, (2 * x - y) // 3 r = min(a,b) if r == 0: print("1") elif r < 0: print("0") else: numerator = reduce(lambda x, y: x * y % mod, ran...
p02909
s963364571
Wrong Answer
print('CRSlauoinunndyyy'[id(id)%3::3])
p02772
s088778531
Wrong Answer
n = int(input()) li = list(map(int,input().split())) flag = 0 for i in range(n): if(li[i] % 2 == 0): if((li[i] % 3 == 0) or(li[i] % 5 == 0)): flag=1 else: flag=0 break else: flag=0 if(flag == 1): print('APPROVED') else: print('DENIED')
p02727
s661839327
Wrong Answer
x,y,a,b,c=map(int,input().split()) P=sorted(list(map(int,input().split())))[::-1] Q=sorted(list(map(int,input().split())))[::-1] R=sorted(list(map(int,input().split())))[::-1]+[0]*(max(x+y-c,0)) L=sorted(P[:x]+Q[:y])[::-1] l=r=0 for i in range(x+y): if r+R[i]<l+L[-i-1]: print(sum(L[:x+y-i]+sorted(L[x+y-i:]...
p03105
s874548880
Wrong Answer
A,B,C = map(int,input().split()) print(max(B//A,C))
p02612
s045856377
Accepted
import math n = int(input()) time = math.ceil(n / 1000) ans = (time * 1000) - n if ans <= 0: print(0) else: print(ans)
p02951
s348204905
Accepted
A, B, C = map(int, input().split()) limit = A - B res = C - limit if res < 0: print(0) else: print(res)
p02613
s155362346
Accepted
n = int(input()) d = { 'AC': 0, 'WA': 0, 'TLE': 0, 'RE': 0 } for i in range(n): d[input()] += 1 print('{} x {}'.format('AC', d['AC'])) print('{} x {}'.format('WA', d['WA'])) print('{} x {}'.format('TLE', d['TLE'])) print('{} x {}'.format('RE', d['RE']))
p03146
s875781495
Accepted
url = "https://atcoder.jp//contests/abc116/tasks/abc116_b" def calc(n): if n % 2 == 0: return n // 2 else: return 3 * n + 1 def main(): s = int(input()) ans = [s] while True: tmp = calc(ans[-1]) ans.append(tmp) if ans.index(tmp) != len(ans)-1: ...
p02779
s147523860
Accepted
def resolve(): N=int(input()) S=len(set(map(int,input().split()))) print("YES" if N==S else "NO") if __name__ == "__main__": resolve()
p03804
s005891630
Wrong Answer
n, m = map(int, input().split()) for i in range(n): a = input() for j in range(m): b = input() if b in a: print('Yes') elif b == a: print('Yes') else: print('No')
p02694
s189884162
Wrong Answer
k=int(input()) x=100 count=0 while True: x+=(x/100) count+=1 if (x>k) or (x==k): break print(count)
p04030
s104930070
Accepted
s=input() def solution(s): new = [] for c in s: if c == '0': new.append('0') elif c == '1': new.append('1') elif c == 'B': try: new.pop() except: pass newnew = ''.join(new) return newnew print(soluti...
p03796
s817456169
Accepted
n = int(input()) pwr = 1 for i in range(n): pwr *= 1*(i+1) pwr = pwr%(10**9+7) print(pwr)
p02596
s019083426
Wrong Answer
k = int(input()) def k_multipul_at(k: int) -> int: r = 7 % k cache = [r, 0] i = 1 while r not in cache: r = (r * (10 % k) + 7 % k) % k cache.append(r) i += 1 return -1 if r else i print(k_multipul_at(k))
p03555
s200114413
Accepted
li1= list(input()) li2= list(input()) if (li1[0]==li2[2])&(li1[1]==li2[1])&(li1[2]==li2[0]): print("YES") else: print("NO")
p03773
s215571612
Wrong Answer
a, b = map(int, input().split()) print(a%24+b)
p02879
s805484349
Accepted
a, b = map(int, input().split()) if 1 <= a <= 9 and 1 <= b <= 9: print(a * b) else: print(-1)
p02687
s741982507
Accepted
N = input() if N == 'ABC': print('ARC') elif N == 'ARC': print('ABC') else: print('eroor')
p03696
s878299895
Wrong Answer
n = int(input()) s = input().split(")(") l = "" ans = "" for i in range(len(s)): if len(s) != 1: if i % 2 == 0: s[i] += ")" else: s[i] = "(" + s[i] R = s[i].count(")") L = s[i].count("(") if R < L: ans += s[i] + ")" * (L-R) elif L < R: ans += "(" * (R-L) + s[i] else: ans += s[i]...
p03208
s641671680
Accepted
N,K=map(int,input().split()) H=[int(input()) for i in range(N)] H.sort() ans=float('inf') for i in range(N-K+1): ans=min(ans,H[i+K-1]-H[i]) print(ans)
p03146
s409024361
Wrong Answer
def f(n): if n%2 == 0: return n//2 else: return (3*n+1) def ff(a1, history, n): a2 = f(a1) n += 1 if a2 in history: return n history.append(a2) return ff(a2, history, n) s = int(input()) print(ff(s,[],1))
p02922
s308318391
Accepted
A,B=map(int,input().split()) count,outlet=0,1 while outlet<B: outlet-=1 outlet+=A count+=1 print(count)
p03338
s938397842
Accepted
from collections import Counter n = int(input()) s = input() ma = 0 for i in range(1,n): s1=s[:i] s2=s[i:] common = set(s1) & set(s2) ma = max(ma,len(common)) print(ma)
p03524
s774023063
Wrong Answer
S = input() if len(S) == 1: print('YES') exit() if len(set(list(S))) == 1 or len(set(list(S))) == 2: print('NO') exit() cnt = [S.count('a'),S.count('b'),S.count('c')] if max(cnt)-min(cnt) <= 1: print('YES') else: print('NO')
p02789
s117104326
Accepted
def main(): n,m = map(int,input().split()) if n == m: print('Yes') else: print('No') main()
p02612
s333967203
Accepted
n = int(input()) pay = 1000 while pay - n < 0: pay += 1000 print(pay - n)
p03998
s851027531
Accepted
A = list(input()) B = list(input()) C = list(input()) now = A[0] while True: if now == 'a': if len(A) == 0: print("A") break now = A.pop(0) if now == 'b': if len (B) == 0: print("B") break now = B.pop(0) if now == 'c': i...
p02817
s769815330
Wrong Answer
s,t = input().split() print(s + t)
p03038
s298579515
Accepted
N, M = map(int, input().split()) A = list(map(int, input().split())) BC = [] for i in range(M): tmp = list(map(int, input().split())) BC.append(tmp) A.sort() BC.sort(key=lambda x: x[1], reverse=True) j = 0 for i in range(M): count = 0 while A[j] < BC[i][1]: A[j] = BC[i][1] # 値を置き換える j += 1 count...
p03612
s284056441
Accepted
n = int(input()) p = list(map(int, input().split())) q = [i for i in range(1, n+1)] cnt = 0 for j in range(n): if p[j] == q[j]: if j != n-1: p[j], p[j+1] = p[j+1], p[j] cnt += 1 else : p[j], p[j-1] = p[j-1], p[j] cnt += 1 print(cnt)
p02731
s288648364
Accepted
l = int(input()) print((l / 3) ** 3)
p03860
s417209388
Wrong Answer
S = input().strip() print("A"+S[1][0]+"C")
p02791
s454092601
Accepted
N=int(input()) S=list(map(int,input().split())) first=S[0] count=1 nagasa=len(S) for i in range(1,nagasa): if S[i]<first: count+=1 first=S[i] print(count)
p03250
s487079905
Accepted
A,B,C=sorted(input().split()) print(int(C+B)+int(A))
p03042
s667870863
Accepted
s = raw_input() print {(0,0):'NA', (0,1): 'YYMM', (1,0): 'MMYY', (1,1):'AMBIGUOUS'}[tuple(map(int,list(tuple([(0<int(s[2*i:2*i+2]) <= 12) for i in range(2)]))))]
p02813
s765039965
Wrong Answer
import itertools import math N = int(input()) P = list(map(int,input().split())) Q = list(map(int,input().split())) check = list(itertools.permutations(range(1,N+1))) N_fac = math.factorial(N) n1 = 0 n2 = 0 countP = 0 countQ = 0 for i in range(0,N_fac): for j in range(0,N): if(check[i][j] == P[j]): coun...
p02726
s274521726
Wrong Answer
N,X,Y=map(int,input().split()) Z=Y-X for k in range(1,N): ans=0 if k<Z: ans+=N-k+min(k,N-Y+1) if 2*k+2<=Z: ans+=max(min(k-1,Z-k-3),0)+min(k-1,N-Y+1) if 2*k<Z+2: ans+=max(k-2,0) elif Z<=k<=N-Z: ans+=min(X,X-k+N-Y+1) print(ans)
p03241
s293660422
Wrong Answer
n,m=map(int,input().split()) a=[] for i in range(1,int(m**.5)+1): if m%i==0 and m//i>=n:a+=[i] print(max(a))
p03107
s204243082
Wrong Answer
a=[100]+[int(i) for i in input()]+[100] n=len(a) i=1 while i<len(a)-1: if a[i]^1==a[i+1]: a.pop(i) a.pop(i+1) if a[i]^1==a[i-1]: a.pop(i) a.pop(i-1) else: i+=1 print(n-len(a))
p03252
s655537435
Accepted
from collections import defaultdict S = input() T = input() S_dict, T_dict = defaultdict(list), defaultdict(list) for i, s in enumerate(S): S_dict[s].append(i) for i, t in enumerate(T): T_dict[t].append(i) S_set, T_set = set(), set() for s in S_dict.values(): S_set.add(tuple(s)) for t in T_dict.values():...
p02813
s938266191
Wrong Answer
from itertools import permutations N = int(input()) P = "".join(list(map(str,input().split()))) Q = "".join(list(map(str,input().split()))) ls = permutations(list(range(1,N+1))) ans = [] for i in list(ls): ans.append("".join(list(map(str,i)))) a,b = 0,0 for i in range(len(ans)): if ans[i] == P: a = i ...
p02994
s490509317
Accepted
def main(): t = 0 n,l = map(int, input().split()) a = [] for i in range(l, l+n): a.append(i) max = n + l - 1 if max <= 0: t = max elif l >= 0: t = l else: t = 0 print(sum(a)-t) if __name__ == '__main__': main()
p02597
s235497283
Wrong Answer
def main(): n = int(input()) c = input() w = c.count("W") ans = 0 for i in range(n): target = "R" if i < w else "W" if c[i] != target: ans += 1 print(ans // 2 if 0 < w < n else 0) if __name__ == '__main__': main()