problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02743
s919307006
Accepted
a,b,c=map(int,input().split()) if c-a-b>0 and 4*a*b<(c-b-a)*(c-a-b): print('Yes') else: print('No')
p02646
s460694348
Accepted
a,v=map(int,input().split()) b,w=map(int,input().split()) t=int(input()) if a<b and v<=w: print("NO") elif w>v: print("NO") else: if abs(b-a)<=t*abs(v-w): print("YES") else: print("NO")
p02601
s178934040
Accepted
# coding: utf-8 import math import numpy #N = int(input()) a, b, c = map(int,input().split()) #A = list(map(int,input().split())) K =int(input()) flg = False i = 0 while a >= b: if i == K: break b *= 2 i += 1 #print(i,a,b,c) while b >= c: if i == K: break c *= 2 i += 1 #print(a,b,c) #print(a, b, c) if a < b < c: print("Yes") else: print("No")
p02813
s810232771
Wrong Answer
import math n = int(input()) p = list(map(int, input().split())) q = list(map(int, input().split())) def turn(arr, m): sum_ = 0 for i in range(m): res = math.factorial(m - (i + 1)) * (arr[i] - (i + 1)) if res > 0: sum_ =+ res return sum_ ans = abs(turn(p, n) - turn(q, n)) print(ans)
p02628
s439818339
Accepted
n, k = map(int, input().split()) p = list(map(int, input().split())) p.sort() print(sum(p[:k]))
p02796
s492009313
Accepted
N = int(input()) XL = [list(map(int,input().split())) for _ in range(N)] r_l = [] for n in range(N): xl = XL[n] x = xl[0] l = xl[1] r_l.append([x-l,x+l]) r_l = sorted(r_l,key = lambda x:x[1]) ans = 1 l = r_l[0][1] for a in r_l: if a[0]<l: continue else: ans += 1 l = a[1] print(ans)
p03331
s464356863
Wrong Answer
n=input() nn=int(n) min_n=9999999999999 for i in range(len(n)-1): a=10**i b=nn-a s=1 for j in range(5): s+=b%10 b=b//10 min_n=min(min_n,s) for i in range(len(n)-1): b=10**i a=nn-b s=1 for j in range(5): s+=a%10 a=a//10 min_n=min(min_n,s) print(min_n)
p02572
s059128944
Accepted
N = int(input()) A = list(map(int, input().split())) MOD = 10**9 + 7 S = 0 ans = 0 for a in A: ans = (ans + a * S) % MOD S += a print(ans)
p02783
s372804101
Wrong Answer
h,a=map(int,input().split()) print(h//a+1)
p02647
s985918171
Wrong Answer
n, k = map(int, input().split()) A = list(map(int, input().split())) for i in range(min(30, k)): DP = [0] * (n+1) for j in range(n): light = A[j] DP[max(0, j-light)] += 1 DP[min(n, j+light+1)] -= 1 for j in range(1, n): DP[j] += DP[j-1] A = DP[:-1] print(*A)
p03241
s563815147
Accepted
#!/usr/bin/env python3 N, M = [int(str) for str in input().strip().split()] divs = [] for i in range(1, int(M**0.5) + 1): if M % i == 0: divs.append(i) if i**2 != M: divs.append(M // i) divs.sort(reverse=True) for div in divs: if M // div >= N: print(div) exit()
p03274
s575346684
Wrong Answer
n,k=map(int,input().split()) x=list(map(int,input().split())) ans=float('inf') for i in range(n-k+1): temp=x[i+k-1]-x[i]+abs(x[i]) if ans>temp:ans=temp print(ans)
p03779
s450115777
Accepted
x = int(input()) for i in range(1,x+1): if i*(i+1)//2 >= x: print(i) exit()
p02779
s681823387
Accepted
import sys def II(): return int(input()) def MI(): return map(int,input().split()) def LI(): return list(map(int,input().split())) def TI(): return tuple(map(int,input().split())) def RN(N): return [input().strip() for i in range(N)] def main(): N = II() A = LI() numa = len(set(A)) #print(numa) if numa == N: print("YES") else: print("NO") if __name__ == "__main__": main()
p02802
s661137372
Wrong Answer
import sys import math import itertools import numpy rl = sys.stdin.readline n, k= map(int, rl().split()) li = [[0, 0] for _ in range(n)] for _ in range(k): a, b = rl().split() b = b.rstrip() a = int(a) - 1 if b == 'WA': li[a][0] += 1 elif li[a][1] == 0: li[a][1] = 1 ac = 0 wa = 0 for lis in li: i, v = lis wa += i if v == 1: ac += 1 print(ac, wa)
p03160
s584473780
Wrong Answer
n=int(input()) l=list(map(int,input().split())) dp=[float("INF")]*n dp[0]=0 for i in range(2,n): for j in range(1,3): dp[i]=min(dp[i-j]+abs(l[i]-l[i-j]),dp[i]) print(dp[-1])
p03944
s126935602
Accepted
w,h,n=[int(x) for x in input().split()] p=[[int(x) for x in input().split()] for _ in range(n)] minx=0 maxx=w miny=0 maxy=h for i in range(n): if p[i][2]==1: minx=max(minx,p[i][0]) if p[i][2]==2: maxx=min(maxx,p[i][0]) if p[i][2]==3: miny=max(miny,p[i][1]) if p[i][2]==4: maxy=min(maxy,p[i][1]) w=maxx-minx h=maxy-miny print(w*h if w>0 and h>0 else 0)
p02708
s395224549
Wrong Answer
N,K=map(int,input().split()) M=N+1 L=K-1 print(M*(M*M+5)/6 + L*(L*L*2+L*3-5-M*(L+1)*3)/6%10**9+7)
p02691
s613423369
Accepted
# print('input >>') N = int(input()) As = list(map(int,(input().split()))) tashi = {} hiki = {} for i in range(len(As)): sum_ = i + As[i] sub_ = i - As[i] if not sum_ in tashi: tashi[sum_] = 0 if not sub_ in hiki: hiki[sub_] = 0 tashi[sum_] += 1 hiki[sub_] += 1 ans = 0 for k, v in tashi.items(): if k in hiki: ans += v * hiki[k] # print('-----output-----') print(ans)
p03612
s477661139
Wrong Answer
n = int(input()) ls = list(map(int,input().split())) di = [0]*n new = [] k = 0 for i in range(n): if ls[i] == i+1: di[i] = 1 k += 1 else: if k > 1: new.append(k) k = 0 if k > 1: new.append(k) print(sum(di)-len(new))
p03555
s436313987
Wrong Answer
a,b=input(),input() print('YES' if reversed(list(a))==list(b)else 'NO')
p02972
s044343034
Accepted
n = int(input()) a = list(map(int, input().split())) b =[0]*(n+1) ans = 0 for i in range(n): j = n-i sum = 0 m = 1 while j*m <= n: sum += b[j*m] m += 1 if sum % 2 != a[j-1]: b[j] = 1 ans += 1 if not 1 in b: print(0) else: print(ans) for i in range(n+1): if b[i] == 1: print(i, end =' ')
p02608
s902310547
Wrong Answer
# C - XYZ Triplets from collections import Counter def main(): """ if x = y = z and n = 1000, 6 * x^2 = 1000 x ≈ 13.038 -> lim = 14 """ N = int(input()) calc = lambda x, y, z: x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x cnt = Counter( calc(i, j, k) for i in range(1, 15) for j in range(1, 15) for k in range(1, 15) ) res = [cnt[i] for i in range(1, N + 1)] print("\n".join(map(str, res))) if __name__ == "__main__": main()
p02613
s241163231
Accepted
from collections import Counter def f(x): print("{} x {}".format(x, c[x])) n = int(input()) s = [input() for _ in range(n)] c = Counter(s) f("AC") f("WA") f("TLE") f("RE")
p03637
s343302763
Accepted
input();a,b1,b2,b4=list(map(int,input().split())),0,0,0 for i in a: if i%2!=0: b1+=1 elif i%4==0: b4+=1 else: b2+=1 print(['NYoe s'[b1<=b4::2],'NYoe s'[b1<=b4+1::2]][not b2])
p03371
s349996161
Accepted
A,B,C,X,Y = map(int,input().split()) if X<Y: print(min(A*X+B*Y,Y*C*2,X*C*2+B*(Y-X))) else: print(min(A*X+B*Y,X*C*2,Y*C*2+A*(X-Y)))
p02972
s039976329
Accepted
N = int(input()) As = [0]+list(map(int, input().split())) memo = [0]*(N+1) for i in range(N,0,-1): j = 2 cnt = 0 while i*j <= N: cnt ^= memo[i*j] j += 1 memo[i] = cnt^As[i] print(sum(memo)) rlt = [] for i in range(1,N+1): if memo[i] == 1: rlt.append(i) print(' '.join(map(str, rlt)))
p03624
s932108744
Accepted
s=list(set(list(input()))) s.sort() alphabet=list("abcdefghijklmnopqrstuvwxyz") for i in s: alphabet.remove(i) if alphabet==[]: print("None") else: print(alphabet[0])
p03799
s763359204
Accepted
N, M = map(int, input().split()) res = 0 res += min(N, M//2) M -= N*2 res += max(M//4, 0) print(res)
p02547
s004789646
Accepted
N = int(input()) count = 0 for i in range(N): d1,d2 = map(int,input().split()) if(d1==d2): count = count + 1 else: count = 0 if(count == 3):break if(count == 3): print("Yes") else: print("No")
p02982
s881128488
Wrong Answer
N,D=map(int,input().split()) c=0 X=[] for i in range(N): X.append(list(map(int,input().split()))) for j in range(N): for k in range(j+1,N): tmp=sum([(X[j][l]-X[k][l])**2 for l in range(D)]) if tmp in [y**2 for y in range(21)]: c +=1 print(c)
p02688
s288335617
Accepted
N, K = map(int, input().split(" ")) # print(N, K) people = [] for i in range(0, K): d = int(input()) A = list(map(int, input().split(" "))) # print(d, A) for j in range(d): people.append(A[j]) # print(people) print(N - len(set(people)))
p03289
s591322438
Accepted
import numpy as np S = input() cond1 = (S[0] == 'A') cntC = S.count('C', 2, len(S)-1) cond2 = (cntC == 1) cnt_lower = 0 for c in S: if c.islower(): cnt_lower += 1 cond3 = (cnt_lower == len(S)-2) if(cond1 and cond2 and cond3): print("AC") else: print("WA")
p02780
s508085647
Wrong Answer
import sys n,k=map(int,input().split()) pp = list(map(int,input().split())) s=[0]*n for i,p in enumerate(pp): if i==0: s[0] = (1+p)/2 else: s[i] = s[i-1]+(1+p)/2 res =0 for i in range(n-k): if res < s[i+k] - s[i]: res = s[i+k]-s[i] print(res)
p03262
s874819801
Accepted
N,X=map(int,input().split()) x=list(map(int,input().split())) def gcd(x,y): if y==0: return x else: return gcd(y,x%y) X=abs(X-x[0]) for i in range(N-1): X=gcd(max(X,abs(x[i+1]-x[i])),min(X,abs(x[i+1]-x[i]))) print(X)
p03377
s600824325
Accepted
a,b,x = map(int,input().split()) print('YES' if x >= a and (a+b) >= x else 'NO')
p03220
s723686495
Accepted
N = int(input()) T, A = map(int, input().split()) High = list(map(int, input().split())) Sa = [] for a, i in enumerate(High): Sa.append(abs(A-(T-High[a] * 0.006))) print(Sa.index(min(Sa)) + 1)
p02835
s119100635
Accepted
print("win" if sum(list(map(int,input().split())))<=21 else "bust")
p02911
s816534461
Accepted
n, k, q = map(int, input().split()) a = [int(input()) for i in range(q)] l = [k-q] * n for i in a: l[i-1] += 1 for f in l: if f <= 0: print("No") else: print("Yes")
p03345
s125930349
Wrong Answer
a,b,c,k=map(int,input().split()) print(c-b)
p02994
s982373956
Accepted
import numpy as np n, l = map(int, input().split()) if l < 0: if l + n <= 0: # 絶対値最小が0以下の場合は最右を削る taste = sum(range(l, l+n-1)) else: # 0を挟む場合はそのまま全部足す taste = sum(range(l, l+n)) else: # 絶対値最小が0以上の場合は最左を削る taste = sum(range(l+1, l+n)) print(taste)
p02819
s345298103
Wrong Answer
import sys x = int(input()) for i in range(x+1,100005): c = 0 for j in range(1,i+1): if i%j != 0: c += 1 if c == i-2: print(i) sys.exit()
p03282
s633633704
Accepted
s = input() k = int(input()) for i in range(len(s)): if s[i] == "1": if i+1 == k: print(1) break else: print(s[i]) break
p02792
s034911526
Wrong Answer
strN = input() N = int(strN) p = {i: {j: 0 for j in range(1, 10)} for i in range(1, 10)} for i in range(1, 10): for j in range(1, 10): for k in range(1, N): strk = str(k) if str(i) == strk[0] and str(j) == strk[-1]: p[i][j] += 1 ans = 0 for i in range(1, 10): for j in range(1, 10): ans += p[i][j] * p[j][i] print(ans)
p02860
s238903891
Accepted
N=int(input()) S=input() if N % 2 ==1: print('No') elif S[0:N // 2] == S[N//2: N]: print('Yes') else: print('No')
p02881
s862053494
Accepted
n = int(input()) for i in range(10**6+1): if i ** 2 >= n: break for j in range(i, 0, -1): if n % j == 0: break print(j + n // j - 2)
p02848
s176671378
Wrong Answer
import sys import os def main(): if os.getenv("LOCAL"): sys.stdin = open("input.txt", "r") N = int(sys.stdin.readline().rstrip()) S = list(sys.stdin.readline()) ret = [] for s in S: n = ord(s) + N ret.append(chr(((n - 65)%26)+65)) print("".join(ret)) if __name__ == '__main__': main()
p03001
s111148722
Accepted
#W, H, x, y W, H, x, y = map(int, input().split()) S = W*H/2 if x==W/2 and y == H/2: print(S, 1) else: print(S, 0)
p02833
s117807849
Accepted
n=int(input()) if n%2==1: print(0) exit() ans=0 for i in range(1,26): a=2*5**i ans+=n//a print(ans)
p02771
s702677627
Accepted
numbers = map(int, input().split()) print("Yes") if len(set(numbers)) == 2 else print("No")
p02572
s830942180
Accepted
N = int(input()) A = list(map(int, input().split())) MOD = 1000000007 sum = 0 for i in range(N): sum = sum + A[i] res = 0 for i in range(N): sum = sum - A[i] res = res + (A[i] % MOD * sum % MOD) print(res % MOD)
p02729
s187314382
Accepted
N, M = map(int, input().split()) print((N*(N-1))//2 + (M*(M-1))//2)
p02983
s012968624
Accepted
L, R = map(int, input().split()) ans = 3000 if R-L > 2019: ans = 0 else: for i in range(L, R): for j in range(i+1, R+1): ans = min(i*j%2019, ans) print(ans)
p04020
s039372201
Accepted
n = int(input()) alst = [int(input()) for _ in range(n)] cnt = 0 bef = 0 for num in alst: cnt += (num + bef) // 2 if (num + bef) % 2 == 1 and num > 0: bef = 1 else: bef = 0 print(cnt)
p02993
s921494428
Wrong Answer
s = str(input().split()) print(s) i = 0 while True: i += 1 if i == 4: break if s[i] == s[i +1]: print_ans = 'Bad' break else: print_ans = 'Good' print(print_ans)
p02699
s656554465
Accepted
s,w = map(int,input().split()) print("unsafe" if s<=w else "safe")
p02631
s423841686
Accepted
N = int(input()) A = list(map(int, input().split()))#o(10^5) temp = 0 for a in A: temp = temp ^ a for a in A: print(temp ^ a, end=' ')
p02677
s764242141
Accepted
from math import sqrt, cos, radians def solve(A, B, H, M): Hr = (H * 60 + M) * 0.5 Mr = M * 6 r = abs(Hr - Mr) if r > 180: r = 360 - r if r == 90: print(sqrt(A ** 2 + B ** 2)) else: print(sqrt(A ** 2 + B ** 2 - (2 * A * B * cos(radians(r))))) A, B, H, M = map(int, open(0).read().split()) solve(A, B, H, M)
p02771
s887488139
Wrong Answer
a, b, c = map(int, input().split()) if a == b and a == c: print("NO") elif a != b and a != c and b != c: print("NO") else: print("YES")
p03000
s907904460
Accepted
N,X = map(int,input().split()) L = list(map(int,input().split())) tmp = 0 cnt = 1 for i in range(N): tmp += L[i] if(tmp <= X): cnt += 1 print(cnt)
p03555
s077324641
Accepted
s1 = input() s2 = input() print('YES' if s1 == s2[::-1] else 'NO')
p03481
s297907455
Accepted
x,y=map(int, input().split()) i=0 while x*(2**i)<=y: i+=1 print(i)
p03779
s099313715
Wrong Answer
X = int(input()) X = abs(X) for i in range(10**5): if X < i*(i+1)//2: ans = X - i*(i-1)//2 + i-1 break print(ans)
p02755
s357945879
Accepted
import math n,m = map(int,input().split()) if (n+1)/0.08 > m/0.1 and (m+1)/0.1 > n/0.08: print(max(math.ceil(n/0.08),math.ceil(m/0.1))) else: print(-1)
p03017
s293706108
Wrong Answer
n,a,b,c,d = map(int,input().split()) s = input() if('##' in s[a-1:d]): print('No') exit() if(c < d): print('Yes') else: if('...' in s[b-2:d]): print('Yes') else: print('No?')
p02842
s477238945
Accepted
import math n = int(input()) o = n / 1.080 o_floor = math.floor(o) o_ceil = math.ceil(o) if math.floor(o_floor * 1.08) == n: print(o_floor) elif math.floor(o_ceil * 1.08) == n: print(o_ceil) else: print(':(')
p03107
s256339123
Accepted
from collections import Counter S = input() C = Counter(S).values() if len(C) == 2: print(min(2*c for c in C)) else: print(0)
p03997
s729893537
Wrong Answer
a = int(input()) b = int(input()) h = int(input()) print((a*b*h) * 0.5)
p02958
s449226347
Accepted
import numpy as np n = int(input()) p = [i for i in list(map(int, input().split()))] p = np.array(p) p_org = p.copy() p.sort() if (p != p_org).sum() <= 2: print('YES') else: print('NO')
p03665
s477687047
Accepted
import numpy as np def combinations(n,k,mod=10**9+7): x,y = 1,1 for i in range(k): x = (x*(n-i))%mod y = (y*(i+1))%mod y = pow(y,mod-2,mod) return (x*y)%mod N,P = map(int,input().split()) a = np.array(list(map(int,input().split())))%2 a1 = np.count_nonzero(a==1) a0 = np.count_nonzero(a==0) ans = 0 for i in range(P,a1+1,2): ans += combinations(a1,i) print(ans*(2**a0))
p02797
s613211536
Wrong Answer
import sys N, K, S = map(int, input().split()) if N == K: ans = '' for i in range(N): ans += str(S) + ' ' print(ans.rstrip()) sys.exit() ans = '' s1, s2 = 0, 0 ex = (S + 1) % (10**9 + 1) if S % 2 == 0: s1 = s2 = S // 2 else: s1 = S // 2 s2 = s1 + 1 for i in range(N): if i % 2 == 0 and i <= K: ans += str(s1) + ' ' elif i <= K: ans += str(s2) + ' ' else: ans += str(ex) + ' ' print(ans.strip())
p04031
s095480767
Accepted
n = int(input()) nums = list(map(int, input().split())) def cost(x,y): return (x-y)**2 avg = round(sum(nums)/len(nums)) res = 0 for n in nums: res += cost(n, avg) print(res)
p03944
s854286670
Accepted
import sys readline = sys.stdin.readline W,H,N = map(int,readline().split()) minX = 0 minY = 0 maxX = W maxY = H for i in range(N): x,y,a = map(int,readline().split()) if a == 1: minX = max(minX,x) elif a == 2: maxX = min(maxX,x) elif a == 3: minY = max(minY,y) elif a == 4: maxY = min(maxY,y) print(max(0,maxX - minX) * max(0,maxY - minY))
p04033
s119283676
Wrong Answer
a,b=map(int,input().split()) if a>0: print("Positive") elif a<=b<0: if (b-a+1)%2==0: print("Positive") else: print("Negative") else: print(0)
p02910
s143917958
Accepted
s = list(input()) count = 0 for i in range(0,len(s)): sign = (i+1)%2 if sign == 1 and s[i] == "L": count = 1 elif sign == 0 and s[i] == "R": count = 1 if count == 1: ans = "No" elif count == 0: ans = "Yes" print(ans)
p03998
s653537481
Accepted
s_li = [[] for i in range(3)] for i in range(3): for s in input(): if s=='a':s_li[i].append(0) if s=='b':s_li[i].append(1) if s=='c':s_li[i].append(2) x = s_li[0].pop(0) while len(s_li[x])!=0: x = s_li[x].pop(0) ans_dic={0:'A',1:'B',2:'C'} print(ans_dic[x])
p03472
s343246958
Wrong Answer
import math n, h = list(map(int, input().split())) ab = [[] for _ in range(n)] for i in range(n): ab[i] = list(map(int, input().split())) az, bz = list(zip(*ab)) maxa = max(az) minb = min(bz) cnt = 0 for i in bz: if i > maxa: h -= i cnt += 1 if h >= 0: cnt += math.ceil(h / maxa) print(cnt)
p03745
s379275001
Accepted
N = int(input()) A = list(map(int, input().split())) i = 0 ans = 0 while i < N: j = i while j < N-1 and A[j]<=A[j+1]: j += 1 k = i while k < N-1 and A[k]>=A[k+1]: k += 1 ans += 1 i = max(j, k) + 1 print(ans)
p02642
s579277536
Wrong Answer
N = int(input()) A = list(map(int,input().split())) dev = [] count = 1 A = sorted(A, reverse = True) for i in range(N-1): flag = 0 for j in range(i+1, N): if A[i] % A[j] == 0: flag = 1 break if flag == 0: count +=1 l = len(A) if A[l-1] == A[l-2]: count -=1 print(count)
p02761
s252503573
Accepted
def is_valid(n, conditions): ns = [int(i) for i in str(n)] return all(ns[s - 1] == c for s, c in conditions) N, M = map(int, input().split()) sc = [] for _ in range(M): s, c = map(int, input().split()) sc.append((s, c)) candidates = (i for i in range(1000) if len(str(i)) == N and is_valid(i, sc)) try: print(next(candidates)) except StopIteration: print(-1)
p03493
s878562423
Wrong Answer
s = input() s1 = int(s[0]) s2 = int(s[1]) s3 = int(s[2]) ans = 0 if s1 == 1: ans += 1 elif s2 ==1: ans += 1 elif s3 == 1: ans += 1 print(ans)
p03659
s330763937
Accepted
N = int(input()) a = [int(i) for i in input().split()] sum_a = sum(a) b = [] c = 0 for i in range(N-1): c += a[i] b.append(abs(2*c-sum_a)) print(min(b))
p03862
s780673465
Accepted
N, x = [int(x) for x in input().split()] a = list([int(x) for x in input().split()]) count = 0 for i in range(N): if a[i] > x: count += a[i] - x a[i] -= a[i] - x if i - 1 >= 0: if a[i] + a[i-1] > x: count += (a[i] + a[i-1]) - x a[i] -= (a[i] + a[i-1]) - x print(count)
p02555
s947227035
Wrong Answer
# -*- coding: utf-8 -*- import numpy as np S=int(input()) MOD=10**9+7 N=S//3 D=np.zeros([S+1,N+1]) for i in range(3,S+1): D[i,1]=1 for j in range(2,N+1): for i in range(3*j,S+1): for k in range(3,i-3*(j-1)+1): #print(k) D[i,j]+=D[S-k,j-1] D[i,j]%=MOD ans=0 for j in range(1,N+1): ans+=D[S,j] ans%=MOD #print(D) print(int(ans))
p02689
s633360230
Wrong Answer
n,m = map(int,input().split()) h = list(map(int,input().split())) tenbo = [list(map(int,input().split())) for _ in range(m)] #print(tenbo) tree = [[0]for _ in range(n)] for i in range(m): x = tenbo[i] x1 = x[0] x2 = x[1] #print(x1) y1 = h[x1-1] y2 = h[x2-1] a = [y1,y2] #print(x[1]) tree[x[0]-1].extend(a) tree[x[1]-1].extend(a) c = 0 for i in range(n): if max(tree[i]) <=h[i]: if len(tree[i]) > 1: #print(max(tree[i])) c += 1 print(c)
p02660
s496849841
Wrong Answer
import math n = int(input()) res = 0 if n <= 1: print(res) else: max_cnt = int(math.sqrt(n)) org_n = n for z in range(2, max_cnt + 1): if n == 1 or z > math.sqrt(n): res += 1 break if n % z == 0: # print(z, n, n//z) res += 1 n = n // z if n == z: break if n == org_n: res += 1 print(res)
p02583
s239291169
Accepted
n=int(input()) ls=list(map(int,input().split())) cnt=0 for i in range(n-2): a=ls[i] for j in range(i+1,n-1): b=ls[j] if a==b: continue for k in range(j+1,n): c=ls[k] if a==c or b==c: continue if a+b <= c or a+c <= b or b+c <= a: continue else: cnt+=1 print(cnt)
p03289
s970005462
Accepted
s = input() if s[0]=='A' and 'C' in s[2:-1]: s = s.replace('A','',1).replace('C','',1) if s == s.lower(): exit(print('AC')) print('WA')
p02761
s890904435
Accepted
def resolve(): n,m = map(int,input().split()) sc = [tuple(map(int,input().split())) for _ in range(m)] for i in range((10**(n-1) if n!=1 else 0),10**n): c = 1 for j in sc: if str(i)[j[0]-1] != str(j[1]): c = 0 break if c: break print(i if c else -1) resolve()
p02642
s350481081
Accepted
def main(): n = int(input()) A = [int(e) for e in input().split()] ma = max(A) N = [0] * (10 ** 6 + 1) for a in A: for i in range(a, ma + 1, a): N[i] += 1 ans = 0 for a in A: if N[a] == 1: ans += 1 print(ans) if __name__ == '__main__': main()
p03910
s532326013
Accepted
N = int(input()) total = 0 x = 0 for i in range(1, N+1): total += i x = i if total >= N: break diff = total-N for i in range(1, x+1): if i!=diff: print(i)
p03017
s164027567
Accepted
N, A, B, C, D = map(int, input().split()) S = input() canCross = False for i, s in enumerate(S, start=1): if A < i < max(C, D) and s == '#' and (S[i-2] == '#' or S[i] == '#'): print('No') exit() if B <= i <= min(C, D) and s == '.' and S[i-2] == '.' and S[i] == '.': canCross = True if C < D: print('Yes') else: if canCross: print('Yes') else: print('No')
p02658
s262733906
Wrong Answer
N = int(input()) A = list(map(int, input().split())) ans = 1 if ans > 10**18: ans = -1 elif min(A) == 0: ans = 0 else: for i in A: ans *= i print(ans)
p03071
s386864836
Wrong Answer
a,b=map(int, input().split()) x=max(a,b) print(x+x-1)
p03011
s617245018
Accepted
p,q,r=map(int,input().split()) print(min(p+q,q+r,r+p))
p03759
s393629123
Accepted
a=sorted(list(map(int,input().split()))) if a[1]-a[0]==a[2]-a[1]: print('YES') else: print('NO')
p03971
s253217018
Accepted
def resolve(): N, A, B= map(int, input().split(" ")) S = list(input()) sum_of_successful_candidate = 0 sum_of_successful_b = 0 for i, s in enumerate(S): if sum_of_successful_candidate >= A + B: for _ in range(N-i): print("No") return True if s == "a": sum_of_successful_candidate += 1 print("Yes") elif s == "b" and sum_of_successful_b < B: sum_of_successful_candidate += 1 sum_of_successful_b += 1 print("Yes") else: print("No") return True if __name__ == "__main__": resolve()
p03852
s134674175
Accepted
c = input() vowel=['a','e','i','o','u'] if c in vowel: print('vowel') else: print('consonant')
p03387
s821099039
Wrong Answer
a=list(map(int,input().split())) a.sort() cnt=0 if a[0]==a[1]==a[2]: print(0) exit() if a[0]==[1]: print(a[2]-a[1]) exit() if a[1]==a[2]: if (a[2]-a[0])%2==0: print((a[2]-a[0])//2) exit() else: print(a[2]-a[0]+1) exit() cnt+=a[2]-a[1] a[0]+=cnt if (a[2]-a[0])%2==0: cnt+=(a[2]-a[0])//2 else: cnt+=(a[2]-a[0])//2+1 print(cnt)
p02684
s927965792
Accepted
n,k=map(int,input().split()) a=[-1]+list(map(int,input().split())) count=[0]*(n+1) cnt=0 i=1 while count[i]==0: count[i]=cnt if cnt==k: print(i) exit() cnt+=1 i=a[i] if cnt==k: print(i) exit() loop=cnt-count[i] #print("loop",loop) goal=(k-cnt)%loop #print(loop,goal) if goal==0: print(i) else: print(count.index(count[i]+goal))