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 |
|---|---|---|---|---|---|---|---|
p03295 | n,m=gets.chomp.split.map { |e| e.to_i }
a=Array.new(m,0)
b=Array.new(m,0)
m.times do |i|
a[i],b[i]=gets.chomp.split.map { |e| e.to_i }
end
c=Array.new(m)
for i in 0..m-1
c[i] = {'a' => a[i],'b' => b[i]}
end
def quick_sort_hash(c)
if c==[]
return []
end
smaller = c.select{ |h| h["b"] < c[0]["b"] }
same = c.select{ |h| h["b"] == c[0]["b"] }
larger = c.select { |h| h["b"] > c[0]["b"] }
return quick_sort_hash(smaller) + same + quick_sort_hash(larger)
end
e=quick_sort_hash(c)
x=-1
dp = 0
m.times do |i|
if e[i]["a"] > x
dp +=1
x=e[i]["b"]
end
end
puts dp
| n,m=gets.chomp.split.map { |e| e.to_i }
a=Array.new(m,0)
b=Array.new(m,0)
m.times do |i|
a[i],b[i]=gets.chomp.split.map { |e| e.to_i }
end
c=Array.new(m)
for i in 0..m-1
c[i] = {'a' => a[i],'b' => b[i]}
end
def quick_sort_hash(c)
if c==[]
return []
end
smaller = c.select{ |h| h["b"] < c[0]["b"] }
same = c.select{ |h| h["b"] == c[0]["b"] }
larger = c.select { |h| h["b"] > c[0]["b"] }
return quick_sort_hash(smaller) + same + quick_sort_hash(larger)
end
e=quick_sort_hash(c)
x=-1
dp = 0
m.times do |i|
if e[i]["a"] >= x
dp +=1
x=e[i]["b"]
end
end
puts dp | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,083,634 | 1,083,635 | u267552846 | ruby |
p03295 | n, m = gets.chomp.split(' ').map(&:to_i)
arr = []
m.times do
arr << gets.chomp.split(' ').map(&:to_i)
end
arr.sort_by! { |i| i[1] }
puts arr
pivot = arr[0]
count = 1
(1...m).each do |i|
if arr[i][0] >= pivot[1]
count += 1
pivot = arr[i]
end
end
## 他の方のコードを備忘録として提出させていただきます | n, m = gets.chomp.split(' ').map(&:to_i)
arr = []
m.times do
arr << gets.chomp.split(' ').map(&:to_i)
end
arr.sort_by! { |i| i[1] }
pivot = arr[0]
count = 1
(1...m).each do |i|
if arr[i][0] >= pivot[1]
count += 1
pivot = arr[i]
end
end
puts count
## 他の方のコードを備忘録として提出させていただきます | [
"call.remove",
"call.add"
] | 1,084,564 | 1,084,565 | u562148988 | ruby |
p03297 | class Integer
def mod_max(a, d)
g = self.gcd(d)
self - g + a % self
end
end
T = gets.to_i
def f(a, b, c, d)
return false if a < b
return false if d < b
return true if c >= b
b.mod_max(a, d) <= c
end
T.times do
a, b, c, d = gets.split.map(&:to_i)
if f(a, b, c, d)
puts 'Yes'
else
puts 'No'
end
end
| class Integer
def mod_max(a, d)
g = self.gcd(d)
self - g + a % g
end
end
T = gets.to_i
def f(a, b, c, d)
return false if a < b
return false if d < b
return true if c >= b
b.mod_max(a, d) <= c
end
T.times do
a, b, c, d = gets.split.map(&:to_i)
if f(a, b, c, d)
puts 'Yes'
else
puts 'No'
end
end
| [
"expression.operation.binary.change"
] | 1,084,655 | 1,084,656 | u740836226 | ruby |
p03297 | class Integer
def mod_max(a, d)
g = self.gcd(d)
self - g + a % self
end
end
T = gets.to_i
def f(a, b, c, d)
return false if a < b
return false if d < b
return true if c >= b
b.mod_max(a, d)
end
T.times do
a, b, c, d = gets.split.map(&:to_i)
if f(a, b, c, d)
puts 'Yes'
else
puts 'No'
end
end
| class Integer
def mod_max(a, d)
g = self.gcd(d)
self - g + a % g
end
end
T = gets.to_i
def f(a, b, c, d)
return false if a < b
return false if d < b
return true if c >= b
b.mod_max(a, d) <= c
end
T.times do
a, b, c, d = gets.split.map(&:to_i)
if f(a, b, c, d)
puts 'Yes'
else
puts 'No'
end
end
| [
"expression.operation.binary.change"
] | 1,084,657 | 1,084,656 | u740836226 | ruby |
p03302 | A, B = gets.split.map(&:to_i)
if A + B == 15
puts '+'
elsif A * B == 15
puts '*'
else
puts 'X'
end
| A, B = gets.split.map(&:to_i)
if A + B == 15
puts '+'
elsif A * B == 15
puts '*'
else
puts 'x'
end
| [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,084,928 | 1,084,929 | u740836226 | ruby |
p03302 | a, b = gets.chomp.split.map(&:to_i)
if a + b = 15
puts "+"
elsif a * b = 15
puts "*"
else
puts "x"
end
| a, b = gets.chomp.split.map(&:to_i)
if a + b == 15
puts "+"
elsif a * b == 15
puts "*"
else
puts "x"
end
| [
"expression.operation.compare.replace.add",
"assignment.replace.remove",
"misc.typo"
] | 1,084,957 | 1,084,958 | u411903982 | ruby |
p03302 | a, b = gets.chomp.split.map(&:to_i)
if a + b = 15
puts "+"
elsif a * b = 15
puts "*"
else
puts "x"
end | a, b = gets.chomp.split.map(&:to_i)
if a + b == 15
puts "+"
elsif a * b == 15
puts "*"
else
puts "x"
end
| [
"expression.operation.compare.replace.add",
"assignment.replace.remove",
"misc.typo"
] | 1,084,959 | 1,084,958 | u411903982 | ruby |
p03302 | x, y = gets.chomp.split.map(&:to_i)
if a + b = 15
puts "+"
elsif a * b = 15
puts "*"
else
puts "x"
end
| a, b = gets.chomp.split.map(&:to_i)
if a + b == 15
puts "+"
elsif a * b == 15
puts "*"
else
puts "x"
end
| [
"assignment.variable.change",
"identifier.change",
"expression.operation.compare.replace.add",
"assignment.replace.remove",
"misc.typo"
] | 1,084,960 | 1,084,958 | u411903982 | ruby |
p03302 | (a,b)=gets.split.map(&:to_i)
if a*b==15
puts "*"
elsif a+b==15
puts "+"
else
puts x
end
| (a,b)=gets.split.map(&:to_i)
if a*b==15
puts "*"
elsif a+b==15
puts "+"
else
puts "x"
end
| [
"call.arguments.change"
] | 1,085,122 | 1,085,123 | u671239754 | ruby |
p03303 | s = gets.chomp.chars
w = gets.chomp.to_i
result = []
cnt = 0
while cnt < s.length
print s[cnt]
cnt += 3
end | s = gets.chomp.chars
w = gets.chomp.to_i
result = []
cnt = 0
while cnt < s.length
print s[cnt]
cnt += w
end | [
"identifier.replace.add",
"literal.replace.remove"
] | 1,085,261 | 1,085,262 | u760636024 | ruby |
p03303 | n = $stdin.read.split("\n")
s = n[0]
w = n[1].to_i
i = w - 1
result = [s[0]]
while true
if i+1 >= s.length - 1
result << s[i+1]
break
end
result << s[i+1]
i+=w
end
p result.join | n = $stdin.read.split("\n")
s = n[0]
w = n[1].to_i
i = w - 1
result = [s[0]]
while true
if i+1 >= s.length - 1
result << s[i+1]
break
end
result << s[i+1]
i+=w
end
puts result.join | [
"call.function.change",
"io.output.change"
] | 1,085,904 | 1,085,905 | u220501704 | ruby |
p03307 | n = gets.to_i
print n % 2 == 0 ? n : n+1 | n = gets.to_i
print n % 2 == 0 ? n : n*2
| [] | 1,086,664 | 1,086,665 | u458429268 | ruby |
p03307 | N = gets.to_i # gcd 最大公約数 lcm 最小公約数
if N.even?
puts N # 偶数
else
puts 2 * N # 奇数ならば2を掛けた数が最小公倍数
end | N = gets.to_i
puts N.even? ? N : 2 * N | [
"io.output.change",
"call.remove"
] | 1,086,687 | 1,086,688 | u552761221 | ruby |
p03307 | n=gets.to_i
puts n.even? ? 2 : 2*n | n=gets.to_i
puts n.even? ? n : 2*n | [
"identifier.replace.add",
"literal.replace.remove",
"call.arguments.change"
] | 1,087,044 | 1,087,045 | u616320334 | ruby |
p03307 | i = ARGV[0].to_i
puts i % 2 == 0 ? i : i * 2 | i = gets.to_i
puts i % 2 == 0 ? i : i * 2 | [
"assignment.value.change"
] | 1,087,283 | 1,087,284 | u852281182 | ruby |
p03308 | n = gets.to_i
num = gets.strip.split.map(&:to_i)
pust num.max-num.min | n = gets.to_i
num = gets.strip.split.map(&:to_i)
puts num.max-num.min
| [
"identifier.change"
] | 1,087,509 | 1,087,510 | u313103408 | ruby |
p03308 | n = gets.chomp.to_i
ary = gets.split(" ").map(&:to_i).sort
puts (ary[-1] - ary[-1]).abs | n = gets.chomp.to_i
ary = gets.split(" ").map(&:to_i).sort
puts (ary[-1] - ary[0]).abs | [
"variable_access.subscript.index.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change",
"expression.operation.unary.remove"
] | 1,087,688 | 1,087,689 | u928941036 | ruby |
p03308 | n = gets.chomp.to_i
array = gets.split.map(&:to_i)
array = array.sort
p array
puts (array.last - array.first)
| n = gets.chomp.to_i
array = gets.split.map(&:to_i)
array = array.sort
puts (array.last - array.first)
| [
"call.remove"
] | 1,087,813 | 1,087,814 | u728874732 | ruby |
p03308 | N = Array.new
A = gets.strip.split.map(&:to_i)
puts A.max-A.min | N = gets.to_i
A = gets.strip.split.map(&:to_i)
puts A.max-A.min | [
"assignment.value.change",
"identifier.change"
] | 1,088,144 | 1,088,145 | u162758522 | ruby |
p03308 | N = gets.to_i
arr = gets.split.map(&to_i)
puts arr.max - arr.min | N = gets.to_i
arr = gets.split.map(&:to_i)
puts arr.max - arr.min | [
"assignment.value.change",
"call.arguments.change"
] | 1,088,222 | 1,088,223 | u328735699 | ruby |
p03308 | n = gets.to_i
a = gets.chomp.split(" ").map(&:to_i)
a.sort!
ans = a.first - a.last
puts ans | n = gets.to_i
a = gets.chomp.split(" ").map(&:to_i)
a.sort!
ans = a.last - a.first
puts ans | [
"assignment.value.change",
"identifier.change",
"expression.operation.binary.change"
] | 1,088,227 | 1,088,228 | u873328343 | ruby |
p03308 | n=gets.chomp.to_i
a=get.chomp.split.map { |e| e.to_i }
max=0
min=10**9
n.times do |i|
if a[i]>max
max=a[i]
end
if a[i]<min
min = a[i]
end
end
puts max-min
| n=gets.chomp.to_i
a=gets.chomp.split.map { |e| e.to_i }
max=0
min=10**9
n.times do |i|
if a[i]>max
max=a[i]
end
if a[i]<min
min = a[i]
end
end
puts max-min | [
"assignment.value.change",
"identifier.change"
] | 1,088,294 | 1,088,295 | u267552846 | ruby |
p03309 | n = gets.to_i
num = gets.strip.split.map(&:to_i)
for i in 1..n
num[i-1] = num[i-1]-i
end
a = num.sort
if n%2==1
b = num[(n-1)/2]
else
b = (num[n/2-1]+num[n/2])/2
end
s = 0
for i in 0..n-1
s += (num[i]-b).abs
end
puts s | n = gets.to_i
num = gets.strip.split.map(&:to_i)
for i in 1..n
num[i-1] = num[i-1]-i
end
a = num.sort
if n%2==1
b = a[(n-1)/2]
else
b = (a[n/2-1]+a[n/2])/2
end
s = 0
for i in 0..n-1
s += (a[i]-b).abs
end
puts s | [
"assignment.value.change",
"identifier.change",
"expression.operation.binary.change"
] | 1,088,524 | 1,088,525 | u313103408 | ruby |
p03307 | N=gets.to_i
if n%2==0
puts N
else
puts N*2
end | N=gets.to_i
if N%2==0
puts N
else
puts N*2
end
| [
"control_flow.branch.if.condition.change"
] | 1,088,625 | 1,088,626 | u967136506 | ruby |
p03309 | n = gets.to_i
array = gets.split(" ").map(&:to_i)
b = []
for i in 0..array.length-1
# puts "#{array[i] - (i+1)} - b"
b << array[i] - (i+1)
end
b.sort!
if b.length % 2 != 0
bb = b[b.length / 2]
else
bb = b[b.length / 2] + b[b.length / 2 - 1]
end
sum = 0
for i in 0..array.length-1
sum += (array[i] - (bb + (i + 1))).abs
end
puts sum | n = gets.to_i
array = gets.split(" ").map(&:to_i)
b = []
for i in 0..array.length-1
# puts "#{array[i] - (i+1)} - b"
b << array[i] - (i+1)
end
b.sort!
if b.length % 2 != 0
bb = b[b.length / 2]
else
bb = (b[b.length / 2] + b[(b.length / 2) - 1]) / 2
end
sum = 0
for i in 0..array.length-1
sum += (array[i] - (bb + (i + 1))).abs
end
puts sum | [
"assignment.change"
] | 1,088,768 | 1,088,769 | u748406041 | ruby |
p03308 |
n = gets.to_i
arr = gets.split.map(&:to_i)
res = 0
arr.each_with_index do |a, i|
arr[i+1..-1].each do |b|
res = [res, a - b].max
end
end
puts res
|
n = gets.to_i
arr = gets.split.map(&:to_i)
res = 0
arr.each_with_index do |a, i|
arr[i+1..-1].each do |b|
res = [res, (a - b).abs].max
end
end
puts res
| [
"call.add"
] | 1,089,302 | 1,089,303 | u946334556 | ruby |
p03309 | _ = gets.to_i
as = gets.split(" ").map(&:to_i)
hoge = []
as.each_with_index do |a,i|
hoge << a - (i+1)
end
hoge.sort!
if hoge.size.odd?
b = hoge[hoge.size/2]
else
i = hoge.size/2
b = hoge[i-1] + (hoge[i] / 2)
end
ans = 0
as.each_with_index do |a,i|
ans += (a - (b+i+1)).abs
end
puts ans | _ = gets.to_i
as = gets.split(" ").map(&:to_i)
hoge = []
as.each_with_index do |a,i|
hoge << a - (i+1)
end
hoge.sort!
if hoge.size.odd?
b = hoge[hoge.size/2]
else
i = hoge.size/2
b = (hoge[i-1] + hoge[i]) / 2
end
ans = 0
as.each_with_index do |a,i|
ans += (a - (b+i+1)).abs
end
puts ans | [] | 1,089,576 | 1,089,577 | u298628832 | ruby |
p03309 | N = gets.to_i
a_list = gets.split.map(&:to_i)
diff_list = a_list.map.with_index do |a, i|
a - i - 1
end.sort
def calc(diff_list, b)
diff_list.map do |d|
(d - b).abs
end.reduce(&:+)
end
ans = calc(diff_list, diff_list[(N / 2) - 1])
puts ans
| N = gets.to_i
a_list = gets.split.map(&:to_i)
diff_list = a_list.map.with_index do |a, i|
a - i - 1
end.sort
def calc(diff_list, b)
diff_list.map do |d|
(d - b).abs
end.reduce(&:+)
end
ans = calc(diff_list, diff_list[N / 2])
puts ans
| [
"call.arguments.change",
"expression.operation.binary.remove"
] | 1,089,603 | 1,089,604 | u012133968 | ruby |
p03309 | N = gets.to_i
A = gets.split.map(&:to_i)
B = A.map.with_index(1) { |a, i| a - i }
b = B[N / 2]
ans = 0
A.each.with_index(1) do |a, i|
ans += (a - i - b).abs
end
puts ans
| N = gets.to_i
A = gets.split.map(&:to_i)
B = A.map.with_index(1) { |a, i| a - i }.sort
b = B[N / 2]
ans = 0
A.each.with_index(1) do |a, i|
ans += (a - i - b).abs
end
puts ans
| [
"call.add"
] | 1,089,703 | 1,089,704 | u740836226 | ruby |
p03309 | n = gets.to_i
a = gets.split.map(&:to_i)
s = Array.new
a.each_with_index do |n, i|
s[i] = n - i - 1
end
s = s.sort
b = s[n/2]
s.each do |n|
x1 += (n - b).abs
end
p x1 | n = gets.to_i
a = gets.split.map(&:to_i)
s = Array.new
a.each_with_index do |n, i|
s[i] = n - i - 1
end
x = 0
s = s.sort
b = s[n/2]
s.each do |n|
x += (n - b).abs
end
p x | [
"identifier.change",
"call.arguments.change"
] | 1,090,646 | 1,090,647 | u757568397 | ruby |
p03309 | n = gets.chomp.to_i
a = gets.chomp.split(' ').map{|i| i.to_i}
n.times do |i|
a[i] = a[i] - i - 1
end
a.sort
b = a[n / 2]
sum = 0
n.times do |i|
sum += (a[i] - b).abs
end
puts sum | n = gets.chomp.to_i
a = gets.chomp.split(' ').map{|i| i.to_i}
n.times do |i|
a[i] = a[i] - i - 1
end
a.sort!
b = a[n / 2]
sum = 0
n.times do |i|
sum += (a[i] - b).abs
end
puts sum | [
"call.suffix.change"
] | 1,090,691 | 1,090,692 | u159117533 | ruby |
p03309 | N = gets.to_i
As = gets.split.map(&:to_i)
xs = As.map.with_index(1){|a, i| a - i}
b = N.even? ? (xs[N/2 - 1, 2].inject(:+) / 2.0).round : xs[N/2]
puts xs.inject(0){|s, x| s + (x - b).abs} | N = gets.to_i
As = gets.split.map(&:to_i)
xs = As.map.with_index(1){|a, i| a - i}.sort
b = N.even? ? (xs[N/2 - 1, 2].inject(:+) / 2.0).round : xs[N/2]
puts xs.inject(0){|s, x| s + (x - b).abs} | [
"call.add"
] | 1,090,764 | 1,090,765 | u304198114 | ruby |
p03315 | #!/usr/bin/env ruby
input = gets.chomp.split("")
result = 0
input.each do |n|
if n == /\+/
result += 1
else
result -= 1
end
end
puts result
| #!/usr/bin/env ruby
input = gets.chomp.split("")
result = 0
input.each do |n|
if n == "+"
result += 1
else
result -= 1
end
end
puts result
| [
"control_flow.branch.if.condition.change"
] | 1,092,111 | 1,092,110 | u958542160 | ruby |
p03315 | #!/usr/bin/env ruby
input = gets.chomp.split("")
result = 0
input.each do |n|
if n == /\+/
result += 1
else
result -= 1
end
end
puts result
| #!/usr/bin/env ruby
input = gets.chomp.split("")
result = 0
input.each do |n|
if n == "+"
result += 1
else
result -= 1
end
end
puts result
| [
"control_flow.branch.if.condition.change"
] | 1,092,111 | 1,092,112 | u958542160 | ruby |
p03315 | s = gets.chomp
p s.size - s.count("-") | s = gets.chomp
p s.count("+") - s.count("-") | [
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change",
"call.arguments.add"
] | 1,092,132 | 1,092,133 | u489339677 | ruby |
p03315 | s = gets.chomp.to_i
print(s.count("+") - s.count("-")) | s = gets.chomp
print(s.count("+") - s.count("-")) | [
"call.remove"
] | 1,092,392 | 1,092,393 | u691896522 | ruby |
p03315 | s = get.chomp
ans = 0
ans += s.count("+")
ans -= s.count("-")
puts ans | s = gets.chomp
ans = 0
ans += s.count("+")
ans -= s.count("-")
puts ans | [
"assignment.value.change",
"identifier.change"
] | 1,092,454 | 1,092,455 | u622469330 | ruby |
p03315 | res=0
gets.chomp.each{|x| eval "res#{x}=1"}
puts res | res=0
gets.chomp.chars{|x| eval "res#{x}=1"}
puts res | [
"identifier.change"
] | 1,092,697 | 1,092,698 | u056944756 | ruby |
p03315 | x=0;p gets.split("").map{|a|a=="-"? x-= 1: x+= 1}[-1] | x=0;p gets.chomp.split("").map{|a|a=="-"? x-= 1: x+= 1}[-1] | [
"call.add"
] | 1,092,706 | 1,092,707 | u617587005 | ruby |
p03315 | s=gets.chomp.split("")
a=0
s.each do |i|
i=="+" ? a+=1:a-=1
end
puts s | s=gets.chomp.split("")
a=0
s.each do |i|
i=="+" ? a+=1:a-=1
end
puts a | [
"identifier.change",
"call.arguments.change"
] | 1,092,744 | 1,092,745 | u702972382 | ruby |
p03312 | N = gets.to_i
a_list = gets.strip.split(/ /).collect{|x| x.to_i}
sum = 0
s_list = []
a_list.each{|a|
sum += a
s_list << sum
}
#p a_list
#p s_list
#p l_table
#p r_table
minimum = sum
(1..(N - 3)).each{|d2|
# p d2
l_sum = s_list[d2]
r_sum = sum - l_sum
# p [l_sum, r_sum]
l_sum2 = l_sum / 2
r_sum2 = r_sum / 2
d1 = (0...d2).bsearch{|i|
s_list[i] > l_sum2
}
if d1 == nil
d1 = d2 - 1
elsif d1 > 0 && (s_list[d1 - 1] * 2 - l_sum).abs < (s_list[d1] * 2 - l_sum).abs
d1 -= 1
end
d3 = ((d2 + 1)...(N - 1)).bsearch{|i|
s_list[i] - l_sum > r_sum2
}
if d3 == nil
d3 = d2 + 1
elsif d3 > 0 && ((s_list[d3 - 1] - l_sum) * 2 - r_sum).abs < ((s_list[d3] - l_sum) * 2 - r_sum).abs
d3 -= 1
end
# p [d1, d2, d3]
s1 = s_list[d1]
s4 = sum - s_list[d3]
pqrs = [s1, l_sum - s1, r_sum - s4, s4]
# p pqrs
diff = pqrs.max - pqrs.min
if diff < minimum
minimum = diff
end
}
puts minimum
| N = gets.to_i
a_list = gets.strip.split(/ /).collect{|x| x.to_i}
sum = 0
s_list = []
a_list.each{|a|
sum += a
s_list << sum
}
#p a_list
#p s_list
#p l_table
#p r_table
minimum = sum
(1..(N - 3)).each{|d2|
# p d2
l_sum = s_list[d2]
r_sum = sum - l_sum
# p [l_sum, r_sum]
l_sum2 = l_sum / 2
r_sum2 = r_sum / 2
d1 = (0...d2).bsearch{|i|
s_list[i] > l_sum2
}
if d1 == nil
d1 = d2 - 1
elsif d1 > 0 && (s_list[d1 - 1] * 2 - l_sum).abs < (s_list[d1] * 2 - l_sum).abs
d1 -= 1
end
d3 = ((d2 + 1)...(N - 1)).bsearch{|i|
s_list[i] - l_sum > r_sum2
}
if d3 == nil
d3 = N - 2
elsif d3 > 0 && ((s_list[d3 - 1] - l_sum) * 2 - r_sum).abs < ((s_list[d3] - l_sum) * 2 - r_sum).abs
d3 -= 1
end
# p [d1, d2, d3]
s1 = s_list[d1]
s4 = sum - s_list[d3]
pqrs = [s1, l_sum - s1, r_sum - s4, s4]
# p pqrs
diff = pqrs.max - pqrs.min
if diff < minimum
minimum = diff
end
}
puts minimum
| [] | 1,092,944 | 1,092,945 | u751724075 | ruby |
p03315 | i = 1
gets.split('').each{|e|e !="-" ? i+=1 : i-=1}
puts i
| i = -1
gets.split('').each{|e|e !="-" ? i+=1 : i-=1}
puts i
| [
"expression.operation.unary.add"
] | 1,092,980 | 1,092,981 | u098870186 | ruby |
p03315 | i = 1
gets.split('').each{|e|e =="-" ? i+=1 : i-=1}
puts i
| i = -1
gets.split('').each{|e|e !="-" ? i+=1 : i-=1}
puts i
| [
"expression.operation.unary.add",
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,092,982 | 1,092,981 | u098870186 | ruby |
p03315 | p eval("0#{gets.chars.join('1')}1") | p eval("0#{gets.strip.chars.join('1')}1") | [
"literal.string.change",
"call.arguments.change"
] | 1,093,018 | 1,093,019 | u782656139 | ruby |
p03316 | N = gets.chomp
n = N.to_i
digit_sums = N.chars.map(&:to_i).inject(&:+)
ans = (n % digit_sums).zero ? "Yes" : "No"
puts ans | N = gets.chomp
n = N.to_i
digit_sums = N.chars.map(&:to_i).inject(&:+)
ans = (n % digit_sums).zero? ? "Yes" : "No"
puts ans | [
"assignment.value.change",
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,093,188 | 1,093,189 | u792512290 | ruby |
p03316 | s = gets.rstrip
p s.to_i % s.chars.map(&:to_i).reduce(:+) == 0 ? 'Yes' : 'No' | s = gets.rstrip
puts s.to_i % s.chars.map(&:to_i).reduce(:+) == 0 ? 'Yes' : 'No' | [
"call.function.change",
"io.output.change"
] | 1,093,461 | 1,093,462 | u084335038 | ruby |
p03316 | n = gets.chomp
p n.to_i % n.chars.map(&:to_i).inject {|sum, num| sum + num} == 0 ? "Yes" : "No"
| n = gets.chomp
puts n.to_i % n.chars.map(&:to_i).inject {|sum, num| sum + num} == 0 ? "Yes" : "No"
| [
"call.function.change",
"io.output.change"
] | 1,093,484 | 1,093,485 | u968699140 | ruby |
p03316 | n = $stdin.gets
m = n.split("").map(&:to_i)
n = n.to_i
sum = 0
m.length.times do |i|
sum = sum + m[i-1]
end
if n % sum == 0
p "Yes"
else
p "No"
end | n = $stdin.gets
m = n.split("").map(&:to_i)
n = n.to_i
sum = 0
m.length.times do |i|
sum = sum + m[i-1]
end
if n % sum == 0
puts "Yes"
else
puts "No"
end
| [
"call.function.change",
"io.output.change"
] | 1,093,497 | 1,093,498 | u688809543 | ruby |
p03316 | n = $stdin.gets
m = n.split("").map(&:to_i)
n = n.to_i
sum = 0
m.length.times do |i|
sum = sum + m[i-1]
end
p sum
if n % sum == 0
p "Yes"
else
p "No"
end | n = $stdin.gets
m = n.split("").map(&:to_i)
n = n.to_i
sum = 0
m.length.times do |i|
sum = sum + m[i-1]
end
if n % sum == 0
puts "Yes"
else
puts "No"
end
| [
"call.remove",
"call.function.change",
"io.output.change"
] | 1,093,499 | 1,093,498 | u688809543 | ruby |
p03316 | p (s=gets).to_i%s.split("").map(&:to_i).inject(:+)==0?:Yes: :No | puts (s=gets).to_i%s.split("").map(&:to_i).inject(:+)==0?:Yes: :No | [
"call.function.change",
"io.output.change"
] | 1,093,592 | 1,093,593 | u025592199 | ruby |
p03316 | a=gets
b=a.split("").map(&:to_i).inject(:+).to_i
puts a%b==0 ? "Yes" : "No" | a=gets
b=a.split("").map(&:to_i).inject(:+).to_i
puts a.to_i%b==0 ? "Yes" : "No"
| [
"control_flow.branch.if.condition.change",
"call.add"
] | 1,093,650 | 1,093,651 | u585819925 | ruby |
p03316 | def dsum(n)
a = 0
while n > 0
a += n % 10
n /= 10
end
ret
end
n = gets.chomp.to_i
if n % dsum(n) == 0
puts "Yes"
else
puts "No"
end | def dsum(n)
a = 0
while n > 0
a += n % 10
n /= 10
end
a
end
n = gets.chomp.to_i
if n % dsum(n) == 0
puts "Yes"
else
puts "No"
end | [
"identifier.change"
] | 1,093,685 | 1,093,686 | u193470608 | ruby |
p03316 | n = gets.to_i
a = n.to_s.split("").map!{|i| i.to_i}
sum = 0
a.length.times do |j|
sum += a[j]
end
if n % sum == 0
puts 'Yes'
else puts 'NO'
end
| n = gets.to_i
a = n.to_s.split("").map!{|i| i.to_i}
sn = 0
a.length.times do |j|
sn += a[j]
end
if n % sn == 0
puts 'Yes'
else puts 'No'
end
| [
"assignment.variable.change",
"identifier.change",
"control_flow.branch.if.condition.change",
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,093,818 | 1,093,819 | u974214237 | ruby |
p03316 | n = gets.chomp.to_i
puts ((n%(n.to_s.split.map(&:to_i).inject(:+))) == 0)? "Yes" : "No" | n = gets.chomp.to_i
puts ((n%(n.to_s.split("").map(&:to_i).inject(:+))) == 0)? "Yes" : "No" | [
"control_flow.branch.if.condition.change"
] | 1,093,979 | 1,093,980 | u145123922 | ruby |
p03316 | Copy
n = gets.chomp.to_i
puts ((n%(n.to_s.split.map(&:to_i).inject(:+))) == 0)? "Yes" : "No" | n = gets.chomp.to_i
puts ((n%(n.to_s.split("").map(&:to_i).inject(:+))) == 0)? "Yes" : "No" | [
"control_flow.branch.if.condition.change"
] | 1,093,981 | 1,093,980 | u145123922 | ruby |
p03316 | def digit_sum(n)
sum = 0
while n != 0
sum += n%10
n /= 10
end
sum
end
x=gets.to_i
puts x%digit_sum(x) == 0 ? "YES" : "NO" | def digit_sum(n)
sum = 0
while n != 0
sum += n%10
n /= 10
end
sum
end
x=gets.to_i
puts x%digit_sum(x) == 0 ? "Yes" : "No" | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,094,107 | 1,094,108 | u616320334 | ruby |
p03316 | N = gets.to_i
n = N
sn = 0
while n > 0
sn += n % 10
n /= 10
end
puts (N % sn) == 0 ? 'YES' : 'NO'
| N = gets.to_i
n = N
sn = 0
while n > 0
sn += n % 10
n /= 10
end
puts (N % sn) == 0 ? 'Yes' : 'No'
| [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,094,318 | 1,094,319 | u308793296 | ruby |
p03316 | s = gets.chomp
sum = s.chars.map{|c|c.to_i}.inject(:+)
if n % sum == 0
puts "Yes"
else
puts "No"
end | s = gets.chomp
sum = s.chars.map{|c|c.to_i}.inject(:+)
if s.to_i % sum == 0
puts "Yes"
else
puts "No"
end | [
"control_flow.branch.if.condition.change",
"call.add"
] | 1,094,322 | 1,094,323 | u158131514 | ruby |
p03309 | n = gets.to_i
a = gets.chomp.split(" ").map(&:to_i)
c = Array.new
for i in 0...n do
c[i] = (a[i] - (i + 1)).abs
end
c.sort!
b = (n % 2 == 0)? c[n/2 -1]: c[(n-1)/2]
ans = 0
for i in 0...n do
ans += (c[i] - b).abs
end
puts "#{ans}\n"
| n = gets.to_i
a = gets.chomp.split(" ").map(&:to_i)
c = Array.new
for i in 0...n do
c[i] = a[i] - (i + 1)
end
c.sort!
b = (n % 2 == 0)? c[n/2 -1]: c[(n-1)/2]
ans = 0
for i in 0...n do
ans += (c[i] - b).abs
end
puts "#{ans}\n"
| [
"call.remove"
] | 1,094,542 | 1,094,543 | u873328343 | ruby |
p03309 | n = gets.to_i
a = gets.chomp.split(" ").map(&:to_i)
c = Array.new
for i in 0...n do
c[i] = a[i] - (i + 1)
end
c.sort!
b = (n % 2 == 0)? c[n/2 -1]: c[(n-1)/2]
ans = 0
for i in 0...n do
ans += a[i] - b - i - 1
end
puts "#{ans}\n"
| n = gets.to_i
a = gets.chomp.split(" ").map(&:to_i)
c = Array.new
for i in 0...n do
c[i] = a[i] - (i + 1)
end
c.sort!
b = (n % 2 == 0)? c[n/2 -1]: c[(n-1)/2]
ans = 0
for i in 0...n do
ans += (c[i] - b).abs
end
puts "#{ans}\n"
| [
"expression.operation.binary.change"
] | 1,094,544 | 1,094,543 | u873328343 | ruby |
p03309 | #!/usr/bin/env ruby
n = gets.chomp.to_i
a = gets.chomp.split(/ /).map(&:to_i)
b = []
a.each_with_index do |num, idx|
b[idx] = num - (idx + 1)
end
b.sort!
s = b.size
i = b[(s / 2).ceil - 1]
nums = 0
b.each do |n|
nums += (n - i).abs
end
puts nums
| #!/usr/bin/env ruby
n = gets.chomp.to_i
a = gets.chomp.split(/ /).map(&:to_i)
b = []
a.each_with_index do |num, idx|
b[idx] = num - (idx + 1)
end
b.sort!
s = b.size
i = b[(n / 2)]
nums = 0
b.each do |n|
nums += (n - i).abs
end
puts nums
| [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change",
"expression.operation.binary.remove"
] | 1,094,661 | 1,094,662 | u029843816 | ruby |
p03317 | n, k = gets.split.map(&:to_i)
ary = gets.split.map(&:to_i)
ans = 1+(n-k)/(k-1)+1
ans += 1 if (n-k) % (k-1) != 0
puts ans
| n, k = gets.split.map(&:to_i)
ary = gets.split.map(&:to_i)
ans = 1+(n-k)/(k-1)
ans += 1 if (n-k) % (k-1) != 0
puts ans
| [
"expression.operation.binary.remove"
] | 1,094,788 | 1,094,789 | u514143079 | ruby |
p03317 | n, k = gets.chomp.split.map(&:to_i)
a = gets
p ((n - 1) / (k - 1)).ceil | n, k = gets.chomp.split.map(&:to_i)
a = gets
p ((n - 1).to_f / (k - 1)).ceil | [
"call.add"
] | 1,094,975 | 1,094,976 | u195257137 | ruby |
p03317 | n, k = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
puts ( (n-1) / (k-1) ).ceil | n, k = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
puts ( 1.0 * (n-1) / (k-1) ).ceil | [
"expression.operation.binary.add"
] | 1,095,062 | 1,095,063 | u693378622 | ruby |
p03317 | N, M, *AS = $stdin.read.split.map(&:to_i)
p AS
rest = N
ans = 0
loop {
ans += 1
if rest == M
break
end
rest -= (M - 1)
break if rest <= 0
}
p ans | N, M, *AS = $stdin.read.split.map(&:to_i)
rest = N
ans = 0
loop {
ans += 1
if rest == M
break
end
rest -= (M - 1)
break if rest <= 0
}
p ans | [
"call.remove"
] | 1,095,543 | 1,095,544 | u525426391 | ruby |
p03317 | n,k=gets.split(" ").map &:to_i
puts (n-2)/k + 1 | n,k=gets.split(" ").map &:to_i
puts (n-2)/(k-1) + 1 | [
"call.arguments.change"
] | 1,095,674 | 1,095,675 | u976045235 | ruby |
p03317 | n, k = gets.split.map(&:to_i)
puts n.fdiv(k-1).ceil | n, k = gets.split.map(&:to_i)
puts (n-1).fdiv(k-1).ceil
| [
"call.arguments.change"
] | 1,095,691 | 1,095,692 | u321226359 | ruby |
p03317 | k, n = gets.split.map(&:to_i)
puts (n - 1).fdiv(k-1).ceil | n, k = gets.split.map(&:to_i)
puts (n-1).fdiv(k-1).ceil
| [] | 1,095,693 | 1,095,692 | u321226359 | ruby |
p03317 | k, n = gets.split.map(&:to_i)
puts (n - 1).fdiv(k).ceil | n, k = gets.split.map(&:to_i)
puts (n-1).fdiv(k-1).ceil
| [
"expression.operation.binary.add"
] | 1,095,694 | 1,095,692 | u321226359 | ruby |
p03317 | n, k = gets.split.map(&:to_i)
if n == k
puts 1
else
puts n.fdiv(k-1).ceil
end
| n, k = gets.split.map(&:to_i)
if n == k
puts 1
else
puts (n-1).fdiv(k-1).ceil
end
| [
"call.arguments.change"
] | 1,095,695 | 1,095,696 | u321226359 | ruby |
p03317 | N, K = gets.split.map(&:to_i)
As = gets.split.map(&:to_i)
#pre = (As.index(1).to_f / (K-1).to_f).ceil
#suf = ((N - As.index(1) - 1).to_f / (K-1).to_f).ceil
#ans = N <= K ? 1 : pre + suf
ans = N <= K ? 1 : (N.to_f / (K-1).to_f).ceil
puts ans
| N, K = gets.split.map(&:to_i)
As = gets.split.map(&:to_i)
#pre = (As.index(1).to_f / (K-1).to_f).ceil
#suf = ((N - As.index(1) - 1).to_f / (K-1).to_f).ceil
#ans = N <= K ? 1 : pre + suf
ans = N <= K ? 1 : ((N-1).to_f / (K-1).to_f).ceil
puts ans
| [] | 1,095,710 | 1,095,711 | u947517859 | ruby |
p03317 | n, k = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
puts ((n-1)/(k-1)).ceil
| n, k = gets.split.map(&:to_f)
a = gets.split.map(&:to_f)
puts ((n-1)/(k-1)).ceil
| [
"assignment.value.change",
"call.arguments.change"
] | 1,095,720 | 1,095,721 | u475329018 | ruby |
p03317 | n, k = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
puts ((a-1)/(k-1)).ceil
| n, k = gets.split.map(&:to_f)
a = gets.split.map(&:to_f)
puts ((n-1)/(k-1)).ceil
| [
"assignment.value.change",
"call.arguments.change",
"identifier.change",
"expression.operation.binary.change",
"io.output.change"
] | 1,095,722 | 1,095,721 | u475329018 | ruby |
p03317 | n,k=gets.split.map{|e|e.to_i};p (n+k-1)/(k-1) | n,k=gets.split.map{|e|e.to_i};p (n+k-3)/(k-1) | [
"literal.number.integer.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 1,095,745 | 1,095,746 | u280667879 | ruby |
p03317 | n,k=gets.split.map{|e|e.to_i};p (n-k-2)/(k-1) | n,k=gets.split.map{|e|e.to_i};p (n+k-3)/(k-1) | [
"misc.opposites",
"expression.operator.arithmetic.change",
"call.arguments.change",
"expression.operation.binary.change",
"literal.number.integer.change"
] | 1,095,749 | 1,095,746 | u280667879 | ruby |
p03317 | n,k=gets.split.map{|e|e.to_i};p (n-1)/(k-1) | n,k=gets.split.map{|e|e.to_i};p (n+k-3)/(k-1) | [
"literal.number.integer.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 1,095,750 | 1,095,746 | u280667879 | ruby |
p03317 | n, k = gets.chomp.split(" ").map(&:to_f)
a = gets.chomp.split(" ").map(&:to_i)
puts ((n - 1) / (k - 1)).floor | n, k = gets.chomp.split(" ").map(&:to_f)
a = gets.chomp.split(" ").map(&:to_i)
puts ((n - 1) / (k - 1)).ceil | [
"misc.opposites",
"identifier.change",
"call.arguments.change",
"io.output.change"
] | 1,095,759 | 1,095,760 | u910756197 | ruby |
p03317 | n, k = gets.chomp.split(" ").map(&:to_i)
a = gets.chomp.split(" ").map(&:to_i)
puts ((n - 1) / (k - 1)).ceil | n, k = gets.chomp.split(" ").map(&:to_f)
a = gets.chomp.split(" ").map(&:to_i)
puts ((n - 1) / (k - 1)).ceil | [
"assignment.value.change",
"call.arguments.change"
] | 1,095,761 | 1,095,760 | u910756197 | ruby |
p03317 | n, k = gets.chomp.split(" ").map(&:to_i)
a = gets.chomp.split(" ").map(&:to_i)
puts ((n - 1) / (k - 1)) | n, k = gets.chomp.split(" ").map(&:to_f)
a = gets.chomp.split(" ").map(&:to_i)
puts ((n - 1) / (k - 1)).ceil | [
"assignment.value.change",
"call.arguments.change",
"call.add"
] | 1,095,762 | 1,095,760 | u910756197 | ruby |
p03317 | n, k = gets.chomp.split(" ").map(&:to_i)
a = gets.chomp.split(" ").map(&:to_i)
puts ((n - 1) / (k - 1)).floor | n, k = gets.chomp.split(" ").map(&:to_f)
a = gets.chomp.split(" ").map(&:to_i)
puts ((n - 1) / (k - 1)).ceil | [
"assignment.value.change",
"call.arguments.change",
"misc.opposites",
"identifier.change",
"io.output.change"
] | 1,095,763 | 1,095,760 | u910756197 | ruby |
p03318 | #!/usr/bin/env ruby
require 'set'
class Hash
def push(key, value)
self[key] = [] if self[key] == nil
self[key].push(value)
end
end
class Array
def lower_bound(value)
left = -1;
right = self.length;
while left + 1 < right
mid = left + (right - left) / 2;
if self[mid] >= value
right = mid
else
left = mid
end
end
right
end
def unique
res = [self.first]
each_cons(2) do |a, b|
if a != b
res.push(b)
end
end
res
end
end
def get_ints
gets.chomp.split.map(&:to_i)
end
def get_ints_minus_one
get_ints.map { |x| x - 1 }
end
def get_int
gets.chomp.to_i
end
K = get_int
# X = 1.step(1000000).map do |n|
# [n, (n.to_f/ n.to_s.split('').map(&:to_i).sum)]
# end
#
# X.sort! { |a, b| a[1] <=> b[1] }
# xx = []
# max = 0
# X.each do |x|
# if x[0] > max
# xx << x
# max = x[0]
# end
# end
require 'bigdecimal'
x = 1
def next_x(x)
if x.to_s.length < 4
x+1
else
a = x.to_s.split('')[0..2].join.to_i
((a+1).to_s + ('9' * (x.to_s.length - 3))).to_i
end
end
x = 1
ans = [1]
while x <= 10 ** 18
x = next_x(x)
ans << x
end
ans.map! { |n| [n,(BigDecimal(n)/ n.to_s.split('').map(&:to_i).sum)] }
ans.sort! do |a, b|
if (a[1] <=> b[1]) == 0
a[0] <=> b[0]
else
a[1] <=> b[1]
end
end
xx = []
max = 0
ans.each do |x|
if x[0] > max
xx << x
max = x[0]
end
end
K.times do |i|
puts ans[i][0]
end
| #!/usr/bin/env ruby
require 'set'
class Hash
def push(key, value)
self[key] = [] if self[key] == nil
self[key].push(value)
end
end
class Array
def lower_bound(value)
left = -1;
right = self.length;
while left + 1 < right
mid = left + (right - left) / 2;
if self[mid] >= value
right = mid
else
left = mid
end
end
right
end
def unique
res = [self.first]
each_cons(2) do |a, b|
if a != b
res.push(b)
end
end
res
end
end
def get_ints
gets.chomp.split.map(&:to_i)
end
def get_ints_minus_one
get_ints.map { |x| x - 1 }
end
def get_int
gets.chomp.to_i
end
K = get_int
# X = 1.step(1000000).map do |n|
# [n, (n.to_f/ n.to_s.split('').map(&:to_i).sum)]
# end
#
# X.sort! { |a, b| a[1] <=> b[1] }
# xx = []
# max = 0
# X.each do |x|
# if x[0] > max
# xx << x
# max = x[0]
# end
# end
require 'bigdecimal'
x = 1
def next_x(x)
if x.to_s.length < 5
x+1
else
a = x.to_s.split('')[0..3].join.to_i
((a+1).to_s + ('9' * (x.to_s.length - 4))).to_i
end
end
x = 1
ans = [1]
while x <= 10 ** 18
x = next_x(x)
ans << x
end
ans.map! { |n| [n,(BigDecimal(n)/ n.to_s.split('').map(&:to_i).sum)] }
ans.sort! do |a, b|
if (a[1] <=> b[1]) == 0
a[0] <=> b[0]
else
a[1] <=> b[1]
end
end
xx = []
max = 0
ans.each do |x|
if x[0] > max
xx << x
max = x[0]
end
end
K.times do |i|
puts xx[i][0]
end
| [
"literal.number.integer.change",
"control_flow.branch.if.condition.change",
"assignment.value.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change",
"identifier.change",
"call.arguments.change",
"io.output.change"
] | 1,095,805 | 1,095,804 | u305883349 | ruby |
p03316 | n = gets.chomp
s = 0
n.length.times do |i|
s += n[i].to_i
end
if n.to_i % s == 0
puts 'YES'
else
puts 'NO'
end
| n = gets.chomp
s = 0
n.length.times do |i|
s += n[i].to_i
end
if n.to_i % s == 0
puts 'Yes'
else
puts 'No'
end
| [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,095,933 | 1,095,934 | u271044469 | ruby |
p03318 |
def digit_sum(n)
n.to_s.each_char.map {|c| c.to_i }.reduce(:+)
end
K = gets.to_i
#res = []
#100000.times{|i|
## res << (i+1)/digit_sum(i+1).to_f
#}
#puts res
res = [*1..9]
res = res.concat([*1..9].map{|i| i*10+9})
res = res.concat([*1..9].map{|i| i*100+99})
1.upto(13){|n|
base = 10**n
10.times{|i|
10.times{|j|
10.times{|k|
res << base*(100*i+10*j+k)+base-1
}
}
}
}
res.sort.uniq!
result = []
(res.length-100).times{|i|
flag = true
2.times{|j|
if (res[i]/digit_sum(res[i]).to_f > res[i+j+1]/digit_sum(res[i+j+1]).to_f)
flag = false
end
}
if (flag)
result << res[i]
end
}
res = []
(result.length-20).times{|i|
flag = true
10.times{|j|
if (result[i]/digit_sum(result[i]).to_f > result[i+j+1]/digit_sum(result[i+j+1]).to_f)
flag = false
end
}
if (flag)
res << result[i]
end
}
puts res[0..K-1] |
def digit_sum(n)
n.to_s.each_char.map {|c| c.to_i }.reduce(:+)
end
K = gets.to_i
#res = []
#100000.times{|i|
## res << (i+1)/digit_sum(i+1).to_f
#}
#puts res
res = [*1..9]
res = res.concat([*1..9].map{|i| i*10+9})
res = res.concat([*1..9].map{|i| i*100+99})
1.upto(13){|n|
base = 10**n
10.times{|i|
10.times{|j|
10.times{|k|
res << base*(100*i+10*j+k)+base-1
}
}
}
}
res = res.sort.uniq
result = []
(res.length-100).times{|i|
flag = true
2.times{|j|
if (res[i]/digit_sum(res[i]).to_f > res[i+j+1]/digit_sum(res[i+j+1]).to_f)
flag = false
end
}
if (flag)
result << res[i]
end
}
res = []
(result.length-20).times{|i|
flag = true
10.times{|j|
if (result[i]/digit_sum(result[i]).to_f > result[i+j+1]/digit_sum(result[i+j+1]).to_f)
flag = false
end
}
if (flag)
res << result[i]
end
}
puts res[0..K-1] | [
"assignment.value.change",
"identifier.change"
] | 1,096,072 | 1,096,073 | u884847580 | ruby |
p03319 | n, k = gets.chomp.split.map(&:to_i)
_a = gets
c = 1
n -= k
while n > 0
c += 1
n -= k
end
puts c
| n, k = gets.chomp.split.map(&:to_i)
_a = gets
c = 1
n -= k
while n > 0
c += 1
n -= (k - 1)
end
puts c
| [] | 1,096,567 | 1,096,568 | u433600270 | ruby |
p03319 | n,k=gets.split(' ').map(&:to_i)
gets
#a=gets.split(' ').index('1')
puts ((n-1)/(k-1)).ceil
| n,k=gets.split(' ').map(&:to_i)
gets
puts ((n-1)/(k-1).to_f).ceil
| [
"call.add"
] | 1,096,569 | 1,096,570 | u098870186 | ruby |
p03317 | n, k = gets.cplit.map(&:to_i).map{|x|x-1}
p (n+k-1)/k
| n, k = gets.split.map(&:to_i).map{|x|x-1}
p (n+k-1)/k
| [
"assignment.value.change",
"identifier.change"
] | 1,096,764 | 1,096,765 | u467508794 | ruby |
p03323 | a, b = gets.split.map(&:to_i)
puts [a, b].max < 8 ? "Yay!" : ":(" | a, b = gets.split.map(&:to_i)
puts [a, b].max <= 8 ? "Yay!" : ":(" | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,097,334 | 1,097,335 | u358554431 | ruby |
p03323 | a, b = gets.chomp.split.map(&:to_i)
if a <= 8 and b <= 8
puts "Yay"
else
puts ":("
end | a, b = gets.chomp.split.map(&:to_i)
if a <= 8 && b <= 8
puts "Yay!"
else
puts ":("
end | [
"control_flow.branch.if.condition.change",
"literal.string.change",
"call.arguments.change"
] | 1,097,508 | 1,097,509 | u552761221 | ruby |
p03323 | a, b = gets.chomp.split.map(&:to_i)
if a <= 8 && b <= 8
puts "Yay"
else
puts ":("
end | a, b = gets.chomp.split.map(&:to_i)
if a <= 8 && b <= 8
puts "Yay!"
else
puts ":("
end | [
"literal.string.change",
"call.arguments.change"
] | 1,097,510 | 1,097,509 | u552761221 | ruby |
p03323 | a,b = gets.split(" ").map(&:to_i)
if a >= 9 or b >= 9
puts ":)"
else
puts "Yay!"
end | a,b = gets.split(" ").map(&:to_i)
if a >= 9 or b >= 9
puts ":("
else
puts "Yay!"
end
| [
"literal.string.change",
"call.arguments.change"
] | 1,097,645 | 1,097,646 | u944733909 | ruby |
p03323 | a,b = gets.split(" ").map(&:to_i)
if a > 9 or b > 9
puts ":)"
else
puts "Yay!"
end
| a,b = gets.split(" ").map(&:to_i)
if a >= 9 or b >= 9
puts ":("
else
puts "Yay!"
end
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"literal.string.change",
"call.arguments.change"
] | 1,097,647 | 1,097,646 | u944733909 | ruby |
p03323 | a,b=gets.split.map(&:to_i)
if a>8 or b>8 then
p ':('
else
p 'Yay!'
end | a,b=gets.split.map(&:to_i)
if a>8 or b>8 then
puts ':('
else
puts 'Yay!'
end | [
"call.function.change",
"io.output.change"
] | 1,097,734 | 1,097,735 | u674959030 | ruby |
p03323 | a,b = gets.chomp.split.map(&:to_i)
if a || b <= 8
puts "Yay!"
else
puts ":("
end | a,b = gets.chomp.split.map(&:to_i)
if a<=8 && b<=8
puts "Yay!"
else
puts ":("
end | [
"control_flow.branch.if.condition.change"
] | 1,097,805 | 1,097,806 | u689027433 | ruby |
p03323 |
a = gets.split.map(&:to_i)
# p a
if a[0] <= 8 && a[1] <= 8
puts "Yay!"
else
puts ":{"
end |
a = gets.split.map(&:to_i)
# p a
if a[0] <= 8 && a[1] <= 8
puts "Yay!"
else
puts ":("
end | [
"literal.string.change",
"call.arguments.change"
] | 1,097,934 | 1,097,935 | u075074066 | ruby |
p03323 | puts gets.split(' ').map(&:to_i).max > 8 ? 'Yay!' : ':(' | puts gets.split(' ').map(&:to_i).max <= 8 ? 'Yay!' : ':(' | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,098,378 | 1,098,379 | u857555436 | ruby |
p03323 | a, b=gets.split.map(&:to_i)
if a<=8&&B<=8
puts "Yay!"
else puts ":("
end | a, b=gets.split.map(&:to_i)
if a<=8&&b<=8
puts "Yay!"
else puts ":("
end | [
"control_flow.branch.if.condition.change"
] | 1,098,451 | 1,098,452 | u760842625 | ruby |
p03323 | a,b = gets.split(" ").map(&:to_i)
puts (a<=8&&b<=8) ? 'yay!' : ':(' | a,b = gets.split(" ").map(&:to_i)
puts (a<=8&&b<=8) ? 'Yay!' : ':(' | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,098,473 | 1,098,474 | u135201316 | ruby |
p03323 | res="Yay!"
gets.split.map(&:to_i).map { |x| res = ":(" if x > 8 } | res="Yay!"
gets.split.map(&:to_i).map { |x| res = ":(" if x > 8 }
print res | [
"call.add"
] | 1,098,756 | 1,098,757 | u644856766 | ruby |
p03323 | # スペース区切りの整数の入力
A, B=gets.chomp.split(" ").map(&:to_i);
if A <= 8 && B <= 8
# 出力
puts"yay!"
else
puts ":("
end | # スペース区切りの整数の入力
A, B=gets.chomp.split(" ").map(&:to_i);
if A <= 8 && B <= 8
# 出力
puts"Yay!"
else
puts ":("
end | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,098,871 | 1,098,872 | u630733574 | ruby |
p03323 | a, b = gets.split.map(&:to_i)
if a > 8 || b > 8
puts ":("
else
puts "Yey!"
end
| a, b = gets.split.map(&:to_i)
if a > 8 || b > 8
puts ":("
else
puts "Yay!"
end
| [
"literal.string.change",
"call.arguments.change"
] | 1,098,873 | 1,098,874 | u633378318 | ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.