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
p03693
rgb = gets.strip.to_i puts rgb % 4 == 0 ? "YES" : "NO"
rgb = gets.chomp.split.join.to_i puts rgb% 4 == 0 ? "YES" : "NO"
[ "assignment.value.change", "identifier.change", "call.add" ]
1,362,957
1,362,958
u191196346
ruby
p03693
puts (gets.gsub(/\s/,'').to_i % 4 == 0 ? 'Yes' : 'No')
puts (gets.gsub(/\s/,'').to_i % 4 == 0 ? 'YES' : 'NO')
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
1,363,013
1,363,014
u627981707
ruby
p03693
r, g, b = gets.split.map &:to_i puts ((100*r + 10*g + b) % 4 == 0 ? 'Yes' : 'No')
r, g, b = gets.split.map &:to_i puts ((100*r + 10*g + b) % 4 == 0 ? 'YES' : 'NO')
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
1,363,102
1,363,103
u762793278
ruby
p03693
puts gets.split(" ").join.to_i % 4 == 0 ? "Yes" : "No"
puts gets.split(" ").join.to_i % 4 == 0 ? "YES" : "NO"
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
1,363,224
1,363,225
u617587005
ruby
p03693
a, b, c = gets.chomp.split(' ') t = (a + b + c).to_i if t % 4 == 1 then print("YES") else print("NO") end
a, b, c = gets.chomp.split(' ') t = (a + b + c).to_i if t % 4 == 0 then print("YES") else print("NO") end
[ "literal.number.integer.change", "control_flow.branch.if.condition.change" ]
1,363,323
1,363,324
u780069703
ruby
p03693
num = gets.chomp.gsub(" ", "").to_i flag = num % 4 if flag == 0 p 'YES' else p 'NO' end
num = gets.chomp.gsub(" ", "").to_i flag = num % 4 if flag == 0 print('YES') else print('NO') end
[ "call.function.change", "io.output.change", "call.arguments.change" ]
1,363,378
1,363,379
u339363067
ruby
p03693
puts gets.split.join.to_i%4==0?:Yes: :No
puts gets.split.join.to_i%4==0?:YES: :NO
[ "call.arguments.change" ]
1,363,418
1,363,419
u647875062
ruby
p03693
r,g,b = gets.split.map(&:to_i) puts (g+b)%4==0 ? "YES" : "NO"
r,g,b = gets.split.map(&:to_i) puts (10*g+b)%4==0 ? "YES" : "NO"
[ "control_flow.branch.if.condition.change" ]
1,363,450
1,363,451
u693378622
ruby
p03693
r, g, b = gets.split.map(&:to_i) rgb = r * 100 + g * 10 + b ans = rgb % 4 == 0 ? 'Yes' : 'No' puts ans
r, g, b = gets.split.map(&:to_i) rgb = r * 100 + g * 10 + b puts rgb % 4 == 0 ? 'YES' : 'NO'
[ "literal.string.change", "literal.string.case.change", "call.remove" ]
1,363,475
1,363,476
u120026978
ruby
p03693
r, g, b = gets.split.map(&:to_i) rgb = r * 100 + g * 10 + b puts rgb % 4 == 0 ? 'Yes' : 'No'
r, g, b = gets.split.map(&:to_i) rgb = r * 100 + g * 10 + b puts rgb % 4 == 0 ? 'YES' : 'NO'
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
1,363,477
1,363,476
u120026978
ruby
p03694
N = gets.to_i data = gets.split("\s").map {|s|s.to_i} min = 1000 max = 0 data.each do |d| if d < min then min = d elsif d > max then max = d end end puts max-min
N = gets.to_i data = gets.split("\s").map {|s|s.to_i} min = 1000 max = 0 data.each do |d| if d < min then min = d end if d > max then max = d end end puts max-min
[]
1,363,927
1,363,928
u186737744
ruby
p03694
h = gets.to_i load = gets.chomp.split.map(&:to_i) load.sort ans = load[h-1] - load[0] puts ans
h = gets.to_i load = gets.chomp.split.map(&:to_i) load.sort! ans = load[h-1] - load[0] puts ans
[ "call.suffix.change" ]
1,364,037
1,364,038
u677020059
ruby
p03693
rgb = STDIN.gets.chomp.split(/\s/).map{|c| c.to_i} value = rgb[0] * 100 + rgb[1] * 10 + rgb[2] ans = value % 4 === 0 ? 'YES' : 'NO' p ans
rgb = STDIN.gets.chomp.split(/\s/).map{|c| c.to_i} value = rgb[0] * 100 + rgb[1] * 10 + rgb[2] ans = value % 4 === 0 ? 'YES' : 'NO' puts ans
[ "call.function.change", "io.output.change" ]
1,364,178
1,364,179
u794141067
ruby
p03693
a, b, c = gets.split.map(&:to_i) puts ((2 * b + c) % 4 == 0 ? "Yes" : "No")
a, b, c = gets.split.map(&:to_i) puts ((2 * b + c) % 4 == 0 ? "YES" : "NO")
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
1,364,194
1,364,195
u459746049
ruby
p03693
r,g,b = gets.split(' ').map(&:to_i) if r*100+g*10+b % 4 == 0 puts 'YES' else puts 'NO' end
r,g,b = gets.split(' ').map(&:to_i) if (r*100+g*10+b) % 4 == 0 puts 'YES' else puts 'NO' end
[ "control_flow.branch.if.condition.change" ]
1,364,239
1,364,240
u633051991
ruby
p03695
N,*as=$<.read.split.map(&:to_i) arr = Array.new(8,0) x=0 as.each do |a| if a < 3200 arr[a/400] = 1 else x += 1 end end n = arr.inject(&:+) min = [1,n].max max = [8,n+x].min puts "#{min} #{max}"
N,*as=$<.read.split.map(&:to_i) arr = Array.new(8,0) x=0 as.each do |a| if a < 3200 arr[a/400] = 1 else x += 1 end end n = arr.inject(&:+) min = [1,n].max # max = [8,n+x].min max = n+x puts "#{min} #{max}"
[ "call.remove" ]
1,364,286
1,364,287
u852974293
ruby
p03695
n = gets.to_i arr = gets.chomp.split(' ').map(&:to_i).map {|i| i/400} monster_count = 0 arr.each do |num| if num >= 8 monster_count += 1 end end arr.delete_if{|num| num >= 8} ans = arr.uniq.size puts ans.to_s + " " + (ans + monster_count).to_s
n = gets.to_i arr = gets.chomp.split(' ').map(&:to_i).map {|i| i/400} monster_count = 0 arr.each do |num| if num >= 8 monster_count += 1 end end arr.delete_if{|num| num >= 8} ans = arr.uniq.size puts [1,ans].max.to_s + " " + (ans + monster_count).to_s
[ "literal.array.change", "call.add" ]
1,364,641
1,364,642
u059126963
ruby
p03695
n = gets.to_i a = gets.chop.split.map(&:to_i) l = [false]*8 over = 0 for x in a if x < 3200 l[x/400] = true else over += 1 end end mini = l.count(true) maxi = l.count(true)+over print("#{mini} #{maxi}")
n = gets.to_i a = gets.chop.split.map(&:to_i) l = [false]*8 over = 0 for x in a if x < 3200 l[x/400] = true else over += 1 end end mini = [l.count(true),1].max maxi = l.count(true)+over print("#{mini} #{maxi}")
[ "call.add" ]
1,364,718
1,364,719
u636683284
ruby
p03695
n = gets.to_i as = gets.chomp.split.map(&:to_i) check = Array.new(8,0) cnt = 0 as.each do |a| if a < 400 check[0] = 1 elsif a < 800 check[1] = 1 elsif a < 1200 check[2] = 1 elsif a < 1600 check[3] = 1 elsif a < 2000 check[4] = 1 elsif a < 2400 check[5] = 1 elsif a < 2800 check[6] = 1 elsif a < 3200 check[7] = 1 else cnt += 1 end end min_num = check.count(1) if min_num == 0 min_num = 1 cnt -= 1 end max_num = [8, min_num + cnt].min puts "#{min_num} #{max_num}"
n = gets.to_i as = gets.chomp.split.map(&:to_i) check = Array.new(8,0) cnt = 0 as.each do |a| if a < 400 check[0] = 1 elsif a < 800 check[1] = 1 elsif a < 1200 check[2] = 1 elsif a < 1600 check[3] = 1 elsif a < 2000 check[4] = 1 elsif a < 2400 check[5] = 1 elsif a < 2800 check[6] = 1 elsif a < 3200 check[7] = 1 else cnt += 1 end end min_num = check.count(1) if min_num == 0 min_num = 1 cnt -= 1 end max_num = min_num + cnt puts "#{min_num} #{max_num}"
[ "call.remove" ]
1,365,713
1,365,714
u191196346
ruby
p03695
def min(a,b); a < b ? a : b; end N = gets.to_i R = Array.new(10, 0) A = gets.split.map(&:to_i) A.each do |a| R[min(a / 400, 8)] += 1 end m = 8.times.count{|r| R[r] > 0 } puts "#{m > 0 ? m : 1} #{min(m+R[8],8)}"
def min(a,b); a < b ? a : b; end N = gets.to_i R = Array.new(10, 0) A = gets.split.map(&:to_i) A.each do |a| R[min(a / 400, 8)] += 1 end m = 8.times.count{|r| R[r] > 0 } puts "#{m > 0 ? m : 1} #{m+R[8]}"
[ "literal.string.change", "call.arguments.change" ]
1,366,182
1,366,181
u627981707
ruby
p03695
n = gets.to_i a = gets.split.map(&:to_i) normals = a.select {|x| x < 3200} experts = a.select {|x| x >= 3200} colors = normals.map {|x| x / 400}.uniq.size puts [ [1, colors].max, [8, colors + experts.size].min, ].join(' ')
n = gets.to_i a = gets.split.map(&:to_i) normals = a.select {|x| x < 3200} experts = a.select {|x| x >= 3200} colors = normals.map {|x| x / 400}.uniq.size puts [ [1, colors].max, colors + experts.size, ].join(' ')
[ "call.remove" ]
1,366,352
1,366,353
u723180465
ruby
p03695
N=gets.to_i as=gets.split.map(&:to_i) cnts=Array.new(9,0) as.each do |i| judge=true for j in 0..7 if 400*j <= i && i < 400*(j+1) cnts[j]=1 judge=false end end cnts[8]+=1 if judge end puts [cnts[0..7].inject(:+),cnts.inject(:+)].join(" ")
N=gets.to_i as=gets.split.map(&:to_i) cnts=Array.new(9,0) as.each do |i| judge=true for j in 0..7 if 400*j <= i && i < 400*(j+1) cnts[j]=1 judge=false end end cnts[8]+=1 if judge end puts [[1,cnts[0..7].inject(:+)].max,cnts.inject(:+)].join(" ")
[ "literal.array.change", "call.add" ]
1,366,634
1,366,635
u926099741
ruby
p03695
n = gets.to_i a = gets.split.map(&:to_i) a_c = a.count {|a_i|a_i>=3200} a.select! { |a_i| a_i < 3200 } types = (a.group_by { |a_i| a_i / 400 }).length puts "#{a_c == 0 ? types : 1} #{types + (a_c == 0 ? 0 : a_c)}"
n = gets.to_i a = gets.split.map(&:to_i) a_c = a.count {|a_i|a_i>=3200} a.select! { |a_i| a_i < 3200 } types = (a.group_by { |a_i| a_i / 400 }).length puts "#{types == 0 ? 1 : types} #{types + (a_c == 0 ? 0 : a_c)}"
[ "literal.string.change", "call.arguments.change" ]
1,366,638
1,366,639
u390727364
ruby
p03695
n = gets.to_i nums = gets.split.map(&:to_i) colors = Hash.new(0) nums.each do |num| if num < 400 colors[:gray] = 1 elsif num < 800 colors[:brown] = 1 elsif num < 1200 colors[:green] = 1 elsif num < 1600 colors[:aqua] = 1 elsif num < 2000 colors[:blue] = 1 elsif num < 2400 colors[:yellow] = 1 elsif num < 2800 colors[:orange] = 1 elsif num < 3200 colors[:red] = 1 else colors[:rainbow] += 1 end end max = colors.values.inject(:+) min = max - colors[:rainbow] puts "#{min} #{max}"
n = gets.to_i nums = gets.split.map(&:to_i) colors = Hash.new(0) nums.each do |num| if num < 400 colors[:gray] = 1 elsif num < 800 colors[:brown] = 1 elsif num < 1200 colors[:green] = 1 elsif num < 1600 colors[:aqua] = 1 elsif num < 2000 colors[:blue] = 1 elsif num < 2400 colors[:yellow] = 1 elsif num < 2800 colors[:orange] = 1 elsif num < 3200 colors[:red] = 1 else colors[:rainbow] += 1 end end max = colors.values.inject(:+) min = [max - colors[:rainbow], 1].max puts "#{min} #{max}"
[ "call.add" ]
1,366,644
1,366,645
u653737129
ruby
p03695
n = gets.to_i ary = gets.split.map(&:to_i) aryC = Array.new(9, 0) ary.each do |i| if i > 3200 i = 3200 end aryC[i / 400] += 1 end changeable = aryC.pop aryC.delete(0) puts [aryC.size, aryC.size + changeable].join(" ")
n = gets.to_i ary = gets.split.map(&:to_i) aryC = Array.new(9, 0) ary.each do |i| if i > 3200 i = 3200 end aryC[i / 400] += 1 end changeable = aryC.pop aryC.delete(0) puts [[aryC.size, 1].max, aryC.size + changeable].join(" ")
[ "call.arguments.change", "call.add" ]
1,366,883
1,366,884
u785521224
ruby
p03695
N = gets a = gets.split.map(&:to_i) n1 = a.select { |i| i < 3200 }.group_by { |i| i / 400 }.size n2 = a.select { |i| i >= 3200 }.size puts [ [n1, 0].max, n1 + n2 ].join(" ")
N = gets a = gets.split.map(&:to_i) n1 = a.select { |i| i < 3200 }.group_by { |i| i / 400 }.size n2 = a.select { |i| i >= 3200 }.size puts [ [n1, 1].max, n1 + n2 ].join(" ")
[ "literal.number.integer.change", "call.arguments.change" ]
1,367,035
1,367,036
u736611421
ruby
p03695
n=[0]*9 gets gets.split.map(&:to_i).each do |a| n[[a/400, 8].min] += 1 end m=n[0...-1].count{|i|i!=0} puts [[m,1].max, [m+n[-1],8].min]*" "
n=[0]*9 gets gets.split.map(&:to_i).each do |a| n[[a/400, 8].min] += 1 end m=n[0...-1].count{|i|i!=0} puts [[m,1].max, m+n[-1]]*" "
[ "call.arguments.change", "call.remove" ]
1,367,410
1,367,411
u647875062
ruby
p03695
gets xs = gets.split(' ').map(&:to_i).map{ |v| v / 400 }.group_by{|v| v} ranks = xs.select{|k,v| k < 8} wc = xs.select{|k,v| k >= 8}.values.flatten min = ranks.keys.length min = 1 if min == 0 && wc.length > 0 max = ranks.keys.length max = [8, [max, max + wc.length].max].min puts min.to_s + ' ' + max.to_s
gets xs = gets.split(' ').map(&:to_i).map{ |v| v / 400 }.group_by{|v| v} ranks = xs.select{|k,v| k < 8} wc = xs.select{|k,v| k >= 8}.values.flatten min = ranks.keys.length min = 1 if min == 0 && wc.length > 0 max = ranks.keys.length max = [max, max + wc.length].max puts min.to_s + ' ' + max.to_s
[ "call.remove" ]
1,367,471
1,367,472
u414541383
ruby
p03695
gets; As = gets.split.map(&:to_i) c = As.reject{|a| a >= 3200}.group_by{|a| a / 400}.size printf "%d %d\n", [c, 1].max, [c + As.count{|a| a >= 3200}, 8].min
gets; As = gets.split.map(&:to_i) c = As.reject{|a| a >= 3200}.group_by{|a| a / 400}.size printf "%d %d\n", [c, 1].max, c + As.count{|a| a >= 3200}
[ "call.arguments.change", "call.remove" ]
1,367,530
1,367,531
u304198114
ruby
p03695
# gets # disrad 1 line input = gets.chomp.split.map{|e| e.to_i / 400 } input_less = input.select{|item| item < 8} input_more = input.select{|item| item >= 8} if input_less.length > 0 answer_min = input_less.uniq.length answer_max = answer_min + input_more.length else answer_min = 1 answer_max = input_more.length end puts "#{answer_min} #{answer_max}"
gets # disrad 1 line input = gets.chomp.split.map{|e| e.to_i / 400 } input_less = input.select{|item| item < 8} input_more = input.select{|item| item >= 8} if input_less.length > 0 answer_min = input_less.uniq.length answer_max = answer_min + input_more.length else answer_min = 1 answer_max = input_more.length end puts "#{answer_min} #{answer_max}"
[]
1,367,580
1,367,581
u790487011
ruby
p03696
n = gets.to_i s = gets.chop #a = s.chop a = s n.times { a.gsub!(/\(\)/, '')} r = a.chars.count{|c| c == "("} l = a.chars.count{|c| c == ")"} puts "(" * l + s + ")" * r
n = gets.to_i s = gets.chop #a = s.chop a = s.clone n.times { a.gsub!(/\(\)/, '')} r = a.chars.count{|c| c == "("} l = a.chars.count{|c| c == ")"} puts "(" * l + s + ")" * r
[ "call.add" ]
1,368,021
1,368,022
u698501698
ruby
p03696
n = gets.to_i s = gets.chop #a = s.chop a = s n.times { a.gsub!("()", '')} r = a.chars.count{|c| c == "("} l = a.chars.count{|c| c == ")"} puts "(" * l + s + ")" * r
n = gets.to_i s = gets.chop #a = s.chop a = s.clone n.times { a.gsub!(/\(\)/, '')} r = a.chars.count{|c| c == "("} l = a.chars.count{|c| c == ")"} puts "(" * l + s + ")" * r
[ "call.add", "call.arguments.change" ]
1,368,023
1,368,022
u698501698
ruby
p03697
a gets.split.map(&:to_i).reduce(:+) puts a > 9 ? 'error' : a
a = gets.split.map(&:to_i).reduce(:+) puts a > 9 ? 'error' : a
[]
1,368,548
1,368,549
u173515518
ruby
p03696
#input = ( ["("]*rand(100) + [")"]*rand(100) ).shuffle.inject(""){|memo, item| memo += item; memo} gets input = gets s = input while s.gsub!(/\(\)/, "") end l = s.count("(") r = s.count(")") puts "("*r + input + ")"*l
#input = ( ["("]*rand(100) + [")"]*rand(100) ).shuffle.inject(""){|memo, item| memo += item; memo} gets input = gets s = input.chomp while s.gsub!(/\(\)/, "") end l = s.count("(") r = s.count(")") puts "("*r + input.chomp + ")"*l
[ "call.add" ]
1,368,849
1,368,850
u790487011
ruby
p03697
a,b=gets.split.map &:to_i; puts a+b<=10 ? "error" : a+b
a,b=gets.split.map &:to_i; puts a+b>=10 ? "error" : a+b
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
1,368,926
1,368,927
u049159332
ruby
p03697
a, b = gets.strip.split.map(&:to_i) foo = a + b puts foo <= 10 ? foo : 'error'
a, b = gets.strip.split.map(&:to_i) foo = a + b puts foo < 10 ? foo : 'error'
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
1,368,936
1,368,937
u561391668
ruby
p03697
A, B = gets.chomp.split.map(&:to_i) if A + B <= 10 then puts A+B else puts 'error' end
A, B = gets.chomp.split.map(&:to_i) if A + B < 10 then puts A+B else puts 'error' end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
1,368,961
1,368,962
u938270657
ruby
p03697
a,b = get.split.map(&:to_i) puts (a + b >= 10 ? 'error' : a + b)
a,b = gets.split.map(&:to_i) puts (a + b >= 10 ? 'error' : a + b)
[ "assignment.value.change", "identifier.change" ]
1,369,083
1,369,084
u627981707
ruby
p03697
A,B = gets.split.map(&:to_i) puts ( A + B ) < 10 ? (A + B) : "10"
A,B = gets.split.map(&:to_i) puts ( A + B ) < 10 ? (A + B) : "error"
[ "literal.string.change", "call.arguments.change" ]
1,369,218
1,369,219
u693378622
ruby
p03697
A,B = gets.split.map(&:to_i) puts ( A + B ) < 10 ? (A + B) : 10
A,B = gets.split.map(&:to_i) puts ( A + B ) < 10 ? (A + B) : "error"
[ "call.arguments.change" ]
1,369,220
1,369,219
u693378622
ruby
p03697
a,b=gets.split.map &:to_i puts g=a+b >=10 ? :error : g
a,b=gets.split.map &:to_i puts (g=a+b) >=10 ? :error : g
[ "control_flow.branch.if.condition.change" ]
1,369,262
1,369,263
u554838392
ruby
p03698
s = gets.split('').map(&:to_s) if s == s.uniq puts 'Yes' else puts 'No' end
s = gets.split('').map(&:to_s) if s == s.uniq puts 'yes' else puts 'no' end
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
1,369,424
1,369,426
u802039083
ruby
p03698
s = gets.chomp.split hash = Hash.new(0) check = 0 s.each do |a| hash[a] += 1 check += 1 if hash[a] >= 2 end if check >= 1 puts :no else puts :yes end
s = gets.chomp.split('') hash = Hash.new(0) check = 0 s.each do |a| hash[a] += 1 check += 1 if hash[a] >= 2 end if check >= 1 puts :no else puts :yes end
[ "call.arguments.add" ]
1,369,538
1,369,539
u437368899
ruby
p03698
s = gets.chomo.split hash = Hash.new(0) check = 0 s.each do |a| hash[a] += 1 check += 1 if hash[a] >= 2 end if check >= 1 puts :no else puts :yes end
s = gets.chomp.split('') hash = Hash.new(0) check = 0 s.each do |a| hash[a] += 1 check += 1 if hash[a] >= 2 end if check >= 1 puts :no else puts :yes end
[ "assignment.value.change", "identifier.change", "call.arguments.add" ]
1,369,540
1,369,539
u437368899
ruby
p03697
require 'prime' require 'set' require 'tsort' include Math def max(a,b); a > b ? a : b end def min(a,b); a < b ? a : b end def swap(a,b); a, b = b, a end def gif; gets.to_i end def gff; gets.to_f end def gsf; gets.chomp end def gi; gets.split.map(&:to_i) end def gf; gets.split.map(&:to_f) end def gs; gets.chomp.split.map(&:to_s) end def gc; gets.chomp.split('') end def pr(num); num.prime_division end def digit(num); num.to_s.length end def array(s,ini=nil); Array.new(s){ini} end def darray(s1,s2,ini=nil); Array.new(s1){Array.new(s2){ini}} end def rep(num); num.times{|i|yield(i)} end def repl(st,en,n=1); st.step(en,n){|i|yield(i)} end n = gi if n[0]+n[1] >=10 puts "error" else putsa n[0]+n[1] end
require 'prime' require 'set' require 'tsort' include Math def max(a,b); a > b ? a : b end def min(a,b); a < b ? a : b end def swap(a,b); a, b = b, a end def gif; gets.to_i end def gff; gets.to_f end def gsf; gets.chomp end def gi; gets.split.map(&:to_i) end def gf; gets.split.map(&:to_f) end def gs; gets.chomp.split.map(&:to_s) end def gc; gets.chomp.split('') end def pr(num); num.prime_division end def digit(num); num.to_s.length end def array(s,ini=nil); Array.new(s){ini} end def darray(s1,s2,ini=nil); Array.new(s1){Array.new(s2){ini}} end def rep(num); num.times{|i|yield(i)} end def repl(st,en,n=1); st.step(en,n){|i|yield(i)} end n = gi if n[0]+n[1] >=10 puts "error" else puts (n[0]+n[1]) end
[ "identifier.change", "call.arguments.change" ]
1,369,545
1,369,546
u988228861
ruby
p03698
S = gets.chomp if S == S.squeeze puts "yes" else puts "no" end
S = gets.chomp.chars if S == S.uniq puts "yes" else puts "no" end
[ "call.add", "identifier.change", "control_flow.branch.if.condition.change" ]
1,369,621
1,369,622
u877283726
ruby
p03698
S = gets.chomp if S == S.squeeze p "yes" else p "no" end
S = gets.chomp.chars if S == S.uniq puts "yes" else puts "no" end
[ "call.add", "call.function.change", "io.output.change" ]
1,369,623
1,369,622
u877283726
ruby
p03698
# frozen_string_literal: true arr = gets.chomp!.split('') exist = Hash.new(false) ans = 'Yes' arr.each do |e| ans = 'No' if exist[e] exist[e] = true end puts ans
# frozen_string_literal: true arr = gets.chomp!.split('') exist = Hash.new(false) ans = 'yes' arr.each do |e| ans = 'no' if exist[e] exist[e] = true end puts ans
[ "literal.string.change", "literal.string.case.change", "assignment.value.change" ]
1,369,710
1,369,711
u315984289
ruby
p03698
a=gets.chars a.uniq.size==a.size ? "yes":"no"
a=gets.chars puts a.uniq.size==a.size ? "yes":"no"
[ "io.output.change", "call.add" ]
1,369,860
1,369,861
u085647568
ruby
p03698
strings = gets.split puts strings.all? { |v| strings.count(v) == 1 } ? 'yes' : 'no'
strings = gets.split('') puts strings.all? { |v| strings.count(v) == 1 } ? 'yes' : 'no'
[ "call.arguments.add" ]
1,369,875
1,369,876
u075012704
ruby
p03698
string = gets.split('') if string.map { |s| string.grep(s).length }.any? {|v| v > 1 } p 'no' else p 'yes' end
string = gets.split('') if string.map { |s| string.grep(s).length }.any? {|v| v > 1 } print 'no' else print 'yes' end
[ "call.function.change", "io.output.change" ]
1,369,877
1,369,878
u111813202
ruby
p03698
a = gets.split ('') if (a.count - a.uniq.count) > 0 puts "No" else puts "Yes" end
a = gets.split ('') if (a.count - a.uniq.count) > 0 puts "no" else puts "yes" end
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
1,369,988
1,369,989
u414166540
ruby
p03698
s = gets.chomp puts s.squeeze.size == s.size ? 'yes' : 'no'
s = gets.chomp.chars puts s.uniq.size == s.size ? 'yes' : 'no'
[ "call.add", "identifier.change", "control_flow.branch.if.condition.change" ]
1,370,235
1,370,236
u627778494
ruby
p03698
s = gets.chomp if s == s.chars.uniq puts "yes" else puts "no" end
s = gets.chomp if s.length == s.chars.uniq.length puts "yes" else puts "no" end
[ "control_flow.branch.if.condition.change", "call.add" ]
1,370,321
1,370,322
u001025229
ruby
p03698
s = gets.chomp if s.length == s.uniq.length puts "yes" else puts "no" end
s = gets.chomp if s.length == s.chars.uniq.length puts "yes" else puts "no" end
[ "control_flow.branch.if.condition.change", "call.add" ]
1,370,324
1,370,322
u001025229
ruby
p03698
s = gets.chomp.split("") l = s.uniq if l.length == s.length puts "Yes" else puts "No" end
s = gets.chomp.split("") l = s.uniq if l.length == s.length puts "yes" else puts "no" end
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
1,370,353
1,370,354
u990788654
ruby
p03698
str = gets.split("") n=str.size flag = true str = str.sort for i in 0..n-2 do if(str[i]==str[i+2]) flag = false end end puts (flag ? "yes":"no")
str = gets.split("") n=str.size flag = true str = str.sort for i in 0..n-2 do if(str[i]==str[i+1]) flag = false end end puts (flag ? "yes":"no")
[ "literal.number.integer.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change" ]
1,370,553
1,370,554
u415041731
ruby
p03698
str = gets.chomp ary = {} str.each_char{|c| if ary[c].nil? then ary[c] = 1 else ary[c] += 1 end} r = false ary.each{|a|r = true if a[1] > 1} if r then 'yes' else 'no' end
str = gets.chomp ary = {} str.each_char{|c| if ary[c].nil? then ary[c] = 1 else ary[c] += 1 end} r = true ary.each{|a|r = false if a[1] > 1} puts (if r then 'yes' else 'no' end)
[ "misc.opposites", "assignment.value.change", "call.add", "call.arguments.change" ]
1,370,584
1,370,585
u315288101
ruby
p03698
s = gets.chomp.split("") n = s.length if s.unique.length == n then puts "yes" else puts "no" end
s = gets.chomp.split("") n = s.length if s.uniq.length == n then puts "yes" else puts "no" end
[ "identifier.change", "control_flow.branch.if.condition.change" ]
1,370,672
1,370,673
u910756197
ruby
p03698
puts`dd`[/(.).*\1/]?:yes : :no
puts`dd`[/(.).*\1/]?:no: :yes
[]
1,370,693
1,370,694
u711705317
ruby
p03698
puts`dd`[/(.).*\1/]?:yes : :no
puts`dd`[/(.).*\1/]?:no : :yes
[]
1,370,693
1,370,695
u711705317
ruby
p03699
n = gets.to_i s = n.times.map{gets.to_i}.sort ans = s.inject(:+) flag = false if ans % 10 == 0 n.times do |i| if s[i] % 10 != 0 ans -= s[i] flag = true break end end end ans = 0 if !flag puts ans
n = gets.to_i s = n.times.map{gets.to_i}.sort ans = s.inject(:+) flag = false if ans % 10 == 0 n.times do |i| if s[i] % 10 != 0 ans -= s[i] flag = true break end end else flag = true end ans = 0 if !flag puts ans
[ "assignment.add" ]
1,370,941
1,370,942
u238956837
ruby
p03699
n = gets.chomp.to_i scores = [] n.times do scores.push(gets.chomp.to_i) end scores.sort! p scores sum = scores.inject(:+) p sum if sum % 10 == 0 scores.each do |score| if score % 10 != 0 puts sum - score exit end end else puts sum exit end puts 0
n = gets.chomp.to_i scores = [] n.times do scores.push(gets.chomp.to_i) end scores.sort! sum = scores.inject(:+) if sum % 10 == 0 scores.each do |score| if score % 10 != 0 puts sum - score exit end end else puts sum exit end puts 0
[ "call.remove" ]
1,371,116
1,371,117
u429775245
ruby
p03699
points = [] n = 0 sum = 0 cnt = 0 while line = gets points[n] = line.to_i n += 1 end points.shift() points.sort! points.each{|var| sum += var } #p(points) while true if sum % 10 != 0 break elsif cnt == points.length #sum = 0 break elsif points[cnt] % 10 != 0 sum -= points[cnt] cnt += 1 else cnt += 1 end end p(sum)
points = [] n = 0 sum = 0 cnt = 0 while line = gets points[n] = line.to_i n += 1 end points.shift() points.sort! points.each{|var| sum += var } #p(points) while true if sum % 10 != 0 break elsif cnt == points.length sum = 0 break elsif points[cnt] % 10 != 0 sum -= points[cnt] cnt += 1 else cnt += 1 end end p(sum)
[ "assignment.add" ]
1,371,576
1,371,577
u080877599
ruby
p03700
n, a, b = gets.chomp.split.map(&:to_i) arr = [] n.times{arr << gets.to_i} l, r = 0, 10**9 # 10**9+1ってやってたけど、取り得る最大値でいいのか... while r-l > 1 do mid = (l+r)/2 # mid回と仮定して計算 count = 0 temp_arr = arr.map{|x|x-mid*b} # 体力が残っているやつをA-Bで何回で倒せるかカウント # (A>BかつBで叩き済みなので差で殴る) temp_arr.each do |x| next if x<=0 # 死んでいる count += x%(a-b)>0 ? x/(a-b) + 1 : x/(a-b) end if mid < count # まだ叩けるので増やす l = mid +1 else # 叩きすぎたので減らす r = mid end end puts (r+l)/2
n, a, b = gets.chomp.split.map(&:to_i) arr = [] n.times{arr << gets.to_i} l, r = 0, 10**9+1 while r-l >= 1 do # r-l>1にしてたんだけどダメなのか mid = (l+r)/2 # mid回と仮定して計算 count = 0 temp_arr = arr.map{|x|x-mid*b} # 体力が残っているやつをA-Bで何回で倒せるかカウント # (A>BかつBで叩き済みなので差で殴る) temp_arr.each do |x| next if x<=0 # 死んでいる # ちょうどmid*(a-b)回で倒せない場合はもっかいたたけば倒せる count += x%(a-b)>0 ? x/(a-b) + 1 : x/(a-b) end if mid < count # まだ叩けるので増やす l = mid +1 else # 叩きすぎたので減らす r = mid end end puts (r+l)/2
[ "expression.operator.compare.change", "expression.operation.binary.change" ]
1,372,190
1,372,191
u445624660
ruby
p03700
n, a, b = gets.chomp.split.map(&:to_i) arr = [] n.times{arr << gets.to_i} l, r = 0, 10**9 # 10**9+1ってやってたけど、取り得る最大値でいいのか... while r-l > 1 do mid = (l+r)/2 # mid回と仮定して計算 count = 0 temp_arr = arr.map{|x|x-mid*b} # 体力が残っているやつをA-Bで何回で倒せるかカウント # (A>BかつBで叩き済みなので差で殴る) temp_arr.each do |x| next if x<=0 # 死んでいる count += x%(a-b)>0 ? x/(a-b) + 1 : x/(a-b) end if mid < count # まだ叩けるので増やす l = mid +1 else # 叩きすぎたので減らす r = mid end end puts (r+l)/2
n, a, b = gets.chomp.split.map(&:to_i) arr = [] n.times{arr << gets.to_i} l, r = 0, 10**9 # 10**9+1ってやってたけど、取り得る最大値でいいのか... while r-l >= 1 do # r-l>1にしてたんだけどダメなのか mid = (l+r)/2 # mid回と仮定して計算 count = 0 temp_arr = arr.map{|x|x-mid*b} # 体力が残っているやつをA-Bで何回で倒せるかカウント # (A>BかつBで叩き済みなので差で殴る) temp_arr.each do |x| next if x<=0 # 死んでいる count += x%(a-b)>0 ? x/(a-b) + 1 : x/(a-b) # count += x/(a-b) end if mid < count # まだ叩けるので増やす l = mid +1 else # 叩きすぎたので減らす r = mid end end puts (r+l)/2
[ "expression.operator.compare.change", "expression.operation.binary.change" ]
1,372,190
1,372,192
u445624660
ruby
p03700
n,a,b=gets.split.map(&:to_i) h=(1..n).map{gets.to_i} r=1000000000 l=1 while l<r p [l,r] c=(l+r)/2 if h.map{|i|[(i-c*b+a-b-1)/(a-b),0].max}.inject(:+) <= c r=c else l=c+1 end end p l
n,a,b=gets.split.map(&:to_i) h=(1..n).map{gets.to_i} r=1000000000 l=1 while l<r c=(l+r)/2 if h.map{|i|[(i-c*b+a-b-1)/(a-b),0].max}.inject(:+) <= c r=c else l=c+1 end end p l
[ "call.remove" ]
1,372,515
1,372,516
u353917577
ruby
p03699
n = gets.to_i input = Array.new n.times do |i| input << gets.to_i end sum = input.inject(:+) if sum % 10 != 0 then puts sum else input.sort! n.times do |i| if input[i] %10 != 0 puts sum - input[i] end end puts 0 end
n = gets.to_i input = Array.new n.times do |i| input << gets.to_i end sum = input.inject(:+) if sum % 10 != 0 then puts sum else input.sort! n.times do |i| if input[i] %10 != 0 puts sum - input[i] exit end end puts 0 end
[ "control_flow.exit.add" ]
1,372,703
1,372,704
u409390792
ruby
p03699
n = gets.chomp.to_i score = [] n.times do score << gets.chomp.to_i end sum = score.inject(&:+) valid = score.select{|s| s % 10 != 0} puts valid.empty? ? "0" : (sum % 10 == 0) ? sum - score.min : sum
n = gets.chomp.to_i score = [] n.times do score << gets.chomp.to_i end sum = score.inject(&:+) valid = score.select{|s| s % 10 != 0} puts valid.empty? ? "0" : (sum % 10 == 0) ? sum - valid.min : sum
[ "identifier.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
1,372,728
1,372,729
u872636244
ruby
p03699
a=(1..gets.to_i).map{gets.to_i}.sort sum=a.inject(:+) if sum%10==0 p sum-a.find{|i|i%10!=0} else p sum end
a=(1..gets.to_i).map{gets.to_i}.sort sum=a.inject(:+) if sum%10==0 p sum-(a.find{|i|i%10!=0}||sum) else p sum end
[ "call.arguments.change" ]
1,372,772
1,372,773
u353917577
ruby
p03695
eval"_,*A="+`dd`.split*?,;B,C=A.partition{|n|n<3200};puts"#{m=B.group_by{|n|n/400}.size} #{m+C.size}"
eval"_,*A="+`dd`.split*?,;B,C=A.partition{|n|n<3200};puts"#{[m=B.group_by{|n|n/400}.size,1].max} #{m+C.size}"
[ "literal.string.change", "call.arguments.change" ]
1,373,607
1,373,608
u711705317
ruby
p03695
gets list = gets.split.map(&:to_i).map{|i|i/400} ans = (0..7).count{|i|list.include?(i)} puts "%d %d"%[ans, ans+list.count{|i|i>7}]
gets list = gets.split.map(&:to_i).map{|i|i/400} ans = (0..7).count{|i|list.include?(i)} puts "%d %d"%[[ans,1].max, ans+list.count{|i|i>7}]
[ "call.arguments.change" ]
1,373,628
1,373,629
u353917577
ruby
p03695
N = gets.to_i a = gets.split.map(&:to_i) rates = [0,0,0,0, 0,0,0,0] any = 0 a.map{|r| if r<3200 then rates[r/400] += 1 else any += 1 end } col = rates.select{|rc| rc>0}.size puts col.to_s + " " + (col+any).to_s
N = gets.to_i a = gets.split.map(&:to_i) rates = [0,0,0,0, 0,0,0,0] any = 0 a.map{|r| if r<3200 then rates[r/400] += 1 else any += 1 end } col = rates.select{|rc| rc>0}.size puts [col, 1].max.to_s + " " + (col+any).to_s
[ "call.arguments.change", "call.add" ]
1,373,632
1,373,633
u397763977
ruby
p03695
n=gets.to_i a=$<.read.split.map{|x|x.to_i/400} s=a.select{|x|x<8}.uniq.size t=a.select{|x|x>7}.size if(s==0) puts "#{n} #{n}" else puts "#{s} #{s+t}" end
n=gets.to_i a=$<.read.split.map{|x|x.to_i/400} s=a.select{|x|x<8}.uniq.size t=a.select{|x|x>7}.size if(s==0) puts "1 #{n}" else puts "#{s} #{s+t}" end
[ "literal.string.change", "call.arguments.change" ]
1,373,653
1,373,654
u017744950
ruby
p03695
gets colors = [false] * 8 top = 0 gets.split(" ").each do |e| v = e.to_i / 400 if v <= 7 colors[v] = true else top += 1 end end min = [colors.count {|v|v}, 1].max max = [colors.count {|v|v} + top, 8].min puts "#{min} #{max}"
gets colors = [false] * 8 top = 0 gets.split(" ").each do |e| v = e.to_i / 400 if v <= 7 colors[v] = true else top += 1 end end min = [colors.count {|v|v}, 1].max max = colors.count {|v|v} + top puts "#{min} #{max}"
[ "call.remove" ]
1,373,707
1,373,708
u286149069
ruby
p03711
x,y=gets.split.map &:to_i a=[1,3,5,7,8,10,12] b=[4,6,9,11] c=[2] if (a.include?(x) && a.include?(y)) || (b.include?(x) && b.inlucde?(y)) || (c.include?(x) && c.include?(y)) puts 'Yes' else puts 'No' end #puts xy.all?{|i| a.include?(i) || b.include?(i) || c.include?(i)} ? 'Yes' : 'No'
x,y=gets.split.map &:to_i a=[1,3,5,7,8,10,12] b=[4,6,9,11] c=[2] puts (a.include?(x) && a.include?(y)) || (b.include?(x) && b.include?(y)) || (c.include?(x) && c.include?(y)) ? 'Yes' : 'No'
[ "identifier.change", "control_flow.branch.if.condition.change", "io.output.change", "call.remove" ]
1,377,224
1,377,225
u630043039
ruby
p03711
x,y=gets.split.map &:to_i a=[1,3,5,7,8,10,12] b=[4,6,9,11] c=[2] if (a.include?(x) && a.include?(y)) || (b.include?(x) && b.inlucde?(y)) || (c.include?(x) && c.include?(y)) puts 'Yes' else puts 'No' end #puts xy.all?{|i| a.include?(i) || b.include?(i) || c.include?(i)} ? 'Yes' : 'No'
x,y=gets.split.map &:to_i a=[1,3,5,7,8,10,12] b=[4,6,9,11] c=[2] if (a.include?(x) && a.include?(y)) || (b.include?(x) && b.include?(y)) || (c.include?(x) && c.include?(y)) puts 'Yes' else puts 'No' end
[ "identifier.change", "control_flow.branch.if.condition.change" ]
1,377,224
1,377,226
u630043039
ruby
p03708
f=->n{n>0?1<<n.bit_length: 0};a,b=$<.map &:to_i;p (c=f[a^b])-(a&=c-1)-[a-f[(b&~-c)-c/2],0].max
f=->n{1<<n.bit_length};a,b=$<.map &:to_i;p (c=f[a^b])-(a&=c-1)-[a-f[(b&~-c)-c/2],0].max
[]
1,377,485
1,377,486
u283869437
ruby
p03711
a=gets.split.map do |i| i = i.to_i i==2 ? 2 : [1,3,5,7,8,10,12].include?(i) ? 1 : 0 end puts a.uniq.size==2 ? "Yes" : "No"
a=gets.split.map do |i| i = i.to_i i==2 ? 2 : [1,3,5,7,8,10,12].include?(i) ? 1 : 0 end puts a.uniq.size==2 ? "No" : "Yes"
[ "literal.string.change", "call.arguments.change" ]
1,377,737
1,377,738
u966810027
ruby
p03711
x,y=gets.split.map &:to_i A=[4,6,9,11],B=[1,3,5,7,8,10,12] puts A.include?(x)&&A.include?(y)||B.include?(x)&&B.include?(y)||x==2&&y==2 ? :Yes: :No
x,y=gets.split.map &:to_i A=[4,6,9,11] B=[1,3,5,7,8,10,12] puts A.include?(x)&&A.include?(y)||B.include?(x)&&B.include?(y)||x==2&&y==2 ? :Yes: :No
[]
1,377,815
1,377,816
u025592199
ruby
p03711
def f(x) case when 4,6,9,11 1 when 2 2 else 3 end end x, y = gets.split.map(&:to_i) puts f(x) == f(y) ? "Yes": "No"
def f(x) case x when 4,6,9,11 1 when 2 2 else 3 end end x, y = gets.split.map(&:to_i) puts f(x) == f(y) ? "Yes": "No"
[]
1,377,841
1,377,842
u056944756
ruby
p03711
x, y = gets.split.map(&:to_i) if [1, 3, 5, 7, 8, 10, 12].find {|n| n == x} != nil if [1, 3, 5, 7, 8, 10, 12].find {|n| n == y} != nil puts 'Yes' else puts 'No' end elsif [4, 6, 9, 11].find {|n| n == x} != nil if [4, 6, 9, 11].find {|n| n == x} != nil puts 'Yes' elsif puts 'No' end elsif puts 'No' end
x, y = gets.split.map(&:to_i) if [1, 3, 5, 7, 8, 10, 12].find {|n| n == x} != nil if [1, 3, 5, 7, 8, 10, 12].find {|n| n == y} != nil puts 'Yes' else puts 'No' end elsif [4, 6, 9, 11].find {|n| n == x} != nil if [4, 6, 9, 11].find {|n| n == y} != nil puts 'Yes' elsif puts 'No' end else puts 'No' end
[ "identifier.change", "control_flow.branch.if.condition.change" ]
1,377,917
1,377,918
u163340796
ruby
p03711
x,y = gets.split.map{|num|num.to_i} g1 = [1,3,5,7,8,10,12] g2 = [4,5,9,11] g3 = [2] if g1.include?(x) && g1.include?(y) puts "Yes" elsif g2.include?(x) && g2.include?(y) puts "Yes" elsif g3.include?(x) && g3.include?(y) puts "Yes" else puts "No" end
x,y = gets.split.map{|num|num.to_i} g1 = [1,3,5,7,8,10,12] g2 = [4,6,9,11] g3 = [2] if g1.include?(x) && g1.include?(y) puts "Yes" elsif g2.include?(x) && g2.include?(y) puts "Yes" elsif g3.include?(x) && g3.include?(y) puts "Yes" else puts "No" end
[ "literal.number.integer.change", "assignment.value.change" ]
1,378,244
1,378,245
u273927571
ruby
p03711
a = [1,3,5,7,8,10,12] b = [4,6,9,11] c = [2] x,y = gets.chomp.split.map(&:to_i) if x == 2 || y == 2 puts 'No' elsif a.include?(x) && a.include?(y) || b.include?(x) && b.include(y) puts 'Yes' else puts 'No' end
a = [1,3,5,7,8,10,12] b = [4,6,9,11] c = [2] x,y = gets.chomp.split.map(&:to_i) if x == 2 || y == 2 puts 'No' elsif a.include?(x) && a.include?(y) || b.include?(x) && b.include?(y) puts 'Yes' else puts 'No' end
[ "call.suffix.change" ]
1,379,549
1,379,550
u018539875
ruby
p03711
groupa = [1,3,5,7,8,10,12] groupb = [4,6,9,11] groupc = [2] inputs = gets.split(' ') x = inputs[0].to_i y = inputs[1].to_i if (groupa.include?(x) and groupa.include?(y)) or (groupb.include?(x) and groupb.include?(y)) or (groupc.include?(x) and groupc.include?(y)) p 'Yes' else p 'No' end
groupa = [1,3,5,7,8,10,12] groupb = [4,6,9,11] groupc = [2] inputs = gets.split(' ') x = inputs[0].to_i y = inputs[1].to_i if (groupa.include?(x) and groupa.include?(y)) or (groupb.include?(x) and groupb.include?(y)) or (groupc.include?(x) and groupc.include?(y)) puts 'Yes' else puts 'No' end
[ "call.function.change", "io.output.change" ]
1,379,570
1,379,571
u119099532
ruby
p03711
X, Y = gets.split.take(2).map(&:to_i) a = [[1,3,5,7,8,12],[4,6,9,11],[2]] puts a.index{|b|b.include?(X)} == a.index{|b|b.include?(Y)} ? :Yes : :No
X, Y = gets.split.take(2).map(&:to_i) a = [[1,3,5,7,8,10,12],[4,6,9,11],[2]] puts a.index{|b|b.include?(X)} == a.index{|b|b.include?(Y)} ? :Yes : :No
[ "literal.array.change" ]
1,379,626
1,379,627
u711705317
ruby
p03713
h, w = gets.chomp.split.map(&:to_i) ans = h * w def min(a,b) a < b ? a : b end def max(a,b) a > b ? a : b end # 分割は4パターンということがわかる # HとWの大きさを入れ替えたりすれば同じやりかたでいけるので2パターンについて考察する # たて3つに分割した場合でも、T時の場合でも一番上の大きさは同じ # たて 1.upto(h-1) do |i| s_1 = i * w s_2 = (w/2) * (h-i) s_3 = (w-w/2)* (h-i) s = [s_1, s_2, s_3] ans = min(s.max - s.min, ans) s_2 = ((h-i)/2) * w s_3 = ((h-i)-(h-i)/2)* w s = [s_1, s_2, s_3] ans = min(s.max - s.min, ans) end # よこ 1.upto(w-1) do |j| s_1 = h * j s_2 = (h/2) * (h-j) s_3 = (h-h/2)* (h-j) s = [s_1, s_2, s_3] ans = min(s.max - s.min, ans) s_2 = ((w-j)/2) * h s_3 = ((w-j)-(w-j)/2)* h s = [s_1, s_2, s_3] ans = min(s.max - s.min, ans) end p ans
h, w = gets.chomp.split.map(&:to_i) ans = h * w def min(a,b) a < b ? a : b end def max(a,b) a > b ? a : b end # 分割は4パターンということがわかる # HとWの大きさを入れ替えたりすれば同じやりかたでいけるので2パターンについて考察する # たて3つに分割した場合でも、T時の場合でも一番上の大きさは同じ # たて 1.upto(h-1) do |i| s_1 = i * w s_2 = (w/2) * (h-i) s_3 = (w-w/2)* (h-i) s = [s_1, s_2, s_3] ans = min(s.max - s.min, ans) s_2 = ((h-i)/2) * w s_3 = ((h-i)-(h-i)/2)* w s = [s_1, s_2, s_3] ans = min(s.max - s.min, ans) end # よこ 1.upto(w-1) do |j| s_1 = h * j s_2 = (h/2) * (w-j) s_3 = (h-h/2)* (w-j) s = [s_1, s_2, s_3] ans = min(s.max - s.min, ans) s_2 = ((w-j)/2) * h s_3 = ((w-j)-(w-j)/2)* h s = [s_1, s_2, s_3] ans = min(s.max - s.min, ans) end p ans
[ "assignment.value.change", "identifier.change", "expression.operation.binary.change" ]
1,380,045
1,380,046
u157887852
ruby
p03713
H,W = gets.split.map(&:to_i) if H % 3 == 0 || W % 3 == 0 puts 0 else if W % 2 == 0 answer1 = ((H- (2*H)/3)*W- (W/2)* ((2*H)/3)).abs answer2 = ((H - ((2*H)/3) - 1)*W- (W/2)* (((2*H)/3)+1)).abs answer3 = W * H answer4 = W * H else answer1 = [(H- (2*H)/3)*W,(W/2)* ((2*H)/3),((W/2)+1)* ((2*H)/3)].max - [(H- (2*H)/3)*W,(W/2)* ((2*H)/3),((W/2)+1)* ((2*H)/3)].min answer2 = [(H - ((2*H)/3) - 1)*W, (W/2)* (((2*H)/3)+1), ((W/2)+1)* (((2*H)/3)+1)].max- [(H - ((2*H)/3) - 1)*W, (W/2)* (((2*H)/3)+1), ((W/2)+1)* (((2*H)/3)+1)].min answer3 = [(H- ((2*W*H)/(3 * W+2)))*W,(W/2)* ((2*W*H)/(3 * W+2)),((W/2)+1)* ((2*W*H)/(3 * W+2))].max - [(H- ((2*W*H)/(3 * W+2)))*W,(W/2)* ((2*W*H)/(3 * W+2)),((W/2)+1)* ((2*W*H)/(3 * W+2))].min answer4 = [(H- ((2*W*H)/(3 * W+2)) -1 )*W,(W/2)* (((2*W*H)/(3 * W+2))+1),((W/2)+1)* (((2*W*H)/(3 * W+2))+1)].max - [(H- ((2*W*H)/(3 * W+2)) -1 )*W,(W/2)* (((2*W*H)/(3 * W+2))+1),((W/2)+1)* (((2*W*H)/(3 * W+2))+1)].min end if H % 2 == 0 answer5 = ((W- (2*W)/3)*H- (H/2)* ((2*W)/3)).abs answer6 = ((W - ((2*W)/3) - 1)*H- (H/2)* (((2*W)/3)+1)).abs answer7 = W * H answer8 = W * H else answer5 = [(W- (2*W)/3)*H,(H/2)* ((2*W)/3),((H/2)+1)* ((2*W)/3)].max - [(W- (2*W)/3)*H,(H/2)* ((2*W)/3),((H/2)+1)* ((2*W)/3)].min answer6 = [(W - ((2*W)/3) - 1)*H, (H/2)* (((2*W)/3)+ 1),((H/2)+1)* (((2*W)/3)+1)].max- [(W - ((2*W)/3) - 1)*H, (H/2)* (((2*W)/3)+1), ((H/2)+1)* (((2*W)/3)+1)].min answer7 = [(W- ((2*W*H)/(3 * H+2)))*H,(H/2)* ((2*W*H)/(3 * H+2)),((H/2)+1)* ((2*W*H)/(3 * H+2))].max - [(W- ((2*W*H)/(3 * H+2)))*H,(H/2)* ((2*W*H)/(3 * H+2)),((H/2)+1)* ((2*W*H)/(3 * H+2))].min answer8 = [(W- ((2*W*H)/(3 * H+2)) -1 )*H,(H/2)* (((2*W*H)/(3 * H+2))+1),((H/2)+1)* (((2*W*H)/(3 * H+2))+1)].max - [(W- ((2*W*H)/(3 * H+2)) -1 )*H,(H/2)* (((2*W*H)/(3 * H+2))+1),((H/2)+1)* (((2*W*H)/(3 * H+2))+1)].min end puts [answer1,answer2,answer3,answer4,answer5,answer6,answer7,answer8].min end
H,W = gets.split.map(&:to_i) if H % 3 == 0 || W % 3 == 0 puts 0 else if W % 2 == 0 answer1 = ((H- (2*H)/3)*W- (W/2)* ((2*H)/3)).abs answer2 = ((H - ((2*H)/3) - 1)*W- (W/2)* (((2*H)/3)+1)).abs answer3 = W * H answer4 = W * H else answer1 = [(H- (2*H)/3)*W,(W/2)* ((2*H)/3),((W/2)+1)* ((2*H)/3)].max - [(H- (2*H)/3)*W,(W/2)* ((2*H)/3),((W/2)+1)* ((2*H)/3)].min answer2 = [(H - ((2*H)/3) - 1)*W, (W/2)* (((2*H)/3)+1), ((W/2)+1)* (((2*H)/3)+1)].max- [(H - ((2*H)/3) - 1)*W, (W/2)* (((2*H)/3)+1), ((W/2)+1)* (((2*H)/3)+1)].min answer3 = [(H- ((2*W*H)/(3 * W+2)))*W,(W/2)* ((2*W*H)/(3 * W+2)),((W/2)+1)* ((2*W*H)/(3 * W+2))].max - [(H- ((2*W*H)/(3 * W+2)))*W,(W/2)* ((2*W*H)/(3 * W+2)),((W/2)+1)* ((2*W*H)/(3 * W+2))].min answer4 = [(H- ((2*W*H)/(3 * W+2)) -1 )*W,(W/2)* (((2*W*H)/(3 * W+2))+1),((W/2)+1)* (((2*W*H)/(3 * W+2))+1)].max - [(H- ((2*W*H)/(3 * W+2)) -1 )*W,(W/2)* (((2*W*H)/(3 * W+2))+1),((W/2)+1)* (((2*W*H)/(3 * W+2))+1)].min end if H % 2 == 0 answer5 = ((W- (2*W)/3)*H- (H/2)* ((2*W)/3)).abs answer6 = ((W - ((2*W)/3) - 1)*H- (H/2)* (((2*W)/3)+1)).abs answer7 = W * H answer8 = W * H else answer5 = [(W- (2*W)/3)*H,(H/2)* ((2*W)/3),((H/2)+1)* ((2*W)/3)].max - [(W- (2*W)/3)*H,(H/2)* ((2*W)/3),((H/2)+1)* ((2*W)/3)].min answer6 = [(W - ((2*W)/3) - 1)*H, (H/2)* (((2*W)/3)+ 1),((H/2)+1)* (((2*W)/3)+1)].max- [(W - ((2*W)/3) - 1)*H, (H/2)* (((2*W)/3)+1), ((H/2)+1)* (((2*W)/3)+1)].min answer7 = [(W- ((2*W*H)/(3 * H+2)))*H,(H/2)* ((2*W*H)/(3 * H+2)),((H/2)+1)* ((2*W*H)/(3 * H+2))].max - [(W- ((2*W*H)/(3 * H+2)))*H,(H/2)* ((2*W*H)/(3 * H+2)),((H/2)+1)* ((2*W*H)/(3 * H+2))].min answer8 = [(W- ((2*W*H)/(3 * H+2)) -1 )*H,(H/2)* (((2*W*H)/(3 * H+2))+1),((H/2)+1)* (((2*W*H)/(3 * H+2))+1)].max - [(W- ((2*W*H)/(3 * H+2)) -1 )*H,(H/2)* (((2*W*H)/(3 * H+2))+1),((H/2)+1)* (((2*W*H)/(3 * H+2))+1)].min end puts [answer1,answer2,answer3,answer4,answer5,answer6,answer7,answer8,W,H].min end
[ "literal.array.change" ]
1,380,607
1,380,608
u162758522
ruby
p03714
class Heap attr_reader :size def initialize @heap = [] @size = 0 end def push(x) i = @size @size += 1 while i > 0 do p = (i - 1) / 2 break if @heap[p] <= x @heap[i] = @heap[p] i = p end @heap[i] = x self end def pop return nil if @size == 0 ret = @heap[0] @size -= 1 x = @heap[@size] i = 0 while i * 2 + 1 < @size do a = i * 2 + 1 b = a + 1 if b < @size && @heap[b] < @heap[a] a = b end break if @heap[a] >= x @heap[i] = @heap[a] i = a end @heap[i] = x @heap.pop return ret end end N = gets.to_i as = gets.split.map(&:to_i) frontmax = [] heap = Heap.new sum = 0 (0..(2*N)).each do |i| heap.push(as[i]) sum += as[i] if heap.size > N min = heap.pop sum -= min end frontmax[i] = sum end as.map!{|a| -a} as.reverse! backmin = [] heap = Heap.new sum = 0 (0..(2*N)).each do |i| heap.push(as[i]) sum += as[i] if heap.size > N min = heap.pop sum -= min end backmin[3*N-1-i] = -sum end score = -Float::INFINITY (N...(2*N)).each do |i| s = frontmax[i] - backmin[i+1] score = s if s > score end p score
class Heap attr_reader :size def initialize @heap = [] @size = 0 end def push(x) i = @size @size += 1 while i > 0 do p = (i - 1) / 2 break if @heap[p] <= x @heap[i] = @heap[p] i = p end @heap[i] = x self end def pop return nil if @size == 0 ret = @heap[0] @size -= 1 x = @heap[@size] i = 0 while i * 2 + 1 < @size do a = i * 2 + 1 b = a + 1 if b < @size && @heap[b] < @heap[a] a = b end break if @heap[a] >= x @heap[i] = @heap[a] i = a end @heap[i] = x @heap.pop return ret end end N = gets.to_i as = gets.split.map(&:to_i) frontmax = [] heap = Heap.new sum = 0 (0...(2*N)).each do |i| heap.push(as[i]) sum += as[i] if heap.size > N min = heap.pop sum -= min end frontmax[i] = sum end as.map!{|a| -a} as.reverse! backmin = [] heap = Heap.new sum = 0 (0...(2*N)).each do |i| heap.push(as[i]) sum += as[i] if heap.size > N min = heap.pop sum -= min end backmin[3*N-1-i] = -sum end score = -Float::INFINITY ((N-1)...(2*N)).each do |i| s = frontmax[i] - backmin[i+1] score = s if s > score end p score
[]
1,381,888
1,381,889
u314396879
ruby
p03719
def between(a, b, c) puts a <= c && c <= b ? "YES" : "NO" end a, b, c= gets.chomp.split(" ").map(&:to_i) between(a, b, c)
def between(a, b, c) puts a <= c && c <= b ? "Yes" : "No" end a, b, c= gets.chomp.split(" ").map(&:to_i) between(a, b, c)
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
1,383,094
1,383,095
u050641473
ruby
p03719
a, b, c = gets.split.map(&:to_s) if c >= a && c <= b puts 'Yes' else puts 'No' end
a, b, c = gets.split.map(&:to_i) if c >= a && c <= b puts 'Yes' else puts 'No' end
[ "assignment.value.change", "call.arguments.change" ]
1,383,187
1,383,188
u467800529
ruby
p03719
a,b,c=gets.split.map &:to_i puts (c<a||c>b ? "Yes" : "No")
a,b,c=gets.split.map &:to_i puts c<a||c>b ? "No" : "Yes"
[ "call.arguments.change", "literal.string.change" ]
1,383,261
1,383,262
u049159332
ruby
p03719
a,b,c=gets.split.map &:to_i puts c<a || c>b ? "Yes" : "No"
a,b,c=gets.split.map &:to_i puts c<a||c>b ? "No" : "Yes"
[ "literal.string.change", "call.arguments.change" ]
1,383,263
1,383,262
u049159332
ruby
p03719
a,b,c=gets.split.map &:to_i puts c<a||c>b ? "Yes" : "No"
a,b,c=gets.split.map &:to_i puts c<a||c>b ? "No" : "Yes"
[ "literal.string.change", "call.arguments.change" ]
1,383,264
1,383,262
u049159332
ruby
p03719
a = gets.split(" ").map(&:to_i) if a[2] >= a[0] && a[2] <= a[1] puts "YES" else puts "NO" end
a = gets.split(" ").map(&:to_i) if a[2] >= a[0] && a[2] <= a[1] puts "Yes" else puts "No" end
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
1,383,561
1,383,562
u414166540
ruby
p03719
a,b,c=gets().chomp().split().map(&:to_i) if a<c and b>c puts("Yes") else puts("No") end
a,b,c=gets().chomp().split().map(&:to_i) if a<=c and b>=c puts("Yes") else puts("No") end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
1,383,748
1,383,749
u060936992
ruby
p03719
a, b, c = gets.chomp.split(" ").map(&:to_i) puts c >= a && c >= b ? "Yes" : "No"
a, b, c = gets.chomp.split(" ").map(&:to_i) puts c >= a && c <= b ? "Yes" : "No"
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
1,383,898
1,383,899
u126541218
ruby
p03719
a, b, c = gets.split.map(&:upcase) if c >= a && c <= b puts "Yes" exit else puts "No" exit end
a, b, c = gets.split.map(&:to_i) if c >= a && c <= b puts "Yes" exit else puts "No" exit end
[ "assignment.value.change", "call.arguments.change" ]
1,383,941
1,383,942
u411903982
ruby
p03719
a,b,c = gets.chomp.split(' ').map{|n| n} if c >= a && c <= b puts "Yes" else puts "No" end
a,b,c = gets.chomp.split(' ').map{|n| n.to_i} if c >= a && c <= b puts "Yes" else puts "No" end
[ "call.add" ]
1,383,960
1,383,961
u698501698
ruby
p03719
a,b,c = gets.chomp.split(" ").map(&:to_i); if c >= a && c <= b puts "yes" else puts "no" end
a,b,c = gets.chomp.split(" ").map(&:to_i); if c >= a && c <= b puts "Yes" else puts "No" end
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
1,383,989
1,383,990
u802942094
ruby