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 |
|---|---|---|---|---|---|---|---|
p03284 | eval"p %d%%%d"%gets.split | eval"p %d%%%d>0?1:0"%gets.split | [
"literal.string.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 1,068,775 | 1,068,776 | u065125881 | ruby |
p03284 | eval"p %d%%%d"%gets.split | eval"p [%d%%%d,1].min"%gets.split | [
"literal.string.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 1,068,775 | 1,068,777 | u065125881 | ruby |
p03285 | n = gets.to_i
(0..25).each do |c|
(0..15).each do |d|
if c*4 + d*7 == n
puts 'YES'
exit 0
end
end
end
puts 'No'
| n = gets.to_i
(0..25).each do |c|
(0..14).each do |d|
if c*4 + d*7 == n
puts 'Yes'
exit
end
end
end
puts 'No' | [
"literal.number.integer.change",
"io.output.change",
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,070,667 | 1,070,668 | u317386998 | ruby |
p03286 | # -2進数でn桁のときの取りうる最大値と最小値を返す
def cal_min_max n
if n.even?
max = (0..n).step(2).inject(0){|sum, i| sum + (-2) ** i}
min = (1..n).step(2).inject(0){|sum, i| sum + (-2) ** i} + (-2) ** n
else
max = (0..n).step(2).inject(0){|sum, i| sum + (-2) ** i} + (-2) ** n
min = (1..n).step(2).inject(0){|sum, i| sum... | # -2進数でn桁のときの取りうる最大値と最小値を返す
def cal_min_max n
if n.even?
max = (0..n).step(2).inject(0){|sum, i| sum + (-2) ** i}
min = (1..n).step(2).inject(0){|sum, i| sum + (-2) ** i} + (-2) ** n
else
max = (0..n).step(2).inject(0){|sum, i| sum + (-2) ** i} + (-2) ** n
min = (1..n).step(2).inject(0){|sum, i| sum... | [
"assignment.change"
] | 1,071,602 | 1,071,603 | u792512290 | ruby |
p03285 | input = gets
input = input.split(' ').map(&:to_i)
n = input[0]
a = 4
b = 7
x_max = 25
y_max = 14
x = 0
y = 0
result = false
while true
y = 0
while true
break if n < a * x + b * y
if n == a * x + b * y
result = true
break;
end
y += 1
break if y_max < y
end
break if x_max < x
x ... | input = gets
input = input.split(' ').map(&:to_i)
n = input[0]
a = 4
b = 7
x_max = 25
y_max = 14
x = 0
y = 0
result = false
while true
y = 0
while true
break if n < a * x + b * y
if n == a * x + b * y
result = true
break;
end
y += 1
break if y_max < y
end
break if x_max < x
x ... | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,072,657 | 1,072,658 | u454343817 | ruby |
p03285 | input = gets
input = input.split(' ').map(&:to_i)
n = input[0]
a = 4
b = 7
x_max = 25
y_max = 14
x = 0
y = 0
result = false
loop do
y = 0
loop do
break if n < a * x + b * y
if n == a * x + b * y
result = true
break;
end
y += 1
break if y_max < y
end
break if x_max < x
x += 1
e... | input = gets
input = input.split(' ').map(&:to_i)
n = input[0]
a = 4
b = 7
x_max = 25
y_max = 14
x = 0
y = 0
result = false
while true
y = 0
while true
break if n < a * x + b * y
if n == a * x + b * y
result = true
break;
end
y += 1
break if y_max < y
end
break if x_max < x
x ... | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,072,659 | 1,072,658 | u454343817 | ruby |
p03285 | input = gets
input = input.split(' ').map(&:to_i)
n = input[0]
a = 4
b = 7
x_max = 25
y_max = 14
x = 0
y = 0
result = false
while 1
y = 0
while 1
break if n < a * x + b * y
if n == a * x + b * y
result = true
break;
end
y += 1
break if y_max < y
end
break if x_max < x
x += 1
e... | input = gets
input = input.split(' ').map(&:to_i)
n = input[0]
a = 4
b = 7
x_max = 25
y_max = 14
x = 0
y = 0
result = false
while true
y = 0
while true
break if n < a * x + b * y
if n == a * x + b * y
result = true
break;
end
y += 1
break if y_max < y
end
break if x_max < x
x ... | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,072,660 | 1,072,658 | u454343817 | ruby |
p03288 | n=gets.to_i
if 1200 > n
p "ABC"
else
p 2800 > n ? "ARC" : "AGC"
end
| n=gets.to_i
if 1200 > n
puts "ABC"
else
puts 2800 > n ? "ARC" : "AGC"
end
| [
"call.function.change",
"io.output.change"
] | 1,074,781 | 1,074,782 | u098870186 | ruby |
p03288 | n=gets.to_i
if 1200 <= n
p "ABC"
else
p 2800 >= n ? "ARC" : "AGC"
end
| n=gets.to_i
if 1200 > n
puts "ABC"
else
puts 2800 > n ? "ARC" : "AGC"
end
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"call.function.change",
"io.output.change"
] | 1,074,783 | 1,074,782 | u098870186 | ruby |
p03289 | s = gets.chomp
if s[0] != "A" || s.slice(2..-2).count("C") != 1
puts "WA"
end
s.delete!("A")
s.delete!("C")
if s == s.downcase
puts"AC"
else
puts "WA"
end | s = gets.chomp
if s[0] != "A" || s.slice(2..-2).count("C") != 1
puts "WA"
exit
end
s.delete!("A")
s.delete!("C")
if s == s.downcase
puts"AC"
else
puts "WA"
end | [
"control_flow.exit.add"
] | 1,076,693 | 1,076,694 | u622469330 | ruby |
p03290 | d,g = gets.chomp.split.map(&:to_i)
ps,cs = d.times.map{gets.chomp.split.map(&:to_i)}.transpose
ans = 10 ** 5
(2 ** d).times do |i|
sum = 0
cnt = 0
num = 0
d.times do |j|
if i[j] == 1
cnt += ps[j]
sum += (ps[j] * 100 * (j+1) + cs[j])
else
num = j
end
end
if sum < g
temp = ((... | d,g = gets.chomp.split.map(&:to_i)
ps,cs = d.times.map{gets.chomp.split.map(&:to_i)}.transpose
ans = 10**5
(2 ** d).times do |i|
sum = 0
cnt = 0
num = 0
d.times do |j|
if i[j] == 1
cnt += ps[j]
sum += (ps[j] * 100 * (j+1) + cs[j])
else
num = j
end
end
if sum < g
temp = ((g... | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,079,231 | 1,079,232 | u191196346 | ruby |
p03290 | d,g = gets.chomp.split.map(&:to_i)
ps,cs = d.times.map{gets.chomp.split.map(&:to_i)}.transpose
ans = 10 ** 5
(2 ** d).times do |i|
sum = 0
cnt = 0
num = 0
d.times do |j|
if i[j] == 1
cnt += ps[j]
sum += (ps[j] * 100 * (j+1) + cs[j])
else
num = j
end
end
if sum < g
temp = ((... | d,g = gets.chomp.split.map(&:to_i)
ps,cs = d.times.map{gets.chomp.split.map(&:to_i)}.transpose
ans = 10**5
(2 ** d).times do |i|
sum = 0
cnt = 0
num = 0
d.times do |j|
if i[j] == 1
cnt += ps[j]
sum += (ps[j] * 100 * (j+1) + cs[j])
else
num = j
end
end
if sum < g
temp = ((g... | [] | 1,079,233 | 1,079,232 | u191196346 | ruby |
p03292 | a = gets.chomp.split(" ").map(&:to_i)
a.sort!
print(abs(a[0] - a[1]) + abs(a[1] - a[2])) | a = gets.chomp.split(" ").map(&:to_i)
a.sort!
print((a[0] - a[1]).abs + (a[1] - a[2]).abs) | [
"call.arguments.change",
"expression.operation.binary.change",
"call.add"
] | 1,080,538 | 1,080,539 | u691896522 | ruby |
p03308 | n=gets.to_i
a=gets.split.map &:to_i
ma=0
for i in 0...n
for j in 0...i
ma=[ma,a[i]-a[j]].max
end
end
puts ma | n=gets.to_i
a=gets.split.map &:to_i
ma=0
for i in 0...n
for j in 0...i
ma=[ma,(a[i]-a[j]).abs].max
end
end
puts ma | [
"call.add"
] | 1,088,336 | 1,088,337 | u459746049 | ruby |
p03309 | n = gets.to_i
as = gets.split.map(&:to_i).map.with_index { |x, i| x - i - 1 }
med = n.odd? ? as[n/2] : (as[n/2-1] + as[n/2]) / 2
p as.map { |a| (a-med).abs }.inject(:+)
| n = gets.to_i
as = gets.split.map(&:to_i).map.with_index { |x, i| x - i - 1 }.sort
med = n.odd? ? as[n/2] : (as[n/2-1] + as[n/2]) / 2
p as.map { |a| (a-med).abs }.inject(:+) | [
"call.add"
] | 1,094,597 | 1,094,598 | u300096598 | ruby |
p03319 | N,K=gets.split.map &:to_i
p (N+K-2)/(K-1) | N,K=gets.split.map &:to_i
p (N+K-3)/(K-1) | [
"literal.number.integer.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 1,096,559 | 1,096,560 | u647875062 | ruby |
p03323 | def solve(a, b)
if a <= 8 && b <= 8
puts 'Yay!'
else
puts ':('
end
end
def main
a, b = gets.chomp.split(" ").map(&:to_i)
solve(a, b)
end | def solve(a, b)
if a <= 8 && b <= 8
puts 'Yay!'
else
puts ':('
end
end
def main
a, b = gets.chomp.split(" ").map(&:to_i)
solve(a, b)
end
main | [] | 1,099,213 | 1,099,214 | u649620975 | ruby |
p03327 | n = gets.to_i
puts n > 999 ? "ABC" : "ABD" | n = gets.to_i
puts n <= 999 ? "ABC" : "ABD" | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,104,231 | 1,104,232 | u139850627 | ruby |
p03328 | eval"A,B="+gets.split*?,;p (B-A)**2-A-B | eval"A,B="+gets.split*?,;p ((B-A)**2-A-B)/2 | [
"call.arguments.change"
] | 1,105,861 | 1,105,862 | u657913472 | ruby |
p03338 | n = gets.to_i
s = gets.chomp
max = (1..(n-1)).to_a.map {|i|
a = s[0..i].chars
b = s[i..n].chars
(a & b).size
}.max
puts max | n = gets.to_i
s = gets.chomp
max = (1..(n-1)).to_a.map {|i|
a = s[0...i].chars
b = s[i...n].chars
(a & b).size
}.max
puts max | [] | 1,112,674 | 1,112,675 | u158131514 | ruby |
p03341 | `dd`.scan(/\D/){$*<<$'.size+$.+$.+=$&<=>?E};p$*.min+~$. | `dd`.scan(/E|W/){$*<<$'.size+$.+$.+=$&<=>?E};p$*.min+~$. | [
"call.arguments.change"
] | 1,114,500 | 1,114,501 | u019489252 | ruby |
p03352 | x=gets.to_i
ans=1
for i in 1..31 do
for j in 1..9 do
if i**j<=x && ans<i**j then
ans=i**j
end
end
end
p ans
| x=gets.to_i
ans=1
for i in 1..31 do
for j in 2..9 do
if i**j<=x && ans<i**j then
ans=i**j
end
end
end
p ans
| [
"literal.number.integer.change"
] | 1,123,153 | 1,123,154 | u136817957 | ruby |
p03352 | x=gets.to_i
ans=0
for i in 1..31 do
for j in 1..9 do
if i**j<=x && ans<i**j then
ans=i**j
end
end
end
p ans
| x=gets.to_i
ans=1
for i in 1..31 do
for j in 2..9 do
if i**j<=x && ans<i**j then
ans=i**j
end
end
end
p ans
| [
"literal.number.integer.change",
"assignment.value.change"
] | 1,123,155 | 1,123,154 | u136817957 | ruby |
p03352 | require 'prime'
require 'set'
require 'tsort'
include Math
ALP = ('a'..'z').to_a
INF = 0xffffffffffffffff
def max(a,b); a > b ? a : b end
def min(a,b); a < b ? a : b end
def swap(a,b); a, b = b, a ... | require 'prime'
require 'set'
require 'tsort'
include Math
ALP = ('a'..'z').to_a
INF = 0xffffffffffffffff
def max(a,b); a > b ? a : b end
def min(a,b); a < b ? a : b end
def swap(a,b); a, b = b, a ... | [
"call.add"
] | 1,123,502 | 1,123,503 | u988228861 | ruby |
p03359 | m, d = gets.chomp.split.map(&:to_i)
if m < d
puts m
else
puts m - 1
end
| m, d = gets.chomp.split.map(&:to_i)
if m <= d
puts m
else
puts m - 1
end
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,127,979 | 1,127,980 | u524019694 | ruby |
p03370 | n, x = gets.strip.split.map(&:to_i)
arr = n.times.map { gets.to_i }
num = n
balance = x - arr.sum
while balance > arr.min do
balance -= arr.min
num += 1
end
puts num | n, x = gets.strip.split.map(&:to_i)
arr = n.times.map { gets.to_i }
num = n
balance = x - arr.sum
while balance >= arr.min do
balance -= arr.min
num += 1
end
puts num | [
"expression.operator.compare.change",
"expression.operation.binary.change"
] | 1,136,415 | 1,136,416 | u658673788 | ruby |
p03371 |
a,b,c,x,y=gets.split.map(&:to_i)
result=[]
max=[x,y].max
min=[x,y].min
max_price=0
if max==x
max_price=a
else
max_price=b
end
result<<2*c*max
result<<2*c*min+(x-y).abs*max_price
result<<a*x+b*y
p result
p result.min | a,b,c,x,y=gets.split.map(&:to_i)
result=[]
max=[x,y].max
min=[x,y].min
max_price=0
if max==x
max_price=a
else
max_price=b
end
result<<2*c*max
result<<2*c*min+(x-y).abs*max_price
result<<a*x+b*y
#p result
p result.min
| [] | 1,137,702 | 1,137,703 | u590472228 | ruby |
p03377 | A, B, X = gets.strip.split.map(&:to_i)
if A <= X
puts (A + B) >= X ? 'Yes' : 'No'
else
puts 'No'
end
| A, B, X = gets.strip.split.map(&:to_i)
if A <= X
puts (A + B) >= X ? 'YES' : 'NO'
else
puts 'NO'
end
| [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,141,995 | 1,141,996 | u707614029 | ruby |
p03378 | nmx = gets.chomp!.split(' ')
n = nmx[0].to_i
m = nmx[1].to_i
x = nmx[2].to_i
ai = gets.chomp!.split(' ')
cost1 = 0
cost2 = 0
for gate in ai
if gate.to_i < x
cost1 = cost1+ 1
else
cost2 = cost2
end
end
if cost1 < cost2
puts cost1
else
puts cost2
end | nmx = gets.chomp!.split(' ')
n = nmx[0].to_i
m = nmx[1].to_i
x = nmx[2].to_i
ai = gets.chomp!.split(' ')
cost1 = 0
cost2 = 0
for gate in ai
if gate.to_i < x
cost1 = cost1+ 1
else
cost2 = cost2+1
end
end
if cost1 < cost2
puts cost1
else
puts cost2
end | [
"assignment.change"
] | 1,144,592 | 1,144,593 | u203995947 | ruby |
p03377 | a, b, x = $stdin.gets.split.map(&:to_i)
if a + b >= x && a <= x
puts 'Yes'
else
puts 'No'
end
| a, b, x = $stdin.gets.split.map(&:to_i)
if a + b >= x && a <= x
puts 'YES'
else
puts 'NO'
end
| [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,145,313 | 1,145,314 | u790487011 | ruby |
p03377 | a, b, x = gets.chomp.split.map(&:to_i)
puts (x-a).positive? && (b - (x - a)).positive? ? 'YES' : 'NO' | a, b, x = gets.chomp.split.map(&:to_i)
puts (x-a) >= 0 && (b - (x - a)) >= 0 ? 'YES' : 'NO'
| [] | 1,145,409 | 1,145,410 | u076590868 | ruby |
p03385 | s=gets.split("")
sorteds = s.sort!.join.strip
p sorteds
if (sorteds).eql?('abc')
puts "Yes"
else
puts "No"
end
| s=gets.split("")
sorteds = s.sort!.join.strip
if (sorteds).eql?('abc')
puts "Yes"
else
puts "No"
end
| [
"call.remove"
] | 1,148,099 | 1,148,100 | u887087974 | ruby |
p03386 | a, b, k = gets.split(" ").map{ |i| i.to_i }
if (b - a + 1) / 2 <= k
for i in a..b do
puts i
end
else
k.times do |i|
puts a + i
end
k.times do |i|
puts b - k + 1 + i
end
end
| a, b, k = gets.split(" ").map{ |i| i.to_i }
if b - a + 1 <= k * 2
for i in a..b do
puts i
end
else
k.times do |i|
puts a + i
end
k.times do |i|
puts b - k + 1 + i
end
end
| [
"control_flow.branch.if.condition.change",
"expression.operation.binary.remove"
] | 1,149,779 | 1,149,780 | u116937979 | ruby |
p03386 | a,b,k = gets.split.map(&:to_i)
if b-a+1 <= k
puts [*a..b]
exit
end
k.times { |i| puts a +i }
k.times { |i| puts b-(k-1)+i } | a,b,k = gets.split.map(&:to_i)
if b-a+1 <= 2*k
puts [*a..b]
exit
end
k.times { |i| puts a +i }
k.times { |i| puts b-(k-1)+i } | [
"control_flow.branch.if.condition.change"
] | 1,150,608 | 1,150,609 | u693378622 | ruby |
p03400 | n = gets.to_i
d,x = gets.strip.split.map(&:to_i)
array = []
while number = gets
array << number.chomp.to_i
end
sum = 0
for i in 0..n-1
sum += ((d-1).to_f/array[i]).ceil
end
puts sum+x | n = gets.to_i
d,x = gets.strip.split.map(&:to_i)
array = []
while number = gets
array << number.chomp.to_i
end
sum = 0
for i in 0..n-1
sum += ((d-1).to_f/array[i]).floor+1
end
puts sum+x | [
"misc.opposites",
"identifier.change"
] | 1,155,066 | 1,155,067 | u313103408 | ruby |
p03407 | require 'prime'
require 'set'
require 'tsort'
include Math
ALP = ('a'..'z').to_a
INF = 0xffffffffffffffff
def max(a,b); a > b ? a : b end
def min(a,b); a < b ? a : b end
def swap(a,b); a, b = b, a ... | require 'prime'
require 'set'
require 'tsort'
include Math
ALP = ('a'..'z').to_a
INF = 0xffffffffffffffff
def max(a,b); a > b ? a : b end
def min(a,b); a < b ? a : b end
def swap(a,b); a, b = b, a ... | [
"expression.operation.binary.remove"
] | 1,159,820 | 1,159,821 | u988228861 | ruby |
p03408 | hash = {}
a = gets.to_i
if a != 0
(0..a-1).each do |n|
st = gets
if hash[st]&.present?
hash[st] = hash[st] + 1
else
hash[st] = 1
end
end
end
b = gets.to_i
if b != 0
(0..b-1).each do |n|
st = gets
if hash[st]&.present?
hash[st] = hash[st] - 1
else ... | hash = {}
a = gets.to_i
if a != 0
(0..a-1).each do |n|
st = gets
if hash[st] != nil
hash[st] = hash[st] + 1
else
hash[st] = 1
end
end
end
b = gets.to_i
if b != 0
(0..b-1).each do |n|
st = gets
if hash[st] != nil
hash[st] = hash[st] - 1
else
... | [
"control_flow.branch.if.condition.change"
] | 1,162,413 | 1,162,414 | u025879810 | ruby |
p03408 | hash = {}
a = gets.to_i
if a != 0
(0..a-1).each do |n|
st = gets
if hash[st].present?
hash[st] = hash[st] + 1
else
hash[st] = 1
end
end
end
b = gets.to_i
if b != 0
(0..b-1).each do |n|
st = gets
if hash[st].present?
hash[st] = hash[st] - 1
else
... | hash = {}
a = gets.to_i
if a != 0
(0..a-1).each do |n|
st = gets
if hash[st] != nil
hash[st] = hash[st] + 1
else
hash[st] = 1
end
end
end
b = gets.to_i
if b != 0
(0..b-1).each do |n|
st = gets
if hash[st] != nil
hash[st] = hash[st] - 1
else
... | [] | 1,162,415 | 1,162,414 | u025879810 | ruby |
p03423 | x = gets
puts (x / 3).to_i | x = gets
puts (x.to_i / 3).to_i | [
"call.add"
] | 1,172,208 | 1,172,209 | u624505752 | ruby |
p03426 | h,w,d = gets.split.map(&:to_i)
nums = Array.new(h * w + 1)
h.times do |i|
line = gets.split.map(&:to_i)
line.each_with_index {|v, j| nums[v] = [i, j] }
end
diffs = Array.new(9001, 0)
((d.next)...(h * w)).each do |i|
diffs[i] = diffs[i - d] + (nums[i][0] - nums[i-d][0]).abs +
... | h,w,d = gets.split.map(&:to_i)
nums = Array.new(h * w + 1)
h.times do |i|
line = gets.split.map(&:to_i)
line.each_with_index {|v, j| nums[v] = [i, j] }
end
diffs = Array.new(90_001, 0)
((d.next)..(h * w)).each do |i|
diffs[i] = diffs[i - d] + (nums[i][0] - nums[i-d][0]).abs +
... | [
"literal.number.integer.change",
"assignment.value.change",
"call.arguments.change"
] | 1,177,564 | 1,177,565 | u004919448 | ruby |
p03433 | n, a = 2.times.gets.map(&:to_i)
if n%500 > a
puts "No"
else
puts "Yes"
end | n, a = 2.times.map{ gets.to_i }
if n%500 > a
puts "No"
else
puts "Yes"
end | [
"call.add",
"call.arguments.change"
] | 1,183,571 | 1,183,572 | u374190629 | ruby |
p03433 | n=gets.chomp.to_i
a=gets.chomp.to_i
if a-(n%500)>0
puts "Yes"
else
puts "No"
end | n=gets.chomp.to_i
a=gets.chomp.to_i
if a-(n%500) >= 0
puts "Yes"
else
puts "No"
end | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,184,681 | 1,184,682 | u087165202 | ruby |
p03434 | a_array = [*$<][1].split.map(&:to_i)
alice = 0
bob = 0
loop do
break if a_array.empty?
alice += a_array.pop
break if a_array.empty?
bob += a_array.pop
end
p alice - bob
| a_array = [*$<][1].split.map(&:to_i).sort
alice = 0
bob = 0
loop do
break if a_array.empty?
alice += a_array.pop
break if a_array.empty?
bob += a_array.pop
end
p alice - bob
| [
"call.add"
] | 1,187,359 | 1,187,361 | u071557846 | ruby |
p03435 | c=[0,0,0]
for i in 0..2
c[i]=gets.split.map &:to_i
end
b=c[0]
a=[0,0,0]
for i in 0..2
a[i]=c[i][0]-b[0]
end
ok=1
for i in 0..2
for j in 0..2
ok&=a[i]+b[j]==c[i][j]
end
end
puts(ok ?'Yes':'No')
| c=[0,0,0]
for i in 0..2
c[i]=gets.split.map &:to_i
end
b=c[0]
a=[0,0,0]
for i in 0..2
a[i]=c[i][0]-b[0]
end
ok=1
for i in 0..2
for j in 0..2
ok&&=a[i]+b[j]==c[i][j]
end
end
puts(ok ?'Yes':'No')
| [] | 1,188,715 | 1,188,716 | u459746049 | ruby |
p03448 | a, b, c, x = 4.times.map { gets.to_i }
cnt = 0
0..a.each do |i|
0..b.each do |j|
0..c.each do |k|
if 500*i + 100*j + 50*k == x
cnt += 1
end
end
end
end
puts cnt | a, b, c, x = 4.times.map { gets.to_i }
cnt = 0
(0..a).each do |i|
(0..b).each do |j|
(0..c).each do |k|
if 500*i + 100*j + 50*k == x
cnt += 1
end
end
end
end
puts cnt | [] | 1,196,544 | 1,196,543 | u750429254 | ruby |
p03448 | a = gets.chomp.to_i
b = gets.chomp.to_i
c = gets.chomp.to_i
x = gets.chomp.to_i
count = 0
0.upto(a) do |i|
0.upto(b) do |s|
0.upto(c) do |m|
if (500*i)+(100*s)+(50*m) == 100
count += 1
end
end
end
end
puts count
| a = gets.chomp.to_i
b = gets.chomp.to_i
c = gets.chomp.to_i
x = gets.chomp.to_i
count = 0
0.upto(a) do |i|
0.upto(b) do |s|
0.upto(c) do |m|
if (500*i)+(100*s)+(50*m) == x
count += 1
end
end
end
end
puts count
| [
"identifier.replace.add",
"literal.replace.remove",
"control_flow.branch.if.condition.change"
] | 1,196,907 | 1,196,908 | u966695319 | ruby |
p03455 | a, b = gets.split
a = a.to_i
b = b.to_i
if a.even? && b.even?
puts "Even"
else
puts "Odd"
end
| # 3 4
a, b = gets.split
a = a.to_i
b = b.to_i
if a.even? || b.even?
puts "Even"
else
puts "Odd"
end
| [
"misc.opposites",
"control_flow.branch.if.condition.change"
] | 1,199,485 | 1,199,486 | u859196277 | ruby |
p03455 | a, b = gets.split("").map(&:to_i)
puts (a*b % 2 == 0 ? "Even": "Odd") | a, b = gets.split(" ").map(&:to_i)
puts (a*b) % 2 == 0 ? "Even": "Odd" | [
"literal.string.change",
"assignment.value.change",
"call.arguments.change",
"control_flow.branch.if.condition.change"
] | 1,200,939 | 1,200,940 | u448908254 | ruby |
p03455 | a,b = gets.chomp.split(" ").map(&:to_i)
if a * b % 2 == 0
p 'Even'
elsif a * b % 2 == 1
p 'Odd'
end | a,b = gets.chomp.split(" ").map(&:to_i)
if a * b % 2 == 0
puts 'Even'
elsif a * b % 2 == 1
puts 'Odd'
end | [
"call.function.change",
"io.output.change"
] | 1,203,123 | 1,203,124 | u743283842 | ruby |
p03455 | #2つの整数a,bが与えられて、そのa,bの積が偶数か奇数かを求める。
a,b = gets.chomp.split(" ").map(&:to_i)
if a * b % 2 == 0
p 'Even'
return
elsif a * b % 2 == 1
p 'Odd'
end | a,b = gets.chomp.split(" ").map(&:to_i)
if a * b % 2 == 0
puts 'Even'
elsif a * b % 2 == 1
puts 'Odd'
end | [
"call.function.change",
"io.output.change",
"control_flow.return.remove"
] | 1,203,125 | 1,203,124 | u743283842 | ruby |
p03455 | #2つの整数a,bが与えられて、そのa,bの積が偶数か奇数かを求める。
a,b = gets.chomp.split(" ").map(&:to_i)
if a * b % 2 == 0
p 'Even'
elsif a * b % 2 == 1
p 'Odd'
end | a,b = gets.chomp.split(" ").map(&:to_i)
if a * b % 2 == 0
puts 'Even'
elsif a * b % 2 == 1
puts 'Odd'
end | [
"call.function.change",
"io.output.change"
] | 1,203,126 | 1,203,124 | u743283842 | ruby |
p03455 | a , b = gets.strip.split.map(&:to_i)
if (a * b).even?
puts "Odd"
else
puts "Even"
end
| a , b = gets.strip.split.map(&:to_i)
if (a * b).odd?
puts "Odd"
else
puts "Even"
end
| [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,203,485 | 1,203,486 | u642502885 | ruby |
p03455 | a , b = gets.chop.split.map(&:to_i)
if a*b.even?
puts "Odd"
else
puts "Even"
end | a , b = gets.strip.split.map(&:to_i)
if (a * b).odd?
puts "Odd"
else
puts "Even"
end
| [
"assignment.value.change",
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,203,487 | 1,203,486 | u642502885 | ruby |
p03455 | a = gets
b = a.split(" ")
seki = b[0].to_i * b[1].to_i
if seki.even?
p "Even"
else
p "Odd"
end | a = gets
b = a.split(" ")
seki = b[0].to_i * b[1].to_i
if seki.even?
puts "Even"
else
puts "Odd"
end | [
"call.function.change",
"io.output.change"
] | 1,204,063 | 1,204,064 | u798109808 | ruby |
p03457 |
n = gets.to_i
data = n.times.map{
gets.strip.split.map(&:to_i)
}
def is_reachable(current, next_data)
tc,xc,yc=current
tn,xn,yn=next_data
dist=(xc-xn).abs+(yc-yn).abs
return false if dist > tn - tc
(dist-(tn-tc)).even?
end
current = [0,0,0]
data.each do |d|
unless is_reachable(current, d)
p... | n = gets.to_i
data = n.times.map { gets.strip.split.map(&:to_i) }
def is_reachable(current, next_data)
# 次の地点までのマンハッタン距離
tc, xc, yc = current
tn, xn, yn = next_data
dist = (xc - xn).abs + (yc - yn).abs
# 最短距離でも間に合わない
return false if dist > tn - tc
# 行ったり来たりでちょうど到着できるか
(dist - (tn - tc... | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 1,209,241 | 1,209,242 | u990653216 | ruby |
p03463 | a = []
a = gets.split.map(&:to_i)
if (a[2]-a[1]) %2 == 0
puts "Borys"
else
puts "Alice"
end | a = []
a = gets.split.map(&:to_i)
if (a[2]-a[1]) %2 == 1
puts "Borys"
else
puts "Alice"
end
| [
"literal.number.integer.change",
"control_flow.branch.if.condition.change"
] | 1,211,454 | 1,211,455 | u614043796 | ruby |
p03470 | N = gets.to_i
d = []
N.times do |i|
d[i] = gets.to_i
end
puts d.uniq!.size | N = gets.to_i
d = []
N.times do |i|
d[i] = gets.to_i
end
puts d.uniq.size | [
"identifier.change",
"call.arguments.change"
] | 1,215,663 | 1,215,664 | u104886851 | ruby |
p03470 | N = gets.to_i
d= []
N.times do |i|
d[i] = gets.to_i
end
puts d.uniq!.size | N = gets.to_i
d = []
N.times do |i|
d[i] = gets.to_i
end
puts d.uniq.size | [
"identifier.change",
"call.arguments.change"
] | 1,215,665 | 1,215,664 | u104886851 | ruby |
p03471 | # in: n t 20 195000
# out: x y z 10000 5000 1000
n, t = gets.split
n = n.to_i
t = t.to_i
x = y = z = 0
t_temp = -1
(n+1).times do |i|
(n+1).times do |j|
k = n - i - j
t_temp = t
t_temp -= 10000 * i
t_temp -= 5000 * j
t_temp -= 1000 * k
if t_temp == 0
x = i
y = j
z... | # in: n t 20 195000
# out: x y z 10000 5000 1000
n, t = gets.split
n = n.to_i
t = t.to_i
x = y = z = 0
t_temp = -1
(n+1).times do |i|
(n+1-i).times do |j|
k = n - i - j
t_temp = t
t_temp -= 10000 * i
t_temp -= 5000 * j
t_temp -= 1000 * k
if t_temp == 0
x = i
y = j
... | [
"control_flow.break.add"
] | 1,216,993 | 1,216,994 | u859196277 | ruby |
p03471 | x,y = gets.strip.split(" ").map(&:to_i)
count = "-1 -1 -1"
(0..x).each do |n|
(0..(x-n)).each do |m|
l = x - n - m
count = "#{n} #{m} #{l}" if 10000 * n + 5000 * m + 1000 * l == y
end
end
p count | x,y = gets.strip.split(" ").map(&:to_i)
count = "-1 -1 -1"
(0..x).each do |n|
(0..(x-n)).each do |m|
l = x - n - m
count = "#{n} #{m} #{l}" if 10000 * n + 5000 * m + 1000 * l == y
end
end
print count | [
"call.function.change",
"io.output.change"
] | 1,217,534 | 1,217,536 | u709852962 | ruby |
p03471 | x,y = gets.strip.split(" ").map(&:to_i)
count = "-1 -1 -1"
(0..x).each do |n|
(0..(x-n)).each do |m|
l = x - n - m
count = "#{n} #{m} #{l}" if 10000 * n + 5000 * m + 1000 * l == y
end
end | x,y = gets.strip.split(" ").map(&:to_i)
count = "-1 -1 -1"
(0..x).each do |n|
(0..(x-n)).each do |m|
l = x - n - m
count = "#{n} #{m} #{l}" if 10000 * n + 5000 * m + 1000 * l == y
end
end
print count | [
"call.add"
] | 1,217,537 | 1,217,536 | u709852962 | ruby |
p03471 | Y,N = gets.split.map(&:to_i)
a = 0
while a * 10000 <= N
b = 0
while b * 5000 + a * 10000 <= N
c = (N - (a * 10000 + b * 5000)) / 1000
if(a+b+c==Y&&a*10000+b*5000+c*1000==N)
puts "#{a} #{b} #{c}"
exit!
end
b += 1
end
a += 1
end
puts "-1 -1 -1"
| Y,N = gets.split.map(&:to_i)
a = 0
while a * 10000 <= N
b = 0
while b * 5000 + a * 10000 <= N
c = (N - (a * 10000 + b * 5000)) / 1000
if(a+b+c==Y&&a*10000+b*5000+c*1000==N)
puts "#{a} #{b} #{c}"
exit
end
b += 1
end
a += 1
end
puts "-1 -1 -1" | [
"call.suffix.change"
] | 1,220,531 | 1,220,532 | u580402951 | ruby |
p03472 | N,h=gets.split(' ').map(&:to_i)
res,a,b=0,[],[]
N.times{|i|a[i],b[i]=gets.split(' ').map(&:to_i)}
a=a.sort{|i, j| j<=>i}
b=b.sort{|i, j| j<=>i}
while h>0
if b[0]!=nil&&a[0]<b[0]
h-=b.shift
res+=1
else
res+=(h/a[0]).ceil
h=-1
end
end
puts res | N,h=gets.split(' ').map(&:to_i)
res,a,b=0,[],[]
N.times{|i|a[i],b[i]=gets.split(' ').map(&:to_i)}
a=a.sort{|i, j| j<=>i}
b=b.sort{|i, j| j<=>i}
while h>0
if b[0]!=nil&&a[0]<b[0]
h-=b.shift
res+=1
else
res+=(h.to_f/a[0]).ceil
h=-1
end
end
puts res | [
"call.add"
] | 1,223,068 | 1,223,069 | u163922356 | ruby |
p03473 | M = gets
puts 48-M | M = gets.to_i
puts 48-M | [
"call.add"
] | 1,224,658 | 1,224,659 | u053656954 | ruby |
p03477 | arr = $stdin.gets.chomp.split(" ")
arr.map! do |a_j|
a_j.to_i
end
if
arr[0] + arr[1] > arr[2] + arr[3]
puts "Left"
elsif
arr[0] + arr[1] = arr[2] + arr[3]
puts "Balanced"
else
puts "Right"
end | arr = $stdin.gets.chomp.split(" ")
arr.map! do |a_j|
a_j.to_i
end
if
arr[0] + arr[1] > arr[2] + arr[3]
puts "Left"
elsif
arr[0] + arr[1] < arr[2] + arr[3]
puts "Right"
else
puts "Balanced"
end | [
"control_flow.branch.if.condition.change",
"literal.string.change",
"call.arguments.change"
] | 1,229,888 | 1,229,889 | u294388467 | ruby |
p03478 | n,a,b = gets.strip.split.map(&:to_i)
result = 0
(1..n).each do |i|
j = i
sum = 0
while j > o do
sum += j % 10
j = j / 10
end
result += i if sum.between?(a, b)
end
puts result | n, a, b = gets.strip.split.map(&:to_i)
result = 0
(1..n).each do |i|
j = i
sum = 0
while j > 0
sum += j % 10
j = j / 10
end
result += i if sum.between?(a, b)
end
puts result | [
"misc.typo",
"identifier.replace.remove",
"literal.replace.add",
"expression.operation.binary.change"
] | 1,231,825 | 1,231,826 | u809809975 | ruby |
p03478 | n,a,b = gets.strip.split.map(&:to_i)
result = 0
(1..n).each do |i|
j = i
sum = 0
while j > o do
sum += j % 10
j = j / 10
end
if sum >= a && sum <= b
result += i
end
end
puts result | n, a, b = gets.strip.split.map(&:to_i)
result = 0
(1..n).each do |i|
j = i
sum = 0
while j > 0
sum += j % 10
j = j / 10
end
if sum >= a && sum <= b
result += i
end
end
puts result | [
"misc.typo",
"identifier.replace.remove",
"literal.replace.add",
"expression.operation.binary.change"
] | 1,231,827 | 1,231,828 | u809809975 | ruby |
p03478 | n,a,b = gets.strip.split.map(&:to_i)
result = []
(1..n).each do |n|
i = n
sum = 0
while i > 0
sum += i % 10
i = i / 10
end
if sum.between?(a, b)
result += n
end
end
puts result
| n,a,b = gets.strip.split.map(&:to_i)
result = 0
(1..n).each do |n|
i = n
sum = 0
while i > 0
sum += i % 10
i = i / 10
end
if sum.between?(a, b)
result += n
end
end
puts result
| [
"assignment.value.change"
] | 1,231,831 | 1,231,832 | u809809975 | ruby |
p03478 | def digit_sum(n)
sum = 0
while n!=0 do
sum = n%10
n /= 10
end
sum
end
n,a,b = gets.chomp.split.map(&:to_i)
ans = (1..n).map {|i| [i,digit_sum(i)]}
.select {|d| a <= d[1] && d[1] <= b}
.inject(0) {|sum, d| sum + d[0]}
puts ans | def digit_sum(n)
sum = 0
while n!=0 do
sum += n%10
n /= 10
end
sum
end
n,a,b = gets.chomp.split.map(&:to_i)
ans = (1..n).map {|i| [i,digit_sum(i)]}
.select {|d| a <= d[1] && d[1] <= b}
.inject(0) {|sum, d| sum + d[0]}
puts ans | [
"assignment.value.change"
] | 1,232,547 | 1,232,548 | u616320334 | ruby |
p03479 | x, y = gets.strip.split.map(&:to_i)
r = 0
while x < y
r += 1 if x<y
x*=2
end
p r
| x, y = gets.strip.split.map(&:to_i)
r = 0
while x <= y
r += 1 if x<=y
x*=2
end
p r
| [
"expression.operator.compare.change",
"expression.operation.binary.change",
"control_flow.branch.if.condition.change"
] | 1,233,530 | 1,233,531 | u021358975 | ruby |
p03485 | g, b = gets.split.map(&:to_i)
puts (a+b+1)/2
| a, b = gets.split.map(&:to_i)
puts (a+b+1)/2
| [
"assignment.variable.change",
"identifier.change"
] | 1,237,029 | 1,237,030 | u056083754 | ruby |
p03485 | a,b = gets.chomp.split.map(&:to_i)
puts (a.to_f+b)/2.ceil | a,b = gets.chomp.split.map(&:to_i)
puts ((a.to_f+b)/2).ceil | [
"call.arguments.change"
] | 1,239,148 | 1,239,149 | u840570880 | ruby |
p03485 | a,b = gets.chomp.split.map(&:to_i)
puts (a+b)/2.ceil | a,b = gets.chomp.split.map(&:to_i)
puts ((a.to_f+b)/2).ceil | [
"call.arguments.change",
"call.add"
] | 1,239,150 | 1,239,149 | u840570880 | ruby |
p03486 | s = gets.chomp.chars.sort.join
t = gets.chomp.charts.sort.reverse.join
puts s < t ? "Yes" : "No" | s = gets.chomp.chars.sort.join
t = gets.chomp.chars.sort.reverse.join
puts s < t ? "Yes" : "No" | [
"assignment.value.change",
"identifier.change"
] | 1,240,253 | 1,240,254 | u202708319 | ruby |
p03486 | s, t = 2.times.map { gets.chomp }
s = s.chars.sort.join
t = s.chars.sort.reverse.join
puts s < t ? "Yes" : "No" | s, t = 2.times.map { gets.chomp }
s = s.chars.sort.join
t = t.chars.sort.reverse.join
puts s < t ? "Yes" : "No" | [
"assignment.value.change",
"identifier.change"
] | 1,240,255 | 1,240,256 | u202708319 | ruby |
p03486 | s = gets.chomp.chars
t = gets.chomp.chars
s = s.sort
t = t.sort.reverse
if s < t
puts 'Yes'
else
puts 'No'
end
| s = gets.chomp.chars
t = gets.chomp.chars
s = s.sort
t = t.sort.reverse
if (s <=> t) < 0
puts 'Yes'
else
puts 'No'
end
| [
"control_flow.branch.if.condition.change",
"expression.operator.compare.change"
] | 1,240,906 | 1,240,907 | u321226359 | ruby |
p03493 | lines = readlines.join.split
lines = lines.split("")
p lines.count("1")
| lines = gets
lines = lines.split("")
p lines.count("1")
| [
"assignment.value.change",
"call.remove"
] | 1,243,790 | 1,243,791 | u565580226 | ruby |
p03493 | a = gets.chomp.split('')
i = 0
i +=1 if a[0] == 1
i +=1 if a[1] == 1
i +=1 if a[2] == 1
puts i | a = gets.chomp.split('')
i = 0
i+=1 if a[0] == '1'
i+=1 if a[1] == '1'
i+=1 if a[2] == '1'
puts i | [
"control_flow.branch.if.condition.change"
] | 1,245,147 | 1,245,148 | u262396543 | ruby |
p03494 | n = gets.to_i
a = gets.split.map(&:to_i)
ans = 0
while true
if a.all? {|i| i%2==0}
break
end
a = a.map{|i| i/2}
ans += 1
end
puts ans | n = gets.to_i
a = gets.split.map(&:to_i)
ans = 0
while true
if a.any? {|i| i%2!=0}
break
end
a = a.map{|i| i/2}
ans += 1
end
puts ans | [
"identifier.change",
"control_flow.branch.if.condition.change",
"misc.opposites",
"expression.operator.compare.change"
] | 1,246,722 | 1,246,723 | u238956837 | ruby |
p03494 | n = gets.to_i
list = gets.split.map(&:to_i)
puts list
cut = 0
while list.all?(&:even?) do
cut = cut.succ
list = list.map { |a| a / 2 }
end
puts cut
| n = gets.to_i
list = gets.split.map(&:to_i)
cut = 0
while list.all?(&:even?) do
cut = cut + 1
list = list.map { |l| l / 2 }
end
puts cut
| [
"call.remove",
"assignment.value.change",
"identifier.change",
"expression.operation.binary.change"
] | 1,248,132 | 1,248,133 | u142103730 | ruby |
p03494 | _n = gets.to_i
list = gets.split.map(&:to_i)
puts list
cut = 0
while list.all?(&:even?) do
cut = cut.succ
list = list.map { |a| a / 2 }
end
puts cut
| n = gets.to_i
list = gets.split.map(&:to_i)
cut = 0
while list.all?(&:even?) do
cut = cut.succ
list = list.map { |a| a / 2 }
end
puts cut
| [
"assignment.variable.change",
"identifier.change",
"call.remove"
] | 1,248,134 | 1,248,135 | u142103730 | ruby |
p03494 | n = gets.to_i
list = gets.split.map(&:to_i)
puts list
cut = 0
while list.all?(&:even?) do
cut = cut.succ
list = list.map { |a| a / 2 }
end
puts cut
| n = gets.to_i
list = gets.split.map(&:to_i)
cut = 0
while list.all?(&:even?) do
cut = cut.succ
list = list.map { |a| a / 2 }
end
puts cut
| [
"call.remove"
] | 1,248,132 | 1,248,135 | u142103730 | ruby |
p03501 | x=gets.split(" ")
3.times do |i|
x[i].to_i
end
if x[0]*x[1]>x[2]
puts x[2]
else
puts x[0]*x[1]
end | x=gets.split(" ")
3.times do |i|
x[i]=x[i].to_i
end
if x[0]*x[1]>x[2]
puts x[2]
else
puts x[0]*x[1]
end | [
"assignment.add"
] | 1,251,998 | 1,251,999 | u890922829 | ruby |
p03502 | n = gets.chomp.to_s
sum = n.split(//).map(&:to_i).inject(:+)
if n % sum == 0
puts "Yes"
else
puts "No"
end | n = gets.chomp.to_s
sum = n.split(//).map(&:to_i).inject(:+)
if n.to_i % sum == 0
puts "Yes"
else
puts "No"
end
| [
"control_flow.branch.if.condition.change",
"call.add"
] | 1,252,980 | 1,252,981 | u928941036 | ruby |
p03502 | n = gets.chomp.to_s
sum = s.split(//).map(&:to_i).inject(:+)
if n % sum == 0
puts "Yes"
else
puts "No"
end
| n = gets.chomp.to_s
sum = n.split(//).map(&:to_i).inject(:+)
if n.to_i % sum == 0
puts "Yes"
else
puts "No"
end
| [
"assignment.value.change",
"identifier.change",
"control_flow.branch.if.condition.change",
"call.add"
] | 1,252,982 | 1,252,981 | u928941036 | ruby |
p03502 | N = gets.strip
N_sum = N.split('').map(&:to_i).inject(&:+)
puts N.to_i % N_sum == 0 ? 'YES' : 'NO' | N = gets.strip
N_sum = N.split('').map(&:to_i).inject(&:+)
puts N.to_i % N_sum == 0 ? 'Yes' : 'No' | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,256,186 | 1,256,187 | u998238691 | ruby |
p03524 | s=gets.chomp;a=s.count('a'),s.count('b'),s.count('c');puts a.max-a.min<=1?:YES: :No | s=gets.chomp;a=s.count('a'),s.count('b'),s.count('c');puts a.max-a.min<=1?:YES: :NO | [
"call.arguments.change"
] | 1,257,956 | 1,257,957 | u025592199 | ruby |
p03543 | n = gets.chomp.split("")
if n[0] == n[1] and n[1] == n[2] || n[1] == n[2] && n[2] == n[3]
puts "Yes"
else
puts "No"
end | n = gets.chomp.split("")
if n[0] == n[1] && n[1] == n[2] || n[1] == n[2] && n[2] == n[3]
puts "Yes"
else
puts "No"
end | [
"control_flow.branch.if.condition.change"
] | 1,261,155 | 1,261,156 | u868089307 | ruby |
p03550 | require 'prime'
require 'set'
require 'tsort'
include Math
ALP = ('a'..'z').to_a
INF = 0xffffffffffffffff
def max(a,b); a > b ? a : b end
def min(a,b); a < b ? a : b end
def swap(a,b); a, b = b, a ... | require 'prime'
require 'set'
require 'tsort'
include Math
ALP = ('a'..'z').to_a
INF = 0xffffffffffffffff
def max(a,b); a > b ? a : b end
def min(a,b); a < b ? a : b end
def swap(a,b); a, b = b, a ... | [
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 1,269,796 | 1,269,797 | u988228861 | ruby |
p03555 | a=gets.split
b=gets.split
a[2]==b[0]&&a[1]==b[1]&&a[0]==b[2] ? print("YES") :print("NO") | a=gets.chars
b=gets.chars
a[2]==b[0]&&a[1]==b[1]&&a[0]==b[2] ? print("YES") :print("NO") | [
"assignment.value.change",
"identifier.change"
] | 1,271,673 | 1,271,674 | u610697662 | ruby |
p03557 | n = gets.to_i
a = gets.chomp.split.map(&:to_i).sort.reverse
b = gets.chomp.split.map(&:to_i).sort
c = gets.chomp.split.map(&:to_i).sort
ans = 0
n.times do |i|
idx1 = a.bsearch_index { |x| x < b[i] } || 0
idx2 = c.bsearch_index { |x| x > b[i] } || 0
ans += (n - idx1) * (n - idx2)
end
puts ans | n = gets.to_i
a = gets.chomp.split.map(&:to_i).sort.reverse
b = gets.chomp.split.map(&:to_i).sort
c = gets.chomp.split.map(&:to_i).sort
ans = 0
n.times do |i|
idx1 = a.bsearch_index { |x| x < b[i] } || n
idx2 = c.bsearch_index { |x| x > b[i] } || n
ans += (n - idx1) * (n - idx2)
end
puts ans | [
"assignment.value.change",
"identifier.replace.add",
"literal.replace.remove",
"expression.operation.binary.change"
] | 1,273,405 | 1,273,406 | u244257825 | ruby |
p03559 | N=gets.to_i
as=gets.split.map(&:to_i).sort
bs=gets.split.map(&:to_i).sort
cs=gets.split.map(&:to_i).sort
dp1 = Array.new(N+1,0)
bs.each.with_index(0) do |b,i|
j = cs.bsearch_index {|c| b <= c}
dp1[i] = N - j if j
end
(N-2).downto(0) do |i|
dp1[i] += dp1[i+1]
end
ret = 0
as.each do |a|
i = bs.bsearch... | N=gets.to_i
as=gets.split.map(&:to_i).sort
bs=gets.split.map(&:to_i).sort
cs=gets.split.map(&:to_i).sort
dp1 = Array.new(N,0)
bs.each.with_index(0) do |b,i|
j = cs.bsearch_index {|c| b < c}
dp1[i] = N - j if j
end
(N-2).downto(0) do |i|
dp1[i] += dp1[i+1]
end
ret = 0
as.each do |a|
i = bs.bsearch_ind... | [
"expression.operation.binary.remove",
"expression.operator.compare.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 1,276,041 | 1,276,042 | u852974293 | ruby |
p03563 | r = r.to_i
g = g.to_i
p (g * 2) - r | r = gets.to_i
g = gets.to_i
p (g * 2) - r
| [
"assignment.value.change",
"identifier.change"
] | 1,278,088 | 1,278,089 | u049159332 | ruby |
p03565 | SS, T = $<.map &:chomp
SS.tr!(??,?.)
(SS.size-T.size).downto(0){|from|
to = from + T.size
if T[/^#{SS[from,to]}$/]
$* << SS[0...from].tr(?.,?a) + T + SS[to..-1].tr(?.,?a)
end
}
puts $*.empty? ? :UNRESTORABLE : $*.min | SS, T = $<.map &:chomp
SS.tr!(??,?.)
(SS.size-T.size).downto(0){|from|
to = from + T.size
if T[/^#{SS[from...to]}$/]
$* << SS[0...from].tr(?.,?a) + T + SS[to..-1].tr(?.,?a)
end
}
puts $*.empty? ? :UNRESTORABLE : $*.min
| [] | 1,283,079 | 1,283,080 | u711705317 | ruby |
p03569 | s = gets.chomp
numx = [0]
notx = ''
pt = 0
s.chars do |c|
if c == 'x'
numx[pt] += 1
else
notx << c
pt += 1
numx[pt] = 0
end
end
if notx != notx.reverse
puts -1
else
ans = 0
l = numx.length
(1..l/2).each do |i|
ans += (numx[i] - numx[l-1-i]).abs
end... | s = gets.chomp
numx = [0]
notx = ''
pt = 0
s.chars do |c|
if c == 'x'
numx[pt] += 1
else
notx << c
pt += 1
numx[pt] = 0
end
end
if notx != notx.reverse
puts -1
else
ans = 0
l = numx.length
(l/2).times do |i|
ans += (numx[i] - numx[l-1-i]).abs
end
e... | [
"identifier.change"
] | 1,283,725 | 1,283,726 | u314396879 | ruby |
p03577 | s=gets
s.slice!(-8..-1)
print s | # Here your code !
s=gets.chomp
s.slice!(-8..-1)
print s | [
"call.add"
] | 1,287,257 | 1,287,258 | u798818115 | ruby |
p03577 | # Here your code !
s=gets
s.slice!(-8..-1)
print(s) | # Here your code !
s=gets.chomp
s.slice!(-8..-1)
print s | [
"call.add",
"call.arguments.change"
] | 1,287,260 | 1,287,258 | u798818115 | ruby |
p03576 | N,K = gets.chomp.split(" ").map(&:to_i)
coord = N.times.map{gets.chomp.split(" ").map(&:to_i)}.sort_by{|i,j|i}
a = Array.new(N+1).map{Array.new(N+1,0)}
ans = 10**20
x,y = 2.times.map{Hash.new}
coord.each_with_index do |b,i|
x[b[0]] = i+1
end
coord.sort_by{|i,j|j}.each_with_index do |b,i|
y[b[1]] = i+1
end
coord.eac... | N,K = gets.chomp.split(" ").map(&:to_i)
coord = N.times.map{gets.chomp.split(" ").map(&:to_i)}.sort_by{|i,j|i}
a = Array.new(N+1).map{Array.new(N+1,0)}
ans = 10**20
x,y = 2.times.map{Hash.new}
coord.each_with_index do |b,i|
x[b[0]] = i+1
end
coord.sort_by{|i,j|j}.each_with_index do |b,i|
y[b[1]] = i+1
end
coord.eac... | [
"control_flow.branch.if.condition.change"
] | 1,287,407 | 1,287,408 | u506255180 | ruby |
p03578 | hN = {}
hM = {}
N,_=gets.chomp.split(' ').map{|n| n.to_i}
gets.chomp.split(' ').map{|n| n.to_i}.each{|n|
hN[n].nil? ? hN[n]=1 : hN[n]+=1
}
M,_=gets.chomp.split(' ').map{|n| n.to_i}
gets.chomp.split(' ').map{|n| n.to_i}.each{|n|
hM[n].nil? ? hM[n]=1 : hM[n]+=1
}
hM.each{|k,v|
if(hN[k].nil? || hN[k] < hM[k])
puts "N... | hN = {}
hM = {}
N,_=gets.chomp.split(' ').map{|n| n.to_i}
gets.chomp.split(' ').map{|n| n.to_i}.each{|n|
hN[n].nil? ? hN[n]=1 : hN[n]+=1
}
M,_=gets.chomp.split(' ').map{|n| n.to_i}
gets.chomp.split(' ').map{|n| n.to_i}.each{|n|
hM[n].nil? ? hM[n]=1 : hM[n]+=1
}
hM.each{|k,v|
if(hN[k].nil? || hN[k] < hM[k])
puts "N... | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 1,288,031 | 1,288,032 | u415591191 | ruby |
p03592 | # Here your code !
n,m,k=gets.split(' ').map(&:to_i)
(n+1).times{|a|
(m+1).times{|b|
if k==(a*n+b*m-2*a*b)
print("Yes")
exit
end
}
}
print("No")
| # Here your code !
n,m,k=gets.split(' ').map(&:to_i)
(m+1).times{|a|
(n+1).times{|b|
if k==(a*n+b*m-2*a*b)
print("Yes")
exit
end
}
}
print("No")
| [
"identifier.change",
"expression.operation.binary.change",
"io.output.change"
] | 1,293,937 | 1,293,938 | u798818115 | ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.