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
p02382
n = gets.to_i x = gets.split.map(&:to_f) y = gets.split.map(&:to_f) p1, p2, p3 = 0, 0, 0; max_array = [] n.times do |i| q = x[i] - y[i] q = q * -1 if q < 0 max_array << q p1 += q p2 += q ** 2 p3 += q ** 3 end puts p1 puts Math.sqrt(p2) puts p3 ** (1 / 3) puts max(max_array)
n = gets.to_i x = gets.split.map(&:to_f) y = gets.split.map(&:to_f) p1, p2, p3 = 0, 0, 0; max_array = [] n.times do |i| q = x[i] - y[i] q = q * -1 if q < 0 max_array << q p1 += q p2 += q ** 2 p3 += q ** 3 end puts p1 puts Math.sqrt(p2) puts p3 ** Rational(1, 3) puts max_array.max
[ "call.add", "call.arguments.change", "expression.operation.binary.change", "call.remove", "io.output.change" ]
137,031
137,032
u330842660
ruby
p02382
n = gets.to_i x = gets.split.map(&:to_f) y = gets.split.map(&:to_f) (1..3).each do |p| d = 0.0 n.times do |i| d +=((x[i] - y[i]).abs)**p end puts d**(1.0/p) end chedyshev = [] n.times do |i| chedyshev.push (x[i] -- y[i]).abs end puts chedyshev.max
n = gets.to_i x = gets.split.map(&:to_f) y = gets.split.map(&:to_f) (1..3).each do |p| d = 0.0 n.times do |i| d += ((x[i] - y[i]).abs)**p end puts d**(1.0/p) end chebyshev = [] n.times do |i| chebyshev.push (x[i] - y[i]).abs end puts chebyshev.max
[ "assignment.variable.change", "identifier.change", "call.arguments.change", "io.output.change" ]
137,035
137,036
u407138207
ruby
p02382
n = gets.to_i x = gets.split.map(&:to_f) y = gets.split.map(&:to_f) (1..3).each do |p| d = 0.0 n.times do |i| d +=((x[i] - y[i]).abs)**p end puts d**(1.0/p) end chedyshev = [] n.times do |i| chedyshev.push (x[i] -- y[i]).abs end puts chedyshev.max
n = gets.to_i x = gets.split.map(&:to_f) y = gets.split.map(&:to_f) (1..3).each do |p| d = 0.0 n.times do |i| d += ((x[i] - y[i]).abs)**p end puts d**(1.0/p) end chebyshev = [] n.times do |i| chebyshev.push (x[i] - y[i]).abs end puts chebyshev.max
[ "assignment.variable.change", "identifier.change", "call.arguments.change", "io.output.change" ]
137,035
137,037
u407138207
ruby
p02382
#!/usr/bin/env ruby def manhattan(n, x_v, y_v) d = 0.0 for i in 0..n.to_i-1 do d += (x_v[i].to_f - y_v[i].to_f).abs end d end def euc_i(n, x_v, y_v, p) d = 0.0 for i in 0..n.to_i-1 do d += (x_v[i].to_f - y_v[i].to_f).abs ** p end d = d ** (1/p.to_f) end def chebshef(n, x_v, y_v) d = 0.0 for i in 0..n.to_i-1 do c = (x_v[i].to_f - y_v[i].to_f).abs d > c ? d : d = c end d end n = STDIN.gets x = STDIN.gets y = STDIN.gets if n.to_i < 1 and n.to_i > 100 exit end x_v = x.split y_v = y.split puts sprintf("%.6f", manhattan(n, x_v, y_v)) puts sprintf("%.6f", euc_i(n, x_v, y_v, 2)) puts sprintf("%.6f", euc_i(n, x_v, y_v, 3)) puts sprintf("%.6f", chebshef(n, x, y))
def manhattan(n, x_v, y_v) d = 0.0 for i in 0..n.to_i-1 do d += (x_v[i].to_f - y_v[i].to_f).abs end d end def euc_i(n, x_v, y_v, p) d = 0.0 for i in 0..n.to_i-1 do d += (x_v[i].to_f - y_v[i].to_f).abs ** p end d = d ** (1/p.to_f) end def chebshef(n, x_v, y_v) d = 0.0 for i in 0..n.to_i-1 do c = (x_v[i].to_f - y_v[i].to_f).abs d > c ? d = d : d = c end d end n = STDIN.gets x = STDIN.gets y = STDIN.gets if n.to_i < 1 and n.to_i > 100 exit end x_v = x.split y_v = y.split puts sprintf("%.6f", manhattan(n, x_v, y_v)) puts sprintf("%.6f", euc_i(n, x_v, y_v, 2)) puts sprintf("%.6f", euc_i(n, x_v, y_v, 3)) puts sprintf("%.6f", chebshef(n, x_v, y_v))
[ "identifier.change", "call.arguments.change", "io.output.change" ]
137,038
137,039
u706174455
ruby
p02382
include Math n = gets.to_i x = gets.split.map(&:to_i) y = gets.split.map(&:to_i) d1 = 0 d2 = 0 d3 = 0 dc = 0 for i in 0..n-1 d = (x[i] - y[i]).abs d1 += d d2 += d ** 2 d3 += d ** 3 dc = d if dc < d end d2 = sqrt(d2) d3 = d3 ** 1.0 / 3.0 printf "%f\n", d1 printf "%f\n", d2 printf "%f\n", d3 printf "%f\n", d4
include Math n = gets.to_i x = gets.split.map(&:to_i) y = gets.split.map(&:to_i) d1 = 0 d2 = 0 d3 = 0 dc = 0 for i in 0..(n-1) d = (x[i] - y[i]).abs d1 += d d2 += d ** 2 d3 += d ** 3 dc = d if dc < d end d2 = sqrt(d2) d3 = d3 ** (1.0/3.0) printf "%f\n", d1 printf "%f\n", d2 printf "%f\n", d3 printf "%f\n", dc
[ "identifier.change", "call.arguments.change" ]
137,047
137,048
u087014397
ruby
p02383
class Dice attr_accessor :faces #メンバ変数を外部から参照可能に dice.faces def initialize(arr) @faces = arr end def roll(direction) case direction when "N" tmp = @faces[0] @faces[0] = @faces[1] @faces[1] = @faces[5] @faces[4] = @faces[5] @faces[5] = tmp when "S" tmp = @faces[0] @faces[0] = @faces[4] @faces[4] = @faces[5] @faces[5] = @faces[1] @faces[1] = tmp when "E" tmp = @faces[0] @faces[0] = @faces[3] @faces[3] = @faces[5] @faces[5] = @faces[2] @faces[2] = tmp when "W" tmp = @faces[0] @faces[0] = @faces[2] @faces[2] = @faces[5] @faces[5] = @faces[3] @faces[3] = tmp end end end face = gets.split.map { |e| e.to_i } dice = Dice.new(face) s = gets.chomp.split(//).map { |e| dice.roll(e) } puts dice.faces[0]
class Dice attr_accessor :faces #メンバ変数を外部から参照可能に dice.faces def initialize(arr) @faces = arr end def roll(direction) case direction when "N" tmp = @faces[0] @faces[0] = @faces[1] @faces[1] = @faces[5] @faces[5] = @faces[4] @faces[4] = tmp when "S" tmp = @faces[0] @faces[0] = @faces[4] @faces[4] = @faces[5] @faces[5] = @faces[1] @faces[1] = tmp when "E" tmp = @faces[0] @faces[0] = @faces[3] @faces[3] = @faces[5] @faces[5] = @faces[2] @faces[2] = tmp when "W" tmp = @faces[0] @faces[0] = @faces[2] @faces[2] = @faces[5] @faces[5] = @faces[3] @faces[3] = tmp end end end face = gets.split.map { |e| e.to_i } dice = Dice.new(face) s = gets.chomp.split(//).map { |e| dice.roll(e) } puts dice.faces[0]
[ "assignment.remove", "assignment.add" ]
137,419
137,420
u728700495
ruby
p02383
<<NOTE.! サイコロ I 次の展開図から得られるサイコロを転がすシミュレーションを行うプログラムを作成してください。 サイコロの各面には図のとおりに 1 から 6 のラベルが割りあてられています。 + http://judge.u-aizu.ac.jp/onlinejudge/IMAGE2/ITP1_11_A_1.png + http://judge.u-aizu.ac.jp/onlinejudge/IMAGE2/ITP1_11_A_2.png 入力としてサイコロの各面のラベルに対応する数字と、転がす命令の列が与えられるので、サイコロの上面の数字を出力してください。シミュレーションの初期状態は、図のとおりのラベルの位置でサイコロが置かれているものとします。 Input 1行目に各面の数字が、図に示すラベルの順番に空白区切りで与えられます。 2行目に命令を表す1つの文字列が与えられます。命令はそれぞれ図に示す4方向を表す文字 E、N、S、W を含む文字列です。 Output すべての命令を実行した後のサイコロの上面の数を1行に出力してください。 Constraints 0? 入力されるサイコロの面の数字 ?100 0? 命令を表す文字列の長さ ?100 Note 続くシリーズ Dice III, Dice IV では、複数のサイコロを扱うので、サイコロをクラスや構造体で作成しておきましょう。 Sample Input 1 1 2 4 8 16 32 SE Sample Output 1 8 各面に 1, 2, 4, 8, 16, 32 と書かれたサイコロを S の方向に転がした後、E の方向に転がすと、上面の数字が 8 になります。 Sample Input 2 1 2 4 8 16 32 EESWN Sample Output 2 32 NOTE class Dice attr_accessor :faces def initialize(faces) <<-NOTE.! |T F L| |B U R| NOTE top, front, right, left, back, bottom = faces @faces = [[top, bottom], [front, back], [left, right]] end def move(commands) commands.split('').each do |com| case com.upcase.to_sym when :E faces[0], faces[2] = faces[2], faces[0].reverse # @top, @right, @bottom, @left = left, top, right, bottom when :W faces[0], faces[2] = faces[2], faces[0].reverse # @top, @right, @bottom, @left = right, bottom, left, top when :N faces[0], faces[1] = faces[1], faces[0].reverse # @top, @front, @bottom, @back = front, bottom, back, top when :S faces[0], faces[1] = faces[1].reverse, faces[0] # @top, @front, @bottom, @back = back, top, front, bottom end end end def top faces[0][0] end def bottom faces[0][1] end def front faces[1][0] end def back faces[1][1] end def left faces[2][0] end def right faces[2][1] end def info p({ T: top, F: front, R: right, L: left, U: back, B: bottom }) end end $stdin = DATA if $stdin.eof? dice = Dice.new(gets.split) dice.move(gets.strip) puts dice.top __END__ 1 2 4 8 16 32 EESWN
<<NOTE.! サイコロ I 次の展開図から得られるサイコロを転がすシミュレーションを行うプログラムを作成してください。 サイコロの各面には図のとおりに 1 から 6 のラベルが割りあてられています。 + http://judge.u-aizu.ac.jp/onlinejudge/IMAGE2/ITP1_11_A_1.png + http://judge.u-aizu.ac.jp/onlinejudge/IMAGE2/ITP1_11_A_2.png 入力としてサイコロの各面のラベルに対応する数字と、転がす命令の列が与えられるので、サイコロの上面の数字を出力してください。シミュレーションの初期状態は、図のとおりのラベルの位置でサイコロが置かれているものとします。 Input 1行目に各面の数字が、図に示すラベルの順番に空白区切りで与えられます。 2行目に命令を表す1つの文字列が与えられます。命令はそれぞれ図に示す4方向を表す文字 E、N、S、W を含む文字列です。 Output すべての命令を実行した後のサイコロの上面の数を1行に出力してください。 Constraints 0? 入力されるサイコロの面の数字 ?100 0? 命令を表す文字列の長さ ?100 Note 続くシリーズ Dice III, Dice IV では、複数のサイコロを扱うので、サイコロをクラスや構造体で作成しておきましょう。 Sample Input 1 1 2 4 8 16 32 SE Sample Output 1 8 各面に 1, 2, 4, 8, 16, 32 と書かれたサイコロを S の方向に転がした後、E の方向に転がすと、上面の数字が 8 になります。 Sample Input 2 1 2 4 8 16 32 EESWN Sample Output 2 32 NOTE class Dice attr_accessor :faces def initialize(faces) <<-NOTE.! |T F L| |B U R| NOTE top, front, right, left, back, bottom = faces @faces = [[top, bottom], [front, back], [left, right]] end def move(commands) commands.split('').each do |com| case com.upcase.to_sym when :E faces[0], faces[2] = faces[2], faces[0].reverse # @top, @right, @bottom, @left = left, top, right, bottom when :W faces[0], faces[2] = faces[2].reverse, faces[0] # @top, @right, @bottom, @left = right, bottom, left, top when :N faces[0], faces[1] = faces[1], faces[0].reverse # @top, @front, @bottom, @back = front, bottom, back, top when :S faces[0], faces[1] = faces[1].reverse, faces[0] # @top, @front, @bottom, @back = back, top, front, bottom end end end def top faces[0][0] end def bottom faces[0][1] end def front faces[1][0] end def back faces[1][1] end def left faces[2][0] end def right faces[2][1] end def info p({ T: top, F: front, R: right, L: left, U: back, B: bottom }) end end $stdin = DATA if $stdin.eof? dice = Dice.new(gets.split) dice.move(gets.strip) puts dice.top __END__ 1 2 4 8 16 32 SE
[ "call.add", "call.remove" ]
137,426
137,427
u024069892
ruby
p02383
$stdin = DATA class Dice def initialize dice = gets.split.map(&:to_i) @action = gets.chomp @upper = dice[0] @side = [ dice[4], dice[2], dice[1], dice[3] ] @bottom = dice[5] end def print_upper @action.chars do |str| b = @bottom u = @upper case str when "N" @upper = @side[2] @bottom = @side[0] @side[2] = b @side[0] = u when "E" @upper = @side[3] @bottom = @side[1] @side[3] = b @side[1] = u when "S" @upper = @side[0] @bottom = @side[2] @side[0] = b @side[2] = u when "W" @upper = @side[1] @bottom = @side[3] @side[1] = b @side[3] = u end end puts @upper end end d = Dice.new d.print_upper
class Dice def initialize dice = gets.split.map(&:to_i) @action = gets.chomp @upper = dice[0] @side = [ dice[4], dice[2], dice[1], dice[3] ] @bottom = dice[5] end def print_upper @action.chars do |str| b = @bottom u = @upper case str when "N" @upper = @side[2] @bottom = @side[0] @side[2] = b @side[0] = u when "E" @upper = @side[3] @bottom = @side[1] @side[3] = b @side[1] = u when "S" @upper = @side[0] @bottom = @side[2] @side[0] = b @side[2] = u when "W" @upper = @side[1] @bottom = @side[3] @side[1] = b @side[3] = u end end puts @upper end end d = Dice.new d.print_upper
[ "assignment.remove" ]
137,428
137,429
u330842660
ruby
p02383
class Dice attr_reader :upper_number def initialize(numbers) @numbers = numbers.unshift 0 @upper_number = numbers[0] end def rotate(instruction) instruction.split('').each{|op| case op when 'W' tmp = @numbers[1] @numbers[1]=@numbers[3]; @numbers[3]=@numbers[6]; @numbers[6]=@numbers[4]; @numbers[4]=tmp when 'E' tmp = @numbers[1] @numbers[1]=@numbers[4]; @numbers[4]=@numbers[6]; @numbers[6]=@numbers[3]; @numbers[3]=tmp when 'S' tmp = @numbers[2] @numbers[2]=@numbers[1]; @numbers[1]=@numbers[5]; @numbers[5]=@numbers[6]; @numbers[6]=tmp when 'N' tmp = @numbers[2] @numbers[2]=@numbers[6]; @numbers[6]=@numbers[5]; @numbers[5]=@numbers[1]; @numbers[1]=tmp end } @upper_number = numbers[0] end end numbers = gets.split.collect{|i|i.to_i} instruction = gets dice = Dice.new numbers dice.rotate instruction puts dice.upper_number
class Dice attr_reader :upper_number def initialize(numbers) @numbers = numbers.unshift 0 @upper_number = numbers[0] end def rotate(instruction) instruction.split('').each{|op| case op when 'W' tmp = @numbers[1] @numbers[1]=@numbers[3]; @numbers[3]=@numbers[6]; @numbers[6]=@numbers[4]; @numbers[4]=tmp when 'E' tmp = @numbers[1] @numbers[1]=@numbers[4]; @numbers[4]=@numbers[6]; @numbers[6]=@numbers[3]; @numbers[3]=tmp when 'S' tmp = @numbers[2] @numbers[2]=@numbers[1]; @numbers[1]=@numbers[5]; @numbers[5]=@numbers[6]; @numbers[6]=tmp when 'N' tmp = @numbers[2] @numbers[2]=@numbers[6]; @numbers[6]=@numbers[5]; @numbers[5]=@numbers[1]; @numbers[1]=tmp end } @upper_number = @numbers[1] end end numbers = gets.split.collect{|i|i.to_i} instruction = gets dice = Dice.new numbers dice.rotate instruction puts dice.upper_number
[ "literal.number.integer.change", "assignment.value.change", "variable_access.subscript.index.change" ]
137,430
137,431
u861698758
ruby
p02383
class Dice def initialize(lbl) @lbl = lbl end def W Dice.new(*[2,1,5,0,4,3].map{|x| @lbl[x]}) end def E Dice.new(*[3,1,0,5,4,2].map{|x| @lbl[x]}) end def N Dice.new(*[1,5,2,3,0,4].map{|x| @lbl[x]}) end def S Dice.new(*[4,0,2,3,5,1].map{|x| @lbl[x]}) end [:top, :front, :right, :left, :back, :bottom].each_with_index do |x,i| define_method(x){ @lbl[i] } end end dice = Dice.new(*gets.split) gets.chomp.chars do |c| eval "dice.#{c}" end puts dice.top
class Dice def initialize(*lbl) @lbl = lbl end def W Dice.new(*[2,1,5,0,4,3].map{|x| @lbl[x]}) end def E Dice.new(*[3,1,0,5,4,2].map{|x| @lbl[x]}) end def N Dice.new(*[1,5,2,3,0,4].map{|x| @lbl[x]}) end def S Dice.new(*[4,0,2,3,5,1].map{|x| @lbl[x]}) end [:top, :front, :right, :left, :back, :bottom].each_with_index do |x,i| define_method(x){ @lbl[i] } end end dice = Dice.new(*gets.split) gets.chomp.chars do |c| eval "dice = dice.#{c}" end puts dice.top
[ "literal.string.change", "call.arguments.change" ]
137,434
137,435
u714639016
ruby
p02383
class Dice def initialize(*lbl) @lbl = lbl end def W Dice.new(*[2,1,5,0,4,3].map{|x| @lbl[x]}) end def E Dice.new(*[3,1,0,5,4,2].map{|x| @lbl[x]}) end def N Dice.new(*[1,5,2,3,0,4].map{|x| @lbl[x]}) end def S Dice.new(*[4,0,2,3,5,1].map{|x| @lbl[x]}) end [:top, :front, :right, :left, :back, :bottom].each_with_index do |x,i| define_method(x){ @lbl[i] } end end dice = Dice.new(*gets.split) gets.chomp.chars do |c| eval "dice.#{c}" end puts dice.top
class Dice def initialize(*lbl) @lbl = lbl end def W Dice.new(*[2,1,5,0,4,3].map{|x| @lbl[x]}) end def E Dice.new(*[3,1,0,5,4,2].map{|x| @lbl[x]}) end def N Dice.new(*[1,5,2,3,0,4].map{|x| @lbl[x]}) end def S Dice.new(*[4,0,2,3,5,1].map{|x| @lbl[x]}) end [:top, :front, :right, :left, :back, :bottom].each_with_index do |x,i| define_method(x){ @lbl[i] } end end dice = Dice.new(*gets.split) gets.chomp.chars do |c| eval "dice = dice.#{c}" end puts dice.top
[ "literal.string.change", "call.arguments.change" ]
137,436
137,435
u714639016
ruby
p02383
class Dice def initialize (given_ary) @ary = given_ary end def roll (direction) case direction.downcase when "e" tmp = @ary[0] @ary[0] = @ary[3] @ary[3] = @ary[5] @ary[5] = @ary[2] @ary[2] =tmp when "w" tmp = @ary[0] @ary[0] = @ary[2] @ary[2] = @ary[5] @ary[5] = @ary[3] @ary[3] = tmp when "s" tmp = @ary[0] @ary[0] = @ary[4] @ary[4] = @ary[5] @ary[5] = @ary[1] @ary[1] = tmp when "n" tmp = @ary[0] @ary[0] = @ary[1] @ary[1] = @ary[5] @ary[5] = @ary[4] @ary[4] = tmp end end def top @ary[0] end end dice = Dice.new(gets.split.map(&:to_i)) gets.split(" ").each do |which| dice.roll(which) end puts dice.top
class Dice def initialize (given_ary) @ary = given_ary end def roll (direction) case direction.downcase when "e" tmp = @ary[0] @ary[0] = @ary[3] @ary[3] = @ary[5] @ary[5] = @ary[2] @ary[2] = tmp when "w" tmp = @ary[0] @ary[0] = @ary[2] @ary[2] = @ary[5] @ary[5] = @ary[3] @ary[3] = tmp when "s" tmp = @ary[0] @ary[0] = @ary[4] @ary[4] = @ary[5] @ary[5] = @ary[1] @ary[1] = tmp when "n" tmp = @ary[0] @ary[0] = @ary[1] @ary[1] = @ary[5] @ary[5] = @ary[4] @ary[4] = tmp end end def top @ary[0] end end dice = Dice.new(gets.split.map(&:to_i)) gets.split('').each do |which| dice.roll(which) end puts dice.top
[]
137,442
137,440
u407138207
ruby
p02383
class Dice def initialize (given_ary) @ary = given_ary end def roll (direction) case direction.downcase when "e" tmp = @ary[0] @ary[0] = @ary[3] @ary[3] = @ary[5] @ary[5] = @ary[2] @ary[2] =tmp when "w" tmp = @ary[0] @ary[0] = @ary[2] @ary[2] = @ary[5] @ary[5] = @ary[3] @ary[3] = tmp when "s" tmp = @ary[0] @ary[0] = @ary[4] @ary[4] = @ary[5] @ary[5] = @ary[1] @ary[1] = tmp when "n" tmp = @ary[0] @ary[0] = @ary[1] @ary[1] = @ary[5] @ary[5] = @ary[4] @ary[4] = tmp end end def top @ary[0] end end dice = Dice.new(gets.split.map(&:to_i)) gets.split(" ").each do |which| dice.roll(which) end puts dice.top
class Dice def initialize (given_ary) @ary = given_ary end def roll (direction) case direction.downcase when "e" tmp = @ary[0] @ary[0] = @ary[3] @ary[3] = @ary[5] @ary[5] = @ary[2] @ary[2] = tmp when "w" tmp = @ary[0] @ary[0] = @ary[2] @ary[2] = @ary[5] @ary[5] = @ary[3] @ary[3] = tmp when "s" tmp = @ary[0] @ary[0] = @ary[4] @ary[4] = @ary[5] @ary[5] = @ary[1] @ary[1] = tmp when "n" tmp = @ary[0] @ary[0] = @ary[1] @ary[1] = @ary[5] @ary[5] = @ary[4] @ary[4] = tmp end end def top @ary[0] end end dice = Dice.new(gets.split.map(&:to_i)) gets.split('').each do |which| dice.roll(which) end puts dice.top
[]
137,443
137,440
u407138207
ruby
p02383
class Dice def initialize (given_ary) @ary = given_ary end def roll (direction) case direction.downcase when "e" tmp = @ary[0] @ary[0] = @ary[3] @ary[3] = @ary[5] @ary[5] = @ary[2] @ary[2] = tmp when "w" tmp = @ary[0] @ary[0] = @ary[2] @ary[2] = @ary[5] @ary[5] = @ary[3] @ary[3] = tmp when "s" tmp = @ary[0] @ary[0] = @ary[4] @ary[4] = @ary[5] @ary[5] = @ary[1] @ary[1] = tmp when "n" tmp = @ary[0] @ary[0] = @ary[1] @ary[1] = @ary[5] @ary[5] = @ary[4] @ary[4] = tmp end end def top @ary[0] end end dice = Dice.new(gets.split.map(&:to_i)) gets.split(" ").each do |which| dice.roll(which) end puts dice.top
class Dice def initialize (given_ary) @ary = given_ary end def roll (direction) case direction.downcase when "e" tmp = @ary[0] @ary[0] = @ary[3] @ary[3] = @ary[5] @ary[5] = @ary[2] @ary[2] = tmp when "w" tmp = @ary[0] @ary[0] = @ary[2] @ary[2] = @ary[5] @ary[5] = @ary[3] @ary[3] = tmp when "s" tmp = @ary[0] @ary[0] = @ary[4] @ary[4] = @ary[5] @ary[5] = @ary[1] @ary[1] = tmp when "n" tmp = @ary[0] @ary[0] = @ary[1] @ary[1] = @ary[5] @ary[5] = @ary[4] @ary[4] = tmp end end def top @ary[0] end end dice = Dice.new(gets.split.map(&:to_i)) gets.split('').each do |which| dice.roll(which) end puts dice.top
[]
137,444
137,440
u407138207
ruby
p02383
class Dice attr_reader :surface def initialize arr @surface = arr end def rotate d tmp = @surface.clone case d when 'N' tmp[0]=@surface[1];tmp[1]=@surface[5];tmp[5]=@surface[4];tmp[4]=@surface[0] when 'S' tmp[0]=@surface[4];tmp[1]=@surface[0];tmp[5]=@surface[1];tmp[4]=@surface[5] when 'W' tmp[3]=@surface[0];tmp[0]=@surface[4];tmp[4]=@surface[5];tmp[5]=@surface[3] when 'E' tmp[3]=@surface[5];tmp[0]=@surface[3];tmp[4]=@surface[0];tmp[5]=@surface[4] end @surface = tmp end end r = Dice.new gets.split gets.each_char { |ch| r.rotate ch } puts r.surface[0]
class Dice attr_reader :surface def initialize arr @surface = arr end def rotate d tmp = @surface.clone case d when 'N' tmp[0]=@surface[1];tmp[1]=@surface[5];tmp[5]=@surface[4];tmp[4]=@surface[0] when 'S' tmp[0]=@surface[4];tmp[1]=@surface[0];tmp[5]=@surface[1];tmp[4]=@surface[5] when 'W' tmp[3]=@surface[0];tmp[0]=@surface[2];tmp[2]=@surface[5];tmp[5]=@surface[3] when 'E' tmp[3]=@surface[5];tmp[0]=@surface[3];tmp[2]=@surface[0];tmp[5]=@surface[2] end @surface = tmp end end r = Dice.new gets.split gets.each_char { |ch| r.rotate ch } puts r.surface[0]
[ "literal.number.integer.change", "assignment.value.change", "variable_access.subscript.index.change", "assignment.variable.change" ]
137,445
137,446
u712035986
ruby
p02383
surface = gets.split.map(&:to_i) commands = gets.chomp.char.map(&:to_sym) throw = {E: [3, 2, 6, 1, 5, 4], N: [5, 1, 3, 4, 6, 2], S: [2, 6, 3, 4, 1, 5], W: [4, 2, 1, 6, 5, 3]} th = {} throw.each_key {|k| th[k] = throw[k].map(&:pred)} dice = [*0..5] commands.each do |c| next_dice = Array.new(6, 0) dice.each_with_index do |d, i| next_dice[th[c][i]] = d end dice = next_dice end puts surface[dice[0]]
surface = gets.split.map(&:to_i) commands = gets.chomp.chars.map(&:to_sym) throw = {E: [3, 2, 6, 1, 5, 4], N: [5, 1, 3, 4, 6, 2], S: [2, 6, 3, 4, 1, 5], W: [4, 2, 1, 6, 5, 3]} th = {} throw.each_key do |k| th[k] = throw[k].map(&:pred) end dice = [*0..5] commands.each do |c| next_dice = Array.new(6, 0) dice.each_with_index do |d, i| next_dice[th[c][i]] = d end dice = next_dice end puts surface[dice[0]]
[ "assignment.value.change", "identifier.change" ]
137,451
137,452
u864617427
ruby
p02384
#!/usr/bin/env ruby result = [] dice = gets.split.map(&:to_i) loop_number = gets.to_i loop_number.times do |index| face = gets.split.map(&:to_i) case face[0] when dice[0] then case face[1] when dice[1] then result << dice[2] when dice[2] then result << dice[4] when dice[3] then result << dice[1] when dice[4] then result << dice[3] end end case face[0] when dice[1] then case face[1] when dice[2] then result << dice[0] when dice[0] then result << dice[3] when dice[3] then result << dice[5] when dice[5] then result << dice[2] end end case face[0] when dice[2] then case face[1] when dice[0] then result << dice[1] when dice[1] then result << dice[5] when dice[4] then result << dice[0] when dice[5] then result << dice[4] end end case face[0] when dice[3] then case face[1] when dice[0] then result << dice[4] when dice[1] then result << dice[0] when dice[4] then result << dice[5] when dice[5] then result << dice[1] end end case face[0] when dice[4] then case face[1] when dice[0] then result << dice[2] when dice[2] then result << dice[5] when dice[3] then result << dice[1] when dice[5] then result << dice[3] end end case face[0] when dice[5] then case face[1] when dice[1] then result << dice[3] when dice[2] then result << dice[1] when dice[3] then result << dice[4] when dice[4] then result << dice[2] end end end puts result
#!/usr/bin/env ruby result = [] dice = gets.split.map(&:to_i) loop_number = gets.to_i loop_number.times do |index| face = gets.split.map(&:to_i) case face[0] when dice[0] then case face[1] when dice[1] then result << dice[2] when dice[2] then result << dice[4] when dice[3] then result << dice[1] when dice[4] then result << dice[3] end end case face[0] when dice[1] then case face[1] when dice[2] then result << dice[0] when dice[0] then result << dice[3] when dice[3] then result << dice[5] when dice[5] then result << dice[2] end end case face[0] when dice[2] then case face[1] when dice[0] then result << dice[1] when dice[1] then result << dice[5] when dice[4] then result << dice[0] when dice[5] then result << dice[4] end end case face[0] when dice[3] then case face[1] when dice[0] then result << dice[4] when dice[1] then result << dice[0] when dice[4] then result << dice[5] when dice[5] then result << dice[1] end end case face[0] when dice[4] then case face[1] when dice[0] then result << dice[2] when dice[2] then result << dice[5] when dice[3] then result << dice[0] when dice[5] then result << dice[3] end end case face[0] when dice[5] then case face[1] when dice[1] then result << dice[3] when dice[2] then result << dice[1] when dice[3] then result << dice[4] when dice[4] then result << dice[2] end end end puts result
[ "literal.number.integer.change", "variable_access.subscript.index.change", "expression.operation.binary.change" ]
137,553
137,554
u948491783
ruby
p02384
#!/usr/bin/env ruby result = [] dice = gets.split.map(&:to_i) loop_number = gets.to_i loop_number.times do |index| face = gets.split.map(&:to_i) case face[0] when dice[0] then case face[1] when dice[1] then result << dice[2] when dice[2] then result << dice[4] when dice[3] then result << dice[1] when dice[4] then result << dice[3] end end case face[0] when dice[1] then case face[1] when dice[2] then result << dice[0] when dice[0] then result << dice[3] when dice[3] then result << dice[5] when dice[5] then result << dice[2] end end case face[0] when dice[2] then case face[1] when dice[0] then result << dice[1] when dice[1] then result << dice[5] when dice[4] then result << dice[0] when dice[5] then result << dice[4] end end case face[0] when dice[3] then case face[1] when dice[0] then result << dice[4] when dice[1] then result << dice[0] when dice[4] then result << dice[5] when dice[5] then result << dice[1] end end case face[0] when dice[4] then case face[1] when dice[0] then result << dice[2] when dice[2] then result << dice[5] when dice[3] then result << dice[0] when dice[5] then result << dice[3] end end case face[0] when dice[5] then case face[1] when dice[1] then result << dice[3] when dice[2] then result << dice[1] when dice[3] then result << dice[4] when dice[4] then result << dice[2] end end puts result[-1] end puts result
#!/usr/bin/env ruby result = [] dice = gets.split.map(&:to_i) loop_number = gets.to_i loop_number.times do |index| face = gets.split.map(&:to_i) case face[0] when dice[0] then case face[1] when dice[1] then result << dice[2] when dice[2] then result << dice[4] when dice[3] then result << dice[1] when dice[4] then result << dice[3] end end case face[0] when dice[1] then case face[1] when dice[2] then result << dice[0] when dice[0] then result << dice[3] when dice[3] then result << dice[5] when dice[5] then result << dice[2] end end case face[0] when dice[2] then case face[1] when dice[0] then result << dice[1] when dice[1] then result << dice[5] when dice[4] then result << dice[0] when dice[5] then result << dice[4] end end case face[0] when dice[3] then case face[1] when dice[0] then result << dice[4] when dice[1] then result << dice[0] when dice[4] then result << dice[5] when dice[5] then result << dice[1] end end case face[0] when dice[4] then case face[1] when dice[0] then result << dice[2] when dice[2] then result << dice[5] when dice[3] then result << dice[0] when dice[5] then result << dice[3] end end case face[0] when dice[5] then case face[1] when dice[1] then result << dice[3] when dice[2] then result << dice[1] when dice[3] then result << dice[4] when dice[4] then result << dice[2] end end end puts result
[ "call.remove" ]
137,555
137,554
u948491783
ruby
p02384
#!/usr/bin/env ruby # vim:set fileencoding=utf-8: class Dice def initialize( given_ary ) @ary = given_ary end def topface( val ) 4.times do self.roll( "E" ) if self.top == val return end end 2.times do self.roll( "N" ) if self.top == val return end end end def frontface( val ) 3.times do tmp = @ary[1] @ary[1] = @ary[2] @ary[2] = @ary[4] @ary[4] = @ary[3] @ary[3] = tmp if @ary[1] == val return end end end def roll( direction ) case direction.downcase when "e" tmp = @ary[0] @ary[0] = @ary[3] @ary[3] = @ary[5] @ary[5] = @ary[2] @ary[2] = tmp when "w" tmp = @ary[0] @ary[0] = @ary[2] @ary[2] = @ary[5] @ary[5] = @ary[3] @ary[3] = tmp when "s" tmp = @ary[0] @ary[0] = @ary[4] @ary[4] = @ary[5] @ary[5] = @ary[1] @ary[1] = tmp when "n" tmp = @ary[0] @ary[0] = @ary[1] @ary[1] = @ary[5] @ary[5] = @ary[4] @ary[4] = tmp end end def top @ary[ 0 ] end def front @ary[ 5 ] end def right @ary[ 2 ] end end dice = Dice.new( gets.split.map(&:to_i) ) gets.to_i.times do top, front = gets.split.map(&:to_i) dice.topface( top ) dice.frontface( front ) puts dice.right end
#!/usr/bin/env ruby # vim:set fileencoding=utf-8: class Dice def initialize( given_ary ) @ary = given_ary end def topface( val ) 4.times do self.roll( "E" ) if self.top == val return end end 3.times do self.roll( "N" ) if self.top == val return end end end def frontface( val ) 4.times do tmp = @ary[1] @ary[1] = @ary[2] @ary[2] = @ary[4] @ary[4] = @ary[3] @ary[3] = tmp if @ary[1] == val return end end end def roll( direction ) case direction.downcase when "e" tmp = @ary[0] @ary[0] = @ary[3] @ary[3] = @ary[5] @ary[5] = @ary[2] @ary[2] = tmp when "w" tmp = @ary[0] @ary[0] = @ary[2] @ary[2] = @ary[5] @ary[5] = @ary[3] @ary[3] = tmp when "s" tmp = @ary[0] @ary[0] = @ary[4] @ary[4] = @ary[5] @ary[5] = @ary[1] @ary[1] = tmp when "n" tmp = @ary[0] @ary[0] = @ary[1] @ary[1] = @ary[5] @ary[5] = @ary[4] @ary[4] = tmp end end def top @ary[ 0 ] end def front @ary[ 5 ] end def right @ary[ 2 ] end end dice = Dice.new( gets.split.map(&:to_i) ) gets.to_i.times do top, front = gets.split.map(&:to_i) dice.topface( top ) dice.frontface( front ) puts dice.right end
[ "literal.number.integer.change" ]
137,558
137,559
u216457386
ruby
p02384
class Dice @numbers = [] def initialize numbers @numbers = numbers end def roll direction old = @numbers.dup case direction when "N" @numbers[0] = old[1] @numbers[1] = old[5] @numbers[5] = old[4] @numbers[4] = old[0] @numbers[2] = old[2] @numbers[3] = old[3] when "E" @numbers[3] = old[5] @numbers[0] = old[3] @numbers[2] = old[0] @numbers[5] = old[2] @numbers[1] = old[1] @numbers[4] = old[4] when "S" @numbers[0] = old[4] @numbers[1] = old[0] @numbers[5] = old[1] @numbers[4] = old[5] @numbers[2] = old[2] @numbers[3] = old[3] when "W" @numbers[3] = old[0] @numbers[0] = old[2] @numbers[2] = old[5] @numbers[5] = old[3] @numbers[1] = old[1] @numbers[4] = old[4] end end def top @numbers[0] end def right t, f case @numbers.index(f) when 0 then roll "S" when 2 then roll "W"; roll "S" when 3 then roll "E"; roll "S" when 4 then roll "S"; roll "S" when 5 then role "N" end case @numbers.index(t) when 2 then roll "W" when 3 then roll "E" when 5 then roll "E"; roll "E" end @numbers[2] end end numbers = gets.chomp.split.map(&:to_i) dice = Dice.new(numbers) n_question = gets.chomp.to_i n_question.times{ top, front = gets.chomp.split.map(&:to_i) puts dice.right(top, front) }
class Dice @numbers = [] def initialize numbers @numbers = numbers end def roll direction old = @numbers.dup case direction when "N" @numbers[0] = old[1] @numbers[1] = old[5] @numbers[5] = old[4] @numbers[4] = old[0] @numbers[2] = old[2] @numbers[3] = old[3] when "E" @numbers[3] = old[5] @numbers[0] = old[3] @numbers[2] = old[0] @numbers[5] = old[2] @numbers[1] = old[1] @numbers[4] = old[4] when "S" @numbers[0] = old[4] @numbers[1] = old[0] @numbers[5] = old[1] @numbers[4] = old[5] @numbers[2] = old[2] @numbers[3] = old[3] when "W" @numbers[3] = old[0] @numbers[0] = old[2] @numbers[2] = old[5] @numbers[5] = old[3] @numbers[1] = old[1] @numbers[4] = old[4] end end def top @numbers[0] end def right t, f case @numbers.index(f) when 0 then roll "S" when 2 then roll "W"; roll "S" when 3 then roll "E"; roll "S" when 4 then roll "S"; roll "S" when 5 then roll "N" end case @numbers.index(t) when 2 then roll "W" when 3 then roll "E" when 5 then roll "E"; roll "E" end @numbers[2] end end numbers = gets.chomp.split.map(&:to_i) dice = Dice.new(numbers) n_question = gets.chomp.to_i n_question.times{ top, front = gets.chomp.split.map(&:to_i) puts dice.right(top, front) }
[ "identifier.change" ]
137,561
137,562
u247371045
ruby
p02385
class Dice TOP=0 FRONT=1 RIGHT=2 LEFT=3 BACK=4 BOTTOM=5 def initialize( nums ) @face = nums end def rolltoTopIndex( faceindex ) case faceindex when FRONT roll( "N" ) when RIGHT roll( "W" ) when LEFT roll( "E" ) when BACK roll( "S" ) when BOTTOM roll( "NN" ) when TOP end end def roll( actions ) for i in ( 0 ... actions.length ) t = 0 case actions[i] when "E" t = @face[ TOP ] @face[ TOP ] = @face[ LEFT ] @face[ LEFT ] = @face[ BOTTOM ] @face[ BOTTOM ] = @face[ RIGHT ] @face[ RIGHT ] = t when "N" t = @face[ TOP ] @face[ TOP ] = @face[ FRONT ] @face[ FRONT ] = @face[ BOTTOM ] @face[ BOTTOM ] = @face[ BACK ] @face[ BACK ] = t when "S" t = @face[ TOP ] @face[ TOP ] = @face[ BACK ] @face[ BACK ] = @face[ BOTTOM ] @face[ BOTTOM ] = @face[ FRONT ] @face[ FRONT ] = t when "W" t = @face[ TOP ] @face[ TOP ] = @face[ RIGHT ] @face[ RIGHT ] = @face[ BOTTOM ] @face[ BOTTOM ] = @face[ LEFT ] @face[ LEFT ] = t when "M" t = @face[ FRONT ] @face[ FRONT ] = @face[ RIGHT ] @face[ RIGHT ] = @face[ BACK ] @face[ BACK ] = @face[ LEFT ] @face[ LEFT ] = t end end end attr_accessor :face end diceface = gets.split( " " ).map { |val| val.to_i } dice1 = Dice.new( diceface ) diceface = gets.split( " " ).map { |val| val.to_i } dice2 = Dice.new( diceface ) cnt = 0 catch ( :samedice ) do for i in ( Dice::TOP ... Dice::BOTTOM ) if dice1.face[Dice::TOP] == dice2.face[i] dice2.rolltoTopIndex( i ) for j in ( Dice::FRONT .. Dice::BACK ) if dice1.face[Dice::FRONT] == dice2.face[Dice::FRONT] cnt = 0 for k in ( Dice::TOP ... Dice::BOTTOM ) if dice1.face[k] == dice2.face[k] cnt += 1 end end throw :samedice if cnt == 6 end dice2.roll( "M" ) end end dice2.face = diceface end end if cnt == 6 puts( "Yes" ) else puts( "No" ) end
class Dice TOP=0 FRONT=1 RIGHT=2 LEFT=3 BACK=4 BOTTOM=5 def initialize( nums ) @face = nums end def rolltoTopIndex( faceindex ) case faceindex when FRONT roll( "N" ) when RIGHT roll( "W" ) when LEFT roll( "E" ) when BACK roll( "S" ) when BOTTOM roll( "NN" ) when TOP end end def roll( actions ) for i in ( 0 ... actions.length ) t = 0 case actions[i] when "E" t = @face[ TOP ] @face[ TOP ] = @face[ LEFT ] @face[ LEFT ] = @face[ BOTTOM ] @face[ BOTTOM ] = @face[ RIGHT ] @face[ RIGHT ] = t when "N" t = @face[ TOP ] @face[ TOP ] = @face[ FRONT ] @face[ FRONT ] = @face[ BOTTOM ] @face[ BOTTOM ] = @face[ BACK ] @face[ BACK ] = t when "S" t = @face[ TOP ] @face[ TOP ] = @face[ BACK ] @face[ BACK ] = @face[ BOTTOM ] @face[ BOTTOM ] = @face[ FRONT ] @face[ FRONT ] = t when "W" t = @face[ TOP ] @face[ TOP ] = @face[ RIGHT ] @face[ RIGHT ] = @face[ BOTTOM ] @face[ BOTTOM ] = @face[ LEFT ] @face[ LEFT ] = t when "M" t = @face[ FRONT ] @face[ FRONT ] = @face[ RIGHT ] @face[ RIGHT ] = @face[ BACK ] @face[ BACK ] = @face[ LEFT ] @face[ LEFT ] = t end end end attr_accessor :face end diceface = gets.split( " " ).map { |val| val.to_i } dice1 = Dice.new( diceface ) diceface = gets.split( " " ).map { |val| val.to_i } dice2 = Dice.new( diceface ) cnt = 0 catch ( :samedice ) do for i in ( Dice::TOP .. Dice::BOTTOM ) if dice1.face[Dice::TOP] == dice2.face[i] dice2.rolltoTopIndex( i ) for j in ( Dice::FRONT .. Dice::BACK ) if dice1.face[Dice::FRONT] == dice2.face[Dice::FRONT] cnt = 0 for k in ( Dice::TOP .. Dice::BOTTOM ) if dice1.face[k] == dice2.face[k] cnt += 1 end end throw :samedice if cnt == 6 end dice2.roll( "M" ) end end dice2.face = diceface end end if cnt == 6 puts( "Yes" ) else puts( "No" ) end
[]
138,096
138,097
u604774382
ruby
p02385
class Dice def initialize(given_ary) @ary = given_ary end def topface(val) 4.times do self.roll ("E") if self.top == val return end end 3.times do self.roll("N") if self.top == val return end end end def frontface(val) 4.times do tmp = @ary[1] @ary[1] = @ary[2] @ary[2] = @ary[4] @ary[4] = @ary[3] @ary[3] = tmp if @ary[1] == val return end end end def checkall(givendice) 4.times do self.roll("E") 4.times do tmp = @ary[1] @ary[1] = @ary[2] @ary[2] = @ary[4] @ary[4] = @ary[3] @ary[3] = tmp if identical(givendice) return true end end end 3.times do self.roll("N") 4.times do tmp = @ary[1] @ary[1] = @ary[2] @ary[2] = @ary[4] @ary[4] = @ary[3] @ary[3] = tmp if identical(givendice) return true end end end return false end def roll(direction) case direction.downcase when "e" tmp = @ary[0] @ary[0] = @ary[3] @ary[3] = @ary[5] @ary[5] = @ary[2] @ary[2] = tmp when "w" tmp = @ary[0] @ary[0] = @ary[2] @ary[2] = @ary[5] @ary[5] = @ary[3] @ary[3] = tmp when "s" tmp = @ary[0] @ary[0] = @ary[4] @ary[4] = @ary[5] @ary[5] = @ary[1] @ary[1] = tmp when "n" tmp = @ary[0] @ary[0] = @ary[1] @ary[1] = @ary[5] @ary[5] = @ary[4] @ary[4] = tmp end end def top @ary[0] end def front @ary[5] end def right @ary[2] end def vals @ary end def compare(givendice) 4.times do self.roll("E") if identical(givendice) return true end end 3.times do self.roll("N") if identical(givendice) return true end 4.times do self.roll("E") if identical(givendice) return true end end end false end def identical(givendice) @ary.zip(givendice.vals).map{ |x,y| (x-y).abs}.inject{:+} == 0 end end dice1 = Dice.new(gets.split.map.(&:to_i)) dice2 = Dice.new(gets.split.map.(&:to_i)) puts (dice1.checkall(dice2))? "Yes" : "No"
class Dice def initialize( given_ary ) @ary = given_ary end def topface( val ) 4.times do self.roll( "E" ) if self.top == val return end end 3.times do self.roll( "N" ) if self.top == val return end end end def frontface( val ) 4.times do tmp = @ary[1] @ary[1] = @ary[2] @ary[2] = @ary[4] @ary[4] = @ary[3] @ary[3] = tmp if @ary[1] == val return end end end def checkall( givendice ) 4.times do self.roll( "E" ) 4.times do tmp = @ary[1] @ary[1] = @ary[2] @ary[2] = @ary[4] @ary[4] = @ary[3] @ary[3] = tmp if identical( givendice ) return true end end end 3.times do self.roll( "N" ) 4.times do tmp = @ary[1] @ary[1] = @ary[2] @ary[2] = @ary[4] @ary[4] = @ary[3] @ary[3] = tmp if identical( givendice ) return true end end end return false end def roll( direction ) case direction.downcase when "e" tmp = @ary[0] @ary[0] = @ary[3] @ary[3] = @ary[5] @ary[5] = @ary[2] @ary[2] = tmp when "w" tmp = @ary[0] @ary[0] = @ary[2] @ary[2] = @ary[5] @ary[5] = @ary[3] @ary[3] = tmp when "s" tmp = @ary[0] @ary[0] = @ary[4] @ary[4] = @ary[5] @ary[5] = @ary[1] @ary[1] = tmp when "n" tmp = @ary[0] @ary[0] = @ary[1] @ary[1] = @ary[5] @ary[5] = @ary[4] @ary[4] = tmp end end def top @ary[ 0 ] end def front @ary[ 5 ] end def right @ary[ 2 ] end def vals @ary end def compare( givendice ) 4.times do self.roll( "E" ) if identical( givendice ) return true end end 3.times do self.roll( "N" ) if identical( givendice ) return true end 4.times do self.roll( "E" ) if identical( givendice ) return true end end end false end def identical( givendice ) @ary.zip( givendice.vals ).map{ | x, y | ( x - y ).abs }.inject(:+) == 0 end end dice1 = Dice.new( gets.split.map(&:to_i) ) dice2 = Dice.new( gets.split.map(&:to_i) ) puts ( dice1.checkall( dice2 ) )? "Yes": "No"
[ "expression.operation.binary.change", "call.arguments.change" ]
138,106
138,107
u407138207
ruby
p02385
class Dice attr_accessor :status def initialize(status) @status = status end def compareSpec(dice) @d2 = dice.status d1 = matchDirect(@d2) return (d1 == @d2) ? true : false end def matchDirect(d2) dt = Array.new(6) 2.times do |i| idx = detectIndex(i) dt[i] = @status[idx] dt[5-i] = @status[5-idx] end top = @status.index(dt[0]) + 1 front = @status.index(dt[1]) + 1 idx = detectSideIndex(top,front) dt[2] = @status[idx] dt[3] = @status[5-idx] return dt end def detectIndex(i) idx = 0 @status.each_with_index do |dir,j| if ((dir == @d2[i]) && (@status[5-j] == @d2[5-i])) idx = j break end end return idx end def detectSideIndex(top,front) idx = 0 case top when 1,6 s = [2,3,5,4] while (s.include?(front))&&(s[0] != front) do s.unshift(s.pop) end idx = (top == 1) ? s[1] - 1 : s[-1] - 1 when 2,5 s = [1,4,6,3] while (s.include?(front))&&(s[0] != front) do s.unshift(s.pop) end idx = (top == 2) ? s[1] - 1 : s[-1] - 1 when 3,4 s = [1,2,6,5] while (s.include?(front))&&(s[0] != front) do s.unshift(s.pop) end idx = (top == 3) ? s[1] - 1 : s[-1] - 1 end return 0 end end d1 = Dice.new(gets.split.map(&:to_i)) d2 = Dice.new(gets.split.map(&:to_i)) result = d1.compareSpec(d2) puts (result == true) ? "Yes" : "No"
class Dice attr_accessor :status def initialize(status) @status = status end def compareSpec(dice) @d2 = dice.status d1 = matchDirect(@d2) return (d1 == @d2) ? true : false end def matchDirect(d2) dt = Array.new(6) 2.times do |i| idx = detectIndex(i) dt[i] = @status[idx] dt[5-i] = @status[5-idx] end top = @status.index(dt[0]) + 1 front = @status.index(dt[1]) + 1 idx = detectSideIndex(top,front) dt[2] = @status[idx] dt[3] = @status[5-idx] return dt end def detectIndex(i) idx = 0 @status.each_with_index do |dir,j| if ((dir == @d2[i]) && (@status[5-j] == @d2[5-i])) idx = j break end end return idx end def detectSideIndex(top,front) idx = 0 case top when 1,6 s = [2,3,5,4] while (s.include?(front))&&(s[0] != front) do s.unshift(s.pop) end idx = (top == 1) ? s[1] - 1 : s[-1] - 1 when 2,5 s = [1,4,6,3] while (s.include?(front))&&(s[0] != front) do s.unshift(s.pop) end idx = (top == 2) ? s[1] - 1 : s[-1] - 1 when 3,4 s = [1,2,6,5] while (s.include?(front))&&(s[0] != front) do s.unshift(s.pop) end idx = (top == 3) ? s[1] - 1 : s[-1] - 1 end return idx end end d1 = Dice.new(gets.split.map(&:to_i)) d2 = Dice.new(gets.split.map(&:to_i)) result = d1.compareSpec(d2) puts (result == true) ? "Yes" : "No"
[ "identifier.replace.add", "literal.replace.remove", "call.arguments.change", "function.return_value.change" ]
138,119
138,120
u213421924
ruby
p02386
class Dice def initialize() # top bottom N E S W @number = gets.split.map(&:to_i) @dice_number = [1, 6, 5, 3, 2, 4] end def rotate(command) swap_number = [] case command when 'N' swap_number = [2, 1, 4] swap(swap_number) when 'E' swap_number = [3, 1, 5] swap(swap_number) when 'S' swap_number = [4, 1, 2] swap(swap_number) when 'W' swap_number = [5, 1, 3] swap(swap_number) end end def rotate_horizontal tmp = @dice_number[2] (2..4).each {|i| @dice_number[i] = @dice_number[i+1]} @dice_number[5] = tmp end def swap(number) number.map do |n| @dice_number[0], @dice_number[n] = @dice_number[n], @dice_number[0] end end def number number_return = [] (0..5).each do |e| number_return << @number[@dice_number[e]-1] end number_return end end def rotateToTop(dice, position) case position when 0 then when 1 then dice.rotate('N') when 2 then dice.rotate('W') when 3 then dice.rotate('E') when 4 then dice.rotate('S') when 5 then 2.times { dice.rotate('S') } end end n = gets.to_i dice = [] n.times do |i| dice << Dice.new end difference_flag = 0 n.times do |i| dice1 = dice[i].clone (i..(n-1)).each do |j| next if i == j match_flag = false (0..5).each do |e| dice2 = Marshal.load(Marshal.dump(dice[j].clone)) rotateToTop(dice2, e) num_of_rotation = 0 while (num_of_rotation+=1) <= 4 do if dice1.number == dice2.number then match_flag = true break end dice2.rotate_horizontal end if match_flag then difference_flag += 1 break end end put "a" end end if difference_flag == 0 then puts "Yes" else puts "No" end
class Dice def initialize() # top bottom N E S W @number = gets.split.map(&:to_i) @dice_number = [1, 6, 5, 3, 2, 4] end def rotate(command) swap_number = [] case command when 'N' swap_number = [2, 1, 4] swap(swap_number) when 'E' swap_number = [3, 1, 5] swap(swap_number) when 'S' swap_number = [4, 1, 2] swap(swap_number) when 'W' swap_number = [5, 1, 3] swap(swap_number) end end def rotate_horizontal tmp = @dice_number[2] (2..4).each {|i| @dice_number[i] = @dice_number[i+1]} @dice_number[5] = tmp end def swap(number) number.map do |n| @dice_number[0], @dice_number[n] = @dice_number[n], @dice_number[0] end end def number number_return = [] (0..5).each do |e| number_return << @number[@dice_number[e]-1] end number_return end end def rotateToTop(dice, position) case position when 0 then when 1 then dice.rotate('N') when 2 then dice.rotate('W') when 3 then dice.rotate('E') when 4 then dice.rotate('S') when 5 then 2.times { dice.rotate('S') } end end n = gets.to_i dice = [] n.times do |i| dice << Dice.new end difference_flag = 0 n.times do |i| dice1 = dice[i].clone (i..(n-1)).each do |j| next if i == j match_flag = false (0..5).each do |e| dice2 = Marshal.load(Marshal.dump(dice[j].clone)) rotateToTop(dice2, e) num_of_rotation = 0 while (num_of_rotation+=1) <= 4 do if dice1.number == dice2.number then match_flag = true break end dice2.rotate_horizontal end if match_flag then difference_flag += 1 break end end end end if difference_flag == 0 then puts "Yes" else puts "No" end
[ "call.remove" ]
138,791
138,789
u873778695
ruby
p02386
class Dice @north = 5 @south = 2 @east = 3 @west = 4 @top = 1 @bottom = 6 def initialize(input_t, input_s, input_e, input_w, input_n, input_b) @north = input_n @south = input_s @east = input_e @west = input_w @top = input_t @bottom = input_b end def set(north, south, east, west, top, bottom) 100000.times do output = self.move(["N", "S", "E", "W"].sample) # p "output = #{output}, dice = [#{north}, #{south}, #{east}, #{west}, #{top}, #{bottom}]" if output[0] == north && output[1] == south && output[2] == east && output[3] == west && output[4] == top && output[5] == bottom return true break end end return false #@top = top, @south = front???????????????????????¶??????move?????? #???????????°?????????false?????§????????´??????true????????? end def move(order_array) length = order_array.length for i in 0..(length-1) if order_array[i] == "N" move_north elsif order_array[i] == "S" move_south elsif order_array[i] == "E" move_east else move_west end end output = [@north, @south, @east, @west, @top, @bottom] return output end def move_north tmp = [] tmp.push(@north) tmp.push(@south) tmp.push(@top) tmp.push(@bottom) @bottom = tmp[0] @top = tmp[1] @north = tmp[2] @south = tmp[3] end def move_south tmp = [] tmp.push(@north) tmp.push(@south) tmp.push(@top) tmp.push(@bottom) @top = tmp[0] @bottom = tmp[1] @south = tmp[2] @north = tmp[3] end def move_east tmp = [] tmp.push(@east) tmp.push(@west) tmp.push(@top) tmp.push(@bottom) @bottom = tmp[0] @top = tmp[1] @east = tmp[2] @west = tmp[3] end def move_west tmp = [] tmp.push(@east) tmp.push(@west) tmp.push(@top) tmp.push(@bottom) @top = tmp[0] @west = tmp[2] @bottom = tmp[1] @east = tmp[3] end end n = gets.chomp.to_i dice_numbers = gets.chomp.split.map(&:to_i) input_t = dice_numbers[0] input_s = dice_numbers[1] input_e = dice_numbers[2] input_w = dice_numbers[3] input_n = dice_numbers[4] input_b = dice_numbers[5] answers = [] (n-1).times do other_dice_numbers = gets.chomp.split.map(&:to_i) dice2 = Dice.new(other_dice_numbers[0], other_dice_numbers[1],other_dice_numbers[2],other_dice_numbers[3],other_dice_numbers[4],other_dice_numbers[5]) dice2_result = dice2.set(input_n, input_s, input_e, input_w, input_t, input_b) if dice2_result == true answers.push("Same") else answers.push("NotSame") end end if answers.include?("Same") == true puts "No" else puts "Yes" end
class Dice @north = 5 @south = 2 @east = 3 @west = 4 @top = 1 @bottom = 6 def initialize(input_t, input_s, input_e, input_w, input_n, input_b) @north = input_n @south = input_s @east = input_e @west = input_w @top = input_t @bottom = input_b end def set(north, south, east, west, top, bottom) 10000.times do output = self.move(["N", "S", "E", "W"].sample) # p "output = #{output}, dice = [#{north}, #{south}, #{east}, #{west}, #{top}, #{bottom}]" if output[0] == north && output[1] == south && output[2] == east && output[3] == west && output[4] == top && output[5] == bottom return true break end end return false #@top = top, @south = front???????????????????????¶??????move?????? #???????????°?????????false?????§????????´??????true????????? end def move(order_array) length = order_array.length for i in 0..(length-1) if order_array[i] == "N" move_north elsif order_array[i] == "S" move_south elsif order_array[i] == "E" move_east else move_west end end output = [@north, @south, @east, @west, @top, @bottom] return output end def move_north tmp = [] tmp.push(@north) tmp.push(@south) tmp.push(@top) tmp.push(@bottom) @bottom = tmp[0] @top = tmp[1] @north = tmp[2] @south = tmp[3] end def move_south tmp = [] tmp.push(@north) tmp.push(@south) tmp.push(@top) tmp.push(@bottom) @top = tmp[0] @bottom = tmp[1] @south = tmp[2] @north = tmp[3] end def move_east tmp = [] tmp.push(@east) tmp.push(@west) tmp.push(@top) tmp.push(@bottom) @bottom = tmp[0] @top = tmp[1] @east = tmp[2] @west = tmp[3] end def move_west tmp = [] tmp.push(@east) tmp.push(@west) tmp.push(@top) tmp.push(@bottom) @top = tmp[0] @west = tmp[2] @bottom = tmp[1] @east = tmp[3] end end n = gets.chomp.to_i dice_numbers = gets.chomp.split.map(&:to_i) input_t = dice_numbers[0] input_s = dice_numbers[1] input_e = dice_numbers[2] input_w = dice_numbers[3] input_n = dice_numbers[4] input_b = dice_numbers[5] answers = [] (n-1).times do other_dice_numbers = gets.chomp.split.map(&:to_i) dice2 = Dice.new(other_dice_numbers[0], other_dice_numbers[1],other_dice_numbers[2],other_dice_numbers[3],other_dice_numbers[4],other_dice_numbers[5]) dice2_result = dice2.set(input_n, input_s, input_e, input_w, input_t, input_b) if dice2_result == true answers.push("Same") else answers.push("NotSame") end end if answers.include?("Same") == true puts "No" else puts "Yes" end
[ "literal.number.integer.change" ]
138,792
138,793
u723368439
ruby
p02388
x = ARGV[0].to_i puts x ** 3
x = ARGF.gets().to_i puts x**3
[ "call.arguments.change" ]
142,629
142,630
u024069892
ruby
p02388
x = ARGV[0].to_i p x ** 3
x = ARGF.gets().to_i puts x**3
[ "call.arguments.change", "call.function.change", "io.output.change" ]
142,631
142,630
u024069892
ruby
p02388
p gets.to_i ^ 3
p gets.to_i ** 3
[ "call.arguments.change", "expression.operation.binary.change" ]
142,652
142,653
u334460795
ruby
p02388
p gets.to_i ^ 3
x = gets.to_i puts x ** 3
[ "assignment.variable.change", "call.arguments.change", "expression.operation.binary.change" ]
142,652
142,654
u334460795
ruby
p02388
# -*- coding: utf-8 -*- a = get.chomp.to_i b = a * a * a puts b
# -*- coding: utf-8 -*- a = gets.chomp.to_i b = a * a * a puts b
[ "assignment.value.change", "identifier.change" ]
142,655
142,656
u571404136
ruby
p02388
int = gets.to_ puts "#{int} ** 3"
int = gets.to_i puts "#{int ** 3}"
[ "assignment.value.change", "identifier.change", "literal.string.change", "call.arguments.change" ]
142,659
142,660
u046695668
ruby
p02388
#!/usr/local/bin/ruby x=gets.chomp.to_i y=x*x*x STDERR.print("%d\n",y)
#!/usr/local/bin/ruby x=gets.chomp.to_i y=x*x*x printf("%d\n",y)
[ "call.remove" ]
142,666
142,667
u248712727
ruby
p02388
x=gets.chomp puts x**3
x = gets.chomp.to_i puts x ** 3
[ "call.add" ]
142,673
142,674
u695662752
ruby
p02388
x=gets.chomp puts x.to_i **3
x = gets.chomp.to_i puts x ** 3
[ "call.remove", "call.add" ]
142,675
142,674
u695662752
ruby
p02388
puts ARGV[0].to_i ** 3
puts STDIN.gets.chomp.to_i ** 3
[ "call.add", "call.arguments.change" ]
142,678
142,679
u217758765
ruby
p02388
num = gets int x x = num.to_i print x ** 3
n = gets x = n.to_i puts x ** 3
[ "assignment.variable.change", "identifier.change", "call.remove", "assignment.value.change" ]
142,680
142,681
u529723140
ruby
p02388
a = gets puts a*a*a
a = gets.to_i puts a**3
[ "call.add", "expression.operation.binary.remove" ]
142,689
142,690
u944058699
ruby
p02388
puts(gets.chomp.to_i ** 2)
puts(gets.to_i ** 3)
[ "call.remove", "literal.number.integer.change", "call.arguments.change", "expression.operation.binary.change" ]
142,709
142,710
u750346935
ruby
p02388
num = ARGV[0].to_i puts(num ** 3)
num = gets.to_i puts(num ** 3)
[ "assignment.value.change" ]
142,731
142,732
u404374904
ruby
p02388
A = gets.freeze puts A * A * A
A = gets.to_i.freeze puts A * A * A
[ "call.add" ]
142,738
142,739
u556326323
ruby
p02388
gets.to_i**3
puts gets.to_i**3
[ "io.output.change", "call.add" ]
142,746
142,747
u014788538
ruby
p02388
n = gets puts n*n*n
n = gets.to_i puts n*n*n
[ "call.add" ]
142,764
142,765
u203261375
ruby
p02388
x= gets.chomp y=x*x*x puts y
x= gets.chomp.to_i y=x*x*x puts y
[ "call.add" ]
142,766
142,767
u971905595
ruby
p02388
x= gets y=x*x*x puts y
x= gets.chomp.to_i y=x*x*x puts y
[ "call.add" ]
142,768
142,767
u971905595
ruby
p02388
a = gets p a.chomp.to_i*3
a = gets p a.chomp.to_i**3
[ "call.arguments.change" ]
142,775
142,776
u656368260
ruby
p02388
a = gets puts a.chomp.to_i*3
a = gets p a.chomp.to_i**3
[ "identifier.change", "call.arguments.change", "io.output.change" ]
142,777
142,776
u656368260
ruby
p02388
a = gets puts a.to_i*3
a = gets p a.chomp.to_i**3
[ "identifier.change", "call.add", "call.arguments.change", "io.output.change" ]
142,778
142,776
u656368260
ruby
p02388
x =gets.to_i puts x ** 2
x = gets.to_i y = x ** 3 puts y
[ "assignment.variable.change", "literal.number.integer.change", "assignment.value.change", "call.arguments.change", "expression.operation.binary.change", "call.add" ]
142,781
142,787
u407138207
ruby
p02388
x =gets.to_i x = x ** 2 puts x
x = gets.to_i y = x ** 3 puts y
[ "assignment.variable.change", "identifier.change", "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.change", "call.arguments.change" ]
142,783
142,787
u407138207
ruby
p02388
x = gets.to_i y = x ** 2 puts y
x = gets.to_i y = x ** 3 puts y
[ "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.change" ]
142,784
142,787
u407138207
ruby
p02388
x =gets.to_i x = x ** 2 puts x
x = gets.to_i y = (x **3) puts y
[ "assignment.variable.change", "identifier.change", "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.change", "call.arguments.change" ]
142,783
142,790
u407138207
ruby
p02388
x = gets.to_i y = x ** 2 puts y
x = gets.to_i y = (x **3) puts y
[ "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.change" ]
142,784
142,790
u407138207
ruby
p02388
x =gets.to_i x = x ** 2 puts x
x = gets.to_i y = (x ** 3) puts y
[ "assignment.variable.change", "identifier.change", "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.change", "call.arguments.change" ]
142,783
142,791
u407138207
ruby
p02388
x = gets.to_i y = x ** 2 puts y
x = gets.to_i y = (x ** 3) puts y
[ "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.change" ]
142,784
142,791
u407138207
ruby
p02388
x =gets.to_i puts x ** 2
x = gets.to_i y = x **3 puts y
[ "assignment.variable.change", "literal.number.integer.change", "assignment.value.change", "call.arguments.change", "expression.operation.binary.change", "call.add" ]
142,781
142,792
u407138207
ruby
p02388
x =gets.to_i x = x ** 2 puts x
x = gets.to_i y = x **3 puts y
[ "assignment.variable.change", "identifier.change", "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.change", "call.arguments.change" ]
142,783
142,792
u407138207
ruby
p02388
x = gets.to_i y = x ** 2 puts y
x = gets.to_i y = x **3 puts y
[ "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.change" ]
142,784
142,792
u407138207
ruby
p02388
x = gets.to_i puts x ** 2
x = gets.to_i y = x **3 puts y
[ "assignment.variable.change", "literal.number.integer.change", "assignment.value.change", "call.arguments.change", "expression.operation.binary.change", "call.add" ]
142,785
142,792
u407138207
ruby
p02388
x =gets.to_i x = x ** 2 puts x
x = gets.to_i y = x**3 puts y
[ "assignment.variable.change", "identifier.change", "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.change", "call.arguments.change" ]
142,783
142,793
u407138207
ruby
p02388
x = gets.to_i y = x ** 2 puts y
x = gets.to_i y = x**3 puts y
[ "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.change" ]
142,784
142,793
u407138207
ruby
p02388
x = gets.to_i puts x ** 2
x = gets.to_i y = x**3 puts y
[ "assignment.variable.change", "literal.number.integer.change", "assignment.value.change", "call.arguments.change", "expression.operation.binary.change", "call.add" ]
142,785
142,793
u407138207
ruby
p02388
n=gets p n**3
n=gets.to_i p n**3
[ "call.add" ]
142,796
142,797
u072398496
ruby
p02388
a = gets.to_i def b = a*a*a print(b)
a = gets.to_i x = a*a*a puts x
[ "assignment.variable.change", "call.arguments.change" ]
142,968
142,969
u932376477
ruby
p02388
input = gets data = input * input * input puts data
input = gets.to_i data = input * input * input puts data
[ "call.add" ]
142,973
142,974
u280655990
ruby
p02388
num = STDIN.gets().to_i return num ** 3
num = $stdin.gets.to_i puts num ** 3
[ "assignment.value.change", "call.add", "call.arguments.change", "function.return_value.change" ]
142,979
142,980
u838759969
ruby
p02388
X=gets.to_i putss "#{x**3}"
x=gets.to_i puts "#{x**3}"
[ "assignment.variable.change", "identifier.change" ]
142,983
142,984
u572049600
ruby
p02388
nput = gets.to_i puts(input**3)
input = gets.to_i puts(input**3)
[ "assignment.variable.change", "identifier.change" ]
142,990
142,991
u737594828
ruby
p02388
a = gets.to_i b = a ** 3 print b print
a = gets.to_i b = a ** 3 puts b
[ "identifier.change", "io.output.change", "call.remove" ]
142,995
142,993
u503263570
ruby
p02388
input = gets.chomp puts input * input * input
input = gets.to_i puts input * input * input
[ "assignment.value.change", "identifier.change" ]
142,996
142,997
u401720175
ruby
p02388
STDIN.gets.to_i ** 3
puts (STDIN.gets.to_i ** 3)
[ "call.add", "call.arguments.change" ]
142,998
142,999
u345868749
ruby
p02388
puts ints.to_i**3
puts gets.to_i**3
[ "identifier.change", "call.arguments.change", "io.output.change" ]
143,004
143,005
u377255272
ruby
p02388
p = gets.to_i puts p
p = gets.to_i puts (p * p * p)
[ "call.arguments.change" ]
143,006
143,007
u288334335
ruby
p02388
p gets.to_x**3
puts (gets().to_i**3)
[ "call.function.change", "io.output.change", "call.arguments.change", "call.add", "identifier.change" ]
143,008
143,009
u087014397
ruby
p02388
x = get.to_i p x ** 3
x = gets.to_i p x ** 3
[ "assignment.value.change", "identifier.change" ]
143,014
143,015
u450608799
ruby
p02388
input = gets p input ** 3
input = gets p (input.to_i ** 3)
[ "call.arguments.change", "call.add" ]
143,024
143,025
u376781570
ruby
p02388
input = gets.to_i ** 3
input = gets.to_i puts input ** 3
[ "call.add" ]
143,028
143,029
u061908535
ruby
p02388
input = gets.to_i puts "input ** 3"
input = gets.to_i puts input ** 3
[]
143,031
143,029
u061908535
ruby
p02388
input = gets.to_i puts "input" ** 3
input = gets.to_i puts input ** 3
[ "call.arguments.change" ]
143,032
143,029
u061908535
ruby
p02388
input = gets.chomp puts input**3
input = gets.chomp puts input.to_i**3
[ "call.add" ]
143,035
143,036
u441419639
ruby
p02388
input = gets.chomp puts input**3
input = gets.chomp.to_i puts input**3
[ "call.add" ]
143,035
143,037
u441419639
ruby
p02388
x = STDIN.gets() puts x * x * x
x = STDIN.gets().to_i puts x * x * x
[ "call.add" ]
143,040
143,041
u523886269
ruby
p02388
x = gets.to_i x**3
x = gets.chomp.to_i puts x**3
[ "call.add", "io.output.change" ]
143,042
143,043
u518105713
ruby
p02389
class Main str = gets str = str.split(" ") a = str[0].to_i b = str[1],to_i puts "#{a*b} #{(a+b) * 2}" end
class Main str = gets.to_s str = str.split(" ") a = str[0].to_i b = str[1].to_i puts "#{a*b} #{(a+b) * 2}" end
[ "call.add", "assignment.value.change" ]
147,868
147,869
u973197167
ruby
p02389
input = gets.chomp.split(" ") length = input[0].to_i width = input[1].to_i answer1 = length * width answer2 = length * 2 + width * 2 puts "#{answer1},#{answer2}"
input = gets.chomp.split(" ") length = input[0].to_i width = input[1].to_i answer1 = length * width answer2 = length * 2 + width * 2 puts "#{answer1} #{answer2}"
[ "literal.string.change", "call.arguments.change" ]
147,871
147,872
u864395740
ruby
p02389
input = gets.chomp.split(" ") length = input[0].to_i width = input[1].to_i answer1 = length * width answer2 = length * 2 + width * 2 puts "#{answer1}#{answer2}"
input = gets.chomp.split(" ") length = input[0].to_i width = input[1].to_i answer1 = length * width answer2 = length * 2 + width * 2 puts "#{answer1} #{answer2}"
[ "literal.string.change", "call.arguments.change" ]
147,874
147,872
u864395740
ruby
p02389
input = gets.chomp.split(" ") length = input[0].to_i width = input[1].to_i answer1 = length * width answer2 = length * 2 + width * 2 puts "#{answer1}""#{answer2}"
input = gets.chomp.split(" ") length = input[0].to_i width = input[1].to_i answer1 = length * width answer2 = length * 2 + width * 2 puts "#{answer1} #{answer2}"
[ "literal.string.change", "call.arguments.change" ]
147,875
147,872
u864395740
ruby
p02389
AS,as = gets.split.map &:to_i puts "#{AS*as} #{(AS+as)*3}"
AS,as = gets.split.map &:to_i puts "#{AS*as} #{(AS+as)*2}"
[ "literal.string.change", "call.arguments.change" ]
147,876
147,877
u075360907
ruby
p02389
a, b = gets.split(" ").map(&:to_i) puts "#{a * b} #{a + b}"
a, b = gets.split(" ").map(&:to_i) puts "#{a * b} #{(a + b) * 2}"
[ "literal.string.change", "call.arguments.change" ]
147,878
147,879
u375793841
ruby
p02389
x = gets.split(" ") a = x[0].to_i * x[1].to_i b = (x[1].to_i*2) + (x[1].to_i*2) puts "#{a} #{b}"
x = gets.split(" ") a = (x[0].to_i) * (x[1].to_i) b = (x[0].to_i*2) + (x[1].to_i*2) puts "#{a} #{b}"
[ "literal.number.integer.change", "assignment.value.change", "variable_access.subscript.index.change", "expression.operation.binary.change" ]
147,888
147,889
u330842660
ruby
p02389
x = gets.split(" ") a = (x[0].to_i) * (x[1].to_i) b = (x[1].to_i*2) + (x[1].to_i*2) puts "#{a} #{b}"
x = gets.split(" ") a = (x[0].to_i) * (x[1].to_i) b = (x[0].to_i*2) + (x[1].to_i*2) puts "#{a} #{b}"
[ "literal.number.integer.change", "assignment.value.change", "variable_access.subscript.index.change", "expression.operation.binary.change" ]
147,890
147,889
u330842660
ruby
p02389
a=gets.to_s b=a.sprit x=b[0].to_i*b[1].to_i y=2*(b[0].to_i+b[1].to_i) print x," ",y,"\n"
a=gets.to_s b=a.split x=b[0].to_i*b[1].to_i y=2*b[0].to_i+2*b[1].to_i print x," ",y,"\n"
[ "assignment.value.change", "identifier.change" ]
147,900
147,901
u180931985
ruby
p02389
a=gets.to_s b=a.sprit x=b[0].to_i*b[1].to_i y=2*b[0].to_i+2*b[1].to_i print x," ",y,"\n"
a=gets.to_s b=a.split x=b[0].to_i*b[1].to_i y=2*b[0].to_i+2*b[1].to_i print x," ",y,"\n"
[ "assignment.value.change", "identifier.change" ]
147,902
147,901
u180931985
ruby
p02389
a=gets.to_s b=a.sprit x=b[0].to_i*b[1].to_i y=2*b[0].to_i+2*b[1].to_i print x," ",y
a=gets.to_s b=a.split x=b[0].to_i*b[1].to_i y=2*b[0].to_i+2*b[1].to_i print x," ",y,"\n"
[ "assignment.value.change", "identifier.change", "call.arguments.add" ]
147,904
147,901
u180931985
ruby
p02389
a = gets.chomp b = a.split(" ") c = b[0].to_i*b[1].to_i d = (b[0].to_i*b[1].to_i)*2 print c,(""),d,("\n")
a = gets.chomp.to_s b = a.split(" ") c = b[0].to_i*b[1].to_i d = (b[0].to_i+b[1].to_i)*2 print c,(" "),d,("\n")
[ "call.add", "expression.operator.arithmetic.change", "assignment.value.change", "call.arguments.change", "expression.operation.binary.change", "literal.string.change" ]
147,911
147,910
u741415050
ruby
p02389
a = gets.chomp b = a.split(" ") c = b[0].to_i*b[1].to_i d = (b[0].to_i*b[1].to_i)*2 print c,(" "),d,("\n")
a = gets.chomp.to_s b = a.split(" ") c = b[0].to_i*b[1].to_i d = (b[0].to_i+b[1].to_i)*2 print c,(" "),d,("\n")
[ "call.add", "expression.operator.arithmetic.change", "assignment.value.change", "call.arguments.change", "expression.operation.binary.change" ]
147,912
147,910
u741415050
ruby
p02389
a = gets.chomp.to_s b = a.split(" ") c = b[0].to_i*b[1].to_i d = (b[0].to_i*b[1].to_i)*2 print c,(" "),d,("\n")
a = gets.chomp.to_s b = a.split(" ") c = b[0].to_i*b[1].to_i d = (b[0].to_i+b[1].to_i)*2 print c,(" "),d,("\n")
[ "expression.operator.arithmetic.change", "assignment.value.change", "call.arguments.change", "expression.operation.binary.change" ]
147,913
147,910
u741415050
ruby
p02389
a = gets.chomp b = a.split(" ") c = b[0].to_i*b[1].to_i d = (b[0].to_i*b[1].to_i)*2 print c,(""),d,("\n")
a = gets.to_s b = a.split(" ") c = b[0].to_i*b[1].to_i d = (b[0].to_i+b[1].to_i)*2 print c,(" "),d,("\n")
[ "assignment.value.change", "identifier.change", "expression.operator.arithmetic.change", "call.arguments.change", "expression.operation.binary.change", "literal.string.change" ]
147,911
147,915
u741415050
ruby
p02389
a = gets.chomp b = a.split(" ") c = b[0].to_i*b[1].to_i d = (b[0].to_i*b[1].to_i)*2 print c,(" "),d,("\n")
a = gets.to_s b = a.split(" ") c = b[0].to_i*b[1].to_i d = (b[0].to_i+b[1].to_i)*2 print c,(" "),d,("\n")
[ "assignment.value.change", "identifier.change", "expression.operator.arithmetic.change", "call.arguments.change", "expression.operation.binary.change" ]
147,912
147,915
u741415050
ruby
p02389
a = gets.chomp.to_s b = a.split(" ") c = b[0].to_i*b[1].to_i d = (b[0].to_i*b[1].to_i)*2 print c,(" "),d,("\n")
a = gets.to_s b = a.split(" ") c = b[0].to_i*b[1].to_i d = (b[0].to_i+b[1].to_i)*2 print c,(" "),d,("\n")
[ "call.remove", "expression.operator.arithmetic.change", "assignment.value.change", "call.arguments.change", "expression.operation.binary.change" ]
147,913
147,915
u741415050
ruby
p02389
a = gets.chomp b = a.split(" ") c = b[0].to_i*b[1].to_i d = (b[0].to_i*b[1].to_i)*2 print c,(""),d,("\n")
a = gets.chomp b = a.split(" ") c = b[0].to_i*b[1].to_i d = (b[0].to_i+b[1].to_i)*2 print c,(" "),d,("\n")
[ "expression.operator.arithmetic.change", "assignment.value.change", "call.arguments.change", "expression.operation.binary.change", "literal.string.change" ]
147,911
147,916
u741415050
ruby