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
p02719
N, K = gets.chomp.split(" ").map(&:to_i) one = N % K another = one % K puts [one, another].min
N, K = gets.chomp.split(" ").map(&:to_i) one = N % K another = (one - K).abs puts [one, another].min
[ "expression.operator.arithmetic.change", "assignment.value.change", "expression.operation.binary.change", "call.add" ]
490,559
490,560
u742129941
ruby
p02719
n, k = gets.split.map(&:to_i) puts [n % k, k % (n % k)].min
n, k = gets.split.map(&:to_i) puts [n % k, k - (n % k)].min
[ "expression.operator.arithmetic.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
491,028
491,029
u866325115
ruby
p02719
n, k = gets.split.map(&:to_i) puts [n % k, k % (n - k).abs].min
n, k = gets.split.map(&:to_i) puts [n % k, k - (n % k)].min
[ "expression.operator.arithmetic.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change", "call.remove" ]
491,030
491,029
u866325115
ruby
p02719
n,k = gets.split,map(&:to_i) min = n % k min = (min - k).abs if min > (min - k).abs puts min
n,k = gets.split.map(&:to_i) min = n % k min = (min - k).abs if min > (min - k).abs puts min
[ "assignment.value.change" ]
491,031
491,032
u437368899
ruby
p02719
n,k = gets.split.map(&:to_i) n %= k puts n puts [n,k-n].min
n,k = gets.split.map(&:to_i) n %= k puts [n,k-n].min
[ "call.remove" ]
492,046
492,047
u088221425
ruby
p02719
n, k = gets.strip.split.map(&:to_i) if n % k < k / 2 puts n % k else puts k - n % k end
n, k = gets.strip.split.map(&:to_i) if n % k <= k / 2 puts n % k else puts k - n % k end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
492,188
492,189
u768135881
ruby
p02719
n, k = gets.split.map(&:to_i) if n % k == 0 puts 0 else n = [n, n % k].min puts [n, (3-k).abs].min end
n, k = gets.split.map(&:to_i) if n % k == 0 puts 0 else n = [n, n % k].min puts [n, (n-k).abs].min end
[ "identifier.replace.add", "literal.replace.remove", "call.arguments.change", "expression.operation.binary.change" ]
492,236
492,237
u729246375
ruby
p02719
n,k = gets.split(/ /).map(&:to_i) n = n % k prev = 0 while prev != n prev = n i = abs(n - k) n = i if i < n end puts n
n,k = gets.split(/ /).map(&:to_i) n = n % k prev = 0 while prev != n prev = n i = (n - k).abs n = i if i < n end puts n
[ "call.add" ]
492,277
492,278
u444318984
ruby
p02719
n,k = gets.split(/ /).map(&:to_i) n = n % k prev = n while prev != n prev = n i = abs(n - k) n = i if i < n end puts n
n,k = gets.split(/ /).map(&:to_i) n = n % k prev = 0 while prev != n prev = n i = (n - k).abs n = i if i < n end puts n
[ "assignment.value.change", "identifier.replace.remove", "literal.replace.add", "call.add" ]
492,279
492,278
u444318984
ruby
p02719
n, k = gets.rstrip.split(" ").map { |c| c.to_i} if n < k then puts n exit end div = n / k a = n - div*k b = a - k puts [a.abs, b.abs].min
n, k = gets.rstrip.split(" ").map { |c| c.to_i} if n < (n-k).abs then puts n exit end div = n / k a = n - div*k b = a - k puts [a.abs, b.abs].min
[ "control_flow.branch.if.condition.change", "call.add" ]
492,391
492,392
u644533034
ruby
p02720
k=gets.to_i z=*1..9 a=0 k.times{ a=z.shift b=a%10 z << a*10 + (a-1) if a != 0 z << a*10 + a z << a*10 + (a+1) if a != 9 } p a
k=gets.to_i z=*1..9 a=0 k.times{ a=z.shift b=a%10 z << a*10 + (b-1) if b != 0 z << a*10 + b z << a*10 + (b+1) if b != 9 } p a
[ "identifier.change", "expression.operation.binary.change", "control_flow.branch.if.condition.change" ]
492,920
492,921
u128694188
ruby
p02720
queue = (1..9).map {|x| [x] } # k = gets.to_i k = 100000 count = 0 ans = -1 loop do x = queue.shift count += 1 if count == k ans = x break end if x.last == 0 queue << (x + [0]) << (x + [1]) elsif x.last != 9 last = x.last queue << (x + [last - 1]) << (x + [last]) << (x + [last + 1]) elsif x.last == 9 queue << (x + [8]) << (x + [9]) end end puts ans.join('')
queue = (1..9).map {|x| [x] } k = gets.to_i count = 0 ans = -1 loop do x = queue.shift count += 1 if count == k ans = x break end if x.last == 0 queue << (x + [0]) << (x + [1]) elsif x.last != 9 last = x.last queue << (x + [last - 1]) << (x + [last]) << (x + [last + 1]) elsif x.last == 9 queue << (x + [8]) << (x + [9]) end end puts ans.join('')
[ "assignment.value.change", "identifier.replace.add", "literal.replace.remove", "call.add" ]
492,955
492,956
u969729424
ruby
p02720
K = gets.to_i lun2 = (1 .. 9).to_a i = 0 until lun2.size > K a = lun2[i] d = a % 10 if d == 0 lun2 << a * 10 lun2 << a * 10 + 1 elsif d == 9 lun2 << a * 10 + 8 lun2 << a * 10 + 9 else lun2 << a * 10 + d lun2 << a * 10 + d - 1 lun2 << a * 10 + d + 1 end i += 1 end puts lun2[K - 1]
K = gets.to_i lun2 = (1 .. 9).to_a i = 0 until lun2.size >= K a = lun2[i] d = a % 10 if d == 0 lun2 << a * 10 lun2 << a * 10 + 1 elsif d == 9 lun2 << a * 10 + 8 lun2 << a * 10 + 9 else lun2 << a * 10 + d - 1 lun2 << a * 10 + d lun2 << a * 10 + d + 1 end i += 1 end puts lun2[K - 1]
[ "expression.operator.compare.change", "expression.operation.binary.change", "expression.operation.binary.remove" ]
493,197
493,198
u627981707
ruby
p02720
require 'set' def main(str) k = str.to_i currents = Set.new([1, 2, 3, 4, 5, 6, 7, 8, 9]) results = currents loop do nexts = Set.new currents.each do |x| m = x % 10 n = 10 * x case m when 0 nexts << n + 0 nexts << n + 1 when 9 nexts << n + 9 nexts << n + 8 else nexts << n + m + 1 nexts << n + m nexts << n + m - 1 end end results += nexts currents = nexts break if results.length > 10 ** 5 end results.sort[k - 1] end puts main($input.read.chomp)
require 'set' def main(str) k = str.to_i currents = Set.new([1, 2, 3, 4, 5, 6, 7, 8, 9]) results = currents loop do nexts = Set.new currents.each do |x| m = x % 10 n = 10 * x case m when 0 nexts << n + 0 nexts << n + 1 when 9 nexts << n + 9 nexts << n + 8 else nexts << n + m + 1 nexts << n + m nexts << n + m - 1 end end results += nexts currents = nexts break if results.length > 10 ** 5 end results.sort[k - 1] end puts main($stdin.read.chomp)
[ "call.arguments.change" ]
493,239
493,240
u715816272
ruby
p02720
require 'set' def main(str) k = str.to_i currents = Set.new([1, 2, 3, 4, 5, 6, 7, 8, 9]) results = currents loop do nexts = Set.new currents.each do |x| m = x % 10 n = 10 * x case m when 0 nexts << n + 0 nexts << n + 1 when 9 nexts << n + 9 nexts << n + 8 else nexts << n + m + 1 nexts << n + m nexts << n + m - 1 end end results += nexts currents = nexts break if results.length > 10 ** 5 end results.sort[k - 1] end puts main($input.read)
require 'set' def main(str) k = str.to_i currents = Set.new([1, 2, 3, 4, 5, 6, 7, 8, 9]) results = currents loop do nexts = Set.new currents.each do |x| m = x % 10 n = 10 * x case m when 0 nexts << n + 0 nexts << n + 1 when 9 nexts << n + 9 nexts << n + 8 else nexts << n + m + 1 nexts << n + m nexts << n + m - 1 end end results += nexts currents = nexts break if results.length > 10 ** 5 end results.sort[k - 1] end puts main($stdin.read.chomp)
[ "call.arguments.change", "call.add" ]
493,241
493,240
u715816272
ruby
p02720
k = gets.to_i h = {1 => ('0'..'9').to_a } luns = [*h[1]] i = 2 while true do nums = h[i-1] h[i] = nums.flat_map do |n| a = n[0].to_i [a-1, a, a+1].select {|b| b >= 0 && b < 10}.map{|b| b.to_s + n } end.uniq luns = [*luns, *h[i]] new = luns.map(&:to_i).uniq if new.size >= k puts new.sort[k] exit 0 end i += 1 end
k = gets.to_i h = {1 => ('0'..'9').to_a } luns = [*h[1]] i = 2 while true do nums = h[i-1] h[i] = nums.flat_map do |n| a = n[0].to_i [a-1, a, a+1].select {|b| b >= 0 && b < 10}.map{|b| b.to_s + n } end.uniq luns = [*luns, *h[i]] new = luns.map(&:to_i).uniq if new.size > k puts new.sort[k] exit 0 end i += 1 end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
493,282
493,283
u173515518
ruby
p02721
n,k,c=gets.split.map &:to_i s=gets.chomp idxs=[] s.each_char.with_index{|c,i| idxs.push(i) if c==?o } cs=[0] t,nidx=0,n-1 idxs.reverse_each{|e| if e<=nidx cs.unshift(t+=1) nidx-=c+1 else cs.unshift(t) end } nidx=0 idxs.each_with_index{|e,i| next if e<nidx puts e+1 if cs[i]<=k && cs[i]>cs[i+1] break if k==1 k-=1 nidx=e+c+1 }
n,k,c=gets.split.map &:to_i s=gets.chomp idxs=[] s.each_char.with_index{|c,i| idxs.push(i) if c==?o } cs=[0] t,nidx=0,n-1 idxs.reverse_each{|e| if e<=nidx cs.unshift(t+=1) nidx=e-c-1 else cs.unshift(t) end } nidx=0 idxs.each_with_index{|e,i| next if e<nidx puts e+1 if cs[i]<=k && cs[i]>cs[i+1] break if k==1 k-=1 nidx=e+c+1 }
[ "assignment.value.change", "misc.opposites", "expression.operator.arithmetic.change", "expression.operation.binary.change" ]
493,868
493,869
u567677663
ruby
p02722
require "prime" # n - 1 の約数で、1以外であれば題意を満たす def solve_1(n) Prime.prime_division(n-1).map(&:last).map(&:succ).inject(:*)-1 end # nの約数について、割りきれなくなるまで破った後、mod==1なら題意を満たす # また、n,n-1の両方に含まれる約数は無い def solve_2(n) a = [] 1.upto(n) do |i| break if i*i > n if n % i == 0 a << i a << n/i if i != n/i end end a = a - [1] ans = 0 a.each do |i| m = n m /= i while m % i == 0 if m % i == 1 ans += 1 end end ans end n = gets.to_i ans = solve_1(n) + solve_2(n) puts ans
require "prime" # n - 1 の約数で、1以外であれば題意を満たす def solve_1(n) Prime.prime_division(n-1).map(&:last).map(&:succ).inject(1,:*)-1 end # nの約数について、割りきれなくなるまで破った後、mod==1なら題意を満たす # また、n,n-1の両方に含まれる約数は無い def solve_2(n) a = [] 1.upto(n) do |i| break if i*i > n if n % i == 0 a << i a << n/i if i != n/i end end a = a - [1] ans = 0 a.each do |i| m = n m /= i while m % i == 0 if m % i == 1 ans += 1 end end ans end n = gets.to_i ans = solve_1(n) + solve_2(n) puts ans
[ "call.arguments.add" ]
494,183
494,184
u106964380
ruby
p02722
require 'set'; require 'prime' INF=Float::INFINITY; MOD=10**9+7 n_orig = gets.chomp.to_i if n_orig == 2 puts 1 exit elsif n_orig == 3 puts 2 exit elsif n_orig == 4 puts 3 exit elsif n_orig == 5 puts 3 exit end de = false root = Math.sqrt(n_orig).to_i p ['root', root] if de div = n_orig - 1 ans = 0 2.upto(root) do |i| n = n_orig while n % i == 0 n /= i end n %= i # = if n == 1 p ['i', i] if de ans += 1 if div % i == 0 p ['div', div / i] if de ans += 1 end end end puts ans + 2
require 'set'; require 'prime' INF=Float::INFINITY; MOD=10**9+7 n_orig = gets.chomp.to_i if n_orig == 2 puts 1 exit elsif n_orig == 3 puts 2 exit elsif n_orig == 4 puts 3 exit elsif n_orig == 5 puts 3 exit end de = false root = Math.sqrt(n_orig).to_i p ['root', root] if de div = n_orig - 1 ans = 0 2.upto(root) do |i| n = n_orig while n % i == 0 n /= i end n %= i # = if n == 1 p ['i', i] if de ans += 1 if div % i == 0 && div/i > root p ['div', div / i] if de ans += 1 end end end puts ans + 2
[ "control_flow.branch.if.condition.change" ]
494,453
494,454
u524019694
ruby
p02723
s = gets if s[2]==s[3] && s[4]==s[5] put :Yes else puts :No end
s = gets if s[2]==s[3] && s[4]==s[5] puts :Yes else puts :No end
[ "misc.typo", "identifier.change" ]
494,720
494,721
u976045235
ruby
p02723
s = gets.chomp.split('') if(s[2] == s[3] || s[4] == s[5]) puts "Yes" else puts "No" end
s = gets.chomp.split('') if(s[2] == s[3] && s[4] == s[5]) puts "Yes" else puts "No" end
[ "misc.opposites", "control_flow.branch.if.condition.change" ]
494,771
494,772
u614201073
ruby
p02723
s = gets.chomp if s[2] == s[3] || s[4] == s[5] puts 'Yes' else puts 'No' end
s = gets.chomp if s[2] == s[3] && s[4] == s[5] puts 'Yes' else puts 'No' end
[ "misc.opposites", "control_flow.branch.if.condition.change" ]
495,136
495,137
u781354194
ruby
p02723
s = gets p (s[2] == s[3] && s[4] == s[5]) ? 'Yes' : 'No'
s = gets puts s[2] == s[3] && s[4] == s[5] ? 'Yes' : 'No'
[ "call.function.change", "io.output.change", "control_flow.branch.if.condition.change" ]
495,515
495,516
u026658011
ruby
p02723
s = gets p s[2] == s[3] && s[4] == s[5] ? 'Yes' : 'No'
s = gets puts s[2] == s[3] && s[4] == s[5] ? 'Yes' : 'No'
[ "call.function.change", "io.output.change" ]
495,517
495,516
u026658011
ruby
p02723
str = gets.to_s p (str[2].eql?(str[3]) && str[4].eql?(str[5])) ? "Yes" : "No"
str = gets.to_s puts (str[2].eql?(str[3]) && str[4].eql?(str[5])) ? "Yes" : "No"
[ "call.function.change", "io.output.change" ]
496,066
496,067
u406630780
ruby
p02723
S = gets.split puts (S[2] == S[3] && S[4] == S[5]) ? 'Yes' : 'No'
S = gets.strip puts (S[2] == S[3] && S[4] == S[5]) ? 'Yes' : 'No'
[ "assignment.value.change", "identifier.change" ]
496,118
496,119
u053656954
ruby
p02723
s = gets.chomp.split('') y = 'No' y = 'yes' if s[2] == s[3] && s[4] == s[5] puts y
s = gets.chomp.split('') y = 'No' y = 'Yes' if s[2] == s[3] && s[4] == s[5] puts y
[ "literal.string.change", "literal.string.case.change", "assignment.value.change" ]
496,183
496,184
u278047632
ruby
p02723
S = gets.chomp isCoffeely = "No" if S[2] == S[3] then if S[4] == S[5] then isCoffeely = "Yes" end end puts is isCoffeely
S = gets.chomp isCoffeely = "No" if S[2] == S[3] then if S[4] == S[5] then isCoffeely = "Yes" end end puts isCoffeely
[ "call.arguments.change" ]
496,642
496,643
u394640249
ruby
p02723
# Wrote in Mar 28, 2020 21:00 by reetok require 'time' require 'prime' require 'bigdecimal' def inp(type=:to_i,spst=" ") return eval("gets.chomp.split(#{spst}).map(&:#{type})") end def inpf() return self.inp(:to_f," ") end def inps() return self.inp(:to_s," ") end def r_up(a, b) (a/b).ceil end def r_down(a, b) (a/b).floor 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 def minp(n,datatype=".to_i") t = [] n.times do t.push(eval("gets.chomp#{datatype}")) end return t end def yes() puts "Yes" end def no() puts "No" end def ynju(bool,yes="Yes",no="No") puts (bool ? yes : no) end class Integer def divisor_list devisors = [1] 2.upto(self/2) do |i| devisors << i if self%i == 0 end devisors << self return devisors.uniq.sort end end class Array def upper(a) #aより上 self.sort.select{|n|n>=a} end def downer(a) #aより下 self.sort.select{|n|n<=a} end end #--------------- s = gets.to_s if s[2]==s[4]&&s[4]==s[5] yes else no end
# Wrote in Mar 28, 2020 21:00 by reetok require 'time' require 'prime' require 'bigdecimal' def inp(type=:to_i,spst=" ") return eval("gets.chomp.split(#{spst}).map(&:#{type})") end def inpf() return self.inp(:to_f," ") end def inps() return self.inp(:to_s," ") end def r_up(a, b) (a/b).ceil end def r_down(a, b) (a/b).floor 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 def minp(n,datatype=".to_i") t = [] n.times do t.push(eval("gets.chomp#{datatype}")) end return t end def yes() puts "Yes" end def no() puts "No" end def ynju(bool,yes="Yes",no="No") puts (bool ? yes : no) end class Integer def divisor_list devisors = [1] 2.upto(self/2) do |i| devisors << i if self%i == 0 end devisors << self return devisors.uniq.sort end end class Array def upper(a) #aより上 self.sort.select{|n|n>=a} end def downer(a) #aより下 self.sort.select{|n|n<=a} end end #--------------- s = gets.chomp if s[2]==s[3]&&s[4]==s[5] yes else no end
[ "assignment.value.change", "identifier.change", "literal.number.integer.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change" ]
496,663
496,664
u891258088
ruby
p02723
# Wrote in Mar 28, 2020 21:00 by reetok require 'time' require 'prime' require 'bigdecimal' def inp(type=:to_i,spst=" ") return eval("gets.chomp.split(#{spst}).map(&:#{type})") end def inpf() return self.inp(:to_f," ") end def inps() return self.inp(:to_s," ") end def r_up(a, b) (a/b).ceil end def r_down(a, b) (a/b).floor 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 def minp(n,datatype=".to_i") t = [] n.times do t.push(eval("gets.chomp#{datatype}")) end return t end def yes() puts "Yes" end def no() puts "No" end def ynju(bool,yes="Yes",no="No") puts (bool ? yes : no) end class Integer def divisor_list devisors = [1] 2.upto(self/2) do |i| devisors << i if self%i == 0 end devisors << self return devisors.uniq.sort end end class Array def upper(a) #aより上 self.sort.select{|n|n>=a} end def downer(a) #aより下 self.sort.select{|n|n<=a} end end #--------------- s = inp if s[2]==s[4]&&s[4]==s[5] yes else no end
# Wrote in Mar 28, 2020 21:00 by reetok require 'time' require 'prime' require 'bigdecimal' def inp(type=:to_i,spst=" ") return eval("gets.chomp.split(#{spst}).map(&:#{type})") end def inpf() return self.inp(:to_f," ") end def inps() return self.inp(:to_s," ") end def r_up(a, b) (a/b).ceil end def r_down(a, b) (a/b).floor 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 def minp(n,datatype=".to_i") t = [] n.times do t.push(eval("gets.chomp#{datatype}")) end return t end def yes() puts "Yes" end def no() puts "No" end def ynju(bool,yes="Yes",no="No") puts (bool ? yes : no) end class Integer def divisor_list devisors = [1] 2.upto(self/2) do |i| devisors << i if self%i == 0 end devisors << self return devisors.uniq.sort end end class Array def upper(a) #aより上 self.sort.select{|n|n>=a} end def downer(a) #aより下 self.sort.select{|n|n<=a} end end #--------------- s = gets.chomp if s[2]==s[3]&&s[4]==s[5] yes else no end
[ "assignment.value.change", "call.add", "literal.number.integer.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change" ]
496,665
496,664
u891258088
ruby
p02723
input = gets.split("") if (input[2] == input[3] && input[4] == input[5]) puts "YES" else puts "NO" end
input = gets.split("") if (input[2] == input[3] && input[4] == input[5]) puts "Yes" else puts "No" end
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
496,713
496,714
u977243856
ruby
p02724
s = gets.to_i count_500 = x / 500 rest_500 = x % 500 count_5 = rest_500 / 5 happy = (count_500 * 1000) + (count_5 * 5) puts happy
s = gets.to_i count_500 = s / 500 rest_500 = s % 500 count_5 = rest_500 / 5 happy = (count_500 * 1000) + (count_5 * 5) puts happy
[ "assignment.value.change", "identifier.change", "expression.operation.binary.change" ]
497,465
497,464
u684458716
ruby
p02724
x = gets.to_s a = x / 500 b = x - a c = b / 5 print a * 1000 + c * 5
x = gets.to_i a = x / 500 b = x - (a * 500) c = b / 5 print a * 1000 + c * 5
[ "call.function.change", "type_conversion.to_integer.change", "type_conversion.to_number.change" ]
497,559
497,560
u569559028
ruby
p02724
x = gets.to_i a = x / 500 b = x - a c = b / 5 return a * 1000 + c * 5
x = gets.to_i a = x / 500 b = x - (a * 500) c = b / 5 print a * 1000 + c * 5
[ "function.return_value.change" ]
497,561
497,560
u569559028
ruby
p02724
x = gets.to_s a = x / 500 b = x - a c = b / 5 return a * 1000 + c * 5
x = gets.to_i a = x / 500 b = x - (a * 500) c = b / 5 print a * 1000 + c * 5
[ "call.function.change", "type_conversion.to_integer.change", "type_conversion.to_number.change", "function.return_value.change" ]
497,562
497,560
u569559028
ruby
p02724
money = gets.to_i div, mod = money.div_mod(500) ureshi = div*1000 div = mod/5 ureshi += div*5 puts "#{ureshi}"
money = gets.to_i div, mod = money.divmod(500) ureshi = div*1000 div = mod/5 ureshi += div*5 puts "#{ureshi}"
[ "assignment.value.change", "identifier.change" ]
497,969
497,970
u406630780
ruby
p02724
money = gets.to_i div, mod = money.div_mod(500) ureshi = div*1000 div = mod/5 ureshi += div*5 puts "ureshi"
money = gets.to_i div, mod = money.divmod(500) ureshi = div*1000 div = mod/5 ureshi += div*5 puts "#{ureshi}"
[ "assignment.value.change", "identifier.change", "literal.string.change", "call.arguments.change" ]
497,971
497,970
u406630780
ruby
p02724
r=gets.to_i l=r/500*1000 r-=p/2 l=r/5*5 p l
r=gets.to_i l=r/500*1000 r-=l/2 l+=r/5*5 p l
[ "identifier.change", "expression.operation.binary.change", "assignment.value.change" ]
498,001
498,002
u370564845
ruby
p02724
x = gets.to_i m, n = x.divmod(500) a1 = m * 100 + (n / 5) * 5 print a1
x = gets.to_i m, n = x.divmod(500) a1 = m * 1000 + (n / 5) * 5 print a1
[ "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.change" ]
498,737
498,738
u771131483
ruby
p02724
class InputLine def self.to_s gets.chomp end def self.to_i InputLine.to_s.to_i end def self.to_f InputLine.to_s.to_f end def self.to_sa InputLine.to_s.split(' ') end def self.to_ia InputLine.to_sa.map(&:to_i) end def self.to_fa InputLine.to_sa.map(&:to_f) end end def main(argv) x = InputLine.to_i p = x / 500 x = x % 500 q = x % 5 puts (p * 1000 + q * 5).to_s end if self.to_s == 'main' then main(ARGV) end
class InputLine def self.to_s gets.chomp end def self.to_i InputLine.to_s.to_i end def self.to_f InputLine.to_s.to_f end def self.to_sa InputLine.to_s.split(' ') end def self.to_ia InputLine.to_sa.map(&:to_i) end def self.to_fa InputLine.to_sa.map(&:to_f) end end def main(argv) x = InputLine.to_i p = x / 500 x = x % 500 q = x / 5 puts (p * 1000 + q * 5).to_s end if self.to_s == 'main' then main(ARGV) end
[ "expression.operator.arithmetic.change", "assignment.value.change", "expression.operation.binary.change" ]
498,774
498,775
u198355306
ruby
p02724
class InputLine def self.to_s gets.chomp end def self.to_i InputLine.to_s.to_i end def self.to_f InputLine.to_s.to_f end def self.to_sa InputLine.to_s.split(' ') end def self.to_ia InputLine.to_sa.map(&:to_i) end def self.to_fa InputLine.to_sa.map(&:to_f) end end def main(argv) x = InputLine.to_i p = x / 500 x = x % 500 q = p % 5 puts (p * 1000 + q * 5).to_s end if self.to_s == 'main' then main(ARGV) end
class InputLine def self.to_s gets.chomp end def self.to_i InputLine.to_s.to_i end def self.to_f InputLine.to_s.to_f end def self.to_sa InputLine.to_s.split(' ') end def self.to_ia InputLine.to_sa.map(&:to_i) end def self.to_fa InputLine.to_sa.map(&:to_f) end end def main(argv) x = InputLine.to_i p = x / 500 x = x % 500 q = x / 5 puts (p * 1000 + q * 5).to_s end if self.to_s == 'main' then main(ARGV) end
[]
498,776
498,775
u198355306
ruby
p02724
a = gets.chop.to_i sum = 0 sum1 = 0 while a - 500 > 0 a = a - 500 sum += 1 end while a - 5 > 0 a = a - 5 sum1 += 1 end puts sum * 1000 + sum1 * 5
a = gets.chomp.to_i sum = 0 sum1 = 0 while a - 500 >= 0 a = a - 500 sum += 1 end while a - 5 >= 0 a = a - 5 sum1 += 1 end puts sum * 1000 + sum1 * 5
[ "assignment.value.change", "identifier.change", "expression.operator.compare.change", "expression.operation.binary.change" ]
498,815
498,816
u020467031
ruby
p02724
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE'] def inpf() a=gets.chomp.split(" ").map(&:to_f)end def inps() a=gets.chomp.split(" ")end def copy(a) Marshal.load(Marshal.dump(a)) end def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end def na(n,d=0) Array.new(n,d)end def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end def inp() a=gets.chomp.split(" ").map(&:to_i)end def r_up(a, b) (a+b-1)/b end def sum(a) a.inject(:+) end def big(a,b) return (a>b)? a:b end def small(a,b) return (a<b)? a:b end x = inp[0] ans = 0 ans += x/500*1000 ans %= 500 p ans + x/5*5
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE'] def inpf() a=gets.chomp.split(" ").map(&:to_f)end def inps() a=gets.chomp.split(" ")end def copy(a) Marshal.load(Marshal.dump(a)) end def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end def na(n,d=0) Array.new(n,d)end def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end def inp() a=gets.chomp.split(" ").map(&:to_i)end def r_up(a, b) (a+b-1)/b end def sum(a) a.inject(:+) end def big(a,b) return (a>b)? a:b end def small(a,b) return (a<b)? a:b end x = inp[0] ans = 0 ans += x/500*1000 x %= 500 p ans + x/5*5
[ "identifier.change" ]
499,111
499,112
u145123922
ruby
p02725
k,_=gets.split.map(&:to_i) ary=gets.split.map(&:to_i) ans=ary.each_cons(2).reduce(0){|_,(a,b)|[b-a].max} ans=[ans,ary.first+(k-ary.last)].max puts k-ans
k,_=gets.split.map(&:to_i) ary=gets.split.map(&:to_i) ans=ary.each_cons(2).reduce(0){|r,(a,b)|[r,b-a].max} ans=[ans,ary.first+(k-ary.last)].max puts k-ans
[ "assignment.value.change", "identifier.change", "literal.array.change" ]
499,344
499,345
u465342836
ruby
p02725
# https://atcoder.jp/contests/abc160/tasks/abc160_c K, N = gets.split.map(&:to_i) As = gets.split.map(&:to_i) ans = As.each_cons(2).reduce(0) { |memo, (a1, a2)| [memo, a2 - a1].max } ans = [ans, As.first + (K - As.last)].max puts ans
# https://atcoder.jp/contests/abc160/tasks/abc160_c K, N = gets.split.map(&:to_i) As = gets.split.map(&:to_i) ans = As.each_cons(2).reduce(0) { |memo, (a1, a2)| [memo, a2 - a1].max } ans = [ans, As.first + (K - As.last)].max puts K - ans
[ "expression.operation.binary.add" ]
499,382
499,383
u091367113
ruby
p02725
circumference, house_count = gets.chomp.split(" ").map(&:to_i) houses = gets.chomp.split(" ").map(&:to_i).sort houses << (circumference + houses[0]) total = 100000000 l = 0 (1..house_count - 1).each do |i| l = [l, (houses[i] - houses[i - 1])].max end puts circumference - l
circumference, house_count = gets.chomp.split(" ").map(&:to_i) houses = gets.chomp.split(" ").map(&:to_i).sort houses << (circumference + houses[0]) l = 0 (1..house_count).each do |i| l = [l, (houses[i] - houses[i - 1])].max end puts circumference - l
[ "expression.operation.binary.remove" ]
499,521
499,522
u647061136
ruby
p02725
k, n = gets.split().map(&:to_i) a = gets.split().map(&:to_i) diff = 20 - a[-1] + a[0] (0..n-2).each do |i| diff = [diff, a[i+1] - a[i]].max end puts k - diff
k, n = gets.split().map(&:to_i) a = gets.split().map(&:to_i) diff = k - a[-1] + a[0] (0..n-2).each do |i| diff = [diff, a[i+1] - a[i]].max end puts k - diff
[ "assignment.value.change", "identifier.replace.add", "literal.replace.remove", "expression.operation.binary.change" ]
499,665
499,666
u620219777
ruby
p02725
k,n = gets.chomp.split(" ").map(&:to_i) a = gets.chomp.split(" ").map(&:to_i) max = 0 (n-1).times do |i| max = a[i+1] - a[i] if max < a[i+1] - a[i] end max = a[0] + k - a[n-1] if max < a[0] + k - a[n-1] puts max
k,n = gets.chomp.split(" ").map(&:to_i) a = gets.chomp.split(" ").map(&:to_i) max = 0 (n-1).times do |i| max = a[i+1] - a[i] if max < a[i+1] - a[i] end max = a[0] + k - a[n-1] if max < a[0] + k - a[n-1] puts k - max
[ "expression.operation.binary.add" ]
499,818
499,819
u265679940
ruby
p02725
k,n = gets.chomp.split().map(&:to_i) a = Array.new b = Array.new a = gets.chomp.split.map(&:to_i) for i in 0..n-2 b[i] = a[i+1]-a[i] end b[n-1]=k-a[n-1]+a[0] c = b.each_with_index.min(n-1).map{|i|i[1]} sum = 0 c.each{|i|sum += b[i]} puts b
k,n = gets.chomp.split().map(&:to_i) a = Array.new b = Array.new a = gets.chomp.split.map(&:to_i) for i in 0..n-2 b[i] = a[i+1]-a[i] end b[n-1]=k-a[n-1]+a[0] c = b.each_with_index.min(n-1).map{|i|i[1]} sum = 0 c.each{|i|sum += b[i]} puts sum
[ "identifier.change", "call.arguments.change" ]
500,050
500,051
u700616733
ruby
p02725
k,n = gets.chomp.split().map(&:to_i) a = Array.new b = Array.new a = gets.chomp.split.map(&:to_i) for i in 0..n-2 b[i] = a[i+1]-a[i] end b[n-1]=a[n-1]-a[0] c = b.each_with_index.min(n-1).map{|i|i[1]} sum = 0 c.each{|i|sum += b[i]} puts sum
k,n = gets.chomp.split().map(&:to_i) a = Array.new b = Array.new a = gets.chomp.split.map(&:to_i) for i in 0..n-2 b[i] = a[i+1]-a[i] end b[n-1]=k-a[n-1]+a[0] c = b.each_with_index.min(n-1).map{|i|i[1]} sum = 0 c.each{|i|sum += b[i]} puts sum
[ "misc.opposites", "expression.operator.arithmetic.change", "assignment.value.change", "expression.operation.binary.change" ]
500,052
500,051
u700616733
ruby
p02725
k,n = gets.chomp.split().map(&:to_i) a = Array.new b = Array.new a = gets.chomp.split.map(&:to_i) for i in 0..n-2 b[i] = a[i+1]-a[i] end b[n-1]=k-a[n-1] c = b.each_with_index.min(n-1).map{|i|i[1]} sum = 0 c.each{|i|sum += b[i]} puts sum
k,n = gets.chomp.split().map(&:to_i) a = Array.new b = Array.new a = gets.chomp.split.map(&:to_i) for i in 0..n-2 b[i] = a[i+1]-a[i] end b[n-1]=k-a[n-1]+a[0] c = b.each_with_index.min(n-1).map{|i|i[1]} sum = 0 c.each{|i|sum += b[i]} puts sum
[ "assignment.change" ]
500,053
500,051
u700616733
ruby
p02725
i = gets.chomp.split(" ").map(&:to_i) n = gets.chomp.split(" ").map(&:to_i) k=[] (i[1]-1).times{|t| k[t]=n[t+1]-n[t] } k[i[1]-1]= i[0] - n[i[1]-1] + n[0] k.sort! k.delete_at(-1) p k puts k.inject(:+)
i = gets.chomp.split(" ").map(&:to_i) n = gets.chomp.split(" ").map(&:to_i) k=[] (i[1]-1).times{|t| k[t]=n[t+1]-n[t] } k[i[1]-1]= i[0] - n[i[1]-1] + n[0] k.sort! k.delete_at(-1) puts k.inject(:+)
[ "call.remove" ]
500,136
500,137
u312004378
ruby
p02725
k,n=gets.split.map(&:to_i) as=gets.split.map(&:to_i) diff=[] n.times do |i| if i==n-1 diff<<(k-as[i]) else diff<<(as[i+1]-as[i]) end end diff.sort! puts diff[0..-2].inject(:+)
k,n=gets.split.map(&:to_i) as=gets.split.map(&:to_i) diff=[] n.times do |i| if i==n-1 diff<<(k-as[i]+as[0]) else diff<<(as[i+1]-as[i]) end end diff.sort! puts diff[0..-2].inject(:+)
[ "expression.operation.binary.add" ]
500,202
500,203
u602591412
ruby
p02725
k,n = gets.chomp.split.map(&:to_i) a = gets.chomp.split.map(&:to_i) def calc_distance(houses, start_point=nil, end_point=nil) return (houses[-1] - houses[0]) if start_point.nil? houses[(start_point - 1)] + end_point - houses[start_point] end distances = a.slice(0, a.length - 1).map.with_index { |e, i| a[(i+1)] - e } start_point = distances.index(distance.max) + 1 puts [calc_distance(a, start_point, k), calc_distance(a)].min
k,n = gets.chomp.split.map(&:to_i) a = gets.chomp.split.map(&:to_i) def calc_distance(houses, start_point=nil, end_point=nil) return (houses[-1] - houses[0]) if start_point.nil? houses[(start_point - 1)] + end_point - houses[start_point] end distances = a.slice(0, a.length - 1).map.with_index { |e, i| a[(i+1)] - e } start_point = distances.index(distances.max) + 1 puts [calc_distance(a, start_point, k), calc_distance(a)].min
[ "assignment.value.change", "identifier.change", "call.arguments.change", "expression.operation.binary.change" ]
500,239
500,240
u433171793
ruby
p02725
# frozen_string_literal: true @k, @n = gets.split.map(&:to_i) array = gets.split.map(&:to_i).sort list = [] array.each_with_index do |e, i| if i < array.size - 1 list.push(array[i + 1] - e) else list.push(@k - e) end end puts @k - list.max
# frozen_string_literal: true @k, @n = gets.split.map(&:to_i) array = gets.split.map(&:to_i).sort list = [] array.each_with_index do |e, i| if i < array.size - 1 list.push(array[i + 1] - e) else list.push(@k + array[0] - e) end end puts @k - list.max
[ "expression.operation.binary.add" ]
500,559
500,560
u393913844
ruby
p02725
k,n = gets.split.map(&:to_i) an = gets.split.map(&:to_i) #an.push(k) bn = Array.new (an.length-1).times{ |i| bn.push(an[i+1]-an[i]) } bn.push( k-an[-1]+an[0] ) #------------------------------------ c=n-1 total=0 #最初の距離を計算 c.times{|t| total += bn[t] } now_len = total #--------------------------- j = bn.length-1 for num in 1..j do if num+c-1 > j then out = num+c-(bn.length+1) now_len = now_len-bn[num-1]+bn[out] else now_len = now_len-bn[num-1]+bn[num+c-1] end if total > now_len then total = now_len end p now_len end p total
k,n = gets.split.map(&:to_i) an = gets.split.map(&:to_i) #an.push(k) bn = Array.new (an.length-1).times{ |i| bn.push(an[i+1]-an[i]) } bn.push( k-an[-1]+an[0] ) #------------------------------------ c=n-1 total=0 #最初の距離を計算 c.times{|t| total += bn[t] } now_len = total #--------------------------- j = bn.length-1 for num in 1..j do if num+c-1 > j then out = num+c-(bn.length+1) now_len = now_len-bn[num-1]+bn[out] else now_len = now_len-bn[num-1]+bn[num+c-1] end if total > now_len then total = now_len end end p total
[ "call.remove" ]
500,622
500,623
u999905658
ruby
p02725
k,n = gets.split.map(&:to_i) an = gets.split.map(&:to_i) #an.push(k) bn = Array.new (an.length-1).times{ |i| bn.push(an[i+1]-an[i]) } bn.push( k-an[-1]+an[0] ) #------------------------------------ c=n-1 total=0 #最初の距離を計算 c.times{|t| total += bn[t] } now_len = total #--------------------------- j = bn.length-1 for num in 1..j do if num+c-1 > j then out = num+c-(bn.length+1) now_len = now_len-bn[num-1]+bn[out] else now_len = now_len-bn[num-1]+bn[num+c-1] end if total > now_len then total = now_len end end p now_len
k,n = gets.split.map(&:to_i) an = gets.split.map(&:to_i) #an.push(k) bn = Array.new (an.length-1).times{ |i| bn.push(an[i+1]-an[i]) } bn.push( k-an[-1]+an[0] ) #------------------------------------ c=n-1 total=0 #最初の距離を計算 c.times{|t| total += bn[t] } now_len = total #--------------------------- j = bn.length-1 for num in 1..j do if num+c-1 > j then out = num+c-(bn.length+1) now_len = now_len-bn[num-1]+bn[out] else now_len = now_len-bn[num-1]+bn[num+c-1] end if total > now_len then total = now_len end end p total
[ "identifier.change", "call.arguments.change" ]
500,624
500,623
u999905658
ruby
p02725
k,n = gets.split.map(&:to_i) an = gets.split.map(&:to_i) #an.push(k) bn = Array.new (an.length-1).times{ |i| bn.push(an[i+1]-an[i]) } bn.push( k-an[-1]+an[0] ) #------------------------------------ c=n-1 total=0 #最初の距離を計算 c.times{|t| total += bn[t] } now_len = total #--------------------------- j = bn.length-1 for num in 1..j do if num+c-1 > j then out = num+c-(bn.length+1) now_len = total-bn[num-1]+bn[out] else now_len = now_len-bn[num-1]+bn[num+c-1] end if total > now_len then total = now_len end end p now_len
k,n = gets.split.map(&:to_i) an = gets.split.map(&:to_i) #an.push(k) bn = Array.new (an.length-1).times{ |i| bn.push(an[i+1]-an[i]) } bn.push( k-an[-1]+an[0] ) #------------------------------------ c=n-1 total=0 #最初の距離を計算 c.times{|t| total += bn[t] } now_len = total #--------------------------- j = bn.length-1 for num in 1..j do if num+c-1 > j then out = num+c-(bn.length+1) now_len = now_len-bn[num-1]+bn[out] else now_len = now_len-bn[num-1]+bn[num+c-1] end if total > now_len then total = now_len end end p total
[ "assignment.value.change", "identifier.change", "expression.operation.binary.change", "call.arguments.change" ]
500,625
500,623
u999905658
ruby
p02725
k,n = gets.split.map(&:to_i) a=gets.chomp.split.map(&:to_i) p a i = 0 for num in 0..n-2 do if i<=a[num+1]-a[num] i = a[num+1]-a[num] end end if k-a[n-1]+a[0]>i puts k-(k-a[n-1]+a[0]) else puts k-i end
k,n = gets.split.map(&:to_i) a=gets.chomp.split.map(&:to_i) i = 0 for num in 0..n-2 do if i<=a[num+1]-a[num] i = a[num+1]-a[num] end end if k-a[n-1]+a[0]>i puts k-(k-a[n-1]+a[0]) else puts k-i end
[ "call.remove" ]
500,922
500,923
u005184477
ruby
p02725
# Wrote in Mar 28, 2020 21:13 by reetok require 'time' require 'prime' require 'bigdecimal' def inp(type=:to_i,spst=" ") return eval("gets.chomp.split(#{spst}).map(&:#{type})") end def inpf() return self.inp(:to_f," ") end def inps() return self.inp(:to_s," ") end def r_up(a, b) (a/b).ceil end def r_down(a, b) (a/b).floor 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 def minp(n,datatype=".to_i") t = [] n.times do t.push(eval("gets.chomp#{datatype}")) end return t end def yes() puts "Yes" end def no() puts "No" end def ynju(bool,yes="Yes",no="No") puts (bool ? yes : no) end class Integer def divisor_list devisors = [1] 2.upto(self/2) do |i| devisors << i if self%i == 0 end devisors << self return devisors.uniq.sort end end class Array def upper(a) #aより上 self.sort.select{|n|n>=a} end def downer(a) #aより下 self.sort.select{|n|n<=a} end end #--------------- k,m = inp a = inp sences = [] a.size.each do |n| if n==0 sences.push(k-a[a.size-1]+a[0]) else sences.push(a[n]-a[n-1]) end end puts k-sences.max
# Wrote in Mar 28, 2020 21:13 by reetok require 'time' require 'prime' require 'bigdecimal' def inp(type=:to_i,spst=" ") return eval("gets.chomp.split(#{spst}).map(&:#{type})") end def inpf() return self.inp(:to_f," ") end def inps() return self.inp(:to_s," ") end def r_up(a, b) (a/b).ceil end def r_down(a, b) (a/b).floor 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 def minp(n,datatype=".to_i") t = [] n.times do t.push(eval("gets.chomp#{datatype}")) end return t end def yes() puts "Yes" end def no() puts "No" end def ynju(bool,yes="Yes",no="No") puts (bool ? yes : no) end class Integer def divisor_list devisors = [1] 2.upto(self/2) do |i| devisors << i if self%i == 0 end devisors << self return devisors.uniq.sort end end class Array def upper(a) #aより上 self.sort.select{|n|n>=a} end def downer(a) #aより下 self.sort.select{|n|n<=a} end end #--------------- k,m = inp a = inp sences = [] a.size.times do |n| if n==0 sences.push(k-a[a.size-1]+a[0]) else sences.push(a[n]-a[n-1]) end end puts k-sences.max
[ "identifier.change" ]
501,574
501,575
u891258088
ruby
p02725
# Wrote in Mar 28, 2020 21:13 by reetok require 'time' require 'prime' require 'bigdecimal' def inp(type=:to_i,spst=" ") return eval("gets.chomp.split(#{spst}).map(&:#{type})") end def inpf() return self.inp(:to_f," ") end def inps() return self.inp(:to_s," ") end def r_up(a, b) (a/b).ceil end def r_down(a, b) (a/b).floor 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 def minp(n,datatype=".to_i") t = [] n.times do t.push(eval("gets.chomp#{datatype}")) end return t end def yes() puts "Yes" end def no() puts "No" end def ynju(bool,yes="Yes",no="No") puts (bool ? yes : no) end class Integer def divisor_list devisors = [1] 2.upto(self/2) do |i| devisors << i if self%i == 0 end devisors << self return devisors.uniq.sort end end class Array def upper(a) #aより上 self.sort.select{|n|n>=a} end def downer(a) #aより下 self.sort.select{|n|n<=a} end end #--------------- k,n = inp a = inp sences = [] a.size.each do |n| if n==0 sences.push(k-a[a.size-1]+a[0]) else sences.push(a[n]-a[n-1]) end end puts k-sences.max
# Wrote in Mar 28, 2020 21:13 by reetok require 'time' require 'prime' require 'bigdecimal' def inp(type=:to_i,spst=" ") return eval("gets.chomp.split(#{spst}).map(&:#{type})") end def inpf() return self.inp(:to_f," ") end def inps() return self.inp(:to_s," ") end def r_up(a, b) (a/b).ceil end def r_down(a, b) (a/b).floor 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 def minp(n,datatype=".to_i") t = [] n.times do t.push(eval("gets.chomp#{datatype}")) end return t end def yes() puts "Yes" end def no() puts "No" end def ynju(bool,yes="Yes",no="No") puts (bool ? yes : no) end class Integer def divisor_list devisors = [1] 2.upto(self/2) do |i| devisors << i if self%i == 0 end devisors << self return devisors.uniq.sort end end class Array def upper(a) #aより上 self.sort.select{|n|n>=a} end def downer(a) #aより下 self.sort.select{|n|n<=a} end end #--------------- k,m = inp a = inp sences = [] a.size.times do |n| if n==0 sences.push(k-a[a.size-1]+a[0]) else sences.push(a[n]-a[n-1]) end end puts k-sences.max
[ "assignment.variable.change", "identifier.change" ]
501,576
501,575
u891258088
ruby
p02727
class Problem attr_accessor :a, :b, :n, :m, :h, :w, :ans, :c ,:x, :y def initialize @x,@y,@a,@b,@c = gets.to_s.split.map{ |v| v.to_i } @p = gets.to_s.split.map{ |v| v.to_i }.sort!.reverse!.take(a) @q = gets.to_s.split.map{ |v| v.to_i }.sort!.reverse!.take(b) @r = gets.to_s.split.map{ |v| v.to_i } @all = (@p + @q + @r).sort!.reverse!.take(x+y) end def solve puts @all.sum end end pb = Problem.new pb.solve # pp pb if ENV['USER'] == 'tamura'
class Problem attr_accessor :a, :b, :n, :m, :h, :w, :ans, :c ,:x, :y def initialize @x,@y,@a,@b,@c = gets.to_s.split.map{ |v| v.to_i } @p = gets.to_s.split.map{ |v| v.to_i }.sort!.reverse!.take(x) @q = gets.to_s.split.map{ |v| v.to_i }.sort!.reverse!.take(y) @r = gets.to_s.split.map{ |v| v.to_i } @all = (@p + @q + @r).sort!.reverse!.take(x+y) end def solve puts @all.sum end end pb = Problem.new pb.solve # pp pb if ENV['USER'] == 'tamura'
[ "assignment.value.change", "identifier.change", "call.arguments.change" ]
503,016
503,017
u106964380
ruby
p02727
x, y, a, b, c = gets.split.map(&:to_i) p = gets.split.map(&:to_i) q = gets.split.map(&:to_i) r = gets.split.map(&:to_i) puts (p[-x, x] + q[-y, y] + r).sort[-(x + y), x + y].reduce(0) {|i, j| i + j}
x, y, a, b, c = gets.split.map(&:to_i) p = gets.split.map(&:to_i) q = gets.split.map(&:to_i) r = gets.split.map(&:to_i) puts (p.sort[-x, x] + q.sort[-y, y] + r).sort[-(x + y), x + y].reduce(0) {|i, j| i + j}
[ "call.add" ]
503,026
503,027
u392423112
ruby
p02727
X, Y, A, B, C = gets.split.map &:to_i P = gets.split.map &:to_i Q = gets.split.map &:to_i R = gets.split.map &:to_i P = P.max(X).sort Q = Q.max(Y).sort PQ = (P + Q).sort R.sort! p PQ.zip(R).map{|a, b| [a, (b || 0)].max }.inject:+
X, Y, A, B, C = gets.split.map &:to_i P = gets.split.map &:to_i Q = gets.split.map &:to_i R = gets.split.map &:to_i P = P.max(X).sort Q = Q.max(Y).sort PQ = (P + Q).sort R.sort!.reverse! p PQ.zip(R).map{|a, b| [a, (b || 0)].max }.inject:+
[ "call.add" ]
504,071
504,072
u711705317
ruby
p02729
n, m = gets.split.map(&:to_i) puts = n*(n-1) / 2 + m*(m-1) / 2
n, m = gets.split.map(&:to_i) puts n*(n-1) / 2 + m*(m-1) / 2
[]
504,876
504,877
u684458716
ruby
p02729
n, m = gets.split.map(&:to_i) puts = n(n-1)/2 + m(m-1)/2
n, m = gets.split.map(&:to_i) puts n*(n-1) / 2 + m*(m-1) / 2
[ "call.arguments.change" ]
504,878
504,877
u684458716
ruby
p02729
N,M = gets.split.map &:to_i p N*(N-1) + M*(M-1)
N,M = gets.split.map &:to_i p N*(N-1)/2 + M*(M-1)/2
[ "expression.operation.binary.add" ]
505,390
505,391
u670503797
ruby
p02729
n, m = gets.strip.split(' ').map(&:to_i) puts (n * n(n-1) / 2) + (m * m(m-1) / 2)
n, m = gets.strip.split(' ').map(&:to_i) puts (n * (n-1) / 2) + (m * (m-1) / 2)
[ "call.arguments.change" ]
505,404
505,405
u259578064
ruby
p02729
a = gets.split(" ").map(&:to_i) p (a[0]*a[0]-1)/2 + (a[1]*a[1])/2
a = gets.split(" ").map(&:to_i) p (a[0]*(a[0]-1))/2 + (a[1]*(a[1]-1))/2
[ "call.arguments.change" ]
505,453
505,454
u583963729
ruby
p02729
even, odd = gets.split.map(&:to_i) puts (even*(even-1)) / 2 + odd(*(odd-1)) / 2
even, odd = gets.split.map(&:to_i) puts (even*(even-1) / 2) + (odd*(odd-1) / 2)
[ "call.arguments.change", "call.add" ]
506,159
506,160
u664737319
ruby
p02730
s = gets().chomp is_strong = true is_strong = false unless s == s.reverse s1 = s[0, ((s.length - 1) /2)] is_strong = false unless s1 == s1.reverse offset = ((s.length + 3) / 2) s2 = s[offset, s.length - offset + 1] is_strong = false unless s2 == s2.reverse puts is_strong ? 'Yes' : 'No'
s = gets().chomp is_strong = true is_strong = false unless s == s.reverse s1 = s[0, ((s.length - 1) /2)] is_strong = false unless s1 == s1.reverse offset = ((s.length + 3) / 2) - 1 s2 = s[offset, s.length - offset] is_strong = false unless s2 == s2.reverse puts is_strong ? 'Yes' : 'No'
[ "expression.operation.binary.remove" ]
506,332
506,333
u810199299
ruby
p02730
def get_i() #空白区切の入力を数値(整数)の配列で返す return gets.chomp.split(" ").map(&:to_i) end def get_f() #空白区切の入力を数値(実数)の配列で返す return gets.chomp.split(" ").map(&:to_f) end def get() #空白区切の入力を文字列の配列で返す return gets.chomp.split(" ") end def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す return gets.chomp.split("") end def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する return bool ? y : n end def array(size1,init=nil,size2=1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す if size2==1 return Array.new(size1){init} else return Array.new(size2){Array.new(size1){init}} end end s=get_nsp L=s.size s1=s.slice(0,(L-1)/2) L1=s1.size (L/2).times do|i| if s[i]!=s[L-1-i] flag=false break end end flag=true (L1/2).times do|i| if s1[i]!=s1[L1-1-i] flag=false break end end s2=s.slice((L+3)/2-1,L-(L+3)/2+1) L2=s2.size (L2/2).times do|i| if s2[i]!=s2[L2-1-i] flag=false break end end puts yn_judge(flag)
def get_i() #空白区切の入力を数値(整数)の配列で返す return gets.chomp.split(" ").map(&:to_i) end def get_f() #空白区切の入力を数値(実数)の配列で返す return gets.chomp.split(" ").map(&:to_f) end def get() #空白区切の入力を文字列の配列で返す return gets.chomp.split(" ") end def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す return gets.chomp.split("") end def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する return bool ? y : n end def array(size1,init=nil,size2=1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す if size2==1 return Array.new(size1){init} else return Array.new(size2){Array.new(size1){init}} end end s=get_nsp L=s.size s1=s.slice(0,(L-1)/2) L1=s1.size flag=true (L/2).times do|i| if s[i]!=s[L-1-i] flag=false break end end (L1/2).times do|i| if s1[i]!=s1[L1-1-i] flag=false break end end s2=s.slice((L+3)/2-1,L-(L+3)/2+1) L2=s2.size (L2/2).times do|i| if s2[i]!=s2[L2-1-i] flag=false break end end puts yn_judge(flag)
[ "assignment.add", "assignment.remove" ]
506,395
506,396
u415400221
ruby
p02730
s = gets l = s.size - 1 hl = (l / 2) - 1 tl = (l + 2) / 2 if s[0..hl] == s[0..hl].reverse && s == s.reverse && s[tl..l] == s[tl..l].reverse puts 'Yes' else puts 'No' end
s = gets.chomp l = s.size - 1 hl = (l - 2) / 2 tl = (l + 2) / 2 if s[0..hl] == s[0..hl].reverse && s == s.reverse && s[tl..l] == s[tl..l].reverse puts 'Yes' else puts 'No' end
[ "call.add", "expression.operation.binary.remove" ]
506,487
506,488
u489339677
ruby
p02730
s = gets n = s.length s1 = s[0..(n-3)/2] s2 = s[(n+1)/2..n-1] def kaibun(m) result = true for i in 1..(m.length) do if m[i-1] != m[-i] then result = false break end end return result end if kaibun(s) && kaibun(s1) && kaibun(s2) then print 'Yes' else print 'No' end
s = gets.chomp.to_s n = s.length s1 = s[0..(n-3)/2] s2 = s[(n+1)/2..n-1] def kaibun(m) result = true for i in 1..(m.length) do if m[i-1] != m[-i] then result = false break end end return result end if kaibun(s) && kaibun(s1) && kaibun(s2) then print 'Yes' else print 'No' end
[ "call.add" ]
506,575
506,576
u569559028
ruby
p02730
s=gets.to_s n=s.size.to_i a=(n-3)/2.to_i b=(n+1)/2.to_i c=(n-1).to_i puts s.slice(0..a)==s.slice(b..c)? "Yes":"No"
s=gets.chomp.to_s n=s.size.to_i a=(n-3)/2.to_i b=(n+1)/2.to_i c=(n-1).to_i puts s.slice(0..a)==s.slice(b..c)? "Yes":"No"
[ "call.add" ]
506,645
506,646
u590472228
ruby
p02730
s=gets.to_s n=s.size.to_i a=(n-3)/2.to_i b=(n+1)/2.to_i c=(n-1).to_i puts s.slice(0..a)==s.slice(b..c)? "YES":"No"
s=gets.chomp.to_s n=s.size.to_i a=(n-3)/2.to_i b=(n+1)/2.to_i c=(n-1).to_i puts s.slice(0..a)==s.slice(b..c)? "Yes":"No"
[ "call.add", "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
506,647
506,646
u590472228
ruby
p02730
input = gets.chomp input_num = input.length b= (input_num - 1) / 2 input_array = input.split("") c = b - 1 smarl_sentence = input_array[0..c] d = smarl_sentence.join e = (input_num + 3) / 2 f = e - 1 h = input_num - 1 smarl_sentence_2 = input_array[f..h] g = smarl_sentence_2.join puts input input_reverse = input.reverse puts input_reverse if input == input_reverse and d == d.reverse and g == g.reverse puts "Yes" else puts "No" end
input = gets.chomp input_num = input.length b= (input_num - 1) / 2 input_array = input.split("") c = b - 1 smarl_sentence = input_array[0..c] d = smarl_sentence.join e = (input_num + 3) / 2 f = e - 1 h = input_num - 1 smarl_sentence_2 = input_array[f..h] g = smarl_sentence_2.join input_reverse = input.reverse if input == input_reverse and d == d.reverse and g == g.reverse puts "Yes" else puts "No" end
[ "call.remove" ]
506,876
506,877
u058220890
ruby
p02730
s = gets def iskaibun(s) if s == s.reverse return true else return false end end len = s.size - 1 if iskaibun(s) \ and iskaibun(s[0..(len-1).div(2)]) \ and iskaibun(s[(len+3).div(2)..len]) puts "Yes" else puts "No" end
s = gets.rstrip def iskaibun(s) if s == s.reverse return true else return false end end len = s.size - 1 if iskaibun(s) \ and iskaibun(s[0..(len-1).div(2)]) \ and iskaibun(s[(len+3).div(2)..len]) puts "Yes" else puts "No" end
[ "call.add" ]
506,940
506,941
u644533034
ruby
p02730
S = gets.chomp if S == S.reverse && S[0, S.size/2] == S.reverse[0, S.size/2] puts 'Yes' else puts 'No' end
S = gets.chomp if S == S.reverse && S[0, S.size/2] == S[0, S.size/2].reverse puts 'Yes' else puts 'No' end
[ "call.remove", "control_flow.branch.if.condition.change", "call.add" ]
507,041
507,042
u064100484
ruby
p02730
input = gets.chop.split('') def palindrome?(str) str == str.reverse end answer = true answer = false if !palindrome?(input) answer = false if !palindrome?(input[0..(input.count / 2)]) puts answer ? 'Yes' : 'No'
input = gets.chop.split('') def palindrome?(str) str == str.reverse end answer = true answer = false if !palindrome?(input) answer = false if !palindrome?(input[0..(input.count - 1) / 2 - 1]) puts answer ? 'Yes' : 'No'
[ "control_flow.branch.if.condition.change", "variable_access.subscript.index.change" ]
507,066
507,067
u450617345
ruby
p02730
line = gets.chomp n = line.size array1 = [] array2 = [] (0..((n-3)/2)).each do |i| array1.push(line[i]) end ((n+1)/2..(n-1)).each do |i| array2.push(line[i]) end if array1 == array2 puts "yes" else puts "No" end
line = gets.chomp n = line.size array1 = [] array2 = [] (0..((n-3)/2)).each do |i| array1.push(line[i]) end ((n+1)/2..(n-1)).each do |i| array2.push(line[i]) end if array1 == array2 puts "Yes" else puts "No" end
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
507,150
507,151
u978628205
ruby
p02730
s = gets.chomp n = s.length num1 = ((n-1)/2) num2 = ((n+3)/2)-1 str1 = s[0...num1] str2 = s[num2...n] p s == s.reverse && str1 == str1.reverse && str2 == str2.reverse ? 'Yes' : 'No'
s = gets.chomp n = s.length num1 = ((n-1)/2) num2 = ((n+3)/2)-1 str1 = s[0,num1] str2 = s[num2,n] print s == s.reverse && str1 == str1.reverse && str2 == str2.reverse ? 'Yes' : 'No'
[ "misc.typo", "assignment.value.change", "variable_access.subscript.index.change", "call.function.change", "io.output.change" ]
507,158
507,159
u433171793
ruby
p02730
s = gets.chomp n = s.length num1 = ((n-1)/2) num2 = ((n+3)/2)-1 str1 = s[0,num1] str2 = s[num2,n] p s == s.reverse && str1 == str1.reverse && str2 == str2.reverse ? 'Yes' : 'No'
s = gets.chomp n = s.length num1 = ((n-1)/2) num2 = ((n+3)/2)-1 str1 = s[0,num1] str2 = s[num2,n] print s == s.reverse && str1 == str1.reverse && str2 == str2.reverse ? 'Yes' : 'No'
[ "call.function.change", "io.output.change" ]
507,160
507,159
u433171793
ruby
p02730
# Wrote in Mar 22, 2020 22:36 by reetok require 'time' require 'prime' require 'bigdecimal' def inp(type=:to_i,spst=" ") return eval("gets.chomp.split(#{spst}).map(&:#{type})") end def inpf() return self.inp(:to_f," ") end def inps() return self.inp(:to_s," ") end def r_up(a, b) (a/b).ceil end def r_down(a, b) (a/b).floor 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 def minp(n,datatype=".to_i") t = [] n.times do t.push(eval("gets.chomp#{datatype}")) end return t end def yes() puts "Yes" end def no() puts "No" end def ynju(bool,yes="Yes",no="No") puts (bool ? yes : no) end class Integer def divisor_list devisors = [1] 2.upto(self/2) do |i| devisors << i if self%i == 0 end devisors << self return devisors.uniq.sort end end class Array def upper(a) #aより上 self.sort.select{|n|n>=a} end def downer(a) #aより下 self.sort.select{|n|n<=a} end end #--------------- s = gets.chomp n = a.size if s==s.reverse if s[0..((n-1)/2-1)]==s[0..((n-1)/2-1)].reverse if s[((n+3)/2-1)..n-1]==s[((n+3)/2-1)..n-1].reverse yes exit end end end no
# Wrote in Mar 22, 2020 22:36 by reetok require 'time' require 'prime' require 'bigdecimal' def inp(type=:to_i,spst=" ") return eval("gets.chomp.split(#{spst}).map(&:#{type})") end def inpf() return self.inp(:to_f," ") end def inps() return self.inp(:to_s," ") end def r_up(a, b) (a/b).ceil end def r_down(a, b) (a/b).floor 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 def minp(n,datatype=".to_i") t = [] n.times do t.push(eval("gets.chomp#{datatype}")) end return t end def yes() puts "Yes" end def no() puts "No" end def ynju(bool,yes="Yes",no="No") puts (bool ? yes : no) end class Integer def divisor_list devisors = [1] 2.upto(self/2) do |i| devisors << i if self%i == 0 end devisors << self return devisors.uniq.sort end end class Array def upper(a) #aより上 self.sort.select{|n|n>=a} end def downer(a) #aより下 self.sort.select{|n|n<=a} end end #--------------- s = gets.chomp n = s.size if s==s.reverse if s[0..((n-1)/2-1)]==s[0..((n-1)/2-1)].reverse if s[((n+3)/2-1)..n-1]==s[((n+3)/2-1)..n-1].reverse yes exit end end end no
[ "assignment.value.change", "identifier.change" ]
507,476
507,477
u891258088
ruby
p02730
s = gets.chomp x = s.split("") n = x.length if x[0..n] == x[0..n].reverse if (x[0...((n - 1) / 2)] == x[0...((n - 1) / 2)].reverse) && (x[((n + 3) / 2) - 1...n] == x[((n + 3) / 2) - 1...n].reverse) puts 'Yes' else put 'No' end else puts 'No' end
s = gets.chomp x = s.split("") n = x.length if x[0..n] == x[0..n].reverse if (x[0...((n - 1) / 2)] == x[0...((n - 1) / 2)].reverse) && (x[((n + 3) / 2) - 1...n] == x[((n + 3) / 2) - 1...n].reverse) puts 'Yes' else puts 'No' end else puts 'No' end
[ "misc.typo", "identifier.change" ]
507,589
507,590
u895926909
ruby
p02730
s = gets.chomp x = s.split("") n = x.length if x[0..n] == x[0..n].reverse if (x[0...((n - 1) / 2)] == x[0...((n - 1) / 2)].reverse) && (x[((n + 3) / 2) - 1...n] == x[((n + 3) / 2) - 1...n].reverse) puts 'Yes' else puts 'No' end end
s = gets.chomp x = s.split("") n = x.length if x[0..n] == x[0..n].reverse if (x[0...((n - 1) / 2)] == x[0...((n - 1) / 2)].reverse) && (x[((n + 3) / 2) - 1...n] == x[((n + 3) / 2) - 1...n].reverse) puts 'Yes' else puts 'No' end else puts 'No' end
[]
507,591
507,590
u895926909
ruby
p02730
#!/usr/bin/env ruby s = STDIN.gets.chomp len = s.size s1 = s[0, (len-1) / 2] s2 = s[(len+3) / 2 - 1, len] ans = (s == s.reverse and s1 == s1.reverse and s2 == s2.reverse) ? "YES" : "NO" puts ans
#!/usr/bin/env ruby s = STDIN.gets.chomp len = s.size s1 = s[0, (len - 1) / 2] s2 = s[(len + 3) / 2 - 1, len] ans = (s == s.reverse and s1 == s1.reverse and s2 == s2.reverse) ? "Yes" : "No" puts ans
[ "literal.string.change", "literal.string.case.change", "assignment.value.change" ]
507,717
507,718
u250545805
ruby
p02730
#!/usr/bin/env ruby s = STDIN.gets.chomp len = s.size s1 = s[0, (len - 1) / 2] s2 = s[(len + 3) / 2 - 1, len] ans = (s == s.reverse and s1 == s1.reverse and s2 == s2.reverse) ? "YES" : "NO" puts ans
#!/usr/bin/env ruby s = STDIN.gets.chomp len = s.size s1 = s[0, (len - 1) / 2] s2 = s[(len + 3) / 2 - 1, len] ans = (s == s.reverse and s1 == s1.reverse and s2 == s2.reverse) ? "Yes" : "No" puts ans
[ "literal.string.change", "literal.string.case.change", "assignment.value.change" ]
507,719
507,718
u250545805
ruby
p02730
#!/usr/bin/env ruby s = STDIN.gets.chomp len = s.size s1 = s[0, (len - 1) / 2] s2 = s[(len +3) / 2 - 1, len] ans = (s == s.reverse and s1 == s1.reverse and s2 == s2.reverse) ? "YES" : "NO" puts ans
#!/usr/bin/env ruby s = STDIN.gets.chomp len = s.size s1 = s[0, (len - 1) / 2] s2 = s[(len + 3) / 2 - 1, len] ans = (s == s.reverse and s1 == s1.reverse and s2 == s2.reverse) ? "Yes" : "No" puts ans
[ "literal.string.change", "literal.string.case.change", "assignment.value.change" ]
507,720
507,718
u250545805
ruby
p02730
#!/usr/bin/env ruby s = STDIN.gets.chomp len = s.size s1 = s[0, (len -1) / 2] s2 = s[(len +3) / 2 - 1, len] ans = (s == s.reverse and s1 == s1.reverse and s2 == s2.reverse) ? "YES" : "NO" puts ans
#!/usr/bin/env ruby s = STDIN.gets.chomp len = s.size s1 = s[0, (len - 1) / 2] s2 = s[(len + 3) / 2 - 1, len] ans = (s == s.reverse and s1 == s1.reverse and s2 == s2.reverse) ? "Yes" : "No" puts ans
[ "literal.string.change", "literal.string.case.change", "assignment.value.change" ]
507,721
507,718
u250545805
ruby
p02730
s = gets.chomp if s != s.reverse print "No\n" else ss = s.slice(0, (s.length-1)/2) p ss if ss != ss.reverse print "No\n" else print "Yes\n" end end
s = gets.chomp if s != s.reverse print "No\n" else ss = s.slice(0, (s.length-1)/2) if ss != ss.reverse print "No\n" else print "Yes\n" end end
[ "call.remove" ]
508,303
508,304
u354261726
ruby
p02731
n=gets.to_i puts format("%.12f",((n**3)/27))
n=gets.to_f puts format("%.12f",((n**3)/27))
[ "call.function.change", "type_conversion.to_float.change", "type_conversion.to_number.change" ]
508,458
508,459
u977506075
ruby
p02731
n=gets.to_i format("%.12f",((n**3)/27))
n=gets.to_f puts format("%.12f",((n**3)/27))
[ "call.function.change", "type_conversion.to_float.change", "type_conversion.to_number.change", "io.output.change", "call.add" ]
508,460
508,459
u977506075
ruby
p02731
p gets.to_i**3/27
p gets.to_f**3/27
[ "call.function.change", "type_conversion.to_float.change", "type_conversion.to_number.change" ]
508,649
508,650
u347948131
ruby
p02731
l = gets.chomp.to_i puts (l/3)**3
l = gets.chomp.to_f puts (l/3)**3
[ "call.function.change", "type_conversion.to_float.change", "type_conversion.to_number.change" ]
508,668
508,669
u821989875
ruby
p02731
p (gets.chomp.to_i / 3)**3
p (gets.chomp.to_f / 3)**3
[ "call.function.change", "type_conversion.to_float.change", "type_conversion.to_number.change" ]
508,791
508,792
u673436081
ruby
p02731
l = gets.to_i puts (l**3)/27
l = gets.to_f puts (l**3)/27
[ "call.function.change", "type_conversion.to_float.change", "type_conversion.to_number.change" ]
508,929
508,930
u620219777
ruby
p02731
L = gets.chomp.to_i l = ((L.to_f/3)).round(5) puts l**3
L = gets.chomp.to_i l = ((L.to_f/3)).round(10) puts l**3
[ "literal.number.integer.change", "assignment.value.change", "call.arguments.change" ]
508,955
508,956
u088211391
ruby
p02731
L = gets.chomp.to_i l = ((L.to_f/3)).round(2) puts l**3
L = gets.chomp.to_i l = ((L.to_f/3)).round(10) puts l**3
[ "literal.number.integer.change", "assignment.value.change", "call.arguments.change" ]
508,957
508,956
u088211391
ruby
p02731
print ((gets.to_i)/3)**3
print ((gets.to_i)/3.to_f)**3
[ "call.add" ]
509,054
509,055
u312004378
ruby