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
p02909
a = gets.to_s if a == "Sunny" then print("Cloudy") elsif a == "Cloudy" then print("Rainy") else print("Sunny") end
a = gets.strip if a === "Sunny" then print("Cloudy") elsif a === "Cloudy" then print("Rainy") else print("Sunny") end
[ "assignment.value.change", "identifier.change", "control_flow.branch.if.condition.change" ]
703,666
703,665
u291303244
ruby
p02909
s = gets if s == "Sunny" puts "Cloudy" elsif s == "Cloudy" puts "Rainy" else s == "Rainy" puts "Sunny" end
s = gets.chomp if s == "Sunny" puts "Cloudy" elsif s == "Cloudy" puts "Rainy" elsif s == "Rainy" puts "Sunny" else end
[ "call.add" ]
703,696
703,697
u928941036
ruby
p02909
a=["Sunny","Cloudy","Rainy"] b=gets c= a.index(b)==2 ? 0 : a.index(b)+1 puts a[c]
a=["Sunny","Cloudy","Rainy"] b=gets.chomp c= a.index(b)==2 ? 0 : a.index(b)+1 puts a[c]
[ "call.add" ]
703,750
703,751
u585819925
ruby
p02909
s = gets.chomp if s =='Sunny' puts 'Cloudy' elsif s =='Coludy' puts 'Rainy' else puts 'Sunny' end
s = gets.chomp if s =='Sunny' puts 'Cloudy' elsif s =='Cloudy' puts 'Rainy' else puts 'Sunny' end
[ "literal.string.change", "control_flow.branch.if.condition.change" ]
703,771
703,772
u932417742
ruby
p02909
s = gets.to_s if s === "Sunny" puts "Cloudy" elsif s === "Cloudy" puts "Rainy" elsif s === "Rainy" puts "Sunny" end
s = gets.chomp.to_s if s === "Sunny" puts "Cloudy" elsif s === "Cloudy" puts "Rainy" elsif s === "Rainy" puts "Sunny" end
[ "call.add" ]
703,806
703,807
u472143411
ruby
p02909
s = gets.to_s if s == "Sunny" puts "Cloudy" elsif s == "Cloudy" puts "Rainy" elsif s =="Rainy" puts "Sunny" else puts "error" end
s = gets.chomp! if s == "Sunny" puts "Cloudy" elsif s == "Cloudy" puts "Rainy" elsif s =="Rainy" puts "Sunny" else puts "error" end
[ "assignment.value.change", "identifier.change" ]
703,810
703,811
u411203878
ruby
p02909
status = gets.to_str out = ["Sunny", "Cloudy", "Rainy"] case status when out[0] puts out[1] when out[1] puts out[2] when out[2] puts out[0] end
status = gets.chomp out = ["Sunny", "Cloudy", "Rainy"] case status when out[0] puts out[1] when out[1] puts out[2] when out[2] puts out[0] end
[ "assignment.value.change", "identifier.change" ]
703,887
703,888
u358003829
ruby
p02909
status = gets.to_str out = ["Sunny", "Cloudy", "Rainy"] case status when out[0] p out[1] when out[1] p out[2] when out[2] p out[0] end
status = gets.chomp out = ["Sunny", "Cloudy", "Rainy"] case status when out[0] puts out[1] when out[1] puts out[2] when out[2] puts out[0] end
[ "assignment.value.change", "identifier.change", "call.function.change", "io.output.change" ]
703,890
703,888
u358003829
ruby
p02909
status = gets out = ["Sunny", "Cloudy", "Rainy"] case status when out[0] puts out[1] when out[1] puts out[2] when out[2] puts out[0] end
status = gets.chomp out = ["Sunny", "Cloudy", "Rainy"] case status when out[0] puts out[1] when out[1] puts out[2] when out[2] puts out[0] end
[ "call.add" ]
703,892
703,888
u358003829
ruby
p02909
status = input() out = ["Sunny", "Cloudy", "Rainy"] case status when out[0] puts out[1] when out[1] puts out[2] when out[2] puts out[0] end
status = gets.chomp out = ["Sunny", "Cloudy", "Rainy"] case status when out[0] puts out[1] when out[1] puts out[2] when out[2] puts out[0] end
[]
703,894
703,888
u358003829
ruby
p02909
status = input() out = ["Sunny", "Cloudy", "Rainy"] case out when out[0] puts out[1] when out[1] puts out[2] when out[2] puts out[0] end
status = gets.chomp out = ["Sunny", "Cloudy", "Rainy"] case status when out[0] puts out[1] when out[1] puts out[2] when out[2] puts out[0] end
[ "identifier.change" ]
703,895
703,888
u358003829
ruby
p02909
weather = {'Sunny' => 'Cloudy', 'Cloudy' => 'Rainy', 'Rainy' => 'Sunny'} S = gets puts weather[S]
weather = {'Sunny' => 'Cloudy', 'Cloudy' => 'Rainy', 'Rainy' => 'Sunny'} puts weather[gets.chomp]
[ "variable_access.subscript.index.change", "call.arguments.change", "call.add" ]
704,061
704,062
u358822669
ruby
p02909
weather = {'Sunny' => 'Cloudy', 'Cloudy' => 'Rainy', 'Rainy' => 'Sunny'} print weather[gets]
weather = {'Sunny' => 'Cloudy', 'Cloudy' => 'Rainy', 'Rainy' => 'Sunny'} puts weather[gets.chomp]
[ "identifier.change", "call.add" ]
704,063
704,062
u358822669
ruby
p02909
weather = {'Sunny' => 'Cloudy', 'Cloudy' => 'Rainy', 'Rainy' => 'Sunny'} puts weather[gets]
weather = {'Sunny' => 'Cloudy', 'Cloudy' => 'Rainy', 'Rainy' => 'Sunny'} puts weather[gets.chomp]
[ "call.add" ]
704,064
704,062
u358822669
ruby
p02909
weather = {'Sunny' => 'Cloudy', 'Cloudy' => 'Rainy', 'Rainy' => 'Sunny'} p weather[gets]
weather = {'Sunny' => 'Cloudy', 'Cloudy' => 'Rainy', 'Rainy' => 'Sunny'} puts weather[gets.chomp]
[ "call.function.change", "io.output.change", "call.add" ]
704,065
704,062
u358822669
ruby
p02909
S=gets.chomp case s when "Sunny" puts "Cloudy" when "Cloudy" puts "Rainy" when "Rainy" puts "Sunny" end
S=gets.chomp case S when "Sunny" puts "Cloudy" when "Cloudy" puts "Rainy" when "Rainy" puts "Sunny" end
[]
704,136
704,137
u792512290
ruby
p02909
s = gets weathers = ['Sunny','Cloudy','Rainy'] if s==weathers[0] puts weathers[1] elsif s==weathers[1] puts weathers[2] elsif s==weathers[2] puts weathers[0] end
s = gets.chomp weathers = ['Sunny','Cloudy','Rainy'] if s==weathers[0] puts weathers[1] elsif s==weathers[1] puts weathers[2] elsif s==weathers[2] puts weathers[0] end
[ "call.add" ]
704,156
704,157
u264007769
ruby
p02909
WEATHER = ['Sunny', 'Cloudy', 'Rainy'] s = gets current_pos = WEATHER.index(s) next_pos = (current_pos + 1) % WEATHER.size puts WEATHER[next_pos]
WEATHER = ['Sunny', 'Cloudy', 'Rainy'] s = gets current_pos = WEATHER.index(s.chop) || 0 next_pos = (current_pos + 1) % WEATHER.size puts WEATHER[next_pos]
[ "call.add" ]
704,213
704,214
u511826322
ruby
p02909
WEATHER = ['Sunny', 'Cloudy', 'Rainy'] s = gets current_pos = WEATHER.index(s) next_pos = (current_pos + 1) % WEATHER.size puts WEATHER[next_pos]
WEATHER = ['Sunny', 'Cloudy', 'Rainy'] s = gets current_pos = WEATHER.index(s.chop) || 0 next_pos = (current_pos + 1) % WEATHER.size puts WEATHER[next_pos]
[ "call.add" ]
704,215
704,214
u511826322
ruby
p02909
s = gets if (s =='Sunny') puts 'Cloudy' elsif (s == 'Cloudy') puts 'Rainy' else puts 'Sunny' end
s = gets.chomp if (s =='Sunny') puts 'Cloudy' elsif (s == 'Cloudy') puts 'Rainy' else puts 'Sunny' end
[ "call.add" ]
704,278
704,279
u546441021
ruby
p02909
S = gets if S == "Sunny" then puts "Cloudy" elsif S == "Cloudy" then puts "Rainy" else puts "Sunny" end
S = gets.chomp if S == "Sunny" then puts "Cloudy" elsif S == "Cloudy" then puts "Rainy" else puts "Sunny" end
[ "call.add" ]
704,280
704,281
u999835680
ruby
p02909
S = get.chomp if S == "Sunny" then puts "Cloudy" elsif S == "Cloudy" then puts "Rainy" else puts "Sunny" end
S = gets.chomp if S == "Sunny" then puts "Cloudy" elsif S == "Cloudy" then puts "Rainy" else puts "Sunny" end
[ "assignment.value.change", "identifier.change" ]
704,283
704,281
u999835680
ruby
p02909
s = gets if s == "Sunny" puts "Cloudy" elsif s == "Cloudy" puts "Rainy" else puts "Sunny" end
s = gets.chomp if s == "Sunny" puts "Cloudy" elsif s == "Cloudy" puts "Rainy" else puts "Sunny" end
[ "call.add" ]
704,333
704,334
u964709568
ruby
p02909
s = gets puts s if s == "Sunny" puts "Cloudy" elsif s == "Cloudy" puts "Rainy" else puts "Sunny" end
s = gets.chomp if s == "Sunny" puts "Cloudy" elsif s == "Cloudy" puts "Rainy" else puts "Sunny" end
[]
704,335
704,334
u964709568
ruby
p02909
s = gets case s when "Sunny" puts "Cloudy" when "Cloudy" puts "Rainy" when "Rainy" puts "Sunny" end
s = $stdin.gets.chomp case s when "Sunny" puts "Cloudy" when "Cloudy" puts "Rainy" when "Rainy" puts "Sunny" end
[ "call.add" ]
704,376
704,377
u268940498
ruby
p02909
s = gets case s when "Sunny" puts "Cloudy" when "Cloudy" puts "Rainy" when "Rainy" puts "Sunny" end
s = $stdin.gets.chomp case s when "Sunny" puts "Cloudy" when "Cloudy" puts "Rainy" when "Rainy" puts "Sunny" end
[ "call.add" ]
704,379
704,377
u268940498
ruby
p02909
w=%w(Sunny Cloudy Rainy) $><<w[w.index(gets.chop)-1]
w=%w(Sunny Cloudy Rainy) $><<w[w.index(gets.chop)-2]
[ "literal.number.integer.change", "variable_access.subscript.index.change", "call.arguments.change", "expression.operation.binary.change" ]
704,453
704,454
u019489252
ruby
p02909
n = gets.to_s case n when 'Sunny' puts 'Cloudy' when 'Cloudy' puts 'Rainy' when 'Rainy' puts 'Sunny' end
n = gets.chomp case n when 'Sunny' puts 'Cloudy' when 'Cloudy' puts 'Rainy' when 'Rainy' puts 'Sunny' end
[ "assignment.value.change", "identifier.change" ]
704,457
704,458
u821757826
ruby
p02909
n = gets case n when 'Sunny' puts 'Cloudy' when 'Cloudy' puts 'Rainy' when 'Rainy' puts 'Sunny' end
n = gets.chomp case n when 'Sunny' puts 'Cloudy' when 'Cloudy' puts 'Rainy' when 'Rainy' puts 'Sunny' end
[ "call.add" ]
704,459
704,458
u821757826
ruby
p02909
n = gets case n when 'Sunny' then puts 'Cloudy' when 'Cloudy' then puts 'Rainy' when 'Rainy' then puts'Sunny' end
n = gets.chomp case n when 'Sunny' puts 'Cloudy' when 'Cloudy' puts 'Rainy' when 'Rainy' puts 'Sunny' end
[ "call.add" ]
704,460
704,458
u821757826
ruby
p02909
string = gets case string when 'Sunny' puts 'Cloudy' when 'Cloudy' puts 'Rainy' when 'Rainy' puts 'Sunny' end
string = gets.chomp case string when 'Sunny' puts 'Cloudy' when 'Cloudy' puts 'Rainy' when 'Rainy' puts 'Sunny' end
[ "call.add" ]
704,509
704,510
u482583772
ruby
p02909
string = gets case string when 'Sunny' puts 'Cloudy' when 'Cloudy' puts ' Rainy' when 'Rainy' puts 'Sunny' end
string = gets.chomp case string when 'Sunny' puts 'Cloudy' when 'Cloudy' puts 'Rainy' when 'Rainy' puts 'Sunny' end
[ "call.add", "literal.string.change", "call.arguments.change" ]
704,511
704,510
u482583772
ruby
p02909
S = gets.chomp if S == "Sunny" puts "Cloudy" elsif S == "Cloudy" puts "" elsif S == "Rainy" puts "Sunny" end
S = gets.chomp if S == "Sunny" puts "Cloudy" elsif S == "Cloudy" puts "Rainy" elsif S == "Rainy" puts "Sunny" end
[ "literal.string.change", "call.arguments.change" ]
704,560
704,561
u349832549
ruby
p02909
s = gets ws = ["Sunny", "Cloudy", "Rainy"] result = -1 ws.each_with_index{|x, i| result = i if x == s } if (ws.length - 1) == result puts ws.first else puts ws[result+1] end
s = gets.chomp ws = ["Sunny", "Cloudy", "Rainy"] result = -1 ws.each_with_index{|x, i| result = i if x == s } if (ws.length - 1) == result puts ws.first else puts ws[result+1] end
[ "call.add" ]
704,616
704,617
u702652578
ruby
p02909
s = gets ws = ["Sunny", "Cloudy", "Rainy"] result = -1 ws.each_with_index{|x, i| result = i if x == s } if ws.length == result puts ws.first else puts ws[result+1] end
s = gets.chomp ws = ["Sunny", "Cloudy", "Rainy"] result = -1 ws.each_with_index{|x, i| result = i if x == s } if (ws.length - 1) == result puts ws.first else puts ws[result+1] end
[ "call.add", "control_flow.branch.if.condition.change" ]
704,619
704,617
u702652578
ruby
p02909
a = gets.chomp puts "Sunny" if a == "Rainy" puts "Croudy" if a == "Sunny" puts "Rainy" if a == "Cloudy"
a = gets.chomp puts "Sunny" if a == "Rainy" puts "Cloudy" if a == "Sunny" puts "Rainy" if a == "Cloudy"
[ "literal.string.change", "call.arguments.change" ]
704,652
704,653
u960706641
ruby
p02909
a = gets.chomp puts "Sunny" if a == "Rainy" puts "Croudy" if a == "Sunny" puts "Rayny" if a == "Cloudy"
a = gets.chomp puts "Sunny" if a == "Rainy" puts "Cloudy" if a == "Sunny" puts "Rainy" if a == "Cloudy"
[ "literal.string.change", "call.arguments.change" ]
704,654
704,653
u960706641
ruby
p02909
next_weather = { 'Sunny' => 'Cloudy', 'Cloudy' => 'Rainy', 'Rainy' => 'Sunny', } current_weather = STDIN.gets puts next_weather[current_weather]
next_weather = { 'Sunny' => 'Cloudy', 'Cloudy' => 'Rainy', 'Rainy' => 'Sunny', } current_weather = STDIN.gets.chomp puts next_weather[current_weather]
[ "call.add" ]
704,659
704,660
u517615862
ruby
p02909
s=gets.chomp.to_s if s == "Sunny" puts "Cloudy" elsif s == "Cloudy" ptus "Rainy" elsif s == "Rainy" puts "Sunny" end
s=gets.chomp.to_s if s == "Sunny" puts "Cloudy" elsif s == "Cloudy" puts "Rainy" elsif s == "Rainy" puts "Sunny" end
[ "identifier.change" ]
704,720
704,721
u390727364
ruby
p02909
s=gets.to_s if s == "Sunny" puts "Cloudy" elsif s == "Cloudy" ptus "Rainy" elsif s == "Rainy" puts "Sunny" end
s=gets.chomp.to_s if s == "Sunny" puts "Cloudy" elsif s == "Cloudy" puts "Rainy" elsif s == "Rainy" puts "Sunny" end
[ "call.add", "identifier.change" ]
704,722
704,721
u390727364
ruby
p02909
s = gets.chomp if s == "Sunny" puts "Cloudy" elsif s == "Cloudy" puts "Rainy" elsif s == "Raniy" puts "Sunny" end
s = gets.chomp if s == "Sunny" puts "Cloudy" elsif s == "Cloudy" puts "Rainy" elsif s == "Rainy" puts "Sunny" end
[ "literal.string.change", "control_flow.branch.if.condition.change" ]
704,775
704,776
u748406041
ruby
p02909
s = gets.chomp if s == 'Sunny' puts 'Clody' elsif s == 'Cloudy' puts 'Rainy' else puts 'Sunny' end
s = gets.chomp if s == 'Sunny' puts 'Cloudy' elsif s == 'Cloudy' puts 'Rainy' else puts 'Sunny' end
[ "literal.string.change", "call.arguments.change" ]
704,864
704,865
u729246375
ruby
p02910
gets.each_char.with_index do |s,i| if i%2==0 unless [?R,?U,?D].include? s puts 'No' exit end else unless [?L,?U,?D].include? s puts 'No' exit end end end puts 'Yes'
gets.chomp.each_char.with_index do |s,i| if i%2==0 unless [?R,?U,?D].include? s puts 'No' exit end else unless [?L,?U,?D].include? s puts 'No' exit end end end puts 'Yes'
[ "call.add" ]
704,939
704,940
u966810027
ruby
p02910
s=gets p (0...s.size).any?{s[_1]=="LR"[_1%2]} ? :No : :Yes
s=gets puts (0...s.size).any?{s[_1]=="LR"[_1%2]} ? :No : :Yes
[ "call.function.change", "io.output.change" ]
704,946
704,947
u657913472
ruby
p02910
s = gets.chomp.split("") flag = 1 S.size.times do |i| if (i + 1) % 2 == 0 && S[i] == "R" flag = 0 break elsif (i + 1) % 2 == 1 && S[i] == "L" flag = 0 break end end if flag == 0 puts "No" else puts "Yes" end
s = gets.chomp.split("") flag = 1 s.size.times do |i| if (i + 1) % 2 == 0 && s[i] == "R" flag = 0 break elsif (i + 1) % 2 == 1 && s[i] == "L" flag = 0 break end end if flag == 0 puts "No" else puts "Yes" end
[ "misc.typo", "control_flow.branch.if.condition.change" ]
705,055
705,056
u920244601
ruby
p02910
s=gets.chomp for i in 0..n-1 if s[i]=="L" && i%2==0 dame=1 elsif s[i]=="R"&& i%2==1 dame=1 end end puts dame==1? :No: :Yes
s=gets.chomp for i in 0..s.size-1 if s[i]=="L" && i%2==0 dame=1 elsif s[i]=="R"&& i%2==1 dame=1 end end puts dame==1? :No: :Yes
[ "expression.operation.binary.change", "call.add" ]
705,081
705,082
u977506075
ruby
p02910
s = gets.chomp.chars (1..s.size).each do |i| if i % 2 == 0 if s[i] == "L" puts "No" exit end else if s[i] == "R" puts "No" exit end end end puts "Yes"
s = gets.chomp.chars (0..s.size - 1).each do |i| if i % 2 == 0 if s[i] == "L" puts "No" exit end else if s[i] == "R" puts "No" exit end end end puts "Yes"
[ "literal.number.integer.change" ]
705,650
705,651
u147964866
ruby
p02910
puts gets.chomp.chars.each_with_index.any?{|x,i| x == i.odd? ? 'R' : 'L'} ? "No" : "Yes"
puts gets.chomp.chars.each_with_index.any?{|x,i| x == (i.odd? ? 'R' : 'L')} ? "No" : "Yes"
[ "control_flow.branch.if.condition.change" ]
705,851
705,852
u056944756
ruby
p02910
puts gets.chomp.chars.each_with_index.any?{|x,i| x == i.even? ? 'R' : 'L'} ? "No" : "Yes"
puts gets.chomp.chars.each_with_index.any?{|x,i| x == (i.odd? ? 'R' : 'L')} ? "No" : "Yes"
[ "control_flow.branch.if.condition.change", "identifier.change" ]
705,853
705,852
u056944756
ruby
p02910
s = gets.chomp.split('') s.length.times do |n| if n.odd? &&s[n]=='R' || n.even? && s[n] == 'L' puts 'No' break end end puts 'Yes'
s = gets.chomp.split('') s.length.times do |n| if n.odd? &&s[n]=='R' || n.even? && s[n] == 'L' puts 'No' exit end end puts 'Yes'
[ "control_flow.break.remove", "control_flow.exit.add" ]
705,944
705,945
u932417742
ruby
p02910
str = gets.chomp a = ['L', 'U', 'D'] b = ['R', 'U', 'D'] result = '' str.each_char.with_index{|c, i| next if (i.odd? && a.include?(c)) || (i.even? && b.include?(c)) result = 'NO' } result = 'YES' if result == '' puts result
str = gets.chomp a = ['L', 'U', 'D'] b = ['R', 'U', 'D'] result = '' str.each_char.with_index{|c, i| next if (i.odd? && a.include?(c)) || (i.even? && b.include?(c)) result = 'No' } result = 'Yes' if result == '' puts result
[ "literal.string.change", "literal.string.case.change", "assignment.value.change" ]
706,098
706,099
u243075416
ruby
p02910
s=gets.chomp.split("") f=true flag=true s.each do|c| if(f and c=="L") and (not f and c=="R") flag=false break end f=(not f) end puts flag ? "Yes" : "No"
s=gets.chomp.split("") f=true flag=true s.each do|c| if(f and c=="L") or (not f and c=="R") flag=false break end f=(not f) end puts flag ? "Yes" : "No"
[ "control_flow.branch.if.condition.change" ]
706,355
706,356
u415400221
ruby
p02910
steps = gets odd_actions = ['R', 'U', 'D'] even_actions = ['L', 'U', 'D'] sl = steps.length is_fumiyasui = true sl.times do |i| step_num = i + 1 if(step_num.odd?) is_fumiyasui = false unless odd_actions.include?(steps[i]) else is_fumiyasui = false unless even_actions.include?(steps[i]) end break unless is_fumiyasui end puts is_fumiyasui ? "Yes" : "No"
steps = gets.chomp odd_actions = ['R', 'U', 'D'] even_actions = ['L', 'U', 'D'] sl = steps.length is_fumiyasui = true sl.times do |i| step_num = i + 1 if(step_num.odd?) is_fumiyasui = false unless odd_actions.include?(steps[i]) else is_fumiyasui = false unless even_actions.include?(steps[i]) end break unless is_fumiyasui end puts is_fumiyasui ? "Yes" : "No"
[ "call.add" ]
706,377
706,378
u494070244
ruby
p02910
ss = gets odd_actions = ['R', 'U', 'D'] even_actions = ['L', 'U', 'D'] sl = ss.length is_fumiyasui = true sl.times do |i| step_num = i + 1 if(step_num.odd?) is_fumiyasui = false unless odd_actions.include?(ss[i]) else is_fumiyasui = false unless even_actions.include?(ss[i]) end break unless is_fumiyasui end puts is_fumiyasui ? "Yes" : "No"
steps = gets.chomp odd_actions = ['R', 'U', 'D'] even_actions = ['L', 'U', 'D'] sl = steps.length is_fumiyasui = true sl.times do |i| step_num = i + 1 if(step_num.odd?) is_fumiyasui = false unless odd_actions.include?(steps[i]) else is_fumiyasui = false unless even_actions.include?(steps[i]) end break unless is_fumiyasui end puts is_fumiyasui ? "Yes" : "No"
[ "assignment.variable.change", "identifier.change", "call.add", "assignment.value.change", "control_flow.branch.if.condition.change" ]
706,379
706,378
u494070244
ruby
p02910
ss = gets odd_actions = ['R', 'U', 'D'] even_actions = ['L', 'U', 'D'] sl = s.length is_fumiyasui = true sl.times do |i| step_num = i + 1 if(step_num.odd?) is_fumiyasui = false unless odd_actions.include?(s[i]) else is_fumiyasui = false unless even_actions.include?(s[i]) end break unless is_fumiyasui end puts is_fumiyasui ? "Yes" : "No"
steps = gets.chomp odd_actions = ['R', 'U', 'D'] even_actions = ['L', 'U', 'D'] sl = steps.length is_fumiyasui = true sl.times do |i| step_num = i + 1 if(step_num.odd?) is_fumiyasui = false unless odd_actions.include?(steps[i]) else is_fumiyasui = false unless even_actions.include?(steps[i]) end break unless is_fumiyasui end puts is_fumiyasui ? "Yes" : "No"
[ "assignment.variable.change", "identifier.change", "call.add", "assignment.value.change", "control_flow.branch.if.condition.change" ]
706,380
706,378
u494070244
ruby
p02910
s = gets.chomp.split('') easy = true s.each_with_index do |value, index| if (index + 1) % 2 == 1 if value == 'L' easy = false break end else if value == 'R' eacy = false break end end end print(easy ? 'Yes' : 'No')
s = gets.chomp.split('') easy = true s.each_with_index do |value, index| if (index + 1) % 2 == 1 if value == 'L' easy = false break end else if value == 'R' easy = false break end end end print(easy ? 'Yes' : 'No')
[ "assignment.variable.change", "identifier.change" ]
706,392
706,393
u429775245
ruby
p02910
dance = gets.chomp! i = dance.length judge = 0 for var in 1..i if var % 2 == 0 if dance[var] == "L" judge += 1 end else if dance[var] == "R" judge += 1 end end end if judge == 0 puts "Yes" else puts "No" end
dance = gets.chomp! i = dance.length judge = 0 for var in 1..i if var % 2 == 1 if dance[var-1] == "L" judge += 1 end else if dance[var-1] == "R" judge += 1 end end end if judge == 0 puts "Yes" else puts "No" end
[ "literal.number.integer.change", "control_flow.branch.if.condition.change" ]
706,459
706,460
u911373146
ruby
p02910
dance = gets.chomp! i = dance.length judge = 0 for var in 1..i if var % 2 == 1 if dance[var] == "L" judge += 1 end else if dance[var] == "R" judge += 1 end end end if judge == 0 puts "Yes" else puts "No" end
dance = gets.chomp! i = dance.length judge = 0 for var in 1..i if var % 2 == 1 if dance[var-1] == "L" judge += 1 end else if dance[var-1] == "R" judge += 1 end end end if judge == 0 puts "Yes" else puts "No" end
[ "control_flow.branch.if.condition.change" ]
706,462
706,460
u911373146
ruby
p02910
ODD_OK = ['R', 'U', 'D'] EVEN_OK = ['L', 'U', 'D'] dance = gets.chop odd_dance = dance.each_char.select.with_index { |_, i| i.even? }.uniq even_dance = dance.each_char.select.with_index { |_, i| i.odd? }.uniq if (odd_dance - ODD_OK).empty? && (even_dance - EVEN_OK).empty? puts 'YES' else puts 'No' end
ODD_OK = ['R', 'U', 'D'] EVEN_OK = ['L', 'U', 'D'] dance = gets.chop odd_dance = dance.each_char.select.with_index { |_, i| i.even? }.uniq even_dance = dance.each_char.select.with_index { |_, i| i.odd? }.uniq if (odd_dance - ODD_OK).empty? && (even_dance - EVEN_OK).empty? puts 'Yes' else puts 'No' end
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
706,615
706,616
u511826322
ruby
p02910
s = gets.chomp odd_str = ["R", "U", "D"] even_str = ["L", "U", "D"] result = true s.chars.each_with_index{|x, i| if i.odd? if odd_str.find{|y| y == x}.nil? result = false end else if even_str.find{|y| y == x}.nil? result = false end end } if result puts "Yes" else puts "No" end
s = gets.chomp odd_str = ["R", "U", "D"] even_str = ["L", "U", "D"] result = true s.chars.each_with_index{|x, i| if (i + 1).odd? if odd_str.find{|y| y == x}.nil? result = false end else if even_str.find{|y| y == x}.nil? result = false end end } if result puts "Yes" else puts "No" end
[ "control_flow.branch.if.condition.change" ]
706,958
706,959
u702652578
ruby
p02910
is_easy = { 1 => {'R' => true,'L'=> false, 'D'=> true,'U' => true}, 0 => {'R' => false,'L'=> true, 'D'=> true,'U' => true} } string = STDIN.gets.chomp all_easy_steps = string.split(//).map.with_index{|x, i| is_easy[i%2][x] }.all puts (all_easy_steps ? "Yes" : "No")
is_easy = { 1 => {'R' => true,'L'=> false, 'D'=> true,'U' => true}, 0 => {'R' => false,'L'=> true, 'D'=> true,'U' => true} } string = STDIN.gets.chomp all_easy_steps = string.split(//).map.with_index{|x, i| is_easy[(i+1)%2][x] }.all? puts (all_easy_steps ? "Yes" : "No")
[ "assignment.value.change", "identifier.change" ]
707,086
707,087
u517615862
ruby
p02910
string = gets.chomp.split("") flag = true string.each.with_index do |char, index| if index % 2 == 0 flag = false unless (char == 'R' || char == 'U' || char == 'D') else flag = false unless (char == 'L' || char == 'U' || char == 'D') end end if flag puts 'Yes' else puts 'N0' end
string = gets.chomp.split("") flag = true string.each.with_index do |char, index| if index % 2 == 0 flag = false unless (char == 'R' || char == 'U' || char == 'D') else flag = false unless (char == 'L' || char == 'U' || char == 'D') end end if flag puts 'Yes' else puts 'No' end
[ "literal.string.change", "call.arguments.change" ]
707,132
707,133
u482583772
ruby
p02910
s = gets.chomp answer = 'Yes' 1.upto(s.size) do |i| if i.even? if s[i] == 'L' answer = 'No' break end else if s[i] == 'R' answer = 'No' break end end end puts answer
s = gets.chomp answer = 'Yes' 0.upto(s.size - 1) do |i| if i.even? if s[i] == 'L' answer = 'No' break end else if s[i] == 'R' answer = 'No' break end end end puts answer
[ "literal.number.integer.change" ]
707,254
707,255
u623402808
ruby
p02910
input_lines2 = gets.chop.split("").map(&:to_s) mozi = "" finish = true for row in 0...input_lines2.size mozi = input_lines2[row] if mozi != "U" || mozi != "D" if (mozi != "R" && row%2 == 0) || (mozi != "L" && row%2 == 1) finish = false end end end if finish puts "Yes" else puts "No" end
input_lines2 = gets.chop.split("").map(&:to_s) mozi = "" finish = true for row in 0...input_lines2.size mozi = input_lines2[row] if mozi != "U" && mozi != "D" if (mozi != "R" && row%2 == 0) || (mozi != "L" && row%2 == 1) finish = false end end end if finish puts "Yes" else puts "No" end
[ "misc.opposites", "control_flow.branch.if.condition.change" ]
707,290
707,291
u302312161
ruby
p02911
x, y, z = gets.chomp.split(" ").map(&:to_i) sanka = Array.new(x, y-z) z.times do n = gets.to_i sanka[n-1] += 1 end puts sanka sanka.each do |e| if e > 0 puts "Yes" else puts "No" end end
x, y, z = gets.chomp.split(" ").map(&:to_i) sanka = Array.new(x, y-z) z.times do n = gets.to_i sanka[n-1] += 1 end sanka.each do |e| if e > 0 puts "Yes" else puts "No" end end
[ "call.remove" ]
707,666
707,667
u096381099
ruby
p02911
n, k, q = gets.split.map(&:to_i) a = q.times.map { gets.to_i } points = Array.new(n + 1, k - q) q.times do |i| points[a[i] - 1] += 1 end puts points[1..n].map { |v| v > 0 ? 'Yes' : 'No' }
n, k, q = gets.split.map(&:to_i) a = q.times.map { gets.to_i } points = Array.new(n + 1, k - q) q.times do |i| points[a[i]] += 1 end puts points[1..n].map { |v| v > 0 ? 'Yes' : 'No' }
[ "expression.operation.binary.remove" ]
707,798
707,799
u889326464
ruby
p02911
n, k, q = gets.chop.split.map(&:to_i) need = q - k + 1 if need <= 0 n.times { puts 'Yes' } exit 0 end s = [] n.times do a = gets.to_i s[a] = s[a].to_i + 1 end (1..n).each do |i| puts s[i].to_i >= need ? 'Yes' : 'No' end
n, k, q = gets.chop.split.map(&:to_i) need = q - k + 1 if need <= 0 n.times { puts 'Yes' } exit 0 end s = [] q.times do a = gets.to_i s[a] = s[a].to_i + 1 end (1..n).each do |i| puts s[i].to_i >= need ? 'Yes' : 'No' end
[ "identifier.change" ]
707,859
707,860
u604352408
ruby
p02911
n, k, q = gets.split.map &:to_i c = (n+1).times.map{0} q.times do c[gets.to_i]+=1 end (1..n).each do |i| puts c[i]>=q-k ? :Yes : :No end
n, k, q = gets.split.map &:to_i c = (n+1).times.map{0} q.times do c[gets.to_i]+=1 end (1..n).each do |i| puts c[i]>q-k ? :Yes : :No end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
708,233
708,234
u976045235
ruby
p02911
n, k, q = gets.split.map &:to_i c = (n+1).times.map{0} q.times do c[gets.to_i]+=1 end (1..n).each do |i| puts c[i]>=n-k ? :Yes : :No end
n, k, q = gets.split.map &:to_i c = (n+1).times.map{0} q.times do c[gets.to_i]+=1 end (1..n).each do |i| puts c[i]>q-k ? :Yes : :No end
[]
708,235
708,234
u976045235
ruby
p02911
n, k, q = gets.split.map &:to_i c = (n+1).rimes.map{0} q.times do c[gets.to_i]+=1 end (1..n).each do |i| puts c[i]>=n-k ? :Yes : :No end
n, k, q = gets.split.map &:to_i c = (n+1).times.map{0} q.times do c[gets.to_i]+=1 end (1..n).each do |i| puts c[i]>q-k ? :Yes : :No end
[ "assignment.value.change", "identifier.change" ]
708,236
708,234
u976045235
ruby
p02911
n,k,q=gets.split.map(&:to_i) l = [k-q] * n q.times do l[gets.to_i-1] += 1 end n.times do |i| puts l[i]>0 ? :Yes : :No end p l
n,k,q=gets.split.map(&:to_i) l = [k-q] * n q.times do l[gets.to_i-1] += 1 end n.times do |i| puts l[i]>0 ? :Yes : :No end
[ "call.remove" ]
708,364
708,365
u744908753
ruby
p02911
# your code goes here N, K, Q = gets.split.map(&:to_i) As = Q.times.map{gets.to_i} ans = Array.new(N, 0) for A in As do ans[A-1] += 1 end for i in 0...N do if i != N-1 then puts (Q - ans[i] >= K) ? "NO" : "YES" else print (Q - ans[i] >= K) ? "NO" : "YES" end end
# your code goes here N, K, Q = gets.split.map(&:to_i) As = Q.times.map{gets.to_i} ans = Array.new(N, 0) for A in As do ans[A-1] += 1 end for i in 0...N do if i != N-1 then puts (Q - ans[i] >= K) ? "No" : "Yes" else print (Q - ans[i] >= K) ? "No" : "Yes" end end
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
708,446
708,447
u961226684
ruby
p02911
# 人数, 初期ライフ, 問題数 n, k, q = gets.chomp.split(' ').map{|s| s.to_i} score = Array.new(n,0) for i in 0..q-1 do x = gets.chomp.to_i score[x] += 1 end for i in 1..n-1 do if k - (q - score[i]) <= 0 then print "No\n" else print "Yes\n" end end
# 人数, 初期ライフ, 問題数 n, k, q = gets.chomp.split(' ').map{|s| s.to_i} score = Array.new(n,0) for i in 0..q-1 do x = gets.chomp.to_i score[x-1] += 1 end for i in 0..n-1 do if k - (q - score[i]) <= 0 then print "No\n" else print "Yes\n" end end
[ "literal.number.integer.change" ]
708,511
708,512
u894128391
ruby
p02911
# 人数, 初期ライフ, 問題数 n, k, q = gets.chomp.split(' ').map{|s| s.to_i} score = Array.new(n,0) for i in 0..q-1 do x = gets.chomp.to_i score[x] += 1 end p score for i in 1..n-1 do if k - (q - score[i]) <= 0 then print "No\n" else print "Yes\n" end end
# 人数, 初期ライフ, 問題数 n, k, q = gets.chomp.split(' ').map{|s| s.to_i} score = Array.new(n,0) for i in 0..q-1 do x = gets.chomp.to_i score[x-1] += 1 end for i in 0..n-1 do if k - (q - score[i]) <= 0 then print "No\n" else print "Yes\n" end end
[ "call.remove", "literal.number.integer.change" ]
708,513
708,512
u894128391
ruby
p02911
n, k, q = STDIN.gets.split(/\s+/).map(&:to_i) answer_count = Hash.new(0) q.times.each{ answer_count[STDIN.gets.to_i] += 1 } participants_survived = (1..n).times.map{|i| k > q - answer_count[i] } participants_survived.each { |participant_survived| puts (participant_survived? "Yes": "No")}
n, k, q = STDIN.gets.split(/\s+/).map(&:to_i) answer_count = Hash.new(0) q.times.each{ answer_count[STDIN.gets.to_i] += 1 } participants_survived = (1..n).map{|i| k > q - answer_count[i] } participants_survived.each { |participant_survived| puts (participant_survived ? "Yes": "No")}
[ "call.remove", "call.arguments.change", "io.output.change" ]
708,682
708,683
u517615862
ruby
p02911
n,k,q = gets.chomp.split(" ").map(&:to_i) b = k-n-1 point = Array.new(n+1){0} q.times do point[gets.to_i] += 1 end n.times do |i| if point[i+1] > b puts("Yes") else puts("No") end end
n,k,q = gets.chomp.split(" ").map(&:to_i) b = q-k point = Array.new(n+1){0} q.times do point[gets.to_i] += 1 end n.times do |i| if point[i+1] > b puts("Yes") else puts("No") end end
[ "expression.operation.binary.remove" ]
709,000
709,001
u879573689
ruby
p02912
def enq(a,x) b = a[i=-1] until b.frozen? return a << x if x >= (a=b)[-1] return a.unshift x if x <= a[0] b = a[i = a.bsearch_index{|y| x < (y.frozen? ? y: y[0])}-1] end if b && b=a return a.insert i+1, x if a[i+9] i>0 ? a[i]=[b,x] : enq(a[i+=1].to_a,x) rescue a[i]=[x,a[i]] end def deq(a) r=a.shift; a.unshift *a.shift if !a[0].frozen?; r end def poq(a) r=a.pop; a.push *a.pop if !a[-1].frozen?; r end N,M,*A = $<.read.split.map{|x| x.to_i} A.sort! M.times { break if A[-1]==0; enq A, (poq A)/2 } p A.flatten.inject(0,:+)
def enq(a,x) b = a[i=-1] until b.frozen? return a << x if x >= (a=b)[-1] return a.unshift x if x <= a[0] b = a[i = a.bsearch_index{|y| x < (y.frozen? ? y: y[0])}-1] end if b && b=a return a.insert i+1, x unless a[i+9] i>0 ? a[i]=[b,x] : enq(a[i+=1].to_a,x) rescue a[i]=[x,a[i]] end def deq(a) r=a.shift; a.unshift *a.shift if !a[0].frozen?; r end def poq(a) r=a.pop; a.push *a.pop if !a[-1].frozen?; r end N,M,*A = $<.read.split.map{|x| x.to_i} A.sort! M.times { break if A[-1]==0; enq A, (poq A)/2 } p A.flatten.inject(0,:+)
[]
709,296
709,297
u720281401
ruby
p02912
def enq(a,x) b = a[i=-1] until b.frozen? return a << x if x >= (a=b)[-1] return a.unshift x if x <= a[0] i = a.bsearch_index {|y| x <= (y.frozen? ? y: y[0])} b = a[i-=1] if (b=a[i]).frozen? ? x<b: x<b[0] end if b && b=a return a.insert(i+1, x) if a.size-i < 9 i > 9 ? a[i] = [a[i],x] : a.unshift(*a.shift(i+1),x) end def deq(a); r = a.shift; a.unshift *a.shift if !a[0].frozen?; r end def popq(a); r = a.pop; a.push *a.pop if !a[-1].frozen?; r end N,M,*A = $<.read.split.map{|x| x.to_i} A.sort! M.times { break if A[0]==0; enq A, (popq A)/2 } p A.flatten.inject(0,:+)
def enq(a,x) b = a[i=-1] until b.frozen? return a << x if x >= (a=b)[-1] return a.unshift x if x <= a[0] i = a.bsearch_index {|y| x <= (y.frozen? ? y: y[0])} b = a[i-=1] if (b=a[i]).frozen? ? x<b: x<b[0] end if b && b=a return a.insert(i+1, x) if a.size-i < 9 i > 9 ? a[i] = [a[i],x] : a.unshift(*a.shift(i+1),x) end def deq(a); r = a.shift; a.unshift *a.shift if !a[0].frozen?; r end def popq(a); r = a.pop; a.push *a.pop if !a[-1].frozen?; r end N,M,*A = $<.read.split.map{|x| x.to_i} A.sort! M.times { break if A[-1]==0; enq A, (popq A)/2 } p A.flatten.inject(0,:+)
[ "variable_access.subscript.index.change", "control_flow.branch.if.condition.change", "expression.operation.unary.add" ]
709,302
709,303
u720281401
ruby
p02912
def enq(a,x) b = a[i=-1] until b.frozen? return a << x if x >= (a=b)[-1] return a.unshift x if x <= a[0] i = a.bsearch_index {|y| x <= (y.frozen? ? y: y[0])} b = a[i-=1] if (b=a[i]).frozen? ? x<b: x<b[0] end if b && b=a return a.insert(i+1, x) if a.size-i < 9 i > 9 ? a[i] = [a[i],x] : a.unshift(*a.shift(i+1),x) end def deq(a); r = a.shift; a.unshift *a.shift if !a[0].frozen?; r end def popq(a); r = a.pop; a.push *a.pop if !a[-1].frozen?; r end N,M,*A = $<.read.split.map{|x| x.to_i} A.sort! M.times { break if A[0]==0; enq A, popq(A/2) } p A.flatten.inject(0,:+)
def enq(a,x) b = a[i=-1] until b.frozen? return a << x if x >= (a=b)[-1] return a.unshift x if x <= a[0] i = a.bsearch_index {|y| x <= (y.frozen? ? y: y[0])} b = a[i-=1] if (b=a[i]).frozen? ? x<b: x<b[0] end if b && b=a return a.insert(i+1, x) if a.size-i < 9 i > 9 ? a[i] = [a[i],x] : a.unshift(*a.shift(i+1),x) end def deq(a); r = a.shift; a.unshift *a.shift if !a[0].frozen?; r end def popq(a); r = a.pop; a.push *a.pop if !a[-1].frozen?; r end N,M,*A = $<.read.split.map{|x| x.to_i} A.sort! M.times { break if A[-1]==0; enq A, (popq A)/2 } p A.flatten.inject(0,:+)
[ "variable_access.subscript.index.change", "control_flow.branch.if.condition.change", "expression.operation.unary.add", "call.arguments.change", "call.add" ]
709,304
709,303
u720281401
ruby
p02912
class PriorityQueue def initialize(&comp) @heap = [] @node_num = 0 if !block_given? @comp = Proc.new { |x, y| x <= y } else @comp = comp end end attr_reader :heap def push(x) i = @node_num # 自分のノード番号 @node_num += 1 while i > 0 par = (i - 1) / 2 # 親のノード番号 break if @comp.call(@heap[par], x) # 逆転してないなら抜ける # 親ノードを下ろして自分を上に @heap[i] = @heap[par] i = par end @heap[i] = x end alias_method(:<<, :push) def pop # 最(小|大)値 ret = @heap[0] # 根にもってくる値 @node_num -= 1 x = @heap[@node_num] # 根から下ろしていく i = 0 while i * 2 + 1 < @node_num # 子どうしを比較 a, b = i * 2 + 1, i * 2 + 2 a = b if b < @node_num && @comp.call(@heap[b], @heap[a]) break unless @comp.call(x, @heap[a]) @heap[i] = @heap[a] i = a end @heap[i] = x return ret end def get @node_num == 0 ? nil : @heap[0] end def empty? return get.nil? end end n, m = gets.split.map(&:to_i) a = gets.split.map(&:to_i) q = PriorityQueue.new { |x, y| x > y } a.each do |e| q.push e end m.times do q.push(q.pop / 2) end puts q.heap.inject(:+)
class PriorityQueue def initialize(&comp) @heap = [] @node_num = 0 if !block_given? @comp = Proc.new { |x, y| x <= y } else @comp = comp end end attr_reader :heap def push(x) i = @node_num # 自分のノード番号 @node_num += 1 while i > 0 par = (i - 1) / 2 # 親のノード番号 break if @comp.call(@heap[par], x) # 逆転してないなら抜ける # 親ノードを下ろして自分を上に @heap[i] = @heap[par] i = par end @heap[i] = x end alias_method(:<<, :push) def pop # 最(小|大)値 ret = @heap[0] # 根にもってくる値 @node_num -= 1 x = @heap[@node_num] # 根から下ろしていく i = 0 while i * 2 + 1 < @node_num # 子どうしを比較 a, b = i * 2 + 1, i * 2 + 2 a = b if b < @node_num && @comp.call(@heap[b], @heap[a]) break unless @comp.call(@heap[a], x) @heap[i] = @heap[a] i = a end @heap[i] = x return ret end def get @node_num == 0 ? nil : @heap[0] end def empty? return get.nil? end end n, m = gets.split.map(&:to_i) a = gets.split.map(&:to_i) q = PriorityQueue.new { |x, y| x > y } a.each do |e| q.push e end m.times do q.push(q.pop / 2) end puts q.heap.inject(:+)
[ "call.arguments.change", "call.arguments.add" ]
709,785
709,786
u706695185
ruby
p02912
class PriorityQueue def initialize(&comp) @heap = [] @node_num = 0 if !block_given? @comp = Proc.new { |x, y| x <= y } else @comp = comp end end attr_reader :heap # def push(x) # i = @node_num # 自分のノード番号 # @node_num += 1 # while i > 0 # par = (i - 1) / 2 # 親のノード番号 # break if @comp.call(@heap[par], x) # 逆転してないなら抜ける # # 親ノードを下ろして自分を上に # @heap[i] = @heap[par] # i = par # end # @heap[i] = x # end def push(x) i = @node_num @node_num += 1 while i > 0 p = (i - 1) / 2 break if @func.call(@heap[p], x) @heap[i] = @heap[p] i = p end @heap[i] = x end alias_method(:<<, :push) def pop # 最(小|大)値 ret = @heap[0] # 根にもってくる値 @node_num -= 1 x = @heap[@node_num] # 根から下ろしていく i = 0 while i * 2 + 1 < @node_num # 子どうしを比較 a = i * 2 + 1 b = i * 2 + 2 a = b if b < @node_num && !@comp.call(@heap[a], @heap[b]) break if @comp.call(x, @heap[a]) @heap[i] = @heap[a] i = a end @heap[i] = x ret end def get @node_num == 0 ? nil : @heap[0] end def empty? get.nil? end end n, m = gets.split.map(&:to_i) a = gets.split.map(&:to_i) q = PriorityQueue.new { |x, y| x > y } a.each do |e| q.push e end m.times do q.push(q.pop / 2) end puts q.heap.inject(:+)
class PriorityQueue def initialize(&comp) @heap = [] @node_num = 0 if !block_given? @comp = Proc.new { |x, y| x <= y } else @comp = comp end end attr_reader :heap # def push(x) # i = @node_num # 自分のノード番号 # @node_num += 1 # while i > 0 # par = (i - 1) / 2 # 親のノード番号 # break if @comp.call(@heap[par], x) # 逆転してないなら抜ける # # 親ノードを下ろして自分を上に # @heap[i] = @heap[par] # i = par # end # @heap[i] = x # end def push(x) i = @node_num @node_num += 1 while i > 0 p = (i - 1) / 2 break if @comp.call(@heap[p], x) @heap[i] = @heap[p] i = p end @heap[i] = x end alias_method(:<<, :push) def pop # 最(小|大)値 ret = @heap[0] # 根にもってくる値 @node_num -= 1 x = @heap[@node_num] # 根から下ろしていく i = 0 while i * 2 + 1 < @node_num # 子どうしを比較 a = i * 2 + 1 b = i * 2 + 2 a = b if b < @node_num && !@comp.call(@heap[a], @heap[b]) break if @comp.call(x, @heap[a]) @heap[i] = @heap[a] i = a end @heap[i] = x ret end def get @node_num == 0 ? nil : @heap[0] end def empty? get.nil? end end n, m = gets.split.map(&:to_i) a = gets.split.map(&:to_i) q = PriorityQueue.new { |x, y| x > y } a.each do |e| q.push e end m.times do q.push(q.pop / 2) end puts q.heap.inject(:+)
[ "control_flow.branch.if.condition.change" ]
709,787
709,788
u706695185
ruby
p02912
class PriorityQueue def initialize(&comp) @heap = [] @node_num = 0 if !block_given? @comp = Proc.new { |x, y| x <= y } else @comp = comp end end attr_reader :heap def push(x) i = @node_num # 自分のノード番号 @node_num += 1 while i > 0 par = (i - 1) / 2 # 親のノード番号 break if @comp.call(@heap[par], x) # 逆転してないなら抜ける # 親ノードを下ろして自分を上に @heap[i] = @heap[par] i = par end @heap[i] = x end alias_method(:<<, :push) def pop # 最(小|大)値 ret = @heap[0] # 根にもってくる値 @node_num -= 1 x = @heap[@node_num] # 根から下ろしていく i = 0 while i * 2 + 1 < @node_num # 子どうしを比較 a, b = i * 2 + 1, i * 2 + 2 a = b if b < @node_num && !@comp.call(@heap[a], @heap[b]) break if @comp.call(x, @heap[a]) @heap[i] = @heap[a] i = a end @heap[i] = x return ret end def get @node_num == 0 ? nil : @heap[0] end def empty? return get.nil? end end n, m = gets.split.map(&:to_i) a = gets.split.map(&:to_i).sort.reverse q = PriorityQueue.new(n) { |x, y| x > y } a.each do |ai| q << ai end m.times do max_n = q.pop() q << (max_n / 2) end p q.heap.inject(:+)
class PriorityQueue def initialize(&comp) @heap = [] @node_num = 0 if !block_given? @comp = Proc.new { |x, y| x <= y } else @comp = comp end end attr_reader :heap def push(x) i = @node_num # 自分のノード番号 @node_num += 1 while i > 0 par = (i - 1) / 2 # 親のノード番号 break if @comp.call(@heap[par], x) # 逆転してないなら抜ける # 親ノードを下ろして自分を上に @heap[i] = @heap[par] i = par end @heap[i] = x end alias_method(:<<, :push) def pop # 最(小|大)値 ret = @heap[0] # 根にもってくる値 @node_num -= 1 x = @heap[@node_num] # 根から下ろしていく i = 0 while i * 2 + 1 < @node_num # 子どうしを比較 a, b = i * 2 + 1, i * 2 + 2 a = b if b < @node_num && !@comp.call(@heap[a], @heap[b]) break if @comp.call(x, @heap[a]) @heap[i] = @heap[a] i = a end @heap[i] = x return ret end def get @node_num == 0 ? nil : @heap[0] end def empty? return get.nil? end end n, m = gets.split.map(&:to_i) a = gets.split.map(&:to_i).sort.reverse q = PriorityQueue.new { |x, y| x > y } a.each do |ai| q << ai end m.times do max_n = q.pop() q << (max_n / 2) end p q.heap.inject(:+)
[ "call.arguments.change" ]
709,789
709,790
u706695185
ruby
p02912
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE'] def inpf() a=gets.chomp.split(" ").map(&:to_f)end def inps() a=gets.chomp.split(" ")end def copy(a) Marshal.load(Marshal.dump(a)) end def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end def na(n,d=0) Array.new(n,d)end def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end def inp() a=gets.chomp.split(" ").map(&:to_i)end def r_up(a, b) (a+b-1)/b end def sum(a) a.inject(:+) end class Hp def initialize(len) @main = na(len,[99999999,nil]) @ind = 1 @size = len - 5 end def push(n) p "wa" if(@ind > @size) @main[@ind+1] = n sind = @ind while(sind >= 2) nind = sind/2 if(@main[sind][0] < @main[nind][0]) @main[sind], @main[nind] = @main[nind], @main[sind] else break end sind /= 2 end @ind += 1 end def put() return @main end def pop() ans = @main[1] @main[1] = @main[@ind] @main[@ind] = @main[-1] sind = 1 while(true) nind = sind*2 break if(nind > @ind) l = @main[nind] nind += 1 if(nind > @ind) ind = nind-1 if(@main[ind][0] < @main[sind][0]) @main[sind], @main[ind] = @main[ind], @main[sind] end break end r = @main[nind] ind = (l[0] > r[0])? nind : nind-1 if(@main[ind][0] < @main[sind][0]) @main[sind], @main[ind] = @main[ind], @main[sind] end sind = ind end @ind -= 1 return ans end def res() @ind = 1 push([99999999,nil]) end end hp = Hp.new(105) n,m = inp a = inp a.each do |d| hp.push([d*-1,0]) end m.times do u = hp.pop if(u[0] == 0) puts 0 exit end hp.push([((u[0]*-1)/2)*-1,0]) end ans = 0 while true u = hp.pop break if(u[1] == nil) ans += u[0] end p ans * -1
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE'] def inpf() a=gets.chomp.split(" ").map(&:to_f)end def inps() a=gets.chomp.split(" ")end def copy(a) Marshal.load(Marshal.dump(a)) end def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end def na(n,d=0) Array.new(n,d)end def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end def inp() a=gets.chomp.split(" ").map(&:to_i)end def r_up(a, b) (a+b-1)/b end def sum(a) a.inject(:+) end class Hp def initialize(len) @main = na(len,[99999999,nil]) @ind = 1 @size = len - 5 end def push(n) p "wa" if(@ind > @size) @main[@ind+1] = n sind = @ind+1 while(sind >= 2) nind = sind/2 if(@main[sind][0] < @main[nind][0]) @main[sind], @main[nind] = @main[nind], @main[sind] else break end sind /= 2 end @ind += 1 end def put() return @main end def pop() ans = @main[1] @main[1] = @main[@ind] @main[@ind] = @main[-1] sind = 1 while(true) nind = sind*2 break if(nind > @ind) l = @main[nind] nind += 1 if(nind > @ind) ind = nind-1 if(@main[ind][0] < @main[sind][0]) @main[sind], @main[ind] = @main[ind], @main[sind] end break end r = @main[nind] ind = (l[0] > r[0])? nind : nind-1 if(@main[ind][0] < @main[sind][0]) @main[sind], @main[ind] = @main[ind], @main[sind] end sind = ind end @ind -= 1 return ans end def res() @ind = 1 push([99999999,nil]) end end hp = Hp.new(200000) n,m = inp a = inp a.each do |d| hp.push([d*-1,0]) end m.times do u = hp.pop if(u[0] == 0) puts 0 exit end hp.push([((u[0]*-1)/2)*-1,0]) end ans = 0 while true u = hp.pop break if(u[1] == nil) ans += u[0] end p ans * -1
[ "literal.number.integer.change", "assignment.value.change", "call.arguments.change" ]
710,511
710,510
u145123922
ruby
p02912
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE'] def inpf() a=gets.chomp.split(" ").map(&:to_f)end def inps() a=gets.chomp.split(" ")end def copy(a) Marshal.load(Marshal.dump(a)) end def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end def na(n,d=0) Array.new(n,d)end def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end def inp() a=gets.chomp.split(" ").map(&:to_i)end def r_up(a, b) (a+b-1)/b end def sum(a) a.inject(:+) end class Hp def initialize(len) @main = na(len,[99999999,nil]) @ind = 1 @size = len - 5 end def push(n) p "wa" if(@ind > @size) @main[@ind+1] = n sind = @ind while(sind >= 2) nind = sind/2 if(@main[sind][0] < @main[nind][0]) @main[sind], @main[nind] = @main[nind], @main[sind] else break end sind /= 2 end @ind += 1 end def put() return @main end def pop() ans = @main[1] @main[1] = @main[@ind] @main[@ind] = @main[-1] sind = 1 while(true) nind = sind*2 break if(nind > @ind) l = @main[nind] nind += 1 if(nind > @ind) ind = nind-1 if(@main[ind][0] < @main[sind][0]) @main[sind], @main[ind] = @main[ind], @main[sind] end break end r = @main[nind] ind = (l[0] > r[0])? nind : nind-1 if(@main[ind][0] < @main[sind][0]) @main[sind], @main[ind] = @main[ind], @main[sind] end sind = ind end @ind -= 1 return ans end def res() @ind = 1 push([99999999,nil]) end end hp = Hp.new(105) n,m = inp a = inp a.each do |d| hp.push([d*-1,0]) end m.times do u = hp.pop if(u[0] == 0) puts 0 exit end hp.push([((u[0]*-1)/2)*-1,0]) end ans = 0 while true u = hp.pop break if(u[1] == nil) ans += u[0] end p ans * -1
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE'] def inpf() a=gets.chomp.split(" ").map(&:to_f)end def inps() a=gets.chomp.split(" ")end def copy(a) Marshal.load(Marshal.dump(a)) end def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end def na(n,d=0) Array.new(n,d)end def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end def inp() a=gets.chomp.split(" ").map(&:to_i)end def r_up(a, b) (a+b-1)/b end def sum(a) a.inject(:+) end class Hp def initialize(len) @main = na(len,[99999999,nil]) @ind = 1 @size = len - 5 end def push(n) p "wa" if(@ind > @size) @main[@ind+1] = n sind = @ind+1 while(sind >= 2) nind = sind/2 if(@main[sind][0] < @main[nind][0]) @main[sind], @main[nind] = @main[nind], @main[sind] else break end sind /= 2 end @ind += 1 end def put() return @main end def pop() ans = @main[1] @main[1] = @main[@ind] @main[@ind] = @main[-1] sind = 1 while(true) nind = sind*2 break if(nind > @ind) l = @main[nind] nind += 1 if(nind > @ind) ind = nind-1 if(@main[ind][0] < @main[sind][0]) @main[sind], @main[ind] = @main[ind], @main[sind] end break end r = @main[nind] ind = (l[0] > r[0])? nind : nind-1 if(@main[ind][0] < @main[sind][0]) @main[sind], @main[ind] = @main[ind], @main[sind] end sind = ind end @ind -= 1 return ans end def res() @ind = 1 push([99999999,nil]) end end hp = Hp.new(100005) n,m = inp a = inp a.each do |d| hp.push([d*-1,0]) end m.times do u = hp.pop if(u[0] == 0) puts 0 exit end hp.push([((u[0]*-1)/2)*-1,0]) end ans = 0 while true u = hp.pop break if(u[1] == nil) ans += u[0] end p ans * -1
[ "literal.number.integer.change", "assignment.value.change", "call.arguments.change" ]
710,511
710,512
u145123922
ruby
p02915
s = gets().chomp.to_i puts s**s
s = gets().chomp.to_i puts s**3
[ "identifier.replace.remove", "literal.replace.add", "call.arguments.change", "io.output.change" ]
710,922
710,923
u810199299
ruby
p02915
n = gets.to_i puts n ** n
n = gets.to_i puts n ** 3
[ "identifier.replace.remove", "literal.replace.add", "call.arguments.change", "expression.operation.binary.change" ]
711,203
711,204
u641383521
ruby
p02915
n = gets.to_i puts n ** n
n = gets.to_i puts n ** 3
[ "identifier.replace.remove", "literal.replace.add", "call.arguments.change", "expression.operation.binary.change" ]
711,203
711,205
u641383521
ruby
p02915
n=gets.chopm.to_i puts n**3
n = gets.chomp.to_i puts n ** 3
[ "assignment.value.change", "identifier.change" ]
711,433
711,434
u932417742
ruby
p02915
n=gets print n**3
n=gets.chomp.to_i print n**3
[ "call.add" ]
711,445
711,446
u882389182
ruby
p02915
N = gets.to_i puts N**N**N
N = gets.to_i puts N**3
[ "call.arguments.change", "expression.operation.binary.change", "io.output.change", "expression.operation.binary.remove" ]
711,473
711,474
u358003829
ruby
p02915
N = scan.to_i puts N**N**N
N = gets.to_i puts N**3
[ "assignment.value.change", "identifier.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change", "expression.operation.binary.remove" ]
711,475
711,474
u358003829
ruby
p02915
n = gets.to_i p i**3
n = gets.to_i p n**3
[ "identifier.change", "call.arguments.change" ]
711,515
711,516
u976045235
ruby
p02915
N = gets.to_i puts (N ** 2) * 2
N = gets.to_i puts (N**2) * N
[ "call.arguments.change", "expression.operation.binary.change" ]
711,592
711,593
u999835680
ruby
p02915
puts (N.to_i)**3
N = gets puts (N.to_i)**3
[ "assignment.add" ]
711,642
711,643
u025800350
ruby
p02915
n = gets.chomp.to_i puts n ** n
n = gets.chomp.to_i puts n ** 3
[ "identifier.replace.remove", "literal.replace.add", "call.arguments.change", "expression.operation.binary.change" ]
711,921
711,922
u808711621
ruby
p02913
MOD=10**9+7 cnt=0; sum=0; prev=nil; h=Hash.new(0) def gs() gets.chomp end def gi() gets.to_i end def gsmi() gets.chomp.split.map(&:to_i) end def desc(ar) ar.sort!{|x,y|y<=>x} end def min(a,b) a<=b ? a : b end def max(a,b) a>=b ? a : b end def puts_yesno(can) puts(can ? 'Yes' : 'No') end def putsend(s) puts s; exit end def debug(k,v) puts "#{k}:#{v}" end ########### ( ˘ω˘ )スヤァ… ########### n = gi s = gs i = 0 j = 0 max = 0 while j<n do sub = s[i..j] other = s[(j+1)..-1] if other[sub] cnt = sub.length max = cnt if cnt>max j += 1 else i += 1 j += 1 end end
MOD=10**9+7 cnt=0; sum=0; prev=nil; h=Hash.new(0) def gs() gets.chomp end def gi() gets.to_i end def gsmi() gets.chomp.split.map(&:to_i) end def desc(ar) ar.sort!{|x,y|y<=>x} end def min(a,b) a<=b ? a : b end def max(a,b) a>=b ? a : b end def puts_yesno(can) puts(can ? 'Yes' : 'No') end def putsend(s) puts s; exit end def debug(k,v) puts "#{k}:#{v}" end ########### ( ˘ω˘ )スヤァ… ########### n = gi s = gs i = 0 j = 0 max = 0 while j<n do sub = s[i..j] other = s[(j+1)..-1] if other[sub] cnt = sub.length max = cnt if cnt>max j += 1 else i += 1 j += 1 end end puts max
[ "call.add" ]
712,186
712,187
u385631112
ruby
p02916
n,a,b,c=$<.map{_1.split.map &:to_i} p b.sum+(0..n-2).sum{|i|a[i]+1==a[i+1] ? c[a[i]-1] : 0}
n,a,b,c=$<.map{_1.split.map &:to_i} p b.sum+(0..n[0]-2).sum{|i|a[i]+1==a[i+1] ? c[a[i]-1] : 0}
[]
712,267
712,268
u657913472
ruby
p02916
n = gets.chomp.to_i a = gets.chomp.split.map(&:to_i) b = gets.chomp.split.map(&:to_i) c = gets.chomp.split.map(&:to_i) sum = 0 n.times do |i| sum += b[a[i] - 1] if a[i-1] + 1 == a[i] sum += c[a[i-1]-1] end end puts sum
n = gets.chomp.to_i a = gets.chomp.split.map(&:to_i) b = gets.chomp.split.map(&:to_i) c = gets.chomp.split.map(&:to_i) sum = 0 n.times do |i| sum += b[a[i] - 1] if i >= 1 && a[i-1] + 1 == a[i] sum += c[a[i-1]-1] end end puts sum
[ "control_flow.branch.if.condition.change" ]
712,319
712,320
u895926909
ruby
p02916
s = gets.to_i a,b,c = 3.times.map { gets.split(" ").map(&:to_i)} sat = 0 n = 0 a.each do |i| sat += b[i-1] sat += c[i-2] if n == i - 1 n = i end puts sat
s = gets.to_i a,b,c = 3.times.map { gets.split(" ").map(&:to_i)} sat = 0 n = -1 a.each do |i| sat += b[i-1] sat += c[i-2] if n == i - 1 n = i end puts sat
[ "assignment.value.change", "expression.operation.unary.add" ]
712,668
712,669
u469030089
ruby
p02916
n = gets.to_i a = gets.chomp.split(" ").map(&:to_i) b = gets.chomp.split(" ").map(&:to_i) c = gets.chomp.split(" ").map(&:to_i) sum = 0 past_number = n + 1 a.each do |number| sum += b[number - 1] sum += c[number - 2] if number - past_number == 1 p sum past_number = number end puts sum
n = gets.to_i a = gets.chomp.split(" ").map(&:to_i) b = gets.chomp.split(" ").map(&:to_i) c = gets.chomp.split(" ").map(&:to_i) sum = 0 past_number = n + 1 a.each do |number| sum += b[number - 1] sum += c[number - 2] if number - past_number == 1 past_number = number end puts sum
[ "call.remove" ]
712,678
712,679
u333374716
ruby