problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03103
s132224598
Accepted
n, m = map(int, input().split()) p = [list(map(int, input().split())) for _ in range(n)] p.sort(key=lambda x: x[0]) ans=0 for i in p: if i[1] >= m: ans += i[0] * m else: ans += i[0] * i[1] m -= i[1] if m <= 0: break print(ans)
p02717
s113075775
Accepted
X,Y,Z=map(int,input().split()) print(Z,X,Y)
p03665
s015507866
Wrong Answer
import sys input = sys.stdin.readline N, P = map(int, input().split()) a = list(map(int, input().split())) odd = 0 even = 0 for i in range(N): if a[i] % 2: odd += 1 else: even += 1 if P: print(int((pow(2, odd - 1) * pow(2, even) * (odd > 0)))) else: print(pow(2, odd - 1) * pow(2, even))
p03043
s399923514
Accepted
N, K = map(int, input().split()) ans = 0 for i in range(N): now = i + 1 loop = 0 while now < K: now *= 2 loop += 1 ans += (1/2)**loop print(ans/N)
p03261
s121943996
Wrong Answer
N = int(input()) W = [] flag = True for i in range(N): Wi = input() W.append(Wi) if 1<= i <=N-2: if W[i-1][-1] == Wi[0]: pass else: flag = False if len(set(W))==len(W): pass else: flag = False if flag: print('Yes') else: print('No')
p02664
s586113448
Accepted
S = str(input()) v_list = list() #print(S) SS = S.replace("?", "D") print(SS)
p03910
s753583289
Wrong Answer
N = int(input()) ans = [] for i in range(1, N): n = N - i if n > 0 and n <= i: continue N = n ans.append(i) if n == 0: break if N == 1: print(1) else: print(*ans, sep='\n')
p02972
s930301628
Accepted
n = int(input()) nums = list(map(int, input().split())) ans = [-1] * n for i in range(1, n + 1)[::-1]: C = i * 2 BALL = nums[i-1] while C <= n: BALL = BALL ^ ans[C-1] C += i ans[i-1] = BALL print(ans.count(1)) ball = [] for i in range(n): if ans[i] == 1: ball.append(i+1) print(*ball)
p03137
s776380076
Accepted
n,m = map(int, input().split(" ")) xList = [int(i) for i in input().split(" ")] xList = sorted(xList) dList = [0] for i in range(len(xList) -1) : dList.append(xList[i+1] - xList[i]) dList = sorted(dList, reverse=True) for i in range(n-1) : dList[i] = 0 if(i == len(dList) -1) : break print(sum(d...
p02791
s696850580
Wrong Answer
n = int(input()) pn = list(map(int, input().split())) ans = 1 if n > 1: count = 0 for i in range(1,n): count += 1 if pn[i-1] > pn[i] else 0 ans += count print(ans)
p02618
s534048638
Accepted
D=int(input()) c=list(map(int,input().split())) s=[] for _ in range(D): ss=list(map(int,input().split())) s.append(ss) for i in range(D): sss=s[i] a=sss.index(max(sss)) print(a+1) i+=1
p03338
s289708103
Wrong Answer
n = int(input()) s = input() ans = -1*float('inf') for i in range(1, n-1): ans = max(ans, len(set(s[:i])&set(s[i:]))) print(ans)
p03485
s177085935
Accepted
import math a,b=map(int,input().split()) print(math.ceil((a+b)/2))
p03286
s268261281
Wrong Answer
LOWER, UPPER = range(2) n = 0 bounds = [0] * 32 for digit in range(32): n = (n << 1) | (digit & 1) bounds[digit] = [-(n >> (digit & 1)), n >> (not (digit & 1))] N = int(input()) answer = 0 n = -(1 << digit) while digit: answer <<= 1 n = (-1) * n >> 1 if bounds[digit][LOWER] <= N < bounds[digit - ...
p02570
s075948179
Accepted
D, S, T = map(int, input().split()) if S*T >= D: print("Yes") else: print("No")
p02708
s339170833
Wrong Answer
N, K = map(int, input().split()) base = 10 ** 100 modu = (10 ** 9) + 7 nums = [(base + i) % modu for i in range(N+1)] saw = [] for i in range(2**(N+1)): _sum = 0 count = 0 for j in range(N+1): if (i >> j) & 1: count += 1 _sum += nums[j] if (_sum % modu not in saw) a...
p03162
s805495974
Wrong Answer
# EDPC C Vacation N = int(input()) act = [list(map(int,input().split())) for i in range(N)] DP = [[-float("inf"), 0] for i in range(N)] DP[0][0] = max(act[0]) DP[0][1] = act[0].index(max(act[0])) for i in range(1,N): for j in range(3): if DP[i-1][1] == j: pass else: DP[i][0...
p02787
s307484013
Wrong Answer
h,n=map(int,input().split()) L=[] for i in range(n): a,b=map(int,input().split()) L.append((b/a,a,b)) dp=[100000000 for i in range(h+1)] dp[0]=0 for i in range(h): for q in range(n): power=L[q][1] magic=L[q][2] if i+power>h: break nex=min(h,i+power) dp[nex]=...
p02618
s473218580
Accepted
import random for i in range(365): print(random.randint(1, 26))
p02973
s072591967
Wrong Answer
import bisect n = int(input()) seq = [] for i in range(n): seq.append(int(input())) seq.reverse() LIS = [seq[0]] for i in range(1,len(seq)): if seq[i] >= LIS[-1]: LIS.append(seq[i]) else: LIS[bisect.bisect_left(LIS, seq[i])] = seq[i] print(len(LIS))
p02786
s120602374
Wrong Answer
n=int(input()) for i in range(50): if n<2**i: break print(i) out=0 for k in range(i): out+=2**k print(out)
p04031
s663505909
Wrong Answer
N =int(input()) a = list(map(int,input().split())) ans = (10**9) for av in range(min(a),max(a)): Sum = 0 for i in range(N): Sum += (a[i]-av)**2 if Sum < ans: ans = Sum print(ans)
p02595
s988034177
Wrong Answer
import math n,d = map(int,input().split()) y = list() x = list() xy = list() for i in range(n): xy += map(int,input().split()) #xy_2 = int(len(xy) / 2) #for i in range(xy_2): # x.append(xy.pop(0)) # y.append(xy.pop(0)) for i in range(n): x.append(xy.pop(0)**2) y.append(xy.pop(0)**2) x.sort() y.so...
p02802
s933853228
Wrong Answer
n,m=map(int,input().split()) list=[] seikai=0 sum=0 for i in range(m): p,s=input().split() if p not in list: if s=='AC': list.append(p) seikai=seikai+1 elif s=='WA': sum=sum+1 print(seikai,sum)
p02862
s147388909
Accepted
x,y = map(int,input().split()) mod = 10**9+7 def comb(a,b): comb = 1 chld = 1 for i in range(b): comb = comb*(a-i)%mod chld = chld*(b-i)%mod return (comb*pow(chld,mod-2,mod))%mod if (x+y)%3!=0: print(0) else: nm = (x+y)//3 n = y-nm m = x-nm if n>=0 and m>=0: print(comb(n+m,m)) else: ...
p02766
s973661519
Accepted
def Base_10_to_n(X, n): if (int(X/n)): return Base_10_to_n(int(X/n), n)+str(X%n) return str(X%n) def main(): N,K = map(int,input().split()) print(len(str(Base_10_to_n(N,K)))) main()
p03625
s820247098
Wrong Answer
from collections import defaultdict N = int(input()) A = list(map(int, input().split())) D = defaultdict(int) A.sort(reverse=True) for i in A: D[i] += 1 cnt1 = 0 ans1 = 1 cnt2 = 0 ans2 = 1 for i, x in D.items(): if x >= 4: ans2 *= i**2 cnt2 += 2 if x >= 2: ans1 *= i cnt1 += 1 if cnt1 == 2: ...
p02706
s044203891
Wrong Answer
# -*- coding: utf-8 -*- import math # 整数の入力 n, m = map(int, input().split()) li = list(map(int, input().split())) # 計算 a = n-sum(li) if 0 <= n: print(a) else: print(-1)
p02765
s548051540
Accepted
N,R = map(int,input().split()) if N>=10: print(R) else: print(R+100*(10-N))
p02854
s590415239
Accepted
N = int(input()) A = list(map(int, input().split())) allL = sum(A) L, mL = 0, float('inf') for i in range(N): L += A[i] if abs(2*L-allL) < mL: mL = abs(2*L-allL) else: break print(mL)
p02909
s721319369
Wrong Answer
S = input( '今日の天気は?' ) if S == 'Sunny': answer = 'Cloudy' elif S == 'Cloudy': answer = 'Rainy' elif S == 'Rainy': answer = 'Sunny' else: answer = '入力間違い【Sunny】【Cloudy】【Rainy】を入力' print(answer)
p02694
s733121419
Accepted
k = int(input()) x = 100 cnt = 0 while(1): x *= 1.01 x = int(x) cnt += 1 if x >= k: break print(cnt)
p02773
s300045200
Accepted
from collections import Counter N = int(input()) S = [input() for i in range(N)] c = Counter(S) l = list(c.most_common()) A = [] for i,j in l: if j == l[0][1]: A.append(i) A.sort() for i in A: print(i)
p02772
s324346792
Accepted
# Papers, Please N = int(input()) A = list(map(int, input().split())) for Ai in A: if Ai % 2 == 1: continue else: if Ai % 3 != 0 and Ai % 5 != 0: print("DENIED") exit() print("APPROVED")
p03612
s430458029
Accepted
N=int(input()) p=list(map(int,input().split())) t=0 for i in range(N): if i!=N-1: if p[i]==i+1: s=p[i+1] p[i]=s p[i+1]=i+1 t+=1 else: if p[i]==i+1: u=p[i-1] p[i]=u p[i-1]=i+1 t+=1 print(t)
p02647
s281738864
Wrong Answer
n,k=map(int,input().split()) A=list(map(int,input().split())) def culc(L): subL=[0]*(n+1) for i in range(n): temp=L[i] bottom=max(i-temp,0) top=min(i+temp,n-1) subL[bottom]+=1 subL[top+1]-=1 resL=[0]*n resL[0]=subL[0] for i in range(1,n): resL[...
p02959
s989848293
Accepted
def solve(): N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) ans = 0 for i in reversed(range(N)): reduce2 = min(A[i+1],B[i]) reduce1 = min(A[i], B[i]-reduce2) A[i] -= reduce1 ans += reduce1 + reduce2 print(ans) if __name_...
p03817
s403529559
Wrong Answer
x=int(input()) d,m=divmod(x,11) ans=2*d if m<7: ans+=1 else: ans+=2 print(ans)
p02819
s180673519
Accepted
x = int(input()) def is_prime(n): if n <= 1: return False for i in range(2, int(n**0.5)+1): if n % i == 0: return False return True if not is_prime(x): while not is_prime(x): x += 1 print(x)
p03449
s790216740
Wrong Answer
n=int(input()) dp=[[0]*n for _ in range(2)] a=list(map(int,input().split())) b=list(map(int,input().split())) dp[0][0]=a[0] for i in range(n-1): dp[0][i+1]=dp[0][i]+a[i+1] for i in range(n-1): dp[1][i+1]=max(dp[0][i+1],dp[1][i])+b[i+1] print(dp[1][n-1])
p02755
s217297619
Wrong Answer
# coding: utf-8 # Your code here! x, y = list(map(int,(input().split()))) for a in range(1,101): if int(a * 0.1) == y: if int(a * 0.08) == x: print(a) exit() print(-1)
p02842
s080618697
Accepted
n=int(input()) ans=[] for i in range(55000): if int(i*1.08)==n: ans.append(i) if ans==[]: print(':(') else: print(ans[0])
p02916
s301862213
Wrong Answer
N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) C = list(map(int, input().split())) sum = 0 A.append(0) for i in range(N): sum += B[A[i]-1] if A[i+1] == A[i] + 1: sum += C[A[i]-1] print(sum) print(sum)
p02802
s799859640
Wrong Answer
n, m = map(int, input().split()) result = {} c_cnt = 0 w_cnt = 0 for i in range(m): p, s = input().split() if (p in result): continue if (s == 'AC'): result[p] = 1 c_cnt = c_cnt + 1 else: w_cnt = w_cnt + 1 print('{} {}'.format(c_cnt, w_cnt))
p03836
s485641020
Accepted
sx,sy,tx,ty = map(int, input().split()) x = tx-sx y = ty-sy ans = [] ans = ans + ['R']*x ans = ans + ['U']*y ans = ans + ['L']*x ans = ans + ['D']*y ans = ans + ['D'] ans = ans + ['R']*(x+1) ans = ans + ['U']*(y+1) ans = ans + ['L'] ans = ans + ['U'] ans = ans + ['L']*(x+1) ans = ans + ['D']*(y+1) ans = ans + ['R']...
p03773
s243697227
Accepted
#!/usr/bin/env python3 A, B = map(int, input().split()) ans = (A + B) % 24 print(ans)
p03030
s293262796
Wrong Answer
N = int(input()) rests = [] for i in range(1, N+1): S, P = input().split() rests.append((S, int(P), i)) rests.sort(key=lambda x: x[0]+str(100-x[1]) if x[1]!=0 else x[0]+"999") for rest in rests: print(rest[2])
p02727
s117189290
Accepted
e_r, e_g, n_r, n_g, n_n = map(int, input().split()) red = list(map(int, input().split())) green = list(map(int, input().split())) none = list(map(int, input().split())) red.sort(reverse=True) green.sort(reverse=True) none.sort(reverse=True) eat_r = red[0:e_r] eat_g = green[0:e_g] eat = eat_r + eat_g eat.sort() for...
p03071
s033253996
Wrong Answer
import sys import math import itertools import collections import heapq import re import numpy as np rr = lambda: sys.stdin.readline().rstrip() rs = lambda: sys.stdin.buffer.readline().split() ri = lambda: int(sys.stdin.readline()) rm = lambda: map(int, sys.stdin.buffer.readline().split()) rl = lambda: list(map(int, s...
p03427
s598686772
Wrong Answer
n=str(input()) m=len(n) if list(set(n))==['9']: print(9*m) else: print(9*(m-1)+int(n[0])-1)
p02546
s483555100
Wrong Answer
S = input() Ss = '{}s'.format(S) if not S.endswith('s') else '{}es'.format(S)
p03475
s441507381
Accepted
n = int(input()) T = [0]*n c,s,f = [0]*(n-1),[0]*(n-1),[0]*(n-1) for i in range(n-1): c[i],s[i],f[i] = map(int,input().split()) for i in range(n-1): T[i] = s[i] + c[i] for j in range(i+1,n-1): if T[i] > s[j]: T[i] += (-T[i])%f[j] + c[j] else: T[i] = s[j] + c[j] print(T[i]) print(0)
p03208
s855872109
Wrong Answer
N,K=map(int,input().split()) lst=[] for i in range (N): h=int(input()) lst.append(h) lst.sort() ans=100000000 for i in range (N-K+1): ans=min(ans,lst[i+K-1]-lst[i]) print(ans)
p02948
s100368383
Accepted
import heapq as hp n,m=map(int,input().split()) AB=[[] for i in range(m+1)] for i in range(n): a,b=map(int,input().split()) if a<=m: AB[a].append(-b) ans=0 l=[] hp.heapify(l) for ab in AB: for t in ab: hp.heappush(l,t) if len(l)>0: ans-=hp.heappop(l) print(ans)
p02912
s949306508
Accepted
import heapq N,M=map(int,input().split()) a=list(map(int,input().split())) a = list(map(lambda x: x * (-1), a)) # 各要素を-1倍 heapq.heapify(a) # リストを優先度付きキューへ for _ in range(M): number=heapq.heappop(a) # 最大値の取り出し if number%2==0: number=number//2 else: number=number//2+1 heapq.heappush(a, ...
p02627
s140009352
Wrong Answer
data = input() if data >= "a" and data <= "z": print("a") elif data >= "A" and data <= "Z": print("a")
p02899
s800578512
Accepted
n = int(input()) m = [(x, 0) for x in range(1, n+1)] for i, x in enumerate(map(int, input().split())): m[i] = (m[i][0], x) m.sort(key=lambda x : x[1]) print(' '.join([str(x[0]) for x in m]))
p03107
s651753856
Accepted
s = input() zero = s.count('0') one = s.count('1') if zero <= one: print(2 * zero) else: print(2 * one)
p03284
s711651155
Wrong Answer
a, b = map(int, input().split()) if a % b == 0: print(0) else: print((a // b) - (a % b))
p03711
s903197121
Accepted
g=[0,1,3,1,2,1,2,1,1,2,1,2,1] x,y=map(int,input().split()) if g[x]==g[y]: print("Yes") else: print("No")
p03723
s234538318
Accepted
A,B,C = map(int, input().split()) ctr = 0 if A == B == C and A%2 == 0 and B%2 == 0 and C%2 == 0: print(-1) else: while A%2 == 0 and B%2 == 0 and C%2 == 0: A,B,C = int((B+C)/2), int((A+C)/2), int((A+B)/2) ctr += 1 print(ctr)
p02547
s152866798
Accepted
n = int(input()) cnt = 0 ans = "No" for i in range(n): d1, d2 = map(int,input().split()) if d1 == d2: cnt += 1 else: cnt = 0 if cnt == 3: ans = "Yes" print(ans)
p03475
s073172245
Accepted
import math from collections import namedtuple Station = namedtuple('Station', 'c s f') N = int(input()) stations = [] for _ in range(N - 1): c, s, f = map(int, input().split()) stations.append(Station(c, s, f)) def measure(start): if start > len(stations) - 1: return 0 time = 0 for station in st...
p02663
s349717783
Accepted
h1, m1, h2, m2, k = map(int, input().split()) s = (h2 * 60 + m2) - (h1 * 60 + m1) if s > k: print(s - k) else: print(0)
p03329
s895288229
Accepted
import sys def count(n, b): res = 0 while n: n, r = divmod(n, b) res += r return res n = int(sys.stdin.readline().rstrip()) def main(): res = float('inf') for i in range(n + 1): res = min(res, count(i, 6) + count(n - i, 9)) print(res) if __name__ == '__main__': m...
p02760
s802416700
Accepted
import numpy as np a = [list(map(int,input().split())) for _ in range(3)] n = int(input()) b = list([int(input()) for _ in range(n)]) c = np.zeros(9).reshape(3,3) for k in b: for i in range(3): for j in range(3): if k == a[i][j]: c[i,j]=1 if (max(c.sum(axis=0))==3) or (max(...
p03059
s129377117
Accepted
A, B, T = map(int, input().split()) print((T//A) * B)
p02819
s492166410
Accepted
a = int(input()) for i in range(a,10**7): result=[x for x in range(1,i+1) if i%x==0] if len(result)==2: print(i) break
p02909
s014945589
Accepted
s=input() if s=='Sunny':print('Cloudy') elif s=='Cloudy':print('Rainy') else:print('Sunny')
p03479
s632157981
Accepted
x,y = map(int, input().split()) cnt=0 while True: if x>y: break else: x = x*2 cnt+=1 print(cnt)
p02899
s310670100
Accepted
n = int(input()) A = list(map(int, input().split(' '))) B = [] i = 0 while i < n: B.append((A[i],i+1)) i += 1 B.sort() ans = '' for b in B: ans += str(b[1]) + ' ' print(ans)
p03408
s478403209
Wrong Answer
from collections import defaultdict d = defaultdict(int) d["DEFAULT"]=0 n=int(input()) for _ in range(n): d[input()]+=1 n=int(input()) for _ in range(n): d[input()]-=1 print(d[max(d)])
p02994
s797756961
Accepted
import sys n,l=input().split() n=int(n) l=int(l) v=[] vv=[] for i in range(1,n+1): v.append(abs(l+i-1)) vv.append(l+i-1) v.sort() #print(v) #print(vv) ss=sum(vv) for i in range(1,n+1): if abs(l+i-1)==v[0]: print(ss-(l+i-1)) sys.exit() #print(ss-v[0])
p02820
s717722311
Accepted
N, K = map(int, input().split()) R, S, P = map(int, input().split()) T = input() ok = [True] * N d = {"r": P, "s": R, "p": S} ans = 0 for i in range(N): if i >= K and T[i - K] == T[i] and ok[i - K]: ok[i] = False if ok[i]: ans += d[T[i]] print(ans)
p02640
s316103161
Accepted
x, y = [int(i) for i in input().split()] if y % 2 != 0: print("No") exit() if 2*x - y/2 >= 0 and y/2 - x >= 0: print("Yes") else: print("No")
p02717
s572181226
Accepted
a, b, c = map(int, input().rstrip().split()) print(c,a,b)
p03627
s597392004
Wrong Answer
import collections N = int(input()) A = sorted(list(map(int, input().split()))) a = collections.Counter(A) ans = [0, 0] for i in a.keys(): if a[i] >= 2: ans.append(i) if a[i] >= 4: ans.append(i) print(ans[-1]*ans[-2])
p03285
s717833288
Wrong Answer
import sys N = int(input()) for i in range(N//4): if (N-4*i)%7 == 0: print("Yes") sys.exit() print("No")
p03605
s660073827
Accepted
N = int(input()) if N // 10 == 9 or N % 10 == 9: print("Yes") else: print("No")
p02717
s272206275
Wrong Answer
box = list(map(int,input().split())) box.reverse() print("%d %d %d"%(box[0],box[1],box[2]))
p03556
s072661362
Wrong Answer
n = int(input()) print((n**0.5//1)**2)
p02832
s982918816
Accepted
A = int(input()) B = list(map(int,input().split(" "))) memory = 1 for i in range(A): if B[i] == memory: memory += 1 else: continue if A-(memory-1) == A: print("-1") else: print(A-(memory-1))
p03061
s445996291
Accepted
from math import gcd n = int(input()) a = list(map(int, input().split())) pref = [0]; suff = [0] for i in range(n): pref.append(gcd(pref[-1], a[i])) for i in range(n-1, -1, -1): suff.append(gcd(suff[-1], a[i])) suff.reverse() ans = pref[-1] for i in range(len(pref)-1): ans = max(ans, gcd(pref[i], suff...
p03681
s268726121
Wrong Answer
import sys import math N, M = map(int, input().split()) ans = 0 if (N + M) % 2 == 0: if N != M: print(0) sys.exit() ans = (math.factorial(N) * 2 * 2) % (10**9 + 7) else: if not N == M - 1 and not N - 1 == M: print(0) sys.exit() ans = (math.factorial(N) * math.factorial(M)) % (10**9 + 7) p...
p03698
s475174323
Wrong Answer
print('yes' if len(set(input())) == 26 else 'no')
p02729
s061979279
Accepted
N, M = map(int, input().split()) print(N * (N - 1) // 2 + M * (M - 1) // 2)
p02767
s398177699
Wrong Answer
n=int(input()) x=list(map(int,input().split())) p=sum(x)//n+1 answer=0 for i in range(n): answer+=(x[i]-p)**2 print(answer)
p02700
s512583691
Wrong Answer
a, b, c, d = map(int, input().split()) if (a-1)//d >= (b-1)//c: print('Yes') else: print('No')
p02748
s286353831
Accepted
A, B, M = [int(i) for i in input().split()] al = [int(i) for i in input().split()] bl = [int(i) for i in input().split()] xyc = [[int(i) for i in input().split()] for _ in range(M)] print(min(min(al)+min(bl), min([al[m[0]-1] + bl[m[1]-1] - m[2] for m in xyc])))
p03437
s678215846
Wrong Answer
x, y = map(int,input().split()) if x*(y-1)//y != 0: print(x*(y-1)) else: print(-1)
p02888
s643893985
Wrong Answer
N = int(input()) L = [i for i in map(int,input().split())] L.sort() import bisect ans = 0 for i in range(1,N): for j in range(i): index = bisect.bisect(L,L[i]+L[j]) if index <= i+1: continue ans += len(L[i+1:index]) print(ans)
p03761
s115260663
Accepted
import math from collections import Counter n = int(input()) s = [Counter(list(input())) for _ in range(n)] a = [math.inf] * 26 flag = [0] * 26 ans = "" for i in s: ke = list(i.keys()) val = list(i.values()) for j, k in enumerate(ke): a[ord(k) - 97] = min(a[ord(k) - 97], val[j]) flag[ord(k)...
p03161
s599827158
Accepted
N,K = map(int,input().split()) h = [0] + list(map(int,input().split())) dp = [0] * (N+1) for i in range(2,N+1): scope = min(i-1,K) jump = [dp[i-j]+abs(h[i]-h[i-j]) for j in range(1,scope+1)] dp[i] = min(jump) print(dp[N])
p02583
s766984726
Accepted
N = int(input()) L = list(map(int,input().split())) import itertools ans = 0 for tmpr in itertools.combinations(list(range(len(L))),3): a,b,c = L[tmpr[0]],L[tmpr[1]],L[tmpr[2]] if a!=b and b!=c and a!=c: if a+b>c and a+c>b and b+c > a: ans+=1 print(ans)
p03163
s112552925
Accepted
import numpy as np n, targw = map(int,input().split()) w = [0 for _ in range(n)] v = [0 for _ in range(n)] for i in range(n): w[i], v[i] = map(int,input().split()) dp = np.zeros(targw+1, dtype=np.int64) for i in range(n): dp[w[i]:] = np.maximum(dp[:-w[i]] + v[i], dp[w[i]:]) print(dp[targw])
p03803
s846193650
Accepted
A, B = map(int, input().split()) if (A == 1) and (B != 1): print("Alice") elif (A != 1) and (B != 1) and (A > B): print("Alice") elif (B == 1) and (A != 1): print("Bob") elif (B != 1) and (A != 1) and (A < B): print("Bob") elif (A == B): print("Draw")
p02791
s985440533
Wrong Answer
N = int(input()) P = list(map(int, input().split())) count = 1 minP = P[0] for i in range(1, N): if P[i] < minP: count = count + 1 minP = P[i] print(count)
p02953
s957716950
Accepted
def main(): N = int(input()) H = [int(h) for h in input().split()] increase = True for i in reversed(range(1, N)): if H[i] >= H[i-1]: pass elif H[i-1] - H[i] == 1: H[i-1] -= 1 else: increase = False break if increase: ...
p02771
s949903019
Accepted
def main(): a = [int(i) for i in input().split()] print("Yes" if len(set(a)) == 2 else "No") if __name__ == "__main__": main()
p03264
s723001205
Accepted
x = int(input()) if x % 2 == 0: print(int(x/2)**2) else: print(int((x+1)/2*(x-1)/2))