Datasets:

problem_id
stringlengths
6
6
buggy_code
stringlengths
8
526k
fixed_code
stringlengths
12
526k
labels
listlengths
0
15
buggy_submission_id
int64
1
1.54M
fixed_submission_id
int64
2
1.54M
user_id
stringlengths
10
10
language
stringclasses
8 values
p02785
HK = list(map(int,input().split(" "))) HP = list(map(int,input().split(" "))) H = HK[0] K = HK[1] HP.reverse() sum_a = sum(HP[K:N]) print(sum_a)
HK = list(map(int,input().split(" "))) HP = list(map(int,input().split(" "))) H = HK[0] K = HK[1] HP.sort(reverse=True) sum_a = sum(HP[K:]) print(sum_a)
[ "identifier.change", "call.arguments.change" ]
588,958
588,956
u796708718
python
p02785
N, K=map(int, input().split()) H=list(map(int, input().split())) if K>=N: print(0) exit() if K==0: print(sum(H)) exit() print(sum(H[:-K]))
N, K=map(int, input().split()) H=list(map(int, input().split())) if K>=N: print(0) exit() if K==0: print(sum(H)) exit() H.sort() print(sum(H[:-K]))
[ "call.add" ]
588,998
588,999
u095021077
python
p02785
a,b = map(int, input().split()) box = list(map(int, input().split())) box.sort() ans = sum(box[b:]) print(ans)
a,b = map(int, input().split()) box = list(map(int, input().split())) box.sort(reverse=True) ans = sum(box[b:]) print(ans)
[ "call.arguments.keyword_argument.add" ]
589,000
589,001
u527616458
python
p02785
from sys import stdin H,K = [int(x) for x in stdin.readline().rstrip().split()] H = [int(x) for x in stdin.readline().rstrip().split()] sum(sorted(H)[::-1][K:])
from sys import stdin H,K = [int(x) for x in stdin.readline().rstrip().split()] H = [int(x) for x in stdin.readline().rstrip().split()] print(sum(sorted(H)[::-1][K:]))
[ "call.add", "call.arguments.change" ]
589,006
589,007
u405256066
python
p02785
n, k = map(int, input().split()) arr = [int(j) for j in input().split()] if k>= n: print(0) else: arr.sort() print(sum(arr[k:]))
n, k = map(int, input().split()) arr = [int(j) for j in input().split()] if k>= n: print(0) else: arr.sort(reverse=True) print(sum(arr[k:]))
[ "call.arguments.keyword_argument.add" ]
589,010
589,011
u116763463
python
p02785
n,k=map(int,input().split()) hps=list(map(int,input().split())) hps.sort() if k>n: print(n) elif k==n: print(k) else: ans=0 for i in range(k): hps.pop() ans+=sum(hps) print(ans)
n,k=map(int,input().split()) hps=list(map(int,input().split())) hps.sort() if k>n: print(0) elif k==n: print(0) else: ans=0 for i in range(k): hps.pop() ans+=sum(hps) print(ans)
[ "identifier.replace.remove", "literal.replace.add", "call.arguments.change", "io.output.change" ]
589,023
589,024
u763380276
python
p02785
N,K=map(int,input().split()) a=list(map(int,input().split())) if K>=N: print(0) b=sorted(a) c=0 for i in range(N-K): c+=b[i] print(c)
N,K=map(int,input().split()) a=list(map(int,input().split())) if K>=N: print(0) else: b=sorted(a) c=0 for i in range(N-K): c+=b[i] print(c)
[]
589,032
589,033
u051928503
python
p02785
n,k=map(int,input().split()) hi=[] for i in map(int,input().split()): hi.append(i) if n<=k: print(0) else: hi.sort hsum=0 for i in range(n-k): hsum=hsum+hi[i] print(hsum)
n,k=map(int,input().split()) hi=[] for i in map(int,input().split()): hi.append(i) if n<=k: print(0) else: hi.sort() hsum=0 for i in range(n-k): hsum=hsum+hi[i] print(hsum)
[ "call.add" ]
589,041
589,042
u576432509
python
p02785
K, N = list(map(int, input().split())) h = list(map(int, input().split())) #倒す数 a = K-N if 0>=a: print(0) else: print(sum(sorted(h[:a])))
K, N = list(map(int, input().split())) h = list(map(int, input().split())) #倒す数 a = K-N if 0>=a: print(0) else: print(sum(sorted(h)[:a]))
[ "call.arguments.change" ]
589,066
589,067
u488884575
python
p02785
from sys import stdin def main(inp1, inp2): n, k = [int(i) for i in inp1.split(sep=' ')] h_list = sorted([int(i) for i in inp2.split(sep=' ')]) print(h_list) num_enemy = n enable_special = k if enable_special >= num_enemy: return 0 elif enable_special == 0: return sum(h_list) else: return sum(h_list[:-enable_special]) if __name__ == '__main__': input1 = stdin.readline().rstrip() input2 = stdin.readline().rstrip() ret = main(input1, input2) print(ret)
from sys import stdin def main(inp1, inp2): n, k = [int(i) for i in inp1.split(sep=' ')] h_list = sorted([int(i) for i in inp2.split(sep=' ')]) num_enemy = n enable_special = k if enable_special >= num_enemy: return 0 elif enable_special == 0: return sum(h_list) else: return sum(h_list[:-enable_special]) if __name__ == '__main__': input1 = stdin.readline().rstrip() input2 = stdin.readline().rstrip() ret = main(input1, input2) print(ret)
[ "call.remove" ]
589,068
589,069
u971654915
python
p02785
N, K = map(int, input().lower().split()) H = [] total = 0 input_string = input() H = input_string.split() H = list(map(int, H)) H.reverse() del H[0:K] print(sum(H))
N, K = map(int, input().lower().split()) H = [] total = 0 input_string = input() H = input_string.split() H = list(map(int, H)) H.sort(reverse = True) del H[0:K] print(sum(H))
[ "identifier.change" ]
589,070
589,071
u994527877
python
p02785
monster, skill = map(int,input().split()) monster_hp = list(map(int,input().split())) monster_hp.sort() attack_count = 0 while(skill>0): skill -= 1 if len(monster_hp) > 0: monster_hp.pop(-1) print(monster_hp) for hp in monster_hp: attack_count += hp print(attack_count)
monster, skill = map(int,input().split()) monster_hp = list(map(int,input().split())) monster_hp.sort() attack_count = 0 while(skill>0): skill -= 1 if len(monster_hp) > 0: monster_hp.pop(-1) for hp in monster_hp: attack_count += hp print(attack_count)
[ "call.remove" ]
589,072
589,073
u127228093
python
p02785
n, k = map(int, input().split()) h = list(map(int, input().split())) for i in range(k): h.pop() if len(h) == 0: break print(0 if len(h) == 0 else sum(h))
n, k = map(int, input().split()) h = list(map(int, input().split())) h.sort() # 必殺技の回数だけ体力の高い敵から倒す # 最後に残ったやつが0になる攻撃回数を出力する for i in range(k): h.pop() if len(h) == 0: break print(0 if len(h) == 0 else sum(h))
[ "call.add" ]
589,082
589,083
u742036388
python
p02785
n,k=map(int,input().split()) a=list(int(x) for x in input().split()) a.sort() s=0 if k <= n: print(0) else: s = sum(a[:n-k]) print(s)
n,k=map(int,input().split()) a=list(int(x) for x in input().split()) a.sort() s=0 if n <= k: print(0) else: s = sum(a[:n-k]) print(s)
[ "control_flow.branch.if.condition.change" ]
589,102
589,103
u857070771
python
p02785
n,k = map(int,input().split()) h = list(map(int,input().split())) if n < k: print('0') h.sort() l = h[0:(n-k)] print(sum(l))
n,k = map(int,input().split()) h = list(map(int,input().split())) if n < k: print('0') else: h.sort() l = h[0:(n-k)] print(sum(l))
[]
589,110
589,111
u756693875
python
p02785
N, K = map(int, input().split()) A = map(int, input().split()) A_list = list(A) counter = 0 A_list.sort() A_list.reverse() if K >= N: print(N) else: for val in range(N - K): counter += int(A_list[val+K]) print(counter)
N, K = map(int, input().split()) A = map(int, input().split()) A_list = list(A) counter = 0 A_list.sort() A_list.reverse() if K >= N: print(0) else: for val in range(N - K): counter += int(A_list[val+K]) print(counter)
[ "identifier.replace.remove", "literal.replace.add", "call.arguments.change", "io.output.change" ]
589,112
589,113
u630027862
python
p02785
N, K = map(int, input().split()) a = list(map(int, input().split())) a.sort() counter = 0 if K > len(a): counter = 0 else: print(a) for _ in range(K): a.pop(-1) counter = sum(a) print(counter)
N, K = map(int, input().split()) a = list(map(int, input().split())) a.sort() counter = 0 if K >= len(a): counter = 0 else: for _ in range(K): a.pop(-1) counter = sum(a) print(counter)
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change", "call.remove" ]
589,114
589,115
u084327817
python
p02785
a,b = map(int,input().split()) N = list(map(int,input().split())) N.sort() for i in range(b): N.pop() print(sum(N))
a,b = map(int,input().split()) N = list(map(int,input().split())) N.sort() for i in range(b): if N: N.pop() print(sum(N))
[ "control_flow.branch.if.add" ]
589,152
589,153
u853547292
python
p02785
#!/usr/bin/env python3 import numpy as np DEBUG = True dprint = print if DEBUG else lambda *x : x N, K = [int(str) for str in input().strip().split()] H = [int(str) for str in input().strip().split()] if K == 0: print(sum(H)) elif K >= len(H): print(0) else: H.sort(reverse=True) print(sum(H[:K]))
#!/usr/bin/env python3 import numpy as np DEBUG = True dprint = print if DEBUG else lambda *x : x N, K = [int(str) for str in input().strip().split()] H = [int(str) for str in input().strip().split()] if K == 0: print(sum(H)) elif K >= len(H): print(0) else: H.sort(reverse=True) print(sum(H[K:]))
[ "call.arguments.change" ]
589,169
589,170
u470936782
python
p02785
n, k = tuple(map(int, input().split(' '))) hs = list(map(int, input().split(' '))) if k>=n: print(0) return hs = sorted(hs) print(sum(hs[:n-k]))
n, k = tuple(map(int, input().split(' '))) hs = list(map(int, input().split(' '))) if k>=n: print(0) exit() hs = sorted(hs) print(sum(hs[:n-k]))
[ "control_flow.return.remove", "control_flow.exit.add", "call.add" ]
589,171
589,172
u424240341
python
p02785
n,k=map(int,input().split()) lists=list(map(int,input().split())) if len(lists)<=k: print(0) elif len(lists)>k: sub=lists[:len(lists)-k] print(sum(sub))
n,k=map(int,input().split()) lists=list(map(int,input().split())) lists=sorted(lists) if len(lists)<=k: print(0) elif len(lists)>k: sub=lists[:len(lists)-k] print(sum(sub))
[ "assignment.add" ]
589,175
589,176
u780962115
python
p02785
N,K=map(int,input().split()) H=list(map(int,input().split())) sorted(H) for i in range(N-1,-1,-1): if K>0: H[i]=0 K-=1 else: break print(sum(H))
N,K=map(int,input().split()) H=list(map(int,input().split())) H=sorted(H) for i in range(N-1,-1,-1): if K>0: H[i]=0 K-=1 else: break print(sum(H))
[ "assignment.add" ]
589,195
589,196
u204616996
python
p02785
import math N, K = map(int,input().split()) H = list(map(int,input().split())) if N <= K: print(0) elif K == 0: print(sum(H)) else: H.sort() h = H[:-K] print(h) print(sum(h))
import math N, K = map(int,input().split()) H = list(map(int,input().split())) if N <= K: print(0) elif K == 0: print(sum(H)) else: H.sort() h = H[:-K] print(sum(h))
[ "call.remove" ]
589,197
589,198
u100277898
python
p02785
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify from bisect import bisect_right, bisect_left import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from copy import deepcopy from math import factorial, ceil, floor, gamma, log from operator import mul from functools import reduce sys.setrecursionlimit(2147483647) INF = float('INF') def LI(): return list(map(int, sys.stdin.buffer.readline().split())) def I(): return int(sys.stdin.buffer.readline()) def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split() def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8') def IR(n): return [I() for i in range(n)] def LIR(n): return [LI() for i in range(n)] def SR(n): return [S() for i in range(n)] def LSR(n): return [LS() for i in range(n)] def SRL(n): return [list(S()) for i in range(n)] def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)] mod = 10 ** 9 + 7 n, k = LI() H = sorted(LI()) if k >= n: print(0) else: print(sum(H[-k:]))
from collections import defaultdict, deque, Counter from heapq import heappush, heappop, heapify from bisect import bisect_right, bisect_left import random from itertools import permutations, accumulate, combinations, product import sys import string from bisect import bisect_left, bisect_right from copy import deepcopy from math import factorial, ceil, floor, gamma, log from operator import mul from functools import reduce sys.setrecursionlimit(2147483647) INF = float('INF') def LI(): return list(map(int, sys.stdin.buffer.readline().split())) def I(): return int(sys.stdin.buffer.readline()) def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split() def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8') def IR(n): return [I() for i in range(n)] def LIR(n): return [LI() for i in range(n)] def SR(n): return [S() for i in range(n)] def LSR(n): return [LS() for i in range(n)] def SRL(n): return [list(S()) for i in range(n)] def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)] mod = 10 ** 9 + 7 n, k = LI() H = sorted(LI()) if k >= n: print(0) else: print(sum(H[:n - k]))
[ "call.arguments.change" ]
589,213
589,214
u499381410
python
p02785
N, K = map(int, input().split()) H = list(map(int, input().split())) H.sort(reverse=True) if N < K: K = N for i in range(K): H[i] = 0 print(H) ans = sum(H) print(ans)
N, K = map(int, input().split()) H = list(map(int, input().split())) H.sort(reverse=True) if N < K: K = N for i in range(K): H[i] = 0 #print(H) ans = sum(H) print(ans)
[ "call.remove" ]
589,242
589,243
u298945776
python
p02785
A,B=map(int,input().split()) C=list(map(int,input().split())) C.sort(reverse=True) sum(C[B:])
A,B=map(int,input().split()) C=list(map(int,input().split())) C.sort(reverse=True) print(sum(C[B:]))
[ "call.add", "call.arguments.change" ]
589,252
589,253
u054274920
python
p02785
n,k = map(int,input().split()) hl = list(map(int,input().split())) hl = sorted(hl) if n <= k: print(0) elif k == 0: print(sum(hl)) else: print(sum(hl[n-k:]))
n,k = map(int,input().split()) hl = list(map(int,input().split())) hl = sorted(hl) if n <= k: print(0) elif k== 0: print(sum(hl)) else: print(sum(hl[:-k]))
[ "variable_access.subscript.index.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
589,262
589,263
u683134447
python
p02785
#!usr/bin/env python3 from collections import defaultdict,deque from heapq import heappush, heappop from itertools import permutations import sys import math import bisect def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def LS():return [list(x) for x in sys.stdin.readline().split()] def S(): res = list(sys.stdin.readline()) if res[-1] == "\n": return res[:-1] return res def IR(n): return [I() for i in range(n)] def LIR(n): return [LI() for i in range(n)] def SR(n): return [S() for i in range(n)] def LSR(n): return [LS() for i in range(n)] sys.setrecursionlimit(1000000) mod = 1000000007 def solve(): n,k = LI() h = LI() if n <= k: print(0) return h.sort() ans = sum(h[:-k]) print(ans) return #Solve if __name__ == "__main__": solve()
#!usr/bin/env python3 from collections import defaultdict,deque from heapq import heappush, heappop from itertools import permutations import sys import math import bisect def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def LS():return [list(x) for x in sys.stdin.readline().split()] def S(): res = list(sys.stdin.readline()) if res[-1] == "\n": return res[:-1] return res def IR(n): return [I() for i in range(n)] def LIR(n): return [LI() for i in range(n)] def SR(n): return [S() for i in range(n)] def LSR(n): return [LS() for i in range(n)] sys.setrecursionlimit(1000000) mod = 1000000007 def solve(): n,k = LI() h = LI() if n <= k: print(0) return h.sort() ans = sum(h[:n-k]) print(ans) return #Solve if __name__ == "__main__": solve()
[ "call.arguments.change" ]
589,290
589,291
u585482323
python
p02786
import math print(2**math.ceil(math.log2(int(input())))-1)
import math print(2**(math.floor(math.log2(int(input())))+1)-1)
[ "call.arguments.change", "misc.opposites", "identifier.change", "expression.operation.binary.change", "io.output.change" ]
589,300
589,301
u123579949
python
p02786
n = int(log2(int(input()))) print(2 ** (n + 1) - 1)
from math import log2 n = int(log2(int(input()))) print(2 ** (n + 1) - 1)
[]
589,302
589,303
u264867962
python
p02786
import bisect H=int(input()) A=[2**x for x in range(51)] if H==1: print(0) elif H==2: print(3) else: index=bisect.bisect_right(A,H) print(sum(A[:index]))
import bisect H=int(input()) A=[2**x for x in range(51)] if H==1: print(1) elif H==2: print(3) else: index=bisect.bisect_right(A,H) print(sum(A[:index]))
[ "literal.number.integer.change", "call.arguments.change", "io.output.change" ]
589,306
589,307
u075303794
python
p02786
import bisect H=int(input()) A=[2**x for x in range(51)] if H==1: print(0) elif H==2: print(3) else: index=bisect.bisect_left(A,H) print(sum(A[:index]))
import bisect H=int(input()) A=[2**x for x in range(51)] if H==1: print(1) elif H==2: print(3) else: index=bisect.bisect_right(A,H) print(sum(A[:index]))
[ "literal.number.integer.change", "call.arguments.change", "io.output.change", "assignment.value.change", "identifier.change" ]
589,308
589,307
u075303794
python
p02786
N = int(input()) for i in range(100000): if 2**i <= N and N<2**(i+1): print(2**(i+1)) break
N = int(input()) for i in range(100000): if 2**i <= N and N<2**(i+1): print((2**(i+1))-1) break
[ "call.arguments.change", "call.arguments.add" ]
589,309
589,310
u142211940
python
p02786
n=int(input()) ans=0 m=1 while n>1: n=n//2 ans+=1 m*=2 print(ans+m)
n=int(input()) ans=0 m=1 while n>1: n=n//2 ans+=m m*=2 print(ans+m)
[ "identifier.replace.add", "literal.replace.remove" ]
589,325
589,326
u010379708
python
p02786
H = int(input()) ene = 0 count = 0 while H >= 1: H //= 2 count += ene ene *= 2 print(count)
H = int(input()) ene = 1 count = 0 while H >= 1: H //= 2 count += ene ene *= 2 print(count)
[ "literal.number.integer.change", "assignment.value.change" ]
589,341
589,342
u442877951
python
p02786
H = int(input()) count = 0 enemy = 1 while H >= 1: count += enemy H //= 2 print(count)
H = int(input()) count = 0 enemy = 1 while H >= 1: count += enemy enemy *= 2 H //= 2 print(count)
[]
589,344
589,345
u442877951
python
p02786
# H=int(input()) H=1000000000000 m=1 a=0 while H>1: a=m H=H//2 _m=2*m m=_m print(2*m-1)
H=int(input()) m=1 a=0 while H>1: a=m H=H//2 _m=2*m m=_m print(2*m-1)
[ "assignment.value.change", "identifier.replace.add", "literal.replace.remove", "call.arguments.add" ]
589,348
589,349
u674588203
python
p02786
def resolve(): import sys sys.setrecursionlimit(100000) H = int(input()) def battle(n): if n == 1: return 1 return battle(n / 2) * 2 + 1 print(battle(H)) return resolve()
def resolve(): import sys sys.setrecursionlimit(1000000) H = int(input()) def battle(n): if n == 1: return 1 return battle(n // 2) * 2 + 1 print(battle(H)) return resolve()
[ "literal.number.integer.change", "call.arguments.change", "expression.operator.arithmetic.change", "function.return_value.change", "expression.operation.binary.change" ]
589,356
589,357
u364386647
python
p02786
print(~-1<<len(bin(int(input()))-3))
print(~-(1<<len(bin(int(input()))[2:])))
[ "call.arguments.change" ]
589,358
589,359
u094999522
python
p02786
h=int(input()) a=0 b=0 if h%2 != 0: h=h-1 c=h while h > 1: h=int(h/2) a+=1 print(a) for i in range(a): b+=2**i print(2**a+b)
h=int(input()) a=0 b=0 if h%2 != 0: h=h-1 c=h while h > 1: h=int(h/2) a+=1 for i in range(a): b+=2**i print(2**a+b)
[ "call.remove" ]
589,370
589,371
u580316619
python
p02786
def myfunc(N): if(N == 1): return 1 return 2 * myfunc(N/2) + 1 if __name__ == "__main__": N = int(input()) print(myfunc(N))
def myfunc(N): if(N <= 1): return 1 return 2 * myfunc(int(N/2)) + 1 if __name__ == "__main__": N = int(input()) print(myfunc(N))
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change", "call.add", "call.arguments.change", "function.return_value.change" ]
589,374
589,375
u894134667
python
p02786
def myfunc(N): if(N <= 1): return 1 return 2 * myfunc(N/2) + 1 if __name__ == "__main__": N = int(input()) print(myfunc(N))
def myfunc(N): if(N <= 1): return 1 return 2 * myfunc(int(N/2)) + 1 if __name__ == "__main__": N = int(input()) print(myfunc(N))
[ "call.add", "call.arguments.change", "function.return_value.change" ]
589,376
589,375
u894134667
python
p02786
H = int(input()) i = 0 while True: if H < 2 ** i: n = i-1 break i += 1 print(2**n -1)
H = int(input()) i = 0 while True: if H < 2 ** i: n = i break i += 1 print(2**n -1)
[ "expression.operation.binary.remove" ]
589,383
589,384
u904331908
python
p02786
H = int(input()) # 体力がHのモンスター1体に勝つために必要な攻撃回数をf(H)とする # すると、f(H)は以下の漸化式に従って求まる # f(H)=2*f(floor(H/2)+1) (H>1) # f(H)=1 (H=1) def attack_num(x): if x == 1: return 1 else: return 2*f(x // 2) + 1 print(attack_num(H))
H = int(input()) # 体力がHのモンスター1体に勝つために必要な攻撃回数をf(H)とする # すると、f(H)は以下の漸化式に従って求まる # f(H)=2*f(floor(H/2)+1) (H>1) # f(H)=1 (H=1) # 漸化式の実装はAtCoderで珍しい。パターンとして覚えよ! def attack_num(x): if x == 1: return 1 else: return 2*attack_num(x // 2) + 1 print(attack_num(H))
[ "identifier.change", "call.function.change", "function.return_value.change", "expression.operation.binary.change" ]
589,385
589,386
u309120194
python
p02786
H = int(input()) # 体力がHのモンスター1体に勝つために必要な攻撃回数をf(H)とする # すると、f(H)は以下の漸化式に従って求まる # f(H)=2*f(floor(H/2)+1) (H>1) # f(H)=1 (H=1) def attack_num(x): if x == 1: return 1 else: return 2*f(x // 2) + 1 print(attack_num(H))
H = int(input()) # 体力がHのモンスター1体に勝つために必要な攻撃回数をf(H)とする # すると、f(H)は以下の漸化式に従って求まる # f(H)=2*f(floor(H/2)+1) (H>1) # f(H)=1 (H=1) def attack_num(x): if x == 1: return 1 else: return 2*attack_num(x // 2) + 1 print(attack_num(H))
[ "identifier.change", "call.function.change", "function.return_value.change", "expression.operation.binary.change" ]
589,385
589,387
u309120194
python
p02786
H = int(input()) # 体力がHのモンスター1体に勝つために必要な攻撃回数をf(H)とする # すると、f(H)は以下の漸化式に従って求まる # f(H)=2*f(floor(H/2)+1) (H>1) # f(H)=1 (H=1) def attack_num(x): if x == 1: return 1 else: return 2*f(x // 2) + 1 print(attack_num(H))
H = int(input()) # 体力がHのモンスター1体に勝つために必要な攻撃回数をf(H)とする # すると、f(H)は以下の漸化式に従って求まる # f(H)=2*f(floor(H/2)+1) (H>1) # f(H)=1 (H=1) def attack_num(x): if x == 1: return 1 else: return 2*attack_num(x // 2) + 1 print(attack_num(H))
[ "identifier.change", "call.function.change", "function.return_value.change", "expression.operation.binary.change" ]
589,385
589,388
u309120194
python
p02786
import sys sys.setrecursionlimit(1000000) def rec(n): if n == 1: return 1 return rec(n/2)*2+1 n = int(input()) print(rec(n))
import sys sys.setrecursionlimit(1000000) def rec(n): if n == 1: return 1 return rec(n//2)*2+1 n = int(input()) print(rec(n))
[ "expression.operator.arithmetic.change", "call.arguments.change", "function.return_value.change", "expression.operation.binary.change" ]
589,391
589,392
u045953894
python
p02786
n = int(input()) ans = 1 while ans < n: ans *= 2 print(ans -1)
n = int(input()) ans = 1 while ans <= n: ans *= 2 print(ans -1)
[ "expression.operator.compare.change", "control_flow.loop.condition.change" ]
589,397
589,398
u381585104
python
p02786
H = int(input()) count = 0 ans = 0 while H>1: H = H//2 ans += 2**i count += 1 ans += 2**i print(ans)
H = int(input()) count = 0 ans = 0 while H>1: H = H//2 ans += 2**count count += 1 ans += 2**count print(ans)
[ "identifier.change", "expression.operation.binary.change" ]
589,403
589,404
u845573105
python
p02786
a=int(input()) import math total=0 total2=1 while True: if a>1: a=math.ceil(a/2) total+=total2 total2=total2*2 elif a==1: print(total+total2) break
a=int(input()) import math total=0 total2=1 while True: if a>1: a=a//2 total+=total2 total2=total2*2 elif a==1: print(total+total2) break
[ "call.remove", "expression.operator.arithmetic.change", "assignment.value.change", "call.arguments.change", "expression.operation.binary.change" ]
589,412
589,413
u796563423
python
p02786
H = int(input()) cnt = 0 while True: H //= 2 cnt += 1 if H == 0: break print(cnt) print(2**cnt-1)
H = int(input()) cnt = 0 while True: H //= 2 cnt += 1 if H == 0: break print(2**cnt-1)
[ "call.remove" ]
589,414
589,415
u065137691
python
p02786
print(int(input()).bit_length()+1)
print(2**int(input()).bit_length()-1)
[ "misc.opposites", "expression.operator.arithmetic.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
589,418
589,419
u938486382
python
p02786
print(int(input()).bit_length())
print(2**int(input()).bit_length()-1)
[ "expression.operation.binary.add" ]
589,420
589,419
u938486382
python
p02786
H=int(input()) A=1 while H>A: A*=2 print(A-1)
H=int(input()) A=1 while H>=A: A*=2 print(A-1)
[ "expression.operator.compare.change", "control_flow.loop.condition.change" ]
589,423
589,424
u752774573
python
p02786
def func(x): if x > 1: return 2 * func(H//2) + 1 elif x == 1: return 1 H = int(input()) ans = func(H) print(ans)
def func(x): if x > 1: return 2 * func(x//2) + 1 elif x == 1: return 1 H = int(input()) ans = func(H) print(ans)
[ "identifier.change", "call.arguments.change", "function.return_value.change", "expression.operation.binary.change" ]
589,445
589,446
u842747358
python
p02786
h = int(input()) add = 1 ans = 0 while(h!=1): h = (h+1)//2 ans += add add *= 2 ans += add print(ans)
h = int(input()) add = 1 ans = 0 while(h!=1): h = h//2 ans += add add *= 2 ans += add print(ans)
[]
589,447
589,448
u092387689
python
p02786
def f(h): return 0 if h==0 else 1 + 2*f(int(h/2)) h = int(input()) f(h)
def f(h): return 0 if h==0 else 1 + 2*f(int(h/2)) h = int(input()) print(f(h))
[ "call.add", "call.arguments.change" ]
589,455
589,456
u437215432
python
p02786
import math def py(): print("yes") def pn(): print("no") def iin(): x = int(input()) return x neko = 1 nya = 1 nuko = 0 h = iin() while h%2 == 0: h //= 2 neko += 1 print(2**neko-1)
import math def py(): print("yes") def pn(): print("no") def iin(): x = int(input()) return x neko = 1 nya = 1 nuko = 0 h = iin() while h > 1: h //= 2 neko += 1 print(2**neko-1)
[]
589,458
589,459
u146803137
python
p02786
HP = int(input()) if HP == 1: print("1") else: #print(bin(HP)) print(pow(2,len(bin(HP))-3))
HP = int(input()) if HP == 1: print("1") else: #print(bin(HP)) print(pow(2,len(bin(HP))-2)-1)
[ "literal.number.integer.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change", "call.arguments.add" ]
589,477
589,478
u152402277
python
p02786
h = int(input()).bit_length() print(h**2-1)
h=int(input()).bit_length() print(2**h-1)
[ "expression.operation.binary.remove" ]
589,479
589,480
u067986264
python
p02786
import math h = int(input()) def f(hp): if(hp == 1): return 1 else: return (2 * f(math.ceil(hp / 2)) + 1) print(f(h))
import math h = int(input()) def f(hp): if(hp == 1): return 1 else: return (2 * f(math.floor(hp / 2)) + 1) print(f(h))
[ "misc.opposites", "identifier.change", "call.arguments.change", "function.return_value.change", "expression.operation.binary.change" ]
589,481
589,482
u693933222
python
p02786
H = int(input()) I = len(bin(H)-3) Sn = 2**(I+1)-1 print(Sn)
H = int(input()) I = len(bin(H))-3 Sn = 2**(I+1)-1 print(Sn)
[ "call.arguments.change" ]
589,493
589,494
u331997680
python
p02785
N,K = map(int,input().split()) W = sorted(list(map(int,input().split())),reverse=True) if N<=K: print(0) for i in range(K): W[i] = 0 print(sum(W))
N,K = map(int,input().split()) W = sorted(list(map(int,input().split())),reverse=True) if N<=K: print(0) else: for i in range(K): W[i] = 0 print(sum(W))
[]
589,503
589,504
u020962106
python
p02785
H,N=map(int, input().split()) l=list(map(int, input().split())) import math # H,N=3,1 # l=[4,1,5] import sys if N>=len(l): print(l) sys.exit() sort_l=sorted(l) delete_l=sort_l[:len(l)-N] print(sum(delete_l))
H,N=map(int, input().split()) l=list(map(int, input().split())) import math # H,N=3,1 # l=[4,1,5] import sys if N>=len(l): print(0) sys.exit() sort_l=sorted(l) delete_l=sort_l[:len(l)-N] print(sum(delete_l))
[ "identifier.replace.remove", "literal.replace.add", "call.arguments.change", "io.output.change" ]
589,507
589,508
u417014669
python
p02785
N, K = map(int, input().split()) H = list(map(int, input().split())) # 必殺技 for i in range(K): if len(H): H.pop() print(sum(H))
N, K = map(int, input().split()) H = list(map(int, input().split())) H.sort() # 必殺技 for i in range(K): #print(H) if len(H): H.pop() print(sum(H))
[ "call.add" ]
589,523
589,524
u875600867
python
p02785
H, K = map(int, input().split()) array = list(map(int, input().split())) A = sorted(array, reverse=True) del A[0:K-1] print(sum(A))
H, K = map(int, input().split()) array = list(map(int, input().split())) A = sorted(array, reverse=True) del A[0:K] print(sum(A))
[ "expression.operation.binary.remove" ]
589,532
589,533
u890183245
python
p02785
H, K = int(input().split()) array = list(map(int, input().split())) A = sorted(array, reverse=True) del A[0:K-1] print(sum(A))
H, K = map(int, input().split()) array = list(map(int, input().split())) A = sorted(array, reverse=True) del A[0:K] print(sum(A))
[ "assignment.value.change", "identifier.change", "call.function.change", "call.arguments.add", "expression.operation.binary.remove" ]
589,534
589,533
u890183245
python
p02785
n,k=map(int,input().split()) h=sorted(list(map(int,input().split()))) if k>=n: print(0) if k==0: print(sum(h)) else: print(sum(h[:-k]))
n,k=map(int,input().split()) h=sorted(list(map(int,input().split()))) if k>=n: print(0) elif k==0: print(sum(h)) else: print(sum(h[:-k]))
[ "control_flow.branch.if.replace.remove", "control_flow.branch.else_if.replace.add" ]
589,535
589,536
u143612492
python
p02785
N, K = map(int, input().split()) H = list(map(int, input().split())) ans = 0 if K>=N: print(ans) else: H = H.sort(reverse=True) for i in range(K, N): ans += H[i] print(ans)
N, K = map(int, input().split()) H = list(map(int, input().split())) ans = 0 if K>=N: print(ans) else: H.sort(reverse=True) for i in range(K, N): ans += H[i] print(ans)
[ "assignment.remove" ]
589,537
589,538
u933717615
python
p02785
n,k = map(int,input().split()) h = list(map(int,input().split())) del h[n::] h.sort() if k != 0: del h[-k:] print(h) print(sum(h))
n,k = map(int,input().split()) h = list(map(int,input().split())) del h[n::] h.sort() if k != 0: del h[-k:] print(sum(h))
[ "call.remove" ]
589,539
589,540
u969211566
python
p02785
n,k = map(int,input().split()) h = list(map(int,input().split())) del h[n::] h.sort() del h[-k:] print(sum(h))
n,k = map(int,input().split()) h = list(map(int,input().split())) del h[n::] h.sort() if k != 0: del h[-k:] print(sum(h))
[ "control_flow.branch.if.add" ]
589,541
589,540
u969211566
python
p02785
n, k = map(int, input().split()) li = sorted(list(map(int, input().split()))) print(sum(li[:(n-k)]))
n, k = map(int, input().split()) li = sorted(list(map(int, input().split()))) print(sum(li[:(max(n-k, 0))]))
[ "call.add", "call.arguments.add" ]
589,544
589,545
u514687406
python
p02785
N, K = map(int, input().split()) H = sorted(map(int, input().split())) print(sum(H[:N-K]))
N, K = map(int, input().split()) H = sorted(map(int, input().split())) print(sum(H[:N-K]) if N>K else 0)
[]
589,548
589,549
u290279680
python
p02785
n, k = map(int, input().split()) H = list(map(int, input().split())) H = list(reversed(sorted(H))) if k >= n: print(0) else: print(sum(H[:k]))
n, k = map(int, input().split()) H = list(map(int, input().split())) H = list(reversed(sorted(H))) if k >= n: print(0) else: print(sum(H[k:]))
[ "call.arguments.change" ]
589,552
589,553
u382423941
python
p02785
R = lambda: map(int, input().split()) n, k = R() print(sum(sorted(R())[:n - k]))
R = lambda: map(int, input().split()) n, k = R() print(sum(sorted(R())[:n - k]) if k < n else 0)
[]
589,560
589,561
u021019433
python
p02785
R = lambda: map(int, input().split()) n, k = R() print(sum(sorted(R())[:n - k]))
R = lambda: map(int, input().split()) n, k = R() print(sum(sorted(R())[:n - min(k,n)]))
[ "call.add", "call.arguments.add" ]
589,560
589,562
u021019433
python
p02785
#!/usr/bin/env python3 import sys def solve(N: int, K: int, H: "List[int]"): H.sort() print(0 if N<=K else sum(H[-K:])) return # Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template) def main(): def iterate_tokens(): for line in sys.stdin: for word in line.split(): yield word tokens = iterate_tokens() N = int(next(tokens)) # type: int K = int(next(tokens)) # type: int H = [int(next(tokens)) for _ in range(N)] # type: "List[int]" solve(N, K, H) if __name__ == '__main__': main()
#!/usr/bin/env python3 import sys def solve(N: int, K: int, H: "List[int]"): H.sort() print(0 if N<=K else sum(H[:N-K])) return # Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template) def main(): def iterate_tokens(): for line in sys.stdin: for word in line.split(): yield word tokens = iterate_tokens() N = int(next(tokens)) # type: int K = int(next(tokens)) # type: int H = [int(next(tokens)) for _ in range(N)] # type: "List[int]" solve(N, K, H) if __name__ == '__main__': main()
[ "call.arguments.change" ]
589,565
589,566
u090649502
python
p02785
N, K = [int(i) for i in input().split()] mon_list = [int(i) for i in input().split()] mon_list = sorted(mon_list, reverse=True) if N <= K: output = 0 else: if K != 0: output = sum(mon_list[:K]) else: output = sum(mon_list) print(output)
N, K = [int(i) for i in input().split()] mon_list = [int(i) for i in input().split()] mon_list = sorted(mon_list, reverse=True) if N <= K: output = 0 else: if K != 0: output = sum(mon_list[K:]) else: output = sum(mon_list) print(output)
[ "call.arguments.change" ]
589,567
589,568
u848678027
python
p02785
N,K=map(int,input().split()) H=[map(int,input().split())] if N<=K: print(0) else: H.sort() a=sum(H[0:N-K]) print(a)
N,K=map(int,input().split()) H=list(map(int,input().split())) if N<=K: print(0) else: H.sort() a=sum(H[0:N-K]) print(a)
[ "assignment.value.change", "call.arguments.change" ]
589,586
589,587
u756399469
python
p02785
#!/usr/bin/env python3 n,k = map(int,input().split()) h = list(map(int,input().split())) if n > k: print(sum(h[:n-k])) else: print(0)
#!/usr/bin/env python3 n,k = map(int,input().split()) h = list(map(int,input().split())) h.sort() if n > k: print(sum(h[:n-k])) else: print(0)
[ "call.add" ]
589,590
589,591
u462329577
python
p02785
n,k=map(int,input().split()) h=list(map(int,input().split())) if n<=k: print(k) else: h.sort(reverse=True) print(sum(h[k:]))
n,k=map(int,input().split()) h=list(map(int,input().split())) if n<=k: print(0) else: h.sort(reverse=True) print(sum(h[k:]))
[ "identifier.replace.remove", "literal.replace.add", "call.arguments.change", "io.output.change" ]
589,592
589,593
u058861899
python
p02786
h = int(input()) ans = -1 for i in range(100000000): if h+1<2**i: ans += 2**i break print(ans)
h = int(input()) ans = -1 for i in range(100000000): if h+0.5<2**i: ans += 2**i break print(ans)
[ "control_flow.branch.if.condition.change" ]
589,598
589,599
u169350228
python
p02786
h=int(input()) def f(n): if n==1: return 1 else: return 2 * f(n) + 1 hit=f(h) print(hit)
h=int(input()) def f(n): if n==1: return 1 else: return 2 * f(n//2) + 1 hit=f(h) print(hit)
[ "expression.operation.binary.add" ]
589,609
589,610
u131638468
python
p02786
#D H = int(input()) c = 1 while H>1: H = math.floor(H/2) c += 1 print(sum([2**i for i in range(c)]))
#D import math H = int(input()) c = 1 while H>1: H = math.floor(H/2) c += 1 print(sum([2**i for i in range(c)]))
[]
589,625
589,626
u081340269
python
p02786
import math H = int(input()) p = math.ceil(math.log2(H)) print(2**p - 1)
import math H = int(input()) p = math.floor(math.log2(H) + 1) print(2**p - 1)
[ "misc.opposites", "assignment.value.change", "identifier.change" ]
589,632
589,633
u692453235
python
p02786
def f(H): if H==1: return 1 elif H>1: return 2*(H//2) +1 h=int(input()) print(f(h))
def f(H): if H==1: return 1 elif H>1: return 2*f(H//2) +1 h=int(input()) print(f(h))
[ "call.add", "function.return_value.change" ]
589,634
589,635
u337626942
python
p02786
def atk(H): if H == 1: return(H) else: global count count += 1 return(atk(H//2)) count = 0 atk(int(input())) print(-1*(1-(2**(count))))
def atk(H): if H == 1: return(H) else: global count count += 1 return(atk(H//2)) count = 0 atk(int(input())) print(-1*(1-(2**(count+1))))
[ "expression.operation.binary.add" ]
589,640
589,641
u297046168
python
p02786
def attack(num, cnt): cnt+=1 if num==1: return cnt else: return attack(num//2, cnt) H = int(input()) cnt=0 cnt = attack(H, cnt) tmp = [2**x for x in range(cnt)] sum(tmp)
def attack(num, cnt): cnt+=1 if num==1: return cnt else: return attack(num//2, cnt) H = int(input()) cnt=0 cnt = attack(H, cnt) tmp = [2**x for x in range(cnt)] print(sum(tmp))
[ "call.add", "call.arguments.change" ]
589,649
589,650
u461833298
python
p02786
def a(x): if x == 1: return 1 if x > 1: return a((x + 1) // 2) * 2 + 1 print(a(int(input())))
def a(x): if x == 1: return 1 if x > 1: return a(x // 2) * 2 + 1 print(a(int(input())))
[ "call.arguments.change" ]
589,665
589,664
u067694718
python
p02786
def a(x): if x == 1: return 1 if x > 1: return a(x/2) * 2 + 1 print(a(int(input())))
def a(x): if x == 1: return 1 if x > 1: return a(x // 2) * 2 + 1 print(a(int(input())))
[ "expression.operator.arithmetic.change", "call.arguments.change", "function.return_value.change", "expression.operation.binary.change" ]
589,667
589,664
u067694718
python
p02786
n =int(input()) ans = 1 for i in range(int(np.log2(n))): ans += 2**(i+1) print(ans)
import numpy as np n =int(input()) ans = 1 for i in range(int(np.log2(n))): ans += 2**(i+1) print(ans)
[]
589,668
589,669
u549383771
python
p02786
def attack(x): if x==1: return 1 else: return (attack(-(-x/2))*2+1) h=int(input()) print(attack(h))
def attack(x): if x==1: return 1 else: return (attack(x//2)*2+1) h=int(input()) print(attack(h))
[ "expression.operator.arithmetic.change", "call.arguments.change", "function.return_value.change", "expression.operation.binary.change" ]
589,672
589,673
u758831502
python
p02786
N=int(input()) a=0 d=1 while d<=N: a+=d d*=2 print(ans)
N=int(input()) a=0 d=1 while d<=N: a+=d d*=2 print(a)
[ "identifier.change", "call.arguments.change", "io.output.change" ]
589,674
589,675
u918601425
python
p02786
N = input() cnt = 0 while N>1: N = int(N/2) cnt +=1 print(2**(cnt+1)-1)
N = int(input()) cnt = 0 while N>1: N = int(N/2) cnt +=1 print(2**(cnt+1)-1)
[ "call.add", "call.arguments.change" ]
589,679
589,680
u904081717
python
p02786
h = int(input()) dep = 0 def log_num(n): global dep if n == 1: return dep else: dep += 1 log_num(n//2) log_num(h) ans = 1 for i in range(dep+1): ans *= 2 print(ans)
h = int(input()) dep = 0 def log_num(n): global dep if n == 1: return dep else: dep += 1 log_num(n//2) log_num(h) ans = 1 for i in range(dep+1): ans *= 2 print(ans-1)
[ "expression.operation.binary.add" ]
589,685
589,686
u933129390
python
p02786
import math h=int(input()) m=math.ceil(math.log2(h)) print(2**m-1)
import math h=int(input()) m=math.floor(math.log2(h)) print(2**(m+1)-1)
[ "misc.opposites", "assignment.value.change", "identifier.change", "call.arguments.change" ]
589,697
589,698
u547167033
python
p02786
import math h=int(input()) m=int(math.long(h,2)) print(2**(h+1)-1)
import math h=int(input()) m=int(math.log(h,2)) print(int(2**(m+1)-1))
[ "assignment.value.change", "identifier.change", "call.arguments.change", "call.add", "expression.operation.binary.change", "io.output.change" ]
589,701
589,700
u547167033
python
p02786
h = int(input()) ans, i = 0, 1 while h >= i: ans += 1 i *= 2 print(ans)
h = int(input()) ans, i = 0, 1 while h >= i: ans += i i *= 2 print(ans)
[ "identifier.replace.add", "literal.replace.remove" ]
589,706
589,707
u392058721
python
p02786
import math n = int(input()) kaisu = math.log2(n) ans = 0 for i in range(int(kaisu)): ans += 2 ** i print(ans)
import math n = int(input()) kaisu = math.log2(n) + 1 ans = 0 for i in range(int(kaisu)): ans += 2 ** i print(ans)
[ "assignment.change" ]
589,710
589,711
u860966226
python
p02786
import math n = int(input()) kaisu = math.log2(n) ans = 0 for i in range(kaisu): ans += 2 ** i print(ans)
import math n = int(input()) kaisu = math.log2(n) + 1 ans = 0 for i in range(int(kaisu)): ans += 2 ** i print(ans)
[ "call.add", "call.arguments.change", "control_flow.loop.range.bounds.upper.change" ]
589,712
589,711
u860966226
python