problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03385
s164070514
Accepted
def main(): S = list(str(input())) if S[0] != S[1] and S[1] != S[2] and S[0] != S[2]: print('Yes') else: print('No') main()
p02897
s869017794
Accepted
n = int(input()) print('{:.8f}'.format((n//2 + (n%2))/n))
p02910
s482239351
Accepted
list_s = list(input()) for i in range(0, len(list_s)): if list_s[i] == 'U' or list_s[i] == 'D': continue elif (i % 2 == 0 and list_s[i] == 'R') or (i % 2 != 0 and list_s[i] == 'L'): continue else: print("No") exit() print("Yes")
p02958
s568233457
Accepted
n,a,c = raw_input(),map(int, raw_input().split(' ')), 0 for i in range(len(a)): if a[i] != i+1: c+=1 print 'YES' if c <=2 else 'NO'
p03435
s150292922
Accepted
c = [[int(i) for i in input().split()] for _ in range(3)] x = 0 for i in range(2): if c[0][i] - c[0][i + 1] == c[1][i] - c[1][i + 1] == c[2][i] - c[2][i + 1]: x += 1 for i in range(2): if c[i][0] - c[i + 1][0] == c[i][1] - c[i + 1][1] == c[i][2] - c[i + 1][2]: x += 1 if x == 4: print("Yes") else: print("No")
p03293
s405475859
Wrong Answer
S= list(input()) T= list(input()) N=len(S) flag=0 for i in range(N): if S[0]!=T[0]: T.append(T[0]) del T[0] elif S[0]==T[0]: #print(i,T) flag=1 for j in range(1,N): if S[j]!=T[j]: flag=0 break print('Yes' if flag==1 else 'No')
p03328
s729777357
Accepted
a,b=(int(i) for i in input().strip().split(" ")) n=b-a k=(n*(n+1))//2 print(k-b)
p02900
s401618400
Accepted
a,b=map(int,input().split()) g=1 while 1: if a==b: g=a break if a<b: k=a a=b b=k a-=b ans=1 i=2 while i*i<=g: if g%i==0: ans+=1 while g%i==0: g//=i i+=1 if g!=1: ans+=1 print(ans)
p03095
s547482759
Accepted
n=int(input()) s=list(input()) import collections c=collections.Counter(s) c=c.most_common() ans=1 for i in range(len(c)): ans *= (c[i][1]+1) print((ans-1)%(10**9+7))
p02838
s336840293
Wrong Answer
n=int(input()) a=list(map(int,input().split())) m=10**9+7 bo=[0]*61 bz=[0]*61 for i in a: t=format(i,'061b') for j in range(61): if t[j]=='0': bz[j]+=1 else: bo[j]+=1 bo=bo[::-1] bz=bz[::-1] x=0 for i in range(61): x+=bo[i]*bz[i]*(2**i) print(x)
p03252
s848553166
Accepted
S=input() T=input() #条件は、SとTで、同じ文字が同じ場所に同数存在していること d={} #used=set() for (s,t) in zip(S,T): try: if d[s]!=t: print("No") exit() except KeyError: #sとtの対応関係を記録 d[s]=t v=d.values() if len(v)!=len(set(v)): print("No") else: print("Yes")
p02910
s975720059
Wrong Answer
import sys s=list(input()) odd=["R","U","D"] even=["L","U","D"] for i in range(len(s)): if i%2==0: if s[i] not in even: print("No") sys.exit() else: if s[i] not in odd: print("No") sys.exit() print("Yes")
p02899
s291969429
Accepted
N = int(input()) A = list(map(int, input().split())) record = [] for i, a in enumerate(A): record += [(i, a)] print(' '.join([str(s[0] + 1) for s in sorted(record, key=lambda x:x[1])]))
p03493
s952665584
Accepted
s = input() print(s.count('1'))
p03861
s771273134
Wrong Answer
import math A, B, X = [int(s) for s in input().split()] def main(): a = math.ceil(A / X) b = math.floor(B / X) print(b - a + 1) if __name__ == '__main__': main()
p03095
s041800921
Accepted
from collections import Counter n = int(input()) d = Counter(list(input())) val = d.values() ans = 1 for i in val: ans *= (i + 1) ans %= 10**9 + 7 print(ans - 1)
p03607
s799187525
Wrong Answer
from collections import Counter N = int(input()) a = [] for i in range(N): inputs = int(input()) a.append(inputs) ans = dict(Counter(a)) ans = [kv[0] for kv in ans.items() if kv[1]==1] print(len(ans))
p02661
s944907831
Wrong Answer
n = int(input()) ab =[list(map(int,input().split())) for _ in range(n)] a = [] b =[] for x in ab: a.append(x[0]) b.append(x[1]) a.sort() b.sort() ca,cb =0,0 if n % 2 == 0: ca = (a[n//2-1] + a[n//2])//2 cb = (b[n//2-1] + b[n//2])//2 ans = (cb-ca) / 0.5 +1 else: ca = a[(n+1)//2-1] cb = b[(n+1)//2-1] ans = (cb-ca) +1 print(int(ans))
p03944
s889942522
Wrong Answer
W, H, N = [int(i) for i in input().split()] xya = [] for _ in range(N): xya.append([int(i) for i in input().split()]) xmin = 1 ymin = 1 xmax = W ymax = H for i in xya: if i[2] == 1: xmin = min(xmin, i[0]) elif i[2] == 2: xmax = max(xmax, i[0]) elif i[2] == 3: ymin = min(ymin, i[1]) else: ymax = max(ymax, i[1]) s = (xmax - xmin) * (ymax - ymin) if s > 0: print(s) else: print(0)
p03285
s714093805
Wrong Answer
def judge_47(n): if n < 4: return False if 4 < n < 7: return False if n % 4 == 0 or n % 7 == 0: return True if n % 4 == 3: return (n - ((n // 4) - 1) * 4) % 7 == 0 if n % 4 < 3: return (n - ((n // 4) - 2) * 4) % 7 == 0 def main(): n = int(input()) if judge_47(n): print('Yes') else: print('No') if __name__ == '__main__': main()
p02909
s308830427
Accepted
#!/usr/bin/env python3 def main(): di = {"Sunny": "Cloudy", "Cloudy": "Rainy", "Rainy": "Sunny"} print(di[input()]) if __name__ == "__main__": main()
p02693
s564502780
Accepted
K = int(input()) A,B = map(int, input().split()) str = "NG" for i in range(A, B+1): if i % K == 0: str = "OK" print(str)
p02743
s482584465
Wrong Answer
a, b, c = map(int, input().split()) if 2 * a**0.5 * b**0.5 < c-a-b: print('Yes') else: print('No')
p03804
s440477423
Accepted
def match(y, x): ret = True for i in range(M): for j in range(M): if A[y + i][x + j] != B[i][j]: ret = False return ret N, M = map(int, input().split()) A = [] for i in range(N): A.append(list(input())) B = [] for i in range(M): B.append(list(input())) flg = False for i in range(N - M + 1): for j in range(N - M + 1): if match(i, j): flg = True print("Yes" if flg else "No")
p03061
s937647954
Wrong Answer
import sys import fractions from functools import reduce from copy import copy input = sys.stdin.readline def gcd_list(numbers): return reduce(fractions.gcd, numbers) n = int(input()) a = list(map(int,input().split())) ans = gcd_list(a) for i in range(n): l = copy(a) l.pop(i) if ans < gcd_list(l): ans = gcd_list(l) break print(ans)
p03474
s472460402
Accepted
A, B = map(int, input().split()) S = list(input()) for i in range(len(S)): if i <= A-1: if S[i] not in [str(i) for i in range(10)]: print('No') exit() if i == A: if S[i] != '-': print('No') exit() else: if S[i] not in [str(i) for i in range(10)]: print('No') exit() print('Yes')
p02780
s001364506
Wrong Answer
n,k = map(int,input().split()) p = list(map(int,input().split())) max=0 sump=0 mxpst=0 ans=0 for i in range(k): max+=p[i] sump=max for i in range(n-k): sump=p[i+k]+max-p[i] if sump>max: max=sump mxpst=i+1 for i in range(k): for j in range(1,p[mxpst+i]+1): ans+=j/p[mxpst+i] print(ans)
p03239
s935270028
Wrong Answer
# その19 ABC112 B - Time Limit Exceeded N,T = map(int,input().split()) C = [] D = [] for i in range(N): A,B = map(int,input().split()) C.append(A) D.append(B) if min(D) > T: print('TLE') else : F=[] for i in range(N): if min(D) == D[i]: F.append(C[i]) print(min(F))
p03331
s908531474
Wrong Answer
N = int(input()) n = N - 1 A = list(str(n)) A = list(int(n) for n in A) ans1 = sum(A) + 1 n = N // 2 A = list(str(n)) A = list(int(n) for n in A) ans2 = 2 * sum(A) ans = min(ans1, ans2) print(ans)
p02888
s995657961
Accepted
# https://takeg.hatenadiary.jp/entry/2019/11/22/212816 # https://drken1215.hatenablog.com/entry/2019/10/20/032700 import bisect N = int(input()) L = list(map(int, input().split())) L.sort() ans = 0 for a in range(N): for b in range(a+1, N): c = bisect.bisect_left(L, L[a] + L[b]) # print(a, b, c) ans += max(c-(b+1), 0) # print(ans) print(ans)
p03698
s654166109
Accepted
S = list(input()) if len(S) != len(set(S)): print('no') else: print('yes')
p03293
s361265751
Accepted
s=input() t=input() s+=s print("Yes" if t in s else "No")
p02848
s478175961
Accepted
n = int(input()) s = input() num = [] #Aは65番,Zは90番 for i in s: num.append(ord(i)) for i in range(len(num)): if num[i]+n>90: num[i] = chr(num[i]+n-90+64) else: num[i] = chr(num[i]+n) a = "" for i in num: a += i print(a)
p03773
s507640702
Accepted
a, b = map(int, input().split()) print((a + b) % 24)
p03862
s573270233
Accepted
n, x, *a = map(int, open(c:=0).read().split()) for i in range(n - 1): s = max(a[i] + a[i + 1] - x, 0) a[i + 1] -= s if a[i + 1] < 0: a[i] += a[i + 1] a[i + 1] = 0 c += s print(c)
p03339
s241202723
Accepted
n = int(input()) s = input() ans = float('inf') w_left = [0] e_right = [0]*n for i in range(1,n): if s[i-1] == 'W': w_left.append(w_left[i-1]+1) else : w_left.append(w_left[i-1]) for i in range(1,n): if s[n-i] == 'E': e_right[n-i-1] = e_right[n-i]+1 else : e_right[n-i-1] = e_right[n-i] for i in range(n): ans = min(ans , w_left[i]+e_right[i]) print(ans)
p02759
s027452683
Accepted
N=int(input()) if(N%2==1): print(N//2+1) else: print(N//2)
p03042
s925671206
Accepted
S=input() a=int(S[:2]) b=int(S[2:]) if 1<=a<=12 and 1<=b<=12: print("AMBIGUOUS") elif 1<=a<=12: print("MMYY") elif 1<=b<=12: print("YYMM") else: print("NA")
p02687
s038298567
Accepted
S = input() if S == "ABC": print("ARC") else: print("ABC")
p02555
s024653924
Accepted
MOD = 10 ** 9 + 7 s = int(input()) if s == 0 or s == 1: print(0) else: ans = [1, 0, 0] for i in range(3, s + 1): ans.append(ans[i - 1] + ans[i - 3]) print(ans[-1] % MOD)
p02689
s630501657
Wrong Answer
def abc166_c(): n, m = map(int, input().split()) H = list(map(int, input().split())) path = dict([(i, []) for i in range(n)]) for _ in range(m): a, b = map(int, input().split()) path[a-1].append(b-1) path[b-1].append(a-1) ans = 0 for i in range(n): my_h = H[i-1] if len(path[i]) == 0: ans += 1 else: adj_h = [H[j] for j in path[i]] if my_h > max(adj_h): ans += 1 print(ans) abc166_c()
p02548
s804706526
Accepted
n = int(input()) ans = 0 for i in range(1,n+1): if i > n: break ans += n//i if n//i * i == n: ans -= 1 print(ans)
p02768
s524375686
Accepted
N, A, B = map(int, open(0).read().split()) MOD = 10 ** 9 + 7 def comb(n, k): ret = 1 for i in range(1, k + 1): ret = ret * (n - i + 1) % MOD ret = ret * pow(i, MOD - 2, MOD) % MOD return ret print((pow(2, N, MOD) - 1 - comb(N, A) - comb(N, B)) % MOD)
p02694
s671932467
Wrong Answer
from math import floor,ceil X = input() X = int(X) cash = 100 count = 0 while cash <= X: cash*=1.01 count += 1 print(count)
p03803
s213228493
Accepted
# coding: utf-8 A, B = map(int, input().split()) if (A > B and B != 1) or (A == 1 and B != 1): print('Alice') elif A == B: print('Draw') else: print('Bob')
p02780
s048682924
Accepted
import numpy n,k = map(int,input().split()) li = [(int(x)*(int(x)+1))/(2*int(x)) for x in input().split()] a = numpy.cumsum(li) ans = 0 for i in range(n-k+1): if i == 0: ans = a[i+k-1] else: if ans < (a[i+k-1] - a[i-1]): ans = a[i+k-1] - a[i-1] print(ans)
p02714
s756100408
Accepted
n = int(input()) s = input() ans = s.count('R') * s.count('G') * s.count('B') for i in range(n-2): for j in range(i+1, n-1): if j - i > n - j - 1: break if s[i] != s[j] and s[j] != s[2*j-i] and s[2*j-i] != s[i]: ans -= 1 print(ans)
p02953
s285748129
Accepted
N = int(input()) H = list(map(int, input().split())) for i in range(len(H)-2, -1, -1): if H[i] - H[i+1] == 1: H[i] -= 1 elif H[i] - H[i+1] >= 2: print("No") exit() else: continue print("Yes")
p02773
s494169391
Accepted
#C N = int(input()) memo = {} max_word = 1 for i in range(N): Si = input() try: memo[Si] += 1 max_word = max(max_word, memo[Si]) except: memo[Si] = 1 keys = [k for k, v in memo.items() if v == max_word] keys.sort() for item in keys: print(item)
p02988
s084360210
Accepted
n = int(input()) P = list(map(int,input().split())) cnt = 0 for i in range(1,n-1): if min(P[i-1],P[i],P[i+1]) < P[i] and max(P[i-1],P[i],P[i+1]) > P[i]: cnt += 1 print(cnt)
p03042
s952268232
Accepted
S = input() if int(S[:2]) != 0 and int(S[:2]) <= 12: if int(S[2:]) != 0 and int(S[2:]) <= 12: print("AMBIGUOUS") else:print("MMYY") else: if int(S[2:]) != 0 and int(S[2:]) <= 12: print("YYMM") else:print("NA")
p02714
s475850915
Accepted
n=int(input()) s=input() r=s.count("R") g=s.count("G") b=s.count("B") ans=r*g*b for i in range(n): for j in range(n): if i+j+j>=n: break s1=s[i] s2=s[i+j] s3=s[i+j*2] if s1!=s2 and s2!=s3 and s1!=s3: ans-=1 print(ans)
p03285
s671967430
Wrong Answer
n = int(input()) for i in range(n): for j in range(n): if 3*i+7*j == n: print('Yes') else: print('No')
p02677
s132069461
Accepted
import math A, B, H, M = map(int, input().split()) KA = H / 12 * 360 + ((M / 60) * (360 / 12)) KB = M / 60 * 360 K = abs(KA - KB) if K > 180: K = 360 - K # if K == 180: # print(A + B) # exit() # if K == 0: # print(abs(B - A)) # exit() cosB = round(math.cos(math.radians(K)), 13) cc = A ** 2 + B ** 2 - (2 * B * A * cosB) print(math.sqrt(cc))
p03657
s643389506
Accepted
a, b = map(int, input().split()) print("Possible" if a % 3 == 0 or b % 3 == 0 or (a+b)%3 == 0 else "Impossible")
p03836
s856971755
Wrong Answer
x_s, y_s, x_t, y_t = map(int, input().split()) dist_x, dist_y = x_t - x_s, y_t - y_s ans = "" ans += ("R" * dist_x) ans += ("U" * dist_y) ans += ("L" * dist_x) ans += ("D" * dist_y) ans += "U" ans += ("R" * (dist_x + 1)) ans += ("U" * (dist_y + 1)) ans += "LL" ans += ("L" * (dist_x + 1)) ans += ("D" * (dist_y + 1)) ans += "R" print(ans)
p03206
s601780941
Wrong Answer
D = int(input()) print("Christmas"+" Eve"*(D-25))
p02783
s124981810
Wrong Answer
h, attack = map(int, input().split()) if h%attack != 0: ans = h//attack + 1 else: ans = h/attack print(ans)
p02547
s078672753
Accepted
s = int(input()) count = 0 for i in range(s): dice1, dice2 = map(int, input().split()) if dice1 == dice2: count += 1 if count >= 3: print("Yes") break else: count = 0 else: print("No")
p03592
s153347755
Wrong Answer
n, m, k = map(int, input().split()) for i in range(1, n + 1): for j in range(1, m + 1): if i * (m - j) + (n - i) * j == k: print('Yes') exit() print('No')
p03109
s160390109
Wrong Answer
s = input() print("Heisei" if s<"2019/04/30" else "TBD")
p03711
s504996148
Accepted
x, y = map(int, input().split()) group1 = [1, 3, 5, 7, 8, 10, 12] group2 = [4, 6, 9, 11] flag = False if x in group1 and y in group1: flag = True elif x in group2 and y in group2: flag = True if flag: print('Yes') else: print('No')
p03239
s604315821
Accepted
n, t = map(int, input().split()) INF = 10**10 min_c = 10**10 for _ in range(n): ci, ti = map(int, input().split()) if ti > t: continue min_c = min(ci, min_c) if min_c == INF: print('TLE') exit() print(min_c)
p03239
s114459996
Accepted
n, t = map(int, input().split()) cost = 10**4 for _ in range(n): c, tt = map(int, input().split()) if tt <= t: cost = min(cost, c) print('TLE') if cost == 10**4 else print(cost)
p02843
s025796973
Accepted
x=int(input()) for i in range(1001): for j in range(100*i,105*i+1): if x==j: print(1) exit(0) print(0)
p02910
s769872849
Wrong Answer
S = input() #print(len(S)) flag= 0 for i in range(len(S)): #print(i,S[i]) if i % 2 == 0: if S[i] != "L" and S[i] != "U" and S[i] != "D": #print(i,S[i]) flag = 1 elif i % 2 !=0: if S[i] != "R" and S[i] != "U" and S[i] != "D": #print(i,S[i]) flag = 1 if flag == 0: print("Yes") else: print("No")
p02923
s923228431
Accepted
import bisect n = int(input()) h = list(map(int, input().split())) ans = 0 i = 0 lmax = 0 while i < n: if i+1 < n and h[i] >= h[i+1]: lmax+=1 ans = max(ans, lmax) else: lmax = 0 i+=1 print(ans)
p02922
s291511492
Accepted
A,B=map(int,input().split()) socket=1 tap=0 while socket<B: socket+=A-1 tap+=1 print(tap)
p02777
s872559038
Accepted
import sys def main(): k = input().replace('\n','').split() a = input().replace('\n','').split() u = input().replace('\n','') a[k.index(u)]=int(a[k.index(u)]) - 1 print(str(a[0]) + ' ' + str(a[1])) if __name__ == '__main__': input = sys.stdin.readline main()
p02873
s468711033
Accepted
S = input() A = [-1, ] * (len(S) + 1) cnt = 0 for i in range(0, len(S)): if S[i] == '<': A[i] = cnt cnt += 1 A[i + 1] = cnt else: cnt = 0 cnt = 0 for i in range(len(S) - 1, -1, -1): if S[i] == '>': A[i + 1] = cnt cnt += 1 A[i] = max(cnt, A[i]) else: cnt = 0 print(sum(A))
p02732
s510289214
Wrong Answer
from collections import Counter N = int(input()) A = list(map(int, input().split())) counter = Counter(A) ans = 0 for k, v in counter.items(): if 2 <= v: ans += v * (v - 1) // 2 for a in A: if a in counter and 2 <= counter[a]: v = counter[a] diff = v * (v - 1) // 2 - ((v- 1) * (v - 2) // 2) print(ans - diff) else: print(0)
p02767
s661133390
Accepted
n = int(input()) x = list(map(int, input().split())) rec = [] for p in range(1,101): s = 0 for i in x: s += (i-p)**2 rec.append(s) rec.sort() print(rec[0])
p02714
s185728369
Accepted
N = int(input()) S = list(input()) r,g,b = 0,0,0 k = 0 buf = 0 for i in range(N) : if S[i] == 'R' : r += 1 elif S[i] == 'G' : g += 1 else : b += 1 for j in range(N) : for i in range(j) : k = 2 * j - i if k <= N-1 : if S[i] != S[j] and S[i] != S[k] and S[j] != S[k] : buf += 1 print(r*g*b - buf)
p02773
s746599067
Wrong Answer
import collections n = int(input()) l =[] for i in range(n): t = input() l.append(t) d = collections.Counter(l) m = max(d.values()) for k,v in d.items(): if v == m: print(k)
p03695
s952126469
Accepted
n = int(input()) a = list(map(int,input().split())) lst = [0] * 8 s = 0 for i in a: if i >= 3200: s += 1 else: i //= 400 lst[i] += 1 colour = 0 for i in lst: if i >= 1: colour += 1 m = max(1, colour) M = colour + s print(m, M)
p03286
s563169883
Accepted
n = int(input()) if n==0: print('0') exit(0) i = 1 s = [] while n!=0: if n%2**i>0: s.append('1') n -= (-2)**(i-1) else: s.append('0') i += 1 print(''.join(s[::-1]))
p03767
s218737338
Accepted
n = int(input()) a = list(map(int, input().split())) a.sort() ans = 0 for i in range(n): ans += a[-(i+1)*2] print(ans)
p02818
s157394138
Accepted
A,B,K = (int(x) for x in input().split()) if A > K: print(A-K,B) elif A+B>K: print(0,B-K+A) else: print(0,0)
p02786
s616272086
Accepted
H = int(input()) def f(n): if n == 1: return 1 else: return 2*f(int(n//2)) + 1 print(f(H))
p02780
s655010503
Accepted
n, k = map(int, input().split()) p = list(map(int, input().split())) def expect(a): return 0.5 * (a+1) total = 0 for i in range(k): total += expect(p[i]) r = [total] for j in range(n-k): total = total-expect(p[j])+expect(p[j+k]) r.append(total) print(max(r))
p02819
s384817359
Wrong Answer
x = int(input()) for i in range(x, 2*x): n = 0 if i % 2 == 0: pass else: for j in range(2, i+1): if i % j == 0: n += 1 if n == 1: print(i) break
p03241
s380437568
Wrong Answer
N,M = map(int,input().split()) ds = set() n = 1 while n*n <= M: if M%n==0: ds.add(n) ds.add(M//n) n += 1 ans = 1 for d in ds: if d <= N: ans = max(ans, d) print(ans)
p02552
s902357621
Accepted
x = int(input()) print(int(not x))
p03639
s016583422
Wrong Answer
n=int(input()) a=list(map(int,input().split())) cnt1=0#奇数 cnt2=0#2で一回割れる。隣り合うと4の倍数 cnt4=0#4で一回割れる。隣がなんでも4の倍数 for i in range(n): if a[i]%2==1: cnt1+=1 elif format(a[i], 'b')[::-1].find('1')==1: cnt2+=1 else: cnt4+=1 if cnt2>=2: print('Yes') if cnt4>=(n-cnt2%2)//2 else print('No') else: print('Yes') if cnt4>=n//2 else print('No')
p02761
s510356896
Accepted
import sys def LI(): return [int(s) for s in input().split()] N,M = LI() check = {} for i in range(M): s,c = LI() if N >= 2 and s == 1 and c == 0: print(-1) sys.exit() if s in check.keys(): if check[s] != c: print(-1) sys.exit() check[s] = c answer = ['0']*N if len(answer) > 1: answer[0] = '1' for s,c in check.items(): answer[s-1] = str(c) print(int(''.join(answer)))
p03719
s559921933
Wrong Answer
icase=0 if icase==0: a,b,c=map(int,input().split()) if a<=c and c<=b: print("YES") else: print("NO")
p02780
s064096434
Accepted
n,k = map(int,input().split()) p = list(map(int,input().split())) pp = list(map(lambda x:(x+1)/2,p)) p_rui = [pp[0]] for i in range(1,n): p_rui.append(p_rui[i-1]+pp[i]) walist=[p_rui[k-1]] for i in range(0,n-k): walist += [p_rui[k+i]-p_rui[i]] print(max(walist))
p02918
s740125487
Accepted
N,K = map(int,input().split()) S = input() score = 0 for i in range(N-1): if S[i] == S[i+1]: score += 1 ans = min(score+2*K, N-1) print(ans)
p03328
s573063702
Accepted
a,b=map(int,input().split()) n=b-a ans=n*(n-1)//2-a print(ans)
p03324
s096638290
Wrong Answer
D, N = map(int, input().split()) if N < 100: ans = N * 100 ** D else: ans = N * 100 ** D + 1 print(ans)
p02629
s574470169
Accepted
def main(): name = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] N = int(input()) y = N ans = [] for i in range(100): y -= 1 x = y%26 y = y//26 ans.insert(0,name[x]) if y == 0: break print(''.join(ans)) if __name__ == '__main__': main()
p03695
s008917822
Accepted
n = int(input()) A = list(map(int, input().split())) R = [0 for i in range(9)] for i in range(n): if A[i] < 3200: R[A[i]//400] += 1 else: R[8] += 1 mi = 0 for i in range(8): if R[i] > 0: mi += 1 if mi == 0 and R[8] > 0: print(mi+1, mi+R[8]) else: print(mi, mi+R[8])
p02987
s826221484
Accepted
import re S = input() s = set(S) m = re.findall(S[0],S) m if len(s) == 2: if len(m) == 2: print('Yes') exit() print('No')
p02760
s310174080
Accepted
a1=list(map(int,input().split())) a2=list(map(int,input().split())) a3=list(map(int,input().split())) n=int(input()) a=a1+a2+a3 b=set([int(input()) for _ in range(n)]) c1=set(a[0::3]) c2=set(a[1::3]) c3=set(a[2::3]) c4=set([a1[0],a2[1],a3[2]]) c5=set([a1[2],a2[1],a3[0]]) c=[set(a1),set(a2),set(a3),c1,c2,c3,c4,c5] j = any(len(b&x)==3 for x in c) print('Yes' if j else 'No')
p02786
s347963236
Accepted
import numpy as np N = int(input()) N = bin(N) x = len(str(N)) - 2 print(2 ** x - 1)
p03617
s959918469
Wrong Answer
q,h,s,d = map(int,input().split()) n = int(input()) p = [] p.append([q*8,q,0.25]) p.append([h*4,h,0.5]) p.append([s*2,s,1]) p.append([d,d,2]) p.sort() ans = 0 for i in range(4): if n%p[i][2] == 0: ans += n//p[i][2]*p[i][1] print(int(ans)) exit() else: ans += n//p[i][2]*p[i][1] n %= p[i][2]
p03680
s860157021
Wrong Answer
import sys n = int(input()) a = [int(input()) for a in range(n)] cnt = 1 a.insert(0,0) sel = a[1] for i in range(n+1): if a[sel] == 2: cnt += 1 print(cnt) sys.exit() else: cnt += 1 sel = a[sel] print(-1)
p03998
s436566429
Accepted
S={abc:list(input()) for abc in "abc"} s="a" while S[s]: s=S[s].pop(0) print(s.upper())
p04029
s279331054
Wrong Answer
n = '' command = input() for i in command: if i =="B": n=n[:-1] else: n+=i print(n)
p03408
s799206001
Wrong Answer
N=int(input()) l=[] m=[] while N>0: a=input() l.append(a) N-=1 M=int(input()) while M>0: b=input() m.append(b) M-=1 print(sorted(l)) print(sorted(m))