problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02760
s251594030
Wrong Answer
import numpy as np def check_bingo(A): for i in range(3): if np.all(A[i] == 0) or np.all(A[:, i] == 0): return 'Yes' if np.all(A[list(range(3)), list(range(3))] == 0): return 'Yes' return 'No' def main(): A = np.array([list(map(int, input().split())) for _ in range(3)]) ...
p02578
s660138356
Wrong Answer
N=int(input()) A=list(map(int,input().split())) F=0 for i in range(1,N): if A[i]<A[i-1]: F+=A[i-1]-A[i] print(F)
p03617
s242068498
Accepted
import sys sys.setrecursionlimit(10 ** 7) input = sys.stdin.readline q, h,s,d, = map(int, input().split()) n = int(input()) ans = 0 qqqq = q*4 hh = h*2 best1 = min(qqqq,hh,s) if n ==1: print(best1) exit() if d >= best1*2: print(n*best1) exit() else: d_ = n//2 n -= d_*2 ans += d*d_ ...
p03103
s366065532
Wrong Answer
N,M = map(int,input().split()) AB =[list(map(int,input().split())) for i in range(N)] AB = sorted(AB) total=0 for i in range(N): if AB[i][1]>M: total = total + AB[i][0]*M else: total = total + AB[i][0]*AB[i][1] M = M - AB[i][1] print(total)
p02602
s119942650
Accepted
import sys N, K = map(int,input().split()) A = [int(x) for x in input().split()] def solve(N, K, A): """ N <= 200,000 """ for i in range(K,N): prev = A[i-K] P = A[i] if prev >= P: print("No") else: print("Yes") solve(N, K, A)
p02633
s501687086
Accepted
def gcd(a, b): return a if b == 0 else gcd(b, a % b) ans = 360 // (gcd(360, int(input()))) print(ans)
p02594
s266256958
Accepted
n = int(input()) if n >= 30: print("Yes") else: print("No")
p03814
s972918001
Wrong Answer
s = input() for a in range(len(s)): if s[a]=='A': break s = s[::-1] for z in range(len(s)): if s[z] =='Z': break s= s[::-1] print(len(s[a:-z]))
p03449
s946965642
Wrong Answer
N = int(input()) A = list(map(int,input().split())) B = list(map(int,input().split())) ans = 0 for i in range(N): if sum(A[i+1:]) + B[N-1] <= sum(B[i:]): print(ans + A[i] + sum(B[i:])) exit() else: ans += A[i] print(ans)
p03493
s813097491
Accepted
a,b,c = map(int,input()) total = sum([a,b,c]) print(total)
p03437
s608265368
Accepted
x,y=map(int,input().split()) if x>=y and x%y==0: print(-1) elif x<y: print(x) else: print(x*y-x)
p03485
s565333587
Wrong Answer
import sys input = sys.stdin.readline #------------- a,b = map(int,input().split()) #------------- x = (a+b)/2 y = x//1 mod = x%1 if mod == 0: print(y) else: print(y+1)
p03448
s188272493
Wrong Answer
A = int(input()) B = int(input()) C = int(input()) X = int(input()) i=0 for a in range(0,A+1): for b in range(0,B+1): for c in range(0,C+1): 500*a + 100*b + 50*c == X i = i+1 print(i)
p03449
s861318668
Accepted
n=int(input()) a=list(map(int,input().split())) b=list(map(int,input().split())) ans=0 for i in range(n): ans=max(ans,sum(a[:i+1])+sum(b[i:])) print(ans)
p02702
s133207706
Accepted
s = input() res = [0 for i in range(2019)] res[0] += 1 resten = 1 ressum = int(s[-1]) res[ressum] += 1 for i in range(2, len(s)+1): resten = (resten*10)%2019 ressum = (int(s[-i])*resten + ressum)%2019 res[ressum] += 1 ans = 0 for i in range(2019): ans += res[i]*(res[i]-1)//2 print(ans)
p03221
s376185943
Accepted
n,m=map(int,input().split()) pyi=[[] for i in range(n)] for i in range(m): p,y=map(int,input().split()) pyi[p-1].append([y,i]) ans=[] for i in range(n): pyi[i].sort() for j in range(len(pyi[i])): ans.append([(6-len(str(i+1)))*"0"+str(i+1)+(6-len(str(j+1)))*"0"+str(j+1),pyi[i][j][1]]) ans.sort(ke...
p02923
s538851968
Wrong Answer
#48 N = int(input()) h = list(map(int,input().split())) move = 0 num = 0 for i in range(N-1): if h[i] >= h[i+1]: num += 1 else: if move < num: move = num num = 0 if move < num: move = num print(move)
p04030
s152366714
Wrong Answer
S = list(str(input())) for i, s in enumerate(S): if s == 'B': if i == 0: S[0] = '' else: S[i-1] = '' S[i] = '' print(''.join(S))
p03095
s966602087
Accepted
mod=10**9+7 N=int(input()) S=input() d={} for s in S: if s in d: d[s]+=1 else: d[s]=1 ans=1 for D in d: ans*=d[D]+1 ans%=mod print((ans-1)%mod)
p02952
s949017055
Wrong Answer
n = int(input()) l = len(str(n)) if l == 2: print(9) elif l == 4: print(909) elif l == 6: print(90909) elif l == 1: print(n) elif l == 3: print(n-90) elif l == 5: print(n-8091)
p03644
s574491062
Accepted
a=int(input()) if a<2: print(1) elif 2<=a<4: print(2) elif 4<=a<8: print(4) elif 8<=a<16: print(8) elif 16<=a<32: print(16) elif 32<=a<64: print(32) elif 64<=a: print(64)
p04033
s261930606
Wrong Answer
a,b=map(int,input().split()) ab=[i for i in range(a,b+1)] if 0 in ab: print('Zero') elif a>0 : print('Positive') else: print('Negative')
p02784
s847881321
Accepted
h, n = map(int, input().split()) a = list(map(int, input().split())) if h <= sum(a): print("Yes") else: print("No")
p03617
s561365684
Accepted
from itertools import permutations def main(): C = list(map( int, input().split())) S = [1, 2, 4,8] N = 4*int( input()) ans = 10**20 for P in permutations( range(4)): cost = 0 left = N for i in P: cost += left//S[i]*C[i] left -= left//S[i]*S[i] ...
p03073
s954858036
Wrong Answer
s = str(input()) S = [int(s[i]) for i in range(len(s))] a = [] b = [] counta = 0 countb = 0 for i in range(len(S)): if i == 0 or i%2==0: a.append(0) b.append(1) else: a.append(1) b.append(0) print(a) print(b) for i in range(len(S)): if S[i] != a[i]: counta += 1 el...
p02775
s787320430
Accepted
def main(): S = map(int, input()) a, b = 0, 1 for s in S: a, b = min(a + s, b + 10 - s), min(a + (s + 1), b + 10 - (s + 1)) print(a) main()
p03711
s038401133
Accepted
d = [1,3,5,7,8,10,12] s = [4,6,9,11] a = [2] x,y = map(int,input().split()) if (x in d and y in d) or (x in s and y in s) or (x in a and y in a): print("Yes") else: print("No")
p02994
s871886720
Accepted
N, L = map(int, input().split()) taste = [0] * N for i in range(N): taste[i] = L+i tmp = taste[:] for i in range(N): tmp[i] = abs(tmp[i]) ind = tmp.index(min(tmp)) print(sum(taste)-taste[ind])
p03773
s261097583
Accepted
def main(): a,b = (int(x) for x in input().split()) print((a+b)%24) if __name__ == '__main__': main()
p02772
s609472976
Accepted
N = int(input()) A = list(map(int, input().split())) ans = 'APPROVED' for i in range(N): if A[i] % 2 == 0 and A[i] % 3 != 0 and A[i] % 5 != 0: ans = 'DENIED' break print(ans)
p02571
s074805402
Wrong Answer
s=input() t=input() ans=len(t) for i in range(len(s)): s1=s[i:len(t)] sum=len(t) for j in range(len(s1)): if t[j]==s1[j]:sum-=1 ans=min(ans,sum) print(ans)
p02771
s022850837
Accepted
a,b,c = map(int, input().split()) if (a == b) and (b !=c): print('Yes') elif (a == c) and (b !=c): print('Yes') elif (b == c) and (a !=c): print('Yes') else: print('No')
p03998
s828172943
Wrong Answer
a = input() b = input() c = input() a = a.replace("a","") b = b.replace("b","") c = c.replace("c","") turn = 'a' for i in range(100): if turn == 'a': if int(len(a)) == 0: print("A") break else: turn = str(a[0]) a = a[1:] if turn == 'b': if int(len(b)) == 0: print('B') break else: turn = s...
p02711
s160112432
Wrong Answer
n = input() N = list(str(n)) if 7 in N: print('Yes') else: print('No')
p02676
s736722509
Wrong Answer
k = int(input()) s = str(input()) if k < len(s): print(s[1:k],"...") else: print(s)
p04045
s897422598
Accepted
n, k = map(int,input().split()) alg = set([0,1,2,3,4,5,6,7,8,9]) numeros = set(map(int, input().split())) def contem(num, numeros): for l in str(num): if int(l) in numeros: return False return True target = n while not contem(target,numeros): target += 1 print(target)
p03544
s696689246
Accepted
N = int(input()) a= 2 b=1 for i in range(1,N+1): a,b = b,b+a #print('a=' +str(a)+' b=' +str(b)) print(a)
p03673
s394050907
Accepted
from collections import deque n=int(input()) a=deque([int(i) for i in input().split()]) b=deque() if n%2==0: for i in range(n): if i % 2 == 0: b.append(a.popleft()) else: b.appendleft(a.popleft()) else: for i in range(n): if i % 2 == 0: b.appendleft(a...
p04044
s891893637
Accepted
N, L = [int(i) for i in input().split()] S = sorted([input() for _ in range(N)]) print(*S, sep="")
p03243
s047907657
Accepted
n = int(input()) for i in range(n, 1000): l = list(str(i)) s = set(l) if len(s) == 1: print(i) exit()
p03043
s617018059
Wrong Answer
N, K = map(int, input().split()) ans = max(N-K+1, 0) / N i = 1 top = min(N, K-1) while True: under = K // 2**i if under >= N: i += 1 continue ans += (0.5**i / N) * (top - under) i += 1 top = under if top == 0: break print(ans)
p03943
s073248217
Accepted
a,b,c = map(int,input().split()) print("Yes" if (a+b+c) / max(a,b,c)==2 else "No")
p03434
s423156492
Accepted
n = int(input()) cardList = list(map(int,input().split())) a = 0 b = 0 cardList.sort(reverse=True) while len(cardList) > 0: if len(cardList) > 0: a += cardList.pop(0) if len(cardList) > 0: b += cardList.pop(0) print(a-b)
p02727
s379446860
Accepted
X, Y, A, B, C = map(int, input().split()) red = list(map(int,input().split())) green = list(map(int,input().split())) trans = list(map(int,input().split())) red.sort(reverse=True) green.sort(reverse=True) trans.sort(reverse=True) apple = red[:X] + green[:Y] apple.sort() j = 0 for i in range(X + Y): if apple[i] < ...
p02879
s618812119
Accepted
def main(): import sys readline = sys.stdin.buffer.readline a, b = map(int, readline().split()) print(a*b if a < 10 and b < 10 else -1) if __name__ == '__main__': main()
p03109
s082115191
Accepted
import datetime S=input() dte = datetime.datetime.strptime(S, '%Y/%m/%d') deh = datetime.datetime.strptime("2019/04/30",'%Y/%m/%d') if dte<=deh: print("Heisei") else: print("TBD")
p03557
s154977150
Accepted
from bisect import bisect_left, bisect_right N = int(input()) A = sorted(list(map(int, input().split()))) B = list(map(int, input().split())) C = sorted(list(map(int, input().split()))) ans = 0 for b in B: max_index_A = bisect_left(A, b) max_index_C = N - bisect_right(C, b) ans += (max_index_A) * (max_ind...
p03785
s402683604
Accepted
N, C, K = map(int, input().split()) T = [int(input()) for i in range(N)] T.sort() ans = 1 bus = C time = T[0] + K for i in T: # バスの定員に空きがあり、かつ、乗車1人目の許容時間内の場合同じバスに乗る if (bus > 0) & (i <= time): bus -= 1 # バスが定員、または、乗車1人目の許容時間外の場合新しいバスに乗る else: bus = C - 1 time = i + K ans...
p03479
s588859060
Accepted
# -*- coding: utf-8 -*- X, Y = map(int, input().split()) results = list() num = X while num <= Y: results.append(num) num += num print(len(results))
p03274
s873844085
Wrong Answer
from collections import deque n,k = map(int,input().split()) a = list(map(int,input().split())) anslist = deque(a) while len(anslist) > k: if abs(anslist[0]) > abs(anslist[-1]): anslist.popleft() else: anslist.pop() if anslist[0] >= 0 and anslist[-1] >= 0: print(anslist[-1]) elif anslist[0]...
p03137
s809459179
Accepted
n, m = map(int, input().split()) X = list(map(int, input().split())) X.sort() C = [] if m <= n: print(0) exit() for i in range(1, m): C.append(abs(X[i] - X[i-1])) C.sort() for i in range(n-1): C[m-2-i] = 0 print(sum(C))
p03262
s845898933
Accepted
# solution # solution import fractions import math import io nim, mike = map(int, input().split()) are1 = list(map(int, input().split())) are2, result = [abs(x - mike) for x in are1], 0 for i in are2: result = fractions.gcd(result, i) print(result)
p03665
s956077271
Wrong Answer
n, p = map(int, input().split()) a = list(map(int, input().split())) length = len(a) even = len([i for i in a if i % 2 == 0]) odd = len([i for i in a if i % 2 == 1]) if length == even and p == 1 or length == odd and p == 0 and odd % 2 == 1: print(0) else: print(2 ** n // 2)
p03456
s858185467
Accepted
n = int("".join(input().split())) x = n**(1/2) if x%1 != 0: print("No") else: print("Yes")
p02598
s236281092
Accepted
n,k = map(int,input().split()) a = list(map(int,input().split())) l = 0 r = 10**10 while r > l + 1: m = (r+l)//2 count = 0 for i in a: if i <= m: continue count += (i)//m if count > k: l = m else: r = m print(r)
p03061
s121497607
Accepted
N = int(input()) *A, = map(int, input().split()) def gcd(a,b): if a > b: a,b=b,a while a: a,b=b%a,a return b L = [0]*(N) R = [0]*(N) L[0] = A[0] R[-1] = A[-1] for i in range(1,N): L[i] = gcd(L[i-1],A[i]) R[-1-i] = gcd(R[-i],A[-1-i]) ans=R[1] for i in range(1,N-1): ans = max(ans, gcd(L[i-1],R[...
p02687
s361657968
Wrong Answer
inpo=input(), for i in inpo: if i=="B": print("R",end="") elif i=="R": print("B",end="") else: print(i,end="")
p03695
s724830088
Accepted
n = int(input()) A = list(map(int, input().split())) d = {} A.sort() irregular_cnt=0 reg_cnt = 0 for i in range(n): a = A[i] a //= 400 if a>7: irregular_cnt += 1 else: d[a] = d.get(a, 0)+1 maxi, mini = 0, 0 for i in d: if d[i]>0: maxi += 1 mini += 1 if irregular_cnt...
p02623
s715177690
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 ...
p02747
s037518570
Accepted
s = input() t = s.replace('hi', '*') if set(t) == {'*'}: print('Yes') else: print('No')
p02678
s519211059
Accepted
import queue N, M = map(int, input().split()) graph = [[] for i in range(N)] for i in range(M): A, B = map(int, input().split()) A -= 1 B -= 1 graph[A].append(B) graph[B].append(A) dist = [-1 for i in range(N)] que = queue.Queue() dist[0] = 0 que.put(0) while not que.empty(): v = que.get(...
p02629
s314779686
Accepted
from sys import stdin N = int(stdin.readline().rstrip()) ans = '' while N > 0: N -= 1 ans += chr(ord('a')+N%26) N //= 26 print(ans[::-1])
p02578
s991459411
Accepted
n = int(input()) a = list(map(int,input().split())) before_max = a[0] humidai = 0 humidai_sum = 0 for i in range(1,n): humidai = 0 if(before_max >= a[i]): humidai = before_max - a[i] humidai_sum += humidai if(before_max < a[i]): before_max = a[i] #print(humidai,befo...
p02706
s565346954
Accepted
n,m = map(int,input().split()) a = list(map(int,input().split())) if n-sum(a)<0: print("-1") else: print(n-sum(a))
p02866
s977507087
Accepted
from collections import Counter N = int(input()) D = list(map(int, input().split())) ans = 0 cnt = 0 if (D[0]==0) and (D.count(0)==1): D = Counter(D) cnt = 1 ans = 1 for i in range(1, max(D)+1): if D[i] == 0: ans = 0 break else: ans *= cnt ** D[i] cnt = D[i] ans = ans % 99824435...
p03799
s272202149
Accepted
s,c=map(int,input().split()) cnt=0 p=min(s,c//2) s-=p c-=2*p cnt+=p q=0 if c<2: print(cnt) else: q=c//4 cnt+=q print(cnt)
p02996
s385504451
Wrong Answer
n = int(input()) ab = [[0]*2 for i in range(n)] for i in range(n): ab[i][0], ab[i][1] = map(int, input().split()) ab.sort(key=lambda x: x[1]) print(ab) ws = 0 for i in range(n): ws += ab[i][0] if ws > ab[i][1]: print('No') break else: print('Yes')
p02639
s949623877
Accepted
A = list(map(int,input().split())) for i in range(5): if(A[i]==0): print(i+1)
p02556
s084106144
Accepted
N = int(input()) L = [[int(l) for l in input().split()] for _ in range(N)] L1 = [0]*N L2 = [0]*N for i in range(N): L1[i] = L[i][0]+L[i][1] L2[i] = L[i][0]-L[i][1] L1.sort() L2.sort() print(max(L1[-1]-L1[0], L2[-1]-L2[0]))
p02571
s064087701
Accepted
s = input() t = input() lt = len(t) ls = len(s) A = [] for i in range(ls-lt+1): cou = 0 for j in range(lt): if s[i+j] == t[j]: cou += 1 A.append(cou) print(lt-max(A))
p03289
s454175243
Accepted
S = input() if S[0]=='A' and (S[2:len(S)-1].count('C')==1) and S[1:2].islower() and S[len(S)-1:].islower(): print('AC') else: print('WA')
p02792
s393563438
Accepted
N = input() N = int(N) c=[[0 for i in range(10)] for j in range(10)] c[0][0] for x in range(1,N+1): X=str(x) c[int(X[0])][int(X[-1])]+=1 score = 0 for i in range(10): for j in range(10): score += c[i][j]*c[j][i] print(score)
p02723
s352383707
Accepted
a=list(input()) if a[2]==a[3] and a[4]==a[5]: print('Yes') else: print('No')
p02622
s047057593
Accepted
def main(): s = input() t = input() sum = 0 for i, j in zip(s, t): if i != j: sum+=1 print(sum) if __name__ == "__main__": main()
p04044
s706985792
Wrong Answer
a=input() b='' for i in a: if i=='0': b+='0' elif i=='1': b+='0' else: b=b[:-1] print(b)
p02554
s864394809
Accepted
n=int(input()) print((10**n-9**n*2+8**n)%(10**9+7))
p02723
s362237021
Wrong Answer
str_in = input() ans = "No" if(str_in[2] == str_in[3] and str_in[2] == str_in[3]): ans = "Yes" print(ans)
p03838
s951426123
Wrong Answer
x, y = (int(x) for x in input().split()) ans = 0 if abs(x) < abs(y): if x < 0 and y > 0: ans += 1 if x < 0 and y < 0: ans += 2 ans += abs(y) - abs(x) elif abs(x) == abs(y): ans += 1 else: if x > 0 and y > 0: ans += 2 if x < 0 and y > 0: ans += 1 ans += abs(x) - ab...
p03944
s923085881
Accepted
import numpy as np w, h, n = map(int, input().split()) area = np.zeros((w, h)) for i in range(n): x, y, a = map(int, input().split()) if a==1: area[:x, :] = 1 elif a==2: area[x:, :] = 1 elif a==3: area[:, :y] = 1 else: area[:, y:] = 1 print((w*h) - int(area.sum()))...
p02548
s949294671
Wrong Answer
import math N = int(input()) cnt = 0 root = int(math.sqrt(N)) for a in range(1,root+1): cnt += (N-1)//a - (a-1) if root<2: print(cnt*2-root) else: print(cnt*2-root+1)
p03659
s383966292
Accepted
n,*a = map(int,open(0).read().split()) total = sum(a) ans = 10**18 dt = 0 for i in range(n-1): dt += a[i] ans = min(ans,abs(total-dt-dt)) print(ans)
p03797
s434256136
Wrong Answer
import sys input = sys.stdin.readline n,m=map(int,input().split()) print(n+(m-2*n)//4)
p03206
s934186079
Accepted
d = int(input()) if d==22: print("Christmas Eve Eve Eve") elif d==23: print("Christmas Eve Eve") elif d==24: print("Christmas Eve") else: print("Christmas")
p02957
s837023015
Accepted
a, b = map(int, input().split()) if (a - b) % 2 == 0: print(((max(a, b) - min(a, b)) // 2) + min(a, b)) else: print('IMPOSSIBLE')
p03331
s918070990
Wrong Answer
n = int(input()) ans = 10000 for i in range(1,n//2): d_n = n-i count_a = 0 count_b = 0 while i > 0: count_a += i % 10 i //= 10 while d_n >0: count_b += d_n % 10 d_n //= 10 if ans >= count_a + count_b: ans = count_a + count_b print(ans)
p03827
s283625335
Accepted
N = int(input()) S = input() cnt = 0 ans = [0] for i in S: if i =='I': cnt+=1 ans.append(cnt) if i == 'D': cnt-=1 ans.append(cnt) print(max(ans))
p03760
s808614396
Accepted
O= input() E= input() p = "" for i in range(len(O)): p = p + O[i] if i < len(E): p = p + E[i] print(p)
p03001
s838897571
Wrong Answer
W,H,x,y = (int(x) for x in input().split()) if x == W // 2 and y == H // 2: ans = [W*H/2, 1] print(*ans) else: ans = [W*H/2, 0] print(*ans)
p03962
s034539301
Wrong Answer
import sys input = sys.stdin.readline def main(): a, b, c = map(int, input().split()) ans = 3 if a == b: ans -= 1 if b == c: ans -= 1 if c == a: ans -= 1 print(ans) if __name__ == "__main__": main()
p02947
s392697941
Accepted
n = int(input()) s = [""] * n t = [""] * n cnt = 0 flg = 0 for i in range(n): s[i] = input() t[i] = sorted(s[i]) t = sorted(t) for i in range(n - 1): if t[i] == t[i + 1]: flg += 1 cnt += flg else: flg = 0 print(cnt)
p02785
s817712770
Wrong Answer
n,k = input().split() k = int(k) n =int(n) healths = input().split() res = 0 healths.sort() for i in range(n-k): res = res + int(healths[i]) print(res)
p02747
s720221649
Wrong Answer
S = input() ans = 'No' if len(S)%2 == 0: for i in range(len(S)//2): if S[i]+S[i+1] != 'hi': break elif i == (len(S)//2)-1: ans = 'Yes' print(ans)
p03013
s662668734
Accepted
n,ng = map(int,input().split()) MOD = 10**9+7 nglist = [0]*(n+1) dp = [0]*(n+1) dp[0] = 1 for i in range(ng): x = int(input()) nglist[x] = 1 for i in range(1,n+1): if nglist[i]==1: dp[i] = 0 continue if i==1: dp[1] = dp[0] continue dp[i] = (dp[i-2] + dp[i-1]) % MOD print(dp[...
p03998
s697266151
Accepted
AA = input() A =list(AA) BB = input() B = list(BB) CC = input() C = list(CC) X ='a' while True: if X == 'a': if len(A) == 0: break else: X = A.pop(0) elif X =='b': if len(B) ==0: break else: X = B.pop(0) else: if len(C) == 0: break else: ...
p02881
s202275813
Wrong Answer
n = int(input()) 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 l = make_divisors(n) x = l[len(l) // 2] + l[len(l) // 2 - 1]...
p03479
s851408973
Accepted
x, y = map(int, input().split()) ans = 0 w = x while w <= y: ans += 1 w *= 2 print(ans)
p03339
s298642753
Accepted
N = int(input()) S = list(input()) ans = [0] * N #リーダーより東の東向きの人 ans[0] = S[1:].count("E") #リーダーを東にずらしていく for i in range(1, N): ans[i] = ans[i-1] if S[i-1] == "W": ans[i] += 1 if S[i] == "E": ans[i] -= 1 #print("ans : {}".format(ans)) print(min(ans))
p02714
s981537960
Wrong Answer
from collections import Counter n = int(input()) s = input() c = Counter(list(s)) ans = 1 for i in list(c.values()): ans *= i for i in range(n-2): for j in range(i+1, n-1): k = j + (j-i) if k >= n: break if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]: ans -= 1...
p02900
s387063528
Accepted
import math A, B = map(int, input().split()) gcd_ab = math.gcd(A, B) factors = set() i = 2 while i <= math.ceil(math.sqrt(gcd_ab)): if gcd_ab%i == 0: factors.add(i) gcd_ab = gcd_ab // i else: i += 1 factors.add(gcd_ab) factors.add(1) print(len(factors))
p02659
s573102423
Accepted
def main(): A, B = input().replace('.','').split(' ') print(int(A)*int(B)//100) if __name__ == "__main__": main()