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
p00002
def cntDigits(num) digit = 1 while num > 10 digit += 1 num /= 10.0 end digit end while line = gets nums = line.split puts cntDigits(nums[0].to_i + nums[1].to_i) end
def cntDigits(num) digit = 1 while num >= 10 digit += 1 num /= 10.0 end digit end while line = gets nums = line.split puts cntDigits(nums[0].to_i + nums[1].to_i) end
[ "expression.operator.compare.change", "expression.operation.binary.change" ]
5,521
5,522
u214508393
ruby
p00003
n = gets.to_i n.times do a, b, c = gets.split.map(&:to_i).sort if c**2 == b**2 + c**2 puts 'YES' else puts 'NO' end end
n = gets.to_i n.times do a, b, c = gets.split.map(&:to_i).sort if c**2 == b**2 + a**2 puts 'YES' else puts 'NO' end end
[ "identifier.change", "control_flow.branch.if.condition.change" ]
6,876
6,877
u334460795
ruby
p00003
n = gets.to_i n.times do input = gets.split(' ') a = input[0].to_i b = input[1].to_i c = input[2].to_i a **= 2 b **= 2 c **= 2 if a = b + c || b = a + c || c = a + b puts 'yes' else puts 'no' end end
n = gets.to_i n.times do input = gets.split(' ') a = input[0].to_i b = input[1].to_i c = input[2].to_i a **= 2 b **= 2 c **= 2 if a == b + c || b == a + c || c == a + b puts 'YES' else puts 'NO' end end
[ "expression.operation.compare.replace.add", "assignment.replace.remove", "misc.typo", "literal.string.change", "literal.string.case.change", "call.arguments.change", "io.output.change" ]
6,925
6,926
u071682035
ruby
p00003
n = gets.to_i n.times do input = gets.split(' ') a = input[0].to_i b = input[2].to_i c = input[3].to_i a **= 2 b **= 2 c **= 2 if a = b + c || b = a + c || c = a + b puts 'YES' else puts 'NO' end end
n = gets.to_i n.times do input = gets.split(' ') a = input[0].to_i b = input[1].to_i c = input[2].to_i a **= 2 b **= 2 c **= 2 if a == b + c || b == a + c || c == a + b puts 'YES' else puts 'NO' end end
[ "io.output.change", "expression.operation.compare.replace.add", "assignment.replace.remove", "misc.typo" ]
6,927
6,926
u071682035
ruby
p00002
a, b = gets.chomp.split.map(&:to_i) puts (a + b).to_s.size
while nums = gets a, b = nums.chomp.split.map(&:to_i) puts (a + b).to_s.size end
[ "identifier.change" ]
7,966
7,967
u517414491
ruby
p00002
digits = [] loop do data = gets break if (data == "\n") || (data == "\n\r") x, y = data.split.map(&:to_i) digits.push((x + y).to_s.length) end digits.each do |d| puts d end
digits = [] loop do data = gets break if data.nil? || (data == "\n") || (data == "\n\r") x, y = data.split.map(&:to_i) digits.push((x + y).to_s.length) end digits.each do |d| puts d end
[ "control_flow.branch.if.condition.change" ]
7,968
7,969
u888227825
ruby
p00002
digits = [] loop do data = gets break if data.eof? || (data == "\n") || (data == "\n\r") x, y = data.split.map(&:to_i) digits.push((x + y).to_s.length) end digits.each do |d| puts d end
digits = [] loop do data = gets break if data.nil? || (data == "\n") || (data == "\n\r") x, y = data.split.map(&:to_i) digits.push((x + y).to_s.length) end digits.each do |d| puts d end
[ "identifier.change", "control_flow.branch.if.condition.change" ]
7,970
7,969
u888227825
ruby
p00007
debt = 100 gets.to_i.times do debt = ceil(debt * 1.05) end puts debt * 1000
debt = 100 gets.to_i.times do debt = (debt * 1.05).ceil end puts debt * 1000
[ "call.add" ]
11,252
11,253
u802537549
ruby
p00008
while n = gets n.chomp.to_i m = 0 (0..9).each do |i| (0..9).each do |j| (0..9).each do |k| (0..9).each do |l| m += 1 if i + j + k + l == n end end end end puts m end
while n = gets n = n.chomp.to_i m = 0 (0..9).each do |i| (0..9).each do |j| (0..9).each do |k| (0..9).each do |l| m += 1 if i + j + k + l == n end end end end puts m end
[ "assignment.add" ]
11,491
11,492
u216457386
ruby
p00011
w = gets.to_i n = gets.to_i horizon_bars = [] n.times do horizon_bars << gets.split(',').map(&:to_i) end p horizon_bars 1.upto(w) do |i| horizon_bars.reverse_each do |bar| source = bar.index(i) i = bar[(source + 1) % 2] if source end puts i end
w = gets.to_i n = gets.to_i horizon_bars = [] n.times do horizon_bars << gets.split(',').map(&:to_i) end 1.upto(w) do |i| horizon_bars.reverse_each do |bar| source = bar.index(i) i = bar[(source + 1) % 2] if source end puts i end
[ "call.remove" ]
13,506
13,507
u728700495
ruby
p00013
arr = [] while line = gets num = line.to_i if num.zero? putsarr.pop else arr << num end end
arr = [] while line = gets num = line.to_i if num.zero? puts arr.pop else arr << num end end
[ "identifier.change", "call.add", "call.arguments.change" ]
13,877
13,878
u814658648
ruby
p00015
#!/usr/bin/ruby n = STDIN.gets.to_i n.times do |i| sum = STDIN.gets.to_i + STDIN.gets.to_i puts sum > 10**79 ? "overflow" : sum end
#!/usr/bin/ruby n = STDIN.gets.to_i n.times do |i| sum = STDIN.gets.to_i + STDIN.gets.to_i puts sum >= 10**80 ? "overflow" : sum end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change", "literal.number.integer.change" ]
15,148
15,149
u809815599
ruby
p00018
$stdin.gets.split.map(&:to_i).sort {|a, b| b <=> a }.join(' ')
puts gets.split.map(&:to_i).sort{|a,b| b<=>a}.join(" ")
[ "call.remove", "literal.string.change", "call.arguments.change" ]
16,009
16,010
u364115699
ruby
p00018
p $stdin.gets.split.map(&:to_i).sort {|a, b| b <=> a }.join(' ')
puts gets.split.map(&:to_i).sort{|a,b| b<=>a}.join(" ")
[ "call.function.change", "io.output.change", "call.remove", "literal.string.change", "call.arguments.change" ]
16,012
16,010
u364115699
ruby
p00018
return $stdin.gets.split.map(&:to_i).sort {|a, b| b <=> a }.join(' ')
puts gets.split.map(&:to_i).sort{|a,b| b<=>a}.join(" ")
[ "function.return_value.change", "call.remove", "literal.string.change", "call.arguments.change" ]
16,015
16,010
u364115699
ruby
p00018
p gets.split.map(&:to_i).sort{|a,b| b<=>a}.join(" ")
puts gets.split.map(&:to_i).sort{|a,b| b<=>a}.join(" ")
[ "call.function.change", "io.output.change" ]
16,016
16,010
u364115699
ruby
p00024
class Problem def exec while l = gets do i = l.to_i res = calc i puts res end end def calc(i) # ?£????????????????????????????????¨???? t = i / 9.8 #?????????????????§??????????????¢????¨???? y = 4.9 * (t ** 2) #??????????????¢????????????????????§???????????°?£???...
class Problem def exec while l = gets do i = l.to_f res = calc(i) puts res end end def calc(i) # ?£????????????????????????????????¨???? t = i / 9.8 #?????????????????§??????????????¢????¨???? y = 4.9 * (t ** 2) #??????????????¢????????????????????§???????????°?£??...
[ "call.function.change", "type_conversion.to_float.change", "type_conversion.to_number.change", "call.arguments.change", "control_flow.return.add" ]
20,308
20,309
u404663268
ruby
p00027
loop{ input = gets.chomp h = 20.0 y = 4.0 m,d = input.split(" ").map{|e| e.to_f} exit if m==0 and d==0 if m==1 or m==2 then m+=12 y-=1 end w=y+(y/4).floor+(h/4).floor-2*h+(13*(m+1)/5).floor+d w=w.to_i r=w % 7 case r when 1 then puts "Sunday" when 2 then puts "Monday" when 3 then puts "Trueday" when 4 then ...
loop{ input = gets.chomp h = 20.0 y = 4.0 m,d = input.split(" ").map{|e| e.to_f} exit if m==0 and d==0 if m==1 or m==2 then m+=12 y-=1 end w=y+(y/4).floor+(h/4).floor-2*h+(13*(m+1)/5).floor+d w=w.to_i r=w % 7 case r when 1 then puts "Sunday" when 2 then puts "Monday" when 3 then puts "Tuesday" when 4 then ...
[ "literal.string.change", "call.arguments.change", "io.output.change" ]
20,856
20,857
u136695294
ruby
p00031
while line = gets arr = [] line.to_i.to_s(2).split("").each_with_index do |elm, idx| arr << 2 ** idx if elm == "1" end puts arr.join(" ") end
while line = gets arr = [] line.to_i.to_s(2).split("").reverse.each_with_index do |b, i| arr << 2 ** i if b == "1" end puts arr.join(" ") end
[ "call.add", "identifier.change", "expression.operation.binary.change", "control_flow.branch.if.condition.change" ]
22,412
22,413
u814658648
ruby
p00034
while (st=gets) != nil do st = st.split(',').map! {|x| x=x.to_i} b = st.pop.to_f a = st.pop.to_f sum = 0 i = 0 st.each {|x| sum += x} a = sum*a/(a+b) p a while a>0 do a -= st.shift i += 1 end p i end
while (st=gets) != nil do st = st.split(',').map! {|x| x=x.to_i} b = st.pop.to_f a = st.pop.to_f sum = 0 i = 0 st.each {|x| sum += x} a = sum*a/(a+b) while a>0 do a -= st.shift i += 1 end p i end
[ "call.remove" ]
23,379
23,380
u068244524
ruby
p00047
cup = [1,0,0] while act = gets case act.chomp when "A,B" then cup[0], cup[1] = cup[1], cup[0] when "B,A" then cup[0], cup[1] = cup[1], cup[0] when "A,C" then cup[0], cup[2] = cup[2], cup[0] when "C,A" then cup[0], cup[2] = cup[2], cup[0] when "B,C" then cup[1], cup[2] = cup[2], cup[1] when "C,B" then cup...
cup = [1,0,0] while act = gets case act.chomp when "A,B" then cup[0], cup[1] = cup[1], cup[0] when "B,A" then cup[0], cup[1] = cup[1], cup[0] when "A,C" then cup[0], cup[2] = cup[2], cup[0] when "C,A" then cup[0], cup[2] = cup[2], cup[0] when "B,C" then cup[1], cup[2] = cup[2], cup[1] when "C,B" then cup...
[ "call.remove" ]
25,973
25,974
u261074410
ruby
p00048
while input = gets; break if input == nil weight = input.to_f if weight <= 48.0 then print "lighy fly\n" elsif weight > 48.0 && weight <= 51.0 then print "fly\n" elsif weight > 51.0 && weight <= 54.0 then print "bantam\n" elsif weight > 54.0 && weight <= 57.0 then print "feather\n" elsif weight > 57.0...
while input = gets; break if input == nil weight = input.to_f if weight <= 48.0 then print "light fly\n" elsif weight > 48.0 && weight <= 51.0 then print "fly\n" elsif weight > 51.0 && weight <= 54.0 then print "bantam\n" elsif weight > 54.0 && weight <= 57.0 then print "feather\n" elsif weight > 57.0...
[ "literal.string.change", "call.arguments.change" ]
26,124
26,123
u802096158
ruby
p00086
route = Array.new(100,0) readlines.each do |line| frm,to = line.split.map(&:to_i) if frm == 0 && to == 0 if route[1].odd? && route[2].odd? && route.drop(3).all?(&:even?) puts"OK" else puts"NG" end nodes = Array.new(100){0} else route[frm] +=1 route[to] +=1 end end
route = Array.new(100,0) readlines.each do |line| frm,to = line.split.map(&:to_i) if frm == 0 && to == 0 if route[1].odd? && route[2].odd? && route.drop(3).all?(&:even?) puts"OK" else puts"NG" end route = Array.new(100){0} else route[frm] +=1 route[to] +=1 end end
[ "assignment.variable.change", "identifier.change" ]
31,232
31,233
u588130269
ruby
p00097
dp = Array.new(10){ Array.new(1001) {0} } dp[0][0] = 1 0.upto(100) do |i| 1000.downto(0) do |j| 9.downto(1) do |k| dp[k][j] += dp[k-1][j-i] if j-i>=0 end end end while gets do n, s = $_.split(' ').map(&:to_i) break if n == 0 or s == 0 puts dp[n][s] end
dp = Array.new(10){ Array.new(1001) {0} } dp[0][0] = 1 0.upto(100) do |i| 1000.downto(0) do |j| 9.downto(1) do |k| dp[k][j] += dp[k-1][j-i] if j-i>=0 end end end while gets do n, s = $_.split(' ').map(&:to_i) break if n == 0 and s == 0 puts dp[n][s] end
[ "control_flow.branch.if.condition.change" ]
32,403
32,404
u708217907
ruby
p00103
result = [] file.gets.chomp.to_i.times do |inning| score = 0 out = 0 runner = 0 while out < 3 event = file.gets.chomp case event when "HIT" runner += 1 when "HOMERUN" score += runner + 1 runner = 0 when "OUT" out += 1 end if runner == 4 score += 1 ...
result = [] gets.chomp.to_i.times do |inning| score = 0 out = 0 runner = 0 while out < 3 event = gets.chomp case event when "HIT" runner += 1 when "HOMERUN" score += runner + 1 runner = 0 when "OUT" out += 1 end if runner == 4 score += 1 runner = 3...
[ "call.remove" ]
33,666
33,667
u635383114
ruby
p00101
n = gets().to_i n.times do |i| str = gets() puts str.gsub("hoshino","hoshina") end
# -*- coding: utf-8 -*- n = gets().to_i n.times do |i| str = gets() puts str.gsub("Hoshino", "Hoshina") end
[ "literal.string.change", "literal.string.case.change", "call.arguments.change", "io.output.change" ]
33,913
33,914
u422535245
ruby
p00105
hash = {} while gets != nil word, page = gets.split if hash[word] == nil hash[word] = [page.to_i] else hash[word] << page.to_i end end hash.values.each {|item| item.sort!} hash = Hash[hash.sort] hash.each {|k, v| puts k, v.join(" ")}
hash = {} while (str = gets) != nil word, page = str.split if hash[word] == nil hash[word] = [page.to_i] else hash[word] << page.to_i end end hash.values.each {|item| item.sort!} hash = Hash[hash.sort] hash.each {|k, v| puts k, v.join(" ")}
[ "assignment.value.change", "identifier.change" ]
34,376
34,377
u635383114
ruby
p00105
hash = Hash.new {|hash, key| hash[key] = []} while (str = gets) != nil word, page = gets.split hash[word] << page.to_i end hash.values.each {|item| item.sort!} hash = Hash[hash.sort] hash.each {|k, v| puts k, v.join(" ")}
hash = Hash.new {|hash, key| hash[key] = []} while (str = gets) != nil word, page = str.split hash[word] << page.to_i end hash.values.each {|item| item.sort!} hash = Hash[hash.sort] hash.each {|k, v| puts k, v.join(" ")}
[ "assignment.value.change", "identifier.change" ]
34,378
34,379
u635383114
ruby
p00423
while true n = gets.to_i break if n == 0 a,b = 0,0 n.times do ca,cb = gets.split.map{|s|s.to_i} ca == cb ? (a+=ca;b+=cb) : (ca>cb ? a += ca+cb : b += ca+cb) end puts"#{ca} #{cb}" end
while true n = gets.to_i break if n == 0 a,b = 0,0 n.times do ca,cb = gets.split.map{|s|s.to_i} ca == cb ? (a+=ca;b+=cb) : (ca>cb ? a += ca+cb : b += ca+cb) end puts"#{a} #{b}" end
[ "literal.string.change", "call.arguments.change" ]
49,446
49,447
u217294278
ruby
p01125
def dir2num(str) case str when 'N' then [0, 1] when 'E' then [1, 0] when 'S' then [0, -1] when 'W' then [-1, 0] end end def move_robot(arr) $r.each do |arr| arr[1].to_i.times do $moved_pos << $pos = $pos.zip(dir2num(arr[0])).map{ |a| a.inject(:+) } end end end while line = gets break i...
def dir2num(str) case str when 'N' then [0, 1] when 'E' then [1, 0] when 'S' then [0, -1] when 'W' then [-1, 0] end end def move_robot(arr) $r.each do |arr| arr[1].to_i.times do $moved_pos << $pos = $pos.zip(dir2num(arr[0])).map{ |a| a.inject(:+) } end end end a = [] while line = gets b...
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
74,881
74,882
u818068308
ruby
p02233
def fib(n) f, p1 = 0, 1 1.upto(n) do p2, p1 = p1, f f = p1 + p2 end return f end puts fib(gets.to_i)
def fib(n) f, p1 = 1, 1 2.upto(n) do p2, p1 = p1, f f = p1 + p2 end return f end puts fib(gets.to_i)
[ "literal.number.integer.change", "assignment.value.change" ]
92,624
92,625
u814658648
ruby
p02233
require 'matrix' def fib3(n) f0, f1 = 1, 1 n.times{ f0, f1 = f1, f0 + f1 } return f0 end puts fib(gets.to_i)
require 'matrix' def fib(n) f0, f1 = 1, 1 n.times{ f0, f1 = f1, f0 + f1 } return f0 end puts fib(gets.to_i)
[ "identifier.change" ]
92,626
92,627
u814658648
ruby
p02255
class AOJ def initialize n = gets.chomp.to_i a = gets.chomp.split(' ').map(&:to_i) 1.upto(n-1) do |i| j = i v = a[j] while j > 0 && v < a[j-1] j -= 1 end a.delete_at(i) a.insert(j, v) puts a.join(' ') end end end AOJ.new
class AOJ def initialize n = gets.chomp.to_i a = gets.chomp.split(' ').map(&:to_i) 0.upto(n-1) do |i| j = i v = a[j] while j > 0 && v < a[j-1] j -= 1 end a.delete_at(i) a.insert(j, v) puts a.join(' ') end end end AOJ.new
[ "literal.number.integer.change" ]
99,020
99,021
u470949294
ruby
p02257
n = gets.strip.to_i count = 0 while line = gets do num = line.strip.to_i root_num = Math.sqrt(num).floor can_divide = (2..root_num).any? do |i| num % i == 0 end if can_divide then count += 1 end end p count
n = gets.strip.to_i count = 0 while line = gets do num = line.strip.to_i root_num = Math.sqrt(num).floor can_divide = (2..root_num).any? do |i| num % i == 0 end if !can_divide then count += 1 end end p count
[ "expression.operation.unary.add", "control_flow.branch.if.condition.change" ]
100,917
100,918
u148091382
ruby
p02260
n = gets.to_i array = gets.split.map(&:to_i) cnt = 0 for i in 0..n-1 indexMin = i for k in i..n-1 if array[k] < array[indexMin] indexMin = k end end array[i],array[indexMin] = array[indexMin],array[i] if i != indexMin cnt += 1 end end p array.join(" ") puts cnt
n = gets.to_i array = gets.split.map(&:to_i) cnt = 0 for i in 0..n-1 indexMin = i for k in i..n-1 if array[k] < array[indexMin] indexMin = k end end array[i],array[indexMin] = array[indexMin],array[i] if i != indexMin cnt += 1 end end puts array.join(" ") puts cnt
[ "call.function.change", "io.output.change" ]
104,141
104,142
u648595404
ruby
p02262
def insertionSort(a,n,g) cnt = 0 for i in g..n-1 v = a[i] j = i-g while j>=0 && a[j]>v do a[j+g] = a[j] j = j-g cnt += 1 end a[j+g] = v end return cnt end def makeShellNum(n) num = 0 arr = [] tmp = 1 while n > tmp do arr << tmp num += 1 tmp = 3*tmp + 1...
def insertionSort(a,n,g) cnt = 0 for i in g..n-1 v = a[i] j = i-g while j>=0 && a[j]>v do a[j+g] = a[j] j = j-g cnt += 1 end a[j+g] = v end return cnt end def makeShellNum(n) num = 0 arr = [] tmp = 1 while n >= tmp do arr << tmp num += 1 tmp = 3*tmp + ...
[ "expression.operator.compare.change", "expression.operation.binary.change", "call.add" ]
109,207
109,208
u241079749
ruby
p02266
s1 = [] s2 = [] str = gets i = 0 sum = 0 str.chars do |c| if c == "\\" s1.push(i) elsif c == "/" && s1.size > 0 j = s1.pop sum += i - j a = i - j while s2.size > 0 && s2.last[:pos] > j st = s2.pop a += st[:area] end s2.push({:pos => j, :area => a}) end i += 1 end puts sum printf("%d", s2.size...
s1 = [] s2 = [] str = gets i = 0 sum = 0 str.chars do |c| if c == "\\" s1.push(i) elsif c == "/" && s1.size > 0 j = s1.pop sum += i - j a = i - j while s2.size > 0 && s2.last[:pos] > j st = s2.pop a += st[:area] end s2.push({:pos => j, :area => a}) end i += 1 end puts sum printf("%d", s2.size...
[ "literal.string.change", "call.arguments.change", "io.output.change", "call.add" ]
110,507
110,508
u292533509
ruby
p02266
s1 = [] s2 = [] str = gets i = 0 sum = 0 str.chars do |c| if c == "\\" s1.push(i) elsif c == "/" && s1.size > 0 j = s1.pop sum += i - j a = i - j while s2.size > 0 && s2.last[:pos] > j st = s2.pop a += st[:area] end s2.push({:pos => j, :area => a}) end i += 1 end puts sum printf("%d", s2.size...
s1 = [] s2 = [] str = gets i = 0 sum = 0 str.chars do |c| if c == "\\" s1.push(i) elsif c == "/" && s1.size > 0 j = s1.pop sum += i - j a = i - j while s2.size > 0 && s2.last[:pos] > j st = s2.pop a += st[:area] end s2.push({:pos => j, :area => a}) end i += 1 end puts sum printf("%d", s2.size...
[ "literal.string.change", "call.arguments.change", "io.output.change", "call.add" ]
110,509
110,508
u292533509
ruby
p02266
s1 = [] s2 = [] str = gets i = 0 sum = 0 str.chars do |c| if c == "\\" s1.push(i) elsif c == "/" && s1.size > 0 j = s1.pop sum += i - j a = i - j while s2.size > 0 && s2.last[:pos] > j st = s2.pop a += st[:area] end s2.push({:pos => j, :area => a}) end i += 1 end puts sum printf("%d", s2.size...
s1 = [] s2 = [] str = gets i = 0 sum = 0 str.chars do |c| if c == "\\" s1.push(i) elsif c == "/" && s1.size > 0 j = s1.pop sum += i - j a = i - j while s2.size > 0 && s2.last[:pos] > j st = s2.pop a += st[:area] end s2.push({:pos => j, :area => a}) end i += 1 end puts sum printf("%d", s2.size...
[ "literal.string.change", "call.arguments.change" ]
110,510
110,508
u292533509
ruby
p02266
s1 = [] s2 = [] str = gets i = 0 sum = 0 str.chars do |c| if c == "\\" s1.push(i) elsif c == "/" && s1.size > 0 j = s1.pop sum += i - j a = i - j while s2.size > 0 && s2.last[:pos] > j st = s2.pop a += st[:area] end s2.push({:pos => j, :area => a}) end i += 1 end puts sum printf("%d", s2.size...
s1 = [] s2 = [] str = gets i = 0 sum = 0 str.chars do |c| if c == "\\" s1.push(i) elsif c == "/" && s1.size > 0 j = s1.pop sum += i - j a = i - j while s2.size > 0 && s2.last[:pos] > j st = s2.pop a += st[:area] end s2.push({:pos => j, :area => a}) end i += 1 end puts sum printf("%d", s2.size...
[ "literal.string.change", "call.arguments.change" ]
110,511
110,508
u292533509
ruby
p02267
def linerSearch(array, key) i = 0 array.push(key) while array[i] != key i += 1 if i == array.length - 1 array.pop return false end end array.pop return true end n = gets.to_i s = gets.chomp.split(' ').map(&:to_i) q = gets.to_i t = gets.chomp.split(' ').map(&:to_i) count = 0 n.times...
def linerSearch(array, key) i = 0 array.push(key) while array[i] != key i += 1 if i == array.length - 1 array.pop return false end end array.pop return true end n = gets.to_i s = gets.chomp.split(' ').map(&:to_i) q = gets.to_i t = gets.chomp.split(' ').map(&:to_i) count = 0 q.times...
[ "identifier.change", "call.arguments.change", "control_flow.branch.if.condition.change", "call.arguments.add" ]
111,384
111,385
u878851603
ruby
p02280
class Node attr_reader :id, :left, :right attr_accessor :parent def initialize(id) @id = id @parent = nil @left = nil @right = nil end def left=(child) child.parent = self @left = child end def right=(child) child.parent = self @right = child end def sibling ret...
class Node attr_reader :id, :left, :right attr_accessor :parent def initialize(id) @id = id @parent = nil @left = nil @right = nil end def left=(child) child.parent = self @left = child end def right=(child) child.parent = self @right = child end def sibling ret...
[ "call.add" ]
122,819
122,820
u069176427
ruby
p02287
def read_tree(a) def parent(array, index) if(index != 1) " parent key = #{array[index/2]}, " end end def keys(array, index) left = 2*index right = 2*index + 1 if(left < array.length && right < array.length) "left key = #{array[left]}, right key = #{array[right]}, " elsif(left < array.length && ri...
def read_tree(a) def parent(array, index) if(index != 1) "parent key = #{array[index/2]}, " end end def keys(array, index) left = 2*index right = 2*index + 1 if(left < array.length && right < array.length) "left key = #{array[left]}, right key = #{array[right]}, " elsif(left < array.length && rig...
[ "literal.string.change", "call.arguments.change" ]
125,434
125,432
u959436166
ruby
p02379
x1,y1,x2,y2 = gets.chomp.split(" ").map{|item| item.to_i} distance = (((x1-x2).abs**2) + ((y1-y2).abs**2))**(1/2.0) puts distance
x1,y1,x2,y2 = gets.chomp.split(" ").map{|item| item.to_f} distance = (((x1-x2).abs**2) + ((y1-y2).abs**2))**(1/2.0) puts distance
[ "call.function.change", "type_conversion.to_float.change", "type_conversion.to_number.change" ]
134,834
134,835
u843848664
ruby
p02379
#lines = <<'EOS' #0 0 1 1 #EOS lines = $stdin.read array = lines.split("\n") str = array[0] x1 = str.split(" ")[0].to_i y1 = str.split(" ")[1].to_i x2 = str.split(" ")[2].to_i y2 = str.split(" ")[3].to_i diff = ((x1-x2)**2).abs + ((y1-y2)**2).abs d = Math.sqrt(diff) puts "#{d}"
#lines = <<'EOS' #0 0 1 1 #EOS lines = $stdin.read array = lines.split("\n") str = array[0] x1 = str.split(" ")[0].to_f y1 = str.split(" ")[1].to_f x2 = str.split(" ")[2].to_f y2 = str.split(" ")[3].to_f diff = ((x1-x2)**2).abs + ((y1-y2)**2).abs d = Math.sqrt(diff) puts "#{d}"
[ "call.function.change", "type_conversion.to_float.change", "type_conversion.to_number.change" ]
134,848
134,849
u397596432
ruby
p02383
class Dice def initialize(faces) @top = faces.shift @back = faces.shift @right = faces.shift @left = faces.shift @front = faces.shift @bottom = faces.shift end def turn_to_n old_top = @top @top = @front @front = @bottom @bottom = @back @back = old_top end def turn...
class Dice def initialize(faces) @top = faces.shift @front = faces.shift @right = faces.shift @left = faces.shift @back = faces.shift @bottom = faces.shift end def turn_to_n old_top = @top @top = @front @front = @bottom @bottom = @back @back = old_top end def turn...
[ "assignment.variable.change" ]
137,447
137,448
u906710658
ruby
p02381
while true n = gets.to_i break if n == 0 s = gets.split.map(&:to_i) mean = s.sum / n sum_of_squares = s.inject(0){|sum, i| sum + (i - mean) ** 2 } s2 = sum_of_squares / n s = Math.sqrt(s2) puts s end
while true n = gets.to_f break if n == 0 s = gets.split.map(&:to_f) mean = s.sum / n sum_of_squares = s.inject(0){|sum, i| sum + (i - mean) ** 2 } s2 = sum_of_squares / n ans = Math.sqrt(s2) puts ans end
[ "call.function.change", "type_conversion.to_float.change", "type_conversion.to_number.change", "assignment.value.change", "call.arguments.change", "assignment.variable.change", "identifier.change" ]
137,802
137,803
u087014397
ruby
p02381
while true n = gets.to_i break if n == 0 s = gets.split.map(&:to_i) mean = s.sum / n sum_of_squares = s.inject(0){|sum, i| sum + (i - mean) ** 2 } s2 = sum_of_squares / n ans = Math.sqrt(s2) puts ans end
while true n = gets.to_f break if n == 0 s = gets.split.map(&:to_f) mean = s.sum / n sum_of_squares = s.inject(0){|sum, i| sum + (i - mean) ** 2 } s2 = sum_of_squares / n ans = Math.sqrt(s2) puts ans end
[ "call.function.change", "type_conversion.to_float.change", "type_conversion.to_number.change", "assignment.value.change", "call.arguments.change" ]
137,804
137,803
u087014397
ruby
p02386
class Dice def dice_s(arr, i) arr[i][0],arr[i][1],arr[i][4],arr[i][5] = arr[i][4],arr[i][0],arr[i][5],arr[i][1] return arr[i] end def dice_e(arr, i) arr[i][0],arr[i][2],arr[i][3],arr[i][5] = arr[i][3],arr[i][0],arr[i][5],arr[i][2] return arr[i] end def dice_w(arr, i) arr[i][0],arr[i][2],...
class Dice def dice_s(arr, i) arr[i][0],arr[i][1],arr[i][4],arr[i][5] = arr[i][4],arr[i][0],arr[i][5],arr[i][1] return arr[i] end def dice_e(arr, i) arr[i][0],arr[i][2],arr[i][3],arr[i][5] = arr[i][3],arr[i][0],arr[i][5],arr[i][2] return arr[i] end def dice_w(arr, i) arr[i][0],arr[i][2...
[ "assignment.variable.change", "identifier.change", "assignment.value.change", "control_flow.branch.if.condition.change" ]
138,794
138,795
u216813029
ruby
p02388
x = gets.to_i puts x*3
x = gets.to_i puts x**3
[ "call.arguments.change", "io.output.change" ]
142,622
142,623
u248067387
ruby
p02388
x = gets.chomp.to_i puts x ^ 3
x = gets.chomp.to_i puts x * x * x
[ "expression.operation.binary.add" ]
142,641
142,642
u338661979
ruby
p02388
x = gets.chomp.to_i puts x ^ 3
x = gets.to_i puts (x ** 3)
[ "call.remove", "call.arguments.change", "expression.operation.binary.change" ]
142,641
142,643
u338661979
ruby
p02388
x=2 puts x**3
x= gets.to_i puts x**3
[ "assignment.value.change", "identifier.replace.add", "literal.replace.remove", "call.add" ]
142,685
142,686
u420040431
ruby
p02388
x = gets puts x * x * x
x = gets.to_i puts x * x * x
[ "call.add" ]
142,704
142,705
u045588362
ruby
p02388
x = gets.chomp puts x * x * x
x = gets.to_i puts x * x * x
[ "assignment.value.change", "identifier.change" ]
142,706
142,705
u045588362
ruby
p02389
a,b = gets.split.map(&:to_i) puts = "#{a*b} #{(a+b)*2}"
a,b = gets.split.map(&:to_i) puts "#{a*b} #{(a+b)*2}"
[]
147,865
147,866
u142551424
ruby
p02389
a,b = gets.split.map(&:to_i) puts = "{#a*b} {#(a+b)*2}"
a,b = gets.split.map(&:to_i) puts "#{a*b} #{(a+b)*2}"
[ "literal.string.change" ]
147,867
147,866
u142551424
ruby
p02389
a, b = *(gets.strip.split(/ +/).map(&:to_i)) area = a * b surround = (a + b) + 2 puts "#{area} #{surround}"
a, b = *(gets.strip.split(/ +/).map(&:to_i)) area = a * b surround = (a + b) * 2 puts "#{area} #{surround}"
[ "expression.operator.arithmetic.change", "assignment.value.change", "expression.operation.binary.change" ]
147,895
147,894
u215060102
ruby
p02391
aryPrm = gets.split strComparisonOperator = "" if aryPrm[0].to_i < aryPrm[1].to_i strComparisonOperator = "<" elsif aryPrm[0].to_i == aryPrm[1].to_i strComparisonOperator = "==" else strComparisonOperator = "<" end puts "a #{strComparisonOperator} b"
aryPrm = gets.split strComparisonOperator = "" if aryPrm[0].to_i < aryPrm[1].to_i strComparisonOperator = "<" elsif aryPrm[0].to_i == aryPrm[1].to_i strComparisonOperator = "==" else strComparisonOperator = ">" end puts "a #{strComparisonOperator} b"
[ "misc.opposites", "literal.string.change", "expression.operator.compare.change", "assignment.value.change" ]
159,180
159,181
u501790039
ruby
p02391
a,b = gets.split.map{ |x| x.to_i } if a < b puts "a < b" elsif a >b puts "a > b" else puts "a = b" end
a,b = gets.split.map{ |x| x.to_i } if a < b puts "a < b" elsif a >b puts "a > b" else puts "a == b" end
[ "literal.string.change", "call.arguments.change" ]
159,198
159,199
u757861951
ruby
p02391
a,b = gets.split.map{ |x| x.to_i } if a < b puts "a<b" elsif a >b puts "a>b" else puts "a==b" end
a,b = gets.split.map{ |x| x.to_i } if a < b puts "a < b" elsif a >b puts "a > b" else puts "a == b" end
[ "literal.string.change", "call.arguments.change" ]
159,200
159,199
u757861951
ruby
p02391
a, b = gets.split.map(&:to_i) exp = "" if a > b then exp = ">" elsif a < b then exp = "<" else epx = "==" end print "a #{exp} b"
a, b = gets.split.map(&:to_i) exp = "" if a > b then exp = ">" elsif a < b then exp = "<" else exp = "==" end puts "a #{exp} b"
[ "assignment.variable.change", "identifier.change" ]
159,256
159,257
u551456712
ruby
p02392
a,b,c =gets.chomp.split(' ').map{|x|x.to_i} if a<b && b<c puts "yes" else puts "no" end
a,b,c =gets.chomp.split(' ').map{|x|x.to_i} if a<b && b<c puts "Yes" else puts "No" end
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
164,010
164,011
u534464795
ruby
p02392
a, b, c = gets.split.map(&:to_i) if a < b && b < c puts "YES" else puts "NO" end
a,b,c = gets.split.map(&:to_i) if a < b && b < c puts "Yes" else puts "No" end
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
164,022
164,023
u517018006
ruby
p02392
x,y,z = gets.split a = x.to_i b = y.to_i c = z.to_i if a < b < c puts"Yes" else puts"No" end
x,y,z = gets.split a = x.to_i b = y.to_i c = z.to_i if a < b and b < c puts"Yes" else puts"No" end
[ "control_flow.branch.if.condition.change" ]
164,055
164,056
u928503227
ruby
p02394
(W,H,x,y,r)=gets.split().map! &:to_i puts (0 < (x-r) && W > (x+r) && 0 < (y-r) && H > (y+r)) ? "Yes" : "No"
(W,H,x,y,r)=gets.split().map! &:to_i puts (0 <= (x-r) && W >= (x+r) && 0 <= (y-r) && H >= (y+r)) ? "Yes" : "No"
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
170,596
170,597
u565102293
ruby
p02394
def toi(a) b = [] a.each do |n| b << n.to_i end b end a = toi(gets.split) if 0<a[2]-a[4]&&a[2]+a[4]<a[0]&&0<a[3]-a[4]&&a[3]+a[4]<a[1] puts("Yes") else puts("No") end
def toi(a) b = [] a.each do |n| b << n.to_i end b end a = toi(gets.split) if 0<=a[2]-a[4]&&a[2]+a[4]<=a[0]&&0<=a[3]-a[4]&&a[3]+a[4]<=a[1] puts("Yes") else puts("No") end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
170,649
170,650
u641479950
ruby
p02394
W,H,x,y,r = gets.split.map(&:to_i) puts ((x+r<W && x-r>0)&&(y+r<H && y-r>0)) ? "Yes" : "No"
W,H,x,y,r = gets.split.map(&:to_i) puts ((x+r<=W && x-r>=0)&&(y+r<=H && y-r>=0)) ? "Yes" : "No"
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
170,726
170,727
u213421924
ruby
p02393
a = gets.split(' ').map{|i|i.to_i}.sort puts "#{a[0]} #{a[1]} #a[2]"
a = gets.chomp.split(' ').map{|i|i.to_i}.sort puts "#{a[0]} #{a[1]} #{a[2]}"
[ "call.add", "literal.string.change", "call.arguments.change" ]
171,054
171,055
u067629267
ruby
p02396
i = 0 while (num = gets.to_i) != 0 puts "Case #{i}:#{num}" i += 1 end
i = 1 while (x = gets.to_i) != 0 puts "Case #{i}: #{x}" i += 1 end
[ "literal.number.integer.change", "assignment.value.change", "assignment.variable.change", "identifier.change", "expression.operation.binary.change", "literal.string.change", "call.arguments.change" ]
174,890
174,891
u075360907
ruby
p02396
i = 0 while (no = gets.to_i) != 0 puts "Case #{i}:#{no}" i += 1 end
i = 1 while (x = gets.to_i) != 0 puts "Case #{i}: #{x}" i += 1 end
[ "literal.number.integer.change", "assignment.value.change", "assignment.variable.change", "identifier.change", "expression.operation.binary.change", "literal.string.change", "call.arguments.change" ]
174,892
174,891
u075360907
ruby
p02396
i = 0 while (num = gets.to_i) != 0 puts "Case #{i}:#{num}" i += 1 end
i = 1 while (no = gets.to_i) != 0 puts "Case #{i}: #{no}" i += 1 end
[ "literal.number.integer.change", "assignment.value.change", "assignment.variable.change", "identifier.change", "expression.operation.binary.change", "literal.string.change", "call.arguments.change" ]
174,890
174,894
u075360907
ruby
p02396
i = 0 while (no = gets.to_i) != 0 puts "Case #{i}:#{no}" i += 1 end
i = 1 while (no = gets.to_i) != 0 puts "Case #{i}: #{no}" i += 1 end
[ "literal.number.integer.change", "assignment.value.change", "literal.string.change", "call.arguments.change" ]
174,892
174,894
u075360907
ruby
p02396
i = 0 while (no = gets.to_i) != 0 puts "Case #{i}: #{x}" i += 1 end
i = 1 while (no = gets.to_i) != 0 puts "Case #{i}: #{no}" i += 1 end
[ "literal.number.integer.change", "assignment.value.change", "literal.string.change", "call.arguments.change" ]
174,893
174,894
u075360907
ruby
p02396
i = 1 while (x = gets.chomp) != '0' puts "Case #{i}:#{x}" i+=1 end
i = 1 while (x = gets.chomp) != '0' puts "Case #{i}: #{x}" i+=1 end
[ "literal.string.change", "call.arguments.change" ]
174,939
174,940
u060323819
ruby
p02396
count = 1; while true do num = gets.to_i; if num == 0 then break; end puts "Case " + count.to_s + ": " + num.to_s; count.next; end
count = 1; while true num = gets.to_i; if num == 0 then break; end puts "Case " + count.to_s + ": " + num.to_s; count += 1; end
[]
175,004
175,003
u606593727
ruby
p02396
count = 1; loop do num = gets.to_i; if num == 0 then break; end puts "Case " + count.to_s + ": " + num.to_s; count.next; end
count = 1; while true num = gets.to_i; if num == 0 then break; end puts "Case " + count.to_s + ": " + num.to_s; count += 1; end
[]
175,005
175,003
u606593727
ruby
p02394
inputs = gets.strip.split(' ') inputs.map!{|i| i.to_i} W = inputs[0] H = inputs[1] x = inputs[2] y = inputs[3] r = inputs[4] width_in = ((x + r) < W) && ((x - r) > 0) height_in = ((y + r) < H) && ((y - r) > 0) if width_in && height_in puts "Yes" else puts "No" end
inputs = gets.strip.split(' ') inputs.map!{|i| i.to_i} W = inputs[0] H = inputs[1] x = inputs[2] y = inputs[3] r = inputs[4] width_in = ((x + r) <= W) && ((x - r) >= 0) height_in = ((y + r) <= H) && ((y - r) >= 0) if width_in && height_in puts "Yes" else puts "No" end
[ "expression.operator.compare.change", "assignment.value.change", "expression.operation.binary.change" ]
175,623
175,624
u839879644
ruby
p02397
while (a = gets.split.map &:to_s) != ['0']*2 puts a.sort.join(" ") end
while (a = gets.chomp.split.map &:to_i) != [0]*2 puts a.sort.join(" ") end
[ "call.add", "assignment.value.change", "call.arguments.change", "expression.operation.binary.change" ]
177,829
177,830
u060323819
ruby
p02397
while (a = gets.chomp.split.map &:to_s) != ['0']*2 puts a.sort.join(" ") end
while (a = gets.chomp.split.map &:to_i) != [0]*2 puts a.sort.join(" ") end
[ "assignment.value.change", "call.arguments.change", "expression.operation.binary.change" ]
177,831
177,830
u060323819
ruby
p02397
while true aryMondai = gets.split.map(&:to_i); num1 = aryMondai[0]; num1 = aryMondai[0]; if num1 == 0 && num2 == 0 then break; end if num1 > num2 then puts num2.to_s + " " + num1.to_s; elsif num1 < num2 then puts num1.to_s + " " + num2.to_s; else puts num1.to_s + " " + num2.to_s; end end
while true aryMondai = gets.split.map(&:to_i); num1 = aryMondai[0]; num2 = aryMondai[1]; if num1 == 0 && num2 == 0 then break; end if num1 > num2 then puts num2.to_s + " " + num1.to_s; elsif num1 < num2 then puts num1.to_s + " " + num2.to_s; else puts num1.to_s + " " + num2.to_s; end end
[ "assignment.variable.change", "identifier.change", "literal.number.integer.change", "assignment.value.change", "variable_access.subscript.index.change" ]
177,872
177,873
u606593727
ruby
p02398
a, b, c = gets.split.map(&:to_i) d = 0 for num in a..c do if c % num == 0 d += 1 end puts d end
a, b, c = gets.split.map(&:to_i) d = 0 for num in a..b do if c % num == 0 d += 1 end end puts d
[ "identifier.change" ]
180,457
180,458
u087773362
ruby
p02398
a, b, c = gets.split.map(&:to_i) d = 0 for num in a..b do if c % num == 0 d += 1 end puts d end
a, b, c = gets.split.map(&:to_i) d = 0 for num in a..b do if c % num == 0 d += 1 end end puts d
[]
180,459
180,458
u087773362
ruby
p02399
a, b = gets.split.map(&:to_i) d = (a / b) r = (a % b) f = sprintf("%10.5f", (a / b)) puts "#{d} #{r} #{f}"
a, b = gets.split.map(&:to_i) d = (a / b) r = (a % b) f = sprintf("%10.10f", (a.to_f / b)) puts "#{d} #{r} #{f}"
[ "literal.string.change", "assignment.value.change", "call.arguments.change", "call.add" ]
185,478
185,479
u330842660
ruby
p02399
a, b = gets.split.map(&:to_i) d = (a / b) r = (a % b) f = sprintf("%10.10f", (a / b)) puts "#{d} #{r} #{f}"
a, b = gets.split.map(&:to_i) d = (a / b) r = (a % b) f = sprintf("%10.10f", (a.to_f / b)) puts "#{d} #{r} #{f}"
[ "call.add" ]
185,480
185,479
u330842660
ruby
p02399
a, b = gets.split.map(&:to_i) d = (a / b) r = (a % b) f = sprintf("%10.10f", (a / b).to_f) puts "#{d} #{r} #{f}"
a, b = gets.split.map(&:to_i) d = (a / b) r = (a % b) f = sprintf("%10.10f", (a.to_f / b)) puts "#{d} #{r} #{f}"
[ "call.add", "call.remove" ]
185,481
185,479
u330842660
ruby
p02400
r = gets.split.to_f s = r * r * Math::PI l = 2 * r * Math::PI printf("%f %f\n", s, l)
r = gets.to_f s = r * r * Math::PI l = 2 * r * Math::PI printf('%f %f', s, l)
[ "call.remove" ]
190,723
190,724
u281180011
ruby
p02400
r = gets.split.to_f s = r * r * Math::PI l = 2 * r * Math::PI puts format('%f %f', s, l)
r = gets.to_f s = r * r * Math::PI l = 2 * r * Math::PI printf('%f %f', s, l)
[ "call.remove", "identifier.change", "call.arguments.change" ]
190,727
190,724
u281180011
ruby
p02400
a=gets.to_f s = a*2*Math::PI l = a**2*Math::PI puts [s,l].join " "
a=gets.to_f s = a**2*Math::PI l = a*2*Math::PI puts [s,l].join(" ")
[ "assignment.value.change", "call.arguments.change" ]
190,731
190,732
u861698758
ruby
p02400
r = gets.to_f m = 2.0 * r * Math::PI s = r * r * Math::PI printf("%.6f %.6f\n", m, s)
r = gets.to_f m = 2.0 * r * Math::PI s = r * r * Math::PI printf("%.6f %.6f\n", s, m)
[ "call.arguments.change", "call.arguments.add" ]
190,881
190,882
u928503227
ruby
p02402
gets arr = gets.split.map(&:to_i) sum = 0 arr.each do |i| sum += i end puts "#{arr.max} #{arr.min} #{sum}"
gets arr = gets.split.map(&:to_i) sum = 0 arr.each do |i| sum += i end puts "#{arr.min} #{arr.max} #{sum}"
[ "literal.string.change", "call.arguments.change" ]
195,396
195,397
u209022771
ruby
p02407
gets i = gets.chomp.split puts i.join(" ")
gets i = gets.chomp.split puts i.reverse.join(" ")
[ "call.add" ]
207,356
207,357
u742797815
ruby
p02408
arr = Array.new(4){ Array.new(13, 0) } mark = ["S","C","H","D"] (gets.to_i).times do check = gets.split arr[mark.index(check[0])][(check[1].to_i)-1] = 1 end 4.times do |i| 13.times do |j| if arr[i][j] == 0 then puts "#{mark[i]} #{j+1}" end end end
arr = Array.new(4){ Array.new(13, 0) } mark = ["S","H","C","D"] (gets.to_i).times do check = gets.split arr[mark.index(check[0])][(check[1].to_i)-1] = 1 end 4.times do |i| 13.times do |j| if arr[i][j] == 0 then puts "#{mark[i]} #{j+1}" end end end
[ "literal.string.change", "assignment.value.change" ]
208,278
208,279
u180931985
ruby
p02411
result=[] while true m, f, r = gets.split.map(&:to_i) sum=m+f if m==-1 && f==-1 && r==-1 break elsif m==-1 || f==-1 result << "F" elsif sum>=80 result << "A" elsif sum>=65 && sum<80 result << "B" elsif sum>=50 && sum<65 result << "C" elsif sum>=30 && sum<50 if r>=50 result ...
result=[] while true m, f, r = gets.split.map(&:to_i) sum=m+f if m==-1 && f==-1 && r==-1 break elsif m==-1 || f==-1 result << "F" elsif sum>=80 result << "A" elsif sum>=65 && sum<80 result << "B" elsif sum>=50 && sum<65 result << "C" elsif sum>=30 && sum<50 if r>=50 result ...
[ "literal.string.change", "expression.operation.binary.change" ]
212,487
212,488
u412829970
ruby
p02409
buildings = [] 4.times do floors = [] 3.times do floors.push( Array.new(10, 0) ) end buildings.push(floors) end n = gets.chomp.to_i n.times do input = gets.split(" ") input.map!(&:to_i) buildings[input[0]-1][input[1]-1][input[2]-1] = input[3] end buildings.each_with_index do |floors,...
buildings = [] 4.times do floors = [] 3.times do floors.push( Array.new(10, 0) ) end buildings.push(floors) end n = gets.chomp.to_i n.times do input = gets.split(" ") input.map!(&:to_i) buildings[input[0]-1][input[1]-1][input[2]-1] += input[3] end buildings.each_with_index do |floors...
[ "assignment.value.change" ]
215,115
215,116
u219639974
ruby
p02415
line = gets line.chomp! print "line = #{line}\n"
line = gets line.chomp! print "#{line.swapcase}\n"
[ "literal.string.change", "call.arguments.change" ]
218,454
218,455
u397596432
ruby
p02412
loop { n, x = gets.split(" ").map(&:to_i) if n+x == 0 break end y = 0 for i in 1..n for j in i+1..n for k in j+1..n if i + j + k == x y += 1 end end end end }
loop { n, x = gets.split(" ").map(&:to_i) if n+x == 0 break end y = 0 for i in 1..n for j in i+1..n for k in j+1..n if i + j + k == x y += 1 end end end end puts y }
[ "call.add" ]
219,171
219,172
u216813029
ruby
p02421
n = gets.to_i taro, hana = 0, 0 n.times do w1, w2 = gets.split(/ /) if w1 > w2 taro += 3 elsif w1 < w2 hana += 3 else taro += 1 hana += 1 end end print taro, " ", hana, "\n" __END__ Sample Input 3 cat dog fish fish lion tiger Sample Output 1 7
n = gets.to_i taro, hana = 0, 0 n.times do w1, w2 = gets.chomp.split(/ /) if w1 > w2 taro += 3 elsif w1 < w2 hana += 3 else taro += 1 hana += 1 end end print taro, " ", hana, "\n" __END__ Sample Input 3 cat dog fish fish lion tiger Sample Output 1 7
[ "call.add" ]
223,397
223,398
u277379271
ruby
p02420
while line = gets.chomp do if (line == "-") then break end card = line n = gets.to_i n.times do h = gets.to_i parts = card.slice!(0, h - 1) card += parts end puts card end
while line = gets.chomp do if (line == "-") then break end card = line n = gets.to_i n.times do h = gets.to_i parts = card.slice!(0, h) card += parts end puts card end
[ "expression.operation.binary.remove" ]
223,527
223,528
u750346935
ruby
p02417
$stdin = DATA if $stdin.eof? appear_count = Hash.new(0) ARGF.each_line do |line| line.downcase.each_char.group_by{|c| c}.map{|k, arr| appear_count[k] += arr.size} end ('a'..'z').each do |c| p "#{c} : #{appear_count[c]}" end __END__ This is a pen. zzzz
$stdin = DATA if $stdin.eof? appear_count = Hash.new(0) ARGF.each_line do |line| line.downcase.each_char.group_by{|c| c}.map{|k, arr| appear_count[k] += arr.size} end ('a'..'z').each do |c| puts "#{c} : #{appear_count[c]}" end __END__ This is a pen. zzzz
[ "call.function.change", "io.output.change" ]
224,225
224,226
u024069892
ruby