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
p03463
n,a,b=gets.strip.split.map(:to_i) if (b-a)%2==1 puts "Borys" else puts "Alice" end
n,a,b=gets.strip.split.map(&:to_i) if (b-a)%2==1 puts "Borys" else puts "Alice" end
[ "call.arguments.change" ]
1,211,337
1,211,338
u061071198
ruby
p03463
array = gets.split(" ").map(&:to_i) if (array[1] - array[2]).even? puts "Borys" else puts "Alice" end
array = gets.split(" ").map(&:to_i) if (array[1] - array[2]).odd? puts "Borys" else puts "Alice" end
[ "identifier.change", "control_flow.branch.if.condition.change" ]
1,211,464
1,211,465
u441320643
ruby
p03463
array = gets.split(" ").map(&:to_i) if (array[1] - array[2]).odd? puts "borys" else puts "alice" end
array = gets.split(" ").map(&:to_i) if (array[1] - array[2]).odd? puts "Borys" else puts "Alice" end
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
1,211,466
1,211,465
u441320643
ruby
p03463
array = gets.split(" ").map(&:to_i) if (array[1] - array[2]).even? puts "borys" else puts "alice" end
array = gets.split(" ").map(&:to_i) if (array[1] - array[2]).odd? puts "Borys" else puts "Alice" end
[ "identifier.change", "control_flow.branch.if.condition.change", "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
1,211,467
1,211,465
u441320643
ruby
p03463
n,a,b=gets.split.map &:to_i (b-a)%2==0 ? print("Borys") : print("Alice")
n,a,b=gets.split.map &:to_i (b-a)%2==1 ? print("Borys") : print("Alice")
[ "literal.number.integer.change", "control_flow.branch.if.condition.change" ]
1,211,603
1,211,604
u610697662
ruby
p03463
n,a,b=gets.split.map &:to_i b-a%2==0 ? print("Borys") : print("Alice")
n,a,b=gets.split.map &:to_i (b-a)%2==1 ? print("Borys") : print("Alice")
[ "control_flow.branch.if.condition.change", "literal.number.integer.change" ]
1,211,605
1,211,604
u610697662
ruby
p03463
class Problem attr_accessor *(?a..?z).to_a.map(&:to_sym) def initialize @n,@a,@b = gets.to_s.split.map{ |v| v.to_i } end def solve (b-a).even? end def show(ans) puts ans ? "ALice" : "Borys" end end Problem.new.instance_eval do show(solve) end
class Problem attr_accessor *(?a..?z).to_a.map(&:to_sym) def initialize @n,@a,@b = gets.to_s.split.map{ |v| v.to_i } end def solve (b-a).even? end def show(ans) puts ans ? "Alice" : "Borys" end end Problem.new.instance_eval do show(solve) end
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
1,212,201
1,212,202
u106964380
ruby
p03469
s = gets.chomp s[3] = "7" puts s
s = gets.chomp s[3] = "8" puts s
[ "literal.string.change", "assignment.value.change" ]
1,213,500
1,213,501
u926099741
ruby
p03469
puts gets.chomp.gsub('/2017/', '2018')
puts gets.chomp.gsub(/2017/, "2018")
[ "literal.string.change", "call.arguments.change", "io.output.change" ]
1,213,665
1,213,666
u809809975
ruby
p03469
puts gets.chomp.gsub('/2017/', '2018')
puts gets.chomp.gsub(/2017/, '2018')
[]
1,213,665
1,213,667
u809809975
ruby
p03469
s = gets.chomp.split("/") s[3] = "8" puts s
s = gets.chomp.split("") s[3] = "8" puts s.join
[ "literal.string.change", "assignment.value.change", "call.arguments.change", "call.add" ]
1,213,749
1,213,750
u333374716
ruby
p03469
str = gets.chomp p str.gsub("2017","2018")
puts gets.gsub("2017", "2018")
[ "call.remove" ]
1,213,769
1,213,770
u501591853
ruby
p03469
puts "2018" + gets.chomp[4..-1]
puts("2018" + gets.chomp[4..-1])
[ "call.arguments.change" ]
1,213,852
1,213,853
u315597999
ruby
p03469
str = gets.chomp.split("") str[3] = 8 p str.join
str = gets.chomp.split("") str[3] = 8 puts str.join
[ "call.function.change", "io.output.change" ]
1,213,947
1,213,948
u618706993
ruby
p03469
line = STDIN.gets p '2018' + line[4..-1]
line = STDIN.gets puts '2018' + line[4..-1]
[ "call.function.change", "io.output.change" ]
1,214,272
1,214,273
u237620737
ruby
p03469
puts gets.chomp.gsub(?7, ?8)
puts gets.chomp.sub(?7, ?8)
[ "identifier.change", "call.arguments.change", "io.output.change" ]
1,214,319
1,214,322
u693378622
ruby
p03469
puts gets.chomp.tr('2017', '2018')
puts gets.chomp.gsub('2017', '2018')
[ "identifier.change", "call.arguments.change", "io.output.change" ]
1,214,477
1,214,478
u320576758
ruby
p03469
s = gets s[0..3] = "2018" p s
s = gets s[0..3] = "2018" puts s
[ "call.function.change", "io.output.change" ]
1,214,534
1,214,535
u607644932
ruby
p03469
s = gets.chomp s[0..3] = "2018" p s
s = gets s[0..3] = "2018" puts s
[ "call.remove", "call.function.change", "io.output.change" ]
1,214,536
1,214,535
u607644932
ruby
p03469
s = gets.chomp s[0..6] = "2018/01" p s
s = gets s[0..3] = "2018" puts s
[ "call.remove", "literal.number.integer.change", "assignment.variable.change", "variable_access.subscript.index.change", "literal.string.change", "assignment.value.change", "call.function.change", "io.output.change" ]
1,214,537
1,214,535
u607644932
ruby
p03469
s = gets.chomp p s.sub(/^(\d+)/, '2018')
s = gets.chomp puts s.sub(/^(\d+)/, '2018')
[ "call.function.change", "io.output.change" ]
1,214,673
1,214,674
u638900599
ruby
p03470
n = gets.to_i mochis = n.times.map { gets.to_i } puts.mochis.uniq.size
n = gets.to_i mochis = n.times.map { gets.to_i } puts mochis.uniq.size
[]
1,214,979
1,214,980
u921695699
ruby
p03470
n = gets.to?i mochis = n.times.map { gets.to_i } puts.mochis.uniq.size
n = gets.to_i mochis = n.times.map { gets.to_i } puts mochis.uniq.size
[ "assignment.value.change", "identifier.change", "call.arguments.change" ]
1,214,981
1,214,980
u921695699
ruby
p03470
n = gets a = Array.new n.times{ a << gets.to_i } puts a.uniq.size
n = gets.to_i a = Array.new n.times{ a << gets.to_i } puts a.uniq.size
[ "call.add" ]
1,215,751
1,215,752
u195257137
ruby
p03470
i = gets arr = [] i.times { arr << gets.to_i } puts arr.uniq.size
i = gets.to_i arr = [] i.times { arr << gets.to_i } puts arr.uniq.size
[ "call.add" ]
1,215,787
1,215,788
u219758627
ruby
p03470
n = gets.to_i a = [] while num = gets do a.push(num) end puts a.uniq
n = gets.to_i a = [] while num = gets do a.push(num.chomp) end puts a.uniq.length
[ "call.add" ]
1,215,881
1,215,882
u944733909
ruby
p03470
n = gets puts n.times.map{gets.to_i}.uniq.size
n = gets.to_i puts n.times.map{gets.to_i}.uniq.count
[ "call.add", "identifier.change", "call.arguments.change", "io.output.change" ]
1,216,062
1,216,063
u374190629
ruby
p03470
n = gets puts n.times.map{gets.to_i}.uniq.count
n = gets.to_i puts n.times.map{gets.to_i}.uniq.count
[ "call.add" ]
1,216,064
1,216,063
u374190629
ruby
p03470
n=gets as=N.time.map{gets.to_i} puts as.uniq.size
N=gets.to_i as=N.times.map{gets.to_i} puts as.uniq.size
[ "assignment.variable.change", "call.add", "assignment.value.change", "identifier.change" ]
1,216,042
1,216,043
u926099741
ruby
p03470
n=gets.chomp.to_i a=n.times.map{gets.to_i} puts a.size-1
n=gets.chomp.to_i a=n.times.map{gets.to_i}.uniq p a.size
[ "assignment.value.change", "call.add", "io.output.change", "expression.operation.binary.remove" ]
1,216,186
1,216,185
u854471099
ruby
p03470
N = gets.chomp.to_i d = N.times.map { gets.chomp } p d.uniq!.length
N = gets.chomp.to_i d = N.times.map { gets.to_i } p d.uniq.size
[ "assignment.value.change", "identifier.change", "call.arguments.change" ]
1,216,267
1,216,268
u246054039
ruby
p03470
n = gets.to_i a = [] n.times do |i| a << gets.to_i end puts a.uniq!.size
n = gets.to_i a = [] n.times do |i| a << gets.to_i end puts a.sort.uniq.size
[ "identifier.change", "call.arguments.change", "call.add" ]
1,216,459
1,216,460
u633378318
ruby
p03470
n = gets.chomp.to_i d = [] n.times{ d << gets.chomp.to_i } print("#{d.uniq!.size}")
n = gets.chomp.to_i d = [] n.times{ d.push(gets.chomp.to_i) } print("#{d.uniq.size}")
[ "expression.operation.binary.change", "call.add", "call.arguments.change", "literal.string.change" ]
1,216,565
1,216,566
u171717855
ruby
p03470
STDIN.readline().to_i puts STDIN.each_line.inject([]){|a, line| a << line.to_i}.uniq!.length
#!/usr/bin/env ruby # DEBUG = false STDIN.readline().to_i puts STDIN.each_line.inject([]){|a, line| a << line.to_i}.uniq.length
[ "identifier.change", "call.arguments.change" ]
1,216,579
1,216,580
u681517464
ruby
p03470
N = gets.chomp.to_i c = [] n = [] while s = gets c.push(s.split.map(&:to_i)) end c.uniq! puts c puts c.length
N = gets.chomp.to_i c = [] n = [] while s = gets c.push(s.split.map(&:to_i)) end c.uniq! #puts c puts c.length
[ "call.remove" ]
1,216,623
1,216,624
u614043796
ruby
p03470
mochi = [] gets.to_i.times do mochi.push(gets) end puts mochi.uniq!.size
mochi = [] gets.to_i.times do mochi.push(gets) end puts mochi.uniq.size
[ "identifier.change", "call.arguments.change" ]
1,216,671
1,216,672
u939552576
ruby
p03471
n, y = gets.split(" ").map(&:to_i) 0.upto(n) do |yen_10000| 0.upto(n) do |yen_5000| yen_1000 = n - yen_10000 - yen_5000 > 0 ? n - yen_10000 - yen_5000 : 0 sum = yen_10000 * 10000 + yen_5000 * 5000 + yen_1000 * 1000 # p "#{yen_10000} #{yen_5000} #{yen_1000}" if sum == y puts "#{yen_10000} #{yen_5000} #{yen_1000}" exit end end end puts "-1 -1 -1"
n, y = gets.split(" ").map(&:to_i) 0.upto(n) do |yen_10000| 0.upto(n - yen_10000) do |yen_5000| yen_1000 = n - yen_10000 - yen_5000 > 0 ? n - yen_10000 - yen_5000 : 0 sum = yen_10000 * 10000 + yen_5000 * 5000 + yen_1000 * 1000 # p "#{yen_10000} #{yen_5000} #{yen_1000}" if sum == y puts "#{yen_10000} #{yen_5000} #{yen_1000}" exit end end end puts "-1 -1 -1"
[ "expression.operation.binary.add" ]
1,217,526
1,217,528
u748406041
ruby
p03471
x,y = gets.split.map(&:to_i) count = "-1 -1 -1" (0..x).each do |n| (0..(x-n)).each do |m| l = x - n -m count = "#{n} #{m} #{l}" if 10000 * n + 5000 * m + 1000 * l = y end end puts count
x,y = gets.split.map(&:to_i) count = "-1 -1 -1" (0..x).each do |n| (0..(x-n)).each do |m| l = x - n -m count = "#{n} #{m} #{l}" if 10000 * n + 5000 * m + 1000 * l == y end end puts count
[ "expression.operation.compare.replace.add", "assignment.replace.remove", "misc.typo" ]
1,217,631
1,217,632
u921695699
ruby
p03471
N, Y = gets.split.map(&:to_i) (N + 1).times do |i| (N - i).times do |j| if (1000 * i + 5000 * j + 10000 * (N - i - j) == Y) puts [i, j, N - i - j].join(" ") exit end end end puts [-1, -1, -1].join(" ")
N, Y = gets.split.map(&:to_i) (N + 1).times do |i| (N + 1 - i).times do |j| if (10000 * i + 5000 * j + 1000 * (N - i - j) == Y) puts [i, j, N - i - j].join(" ") exit end end end puts [-1, -1, -1].join(" ")
[ "literal.number.integer.change", "control_flow.branch.if.condition.change" ]
1,218,260
1,218,261
u926099741
ruby
p03471
N, Y = gets.split.map(&:to_i) (0...N).each do |n10| (0...(N-n10)).each do |n5| n1 = N - n10 - n5 next if n1 < 0 if (10 * n10 + 5 * n5 + n1) * 1000 == Y puts "#{n10} #{n5} #{n1}" exit end end end puts "-1 -1 -1"
N, Y = gets.split.map(&:to_i) (0..N).each do |n10| (0..(N-n10)).each do |n5| n1 = N - n10 - n5 next if n1 < 0 if (10 * n10 + 5 * n5 + n1) * 1000 == Y puts "#{n10} #{n5} #{n1}" exit end end end puts "-1 -1 -1"
[]
1,218,386
1,218,387
u305384049
ruby
p03471
n, y = gets.chomp.split(' ').map(&:to_i) o_i, o_j, o_k = -1, -1, -1 (0..n).each do |i| (0..n-i).each do |j| if i * 10000 + j * 5000 + (n - i - j) * 1000 == y o_i, o_j, o_k = i, j, (n - i - j) end end end p "#{o_i} #{o_j} #{o_k}"
n, y = gets.chomp.split(' ').map(&:to_i) o_i, o_j, o_k = -1, -1, -1 (0..n).each do |i| (0..n-i).each do |j| if i * 10000 + j * 5000 + (n - i - j) * 1000 == y o_i, o_j, o_k = i, j, (n - i - j) end end end puts "#{o_i} #{o_j} #{o_k}"
[ "call.function.change", "io.output.change" ]
1,218,700
1,218,701
u728823690
ruby
p03471
n, y = gets.strip.split.map(&:to_i) a, b, c = 0, 0, 0 (0..n).each do |i| (0..(n-1)).each do |j| if y == 10000*i + 5000*j + 1000*(n-i-j) puts "#{i} #{j} #{n-i-j}" exit end end end puts "-1 -1 -1"
n, y = gets.strip.split.map(&:to_i) a, b, c = 0, 0, 0 (0..n).each do |i| (0..(n-i)).each do |j| if y == 10000*i + 5000*j + 1000*(n-i-j) puts "#{i} #{j} #{n-i-j}" exit end end end puts "-1 -1 -1"
[ "identifier.replace.add", "literal.replace.remove", "expression.operation.binary.change", "io.output.change" ]
1,218,765
1,218,764
u292220197
ruby
p03471
n, y = gets.split(" ").map(&:to_i) l = 10000 m = 5000 s = 1000 result = nil (0..n).each do |i| (0..(n - i)).each do |j| if s * (n - i - j) == y - l * i + m * j result = [i, j, n - i - j] end end end result = [-1, -1, -1] if !result print result[0] print " " print result[1] print " " print result[2]
n, y = gets.split(" ").map(&:to_i) l = 10000 m = 5000 s = 1000 result = nil (0..n).each do |i| (0..(n - i)).each do |j| if s * (n - i - j) == y - (l * i + m * j) result = [i, j, n - i - j] end end end result = [-1, -1, -1] if !result print result[0] print " " print result[1] print " " print result[2]
[ "control_flow.branch.if.condition.change" ]
1,218,797
1,218,798
u656538922
ruby
p03471
n,sum = gets.split.map(&:to_i) (n+1).times{|x| for y in 0..n-x do z=n-x-y if x*10000 + y*5000+ z*1000 == yen puts "#{x} #{y} #{z}" exit end end } puts "-1 -1 -1"
n,sum = gets.split.map(&:to_i) (n+1).times{|x| for y in 0..n-x do z=n-x-y if x*10000 + y*5000+ z*1000 == sum puts "#{x} #{y} #{z}" exit end end } puts "-1 -1 -1"
[ "identifier.change", "control_flow.branch.if.condition.change" ]
1,218,834
1,218,835
u585819925
ruby
p03471
N, Y = gets.chomp.split(" ").map(&:to_i) count = 0 catch(:break_loop) do (0..N).each {|ten| (0..N).each{|five| if 10000*ten + 5000*five + 1000*(N-ten-five) == Y puts "#{ten} #{five} #{N-ten-five}" count += 1 throw :break_loop end } } end if count == 0 puts "-1 -1 -1" end
N, Y = gets.chomp.split(" ").map(&:to_i) count = 0 catch(:break_loop) do (0..N).each {|ten| (0..N-ten).each{|five| if 10000*ten + 5000*five + 1000*(N-ten-five) == Y puts "#{ten} #{five} #{N-ten-five}" count += 1 throw :break_loop end } } end if count == 0 puts "-1 -1 -1" end
[ "expression.operation.binary.add" ]
1,219,043
1,219,045
u179299890
ruby
p03471
N,Y = gets.strip.split.map(&:to_i) i,j,k = -1,-1,-1 (0..N).each do |a| (0..N-i).each do |b| i,j,k = a,b,N-a-b if a*10000+b*5000+(N-a-b)*1000 == Y break if i!=0 end end puts "#{i}, #{j}, #{k}"
N,Y = gets.strip.split.map(&:to_i) i,j,k = -1,-1,-1 (0..N).each do |a| (0..N-a).each do |b| i,j,k = a,b,N-a-b if a*10000+b*5000+(N-a-b)*1000 == Y break if i!=-1 end end puts "#{i} #{j} #{k}"
[ "identifier.change", "expression.operation.binary.change", "assignment.value.change", "control_flow.branch.if.condition.change", "expression.operation.unary.add", "literal.string.change", "call.arguments.change" ]
1,219,127
1,219,125
u211109468
ruby
p03471
N, Y = gets.strip.split(' ').map(&:to_i) x, y, z = -1, -1, -1 (0..N).each do |i| (0..(N-x)).each do |j| sum = 10000*i + 5000*j + 1000*(N-i-j) if sum == Y x, y, z = i, j, N-i-j break end end end puts "#{x} #{y} #{z}"
N, Y = gets.strip.split(' ').map(&:to_i) x, y, z = -1, -1, -1 (0..N).each do |i| (0..(N-i)).each do |j| sum = 10000*i + 5000*j + 1000*(N-i-j) if sum == Y x, y, z = i, j, N-i-j end end end puts "#{x} #{y} #{z}"
[ "identifier.change", "expression.operation.binary.change", "control_flow.break.remove" ]
1,219,161
1,219,162
u259578064
ruby
p03471
n,y = gets.chomp.split(" ").map(&:to_i); flg = 0 for a in 0..n do for b in 0..n do c = n - (a + b) if (y == 10000 * a + 5000 * b + 1000 * c) && (a + b + c == n) && (c >= 0) puts "#{a}, #{b}, #{c}" flg = 1 exit end end end puts "-1, -1, -1" if flg == 0
n,y = gets.chomp.split(" ").map(&:to_i); flg = 0 for a in 0..n do for b in 0..n do c = n - (a + b) if (y == 10000 * a + 5000 * b + 1000 * c) && (a + b + c == n) && (c >= 0) puts "#{a} #{b} #{c}" flg = 1 exit end end end puts "-1 -1 -1" if flg == 0
[ "literal.string.change", "call.arguments.change" ]
1,219,380
1,219,381
u079207542
ruby
p03471
n = gets.split(" ").map(&:to_i) a = n[0] b = n[0] m = [] (0..a).each do |x| (0..b).each do |y| c = n[0] - x - y if m.empty? && n[1] == 10000*x + 5000*y + 1000*c m << x m << y m << c end end end if !m.empty? print m.join(' ') elsif puts "-1 -1 -1" end
n = gets.split(" ").map(&:to_i) a = n[0] b = n[0] m = [] (0..a).each do |x| (0..b).each do |y| c = n[0] - x - y if c >= 0 and m.empty? and n[1] == 10000*x + 5000*y + 1000*c m << x m << y m << c end end end if !m.empty? print m.join(' ') elsif puts "-1 -1 -1" end
[ "control_flow.branch.if.condition.change" ]
1,219,453
1,219,454
u523351024
ruby
p03471
N,Y = gets.chomp.split(" ").map(&:to_i) (0..N).each do |a| (0..N-a).each do |b| c = N-a-b if 10000 * a + 5000 * b + 1000 * c == Y p "#{a} #{b} #{c}" exit end end end p "-1 -1 -1"
N,Y = gets.chomp.split(" ").map(&:to_i) (0..N).each do |a| (0..N-a).each do |b| c = N-a-b if 10000 * a + 5000 * b + 1000 * c == Y puts "#{a} #{b} #{c}" exit end end end puts "-1 -1 -1"
[ "call.function.change", "io.output.change" ]
1,219,705
1,219,706
u246054039
ruby
p03471
n, total = gets.split.map(&:to_i) ans_x, anx_y, ans_z = -1, -1, -1 (0..n).each do |x| (0..n).each do |y| z = n - x - y if 10000*x + 5000*y + 1000*z == total ans_x, anx_y, ans_z = x, y, z end end end puts "#{ans_x} #{anx_y} #{ans_z}"
n, total = gets.split.map(&:to_i) ans_x, anx_y, ans_z = -1, -1, -1 (0..n).each do |x| (0..n-x).each do |y| z = n - x - y if 10000*x + 5000*y + 1000*z == total ans_x, anx_y, ans_z = x, y, z end end end puts "#{ans_x} #{anx_y} #{ans_z}"
[ "expression.operation.binary.add" ]
1,219,785
1,219,786
u617691573
ruby
p03471
n, total = gets.split.map(&:to_i) ans_x, anx_y, ans_z = -1, -1, -1 (0..n).each do |x| (0..n).each do |y| z = n - x - y if 10000*x + 5000*y + 1000*z == total ans_x, anx_y, ans_z = x, y, z end end end puts "#{ans_x} #{anx_y} #{ans_z}"
n, total = gets.split.map(&:to_i) ans_x, anx_y, ans_z = -1, -1, -1 (0..n).each do |x| (0..n-x).each do |y| z = n - x - y if 10000*x + 5000*y + 1000*z == total ans_x, anx_y, ans_z = x, y, z end end end puts "#{ans_x} #{anx_y} #{ans_z}"
[ "expression.operation.binary.add" ]
1,219,785
1,219,787
u617691573
ruby
p03471
N, Y = gets.strip.split.map(&:to_i) def fin(i, j, k) puts "#{i} #{j} #{k}" end (0..N).each do |i| (0..N).each do |j| k = N - (i + j) if k >= 0 && Y.eql?(i * 10000 + j * 5000 + k * 1000) fin(i, j, k) end end end fin(-1, -1, -1)
N, Y = gets.strip.split.map(&:to_i) def fin(i, j, k) puts "#{i} #{j} #{k}" exit end (0..N).each do |i| (0..N).each do |j| k = N - (i + j) if k >= 0 && Y.eql?(i * 10000 + j * 5000 + k * 1000) fin(i, j, k) end end end fin(-1, -1, -1)
[ "control_flow.exit.add" ]
1,219,901
1,219,902
u707614029
ruby
p03471
N,Y = gets.split.map(&:to_i) isBreak = false result = "-1 -1 -1" (0..N).each do |i| (0..N).each do |j| if(i*10000)+(j*5000)+((N-i+j)*1000) == Y && i+j+(N-i+j) == N && (N-i+j) >= 0 result = "#{i} #{j} #{N-i+j}" isBreak = true break end end break if isBreak end puts result
N,Y = gets.split.map(&:to_i) isBreak = false result = "-1 -1 -1" (0..N).each do |i| (0..N).each do |j| if(i*10000)+(j*5000)+((N-i-j)*1000) == Y && i+j+(N-i-j) == N && (N-i-j) >= 0 result = "#{i} #{j} #{N-i-j}" isBreak = true break end end break if isBreak end puts result
[ "misc.opposites", "expression.operator.arithmetic.change", "control_flow.branch.if.condition.change", "literal.string.change", "assignment.value.change" ]
1,220,048
1,220,049
u244087909
ruby
p03471
N,Y = gets.split.map(&:to_i) isBreak = false result = "-1 -1 -1" (0..N).each do |i| (0..N).each do |j| if(i*10000)+(j*5000)+((N-i+j)*1000) == Y && i+j+(N-i+j) == N && (N-i+j) >= 0 result = "#{i} #{j} #{N-i+j}" isBreak = true end end break if isBreak end puts result
N,Y = gets.split.map(&:to_i) isBreak = false result = "-1 -1 -1" (0..N).each do |i| (0..N).each do |j| if(i*10000)+(j*5000)+((N-i-j)*1000) == Y && i+j+(N-i-j) == N && (N-i-j) >= 0 result = "#{i} #{j} #{N-i-j}" isBreak = true break end end break if isBreak end puts result
[ "misc.opposites", "expression.operator.arithmetic.change", "control_flow.branch.if.condition.change", "literal.string.change", "assignment.value.change", "control_flow.break.add" ]
1,220,050
1,220,049
u244087909
ruby
p03471
n,y=gets.split.map &:to_i for a in 0..n for b in 0..n c=n-a-b next if c<0 if 1000*a+5000*b+10000*c==y puts "#{a} #{b} #{c}" exit end end end puts "-1 -1 -1"
n,y=gets.split.map &:to_i for a in 0..n for b in 0..n c=n-a-b break if c<0 if 1000*a+5000*b+10000*c==y puts "#{c} #{b} #{a}" exit end end end puts "-1 -1 -1"
[ "literal.string.change", "call.arguments.change" ]
1,220,071
1,220,072
u752146271
ruby
p03471
num_of_bills, sum = gets.split.map &:to_i bills = [10000, 5000, 1000] for count_10k in 0 .. num_of_bills for count_5k in 0 .. num_of_bills - count_10k if count_10k * 10000 + count_5k * 5000 + (num_of_bills - count_5k - count_10k) * 1000 == sum puts [count_10k, count_5k, num_of_bills - count_5k, count_10k].join(" ") exit end end end puts "-1 -1 -1"
num_of_bills, sum = gets.split.map &:to_i bills = [10000, 5000, 1000] for count_10k in 0 .. num_of_bills for count_5k in 0 .. num_of_bills - count_10k if count_10k * 10000 + count_5k * 5000 + (num_of_bills - count_5k - count_10k) * 1000 == sum puts [count_10k, count_5k, num_of_bills - count_5k - count_10k].join(" ") exit end end end puts "-1 -1 -1"
[ "call.arguments.change", "io.output.change" ]
1,220,284
1,220,285
u785521224
ruby
p03471
N, Y = gets.split.map(&:to_i) for i in 0..N for j in 0..N if 10000 * i + 5000 * j + (N - i - j) * 1000 == Y puts "#{i} #{j} #{N - i - j}" exit end end end puts "-1 -1 -1"
N, Y = gets.split.map(&:to_i) for i in 0..N for j in 0..(N - i) if 10000 * i + 5000 * j + (N - i - j) * 1000 == Y puts "#{i} #{j} #{N - i - j}" exit end end end puts "-1 -1 -1"
[]
1,220,420
1,220,421
u614043796
ruby
p03471
N, Y = gets.chomp.split(' ').map(&:to_i) ans = (0...(N+2)).to_a.combination(2).map do |i, j| [i, j - i, N - j] end.find do |x, y, z| 10_000 * x + 5_000 * y + 1_000 * z == Y end if ans puts ans.join(' ') else puts '-1 -1 -1' end
N, Y = gets.chomp.split(' ').map(&:to_i) ans = (0...(N+2)).to_a.combination(2).map do |i, j| [i, j - i - 1, N - j + 1] end.find do |x, y, z| 10_000 * x + 5_000 * y + 1_000 * z == Y end if ans puts ans.join(' ') else puts '-1 -1 -1' end
[ "assignment.change" ]
1,220,511
1,220,512
u307960755
ruby
p03471
sum,yen = gets.chomp.split(" ").map(&:to_i) ans10000 = -1 ans5000 = -1 ans1000 = -1 0.upto(sum) do |x| 0.upto(sum) do |y| z = sum - x - y sum_yen = (x*10000)+(y*5000)+(z*1000) if sum_yen == yen ans10000 = x ans5000 = y ans1000 = z break end end end puts "#{ans10000} #{ans5000} #{ans1000}"
sum,yen = gets.chomp.split(" ").map(&:to_i) ans10000 = -1 ans5000 = -1 ans1000 = -1 0.upto(sum) do |x| 0.upto(sum-x) do |y| z = sum - x - y sum_yen = (x*10000)+(y*5000)+(z*1000) if sum_yen == yen ans10000 = x ans5000 = y ans1000 = z break end end end puts "#{ans10000} #{ans5000} #{ans1000}"
[ "expression.operation.binary.add" ]
1,220,552
1,220,553
u966695319
ruby
p03471
a = gets.split(" ").map(&:to_i) for i in 0..a.length do a[i]=a[i].to_i end x=0 y=0 z=0 for i in 1..a[0] do if a[1]>=10000 then a[1]-=10000 x+=1 elsif a[1]>=5000 a[1]-=5000 y+=1 elsif a[1]>=1000 a[1]-=1000 z+=1 end end if a[1]>0 then x=-1 y=-1 z=-1 end temp=a[1]-(x+y+z) while temp==0 if temp>0 then if temp>=4 then if y>0 then y-=1 z+=5 temp-=4 elsif x>0 then x-=1 y+=2 temp-=1 else x=-1 y=-1 z=-1 break end elsif x>0 then x-=1 y+=2 temp-=1 else x=-1 y=-1 z=-1 break end else x=-1 y=-1 z=-1 break end end puts ("#{x} #{y} #{z}")
a = gets.split(" ").map(&:to_i) for i in 0..a.length do a[i]=a[i].to_i end x=0 y=0 z=0 for i in 1..a[0] do if a[1]>=10000 then a[1]-=10000 x+=1 elsif a[1]>=5000 a[1]-=5000 y+=1 elsif a[1]>=1000 a[1]-=1000 z+=1 end end if a[1]>0 then x=-1 y=-1 z=-1 end temp=a[0]-(x+y+z) while temp!=0 if temp>0 then if temp>=4 then if y>0 then y-=1 z+=5 temp-=4 elsif x>0 then x-=1 y+=2 temp-=1 else x=-1 y=-1 z=-1 break end elsif x>0 then x-=1 y+=2 temp-=1 else x=-1 y=-1 z=-1 break end else x=-1 y=-1 z=-1 break end end puts ("#{x} #{y} #{z}")
[ "literal.number.integer.change", "assignment.value.change", "variable_access.subscript.index.change", "expression.operation.binary.change" ]
1,220,792
1,220,793
u604693716
ruby
p03471
n , y = gets.strip.split.map(&:to_i) _i, _j, _k = -1, -1, -1 (0..n).each do |i| (0..n).each do |j| if i * 10000 + j * 5000 + ( n - i - j ) * 1000 == y _i, _j, _k = i, j, n - i - j end end end puts "#{_i} #{_j} #{_k}"
n , y = gets.strip.split.map(&:to_i) _i, _j, _k = -1, -1, -1 (0..n).each do |i| (0..n-i).each do |j| if i * 10000 + j * 5000 + ( n - i - j ) * 1000 == y _i, _j, _k = i, j, n - i - j end end end puts "#{_i} #{_j} #{_k}"
[ "expression.operation.binary.add" ]
1,220,834
1,220,835
u124214522
ruby
p03471
n,y=gets.chomp.split(" ").map { |e| e.to_i } for i in 0..n do for j in 0..n-i do if 10000*i + 5000*j + 1000*(n-j-i) == y printf("%d %d %d\n",k,j,n-j-i) exit end end end printf("%d %d %d\n",-1,-1,-1)
n,y=gets.chomp.split(" ").map { |e| e.to_i } for i in 0..n do for j in 0..n-i do if 10000*i + 5000*j + 1000*(n-j-i) == y printf("%d %d %d\n",i,j,n-j-i) exit end end end printf("%d %d %d\n",-1,-1,-1)
[ "identifier.change", "call.arguments.change" ]
1,220,861
1,220,862
u267552846
ruby
p03471
n,y=gets.chomp.split(" ").map { |e| e.to_i } for i in 0..n do for j in 0..n-i do if 10000*k + 5000*j + 1000*(n-j-k) == y printf("%d %d %d\n",k,j,n-j-k) exit end end end printf("%d %d %d\n",-1,-1,-1)
n,y=gets.chomp.split(" ").map { |e| e.to_i } for i in 0..n do for j in 0..n-i do if 10000*i + 5000*j + 1000*(n-j-i) == y printf("%d %d %d\n",i,j,n-j-i) exit end end end printf("%d %d %d\n",-1,-1,-1)
[ "identifier.change", "control_flow.branch.if.condition.change", "call.arguments.change", "expression.operation.binary.change" ]
1,220,863
1,220,862
u267552846
ruby
p03471
N, Y = gets.split.map &:to_i def f(n, y) res = [0, 0, 0] loop do if n<=0 or y<0 return nil end if n*5000==y res[1] += n return res elsif n*5000<y res[0] += 1 n -= 1 y -= 10000 else res[2] += 1 n -= 1 y -= 1000 end end return res end if w=f(N, Y) puts w.join ' ' else puts [-1]*3*' ' end
N, Y = gets.split.map &:to_i def f(n, y) res = [0, 0, 0] loop do if n<0 or y<0 return nil end if n*5000==y res[1] += n return res elsif n*5000<y res[0] += 1 n -= 1 y -= 10000 else res[2] += 1 n -= 1 y -= 1000 end end end if w=f(N, Y) puts w.join ' ' else puts [-1]*3*' ' end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
1,220,990
1,220,991
u967136506
ruby
p03471
# 入力を受け取る n,y = gets.chomp.split.map(&:to_i) for i in 0..n do for j in 0..(n-i) do sum = 10000*i+5000*j+1000*(n-i-j) if sum == y puts "#{i} #{j} #{n-i-j}" flag = true break end end break if flag end puts "-1 -1 -1" if flag
# 入力を受け取る n,y = gets.chomp.split.map(&:to_i) for i in 0..n do for j in 0..(n-i) do sum = 10000*i+5000*j+1000*(n-i-j) if sum == y puts "#{i} #{j} #{n-i-j}" flag = true break end end break if flag end puts "-1 -1 -1" if !(flag)
[ "control_flow.branch.if.condition.change" ]
1,221,043
1,221,044
u706730549
ruby
p03472
N,H=gets.split.map(&:to_i) as,bs=N.times.map{gets.split.map(&:to_i)}.transpose as_max=as.max bs.delete_if{|e|e<=as.max} bs.sort! bs.reverse! damage=0 attack=0 bs.each do |e| attack+=1 damage+=1 if H<=damage puts attack exit end end attack+=((H-damage)/as_max.to_f).ceil puts attack
N,H=gets.split.map(&:to_i) as,bs=N.times.map{gets.split.map(&:to_i)}.transpose as_max=as.max bs.delete_if{|e|e<=as_max} bs.sort! bs.reverse! damage=0 attack=0 bs.each do |e| attack+=1 damage+=e if H<=damage puts attack exit end end attack+=((H-damage)/as_max.to_f).ceil puts attack
[ "expression.operation.binary.change", "call.remove", "identifier.replace.add", "literal.replace.remove" ]
1,221,848
1,221,847
u926099741
ruby
p03472
# https://atcoder.jp/contests/abc085/tasks/abc085_d # 5 500 # 35 44 # 28 83 # 46 62 # 31 79 # 40 43 # 9 n, h = gets.split.map(&:to_i) a = [] b = [] n.times { x, y = gets.split.map(&:to_i) a << x b << y } max_a = a.max count = 0 b.sort!.reverse!.each do |v| break unless (v > max_a) && (h >= 0) h -= v count += 1 end count += (h + max_a - 1)/max_a puts count
# https://atcoder.jp/contests/abc085/tasks/abc085_d # 5 500 # 35 44 # 28 83 # 46 62 # 31 79 # 40 43 # 9 n, h = gets.split.map(&:to_i) a = [] b = [] n.times { x, y = gets.split.map(&:to_i) a << x b << y } max_a = a.max count = 0 b.sort!.reverse!.each do |v| break unless (v > max_a) && (h > 0) h -= v count += 1 end count += (h + max_a - 1)/max_a if h > 0 puts count
[ "expression.operator.compare.change", "expression.operation.binary.change" ]
1,221,932
1,221,933
u987208743
ruby
p03472
# https://atcoder.jp/contests/abc085/tasks/abc085_d # 5 500 # 35 44 # 28 83 # 46 62 # 31 79 # 40 43 # 9 n, h = gets.split.map(&:to_i) a = [] b = [] n.times { x, y = gets.split.map(&:to_i) a << x b << y } max_a = a.max count = 0 b.sort!.reverse!.each do |v| break unless (v > max_a) && (h > 0) h -= v count += 1 end count += (h + max_a - 1)/max_a puts count
# https://atcoder.jp/contests/abc085/tasks/abc085_d # 5 500 # 35 44 # 28 83 # 46 62 # 31 79 # 40 43 # 9 n, h = gets.split.map(&:to_i) a = [] b = [] n.times { x, y = gets.split.map(&:to_i) a << x b << y } max_a = a.max count = 0 b.sort!.reverse!.each do |v| break unless (v > max_a) && (h > 0) h -= v count += 1 end count += (h + max_a - 1)/max_a if h > 0 puts count
[]
1,221,934
1,221,933
u987208743
ruby
p03472
n, h = gets.chomp.split(" ").map(&:to_i) a = [] b = [] n.times do a_, b_ = gets.chomp.split(" ").map(&:to_i) a << a_ b << b_ end amax = a.max b.sort! ans = 0 (n-1).downto(0) do |i| break if h <= 0 if b[i] > amax h -= b[i] ans += 1 end end ans += h / amax if h % amax == 0 puts ans else puts ans + 1 end
n, h = gets.chomp.split(" ").map(&:to_i) a = [] b = [] n.times do a_, b_ = gets.chomp.split(" ").map(&:to_i) a << a_ b << b_ end amax = a.max b.sort! ans = 0 (n-1).downto(0) do |i| if h <= 0 puts ans exit end if b[i] > amax h -= b[i] ans += 1 end end ans += h / amax if h % amax == 0 puts ans else puts ans + 1 end
[ "control_flow.break.remove", "call.add", "control_flow.exit.add" ]
1,222,463
1,222,464
u910756197
ruby
p03472
N,H=gets.split.map &:to_i a,b=N.times.map{gets.split.map &:to_i}.transpose a=a.max b=[0]+b.sort.reverse (1...b.size).each{|i|b[i]+=b[i-1]} p b.size.times.map{|i|i+(H-b[i]+a-1)/a}.min
N,H=gets.split.map &:to_i a,b=N.times.map{gets.split.map &:to_i}.transpose a=a.max b=[0]+b.sort.reverse (1...b.size).each{|i|b[i]+=b[i-1]} p b.size.times.map{|i|i+[0,(H-b[i]+a-1)/a].max}.min
[ "literal.array.change", "call.add" ]
1,222,654
1,222,655
u647875062
ruby
p03471
n,y = gets.chomp.split(" ").map(&:to_i) (n+1).times do |i| (n-i).times do |j| k = n-i-j if i*10000 + j*5000 + k*1000 == y puts "#{i} #{j} #{k}" exit end end end puts "-1 -1 -1"
n,y = gets.chomp.split(" ").map(&:to_i) (n+1).times do |i| (n+1-i).times do |j| k = n-i-j if i*10000 + j*5000 + k*1000 == y puts "#{i} #{j} #{k}" exit end end end puts "-1 -1 -1"
[ "expression.operation.binary.add" ]
1,224,313
1,224,314
u872636244
ruby
p03471
n,y = gets.split.map(&:to_i) ans = [n,0,0] sum = n * 1000 if y >= n * 1000 && y <= n * 10000 while sum != y && ans[0] >= 0 && ans[2] >= 0 && ans[2] <= n if (y - sum) >= 9000 ans[0] -= 1 ans[2] += 1 elsif sum < y ans[0] -= 1 ans[1] += 1 elsif sum > y ans[2] -= 1 ans[1] += 1 end sum = ans[0] * 1000 + ans[1] * 5000 + ans[2] * 10000 p sum end else ans[0] = -1 end if ans[0] < 0 || ans[0] > n || ans[2] < 0 || ans[2] > n puts "-1 -1 -1" else print "#{ans[2]} #{ans[1]} #{ans[0]}" end
n,y = gets.split.map(&:to_i) ans = [n,0,0] sum = n * 1000 if y >= n * 1000 && y <= n * 10000 while sum != y && ans[0] >= 0 && ans[2] >= 0 && ans[2] <= n if (y - sum) >= 9000 ans[0] -= 1 ans[2] += 1 elsif sum < y ans[0] -= 1 ans[1] += 1 elsif sum > y ans[2] -= 1 ans[1] += 1 end sum = ans[0] * 1000 + ans[1] * 5000 + ans[2] * 10000 #p sum end else ans[0] = -1 end if ans[0] < 0 || ans[0] > n || ans[2] < 0 || ans[2] > n puts "-1 -1 -1" else print "#{ans[2]} #{ans[1]} #{ans[0]}" end
[ "call.remove" ]
1,224,444
1,224,445
u123276241
ruby
p03473
n = gets.chomp.to_i puts n+24
n = gets.chomp.to_i puts 24-n+24
[ "expression.operation.binary.add" ]
1,224,461
1,224,462
u303448696
ruby
p03473
a = gets puts 48-a
a = gets.to_i puts 48-a
[ "call.add" ]
1,224,765
1,224,766
u611721508
ruby
p03473
Day1230 = 24 Day1231 = 24 get = gets.to_i Day1230 = Day1230 - get put Day1231 + Day1230
Day1230 = 24 Day1231 = 24 get = gets.to_i Day1230 = Day1230 - get print Day1231 + Day1230
[ "identifier.change" ]
1,224,939
1,224,940
u976397612
ruby
p03473
# 12月30日の時間 Day1230 = 24 # 12月31日の時間 Day1231 = 24 # 受け取る値 get = gets.to_i # 12月30日の残り時間を計算 Day1230 = Day1230 - get put Day1231 + Day1230
Day1230 = 24 Day1231 = 24 get = gets.to_i Day1230 = Day1230 - get print Day1231 + Day1230
[ "identifier.change" ]
1,224,942
1,224,940
u976397612
ruby
p03473
def ascan; gets.split.map(&:to_i);end m = gets.to_i p 24-m
def ascan; gets.split.map(&:to_i);end m = gets.to_i p 24-m+24
[ "expression.operation.binary.add" ]
1,225,155
1,225,156
u079330987
ruby
p03473
puts 48 - get.chomp.to_i
puts 48-gets.to_i
[ "identifier.change", "call.arguments.change", "expression.operation.binary.change", "call.remove" ]
1,225,321
1,225,322
u094826590
ruby
p03473
puts 48 - get.chomp.to_i
puts 48 - gets.to_i
[ "identifier.change", "call.arguments.change", "expression.operation.binary.change", "call.remove" ]
1,225,321
1,225,323
u094826590
ruby
p03473
puts 48 - get.chomp.to_i
puts 48 - gets.chomp.to_i
[ "identifier.change", "call.arguments.change", "expression.operation.binary.change" ]
1,225,321
1,225,324
u094826590
ruby
p03474
a, b = gets.split.map &:to_i r = Regexp.new("^\\d{#{a}}-\\d{#{b}}$") puts (gets=~r ? "YES" : "NO")
a, b = gets.split.map &:to_i r = Regexp.new("^\\d{#{a}}-\\d{#{b}}$") puts (gets=~r ? "Yes" : "No")
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
1,226,078
1,226,079
u976045235
ruby
p03474
a,b = gets.chomp.split(" ").map(&:to_i) s = gets.chomp flg = 0 sarr = s.chomp.split("") if sarr[a] == "-" && s.length == a + b + 1 s.length.times do |i| if i != a if sarr[i] == "-" then flg = 1 end else flg = 1 end end else flg = 1 end if flg == 1 then print("No\n") else print("Yes\n") end
a,b = gets.chomp.split(" ").map(&:to_i) s = gets.chomp flg = 0 sarr = s.chomp.split("") if sarr[a] == "-" && s.length == a + b + 1 s.length.times do |i| if i != a if sarr[i] == "-" then flg = 1 end end end else flg = 1 end if flg == 1 then print("No\n") else print("Yes\n") end
[ "assignment.remove" ]
1,226,258
1,226,259
u843129591
ruby
p03474
a,b = gets.chomp.split(" ").map(&:to_i) s = gets.chomp flg = 0 sarr = s.chomp.split("") if sarr[a] == "-" && s.length == a + b + 1 s.length.times do |i| if i != a if sarr[i] == "-" then flg = 1 end end end end if flg == 1 then print("No\n") else print("Yes\n") end
a,b = gets.chomp.split(" ").map(&:to_i) s = gets.chomp flg = 0 sarr = s.chomp.split("") if sarr[a] == "-" && s.length == a + b + 1 s.length.times do |i| if i != a if sarr[i] == "-" then flg = 1 end end end else flg = 1 end if flg == 1 then print("No\n") else print("Yes\n") end
[ "assignment.add" ]
1,226,260
1,226,259
u843129591
ruby
p03474
a,b = gets.chomp.split(" ").map(&:to_i) s = gets.chomp flg = 0 sarr = s.chomp.split("") if sarr[a] == "-" && s.length == a + b + 1 s.length.times do |i| if i != a if sarr[i] == "-" then flg = 1 end end end end if flg == 1 then print("No\n") else print("Yes\n") end
a,b = gets.chomp.split(" ").map(&:to_i) s = gets.chomp flg = 0 sarr = s.chomp.split("") if sarr[a] == "-" && s.length == a + b + 1 s.length.times do |i| if i != a if sarr[i] == "-" then flg = 1 end end end else flg = 1 end if flg == 1 then print("No\n") else print("Yes\n") end
[ "assignment.add" ]
1,226,261
1,226,259
u843129591
ruby
p03474
a,b=gets.split.map &:to_i s=gets.chomp.chars puts s.size==a+b+1&&s.count(”-”)==1&&s.index(”-”)==a ? :Yes: :No
a,b=gets.split.map &:to_i s=gets.chomp.chars puts s.size==a+b+1&&s.count("-")==1&&s.index("-")==a ? :Yes: :No
[ "control_flow.branch.if.condition.change" ]
1,226,390
1,226,391
u785521224
ruby
p03473
print (48 - gets.to_i).chomp
print (48 - gets.to_i)
[ "call.remove" ]
1,226,474
1,226,475
u490837489
ruby
p03474
a, b = gets.chomp.split(' ').map(&:to_i) s = gets.chomp.split('') if s.length != a + b + 1 puts("No") elsif s[a] != '-' puts("No") else flag = true s.each_with_index do |c, i| if i != a and (c < '0' || '9' < 0) flag = false break end if i == a and c != '-' flag = false break end end if flag puts "Yes" else puts "No" end end
a, b = gets.chomp.split(' ').map(&:to_i) s = gets.chomp.split('') if s.length != a + b + 1 puts("No") elsif s[a] != '-' puts("No") else flag = true s.each_with_index do |c, i| if i != a and (c < '0' || '9' < c) flag = false break end if i == a and c != '-' flag = false break end end if flag puts "Yes" else puts "No" end end
[ "identifier.replace.add", "literal.replace.remove", "control_flow.branch.if.condition.change" ]
1,226,540
1,226,541
u319818856
ruby
p03474
a,b = gets.chomp.split(' ').map(&:to_i) s = gets.chomp if s =~ /^\d{#{a}}-\d{#{b}}/ p 'Yes' else p 'No' end
a,b = gets.chomp.split(' ').map(&:to_i) s = gets.chomp if s =~ /^\d{#{a}}-\d{#{b}}/ puts 'Yes' else puts 'No' end
[ "call.function.change", "io.output.change" ]
1,226,697
1,226,698
u093034675
ruby
p03474
x,y=gets.split.map &:to_i puts gets.chomp=~/^\d#{x}-\d#{y}$/?:Yes: :No
x,y=gets.split.map &:to_i puts gets.chomp=~/^\d{#{x}}-\d{#{y}}$/?:Yes: :No
[ "control_flow.branch.if.condition.change" ]
1,226,767
1,226,768
u280667879
ruby
p03474
x,y=gets.split.map &:to_i puts gets.chomp=~/\d#{x}-\d#{y}/?:Yes: :No
x,y=gets.split.map &:to_i puts gets.chomp=~/^\d{#{x}}-\d{#{y}}$/?:Yes: :No
[ "control_flow.branch.if.condition.change" ]
1,226,769
1,226,768
u280667879
ruby
p03474
a,b=gets.split.map &:to_i;puts (s=gets).size()==a+b+1&&s[a]==?-&&s=~/[0-9]+-[0-9]+/?:Yes: :No
a,b=gets.split.map &:to_i;puts (s=gets.chop).size()==a+b+1&&s[a]==?-&&s=~/[0-9]+-[0-9]+/?:Yes: :No
[ "control_flow.branch.if.condition.change", "call.add" ]
1,226,899
1,226,900
u598016178
ruby
p03474
a, b = gets.strip.split.map(&:to_i) s = gets.strip if /^\d{#{a}}-\d{#{b}}$/ =~ s puts 'YES' else puts 'NO' end
a, b = gets.strip.split.map(&:to_i) s = gets.strip if /^\d{#{a}}-\d{#{b}}$/ =~ s puts 'Yes' else puts 'No' end
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
1,226,903
1,226,904
u729294108
ruby
p03475
n = gets.to_i c, s, f = [], [], [] (n-1).times do ci, si, fi = gets.chomp.split.map(&:to_i) c << ci s << si f << fi end c << 0 s << 1 f << 1 # なんとなくシミュレーションする # 終点だったら終了 # (次の待ち時間)+次への乗車時間 # - 次の発車時間 == 到着時間 -> すぐ乗れる # - 到着時間 < 次の始発 -> 始発に乗る # - それ以外(待ち時間) -> 到着時間 + (到着時間-(到着時間/発車間隔+1)*発車間隔) n.times do |i| now = 0 (i...n-1).each do |j| if now < s[j] now = s[j] elsif (now % f[j]).zero? # なにもしない else # now += now-(now/f[j+1]+1)*f[j+1] now = now + f[j+1]-now%f[j+1] # (now/f[j+1]+1)*f[j+1] end now += c[j] end puts now end
n = gets.to_i c, s, f = [], [], [] (n-1).times do ci, si, fi = gets.chomp.split.map(&:to_i) c << ci s << si f << fi end c << 0 s << 1 f << 1 # なんとなくシミュレーションする # 終点だったら終了 # (次の待ち時間)+次への乗車時間 # - 次の発車時間 == 到着時間 -> すぐ乗れる # - 到着時間 < 次の始発 -> 始発に乗る # - それ以外(待ち時間) -> 到着時間 + (到着時間-(到着時間/発車間隔+1)*発車間隔) n.times do |i| now = 0 (i...n-1).each do |j| if now < s[j] now = s[j] elsif (now % f[j]).zero? # なにもしない else # now += now-(now/f[j+1]+1)*f[j+1] # now = now + f[j+1]-now%f[j+1] # (now/f[j+1]+1)*f[j+1] now = now + f[j]-now%f[j] # (now/f[j+1] end now += c[j] end puts now end
[ "expression.operation.binary.remove" ]
1,227,584
1,227,585
u445624660
ruby
p03476
require "prime" def get_i() #空白区切の入力を数値(整数)の配列で返す return gets.chomp.split(" ").map(&:to_i) end def get_f() #空白区切の入力を数値(実数)の配列で返す return gets.chomp.split(" ").map(&:to_f) end def get() #空白区切の入力を文字列の配列で返す return gets.chomp.split(" ") end def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す return gets.chomp.split("") end def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する return bool ? y : n end def array(size,n=1,init=nil) #nに配列の次元数、sizeに配列の大きさ、initに初期値を投げることでその配列を返す if n==1 return Array.new(size){init} else return Array.new(n).map{Array.new(size){init}} end end q=gets.to_i table=array(10**5,1,0) for i in 1..10**5 if (i%2).zero? table[i]=table[i-1] else table[i]=table[i-1] table[i]+=(Prime.prime?(i) and Prime.prime?((i+1)/2)) ? 1 : 0 end end q.times do|i| l,r=get_i puts table[r]-table[l] end
require "prime" def get_i() #空白区切の入力を数値(整数)の配列で返す return gets.chomp.split(" ").map(&:to_i) end def get_f() #空白区切の入力を数値(実数)の配列で返す return gets.chomp.split(" ").map(&:to_f) end def get() #空白区切の入力を文字列の配列で返す return gets.chomp.split(" ") end def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す return gets.chomp.split("") end def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する return bool ? y : n end def array(size,n=1,init=nil) #nに配列の次元数、sizeに配列の大きさ、initに初期値を投げることでその配列を返す if n==1 return Array.new(size){init} else return Array.new(n).map{Array.new(size){init}} end end q=gets.to_i table=array(10**5,1,0) for i in 1..10**5 if (i%2).zero? table[i]=table[i-1] else table[i]=table[i-1] table[i]+=(Prime.prime?(i) and Prime.prime?((i+1)/2)) ? 1 : 0 end end q.times do|i| l,r=get_i puts table[r]-table[l-1] end
[ "expression.operation.binary.add" ]
1,227,900
1,227,901
u415400221
ruby
p03475
N = gets.chomp.to_i C = Array.new(N-1) S = Array.new(N-1) F = Array.new(N-1) (N-1).times do |n| C[n],S[n],F[n] = gets.chomp.split.map(&:to_i) end (N-1).times do |n| sum = 0 n.upto(N-2) do |m| if sum < S[m] sum = S[m] elsif sum % F[m] != 0 sum += sum + F[m] - (sum % F[m]) end sum += C[m] end p sum end p 0
N = gets.chomp.to_i C = Array.new(N-1) S = Array.new(N-1) F = Array.new(N-1) (N-1).times do |n| C[n],S[n],F[n] = gets.chomp.split.map(&:to_i) end (N-1).times do |n| sum = 0 n.upto(N-2) do |m| if sum < S[m] sum = S[m] elsif sum % F[m] != 0 sum += F[m] - (sum % F[m]) end sum += C[m] end p sum end p 0
[ "expression.operation.binary.remove" ]
1,227,984
1,227,985
u800051719
ruby
p03475
n = gets.to_i station = [nil] (n-1).times do station.push(gets.chomp.split(' ').map(&:to_i).unshift(nil)) end arr = [] for i in 1..(n-1) station[i] time = 0 # 出発駅の待ち時間を足す time+=station[i][2] # 次の駅に向かう time+=station[i][1] # i+1からn-1まで駅操作を繰り返す for j in (i+1)..(n-1) # 時間が当駅の出発時間に満たなかったとき、時間を出発時間に変更 time = station[j][2] if time < station[j][2] unless time%station[j][3] == 0 # 発車間隔まで待つ time+=time%station[j][3]-time/station[j][3] end time+= station[j][1] end arr.push(time) end arr.push(0) arr.each{|a|puts a}
n = gets.to_i station = [nil] (n-1).times do station.push(gets.chomp.split(' ').map(&:to_i).unshift(nil)) end arr = [] for i in 1..(n-1) station[i] time = 0 # 出発駅の待ち時間を足す time+=station[i][2] # 次の駅に向かう time+=station[i][1] # i+1からn-1まで駅操作を繰り返す for j in (i+1)..(n-1) # 時間が当駅の出発時間に満たなかったとき、時間を出発時間に変更 time = station[j][2] if time < station[j][2] unless time%station[j][3] == 0 # 発車間隔まで待つ time+=station[j][3]-time%station[j][3] end time+= station[j][1] end arr.push(time) end arr.push(0) arr.each{|a|puts a}
[ "expression.operation.binary.remove" ]
1,228,030
1,228,031
u093034675
ruby
p03475
n=gets.to_i c,s,f=$<.map{|e|e.split.map &:to_i}.transpose n.times{|i| t=0 (i..n-2).each{|j| if t<s[j] t=s[j] elsif t%f[j]!=0 t+=f[j]-t%s[j] end t+=c[j] } p t }
n=gets.to_i c,s,f=$<.map{|e|e.split.map &:to_i}.transpose n.times{|i| t=0 (i..n-2).each{|j| if t<s[j] t=s[j] elsif t%f[j]!=0 t+=f[j]-t%f[j] end t+=c[j] } p t }
[ "identifier.change", "expression.operation.binary.change" ]
1,228,210
1,228,211
u280667879
ruby
p03475
n = gets.to_i csf = (n-1).times.map{gets.split.map &:to_i} ans = Array.new(n, 0) (n-1).times{|i| a = 0 for j in i...n-1 c,s,f = csf[j] a = s if a < s a += (a-s)%f a += c end ans[i] = a } ans.each{|t| p t}
n = gets.to_i csf = (n-1).times.map{gets.split.map &:to_i} ans = Array.new(n, 0) (n-1).times{|i| a = 0 for j in i...n-1 c,s,f = csf[j] a = s if a < s a += (f-(a-s)%f)%f a += c end ans[i] = a } ans.each{|t| p t}
[ "expression.operation.binary.add" ]
1,228,293
1,228,294
u397763977
ruby
p03476
require 'prime' prime = Prime.each(10**5) c = Array.new(10**5, 0) l=[], r=[] Q = gets.to_i Q.times do |i| l[i], r[i] = gets.split.map(&:to_i) end isPrime = Array.new(10**5, false) prime.each do |i| isPrime[i] = true end j = 1 while j < 100000 c[j] += 1 if isPrime[j] && isPrime[(j+1)/2] j +=2 end 1.upto(100000) do |i| c[i] += c[i-1] end Q.times do |i| puts c[r[i]]-c[l[i]-1] end
require 'prime' prime = Prime.each(2*10**5) c = Array.new(2*10**5, 0) l=[], r=[] Q = gets.to_i Q.times do |i| l[i], r[i] = gets.split.map(&:to_i) end isPrime = Array.new(2*10**5, false) prime.each do |i| isPrime[i] = true end j = 1 while j < 100000 c[j] += 1 if isPrime[j] && isPrime[(j+1)/2] j +=2 end 1.upto(100000) do |i| c[i] += c[i-1] end Q.times do |i| puts c[r[i]]-c[l[i]-1] end
[ "assignment.change" ]
1,228,543
1,228,544
u819939299
ruby