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 |
|---|---|---|---|---|---|---|---|
p03360 | a, b, c = gets.split.map(&:to_i)
k = gets.to_i
max = a
max = b if max < b
max = c if max < c
k.times do
max += max
end
if max == a
puts max + b + c
elsif max == b
puts max + a + c
else
puts max + a + b
end
| a, b, c = gets.split.map(&:to_i)
k = gets.to_i
max = a
max = b if max < b
max = c if max < c
max2 = max
k.times do
max += max
end
if max2 == a
puts max + b + c
elsif max2 == b
puts max + a + c
else
puts max + a + b
end
| [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,129,288 | 1,129,289 | u475329018 | ruby |
p03360 | s = gets.split.map(&:to_i)
k = gets.to_i
k.times do
s.sort
s[-1] *= 2
end
puts s.inject(:+)
| s = gets.split.map(&:to_i)
k = gets.to_i
k.times do
s.sort!
s[-1] *= 2
end
puts s.inject(:+) | [
"call.suffix.change"
] | 1,129,341 | 1,129,342 | u693378622 | ruby |
p03360 | input = gets
a = input.split(" ")[0].to_i
b = input.split(" ")[1].to_i
c = input.split(" ")[2].to_i
arr = [a, b, c]
input = gets
k = input.to_i
max_index = arr.index(arr.max)
max = arr[max_index]
sum = max
k.times do |i|
sum += max
end
arr.delete_at(max_index)
arr.each do |i|
sum += i
end
p sum | input = gets
a = input.split(" ")[0].to_i
b = input.split(" ")[1].to_i
c = input.split(" ")[2].to_i
arr = [a, b, c]
input = gets
k = input.to_i
max_index = arr.index(arr.max)
max = arr[max_index]
sum = max
k.times do |i|
sum += max
max *= 2
end
arr.delete_at(max_index)
arr.each do |i|
sum += i
end
p sum
| [] | 1,129,355 | 1,129,356 | u092283015 | ruby |
p03360 | input = gets
a = input.split(" ")[0].to_i
b = input.split(" ")[1].to_i
c = input.split(" ")[2].to_i
arr = [a, b, c]
input = gets
k = input.to_i
max_index = arr.index(arr.max)
max = arr[max_index]
sum = 0
k.times do |i|
sum += max
end
arr.delete_at(max_index)
arr.each do |i|
sum += i
end
p sum | input = gets
a = input.split(" ")[0].to_i
b = input.split(" ")[1].to_i
c = input.split(" ")[2].to_i
arr = [a, b, c]
input = gets
k = input.to_i
max_index = arr.index(arr.max)
max = arr[max_index]
sum = max
k.times do |i|
sum += max
max *= 2
end
arr.delete_at(max_index)
arr.each do |i|
sum += i
end
p sum
| [
"assignment.value.change",
"identifier.replace.add",
"literal.replace.remove"
] | 1,129,357 | 1,129,356 | u092283015 | ruby |
p03361 | h,w=gets.split.map(&:to_i)
field=readlines
field[-1] << '.'
field << '.' * (w+1)
p field
0.upto(h-1) do |i|
0.upto(w-1) do |j|
next if field[j][i] == '.'
ok = [
field[j-1][i],
field[j+1][i],
field[j][i-1],
field[j][i+1],
].any? {|b| b == '#'}
unless ok
puts 'No'
exit 0
end
end
end
puts 'Yes' | h,w=gets.split.map(&:to_i)
field=readlines
field[-1] << '.'
field << '.' * (w+1)
0.upto(h-1) do |j|
0.upto(w-1) do |i|
next if field[j][i] == '.'
ok = [
field[j-1][i],
field[j+1][i],
field[j][i-1],
field[j][i+1],
].any? {|b| b == '#'}
unless ok
puts 'No'
exit 0
end
end
end
puts 'Yes' | [
"call.remove",
"identifier.change",
"io.output.change"
] | 1,131,257 | 1,131,256 | u852974293 | ruby |
p03363 | input = gets.to_i
nums = gets.split(' ').map(&:to_i)
arr = []
arr.push(0)
for i in 1..input do
arr.push(arr.last+nums[i-1])
end
arr.sort!
p arr
pointer = 0
ans = 0
while pointer <= input do
num = arr[pointer]
i = pointer+1
count = 1
while arr[i] == num do
count += 1
i += 1
end
if count > 1 then
count = count*(count-1)/2
ans +=count
end
pointer = i
end
puts ans
| input = gets.to_i
nums = gets.split(' ').map(&:to_i)
arr = []
arr.push(0)
for i in 1..input do
arr.push(arr.last+nums[i-1])
end
arr.sort!
pointer = 0
ans = 0
while pointer <= input do
num = arr[pointer]
i = pointer+1
count = 1
while arr[i] == num do
count += 1
i += 1
end
if count > 1 then
count = count*(count-1)/2
ans +=count
end
pointer = i
end
puts ans
| [
"call.remove"
] | 1,134,033 | 1,134,034 | u828847847 | ruby |
p03363 | n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)
s = [0]
for i in 0..(n-1)
s[i+1] = a[i] + s[i]
end
h = Hash.new(0)
s.each do |v|
h[v] += 1
end
ans = 0
h.each do |k, v|
next if v == 1
ans += v * (v-1) / 2
end | n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)
s = [0]
for i in 0..(n-1)
s[i+1] = a[i] + s[i]
end
h = Hash.new(0)
s.each do |v|
h[v] += 1
end
ans = 0
h.each do |k, v|
next if v == 1
ans += v * (v-1) / 2
end
puts ans | [
"call.add"
] | 1,134,114 | 1,134,115 | u868089307 | ruby |
p03364 | N = gets.to_i
ss, sst = [], Array.new(N){Array.new(N)}
N.times do |i|
ss[i] = gets.chomp.split('')
end
N.times do |i|
N.times do |j|
sst[j][i] = ss[i][j]
end
end
sum = 0
(0...N).each do |a|
success = true
(0...N).each do |i|
unless ss[i] == sst[(i-a)%N]
success = false
break
end
end
if success
sum += N
end
(0...N).each do |i|
ss[i].rotate!(1)
end
end
puts sum
| N = gets.to_i
ss, sst = [], Array.new(N){Array.new(N)}
N.times do |i|
ss[i] = gets.chomp.split('')
end
N.times do |i|
N.times do |j|
sst[j][i] = ss[i][j]
end
end
sum = 0
(0...N).each do |a|
success = true
(0...N).each do |i|
unless ss[i] == sst[(i+a)%N]
success = false
break
end
end
if success
sum += N
end
(0...N).each do |i|
ss[i].rotate!(1)
end
end
puts sum
| [
"misc.opposites",
"expression.operator.arithmetic.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change"
] | 1,134,813 | 1,134,814 | u314396879 | ruby |
p03369 | s = gets.chop.split.count("o")
puts 700 + 100 * s | s = gets.chomp.split("").count("o")
puts 700 + 100 * s | [
"assignment.value.change",
"identifier.change",
"call.arguments.add"
] | 1,135,363 | 1,135,364 | u020467031 | ruby |
p03369 | a = gets.strip.split("")
puts a.count("○") * 100 + 700 | a = gets.split("")
puts a.count("o") * 100 + 700 | [
"call.remove",
"literal.string.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 1,135,445 | 1,135,446 | u514143079 | ruby |
p03369 | ramen = 700
topping = gets.chomp.split("")
ramen += 100 if topping[0] == "x"
ramen += 100 if topping[1] == "x"
ramen += 100 if topping[2] == "x"
puts ramen | ramen = 700
topping = gets.chomp.split("")
ramen += 100 if topping[0] == "o"
ramen += 100 if topping[1] == "o"
ramen += 100 if topping[2] == "o"
puts ramen | [
"literal.string.change",
"control_flow.branch.if.condition.change"
] | 1,135,722 | 1,135,723 | u494874742 | ruby |
p03369 | s = gets.strip.split("")
n == 0
for i in 0..2 do
if s[i] == "o"
n += 100
end
end
print n+700 | s = gets.strip.split("")
n = 700
for i in 0..2 do
if s[i] == "o"
n += 100
end
end
print n | [
"expression.operation.binary.remove"
] | 1,136,021 | 1,136,022 | u750429254 | ruby |
p03369 | s = gets.strip.split("")
n == 700
for i in 0..2 do
if s[i] == "o"
n += 100
end
end
print n | s = gets.strip.split("")
n = 700
for i in 0..2 do
if s[i] == "o"
n += 100
end
end
print n | [
"expression.operation.compare.replace.remove",
"assignment.replace.add",
"misc.typo"
] | 1,136,023 | 1,136,022 | u750429254 | ruby |
p03369 | s=gets.to_i.split('')
ramen=700
topping=0
s.each do |x|
topping += 1 if x=='o'
end
puts ramen + topping*100 | s=gets.split('')
ramen=700
topping=0
s.each do |x|
topping += 1 if x=='o'
end
puts ramen + topping*100
| [
"call.remove"
] | 1,136,107 | 1,136,108 | u348067535 | ruby |
p03369 | (gets.chomp!.split('').count { |c| c == 'o' }) * 100 + 700 | puts (gets.chomp!.split('').count { |c| c == 'o' }) * 100 + 700
| [
"io.output.change",
"call.add"
] | 1,136,309 | 1,136,310 | u304013285 | ruby |
p03369 | s = gets.chomp
price = 700
3.times do
price += 100 if s[i] == "o"
end
puts price | s = gets.chomp
price = 700
3.times do |i|
price += 100 if s[i] == "o"
end
puts price | [] | 1,136,245 | 1,136,246 | u910756197 | ruby |
p03370 | 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
N,x=get_i
m=array(N)
N.times do|i|
m[i]=gets.to_i
end
m.sort!
ans=N
sum=m.inject(:+)
x-=sum
while x-m[0]>0
x-=m[0]
ans+=1
end
puts ans | 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
N,x=get_i
m=array(N)
N.times do|i|
m[i]=gets.to_i
end
m.sort!
ans=N
sum=m.inject(:+)
x-=sum
while x-m[0]>=0
x-=m[0]
ans+=1
end
puts ans | [
"expression.operator.compare.change",
"expression.operation.binary.change"
] | 1,136,473 | 1,136,474 | u415400221 | ruby |
p03370 | n,x = gets.chomp.split(" ").map(&:to_i).sort
ary = []
n.times do |k|
p k = gets.to_i
ary << k
x = x-k
end
p n + x/ary.min | n,x = gets.chomp.split(" ").map(&:to_i).sort
ary = []
n.times do |k|
k = gets.to_i
ary << k
x = x-k
end
p n + x/ary.min | [
"io.output.change",
"call.remove"
] | 1,136,677 | 1,136,678 | u599631096 | ruby |
p03370 | N, X = gets.strip.split.map(&:to_i)
a = N.times { gets.strip.to_i }
puts N + (X - a.inject(:+) / a.min)
| N, X = gets.strip.split.map(&:to_i)
a = N.times.map { gets.strip.to_i }
puts N + ((X - a.inject(:+)) / a.min)
| [
"call.add",
"call.arguments.change"
] | 1,137,025 | 1,137,026 | u707614029 | ruby |
p03370 | n,x = gets.split.map(&:to_i)
i_n = n.times.map{ gets.to_i}
counter = 0
total = 0
i_n.each{|n| total += n}
rmd = x - total
mindonut = i_n.min
while rmd > mindonut
rmd = rmd - mindonut
counter += 1
end
puts counter + n | n,x = gets.split.map(&:to_i)
i_n = n.times.map{ gets.to_i}
counter = 0
total = 0
i_n.each{|n| total += n}
rmd = x - total
mindonut = i_n.min
while rmd >= mindonut
rmd = rmd - mindonut
counter += 1
end
puts counter + n | [
"expression.operator.compare.change",
"expression.operation.binary.change"
] | 1,137,037 | 1,137,038 | u296101474 | ruby |
p03369 | s = gets.split.map(&:to_i)
price = 700 + 100 * s.count("o")
puts price
| s = gets.chop.split("")
price = 700 + 100 * s.count("o")
puts price
| [
"assignment.value.change",
"identifier.change",
"call.arguments.change"
] | 1,137,083 | 1,137,084 | u709879360 | ruby |
p03370 | n,x=gets.chomp.split(" ").map(&:to_i)
m = []
n.times do |i|
m << gets.to_i
end
m.each do |i|
x = x - i
end
m.sort!
p m
cnt = x / m[0]
print("#{cnt+n}\n") | n,x=gets.chomp.split(" ").map(&:to_i)
m = []
n.times do |i|
m << gets.to_i
end
m.each do |i|
x = x - i
end
m.sort!
cnt = x / m[0]
print("#{cnt+n}\n") | [
"call.remove"
] | 1,137,198 | 1,137,199 | u843129591 | ruby |
p03370 | n,x=gets.split.map(&:to_i)
m=[*1..n].map{gets.to_i}
p (x-m.inject(:+))/m.min+3 | n,x=gets.split.map(&:to_i)
m=[*1..n].map{gets.to_i}
p (x-m.inject(:+))/m.min+n | [
"identifier.replace.add",
"literal.replace.remove",
"call.arguments.change",
"expression.operation.binary.change"
] | 1,137,208 | 1,137,209 | u656771711 | ruby |
p03370 | N, X = gets.split.map(&:to_i)
m = []
gram = X
num = 0
N.times do
tmp = gets.to_i
m << tmp
gram = gram - tmp
num += 1
end
m.sort!
while (gram - m[0])> 0 do
gram = gram - m[0]
num += 1
end
puts num | N, X = gets.split.map(&:to_i)
m = []
gram = X
num = 0
N.times do
tmp = gets.to_i
m << tmp
gram = gram - tmp
num += 1
end
m.sort!
while (gram - m[0])>= 0 do
gram = gram - m[0]
num += 1
end
puts num | [
"expression.operator.compare.change",
"expression.operation.binary.change"
] | 1,137,284 | 1,137,285 | u105225201 | ruby |
p03370 | tmp = gets.chomp.split(" ")
cnt = tmp[0].to_i
rem = tmp[1].to_i
donuts = Array.new
cnt.to_i.times do
donuts.push(gets.chomp.to_i)
end
sm = donuts[0]
donuts.each do |donut|
sm = donut if donut < sm
rem -= donut
end
while rem > sm do
rem -= sm
cnt += 1
end
puts cnt
| tmp = gets.chomp.split(" ")
cnt = tmp[0].to_i
rem = tmp[1].to_i
donuts = Array.new
cnt.to_i.times do
donuts.push(gets.chomp.to_i)
end
sm = donuts[0]
donuts.each do |donut|
sm = donut if donut < sm
rem -= donut
end
while rem >= sm do
rem -= sm
cnt += 1
end
puts cnt
| [
"expression.operator.compare.change",
"expression.operation.binary.change"
] | 1,137,513 | 1,137,514 | u212065444 | ruby |
p03371 | a, b, c, x, y = gets().chomp.split("\s").map{|x| x.to_i}
sep_total = a * x + b * y
min = [x, y].min
max = [x, y].max
mix_total1 = min * c * 2 + (x - min) * a + (y - min) * b
mix_total2 = max * c * 2
puts [sep_total, mix_total1, mix_total2].max
| a, b, c, x, y = gets().chomp.split("\s").map{|x| x.to_i}
sep_total = a * x + b * y
min = [x, y].min
max = [x, y].max
mix_total1 = min * c * 2 + (x - min) * a + (y - min) * b
mix_total2 = max * c * 2
puts [sep_total, mix_total1, mix_total2].min
| [
"misc.opposites",
"identifier.change",
"call.arguments.change",
"io.output.change"
] | 1,137,574 | 1,137,575 | u810199299 | ruby |
p03371 | a, b , c ,x, y = gets.chomp.split(" ").map(&:to_i)
small = []
tanpin = a * x + b * y
small << tanpin
small << c * 2 * [x,y].max
if x > y
mix_tanpin = 2 * c * y + a * (x - y)
small << mix_tanpin
else
mix_tanpin = 2 * c * x + a * (y - x)
small << mix_tanpin
end
puts small.min | a, b, c, x, y = gets.chomp.split(" ").map(&:to_i)
small = []
tanpin = a * x + b * y
small << tanpin
small << c * 2 * [x,y].max
if x > y
mix_tanpin = 2 * c * y + a * (x - y)
small << mix_tanpin
else
mix_tanpin = 2 * c * x + b * (y - x)
small << mix_tanpin
end
puts small.min | [
"assignment.value.change",
"identifier.change",
"expression.operation.binary.change"
] | 1,137,618 | 1,137,619 | u412789323 | ruby |
p03371 | a, b , c ,x, y = gets.chomp.split(" ").map(&:to_i)
small = []
tanpin = a * x + b * y
small << tanpin
small << c * 2 * [x,y].max
if x > y
mix_tanpin = 2 * c * y + a * (x - y)
small << mix_tanpin
elsif x < y
mix_tanpin = 2 * c * x + a * (y - x)
small << mix_tanpin
end
puts small.min
| a, b, c, x, y = gets.chomp.split(" ").map(&:to_i)
small = []
tanpin = a * x + b * y
small << tanpin
small << c * 2 * [x,y].max
if x > y
mix_tanpin = 2 * c * y + a * (x - y)
small << mix_tanpin
else
mix_tanpin = 2 * c * x + b * (y - x)
small << mix_tanpin
end
puts small.min | [
"expression.operation.binary.remove",
"assignment.value.change",
"identifier.change",
"expression.operation.binary.change"
] | 1,137,620 | 1,137,619 | u412789323 | ruby |
p03371 | a, b, c, x, y = gets.split.map(&:to_i)
result = []
result << a*x + b*y
result << 2*c*[x,y].max
if x > y
result << 2*c*y + (x-y) * a
else
result << 2*x*x + (y-x) * b
end
p result.min
| a, b, c, x, y = gets.split.map(&:to_i)
result = []
result << a*x + b*y
result << 2*c*[x,y].max
if x > y
result << 2*c*y + (x-y) * a
else
result << 2*c*x + (y-x) * b
end
p result.min
| [
"identifier.change",
"expression.operation.binary.change"
] | 1,137,641 | 1,137,642 | u180695909 | ruby |
p03371 | a,b,c,x,y=gets.split.map(&:to_i)
answer=0
min=[x,y].min
max=[x,y].max
if a+b>2*c
answer+=c*min*2
else
answer+=(a+b)*min
end
if x>y
if a<2*c
answer+=(x-y)*a
else
answer+=(x-y)*c*2
end
else
if b<2*c
answer+=(y-x)*a
else
answer+=(y-x)*c*2
end
end
puts answer | a,b,c,x,y=gets.split.map(&:to_i)
answer=0
min=[x,y].min
max=[x,y].max
if a+b>2*c
answer+=c*min*2
else
answer+=(a+b)*min
end
if x>y
if a<2*c
answer+=(x-y)*a
else
answer+=(x-y)*c*2
end
else
if b<2*c
answer+=(y-x)*b
else
answer+=(y-x)*c*2
end
end
puts answer | [
"identifier.change",
"expression.operation.binary.change"
] | 1,138,229 | 1,138,230 | u506544056 | ruby |
p03371 | def cin
gets.split.map(&:to_i)
end
a, b, c, x, y = cin
ans1, ans2, ans3 = 0
min, max = [x, y].minmax
ans1 = c * max * 2
ans2 = if x >= y
c * min * 2 + a * (x - y)
else
c * min * 2 + b * (y - x)
end
ans3 = a * x + b * y
puts ans1, ans2, ans3
| def cin
gets.split.map(&:to_i)
end
a, b, c, x, y = cin
ans1, ans2, ans3 = 0
min, max = [x, y].minmax
ans1 = c * max * 2
ans2 = if x >= y
c * min * 2 + a * (x - y)
else
c * min * 2 + b * (y - x)
end
ans3 = a * x + b * y
puts [ans1, ans2, ans3].min
| [
"call.arguments.change",
"call.add"
] | 1,138,332 | 1,138,333 | u889326464 | ruby |
p03371 | A, B, C, X, Y = gets.split.map(&:to_i)
if (A+B) < 2*C
puts A*X + B*Y
elsif A < 2*C && B < 2*C
if X>Y
puts 2*C*Y+(X-Y)*A
else
puts 2*C*Y+(Y-X)*B
end
elsif A > 2*C && B > 2*C
puts [X, Y].max * 2*C
elsif A > 2*C && B < 2*C
if X < Y
puts 2*C*X+(Y-X)*B
else
puts 2*C*X
end
else
if X > Y
puts 2*C*Y+(X-Y)*A
else
puts 2*C*Y
end
end
| A, B, C, X, Y = gets.split.map(&:to_i)
if (A+B) < 2*C
puts A*X + B*Y
elsif A < 2*C && B < 2*C
if X>Y
puts 2*C*Y+(X-Y)*A
else
puts 2*C*X+(Y-X)*B
end
elsif A > 2*C && B > 2*C
puts [X, Y].max * 2*C
elsif A > 2*C && B < 2*C
if X < Y
puts 2*C*X+(Y-X)*B
else
puts 2*C*X
end
else
if X > Y
puts 2*C*Y+(X-Y)*A
else
puts 2*C*Y
end
end
| [
"call.arguments.change",
"expression.operation.binary.change"
] | 1,138,792 | 1,138,793 | u884847580 | ruby |
p03371 | a = []
a = gets.split.map(&:to_i)
cnt = []
if 2 * a[2] <= a[0] + a[1]
if a[3] >= a[4]
cnt.push([a[3], a[4]].min * a[2]*2 + (a[3] - a[4]) * a[0])
else
cnt.push([a[3], a[4]].min * a[2]*2 + (a[4] - a[3]) * a[0])
end
end
cnt.push( a[0] * a[3] + a[1] * a[4])
cnt.push([a[3], a[4]].max * a[2]*2)
puts cnt.min
| a = []
a = gets.split.map(&:to_i)
cnt = []
if 2 * a[2] <= a[0] + a[1]
if a[3] >= a[4]
cnt.push([a[3], a[4]].min * a[2]*2 + (a[3] - a[4]) * a[0])
else
cnt.push([a[3], a[4]].min * a[2]*2 + (a[4] - a[3]) * a[1])
end
end
cnt.push( a[0] * a[3] + a[1] * a[4])
cnt.push([a[3], a[4]].max * a[2]*2)
puts cnt.min | [
"literal.number.integer.change",
"variable_access.subscript.index.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 1,138,816 | 1,138,817 | u614043796 | ruby |
p03371 | a = []
a = gets.split.map(&:to_i)
cnt = []
if 2 * a[2] <= a[0] + a[1]
if a[3] >= a[4]
cnt.push([a[3], a[4]].min * a[2]*2 + (a[3] - a[4]) * a[0])
else
cnt.push([a[3], a[4]].min * a[2]*2 + (a[4] - a[3]) * a[0])
end
end
cnt.push( a[0] * a[3] + a[1] * a[4])
cnt.push([a[3], a[4]].max * a[2])
puts cnt.min
| a = []
a = gets.split.map(&:to_i)
cnt = []
if 2 * a[2] <= a[0] + a[1]
if a[3] >= a[4]
cnt.push([a[3], a[4]].min * a[2]*2 + (a[3] - a[4]) * a[0])
else
cnt.push([a[3], a[4]].min * a[2]*2 + (a[4] - a[3]) * a[1])
end
end
cnt.push( a[0] * a[3] + a[1] * a[4])
cnt.push([a[3], a[4]].max * a[2]*2)
puts cnt.min | [
"literal.number.integer.change",
"variable_access.subscript.index.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 1,138,818 | 1,138,817 | u614043796 | ruby |
p03373 | a,b,c,x,y = gets.chomp.split.map(&:to_i)
n = x > y ? x : y
p n
min = 1000000000
(0..n).each do |i|
k = i*2*c + a*[0,x-i].max + b*[0,y-i].max
min = k if k < min
end
puts min | a,b,c,x,y = gets.chomp.split.map(&:to_i)
n = x > y ? x : y
min = 1000000000
(0..n).each do |i|
k = i*2*c + a*[0,x-i].max + b*[0,y-i].max
min = k if k < min
end
puts min | [
"call.remove"
] | 1,139,730 | 1,139,731 | u599631096 | ruby |
p03374 | n,c=gets.split.map &:to_i
x,v=($<.map{|l|l.split.map(&:to_i)}).transpose
y=[];x.each{|e|y.unshift(c-e)}
x.unshift(0);y.unshift(0)
r=[0];l=[0]
v.each{|e|r<<r[-1]+e}
(v.reverse).each{|e|l<<l[-1]+e}
f=[0];g=[0]
for k in 1..n
f<<[f[-1],r[k]-x[k]].max
g<<[f[-1],r[k]-2*x[k]].max
end
m=0
for i in 0..n
m=[l[i]-y[i]+g[n-i],l[i]-2*y[i]+f[n-i],m].max
end
p m | n,c=gets.split.map &:to_i
x,v=($<.map{|l|l.split.map(&:to_i)}).transpose
y=[];x.each{|e|y.unshift(c-e)}
x.unshift(0);y.unshift(0)
r=[0];l=[0]
v.each{|e|r<<r[-1]+e}
(v.reverse).each{|e|l<<l[-1]+e}
f=[0];g=[0]
for k in 1..n
f<<[f[-1],r[k]-x[k]].max
g<<[g[-1],r[k]-2*x[k]].max
end
m=0
for i in 0..n
m=[l[i]-y[i]+g[n-i],l[i]-2*y[i]+f[n-i],m].max
end
p m | [] | 1,140,142 | 1,140,143 | u610697662 | ruby |
p03374 | n,c=gets.split.map &:to_i
x,v=($<.map{|l|l.split.map(&:to_i)}).transpose
y=[];x.each{|e|y.unshift(c-e)}
x.unshift(0);y.unshift(0)
r=[0];l=[0]
v.each{|e|r<<r[-1]+e}
(v.reverse).each{|e|l<<l[-1]+e}
f=[0];g=[0]
for k in 1...n
f<<[f[-1],r[k]-x[k]].max
g<<[f[-1],r[k]-2*x[k]].max
end
m=0
for i in 0..n
m=[l[i]-y[i]+g[n-i],l[i]-2*y[i]+f[n-i],m].max
end
p m | n,c=gets.split.map &:to_i
x,v=($<.map{|l|l.split.map(&:to_i)}).transpose
y=[];x.each{|e|y.unshift(c-e)}
x.unshift(0);y.unshift(0)
r=[0];l=[0]
v.each{|e|r<<r[-1]+e}
(v.reverse).each{|e|l<<l[-1]+e}
f=[0];g=[0]
for k in 1..n
f<<[f[-1],r[k]-x[k]].max
g<<[g[-1],r[k]-2*x[k]].max
end
m=0
for i in 0..n
m=[l[i]-y[i]+g[n-i],l[i]-2*y[i]+f[n-i],m].max
end
p m | [] | 1,140,144 | 1,140,143 | u610697662 | ruby |
p03374 | N, C = gets.split.map(&:to_i)
xs, vs = [], []
N.times do |i|
xs[i], vs[i] = gets.split.map(&:to_i)
end
max = 0
max_cw = Array.new(N, 0)
max_ccw = Array.new(N, 0)
ret_max_cw = Array.new(N, 0)
ret_max_ccw = Array.new(N, 0)
sum = vs[0] - xs[0]
max_cw[0] = [sum, 0].max
sum2 = vs[0] - 2 * xs[0]
ret_max_cw[0] = [sum2, 0].max
(N - 1).times do |i|
sum += vs[i+1] - (xs[i+1] - xs[i])
sum2 += vs[i+1] - (xs[i+1] - xs[i]) * 2
max_cw[i+1] = [max_cw[i], sum].max
ret_max_cw[i+1] = [ret_max_cw[i], sum2].max
end
sum = vs[-1] - (C - xs[-1])
max_ccw[-1] = [sum, 0].max
sum2 = vs[-1] - (C - xs[-1]) * 2
ret_max_ccw[-1] = [sum2, 0].max
(N - 1).times do |i|
sum += vs[N - 2 - i] - (xs[N - 1 - i] - xs[N - 2 - i])
sum2 += vs[N - 2 - i] - (xs[N - 1 - i] - xs[N - 2 - i]) * 2
max_ccw[N - 2 - i] = [max_ccw[N - 1 - i], sum].max
ret_max_ccw[N - 2 - i] = [ret_max_ccw[N - 1 - i], sum2].max
end
ans = [max_cw.max, max_ccw.max].max
(N - 2).times do |i|
cal = [
ret_max_cw[i] + max_ccw[i+1],
ret_max_ccw[i+1] + max_cw[i]
].max
ans = cal if ans < cal
end
puts ans | N, C = gets.split.map(&:to_i)
xs, vs = [], []
N.times do |i|
xs[i], vs[i] = gets.split.map(&:to_i)
end
max_cw = Array.new(N, 0)
max_ccw = Array.new(N, 0)
ret_max_cw = Array.new(N, 0)
ret_max_ccw = Array.new(N, 0)
sum = vs[0] - xs[0]
max_cw[0] = [sum, 0].max
sum2 = vs[0] - 2 * xs[0]
ret_max_cw[0] = [sum2, 0].max
(N - 1).times do |i|
sum += vs[i+1] - (xs[i+1] - xs[i])
sum2 += vs[i+1] - (xs[i+1] - xs[i]) * 2
max_cw[i+1] = [max_cw[i], sum].max
ret_max_cw[i+1] = [ret_max_cw[i], sum2].max
end
sum = vs[-1] - (C - xs[-1])
max_ccw[-1] = [sum, 0].max
sum2 = vs[-1] - (C - xs[-1]) * 2
ret_max_ccw[-1] = [sum2, 0].max
(N - 1).times do |i|
sum += vs[N - 2 - i] - (xs[N - 1 - i] - xs[N - 2 - i])
sum2 += vs[N - 2 - i] - (xs[N - 1 - i] - xs[N - 2 - i]) * 2
max_ccw[N - 2 - i] = [max_ccw[N - 1 - i], sum].max
ret_max_ccw[N - 2 - i] = [ret_max_ccw[N - 1 - i], sum2].max
end
#p max_cw
#p max_ccw
#p ret_max_cw
#p ret_max_ccw
ans = [max_cw.max, max_ccw.max].max
(N - 1).times do |i|
cal = [
ret_max_cw[i] + max_ccw[i+1],
ret_max_ccw[i+1] + max_cw[i]
].max
ans = cal if ans < cal
end
puts ans | [
"literal.number.integer.change",
"expression.operation.binary.change"
] | 1,140,179 | 1,140,180 | u314396879 | ruby |
p03377 | a, b ,x = gets.chomp.split(" ").map(&:to_i)
if a + b >= x && b <= x
puts "YES"
else
puts "NO"
end | a, b ,x = gets.chomp.split(" ").map(&:to_i)
if a + b >= x && a <= x
puts "YES"
else
puts "NO"
end
| [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,140,294 | 1,140,295 | u412789323 | ruby |
p03377 | a, b ,x = gets.chomp.split(" ").map(&:to_i)
if a + b >- x && b <= x
puts "YES"
else
puts "NO"
end
| a, b ,x = gets.chomp.split(" ").map(&:to_i)
if a + b >= x && a <= x
puts "YES"
else
puts "NO"
end
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"expression.operation.unary.arithmetic.remove",
"identifier.change"
] | 1,140,296 | 1,140,295 | u412789323 | ruby |
p03377 | a, b, x = gets.split.map &:to_i
puts (a+b) >= x ? :YES: :NO | a, b, x = gets.split.map &:to_i
puts (a+b) >= x && a <= x ? :YES: :NO | [
"control_flow.branch.if.condition.change"
] | 1,140,322 | 1,140,323 | u489339677 | ruby |
p03377 | a,b,x = gets.split.map &:to_i
if a > x || a+b < x
puts "No"
elsif a == x || (a < x && a+b >= x)
puts "Yes"
end
| a,b,x = gets.split.map &:to_i
if a > x || a+b < x
puts "NO"
elsif a == x || (a < x && a+b >= x)
puts "YES"
end | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,140,724 | 1,140,725 | u437368899 | ruby |
p03377 | a,b,x = gets.chomp.split.map(&:to_i)
if x >= a && x <= a+b
puts "Yes"
else
puts "No"
end | a,b,x = gets.chomp.split.map(&:to_i)
if x >= a && x <= a+b
puts "YES"
else
puts "NO"
end | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,140,938 | 1,140,939 | u689027433 | ruby |
p03377 | a,b,x = gets.chomp.split.map(&:to_i)
if x >= a && x <= b
puts "Yes"
else
puts "No"
end | a,b,x = gets.chomp.split.map(&:to_i)
if x >= a && x <= a+b
puts "YES"
else
puts "NO"
end | [
"control_flow.branch.if.condition.change",
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,140,940 | 1,140,939 | u689027433 | ruby |
p03377 | arr = $stdin.gets.chomp.split(" ")
arr.map! do |a_j|
a_j.to_i
end
if arr[2] >= arr[0] and arr[0] + arr[1] <= arr[2]
puts "YES"
else
puts "NO"
end
| arr = $stdin.gets.chomp.split(" ")
arr.map! do |a_j|
a_j.to_i
end
if arr[2] >= arr[0] and arr[0] + arr[1] >= arr[2]
puts "YES"
else
puts "NO"
end | [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,141,378 | 1,141,379 | u294388467 | ruby |
p03377 | a,b,c = readline.chomp.split.map(&:to_i)
puts a < c && (a + b) > c ? "YES" : "NO" | a,b,c = readline.chomp.split.map(&:to_i)
puts a <= c && (a + b) >= c ? "YES" : "NO" | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,141,474 | 1,141,475 | u353707427 | ruby |
p03377 | a,b,c = gets.chomp.split(" ").map(&:to_i)
x - a <= b && x - a >= 0 ? answer = "YES" : answer = "NO"
puts answer | a,b,x = gets.chomp.split(" ").map(&:to_i)
(x - a <= b && x - a >= 0) ? answer = "YES" : answer = "NO"
puts answer | [
"assignment.variable.change",
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,141,574 | 1,141,575 | u333374716 | ruby |
p03377 | a,b,x=gets.split.map(&:to_i)
puts a+b>=x && a<=x ?'Yes':'No' | a,b,x=gets.split.map(&:to_i)
puts a+b>=x && a<=x ?'YES':'NO' | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,141,609 | 1,141,610 | u630043039 | ruby |
p03377 | A,B,X = gets.split.map(&:to_i)
puts (A > X or A+B < X) ? "No" : "Yes" | A,B,X = gets.split.map(&:to_i)
puts (A > X or A+B < X) ? "NO" : "YES" | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,141,831 | 1,141,832 | u502306384 | ruby |
p03377 | a,b,x = gets.split.map(&:to_i)
puts a <= x && x <= b ? "Yes" : "No" | a,b,x = gets.split.map(&:to_i)
puts a <= x && x <= a + b ? "YES" : "NO" | [
"control_flow.branch.if.condition.change",
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,142,315 | 1,142,316 | u502774641 | ruby |
p03377 |
a,b,c = gets.split.map(&:to_i)
if a + b >= c && a <= c
puts "Yes"
else
puts "No"
end | a,b,c = gets.split.map(&:to_i)
if a + b >= c && a <= c
puts "YES"
else
puts "NO"
end | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,142,756 | 1,142,757 | u990788654 | ruby |
p03377 |
a,b,c = gets.split.map(&:to_i)
if a + b > c && a <= c
puts "Yes"
else
puts "No"
end
| a,b,c = gets.split.map(&:to_i)
if a + b >= c && a <= c
puts "YES"
else
puts "NO"
end | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,142,758 | 1,142,757 | u990788654 | ruby |
p03377 | a,b,x=gets.chomp.split(" ").map { |e| e.to_i }
if a+b >= x
puts "YES"
else
puts "NO"
end
| a,b,x=gets.chomp.split(" ").map { |e| e.to_i }
if a+b >= x && a <= x
puts "YES"
else
puts "NO"
end
| [
"control_flow.branch.if.condition.change"
] | 1,142,780 | 1,142,781 | u267552846 | ruby |
p03377 | (a,b,c)=gets.split.map(&:to_i)
if c == a
puts "Yes"
elsif a<c && (a+b)>=c
puts "Yes"
else
puts "No"
end
| (a,b,c)=gets.split.map(&:to_i)
if c == a
puts "YES"
elsif a<=c && (a+b)>=c
puts "YES"
else
puts "NO"
end
| [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,143,132 | 1,143,133 | u671239754 | ruby |
p03377 | (a,b,c)=gets.split.map(&:to_i)
if c == a
puts "Yes"
elsif a<c && (a+b)>=c
puts "Yes"
else
puts "NO"
end
| (a,b,c)=gets.split.map(&:to_i)
if c == a
puts "YES"
elsif a<=c && (a+b)>=c
puts "YES"
else
puts "NO"
end
| [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,143,134 | 1,143,133 | u671239754 | ruby |
p03377 | a,b,c = gets.strip.split.map(&:to_i)
if (a + b) >= c
puts 'YES'
else
puts 'NO'
end | a,b,c = gets.strip.split.map(&:to_i)
if (a + b) >= c && a <= c
puts 'YES'
else
puts 'NO'
end | [
"control_flow.branch.if.condition.change"
] | 1,143,290 | 1,143,291 | u271063202 | ruby |
p03377 | s = gets().split(" ")
a = s[0].to_i
b = s[1].to_i
x = s[2].to_i
if (a <= x && x <= b)
puts "YES"
else
puts "NO"
end
| s = gets().split(" ")
a = s[0].to_i
b = s[1].to_i
x = s[2].to_i
if (a <= x && x <= a + b)
puts "YES"
else
puts "NO"
end
| [
"control_flow.branch.if.condition.change"
] | 1,143,372 | 1,143,373 | u184659204 | ruby |
p03377 | a, b, x = gets.split.map(&:to_i)
if a <= x && x <= a + b
puts 'Yes'
else
puts 'No'
end | a, b, x = gets.split.map(&:to_i)
if a <= x && x <= a + b
puts 'YES'
else
puts 'NO'
end | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,143,416 | 1,143,417 | u991345716 | ruby |
p03377 | i = gets.chomp.split("\s").map{|e| e.to_i}
A = i[0]
B = i[1]
X = i[2]
if (A + B - X >= 0) && (X - A >= 0)
print("Yes")
else
print("No")
end | i = gets.chomp.split("\s").map{|e| e.to_i}
A = i[0]
B = i[1]
X = i[2]
if (A + B - X >= 0) && (X - A >= 0)
print("YES")
else
print("NO")
end | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,143,566 | 1,143,567 | u430058562 | ruby |
p03378 | N,M,X = gets.split.map(&:to_i)
A = gets.split.map(&:to_i)
x = A.find_all{|item| item < x}.length
puts [x, m - x].min | N,M,X = gets.split.map(&:to_i)
A = gets.split.map(&:to_i)
x = A.find_all{|item| item < X}.length
puts [x, M - x].min | [
"assignment.value.change",
"expression.operation.binary.change",
"call.arguments.change",
"io.output.change"
] | 1,144,267 | 1,144,268 | u244087909 | ruby |
p03378 | n,m,x=gets.chomp.map(&:to_i)
as=gets.chomp.map(&:to_i)
left = as.count {|a| a < x}
right = as.count {|a| x < a}
p [left,right].min | n,m,x=gets.chomp.split.map(&:to_i)
as=gets.chomp.split.map(&:to_i)
left = as.count {|a| a < x}
right = as.count {|a| x < a}
p [left,right].min | [
"call.add"
] | 1,144,371 | 1,144,372 | u852974293 | ruby |
p03378 | n,m,x,*a=`dd`.split.map &:to_i
idx=(0...n).bsearch{|i|a[i]>=x}||n
p [idx,n-idx].min | n,m,x,*a=`dd`.split.map &:to_i
idx=(0...m).bsearch{|i|a[i]>=x}||m
p [idx,m-idx].min | [
"assignment.value.change",
"identifier.change",
"expression.operation.binary.change",
"call.arguments.change"
] | 1,144,552 | 1,144,553 | u280667879 | ruby |
p03378 | n,m,x,*a=`dd`.split.map &:to_i
idx=(0..n).bsearch{|i|a[i]>=x}||n
p [idx,n-idx].min | n,m,x,*a=`dd`.split.map &:to_i
idx=(0...m).bsearch{|i|a[i]>=x}||m
p [idx,m-idx].min | [
"assignment.value.change",
"expression.operation.binary.change",
"identifier.change",
"call.arguments.change"
] | 1,144,554 | 1,144,553 | u280667879 | ruby |
p03379 | n = gets.to_i
ary = gets.split.map(&:to_i)
n.times do |i|
ary[i] = [ary[i], i]
end
ary.sort!
n.times do |i|
ary[i] << ary[n / 2 - 1 + i / (n / 2)][0]
end
ary.sort_by{|a| a[1]}.each do |x|
puts x[2]
end
| n = gets.to_i
ary = gets.split.map(&:to_i)
n.times do |i|
ary[i] = [ary[i], i]
end
ary.sort!
n.times do |i|
ary[i] << ary[n / 2 - i / (n / 2)][0]
end
ary.sort_by{|a| a[1]}.each do |x|
puts x[2]
end
| [
"expression.operation.binary.remove"
] | 1,144,930 | 1,144,931 | u785521224 | ruby |
p03379 | n,*x=gets(p).split.map(&:to_i)
y=x.sort
med_l,med_r=y[n/2-1,n/2]
x.each{|v|
puts v>=med_r ? med_l : med_r
} | n,*x=gets(p).split.map(&:to_i)
y=x.sort
med_l,med_r=y[n/2-1],y[n/2]
x.each{|v|
puts v>=med_r ? med_l : med_r
} | [] | 1,145,017 | 1,145,018 | u726630158 | ruby |
p03377 | arr = gets.chomp.split(" ")
a = arr[0].to_i
b = arr[1].to_i
x = arr[2].to_i
if (a<=x && x<=(a+b))
puts 'Yes'
else
puts 'No'
end
| arr = gets.chomp.split(" ")
a = arr[0].to_i
b = arr[1].to_i
x = arr[2].to_i
if (a<=x && x<=(a+b))
puts 'YES'
else
puts 'NO'
end
| [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,145,282 | 1,145,283 | u207576661 | ruby |
p03377 | a,b,x= gets.split(" ").map { |e| e.to_i }
if a<=x and x<=b
puts "YES"
else
puts "NO"
end | a,b,x= gets.split(" ").map { |e| e.to_i }
if a<=x and x<=(a+b)
puts "YES"
else
puts "NO"
end
| [
"control_flow.branch.if.condition.change"
] | 1,145,345 | 1,145,346 | u698460655 | ruby |
p03377 | A, B, X = gets.split.map(&:to_i)
puts X > A && X <= B ? 'YES' : 'NO' | A, B, X = gets.split.map(&:to_i)
puts X >= A && X <= A + B ? 'YES' : 'NO' | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,145,439 | 1,145,440 | u764026162 | ruby |
p03379 | n = gets.to_i
x = gets.chomp.split(" ").map(&:to_i)
y = x.sort
b = y[n/2-1..n/2]
p b
n.times do |i|
if x[i] <= b[0]
puts b[1]
else x[i] >= b[1]
puts b[0]
end
end | n = gets.to_i
x = gets.chomp.split(" ").map(&:to_i)
y = x.sort
b = y[n/2-1..n/2]
n.times do |i|
if x[i] <= b[0]
puts b[1]
else x[i] >= b[1]
puts b[0]
end
end | [
"call.remove"
] | 1,145,556 | 1,145,557 | u506255180 | ruby |
p03380 | n = gets.to_i
num = gets.strip.split.map(&:to_i)
#パスカルの三角形を考えればnとして選ぶのはnumの最大値
maxs = num.max
ary = []
i = 0
while i < n
ary[i] = (num[i]-maxs.to_f/2).abs
i += 1
end
mins = ary.min
puts [maxs,num[ary.index(mins)]].join(" ") | n = gets.to_i
num = gets.strip.split.map(&:to_i)
#パスカルの三角形を考えればnとして選ぶのはnumの最大値
maxs = num.max
num.sort!
ary = []
i = 0
while i < n-1
ary[i] = (num[i]-maxs.to_f/2).abs
i += 1
end
mins = ary.min
puts [maxs,num[ary.index(mins)]].join(" ") | [
"call.add"
] | 1,145,580 | 1,145,581 | u313103408 | ruby |
p03380 | n = gets.to_s.to_i
a = gets.to_s.split.map{|t| t.to_i }.sort
m = a[-1] / 2
x = a[0,n-1].bsearch{ |t| t >= m }
y = a[0,n-1].reverse.bsearch{ |t| t <= m }
# p [x, y, a[-1] - x, y]
if (x && y && m - x <= y) || !y
puts "#{a[-1]} #{x}"
else
puts "#{a[-1]} #{y}"
end
| n = gets.to_s.to_i
a = gets.to_s.split.map{|t| t.to_i }.sort
# n = a.size
m = a[-1] / 2
x = a[0,n-1].bsearch{ |t| t >= m }
y = a[0,n-1].reverse.bsearch{ |t| t <= m }
if (x && y && x-m <= m-y) || !y
puts "#{a[-1]} #{x}"
else
puts "#{a[-1]} #{y}"
end | [
"control_flow.branch.if.condition.change",
"expression.operation.binary.remove"
] | 1,145,753 | 1,145,754 | u693378622 | ruby |
p03377 | a,b,x = gets.strip.split.map(&:to_i)
if a<=x && x<=a+b
puts "Yes"
else
puts "No"
end | #YESとNOが大文字だ
a,b,x = gets.strip.split.map(&:to_i)
if a<=x && x<=a+b
puts "YES"
else
puts "NO"
end
| [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,146,526 | 1,146,527 | u313103408 | ruby |
p03380 | lines = $stdin.read
array = lines.split("\n")
# https://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q1155016236
# nが偶数のときはr=n/2
# nが奇数のときはr=(n-1)/2,(n+1)/2
# で最大値をとることになります.
N = array[0].to_i
A = array[1].split(" ").map(&:to_i).sort.reverse
n = A.max
max_r_idx = A.map.with_index{|e,idx| [(n/2-e).abs,idx]}.min_by{|arr| arr.first}.last
max_r = A[max_r_idx]
puts "#{n} #{max_r}" | lines = $stdin.read
array = lines.split("\n")
# https://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q1155016236
# nが偶数のときはr=n/2
# nが奇数のときはr=(n-1)/2,(n+1)/2
# で最大値をとることになります.
N = array[0].to_i
A = array[1].split(" ").map(&:to_i).sort.reverse
n = A.max
A.delete(n)
max_r_idx = A.map.with_index{|e,idx| [(n/2-e).abs,idx]}.min_by{|arr| arr.first}.last
max_r = A[max_r_idx]
puts "#{n} #{max_r}" | [
"call.add"
] | 1,146,772 | 1,146,773 | u108333452 | ruby |
p03380 | arr = gets.chomp.split(' ').map(&:to_i)
b = gets.chomp.split(' ').map(&:to_i)
max = b.max
half = (max + 1) / 2
diff = []
index = 0
b.each_with_index do |val, i|
next if val == max
diff[i] = (half - val).abs
index = diff[index] > diff[i] ? i : index
end
puts "#{max} #{b[index]}"
| arr = gets.chomp.split(' ').map(&:to_i)
b = gets.chomp.split(' ').map(&:to_i)
max = b.max
half = (max + 1) / 2
diff = [half * 3]
index = 0
b.each_with_index do |val, i|
next if val == max
diff[i] = (half - val).abs
index = diff[index] > diff[i] ? i : index
end
puts "#{max} #{b[index]}"
| [
"assignment.change"
] | 1,147,060 | 1,147,061 | u658389776 | ruby |
p03380 | n = gets.to_i
arr = gets.split(" ").map(&:to_i)
j = arr.max
k = 9999999999
div = 1000000000
if arr.include?(j/2)
puts j.to_s + " " + (j/2).to_s
exit
end
for i in 0..n-1 do
if (j/2 - arr[i]).abs <= div
div = (j/2 - arr[i]).abs
k = arr[i]
end
end
puts j.to_s + " " + k.to_s | n = gets.to_i
arr = gets.split(" ").map(&:to_i).sort
j = arr.max
k = 9999999999
div = 1000000000
if arr.include?(j/2)
puts j.to_s + " " + (j/2).to_s
exit
end
for i in 0..n-2 do
if (j/2 - arr[i]).abs <= div
div = (j/2 - arr[i]).abs
k = arr[i]
end
end
puts j.to_s + " " + k.to_s | [
"call.add",
"literal.number.integer.change",
"expression.operation.binary.change"
] | 1,147,118 | 1,147,119 | u094826590 | ruby |
p03385 | s = gets.chomp.split(' ').sort.join
if s == "abc"
puts "Yes"
else
puts "No"
end | s = gets.chomp.chars.sort.join
if s == "abc"
puts "Yes"
else
puts "No"
end | [
"assignment.value.change",
"identifier.change",
"call.arguments.change"
] | 1,147,343 | 1,147,344 | u059126963 | ruby |
p03385 | puts gets.chomp.size == 3 ? :Yes: :No | puts gets.chomp.chars.uniq.size == 3 ? :Yes: :No | [
"control_flow.branch.if.condition.change",
"call.add"
] | 1,147,371 | 1,147,372 | u489339677 | ruby |
p03385 | puts (gets.chop.chars&[?a..?c]).size>2 ? :Yes: :No | puts (gets.chop.chars&[?a,?b,?c]).size>2 ? :Yes: :No | [
"control_flow.branch.if.condition.change",
"literal.array.change"
] | 1,147,388 | 1,147,389 | u657913472 | ruby |
p03385 | n = $stdin.gets.chomp
flag == 0
if n[0] != n[1]
if n[1] != n[2]
if n[0] != n[2]
flag = 1
end
end
end
if flag == 1
puts "Yes"
else
puts "No"
end | n = $stdin.gets.chomp
flag = 0
if n[0] != n[1]
if n[1] != n[2]
if n[0] != n[2]
flag = 1
end
end
end
if flag == 1
puts "Yes"
else
puts "No"
end
| [
"expression.operation.compare.replace.remove",
"assignment.replace.add",
"misc.typo"
] | 1,147,427 | 1,147,428 | u688809543 | ruby |
p03385 | s = gets
if s[0] != s[1] && s[1] != s[2] && s[2] != s[3]
printf "Yes"
else
printf 'No'
end | s = gets
if s[0] != s[1] && s[1] != s[2] && s[2] != s[0]
printf 'Yes'
else
printf 'No'
end | [
"literal.number.integer.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change",
"literal.string.change",
"call.arguments.change"
] | 1,147,605 | 1,147,606 | u979444096 | ruby |
p03385 | s = gets.chomp.split("").uniq
s.length == 3 ? answer = "Yes" : answer = "NO"
puts answer | s = gets.chomp.split("").uniq
s.length == 3 ? answer = "Yes" : answer = "No"
puts answer
| [
"literal.string.change",
"literal.string.case.change",
"assignment.value.change"
] | 1,147,654 | 1,147,655 | u333374716 | ruby |
p03385 | if gets.chomp.uniq.length == 3
puts 'Yes'
else
puts 'No'
end | if gets.chomp.chars.uniq.length == 3
puts 'Yes'
else
puts 'No'
end | [
"control_flow.branch.if.condition.change",
"call.add"
] | 1,147,658 | 1,147,659 | u866325115 | ruby |
p03385 | a = gets.chomp.chars
b = (a.all? {|w| w == 'a' || w == 'b' || w == 'c' } && a.uniq.length == 3) ? 'aa' : 'bb'
puts b | a = gets.chomp.chars
b = (a.all? {|w| w == 'a' || w == 'b' || w == 'c' } && a.uniq.length == 3) ? 'Yes' : 'No'
puts b | [
"literal.string.change",
"assignment.value.change"
] | 1,147,811 | 1,147,812 | u398965608 | ruby |
p03385 | s = $stdin.read
puts s.split("").sort.join == "abc" ? 'Yes' : 'No' | s = $stdin.read.chomp
puts s.split("").sort.join == 'abc' ? 'Yes' : 'No' | [
"call.add",
"literal.string.change",
"control_flow.branch.if.condition.change"
] | 1,147,872 | 1,147,873 | u534039323 | ruby |
p03385 | s = $stdin.read
puts s.split("").sort.join == 'abc' ? 'Yes' : 'No' | s = $stdin.read.chomp
puts s.split("").sort.join == 'abc' ? 'Yes' : 'No' | [
"call.add"
] | 1,147,874 | 1,147,873 | u534039323 | ruby |
p03385 | puts gets.chars.sort.join == "abc" ? "Yes" : "No" | puts gets.chomp.chars.sort.join == "abc" ? "Yes" : "No" | [
"control_flow.branch.if.condition.change",
"call.add"
] | 1,147,910 | 1,147,911 | u670503797 | ruby |
p03385 | puts gets.chomp.sort == "abc" ? "Yes" : "No" | puts gets.chomp.chars.sort.join == "abc" ? "Yes" : "No" | [
"control_flow.branch.if.condition.change",
"call.add"
] | 1,147,912 | 1,147,911 | u670503797 | ruby |
p03385 | puts gets.chpmp.sort == "abc" ? "Yes" : "No" | puts gets.chomp.chars.sort.join == "abc" ? "Yes" : "No" | [
"identifier.change",
"control_flow.branch.if.condition.change",
"call.add"
] | 1,147,913 | 1,147,911 | u670503797 | ruby |
p03385 | puts gets.chars.uniq.length == 3 ? "Yes" : "No" | puts gets.chomp.chars.uniq.length == 3 ? "Yes" : "No"
| [
"control_flow.branch.if.condition.change",
"call.add"
] | 1,148,071 | 1,148,072 | u871239364 | ruby |
p03385 | if gets.chop.split('').sort.join == "abc"
puts "YES"
else
puts "NO"
end
| if gets.chop.split('').sort.join == "abc"
puts "Yes"
else
puts "No"
end
| [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,148,141 | 1,148,142 | u709879360 | ruby |
p03385 | a = gets.split("")
sort = a.sort
if sort.join("") == "abc"
puts "Yes"
else
puts "No"
end | a = gets.chomp.split("")
sort = a.sort!
if sort.join("") == "abc"
puts "Yes"
else
puts "No"
end | [
"call.add",
"call.suffix.change"
] | 1,148,203 | 1,148,204 | u990788654 | ruby |
p03385 | print gets.chomp.chars.sort = ["a", "b", "c"] ? "Yes" : "No" | print gets.chomp.chars.sort == ["a", "b", "c"] ? "Yes" : "No" | [
"expression.operation.compare.replace.add",
"assignment.replace.remove",
"misc.typo"
] | 1,148,218 | 1,148,219 | u644856766 | ruby |
p03385 | puts gets.chomp.sort=='abc' ? "Yes" : "No" | puts gets.chomp.chars.sort=='abc'.chars ? "Yes" : "No" | [
"control_flow.branch.if.condition.change",
"call.add"
] | 1,148,242 | 1,148,243 | u056944756 | ruby |
p03385 | s = gets.chomp
if s[0] == "a"
a = 1
elsif s[0] == "b"
b = 1
elsif s[0] == "c"
c = 1
end
if s[1] == "a"
a = 1
elsif s[1] == "b"
b = 1
elsif s[1] == "c"
c = 1
end
if s[2] == "a"
a = 1
elsif s[2] == "b"
b = 1
elsif s[2] == "c"
c = 1
end
if (a == 1) && (b == 1) && (c == 1)
puts("yes")
else
puts("no")
end | s = gets.chomp
if s[0] == "a"
a = 1
elsif s[0] == "b"
b = 1
elsif s[0] == "c"
c = 1
end
if s[1] == "a"
a = 1
elsif s[1] == "b"
b = 1
elsif s[1] == "c"
c = 1
end
if s[2] == "a"
a = 1
elsif s[2] == "b"
b = 1
elsif s[2] == "c"
c = 1
end
if (a == 1) && (b == 1) && (c == 1)
puts("Yes")
else
puts("No")
end | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,148,455 | 1,148,456 | u163052359 | ruby |
p03385 | s = gets.chomp
if s.split('').sort.join == 'abc'
puts 'yes'
else
puts 'no'
end
| s = gets.chomp
if s.split('').sort.join == 'abc'
puts 'Yes'
else
puts 'No'
end
| [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,148,723 | 1,148,724 | u777001365 | ruby |
p03386 | #WA理由分からず
a,b,k = gets.chomp.split(' ').map(&:to_i)
arr = []
i = a
while i < a + k && i < b
arr.push(i)
i += 1
end
i -= 1
if i < b - k
i = b - k + 1
end
while i <= b
arr.push(i)
i += 1
end
puts arr
| #WA理由分からず
a,b,k = gets.chomp.split(' ').map(&:to_i)
arr = []
i = a
while i < a + k && i < b
arr.push(i)
i += 1
end
if i - 1 < b - k
i = b - k + 1
end
while i <= b
arr.push(i)
i += 1
end
puts arr | [
"control_flow.branch.if.condition.change"
] | 1,148,831 | 1,148,832 | u059126963 | ruby |
p03386 | #WA理由分からず
a,b,k = gets.chomp.split(' ').map(&:to_i)
arr = []
i = a
while i < a + k && i < b
arr.push(i)
i += 1
end
if i < b - k
i = b - k + 1
end
while i <= b
arr.push(i)
i += 1
end
puts arr | #WA理由分からず
a,b,k = gets.chomp.split(' ').map(&:to_i)
arr = []
i = a
while i < a + k && i < b
arr.push(i)
i += 1
end
if i - 1 < b - k
i = b - k + 1
end
while i <= b
arr.push(i)
i += 1
end
puts arr | [
"control_flow.branch.if.condition.change"
] | 1,148,833 | 1,148,832 | u059126963 | ruby |
p03386 | a,b,k = gets.chomp.split(' ').map(&:to_i)
arr = []
i = a
while i < a + k && i < b
arr.push(i)
i += 1
end
if i < b - k
i = b - k + 1
end
while i <= b
arr.push(i)
i += 1
end
puts arr | #WA理由分からず
a,b,k = gets.chomp.split(' ').map(&:to_i)
arr = []
i = a
while i < a + k && i < b
arr.push(i)
i += 1
end
if i - 1 < b - k
i = b - k + 1
end
while i <= b
arr.push(i)
i += 1
end
puts arr | [
"control_flow.branch.if.condition.change"
] | 1,148,834 | 1,148,832 | u059126963 | ruby |
p03386 | a,b,k = $stdin.gets.chomp.split(' ').map(&:to_i)
# a = a.to_i,b = b.to_i,k = k.to_i #(.map(&:to_i)でいいんだけど…)
num = a.to_i
k.times do
puts num
num = num + 1
if num > b
exit
end
end
if num > b-k
(b - num + 1).times do
puts num
num = num + 1
end
else
num = b - k
k.times do
puts num
num = num + 1
end
end | a,b,k = $stdin.gets.chomp.split(' ').map(&:to_i)
# a = a.to_i,b = b.to_i,k = k.to_i #(.map(&:to_i)でいいんだけど…)
num = a.to_i
k.times do
puts num
num = num + 1
if num > b
exit
end
end
if num > b-k
(b - num + 1).times do
puts num
num = num + 1
end
else
num = b - k + 1
k.times do
puts num
num = num + 1
end
end | [
"assignment.change"
] | 1,148,987 | 1,148,988 | u688809543 | ruby |
p03386 | A,B,K=$<.read.split.map(&:to_i)
if B-K <= A+K
A.upto(B) do |n|
puts n
end
else
A.upto(A+K-1) do |n|
puts n
end
(B-K+1).upto(B) do |n|
puts n
end
end
# A.upto([A+K-1,B].min) do |n|
# puts n
# end
# [B-K+1,A+K].max.upto(B) do |n|
# puts n
# end
| A,B,K=$<.read.split.map(&:to_i)
if B-K+1 <= A+K-1
A.upto(B) do |n|
puts n
end
else
A.upto(A+K-1) do |n|
puts n
end
(B-K+1).upto(B) do |n|
puts n
end
end
# A.upto([A+K-1,B].min) do |n|
# puts n
# end
# [B-K+1,A+K].max.upto(B) do |n|
# puts n
# end
| [
"control_flow.branch.if.condition.change"
] | 1,149,089 | 1,149,090 | u852974293 | ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.