problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03679
s007745701
Accepted
X,A,B=map(int, input().split()) if A>=B: print("delicious") elif B-A<=X: print("safe") else: print("dangerous")
p03069
s368352694
Accepted
n = int(input()) s = input() wh = [0] * n bl = [0] * n w , b = 0,0 for i in range(n): if s[i] == '.': w += 1 else: b += 1 wh[i] = w bl[i] = b ans = n wtot = wh[-1] btot = bl[-1] for i in range(n): x = (wtot - wh[i]) + bl[i] # print (bl[i], (wtot - wh[i])) ans = min(ans, x) ans = min(ans, wtot) print (ans)
p02548
s225776058
Accepted
n = int(input()) s = 0 a = 1 b = 1 while a*b < n: while a*b < n and b <= a: if a == b: s += 1 else: s += 2 b += 1 a += 1 b = 1 print(s)
p03803
s819515608
Accepted
# A - One Card Poker a,b=list(map(int,input().split())) if a==1: a=14 if b==1: b=14 if a>b: print("Alice") elif a<b: print("Bob") else: print("Draw")
p02724
s545110350
Accepted
x = int(input()) n = x//500 m = x%500//5 print(1000*n+5*m)
p03592
s773522939
Wrong Answer
n, m, k = map(int, input().split()) for i in range(n + 1): for j in range(m + 1): if i * (n - j) + j *(m - i) == k: print("Yes") exit() else: print("No")
p03592
s048905175
Wrong Answer
N, M, K = map(int, input().split()) def main(N, M, K): for i in range(1, N+1): for j in range(1, M+1): if N * (M - j) + M * (N - i) == K: return True return False res = main(N, M, K) if res == True: print('Yes') else: print('No')
p02748
s963040841
Accepted
A, B, M = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) z = [list(map(int, input().split())) for i in range(M)] price = min(a) + min(b) for e in z: tmp_price = a[e[0]-1] + b[e[1]-1] - e[2] if(price > tmp_price): price = tmp_price print(price)
p03557
s087274041
Wrong Answer
import bisect n = (int)(input()) a = sorted(list(map(int, input().split(" ")))) b = list(map(int, input().split(" "))) c = sorted(list(map(int, input().split(" ")))) count = 0 for i in b: #print((a[:bisect.bisect(a, i - 1)]), i, c[bisect.bisect_left(c, i + 1):]) count += len(a[:bisect.bisect(a, i - 1):]) print(count)
p03386
s808090449
Accepted
A, B, K = map(int,input().split()) for i in range(A, min(A + K, B + 1)): print(i) for i in range(max(B - K, A) , B): if i + 1 >= A + K: print(i + 1)
p03672
s176326538
Accepted
S = input() while True: S = S[:-2] if S[:len(S)//2] == S[len(S)//2:]: print(len(S)) break
p02576
s774190032
Accepted
import math n, x, t = map(int, input().split()) print(t * math.ceil(n / x))
p02691
s251284552
Accepted
from collections import Counter N = int(input()) A = list(map(int, input().split())) P = [i + a for i, a in enumerate(A, start=1)] Q = [j - a for j, a in enumerate(A, start=1)] ans = 0 QC = Counter(Q) for p in P: ans += QC[p] print(ans)
p02713
s421232741
Wrong Answer
import itertools from fractions import gcd K = int(input()) l = range(1, K+1) ans = sum(range(1, K+1)) for a, b in itertools.combinations(l, 2): g = gcd(a, b) for c in l: if a == c or b == c: ans += g * 3 else: ans += gcd(g, c) * 6 print(ans)
p02546
s869404913
Accepted
s=input() if s[-1]=='s': a=s a+='es' else: a=s+'s' print (a)
p03107
s764335429
Wrong Answer
S = str(input()) x = len(S) if S[0] == '1': while '10' in S: S = S.replace('10', '') S = S.replace('01', '') else: while '01' in S: S = S.replace('01', '') S = S.replace('10', '') print(x - len(S))
p02694
s269745260
Wrong Answer
a=int(input()) i=100 f=0 while i/a<1: i=int(i*1.01) f=f+1 if a/i>3605334940814628: i=int(i*3605334940814628) f=f+3600 print(f)
p02706
s445271481
Accepted
N,M=map(int,input().split()) list = [int(i) for i in input().split()] Sum=sum(list) if(N-Sum < 0): print(-1) else: print(N-Sum)
p02862
s286903848
Accepted
def cmb(n,r): r=min(r,n-r) if r<0 or n<=0: return 0 return A[n]*B[r]*B[n-r]%mod mod=10**9+7 A=[1,1] B=[1,1] for i in range(2,7*10**5): A.append(A[-1]*i%mod) B.append(B[-1]*pow(i,mod-2,mod)%mod) x,y=map(int,input().split()) if (x+y)%3==0: a=(x+y)//3 b=x-a print(cmb(a,b)) else: print(0)
p02705
s324272292
Accepted
import math r = int(input()) print(2 * math.pi * r)
p02598
s772455319
Wrong Answer
n, k = map(int, input().split()) a = list(map(int, input().split())) low = 0 top = max(a) + 1 while top - low > 1: mid = (top + low) // 2 cnt = 0 for i in range(n): cnt += (a[i] + 1) // mid if cnt <= k: top = mid else: low = mid print(low)
p03705
s269577132
Wrong Answer
n, a, b = map(int, input().split()) if a > b: print(0) elif n == 1 and a != b: print(0) elif n != 1 and a == b: print(0) else: print((b * (n-1) + a) - (a * (n-1) + b) + 1)
p02888
s658178746
Wrong Answer
N = int(input()) L = list(map(int, input().split())) L.sort() ans = 0 flag = 0 ma = 2 for left1 in range(N-2): for left2 in range(left1+1, N-1): for right in range(ma, N): if L[right] < L[left1] + L[left2]: flag = 1 ma = right if L[right] >= L[left1] + L[left2]: if flag == 1: ans += right - left2 break print(ans)
p02578
s329393064
Accepted
# -*- coding: utf-8 -*- def main(): N = int(input()) A = [int(i) for i in input().split()] ans = 0 max = A[0] for a in A: if max > a: ans += max-a else: max = a print(ans) if __name__ == "__main__": main()
p03013
s953646300
Wrong Answer
import sys n,m = map(int,input().split()) broken = [] for i in range(m): broken.append(int(input())) if(len(broken) >= 2): if(broken[i] - broken[i-1] == 1): print("0") sys.exit()
p03815
s478903035
Accepted
x = int(input()) res = (x // 11) * 2 if 1 <= x % 11 <= 6: res += 1 elif 7 <= x % 11 <= 10: res += 2 print(res)
p03252
s066507220
Accepted
from collections import Counter s = input().rstrip() t = input().rstrip() if sorted(Counter(s).values()) == sorted(Counter(t).values()): print('Yes') else: print('No')
p03474
s576667498
Wrong Answer
a,b = map(int,input().split()) stg = input() res = "Yes" if len(stg)==a+b+1: for i in range(a): if not stg[i].isdigit(): res = "No" if not stg[a]=='-': res = "No" for i in range(a+1,b+1): if not stg[i].isdigit(): res = "No" else: res = "No" print(res)
p02779
s250604181
Accepted
from collections import Counter n = int(input()) a = list(map(int,input().strip().split())) if Counter(a).most_common(1)[0][1] != 1: print('NO') else: print('YES')
p02912
s855431530
Accepted
import heapq N,M=map(int,input().split()) arr=list(map(int,input().split())) hq=[] for i in arr: heapq.heappush(hq,-i) while M>0: a=heapq.heappop(hq) heapq.heappush(hq,a/2) M-=1 #print(hq) ans=0 for i in hq: ans+=int(-i) print(ans)
p02720
s284019389
Accepted
k=int(input()) num=[] def d(n): num.append(n) if n > 3234570000: return a=n%10 if a==0: l=[0,1] elif a==9: l=[8,9] else: l=[a-1,a,a+1] for i in l: s=int(str(n)+str(i)) d(s) for i in range(1,10): d(i) num.sort() print(num[k-1])
p03680
s863703540
Accepted
n=int(input()) A=[] for i in range(n): A.append(int(input())) k=1 for i in range(n): if A[k-1]==2: print(i+1) exit() k=A[k-1] print(-1)
p02705
s505296112
Accepted
import math n = int(input()) print(2*n*math.pi)
p02747
s226112993
Accepted
from collections import Counter,defaultdict,deque from heapq import heappop,heappush,heapify import sys,bisect,math,itertools,fractions,pprint sys.setrecursionlimit(10**8) mod = 10**9+7 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) def inpln(n): return list(int(sys.stdin.readline()) for i in range(n)) s = input() n = len(s) if n %2: print('No'); quit() for i in range(n//2)[::2]: if s[i] == 'h' and s[i+1] == 'i': continue print('No') quit() print('Yes')
p03136
s928019091
Wrong Answer
N = int(input()) L = list(map(int, input().split())) L.sort(reverse=True) if 2*max(L) > sum(L): print('Yes') else: print('No')
p02731
s095957209
Wrong Answer
import math L = int(input()) ans = 0 for x in range(math.floor(L/3)-1, math.ceil(L/3)+1): for y in range(math.floor(L/3)-1, math.ceil(L/3)+1): for z in range(math.floor(L/3)-1, math.ceil(L/3)+1): if x+y+z == L: tmp = x*y*z ans = max(ans, tmp) print(float(ans))
p02866
s847301982
Accepted
N=int(input()) D=list(map(int,input().split())) layer=[0]*N mx=0 for item in D: layer[item]+=1 mx=max(mx,item) if layer[0]!=1 or D[0]!=0: print(0) exit() ans=1 for i in range(mx): ans*=(layer[i]**layer[i+1]) print(ans%998244353)
p02900
s099470850
Wrong Answer
import string import collections ans=[] a,b = map(int, input().split()) for i in range(2, int(min(a,b)**0.5)+1): if max(a,b)%i == 0 and min(a,b)%i == 0: for j in ans: if i%j == 0: break else: ans+=[i] print(len(ans)+1)
p03544
s990142266
Accepted
#!/usr/bin/env python3 import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) seen = {} def luka(n): if n == 0: return 2 if n == 1: return 1 if n in seen.keys(): return seen[n] else: seen[n] = luka(n-1) + luka(n-2) return seen[n] N = int(input()) print(luka(N))
p02761
s595359684
Wrong Answer
N,M=list(map(int,input().split())) A=[list(map(int,input().split())) for i in range(M)] import sys S=[-1 for i in range(N)] visited=[[] for i in range(N)] for i in A: S[i[0]-1]=i[1] visited[i[0]-1].append(i[1]) for i in visited: if len(set(i))>1: print(-1) sys.exit() if S[0]==0: print(-1) sys.exit() if S[0]==-1: S[0]=1 for i,value in enumerate(S): if value==-1: S[i]=0 print(*S,sep='')
p03472
s830060933
Accepted
n,h=map(int,input().split()) g=[[0]*2 for i in range(n)] for i in range(n): g[i]=list(map(int,input().split())) a=0 for i in range(n): if g[i][0]>a: a=g[i][0] g.sort(key=lambda x:x[1],reverse=True) ans=0 i=0 while h>0 and i<n: if g[i][1]<a: break h=h-g[i][1] ans=ans+1 i=i+1 if h<=0: print(ans) else: ans=ans+((h-1)//a+1) print(ans)
p02989
s978171761
Accepted
n = int(input()) d = [int(i) for i in input().split()] ans = 0 d.sort() abc = d[0:n//2] arc = d[n//2:n] if len(abc) == len(arc): ans = d[n//2] - d[n//2-1] print(ans)
p03705
s962445679
Accepted
N, A, B = map(int, input().split()) if N == 1 and A != B: print(0) exit() elif N == 1: print(1) exit() elif A > B: print(0) exit() elif A == B: print(1) exit() am = N - 2 # 最小 minv = A + B + am*A # 最大 maxv = A + B + am*B print(maxv - minv + 1)
p03062
s855634175
Accepted
N = int(input()) A = list(map(int, input().split())) souwa = 0 cnt = 0 keep = 1e10 for i in range(N): if A[i] < 0: cnt += 1 A[i] *= (-1) souwa += A[i] keep = min(keep, A[i]) print(souwa - 2 * keep * (cnt % 2))
p02747
s927243806
Accepted
S = list(input()) flag = True if len(S) % 2 == 0: for i in range(0, len(S), 2): if S[i] == 'h' and S[i + 1] == 'i': pass else: flag = not flag break else: flag = not flag if flag: print("Yes") else: print("No")
p03795
s642919043
Accepted
N = int(input()) def Main(N): return 800*N-200*(N//15) print(Main(N))
p04044
s372781161
Accepted
N, L = map(int, input().split()) l = [input() for _ in range(N)] l = sorted(l) s = "" for i in range(N): s += l[i] print(s)
p02835
s729007925
Accepted
a=list(map(int,input().split())) if sum(a)<22: print('win') else: print('bust')
p03719
s013364943
Wrong Answer
a, b, c = map(int, input().split()) if a <= c <= b: print('YES') else: print('NO')
p03282
s815909164
Accepted
import sys input = sys.stdin.readline def main(): ans = '' index = 0 s = input().rstrip('\n') k = int(input()) for i in range(len(s)): if s[i] != '1': ans = s[i] index = i break if ans == '' or k < index+1: ans = '1' print(ans) if __name__ == '__main__': main()
p03795
s346371613
Accepted
N = int(input()) x = 800 * N y = 200 * (N // 15) print(x - y)
p03289
s061928294
Accepted
import sys S=input() first=S[0] second=S[1] last=S[len(S)-1] cnt=0 moji=[i for i in "abcdefghijklmnopqrstuvwxyz"] # print(len(moji)) if first=="A": for i in range(2,len(S)-1): if S[i]=="C": cnt+=1 else: if (S[i] in moji)==False: print("WA") sys.exit() if cnt==1 and ((last in moji)==True) and ((second in moji)==True): print("AC") else: print("WA") else: print("WA")
p02784
s907530866
Accepted
h,n=map(int,input().split()) a=list(map(int,input().split())) print("Yes" if sum(a)>=h else "No")
p03012
s854908410
Wrong Answer
def main(): n = int(input()) w = list(map(int, input().split())) avr = sum(w) // 2 res = 0 ans1 = 0 ans2 = 0 for i in range(n): res += w[i] if res > avr: ans1 = abs(sum(w[(i+1):]) - sum(w[:(i+1)])) ans2 = abs(sum(w[i+1:]) - sum(w[:i+1])) print(min(ans1,ans2)) return if __name__ == '__main__': main()
p02661
s895488863
Accepted
n=int(input()) A=[] B=[] for i in range(n): ai,bi=map(int,input().split()) A.append(ai) B.append(bi) A.sort() B.sort() amid=0 bmid=0 if n%2==0: amid=(A[round(n/2-1)]+A[round(n/2)])/2 bmid=(B[round(n/2-1)]+B[round(n/2)])/2 else: amid=A[round((n-1)/2)] bmid=B[round((n-1)/2)] d=bmid-amid if n%2==0: print(round(2*d)+1) else: print(d+1)
p02603
s639680000
Wrong Answer
N=int(input()) A=list(map(int,input().split())) tmp=A[0] ans=1000 kabu=0 for i in range(1,N): if tmp < A[i]: kabu=ans//tmp ans=ans%tmp tmp=A[i] elif tmp > A[i]: ans+=kabu*tmp kabu=0 tmp=A[i] if kabu > 0: ans+=kabu*A[-1] print(ans)
p03761
s660138794
Accepted
from collections import Counter N = int(input()) S = [input() for _ in range(N)] A = Counter(list(S[0])) for i in range(1, len(S)): B = Counter(list(S[i])) A &= B ans = list(A.elements()) ans.sort() print(''.join(ans))
p02820
s031875099
Wrong Answer
N,K = map(int,input().split()) R,S,P = map(int,input().split()) T = str(input()) i = 0 point = 0 for i in range(N): if T[i] == "r" and T[K] != "p": point += P elif T[i] == "s" and T[K] != "r": point += R elif T[i] == "p" and T[K] != "s": point += S else: break i += 1 print(point)
p02582
s653430869
Accepted
# -*- coding: utf-8 -*- def main(): s = str(input()) if s == "RRR": print(3) elif s == "RRS" or s == "SRR": print(2) elif s == "SSS": print(0) else: print(1) if __name__ == '__main__': main()
p03471
s787821389
Accepted
n, k = map(int, input().split()) for x in range(n+1): for y in range(n+1): if x + y <= n: z = n - x - y result = 10000*x + 5000*y + 1000*z if result == k: print("{} {} {}".format(x, y, z)) exit() print("-1 -1 -1")
p03679
s423116472
Wrong Answer
import sys X,A,B = map(int,input().split()) if X < 0 or A < 0 or B < 0 or X > 10 ** 9 or A > 10 ** 9 or B > 10 ** 9: sys.exit() if B - A <= X + 1 and B - X > 0: print("safe") if B - A <= X + 1 and B - X < 0: print("delicious") if B - A > X + 1: print("dangerous")
p02647
s397076318
Wrong Answer
import numpy as np Debug = False # Calculate intensity N, K = [int(v) for v in input().split(" ")] A_arr = [int(v) for v in input().split(" ")] def Luminate(A_arr, i): step = np.arange(len(A_arr)) distance = abs(step - i) isLuminated = distance < np.array(A_arr)+1 if Debug: print(step, distance,isLuminated) return isLuminated def get_Intensity(A_arr): return [np.sum(Luminate(A_arr, i)) for i in range(len(A_arr))] Intensity = A_arr for i in range(K): Intensity = get_Intensity(Intensity) print(Intensity)
p02719
s720109551
Accepted
import sys n, k = map(int, input().split()) n = abs(n - k) if k == n: print(0) sys.exit() elif k > n: print(min(n, k-n)) sys.exit() else: while n > k: n %= k print(min(n%k, abs(n-k)))
p02665
s388064762
Wrong Answer
N = int(input()) A = list(map(int, input().split())) bottom = sum(A) if bottom == 0 or A[0] >= 1: print(-1) exit() ret = 1 children = 1 - A[0] bottom -= A[0] for i in range(N): children = children * 2 - A[i+1] if children <= -1: ret = -1 break bottom -= A[i+1] if children >= bottom: children = bottom ret += children + A[i+1] print(ret)
p02657
s247418063
Accepted
#!/usr/bin/env python3 import sys def solve(A: int, B: int): print(A * B) return # Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template) def main(): def iterate_tokens(): for line in sys.stdin: for word in line.split(): yield word tokens = iterate_tokens() A = int(next(tokens)) # type: int B = int(next(tokens)) # type: int solve(A, B) if __name__ == '__main__': main()
p02613
s252037670
Accepted
dct = { 'AC': 0, 'WA': 0, 'TLE': 0, 'RE': 0, } N = int(input()) for i in range(N): S = input() dct[S] = dct[S] + 1 print('AC x %s' % dct['AC']) print('WA x %s' % dct['WA']) print('TLE x %s' % dct['TLE']) print('RE x %s' % dct['RE'])
p02693
s567982089
Accepted
k = int(input()) a, b = map(int, input().split()) for i in range(1000): if a <= k*i <= b: print("OK") break else: print("NG")
p03852
s482114606
Wrong Answer
l=input() if l=='a' or 'e' or 'i' or 'o' or 'u': print('vowel') else: print('consonant')
p03220
s745049446
Accepted
import numpy as np n = int(input()) t, a = map(int, input().split()) h = np.array(list(map(int, input().split()))) temp = abs((t - 0.006 * h) - a) ans = np.where(min(temp) == temp) print(ans[0][0] + 1)
p02726
s829447689
Wrong Answer
#!/usr/bin/env python n, x, y = (int(v) for v in input().split()) x -= 1 y -= 1 c = [0] * (n - 1) for i in range(n): c.append(n - i) for i in range(n): for j in range(n): idx = min( abs(i - j), abs(i - x) + 1 + abs(j - y), abs(i - y) + 1 + abs(j - x) ) c[idx - 1] for v in c: print(str(int(v)))
p02689
s265471101
Wrong Answer
N, K = map(int,input().split()) H = list(map(int,input().split())) s = {} for j in range(K): A, B = map(int,input().split()) if H[A-1] < H[B-1]: s[A] = False s[B] = True else: s[A] = True s[B] = False cnt = 0 for i in s: if s[i]: cnt += 1 print(cnt)
p03760
s020723209
Accepted
O = input() E = input() len_pass = len(O) + len(E) for num in range(1, len_pass + 1): if (num % 2 == 1): odd_index = num // 2 print(O[odd_index], end="") elif (num % 2 == 0): even_index = (num // 2) - 1 print(E[odd_index], end="") print("")
p03693
s679924608
Accepted
s = int(''.join(input().split())) print('YES' if s%4==0 else 'NO')
p03719
s963387348
Wrong Answer
a,b,c = map(int, input().split()) if c>=a and c<=b: print("YES") else: print("NO")
p02708
s455967119
Accepted
N,K = map(int,input().split()) lis = [] for k in range(K,N+2): lis.append((N-k+1)*k+1) print(sum(lis)%(10**9+7))
p03862
s114631487
Accepted
n,x = map(int, input().split()) a = list(map(int, input().split())) ans = 0 for i in range(1,n): if a[i] + a[i-1] > x: t = a[i] + a[i-1] - x ans += t if a[i] >= t: a[i] = a[i] - t else: a[i-1] -= (t-a[i]) a[i] = 0 print(ans)
p03059
s071660706
Wrong Answer
a, b, t = map(int, input().split()) print((t+0.5)//a*b)
p03479
s128132121
Accepted
x,y=map(int,input().split()) ans=1 while x*2 <= y: ans= ans+1 x=x*2 print(ans)
p03408
s801525365
Wrong Answer
N=int(input()) A=[] for i in range(N): A.append(input()) K=int(input()) for i in range(K): s=input() if s in A==1: A.remove(s) B=set(A) ans=0 for i in B: if A.count(i)>ans: ans=A.count(i) print(ans)
p03971
s276503916
Accepted
n,a,b = map(int,input().split()) s = input() count_a = 0 count_b = 0 for i in range(n): s1 = s[i] if s1 == "c": print("No") elif s1 == "b": if count_a + count_b < a+b and count_b < b: count_b += 1 print("Yes") else: print("No") else: if count_a + count_b < a+b: count_a += 1 print("Yes") else: print("No")
p02572
s963180815
Wrong Answer
n = int(input()) a = list(map(int, input().split())) A = [0]*(n) num = 1e9+7 ans = 0 for i in range(1, n): A[i] = A[i-1] + a[i-1] for i in range(n-1, 0, -1): ans += (A[i]*a[i])%num ans = ans%num print(int(ans))
p02622
s973674289
Accepted
import sys sys.setrecursionlimit(10 ** 7) rl = sys.stdin.readline def solve(): S = rl().rstrip() T = rl().rstrip() ans = 0 for si, ti in zip(S, T): if si != ti: ans += 1 print(ans) if __name__ == '__main__': solve()
p03472
s156974505
Accepted
import sys,math input = sys.stdin.readline a_max=0 b = [] N,H = map(int,input().split()) for i in range(N): an,bn = map(int,input().split()) b.append(bn) a_max = max(a_max,an) b = sorted([ bn for bn in b if bn>=a_max]) cnt = 0 for i in range(len(b)): H -= b.pop() cnt += 1 if H <=0: print(cnt) exit() cnt += math.ceil(H/a_max) print(cnt)
p02744
s751921226
Accepted
import sys sys.setrecursionlimit(10**6) a = int(input()) S = 'abcdefghij' def dfs(s,c): if c == a: ans.append(s) return for i in S[:c+1]: if i in s:dfs(s+i,c+1) else: dfs(s+i,c+1) return ans = [] dfs("",0) for i in ans: print(i)
p03485
s246832031
Wrong Answer
a,b = map(int,input().split()) A = int((a+b)/2) print(A if (A*10)%2 == 0 else int(A+0.5))
p02681
s054158187
Wrong Answer
a, b = input(), input() n = len(a) if a==b[:n] and n+1==len(b): print("Yes") else: print("NO")
p03680
s257451876
Wrong Answer
ais = [int(raw_input()) for oo in range(int(raw_input()))] seen = set([]) u = 0 while(u!= 1 or u not in seen): seen.add(u) u = ais[u] - 1 print len(seen) if u == 1 else -1
p02660
s149772027
Wrong Answer
n = int(input()) ans = 0 i = 2 num = n while i * i <= n: cnta = 0 cntb = 0 while num % i == 0: num //= i if cnta == cntb: ans += 1 cnta = 0 cntb += 1 else: cnta += 1 i += 1 if ans == 0 and n != 1: ans += 1 print(ans)
p03555
s973002558
Accepted
import sys import itertools sys.setrecursionlimit(1000000000) from heapq import heapify,heappop,heappush,heappushpop import math import collections import copy INF = 10**18 if __name__ == "__main__": c = list(input()) t = list(input()) for i in range(len(c)): if c[i] != t[len(t)-i-1]: print("NO") sys.exit() print("YES")
p03760
s210515731
Accepted
O=list(input()) E=list(input()) ans="" if len(O)-len(E) > 0: ans+=O[0] O.pop(0) for i in range(len(O)): ans+=E[i] ans+=O[i] else: for i in range(len(O)): ans+=O[i] ans+=E[i] print(ans)
p03293
s722599572
Accepted
S = input() T = input() def rolling(str , n): return str[n:len(str)] + str[:n] for i in range(len(S)): if T == rolling(S, i): print('Yes') exit() print('No')
p02880
s852777262
Accepted
N = int(input()) num = range(1,10) num_list = [ i*j for i in num for j in num ] if N in num_list: print('Yes') else: print('No')
p02683
s074131287
Accepted
n,m,x= map(int,input().split()) texts = [list(map(int,input().split())) for i in range(n)] judge = False min_ex = 10**7 for bit in range(2**n): understand = [0]*m expense = 0 for i in range(n): if bit>>i & 1: expense += texts[i][0] for j in range(m): understand[j] += texts[i][j+1] if min(understand) >= x: judge = True min_ex = min(expense, min_ex) if judge: print(min_ex) else: print(-1)
p02676
s673875275
Wrong Answer
K = int(input()) S = input() if len(S) >= K: print(S) else: print(S[:K]+'...')
p03077
s862359628
Accepted
from math import ceil N = int(input()) A = int(input()) B = int(input()) C = int(input()) D = int(input()) E = int(input()) print(4+ceil(N/min(A,B,C,D,E)))
p02912
s677551670
Wrong Answer
n, m = map(int, input().split()) a = list(map(int, input().split())) a.sort(reverse = True) for i in range(m): a[0] = a[0] // 2 if sum(a) == 0: break for j in range(n): if a[0] < a[j]: a[0], a[j] = a[j], a[0] break print(sum(a))
p02759
s510914745
Accepted
N=int(input()) print(N//2 if N%2==0 else N//2+1)
p02660
s575457058
Accepted
N = int(input()) n, p, score = N, 2, 0 while p ** 2 <= N: e = 1 while n >= (p ** e) and n % (p ** e) == 0: n //= (p ** e) score += 1 e += 1 else: while n >= p and n % p == 0: n //= p p += 1 else: if n != 1: score += 1 print(score)
p02606
s197641415
Accepted
l, r, d = map(int, input().split()) cnt = 0 for i in range(l, r+1): if i % d == 0: cnt += 1 print(cnt)
p04005
s166212442
Accepted
A,B,C = list(map(int,input().split())) if A%2==0 or B%2==0 or C%2==0: print(0) exit() print(min(A*B,B*C,C*A))