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
p02712
anser=0 counter=gets.chomp.to_i 1.upto counter do |c| if c%3 != 0 && c%5 != 0 answer = anser+c end end puts answer
answer=0 counter=gets.chomp.to_i 1.upto counter do |c| if c%3 != 0 && c%5 != 0 answer = answer+c end end puts answer
[ "assignment.variable.change", "identifier.change", "assignment.value.change", "expression.operation.binary.change" ]
473,912
473,913
u562148988
ruby
p02712
a = gets.chomp.to_i sum = 0 (1...a).each do |i| unless (i%3==0 || i%5==0) sum += i end end puts sum
a = gets.chomp.to_i sum = 0 (1..a).each do |i| unless (i%3==0 || i%5==0) sum += i end end puts sum
[]
474,043
474,044
u137521549
ruby
p02712
n = gets.to_i cnt = 0 n.times do |i| cnt += i if i % 3 != 0 and i % 5 != 0 end p cnt
n = gets.to_i cnt = 0 1.upto(n) do |i| cnt += i if i % 3 != 0 and i % 5 != 0 end p cnt
[ "identifier.replace.remove", "literal.replace.add", "identifier.change", "call.arguments.add" ]
474,193
474,194
u084335038
ruby
p02712
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE'] def inpf() a=gets.chomp.split(" ").map(&:to_f)end def inps() a=gets.chomp.split(" ")end def copy(a) Marshal.load(Marshal.dump(a)) end def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end def na(n,d=0) Array.new(n,d)end def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end def inp() a=gets.chomp.split(" ").map(&:to_i)end def r_up(a, b) (a+b-1)/b end def sum(a) a.inject(:+) end def big(a,b) return (a>b)? a:b end def small(a,b) return (a<b)? a:b end n = inp[0] ans = 0 (1..n).each do |i| if i%3==0 or i%5==0 ans += i end end p ans
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE'] def inpf() a=gets.chomp.split(" ").map(&:to_f)end def inps() a=gets.chomp.split(" ")end def copy(a) Marshal.load(Marshal.dump(a)) end def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end def na(n,d=0) Array.new(n,d)end def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end def inp() a=gets.chomp.split(" ").map(&:to_i)end def r_up(a, b) (a+b-1)/b end def sum(a) a.inject(:+) end def big(a,b) return (a>b)? a:b end def small(a,b) return (a<b)? a:b end n = inp[0] ans = 0 (1..n).each do |i| if i%3!=0 and i%5!=0 ans += i end end p ans
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
474,372
474,373
u145123922
ruby
p02712
n = 1000000.to_i ans = 0 1.upto(n) do |i| ans += i unless i%15==0 || i%3==0 || i%5==0 end puts ans
n = gets.to_i ans = 0 1.upto(n) do |i| ans += i unless i%15==0 || i%3==0 || i%5==0 end puts ans
[ "assignment.value.change", "identifier.replace.add", "literal.replace.remove" ]
474,439
474,440
u523351024
ruby
p02712
n=gets.to_i r = (0..n).select{|x| x % 3==0 || x%5==0}.sum print r
n=gets.to_i r = (0..n).select{|x| x % 3!=0 && x%5!=0}.sum print r
[ "misc.opposites", "expression.operator.compare.change", "assignment.value.change", "expression.operation.binary.change" ]
474,762
474,763
u702482655
ruby
p02713
K=gets.chomp.to_i i=0 1.upto(K){|a| 1.upto(K){|b| 1.upto(K){|c| d=a.gcd(b).gcd(c) if i < d i=d end } } } puts i
K=gets.chomp.to_i i=0 1.upto(K){|a| 1.upto(K){|b| 1.upto(K){|c| d=a.gcd(b).gcd(c) i+=d } } } puts i
[ "assignment.value.change" ]
475,251
475,252
u085647568
ruby
p02713
class Array def gcd self.inject{|a,b| a.gcd(b)} end end n = gets.to_i renban = [*1..n] kumiawase = renban.repeated_combination(3).to_a result = 0 kumiawase.each do |a| size = a.uniq.size if size == 1 result += a.gcd elsif size == 2 result += (a.gcd * 3) else result += (a.gcd * 9) end end puts result
class Array def gcd self.inject{|a,b| a.gcd(b)} end end n = gets.to_i renban = [*1..n] kumiawase = renban.repeated_combination(3).to_a result = 0 kumiawase.each do |a| size = a.uniq.size if size == 1 result += a.gcd elsif size == 2 result += (a.gcd * 3) else result += (a.gcd * 6) end end puts result
[ "literal.number.integer.change", "expression.operation.binary.change" ]
475,989
475,990
u634482428
ruby
p02714
N = gets.to_i S = gets.chomp counter = S.chars.tally ans = counter['R'] * counter['G'] * counter['B'] 1.upto(N) do |i| j = 0 while j + 2 * i < N ans -= 1 if S[j] != S[j + i] && S[j + i] != S[j + 2 * i] && S[j] != S[j + 2 * i] j += 1 end end puts ans
N = gets.to_i S = gets.chomp counter = S.chars.tally counter.default = 0 ans = counter['R'] * counter['G'] * counter['B'] 1.upto(N) do |i| j = 0 while j + 2 * i < N ans -= 1 if S[j] != S[j + i] && S[j + i] != S[j + 2 * i] && S[j] != S[j + 2 * i] j += 1 end end puts ans
[ "assignment.add" ]
476,084
476,085
u740836226
ruby
p02714
*,S = $<.read.split X,Y,Z,t,a,b = [],[],[],0,S[0] S.size.times {|i| if a == s=S[i]; X<<i elsif s == b||=s; Y<<i else Z<<i end } [X,Y,Z].permutation {|x,y,z| b,ys,zs,s = 0,y.size,z.size,S[z[0]] x.each_with_index {|i,a| k = z[c=0] b += 1 until i < y[b] rescue break b.upto(ys-1) {|b| l = (j=y[b])*2 - i k = z[c+=1] until j < k rescue break t += S[l]==s ? zs-c-1 : zs-c } } } p t
*,S = $<.read.split X,Y,Z,t,a,b = [],[],[],0,S[0] S.size.times {|i| if a == s=S[i]; X<<i elsif s == b||=s; Y<<i else Z<<i end } [X,Y,Z].permutation {|x,y,z| b,ys,zs,s = 0,y.size,z.size,S[z[0]||0] x.each_with_index {|i,a| k = z[c=0] b += 1 until i < y[b] rescue break b.upto(ys-1) {|b| l = (j=y[b])*2 - i k = z[c+=1] until j < k rescue break t += S[l]==s ? zs-c-1 : zs-c } } } p t
[]
477,155
477,156
u720281401
ruby
p02714
line = readlines.map(&:chomp) n = line[0].to_i s = line[1] r_num = [] g_num = [] b_num = [] for i in 0..n-1 if s[i] == "R" then r_num.push(i) elsif s[i] == "G" then g_num.push(i) elsif s[i] == "B" then b_num.push(i) end end result = r_num.length * g_num.length * b_num.length for i in r_num for j in g_num c1 = [i,j].sort[0] c2 = [i,j].sort[1] d = c2 - c1 c3 = c2 + d c0 = c1 - d cm = (c2 - c1) / 2 if c0 >= 0 and s[c0] == "B" result = result - 1 end if c3 <= n - 1 and s[c3] == "B" result = result - 1 end if (c2 - c1) % 2 == 0 and s[cm] == "B" result = result - 1 end end end print result
line = readlines.map(&:chomp) n = line[0].to_i s = line[1] r_num = [] g_num = [] b_num = [] for i in 0..n-1 if s[i] == "R" then r_num.push(i) elsif s[i] == "G" then g_num.push(i) elsif s[i] == "B" then b_num.push(i) end end result = r_num.length * g_num.length * b_num.length for i in r_num for j in g_num c1 = [i,j].sort[0] c2 = [i,j].sort[1] d = c2 - c1 c3 = c2 + d c0 = c1 - d cm = (c2 + c1) / 2 if c0 >= 0 and s[c0] == "B" result = result - 1 end if c3 <= n - 1 and s[c3] == "B" result = result - 1 end if (c2 + c1) % 2 == 0 and s[cm] == "B" result = result - 1 end end end print result
[ "misc.opposites", "expression.operator.arithmetic.change", "assignment.value.change", "expression.operation.binary.change", "control_flow.branch.if.condition.change" ]
478,179
478,180
u569559028
ruby
p02714
n = gets.chomp.to_i s = gets.chomp r_sum = [] g_sum = [] b_sum = [] rgb = [] r = g = b = 0 s.each_char do |c| rgb << c r+=1 if c == "R" g+=1 if c == "G" b+=1 if c == "B" r_sum << r g_sum << g b_sum << b end i = 0 sum = 0 s.each_char do if s[i] == "R" sum += (g_sum[-1] - g_sum[i]) * (b_sum[-1] - b_sum[i]) n = 1 while (i + 2*n < s.size ) c1 = s[i+n] c2 = s[i+2*n] c1, c2 = [c2, c1] if c2 < c1 sum -= 1 if c1 == "B" && c2 == "G" n+=1 end end if s[i] == "G" sum += (r_sum[-1] - r_sum[i]) * (b_sum[-1] - b_sum[i]) while (i + 2*n < s.size ) c1 = s[i+n] c2 = s[i+2*n] c1, c2 = [c2, c1] if c2 < c1 sum -= 1 if c1 == "B" && c2 == "R" n+=1 end end if s[i] == "B" sum += (r_sum[-1] - r_sum[i]) * (g_sum[-1] - g_sum[i]) while (i + 2*n < s.size ) c1 = s[i+n] c2 = s[i+2*n] c1, c2 = [c2, c1] if c2 < c1 sum -= 1 if c1 == "G" && c2 == "R" n+=1 end end i+=1 end puts sum
n = gets.chomp.to_i s = gets.chomp r_sum = [] g_sum = [] b_sum = [] rgb = [] r = g = b = 0 s.each_char do |c| rgb << c r+=1 if c == "R" g+=1 if c == "G" b+=1 if c == "B" r_sum << r g_sum << g b_sum << b end i = 0 sum = 0 s.each_char do if s[i] == "R" sum += (g_sum[-1] - g_sum[i]) * (b_sum[-1] - b_sum[i]) n = 1 while (i + 2*n < s.size ) c1 = s[i+n] c2 = s[i+2*n] c1, c2 = [c2, c1] if c2 < c1 sum -= 1 if c1 == "B" && c2 == "G" n+=1 end end if s[i] == "G" sum += (r_sum[-1] - r_sum[i]) * (b_sum[-1] - b_sum[i]) n = 1 while (i + 2*n < s.size ) c1 = s[i+n] c2 = s[i+2*n] c1, c2 = [c2, c1] if c2 < c1 sum -= 1 if c1 == "B" && c2 == "R" n+=1 end end if s[i] == "B" sum += (r_sum[-1] - r_sum[i]) * (g_sum[-1] - g_sum[i]) n = 1 while (i + 2*n < s.size ) c1 = s[i+n] c2 = s[i+2*n] c1, c2 = [c2, c1] if c2 < c1 sum -= 1 if c1 == "G" && c2 == "R" n+=1 end end i+=1 end puts sum
[ "assignment.add" ]
479,513
479,514
u650620788
ruby
p02717
a=gets.split a.shift(a.pop) puts a.join ' '
a=gets.chomp.split a.unshift(a.pop) puts a.join ' '
[ "call.add", "identifier.change" ]
480,016
480,017
u966810027
ruby
p02717
a=gets.chomp.split puts a.shift(a.pop).join ' '
a=gets.chomp.split a.unshift(a.pop) puts a.join ' '
[ "io.output.change", "call.remove", "identifier.change", "call.arguments.change", "call.add" ]
480,018
480,017
u966810027
ruby
p02717
x, y, z = gets.split.map(&:to_i) a = [y, z, x] p a.join(' ')
x, y, z = gets.split.map(&:to_i) a = [z, x, y] puts a.join(' ')
[ "literal.array.change", "call.function.change", "io.output.change" ]
480,162
480,163
u438160186
ruby
p02717
puts `dd`.split.map(&:to_i).rotate(1)*" "
puts (`dd`.split.map &:to_i).rotate(2)*" "
[ "call.arguments.change", "literal.number.integer.change", "expression.operation.binary.change", "io.output.change" ]
480,230
480,231
u670503797
ruby
p02717
x, y, z = gets.split.map!(&:to_i) puts [z, x, y] % " " load __FILE__ unless $stdin.eof?
x, y, z = gets.split.map!(&:to_i) puts [z, x, y].join(" ") load __FILE__ unless $stdin.eof?
[ "call.arguments.change", "expression.operation.binary.change", "call.add" ]
480,618
480,619
u960319975
ruby
p02717
def main(str) a, b, c = str.split(" ") [c, a, b].join(" ") end main($stdin.read.chomp)
def main(str) a, b, c = str.split(" ") [c, a, b].join(" ") end puts main($stdin.read.chomp)
[ "io.output.change", "call.add" ]
480,826
480,827
u715816272
ruby
p02717
x, y, z = gets.chomp.split.map(&to_i) puts [z, x, y].join(" ")
x, y, z = gets.chomp.split.map(&:to_i) puts [z, x, y].join(" ")
[ "assignment.value.change", "call.arguments.change" ]
480,852
480,853
u482840940
ruby
p02717
int = gets.split(" ").chomp.map(&:to_i) print "#{int[2]} #{int[0]} #{int[1]}"
# Your code here! int = gets.chomp.split(" ").map(&:to_i) print "#{int[2]} #{int[0]} #{int[1]}"
[ "call.add", "call.remove" ]
480,854
480,855
u670430370
ruby
p02717
number = gets.split.map(&:to_i) number.rotate.each do |n| print n, " " end
number = gets.split.map(&:to_i) number.rotate(2).each do |n| print n, " " end
[ "call.arguments.add" ]
481,055
481,056
u771131483
ruby
p02717
n = gets.chop.split("") n[0], n[1] = n[1], n[0] n[0], n[2] = n[2], n[0] puts n[0] + " " + n[1] + " " + n[2]
n = gets.chomp.split n[0], n[1] = n[1], n[0] n[0], n[2] = n[2], n[0] puts n[0] + " " + n[1] + " " + n[2]
[ "assignment.value.change", "identifier.change", "call.arguments.change" ]
481,091
481,092
u020467031
ruby
p02718
n,m,*a=gets.split.map &:to_i s=a.sum puts a.count{4*m*_1>=s}>=m ? :Yes: :No
n,m,*a=`dd`.split.map &:to_i s=a.sum puts a.count{4*m*_1>=s}>=m ? :Yes: :No
[ "assignment.value.change" ]
481,393
481,394
u657913472
ruby
p02718
N,M = gets.split(" ").map(&:to_i) A = gets.split(" ").map(&:to_i) l = A.sum / (4*M) passing = A.select { |num| l<=num } ans = M<=passing.length ? "Yes" : "No" puts ans
N,M = gets.split(" ").map(&:to_i) A = gets.split(" ").map(&:to_i) l = A.sum.to_f / (4*M) passing = A.select { |num| l<=num } ans = M<=passing.length ? "Yes" : "No" puts ans
[ "call.add" ]
481,517
481,518
u192433528
ruby
p02718
n, m = gets.split.map(&:to_i) ai = gets.split.map(&:to_i).sort.reverse sum = ai.inject(:+) puts 4*m*ai[m-1] > sum ? "Yes" : "No"
n, m = gets.split.map(&:to_i) ai = gets.split.map(&:to_i).sort.reverse sum = ai.inject(:+) puts 4*m*ai[m-1] >= sum ? "Yes" : "No"
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
481,554
481,555
u358554431
ruby
p02718
# frozen_string_literal: true N, M = gets.split.map(&:to_i) a = gets.split.map(&:to_i) puts(a.filter { |n| n >= a.sum / (4 * M) }.count >= M ? 'Yes' : 'No')
# frozen_string_literal: true N, M = gets.split.map(&:to_i) a = gets.split.map(&:to_i) puts(a.filter { |n| n >= a.sum / (4.0 * M) }.count >= M ? 'Yes' : 'No')
[ "control_flow.branch.if.condition.change" ]
481,613
481,614
u326440422
ruby
p02718
N, M = gets.split(" ").map {|s| s.to_i } arr = gets.split(" ").map {|s| s.to_i } sarr = arr.sort total = sarr.sum puts sarr[-M] * 4 * M >= total ? "yes" : "no"
N, M = gets.split(" ").map {|s| s.to_i } arr = gets.split(" ").map {|s| s.to_i } sarr = arr.sort total = sarr.sum puts sarr[-M] * 4 * M >= total ? "Yes" : "No"
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
481,750
481,751
u771770008
ruby
p02718
n, m = gets.chomp.split(" ").map(&:to_i) arr = gets.chomp.split(" ").map(&:to_i) total = arr.sum if arr.select { |a| a >= total / (4 * m) }.count >= m puts "Yes" else puts "No" end
n, m = gets.chomp.split(" ").map(&:to_i) arr = gets.chomp.split(" ").map(&:to_i) total = arr.sum if arr.select { |a| a >= total.to_f / (4 * m) }.count >= m puts "Yes" else puts "No" end
[ "control_flow.branch.if.condition.change", "call.add" ]
481,752
481,753
u469583382
ruby
p02718
N, M = gets.split.map(&:to_i) A = gets.split.map(&:to_i).sort puts A[N-M]<A.sum/(4*M) ? "No" : "Yes"
N, M = gets.split.map(&:to_i) A = gets.split.map(&:to_i).sort puts A[N-M]<A.sum.to_f/(4*M) ? "No" : "Yes"
[ "control_flow.branch.if.condition.change", "call.add" ]
481,754
481,755
u244203620
ruby
p02718
x,y=gets.split.map!(&:to_i) s=gets.split.map!(&:to_i) s=s.sort.reverse max=s.sum if s[y-1]>=(max/(4*y)) puts "Yes" else puts "No" end
x,y=gets.split.map!(&:to_f) s=gets.split.map!(&:to_i) s=s.sort.reverse max=s.sum if s[y-1]>=(max/(4*y)) puts "Yes" else puts "No" end
[ "assignment.value.change", "call.arguments.change" ]
481,982
481,983
u977506075
ruby
p02718
x,y=gets.split.map!(&:to_i) s=gets.split.map!(&:to_i) s.sort.reverse! max=s.sum if s[y-1]>=(max/(4*y)) puts "Yes" else puts "No" end
x,y=gets.split.map!(&:to_f) s=gets.split.map!(&:to_i) s=s.sort.reverse max=s.sum if s[y-1]>=(max/(4*y)) puts "Yes" else puts "No" end
[ "assignment.value.change", "call.arguments.change", "identifier.change" ]
481,985
481,983
u977506075
ruby
p02718
x,y=gets.split.map!(&:to_i) s=gets.split.map!(&:to_i) s.sort.reverse! max=s.max if s[y-1]>=(max/(4*y)) puts "Yes" else puts "No" end
x,y=gets.split.map!(&:to_f) s=gets.split.map!(&:to_i) s=s.sort.reverse max=s.sum if s[y-1]>=(max/(4*y)) puts "Yes" else puts "No" end
[ "assignment.value.change", "call.arguments.change", "identifier.change" ]
481,986
481,983
u977506075
ruby
p02718
x,y=gets.split.map!(&:to_i) s=gets.split.map!(&:to_i) s=s.sort.reverse max=s.sum if s[y-1]>=(max/(4*y)) puts "Yes" else puts "No" end
x,y=gets.split.map!(&:to_f) s=gets.split.map!(&:to_i) s=s.sort.reverse max=s.sum if s[y-1]>=(max/(4*y)).to_f puts "Yes" else puts "No" end
[ "assignment.value.change", "call.arguments.change", "control_flow.branch.if.condition.change", "call.add" ]
481,982
481,988
u977506075
ruby
p02718
N,M = gets.strip.split.map(&:to_i) vote = gets.strip.split.map(&:to_i) S = vote.sum sum = 0 (0..N-1).each do |i| vote[i] >= (S.to_f)/(4*M) sum += 1 end if sum >= M then puts "Yes" else puts "No" end
N,M = gets.strip.split.map(&:to_i) vote = gets.strip.split.map(&:to_i) S = vote.sum sum = 0 (0..N-1).each do |i| if vote[i] >= (S.to_f)/(4*M) then sum += 1 end end if sum >= M then puts "Yes" else puts "No" end
[]
482,005
482,006
u313103408
ruby
p02718
n, m = gets.chomp.split(' ').map(&:to_i) a = gets.chomp.split(' ').map(&:to_i) count = 0 b = a.sum / (4.0 * m) a.each{|i| if(i > b) count += 1 end } if(count < m) puts "No" else puts "Yes" end
n, m = gets.chomp.split(' ').map(&:to_i) a = gets.chomp.split(' ').map(&:to_i) count = 0 b = a.sum / (4.0 * m) a.each{|i| if(i >= b) count += 1 end } if(count < m) puts "No" else puts "Yes" end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
482,256
482,257
u614201073
ruby
p02718
n, m = gets.chomp.split(' ').map(&:to_i) a = gets.chomp.split(' ').map(&:to_i) count = 0 b = a.sum / (4.0 * m) puts b a.each{|i| if(i > b) count += 1 end } if(count < m) puts "No" else puts "Yes" end
n, m = gets.chomp.split(' ').map(&:to_i) a = gets.chomp.split(' ').map(&:to_i) count = 0 b = a.sum / (4.0 * m) a.each{|i| if(i >= b) count += 1 end } if(count < m) puts "No" else puts "Yes" end
[ "call.remove", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
482,258
482,257
u614201073
ruby
p02718
n, m = gets.chomp.split(' ').map(&:to_i) a = gets.chomp.split(' ').map(&:to_i) count = 0 b = a.sum / (4 * m) a.each{|i| if(i > b) count += 1 end } if(count < m) puts "No" else puts "Yes" end
n, m = gets.chomp.split(' ').map(&:to_i) a = gets.chomp.split(' ').map(&:to_i) count = 0 b = a.sum / (4.0 * m) a.each{|i| if(i >= b) count += 1 end } if(count < m) puts "No" else puts "Yes" end
[ "assignment.value.change", "expression.operation.binary.change", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
482,259
482,257
u614201073
ruby
p02718
n, m = gets.chomp.split(' ').map(&:to_i) a = gets.chomp.split(' ').map(&:to_i) count = 0 b = a.sum / (4 * m) a.each{|i| if(i >= b) count += 1 end } if(count >= m) puts "Yes" else puts "No" end
n, m = gets.chomp.split(' ').map(&:to_i) a = gets.chomp.split(' ').map(&:to_i) count = 0 b = a.sum / (4.0 * m) a.each{|i| if(i >= b) count += 1 end } if(count < m) puts "No" else puts "Yes" end
[ "assignment.value.change", "expression.operation.binary.change", "expression.operator.compare.change", "control_flow.branch.if.condition.change", "call.remove", "call.add" ]
482,260
482,257
u614201073
ruby
p02718
n, m = gets.chomp.split(' ').map(&:to_i) a = gets.chomp.split(' ').map(&:to_i) count = 0 b = a.sum / (4 * m) a.each{|i| if(i > b) count += 1 end } if(count < m) puts "No" else puts "Yes" end
n, m = gets.chomp.split(' ').map(&:to_i) a = gets.chomp.split(' ').map(&:to_i) count = 0 b = a.sum.to_f / (4 * m) a.each{|i| if(i >= b) count += 1 end } if(count < m) puts "No" else puts "Yes" end
[ "call.add", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
482,259
482,261
u614201073
ruby
p02718
n, m = gets.chomp.split(" ").map(&:to_i) arr = gets.chomp.split(" ").map(&:to_i) arr_sum = arr.sum filtered = arr.select { |a| a >= arr_sum / (4 * m) } if filtered.count >= m puts "Yes" else puts "No" end
n, m = gets.chomp.split(" ").map(&:to_i) arr = gets.chomp.split(" ").map(&:to_i) arr_sum = arr.sum filtered = arr.select { |a| a >= arr_sum.to_f / (4 * m) } if filtered.count >= m puts "Yes" else puts "No" end
[ "call.add" ]
482,262
482,263
u614201073
ruby
p02718
n,m = gets.split(' ').map(&:to_i) a = gets.split(' ').map(&:to_i).sort.reverse minVote = a.sum / (4.0*m) puts a[m-1] > minVote ? 'Yes' : 'No'
n,m = gets.split(' ').map(&:to_i) a = gets.split(' ').map(&:to_i).sort.reverse minVote = a.sum / (4.0*m) puts a[m-1] >= minVote ? 'Yes' : 'No'
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
482,533
482,534
u932417742
ruby
p02718
n,m = gets.split(' ').map(&:to_i) a = gets.split(' ').map(&:to_i).sort minVote = a.sum / (4*m) answer = true m.times do compare = a.pop answer = false if compare <= minVote end puts answer ? 'Yes' : 'No'
n,m = gets.split(' ').map(&:to_i) a = gets.split(' ').map(&:to_i).sort minVote = a.sum / (4.0*m) answer = true m.times do |i| compare = a.pop answer = false if compare < minVote end puts answer ? 'Yes' : 'No'
[ "assignment.value.change", "expression.operation.binary.change", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
482,535
482,536
u932417742
ruby
p02718
n,m = gets.split(' ').map(&:to_i) a = gets.split(' ').map(&:to_i).sort minVote = a.sum / (4*m) answer = true m.times do compare = a.pop answer = false if compare < minVote end puts answer ? 'Yes' : 'No'
n,m = gets.split(' ').map(&:to_i) a = gets.split(' ').map(&:to_i).sort minVote = a.sum / (4.0*m) answer = true m.times do |i| compare = a.pop answer = false if compare < minVote end puts answer ? 'Yes' : 'No'
[ "assignment.value.change", "expression.operation.binary.change" ]
482,537
482,536
u932417742
ruby
p02718
n,m=gets.split.map(&:to_i) a=gets.split.map(&:to_i).sort s=a.inject(&:+) puts (a[0,m].all?{|x| 4*m*x >= s } ? "Yes" : "No")
n,m=gets.split.map(&:to_i) a=gets.split.map(&:to_i).sort.reverse s=a.inject(&:+) puts (a[0,m].all?{|x| 4*m*x >= s } ? "Yes" : "No")
[ "call.add" ]
482,702
482,703
u056944756
ruby
p02718
n, m = gets.split.map(&:to_i) products_vote = (gets.split.map(&:to_i))#.sort!.reverse! # if <= products.sum / (4 * m) products_vote_sum = products_vote.sum count = 0 #puts n, m border = products_vote_sum * (1.0 / (4.0 * m)) #puts border (0..n-1).each { |product| if border < products_vote[product] count += 1 end } if count >= m puts "Yes" else puts "No" end
n, m = gets.split.map(&:to_i) products_vote = (gets.split.map(&:to_i)).sort.reverse products_vote_sum = products_vote.sum count = 0 border = products_vote_sum * (1.0 / (4.0 * m)) (0..n-1).each { |product| if border <= products_vote[product] count += 1 end # print border, " ",products_vote[product],"\n" } if count >= m puts "Yes" else puts "No" end
[ "call.add", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
482,741
482,742
u635857549
ruby
p02718
n, m = gets.split.map(&:to_i) products_vote = (gets.split.map(&:to_i))#.sort!.reverse! # if <= products.sum / (4 * m) products_vote_sum = products_vote.sum count = 0 #puts n, m border = products_vote_sum * (1.0 / (4.0 * m)) #puts border (0..n-1).each { |product| if border < products_vote[product] count += 1 end } if count >= m puts "Yes" else puts "No" end
n, m = gets.split.map(&:to_i) products_vote = (gets.split.map(&:to_i)).sort.reverse products_vote_sum = products_vote.sum count = 0 border = products_vote_sum * (1.0 / (4.0 * m)) (0..n-1).each { |product| if border <= products_vote[product] count += 1 end # print border, " ",products_vote[product],"\n" } if count >= m puts "Yes" else puts "No" end
[ "call.add", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
482,743
482,742
u635857549
ruby
p02718
n, m = gets.split.map(&:to_i) products_vote = (gets.split.map(&:to_i)).sort!.reverse! # if <= products.sum / (4 * m) products_vote_sum = products_vote.sum count = 0 #puts n, m border = products_vote_sum * (1.0 / (4.0 * m)) #puts border (0..n-1).each { |product| if border < products_vote[product] count += 1 end } if count >= m puts "Yes" else puts "No" end
n, m = gets.split.map(&:to_i) products_vote = (gets.split.map(&:to_i)).sort.reverse products_vote_sum = products_vote.sum count = 0 border = products_vote_sum * (1.0 / (4.0 * m)) (0..n-1).each { |product| if border <= products_vote[product] count += 1 end # print border, " ",products_vote[product],"\n" } if count >= m puts "Yes" else puts "No" end
[ "assignment.value.change", "identifier.change", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
482,744
482,742
u635857549
ruby
p02718
lines = [] while line = gets lines << line.chomp.split(' ').map(&:to_i) end n = lines[0][0] m = lines[0][1] a = lines[1] total_votes = 0 for i in 1..n total_votes += a[i-1] end result = 0 for i in 1..n do if a[i-1] >= total_votes / (4 * m) then result += 1 end end if result == m then print "Yes" else print "No" end
lines = [] while line = gets lines << line.chomp.split(' ').map(&:to_i) end n = lines[0][0] m = lines[0][1] a = lines[1] total_votes = 0 for i in 1..n total_votes += a[i-1] end result = 0 for i in 1..n do if a[i-1] >= total_votes / (4.0 * m) then result += 1 end end if result >= m then print "Yes" else print "No" end
[ "control_flow.branch.if.condition.change", "expression.operator.compare.change" ]
483,092
483,093
u569559028
ruby
p02718
lines = [] while line = gets lines << line.chomp.split(' ').map(&:to_i) end n = lines[0][0] m = lines[0][1] a = lines[1] total_votes = 0 for i in 1..n total_votes += a[i-1] end result = 0 for i in 1..n do if a[i-1] >= total_votes / (4 * m) then result += 1 end end if result >= m then print "Yes" else print "No" end
lines = [] while line = gets lines << line.chomp.split(' ').map(&:to_i) end n = lines[0][0] m = lines[0][1] a = lines[1] total_votes = 0 for i in 1..n total_votes += a[i-1] end result = 0 for i in 1..n do if a[i-1] >= total_votes / (4.0 * m) then result += 1 end end if result >= m then print "Yes" else print "No" end
[ "control_flow.branch.if.condition.change" ]
483,094
483,093
u569559028
ruby
p02718
N,M=gets.chomp.split.map(&:to_i) A=gets.chomp.split.map(&:to_i) total_vote_count=A.inject(:+) if (A.sort.reverse)[M-1]<total_vote_count/(4*M) puts "No" else puts "Yes" end
N,M=gets.chomp.split.map(&:to_i) A=gets.chomp.split.map(&:to_f) total_vote_count=A.inject(:+) if (A.sort.reverse)[M-1]<total_vote_count/(4*M) puts "No" else puts "Yes" end
[ "assignment.value.change", "call.arguments.change" ]
483,107
483,108
u168915361
ruby
p02718
def solve n, m = gets.split.map!(&:to_i) a = gets.split.map!(&:to_i) tot_votes = 0 a.map { |vote| tot_votes += vote } cnt = 0 (0..(n - 1)).each do |i| cnt += 1 if a[i] >= (tot_votes / (4 * m)).to_i return 'Yes' if cnt == m end 'No' end print solve
def solve n, m = gets.split.map!(&:to_i) a = gets.split.map!(&:to_i) tot_votes = 0 a.map { |vote| tot_votes += vote } cnt = 0 (0..(n - 1)).each do |i| cnt += 1 if a[i] >= tot_votes / (4 * m).to_f end return 'Yes' if cnt >= m 'No' end print solve
[ "control_flow.branch.if.condition.change", "call.function.change", "type_conversion.to_float.change", "type_conversion.to_number.change", "expression.operator.compare.change" ]
483,233
483,232
u595657182
ruby
p02718
N,M = gets.chomp.split(' ').map(&:to_i) votes = gets.chomp.split(' ').map(&:to_i) border = (votes.inject{|result,item| result + item } / (4 * M)) over_border_votes = 0 votes.each do |v| if v >= border over_border_votes += 1 end end if over_border_votes >= M puts 'Yes' else puts 'No' end
N,M = gets.chomp.split(' ').map(&:to_i) votes = gets.chomp.split(' ').map(&:to_i) border = (votes.inject{|result,item| result + item } / (4 * M).to_f) over_border_votes = 0 votes.each do |v| if v >= border over_border_votes += 1 end end if over_border_votes >= M puts 'Yes' else puts 'No' end
[ "call.add" ]
483,665
483,666
u934521135
ruby
p02718
_n, m = gets.chomp.split(" ").map(&:to_i) a = gets.chomp.split(" ").map(&:to_i) min = a.sum.to_f / (4 * m) p a.count { |ai| ai.to_f >= min } >= m ? "Yes" : "No"
_n, m = gets.chomp.split(" ").map(&:to_i) a = gets.chomp.split(" ").map(&:to_i) min = a.inject(:+).to_f / (4 * m) puts a.count { |ai| ai.to_f >= min } >= m ? "Yes" : "No"
[ "assignment.value.change", "identifier.change", "expression.operation.binary.change", "call.arguments.add", "call.function.change", "io.output.change" ]
484,457
484,458
u390727364
ruby
p02718
_n, m = gets.chomp.split(" ").map(&:to_i) a = gets.chomp.split(" ").map(&:to_i) min = a.sum.to_f / (4 * m) puts a.count { |ai| ai.to_f >= min } >= m ? "Yes" : "Noo"
_n, m = gets.chomp.split(" ").map(&:to_i) a = gets.chomp.split(" ").map(&:to_i) min = a.inject(:+).to_f / (4 * m) puts a.count { |ai| ai.to_f >= min } >= m ? "Yes" : "No"
[ "assignment.value.change", "identifier.change", "expression.operation.binary.change", "call.arguments.add", "literal.string.change", "call.arguments.change" ]
484,459
484,458
u390727364
ruby
p02718
n, m = gets.chomp.split(" ").map(&:to_i) a = gets.chomp.split(" ").map(&:to_i) k = a.inject(:+) / (4 * m) puts a.select{|x| x >= k}.size >= m ? "Yes" : "No"
n, m = gets.chomp.split(" ").map(&:to_i) a = gets.chomp.split(" ").map(&:to_i) k = a.inject(:+) / (4.0 * m) puts a.select{|x| x >= k}.size >= m ? "Yes" : "No"
[ "assignment.value.change", "expression.operation.binary.change" ]
484,882
484,883
u466332671
ruby
p02718
n,m = gets.split.map(&:to_i) a = gets.split.map(&:to_i) s = a.inject(:+) puts a.max(m).min >= s/(4*m) ? "Yes" : "No"
n,m = gets.split.map(&:to_i) a = gets.split.map(&:to_i) s = a.inject(:+) puts a.max(m).min >= s/(4.0*m) ? "Yes" : "No"
[ "control_flow.branch.if.condition.change" ]
485,243
485,244
u585819925
ruby
p02718
ar = gets.split dd = gets.split n = ar[0].to_i m = ar[1].to_i #p dd.map!{|x| x.to_i} dsum = dd.map!{|x| x.to_i}.inject(:+) cnt = 0 for j in 1..n do if (dd[j-1] > dsum/(4*m)) then cnt = cnt+1 end end if (cnt<m) then puts( "No" ) elsif puts( 'Yes') end
ar = gets.split dd = gets.split n = ar[0].to_i m = ar[1].to_i #p dd.map!{|x| x.to_i} dsum = dd.map!{|x| x.to_i}.inject(:+) cnt = 0 for j in 1..n do if (dd[j-1] >= dsum/(4.0*m)) then cnt = cnt+1 end end if (cnt<m) then puts( "No" ) elsif puts( 'Yes') end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
485,505
485,506
u733097332
ruby
p02718
ar = gets.split dd = gets.split n = ar[0].to_i m = ar[1].to_i #p dd.map!{|x| x.to_i} dsum = dd.map!{|x| x.to_i}.inject(:+) cnt = 0 for j in 1..n do if (dd[j-1] >= dsum/(4*m)) then cnt = cnt+1 end end if (cnt<m) then puts( "No" ) elsif puts( 'Yes') end
ar = gets.split dd = gets.split n = ar[0].to_i m = ar[1].to_i #p dd.map!{|x| x.to_i} dsum = dd.map!{|x| x.to_i}.inject(:+) cnt = 0 for j in 1..n do if (dd[j-1] >= dsum/(4.0*m)) then cnt = cnt+1 end end if (cnt<m) then puts( "No" ) elsif puts( 'Yes') end
[ "control_flow.branch.if.condition.change" ]
485,507
485,506
u733097332
ruby
p02718
ar = gets.split dd = gets.split n = ar[0].to_i m = ar[1].to_i #p dd.map!{|x| x.to_i} dsum = dd.map!{|x| x.to_i}.inject(:+) cnt = 0 for j in 1..n do if (dd[j-1] >= dsum/(4*m)) then cnt = cnt+1 end end if (cnt<m) then puts( "no" ) elsif puts( 'yes') end
ar = gets.split dd = gets.split n = ar[0].to_i m = ar[1].to_i #p dd.map!{|x| x.to_i} dsum = dd.map!{|x| x.to_i}.inject(:+) cnt = 0 for j in 1..n do if (dd[j-1] >= dsum/(4.0*m)) then cnt = cnt+1 end end if (cnt<m) then puts( "No" ) elsif puts( 'Yes') end
[ "control_flow.branch.if.condition.change", "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
485,508
485,506
u733097332
ruby
p02718
ar = gets.split dd = gets.split n = ar[0].to_i m = ar[1].to_i #p dd.map!{|x| x.to_i} dsum = dd.map!{|x| x.to_i}.inject(:+) cnt = 0 for j in 1..n do if (dd[j-1] > dsum/(4*m)) then cnt = cnt+1 end end if (cnt<m) then puts( "no" ) elsif puts( 'yes') end
ar = gets.split dd = gets.split n = ar[0].to_i m = ar[1].to_i #p dd.map!{|x| x.to_i} dsum = dd.map!{|x| x.to_i}.inject(:+) cnt = 0 for j in 1..n do if (dd[j-1] >= dsum/(4.0*m)) then cnt = cnt+1 end end if (cnt<m) then puts( "No" ) elsif puts( 'Yes') end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change", "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
485,509
485,506
u733097332
ruby
p02718
_, m = gets.chomp.split(" ").map(&:to_i); a_arr = gets.chomp.split(" ").map(&:to_i); a_arr.sort!.reverse! sum = 0 a_arr.each do |e| sum = sum + e end if a_arr[m - 1] < sum / (4 * m) puts 'No' else puts 'Yes' end
_, m = gets.chomp.split(" ").map(&:to_i); a_arr = gets.chomp.split(" ").map(&:to_i); a_arr.sort!.reverse! sum = 0 a_arr.each do |e| sum = sum + e end if a_arr[m - 1] < sum.to_f / (4 * m) puts 'No' else puts 'Yes' end
[ "control_flow.branch.if.condition.change", "call.add" ]
485,519
485,520
u776820541
ruby
p02718
# frozen_string_literal: true n, m = gets.split.map(&:to_i) as = gets.split.map(&:to_i) sum = as.inject(:+) items = as.select { |a| a >= sum / (4 * m) } puts items.count >= m ? 'Yes' : 'No'
# frozen_string_literal: true n, m = gets.split.map(&:to_i) as = gets.split.map(&:to_i) sum = as.inject(:+) items = as.select { |a| a >= sum.to_f / (4.0 * m) } puts items.count >= m ? 'Yes' : 'No'
[ "call.add", "assignment.value.change", "expression.operation.binary.change" ]
485,548
485,549
u889326464
ruby
p02718
n, m = gets.split.map(&:to_i) goods = gets.split.map(&:to_i) votes = goods.inject(:+) popular_goods = [] def judge(target, sum, m) if target >= sum / (4 * m) 1 else 0 end end goods.each do |good| popular_goods.push(judge(good, votes, m)) end if popular_goods.inject(:+) >= m puts "Yes" else puts "No" end
n, m = gets.split.map(&:to_i) goods = gets.split.map(&:to_i) votes = goods.inject(:+) popular_goods = [] def judge(target, sum, m) if target >= sum.to_f / (4 * m) 1 else 0 end end goods.each do |good| popular_goods.push(judge(good, votes, m)) end if popular_goods.inject(:+) >= m puts "Yes" else puts "No" end
[ "control_flow.branch.if.condition.change", "call.add" ]
486,325
486,326
u602384426
ruby
p02718
n, m = gets.split.map(&:to_i) goods = gets.split.map(&:to_i) votes = goods.inject(:+) popular_goods = [] def judge(target, sum, m) if target > sum / (4 * m) 1 else 0 end end goods.each do |good| popular_goods.push(judge(good, votes, m)) end if popular_goods.inject(:+) >= m puts "Yes" else puts "No" end
n, m = gets.split.map(&:to_i) goods = gets.split.map(&:to_i) votes = goods.inject(:+) popular_goods = [] def judge(target, sum, m) if target >= sum.to_f / (4 * m) 1 else 0 end end goods.each do |good| popular_goods.push(judge(good, votes, m)) end if popular_goods.inject(:+) >= m puts "Yes" else puts "No" end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change", "call.add" ]
486,327
486,326
u602384426
ruby
p02718
n, m = gets.chomp.split(' ').map(&:to_i) arr = gets.chomp.split(' ').map(&:to_i).sort.reverse sum = arr.inject(:+) ok = true (0...m).each do |i| ok = ok && arr[i] * (4 * m) > sum end puts ok ? 'Yes' : 'No'
n, m = gets.chomp.split(' ').map(&:to_i) arr = gets.chomp.split(' ').map(&:to_i).sort.reverse sum = arr.inject(:+) ok = true (0...m).each do |i| ok = ok && arr[i] * (4 * m) >= sum end puts ok ? 'Yes' : 'No'
[ "expression.operator.compare.change", "assignment.value.change", "expression.operation.binary.change" ]
486,535
486,536
u857510905
ruby
p02718
n, m = gets.chomp.split(' ').map(&:to_i) arr = gets.chomp.split(' ').map(&:to_i).sort.reverse sum = arr.inject(:+) ok = true (0...m).each do |i| ok = ok && arr[i] > sum / (4 * m) end puts ok ? 'Yes' : 'No'
n, m = gets.chomp.split(' ').map(&:to_i) arr = gets.chomp.split(' ').map(&:to_i).sort.reverse sum = arr.inject(:+) ok = true (0...m).each do |i| ok = ok && arr[i] * (4 * m) >= sum end puts ok ? 'Yes' : 'No'
[ "assignment.value.change", "expression.operation.binary.change", "expression.operation.binary.remove" ]
486,537
486,536
u857510905
ruby
p02718
N,M = gets.split.map(&:to_i); A = gets.split.map(&:to_i); min = A.inject(&:+) / (4.0 * M); puts A.count{|x| x >= min} > M ? "Yes" : "No"
N,M = gets.split.map(&:to_i); A = gets.split.map(&:to_i); min = A.inject(&:+) / (4.0 * M); puts A.count{|x| x >= min} >= M ? "Yes" : "No"
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
486,903
486,904
u238278340
ruby
p02718
N,M = gets.split.map(&:to_i); A = gets.split.map(&:to_i); min = A.inject(&:+) / (4.0 * M); puts A.count{|x| x > min} > M ? "Yes" : "No"
N,M = gets.split.map(&:to_i); A = gets.split.map(&:to_i); min = A.inject(&:+) / (4.0 * M); puts A.count{|x| x >= min} >= M ? "Yes" : "No"
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
486,905
486,904
u238278340
ruby
p02718
#!/usr/bin/env ruby tmp = STDIN.gets.chomp.split(/\s/).map { |e| e.to_i } m = tmp[1] a = STDIN.gets.chomp.split(/\s/).map { |e| e.to_i } s = a.inject(:+) t = 1.0 * s / (4 * m) cnt = 0 a.each do |i| if i > t cnt += 1 end end puts ((cnt >= m) ? "Yes" : "No")
#!/usr/bin/env ruby tmp = STDIN.gets.chomp.split(/\s/).map { |e| e.to_i } m = tmp[1] a = STDIN.gets.chomp.split(/\s/).map { |e| e.to_i } s = a.inject(:+) t = 1.0 * s / (4 * m) cnt = 0 a.each do |i| if i >= t cnt += 1 end end puts ((cnt >= m) ? "Yes" : "No")
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
487,235
487,236
u250545805
ruby
p02718
#!/usr/bin/env ruby tmp = STDIN.gets.chomp.split(/\s/).map { |e| e.to_i } m = tmp[1] a = STDIN.gets.chomp.split(/\s/).map { |e| e.to_i } s = a.sum t = 1.0 * s / (4 * m) cnt = 0 a.each do |i| if i > t cnt += 1 end end puts ((cnt >= m) ? "Yes" : "No")
#!/usr/bin/env ruby tmp = STDIN.gets.chomp.split(/\s/).map { |e| e.to_i } m = tmp[1] a = STDIN.gets.chomp.split(/\s/).map { |e| e.to_i } s = a.inject(:+) t = 1.0 * s / (4 * m) cnt = 0 a.each do |i| if i >= t cnt += 1 end end puts ((cnt >= m) ? "Yes" : "No")
[ "assignment.value.change", "identifier.change", "call.arguments.add", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
487,237
487,236
u250545805
ruby
p02718
n, m = gets.strip.split.map(&:to_i) ary = gets.strip.split.map(&:to_i).sort.reverse ans = "Yes" ary[0..(m-1)].each do |i| if i < (ary.inject(&:+)/(4*m)).to_f ans = "No" end end puts ans
n, m = gets.strip.split.map(&:to_i) ary = gets.strip.split.map(&:to_i).sort.reverse ans = "Yes" ary[0..(m-1)].each do |i| if i < ary.inject(&:+)/(4*m).to_f ans = "No" end end puts ans
[ "control_flow.branch.if.condition.change" ]
487,292
487,293
u514143079
ruby
p02718
n, m = gets.strip.split.map(&:to_i) ary = gets.strip.split.map(&:to_i).sort.reverse ans = "Yes" ary[0..(m-1)].each do |i| if i < ary.inject(&:+)/(4*m) ans = "No" end end puts ans
n, m = gets.strip.split.map(&:to_i) ary = gets.strip.split.map(&:to_i).sort.reverse ans = "Yes" ary[0..(m-1)].each do |i| if i < ary.inject(&:+)/(4*m).to_f ans = "No" end end puts ans
[ "control_flow.branch.if.condition.change", "call.add" ]
487,294
487,293
u514143079
ruby
p02718
# frozen_string_literal: true _n, m = gets.split.map(&:to_i) a = gets.split.map(&:to_i) min = a.inject(:+) / (4 * m).ceil if a.count { |x| x >= min } >= m puts 'Yes' else puts 'No' end
# frozen_string_literal: true _n, m = gets.split.map(&:to_i) a = gets.split.map(&:to_i) min = (a.inject(:+) / (4 * m).to_f).ceil if a.count { |x| x >= min } >= m puts 'Yes' else puts 'No' end
[ "call.add" ]
487,328
487,329
u120313292
ruby
p02718
(N, M) = gets.chomp.split.map(&:to_i) @a = gets.chomp.split.map(&:to_i) limit = (@a.reduce(0, &:+) / (4 * M).to_f) s = @a.delete_if {|a| a <= limit } . length puts s >= M ? 'Yes' : 'No'
(N, M) = gets.chomp.split.map(&:to_i) @a = gets.chomp.split.map(&:to_i) limit = (@a.reduce(0, &:+) / (4 * M).to_f) s = @a.delete_if {|a| a < limit } . length puts s >= M ? 'Yes' : 'No'
[ "expression.operator.compare.change", "assignment.value.change", "expression.operation.binary.change" ]
487,422
487,423
u179236015
ruby
p02718
n,m = gets.chomp.split(" ").map(&:to_i) vote = gets.chomp.split(" ").map(&:to_i) minVote = vote.inject(:+) * 1 / (4 * m) count = 0 (0..n-1).each do |i| # puts vote[i] if vote[i] >= minVote count += 1 end end if count >= m puts "Yes" else puts "No" end
n,m = gets.chomp.split(" ").map(&:to_i) vote = gets.chomp.split(" ").map(&:to_i) minVote = vote.inject(:+) * 1 / (4 * m).to_f count = 0 (0..n-1).each do |i| # puts vote[i] if vote[i] >= minVote count += 1 end end if count >= m puts "Yes" else puts "No" end
[ "call.add" ]
487,675
487,676
u501278209
ruby
p02718
n,m = gets.split(' ').map(&:to_i) nums = gets.split(' ').map(&:to_i) sum = nums.inject(:+) ok = sum / (4*m) puts m <= nums.count { |i| i >= ok } ? 'Yes' : 'No'
n,m = gets.split(' ').map(&:to_i) nums = gets.split(' ').map(&:to_i) sum = nums.inject(:+) ok = sum.to_f / (4*m) puts m <= nums.count { |i| i >= ok } ? 'Yes' : 'No'
[ "call.add" ]
488,194
488,195
u634482428
ruby
p02718
N, M = gets.chomp.split.map(&:to_i) A = gets.chomp.split.map(&:to_i) sortedA = A.sort.reverse if sortedA[M - 1] < (A.inject(:+))/(4 * M) then puts "No" else puts "Yes" end
N, M = gets.chomp.split.map(&:to_i) A = gets.chomp.split.map(&:to_i) sortedA = A.sort.reverse if sortedA[M - 1] < (A.inject(:+))/(4.0 * M) then puts "No" else puts "Yes" end
[ "control_flow.branch.if.condition.change" ]
488,218
488,219
u394640249
ruby
p02718
n,m = gets.split(" ").map(&:to_i) list = gets.split(" ").map(&:to_i) sum = 0 for value in 0...list.length do sum = sum + list[value] end pre = sum / (4 * m) ans = list.select { |num| num >= pre } if ans.length >= m then puts "Yes" else puts "No" end
n,m = gets.split(" ").map(&:to_i) list = gets.split(" ").map(&:to_i) sum = 0 for value in 0...list.length do sum = sum + list[value] end pre = sum / (4.0 * m) ans = list.select { |num| num >= pre } if ans.length >= m then puts "Yes" else puts "No" end
[ "assignment.value.change", "expression.operation.binary.change" ]
488,220
488,221
u734430573
ruby
p02718
n,m = gets.split(" ").map(&:to_i) list = gets.split(" ").map(&:to_i) sum = 0 for value in 0...list.length do sum = sum + list[value] end pre = sum / 4 * m ans = list.select { |num| num >= pre } if ans.length >= m then puts "Yes" else puts "No" end
n,m = gets.split(" ").map(&:to_i) list = gets.split(" ").map(&:to_i) sum = 0 for value in 0...list.length do sum = sum + list[value] end pre = sum / (4.0 * m) ans = list.select { |num| num >= pre } if ans.length >= m then puts "Yes" else puts "No" end
[ "assignment.value.change", "expression.operation.binary.change" ]
488,222
488,221
u734430573
ruby
p02718
n, m = gets.split.map(&:to_i) a = gets.split.map(&:to_i) min = a.inject(:+) / 4 / m count = 0 a.each do |aa| count += 1 if aa >= min end if count >= m puts "Yes" else puts "No" end
n, m = gets.split.map(&:to_i) a = gets.split.map(&:to_i) min = a.inject(:+).to_f / 4.0 / m count = 0 a.each do |aa| count += 1 if aa >= min end if count >= m puts "Yes" else puts "No" end
[ "call.add", "assignment.value.change", "expression.operation.binary.change" ]
488,241
488,242
u374765295
ruby
p02718
N, M = gets.chomp.split(" ").map(&:to_i) A = gets.chomp.split(" ").map(&:to_i).sort.reverse all = A.inject(:+) count = 0 A.each do |a| if a > all.quo(4 * M) count += 1 end if count == M break end end if count == M puts "Yes" else puts "No" end
N, M = gets.chomp.split(" ").map(&:to_i) A = gets.chomp.split(" ").map(&:to_i).sort.reverse all = A.inject(:+) count = 0 A.each do |a| if a >= all.quo(4 * M) count += 1 end if count == M break end end if count == M puts "Yes" else puts "No" end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
488,335
488,336
u729911058
ruby
p02718
N, M = gets.chomp.split(" ").map(&:to_i) A = gets.chomp.split(" ").map(&:to_i).sort.reverse all = A.inject(:+) count = 0 A.each do |a| if a >= all / (4 * M) count += 1 end if count == M break end end if count == M puts "Yes" else puts "No" end
N, M = gets.chomp.split(" ").map(&:to_i) A = gets.chomp.split(" ").map(&:to_i).sort.reverse all = A.inject(:+) count = 0 A.each do |a| if a >= all.quo(4 * M) count += 1 end if count == M break end end if count == M puts "Yes" else puts "No" end
[ "control_flow.branch.if.condition.change", "call.add" ]
488,337
488,336
u729911058
ruby
p02718
N, M = gets.chomp.split(" ").map(&:to_i) A = gets.chomp.split(" ").map(&:to_i).sort.reverse all = A.inject(:+) count = 0 A.each do |a| if a > all / (4 * M) count += 1 end if count == M break end end if count == M puts "Yes" else puts "No" end
N, M = gets.chomp.split(" ").map(&:to_i) A = gets.chomp.split(" ").map(&:to_i).sort.reverse all = A.inject(:+) count = 0 A.each do |a| if a >= all.quo(4 * M) count += 1 end if count == M break end end if count == M puts "Yes" else puts "No" end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change", "call.add" ]
488,338
488,336
u729911058
ruby
p02718
N,M=gets.split.map(&:to_i) a=gets.split.map(&:to_i) total = a.reduce{|i,j| i+j} a.sort! if a.reverse[M-1] < total/(4*M) puts "No" else puts "Yes" end
N,M=gets.split.map(&:to_i) a=gets.split.map(&:to_i) total = a.reduce{|i,j| i+j} a.sort! if a.reverse[M-1] < total/(4*M).to_f puts "No" else puts "Yes" end
[ "control_flow.branch.if.condition.change", "call.add" ]
488,401
488,402
u224392861
ruby
p02718
n,m = gets.split.map(&:to_i) a = gets.split.map(&:to_i) cnt = 0 sum = a.inject(:+) base = sum/4.0*m n.times do |i| if a[i] >= base cnt += 1 end end if cnt >= m puts "Yes" else puts "No" end
n,m = gets.split.map(&:to_i) a = gets.split.map(&:to_i) cnt = 0 sum = a.inject(:+) base = sum/(4.0*m) n.times do |i| if a[i] >= base cnt += 1 end end if cnt >= m puts "Yes" else puts "No" end
[]
488,432
488,433
u760636024
ruby
p02718
n, m = gets.rstrip.split(" ").map { |c| c.to_i} a = gets.rstrip.split(" ").map {|c| c.to_i } total = 0 a.each { |ai| total += ai } cnt = 0 a.each do |ai| if ai >= total/(4*m) then cnt += 1 end end if cnt >= m then puts "Yes" else puts "No" end
n, m = gets.rstrip.split(" ").map { |c| c.to_i} a = gets.rstrip.split(" ").map {|c| c.to_i } total = 0 a.each { |ai| total += ai } cnt = 0 a.each do |ai| if ai >= total.to_f/(4*m) then cnt += 1 end end if cnt >= m then puts "Yes" else puts "No" end
[ "control_flow.branch.if.condition.change", "call.add" ]
488,511
488,512
u644533034
ruby
p02718
n, m = gets.split.map(&:to_i) nums = gets.split.map(&:to_i).sort.reverse sum = nums.reduce(:+) t = nums[m-1] puts t > (sum / (4.0*m)) ? 'Yes' : 'No'
n, m = gets.split.map(&:to_i) nums = gets.split.map(&:to_i).sort.reverse sum = nums.reduce(:+) t = nums[m-1] puts t >= (sum / (4.0*m)) ? 'Yes' : 'No'
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
488,600
488,601
u173515518
ruby
p02718
n,m = gets.split(/ /).map(&:to_i) a = gets.split(/ /).map(&:to_i).sort{|a,b| b <=> a} sum = a.inject(&:+) / (4 * m) result = 'Yes' m.times do |i| if a[i] < sum result = 'No' end end puts result
n,m = gets.split(/ /).map(&:to_i) a = gets.split(/ /).map(&:to_i).sort{|a,b| b <=> a} sum = a.inject(&:+).to_f / (4 * m) result = 'Yes' m.times do |i| if a[i] < sum result = 'No' end end puts result
[ "call.add" ]
488,977
488,978
u444318984
ruby
p02718
n, m = gets.chomp!.split(" ").map(&:to_i) a = gets.chomp!.split(" ").map(&:to_i) if a.sort.reverse[m - 1] < (a.inject(:+) / (4 * m)) puts "No" else puts "Yes" end
n, m = gets.chomp!.split(" ").map(&:to_i) a = gets.chomp!.split(" ").map(&:to_i) if a.sort.reverse[m - 1] < (a.inject(:+) / (4.0 * m)) puts "No" else puts "Yes" end
[ "control_flow.branch.if.condition.change" ]
488,987
488,988
u081708706
ruby
p02718
_n, m = gets.split.map(&:to_i) a = gets.split.map(&:to_i) b = a.inject(:+) / ( 4 * m) cnt = 0 a.each do |ai| cnt += 1 unless ai < b end if cnt >= m puts 'Yes' else puts 'No' end
_n, m = gets.split.map(&:to_i) a = gets.split.map(&:to_i) b = a.inject(:+).to_f / (4 * m) cnt = 0 a.each do |ai| cnt += 1 unless ai < b end if cnt >= m puts 'Yes' else puts 'No' end
[ "call.add" ]
489,044
489,045
u503270460
ruby
p02718
n,m = gets.split.map(&:to_i) a = gets.split.map(&:to_i).sort.reverse sum = a.inject(:+) puts a[m-1] >= sum / (4 * m) ? "Yes" : "No"
n,m = gets.split.map(&:to_i) a = gets.split.map(&:to_i).sort.reverse sum = a.inject(:+) puts a[m-1] >= (sum.to_f / (4 * m)) ? "Yes" : "No"
[ "control_flow.branch.if.condition.change", "call.add" ]
489,555
489,556
u123276241
ruby
p02718
n,m = gets.split.map(&:to_i) a = gets.split.map(&:to_i).sort.reverse sum = a.inject(:+) puts a[m-1] >= (sum+1) / (4 * m) ? "Yes" : "No"
n,m = gets.split.map(&:to_i) a = gets.split.map(&:to_i).sort.reverse sum = a.inject(:+) puts a[m-1] >= (sum.to_f / (4 * m)) ? "Yes" : "No"
[ "control_flow.branch.if.condition.change" ]
489,557
489,556
u123276241
ruby
p02718
N, M = gets.chomp.split(" ").map(&:to_i) A = gets.chomp.split(" ").map(&:to_i) s = A.inject(:+) puts A.select{|a| a >= s/(4*M)}.count >= M ? 'Yes' : 'No'
N, M = gets.chomp.split(" ").map(&:to_i) A = gets.chomp.split(" ").map(&:to_i) s = A.inject(:+) puts A.select{|a| a >= s.to_f/(4*M)}.count >= M ? 'Yes' : 'No'
[ "control_flow.branch.if.condition.change", "call.add" ]
489,580
489,581
u276517671
ruby
p02718
N, M = gets.split(' ').map(&:to_i) ary = gets.split(' ').map(&:to_i) line = ary.reduce(&:+) / (4 * M) count = 0 ary.each do |a| count += 1 unless a < line break if count >= M end if count >= M puts 'Yes' else puts 'No' end
N, M = gets.split(' ').map(&:to_i) ary = gets.split(' ').map(&:to_i) line = ary.reduce(&:+) / (4 * M).to_f count = 0 ary.each do |a| count += 1 unless a < line break if count >= M end if count >= M puts 'Yes' else puts 'No' end
[ "call.add" ]
489,625
489,626
u598150937
ruby
p02718
# b require 'pp' n, m = gets.split.map(&:to_i) a = gets.split.map(&:to_i) sum = a.inject(:+) a2 = a.select{|aa| aa >= (sum/(4*m)) } puts (a2.size >= m) ? 'Yes' : 'No'
# b require 'pp' n, m = gets.split.map(&:to_i) a = gets.split.map(&:to_i) sum = a.inject(:+).to_f a2 = a.select{|aa| aa >= (sum/(4*m)) } puts (a2.size >= m) ? 'Yes' : 'No'
[ "call.add" ]
489,747
489,748
u315597999
ruby
p02718
(n,m)=gets.split.map(&:to_i) a=gets.split.map(&:to_i) s=a.reduce(:+) r = a.select {|x| x >= s / (4 * m) } if r.size >= m print 'Yes' else print 'No' end
(n,m)=gets.split.map(&:to_i) a=gets.split.map(&:to_i) s=a.reduce(:+) r = a.select {|x| x >= s.to_f / (4 * m) } if r.size >= m print 'Yes' else print 'No' end
[ "call.add" ]
489,955
489,956
u702482655
ruby
p02718
n,m = gets.chomp.split(' ').map(&:to_i) a = gets.chomp.split(' ').map(&:to_i) a.sort!.reverse! kijun = a.inject(:+) / (4*m).to_f p kijun if (a[m-1] < kijun) puts 'No' else puts 'Yes' end
n,m = gets.chomp.split(' ').map(&:to_i) a = gets.chomp.split(' ').map(&:to_i) a.sort!.reverse! kijun = a.inject(:+) / (4*m).to_f if (a[m-1] < kijun) puts 'No' else puts 'Yes' end
[ "call.remove" ]
489,961
489,962
u546441021
ruby
p02718
n,m = gets.chomp.split(' ').map(&:to_i) a = gets.chomp.split(' ').map(&:to_i) a.sort!.reverse! kijun = a.inject(:+) / (4*m) if (a[m-1] < kijun) puts 'No' else puts 'Yes' end
n,m = gets.chomp.split(' ').map(&:to_i) a = gets.chomp.split(' ').map(&:to_i) a.sort!.reverse! kijun = a.inject(:+) / (4*m).to_f if (a[m-1] < kijun) puts 'No' else puts 'Yes' end
[ "call.add" ]
489,963
489,962
u546441021
ruby
p02718
n, m = gets.split(" ").map(&:to_i) ary = gets.split(" ").map(&:to_i).sort.reverse sum = ary.inject(:+) div = sum / (4 * m) m.times do |i| if ary[i] < div puts "No" exit end end puts "Yes"
n, m = gets.split(" ").map(&:to_i) ary = gets.split(" ").map(&:to_i).sort.reverse sum = ary.inject(:+) div = sum / (4 * m).to_f m.times do |i| if ary[i] < div puts "No" exit end end puts "Yes"
[ "call.add" ]
489,986
489,987
u928941036
ruby
p02718
n, m = gets.split.map(&:to_i) a = gets.split.map(&:to_i) sum = a.inject(&:+) a = a.delete_if{|x| x < sum / (4*m) } puts a.count >= m ? 'Yes' : 'No'
n, m = gets.split.map(&:to_i) a = gets.split.map(&:to_i) sum = a.inject(&:+) a = a.delete_if{|x| x < sum / (4.0*m) } puts a.count >= m ? 'Yes' : 'No'
[ "assignment.value.change", "expression.operation.binary.change" ]
490,034
490,035
u359413188
ruby