problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02802
s139785458
Accepted
N, M = map(int, input().split()) PS = [[0, 0] for i in range(N)] for i in range(M): p, s = input().split() if s == "AC": PS[int(p) - 1][0] = 1 elif s == "WA" and PS[int(p) - 1][0] == 0: PS[int(p) - 1][1] += 1 ac = 0 wa = 0 for ps in PS: if ps[0] == 1: ac += 1 wa += ps[1] print(ac, wa)
p04033
s228305595
Accepted
a,b = map(int,input().split()) if a <= 0 and b >= 0: print("Zero") elif a > 0: print("Positive") else: if (b-a)%2 == 0: print("Negative") else: print("Positive")
p03627
s236756004
Wrong Answer
n = int(input()) a = list(map(int,input().split())) b = list(set(a)) import collections c = collections.Counter(a) g = [] for i in range(len(b)): if c[b[i]] >= 2: g.append(b[i]) if len(g) <= 1: g = [] for i in range(len(b)): if c[b[i]] >= 4: g.append(b[i]) if len(g) == 0: print(0) else: g = sorted(g,reverse = True) print(g[0]**2) else: g = sorted(g,reverse = True) print(g[0]*g[1])
p02897
s442116006
Accepted
i=int(input()) print(0.5 if i%2==0 else 1.0 if i==1 else (i//2+1)/i)
p03127
s800374283
Accepted
# -*- coding: utf-8 -*- import sys from math import gcd sys.setrecursionlimit(10**9) INF=10**18 MOD=10**9+7 input=lambda: sys.stdin.readline().rstrip() YesNo=lambda b: bool([print('Yes')] if b else print('No')) YESNO=lambda b: bool([print('YES')] if b else print('NO')) int1=lambda x:int(x)-1 N=int(input()) A=list(map(int,input().split())) ans=A[0] for x in A[1:]: ans=gcd(ans,x) print(ans)
p02732
s505166985
Accepted
# sys.stdin.readline() import sys input = sys.stdin.readline import collections N = int(input()) A = list(map(int,input().split())) c = collections.Counter(A) cnt=[] for k in c: cnt.append(c[k]*(c[k]-1)//2) s=sum(cnt) for i in range(N): print(s-c[A[i]]+1)
p02724
s020942429
Accepted
X = int(input()) print((X//500)*1000+(X%500)//5*5)
p02646
s618119905
Wrong Answer
from sys import stdin def main(): input = stdin.readline A,V = map(int,input().split()) B,W = map(int,input().split()) T = int(input()) if(V <= W): print("NO") else: X = abs(V - W) if (abs(A - B) // X <= T) & (abs(A - B) % X == 0): print("YES") else: print("NO") if __name__ == "__main__": main()
p02603
s808492626
Accepted
def II(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(map(int, input().split())) N=II() A=LI() ans=1000 for i in range(N-1): if A[i]<A[i+1]: ans+=(ans//A[i])*(A[i+1]-A[i]) print(ans)
p03386
s233909209
Accepted
a, b, k = map(int,input().split()) ans = set([]) if b > a+k: for i in range(a,a+k): ans.add(i) for i in range(b-k+1,b+1): ans.add(i) else: for i in range(a,b+1): ans.add(i) ans = sorted(ans) for i in ans: print(i)
p03555
s577875335
Wrong Answer
data1 = input() data2 = input() count = len(data1) - 1 sw = 0 i = 0 j = len(data2)-1 while i <= count: if data1[i] == data2[j]: sw += 1 i += 1 j -= 1 if sw == len(data1): print("Yes") else: print("No")
p02732
s379901657
Wrong Answer
n = int(input()) a = list(map(int, input().split())) x = [0]*(n+1) for i in range(1, n+1): x[a[i-1]] += 1 print(x) sumx = 0 for i in range(1, n+1): sumx += x[i] * (x[i]-1) // 2 for i in range(1, n+1): print(sumx - x[a[i-1]] * (x[a[i-1]]-1) // 2 + (x[a[i-1]]-1) * (x[a[i-1]]-2) // 2)
p02693
s687631165
Wrong Answer
K = int(input()) A,B = map(int,input().split()) if B - A + 1 >= K: print("OK") elif K >= A: print("OK") else: print("NG")
p02606
s604624526
Accepted
l,r,d=map(int, input().split()) cnt = 0 tmp = 0 while tmp <= r: tmp = tmp + d if tmp >= l and tmp <= r: cnt+=1 print(cnt)
p02946
s417810400
Accepted
k, x = map(int, input().split()) a = [] for i in range(x-k+1,x+k): a.append(str(i)) print (" ".join(a))
p02657
s179584449
Wrong Answer
# 169A # 1.入力をちゃんと受け取る。図解をする # ex: [2 5] a=2 b=5 a, b = map(int, input().split()) print(a) print(b) # 2.計算 answer=a*b # 3出力 print(answer)
p02835
s073254273
Accepted
a = list(map(int, input().split())) ans = 'bust' if sum(a) >= 22 else 'win' print(ans)
p03351
s836204599
Accepted
a, b, c, d = map(int, input().split()) if abs(a - c) <= d: ans = 'Yes' elif abs(a - b) <= d and abs(b - c) <= d: ans = 'Yes' else: ans = 'No' print(ans)
p02601
s888059452
Wrong Answer
A, B, C = map(int, input().split()) K = int(input()) for i in range(K): if B <= A: print('a') B *= 2 elif C <= B: print('b') C *= 2 else: print('C') C *= 2 if A < B and B < C: print('Yes') else: print('No')
p02676
s352709022
Wrong Answer
#!/usr/bin/env python3 # atcoder # Türkçe konuşyorum # Türkler var mı # memnün oldum K = int(input()) S = input() if(len(S) <= K): print(S) else: print(S[K:] + '.' * 3)
p03427
s282644720
Accepted
S = input() N = int(S) ans = sum(map(int,S)) for i in range(1,len(S)): n = str(int(S[:i]) - 1) t = sum(map(int,n)) + 9*(len(S)-i) ans = max(ans,t) print(ans)
p03795
s650998369
Accepted
# すぬけくんはレストランに通うのが好きです。 # すぬけくん行きつけのレストランは何を食べても1食 800円で、15食食べる毎にその場で 200円もらえます。 # すぬけくんは今までで合計 N食食べました。 今までに払った金額をx円、レストランからもらった金額を y円として、x−yを求めなさい。 N = int(input()) print(N *800 - (N // 15 *200))
p03073
s650113040
Accepted
S = input() cost1 = 0 for i in range(len(S)): if i % 2 == 0: if S[i] == '0': cost1 += 1 else: if S[i] == '1': cost1 += 1 cost2 = 0 for i in range(len(S)): if i % 2 == 0: if S[i] == '1': cost2 += 1 else: if S[i] == '0': cost2 += 1 print(min(cost1, cost2))
p02708
s490624757
Accepted
N, K = map(int, input().split()) mod = 10**9+7 res = 1 l = K*(K-1)//2 r = l+(N-K+1)*K for i in range(K, N+1): res += r-l+1 res %= mod l += i r += N-i print(res)
p03693
s192999211
Accepted
print('YES' if int(input().replace(' ', '')) % 4 == 0 else 'NO')
p03645
s107161298
Wrong Answer
n,m=map(int,input().split()) ab=[list(map(int, input().split())) for _ in range(m)] graph = [[] for _ in range(n)] for v in ab: graph[v[0]-1].append(v[1]-1) graph[v[1]-1].append(v[0]-1) # print(graph) from collections import deque queue = deque([0]) d = [100] * n d[0] = 0 while queue: v = queue.popleft() for i in graph[v]: if d[i]==10**6: d[i] = d[v] + 1 queue.append(i) # print(d) print('POSSIBLE' if d[n-1]<=2 else 'IMPOSSIBLE')
p03076
s203790384
Accepted
import sys import math import itertools import collections import heapq import re import numpy as np rr = lambda: sys.stdin.readline().rstrip() rs = lambda: sys.stdin.readline().split() ri = lambda: int(sys.stdin.readline()) rm = lambda: map(int, sys.stdin.readline().split()) rl = lambda: list(map(int, sys.stdin.readline().split())) inf = float('inf') mod = 10**9 + 7 li = [ri() for _ in range(5)] lis = [math.ceil(i/10)*10 for i in li] ans = inf for i in range(5): ans = min(sum(lis[:i])+li[i]+sum(lis[i+1:]), ans) print(ans)
p02873
s944547199
Wrong Answer
s = list(input()) n = len(s) s.append('<') mini = 0 maxi = 0 p = 0 for i in range(n): if s[i] == '<': mini += 1 else: maxi += 1 if s[i+1] == '<': p += (1 + max(mini,maxi)) * max(mini,maxi) // 2 p += (min(mini,maxi) - 1) * (min(mini,maxi) - 1) // 2 mini = 0 maxi = 0 if mini != 0: print(p + ((1+mini) * (mini) // 2)) else: print(p)
p02917
s078585415
Accepted
N = int(input()) B = list(map(int, input().split())) A = [10**5]*N for i in range(N-1): A[i] = min(A[i], B[i]) A[i+1] = min(A[i+1], B[i]) print(sum(A))
p03037
s714107802
Accepted
n,m,*a=map(int,open(0).read().split()) b=min(a[1::2])-max(a[::2])+1 print(b if b>0 else 0)
p03360
s477545631
Accepted
A = list(map(int, input().split())) K = int(input()) A.sort() print(A[0]+A[1]+A[-1]*pow(2,K))
p03359
s406269534
Wrong Answer
a, b = map(int, input().split()) print(10*a+b-11+1)
p02911
s228740166
Accepted
N, K, Q, *A = map(int, open(0).read().split()) ans = [K - Q] * N for a in A: ans[a - 1] += 1 print('\n'.join('Yes' if v > 0 else 'No' for v in ans))
p03910
s802942156
Accepted
n = int(input()) s = 0 for i in range(1,10**5): s += i if s >= n: t = i break if s == n: for i in range(1,t+1): print (i) else: for i in range(1,t+1): if i == s-n: continue print (i) exit()
p03103
s256264772
Wrong Answer
N,M = map(int,input().split()) AB = [] for _ in range(N): AB.append([int(i) for i in input().split()]) AB_sort = sorted(AB,key=lambda x : x[0]) money = 0 for ab in AB_sort: if M >= ab[0]: money += ab[0] * ab[1] M -= ab[1] else: money += M * ab[0] break print(money)
p03043
s331227015
Accepted
n, k = map(int, input().split()) ans = 0 count = 0 if k == 1: print(1) else: for i in range(1, n+1): while i < k: i *= 2 count += 1 ans = ans + 0.5**count/n count = 0 print(ans)
p03815
s682603197
Accepted
x = int(input()) cnt = 0 a = int(x/11) cnt = a*2 x -= 11*a if x == 0: cnt += 0 elif x < 7: cnt += 1 else: cnt += 2 print(cnt)
p03623
s492051138
Wrong Answer
s = list(input()) s.sort() alp = list('abcdefghijklmnopqrstuvwxyz') for s_,alp_ in zip(s,alp): if s_ != alp_ : print(alp_) exit() print('None')
p03456
s121958164
Wrong Answer
a, b = input().split() c = int(a + b) for i in range(1,101): if i * i == c: print("Yes") break else: print("No")
p03219
s693723278
Wrong Answer
X, Y = map(int, input().split()) print(X+Y/2)
p02729
s891619462
Accepted
# must have sum even. This only happens for x,y both even or both odd. # N even, so N*(N-1)/2 pairs of them (not counting order). Same for M. N, M = map(int, input().split()) num_N = N*(N-1)//2 num_M = M*(M-1)//2 print(num_N+num_M)
p02755
s016376911
Accepted
import math A, B = list(map(int, input().split())) amax = math.ceil((A + 1) / 8 * 100) - 1 amin = math.ceil(A / 8 * 100) bmax = math.ceil((B + 1) * 10) - 1 bmin = math.ceil(B * 10) if amin > bmax or bmin > amax: print(-1) else: print(int(max(amin, bmin)))
p02608
s979656497
Wrong Answer
N = int(input()) a = [0]* N x = [i for i in range(1,43)] y = [i for i in range(1,43)] z = [i for i in range(1,43)] ans = [] for i in x: for j in y: for k in z: t = (i**2+j**2+k**2+i*j+j*k+k*i) if t <= N: a[t-1] += 1 for i in range(N): print(a[i])
p03427
s315454806
Wrong Answer
def solve(): N = input() if len(N) == 1: print(int(N)) elif all(i == '9' for i in N): print(9 * len(N)) else: print((int(N[0]) - 1) + 9 * (len(N) - 1)) if __name__ == "__main__": solve()
p03075
s179764108
Wrong Answer
aaa = [int(input()) for i in range(6)] ans = ":(" a = aaa[0] for i in range(1,5): if aaa[5] <= abs(a - aaa[i]): ans = "Yay" break a = aaa[i] print(ans)
p02608
s388671397
Wrong Answer
n = int(input()) ANS =[0 for _ in range(n)] for x in range(1, int((n/2)**0.5) + 1): for y in range(1, int((n/2)**0.5) + 1): for z in range(1, int((n/2)**0.5) + 1): if x**2 + y**2 + z**2 + x*y + y*z + z*x > n: continue ANS[(x**2 + y**2 + z**2 + x*y + y*z + z*x) - 1] += 1 for i in ANS: print(i)
p03487
s646591793
Accepted
N = int(input()) A = list(map(int,input().split())) NA = set(A) d = {x:0 for x in NA} for i in range(N): d[A[i]] += 1 counter = 0 for p in d: if p > d[p]: counter += d[p] else: counter += d[p]-p print(counter)
p03281
s529477118
Wrong Answer
n = int(input()) ans = 0 total = 0 for i in range(n//2 + 1): for j in range(1, 2*i + 2): if (2*i + 1) % j == 0: ans += 1 if ans == 8: total += 1 ans = 0 print(total)
p03557
s732409095
Wrong Answer
N = int(input()) lst_a = sorted([int(x) for x in input().split()]) lst_b = sorted([int(x) for x in input().split()]) lst_c = sorted([int(x) for x in input().split()], reverse=True) a_num = len(lst_a) b_num = len(lst_b) c_num = len(lst_c) ret = 0 for a in lst_a: for b in lst_b: if a >= b: break for c in lst_c: if c > b: ret += 1 else: break print(ret)
p03146
s825430436
Wrong Answer
def f(n): if n % 2 == 0: return n/2 else: return 3*n+1 s = int(input()) a_i = s cnt = 1 while True: if a_i == 4: break cnt += 1 a_i = f(a_i) print(cnt+3)
p03059
s728220386
Accepted
a, b, t = map(int, input().split()) print((t//a)*b)
p03779
s810754558
Accepted
import sys def solve(): X = int(input()) for i in range(1, 10**5): if i * (i + 1) // 2 >= X: minI = i break print(minI) return 0 if __name__ == "__main__": solve()
p02843
s336279021
Wrong Answer
X=int(input()) Y=X%100 Z=X//100 if X>(Z*5): print(0) else: print(1)
p03479
s138446786
Accepted
import sys def input(): return sys.stdin.readline().strip() def main(): x, y = map(int, input().split()) cnt = 0 while x <= y: x *= 2 cnt += 1 print(cnt) if __name__ == "__main__": main()
p02873
s229722937
Accepted
s = str(input()) f = "" # 前回のステップの文字 "<" or ">" ans = 0 # Answer count = 0 # Ai continuous = 0 # ">" が何回連続するか for m in s: if m=="<": if f==">" and count>0: # 清算 ans-=count*continuous count=0 count+=1 else: if f=="<": # セット continuous=0 count-=1 continuous+=1 if count==-1: ans+=continuous count=0 continue ans+=count f=m print(ans)
p02554
s787337795
Wrong Answer
N = int(input()) ans = (9**N - 2*8**N + 7**N)%(10**9+7) print(ans)
p02933
s462222366
Accepted
a = int(input()) s = input() if a < 3200: print('red') elif a >= 3200: print(s)
p02682
s529487256
Wrong Answer
A, B, C, K = map(int, input().split()) print (A, B, C, K) sum = 0 if K - A >= 0: K -= A sum += A else: print(sum) exit if K - B >= 0: K -= B sum += 0 else: sum += 0 print(sum) exit if K - C >= 0: K -= C sum += -C else: sum += -1 * K print (sum)
p02707
s200709567
Accepted
N = int(input()) Alist = list(map(int, input().split())) boss = {} for i in Alist: if i not in boss: boss[i] = 1 else: boss[i] += 1 for j in range(1,N+1): if j in boss: print(boss[j]) else: print(0)
p02702
s183029508
Wrong Answer
s = input() s_num = int(s) len_s = len(s) list=[0 for x in range(len_s+1)] for i in range(len_s-1,-1,-1): for j in range(4,min(8,len_s-i+1)): print(i,j, s[i:j+i]) if int(s[i:i+j])%2019==0: list[i]=list[i+j]+1 print(sum(list))
p03061
s468095596
Wrong Answer
import fractions N=int(input()) A=list(map(int,input().split())) A.append(A[0]) ans=0 l=[] if N==2: print(max(A)) exit() for i in range(N): val=fractions.gcd(A[i],A[i+1]) l.append(val) l.sort() print(l[2])
p03699
s435470662
Wrong Answer
n = int(input()) S = [0]*n for i in range(n): S[i] = int(input()) r = sum(S) S.sort() for i in range(n): if r%10 == 0 and S[i]%10!=0: r -= S[i] elif r%10!=0: break print(r)
p02916
s403796022
Accepted
n=int(input()) a=list(map(int,input().split())) b=list(map(int,input().split())) c=list(map(int,input().split())) ans=0 for i in range(len(a)): ai=a[i] ans+=b[ai-1] if(ans!=b[ai-1]): if(ai==before+1): ans+=c[before-1] before=ai print(ans)
p02843
s326802343
Wrong Answer
x = input() x = '000'+x z = x[-4:-2] y = x[-2:] s = 0 z = int(z) y = int(y) L = [] for i in range(1,20): s +=i if s>=y and z>=i: print(1) exit() print(0)
p02742
s807962614
Accepted
h,w=map(int,input().split()) if h==1 or w==1: print(1) exit() if w%2==0: print(w//2*h) exit() if w%2==1: if h%2==0: print(w*h//2) elif h%2==1: ans=0 ans+=w*(int(h/2)) ans+=w//2+1 print(ans)
p03434
s873083271
Accepted
n=int(input()) a=list(map(int,input().split())) a_sort=a.sort(reverse=True) point_a=0 point_b=0 for i in range(0,n,2): point_a+=a[i] for i in range(1,n,2): point_b+=a[i] print(point_a-point_b)
p02916
s235514354
Accepted
import sys sys.setrecursionlimit(10**6) n = int(input()) readline = sys.stdin.readline A = [int(i)-1 for i in readline().split()] B = [int(i) for i in readline().split()] C = [int(i) for i in readline().split()] ans = 0 a_prev = -100 for a in A: ans += B[a] if a == a_prev+1: ans += C[a-1] a_prev = a print(ans)
p02838
s172029649
Wrong Answer
import numpy as np N = int(input()) A = list(map(int,input().split())) A = np.array(A,np.int64)##Ai<2^60 ans = 0 mod = int(1e9+7) for i in range(60): bottom_bit = (A>>i)&1 ##i回シフトしたときの最下位bit ones = sum(bottom_bit[bottom_bit==1]) ##ans += (N-ones)*ones*(2**i) ##0の個数*1の個数*2^i個 tmp = 1 for j in range(i): tmp *= 2 % mod ans += (N-ones)*ones*tmp % mod print(ans%mod)
p02792
s384425007
Wrong Answer
n = int(input()) cnt = [[0] * 10 for i in range(10)] for i in range(1,n+1): cnt[int(str(i)[0])][int(str(i)[-1])] += 1 print(cnt) ans = 0 for i in range(10): for j in range(10): ans += cnt[i][j] * cnt[j][i] print(ans)
p03804
s370579465
Accepted
n, m = map(int, input().split()) A = [input() for i in range(n)] B = [input() for i in range(m)] ans = 'No' for i in range(n - m + 1): for j in range(n - m + 1): C = [] for k in range(m): C.append(A[i + k][j : j + m]) if B == C: ans = 'Yes' print(ans)
p02995
s493547673
Accepted
def wareru(x,y,z): if x%z == 0: return y//z - x//z + 1 else: return y//z - x//z import fractions a,b,c,d = map(int,input().split()) e = c*d//(fractions.gcd(c,d)) c_hoge = wareru(a,b,c) d_hoge = wareru(a,b,d) e_hoge = wareru(a,b,e) print(b-a+1-c_hoge-d_hoge+e_hoge)
p02917
s550026692
Accepted
n = int(input()) b = list(map(int,input().split())) a = [0]*n a[0] = b[0] a[-1] = b[-1] for i in range(1,n-1): a[i] = min(b[i-1],b[i]) print(sum(a))
p03219
s504936886
Wrong Answer
X,Y=map(int,input().split()) print(abs(X+Y/2))
p03126
s091345575
Accepted
n, m = map(int, input().split()) a = [0]*m for _ in range(n): k = list(map(int, input().split())) for i in range(m): if i+1 in k[1:]: a[i] += 1 ans = 0 for i in range(m): if a[i] == n: ans += 1 print(ans)
p02677
s977719613
Accepted
import numpy as np a,b,h,m=map(int,input().split()) pi = np.pi x = 2*pi*(h*60+m)/720 y = 2*pi*m/60 theta=abs(x-y) cos = np.cos(theta) ans = (a**2+b**2-2*a*b*cos)**0.5 print(ans)
p02613
s656376268
Accepted
N = int(input()) S_list = [input() for _ in range(N)] res_list = ['AC', 'WA', 'TLE', 'RE'] for res in res_list: print(res + ' x ' + str(S_list.count(res)))
p02832
s631077737
Accepted
x = int(input()) li = list(map(int, input().split())) k = 1 s = 0 for i in range(len(li)): if k == li[i] : k += 1 s += 1 if i == len(li)-1 and k == 1: s = len(li) + 1 print(len(li)-s)
p03779
s367485801
Accepted
x = int(input()) t = 0 while t*(t+1)/2 < x: t += 1 print(t)
p04043
s362769994
Accepted
a = input().split() if a.count('5')==2 and a.count('7')==1: print('YES') else: print('NO')
p02847
s078440473
Accepted
import sys from collections import defaultdict readline = sys.stdin.buffer.readline # sys.setrecursionlimit(10**5) def geta(fn=lambda s: s.decode()): return map(fn, readline().split()) def gete(fn=lambda s: s.decode()): return fn(readline().rstrip()) def main(): d = {"SUN": 7, "MON": 6, "TUE": 5, "WED": 4, "THU": 3, "FRI": 2, "SAT": 1} print(d[gete()]) if __name__ == "__main__": main()
p03359
s522797310
Wrong Answer
a,b=map(int,input().split()) print(a-(a<b))
p02720
s912600626
Accepted
from collections import deque K = int(input()) L = deque() for i in range(9): L.append((i+1)) for i in range(K): ans = L.popleft() if ans % 10: L.append(10*ans+ans%10-1) L.append(10*ans+ans%10) if ans % 10-9: L.append(10*ans+ans%10+1) print(ans)
p03105
s665479619
Wrong Answer
#!/usr/bin/python input_data = list(map(int,input().split())) d1 = input_data[0] d2 = input_data[1] d3 = input_data[2] total = 0 d4 = int(d2 / d1) if d4 > d3: total += 1 print(total)
p02693
s677511560
Wrong Answer
k = int(input()) a, b = map(int, input().split()) if k <= b: if a <= k: print("OK") else: print("NG")
p03061
s833014764
Wrong Answer
import sys def gcd(m, n): r = m % n return gcd(n, r) if r else n def gcd_list(ln): tmp = gcd(ln[0], ln[1]) for x in ln[2:]: tmp = gcd(tmp, x) return tmp n = int(input()) a = list(map(int, sys.stdin.readline().split())) if n == 2: print(max(a)) else: c = [gcd_list(a[:i] + a[i+1:]) for i in range(min(n, 4))] c.sort() print(c[-1])
p02946
s015604964
Accepted
K,X=map(int,input().split()) print(*list(range(X-K+1,X+K)))
p02819
s001334967
Wrong Answer
def main(): X = int(input()) i = 1 while i != 0: if X % 2 != 0: if X % 3 != 0: if X % 5 != 0: print(X) break X += 1 main()
p02860
s517706216
Wrong Answer
lst = [input() for i in range(0, 2)] n = int(lst[0]) s = lst[1] if n % 2 == 1: print('NO') t = '' for i in range(0, n//2): t += s[i] if t + t == s: print('YES') else: print('NO')
p03087
s031861974
Accepted
n, q = map(int, input().split()) s = input() t = [0]*(n + 1) for i in range(n): t[i+1] = t[i] + (1 if s[i:i+2] == 'AC' else 0) for i in range(q): l, r = map(int, input().split()) print(t[r-1] - t[l-1])
p02664
s694231430
Wrong Answer
t = str(input()) t0 = t.replace('?','K') list = [t0] i=0 while 'K' in list[i]: list.append(list[i].replace('DK','DP').replace('PK','PD')) i+=1 print(list[i])
p03043
s197592324
Accepted
def kaisu(n,k): if n>=K: return k else: return kaisu(2*n,k+1) N,K=map(int,input().split()) ans=0 for i in range(1,N+1): ans+=pow(2,20-kaisu(i,0)) ans=ans/(pow(2,20)) print(ans/N)
p02793
s825021017
Accepted
n = int(input()) A = list(map(int,input().split())) ans = 0 from functools import reduce import fractions def lcm_base(x, y): return (x * y) // fractions.gcd(x, y) def lcm(numbers): return reduce(lcm_base, numbers, 1) lc = lcm(A) for i in range(n): ans += lc//A[i] print(ans % (10**9+7))
p02597
s681319975
Accepted
n, c = int(input()), input() wa = [0] * (n+2) for i in range(n): if(c[i]=='W'): wa[i+1]+=1 for i in range(n+1): wa[i+1] += wa[i] ans = n; for i in range(n+2): w = wa[i] r = n-i - (wa[n] - wa[i]) ans = min(ans, max(w, r)) print(ans)
p02641
s811659602
Accepted
X, N = map(int, input().split())# p = map(int, input().split()) p = list(p) tmp = X Y = X tmp1 = 0 tmp2 = 0 if X not in p: tmp1 = X for i in range(N): if X not in p: tmp1 = X else: X = X + 1 if Y not in p: tmp2 = Y else: Y = Y - 1 if abs(tmp1 - tmp) >= abs(tmp2 - tmp): print(tmp2) else: print(tmp1)
p03339
s190080081
Wrong Answer
n = int(input()) s = input() ans = 10 ** 10 for i in range(1, n): left = s[:i] right = s[i + 1:] l = list(left).count('W') r = list(right).count('E') ans = min(ans, l + r) print(ans)
p02730
s621518270
Wrong Answer
S = input() l = len(S) count = 0 harf = int(l/2) a = S[:harf] b = S[harf+1:][::-1] if a == b : count+=1 quarter = int(l/2) - 1 a1 = a[:quarter-1] a2 = a[quarter][::-1] if a1==a2: count+=1 b1 = b[:quarter-1] b2 = b[quarter][::-1] if b1 == b2: count+=1 if count == 3: print("Yes") else: print("No")
p02730
s388577141
Wrong Answer
def palindrome(s): n = len(s) f = True for i in range(n//2): if s[i] != s[-(i+1)]: f = False break return f S = input() N = len(S) print("Yes" if palindrome(S[:(N-1)//2]) and palindrome(S[(N+3)//2 - 1:]) else "No")
p03000
s958304505
Accepted
import sys N,X = map(int,input().split()) array = list(map(int,input().split())) count = 1 point = 0 for I in range(len(array)): point += array[I] if point <= X: count += 1 else: break print(count)
p03555
s560161145
Accepted
from sys import stdin from sys import setrecursionlimit setrecursionlimit(10 ** 7) s = input() t = input()[::-1] if s == t: print("YES") else: print("NO")
p02631
s800385460
Accepted
n=int(input()) a=list(map(int,input().split())) p=[a[0]] for i in range(1,n): p.append(p[-1] ^ a[i]) S=p[-1] b=[v^S for v in a] print(*b,sep=' ')