input
stringlengths
20
127k
target
stringlengths
20
119k
problem_id
stringlengths
6
6
def f(x): return (a * x) // b - a * (x // b) a, b, n = list(map(int, input().split())) k = (n + 1) // b ans = 0 for x in range(max(0, k * b - 1), n + 1): ans = max(ans, f(x)) print(ans)
def f(x): return (a * x) // b - a * (x // b) a, b, n = list(map(int, input().split())) k = (n + 1) // b x = max(k * b - 1, 0) ans = f(x) ans = max(ans, f(n)) print(ans)
p02696
import math def main(A, B, N): answer = 0 for x in range(N + 1): cand = math.floor(A * x / B) - A * math.floor(x / B) answer = max(answer, cand) print(answer) if __name__ == '__main__': A, B, N = list(map(int, input().split())) # A, B, N = 5, 7, 4 main(A, B, N)
import math def main(A, B, N): x = min(B-1, N) answer = math.floor(A * x / B) - A * math.floor(x / B) print(answer) if __name__ == '__main__': A, B, N = list(map(int, input().split())) main(A, B, N)
p02696
from math import floor def f(x): return floor(a*x/b) - a*floor(x/b) a,b,n = list(map(int,input().split())) ans = 0 for i in range(min(b-1,n)): ans = max(ans,f(i+1)) print(ans)
from math import floor def f(x): return floor(a*x/b) - a*floor(x/b) a,b,n = list(map(int,input().split())) print((f(min(b-1,n))))
p02696
import math A, B, N = list(map(int, input().split())) max = 0 i = 1 while True: x = i * B -1 if x > N: if i == 1: x = N else: break k = int(((x / B) - (x // B)) * A) if k > max: max = k i +=1 print(max)
A, B, N = list(map(int, input().split())) max = 0 i = 1 p = int((N + 1) / B) if p == 0: x = N else: x = B * p -1 print((int(((x / B) - (x // B)) * A)))
p02696
def main(): A, B, N = (int(x) for x in input().split()) mini = 0 if N >= B: for x in range(B-1, N+1, B): k = x / B ans = int(A*k) - int(k) if ans > mini: mini = ans else: ans = int(A*(N)/B) print(ans) if __name__ == ...
def main(): A, B, N = (int(x) for x in input().split()) mini = 0 if N >= B: ans = int(A*(B-1)/B) else: ans = int(A*(N)/B) print(ans) if __name__ == "__main__": main()
p02696
def main(): a, b, n = list(map(int, input().split())) x = min(b-1, n) print(((a*x)//b - a*(x//b))) if __name__ == "__main__": main()
def main(): a, b, n = list(map(int, input().split())) print((a*min(n, b-1)//b - a*(min(n, b-1)//b))) if __name__ == "__main__": main()
p02696
def main(): a, b, n = list(map(int, input().split())) x = min(b-1, n) print(((a*x)//b-a*(x//b))) if __name__ == "__main__": main()
def main(): a, b, n = list(map(int, input().split())) x = min(b-1, n) print((a*x//b - a*(x//b))) if __name__ == "__main__": main()
p02696
A,B,N=list(map(int,input().split())) max_L=0 x=0 while x<B and x<=N: L=int(A*x/B)-A*int(x/B) if max_L<=L: max_L=L x+=1 else: break """ if B>N: while x<=N: L=int(A*x/B)-A*int(x/B) if x<N: if max_L<=L: max_L=L x+=1 else: break else: if max_L<=L: max_L=L ...
A,B,N=list(map(int,input().split())) max_L=0 x=0 if B>N: x=N max_L=int(A*x/B)-A*int(x/B) else: x=B-1 max_L=int(A*x/B)-A*int(x/B) print(max_L)
p02696
import math a, b, n = list(map(int, input().split())) ans = 0 for x in range(1, n+1): ans = max(ans, (math.floor(a * x / b) - a * math.floor(x / b))) print(ans)
import math a, b, n = list(map(int, input().split())) x = min(b-1, n) ans = math.floor(a * x / b) - a * math.floor(x / b) print(ans)
p02696
a,b,n=list(map(int,input().split())) max = 0 if b - 1 > n: x = n else: x = b - 1 while x <= n: tmp = (a * x // b) - a * (x // b) if max < tmp: max = tmp x += b print(max)
a,b,n=list(map(int,input().split())) max = 0 if b - 1 > n: x = n else: x = b - 1 max = (a * x // b) - a * (x // b) print(max)
p02696
#!/usr/bin/env python3 import sys import math def solve(A: int, B: int, N: int): print((max([math.floor(A*x/B) - A*math.floor(x/B) for x in range(1, min(B+1, N+1))]))) return def main(): def iterate_tokens(): for line in sys.stdin: for word in line.split(): ...
#!/usr/bin/env python3 import sys import math def solve(A: int, B: int, N: int): x = min(B-1, N) print((math.floor(A*x/B) - A*math.floor(x/B))) return def main(): def iterate_tokens(): for line in sys.stdin: for word in line.split(): yield word t...
p02696
import math A, B, N = (int(i) for i in input().split()) ans = 0 for x in range(N+1): ans = max(ans, math.floor(A * x / B) - A * math.floor(x/B)) print(ans)
import math A, B, N = (int(i) for i in input().split()) def func(A, B, x): return math.floor(A * x / B) - A * math.floor(x/B) print((func(A, B, min(N, B-1))))
p02696
import math nums = [int(e) for e in input().split()] a = nums[0] b = nums[1] n = nums[2] max_score = -1 score = -1 for x in range(1, n+1): score = math.floor(a*x/b) - a* math.floor(x/b) if max_score < score: max_score = score x += 1 elif x > b: break print(m...
import math nums = [int(e) for e in input().split()] a = nums[0] b = nums[1] n = nums[2] max_score = -1 score = -1 # for x in range(1, n+1): # score = math.floor(a*x/b) - a* math.floor(x/b) # if max_score < score: # max_score = score # elif x > b: # break if b > n: ...
p02696
a, b, n = list(map(int, input().split())) max_int = 0 if a != b: if n < b: max_int = int((a*n)/b) -a * int(n/b) else: #for i in range(n, n-max(int(b/a), int(a/b), int(a%b), int(b%a))-1, -1): for i in range(1, n): tmp = int((a*i)/b) -a * int(i/b) #print(...
a, b, n = list(map(int, input().split())) i = min(b-1, n) print((int((a*i)/b) -a * int(i/b)))
p02696
a,b,n=list(map(int,input().split())) import math x=b-1 if n<b-1: m=[math.floor(a*n/b)] else: m=[0] while x<=n: f=math.floor(a*x/b)-a*(math.floor(x/b)) m.append(f) x+=b print((max(m)))
a,b,n=list(map(int,input().split())) import math if n<b: m=math.floor(a*n/b) else: e=b-1 m=math.floor(a*e/b) print(m)
p02696
import math A,B,N = list(map(int,input().split())) ans = 0 flag = False for i in range(1,N+1): t = math.floor(A*i/B) s = A*math.floor(i/B) if t-s >= 1: flag = True if flag and t-s == 0: break ans = t-s print(ans)
A,B,N = list(map(int,input().split())) C = N - N%B ans = A*(C-1)//B - A*((C-1)//B) if B > N: ans = A*N//B - A*(N//B) print(ans)
p02696
A, B, N = list(map(int, input().split())) f = [int(A*x/B) - (A * int(x/B)) for x in range(N+1)] print((max(f)))
def f(a, b, x): return int(a*x/b) - (a*int(x/b)) A, B, N = list(map(int, input().split())) print((f(A, B, min(B-1, N))))
p02696
A, B, N = list(map(int, input().split())) alpha = A // B beta = A % B q = min(N, B - 1) ans = alpha * q + (beta*q//B) print(ans)
A, B, N = list(map(int, input().split())) x = min(N, B-1) print((A*x//B - A*(x//B)))
p02696
import math a,b,n = list(map(int,input().split())) maxx = n//b ans = 0 for i in range(min(maxx,10**8)): x = b*(maxx-i)-1 ans = max(math.floor(a*x/b)-a*(math.floor(x/b)),ans) ans = max(math.floor(a*n/b)-a*(math.floor(n/b)),ans) print(ans)
a,b,n=list(map(int,input().split())) x=min(b-1,n) #上記よりxとしてmin(B-1,N)を選ぶのが最善 print(((a*x)//b-a*(x//b)))
p02696
import math A ,B ,N = list(map(int,input().split())) l = 0 t = A/B for x in range(1,N+1): if math.floor(t * x)-A*math.floor(x/B) > l: l=math.floor(t * x)-A*math.floor(x/B) print(l)
A , B , N = list(map(int,input().split())) x = min(B-1,N) print(((A*x)//B))
p02696
import math S = list(map(int,input().split())) A = S[0] B = S[1] N = S[2] d = [] for i in range(1,N+1): t = math.floor(A*i/B)-math.floor(i/B)*A d.append(t) print((max(d)))
import math S = list(map(int,input().split())) A = S[0] B = S[1] N = S[2] if N<B: print((math.floor(A*N/B)-math.floor(N/B)*A)) else: print((math.floor(A*(B-1)/B)-math.floor((B-1)/B)*A))
p02696
A,B,N=list(map(int,input().split())) list_ans=[] minimum=min(N-3,0) for i in range(minimum,N+1): list_ans.append(int(A*i/B)-A*int(i/B)) print((int(max(list_ans))))
A,B,N=list(map(int,input().split())) list_ans=[] minimum=min(B-1,N) print((int(A*minimum/B)-A*int(minimum/B)))
p02696
A, B, N = list(map(int,input().split())) max = 0 x = 0 n = int(B/A) if(n < 1):n=1 if(A == 1 or B == 1): print(max) else: while(x <= N): f = (A*x)//B - A*(x//B) #x += n x += 1 #print(f) if(max <= f): max = f if(max != 0 and f == 0): break print(max)
A,B,N = list(map(int,input().split())) def f(x): f = int((A*x)/B)-A*int(x/B) return f if(B-1 < N): print((f(B-1))) else: print((f(N)))
p02696
import math n = list(map(int,input().split())) hikaku = 0 for x in range(1,n[2]+1): m = math.floor(n[0] * x // n[1]) - n[0] * math.floor(x // n[1]) if hikaku < m: hikaku = m print(hikaku)
import math n = list(map(int,input().split())) x = min(n[1]-1 , n[2]) if n[2] >= n[2]: print((math.floor(n[0] * x / n[1])))
p02696
import math def bisearch(function, ok, ng): tmp = 0 while abs(ok-ng) > 1: mid = (ok + ng)//2 ans = function(mid) if ans > tmp: ok = mid else: ng = mid print(("mid:{}".format(mid))) tmp = ans return ok def calc(x): ...
import math def calc(x): return (math.floor(A*x/B) - A*math.floor(x/B)) A, B, N = list(map(int, input().split())) print((calc(min(B-1, N))))
p02696
a,b,n=list(map(int,input().split())) if n>=b-1: print((int(a*(b-1)/b)-a*int((b-1)/b))) else: print((int(a*n/b)-a*int(n/b)))
a,b,n=list(map(int,input().split())) if b-1<=n: x=b-1 print((int(a*x/b)-a*int(x/b))) else: x=n print((int(a*x/b)-a*int(x/b)))
p02696
import math a, b, n = list(map(int, input().split())) arr = [] ans = 0 for i in range(min(b, n)): x = i + 1 arr.append(math.floor(a * x / b) - a * math.floor(x / b)) ans = max(arr) print(ans)
import math a, b, n = list(map(int, input().split())) x = min(b - 1, n) ans = math.floor(a * x / b) - a * math.floor(x / b) print(ans)
p02696
import math A, B, N = list(map(int,input().split(' '))) def f(x): return math.floor(A*x/B)-A*math.floor(x/B) def main(): ans = 0 i = 0 while B > i and i <= N: fi = f(i) ans = f(i) if ans < fi else ans i += 1 print(ans) if __name__ == "__main...
import math A, B, N = list(map(int,input().split(' '))) def f(x): return math.floor(A*x/B)-A*math.floor(x/B) def main(): if N >= B: print((f(B-1))) else: print((f(N))) if __name__ == "__main__": main()
p02696
import math a,b,n= list(map(int, input().split())) c = a/b p = [] for x in range(n + 1): d = math.floor(c * x) - a * math.floor(x / b) p.append(d) p.sort() if len(p) == 2: del p[0] print((p[0]))
import sys input = sys.stdin.readline import math def main(): a,b,n = list(map(int, input().split())) if b > n: print((math.floor(a*n/b))) else: print((math.floor(a*(b-1)/b) - a*math.floor((b-1)/b))) if __name__ == '__main__': main()
p02696
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy sys.setrecursionlimit(10**7) inf=10**20 mod=10**9+7 dd=[(-1,0),(0,1),(1,0),(0,-1)] ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI(): return [int(x) for x in sys.stdin.readline().split()] def LF(): return [float(x) for...
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy sys.setrecursionlimit(10**7) inf=10**20 mod=10**9+7 dd=[(-1,0),(0,1),(1,0),(0,-1)] ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI(): return [int(x) for x in sys.stdin.readline().split()] def LF(): return [float(x) for...
p02696
A,B,N=input().split() A=int(A) B=int(B) N=int(N) ans=0 for x in range(N+1): ans=max(ans,int(A*x/B)-(A*int(x/B))) print(ans)
A, B, N = list(map(int, input().split())) if N<B: print((int(A*N/B))) else: print((int(A*(B-1)/B)))
p02696
import math A,B,N = list(map(int,input().split())) maxn = 0 sec =False pp =False for x in range(1,N+1): tmp = math.floor((A*x)/B)-A*(math.floor(x/B)) if maxn < tmp: maxn = tmp if sec == True and tmp != 0: pp =True if tmp == 0: if sec ==True and pp ==True: ...
import math A,B,N = list(map(int,input().split())) s = min(B-1,N) print((math.floor((A*s)/B)-A*(math.floor(s/B))))
p02696
import math a, b, n = list(map(int, input().split())) ans = [math.floor(a*i/b)-a*math.floor(i/b) for i in range(n+1)] print((max(ans)))
import math a, b, n = list(map(int, input().split())) if b>n: print((math.floor(a*n/b))) else: x = b-1 print((math.floor(a*x/b)))
p02696
a, b, n = list(map(int, input().split())) ans1 = 0 for i in range(n+1): ans2 = int(a * i / b) - a * int(i / b) ans1 = max(ans1, ans2) print(ans1)
a, b, n = list(map(int, input().split())) if b > n: x = n else: x = b - 1 print((int(a * x / b) - a * int(x / b)))
p02696
import math A, B, N = list(map(int, input().split())) d = 0 ans = 0 mid = N//2 if (math.floor((A*mid)/B) - A*math.floor(mid/B)) < (math.floor((A*(mid+1))/B) - A*math.floor((mid+1)/B)): for i in range(mid, N+1): d = math.floor((A * i) / B) - A * math.floor(i / B) if ans <= d: ...
import math A, B, N = list(map(int, input().split())) print((math.floor((A * min(B-1, N)) / B) - A * math.floor(min(B-1, N) / B)))
p02696
a, b, n = list(map(int, input().split())) x = min(b - 1, n) max_num = (a * x) // b - a * (x // b) print(max_num)
a, b, n = list(map(int, input().split())) x = min(b - 1, n) max_num = (a * x) // b - (a * (x // b)) print(max_num)
p02696
import math a,b,n = list(map(int,input().split())) ans=0 for x in range(n+1): c = math.floor(a*x/b)-a*(math.floor(x/b)) if c > ans: ans = c print(ans)
import math a,b,n = list(map(int,input().split())) ans=0 c = 0 if n >= b: c = b-1 else: c = n ans = math.floor(c*a/b)-a*(math.floor(c/b)) print(ans)
p02696
maxa=-(10**10) a,b,n=list(map(int,input().split())) for i in range(1,min(n+1,b+1)): maxa=max(((a*i)//b)-a*(i//b),maxa) print(maxa)
maxa=-(10**10) a,b,n=list(map(int,input().split())) i=min(n,b-1) maxa=max(((a*i)//b)-a*(i//b),maxa) print(maxa)
p02696
a,b,n = list(map(int,input().split())) ans = -float("inf") for x in range(n): #print(a*((x+1)%b)//b) if a*((x+1)%b)//b > ans: ans = a*((x+1)%b)//b #print("----------") print(ans)
a,b,n = list(map(int,input().split())) if n < b-1: print((a*(n%b)//b)) else: print((a*((b-1)%b)//b))
p02696
a,b,n = list(map(int, input().split())) com = 0 if n < b: x = n else: x = b-1 while x >= 0: val = (a*x)//b-a*(x//b) if val < com: pass else: com = val x -= 1 print(com)
a,b,n = list(map(int, input().split())) com = 0 if n < b: x = n else: x = b-1 val = (a*x)//b print(val)
p02696
a,b,n=list(map(int,input().split())) ''' lst=[] for i in range(n+1): now=int(a*i/b)-a*int(i/b) lst.append(now) print(max(lst)) ''' now=0 if n>=b: if n//b>=500000: ans=int(a*(n-1)/b)-a*int((n-1)/b) ans2=int(a*n/b)-a*int(n/b) for i in range(0,n//b+1,20000): an...
a,b,n=list(map(int,input().split())) def ans(x): return int(a*x/b) print((ans(min(n,b-1))))
p02696
# -*- coding: utf-8 -*- a,b,n = list(map(int,input().split())) ans = 0 tmp = min(b, n) for x in range(int(pow(n, 0.5)) + 1, n+1): #print(x) tmp1 = (a * x) // b - (a * (x // b)) if tmp1 >= ans: ans = tmp1 print(ans)
# -*- coding: utf-8 -*- a,b,n = list(map(int,input().split())) """ ans = 0 tmp = min(b, n) for x in range(int(pow(n, 0.5)) + 1, n+1): #print(x) tmp1 = (a * x) // b - (a * (x // b)) if tmp1 >= ans: ans = tmp1 print(ans) """ x = min(b-1, n) #print(x) ans = (a * x) // b - (a * (x // b))...
p02696
import math a,b,n = list(map(int,input().split())) l = [0] for x in range(1,n+1): ans = 0 ans = math.floor(a*x/b) - a * math.floor(x/b) l.append(ans) if l[x] > ans: break #print(l) print((max(l)))
A,B,N=list(map(int,input().split())) def f(x): return int(A*x/B)-A*int(x/B) print((f(min(N,B-1))))
p02696
a, b, n = list(map(int, input().split())) x = (n//b)*b - 1 if x == -1: x = n ans = a*x//b - a*(x//b) print(ans)
a, b, n = list(map(int, input().split())) if n <= b - 1: x = n else: x = n - (n%b + 1) ans = a*x//b - a*(x//b) print(ans)
p02696
A,B,N = list(map(int,input().split())) #N=int(input()) #A = list(map(int,input().split())) #S=str(input()) m=0 if B<N: N=B s=int(B/A) if s>N: print((0)) exit() for x in range(s,N+1): num=int(A*x/B) - A * int(x/B) m=max(num,m) print(m)
A,B,N = list(map(int,input().split())) #N=int(input()) #A = list(map(int,input().split())) #S=str(input()) m=0 if B<=N: m=int(A * (B-1) / B) print(m) else: m=int(A * N / B) print(m)
p02696
A,B,N = list(map(int,input().split())) max_n = -1 endpoint = min(B-1,N) for i in range(endpoint+1) : n = ((A * i) // B) - A * (i // B) # print(i,n) if (max_n < n) : max_n = n print(max_n)
def f(x) : return ((A * x) // B) - A * (x // B) A,B,N = list(map(int,input().split())) print((f(min(B-1,N))))
p02696
import math a, b, n = list(map(int, input().split())) def f(n): return math.floor(a*n/b) - a*math.floor(n/b) ans = f(n) for x in range(b-1, n+1, b): ans = max(ans, f(x)) print(ans)
from math import floor a, b, n = list(map(int, input().split())) def f(x): return floor(a*x/b) - a*floor(x/b) print((f(min(n, b-1))))
p02696
from math import floor,ceil import fractions import collections import itertools from collections import deque A,B,N=list(map(int,input().split())) piv=B/A #基本数 #for i in range(0,30): # print(A,i,B,floor(A*i/B)-A*floor(i/B)) #A<=Bなら #0,0,.. 1,1,.. ... (A-1),(A-1),...が #先頭から(B%A)の数字まではceil(piv)こ、あとは...
from math import floor,ceil import fractions import collections import itertools from collections import deque A,B,N=list(map(int,input().split())) piv=B/A #基本数 #for i in range(0,30): # print(A,i,B,floor(A*i/B)-A*floor(i/B)) #A<=Bなら #0,0,.. 1,1,.. ... (A-1),(A-1),...が #先頭から(B%A)の数字まではceil(piv)こ、あとは...
p02696
a,b,n=list(map(int,input().split())) # s=n//b nmax = (a*n)//b - a*(n//b) # for i in range(1,s+1): # x = b*i-1 # t = (a*x)//b - a*(x//b) # if t > nmax: # nmax = t b_n = b b_nn = 0 while b_n <= n: x = b_n -1 t = (a*x)//b - a*b_nn if t > nmax: nmax = t b_n += b ...
a,b,n=list(map(int,input().split())) s=n//b nmax = (a*n)//b - a*(n//b) # b_n = b # b_nn = 0 # while b_n <= n: # x = b_n -1 # t = (a*x)//b - a*b_nn # if t > nmax: # nmax = t # b_n += b # b_nn +=1 if s>0: x = b*s-1 t = (a*x)//b - a*(s-1) if t > nmax: nmax = ...
p02696
import sys import math sys.setrecursionlimit(10**9) def main(): A,B,N = list(map(int,input().split())) def f(x): return math.floor((A*x)/B) - A * math.floor(x/B) def bin(a): left = 0 right = min(B-1,N) while right-left > 1: x = (right+left) // 2...
import sys import math sys.setrecursionlimit(10**9) def main(): A,B,N = list(map(int,input().split())) def f(x): return math.floor((A*x)/B) - A * math.floor(x/B) print((f(min(B-1,N)))) if __name__ == "__main__": main()
p02696
a,b,n=list(map(int,input().split())) a1=a*n//b i=(n+1)//b if i!=0: a2=a*(b-1)//b print(a2) else: print(a1)
A,B,N=list(map(int,input().split())) if N>=B: print((int(A*(B-1)/B))) else: print((int(A*N/B)))
p02696
def resolve(): n=int(eval(input())) l=list(map(int,input().split())) from collections import Counter c=Counter(l)# ()にカウンターの対象のリストの変数名 cl=list(c.items()) cl.sort(key=lambda x:x[0],reverse=True) ans=[] for key,value in cl: if value>=4: ans.append(key) ...
import sys def input(): return sys.stdin.readline().strip() def resolve(): n=int(eval(input())) l=list(map(int,input().split())) from collections import Counter c=Counter(l)# ()にカウンターの対象のリストの変数名 cl=list(c.items()) cl.sort(key=lambda x:x[0],reverse=True) ans=[] for key,value i...
p03627
import sys def input(): return sys.stdin.readline().strip() def resolve(): n=int(eval(input())) l=list(map(int,input().split())) from collections import Counter c=Counter(l)# ()にカウンターの対象のリストの変数名 cl=list(c.items()) cl.sort(key=lambda x:x[0],reverse=True) ans=[] for key,value i...
import sys def input(): return sys.stdin.readline().strip() def resolve(): n=int(eval(input())) l=list(map(int,input().split())) from collections import Counter c=Counter(l)# ()にカウンターの対象のリストの変数名 ans=[] for key,value in list(c.items()): if value>=4: ans.append(key)...
p03627
N = int(eval(input())) A = list(map(int, input().split())) A.sort() A.reverse() Ans = [] d = 0 cnt = 0 while cnt < 2: c = A.count(A[d]) for j in range(c//2): Ans.append(A[d]) cnt += c//2 d += c if d == N: Ans.append(0) Ans.append(0) cnt +=2 print((Ans[0]*Ans[1]))
N = int(eval(input())) A = list(map(int, input().split())) A.sort(reverse=True) Ans = [] d = 0 cnt = 0 while cnt < 2: c = (A[d:d+4]).count(A[d]) for j in range(c//2): Ans.append(A[d]) cnt += c//2 d += c if d == N: Ans.append(0) Ans.append(0) cnt +=2 print((Ans[0]*Ans[1]))
p03627
n=int(eval(input())) a=list(map(int,input().split())) f=0 s=0 mx=max(a) stk=[] ed=[0,0] for i in a: if i in stk: stk.remove(i) ed.append(i) else: stk.append(i) ans=sorted(ed,reverse=True) print((ans[0]*ans[1]))
n=int(eval(input())) a=list(map(int,input().split())) a.sort(reverse=True) ans=0 b=-1 for i in a: if i==b: if ans!=0: ans*=i break else: ans=i b=-1 continue b=i print(ans)
p03627
import collections s = set() N = int(eval(input())) count = []*(10**9+1) ma1 = 0 ma2 = 0 A = list(map(int,input().split())) a = collections.Counter(A) b = sorted(list(a.items()),reverse = True) for i in b: if ma1 == 0 and i[1] > 1: ma1 = i[0] if i[1] > 3: ma2 = i[0] elif ma1 != 0 and i...
N = int(eval(input())) ma1 = 0 ma2 = 0 A = list(map(int,input().split())) A.append(0) a = sorted(A,reverse = True) hold = 0 count = 0 for i in a: if i == hold: count += 1 else: if count > 3 and ma1 == 0: ma1 = hold ma2 = hold elif count > 1: if ma1 == 0: ma...
p03627
n = int(eval(input())) A = list(map(int, input().split())) d = {} for i in range(n): if A[i] not in d: d[A[i]] = 1 else: d[A[i]] += 1 #print(d) L = [] for k, v in list(d.items()): if v >= 2: L.append([k, v]) L.sort(reverse=True) if len(L) == 0: print((0)) elif l...
n = int(eval(input())) A =list(map(int, input().split())) d = {} for i in range(n): if A[i] not in d: d[A[i]] = 1 else: d[A[i]] += 1 ans = 0 l = [] for k, v in list(d.items()): if v >= 4: ans = max(ans, k**2) l.append(k) elif v >= 2: l.append(k) ...
p03627
n = int(eval(input())) A =list(map(int, input().split())) d = {} for i in range(n): if A[i] not in d: d[A[i]] = 1 else: d[A[i]] += 1 ans = 0 l = [] for k, v in list(d.items()): if v >= 4: ans = max(ans, k**2) l.append(k) elif v >= 2: l.append(k) ...
n = int(eval(input())) A =list(map(int, input().split())) d = {} for i in range(n): if A[i] not in d: d[A[i]] = 1 else: d[A[i]] += 1 s = [] t = [] for k, v in list(d.items()): if v >= 4: s.append(k) t.append(k) elif v >= 2: t.append(k) if len(s...
p03627
from collections import Counter N = int(eval(input())) A = Counter(list(map(int, input().split()))) ans = [0, 0] for k in sorted(list(A.keys()), reverse=True): if A[k] >= 2: ans.append(k) if A[k] >= 4: ans.append(k) ans = sorted(ans) print((ans[-1]*ans[-2]))
from collections import Counter N = int(eval(input())) A = Counter(list(map(int, input().split()))) A = {k: v for k, v in list(A.items()) if v >= 2} A = sorted(list(A.items()), key=lambda x: x[0], reverse=True) A.extend([(0, 0), (0, 0)]) if A[0][1] >= 4: print((A[0][0]**2)) else: print((A[0][0]*A[1][...
p03627
N = int(eval(input())) A = list(map(int, input().split())) A.sort(reverse=True) ans = [] s = A[0] n = 1 for i in range(1, N): if len(ans) == 2: break if A[i] == s: n += 1 if n == 2 or n == 4: ans.append(s) else: s = A[i] n = 1 print((ans[0] * ans[1] if len(ans) != 0 else 0))
N = int(eval(input())) A = list(map(int, input().split())) A.sort(reverse=True) a = "" ans = [] for i in range(N): if a == "": a = A[i] elif a != A[i]: a = A[i] elif A[i] == a: ans.append(A[i]) a = "" if len(ans) == 2: break print((0 if len(ans) != 2 else ans[0] * ans[1]))
p03627
N = int(eval(input())) A = list(map(int, input().split())) #%% keys = set(A) keys = sorted(keys, reverse=True) lengths = [] for k in keys: num = A.count(k) if num >= 4 and len(lengths) == 0: lengths.append(k) lengths.append(k) elif num >= 2: lengths.append(k) i...
N = int(eval(input())) A = sorted(list(map(int, input().split())), reverse=True) lengths = [] for i in range(len(A) - 1): try: if A[i] == A[i+3] and len(lengths) == 0: lengths.append(A[i]) lengths.append(A[i]) break except: pass if (A[i] not...
p03627
import sys import heapq input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) def main(): N = int(eval(input())) A = list(map(int, input().split())) A = list(set([-x for x in A if A.count(x) >= 2])) if len(A) < 2: print((0)) exit() heapq.heapify(A) print...
import sys import heapq input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) def main(): N = int(eval(input())) s = set() q = [0, 0] for a in map(int, input().split()): if a > q[0]: try: s.remove(a) heapq.heapreplace(q, a) ...
p03627
# ARC081c def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(10**6) from collections import Counter n = int(eval(input())) a = list(map(int, input().split())) a.sort(reverse=True) mg = 0 for i in a: if a.count(i) > 3 and mg != i: ...
# ARC081c def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(10**6) from collections import Counter import heapq n = int(eval(input())) def fun(i): return -int(i) a = list(map(fun, input().split())) heapq.heapify(a) b = [] hea...
p03627
# ARC081c def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(10**6) from collections import Counter import heapq n = int(eval(input())) def fun(i): return -int(i) a = list(map(fun, input().split())) heapq.heapify(a) b = [] hea...
# ARC081c def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(10**6) from collections import Counter import heapq n = int(eval(input())) a = list(map(int, input().split())) a.sort(reverse=True) b = [] heapq.heapify(b) ln = 0 cou = 0 ...
p03627
N = int(eval(input())) a = sorted(list(map(int, input().split()))) val, ans = [], [] for i in a: if i in set(val): ans.append(i) else: val.append(i) ans.sort() if len(ans) == 0: print((0)) else: if ans.count(ans[-1]) >= 4: print((ans[-1]**2)) elif ans.count(ans[...
N = int(eval(input())) a = list(map(int, input().split())) val = set() ans = [] for i in a: if i in val: ans.append(i) else: val.add(i) ans.sort() if len(ans) == 0: print((0)) else: if ans.count(ans[-1]) >= 4: print((ans[-1]**2)) elif ans.count(ans[-1]) == 3:...
p03627
from collections import Counter n = int(eval(input())) a = list(map(int, input().split())) cnt = Counter(a) ans = [] for k in sorted(list(cnt.keys()), reverse=True): if len(ans) == 2: break if cnt[k] >= 4: ans.append(k) ans.append(k) elif cnt[k] >= 2: ans.append(k...
from collections import Counter n = int(eval(input())) ctr = Counter(list(map(int, input().split()))) side = [] for k in sorted(list(ctr.keys()), reverse=True): if ctr[k] >= 4: side.append(k) side.append(k) elif ctr[k] >= 2: side.append(k) print((side[0] * side[1] if len(side) ...
p03627
import collections def main(): n = int(eval(input())) a = list(map(int,input().split())) cnt = collections.Counter(a) set_a = set(a) a = [] a = list(set_a) a.sort(reverse=True) select = 0 ans = 1 tmp = 0 flg = 0 for i, aa in enumerate(a): if cnt[aa...
import collections def main(): n = int(eval(input())) a = list(map(int,input().split())) # a.sort(reverse=True) c = collections.Counter(a) cl = c.most_common() # cl.sort(reverse = True) cnt = 1 lst = [] now = a[0] ans = 0 for i, cc in enumerate(cl): if ...
p03627
N = int(eval(input())) A = list(map(int, input().split())) C = {} count = 0 H = 0 W = 0 res1=res2=res3=0 for i in A: C[i] = 0 for i in A: C[i] += 1 for i in A: if C[i] >= 2: res1 = max(res1, i) for i in A: if C[i] >= 2 and i != res1: res2 = max(res2, i) f...
N = int(eval(input())) A = list(map(int, input().split())) A.sort() wh = [0,0] tmp = 0 for i in A: if i == tmp: wh.append(i) tmp = 0 else: tmp = i print((wh[-1] * wh[-2]))
p03627
N = int(eval(input())) import collections A = list(map(int,input().split())) C = collections.Counter(A) use = [0,0] for i,val in list(C.items()): if val >= 4: use.append(i) if val >= 2: use.append(i) use.sort(reverse=True) print((use[0] * use[1]))
N = int(eval(input())) import collections A = list(map(int,input().split())) C = collections.Counter(A) use = [] for i,val in list(C.items()): if val >= 4: use.append(i) if val >= 2: use.append(i) use = sorted(use,reverse= True) if len(use)<2: print((0)) else: print((use[0]*use[1]))
p03627
from collections import Counter N = int(eval(input())) cnt = Counter(list(map(int, input().split()))) L = sum([[a] * (c // 2) for a, c in list(cnt.items())], []) L.sort() ans = 0 if len(L) < 2 else L[-1] * L[-2] print(ans)
from collections import Counter N = int(eval(input())) cnt = Counter(list(map(int, input().split()))) L = [] for a, c in list(cnt.items()): if c >= 2: L += [a] * (c // 2) L.sort() ans = 0 if len(L) < 2 else L[-1] * L[-2] print(ans)
p03627
from collections import Counter N = int(eval(input())) cnt = Counter(list(map(int, input().split()))) L = sum([[a for _ in range(min(2, c // 2))] for a, c in list(cnt.items())], []) L.sort() ans = 0 if len(L) < 2 else L[-1] * L[-2] print(ans)
from collections import Counter N = int(eval(input())) A = Counter(list(map(int, input().split()))) S = [] for a, c in list(A.items()): S.extend([a] * (c // 2)) S.sort() if len(S) < 2: print((0)) else: print((S[-1] * S[-2]))
p03627
import sys read = sys.stdin.buffer.read input = sys.stdin.buffer.readline inputs = sys.stdin.buffer.readlines # rstrip().decode('utf-8') # map(int,input().split()) # import numpy as np from collections import defaultdict def main(): d=defaultdict(int) n=int(eval(input())) A=list(map(int,input()...
import sys read = sys.stdin.buffer.read input = sys.stdin.buffer.readline inputs = sys.stdin.buffer.readlines # rstrip().decode('utf-8') # map(int,input().split()) # import numpy as np def main(): n=int(eval(input())) A=list(map(int,input().split())) A.sort(reverse=True) ans=0 cnt=0 li=[] f...
p03627
from collections import Counter N = int(eval(input())) A = list(map(int,input().split())) c = Counter(A) hen = [] for i,j in zip(list(c.keys()),list(c.values())): if 2 <= j <= 3: hen.append([i,2]) elif j >= 4: hen.append([i,4]) hen.sort(reverse=True) ##print(hen) ans = ...
from collections import Counter N = int(eval(input())) A = list(map(int,input().split())) c = Counter(A) hen = [] for i,j in zip(list(c.keys()),list(c.values())): if 2 <= j <= 3: hen.append([i,2]) elif j >= 4: hen.append([i,4]) hen.sort(reverse=True) ##print(hen) ans = ...
p03627
def solve(): N = int(eval(input())) A = [int(a) for a in input().split()] A.sort() Adict = dict() for i, a in enumerate(A): if a in Adict: Adict[a] += 1 else: Adict[a] = 1 rect = 0 ri = -1 for i in reversed(list(range(N))): if Adict[A[i]] >= 4: ...
import sys from heapq import heapify, heappop, heappush def solve(): input = sys.stdin.readline N = int(eval(input())) A = [int(a) for a in input().split()] Anum = dict() for a in A: if a in Anum: Anum[a] += 1 else: Anum[a] = 1 q = [0, 0] for key in Anum: ...
p03627
from collections import defaultdict eval(input()) t = defaultdict(lambda: 0) for e in [int(i) for i in input().split()]: t[e] += 1 ans = [] for k, v in list(t.items()): if v >= 2: if v >= 4: ans.extend([k, k]) else: ans.append(k) ans.sort() if len(ans) < 2: print((0)) else: ...
from collections import Counter eval(input()) t = Counter([int(i) for i in input().split()]) ans = [] for k, v in list(t.items()): if v >= 2: if v >= 4: ans.extend([k, k]) else: ans.append(k) ans.sort() if len(ans) < 2: print((0)) else: print((ans[-1]*ans[-2]))
p03627
from collections import Counter N = int(eval(input())) a = list(map(int,input().split())) c = Counter(a) ans = 0 s = [] for e in c: if c[e] >= 2: s.append(e) if c[e] >= 4: ans = max(ans,e*e) s = sorted(s) if len(s) < 2: print((0)) else: print((max(ans,s[-1]*s[-2])))
from collections import Counter N = int(eval(input())) A = list(map(int,input().split())) C = Counter(A) T = [] F = [] for e in C: if C[e] >= 4: F.append(e) if C[e] >= 2: T.append(e) ans = 0 for e in F: ans = max(ans,e**2) T = sorted(T) if len(T) >= 2: ans = max(ans,T[-1]...
p03627
N=int(eval(input())) A=list(map(int,input().split())) B=[] C=[] for i in range(N): if A[i] in B: C+=[A[i]] B.remove(A[i]) else: B+=[A[i]] C.sort(reverse=1) if len(C)<2: print((0)) else: print((C[0]*C[1]))
import sys N=int(eval(input())) A=list(map(int,input().split())) A.sort(reverse=1) a=0 b=0 j=N-1 for i in range(N-1): if A[i]==A[i+1]: a=A[i] j=i break for i in range(j+2,N-1): if A[i]==A[i+1]: b=A[i] break print((a*b))
p03627
import collections N = int(eval(input())) A = list(map(int, input().split())) a = collections.Counter(A) ans = [0, 0] for i in list(a.keys()): if a[i] >= 2: ans.append(i) if a[i] >= 4: ans.append(i) ans.sort() print((ans[-1]*ans[-2]))
from collections import Counter N = int(eval(input())) A = list(map(int, input().split())) c = Counter(A) ans = [0, 0] for i, j in list(c.items()): if j >= 2: ans.append(i) if j >= 4: ans.append(i) ans.sort() print((ans[-1]*ans[-2]))
p03627
def main(): import sys input = sys.stdin.readline n = int(input().rstrip('\n')) a = list(map(int, input().rstrip('\n').split())) import collections a = collections.Counter(a).most_common() a = sorted(a, key=lambda x: x[0], reverse=True) t = -1 for k, v in a: if v >=...
def slove(): import sys import collections input = sys.stdin.readline n = int(input().rstrip('\n')) a = list(map(int, input().rstrip('\n').split())) a = sorted(collections.Counter(a).most_common(), key=lambda x: x[0], reverse=True) ans = [] for k, v in a: if v >= 2: ...
p03627
from collections import defaultdict n = int(eval(input())) A = list(map(int, input().split())) d = defaultdict(int) l = [] for key in A: d[key] += 1 if d[key] == 2: l.append(key) d[key] = 0 if len(l) < 2: print((0)) else: l.sort(reverse=True) print((l[0]*l[1]))
from collections import Counter n = int(eval(input())) A = list(map(int, input().split())) C = Counter(A) L = [] for k, v in list(C.items()): if v >= 2: L.append(k) if v >= 4: L.append(k) if len(L) < 2: print((0)) else: L.sort() ans = L[-1] * L[-2] print(ans)
p03627
N = int(eval(input())) A = list(map(int,input().split())) from collections import Counter ctr = Counter(A) e = -1 for k,v in sorted(list(ctr.items()), reverse=True): if v < 2: continue if e > 0: print((e*k)) exit() elif v >= 4: print((k*k)) exit() else: ...
N = int(eval(input())) A = list(map(int,input().split())) from collections import Counter ctr = Counter(A) x = None for k,v in reversed(sorted(ctr.items())): if v >= 4: if x: print((x*k)) else: print((k**2)) exit() if v >= 2: if x: ...
p03627
from collections import Counter N = int(eval(input())) Ac = Counter(list(map(int, input().split()))) sticks = sorted({k:v for k, v in list(Ac.items()) if v >= 2}.items())[::-1] if len(sticks) == 0: print((0)) else: if sticks[0][1] >= 4: print((sticks[0][0]**2)) else: print((sticks[...
from collections import Counter N = int(eval(input())) Alist = list(map(int, input().split())) Ac = Counter(Alist) length_list = sorted(list(Ac.keys()), reverse=True) can_use = [] for l in length_list: if Ac[l] >= 4: if can_use: print((can_use[0]*l)) exit() else: ...
p03627
# -*- coding: utf-8 -*- from collections import Counter N = int(eval(input())) A = tuple(map(int, input().split())) c = Counter(A) pairs = [] for k, v in list(c.items()): if v >= 4: pairs.extend([k]*2) elif v >= 2: pairs.append(k) if len(pairs) >= 2: a, b = sorted(pairs, reve...
# -*- coding: utf-8 -*- from collections import Counter def inpl(): return list(map(int, input().split())) N = int(eval(input())) C= Counter(inpl()) F = sorted([k for k, v in list(C.items()) if v >= 4] + [0]) T = sorted([k for k, v in list(C.items()) if v >= 2] + [0, 0]) print((max(F[-1]*F[-1], T[-1]*T[-2]...
p03627
from sys import stdin, stdout def readLine_int_list():return list(map(int, stdin.readline().split())) def main(): n = int(eval(input())) a = readLine_int_list() set_a = sorted(list(set(a)), reverse=True) pair = [] ans = 0 if len(a) - len(set_a) == 1: ...
from sys import stdin, stdout def readLine_int_list():return list(map(int, stdin.readline().split())) def main(): n = int(eval(input())) a = sorted(readLine_int_list(),reverse=True) a.append(-1) pair = [] ans = 0 t = 1 for i in range(n): if a[i] == a[i+1...
p03627
n = int(eval(input())) a = list(map(int, input().split())) use_1 = 0 use_2 = 0 for i in set(a): can = a.count(i) // 2 if can == 1: if use_1 < i: use_2 = use_1 use_1 = i elif can > 1: use_1 = max(use_1, i) use_2 = max(use_2, i) print((use_1*u...
n = int(eval(input())) a = list(map(int, input().split())) a.sort() a = a[::-1] tobasu = 0 one = 0 two = 0 for i in range(len(a) - 1): if tobasu == 1: tobasu = 0 continue if a[i] == a[i + 1] and one == 0: tobasu = 1 one = a[i] elif a[i] == a[i + 1] and one != 0 ...
p03627
import collections N = int(eval(input())) A = list(map(int, input().split())) dic = collections.defaultdict(int) for x in A: dic[x] += 1 dic = list(dic.items()) dic = [x for x in dic if x[1] >= 2] dic = sorted(dic, reverse=True, key=lambda x: x[0]) if len(dic) >= 2: if dic[0][1] >= 4: ...
import heapq import collections N = int(eval(input())) A = list(map(int, input().split())) table = collections.defaultdict(int) hq = [0, 0] for x in A: table[x] += 1 if table[x] == 2: heapq.heappush(hq, -x) table[x] = 0 print((heapq.heappop(hq) * heapq.heappop(hq)))
p03627
N = int(eval(input())) A = [int(x) for x in input().split()] d = {} for i in range(N): if A[i] not in d: d[A[i]] = 0 d[A[i]] += 1 ans = 0 for k in d: if d[k] >= 4: ans = max(ans, k ** 2) if d[k] >= 2: for l in d: if k == l: continue ...
N = int(eval(input())) A = [int(x) for x in input().split()] d = {} for i in range(N): if A[i] not in d: d[A[i]] = 0 d[A[i]] += 1 ans = {0} s1 = [k for k, v in list(d.items()) if v >= 4] if len(s1) > 0: s1.sort() ans.add(s1[-1] ** 2) s2 = [k for k, v in list(d.items()) if v...
p03627
from collections import Counter N = int(eval(input())) c = Counter(list(map(int, input().split()))) usables = sorted([(k, v) for k, v in list(c.items()) if v >= 2]) if len(usables) <= 1: print((0)) else: if usables[-1][1] >= 4: print((usables[-1][0] ** 2)) else: print((usables[...
from collections import Counter def solve(): N = int(eval(input())) c = Counter(list(map(int, input().split()))) usables = sorted([k for k, v in list(c.items()) if v > 1]) if len(usables) == 0: return 0 else: ans = usables[-1] if c[ans] > 3: return...
p03627
#! /usr/bin/env python3 N = int(eval(input())) L = sorted(map(int, input().split()))[::-1] a = 0 b = 0 while L: t = L.pop(0) if a == t: break else: a = t while L: t = L.pop(0) if b == t: break else: b = t print((a*b))
#! /usr/bin/env python3 def main(): N = int(eval(input())) L = sorted(map(int, input().split()))[::-1] a = b = c = 0 while c < len(L): t = L[c] c += 1 if a == t: break else: a = t while c < len(L): t = L[c] c += ...
p03627
#! /usr/bin/env python3 def main(): N = int(eval(input())) L = sorted(map(int, input().split()))[::-1] a = b = c = 0 while c < len(L): t = L[c] c += 1 if a == t: break else: a = t while c < len(L): t = L[c] c += ...
#! /usr/bin/env python3 def main(): N = int(eval(input())) L = sorted(map(int, input().split())) a = b = 0 c = len(L) - 1 while c > -1: t = L[c] c -= 1 if a == t: break else: a = t while c > -1: t = L[c] c -...
p03627
from collections import Counter n=eval(input()) a=list(map(int,input().split())) a=Counter(a) f,t=[],[] for k in a: if a[k]>=4: f.append(k) if a[k]>=2: t.append(k) # print('f:',f) # print('t:',t) ans1=0 for ff in f: ans1=max(ans1,ff**2) ans2=0 t.sort(reverse=True) if len(t...
from collections import Counter n=int(eval(input())) a=list(map(int,input().split())) c=Counter(a) l4,l2=[],[] for k,v in list(c.items()): if v>=4:l4.append(k) if v>=2:l2.append(k) l4.sort(reverse=True) l2.sort(reverse=True) if len(l4)<=2:l4+=[0,0] if len(l2)<=2:l2+=[0,0] print((max(l4[0]*l4[1],l4[0...
p03627
import collections N = int(eval(input())) A = list(map(int,input().split())) c = collections.Counter(A) c_l = c.most_common() l = [] for e in c_l: if e[1] >= 4: l.append(e[0]) l.append(e[0]) elif e[1] >= 2: l.append(e[0]) l.sort() if len(l) >= 2: print((l[-1]*l[-2])) e...
from collections import Counter N = int(eval(input())) A = list(map(int,input().split())) c = Counter(A) op = [] for a, cnt in list(c.items()): for _ in range(cnt // 2): op.append(a) op.sort(reverse=True) if len(op) < 2: print((0)) else: print((op[0]*op[1]))
p03627
# import bisect from collections import Counter, deque # from copy import copy, deepcopy # from fractions import gcd # from functools import reduce # from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product # import math # import numpy as np # from operator i...
# import bisect from collections import Counter, deque # from copy import copy, deepcopy # from fractions import gcd # from functools import reduce # from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product # import math # import numpy as np # from operator i...
p03627
# import bisect from collections import Counter, deque # from copy import copy, deepcopy # from fractions import gcd # from functools import reduce # from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product # import math # import numpy as np # from operator i...
from collections import Counter, deque, OrderedDict # from copy import copy, deepcopy # from functools import reduce # from heapq import heapify, heappop, heappush # from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product # import math # import numpy as np # ...
p03627
N = int(eval(input())) A = list(map(int,input().split())) B = set(A) C = sorted([i for i in B if A.count(i) // 2 >= 1],reverse = True) ans = 0 m = 0 n = 0 if len(C) == 0: ans = 0 elif A.count(C[0]) >= 4: m = C[0] ans = m ** 2 elif len(C) > 1: m = C[0] n = C[1] ans = m * n print(ans...
N = int(eval(input())) A = sorted(list(map(int,input().split())),reverse = True) edge = [] for i in range(1,N): if A[i] == A[i - 1] and A[i] not in edge: edge.append(A[i]) elif A[i] == A[i - 3]: edge.append(A[i]) if len(edge) == 2: break if len(edge) <= 1: print((0)) else: ...
p03627
#!/usr/bin/env python3 n = int(eval(input())) a = list(map(int, input().split())) ans = 0 d = {} for i in a: if i not in d: d[i] = 1 else: d[i] += 1 d = sorted(list(d.items()), key=lambda x:x[0], reverse=True) area = 1 cnt = 0 allone = True for i in d: if 1 < i[1] < ...
#!/usr/bin/env python3 n = int(eval(input())) a = list(map(int, input().split())) ans = 0 d = {} for i in a: if i not in d: d[i] = 1 else: d[i] += 1 d = sorted(list(d.items()), key=lambda x:x[0], reverse=True) area = 1 cnt = 0 allone = True for i in d: if i[1] != 1: ...
p03627
d = {"A": 0, "AB": 0, "B": 0, "O": 0} flag = 1 while flag: try: _, blood_type = input().split(',') d[blood_type] += 1 except: for blood_type in ["A", "B", "AB", "O"]: print((d[blood_type])) flag = 0
d = [] flag = 1 while flag: try: _, blood_type = input().split(',') d.append(blood_type) except: for blood_type in ["A", "B", "AB", "O"]: print((d.count(blood_type))) flag = 0
p00049
( w, h, x, y, r ) = list(map ( int, input ( ).split ( ) )) if ( 0 <= x - r ) and ( x + r <= w ) and ( 0 <= y - r ) and ( y + r <= h ): print ( "Yes" ) else: print ( "No" )
c = input().split() W, H, x, y, r = int(c[0]), int(c[1]), int(c[2]), int(c[3]), int(c[4]) if r <= x <= W - r and r <= y <= H - r: print("Yes") else: print("No")
p02394
# coding: utf-8 # Here your code ! import math def func(): try: line=input().rstrip() numbers=line.split(" ") width=float(numbers[0]) height=float(numbers[1]) x=float(numbers[2]) y=float(numbers[3]) r=abs(float(numbers[4])) ...
# coding: utf-8 # Here your code ! import math def func(): try: line=input().rstrip() numbers=line.split(" ") width=float(numbers[0]) height=float(numbers[1]) x=float(numbers[2]) y=float(numbers[3]) r=abs(float(numbers[4])) ...
p02394
(W,H,x,y,r) = input().rstrip().split(' ') W = int(W) H = int(H) x = int(x) y = int(y) r = int(r) if x - r >= 0 and y - r >= 0 and x + r <= W and y + r<= H: print('Yes') else: print('No')
W, H, x, y, r = [int(i) for i in input().split()] if x + r <= W and y - r >= 0 and x - r >= 0 and y + r <= H: print("Yes") else: print("No")
p02394