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
9 values
p02829
a=`dd`.split.map &:to_i;p [1,2,3]-a
a=`dd`.split.map &:to_i;p *[1,2,3]-a
[ "call.arguments.change" ]
629,815
629,816
u280667879
ruby
p02829
a = gets.to_i b = gets.to_i array = [1,2,3] array.each do |ary| if a == ary break elsif b == ary break else puts ary end end
a = gets.to_i b = gets.to_i array = [1,2,3] array.each do |ary| if a == ary elsif b == ary else puts ary end end
[ "control_flow.break.remove" ]
629,925
629,926
u322744344
ruby
p02829
a = gets.to_i b = gets.to_i l = [1, 2, 3] l.delete!(a) l.delete!(b) puts l[0]
a = gets.to_i b = gets.to_i l = [1, 2, 3] l.delete(a) l.delete(b) puts l[0]
[ "identifier.change" ]
629,935
629,936
u403537991
ruby
p02829
answer = [1,2,3] a = get.chomp.to_i b = get.chomp.to_i answer.delete(a) answer.delete(b) puts answer[0]
answer = [1,2,3] a = gets.to_i b = gets.to_i answer.delete(a) answer.delete(b) puts answer[0]
[ "assignment.value.change", "identifier.change", "call.remove" ]
629,968
629,969
u022164890
ruby
p02829
answer = [1,2,3] a = get.to_i b = get.to_i answer.delete(a) answer.delete(b) puts answer[0]
answer = [1,2,3] a = gets.to_i b = gets.to_i answer.delete(a) answer.delete(b) puts answer[0]
[ "assignment.value.change", "identifier.change" ]
629,970
629,969
u022164890
ruby
p02829
a=gets.to_i b=gets.to_i puts = 6-(a+b)
a=gets.to_i b=gets.to_i puts 6-(a+b)
[]
630,011
630,012
u198327355
ruby
p02829
require 'set' wrong = (1..2).map { gets.chomp.to_i } (Set.new([1,2,3]) - Set.new(wrong)).first
require 'set' wrong = (1..2).map { gets.chomp.to_i } puts (Set.new([1,2,3]) - Set.new(wrong)).first
[ "io.output.change", "call.add" ]
630,056
630,057
u980438307
ruby
p02829
total=6 a=inputs.to_i b=inputs.to_i puts total-a-b
total=6 a=gets.to_i b=gets.to_i puts total-a-b
[ "assignment.value.change", "identifier.change" ]
630,096
630,097
u562148988
ruby
p02829
total=6 a=inputs.to_i b=inputs.to_i print 6-a-b
total=6 a=gets.to_i b=gets.to_i puts total-a-b
[ "assignment.value.change", "identifier.change" ]
630,098
630,097
u562148988
ruby
p02829
a = gets.to_i b = gets.to_i puts [1, 2, 3].delete(a).delete(b).join
a = gets.to_i b = gets.to_i ary = [1, 2, 3] ary.delete(a) ary.delete(b) puts ary.join
[ "assignment.variable.change", "call.add" ]
630,118
630,119
u785521224
ruby
p02829
#!/usr/bin/env ruby inputArr = [] inputArr.push(gets.chomp.to_i).push(gets.chomp.to_i) ans = [1, 2, 3] p ans - inputArr
#!/usr/bin/env ruby inputArr = [] inputArr.push(gets.chomp.to_i).push(gets.chomp.to_i) ans = [1, 2, 3] puts (ans - inputArr)
[ "call.function.change", "io.output.change", "call.arguments.change" ]
630,192
630,193
u331086044
ruby
p02830
N = gets.to_i S, T = gets.chomp.split ans = [] N.times do |i| ans << S[i] ans << T[i] ## S, T の順番で足されていく end puts ans
N = gets.to_i S, T = gets.chomp.split ans = "" N.times do |i| ans << S[i] ans << T[i] ## S, T の順番で足されていく end puts ans
[]
630,636
630,637
u552761221
ruby
p02830
_,a.b=`dd`.split;puts a.chars.zip(b.chars).join
_,a,b=`dd`.split;puts a.chars.zip(b.chars).join
[ "misc.typo", "assignment.variable.change" ]
630,797
630,798
u280667879
ruby
p02830
n = gets.to_i s, t = gets.split(' ') answer = "" n.times.each do |i| answer += answer + s[i] + t[i] end puts answer
n = gets.to_i s, t = gets.split(' ') answer = "" n.times.each do |i| answer += s[i] + t[i] end puts answer
[ "expression.operation.binary.remove" ]
630,872
630,873
u509036258
ruby
p02830
N = gets.to_i words = gets.split(' ') answer = "" for i in 0..words.length-1 do words.each do |w| answer += w[i] end end puts answer
N = gets.to_i words = gets.split(' ') answer = "" for i in 0..N-1 do words.each do |w| answer += w[i] end end puts answer
[ "expression.operation.binary.change", "call.remove" ]
630,896
630,897
u808757777
ruby
p02830
gets; puts gets.chomp.split.map &:chars.transpose.join
gets; puts gets.chomp.split.map(&:chars).transpose.join
[ "call.arguments.change" ]
631,037
631,038
u785521224
ruby
p02830
gets; puts gets.chomp.split.mmap &:chars.transpose.join
gets; puts gets.chomp.split.map(&:chars).transpose.join
[ "identifier.change", "call.arguments.change", "io.output.change" ]
631,039
631,038
u785521224
ruby
p02830
gets; gets.chomp.split.map(&:chars).transpose.join
gets; puts gets.chomp.split.map(&:chars).transpose.join
[ "io.output.change", "call.add" ]
631,040
631,038
u785521224
ruby
p02830
gets; gets.chomp.split.chars.transpose.join
gets; puts gets.chomp.split.map(&:chars).transpose.join
[ "io.output.change", "call.add", "identifier.change", "call.arguments.add" ]
631,041
631,038
u785521224
ruby
p02830
def get_int gets.chop.to_i end def get_ints gets.chop.split.map(&:to_i) end def get_double gets.chop.to_f end def get_str gets.chop end def get_strs gets.chop.split end def main n = get_int s = get_str t = get_str chars = [] 0.upto(n-1) do |i| chars << s[i] chars << t[i] end puts chars.join("") end if __FILE__ == $0 main end
def get_int gets.chop.to_i end def get_ints gets.chop.split.map(&:to_i) end def get_double gets.chop.to_f end def get_str gets.chop end def get_strs gets.chop.split end def main n = get_int s, t = get_strs chars = [] 0.upto(n-1) do |i| chars << s[i] chars << t[i] end puts chars.join("") end if __FILE__ == $0 main end
[ "assignment.variable.change", "assignment.value.change", "identifier.change" ]
631,044
631,045
u064061804
ruby
p02830
n = gets.to_i s, t = gets.split.map(&:to_s) new = [] (0..n-1).each do |i| new[i * 2] = s[i] new[(i * 2) + 1] = t[i] end p new.join
n = gets.to_i s, t = gets.split.map(&:to_s) new = [] (0..n-1).each do |i| new[i * 2] = s[i] new[(i * 2) + 1] = t[i] end puts new.join
[ "call.function.change", "io.output.change" ]
631,167
631,168
u751934765
ruby
p02830
N = gets.to_i S, T = gets.split() puts S puts T i = 0 while i < N do print S[i] print T[i] i += 1 end
N = gets.to_i S, T = gets.split() i = 0 while i < N do print S[i] print T[i] i += 1 end
[ "call.remove" ]
631,262
631,261
u645787471
ruby
p02831
a,b = gets.split(' ').map(&:to_i) answer = 0 for n in 1..b do s = a * n next if s % b != 0 answer = s break end puts a
a,b = gets.split(' ').map(&:to_i) answer = 0 for n in 1..b do s = a * n next if s % b != 0 answer = s break end puts answer
[ "identifier.change", "call.arguments.change" ]
632,882
632,883
u509036258
ruby
p02831
a,b = gets.split(' ').map(&:to_i) answer = 0 for n in 1..b do s = a * n next if s % b != 0 answer = n break end puts a
a,b = gets.split(' ').map(&:to_i) answer = 0 for n in 1..b do s = a * n next if s % b != 0 answer = s break end puts answer
[ "assignment.value.change", "identifier.change", "call.arguments.change" ]
632,884
632,883
u509036258
ruby
p02832
n = gets.to_i a = gets.split.map &:to_i if a.index(1) == nil p -1 else c = i = 0 1.upto n do |n| break if (i=a[i..-1].index(n)) == nil c += 1 end p a.size - c end
n = gets.to_i a = gets.split.map &:to_i if a.index(1) == nil p -1 else c = i = 0 1.upto n do |n| break if (t=a[i..-1].index(n)) == nil i += t c += 1 end p a.size - c end
[ "assignment.variable.change", "identifier.change", "control_flow.branch.if.condition.change" ]
634,920
634,921
u488208047
ruby
p02832
N = gets.to_i+ nums = gets.split(' ').map(&:to_i) cnt = 0 mark = 1 nums.each do |n| if n == mark cnt += 1 mark += 1 end end if cnt == 0 puts -1 else puts (nums.length - cnt) end
N = gets.to_i nums = gets.split(' ').map(&:to_i) cnt = 0 mark = 1 nums.each do |n| if n == mark cnt += 1 mark += 1 end end if cnt == 0 puts -1 else puts (nums.length - cnt) end
[]
634,938
634,939
u808757777
ruby
p02832
# coding: utf-8 N = gets.to_i a = gets.split.map {|e| e.to_i} # 砕くレンガの個数 ans = 0 # 今探している数 sn = 1 cnt = 0 a.each do |n| if n == sn ans += cnt cnt = 0 sn += 1 else cnt += 1 end end if cnt == a.size puts -1 else puts ans end
# coding: utf-8 N = gets.to_i a = gets.split.map {|e| e.to_i} # 砕くレンガの個数 ans = 0 # 今探している数 sn = 1 cnt = 0 a.each do |n| if n == sn ans += cnt cnt = 0 sn += 1 else cnt += 1 end end if cnt == a.size puts -1 else puts ans + cnt end
[ "expression.operation.binary.add" ]
635,187
635,188
u810246563
ruby
p02832
N=gets.to_i a=gets.split.map(&:to_i) cnt=0 N.times do |i| if as[i]==cnt+1 cnt+=1 end end puts cnt==0 ? -1 : N-cnt
N=gets.to_i as=gets.split.map(&:to_i) cnt=0 N.times do |i| if as[i]==cnt+1 cnt+=1 end end puts cnt==0 ? -1 : N-cnt
[ "assignment.variable.change", "identifier.change" ]
635,251
635,252
u926099741
ruby
p02833
n = gets.chomp.to_i if n < 10 || n & 1 == 1 then puts 0 exit end ans = 0 while 10 < n do ans += n/10 n /= 5 end puts ans
n = gets.chomp.to_i if n < 10 || n & 1 == 1 then puts 0 exit end ans = 0 while 10 <= n do ans += n/10 n /= 5 end puts ans
[ "expression.operator.compare.change", "expression.operation.binary.change" ]
635,577
635,578
u466332671
ruby
p02833
N = gets.to_i if N % 2 == 1 then print 0 else zeros = 0 i = 10 while i < N do num = N / i zeros += num i *= 5 end print zeros end
N = gets.to_i if N % 2 == 1 then print 0 else zeros = 0 i = 10 while i <= N do num = N / i zeros += num i *= 5 end print zeros end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
635,628
635,629
u569559028
ruby
p02833
n=gets.to_i if n.odd? puts 0 else ans=0 times=10 while times<n ans+=n/times times*=5 end puts ans end
n=gets.to_i if n.odd? puts 0 else ans=0 times=10 while times<=n ans+=n/times times*=5 end puts ans end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
635,818
635,819
u602591412
ruby
p02833
N=gets.to_i result = 0 if N%2==1 puts 0 else 10.times do |i| result = result + N / (5**i) * 10 end puts result end
N=gets.to_i result=0 if N%2==1 puts 0 else 100.times do |i| result=result+N/((5**i)*10) end puts result end
[ "literal.number.integer.change" ]
636,034
636,035
u224392861
ruby
p02833
N = gets.chomp.to_i # A, B, C = gets.chomp.split.map(&:to_i) # S = gets.chomp.chars if N % 2 == 1 # odd p 0 else divider = 10 ans = 0 while (divider < N) ans += N/divider divider *= 5 end p ans end
N = gets.chomp.to_i # A, B, C = gets.chomp.split.map(&:to_i) # S = gets.chomp.chars if N % 2 == 1 # odd p 0 else # even divider = 10 ans = 0 while (divider <= N) ans += N/divider divider *= 5 end p ans end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
636,140
636,141
u328294851
ruby
p02833
n = gets.to_i count = 0 if n%2==1 puts 0 end if n%2==0 ans = 0 five_times = 10 while five_times<n ans += (n/five_times) five_times*=5 end puts ans end
n = gets.to_i if n%2==1 puts 0 end if n%2==0 ans = 0 five_times = 10 while five_times<=n ans += (n/five_times) five_times*=5 end puts ans end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
636,189
636,190
u710018917
ruby
p02833
n=gets.to_i if n.odd? puts 0 exit end m=10 ans=0 while(m<n) ans += (n/m) m *= 5 end puts ans
n=gets.to_i if n.odd? puts 0 exit end m=10 ans=0 while(m<=n) ans += (n/m) m *= 5 end puts ans
[ "expression.operator.compare.change", "expression.operation.binary.change" ]
636,202
636,203
u868089307
ruby
p02833
n = gets.to_i if n.odd? puts 0 else ans = 0 i = 10 while n > i ans += n / i i *= 5 end puts ans end
n = gets.to_i if n.odd? puts 0 else ans = 0 i = 10 while n >= i ans += n / i i *= 5 end puts ans end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
636,210
636,211
u692254521
ruby
p02833
n = gets.to_i j = 0 s = n.odd? ? 1 : 2 if s == 1 puts '0' exit end i = 1 while (5**i) * 2 < n j += n / ((5**i) * 2) i += 1 end p j
n = gets.to_i j = 0 s = n.odd? ? 1 : 2 if s == 1 puts '0' exit end i = 1 while (5**i) * 2 <= n j += n / ((5**i) * 2) i += 1 end p j
[ "expression.operator.compare.change", "expression.operation.binary.change" ]
636,254
636,255
u437368899
ruby
p02833
include Math N = gets.to_i if N % 2 == 1 puts 0 else order = Math.log(N, 5) # puts order ans = 0 (1..order).each do |i| ans += N.div(5**i) #print i.to_s + " " #puts ans end puts ans end
include Math N = gets.to_i if N % 2 == 1 puts 0 else order = Math.log(N, 5) # puts order ans = 0 (1..order).each do |i| ans += N.div(5**i)/2 #print i.to_s + " " #puts ans end puts ans end
[ "expression.operation.binary.add" ]
636,297
636,298
u808757777
ruby
p02833
def zero_count(n) return 0 if n % 2 == 1 n = n / 2 count = 0 div = 5 exp = 1 while div < n count += n / div exp += 1 div = 5**exp end count end puts zero_count(gets.to_i)
def zero_count(n) return 0 if n % 2 == 1 n = n / 2 count = 0 div = 5 exp = 1 while div <= n count += n / div exp += 1 div = 5**exp end count end puts zero_count(gets.to_i)
[ "expression.operator.compare.change", "expression.operation.binary.change" ]
636,441
636,442
u645787471
ruby
p02833
def fn(n) res = 1 n.step(1, -2) do |i| break if n < 2 res *= i end res end def count_r(n) rev = n.to_s.reverse res = 0 rev.chars.each { |i| break if i != '0'; res += 1 } res end n = gets.to_i if n.odd? puts "0" exit end # prepared_res = count_r(fn(n)) res = 0 res += n / 10 n /= 10 while n > 5 res += n / 5 n /= 5 end # res += n / 250 puts res # puts prepared_res # puts count_r fn(10) # puts count_r fn(20) # puts count_r fn(30) # puts count_r fn(40) # puts count_r fn(50) # puts count_r fn(80) # puts count_r fn(96) # puts count_r fn(100) # puts count_r fn(110) # puts count_r fn(140) # puts count_r fn(150)
def fn(n) res = 1 n.step(1, -2) do |i| break if n < 2 res *= i end res end def count_r(n) rev = n.to_s.reverse res = 0 rev.chars.each { |i| break if i != '0'; res += 1 } res end n = gets.to_i if n.odd? puts "0" exit end # prepared_res = count_r(fn(n)) res = 0 res += n / 10 n /= 10 while n >= 5 res += n / 5 n /= 5 end # res += n / 250 puts res # puts prepared_res # puts count_r fn(10) # puts count_r fn(20) # puts count_r fn(30) # puts count_r fn(40) # puts count_r fn(50) # puts count_r fn(80) # puts count_r fn(96) # puts count_r fn(100) # puts count_r fn(110) # puts count_r fn(140) # puts count_r fn(150)
[ "expression.operator.compare.change", "expression.operation.binary.change" ]
636,484
636,485
u624505752
ruby
p02833
def fn(n) res = 1 n.step(1, -2) do |i| break if n < 2 res *= i end res end def count_r(n) rev = n.to_s.reverse res = 0 rev.chars.each { |i| break if i != '0'; res += 1 } res end n = gets.to_i if n.odd? puts "0" exit end # prepared_res = count_r(fn(n)) res = 0 res += n / 10 n /= 10 while n > 5 res += n / 5 n /= 5 end # res += n / 250 puts res # puts prepared_res # puts count_r fn(10) # puts count_r fn(20) # puts count_r fn(30) # puts count_r fn(40) # puts count_r fn(50) # puts count_r fn(80) # puts count_r fn(96) # puts count_r fn(100) # puts count_r fn(110) # puts count_r fn(140) # puts count_r fn(150)
def fn(n) res = 1 n.step(1, -2) do |i| break if n < 2 res *= i end res end def count_r(n) rev = n.to_s.reverse res = 0 rev.chars.each { |i| break if i != '0'; res += 1 } res end n = gets.to_i if n.odd? puts "0" exit end # prepared_res = count_r(fn(n)) res = 0 res += n / 10 n /= 10 while n >= 5 res += n / 5 n /= 5 end # res += n / 250 puts res # puts prepared_res # puts count_r fn(10) # puts count_r fn(20) # puts count_r fn(30) # puts count_r fn(40) # puts count_r fn(50) # puts count_r fn(80) # puts count_r fn(96) # puts count_r fn(100) # puts count_r fn(110) # puts count_r fn(140) # puts count_r fn(150)
[ "expression.operator.compare.change", "expression.operation.binary.change" ]
636,486
636,485
u624505752
ruby
p02833
N=gets.to_i if N.odd? puts 0 exit end cnt=N ans=0 while cnt>0 ans+=cnt/10 cnt/=10 end puts ans
N=gets.to_i if N.odd? puts 0 exit end cnt=N ans=0 while cnt>0 ans+=cnt/10 cnt/=5 end puts ans
[ "literal.number.integer.change" ]
636,692
636,693
u926099741
ruby
p02833
N = gets.chomp.to_i if N.odd? puts 0 exit end result = 0 x = 10 while N > x result += (N / x) x = x * 5 end puts result
N = gets.chomp.to_i if N.odd? puts 0 exit end result = 0 x = 10 while N >= x result += (N / x) x = x * 5 end puts result
[ "expression.operator.compare.change", "expression.operation.binary.change" ]
636,796
636,797
u299761130
ruby
p02833
n = gets.to_i count = 0 i = 10 while i < n count += n / i i *= 5 end if n % 2 == 1 puts 0 else puts count end
n = gets.to_i count = 0 i = 10 while i <= n count += n / i i *= 5 end if n % 2 == 1 puts 0 else puts count end
[ "expression.operator.compare.change", "expression.operation.binary.change" ]
637,022
637,023
u374765295
ruby
p02833
n = gets.to_i if n.odd? puts 0 exit end n /= 2 k = 5 m = 0 while k < n m += n / k k *= 5 end puts m
n = gets.to_i if n.odd? puts 0 exit end n /= 2 k = 5 m = 0 while k <= n m += n / k k *= 5 end puts m
[ "expression.operator.compare.change", "expression.operation.binary.change" ]
637,031
637,032
u960319975
ruby
p02833
n = gets.to_i if n.odd? ans = -1 else n /= 2 ans = 0 div = 5 while n / div > 0 ans += (n / div) div *= 5 end end puts ans
n = gets.to_i if n.odd? ans = 0 else n /= 2 ans = 0 div = 5 while n / div > 0 ans += (n / div) div *= 5 end end puts ans
[ "assignment.value.change", "expression.operation.unary.remove" ]
637,139
637,140
u191196346
ruby
p02835
p (gets.split.map(&:to_i).inject(:+) >= 22 ? "bust" : "win")
puts (gets.split.map(&:to_i).inject(:+) >= 22 ? "bust" : "win")
[ "call.function.change", "io.output.change" ]
637,652
637,653
u358554431
ruby
p02835
a, b, c= gets.split.map(&:to_i) put a+b+c >= 22? "bust" : "win"
a, b, c= gets.split.map(&:to_i) puts a+b+c >= 22? "bust" : "win"
[ "misc.typo", "identifier.change" ]
638,036
638,037
u684458716
ruby
p02835
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE'] require 'prime' 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 def big(a,b) return (a>b)? a:b end def small(a,b) return (a<b)? a:b end t = inp puts if(sum(t)>21)? "bust" : "win"
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE'] require 'prime' 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 def big(a,b) return (a>b)? a:b end def small(a,b) return (a<b)? a:b end t = inp puts (sum(t)>21)? "bust" : "win"
[]
638,040
638,041
u145123922
ruby
p02835
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE'] require 'prime' 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 def big(a,b) return (a>b)? a:b end def small(a,b) return (a<b)? a:b end t = inp puts if(t.sum()>21)? "bust" : "win"
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE'] require 'prime' 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 def big(a,b) return (a>b)? a:b end def small(a,b) return (a<b)? a:b end t = inp puts (sum(t)>21)? "bust" : "win"
[ "call.remove", "control_flow.branch.if.condition.change" ]
638,042
638,041
u145123922
ruby
p02835
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE'] require 'prime' 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 def big(a,b) return (a>b)? a:b end def small(a,b) return (a<b)? a:b end t = inp p if(sum(t)>21)? "bust" : "win"
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE'] require 'prime' 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 def big(a,b) return (a>b)? a:b end def small(a,b) return (a<b)? a:b end t = inp puts (sum(t)>21)? "bust" : "win"
[ "call.function.change", "io.output.change" ]
638,043
638,041
u145123922
ruby
p02835
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE'] require 'prime' 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 def big(a,b) return (a>b)? a:b end def small(a,b) return (a<b)? a:b end t = inp p if(t.sum()>21)? "bust" : "win"
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE'] require 'prime' 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 def big(a,b) return (a>b)? a:b end def small(a,b) return (a<b)? a:b end t = inp puts (sum(t)>21)? "bust" : "win"
[ "call.function.change", "io.output.change", "call.remove", "control_flow.branch.if.condition.change" ]
638,044
638,041
u145123922
ruby
p02835
A = gets.split.map(&:to_i) puts A.inject(:+) > 21 ? :burst : :win
A = gets.split.map(&:to_i) puts A.inject(:+) > 21 ? :bust : :win
[ "call.arguments.change" ]
638,103
638,104
u091810847
ruby
p02835
a, b, c = gets.chomp.split.map(&:to_i) if (a + b + c) <= 22 puts "win" else puts "bust" end
a, b, c = gets.chomp.split.map(&:to_i) if (a + b + c) <= 21 puts "win" else puts "bust" end
[ "literal.number.integer.change", "control_flow.branch.if.condition.change" ]
638,205
638,206
u552761221
ruby
p02835
# a, b, c = gets.chomp.split(' ').map(&:to_i) # 文字列をわたしてやらないといけない ## A = gets.chomp.split.map(&:to_i) # if ((a + b + c) < 21) → 文字列を見ていない ## if (A[0] + A[1] + A[2]) <= 22 # 要素の1番目+2番目+3番目 ## puts "win" ## else ## puts "bust" ## end a, b, c = gets.chomp.split(&:to_i) if (a + b + c) <= 22 puts "win" else puts "bust" end
a, b, c = gets.chomp.split.map(&:to_i) if (a + b + c) <= 21 puts "win" else puts "bust" end
[ "call.add", "literal.number.integer.change", "control_flow.branch.if.condition.change" ]
638,207
638,206
u552761221
ruby
p02835
n=gets.split("").map(&:to_i) if n.sum>= 22 puts "bust" else puts "win" end
n=gets.split(" ").map(&:to_i) if n.inject(:+)>= 22 puts "bust" else puts "win" end
[ "literal.string.change", "assignment.value.change", "call.arguments.change", "identifier.change", "control_flow.branch.if.condition.change", "call.arguments.add" ]
638,555
638,554
u562148988
ruby
p02835
ary = gets.split(" ").map(&:to_i) sum = 0 ary.each do |i| sum += i end if sum >= 22 puts "win" else puts "bust" end
ary = gets.split(" ").map(&:to_i) sum = 0 ary.each do |i| sum += i end if sum >= 22 puts "bust" else puts "win" end
[ "call.remove", "call.add" ]
638,563
638,564
u507391030
ruby
p02835
n = gets.chomp.split(' ').map(&:to_i).reduce(:+) puts n < 21 ? 'win' : 'bust'
n = gets.chomp.split(' ').map(&:to_i).reduce(:+) puts n < 22 ? 'win' : 'bust'
[ "literal.number.integer.change", "control_flow.branch.if.condition.change" ]
638,987
638,988
u765478029
ruby
p02835
x, y, z = gets.chop.split.map(&:to_i) puts x + y + z >= 22 ? "win" : "bust"
x, y, z = gets.chop.split.map(&:to_i) puts x + y + z >= 22 ? "bust" : "win"
[ "literal.string.change", "call.arguments.change" ]
639,151
639,152
u668278891
ruby
p02835
a, b, c = gets.split.map(&:to_i) sum = a+b+c if(sum < 21) puts "win" else puts "bust" end
a, b, c = gets.split.map(&:to_i) sum = a+b+c if(sum <= 21) puts "win" else puts "bust" end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
639,155
639,156
u331086044
ruby
p02835
a, b, c = gets.split.map(&:to_i) sum = a+b+c if(sum < 21) puts "win" else puts bust end
a, b, c = gets.split.map(&:to_i) sum = a+b+c if(sum <= 21) puts "win" else puts "bust" end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change", "call.arguments.change" ]
639,157
639,156
u331086044
ruby
p02835
a, b, c = gets.chomp.split(" ").map(&:to_i) if a+b+c >= 22 p 'bust' else p 'win' end
a, b, c = gets.chomp.split(" ").map(&:to_i) if a+b+c >= 22 print 'bust' else print 'win' end
[ "call.function.change", "io.output.change" ]
639,164
639,165
u137521549
ruby
p02835
a, b, c = gets.chomp.split(" ").map(&:to_i) if a+b+c >= 22 p 'bust' else p 'win' end
a, b, c = gets.chomp.split(" ").map(&:to_i) if a+b+c >= 22 print 'bust' else print 'win' end
[ "call.function.change", "io.output.change" ]
639,166
639,165
u137521549
ruby
p02835
a,b,c= gets.split.map(&:to_i) if a + b + c > 22 puts "bust" else puts "win" end
a,b,c= gets.split.map(&:to_i) if a + b + c >= 22 puts "bust" else puts "win" end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
639,247
639,248
u945412921
ruby
p02835
a.b.c= gets.split.map(&:to_i) if a + b + c > 22 puts "bust" else puts "win" end
a,b,c= gets.split.map(&:to_i) if a + b + c >= 22 puts "bust" else puts "win" end
[ "misc.typo", "assignment.variable.change", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
639,249
639,248
u945412921
ruby
p02835
a, b, c = gets.split.map(&:to_i) puts (a + b + c) > 22 ? 'bust' : 'win'
a, b, c = gets.split.map(&:to_i) puts (a + b + c) > 21 ? 'bust' : 'win'
[ "literal.number.integer.change", "control_flow.branch.if.condition.change" ]
639,325
639,326
u304013285
ruby
p02835
a1, a2, a3 = gets.map(&:to_i) puts a1 + a2 + a3 >= 22 ? 'bust' : 'win'
a1, a2, a3 = gets.split.map(&:to_i) puts a1 + a2 + a3 >= 22 ? 'bust' : 'win'
[ "call.add" ]
639,532
639,533
u976684425
ruby
p02836
n=gets.chomp s=n.reverse ans=0 for i in 0..((n.size+1)/2)-1 ans+=1 if n[n]!=s[n] end puts ans
n=gets.chomp s=n.reverse ans=0 for i in 0..((n.size+1)/2)-1 ans+=1 if n[i]!=s[i] end puts ans
[ "identifier.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change" ]
639,849
639,850
u977506075
ruby
p02836
S=gets.chars N=S.size/2 s1,s2=S[0...N],S[-N..-1].reverse count = 0 N.times{|i| count+=1 if s1[i] != s2[i] } p count
S=gets.chomp.chars N=S.size/2 s1,s2=S[0...N],S[-N..-1].reverse count = 0 N.times{|i| count+=1 if s1[i] != s2[i] } p count
[ "call.add" ]
639,855
639,856
u502306384
ruby
p02836
S=gets.chars N=S.size/2 count = 0 N.times{|i| count+=1 if S[i] != S[-i-1] } p count
S=gets.chomp.chars N=S.size/2 count = 0 N.times{|i| count+=1 if S[i] != S[-i-1] } p count
[ "call.add" ]
639,858
639,859
u502306384
ruby
p02836
S = gets.chomp N = S.length ans = 0 N.times do |i| if S[i] != S[N - i -1] ans += 1 end end puts ans.to_s
S = gets.chomp N = S.length ans = 0 (N / 2).times do |i| if S[i] != S[N - i -1] ans += 1 end end puts ans.to_s
[]
639,963
639,965
u552761221
ruby
p02836
a=gets.chomp.chars ans=0 for i in 0..(a.length/2) ans+=1 if a[i]!=a[a.length-1-i] end puts ans
a=gets.chomp.chars ans=0 for i in 0..(a.length/2-1) ans+=1 if a[i]!=a[a.length-1-i] end puts ans
[ "expression.operation.binary.add" ]
640,285
640,286
u585819925
ruby
p02836
s = gets.chomp.split('') count = 0 n = s.size / 2 if s.size.odd? n = s.size / 2 + 1 if s.size.even? (0..n-1).each do |i| count += 1 if s[i] != s[s.size - 1 - i] end puts count
s = gets.chomp.split('') count = 0 n = s.size / 2 if s.size.odd? n = s.size / 2 - 1 if s.size.even? (0..n).each do |i| count += 1 if s[i] != s[s.size - 1 - i] end puts count
[ "misc.opposites", "expression.operator.arithmetic.change", "assignment.value.change", "expression.operation.binary.change", "expression.operation.binary.remove" ]
640,316
640,317
u437368899
ruby
p02836
s = gets.strip.chars count = 0 while s.size> 2 do h = s.shift l = s.pop count += 1 if h != l end puts count
s = gets.strip.chars count = 0 while s.size > 1 do h = s.shift l = s.pop count += 1 if h != l end puts count
[ "literal.number.integer.change", "expression.operation.binary.change" ]
640,383
640,384
u173515518
ruby
p02836
s = gets.to_s count = 0 for i in (1..(s.size / 2)) if s[i - 1] != s[-i] count += 1 end end puts count
s = gets.chomp count = 0 for i in (1..(s.size / 2)) if s[i - 1] != s[-i] count += 1 end end puts count
[ "assignment.value.change", "identifier.change" ]
640,393
640,394
u729911058
ruby
p02836
s = gets.split(//).map(&:to_s) i = 0 j = s.length - 1 h = 0 while j >= i #puts "si:#{s[i]}" #puts "sj:#{s[j]}" h = h + 1 if s[i] != s[j] i = i + 1 j = j - 1 end puts h
s = gets.chomp s = s.split(//).map(&:to_s) i = 0 j = s.length - 1 h = 0 while j >= i #puts "si:#{s[i]}" #puts "sj:#{s[j]}" h = h + 1 if s[i] != s[j] i = i + 1 j = j - 1 end puts h
[ "call.add" ]
640,404
640,405
u944733909
ruby
p02836
s = gets.split(//).map(&:to_s) i = 0 j = s.length - 1 h = 0 while j > i h = h + 1 if s[i] != s[j] i = i + 1 j = j - 1 end puts h
s = gets.chomp s = s.split(//).map(&:to_s) i = 0 j = s.length - 1 h = 0 while j >= i #puts "si:#{s[i]}" #puts "sj:#{s[j]}" h = h + 1 if s[i] != s[j] i = i + 1 j = j - 1 end puts h
[ "call.add", "expression.operator.compare.change", "expression.operation.binary.change" ]
640,408
640,405
u944733909
ruby
p02836
s = gets.chomp.to_i len = s.length las = len - 1 count = 0 len.times do |l| if len%2==0 if s[l] != s[las] count +=1 end las -=1 if las == l break end else if s[l] != s[las] count +=1 end if las == l break end las -=1 end end puts count
s = gets.chomp.to_s len = s.length las = len - 1 count = 0 len.times do |l| if len%2==0 if s[l] != s[las] count +=1 end las -=1 if las == l break end else if s[l] != s[las] count +=1 end if las == l break end las -=1 end end puts count
[ "call.function.change", "type_conversion.to_string.change" ]
640,415
640,416
u322744344
ruby
p02836
S = gets.chomp =begin 実装するアルゴリズムに関する説明 入力された文字列 S の文字数を求め(n文字目)と(文字数-n+1文字目)を比較し、 異なってる文字数を算出する =end num=0 count =0 while num < S.length/2+1 if S[num] != S[S.length-num-1] count+=1 end num+=1 end p count
S = gets.chomp =begin 実装するアルゴリズムに関する説明 入力された文字列 S の文字数を求め(n文字目)と(文字数-n+1文字目)を比較し、 異なってる文字数を算出する =end num=0 count =0 while num < S.length/2 if S[num] != S[S.length-num-1] count+=1 end num+=1 end p count
[ "expression.operation.binary.remove" ]
640,438
640,439
u372923276
ruby
p02836
s = gets ans = 0 for i in 0..s.length do ans += 1 if s[i] != s[s.length - 1 - i] end puts(ans / 2)
s = gets.chomp ans = 0 for i in 0..s.length do ans += 1 if s[i] != s[s.length - 1 - i] end puts(ans / 2) # s = gets.chomp # len = s.size # ans = 0 # (len/2).times do |i| # ans += 1 if s[i] != s[-i-1] # end # puts ans
[ "call.add" ]
640,497
640,498
u917013605
ruby
p02836
line = gets,chomp def cal(s) t = s.reverse a = 0 l = s.length for i in 0..l-1 if s[i] != t[i] then a = a+1 end end return a end print cal(line)/2
line = gets.chomp def cal(s) t = s.reverse a = 0 l = s.length for i in 0..l-1 if s[i] != t[i] then a = a+1 end end return a end print cal(line)/2
[ "assignment.value.change" ]
640,519
640,520
u413184068
ruby
p02836
line = gets def cal(s) t = s.reverse a = 0 l = s.length for i in 0..l-1 if s[i] != t[i] then a = a+1 end end return a end c =cal(line)/2 print c
line = gets.chomp def cal(s) t = s.reverse a = 0 l = s.length for i in 0..l-1 if s[i] != t[i] then a = a+1 end end return a end print cal(line)/2
[ "call.add", "call.remove" ]
640,521
640,520
u413184068
ruby
p02836
s = gets.strip.split('') count = 0 if s.length > 1 (0..((s.length)/2).floor).each do |i| if s[i]!=s[-1-i] count += 1 end end puts count else puts "0" end
s = gets.strip.split('') count = 0 if s.length > 1 (0..((s.length)/2).floor-1).each do |i| if s[i]!=s[-1-i] count += 1 end end puts count else puts "0" end
[ "expression.operation.binary.add" ]
640,616
640,617
u913209852
ruby
p02836
s = gets hug = 0 (s.length/2).times do |i| if s[i] != s[-(i+1)] hug += 1 end end puts("#{hug}")
s = gets.chomp hug = 0 (s.length/2).times do |i| if s[i] != s[-(i+1)] hug += 1 end end puts("#{hug}")
[ "call.add" ]
640,677
640,678
u879573689
ruby
p02836
a = gets.chomp.split("") sum = 0 for n in (0..(a.count/2 -1)) do if a[n] != a[(n * -1 -1)] sum += 1 end end
a = gets.chomp.split("") sum = 0 for n in (0..(a.count/2 -1)) do if a[n] != a[(n * -1 -1)] sum += 1 end end puts sum
[ "call.add" ]
640,710
640,711
u012110567
ruby
p02836
s=geta.chomp n=s.size n=(n+1)/2 cnt=0 n.times do |i| cnt+=1 if s[i]!=s[s.size-1-i] end puts cnt
s=gets.chomp nn=s.size n=(nn+1)/2 cnt=0 n.times do |i| cnt+=1 if s[i]!=s[nn-1-i] end puts cnt
[ "assignment.value.change", "identifier.change", "assignment.variable.change", "expression.operation.binary.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change", "call.remove" ]
640,730
640,731
u926099741
ruby
p02836
s=gets.chomp n=s.size n=(n+1)/2 cnt=0 n.times do |i| cnt+=1 if s[i]!=s[n-1-i] end puts cnt
s=gets.chomp nn=s.size n=(nn+1)/2 cnt=0 n.times do |i| cnt+=1 if s[i]!=s[nn-1-i] end puts cnt
[ "assignment.variable.change", "identifier.change", "assignment.value.change", "expression.operation.binary.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change" ]
640,732
640,731
u926099741
ruby
p02836
s = gets.chomp n = s.size cnt = 0 for i in 0..n/2 cnt += 1 if s[i] != s[-(i+1)] end p cnt
s = gets.chomp n = s.size cnt = 0 for i in 0...n/2 cnt += 1 if s[i] != s[-(i+1)] end p cnt
[]
640,853
640,854
u752146271
ruby
p02837
n = gets.to_i h = Array.new(n+1) { Array.new } m = Array.new(n+1) { Array.new } (1..n).each do |t| ai = gets.to_i ai.times do x, y = gets.split.map(&:to_i) m[t] << x if y == 0 h[t] << x if y == 1 end end max = 0 (n ** 2).times do |pattern| catch(:hoge) do n.times do |i| next if 1<<i & pattern == 0 m[i+1].each do |m| throw(:hoge) if pattern[m-1] != 0 end h[i+1].each do |h| throw(:hoge) if pattern[h-1] != 1 end end max = [max, pattern.to_s(2).count('1')].max end end puts max
n = gets.to_i h = Array.new(n+1) { Array.new } m = Array.new(n+1) { Array.new } (1..n).each do |t| ai = gets.to_i ai.times do x, y = gets.split.map(&:to_i) m[t] << x if y == 0 h[t] << x if y == 1 end end max = 0 (2 ** n).times do |pattern| catch(:hoge) do n.times do |i| next if 1<<i & pattern == 0 m[i+1].each do |m| throw(:hoge) if pattern[m-1] != 0 end h[i+1].each do |h| throw(:hoge) if pattern[h-1] != 1 end end max = [max, pattern.to_s(2).count('1')].max end end puts max
[ "expression.operation.binary.remove" ]
641,310
641,311
u604352408
ruby
p02837
n = gets.to_i h = Array.new(n+1) { Array.new } m = Array.new(n+1) { Array.new } (1..n).each do |t| ai = gets.to_i ai.times do x, y = gets.split.map(&:to_i) m[t] << x if y == 0 h[t] << x if y == 1 end end max = 0 (n ** 2 - 1).times do |pattern| catch(:hoge) do n.times do |i| next if 1<<i & pattern == 0 m[i+1].each do |m| throw(:hoge) if pattern[m-1] != 0 end h[i+1].each do |h| throw(:hoge) if pattern[h-1] != 1 end end max = [max, pattern.to_s(2).count('1')].max end end puts max
n = gets.to_i h = Array.new(n+1) { Array.new } m = Array.new(n+1) { Array.new } (1..n).each do |t| ai = gets.to_i ai.times do x, y = gets.split.map(&:to_i) m[t] << x if y == 0 h[t] << x if y == 1 end end max = 0 (2 ** n).times do |pattern| catch(:hoge) do n.times do |i| next if 1<<i & pattern == 0 m[i+1].each do |m| throw(:hoge) if pattern[m-1] != 0 end h[i+1].each do |h| throw(:hoge) if pattern[h-1] != 1 end end max = [max, pattern.to_s(2).count('1')].max end end puts max
[ "expression.operation.binary.remove" ]
641,312
641,311
u604352408
ruby
p02837
require 'set' class Hash def push(key, value) self[key] = [] if self[key] == nil self[key].push(value) end end class Array def lower_bound(value) left = -1; right = self.length; while left + 1 < right mid = left + (right - left) / 2; if self[mid] >= value right = mid else left = mid end end right end def unique res = [self.first] each_cons(2) do |a, b| if a != b res.push(b) end end res end end def get_ints gets.split.map(&:to_i) end def get_ints_minus_one get_ints.map { |x| x - 1 } end def get_int gets.chomp.to_i end N = get_int hash = {} 1.step(N) do |i| a = get_int hash[i] = { honest: [], unkind: [], } a.times do x, y = get_ints if y == 1 hash[i][:honest].push(x) else hash[i][:unkind].push(x) end end end high = N low = 0 # while high - low > 1 # mid = low + (high - low) / 2 # success = false # [*1..N].combination(mid).each do |c| # honest_set = Set.new # unkind_set = Set.new # contradiction = false # # c.each do |data| # honest_set.merge(hash[data][:honest]) # unkind_set.merge(hash[data][:unkind]) # end # # if (c.to_set & honest_set).length != honest_set.length # contradiction = true # else # contradiction = true if (c.to_set & unkind_set).length > 0 # end # # if !contradiction # # 矛盾がない # p c # success = true # break # end # end # # if success # low = mid # else # high = mid # end # end # # puts low n = N while n > 0 mid = n success = false [*1..N].combination(mid).each do |c| honest_set = Set.new unkind_set = Set.new contradiction = false c.each do |data| honest_set.merge(hash[data][:honest]) unkind_set.merge(hash[data][:unkind]) end if (c.to_set & honest_set).length != honest_set.length contradiction = true else contradiction = true if (c.to_set & unkind_set).length > 0 end if !contradiction # 矛盾がない p c success = true break end end break if success n -= 1 end puts n
require 'set' class Hash def push(key, value) self[key] = [] if self[key] == nil self[key].push(value) end end class Array def lower_bound(value) left = -1; right = self.length; while left + 1 < right mid = left + (right - left) / 2; if self[mid] >= value right = mid else left = mid end end right end def unique res = [self.first] each_cons(2) do |a, b| if a != b res.push(b) end end res end end def get_ints gets.split.map(&:to_i) end def get_ints_minus_one get_ints.map { |x| x - 1 } end def get_int gets.chomp.to_i end N = get_int hash = {} 1.step(N) do |i| a = get_int hash[i] = { honest: [], unkind: [], } a.times do x, y = get_ints if y == 1 hash[i][:honest].push(x) else hash[i][:unkind].push(x) end end end high = N low = 0 # while high - low > 1 # mid = low + (high - low) / 2 # success = false # [*1..N].combination(mid).each do |c| # honest_set = Set.new # unkind_set = Set.new # contradiction = false # # c.each do |data| # honest_set.merge(hash[data][:honest]) # unkind_set.merge(hash[data][:unkind]) # end # # if (c.to_set & honest_set).length != honest_set.length # contradiction = true # else # contradiction = true if (c.to_set & unkind_set).length > 0 # end # # if !contradiction # # 矛盾がない # p c # success = true # break # end # end # # if success # low = mid # else # high = mid # end # end # # puts low n = N while n > 0 mid = n success = false [*1..N].combination(mid).each do |c| honest_set = Set.new unkind_set = Set.new contradiction = false c.each do |data| honest_set.merge(hash[data][:honest]) unkind_set.merge(hash[data][:unkind]) end if (c.to_set & honest_set).length != honest_set.length contradiction = true else contradiction = true if (c.to_set & unkind_set).length > 0 end if !contradiction # 矛盾がない success = true break end end break if success n -= 1 end puts n
[ "call.remove" ]
641,318
641,319
u305883349
ruby
p02837
n = gets.to_s.to_i s = Array.new(n){ Array.new(n){ nil } } n.times do |i| a = gets.to_s.to_i a.times do x, y = gets.to_s.split.map{|t|t.to_i} x -= 1 s[i][x] = y end end ans = 0 (2**n).times do |bit| cnt = 0 flag = true n.times do |i| next if bit[i] == 0 cnt += 1 s[i].each_with_index do |y, j| if !y && y != bit[j] flag = false break end end end ans = [ans, cnt].max if flag end puts ans
n = gets.to_s.to_i s = Array.new(n){ Array.new(n){ nil } } n.times do |i| a = gets.to_s.to_i a.times do x, y = gets.to_s.split.map{|t|t.to_i} x -= 1 s[i][x] = y end end ans = 0 (2**n).times do |bit| cnt = 0 flag = true n.times do |i| next if bit[i] == 0 cnt += 1 s[i].each_with_index do |y, j| next unless y if y != bit[j] flag = false break end end end ans = [ans, cnt].max if flag end puts ans
[ "control_flow.branch.if.condition.change" ]
641,400
641,401
u693378622
ruby
p02837
n = gets.to_i xys = n.times.map do a = gets.to_i a.times.map { gets.split.map(&:to_i) } end ans = 0 (1 << n).times do |bit| count = 0 xys.each_with_index do |xy, i| next if bit[i] == 0 if xy.all? { |x, y| bit[x - 1] != y } count += 1 else count = 0 break end end ans = count if count >= ans end puts ans
n = gets.to_i xys = n.times.map do a = gets.to_i a.times.map { gets.split.map(&:to_i) } end ans = 0 (1 << n).times do |bit| count = 0 xys.each_with_index do |xy, i| next if bit[i] == 0 if xy.all? { |x, y| bit[x - 1] == y } count += 1 else count = 0 break end end ans = count if count >= ans end puts ans
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
641,422
641,423
u889326464
ruby
p02837
n = gets.to_i evi = n.times.map do a = gets.to_i a.times.map{gets.split.map(&:to_i)} end ans = 0 (2**n).times do |bit| cnt = 0 n.times do |i| if bit[i] == 1 && evi[i].all? {|x,y| bit[x-1] == y} cnt += 1 else cnt = 0 break end end ans = cnt if cnt > ans end puts ans
n = gets.to_i evi = n.times.map do a = gets.to_i a.times.map{gets.split.map(&:to_i)} end ans = 0 (2**n).times do |bit| cnt = 0 n.times do |i| if bit[i] == 1 if evi[i].all? {|x,y| bit[x-1] == y} cnt += 1 else cnt = 0 break end end end ans = cnt if cnt > ans end puts ans
[ "control_flow.branch.if.condition.change" ]
642,262
642,263
u735499035
ruby
p02837
n=gets.to_i a=(1..n).map{ (1..gets.to_i).map{ gets.split.map(&:to_i) } } p (0...2**n).select{|b| (0...n).all?{|i| b[i]==0 || a[i].all?{|x,y|b[x+1]==y} } }.map{|b|b.to_s(2).count(?1)}.max
n=gets.to_i a=(1..n).map{ (1..gets.to_i).map{ gets.split.map(&:to_i) } } p (0...2**n).select{|b| (0...n).all?{|i| b[i]==0 || a[i].all?{|x,y|b[x-1]==y} } }.map{|b|b.to_s(2).count(?1)}.max
[ "misc.opposites", "expression.operator.arithmetic.change", "variable_access.subscript.index.change", "call.arguments.change", "expression.operation.binary.change" ]
642,302
642,303
u353917577
ruby
p02837
N = gets.chomp.to_i a = Array.new(N){Array.new(N,2)} d = Array.new(N,0) for i in 0...N do m = gets.chomp.to_i for j in 0...m do str = gets.split b,c = str[0].to_i-1, str[1].to_i a[i][b] = c end end answer = 0 for i in 1...2**N do b = i c = 0 for j in 0...N do d[j] = b%2 c += b%2 b /= 2 end f = 1 for j in 0...N do if d[j] == 1 for k in 0...N do if a[j][k] != d[j] && a[j][k] != 2 f = 0 end end end end if f == 1 answer = c > answer ? c : answer end end puts answer
N = gets.chomp.to_i a = Array.new(N){Array.new(N,2)} d = Array.new(N,0) for i in 0...N do m = gets.chomp.to_i for j in 0...m do str = gets.split b,c = str[0].to_i-1, str[1].to_i a[i][b] = c end end answer = 0 for i in 1...2**N do b = i c = 0 for j in 0...N do d[j] = b%2 c += b%2 b /= 2 end f = 1 for j in 0...N do if d[j] == 1 for k in 0...N do if a[j][k] != d[k] && a[j][k] != 2 f = 0 end end end end if f == 1 answer = c > answer ? c : answer end end puts answer
[ "identifier.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change" ]
642,383
642,384
u349832549
ruby
p02837
N=gets.to_i as=Array.new(N) ds=Array.new(N){Array.new(N,false)} N.times do |i| as[i]=gets.to_i as[i].times do |j| e,f=gets.split.map(&:to_i) ds[i][e-1]=f end end ans=0 (1<<N).times do |i| ok=true cnt=0 N.times do |j| next if ((i & (1<<j))==0) cnt+=1 ds[j].each_with_index do |e,k| next if !e ok=false if ((e==1) && (i & (1<<k))==0) || ((e==0) && (i & (1<<k))!=0) end end ans=ans<cnt ? cnt : ans end puts ans
N=gets.to_i as=Array.new(N) ds=Array.new(N){Array.new(N,false)} N.times do |i| as[i]=gets.to_i as[i].times do |j| e,f=gets.split.map(&:to_i) ds[i][e-1]=f end end ans=0 (1<<N).times do |i| ok=true cnt=0 N.times do |j| next if ((i & (1<<j))==0) cnt+=1 ds[j].each_with_index do |e,k| next if !e ok=false if ((e==1) && (i & (1<<k))==0) || ((e==0) && (i & (1<<k))!=0) end end ans=ans<cnt ? cnt : ans if ok end puts ans
[]
642,458
642,459
u926099741
ruby
p02836
line = gets array = line.split("") array.pop number = 0 array.each_index do |idx| if idx == array.length / 2 break end if array[idx] != array[array.length - idx] number += 1 end end puts number
line = gets array = line.split("") array.pop number = 0 array.each_index do |idx| if idx == array.length / 2 break end if array[idx] != array[array.length - idx -1] number += 1 end end puts number
[ "control_flow.branch.if.condition.change" ]
642,772
642,773
u333374716
ruby
p02838
N=gets.to_i A=gets.split.map(&:to_i) ans=0 for i in 0..60 p=0 for j in 0..N-1 p+=A[j][i] end ans+=p*(N-p) end ans%=(10**9+7) puts ans
N=gets.to_i A=gets.split.map(&:to_i) ans=0 for i in 0..60 p=0 for j in 0..N-1 p+=A[j][i] end ans+=p*(N-p)*2**i end ans%=(10**9+7) puts ans
[ "expression.operation.binary.add" ]
643,801
643,802
u041282550
ruby
p02838
mod = 1000000007 n = gets.to_i a = gets.split.map(&:to_i) len = a.max.to_s(2).length ans = 0 len.times do |l| n_1 = a.count { |x| x[l] == 1 } v = l >= 30 ? (2 ** l) % mod : (2 ** i) ans += ((n - n_1) * n_1 * v ) % mod ans %= mod end puts ans
mod = 1000000007 n = gets.to_i a = gets.split.map(&:to_i) len = a.max.to_s(2).length ans = 0 len.times do |l| n_1 = a.count { |x| x[l] == 1 } v = l >= 30 ? (2 ** l) % mod : (2 ** l) ans += ((n - n_1) * n_1 * v ) % mod ans %= mod end puts ans
[ "assignment.value.change", "identifier.change", "expression.operation.binary.change" ]
643,851
643,852
u604352408
ruby