problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03448
s232041143
Wrong Answer
A = int(input()) B = int(input()) C = int(input()) X = int(input()) A_max = X // 500 count = 0 for i in range(A_max + 1): for j in range(B + 1): for h in range(C + 1): if i * 500 + j * 100 + h * 50 == X: count += 1 print(count)
p03681
s804033139
Accepted
from math import factorial as frac N, M = map(int, input().split()) MOD = 10**9 + 7 def nPk(n, k): r = 1 while k > 0: r *= n r %= MOD n -= 1 k -= 1 return r if abs(N-M) > 1: print(0) elif N==M: print(((nPk(N,N)*nPk(M,M))*2)%MOD) else: print(nPk(N,N)*nPk(M,M)%MOD)
p02900
s017522863
Wrong Answer
a, b = map(int, input().split()) roota = int(a ** 0.5) pa = [] for i in range(2, roota + 1): if a % i == 0: pa.append(i) while a % i == 0: a //= i cd = [] for i in range(len(pa)): if b % pa[i] == 0: cd.append(pa[i]) print(len(cd) + 1)
p03962
s823903836
Wrong Answer
# -*- coding: utf-8 -*- a,b,c = map(int, input().split()) cnt = 0 if a != b: cnt += 1 if a != c: cnt += 1 if b != c: cnt += 1 print(int(cnt))
p03698
s158700167
Accepted
s = str(input()) if len(s) == len(set(s)): print("yes") else: print("no")
p02732
s734215278
Accepted
def f(m): return 0 if m < 2 else m * (m-1) // 2 def solve(n, a): D = {} for x in a: if not x in D: D[x] = 0 D[x] += 1 total = 0 for x, num in D.items(): total += f(num) for x in a: num = D[x] print(total - f(num) + f(num-1)) n = int(input()) a = list(map(int, input().split())) solve(n, a)
p03469
s354389974
Accepted
print(input().replace('017','018'))
p02820
s870463747
Accepted
from collections import defaultdict N, K = map(int, input().split()) r, s, p = map(int, input().split()) score = {} score['s'] = r score['p'] = s score['r'] = p T = input() dic = defaultdict(int) ans = 0 for i in range(N): c = T[i] if i<K: ans += score[c] dic[i] = c continue d = dic[i%K] if d==c: dic[i%K] = 0 continue ans += score[c] dic[i%K] = c print(ans)
p03814
s778353866
Accepted
s = input() print(s.rfind('Z') - s.index('A') + 1)
p02787
s693905935
Accepted
H, N = map(int, input().split()) magics = [tuple(map(int, input().split())) for _ in range(N)] maxA = max([x for x, y in magics]) dp = [10**18]*(H+maxA+1) dp[0] = 0 for i in range(1, H+maxA+1): for j in range(N): a, b = magics[j] if a<=i: dp[i] = min(dp[i-a]+b, dp[i]) print(min(dp[H:]))
p03013
s906793224
Accepted
N,M=map(int,input().split()) B=[1]+[1]+[0]*(N-1) for j in range(M): a=int(input()) B[a]=-1 if a==1: B[a]=0 i=2 while i<=N: if B[i]==-1: B[i]=0 else: B[i] = (B[i - 1] + B[i - 2]) % (10 ** 9 + 7) i+=1 print(B[N])
p03719
s641430915
Wrong Answer
a, b, c = map(int, input().split()) if c <= a <= b: print('YES') else: print('NO')
p03221
s925375215
Wrong Answer
x,y=map(int,input().split()) citylist=[[] for x in range(x)] inputlist=[] arucity=set() for a in range(y): s,t=map(int,input().split()) citylist[s-1].append(t) inputlist.append(s) inputlist.append(t) arucity.add(s) for a in arucity: citylist[a-1].sort() for b in range(y): e=inputlist.pop(0) print("{:08} {:08}".format(e,(citylist[e-1].index(inputlist.pop(0))+1)))
p02790
s815486555
Accepted
a , b = map(int,input().split()) print(min(str(a) * b ,str(b) * a))
p03852
s345007413
Wrong Answer
I = input() import re # if re.match("^(a|i|u|e|o){1}$", I): # if I in 'aiueo': if 'aiueo'.find(I): print('vowel', flush=True) else: print('consonant', flush=True)
p03339
s946919172
Accepted
n = int(input()) s = input() curr_change_cnt = min_change_cnt = sum(c == 'E' for c in s[1:]) for i in range(1, n): if s[i - 1] == 'W': curr_change_cnt += 1 if s[i] == 'E': curr_change_cnt -= 1 min_change_cnt = min(curr_change_cnt, min_change_cnt) print(min_change_cnt)
p03221
s765365694
Accepted
n, m = map(int, input().split()) ans = [0] * m G = [[] for _ in range(n + 1)] for i in range(m): p, y = map(int, input().split()) G[p].append([y, i]) for i in range(1, n + 1): g = G[i] g.sort() for j in range(len(g)): f = g[j] s = ["0"] * (6 - len(str(i))) + [str(i)] t = ["0"] * (6 - len(str(j + 1))) + [str(j + 1)] ans[f[1]] = "".join(s + t) for i in ans: print(i)
p02995
s613561810
Wrong Answer
A,B,C,D=map(int,input().split()) print(A,B,C,D) from fractions import* upto_B=B-(B//C+B//D-B//(C*D//gcd(C,D))) upto_A=A-1-((A-1)//C+(A-1)//D-(A-1)//(C*D//gcd(C,D))) print(upto_B-upto_A*(A>2))
p03612
s599864899
Wrong Answer
from collections import defaultdict import numpy as np n = int(input()) p = np.array(list(map(int, input().split()))) comp = np.arange(n) + 1 diff = comp - p memo = defaultdict(int) memo[0] = 0 cnt = 0 for x in diff: if x == 0: cnt += 1 else: memo[cnt] += 1 cnt = 0 if np.any(diff) == False: memo[diff.shape[0]] += 1 remove = memo.pop(0) if memo[1] != 0: ans = memo.pop(1) else: ans = 0 for k, v in memo.items(): ans += (k - 1) * v print(ans)
p02657
s496117531
Accepted
#import numpy as np import sys, math from itertools import permutations, combinations from collections import defaultdict, Counter, deque from math import factorial#, gcd from bisect import bisect_left #bisect_left(list, value) sys.setrecursionlimit(10**7) enu = enumerate MOD = 10**9+7 def input(): return sys.stdin.readline()[:-1] pl = lambda x: print(*x, sep='\n') N, K = map(int, input().split()) print(N*K)
p02970
s237660957
Accepted
n,d = map(int,input().split()) print(-(-n//(d*2+1)))
p03971
s353495471
Accepted
N,A,B = [ int(i) for i in input().split() ] S = input() passCount = 0 overseaPassCount = 1 for k,v in enumerate(S): if v == "c": print("No") elif v == "b": if passCount<A+B and overseaPassCount<=B : print("Yes") overseaPassCount += 1 passCount += 1 else: print("No") elif v == "a": if passCount<A+B : print("Yes") passCount += 1 else: print("No") else : None
p02683
s654135548
Accepted
import numpy as np n, m, x = map(int, input().split()) books = [list(map(int, input().split())) for _ in range(n)] ans = float('inf') for i in range(2 ** n): cost = 0 exp = np.array([0] * m) for j , b in enumerate(books): if i >> j & 1: continue cost += b[0] exp = exp + np.array(b[1:]) if (exp < x).any(): continue ans = min(cost, ans) if ans == float('inf'): ans = -1 print(ans)
p03761
s252865616
Accepted
import sys import collections input = sys.stdin.readline def main(): N = int(input()) C = [] for i in range(N): S = input().strip() C.append(collections.Counter(S)) for i in range(26): m = float("inf") for j in range(N): m = min(m, C[j][chr(ord('a') + i)]) if m != float("inf"): print(chr(ord('a') + i) * m, end="") print() if __name__ == '__main__': main()
p03281
s943072416
Wrong Answer
N = int(input()) ans = 0 for i in range(1, N, 2): c = 0 for j in range(1, N+1): if i%j==0: c += 1 if c==8: ans += 1 print(ans)
p02911
s935776092
Accepted
n, k, q = list(map(int, input().split())) collect = [0] * (n+1) for i in range(q): p = int(input()) collect[p] += 1 for j in range(1, n+1): if k - (q - collect[j]) > 0: print("Yes") else: print("No")
p02624
s211670866
Accepted
from numba import jit n = int(input()) @jit def main(n): ans = 0 for i in range(1, n+1): ans += i * (n//i) * (n//i + 1) //2 print(ans) main(n)
p03345
s957008628
Accepted
A,B,C,K = map(int,input().split()) S = A+B+C d = A-B if d > pow(10,18): print("unfair") exit() if K%2 == 0: print(d) else: print(-d)
p02795
s197282749
Accepted
H = int(input()) W = int(input()) N = int(input()) s = 0 c = 0 while s < N: if H < W: s += W H -=1 else: s += H W -=1 c += 1 print(c)
p04034
s747988663
Accepted
n, m = map(int, input().split()) N = [1]*n P = [True] + [False]*(n-1) for i in range(m): x, y = list(map(lambda tmp: tmp-1, map(int, input().split()))) P[y] = True if P[x]==True else P[y] N[x] -= 1 N[y] += 1 P[x] = False if N[x]==0 else P[x] print(sum(P))
p03261
s709506577
Wrong Answer
def main(): n = int(input()) word_lst = [""] * n previous_word = input() ok = True for i in range(1,n): now_word = input() if not (now_word[0] == previous_word[-1]): ok = False break print("Yes" if ok else "No") if __name__ == '__main__': main()
p02879
s956898857
Accepted
a,b=map(int,input().split()) if 0<a<10 and 0<b<10: print(a*b) else: print(-1)
p03380
s144065223
Accepted
n = int(input()) List = list(map(int,input().split())) List = sorted(List) a_j = List[-1] checker = a_j a_i = a_j for item in List: temp = abs(a_j/2 - item) if temp < checker: checker = temp a_i = item Answer = [a_j, a_i] print(*Answer)
p02600
s647610117
Accepted
x = int(input()) a = 0 if 400 <= x <= 599: a = 8 if 600 <= x <= 799: a = 7 if 800 <= x <= 999: a = 6 if 1000 <= x <= 1199: a = 5 if 1200 <= x <= 1399: a = 4 if 1400 <= x <= 1599: a = 3 if 1600 <= x <= 1799: a = 2 if 1800 <= x <= 1999: a = 1 print(a)
p02719
s712330343
Accepted
from sys import stdin, stdout N, K = map(int,stdin.readline().rstrip().split()) ans = N % K print(min(ans,abs(ans - K)))
p02571
s194645060
Accepted
s=input() t=input() max=0 count=0 for i in range(len(s)-len(t)+1): count=0 for j in range(len(t)): if s[i+j]==t[j]: count+=1 if count > max: max=count print(len(t)-max)
p02983
s870562924
Accepted
import sys import os MOD = 2019 def main(): if os.getenv("LOCAL"): sys.stdin = open("input.txt", "r") L, R = list(map(int, sys.stdin.readline().split())) ret = float('inf') if R - L >= 2019: print(0) exit() for i in range(L, R+1): for j in range(i+1, R+1): ret = min(ret, (i * j) % MOD) print(ret) if __name__ == '__main__': main()
p02793
s951344047
Accepted
from fractions import gcd def invmod(j): return pow(j, MOD - 2, MOD) N = int(input()) A = list(map(int, input().split())) MOD = 10 ** 9 + 7 l = 1 ans = 0 for i in range(N): g = gcd(l, A[i]) multip = A[i] * invmod(g) % MOD l *= multip ans *= multip ans += l * invmod(A[i]) % MOD ans %= MOD print(ans % MOD)
p02553
s725313893
Accepted
a,b,c,d=map(int,input().split()) ans=max(a*c,a*d) ans=max(ans,b*c) ans=max(ans,b*d) print(ans)
p02724
s301478087
Accepted
x = int(input()) rest = x ureshisa = 0 ureshisa += (rest // 500) * 1000 rest = rest % 500 ureshisa += (rest // 5) * 5 print(ureshisa)
p03474
s318528341
Accepted
a, b = map(int, input().split()) s = input() if s[:a].isnumeric() and s[a+1:].isnumeric() and s[a] == '-': print("Yes") else: print("No")
p02796
s545021099
Accepted
n = int(input()) a = [] for _ in range(n): c0, c1 = map(int, input().split()) a.append([c0-c1, c0+c1]) a.sort(key=lambda x: x[1]) ans, b = 1, a[0][1] for i in a[1:]: if b <= i[0]: b = i[1] ans += 1 print(ans)
p03210
s441685330
Wrong Answer
print("YES" if input() in "357" else "No")
p03221
s143061681
Accepted
from operator import itemgetter def id(n): if len(str(n)) >= 6: return str(n) return "0"*(6-len(str(n)))+str(n) n,m = map(int,input().split()) data = [[] for i in range(n+1)] for i in range(m): p,y = map(int,input().split()) data[p].append((i,y)) ans = [] for i in range(n+1): if data[i]: data[i].sort(key=itemgetter(1)) for j in range(len(data[i])): ans.append((data[i][j][0],id(i)+id(j+1))) ans.sort() for i,j in ans: print(j)
p03136
s701680916
Accepted
N = int(input()) L = sorted(list(map(int, input().split()))) if L[-1] < sum(L[:-1]): print("Yes") else: print("No")
p03962
s386340696
Wrong Answer
a, b ,c = map(int, input().split()) count = 0 if a!=b: count+=1 if b!=c: count+=1 if a!=c: count+=1 if count==1: print(1) else: print(count)
p02909
s897690225
Wrong Answer
T={'Sunny':'Cloudy','Cloudy':'Rainy','Rainy':'Sunny'} print(input(T))
p03778
s701550225
Wrong Answer
w,a,b = map(int,input().split()) c = b - a if c - w > 0: print(c - w) else: print("0")
p03774
s387749990
Accepted
N, M = map(int, input().split()) x = [list(map(int, input().split())) for _ in range(N)] y = [list(map(int, input().split())) for _ in range(M)] for a,b in x: z = [abs(a-c) + abs(b-d) for c,d in y] print(z.index(min(z))+1)
p03607
s870876425
Accepted
N = int(input()) A = [int(input()) for c in range(N)] A = sorted(A) tmp = 1 cnt = 0 for i in range(N): if i+1<N: if A[i] == A[i+1]: tmp += 1 else: cnt += tmp%2 tmp = 1 else: cnt += tmp%2 print(cnt)
p03309
s721008033
Wrong Answer
import statistics n = int(input()) a = list(map(int, input().split())) bi = [] for i in range(n): bi.append(a[i] - (i + 1)) b = statistics.median(bi) ans = 0 for i in range(n): ans += int(abs(bi[i] - b)) print(ans)
p02639
s080175733
Accepted
x_n =list(map(int,input().split())) for i in range(5): if x_n[i]==0: print(i+1)
p02731
s189830684
Accepted
L = int(input()) print((L/3)**3)
p02838
s767250952
Accepted
import numpy as np n = int(input()) a = np.array([int(x) for x in input().split()]) ans = 0 mod = pow(10, 9)+7 for i in range(100): c = np.sum((a>>i)&1) ans += (c*(n-c)%mod)*pow(2, i, mod)%mod ans %= mod print(ans)
p02951
s011983980
Accepted
a, b, c = map(int, input().split()) if a - b >= c: x = 0 else: x = c - a + b print(int(x))
p02958
s468280573
Wrong Answer
n = int(input()) p = list(map(int, input().split())) nl = list(range(n, 0, -1)) if nl == p: print("YES") exit() res = [] for i in range(n): if p[i] != nl[i]: res.append(i) if len(res) == 2: if nl[res[0]] == res[1]+1 and nl[res[1]] == res[0]+1: print("YES") exit() print("NO")
p02771
s966155318
Accepted
A = [int(_) for _ in input().split()] if len(set(A)) == 2: print('Yes') else: print('No')
p02714
s207987310
Accepted
n = int(input()) s = input() an = s.count('R') *s.count('G') *s.count('B') for i in range(n-2): for j in range(i+1,n-1): k = 2*j-i if (k<n) and (s[i]!=s[j]) and (s[j]!=s[k])and(s[i]!=s[k]): an -= 1 print(an)
p02697
s568521552
Accepted
n, m = map(int, input().split()) end = n dif = set() count = 0 for i in range(1, n+1): while end-i in dif or n+i-end in dif or end-i == n+i-end: end -= 1 print(i, end) dif.add(end-i) dif.add(n+i-end) end -= 1 count += 1 if count == m: break
p03672
s427267943
Accepted
S=[i for i in input()] n=len(S) for i in range(2,n-2+1,2): m=int((n-i)/2) SF=S[0:m] SR=S[m:m*2] if SF==SR: #print(SF,SR) print(len(SF+SR)) break
p03208
s132432732
Accepted
n, k = map(int, input().split()) ab = [int(input()) for _ in range(n)] sab = sorted(ab) res = 10**10 for i in range(n-k+1): res = min(res,sab[i+k-1]-sab[i]) print(res)
p02612
s628238227
Wrong Answer
n = int(input()) print(n%1000)
p02546
s602946270
Accepted
def resolve(): s = input() if s[-1] == "s": print(s + "es") else: print(s+"s") resolve()
p02729
s456488677
Wrong Answer
def main(): n, m = map(int, input().split()) n -= 1 m -= 1 e = 0 while n > 0: e += n print(n) n -= 1 while m > 0: e += m m -= 1 print(e) main()
p03126
s561305151
Wrong Answer
n,m = map(int ,input().split()) l=[list(map(int ,input().split())) for x in range(n)] cnt=0 ans=0 if n==1: print(l[0][0]) exit() for i in range(n): del(l[i][0]) for i in range(n): cnt=0 for j in range(1,m+1): if j in l[i]: cnt+=1 if cnt==n: ans+=1 print(ans)
p03433
s934568483
Accepted
#InfiniteCoins n = int(input()) a = int(input()) r = n % 500 if r <= a: print('Yes') else: print('No')
p03485
s447731169
Wrong Answer
# -*- coding: utf-8 -*- import math a, b = list(map(int, input().split())) a,b = 5,5 print(math.ceil((a+b)/2))
p02847
s412557808
Wrong Answer
s=input() if s=='SUN': print(7) if s=='MON': print(6) if s=='TUE': print(5) if s=='WED': print(4) if s=='THU': print(3) if s=='FRI': print(2) else: print(1)
p02923
s293631599
Accepted
import numpy as np n = int(input()) hList = np.array(list(map(int, input().split()))) mFlag = np.diff(hList) <= 0 #bFlag = False cnt=0 ret =0 for f in mFlag: if f: cnt += 1 if( ret<cnt): ret = cnt else: cnt=0 print(ret)
p02719
s355473143
Accepted
N,K = map(int,input().split()) S,A = divmod(N,K) print(min(A,abs(A-K)))
p02933
s820173179
Accepted
a=int(input()) s=input() if a>=3200: print(s) else: print("red")
p03767
s825947590
Accepted
n = int(input()) a = list(map(int, input().split())) a.sort(reverse = True) sum = 0 for i in range(n): sum = sum + a[i*2+1] print(sum)
p02971
s456269735
Accepted
# import sys # sys.setrecursionlimit(10**5) # from collections import defaultdict geta = lambda fn: list(map(fn, input().split())) gete = lambda fn: fn(input()) N = gete(int) a1, a2, i1 = 0, -1, -1 for i in range(N): ai = gete(int) if ai >= a1: a1, a2 = ai, a1 i1 = i elif ai >= a2: a2 = ai if a1 == a2: print(*[a1] * N, sep="\n") else: print(*[a2 if i == i1 else a1 for i in range(N)], sep="\n")
p02647
s044906316
Accepted
import numpy as np from numba import njit N,K = map(int, input().split()) A = np.array(list(map(int, input().split()))) @njit def main(N, K, A): for _ in range(min(K, 42)): A_ = np.zeros_like(A) for n in range(N): A_[max(0, n - A[n])] += 1 if n + A[n] + 1 < N: A_[n + A[n] + 1] -= 1 A = A_.cumsum() return A print(*main(N, K, A))
p03479
s153733098
Wrong Answer
import math x,y=map(int,input().split()) print(math.floor(math.log2(y//x))+1)
p02754
s862377550
Accepted
n, a, b = map(int, input().split()) q = n // (a + b) x = a * q w = n % (a + b) if w >= a: y = a else: y = w ans = x + y print(ans)
p03659
s820095563
Wrong Answer
n=int(input()) a=list(map(int,input().split())) t=sum(a) m=10**9 flag=0 for i in range(len(a)-1): t-=2*a[i] m=min(abs(t),m) print(m)
p02676
s008220147
Accepted
k = int(input()) s = input() if len(s) <= k: print(s) else: print(f"{s[:k]}...")
p03319
s605106969
Accepted
N,K = map(int, input().split()) print(-(-(N-1)//(K-1)))
p03543
s600826908
Accepted
A = int(input()) p = A % 10 A //= 10 q = A % 10 A //= 10 r = A % 10 s = A // 10 if p == q == r or q == r == s: print("Yes") else: print("No")
p02952
s851405677
Wrong Answer
n = int(input()) res = 0 for i in range(n + 1): if len(str(i)) % 2 == 1: res += 1 print(res)
p02777
s585207561
Accepted
s, t = map(str, input().split()) a, b = map(int, input().split()) u = str(input()) if u == s: print(a - 1, b) elif u == t: print(a, b - 1)
p02601
s238494896
Accepted
a,b,c = map(int, input().split()) k = int(input()) x = 0 while b <= a: b *= 2 x += 1 while c <= b: c *= 2 x += 1 if x <= k: print('Yes') else: print('No')
p02923
s178640869
Accepted
n=int(input()) h=list(map(int,input().split())) ans=0 tmp=0 for i in range(n-1): if h[i] >= h[i+1]: tmp+=1 ans=max(ans,tmp) else: tmp=0 print(ans)
p02623
s124020856
Accepted
#ABC172 C Tsundoku 22:34 from itertools import accumulate n,m,k = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) s_A = [0]+list(accumulate(A)) s_B = [0]+list(accumulate(B)) ans,j = 0, m for i in range(n+1): if s_A[i] > k: break while s_B[j] > k - s_A[i]: j -= 1 ans = max(ans, i+j) print(ans)
p02813
s907708781
Wrong Answer
import itertools n=int(input()) pp=input().split() qq=input().split() p=[] q=[] p.append(pp) q.append(qq) a=[] for v in itertools.permutations(pp,n): a.append(v) a=sorted(a) for j in range(len(a)): a[j]=list(a[j]) b=0 c=0 for i in range(len(a)): if a[i]==pp: b+=i elif a[i]==qq: c+=i print(max(b-c,c-b))
p02677
s903422597
Wrong Answer
import numpy as np A,B,H,M = map(int,input().split()) th_a = 30 * H th_b = 6 * M theta = th_a - th_b C = np.sqrt(A**2 + B**2 - 2*A*B*np.cos(theta))
p02552
s717230122
Accepted
x = int(input()) if x == 1: print(0) else: print(1)
p03408
s950036222
Accepted
n = [input() for i in range(int(input()))] m = [input() for i in range(int(input()))] words = list(set(n)) print(max(0,max(n.count(words[i])-m.count(words[i]) for i in range(len(words)))))
p03944
s183611550
Wrong Answer
W,H,N = map(int,input().split()) x_r = W x_l = 0 y_r = H y_l = 0 for _ in range(N): x,y,a = map(int,input().split()) if a == 1: x_l = max(x,x_l) elif a == 2: x_r = min(x,x_r) elif a == 3: y_l = max(y,y_l) else: y_r = min(y,y_r) print(max(0,(x_r-x_l)*(y_r-y_l)))
p02994
s227702621
Accepted
lst = input() lst = lst.split() for i in range(len(lst)): lst[i]= int(lst[i]) N = lst[0] L = lst[1] q = L l = 0 lste = [abs(L)] tlst = [] for i in range(2,N+1): t = L+i-1 q += t tlst.append(t) t = abs(t) lste.append(t) slst = sorted(lste) l = slst[0] if tlst.count(-l) > 0: print(q+l) else: print(q-l)
p02706
s671298313
Accepted
N, M = tuple(int(n) for n in input().split()) As = [int(n) for n in input().split()] for A in As: N -= A print(max(N, -1))
p02724
s624710425
Accepted
X = int(input()) print(1000*(X//500) + 5*((X%500)//5))
p03012
s503797316
Accepted
n = int(input()) s = list(map(int,input().split())) print(min([abs(sum(s[:i+1]) - sum(s[i+1:])) for i in range(n)]))
p03087
s881082616
Accepted
N,Q =map(int,input().split()) S = input() lr = [list(map(int,input().split())) for _ in range(Q)] ans = 0 ans_ls = [] ans_ls.append(0) for n in range(N-1): if S[n] == "A" and S[n+1] =="C": ans += 1 ans_ls.append(ans) for q in range(Q): print(ans_ls[lr[q][1]-1]-ans_ls[lr[q][0]-1])
p03293
s596049305
Accepted
import sys readline = sys.stdin.buffer.readline MOD = 10**9+7 INF = float('inf') def main(): S = input() T = input() L = len(S) bl = False for i in range(L): s = S[-i:] + S[:-i] if T == s: bl = True print('Yes' if bl else 'No') if __name__ == '__main__': main()
p02833
s229452848
Wrong Answer
N = int(input()) ans = 0 if N % 2 == 1: print(ans) else: for i in range(1, 20): a = N // (2 * (5**i)) ans += a if a == 0: break print(ans)
p03011
s937196114
Wrong Answer
p,q,r = map(int,input().split()) print(min(p+q,q+r,r+q))
p03785
s098163749
Accepted
n,c,k = map(int,input().split()) t = [0]*n for i in range(n): t[i] = int(input()) t = sorted(t) ans = 0 s = 0 u = float("Inf") for i in range(n-1): s += 1 u = min(u, t[i]) if s == c or t[i+1] > u + k: ans += 1 s = 0 u = float("Inf") print(ans+1)
p02613
s728526199
Wrong Answer
n = int(input()) ans = {'AC': 0, 'WA':0, 'TLE':0, 'RE':0} for i in range(n): s = input() ans[s] = ans[s] + 1 for s in ans.keys(): print("{} × {}".format(s, ans[s]))