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
p02831
class Solution: def solve(self, a: int, b: int) -> int: return a * b // math.gcd(a, b) if __name__ == '__main__': # standard input a, b = map(int, input().split()) # solve solution = Solution() print(solution.solve(a, b))
import math class Solution: def solve(self, a: int, b: int) -> int: return a * b // math.gcd(a, b) if __name__ == '__main__': # standard input a, b = map(int, input().split()) # solve solution = Solution() print(solution.solve(a, b))
[ "identifier.change", "function.return_value.change", "expression.operation.binary.change" ]
633,152
633,153
u577170763
python
p02831
import sys a, b = input().split() A = int(a) B = int(b) Adiv = A Bdiv = B k = 0 for i in reversed(range(min([A, B]))): j = i+1 if Adiv % j == 0 and Bdiv % j == 0: k = j if k == 0: k = 1 res = A * B / k print(int(res))
import sys a, b = input().split() A = int(a) B = int(b) Adiv = A Bdiv = B k = 0 for i in reversed(range(min([A, B]))): j = i+1 if Adiv % j == 0 and Bdiv % j == 0: k = j break if k == 0: k = 1 res = A * B / k print(int(res))
[ "control_flow.break.add" ]
633,168
633,169
u059091824
python
p02831
import fraction A, B = map(int, input().split()) print(A * B // fraction.gcd(A, B))
import math A, B = map(int, input().split()) print(A * B // math.gcd(A, B))
[ "identifier.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
633,172
633,173
u458315482
python
p02831
A, B = map(int, input().split()) import math print(A * B // gcd(A, B))
A, B = map(int, input().split()) import math print(A * B // math.gcd(A, B))
[ "identifier.change" ]
633,194
633,193
u663093503
python
p02831
A, B = map(int, input().split()) N = A*B #print(N) if A >= B: a = int(N/A) for i in range(a): if A*(a-i) % B == 0: N = A*(a-i) else: b = int(N/B) for i in range(b): print(b-i) if B*(b-i) % A == 0: N = B*(b-i) print(N)
A, B = map(int, input().split()) N = A*B if A >= B: a = int(N/A) for i in range(a): if A*(a-i) % B == 0: N = A*(a-i) else: b = int(N/B) for i in range(b): if B*(b-i) % A == 0: N = B*(b-i) print(N)
[ "call.remove" ]
633,195
633,196
u164873417
python
p02831
A,B = map(int,input().split()) def gcd(a, b): while b: a, b = b, a % b return a def lcm(a, b): return a * b // gcd (a, b) print(lcm(a,b))
a,b = map(int,input().split()) def gcd(a, b): while b: a, b = b, a % b return a def lcm(a, b): return a * b // gcd (a, b) print(lcm(a,b))
[ "assignment.variable.change", "identifier.change" ]
633,206
633,207
u021217230
python
p02831
import fractions def main(): A, B = list(map(int, input().split())) print(lcm(A, B)) def lcm(a, b): return a * b // fractions.lcm(a, b) if __name__ == "__main__": main()
import math def main(): A, B = list(map(int, input().split())) print(lcm(A, B)) def lcm(a, b): return a * b // math.gcd(a, b) if __name__ == "__main__": main()
[ "identifier.change", "function.return_value.change", "expression.operation.binary.change" ]
633,269
633,270
u614627871
python
p02831
import math a,b = list(map(int, input().split())) def gcd( x, y ): while y != 0: x, y = y, x%y def lcm(x, y): return (x * y) // gcd(x, y) print(lcm(a, b))
import math a,b = list(map(int, input().split())) def gcd( x, y ): while y != 0: x, y = y, x%y return x def lcm(x, y): return (x * y) // gcd(x, y) print(lcm(a, b))
[ "control_flow.return.add" ]
633,355
633,356
u749601238
python
p02831
A,B = input().split() A=int(A) B =int(B) if A<B: for i in range(1,B+1): if A*i%B ==0: print(A*i) else: for i in range(1,A+1): if B*i%A ==0: print(B*i)
A,B = input().split() A=int(A) B =int(B) if A<B: for i in range(1,B+1): if A*i%B ==0: print(A*i) break else: for i in range(1,A+1): if B*i%A ==0: print(B*i) break
[ "control_flow.break.add" ]
633,451
633,452
u018983066
python
p02831
#c a, b = map(int ,input().split()) from math import * print(a*b//math.gcd(a, b))
#c a, b = map(int ,input().split()) from math import gcd print(a*b//gcd(a, b))
[ "identifier.change" ]
633,487
633,488
u078264526
python
p02831
N,S = map(int, input().split()) tmp = 1 a = 1 while True: if N // 2 < a or S // 2 < a: break if N % a == 0 and S % a == 0: N,S = N // a, S // a tmp *= a a = 1 a += 1 print(tmp * S * N)
N,S = map(int, input().split()) tmp = 1 a = 1 while True: if N // 2 < a and S // 2 < a: break if N % a == 0 and S % a == 0: N,S = N // a, S // a tmp *= a a = 1 a += 1 print(tmp * S * N)
[ "control_flow.branch.if.condition.change" ]
633,566
633,567
u290886932
python
p02831
a, b = input().split() complete = int(a) * int(b); tmp = complete for i in range(2, min(int(a), int(b)) + 1): tmp = complete / i if tmp % int(b) == 0 and tmp % int(a) == 0: complete = tmp print(int(complete))
a, b = input().split() product = int(a) * int(b); complete = product tmp = product for i in range(2, min(int(a), int(b)) + 1): tmp = product / i if tmp % int(b) == 0 and tmp % int(a) == 0: complete = tmp print(int(complete))
[ "assignment.variable.change", "identifier.change", "assignment.value.change", "expression.operation.binary.change" ]
633,623
633,624
u945046250
python
p02831
a, b = input().split() complete = int(a) * int(b); tmp = complete for i in range(2, min(int(a), int(b)) + 1): tmp = complete / i if tmp % int(b) == 0 and tmp % int(a) == 0: complete = tmp print(int(complete))
a, b = input().split() product = int(a) * int(b); complete = product tmp = product for i in range(2, min(int(a), int(b)) + 1): tmp = product / i if tmp % int(b) == 0 and tmp % int(a) == 0: complete = tmp print(int(complete))
[ "assignment.variable.change", "identifier.change", "assignment.value.change", "expression.operation.binary.change" ]
633,625
633,624
u945046250
python
p02831
def lcm(x, y): return (x * y) // math.gcd(x, y) a,b=map(int,input().split()) print(lcm(a, b))
import math def lcm(x, y): return (x * y) // math.gcd(x, y) a,b=map(int,input().split()) print(lcm(a, b))
[ "identifier.change", "function.return_value.change", "expression.operation.binary.change" ]
633,685
633,686
u019053283
python
p02831
a,b = map(int,input().split()) def lcm(x, y): return (x * y) // math.gcd(x, y) print(int(lcm(a, b)))
import math a,b = map(int,input().split()) def lcm(x, y): return (x * y) // math.gcd(x, y) print(int(lcm(a, b)))
[ "identifier.change", "function.return_value.change", "expression.operation.binary.change" ]
633,695
633,696
u829008868
python
p02831
x,y = map(int,input().split()) print(x*y//gcd(x,y))
import math x,y = map(int,input().split()) print(x*y//math.gcd(x,y))
[]
633,756
633,757
u983367697
python
p02831
from fractions import math (A, B) = list(map(int, input().split())) print((A * B) // gcd(A, B))
import math (A, B) = list(map(int, input().split())) print((A * B) // math.gcd(A, B))
[]
633,797
633,798
u205936263
python
p02831
#problemC: Snack a,b = list(map(int, input().split())) def gcd(a,b): while b!=0: a,b=b,a%b return a def lcm(a,b): return a*b//gcd(a,b) lcm(a,b)
#problemC: Snack a,b = list(map(int, input().split())) def gcd(a,b): while b!=0: a,b=b,a%b return a def lcm(a,b): return a*b//gcd(a,b) print(lcm(a,b))
[ "call.add", "call.arguments.change" ]
633,800
633,801
u994034374
python
p02831
from math import gcd a, b = map(int, input().split()) def lcm(x, y): return (x * y) // math.gcd(x, y) print(lcm(a, b))
from math import gcd a, b = map(int, input().split()) def lcm(x, y): return (x * y) // gcd(x, y) print(lcm(a, b))
[]
633,828
633,829
u849029577
python
p02831
from fracrions import gcd def lcm(x, y): return (x * y) // gcd(x, y) d = [int(i) for i in input().split()] print(lcm(d[0],d[1]))
from math import gcd def lcm(x, y): return (x * y) // gcd(x, y) d = [int(i) for i in input().split()] print(lcm(d[0],d[1]))
[ "identifier.change" ]
633,837
633,838
u114933382
python
p02831
a, b = map(int, input().split()) print(a * b / gcd(a, b))
import math a, b = map(int, input().split()) print(a * b // math.gcd(a, b))
[ "expression.operator.arithmetic.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
633,927
633,928
u642823003
python
p02831
a,b=map(int,input().split()) print(int((a * b /fraction.gcd(a, b))))
import math a,b=map(int,input().split()) print(int((a * b /math.gcd(a, b))))
[ "identifier.change", "call.arguments.change", "expression.operation.binary.change" ]
633,934
633,935
u353652911
python
p02831
import fraction a,b=map(int,input().split()) print(int((a * b /fraction.gcd(a, b))))
import math a,b=map(int,input().split()) print(int((a * b /math.gcd(a, b))))
[ "identifier.change", "call.arguments.change", "expression.operation.binary.change" ]
633,936
633,935
u353652911
python
p02831
import math a,b = map(int,input().split()) min = a * b / gcd(a, b) print(min)
import math a,b = map(int,input().split()) min = a * b / math.gcd(a, b) print(int(min))
[ "identifier.change", "call.add", "call.arguments.change" ]
633,948
633,949
u598924163
python
p02831
def gcd(a,b) : if b == 0: return a return gcd(b,b%a) a, b = map(int, input().split() ) print( a * b // gcd(a,b) )
def gcd(a,b) : if b == 0: return a return gcd(b,a%b) a, b = map(int, input().split() ) print( a * b // gcd(a,b) )
[ "expression.operation.binary.remove" ]
634,054
634,055
u737609426
python
p02831
from math import gcd A,B = int(input().split()) print((A*B) // gcd(A,B))
from math import gcd A,B = map(int,input().split()) print((A*B) // gcd(A,B))
[ "assignment.value.change", "identifier.change", "call.function.change", "call.arguments.add" ]
634,074
634,075
u626217906
python
p02831
from fractions import gcm a, b = map(int, input().split()) print(a*b/gcm(a, b))
from math import gcd a, b = map(int, input().split()) print(int(a*b/gcd(a, b)))
[ "identifier.change", "call.add", "call.function.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
634,124
634,123
u401830498
python
p02831
from math import gcm a, b = map(int, input().split()) print(a*b/gcm(a, b))
from math import gcd a, b = map(int, input().split()) print(int(a*b/gcd(a, b)))
[ "identifier.change", "call.add", "call.function.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
634,125
634,123
u401830498
python
p02831
a,b=(int(x) for x in input().split()) gcc=1 i=2 while True: if(a<i or b<i): break elif (a%i==0 and b%i==0): print(i) gcc*=i a/=i b/=i i=2 else: i+=1 print(int(a*b*gcc))
a,b=(int(x) for x in input().split()) gcc=1 i=2 while True: if(a<i or b<i): break elif (a%i==0 and b%i==0): gcc*=i a/=i b/=i i=2 else: i+=1 print(int(a*b*gcc))
[ "call.remove" ]
634,161
634,162
u790830953
python
p02831
import math n = list(map(int, input().split())) a = (n[0] * n[1]) // math.gcd(n[0], n[1])
import math n = list(map(int, input().split())) a = (n[0] * n[1]) // math.gcd(n[0], n[1]) print(a)
[ "identifier.change", "assignment.value.change", "expression.operation.binary.change", "call.add" ]
634,190
634,189
u743354620
python
p02831
import fraction a, b = map(int, input().split()) print(a * b // fraction.gcd(a, b))
from math import gcd a, b = map(int, input().split()) print(a * b // gcd(a, b))
[ "identifier.change" ]
634,285
634,286
u340781749
python
p02831
a,b=map(int,input().split()) import math gcd=math.gcd(a,b)#最大公約数 lcm=a*b//gcd#最小公倍数least common multiple print(lmc)
a,b=map(int,input().split()) import math gcd=math.gcd(a,b)#最大公約数 lcm=a*b//gcd#最小公倍数least common multiple print(lcm)
[ "identifier.change", "call.arguments.change", "io.output.change" ]
634,387
634,388
u867848444
python
p02832
n=int(input()) a=list(int(x) for x in input().split()) count=0 z=True j=0 if 1 not in a: print(-1) for k in range(j,n): if a[k]==count+1: j=k count=count+1 print(n-count)
n=int(input()) a=list(int(x) for x in input().split()) count=0 z=True j=0 if 1 not in a: print(-1) else: for k in range(j,n): if a[k]==count+1: j=k count=count+1 print(n-count)
[]
634,408
634,409
u209561309
python
p02832
n = int(input()) al = list(map(int, input().split())) if n == 1 and al[0] == 1: print(0) else: i, j, num, ans = 0, 0, 1, 0 while i < n: if al[i] != num: i += 1 else: ans += i-j j = i+1 num += 1 i += 1 # print(i, j, ans) if num != 1 and j != n: ans += i-j if ans == 0: print(-1) else: print(ans)
n = int(input()) al = list(map(int, input().split())) if n == 1 and al[0] == 1: print(0) else: i, j, num, ans = 0, 0, 1, 0 while i < n: if al[i] != num: i += 1 else: ans += i-j j = i+1 num += 1 i += 1 # print(i, j, ans) if num != 1 and j != n: ans += i-j if num == 1: print(-1) else: print(ans)
[ "identifier.change", "control_flow.branch.if.condition.change", "literal.number.integer.change" ]
634,410
634,411
u080364835
python
p02832
n = int(input()) al = list(map(int, input().split())) if n == 1 and al[0] == 1: print(0) else: i, j, num, ans = 0, 0, 1, 0 while i < n: if al[i] != num: i += 1 else: ans += i-j j = i+1 num += 1 i += 1 if ans != 0 and j != n: ans += i-j if ans == 0: print(-1) else: print(ans)
n = int(input()) al = list(map(int, input().split())) if n == 1 and al[0] == 1: print(0) else: i, j, num, ans = 0, 0, 1, 0 while i < n: if al[i] != num: i += 1 else: ans += i-j j = i+1 num += 1 i += 1 # print(i, j, ans) if num != 1 and j != n: ans += i-j if num == 1: print(-1) else: print(ans)
[ "identifier.change", "control_flow.branch.if.condition.change", "literal.number.integer.change" ]
634,412
634,411
u080364835
python
p02832
n = int(input()) aas = list(map(int, input().split())) if n == 1 and aas == [1]: print(0) exit() t = 0 for i in aas: if i == t + 1: t += 1 print(n-t if t > 1 else -1)
n = int(input()) aas = list(map(int, input().split())) if n == 1 and aas == [1]: print(0) exit() t = 0 for i in aas: if i == t + 1: t += 1 print(n-t if t > 0 else -1)
[ "literal.number.integer.change", "call.arguments.change", "io.output.change" ]
634,418
634,419
u980783809
python
p02832
class Stack: def __init__(self): self.count = 1 self.lst = [] def push(self, element): if element == count: self.lst.append(element) self.count += 1 def length(self): return len(self.lst) n = int(input()) a = list(map(int, input().split())) stack = Stack() for i in a: stack.push(i) b = stack.length() if b == 0: print('-1') else: print(n - b)
class Stack: def __init__(self): self.count = 1 self.lst = [] def push(self, element): if element == self.count: self.lst.append(element) self.count += 1 def length(self): return len(self.lst) n = int(input()) a = list(map(int, input().split())) stack = Stack() for i in a: stack.push(i) b = stack.length() if b == 0: print('-1') else: print(n - b)
[ "control_flow.branch.if.condition.change" ]
634,427
634,428
u243572357
python
p02832
N = int(input()) A = list(map(int, input().split())) idx = 1 ans = 0 length = len(A) lis = [] for a in A: if a == idx: lis.append(idx) idx += 1 continue else: ans += 1 length -= 1 if lis == list(range(1, length+1)): print(ans) else: print(-1)
N = int(input()) A = list(map(int, input().split())) idx = 1 ans = 0 length = len(A) lis = [] for a in A: if a == idx: lis.append(idx) idx += 1 continue else: ans += 1 length -= 1 if lis != [] and lis == list(range(1, length+1)): print(ans) else: print(-1)
[ "control_flow.branch.if.condition.change" ]
634,433
634,434
u909991537
python
p02832
n = int(input()) a = [int(x) - 1 for x in input().split()] target, point = 0, 0 ans = 0 for i in range(n): if a[i] == target: ans += i - point point = i + 1 target += 1 if target == 0: print(-1) else: print(ans)
n = int(input()) a = [int(x) - 1 for x in input().split()] target, point = 0, 0 ans = 0 for i in range(n): if a[i] == target: ans += i - point point = i + 1 target += 1 if target == 0: print(-1) else: ans += n - point print(ans)
[]
634,435
634,436
u872538555
python
p02832
n = int(input()) a = list(map(int,input().split())) cnt = 0 num = 1 for i in range(n): if a[i] == num : num += 1 continue cnt += 1 print(cnt if num > 1 else 0)
n = int(input()) a = list(map(int,input().split())) cnt = 0 num = 1 for i in range(n): if a[i] == num : num += 1 continue cnt += 1 print(cnt if num > 1 else -1)
[ "call.arguments.change", "io.output.change", "expression.operation.unary.add" ]
634,450
634,451
u843073153
python
p02832
t = int(input()) n = [ int(i) for i in input().split(" ") ] count = 0 num = 1 for i in range(len(n)): if n[i] == num: num += 1 else: count += 1 if count == 0: count = -1 print(count)
t = int(input()) n = [ int(i) for i in input().split(" ") ] count = 0 num = 1 for i in range(len(n)): if n[i] == num: num += 1 else: count += 1 if count == t: count = -1 print(count)
[ "identifier.replace.add", "literal.replace.remove", "control_flow.branch.if.condition.change" ]
634,452
634,453
u723711163
python
p02832
n = int(input()) a = list(map(int,input().split())) ans = 1 cnt = 0 if ans not in a: print(-1) exit() for i in range(n): if i == ans: ans += 1 continue cnt += 1 print(cnt)
n = int(input()) a = list(map(int,input().split())) ans = 1 cnt = 0 if ans not in a: print(-1) exit() for i in a: if i == ans: ans += 1 continue cnt += 1 print(cnt)
[ "control_flow.loop.range.bounds.upper.change", "call.arguments.change" ]
634,462
634,463
u773440446
python
p02832
N = int(input()) A = list(map(int, input().split())) crash = 0 cnt = 0 for i in A: if i == cnt: cnt += 1 else: crash += 1 if cnt == 0: print(-1) else: print(crash)
N = int(input()) A = list(map(int, input().split())) crash = 0 cnt = 1 for i in A: if i == cnt: cnt += 1 else: crash += 1 if cnt == 1: print(-1) else: print(crash)
[ "literal.number.integer.change", "assignment.value.change", "control_flow.branch.if.condition.change" ]
634,464
634,465
u329319441
python
p02832
N = int(input()) A = list(map(int, input().split())) crash = 0 cnt = 1 for i in A: if i == cnt: cnt += 1 else: crash += 1 if cnt == 0: print(-1) else: print(crash)
N = int(input()) A = list(map(int, input().split())) crash = 0 cnt = 1 for i in A: if i == cnt: cnt += 1 else: crash += 1 if cnt == 1: print(-1) else: print(crash)
[ "literal.number.integer.change", "control_flow.branch.if.condition.change" ]
634,466
634,465
u329319441
python
p02832
#!/usr/bin/env python # -*- coding: utf-8 -*- # # FileName: D # CreatedDate: 2020-08-30 14:25:42 +0900 # LastModified: 2020-08-30 14:33:11 +0900 # import os import sys # import numpy as np # import pandas as pd def main(): N = int(input()) A = list(map(int, input().split())) if 1 in A: print(-1) return index = 0 for a in A: if index+1 == a: index += 1 print(N-index) if __name__ == "__main__": main()
#!/usr/bin/env python # -*- coding: utf-8 -*- # # FileName: D # CreatedDate: 2020-08-30 14:25:42 +0900 # LastModified: 2020-08-30 14:34:10 +0900 # import os import sys # import numpy as np # import pandas as pd def main(): N = int(input()) A = list(map(int, input().split())) if not 1 in A: print(-1) return index = 0 for a in A: if index+1 == a: index += 1 print(N-index) if __name__ == "__main__": main()
[ "control_flow.branch.if.condition.change" ]
634,471
634,472
u326552320
python
p02832
n = int(input()) a = list(map(int,input().split())) if 1 not in a: print(-1) exit() num_break = 0 pos = 1 for i in a: if i == pos: pos += 1 else: num_break += 1
n = int(input()) a = list(map(int,input().split())) if 1 not in a: print(-1) exit() num_break = 0 pos = 1 for i in a: if i == pos: pos += 1 else: num_break += 1 print(num_break)
[ "call.add" ]
634,478
634,479
u624613992
python
p02832
n = int(input()) a = [int(i)-1 for i in input().split()] ans = 0 for i in range(n): if a[i] != (i - ans): ans += 1 print(ans if ans != n else 0)
n = int(input()) a = [int(i)-1 for i in input().split()] ans = 0 for i in range(n): if a[i] != (i - ans): ans += 1 print(ans if ans != n else -1)
[ "call.arguments.change", "io.output.change", "expression.operation.unary.add" ]
634,486
634,487
u405733072
python
p02832
n = input() renga = list(map(int, input().split(" "))) ni = 1 remains = 0 for r in renga: if ni == r: ni += 1 remains += 1 if ni == 1: print(-1) else: print(renga - remains)
n = input() renga = list(map(int, input().split(" "))) ni = 1 remains = 0 for r in renga: if ni == r: ni += 1 remains += 1 if ni == 1: print(-1) else: print(len(renga) - remains)
[ "call.add", "call.arguments.change" ]
634,492
634,493
u951361302
python
p02824
from collections import Counter import numpy as np import bisect N,M,V,P = (int(x) for x in input().split()) A = list(map(int, input().split())) dtype = [('points','int64'),('number','int64')] c = np.array([x for x in Counter(A).items()],dtype=dtype) c.sort(order='points') value = [c[-i][1] for i in range(1,len(c)+1)] cs = np.cumsum(value) bs = bisect.bisect_left(cs,P) thr = c[-bs-1][0] limit = np.cumsum([(thr-c[i][0])*c[i][1] for i in range(len(c)-bs-1)]) broke = False if bs == len(cs) - 1: print(N) else: for i in range(len(cs)-bs-1): point = c[-bs-2-i][0] points_needed = thr - point if points_needed > M: print(cs[bs+i]) broke = True break else: questions_raised = V - (N - cs[bs+i]) if questions_raised >= P: points_overflowed = M * (questions_raised-(P-1)) points_limit = limit[-1] - limit[-1-i] + (point+M-thr) * (cs[bs+i]-cs[bs-1]) if points_overflowed > points_limit: print(cs[bs+i]) broke = True break if broke == False: print(N)
from collections import Counter import numpy as np import bisect N,M,V,P = (int(x) for x in input().split()) A = list(map(int, input().split())) dtype = [('points','int64'),('number','int64')] c = np.array([x for x in Counter(A).items()],dtype=dtype) c.sort(order='points') value = [c[-i][1] for i in range(1,len(c)+1)] cs = np.cumsum(value) bs = bisect.bisect_left(cs,P) thr = c[-bs-1][0] limit = np.cumsum([(thr-c[i][0])*c[i][1] for i in range(len(c)-bs-1)]) broke = False if bs == len(cs) - 1: print(N) else: for i in range(len(cs)-bs-1): point = c[-bs-2-i][0] points_needed = thr - point if points_needed > M: print(cs[bs+i]) broke = True break else: questions_raised = V - (N - cs[bs+i]) if questions_raised >= P: points_overflowed = M * (questions_raised-(P-1)) points_limit = limit[-1] - limit[-1-i] + (point+M-thr) * (cs[bs+i]-P+1) if points_overflowed > points_limit: print(cs[bs+i]) broke = True break if broke == False: print(N)
[ "expression.operation.binary.remove" ]
634,510
634,511
u093041722
python
p02824
def main(): N, M, V, P = (int(i) for i in input().split()) A = [int(i) for i in input().split()] A.sort(reverse=True) def is_ok(mid): if mid <= P: return False # 採用可能 if A[mid] + M < A[P-1]: return True # 採用不可能 votable = M + (P-1) * M + (N - (mid + 1))*M for i in range(P-1, mid): votable += min(M, max(0, A[mid] + M - A[i])) if M*V <= votable: return False else: return True def binary_search_meguru(): left = -1 right = N while right - left > 1: mid = left + ((right - left) // 2) if is_ok(mid): right = mid else: left = mid return right print(binary_search_meguru()) if __name__ == '__main__': main()
def main(): N, M, V, P = (int(i) for i in input().split()) A = [int(i) for i in input().split()] A.sort(reverse=True) def is_ok(mid): if mid <= P-1: return False # 採用可能 if A[mid] + M < A[P-1]: return True # 採用不可能 votable = M + (P-1) * M + (N - (mid + 1))*M for i in range(P-1, mid): votable += min(M, max(0, A[mid] + M - A[i])) if M*V <= votable: return False else: return True def binary_search_meguru(): left = -1 right = N while right - left > 1: mid = left + ((right - left) // 2) if is_ok(mid): right = mid else: left = mid return right print(binary_search_meguru()) if __name__ == '__main__': main()
[ "control_flow.branch.if.condition.change" ]
634,536
634,537
u312025627
python
p02824
#!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,m,v,p = LI() a = LI() a.sort() l = -1 r = n-1 while r-l > 1: i = (l+r) >> 1 ai = a[i] aim = ai+m ri = bisect.bisect_right(a,aim) if n-ri >= p: l = i continue cnt = 0 for j in range(n-p): if i == j: continue cnt += min(m,aim-a[j]) if cnt >= m*(v-p): r = i else: l = i print(n-r) 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,m,v,p = LI() a = LI() a.sort() l = -1 r = n-1 while r-l > 1: i = (l+r) >> 1 ai = a[i] aim = ai+m ri = bisect.bisect_right(a,aim) if n-ri >= p: l = i continue cnt = 0 for j in range(n-p+1): if i == j: continue cnt += min(m,aim-a[j]) if cnt >= m*(v-p): r = i else: l = i print(n-r) return #Solve if __name__ == "__main__": solve()
[ "control_flow.loop.range.bounds.upper.change", "expression.operation.binary.add" ]
634,542
634,543
u585482323
python
p02824
N,M,V,P = map(int, input().split()) A = list(map(int, input().split())) A.sort(reverse=True) ok = P-1 ng = N - 1 while abs(ok - ng) > 1: mid = (ok + ng) // 2 curr_max = A[mid] + M if curr_max < A[P-1]: ng = mid continue cnt = 0 # midと上位P-1位に+Mした分 cnt += M + (P-1) * M for i in range(P-1, N): if i == mid: continue cnt += min(M, max(0, curr_max - A[i])) if cnt >= M*V: ok = mid else: ng = mid print(ok + 1)
N,M,V,P = map(int, input().split()) A = list(map(int, input().split())) A.sort(reverse=True) ok = P-1 ng = N while abs(ok - ng) > 1: mid = (ok + ng) // 2 curr_max = A[mid] + M if curr_max < A[P-1]: ng = mid continue cnt = 0 # midと上位P-1位に+Mした分 cnt += M + (P-1) * M for i in range(P-1, N): if i == mid: continue cnt += min(M, max(0, curr_max - A[i])) if cnt >= M*V: ok = mid else: ng = mid print(ok + 1)
[ "expression.operation.binary.remove" ]
634,544
634,545
u037430802
python
p02824
n,m,v,p=map(int,input().split()) a=list(map(int,input().split())) a.sort() def f(x): if x>=n-p: return 1 elif a[x]+m<a[n-p]: return 0 else: ct=(p-1)*m+m+x*m for i in range(x+1,n-p): ct+=a[x]+m-a[i] if ct>=m*v: return 1 else: return 0 L=-1;R=n while R-L>1: x=(L+R)//2 if f(x)==1: R=x else: L=x print(n-L-1)
n,m,v,p=map(int,input().split()) a=list(map(int,input().split())) a.sort() def f(x): if x>=n-p: return 1 elif a[x]+m<a[n-p]: return 0 else: ct=(p-1)*m+m+x*m for i in range(x+1,n-p+1): ct+=a[x]+m-a[i] if ct>=m*v: return 1 else: return 0 L=-1;R=n while R-L>1: x=(L+R)//2 if f(x)==1: R=x else: L=x print(n-L-1)
[ "control_flow.loop.range.bounds.upper.change", "expression.operation.binary.add" ]
634,548
634,549
u017810624
python
p02824
import sys def solve(): input = sys.stdin.readline N, M, V, P = map(int, input().split()) A = [int(a) for a in input().split()] A.sort() B = A[N - P] low, high = -1, N while high - low > 1: mid = (low + high) // 2 if mid >= N - P: high = mid elif A[mid] + M < B: low = mid else: border = A[mid] + M room = 0 for i in range(N - P): if i != mid: room += min(M, max(0, border - A[i])) if room >= max(0, V - P) * M: high = mid else: low = mid #print(mid, room) print(N - high) return 0 if __name__ == "__main__": solve()
import sys def solve(): input = sys.stdin.readline N, M, V, P = map(int, input().split()) A = [int(a) for a in input().split()] A.sort() B = A[N - P] low, high = -1, N while high - low > 1: mid = (low + high) // 2 if mid >= N - P: high = mid elif A[mid] + M < B: low = mid else: border = A[mid] + M room = 0 for i in range(N - P + 1): if i != mid: room += min(M, max(0, border - A[i])) if room >= max(0, V - P) * M: high = mid else: low = mid #print(mid, room) print(N - high) return 0 if __name__ == "__main__": solve()
[ "control_flow.loop.range.bounds.upper.change", "expression.operation.binary.add" ]
634,566
634,567
u608088992
python
p02824
import sys from bisect import bisect def solve(): input = sys.stdin.readline N, M, V, P = map(int, input().split()) A = [int(a) for a in input().split()] A.sort() border = A[N - P] low, high = 0, N while high - low > 1: mid = (low + high) //2 point = A[mid] + M if point < border: low = mid elif mid >= N - P: high = mid else: space = (mid + P) * M for i in range(mid + 1, N - P + 1 ): space += point - A[i] if space >= M * V: high = mid else: low = mid print(N - low - 1) return 0 if __name__ == "__main__": solve()
import sys from bisect import bisect def solve(): input = sys.stdin.readline N, M, V, P = map(int, input().split()) A = [int(a) for a in input().split()] A.sort() border = A[N - P] low, high = -1, N while high - low > 1: mid = (low + high) //2 point = A[mid] + M if point < border: low = mid elif mid >= N - P: high = mid else: space = (mid + P) * M for i in range(mid + 1, N - P + 1 ): space += point - A[i] if space >= M * V: high = mid else: low = mid print(N - low - 1) return 0 if __name__ == "__main__": solve()
[ "assignment.value.change", "expression.operation.unary.add" ]
634,568
634,569
u608088992
python
p02824
import sys from bisect import bisect def solve(): input = sys.stdin.readline N, M, V, P = map(int, input().split()) A = [int(a) for a in input().split()] A.sort() border = A[N - P] low, high = 0, N while high - low > 1: mid = (low + high) //2 point = A[mid] + M if point < border: low = mid elif mid >= N - P: high = mid else: space = (mid + P) * M for i in range(mid + 1, N - P + 1): space -= point - A[i] if space >= M * V: high = mid else: low = mid print(N - low - 1) return 0 if __name__ == "__main__": solve()
import sys from bisect import bisect def solve(): input = sys.stdin.readline N, M, V, P = map(int, input().split()) A = [int(a) for a in input().split()] A.sort() border = A[N - P] low, high = -1, N while high - low > 1: mid = (low + high) //2 point = A[mid] + M if point < border: low = mid elif mid >= N - P: high = mid else: space = (mid + P) * M for i in range(mid + 1, N - P + 1 ): space += point - A[i] if space >= M * V: high = mid else: low = mid print(N - low - 1) return 0 if __name__ == "__main__": solve()
[ "assignment.value.change", "expression.operation.unary.add", "expression.operator.change" ]
634,570
634,569
u608088992
python
p02824
#!/usr/bin/env python3 from collections import defaultdict, deque from heapq import heappush, heappop from bisect import bisect_left, bisect_right import sys import random import itertools import math sys.setrecursionlimit(10**5) input = sys.stdin.readline sqrt = math.sqrt def LI(): return list(map(int, input().split())) def LF(): return list(map(float, input().split())) def LI_(): return list(map(lambda x: int(x)-1, input().split())) def II(): return int(input()) def IF(): return float(input()) def LS(): return list(map(list, input().split())) def S(): return list(input().rstrip()) def IR(n): return [II() for _ in range(n)] def LIR(n): return [LI() for _ in range(n)] def FR(n): return [IF() for _ in range(n)] def LFR(n): return [LI() for _ in range(n)] def LIR_(n): return [LI_() for _ in range(n)] def SR(n): return [S() for _ in range(n)] def LSR(n): return [LS() for _ in range(n)] mod = 1000000007 inf = 1e10 #solve def solve(): n, m, v, p = LI() a = LI() a.sort(reverse=True) ok = p - 1 ng = n def f(x): tmp = (p - 1) * m + (n - x) * m t = a[x] + m if t < a[p - 1]: return False for i in range(p, x): tmp += t - a[i] return tmp >= m * v while abs(ok - ng) > 1: mid = (ok + ng) // 2 if f(mid): ok = mid else: ng = mid print(ok + 1) return #main if __name__ == '__main__': solve()
#!/usr/bin/env python3 from collections import defaultdict, deque from heapq import heappush, heappop from bisect import bisect_left, bisect_right import sys import random import itertools import math sys.setrecursionlimit(10**5) input = sys.stdin.readline sqrt = math.sqrt def LI(): return list(map(int, input().split())) def LF(): return list(map(float, input().split())) def LI_(): return list(map(lambda x: int(x)-1, input().split())) def II(): return int(input()) def IF(): return float(input()) def LS(): return list(map(list, input().split())) def S(): return list(input().rstrip()) def IR(n): return [II() for _ in range(n)] def LIR(n): return [LI() for _ in range(n)] def FR(n): return [IF() for _ in range(n)] def LFR(n): return [LI() for _ in range(n)] def LIR_(n): return [LI_() for _ in range(n)] def SR(n): return [S() for _ in range(n)] def LSR(n): return [LS() for _ in range(n)] mod = 1000000007 inf = 1e10 #solve def solve(): n, m, v, p = LI() a = LI() a.sort(reverse=True) ok = p - 1 ng = n def f(x): tmp = (p - 1) * m + (n - x) * m t = a[x] + m if t < a[p - 1]: return False for i in range(p - 1, x): tmp += t - a[i] return tmp >= m * v while abs(ok - ng) > 1: mid = (ok + ng) // 2 if f(mid): ok = mid else: ng = mid print(ok + 1) return #main if __name__ == '__main__': solve()
[ "control_flow.loop.range.bounds.lower.change", "expression.operation.binary.add" ]
634,589
634,590
u423585790
python
p02824
#!/usr/bin/env python3 from collections import defaultdict, deque from heapq import heappush, heappop from bisect import bisect_left, bisect_right import sys import random import itertools import math sys.setrecursionlimit(10**5) input = sys.stdin.readline sqrt = math.sqrt def LI(): return list(map(int, input().split())) def LF(): return list(map(float, input().split())) def LI_(): return list(map(lambda x: int(x)-1, input().split())) def II(): return int(input()) def IF(): return float(input()) def LS(): return list(map(list, input().split())) def S(): return list(input().rstrip()) def IR(n): return [II() for _ in range(n)] def LIR(n): return [LI() for _ in range(n)] def FR(n): return [IF() for _ in range(n)] def LFR(n): return [LI() for _ in range(n)] def LIR_(n): return [LI_() for _ in range(n)] def SR(n): return [S() for _ in range(n)] def LSR(n): return [LS() for _ in range(n)] mod = 1000000007 inf = 1e10 #solve def solve(): n, m, v, p = LI() a = LI() a.sort(reverse=True) ok = p - 1 ng = n def f(x): tmp = (p - 1) * m + (n - x - 1) * m t = a[x] + m if t < a[p - 1]: return False for i in range(p, x): tmp += t - a[i] return tmp >= m * v while abs(ok - ng) > 1: mid = (ok + ng) // 2 if f(mid): ok = mid else: ng = mid print(ok + 1) return #main if __name__ == '__main__': solve()
#!/usr/bin/env python3 from collections import defaultdict, deque from heapq import heappush, heappop from bisect import bisect_left, bisect_right import sys import random import itertools import math sys.setrecursionlimit(10**5) input = sys.stdin.readline sqrt = math.sqrt def LI(): return list(map(int, input().split())) def LF(): return list(map(float, input().split())) def LI_(): return list(map(lambda x: int(x)-1, input().split())) def II(): return int(input()) def IF(): return float(input()) def LS(): return list(map(list, input().split())) def S(): return list(input().rstrip()) def IR(n): return [II() for _ in range(n)] def LIR(n): return [LI() for _ in range(n)] def FR(n): return [IF() for _ in range(n)] def LFR(n): return [LI() for _ in range(n)] def LIR_(n): return [LI_() for _ in range(n)] def SR(n): return [S() for _ in range(n)] def LSR(n): return [LS() for _ in range(n)] mod = 1000000007 inf = 1e10 #solve def solve(): n, m, v, p = LI() a = LI() a.sort(reverse=True) ok = p - 1 ng = n def f(x): tmp = (p - 1) * m + (n - x) * m t = a[x] + m if t < a[p - 1]: return False for i in range(p - 1, x): tmp += t - a[i] return tmp >= m * v while abs(ok - ng) > 1: mid = (ok + ng) // 2 if f(mid): ok = mid else: ng = mid print(ok + 1) return #main if __name__ == '__main__': solve()
[ "expression.operation.binary.remove" ]
634,591
634,590
u423585790
python
p02824
import bisect n,m,v,p=map(int,input().split()) l=list(map(int,input().split())) l.sort() ok=n#idx ng=-1 def solve(x): if bisect.bisect_right(l,l[x])>=n-p+1: return 1 lx=l[x]+m lxi=bisect.bisect_right(l,lx)-1 if lxi<=n-p-1: return 0 #n-p-1<lxi f=0 for i in range(n): if i<=x or i>n-p: f+=m continue else: f+=min(lx-l[i],m) if f>v*m: return 2 else: return 0 #for i in range(n): #print(solve(i)) while ok-ng>1: x=(ok+ng)//2 if solve(x): ok=x else: ng=x #print(x) print(n-ok)
import bisect n,m,v,p=map(int,input().split()) l=list(map(int,input().split())) l.sort() ok=n#idx ng=-1 def solve(x): if bisect.bisect_right(l,l[x])>=n-p+1: return 1 lx=l[x]+m lxi=bisect.bisect_right(l,lx)-1 if lxi<=n-p-1: return 0 #n-p-1<lxi f=0 for i in range(n): if i<=x or i>n-p: f+=m continue else: f+=min(lx-l[i],m) if f>=v*m: return 2 else: return 0 #for i in range(n): #print(solve(i)) while ok-ng>1: x=(ok+ng)//2 if solve(x): ok=x else: ng=x #print(x) print(n-ok)
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
634,609
634,610
u223904637
python
p02824
# input = sys.stdin.readline from bisect import * from collections import * from heapq import * # import functools # import itertools # import math N,M,V,P=map(int,input().split()) A=sorted(list(map(int,input().split()))) _SUM=sum(A[:N-(P-1)]) def main(i): B=[A[m] for m in range(N-(P-1)) if m!=i] C=A[i]+M a=V-P if C<A[-P]: return(0) else: if a>0: Votenum=a*M for b in B: Votenum-=min(C-b,M) if Votenum<=0: return(1) return(0) else: return(1) if main(0): print(N) exit() st=0 end=N-P+1 while 1: a=(st+end)//2 if main(a): end=a else: st=a if end-st<=1: break print(st,end) if main(st): print(N-st) else: print(N-end)
# input = sys.stdin.readline from bisect import * from collections import * from heapq import * # import functools # import itertools # import math N,M,V,P=map(int,input().split()) A=sorted(list(map(int,input().split()))) _SUM=sum(A[:N-(P-1)]) def main(i): B=[A[m] for m in range(N-(P-1)) if m!=i] C=A[i]+M a=V-P if C<A[-P]: return(0) else: if a>0: Votenum=a*M for b in B: Votenum-=min(C-b,M) if Votenum<=0: return(1) return(0) else: return(1) if main(0): print(N) exit() st=0 end=N-P+1 while 1: a=(st+end)//2 if main(a): end=a else: st=a if end-st<=1: break if main(st): print(N-st) else: print(N-end)
[ "call.remove" ]
634,657
634,658
u779455925
python
p02824
N,M,V,P=map(int,input().split()) import numpy as np A=np.array(sorted(map(int,input().split()))) ng,ok=-1,N-P+1 while ng+1<ok: t=(ng+ok)//2 if A[t]+M<A[-P] or np.sum(np.minimum(M,A[t]+M-A[t+1:-P+1]))<M*(V-P-t): ng=t else: ok=t print(N-ok)
N,M,V,P=map(int,input().split()) import numpy as np A=np.array(sorted(map(int,input().split()))) ng,ok=-1,N-P+1 while ng+1<ok: t=(ng+ok)//2 if A[t]+M<A[-P] or np.sum(np.minimum(M,A[t]+M-A[t+1:N-P+1]))<M*(V-P-t): ng=t else: ok=t print(N-ok)
[ "control_flow.branch.if.condition.change" ]
634,663
634,664
u509368316
python
p02824
n,m,v,p = map(int,input().split()) lis = list(map(int,input().split())) lis.sort(reverse=True) ans = 0 trash = 0 print(lis) for i in range(n): if i+1 <= p: ans += 1 else: if lis[i] + m >= lis[p-1]: if (lis[i]+m)*(i-(p-1))-trash >= m * (v-(p-1)-(n-i)): # print(lis[i]+m,i-(p-1)-trash,m*(v-(p-1)-(n-i))) ans += 1 if i+1 >= p: trash += lis[i] print(ans)
n,m,v,p = map(int,input().split()) lis = list(map(int,input().split())) lis.sort(reverse=True) ans = 0 trash = 0 for i in range(n): if i+1 <= p: ans += 1 else: if lis[i] + m >= lis[p-1]: if (lis[i]+m)*(i-(p-1))-trash >= m * (v-(p-1)-(n-i)): # print(lis[i]+m,i-(p-1)-trash,m*(v-(p-1)-(n-i))) ans += 1 if i+1 >= p: trash += lis[i] print(ans)
[ "call.remove" ]
634,666
634,667
u667024514
python
p02824
n,m,v,p = map(int, input().split()) a = list(map(int, input().split())) a.sort() b = [0]*(n+1) for i in range(n): b[i+1] = b[i] + a[i] def judge(x): if x >= n-p: return True if a[x] + m < a[n-p]: return False safe = m*(n-2) + a[x]*(n-p-x-1) - b[n-p] + b[x+1] return safe >= m*(v-1) ok = n-p ng = -1 while ok-ng > 1: mid = (ok+ng)//2 if judge(mid): ok = mid else: ng = mid print(n-ok)
n,m,v,p = map(int, input().split()) a = list(map(int, input().split())) a.sort() b = [0]*(n+1) for i in range(n): b[i+1] = b[i] + a[i] def judge(x): if x >= n-p: return True if a[x] + m < a[n-p]: return False safe = m*(n-1) + a[x]*(n-p-x) - b[n-p+1] + b[x+1] return safe >= m*(v-1) ok = n-p ng = -1 while ok-ng > 1: mid = (ok+ng)//2 if judge(mid): ok = mid else: ng = mid print(n-ok)
[ "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.change", "expression.operation.binary.remove" ]
634,670
634,671
u543954314
python
p02824
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools import time,random sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**10 mod = 10**9+7 mod2 = 998244353 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 list(map(int, sys.stdin.readline().split())) def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def I(): return int(sys.stdin.readline()) def F(): return float(sys.stdin.readline()) def S(): return input() def pf(s): return print(s, flush=True) def pe(s): return print(str(s), file=sys.stderr) def JA(a, sep): return sep.join(map(str, a)) def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a) def bs(f, mi, ma): mm = -1 while ma > mi: mm = (ma+mi) // 2 if f(mm): mi = mm + 1 else: ma = mm if f(mm): return mm + 1 return mm def main(): n,m,v,p = LI() a = sorted(LI()) pi = n-p pv = a[pi] def f(i): t = a[i] + m if pv > t: return True mv = m*v-m for j in range(n): if j == i: continue aj = a[j] if j > pi: mv -= m elif aj <= t: mv -= min(m, t - aj) else: mv -= m return mv >= 0 r = bs(f,0,n-1) return n - r print(main())
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools import time,random sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**10 mod = 10**9+7 mod2 = 998244353 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 list(map(int, sys.stdin.readline().split())) def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def I(): return int(sys.stdin.readline()) def F(): return float(sys.stdin.readline()) def S(): return input() def pf(s): return print(s, flush=True) def pe(s): return print(str(s), file=sys.stderr) def JA(a, sep): return sep.join(map(str, a)) def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a) def bs(f, mi, ma): mm = -1 while ma > mi: mm = (ma+mi) // 2 if f(mm): mi = mm + 1 else: ma = mm if f(mm): return mm + 1 return mm def main(): n,m,v,p = LI() a = sorted(LI()) pi = n-p pv = a[pi] def f(i): t = a[i] + m if pv > t: return True mv = m*v-m for j in range(n): if j == i: continue aj = a[j] if j > pi: mv -= m elif aj <= t: mv -= min(m, t - aj) else: mv -= m return mv > 0 r = bs(f,0,n-1) return n - r print(main())
[ "expression.operator.compare.change", "function.return_value.change" ]
634,675
634,676
u637175065
python
p02824
N, M, V, P = map(int, input().split()) A = list(map(int, input().split())) A.sort() A = A[::-1] #print("A:", A) left = 0 right = N - 1 while left + 1 < right: mid = (left + right) // 2 Amid = A[mid] rest = M * V - M * P start = P if mid <= P - 1 else P - 1 flag = 0 for i in range(start, N): if mid == i: continue else: if A[i] > Amid + M: flag = 1 break else: rest -= min(M, Amid + M - A[i]) if rest > 0 or flag: right = mid else: left = mid #print(left) answer = 0 Aleft = A[left] for i in range(N): if A[i] >= Aleft: answer += 1 print(answer)
N, M, V, P = map(int, input().split()) A = list(map(int, input().split())) A.sort() A = A[::-1] #print("A:", A) left = 0 right = N while left + 1 < right: mid = (left + right) // 2 Amid = A[mid] rest = M * V - M * P start = P if mid + 1 <= P else P - 1 flag = 0 for i in range(start, N): if mid == i: continue else: if A[i] > Amid + M: flag = 1 break else: rest -= min(M, Amid + M - A[i]) if rest > 0 or flag: right = mid else: left = mid #print(left) answer = 0 Aleft = A[left] for i in range(N): if A[i] >= Aleft: answer += 1 print(answer)
[ "expression.operation.binary.remove" ]
634,694
634,695
u296518383
python
p02824
from heapq import heappush,heappop,heapify from collections import deque,defaultdict,Counter import itertools from itertools import permutations,combinations,groupby import sys import bisect import string import math import time import random def S_(): return input() def LS(): return [i for i in input().split()] def I(): return int(input()) def MI(): return map(int,input().split()) def LI(): return [int(i) for i in input().split()] def LI_(): return [int(i)-1 for i in input().split()] def StoI(): return [ord(i)-97 for i in input()] def ItoS(nn): return chr(nn+97) def LtoS(ls): return ''.join([chr(i+97) for i in ls]) def GI(V,E,Directed=False,index=0): org_inp=[] g=[[] for i in range(n)] for i in range(E): inp=LI() org_inp.append(inp) if index==0: inp[0]-=1 inp[1]-=1 if len(inp)==2: a,b=inp g[a].append(b) if not Directed: g[b].append(a) elif len(inp)==3: a,b,c=inp aa=(inp[0],inp[2]) bb=(inp[1],inp[2]) g[a].append(bb) if not Directed: g[b].append(aa) return g,org_inp def bit_combination(k,n=2): rt=[] for tb in range(n**k): s=[tb//(n**bt)%n for bt in range(k)] rt+=[s] return rt def show(*inp,end='\n'): if show_flg: print(*inp,end=end) YN=['Yes','No'] mo=10**9+7 inf=float('inf') l_alp=string.ascii_lowercase u_alp=string.ascii_uppercase ts=time.time() #sys.setrecursionlimit(10**5) input=lambda: sys.stdin.readline().rstrip() def ran_input(): import random n=random.randint(4,16) rmin,rmax=1,10 a=[random.randint(rmin,rmax) for _ in range(n)] return n,a show_flg=False show_flg=True ans=0 n,m,v,p=LI() a=LI() b=sorted(a)[::-1] def check(k): tot=m*v if k<=p-1: return True if b[p-1]>b[k]+m: return False tot-=m*p mx=b[k]+m #show((k,b[k],tot),p,v,mx,b[p:n]) for i in range(p,n): if i==k: continue tot-=min(max(0,mx-b[i]),m) #show(tot) if tot<=0: return True else: return False l,r=0,n while r-l>1: mid=(l+r)//2 if check(mid): l=mid else: r=mid #show(l,mid,r) ok=b[l] ans=sum([1 if i>=ok else 0 for i in b]) print(ans)
from heapq import heappush,heappop,heapify from collections import deque,defaultdict,Counter import itertools from itertools import permutations,combinations,groupby import sys import bisect import string import math import time import random def S_(): return input() def LS(): return [i for i in input().split()] def I(): return int(input()) def MI(): return map(int,input().split()) def LI(): return [int(i) for i in input().split()] def LI_(): return [int(i)-1 for i in input().split()] def StoI(): return [ord(i)-97 for i in input()] def ItoS(nn): return chr(nn+97) def LtoS(ls): return ''.join([chr(i+97) for i in ls]) def GI(V,E,Directed=False,index=0): org_inp=[] g=[[] for i in range(n)] for i in range(E): inp=LI() org_inp.append(inp) if index==0: inp[0]-=1 inp[1]-=1 if len(inp)==2: a,b=inp g[a].append(b) if not Directed: g[b].append(a) elif len(inp)==3: a,b,c=inp aa=(inp[0],inp[2]) bb=(inp[1],inp[2]) g[a].append(bb) if not Directed: g[b].append(aa) return g,org_inp def bit_combination(k,n=2): rt=[] for tb in range(n**k): s=[tb//(n**bt)%n for bt in range(k)] rt+=[s] return rt def show(*inp,end='\n'): if show_flg: print(*inp,end=end) YN=['Yes','No'] mo=10**9+7 inf=float('inf') l_alp=string.ascii_lowercase u_alp=string.ascii_uppercase ts=time.time() #sys.setrecursionlimit(10**5) input=lambda: sys.stdin.readline().rstrip() def ran_input(): import random n=random.randint(4,16) rmin,rmax=1,10 a=[random.randint(rmin,rmax) for _ in range(n)] return n,a show_flg=False show_flg=True ans=0 n,m,v,p=LI() a=LI() b=sorted(a)[::-1] def check(k): tot=m*v if k<=p-1: return True if b[p-1]>b[k]+m: return False tot-=m*p mx=b[k]+m for i in range(p-1,n): if i==k: continue tot-=min(max(0,mx-b[i]),m) if tot<=0: return True else: return False l,r=0,n while r-l>1: mid=(l+r)//2 if check(mid): l=mid else: r=mid ok=b[l] ans=sum([1 if i>=ok else 0 for i in b]) print(ans)
[ "control_flow.loop.range.bounds.lower.change", "expression.operation.binary.add" ]
634,700
634,701
u623819879
python
p02824
def nibutan(L): ok = len(L) ng = -1 while abs(ok - ng) > 1: mid = (ok + ng) // 2 if nasu(mid, L): ok = mid else: ng = mid return ok def nasu(n, L): p = L[n] + M if p < L[K]: return False m = (V - 1 - (n + P - 1)) * M if m <= 0: return True for i in range(n + 1, K): m -= p - L[i] if m <= 0: return True return False N, M, V, P = list(map(int, input().split())) A = list(map(int, input().split())) A.sort() K = N - P T = A[K] print(N - nibutan(A))
def nibutan(L): ok = len(L) ng = -1 while abs(ok - ng) > 1: mid = (ok + ng) // 2 if nasu(mid, L): ok = mid else: ng = mid return ok def nasu(n, L): p = L[n] + M if p < L[K]: return False m = (V - 1 - (n + P - 1)) * M if m <= 0: return True for i in range(n + 1, K + 1): m -= p - L[i] if m <= 0: return True return False N, M, V, P = list(map(int, input().split())) A = list(map(int, input().split())) A.sort() K = N - P T = A[K] print(N - nibutan(A))
[ "control_flow.loop.range.bounds.upper.change", "expression.operation.binary.add" ]
634,706
634,707
u456353530
python
p02832
N=int(input()) A=list(map(int,input().split())) t=1 ans=0 for i in range(N): if A[i]!=t: t+=1 else: ans+=1 if ans==N: print(-1) else: print(ans)
N=int(input()) A=list(map(int,input().split())) t=1 ans=0 for i in range(N): if A[i]==t: t+=1 else: ans+=1 if ans==N: print(-1) else: print(ans)
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
634,713
634,714
u387774811
python
p02832
N = int(input()) A = list(map(int, input().split())) nu = 1 bl = 0 if not 1 in A: print(-1) else: for i in range(1,N+1): if A[i] == nu: nu += 1 bl += 1 print(N-bl)
N = int(input()) A = list(map(int, input().split())) nu = 1 bl = 0 if not 1 in A: print(-1) else: for i in range(1,N+1): if A[i-1] == nu: nu += 1 bl += 1 print(N-bl)
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change", "misc.off_by_one" ]
634,723
634,724
u121698457
python
p02832
n=int(input()) a=list(map(int, input().split())) tmp_num=1 tmp_cnt=0 cnt=0 for i in range(n): if a[i]==tmp_num: tmp_num+=1 cnt+=tmp_cnt tmp_cnt=0 else: tmp_cnt+=1 print(-1 if tmp_cnt==len(a) else cnt)
n=int(input()) a=list(map(int, input().split())) tmp_num=1 tmp_cnt=0 cnt=0 for i in range(n): if a[i]==tmp_num: tmp_num+=1 cnt+=tmp_cnt tmp_cnt=0 else: tmp_cnt+=1 cnt+=tmp_cnt print(-1 if tmp_cnt==len(a) else cnt)
[]
634,728
634,729
u405660020
python
p02832
N = int(input()) A = list(map(int, input().split())) count = 0 x = -1 num = 1 for i in range(1,N+1): if A[i] == num: count += 1 num += 1 if count != 0: print(N-count) else: print(-1)
N = int(input()) A = list(map(int, input().split())) count = 0 x = -1 num = 1 for i in range(N): if A[i] == num: count += 1 num += 1 if count != 0: print(N-count) else: print(-1)
[ "call.arguments.change", "expression.operation.binary.remove" ]
634,730
634,731
u991134049
python
p02832
N = int(input()) A = list(map(int, input().split())) count = 0 x = -1 num = 1 for i in range(1,N+1): if a[i] == num: count += 1 num += 1 if count != 0: print(N-count) else: print(-1)
N = int(input()) A = list(map(int, input().split())) count = 0 x = -1 num = 1 for i in range(N): if A[i] == num: count += 1 num += 1 if count != 0: print(N-count) else: print(-1)
[ "call.arguments.change", "expression.operation.binary.remove", "identifier.change", "control_flow.branch.if.condition.change" ]
634,733
634,731
u991134049
python
p02832
n = int(input()) a = list(map(int,input().split())) h = 0 for i in range(1,n): if a[i] != i-h+1: h += 1 if h == n: print(-1) else: print(h)
n = int(input()) a = list(map(int,input().split())) h = 0 for i in range(0,n): if a[i] != i-h+1: h += 1 if h == n: print(-1) else: print(h)
[ "literal.number.integer.change", "call.arguments.change", "control_flow.loop.range.bounds.lower.change" ]
634,734
634,735
u227085629
python
p02832
from collections import deque n = int(input()) a = list(map(int,input().split())) q = deque(a) count = 1 ans = 0 for i in range(n): if q[0] == count: #print(q[0]) count += 1 q.popleft() else: q.popleft() if count == 0: print(-1) else: print(len(a)-count+1)
from collections import deque n = int(input()) a = list(map(int,input().split())) q = deque(a) count = 1 ans = 0 for i in range(n): if q[0] == count: count += 1 q.popleft() else: q.popleft() if count == 1: print(-1) else: print(len(a)-count+1)
[ "literal.number.integer.change", "control_flow.branch.if.condition.change" ]
634,738
634,739
u254221913
python
p02832
# -*- coding: utf-8 -*- """ Created on Sat May 9 16:33:03 2020 @author: shinba """ n = int(input()) a = list(map(input().split())) cnt = 0 st = 1 for i in range(n): if a[i] == st: st += 1 else: cnt += 1 if 1 in a: print(cnt) else: print(-1)
# -*- coding: utf-8 -*- """ Created on Sat May 9 16:33:03 2020 @author: shinba """ n = int(input()) a = list(map(int,input().split())) cnt = 0 st = 1 for i in range(n): if a[i] == st: st += 1 else: cnt += 1 if 1 in a: print(cnt) else: print(-1)
[ "call.arguments.add" ]
634,753
634,754
u496821919
python
p02832
def main(): ind = int(input()) t = list(map(int, input().split())) ans = [] for i in range(ind): if len(ans) + 1 == t[i]: ans.append(t[i]) count = -1 if len(ans) == 0 else ind - len(ans) print(ans) print(count) if __name__ == '__main__': main()
def main(): ind = int(input()) t = list(map(int, input().split())) ans = [] for i in range(ind): if len(ans) + 1 == t[i]: ans.append(t[i]) count = -1 if len(ans) == 0 else ind - len(ans) print(count) if __name__ == '__main__': main()
[ "call.remove" ]
634,763
634,764
u755180064
python
p02832
def main(): ind = int(input()) t = list(map(int, input().split())) ans = [] for i in range(ind): if len(ans) + 1 == t[i]: ans.append(t[i]) count = 0 if len(ans) == 0 else ind - len(ans) print(count) if __name__ == '__main__': main()
def main(): ind = int(input()) t = list(map(int, input().split())) ans = [] for i in range(ind): if len(ans) + 1 == t[i]: ans.append(t[i]) count = -1 if len(ans) == 0 else ind - len(ans) print(count) if __name__ == '__main__': main()
[ "assignment.value.change", "expression.operation.unary.add" ]
634,765
634,764
u755180064
python
p02832
N=int(input()) a=list(map(int,input().split())) ans=0 l=1 for i in a: if i!=l: ans+=1 else: l+=1 if ans==0: print("-1") else: print(ans)
N=int(input()) a=list(map(int,input().split())) ans=0 l=1 for i in a: if i!=l: ans+=1 else: l+=1 if ans==N: print("-1") else: print(ans)
[ "identifier.replace.add", "literal.replace.remove", "control_flow.branch.if.condition.change" ]
634,770
634,771
u225020286
python
p02832
N = int(input()) a = list(map(int,input().split())) BS = 1 for i in range(N): if a[i] == BS: BS += 1 if a[i] == 1: print(-1) else: print(N+1-BS)
N = int(input()) a = list(map(int,input().split())) BS = 1 for i in range(N): if a[i] == BS: BS += 1 if BS == 1: print(-1) else: print(N+1-BS)
[ "control_flow.branch.if.condition.change" ]
634,774
634,775
u758475901
python
p02832
n=int(input()) a=map(int,input().split()) i=1 for k in a: if k==i: i+=1 print(N-i+1 if i>1 else -1)
n=int(input()) a=map(int,input().split()) i=1 for k in a: if k==i: i+=1 print(n-i+1 if i>1 else -1)
[ "identifier.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
634,784
634,785
u345483150
python
p02832
n=int(input()) l=list(map(int,input().split())) t=1 ans=0 for i in l: if i==t: t+=1 else: ans+=1 if t==n: ans=-1 print(ans)
n=int(input()) l=list(map(int,input().split())) t=1 ans=0 for i in l: if i==t: t+=1 else: ans+=1 if t==1: ans=-1 print(ans)
[ "identifier.replace.remove", "literal.replace.add", "control_flow.branch.if.condition.change" ]
634,789
634,790
u065446124
python
p02832
n=int(input()) a=list(map(int,input().split())) i=1 cnt=0 for x in a: if x==i:i+=1 else:cnt+=1 if cnt==n:print(-1) print(cnt)
n=int(input()) a=list(map(int,input().split())) i=1 cnt=0 for x in a: if x==i:i+=1 else:cnt+=1 if cnt==n:print(-1) else:print(cnt)
[]
634,795
634,796
u751843916
python
p02832
N=int(input()) a=list(map(int,input().split())) c=0 n=1 for i in range(N): if a[i]==n: n+=1 else: c+=1 if c==n: print("-1") else: print(c)
N=int(input()) a=list(map(int,input().split())) c=0 n=1 for i in range(N): if a[i]==n: n+=1 else: c+=1 if c==N: print("-1") else: print(c)
[ "identifier.change", "control_flow.branch.if.condition.change" ]
634,799
634,800
u173148629
python
p02832
N=int(input()) a=list(map(int,input().split())) c=0 n=1 for i in range(N): if a[i]==n: n+=1 else: c+=1 if c==n: print("-1") else: print(c)
N=int(input()) a=list(map(int,input().split())) c=0 n=1 for i in range(N): if a[i]==n: n+=1 else: c+=1 if c==N: print("-1") else: print(c)
[ "identifier.change", "control_flow.branch.if.condition.change" ]
634,799
634,801
u173148629
python
p02832
N = int(input()) A = list(map(int, input().split())) i = 1 j = 0 cnt = 0 while j <= N-1: if i == A[j]: i += 1 j += 1 else: j += 1 cnt += 1 print(cnt if cnt < N-1 else "-1")
N = int(input()) A = list(map(int, input().split())) i = 1 j = 0 cnt = 0 while j <= N-1: if i == A[j]: i += 1 j += 1 else: j += 1 cnt += 1 print(cnt if cnt <= N-1 else "-1")
[ "expression.operator.compare.change", "call.arguments.change", "io.output.change" ]
634,825
634,826
u686036872
python
p02832
# ABC148D - Brick Break import bisect n=int(input()) a=list(map(int,input().split())) ans=0 for i in a: if ans+1==i: ans=i print(ans) if ans: print(n-ans) else: print(-1)
# ABC148D - Brick Break import bisect n=int(input()) a=list(map(int,input().split())) ans=0 for i in a: if ans+1==i: ans=i #print(ans) if ans: print(n-ans) else: print(-1)
[ "call.remove" ]
634,833
634,834
u859897687
python
p02832
n= int(input()) l=list(map(int, input().split())) i = 1 c= 0 for a in l: if a==1: i+=1 else: c+=1 print(c if c!=n else -1)
n= int(input()) l=list(map(int, input().split())) i = 1 c= 0 for a in l: if a==i: i+=1 else: c+=1 print(c if c!=n else -1)
[ "identifier.replace.add", "literal.replace.remove", "control_flow.branch.if.condition.change" ]
634,839
634,840
u088115428
python
p02832
n=int(input()) a=list(map(int,input().split())) s=0 j=0 if 1 not in a: print(-1) exit() for k in range(n): for i in range(j,n): if a[i]==k+1: s=s+i-j j=i+1 break else: print(s) exit() print(s)
n=int(input()) a=list(map(int,input().split())) s=0 j=0 if 1 not in a: print(-1) exit() for k in range(n): for i in range(j,n): if a[i]==k+1: s=s+i-j j=i+1 break else: print(s+(n-j)) exit() print(s)
[ "expression.operation.binary.add" ]
634,841
634,842
u064434060
python
p02832
N = int(input()) a = list(map(int, input().split())) now = 1 for ai in a: if ai == now: now += 1 if now == 1: print(-1) else: print(N - now + 2)
N = int(input()) a = list(map(int, input().split())) now = 1 for ai in a: if ai == now: now += 1 if now == 1: print(-1) else: print(N - now + 1)
[ "literal.number.integer.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
634,855
634,856
u767664985
python
p02832
n = int(input()) R = list(map(int, input().split())) c, i = 0, 1 for r in R: if r==i: i+=1 else: c+=1 print(c if c<N else '-1')
n = int(input()) R = list(map(int, input().split())) c, i = 0, 1 for r in R: if r==i: i+=1 else: c+=1 print(c if c<n else '-1')
[ "identifier.change", "call.arguments.change", "io.output.change" ]
634,862
634,863
u641406334
python
p02832
n = int(input()) a = [int(i) for i in input().split()] c = 0 d = 0 for i in range(n): for j in range(c, n): if i + 1 == a[j]: c = j d += 1 break if c == n - 1: break if 1 not in a: print(-1) else: print(n - d)
n = int(input()) a = [int(i) for i in input().split()] c = 0 d = 0 for i in range(n): for j in range(c, n): if i + 1 == a[j]: c = j d += 1 break else: break if c == n - 1: break if 1 not in a: print(-1) else: print(n - d)
[ "control_flow.break.add" ]
634,864
634,865
u540631540
python
p02832
N = int(input()) li = list(map(int, input().split())) try: position1 = li.index(1) except: print(-1) exit() kowasu = position1 target = 2 position = position1 + 1 while True: flag = False for i in range(position, len(li)): if li[i] == target: flag = True kowasu += i - position # print(kowasu) # print(i) tekito = i break if flag: target += 1 if tekito == len(li) - 1: break position = tekito + 1 else: print(position) kowasu += len(li) - position break print(kowasu)
N = int(input()) li = list(map(int, input().split())) try: position1 = li.index(1) except: print(-1) exit() kowasu = position1 target = 2 position = position1 + 1 while True: flag = False for i in range(position, len(li)): if li[i] == target: flag = True kowasu += i - position # print(kowasu) # print(i) tekito = i break if flag: target += 1 if tekito == len(li) - 1: break position = tekito + 1 else: kowasu += len(li) - position break print(kowasu)
[ "call.remove" ]
634,866
634,867
u634046173
python
p02832
N = int(input()) li = list(map(int, input().split())) try: position1 = li.index(1) except: print(-1) exit() kowasu = position1 target = 2 position = position1 + 1 while True: flag = False for i in range(position, len(li)): if li[i] == target: flag = True kowasu += i - position # print(kowasu) # print(i) tekito = i break if flag: target += 1 if tekito == len(li) - 1: break position = tekito + 1 else: kowasu += len(li) - position - 1 break print(kowasu)
N = int(input()) li = list(map(int, input().split())) try: position1 = li.index(1) except: print(-1) exit() kowasu = position1 target = 2 position = position1 + 1 while True: flag = False for i in range(position, len(li)): if li[i] == target: flag = True kowasu += i - position # print(kowasu) # print(i) tekito = i break if flag: target += 1 if tekito == len(li) - 1: break position = tekito + 1 else: kowasu += len(li) - position break print(kowasu)
[ "expression.operation.binary.remove" ]
634,868
634,867
u634046173
python
p02832
# シンプルに左から探索するだけ N = int(input()) A = [int(i) for i in input().split()] L = [i+1 for i in range(3)] cnt = 0 k = 0 for j in A: if j == L[k]: k += 1 else: cnt += 1 if k == 0: print(-1) else: print(cnt)
# シンプルに左から探索するだけ N = int(input()) A = [int(i) for i in input().split()] L = [i+1 for i in range(N)] cnt = 0 k = 0 for j in A: if j == L[k]: k += 1 else: cnt += 1 if k == 0: print(-1) else: print(cnt)
[ "assignment.value.change", "identifier.replace.add", "literal.replace.remove", "call.arguments.change", "control_flow.loop.range.bounds.upper.change" ]
634,875
634,876
u781758937
python
p02832
n = int(input()) block = list(map(int,input().split())) count = 0 num = 1 for i in range(0,n): if block[i] == num: num += 1 else: count += 1 if count == 0 and num != 2: print(-1) else: print(count)
n = int(input()) block = list(map(int,input().split())) count = 0 num = 1 for i in range(0,n): if block[i] == num: num += 1 else: count += 1 if count == n: print(-1) else: print(count)
[ "identifier.replace.add", "literal.replace.remove", "control_flow.branch.if.condition.change" ]
634,879
634,880
u561883765
python
p02832
n = int(input()) block = list(map(int,input().split())) count = 0 num = 1 for i in range(0,n): if block[i] == num: num += 1 else: count += 1 if count == 0: print(-1) else: print(count)
n = int(input()) block = list(map(int,input().split())) count = 0 num = 1 for i in range(0,n): if block[i] == num: num += 1 else: count += 1 if count == n: print(-1) else: print(count)
[ "identifier.replace.add", "literal.replace.remove", "control_flow.branch.if.condition.change" ]
634,881
634,880
u561883765
python
p02832
n=int(input()) a=list(map(int,input().split())) m=1 for i in range(n): if a[i]==m: m+=1 if m==1: print(-1) print(n-m+1)
n=int(input()) a=list(map(int,input().split())) m=1 for i in range(n): if a[i]==m: m+=1 if m==1: print(-1) else: print(n-m+1)
[]
634,896
634,897
u464205401
python
p02832
N = int(input()) a = list(map(int, input().split())) c = [] i=1 for k in range(N): if a[k]==i: i += 1 else: c.append(a[k]) if len(c)>= len(a): print(-1) else: print(len(a)-len(c))
N = int(input()) a = list(map(int, input().split())) c = [] i=1 for k in range(N): if a[k]==i: i += 1 else: c.append(a[k]) if len(c)>=len(a): print(-1) else: print(len(c))
[ "expression.operation.binary.remove" ]
634,916
634,917
u906481659
python
p02832
_ = input() l = list(map(int, input().split())) print(l) br = 0 cn = 1 for i, n in enumerate(l): #print([i,n,cn]) if n != cn: br += 1 else: cn += 1 if br == len(l): print(-1) else: print(br)
_ = input() l = list(map(int, input().split())) br = 0 cn = 1 for i, n in enumerate(l): #print([i,n,cn]) if n != cn: br += 1 else: cn += 1 if br == len(l): print(-1) else: print(br)
[ "call.remove" ]
634,922
634,923
u190875453
python
p02832
ni = lambda: int(input()) nm = lambda: map(int, input().split()) nl = lambda: list(map(int, input().split())) n = ni() a = nl() cnt = 0 shift = 0 for i in range(n): if(a[cnt+shift]==cnt+1): cnt+=1 else: shift+=1 if(shift==n-1): print(-1) exit() print(shift)
ni = lambda: int(input()) nm = lambda: map(int, input().split()) nl = lambda: list(map(int, input().split())) n = ni() a = nl() cnt = 0 shift = 0 for i in range(n): if(a[cnt+shift]==cnt+1): cnt+=1 else: shift+=1 if(cnt==0): print(-1) exit() print(shift)
[ "identifier.change", "control_flow.branch.if.condition.change", "identifier.replace.remove", "literal.replace.add", "expression.operation.binary.remove" ]
634,924
634,925
u963915126
python