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
p03017
# frozen_string_literal: true n, a, b, c, d = gets.split.map(&:to_i) s = gets.chomp a -= 1 b -= 1 c -= 1 d -= 1 a.upto(c - 1) do |i| if s[i + 1] == '#' && s[i] == '#' puts 'No' exit end end b.upto(d - 1) do |i| if s[i + 1] == '#' && s[i] == '#' puts 'No' exit end end if c < d puts 'Yes' exit end b.upto(d - 1) do |i| if s[i - 1] != '#' && s[i] != '#' && s[i + 1] != '#' puts 'Yes' exit end end puts 'No'
# frozen_string_literal: true n, a, b, c, d = gets.split.map(&:to_i) s = gets.chomp a -= 1 b -= 1 c -= 1 d -= 1 a.upto(c - 1) do |i| if s[i + 1] == '#' && s[i] == '#' puts 'No' exit end end b.upto(d - 1) do |i| if s[i + 1] == '#' && s[i] == '#' puts 'No' exit end end if c < d puts 'Yes' exit end b.upto(d) do |i| if s[i - 1] != '#' && s[i] != '#' && s[i + 1] != '#' puts 'Yes' exit end end puts 'No'
[ "expression.operation.binary.remove" ]
832,623
832,624
u434509016
ruby
p03017
# frozen_string_literal: true n, a, b, c, d = gets.split.map(&:to_i) s = gets.chomp a -= 1 b -= 1 c -= 1 d -= 1 a.upto(c - 1) do |i| if s[i + 1] == '#' && s[i] == '#' puts 'No' exit end end b.upto(d - 1) do |i| if s[i + 1] == '#' && s[i] == '#' puts 'No' exit end end if c < d puts 'Yes' exit end b.upto(c - 1) do |i| if s[i - 1] != '#' && s[i] != '#' && s[i + 1] != '#' puts 'Yes' exit end end puts 'No'
# frozen_string_literal: true n, a, b, c, d = gets.split.map(&:to_i) s = gets.chomp a -= 1 b -= 1 c -= 1 d -= 1 a.upto(c - 1) do |i| if s[i + 1] == '#' && s[i] == '#' puts 'No' exit end end b.upto(d - 1) do |i| if s[i + 1] == '#' && s[i] == '#' puts 'No' exit end end if c < d puts 'Yes' exit end b.upto(d) do |i| if s[i - 1] != '#' && s[i] != '#' && s[i + 1] != '#' puts 'Yes' exit end end puts 'No'
[ "call.arguments.change", "expression.operation.binary.change", "expression.operation.binary.remove" ]
832,625
832,624
u434509016
ruby
p03017
N, a, b, C, D = gets.split.map(&:to_i) S = gets.chomp if C < D ans = 'Yes' ((a-1)..C-2).each do |i| if S[i..(i+1)] == '##' ans = 'No' break end end ((b-1)..D-2).each do |i| if S[i..(i+1)] == '##' ans = 'No' break end end else ans = 'No' ([(b-2),0].max..D-3).each do |i| if S[i..(i+2)] == '...' ans = 'Yes' end end ((a-1)..C-2).each do |i| if S[i..(i+1)] == '##' ans = 'No' break end end ((b-1)..D-2).each do |i| if S[i..(i+1)] == '##' ans = 'No' break end end end puts ans
N, a, b, C, D = gets.split.map(&:to_i) S = gets.chomp if C < D ans = 'Yes' ((a-1)..C-2).each do |i| if S[i..(i+1)] == '##' ans = 'No' break end end ((b-1)..D-2).each do |i| if S[i..(i+1)] == '##' ans = 'No' break end end else ans = 'No' ([(b-2),0].max..D-2).each do |i| if S[i..(i+2)] == '...' ans = 'Yes' end end ((a-1)..C-2).each do |i| if S[i..(i+1)] == '##' ans = 'No' break end end ((b-1)..D-2).each do |i| if S[i..(i+1)] == '##' ans = 'No' break end end end puts ans
[ "literal.number.integer.change", "expression.operation.binary.change" ]
832,797
832,798
u729246375
ruby
p03018
s = gets.strip if s.length < 3 puts 0 exit end ans = 0 ca = 0 i = 0 while i < s.length - 2 if s[i, 3] == 'ABC' ans += (ca + 1) s[i + 2] = 'A' i += 2 ca = 0 next else if s[i] == 'A' ca += 1 else ca = 0 end i += 1 end end puts ans
s = gets.strip if s.length < 3 puts 0 exit end ans = 0 ca = 0 i = 0 while i < s.length - 2 if s[i, 3] == 'ABC' ans += (ca + 1) s[i + 2] = 'A' i += 2 next else if s[i] == 'A' ca += 1 else ca = 0 end i += 1 end end puts ans
[ "assignment.remove" ]
833,777
833,778
u919970507
ruby
p03024
puts gets.chomp.count('o') >= 8 ? 'YES' : 'NO'
puts gets.chomp.count('x') >= 8 ? 'NO' : 'YES'
[ "literal.string.change", "control_flow.branch.if.condition.change", "call.arguments.change" ]
835,476
835,478
u857510905
ruby
p03024
puts ((a=gets.chars).count('o') + (15 - a.count) >= 8 ? 'YES' : 'NO')
puts (a=gets.chomp.chars).count('o') + (15 - a.count) >= 8 ? 'YES' : 'NO'
[ "call.arguments.change", "control_flow.branch.if.condition.change", "call.add" ]
835,707
835,708
u871239364
ruby
p03024
puts (a=gets.chars).count('o') + (15 - a.count) >= 8 ? 'YES' : 'NO'
puts (a=gets.chomp.chars).count('o') + (15 - a.count) >= 8 ? 'YES' : 'NO'
[ "control_flow.branch.if.condition.change", "call.add" ]
835,709
835,708
u871239364
ruby
p03024
s=gets s+='o'*([15-s.length, 0].max) puts s.split('').select{|a| a == 'o'}.count >= 8 ? 'YES' : 'NO'
s=gets.chomp s+='o'*([15-s.length, 0].max) puts s.split('').select{|a| a == 'o'}.count >= 8 ? 'YES' : 'NO'
[ "call.add" ]
835,877
835,878
u517159683
ruby
p03024
a=gets.chomp.split('') puts (a.count('o') + (15 - a.count)) >= 8 ? 'Yes' : 'No'
a=gets.chomp.split('') puts (a.count('o') + (15 - a.count)) >= 8 ? 'YES' : 'NO'
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
836,308
836,309
u098870186
ruby
p03017
n,s=*$<;eval'N,A,B,C,D='+n.split*?,;puts D<C&&!s[B-2..D][?.*3]&&s[A...D][?#*2]?:No: :Yes
n,s=*$<;eval'N,A,B,C,D='+n.split*?,;puts D<C&&!s[B-2..D][?.*3]||s[A...D][?#*2]?:No: :Yes
[ "misc.opposites", "control_flow.branch.if.condition.change" ]
836,551
836,552
u283869437
ruby
p03017
eval"N,A,B,C,D="+gets.split*?, s=gets puts (s[A..C]+t=s[B-2..D])=~/##/||C>D&&t !~/\.{3}/?:No: :Yes
eval"N,A,B,C,D="+gets.split*?, gets puts ($_[A...C]+$_=$_[B-2..D])=~/##/||C>D&&!/\.{3}/?:No: :Yes
[ "control_flow.branch.if.condition.change", "assignment.variable.change", "assignment.value.change" ]
836,629
836,630
u657913472
ruby
p03017
eval"N,A,B,C,D="+gets.split*?, s=gets puts (s[A..C]+t=s[B-2..D])=~/##/||C>D&&t !~/\.{3}/?:No: :Yes
eval"N,A,B,C,D="+gets.split*?, s=gets puts (s[A...C]+t=s[B-2..D])=~/##/||C>D&&t !~/\.{3}/?:No: :Yes
[ "control_flow.branch.if.condition.change" ]
836,629
836,632
u657913472
ruby
p03017
eval"N,A,B,C,D="+gets.split*?, s=gets puts (s[A...C]+s[B-1..D])=~/##/||C>D&&s[B-1..D]!~/\.{3}/?:No: :Yes
eval"N,A,B,C,D="+gets.split*?, s=gets puts (s[A...C]+t=s[B-2..D])=~/##/||C>D&&t !~/\.{3}/?:No: :Yes
[ "control_flow.branch.if.condition.change", "literal.number.integer.change", "assignment.value.change", "variable_access.subscript.index.change" ]
836,633
836,632
u657913472
ruby
p03017
eval"N,A,B,C,D="+gets.split*?, s=gets puts (s[A...C]+s[B..D])=~/##/||C>D&&s[B..D]!~/\.{3}/?:No: :Yes
eval"N,A,B,C,D="+gets.split*?, s=gets puts (s[A...C]+t=s[B-2..D])=~/##/||C>D&&t !~/\.{3}/?:No: :Yes
[ "control_flow.branch.if.condition.change" ]
836,634
836,632
u657913472
ruby
p03017
eval"N,A,B,C,D="+gets.split*?, s=gets puts (s[A..C]+?A+s[B..D])=~/##/||C>D&&s[B-2..D+1]!~/\.{3}/?:No: :Yes
eval"N,A,B,C,D="+gets.split*?, s=gets puts (s[A...C]+t=s[B-2..D])=~/##/||C>D&&t !~/\.{3}/?:No: :Yes
[ "control_flow.branch.if.condition.change" ]
836,636
836,632
u657913472
ruby
p03017
eval"N,A,B,C,D="+gets.split*?, s=gets puts (s[A..C]+s[B..D])=~/##/||C>D&&s[B-2..D+1]!~/\.{3}/?:No: :Yes
eval"N,A,B,C,D="+gets.split*?, s=gets puts (s[A...C]+t=s[B-2..D])=~/##/||C>D&&t !~/\.{3}/?:No: :Yes
[ "control_flow.branch.if.condition.change" ]
836,637
836,632
u657913472
ruby
p03017
eval"N,A,B,C,D="+gets.split*?, s=gets puts (s[A...C]+s[B-1..D])=~/##/||C>D&&s[B-1..D]!~/\.{3}/?:No: :Yes
eval"N,A,B,C,D="+gets.split*?, s=gets puts (s[A...C]+s[B-2..D])=~/##/||C>D&&s[B-2..D]!~/\.{3}/?:No: :Yes
[ "literal.number.integer.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change" ]
836,633
836,638
u657913472
ruby
p03017
eval"N,A,B,C,D="+gets.split*?, s=gets puts (s[A...C]+s[B..D])=~/##/||C>D&&s[B..D]!~/\.{3}/?:No: :Yes
eval"N,A,B,C,D="+gets.split*?, s=gets puts (s[A...C]+s[B-2..D])=~/##/||C>D&&s[B-2..D]!~/\.{3}/?:No: :Yes
[ "control_flow.branch.if.condition.change" ]
836,634
836,638
u657913472
ruby
p03017
eval"N,A,B,C,D="+gets.split*?, s=gets puts (s[A..C]+?A+s[B..D])=~/##/||C>D&&s[B-2..D+1]!~/\.{3}/?:No: :Yes
eval"N,A,B,C,D="+gets.split*?, s=gets puts (s[A...C]+s[B-2..D])=~/##/||C>D&&s[B-2..D]!~/\.{3}/?:No: :Yes
[ "control_flow.branch.if.condition.change", "expression.operation.binary.remove" ]
836,636
836,638
u657913472
ruby
p03017
eval"N,A,B,C,D="+gets.split*?, s=gets puts (s[A..C]+s[B..D])=~/##/||C>D&&s[B-2..D+1]!~/\.{3}/?:No: :Yes
eval"N,A,B,C,D="+gets.split*?, s=gets puts (s[A...C]+s[B-2..D])=~/##/||C>D&&s[B-2..D]!~/\.{3}/?:No: :Yes
[ "control_flow.branch.if.condition.change" ]
836,637
836,638
u657913472
ruby
p03017
eval"N,A,B,C,D="+gets.split*?, s=gets puts (s[A..C]+?A+s[B..D])=~/##/||C>D&&s[B-2..D+1]!~/\.{3}/?:No: :Yes
eval"N,A,B,C,D="+gets.split*?, s=gets puts (s[A...C]+s[B..D])=~/##/||C>D&&s[B-2..D]!~/\.{3}/?:No: :Yes
[ "control_flow.branch.if.condition.change", "expression.operation.binary.remove" ]
836,636
836,639
u657913472
ruby
p03017
eval"N,A,B,C,D="+gets.split*?, s=gets puts (s[A..C]+s[B..D])=~/##/||C>D&&s[B-2..D+1]!~/\.{3}/?:No: :Yes
eval"N,A,B,C,D="+gets.split*?, s=gets puts (s[A...C]+s[B..D])=~/##/||C>D&&s[B-2..D]!~/\.{3}/?:No: :Yes
[ "control_flow.branch.if.condition.change" ]
836,637
836,639
u657913472
ruby
p03017
eval"N,A,B,C,D="+gets.split*?, s=gets puts (s[A..C]+?A+s[B..D])=~/##/||C>D&&s[B-2..D+1]!~/\.{3}/?:No: :Yes
eval"N,A,B,C,D="+gets.split*?, s=gets puts (s[A...C]+s[B...D])=~/##/||C>D&&s[B-2..D]!~/\.{3}/?:No: :Yes
[ "control_flow.branch.if.condition.change", "expression.operation.binary.remove" ]
836,636
836,640
u657913472
ruby
p03017
eval"N,A,B,C,D="+gets.split*?, s=gets puts (s[A..C]+s[B..D])=~/##/||C>D&&s[B-2..D+1]!~/\.{3}/?:No: :Yes
eval"N,A,B,C,D="+gets.split*?, s=gets puts (s[A...C]+s[B...D])=~/##/||C>D&&s[B-2..D]!~/\.{3}/?:No: :Yes
[ "control_flow.branch.if.condition.change" ]
836,637
836,640
u657913472
ruby
p03017
n, a, b, c, d = gets.strip.split.map(&:to_i) s = gets.strip.split("") s.insert(0,"0") if s[a,c-a+1].join.match(/.*##.*/) puts "No" exit end if s[b,d-b+1].join.match(/.*##.*/) puts "No" exit end if c < d puts "Yes" else if s[b-1,d-b+2].join.match(/.*\.\.\..*/) puts "Yes" else puts "No" end end
n, a, b, c, d = gets.strip.split.map(&:to_i) s = gets.strip.split("") s.insert(0,"0") if s[a,c-a+1].join.match(/.*##.*/) puts "No" exit end if s[b,d-b+1].join.match(/.*##.*/) puts "No" exit end if c < d puts "Yes" else if s[b-1,d-b+3].join.match(/.*\.\.\..*/) puts "Yes" else puts "No" end end
[ "literal.number.integer.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change" ]
836,926
836,927
u654590131
ruby
p03017
n, a, b, c, d = gets.split.map(&:to_i) ss = gets.split('').map{|e| e=='#' ? true : false} overlap = c > d f_single = false double_stone_flag = (ss[(a-1)..([c,d].max-1)].select{|e| f_double = f_single && e f_single = e f_double }).size.positive? f_single = false f_double = false triple_dots_flag = (ss[(b-1)..(d)].select{|e| f_triple = f_double && !e f_double = f_single && !e f_single = !e f_triple }).size.positive? if c < d puts double_stone_flag ? 'No' : 'Yes' else puts !double_stone_flag && triple_dots_flag ? 'Yes' : 'No' end
n, a, b, c, d = gets.split.map(&:to_i) ss = gets.split('').map{|e| e=='#' ? true : false} overlap = c > d f_single = false double_stone_flag = (ss[(a-1)..([c,d].max-1)].select{|e| f_double = f_single && e f_single = e f_double }).size.positive? f_single = false f_double = false triple_dots_flag = (ss[(b-2)..(d)].select{|e| f_triple = f_double && !e f_double = f_single && !e f_single = !e f_triple }).size.positive? if c < d puts double_stone_flag ? 'No' : 'Yes' else puts !double_stone_flag && triple_dots_flag ? 'Yes' : 'No' end
[ "literal.number.integer.change", "assignment.value.change", "variable_access.subscript.index.change", "expression.operation.binary.change" ]
837,004
837,005
u069429049
ruby
p03017
n, a, b, c, d = gets.split.map(&:to_i) ss = gets.split('').map{|e| e=='#' ? true : false} overlap = c > d f_single = false double_stone_flag = (ss[(b-1)..([c,d].max-1)].select{|e| f_double = f_single && e f_single = e f_double }).size.positive? f_single = false f_double = false triple_dots_flag = (ss[(b-1)..(d)].select{|e| f_triple = f_double && !e f_double = f_single && !e f_single = !e f_triple }).size.positive? if c < d puts double_stone_flag ? 'No' : 'Yes' else puts !double_stone_flag && triple_dots_flag ? 'Yes' : 'No' end
n, a, b, c, d = gets.split.map(&:to_i) ss = gets.split('').map{|e| e=='#' ? true : false} overlap = c > d f_single = false double_stone_flag = (ss[(a-1)..([c,d].max-1)].select{|e| f_double = f_single && e f_single = e f_double }).size.positive? f_single = false f_double = false triple_dots_flag = (ss[(b-2)..(d)].select{|e| f_triple = f_double && !e f_double = f_single && !e f_single = !e f_triple }).size.positive? if c < d puts double_stone_flag ? 'No' : 'Yes' else puts !double_stone_flag && triple_dots_flag ? 'Yes' : 'No' end
[ "assignment.value.change", "identifier.change", "variable_access.subscript.index.change", "expression.operation.binary.change", "literal.number.integer.change" ]
837,006
837,005
u069429049
ruby
p03017
n, a, b, c, d = gets.split.map(&:to_i) ss = gets.split('').map{|e| e=='#' ? true : false} overlap = c > d f_single = false double_stone_flag = (ss[(b-1)..([c,d].min-1)].select{|e| f_double = f_single && e f_single = e f_double }).size.positive? f_single = false f_double = false triple_dots_flag = (ss[(b-1)..(d-1)].select{|e| f_triple = f_double && !e f_double = f_single && !e f_single = !e f_triple }).size.positive? if c < d puts double_stone_flag ? 'No' : 'Yes' else puts !double_stone_flag && triple_dots_flag ? 'Yes' : 'No' end
n, a, b, c, d = gets.split.map(&:to_i) ss = gets.split('').map{|e| e=='#' ? true : false} overlap = c > d f_single = false double_stone_flag = (ss[(a-1)..([c,d].max-1)].select{|e| f_double = f_single && e f_single = e f_double }).size.positive? f_single = false f_double = false triple_dots_flag = (ss[(b-2)..(d)].select{|e| f_triple = f_double && !e f_double = f_single && !e f_single = !e f_triple }).size.positive? if c < d puts double_stone_flag ? 'No' : 'Yes' else puts !double_stone_flag && triple_dots_flag ? 'Yes' : 'No' end
[ "assignment.value.change", "identifier.change", "variable_access.subscript.index.change", "expression.operation.binary.change", "misc.opposites", "literal.number.integer.change", "expression.operation.binary.remove" ]
837,008
837,005
u069429049
ruby
p03017
n, a, b, c, d = gets.split.map(&:to_i) ss = gets.split('').map{|e| e=='#' ? true : false} overlap = c > d f_single = false double_stone_flag = (ss[(a-1)..([c,d].max-1)].select{|e| f_double = f_single && e f_single = e f_double }).size.positive? f_single = false f_double = false triple_dots_flag = (ss[(b-1)..(d)].select{|e| f_triple = f_double && !e f_double = f_single && !e f_single = !e f_triple }).size.positive? if c < d puts double_stone_flag ? 'No' : 'Yes' else puts !double_stone_flag && triple_dots_flag ? 'Yes' : 'No' end
n, a, b, c, d = gets.split.map(&:to_i) ss = gets.split('').map{|e| e=='#' ? true : false} overlap = c > d f_single = false double_stone_flag = (ss[(a-1)..([c,d].max-1)].select{|e| f_double = f_single && e f_single = e f_double }).size.positive? f_single = false f_double = false triple_dots_flag = (ss[(b-2)..(d)].select{|e| f_triple = f_double && !e f_double = f_single && !e f_single = !e f_triple }).size.positive? if c < d puts double_stone_flag ? 'No' : 'Yes' else puts !double_stone_flag && triple_dots_flag ? 'Yes' : 'No' end
[ "literal.number.integer.change", "assignment.value.change", "variable_access.subscript.index.change", "expression.operation.binary.change" ]
837,004
837,009
u069429049
ruby
p03017
n, a, b, c, d = gets.split.map(&:to_i) ss = gets.split('').map{|e| e=='#' ? true : false} overlap = c > d f_single = false double_stone_flag = (ss[(b-1)..([c,d].min-1)].select{|e| f_double = f_single && e f_single = e f_double }).size.positive? f_single = false f_double = false triple_dots_flag = (ss[(b-1)..(d)].select{|e| f_triple = f_double && !e f_double = f_single && !e f_single = !e f_triple }).size.positive? if c < d puts double_stone_flag ? 'No' : 'Yes' else puts !double_stone_flag && triple_dots_flag ? 'Yes' : 'No' end
n, a, b, c, d = gets.split.map(&:to_i) ss = gets.split('').map{|e| e=='#' ? true : false} overlap = c > d f_single = false double_stone_flag = (ss[(a-1)..([c,d].max-1)].select{|e| f_double = f_single && e f_single = e f_double }).size.positive? f_single = false f_double = false triple_dots_flag = (ss[(b-2)..(d)].select{|e| f_triple = f_double && !e f_double = f_single && !e f_single = !e f_triple }).size.positive? if c < d puts double_stone_flag ? 'No' : 'Yes' else puts !double_stone_flag && triple_dots_flag ? 'Yes' : 'No' end
[ "assignment.value.change", "identifier.change", "variable_access.subscript.index.change", "expression.operation.binary.change", "misc.opposites", "literal.number.integer.change" ]
837,007
837,009
u069429049
ruby
p03017
n, a, b, c, d = gets.split.map(&:to_i) ss = gets.split('').map{|e| e=='#' ? true : false} overlap = c > d f_single = false double_stone_flag = (ss[(b-1)..([c,d].min-1)].select{|e| f_double = f_single && e f_single = e f_double }).size.positive? f_single = false f_double = false triple_dots_flag = (ss[(b-1)..(d-1)].select{|e| f_triple = f_double && !e f_double = f_single && !e f_single = !e f_triple }).size.positive? if c < d puts double_stone_flag ? 'No' : 'Yes' else puts !double_stone_flag && triple_dots_flag ? 'Yes' : 'No' end
n, a, b, c, d = gets.split.map(&:to_i) ss = gets.split('').map{|e| e=='#' ? true : false} overlap = c > d f_single = false double_stone_flag = (ss[(a-1)..([c,d].max-1)].select{|e| f_double = f_single && e f_single = e f_double }).size.positive? f_single = false f_double = false triple_dots_flag = (ss[(b-2)..(d)].select{|e| f_triple = f_double && !e f_double = f_single && !e f_single = !e f_triple }).size.positive? if c < d puts double_stone_flag ? 'No' : 'Yes' else puts !double_stone_flag && triple_dots_flag ? 'Yes' : 'No' end
[ "assignment.value.change", "identifier.change", "variable_access.subscript.index.change", "expression.operation.binary.change", "misc.opposites", "literal.number.integer.change", "expression.operation.binary.remove" ]
837,008
837,009
u069429049
ruby
p03029
a, b = gets.chomp.split(" ").map(&:to_i) puts (a * 3 + p) / 2
a, b = gets.chomp.split(" ").map(&:to_i) puts (a * 3 + b) / 2
[ "identifier.change", "call.arguments.change", "expression.operation.binary.change" ]
837,451
837,452
u412789323
ruby
p03029
a, b = gets.split.map(&:to_i) puts (a + b * 3) / 2
a, b = gets.split.map(&:to_i) puts (a * 3 + b) / 2
[ "expression.operation.binary.remove" ]
837,518
837,519
u926099741
ruby
p03029
a,p=gets.split.map(&:to_i) R = a*3+p p (R/2.0).ceil
a,p=gets.split.map(&:to_i) R = a*3+p p R/2
[ "call.arguments.change", "expression.operation.binary.change", "call.remove" ]
837,664
837,665
u370564845
ruby
p03029
a,b = gets.split.map(&:to_i) puts (((a/3)+ b)/2)
a,b = gets.split.map(&:to_i) puts (((a*3)+ b)/2)
[ "expression.operator.arithmetic.change", "call.arguments.change", "expression.operation.binary.change" ]
837,735
837,736
u947090482
ruby
p03029
a,p = gets.chomp.split.map(&:to_i) puts [(a*3+p)/2].floor
a,p = gets.chomp.split.map(&:to_i) puts (a*3+p)/2
[ "call.arguments.change", "call.remove" ]
837,894
837,895
u303448696
ruby
p03029
A, P = gets.split.map(&:to_i) pieces = (A * 3) + P pie = (pieces / 3).floor puts(pie)
A, P = gets.split.map(&:to_i) pieces = (A * 3) + P pie = (pieces / 2).floor puts(pie)
[ "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.change" ]
838,135
838,136
u670006196
ruby
p03029
A, P = gets.split.map(&:to_i) pieces = A * 3 + P pie = (pieces / 3).floor print(pie)
A, P = gets.split.map(&:to_i) pieces = (A * 3) + P pie = (pieces / 2).floor puts(pie)
[ "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.change", "identifier.change" ]
838,137
838,136
u670006196
ruby
p03029
a, b = gets.split(" ").to_i sum = a * 3 + b print (sum / 2).floor
a, b = gets.split(" ").map(&:to_i) sum = a * 3 + b print (sum / 2).floor
[ "assignment.value.change", "identifier.change", "call.arguments.add" ]
838,169
838,170
u721689253
ruby
p03029
a, p = gets.split.map(&:to_i) a /= 3 puts (a + p) / 2
a, p = gets.split.map(&:to_i) a *= 3 puts (a+p) / 2
[ "expression.operator.change" ]
838,382
838,383
u326891688
ruby
p03030
z = 1 n = gets.to_i array = [] n.times do a,b = gets.split b.to_i array << [a,b,z] z += 1 end array.sort!{|a,b| a[1] <=> b[1]} array.reverse! array.sort!{|a,b| a[0] <=> b[0]} for i in 0..(n-1) puts array[i][2] end
z = 1 n = gets.to_i array = [] n.times do a,b = gets.split c = b.to_i array << [a,c,z] z += 1 end array.sort!{|a,b| a[1] <=> b[1]} array.reverse! array.sort!{|a,b| a[0] <=> b[0]} for i in 0..(n-1) puts array[i][2] end
[ "identifier.change", "expression.operation.binary.change" ]
839,104
839,105
u911373146
ruby
p03030
class Book < Array def initialize super end def sort_by_city! self.sort! { |a, b| (a.city == b.city).nonzero? || b.rate <=> a.rate } end end class Restaurant attr_reader :city, :rate, :original_number def initialize(city, rate, original_number) @city = city @rate = rate @original_number = original_number end end n = gets.chomp.to_i book = Book.new n.times do |i| city, rate = gets.chomp.split(" ") book.push(Restaurant.new(city, rate.to_i, i + 1)) end book.sort_by_city! book.each { |restaurant| puts restaurant.original_number }
class Book < Array def initialize super end def sort_by_city! self.sort! { |a, b| (a.city <=> b.city).nonzero? || b.rate <=> a.rate } end end class Restaurant attr_reader :city, :rate, :original_number def initialize(city, rate, original_number) @city = city @rate = rate @original_number = original_number end end n = gets.chomp.to_i book = Book.new n.times do |i| city, rate = gets.chomp.split(" ") book.push(Restaurant.new(city, rate.to_i, i + 1)) end book.sort_by_city! book.each { |restaurant| puts restaurant.original_number }
[ "expression.operator.compare.change", "expression.operation.binary.change" ]
839,284
839,285
u623402808
ruby
p03017
n,a,b,c,d = gets.chomp.split(" ").map(&:to_i) s = gets.chomp stop = [] (n-1).times do |i| if s[i] == '#' && s[i+1] == '#' stop.push(i) end end stop.each do |x| if (x+1 > a && x+2 < c) || (x+1 > b && x+2 < d) puts "No" exit end end if b < c && c < d puts "Yes" elsif b < c && c > d (b-1).upto(d-2) do |i| if s[i] == '.' && s[i+1] == '.' && s[i+2] == '.' puts "Yes" exit end end puts "No" else puts "Yes" end
n,a,b,c,d = gets.chomp.split(" ").map(&:to_i) s = gets.chomp stop = [] (n-1).times do |i| if s[i] == '#' && s[i+1] == '#' stop.push(i) end end stop.each do |x| if (x+1 > a && x+2 < c) || (x+1 > b && x+2 < d) puts "No" exit end end if b < c && c < d puts "Yes" elsif b < c && c > d (b-2).upto(d-2) do |i| if s[i] == '.' && s[i+1] == '.' && s[i+2] == '.' puts "Yes" exit end end puts "No" else puts "Yes" end
[ "literal.number.integer.change", "expression.operation.binary.change" ]
839,565
839,566
u265679940
ruby
p03017
n,a,b,c,d = gets.chomp.split(" ").map(&:to_i) s = gets.chomp stop = [] (n-1).times do |i| if s[i] == '#' && s[i+1] == '#' stop.push(i) end end stop.each do |x| if (x+1 > a && x+2 < c) || (x+1 > b && x+2 < d) puts "No" exit end end if b < c && c < d puts "Yes" elsif b < c && c > d (b-1).upto(d-3) do |i| if s[i] == '.' && s[i+1] == '.' && s[i+2] == '.' puts "Yes" exit end end puts "No" else puts "Yes" end
n,a,b,c,d = gets.chomp.split(" ").map(&:to_i) s = gets.chomp stop = [] (n-1).times do |i| if s[i] == '#' && s[i+1] == '#' stop.push(i) end end stop.each do |x| if (x+1 > a && x+2 < c) || (x+1 > b && x+2 < d) puts "No" exit end end if b < c && c < d puts "Yes" elsif b < c && c > d (b-2).upto(d-2) do |i| if s[i] == '.' && s[i+1] == '.' && s[i+2] == '.' puts "Yes" exit end end puts "No" else puts "Yes" end
[ "literal.number.integer.change", "expression.operation.binary.change", "call.arguments.change" ]
839,567
839,566
u265679940
ruby
p03017
n,a,b,c,d = gets.chomp.split(" ").map(&:to_i) s = gets.chomp stop = [] (n-1).times do |i| if s[i] == '#' && s[i+1] == '#' stop.push(i) end end stop.each do |x| if (x+1 > a && x+2 < c) || (x+1 > b && x+2 < d) puts "No" exit end end if b < c && c < d puts "Yes" elsif b < c && c > d (b-1).upto(d-1) do |i| if s[i] == '.' && s[i+1] == '.' && s[i+2] == '.' puts "Yes" exit end end puts "No" else puts "Yes" end
n,a,b,c,d = gets.chomp.split(" ").map(&:to_i) s = gets.chomp stop = [] (n-1).times do |i| if s[i] == '#' && s[i+1] == '#' stop.push(i) end end stop.each do |x| if (x+1 > a && x+2 < c) || (x+1 > b && x+2 < d) puts "No" exit end end if b < c && c < d puts "Yes" elsif b < c && c > d (b-2).upto(d-2) do |i| if s[i] == '.' && s[i+1] == '.' && s[i+2] == '.' puts "Yes" exit end end puts "No" else puts "Yes" end
[ "literal.number.integer.change", "expression.operation.binary.change", "call.arguments.change" ]
839,568
839,566
u265679940
ruby
p03017
class Move attr_accessor :a, :b # move a to b def initialize(a,b) @a = a @b = b raise "bad ord" if a >= b end def intersect(other) c,d = other.a,other.b return nil if b < d other end end # a = Move.new(1,10) # b = Move.new(5,12) # c = Move.new(4,2) # pp a.overwrap(b) # pp a.intersect(b) # pp a.exchange(b) # pp a.overwrap(c) # pp a.intersect(c) # pp a.exchange(c) class Problem attr_accessor :a, :b, :c, :d, :k, :n, :m, :h, :w, :s, :x, :y def initialize @n,@a,@b,@c,@d = gets.to_s.split.map{ |v| v.to_i } @s = gets.chomp end # 追い越しが無いなら、#が2個以上連続しなければよい # 追い越しがあるなら、上の条件に加えて、3つの連続した.が必要 def solve if d < c # 追い越しあり !has_double(a,c) && !has_double(b,d) && triple_space(a,c) else !has_double(a,c) && !has_double(b,d) end end def substr(a,b) a -= 1 b -= 1 s[a..b] end def has_double(a,b) substr(a, b) =~ /##/ end def triple_space(a,b) substr(a, b) =~ /\.\.\./ end def show(ans) puts ans ? "Yes" : "No" end end Problem.new.instance_eval do show(solve) end
class Move attr_accessor :a, :b # move a to b def initialize(a,b) @a = a @b = b raise "bad ord" if a >= b end def intersect(other) c,d = other.a,other.b return nil if b < d other end end # a = Move.new(1,10) # b = Move.new(5,12) # c = Move.new(4,2) # pp a.overwrap(b) # pp a.intersect(b) # pp a.exchange(b) # pp a.overwrap(c) # pp a.intersect(c) # pp a.exchange(c) class Problem attr_accessor :a, :b, :c, :d, :k, :n, :m, :h, :w, :s, :x, :y def initialize @n,@a,@b,@c,@d = gets.to_s.split.map{ |v| v.to_i } @s = gets.chomp end # 追い越しが無いなら、#が2個以上連続しなければよい # 追い越しがあるなら、上の条件に加えて、3つの連続した.が必要 def solve if d < c # 追い越しあり !has_double(a,c) && !has_double(b,d) && triple_space(b-1,d+1) else !has_double(a,c) && !has_double(b,d) end end def substr(a,b) a -= 1 b -= 1 s[a..b] end def has_double(a,b) substr(a, b) =~ /##/ end def triple_space(a,b) substr(a, b) =~ /\.\.\./ end def show(ans) puts ans ? "Yes" : "No" end end Problem.new.instance_eval do # pp s.index("##") # pp s.index("...") # pp s[64402,10] show(solve) end
[ "call.arguments.change", "expression.operation.binary.change" ]
839,603
839,604
u106964380
ruby
p03017
class Move attr_accessor :a, :b # move a to b def initialize(a,b) @a = a @b = b raise "bad ord" if a >= b end def intersect(other) c,d = other.a,other.b return nil if b < d other end end # a = Move.new(1,10) # b = Move.new(5,12) # c = Move.new(4,2) # pp a.overwrap(b) # pp a.intersect(b) # pp a.exchange(b) # pp a.overwrap(c) # pp a.intersect(c) # pp a.exchange(c) class Problem attr_accessor :a, :b, :c, :d, :k, :n, :m, :h, :w, :s, :x, :y def initialize @n,@a,@b,@c,@d = gets.to_s.split.map{ |v| v.to_i } @s = gets.chomp end # 追い越しが無いなら、#が2個以上連続しなければよい # 追い越しがあるなら、上の条件に加えて、3つの連続した.が必要 def solve if d < c # 追い越しあり !has_double(a,c) && !has_double(b,d) && triple_space(b,d) else !has_double(a,c) && !has_double(b,d) end end def substr(a,b) a -= 1 b -= 1 s[a..b] end def has_double(a,b) substr(a, b) =~ /##/ end def triple_space(a,b) substr(a, b) =~ /\.\.\./ end def show(ans) puts ans ? "Yes" : "No" end end Problem.new.instance_eval do # pp triple_space(b,d) # pp substr(b,d) # pp substr(b,d) =~ /\s\s\s/ show(solve) # pp has_double(2,5) # pp has_double(2,3) end
class Move attr_accessor :a, :b # move a to b def initialize(a,b) @a = a @b = b raise "bad ord" if a >= b end def intersect(other) c,d = other.a,other.b return nil if b < d other end end # a = Move.new(1,10) # b = Move.new(5,12) # c = Move.new(4,2) # pp a.overwrap(b) # pp a.intersect(b) # pp a.exchange(b) # pp a.overwrap(c) # pp a.intersect(c) # pp a.exchange(c) class Problem attr_accessor :a, :b, :c, :d, :k, :n, :m, :h, :w, :s, :x, :y def initialize @n,@a,@b,@c,@d = gets.to_s.split.map{ |v| v.to_i } @s = gets.chomp end # 追い越しが無いなら、#が2個以上連続しなければよい # 追い越しがあるなら、上の条件に加えて、3つの連続した.が必要 def solve if d < c # 追い越しあり !has_double(a,c) && !has_double(b,d) && triple_space(b-1,d+1) else !has_double(a,c) && !has_double(b,d) end end def substr(a,b) a -= 1 b -= 1 s[a..b] end def has_double(a,b) substr(a, b) =~ /##/ end def triple_space(a,b) substr(a, b) =~ /\.\.\./ end def show(ans) puts ans ? "Yes" : "No" end end Problem.new.instance_eval do # pp s.index("##") # pp s.index("...") # pp s[64402,10] show(solve) end
[ "expression.operation.binary.add" ]
839,605
839,604
u106964380
ruby
p03017
n,a,b,c,d = gets.split.map(&:to_i) s = gets.chomp ans = 'No' if c<d if !s[(a-1)..(c-1)].match(/\#\#/) && !s[(b-1)..(d-1)].match(/\#\#/) ans = 'Yes' end else if s[(b-3)..d].match(/\.\.\./) && !s[(a-1)..(c-1)].match(/\#\#/) ans = 'Yes' end end puts ans
n,a,b,c,d = gets.split.map(&:to_i) s = gets.chomp ans = 'No' if c<d if !s[(a-1)..(c-1)].match(/\#\#/) && !s[(b-1)..(d-1)].match(/\#\#/) ans = 'Yes' end else if s[(b-2)..d].match(/\.\.\./) && !s[(a-1)..(c-1)].match(/\#\#/) ans = 'Yes' end end puts ans
[ "literal.number.integer.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change" ]
839,989
839,990
u238956837
ruby
p03017
n,a,b,c,d = gets.split.map(&:to_i) s = gets.chomp ans = 'No' if c<d if !s[(a-1)..(c-1)].match(/\#\#/) && !s[(b-1)..(d-1)].match(/\#\#/) ans = 'Yes' end else if s[(a-1)..d].match(/\.\.\./) && !s[(a-1)..(c-1)].match(/\#\#/) ans = 'Yes' end end puts ans
n,a,b,c,d = gets.split.map(&:to_i) s = gets.chomp ans = 'No' if c<d if !s[(a-1)..(c-1)].match(/\#\#/) && !s[(b-1)..(d-1)].match(/\#\#/) ans = 'Yes' end else if s[(b-2)..d].match(/\.\.\./) && !s[(a-1)..(c-1)].match(/\#\#/) ans = 'Yes' end end puts ans
[ "identifier.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change", "literal.number.integer.change" ]
839,991
839,990
u238956837
ruby
p03030
n = gets.chomp.split(" ").map {|item| item.to_i } stores = [] n[0].times do |index| name, point = gets.chomp.split(" ") store = [name, point.to_i, index] stores.push(store) end stores.sort!{|a, b| comp_result = a[0][0].casecmp(b[0][0]) if comp_result == 0 b[1] <=> a[1] else comp_result end } stores.each do |store| puts store[2] + 1 end
n = gets.chomp.split(" ").map {|item| item.to_i } stores = [] n[0].times do |index| name, point = gets.chomp.split(" ") store = [name, point.to_i, index] stores.push(store) end stores.sort!{|a, b| comp_result = a[0].casecmp(b[0]) if comp_result == 0 b[1] <=> a[1] else comp_result end } stores.each do |store| puts store[2] + 1 end
[]
840,265
840,266
u182948299
ruby
p03030
n = gets.to_i Restaurant = Struct.new(:id, :city, :point) do include Comparable def <=>(other) result = self.city <=> other.city if result == 0 result = other.point <=> self.point end result end end restaurants = [] n.times do |i| s, p = gets.split(' ') restaurants << Restaurant.new(i+1, s, p) end restaurants.sort.map(&:id).each do |id| print "#{id}\n" end
n = gets.to_i Restaurant = Struct.new(:id, :city, :point) do include Comparable def <=>(other) result = self.city <=> other.city if result == 0 result = other.point <=> self.point end result end end restaurants = [] n.times do |i| s, p = gets.split(' ') restaurants << Restaurant.new(i+1, s, p.to_i) end restaurants.sort.map(&:id).each do |id| print "#{id}\n" end
[ "call.add" ]
840,281
840,282
u014968288
ruby
p03030
puts gets.to_i.times.map{|i| s,p = gets.split; [s, -p, i+1]}.sort.map{|x,y,z| z}
puts gets.to_i.times.map{|i| s,p = gets.split; [s, -p.to_i, i+1]}.sort.map{|x,y,z| z}
[ "call.add" ]
840,443
840,444
u056944756
ruby
p03030
n = gets.to_i c, p = n.times.map{gets.chomp.split}.transpose city = Array.new(0) for i in 0..(n-1) city.push(c[i]) end city.uniq! city.sort! city.each do |ci| po = Array.new(0) for i in 0..(n-1) if c[i] == ci po.push([p[i], i+1]) end end po.sort!{|n1, n2| n2[0] <=> n1[0]} po.each do |ar| puts ar[1] end end
n = gets.to_i c, p = n.times.map{gets.chomp.split}.transpose city = Array.new(0) for i in 0..(n-1) city.push(c[i]) end city.uniq! city.sort! city.each do |ci| po = Array.new(0) for i in 0..(n-1) if c[i] == ci po.push([p[i].to_i, i+1]) end end po.sort!{|n1, n2| n2[0] <=> n1[0]} po.each do |ar| puts ar[1] end end
[ "call.add" ]
840,581
840,582
u326891688
ruby
p03030
n = gets.to_i rs = [] names = [] n.times do |i| name, score = gets.split rs.push([name, score.to_i, i+1]) names.push(name) end names.uniq!.sort! names.each do |name| targets = rs.find_all { |i| i[0] == name } targets.sort! {|a, b| b[1] <=> a[1] } targets.each {|i| puts i[2] } end
n = gets.to_i rs = [] names = [] n.times do |i| name, score = gets.split rs.push([name, score.to_i, i+1]) names.push(name) end names.uniq! names.sort! names.each do |name| targets = rs.find_all { |i| i[0] == name } targets.sort! {|a, b| b[1] <=> a[1] } targets.each {|i| puts i[2] } end
[ "call.add" ]
840,594
840,595
u624505752
ruby
p03030
n = gets.to_i lss = [] n.times do |i| lss << gets.split.map(&:to_s) lss[i][2] = i + 1 end ls = lss.sort_by{|i| i[0]} p ls ans = [] n.times do |i| next if ls[i] == nil temp = [] j = i + 1 toshi = ls[i][0] temp << ls[i] if ls[j] == nil b = temp.sort_by{|i| i[1].to_i}.reverse b.each do |y| ans << y[2] end break end if toshi == ls[j][0] until toshi != ls[j][0] temp << ls[j] ls[j] = nil j += 1 break if ls[j] == nil end end b = temp.sort_by{|i| i[1].to_i}.reverse b.each do |y| ans << y[2] end end puts ans
n = gets.to_i lss = [] n.times do |i| lss << gets.split.map(&:to_s) lss[i][2] = i + 1 end ls = lss.sort_by{|i| i[0]} ans = [] n.times do |i| next if ls[i] == nil temp = [] j = i + 1 toshi = ls[i][0] temp << ls[i] if ls[j] == nil b = temp.sort_by{|i| i[1].to_i}.reverse b.each do |y| ans << y[2] end break end if toshi == ls[j][0] until toshi != ls[j][0] temp << ls[j] ls[j] = nil j += 1 break if ls[j] == nil end end b = temp.sort_by{|i| i[1].to_i}.reverse b.each do |y| ans << y[2] end end puts ans
[ "call.remove" ]
840,671
840,672
u296101474
ruby
p03031
n,m=gets.split.map(&:to_i) k=[] m.times do k<<gets.split.map(&:to_i) end p=gets.split.map(&:to_i) switch=0 ans=0 can=0 s=[0,1].repeated_permutation(n).to_a s.each do |s| can=0 m.times do |i| 1.upto(k[i][0]) do |j| switch+=s[k[i][j]-1] end if switch%2==p[i] can+=1 end end if can==m ans+=1 end end puts ans
n,m=gets.split.map(&:to_i) k=[] m.times do k<<gets.split.map(&:to_i) end p=gets.split.map(&:to_i) switch=0 ans=0 can=0 s=[0,1].repeated_permutation(n).to_a s.each do |s| can=0 m.times do |i| switch =0 1.upto(k[i][0]) do |j| switch+=s[k[i][j]-1] end if switch%2==p[i] can+=1 end end if can==m ans+=1 end end puts ans
[]
840,686
840,687
u556046719
ruby
p03031
n,m=gets.split.map(&:to_i) k=[] m.times do k<<gets.split.map(&:to_i) end p=gets.split.map(&:to_i) switch=0 ans=0 can=0 s=[0,1].repeated_permutation(n).to_a s.each do |s| can=0 m.times do |i| 1.upto(k[i][0]) do |j| switch+=s[k[i][j]-1] end if switch%2==p[i] can+=1 else break end end if can==m ans+=1 end end puts ans
n,m=gets.split.map(&:to_i) k=[] m.times do k<<gets.split.map(&:to_i) end p=gets.split.map(&:to_i) switch=0 ans=0 can=0 s=[0,1].repeated_permutation(n).to_a s.each do |s| can=0 m.times do |i| switch =0 1.upto(k[i][0]) do |j| switch+=s[k[i][j]-1] end if switch%2==p[i] can+=1 end end if can==m ans+=1 end end puts ans
[ "control_flow.break.remove" ]
840,688
840,687
u556046719
ruby
p03031
# https://atcoder.jp/contests/abc128/tasks/abc128_c MOD = 2 N, M = gets.split.map(&:to_i) bulbs_with_switches = [] M.times do bulbs_with_switches << gets.split.map(&:to_i) end ps = gets.split.map(&:to_i) ans = 0 (1..(2 ** N - 1)).each do |i| on_off_list = format("%0#{N}d", i.to_s(2)).chars off_switch_ids = [] on_off_list.each_with_index do |flg, idx| off_switch_ids << idx + 1 if flg == '0' end all_lighting = true bulbs_with_switches.each_with_index do |bulb_with_switches, idx| unless (bulb_with_switches[1..-1] - off_switch_ids).size % 2 == ps[idx] all_lighting = false break end end ans += 1 if all_lighting end puts ans
# https://atcoder.jp/contests/abc128/tasks/abc128_c MOD = 2 N, M = gets.split.map(&:to_i) bulbs_with_switches = [] M.times do bulbs_with_switches << gets.split.map(&:to_i) end ps = gets.split.map(&:to_i) ans = 0 (0..(2 ** N - 1)).each do |i| on_off_list = format("%0#{N}d", i.to_s(2)).chars off_switch_ids = [] on_off_list.each_with_index do |flg, idx| off_switch_ids << idx + 1 if flg == '0' end all_lighting = true bulbs_with_switches.each_with_index do |bulb_with_switches, idx| unless (bulb_with_switches[1..-1] - off_switch_ids).size % 2 == ps[idx] all_lighting = false break end end ans += 1 if all_lighting end puts ans
[ "literal.number.integer.change" ]
841,519
841,520
u019986937
ruby
p03031
n, m = gets.strip.split.map(&:to_i) k = [] s = [] m.times do |i| s[i] = gets.chomp.split.map(&:to_i) k[i] = s[i].shift end p = gets.strip.split.map.map(&:to_i) ans = 0 # スイッチの組み合わせ全てを試す 最大で2^10 = 1024回 [0,1].repeated_permutation(n) do |a| flag = false # 電球全てを巡回 m.times do |i| tmp = 0 # 電球に繋がっているスイッチを巡回 s[i].each do |t| # スイッチがオンになっているとき、tmpに1を足す tmp += a[t-1] end # ついている電球を2で割った値が、p[i]と一致していないとき、すなわち電球がついていないときflagをtrueに if tmp % 2 != p[i] flg = true break end end # flagがtrueの時、すなわち電球がついていない時にans += 1を実行せず次に進む  # 電球がついている時、flag=falseの時ans += 1を実行する next if flg ans += 1 end puts ans
n, m = gets.chomp.split.map(&:to_i) k = [] s = [] m.times do |i| s[i] = gets.chomp.split.map(&:to_i) k[i] = s[i].shift end p = gets.chomp.split.map(&:to_i) ans = 0 # スイッチの組み合わせ全てを試す 最大で2^10 = 1024回 [0,1].repeated_permutation(n) do |a| flag = false # 電球全てを巡回 m.times do |i| tmp = 0 # 電球に繋がっているスイッチを巡回 s[i].each do |t| # スイッチがオンになっているとき、tmpに1を足す tmp += a[t-1] end # ついている電球を2で割った値が、p[i]と一致していないとき、すなわち電球がついていないときflagをtrueに if tmp % 2 != p[i] flag = true break end end # flagがtrueの時、すなわち電球がついていない時にans += 1を実行せず次に進む  # 電球がついている時、flag=falseの時ans += 1を実行する next if flag ans += 1 end puts ans
[ "assignment.value.change", "identifier.change", "call.remove", "assignment.variable.change", "control_flow.branch.if.condition.change" ]
841,582
841,583
u913209852
ruby
p03031
require 'pp' n, m = gets.split.map(&:to_i) s = [] m.times do _, *si = gets.split.map(&:to_i) si.map! { |x| x - 1 } s << si end pika = gets.split.map(&:to_i) ans = 0 (1 << n).times do |i| flag = true m.times do |j| t = s[j].map { |si| i[si] }.inject(:+) if pika[j] == t % 2 flag = false break end end ans += 1 if flag end p ans
require 'pp' n, m = gets.split.map(&:to_i) s = [] m.times do _, *si = gets.split.map(&:to_i) si.map! { |x| x - 1 } s << si end pika = gets.split.map(&:to_i) ans = 0 (1 << n).times do |i| flag = true m.times do |j| t = s[j].map { |si| i[si] }.inject(:+) if pika[j] != t % 2 flag = false break end end ans += 1 if flag end p ans
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
841,734
841,735
u706695185
ruby
p03031
N, M = gets.chomp.split().map(&:to_i) SWITCHES = M.times.map { gets.split().map(&:to_i) } FLAGS = gets.chomp.split().map(&:to_i) def all_on?(comb) ct = 0 m = -1 SWITCHES.all? do |a, *s| s.each do |s| ct += 1 if comb[s-1] end m += 1 ct % 2 == FLAGS[m] end end ans = 0 [true, false].repeated_permutation(N).each do |comb| ans += 1 if all_on?(comb) end puts ans
N, M = gets.chomp.split().map(&:to_i) SWITCHES = M.times.map { gets.split().map(&:to_i) } FLAGS = gets.chomp.split().map(&:to_i) def all_on?(comb) m = -1 SWITCHES.all? do |a, *s| ct = 0 s.each do |s| ct += 1 if comb[s-1] end m += 1 ct % 2 == FLAGS[m] end end ans = 0 [true, false].repeated_permutation(N).each do |comb| ans += 1 if all_on?(comb) end puts ans
[ "assignment.remove", "assignment.add" ]
841,854
841,855
u541032448
ruby
p03031
n,m = $stdin.gets.split.map(&:to_i) ary = [] k = [] m.times do |i| k[i] = $stdin.getc.to_i ary[i] = $stdin.gets.split.map(&:to_i) end p = $stdin.gets.split.map(&:to_i) result = 0 (2**n).times do |i| i = i.to_s(2) flg = false m.times do |j| if flg break end xor = 0 k[j].times do |l| xor ^= i[ary[j][l]-1].to_i end if xor != p[j] flg = true break end end if !flg result += 1 end end puts result
n,m = $stdin.gets.split.map(&:to_i) ary = [] k = [] m.times do |i| k[i] = $stdin.getc.to_i ary[i] = $stdin.gets.split.map(&:to_i) end p = $stdin.gets.split.map(&:to_i) result = 0 (2**n).times do |i| i = i.to_s(2).rjust(n) flg = false m.times do |j| if flg break end xor = 0 k[j].times do |l| xor ^= i[ary[j][l]-1].to_i end if xor != p[j] flg = true break end end if !flg result += 1 end end puts result
[ "call.add" ]
841,995
841,996
u622469330
ruby
p03032
n,k=gets.split.map(&:to_i) v=gets.split.map(&:to_i) p (0..[n,k].min).map{|a| (0..[n,k-a].min).map{|b| l = (v[0,a]+v[-b,b]).sort drop_cnt = k-a-b l.drop_while{|i| (i<=0) && ((drop_cnt-=1)>=0) }.inject(:+)||0 }.max }.max
n,k=gets.split.map(&:to_i) v=gets.split.map(&:to_i) p (0..[n,k].min).map{|a| (0..[n-a,k-a].min).map{|b| l = (v[0,a]+v[-b,b]).sort drop_cnt = k-a-b l.drop_while{|i| (i<=0) && ((drop_cnt-=1)>=0) }.inject(:+)||0 }.max }.max
[ "expression.operation.binary.add" ]
842,643
842,644
u353917577
ruby
p03031
N,M = gets.split.map(&:to_i) # switches, lights L = Array.new(M + 1) (1 .. M).map{|i| k,*c = gets.split.map(&:to_i); L[i] = [k, c] } P = Array.new(N + 1) gets.split.map(&:to_i).each.with_index(1){|parity,j| P[j] = parity } ans = (1 << N).times.count do |sw| (1 .. M).each do |m| k, c = L[m] c.count{|i| sw[i - 1] == 1 } % 2 == P[m] end end puts ans
N,M = gets.split.map(&:to_i) # switches, lights L = Array.new(M + 1) (1 .. M).map{|i| k,*c = gets.split.map(&:to_i); L[i] = [k, c] } P = Array.new(N + 1) gets.split.map(&:to_i).each.with_index(1){|parity,j| P[j] = parity } ans = (1 << N).times.count do |sw| (1 .. M).all? do |m| k, c = L[m] c.count{|i| sw[i - 1] == 1 } % 2 == P[m] end end puts ans
[ "assignment.value.change", "identifier.change" ]
843,150
843,151
u819939299
ruby
p03032
n, k = gets.chomp.split(' ').map(&:to_i) v = gets.chomp.split(' ').map(&:to_i) pat = [] for j in 0..k for i in 0..j tmp_v = v.dup item = [] i.times do item << tmp_v.shift end (j-i).times do item << tmp_v.pop end item.compact! item.sort! if item.count > 0 (k-j).times do if item[0] < 0 item.shift end break if item.count == 0 end end p item pat << item.inject(:+) end end pat.compact! pat << 0 p pat.max
n, k = gets.chomp.split(' ').map(&:to_i) v = gets.chomp.split(' ').map(&:to_i) pat = [] for j in 0..k for i in 0..j tmp_v = v.dup item = [] i.times do item << tmp_v.shift end (j-i).times do item << tmp_v.pop end item.compact! item.sort! if item.count > 0 (k-j).times do if item[0] < 0 item.shift end break if item.count == 0 end end pat << item.inject(:+) end end pat.compact! pat << 0 p pat.max
[ "call.remove" ]
843,840
843,841
u906574460
ruby
p03032
n, k = gets.split.map(&:to_i) $v = gets.split.map(&:to_i) ans = 0 def calc(l, r, k, n) k -= (l + r) return -1 if k < 0 && (l + r) > n tmp = $v[0, l] + $v[-r, r] tmp.sort! k = [k, tmp.size].min res = 0 tmp.each { |x| res += x } k.times do |i| res -= tmp[i] if tmp[i] < 0 end res end (0..k).each do |l| (0..k).each do |r| ans = [ans, calc(l, r, k, n)].max end end puts ans
n, k = gets.split.map(&:to_i) $v = gets.split.map(&:to_i) ans = 0 def calc(l, r, k, n) k -= (l + r) return -1 if k < 0 || (l + r) > n tmp = $v[0, l] + $v[-r, r] tmp.sort! k = [k, tmp.size].min res = 0 tmp.each { |x| res += x } k.times do |i| res -= tmp[i] if tmp[i] < 0 end res end (0..k).each do |l| (0..k).each do |r| ans = [ans, calc(l, r, k, n)].max end end puts ans
[ "misc.opposites", "control_flow.branch.if.condition.change" ]
844,218
844,220
u415041731
ruby
p03035
A, B = gets.chomp.split.map(&:to_i) if A >= 13 puts B elsif 6 <= A <= 12 puts B / 2 else puts 0 end
A, B = gets.chomp.split.map(&:to_i) if A >= 13 puts B elsif 6 <= A && A <= 12 puts B / 2 else puts 0 end
[ "control_flow.branch.if.condition.change" ]
845,334
845,335
u920244601
ruby
p03035
a,b = gets.chomp.split.map(&:to_i) if a>13 p b elsif a>6 p b/2 else p 0 end
a,b = gets.chomp.split.map(&:to_i) if a>=13 p b elsif a>=6 p b/2 else p 0 end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
845,647
845,648
u891258088
ruby
p03035
a,b=gets.chomp.split().map(&:to_i) if a>=13 puts b elsif a<=5 puts b/2 else puts 0 end
a,b=gets.chomp.split().map(&:to_i) if a>=13 puts b elsif a<=5 puts 0 else puts b/2 end
[ "call.add", "call.remove" ]
845,786
845,787
u723583932
ruby
p03035
a, b = gets.strip.split.map(&:to_i) if a >= 13 puts b.to_s elsif a> 6 puts (b/2).to_s else puts '0' end
a, b = gets.strip.split.map(&:to_i) if a >= 13 puts b.to_s elsif a>= 6 puts (b/2).to_s else puts '0' end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
846,144
846,145
u913209852
ruby
p03035
a,b = gets.split.map(&:to_i) p a < 13 ? a < 5 ? 0 : b/2 : b
a,b = gets.split.map(&:to_i) p a < 13 ? a <= 5 ? 0 : b/2 : b
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
846,426
846,427
u562082015
ruby
p03035
a,b=gets.strip.split.map(&:to_i) puts 13<=a ? b : b<=5 ? 0 : b/2
a,b=gets.strip.split.map(&:to_i) puts 13<=a ? b : a<=5 ? 0 : b/2
[ "identifier.change", "control_flow.branch.if.condition.change" ]
846,769
846,770
u172873334
ruby
p03035
a, b = gets.chomp.split(" ").map(&:to_i) if a <= 5 b = 0 elsif a < 13 b = b * 0.5 end puts b
a, b = gets.chomp.split(" ").map(&:to_i) if a <= 5 b = 0 elsif a < 13 b = b * 0.5 end puts b.to_i
[ "call.add" ]
846,777
846,778
u512524057
ruby
p03035
a,b = gets.split.map(&:to_i) if a >= 13 puts b elsif a >= 6 and a <= 12 puts b/2 elsif a < 5 puts 0 end
a,b = gets.split.map(&:to_i) if a >= 13 puts b elsif a >= 6 and a <= 12 puts b/2 elsif a <= 5 puts 0 end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
846,820
846,821
u012110567
ruby
p03035
a,b = gets.split.map(&:to_i) if a >= 13 puts b elsif a >= 6 && a <= 12 puts b/2 elsif a < 5 puts 0 end
a,b = gets.split.map(&:to_i) if a >= 13 puts b elsif a >= 6 and a <= 12 puts b/2 elsif a <= 5 puts 0 end
[ "control_flow.branch.if.condition.change", "expression.operator.compare.change" ]
846,822
846,821
u012110567
ruby
p03035
a,b = gets.split.map(&:to_i) if a >= 13 puts (b) elsif a >= 6 && a <= 12 puts (b/2) elsif a < 5 puts 0 end
a,b = gets.split.map(&:to_i) if a >= 13 puts b elsif a >= 6 and a <= 12 puts b/2 elsif a <= 5 puts 0 end
[ "call.arguments.change", "control_flow.branch.if.condition.change", "expression.operator.compare.change" ]
846,823
846,821
u012110567
ruby
p03035
a,b = gets.split.map(&:to_i) if a >= 13 puts b elsif a >= 6 and a <= 12 puts b/2 elsif a < 5 puts 0 end
a,b = gets.split.map(&:to_i) if a >= 13 puts b elsif a >= 6 and a <= 12 puts b/2 else puts 0 end
[ "expression.operation.binary.remove" ]
846,820
846,824
u012110567
ruby
p03035
a,b = gets.split.map(&:to_i) if a >= 13 puts b elsif a >= 6 && a <= 12 puts b/2 elsif a < 5 puts 0 end
a,b = gets.split.map(&:to_i) if a >= 13 puts b elsif a >= 6 and a <= 12 puts b/2 else puts 0 end
[ "control_flow.branch.if.condition.change", "expression.operation.binary.remove" ]
846,822
846,824
u012110567
ruby
p03035
a, b = gets.split.map(&:to_i) a > 12 ? b : (a > 5 ? b/2 : 0)
a, b = gets.split.map(&:to_i) puts a>12 ? b : a>5 ? b/2 : 0
[ "io.output.change", "call.add" ]
846,861
846,862
u679291177
ruby
p03035
A,B = gets.split.map(&:to_i) if A<5 puts 0 elsif A >=6 && A<=12 puts B/2 else puts B end
A,B = gets.split.map(&:to_i) if A<=5 puts 0 elsif A >=6 && A<=12 puts B/2 else puts B end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
846,945
846,946
u467484398
ruby
p03035
a, b = gets.chomp.split(" ").map(&:to_i) fee = if a <= 5 b elsif a >= 6 && a <= 12 0 elsif a >= 13 b / 2 end puts fee
a, b = gets.chomp.split(" ").map(&:to_i) fee = if a <= 5 0 elsif a >= 6 && a <= 12 b / 2 elsif a >= 13 b end puts fee
[ "assignment.value.change", "identifier.replace.remove", "literal.replace.add", "identifier.replace.add", "literal.replace.remove", "expression.operation.binary.remove" ]
847,001
847,002
u623402808
ruby
p03035
input = gets.split(" ").map(&:to_i) if input[0] >= 13 puts input[1] elsif input[0] >= 6 puts input[1] / 2 else puts input[1] / 4 end
input = gets.split(" ").map(&:to_i) if input[0] >= 13 puts input[1] elsif input[0] >= 6 puts input[1] / 2 else puts 0 end
[ "identifier.replace.remove", "literal.replace.add", "call.arguments.change", "expression.operation.binary.change", "expression.operation.binary.remove" ]
847,177
847,178
u440194113
ruby
p03035
old,price=gets.chomp.split(" ").map{|n|n.to_i} if old>=12 then puts price elsif old>=6 then puts price/2 else puts 0 end
old,price=gets.chomp.split(" ").map{|n|n.to_i} if old>=13 then puts price elsif old>=6 then puts price/2 else puts 0 end
[ "literal.number.integer.change", "control_flow.branch.if.condition.change" ]
847,233
847,234
u606976120
ruby
p03035
a, b = gets.strip.split.map(&:to_i) if a <= 5 puts 0 elsif a <= 12 puts b / 2 else puts a end
a, b = gets.strip.split.map(&:to_i) if a <= 5 puts 0 elsif a <= 12 puts b / 2 else puts b end
[ "identifier.change", "call.arguments.change" ]
847,432
847,433
u367259152
ruby
p03035
a,b=gets.split.map(&:to_i) if a>=13 puts b elsif a<5 puts 0 else puts b/2 end
a,b=gets.split.map(&:to_i) if a>=13 puts b elsif a<=5 puts 0 else puts b/2 end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
847,508
847,509
u602591412
ruby
p03035
a = gets.chomp.split(" ").map(&:to_i) if a[0] >= 13 puts a[1] elsif a[0] >= 6 && a[0] <= 12 puts a[1] / 2 else puts a[1] end
a = gets.chomp.split(" ").map(&:to_i) if a[0] >= 13 puts a[1] elsif a[0] >= 6 && a[0] <= 12 puts a[1] / 2 else puts 0 end
[ "identifier.replace.remove", "literal.replace.add", "call.arguments.change" ]
847,637
847,638
u023473244
ruby
p03035
a = gets.chomp.split(" ").map(&:to_i) if a[0] >= 13 puts a[1] elsif a[0] >= 6 && a[1] <= 12 puts a[1] / 2 else puts a[1] end
a = gets.chomp.split(" ").map(&:to_i) if a[0] >= 13 puts a[1] elsif a[0] >= 6 && a[0] <= 12 puts a[1] / 2 else puts 0 end
[ "literal.number.integer.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change", "identifier.replace.remove", "literal.replace.add", "call.arguments.change" ]
847,639
847,638
u023473244
ruby
p03035
A,B = gets.split(" ").map(&:to_i) if A <= 5 puts 0 elsif A >= 6 && A <= 12 puts B / 2 else puts b end
A,B = gets.split(" ").map(&:to_i) if A <= 5 puts 0 elsif A >= 6 && A <= 12 puts B / 2 else puts B end
[ "call.arguments.change" ]
847,733
847,734
u538351278
ruby
p03035
line = gets.chomp n1,n2 = line.split.map(&:to_i) if n1 <= 6 puts 0 elsif n1 <= 12 puts n2/2 else puts n2 end
line = gets.chomp n1,n2 = line.split.map(&:to_i) if n1 <= 5 puts 0 elsif n1 <= 12 puts n2/2 else puts n2 end
[ "literal.number.integer.change", "control_flow.branch.if.condition.change" ]
847,800
847,801
u910016508
ruby
p03035
A, B = gets.split(" ").map(&:to_i) if A >= 13 puts B elsif A > 6 puts B / 2 else puts 0 end
A, B = gets.split(" ").map(&:to_i) if A >= 13 puts B elsif A >= 6 puts B / 2 else puts 0 end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
847,940
847,941
u579651661
ruby
p03035
a, b = gets.split.map(&:to_i) if a > 12 puts b elsif a >= 5 puts b / 2 else puts 0 end
a, b = gets.split.map(&:to_i) if a > 12 puts b elsif a >= 6 puts b / 2 else puts 0 end
[ "literal.number.integer.change", "control_flow.branch.if.condition.change" ]
847,970
847,971
u757568397
ruby
p03035
a, b = gets.strip.split.map(&:to_i) result = 0 result = if a >= 13 b elsif a >= 6 b/2 end puts result
a, b = gets.strip.split.map(&:to_i) result = if a >= 13 b elsif a >= 6 b/2 else 0 end puts result
[ "assignment.remove" ]
848,038
848,039
u021358975
ruby
p03035
a,b=gets.split.map(&:to_i) if a<6 puts 0 elsif a<13 puts b/2 else putsb end
a,b=gets.split.map(&:to_i) if a<6 puts 0 elsif a<13 puts b/2 else puts b end
[ "call.arguments.change" ]
848,233
848,234
u987183622
ruby
p03035
a, b = gets.chomp.split(" ").map(&:to_i) if a > 12 puts b elsif a > 6 && a < 13 puts b/2 else puts 0 end
a, b = gets.chomp.split(" ").map(&:to_i) if a > 12 puts b elsif a > 5 && a < 13 puts b/2 else puts 0 end
[ "literal.number.integer.change", "control_flow.branch.if.condition.change" ]
848,262
848,263
u126541218
ruby
p03036
r,d,x=gets.split.map(&:to_i) i=0 while i<11 x=r*x-d puts x i+=1 end
r,d,x=gets.split.map(&:to_i) i=0 while i<10 x=r*x-d puts x i+=1 end
[ "literal.number.integer.change", "expression.operation.binary.change" ]
848,803
848,804
u590472228
ruby
p03036
r, d, x = gets.split.map(&:to_i) sum = x d.times do puts sum = r*sum-d end
r, d, x = gets.split.map(&:to_i) sum = x 10.times do puts sum = r*sum-d end
[ "identifier.replace.remove", "literal.replace.add" ]
848,948
848,949
u514143079
ruby
p03036
r,d,x=gets.chomp.split.map(&:to_i) 10.times{ x=r*x-d puts r*x-d }
r,d,x=gets.chomp.split.map(&:to_i) 10.times{ x=r*x-d puts x }
[ "call.remove", "expression.operation.binary.remove" ]
848,997
848,998
u585819925
ruby
p03036
r,d,x = gets.chomp.split(" ").map{|x|x.to_i} ar=Array.new ar[1]=x for i in 1..10 ar[i+1] = ar[i]*r-d puts ar[i] end
r,d,x = gets.chomp.split(" ").map{|x|x.to_i} ar=Array.new ar[1]=x for i in 1..10 ar[i+1] = ar[i]*r-d puts ar[i+1] end
[ "expression.operation.binary.add" ]
849,160
849,161
u926099741
ruby
p03036
r, D, x=gets.chomp.split(" ").map(&:to_i); y=0 while y<9 x = r * x - D puts x y = y+1 end
r, D, x=gets.chomp.split(" ").map(&:to_i); y=0 while y<10 x = r * x - D puts x y = y+1 end
[ "literal.number.integer.change", "expression.operation.binary.change" ]
849,371
849,372
u602984196
ruby
p03036
r, D, x=gets.chomp.split(" ").map(&:to_i); y=0 while y<9 x = rx - D puts x y = y+1 end
r, D, x=gets.chomp.split(" ").map(&:to_i); y=0 while y<10 x = r * x - D puts x y = y+1 end
[ "literal.number.integer.change", "expression.operation.binary.change", "assignment.value.change", "identifier.change" ]
849,373
849,372
u602984196
ruby