problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03106
s887891857
Accepted
a, b, k = map(int, input().split()) ans = [] d = max(a, b) for i in range(1, d+1): if a % i == 0 and b % i == 0: ans.append(i) print(ans[-k])
p03327
s225363419
Accepted
N = int(input()) if N <= 999: print("ABC") else: print("ABD")
p03145
s330493177
Wrong Answer
k = input().split() a = k[0] b = k[1] c = k[2] Sum = 0 h = max(k) Buf = 1 del k[k.index(h)] for i in k: Buf = Buf * int(i) r = Buf/2 print(int(r))
p03699
s734133833
Accepted
N = int(input()) s = [int(input()) for _ in range(N)] res = 0 other = [] for num in s: if num % 10 == 0: res += num else: other.append(num) if other: other.sort() res += sum(other) if res % 10 == 0: res -= other[0] print(res) else: print(0)
p02663
s139027364
Accepted
import sys input = sys.stdin.readline import math a,b,c,d,e = map(int,input().split()) print(max((c-a)*60+(d-b)-e,0))
p02697
s887103948
Accepted
import math bl=input().split() n=int(bl[0]) s=int(bl[1]) for a in range(math.ceil(s/2)): print(str(a+1)+" "+str(s-a+1)) for b in range(math.floor(s/2)): print(str(s+b+2)+" "+str(2*s-b+1))
p03071
s210167939
Accepted
a,b=map(int,input().split()) total=0 for i in range(2): if a>=b: total+=a a-=1 else: total+=b b-=1 print(total)
p02897
s581424081
Wrong Answer
N = int(input()) count = 0 for i in range(N+1): if i % 2 == 1: count += 1 break else: pass ans = N / count print('{:.08f}'.format(ans))
p02796
s250168520
Accepted
n = int(input()) l = [[] for _ in range(n)] d = [[] for _ in range(n)] for i in range(n): l[i] = list(map(int,input().split())) d[i] = [l[i][0]-l[i][1],l[i][0]+l[i][1]] d.sort(key=lambda x:x[1]) ma = -9999999 c = 0 for i in range(n): if(d[i][0] >= ma): ma = d[i][1] c += 1 print(c)
p03457
s091335309
Accepted
import sys n = int(input()) txy = [] for i in range(n): txy.append(list(map(int, input().split()))) pt = 0 py = 0 px = 0 for t, x, y in txy: dt = t - pt dx = x - px dy = y - py ax = abs(dx) % 2 ay = abs(dy) % 2 a = (ax + ay) % 2 if abs(dx) + abs(dy) > dt or a != dt % 2: print("No") sys.exit() print("Yes")
p03817
s912060370
Accepted
def resolve(): x=int(input()) q,mod=divmod(x,11) if mod==0: print(q*2) elif 1<=mod<=6: print((q+1)*2-1) else: print((q+1)*2) resolve()
p03087
s019291472
Wrong Answer
N, Q = map(int, input().split()) S = input() t=[0]*(N+1) for i in range(N): t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0) for i in range(Q): l, r = map(int, input().split()) print(t[r-1] - t[l-1])
p02993
s290664615
Accepted
S = input() print('Bad' if S[0] == S[1] or S[1] == S[2] or S[2] == S[3] else 'Good')
p02726
s719621841
Accepted
N, X, Y = map(int, input().split()) ans = [0] * (N + 1) for i in range(1, N+1): for j in range(i+1, N+1): # print(i, j) tmp = abs(i-X) + abs(j - Y) + 1 minV = min( abs(i-j) ,tmp) ans[minV] += 1 for i in range(1, N): print(ans[i])
p03815
s409976112
Accepted
x = int(input()) print(((x-1)//11)*2 + ((x-1)%11)//6 + 1)
p03289
s879480300
Accepted
S=input() if S[0]=='A': if 'C' in S[2:-1]: S=S.lstrip('A') S=S.replace('C','',1) if str.islower(S): print('AC') exit() print('WA')
p02897
s141092794
Accepted
N = int(input()) if N % 2 == 0: print(0.5) else: print((N // 2 + 1) / N)
p03785
s172610057
Wrong Answer
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 += 1 print(ans)
p03145
s845135393
Accepted
a, b, c = map(int, input().split()) print(int(a*b/2))
p02630
s632022572
Wrong Answer
N = int(input()) numbers = list(map(int,input().split())) numOfOperation = int(input()) dic = {} for num in numbers: if num in dic : dic[num] += 1 else: dic[num] = 1 sums = sum(numbers) for i in range(numOfOperation): B,C = map(int,input().split()) dic[B] = 1 dic[C] = 0 sums += dic[B] * (C - B) print(sums)
p02813
s193629634
Wrong Answer
N = int(input()) P = tuple(map(int, input().split())) Q = tuple(map(int, input().split())) A = list(range(1,N+1)) Alist=[] import itertools for v in itertools.permutations(A): Alist.append(v) a_num = Alist.index(P)+1 b_num = Alist.index(Q)+1 print(b_num - a_num)
p03146
s093034957
Wrong Answer
s = int(input()) ans = 4 while ans != 4: ans += 1 if s % 2 == 0: s //= 2 else: s = s*3+1 print(ans)
p03262
s703542026
Accepted
n, x = map(int, input().split()) l = list(map(int, input().split())) sub = [] for i in range(n): sub.append(abs(x - l[i])) # a,bの最大公約数を求めます。(ユークリッドの互除法) def gcd(m, n): if n == 0: return m return gcd(n, m % n) #gcd_複数の値の最大公約数を求める def gcd_2(a): if len(a) == 1: return a[0] ans = a[0] for i in range(1, len(a)): ans = gcd(ans, a[i]) return ans print(gcd_2(sub))
p02683
s251947523
Wrong Answer
N, M, X = map(int, input().split()) C = [] A = [] for i in range(N): c = list(map(int, input().split())) C.append(c[0]) A.append(c[1:]) ans = sum(C) for n in range(1 << N): p = [0 for j in range(M)] q = 0 for i in range(N): t = (n >> i) & 1 q += t * C[i] for j in range(M): p[j] += t * A[i][j] f = 0 for j in range(M): if p[j] < X: f = 1 break if f == 0: ans = min(ans, q) if ans == sum(C): print(-1) else: print(ans)
p03821
s306070969
Accepted
def main(): import sys def input(): return sys.stdin.readline().rstrip() n = int(input()) A = [] B = [] for _ in range(n): a,b = map(int, input().split()) A.append(a) B.append(b) import numpy as np a = np.array(A[::-1], dtype=int) ans = 0 for i, b in enumerate(B[::-1]): tmp = (b-a[i]%b)%b a[i:] += tmp ans += tmp print(ans) if __name__ == '__main__': main()
p02642
s554913266
Wrong Answer
N = int(input()) a = list(map(int,input().split())) A = sorted(a, reverse=True) count = 0 for i in range(N-1): flag = False for j in range(i+1,N): if i != j: if A[i] % A[j] == 0: flag = True break if flag == False: count += 1 print(count)
p02729
s579168539
Accepted
n, m = map(int, input().split()) ans = 0 if n > 1: ans += n * (n - 1) // 2 if m > 1: ans += m * (m - 1) // 2 print(ans)
p02959
s747633752
Accepted
n=int(input()) aa=list(map(int,input().split())) bb=list(map(int,input().split())) bef=sum(aa) for i in range(n): aa[i] -= bb[i] if aa[i] >= 0: bb[i]=0 else: bb[i]=0-aa[i] aa[i]=0 aa[i+1] -= bb[i] if aa[i+1] >= 0: bb[i]=0 else: bb[i]=0-aa[i+1] aa[i+1]=0 print(bef-sum(aa))
p03665
s257027178
Accepted
n, m = map(int, input().split()) n -= 1 dat = list(map(int, input().split())) iseven = True for i in range(len(dat)): if dat[i] %2 == 1: iseven = False if iseven: if m == 0: print(2**(n+1)) else: print(0) else: if n == 0: print(0) else: print(pow(2, n))
p02813
s625833898
Accepted
from itertools import permutations N =[i+1 for i in range(int(input()))] p = tuple(map(int,input().split())) q = tuple(map(int,input().split())) index = 0 for n in permutations(N): if p==n: x = index if q ==n: y = index index += 1 print(abs(x-y))
p02859
s098919479
Wrong Answer
print(int(input()) * 2)
p03774
s133337713
Wrong Answer
N, M = map(int, input().split()) ab = [tuple(map(int, input().split())) for _ in range(N)] cd = [tuple(map(int, input().split())) for _ in range(M)] for a, b in ab: check_point_dist = 10 ** 8 * 2 check_point = 0 count = 0 for c, d in cd: count += 1 if check_point_dist > abs(a - c) + abs(b - d): check_point = count check_point_dist = abs(a - c) + abs(b - d) else: print(check_point)
p02910
s299316369
Accepted
s = list(input()) sum = 0 for i in range(len(s)): if i % 2 != 0: if "R" == s[i]: sum += 1 elif i % 2 == 0: if "L" == s[i]: sum += 1 if sum > 0: print("No") else: print("Yes")
p02595
s110472558
Wrong Answer
n,d=map(int,input().split()) x=[0 for i in range(n)] for i in range(n): x[i]=list(map(int,input().split())) print(x) a=0 for i in range(n): if x[i][0]**2+x[i][1]**2<=d**2: a+=1 print(a)
p03838
s701098406
Wrong Answer
x, y = map(int, input().split()) dif = abs(abs(x) - abs(y)) if x < 0 and y < 0: if x < y: print(dif) exit() else: print(dif+2) exit() if x >= 0 and y >= 0: if x > y: print(dif+2) exit() else: print(dif) exit() print(dif+1 if x >= 0 else dif)
p03557
s621162133
Accepted
import numpy as np n=int(input()) a=list(map(int,input().split())) b=list(map(int,input().split())) c=list(map(int,input().split())) a.sort() b.sort() c.sort() a=np.array(a) b=np.array(b) c=np.array(c) cnt_a=np.searchsorted(a,b) cnt_c=n-np.searchsorted(c,b,side='right') print(np.sum(cnt_a*cnt_c))
p03145
s649553403
Accepted
a, b, c = map(int, input().split()) print(a * b // 2)
p02983
s259217614
Accepted
L,R = map(int,input().split()) if(R-L >= 2019): print(0) else: mL = L%2019 mR = R%2019 modmin = 2019 for i in range(mL,mR): for j in range(i+1,mR+1): modmin = min(modmin,i*j%2019) print(modmin)
p03797
s101011522
Wrong Answer
N, M = map(int, input().split()) ans = max((N*2 + M) // 4, min(N, M // 2)) print(ans)
p02695
s835044829
Accepted
N,M,Q=list(map(int,input().split())) M=[i for i in range(1,M+1)] import itertools A=list(itertools.combinations_with_replacement(M, N)) a=[0]*Q b=[0]*Q c=[0]*Q d=[0]*Q for i in range(Q): a[i],b[i],c[i],d[i]=list(map(int,input().split())) s=[] ans=0 for j in range(len(A)): for k in range(Q): if A[j][b[k]-1]-A[j][a[k]-1]==c[k]: ans=ans+d[k] s.append(ans) ans=0 print(max(s))
p02847
s962983862
Accepted
s=input() l=['SUN','MON','TUE','WED','THU','FRI','SAT'] for i in range(7): if s==l[i]:print(7-i)
p03136
s705787993
Wrong Answer
n = int(input()) l = sorted(list(map(int, input().split()))) if l[-1] < sum(l[:-2]): print('Yes') else: print('No')
p03076
s758600393
Wrong Answer
import math list = [input() for i in range(5)] one_min = 9 for i in range(5): if one_min >= int(list[i][-1]) > 0: one_min = int(list[i][-1]) sum = 0 for i in range(5): sum += math.ceil(int(list[i])/10)*10 print(sum - 10 + one_min)
p02602
s684342568
Accepted
N,K = map(int,input().split()) A = list(map(int,input().split())) for i in range(N-K): if A[K+i] > A[i]: print("Yes") else: print("No")
p03821
s414536057
Accepted
# https://atcoder.jp/contests/agc009/tasks/agc009_a n = int(input()) A = [] B = [] for _ in range(n): a, b = map(int, input().split()) A.append(a) B.append(b) ans = 0 plus = 0 for i in range(n)[::-1]: a = A[i] + plus b = B[i] if a % b != 0: multi = a // b + 1 t = b * multi - a ans += t plus += t print(ans)
p02556
s620176831
Accepted
N = int(input()) z =[] w = [] for i in range(N): x,y = map(int, input().split()) z.append(x+y) w.append(x-y) print(max(max(z)-min(z),max(w)-min(w)))
p02813
s074364101
Accepted
import itertools as it import numpy as np import math N = int(input()) P = list(map(int, input().split())) Q = list(map(int, input().split())) rosen = list(it.permutations(range(1, N+1))) isP = 0 isQ = 0 for i in range (0, len(rosen)): if list(rosen[i]) == P: isP = i+1 if list(rosen[i]) == Q: isQ = i+1 print(abs(isP-isQ))
p02768
s987608112
Wrong Answer
nab = input().split() n = int(nab[0]) a = int(nab[1]) b = int(nab[2]) ans = 0 for i in range(1, n+1): if i == a or i == b: continue tp = 1 for j in range(n, 1, -1): if j > i: tp *= j else: tp /= j ans += tp ans = round(ans % (10**9 + 7)) print(ans)
p02778
s816536207
Wrong Answer
S=input() s=str(S) for i in range(len(s)): s.replace("x",s[i])
p03317
s424503246
Wrong Answer
import sys import itertools sys.setrecursionlimit(1000000000) from heapq import heapify,heappop,heappush,heappushpop import math import collections MOD = 10**9+7 MAX = 10**18 MIN = -10**18 n,k = map(int,input().split()) a = list(map(int,input().split())) for i in range(n): if a[i] == 1: start = i break start += 1 r = n - start + 1 l = start print(r//(k-1) + l//(k-1))
p03013
s999721888
Accepted
# input stairs, broken = map(int, input().split()) conditions = [1] * (stairs + 1) for i in range(broken): tmp = int(input()) conditions[tmp] = 0 # main for i in range(2, stairs+1): conditions[i] *= (conditions[i-1] + conditions[i-2]) % (10**9+7) print(conditions[stairs])
p02779
s008890931
Accepted
N=int(input()) a=list(map(int,input().split())) b=list(set(a)) if len(a)==len(b): print('YES') else: print('NO')
p02775
s160150826
Accepted
a = [int(x) for x in input()[::-1]] + [0] n = len(a) dp = [[0] * 2 for _ in range(n)] dp[0][0], dp[0][1] = a[0], 10-a[0] for i in range(n-1): dp[i+1][0] = min(a[i+1]+dp[i][0], a[i+1]+dp[i][1]+1) dp[i+1][1] = min(10-a[i+1]+dp[i][0], 10-(a[i+1]+1)+dp[i][1]) print(min(dp[n-1]))
p03997
s154415710
Accepted
a = int(input()) b = int(input()) h = int(input()) print((a+b)*h//2)
p03339
s732910510
Accepted
n = int(input()) s = input() w_c=0 e_c=0 ans=n for i in s: if i == 'E': e_c+=1 for i in s: if i == 'E': e_c-=1 k=w_c+e_c if ans > k: ans = k if i == 'W': w_c+=1 print(ans)
p03017
s434523946
Accepted
n , a , b , c , d = map(int,input().split()) s = input() if s[a:c+1].count("##") != 0 or s[b:d+1].count("##") != 0: print("No") exit() if c > d: if s[b-2:d+1].count("...") == 0: print("No") exit() print("Yes")
p02880
s857990384
Wrong Answer
import sys N = int(input()) array = [ I for I in range(1,10) ] if not ( 1 <= N <= 100 ): sys.exit() if N >= 82: print('No') else: for J in array: if N % J == 0: print('Yes'); sys.exit() print('No')
p02660
s841667903
Accepted
n = int(input()) ans = 0 i = 2 while n>1 and i*i<=n: if n % i == 0: c = 0 while n % i == 0: n = n / i c += 1 j = 1 while c>=j: ans=ans+1 c -= j j += 1 i = i + 1 if n > 1: ans = 1 + ans print(ans)
p02631
s193532287
Wrong Answer
n = int(input()) A = list(map(int, input().split())) def calc_total(A): total = [] for x, y in zip(A, A[1:]): total.append(x ^ y) return total total = A while len(total) != 1: total = calc_total(total) total = total[0] ans = [] for a in A: ans.append(total ^ a) print(*ans)
p02801
s637584954
Wrong Answer
alfa=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] c=input() print("'"+c+"'"+"の次は'"+alfa[alfa.index(c)+1]+"'です。")
p04031
s467787207
Wrong Answer
n=int(input()) a=list(map(int,input().split())) a=sorted(a) num=(a[0]+a[-1])//2 ans=0 for i in range(n): ans+=(num-a[i])**2 print(ans)
p03435
s996213680
Wrong Answer
c=[] for i in range(3): c.append(list(map(int,input().split()))) a=[0]*3 b=[0]*3 for i in range(3): a[i]=sum(c[i][0:3]) b[i]=sum(c[0:3][i]) if (a[0]-a[1])%3!=0 or (a[1]-a[2])%3!=0 or (a[2]-a[0])%3!=0: ans="No" elif (b[0]-b[1])%3!=0 or (b[1]-b[2])%3!=0 or (b[2]-b[0])%3!=0: ans="No" else: ans="Yes" print(ans)
p03150
s627594204
Accepted
S=input() s="keyence" l=len(S) for i in range(l): for j in range(i,l+1): if s==S[:i]+S[j:]: print("YES") break else: continue break else: print("NO")
p03779
s685618599
Accepted
x=int(input()) cnt,i=0,0 while i<x: cnt +=1 i +=cnt print(cnt)
p02831
s251896925
Wrong Answer
A,B=map(int,input().split()) if B > A: A,B = B,A for i in range(1, int(10**5 / A)): if (A * i) % B == 0: print(A * i) break
p02700
s579028571
Accepted
A,B,C,D=map(int,input().split()) flag=True while A >0 and C>0: C = C-B if C<=0: print('Yes') flag = False break A = A-D if flag: print('No')
p03095
s477777374
Accepted
from collections import Counter N = int(input()) S = list(str(input())) mod = 10**9+7 count = 1 cs = Counter(S) for key,value in cs.items(): count *= (value+1) print((count-1)%mod)
p03160
s057749728
Accepted
n = int(input()) lis = list(map(int, input().split())) dp = [] for k in range(n+1): dp.append(0) for i in range(2, n+1): if i == 2: dp[i] = abs(lis[i-1]-lis[i-2]) #print(i, dp[i]) else: #print(i) dp[i] = min(abs(lis[i-1]-lis[i-2])+dp[i-1], abs(lis[i-1]-lis[i-3])+dp[i-2]) #print(i, dp[i]) print(dp[n])
p02866
s715546770
Accepted
from collections import defaultdict N = int(input()) D = list(map(int, input().split())) MOD = 998244353 p = defaultdict(int) for d in D: p[d] += 1 if p[0] == 1 and D[0] == 0: ans = 1 for i in range(N + 1): ans *= p[i] ** p[i + 1] ans %= MOD print(ans % MOD) else: print(0)
p03632
s068139604
Wrong Answer
a, b, c, d = map(int, input().split()) if a < c and c < b and b < d: print(b-c) elif a < c and d < b: print(b-a) elif c < a and b < d: print(d-c) else: print(0)
p03474
s892962092
Accepted
A, B = map(int, input().split()) S = input() if S[:A].isdigit() and S[-B:].isdigit() and S[A] == '-': print('Yes') else: print('No')
p02607
s014798445
Accepted
N = int(input()) AA = list(map(int,input().split())) cnt = 0 for i in range(0,N,2): if AA[i]%2==1: cnt+=1 print(cnt)
p03284
s650256958
Accepted
N, K = list(map(int, input().split())) if N%K != 0: print("1") else: print("0")
p02548
s552378427
Accepted
N=int(input()) n=N-1 ans=1 for a in range(1,n): ans+=n//a print(ans)
p02755
s055997659
Accepted
a,b=map(int,input().split()) d=int(a/0.08) u=int(b/0.1) ans=-1 if min(d,u)>12: start=min(d,u)-12 else: start=0 for i in range(start,max(d,u)+13): if (int(i*0.08)==a)and(int(i*0.1)==b): ans=i break print(ans)
p03644
s907685463
Accepted
import math print 2 ** int(math.floor(math.log(int(raw_input()),2)))
p02629
s099755318
Wrong Answer
N = int(input()) def num10to26(num): if num<=26: return chr(64+num) elif num%26==0: return num10to26(num//26-1)+chr(90) else: return num10to26(num//26)+chr(64+num%26) print(num10to26(N))
p02725
s573888895
Wrong Answer
k,n = map(int,input().split()) a=list(map(int,input().split())) ans=0 for i in range(n): ans=max(ans,abs(a[i]-a[i-1])) print(ans)
p03637
s675829505
Accepted
n = int(input()) a = [int(x) for x in input().split()] a_div_2 = [1 if a[i] % 2 == 0 and a[i] % 4 != 0 else 0 for i in range(n)] a_div_4 = [1 if a[i] % 4 == 0 else 0 for i in range(n)] if a_div_2.count(1) // 2 + a_div_4.count(1) >= n // 2: print("Yes") else: print("No")
p02912
s719185634
Accepted
import heapq N,M=map(int,input().split()) A=list(map(int,input().split())) A=list(map(lambda x: x*(-1),A)) heapq.heapify(A) for i in range(M): temp=heapq.heappop(A) heapq.heappush(A,temp//2+temp%2) print(-sum(A))
p02608
s016606875
Wrong Answer
import math N = int(input()) enter = int(math.sqrt(N)) value_array = [] for x in range(7, enter): for y in range(7, enter): for z in range(7, enter): value_array.append(x**2 + y **2 + z ** 2 + x*y + y*z + z*x) for i in range(1, N+1): print(value_array.count(i))
p03107
s014507400
Accepted
s=input() print(len(s)-abs(s.count('0')-s.count('1')))
p03042
s651204427
Wrong Answer
S = list(input()) fo = int(''.join(S[:2])) la = int(''.join(S[2:])) if fo==0 or la==0: print("NA") elif fo <= 12 and la <= 12: print("AMBIGUOUS") elif fo <= 12 and la > 13: print("MMYY") elif fo > 13 and la <= 12: print("YYMM") else: print("NA")
p02677
s879798851
Accepted
import sys import numpy as np import math input=sys.stdin.readline a,b,h,m=map(int,input().split()) t=60*h+m hun=6*t%360 zi=0.5*t deg=min(360-abs(zi-hun),abs(zi-hun)) ans=a**2+b**2-2*a*b*math.cos(math.radians(deg)) print(pow(ans,0.5))
p03910
s608806274
Accepted
#!/usr/bin/env python3 #%% for atcoder uniittest use import sys input= lambda: sys.stdin.readline().rstrip() def pin(type=int):return map(type,input().split()) def tupin(t=int):return tuple(pin(t)) #%%code def resolve(): N,=pin() temp=0 ans=[] dame=0 end=0 for i in range(1,10**7): temp+=i if temp>=N: dame=temp-N end=i break for j in range(1,end+1): if j!=dame:print(j) #%%submit! resolve()
p03338
s205591389
Accepted
# coding:utf-8 n = int(input()) s = input() ans = 0 for i in range(n): right = s[:i] left = s[i:] tmp = len(set(right) & set(left)) ans = max(tmp, ans) print(ans)
p03524
s162315464
Accepted
s= input() a=s.count('a') b=s.count('b') c=s.count('c') if max(a,b,c) -min(a,b,c) <= 1: print('YES') else: print('NO')
p02639
s313943584
Accepted
l = list(map(int, input().split())) for i,j in enumerate(l): if j == 0: print(i+1) break
p02790
s413799073
Accepted
a,b = map(int,input().split()) if(a <= b): print(str(a) * b) else: print(str(b) * a)
p02935
s381324955
Wrong Answer
N = int(input()) V = sorted(list(map(int,input().split()))) ans = 0 ans += (V[0]+V[1])/2**(len(V)-1) print(ans) for i in range(2,N): ans += V[i]/2**(N-i) print(ans)
p03371
s844106304
Accepted
def main(): a,b,c,x,y = map(int, input().split()) ans = 10**10 for i in range(max(x, y)+1): total = i*2*c + max(0, x-i)*a + max(0, y-i)*b ans = min(ans, total) print(ans) if __name__ == '__main__': main()
p03281
s478183534
Accepted
def abc106b_105(): n = int(input()) cnt = 0 for i in range(1, n + 1): if i % 2 == 0: continue yaku_cnt = 0 for j in range(1, i + 1): if i % j == 0: yaku_cnt += 1 if yaku_cnt == 8: cnt += 1 print(cnt) abc106b_105()
p02785
s805864169
Wrong Answer
n,k = map(int,input().split()) h = list(map(int,input().split())) h = sorted(h,reverse=True) attack_n = 0 if k >= n: pass else: for i in h[n-k-1:]: attack_n += i print(attack_n)
p03150
s150541196
Accepted
S = input() def f(): for i in range(len(S)): for j in range(len(S)): if S[:i] + S[j:] == "keyence": print("YES") return else: print("NO") f()
p02598
s278272823
Wrong Answer
N, K = map(int, input().split()) X = list(map(int, input().split())) ub = 10 ** 9 + 7 lb = 0 while ub - lb > 1: mid = (ub + lb) // 2 res = 0 for v in X: res += v // mid if res <= K: ub = mid else: lb = mid if K == 0: print(max(X)) else: print(ub)
p03037
s798264799
Accepted
def main(): n, m = map(int,input().split()) startlis = [] endlis = [] for i in range(m): a, b = map(int, input().split()) startlis.append(a) endlis.append(b) start = max(startlis) end = min(endlis) print(max(0,end - start + 1)) if __name__ == "__main__": main()
p03219
s788146152
Accepted
a,b=map(int,input().split()) print(a+b//2)
p03069
s282414081
Accepted
N = int(input()) S = str(input()) w = S.count('.') b = S.count('#') cnt = N+1 tmp = w for i in range(N): if S[i] == '.': tmp -= 1 else: tmp += 1 cnt = min(cnt, tmp) ans = min(w, b, cnt) print(ans)
p02801
s914921040
Wrong Answer
a = input() next = (chr(ord(a)+1)) print("'"+a+"'"+"の次は"+"'"+next+"'"+"です")
p03073
s299125580
Wrong Answer
S = list(input()) a=0 b=0 if S[0]=="0": for i in S[::2]: print(i) if i=="1": a+=1 for k in S[1::2]: if k=="0": a+=1 if S[0]=="1": for i in S[::2]: if i=="0": b+=1 for k in S[1::2]: if k=="1": b+=1 print(max(a,b))