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 |
|---|---|---|---|---|---|---|---|
p02417 | a = ("a".."z").to_a
b = Array.new(26, 0)
while x = gets.chomp.downcase
x.chars { |i|
for j in 0..25
i == a[j] && b[j] += 1
end
}
end
a.size.times { |c|
puts "#{a[c]} : #{b[c]}"
} | a = ("a".."z").to_a
b = Array.new(26, 0)
while x = gets
x = x.downcase
x.chars { |i|
for j in 0..25
i == a[j] && b[j] += 1
end
}
end
a.size.times { |c|
puts "#{a[c]} : #{b[c]}"
} | [
"call.add"
] | 224,274 | 224,275 | u216813029 | ruby |
p02417 | a = ("a".."z").to_a
b = Array.new(26, 0)
while x = gets.downcase
x.chars { |i|
for j in 0..25
i == a[j] && b[j] += 1
end
}
end
a.size.times { |c|
puts "#{a[c]} : #{b[c]}"
} | a = ("a".."z").to_a
b = Array.new(26, 0)
while x = gets
x = x.downcase
x.chars { |i|
for j in 0..25
i == a[j] && b[j] += 1
end
}
end
a.size.times { |c|
puts "#{a[c]} : #{b[c]}"
} | [
"assignment.add"
] | 224,276 | 224,275 | u216813029 | ruby |
p02417 | a = ("a".."z").to_a
b = Array.new(26, 0)
while x = gets.chomp.downcase
x.chars { |i|
for j in 0..25
i == a[j] && b[j] += 1
end
}
end
a.size.times { |c|
puts "#{a[c]} : #{b[c]}"
} | a = ("a".."z").to_a
b = Array.new(26, 0)
while x = gets
x.downcase.chars { |i|
for j in 0..25
i == a[j] && b[j] += 1
end
}
end
a.size.times { |c|
puts "#{a[c]} : #{b[c]}"
} | [] | 224,274 | 224,277 | u216813029 | ruby |
p02419 | def count_word(t_array, w)
length = t_array.length
word_count = 0
for i in 0..(length-1)
if t_array[i] == w
word_count += 1
end
end
return word_count
end
w = gets.chomp
t_array = []
loop do
t = gets.chomp.split
if t == ["END_OF_TEXT"]
break
end
t_array.push(t)
t_array.flatten!
end... | def count_word(t_array, w)
length = t_array.length
word_count = 0
for i in 0..(length-1)
if t_array[i].downcase == w
word_count += 1
end
end
return word_count
end
w = gets.chomp
t_array = []
loop do
t = gets.chomp.split
if t == ["END_OF_TEXT"]
break
end
t_array.push(t)
t_array.fla... | [
"control_flow.branch.if.condition.change",
"call.add"
] | 224,659 | 224,660 | u723368439 | ruby |
p02419 | def count_word(t_array, w)
length = t_array.length
word_count = 0
for i in 0..(length-1)
if t_array[i] == w
word_count += 1
end
end
return word_count
end
w = gets.chomp
t_array = []
loop do
t = gets.chomp.downcase
if t == ["END_OF_TEXT"]
break
end
t_array.push(t)
t_array.flatten!
... | def count_word(t_array, w)
length = t_array.length
word_count = 0
for i in 0..(length-1)
if t_array[i].downcase == w
word_count += 1
end
end
return word_count
end
w = gets.chomp
t_array = []
loop do
t = gets.chomp.split
if t == ["END_OF_TEXT"]
break
end
t_array.push(t)
t_array.fla... | [
"control_flow.branch.if.condition.change",
"call.add",
"assignment.value.change",
"identifier.change"
] | 224,662 | 224,660 | u723368439 | ruby |
p02419 | def count_word(t_array, w)
length = t_array.length
word_count = 0
for i in 0..(length-1)
if t_array[i].downcase == w
word_count += 1
end
end
return word_count
end
w = gets.chomp
t_array = []
loop do
t = gets.chomp
if t == ["END_OF_TEXT"]
break
end
t_array.push(t)
t_array.flatten!
... | def count_word(t_array, w)
length = t_array.length
word_count = 0
for i in 0..(length-1)
if t_array[i].downcase == w
word_count += 1
end
end
return word_count
end
w = gets.chomp
t_array = []
loop do
t = gets.chomp.split
if t == ["END_OF_TEXT"]
break
end
t_array.push(t)
t_array.fla... | [
"call.add"
] | 224,663 | 224,660 | u723368439 | ruby |
p02479 | r = gets.to_i
puts [r ** 2 * Math::PI, r * 2 * Math::PI]*" " | r = gets.to_f
puts [r ** 2 * Math::PI, r * 2 * Math::PI]*" " | [
"call.function.change",
"type_conversion.to_float.change",
"type_conversion.to_number.change"
] | 228,044 | 228,045 | u454855072 | ruby |
p02479 | r = str.to_f
puts [r ** 2 * Math::PI, r * 2 * Math::PI]*" " | r = gets.to_f
puts [r ** 2 * Math::PI, r * 2 * Math::PI]*" " | [
"assignment.value.change",
"identifier.change"
] | 228,046 | 228,045 | u454855072 | ruby |
p02489 |
c=1
num = gets.chomp.to_i
while num!=0
puts "Case #{c}: #{num}"
c++
num = gets.chomp.to_i
end |
c=1
num = gets.chomp.to_i
while num!=0
puts "Case #{c}: #{num}"
c+=1
num = gets.chomp.to_i
end | [] | 234,170 | 234,171 | u810198868 | ruby |
p02546 | # frozen_string_literal: true
s = gets.chomp
puts s + (s[-1] == 's' ? 's' : 'es')
| # frozen_string_literal: true
s = gets.chomp
puts s + (s[-1] == 's' ? 'es' : 's')
| [
"literal.string.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 243,662 | 243,663 | u434509016 | ruby |
p02570 | line = gets.split(' ')
line = line.map { |x| x.to_i }
D = line[0]
T = line[1]
S = line[2]
if T >= (D / S)
puts "Yes"
else
puts "No"
end | line = gets.split(' ')
line = line.map { |x| x.to_f }
D = line[0]
T = line[1]
S = line[2]
if T >= (D / S)
puts "Yes"
else
puts "No"
end | [
"call.function.change",
"type_conversion.to_float.change",
"type_conversion.to_number.change"
] | 258,505 | 258,506 | u936380681 | ruby |
p02570 | D, T, S = gets.split.map(&:to_i)
puts D < T*S ? "Yes" : "No"
| D, T, S = gets.split.map(&:to_i)
puts D <= T*S ? "Yes" : "No"
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 259,437 | 259,438 | u716826907 | ruby |
p02571 | s = gets.chomp
t = gets.chomp
tlength = t.length
min = tlength
(s.length - tlength).times{|i|
diff = tlength
ss = s[i .. i + tlength - 1]
tlength.times{|j|
diff -= 1 if ss[j] == t[j]
}
min = diff if min > diff
}
puts min
| s = gets.chomp
t = gets.chomp
tlength = t.length
min = tlength
(s.length - tlength + 1).times{|i|
diff = tlength
ss = s[i .. i + tlength - 1]
tlength.times{|j|
# p [s, t, ss, i, j, ss[j], t[j]]
diff -= 1 if ss[j] == t[j]
}
min = diff if min > diff
}
puts min
| [
"expression.operation.binary.add"
] | 262,390 | 262,391 | u208362438 | ruby |
p02573 | n, m = gets.split(" ").map(&:to_i)
@ind_arr = Array.new(n+1){|i| i}
@f_arr = Array.new(n+1, 1)
def find(x)
return x if x == @ind_arr[x]
# 途中のindexも更新しておく
@ind_arr[x] = find(@ind_arr[x])
return @ind_arr[x]
end
def union(x, y)
x = find(x)
y = find(y)
return if x == y
@ind_arr[x] = y
@f_arr[y] += @f_a... | n, m = gets.split(" ").map(&:to_i)
@ind_arr = Array.new(n+1){|i| i}
@f_arr = Array.new(n+1, 1)
def find(x)
return x if x == @ind_arr[x]
# 途中のindexも更新しておく
@ind_arr[x] = find(@ind_arr[x])
return @ind_arr[x]
end
def union(x, y)
x = find(x)
y = find(y)
return if x == y
@ind_arr[x] = y
@f_arr[y] += @f_a... | [
"call.add",
"call.arguments.change"
] | 269,338 | 269,339 | u771770008 | ruby |
p02576 | a,b,c = gets.chomp.split(" ").map(&:to_i);
z=a%b
if z==0
p a/b*t
else
p a/b*c+c
end | a,b,c = gets.chomp.split(" ").map(&:to_i);
z=a%b
if z==0
p a/b*c
else
p a/b*c+c
end
| [
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 272,080 | 272,081 | u492991702 | ruby |
p02577 | puts (gets.to_i % 9 == 0 ? "YES" : "NO") | puts (gets.to_i % 9 == 0 ? "Yes" : "No") | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 274,088 | 274,089 | u714724786 | ruby |
p02582 | s=gets.chomp.chars
if s.include?('RRR')
puts 3
elsif s.include?('RR')
puts 2
elsif s.include?('R')
puts 1
else
puts 0
end | s=gets.chomp
if s.include?('RRR')
puts 3
elsif s.include?('RR')
puts 2
elsif s.include?('R')
puts 1
else
puts 0
end | [
"call.remove"
] | 283,157 | 283,158 | u630043039 | ruby |
p02583 | n=gets.to_i
a=gets.split.map(&:to_i).sort
cnt=0
n=a.size
for i in 0...n-2
for j in i+1...n-1
for k in j+1...n
if a[i]+a[j]<a[k]&&(!(a[i]==a[j]||a[j]==a[k]))
cnt+=1
end
end
end
end
puts cnt | n=gets.to_i
a=gets.split.map(&:to_i).sort
cnt=0
n=a.size
for i in 0...n-2
for j in i+1...n-1
for k in j+1...n
if a[i]+a[j]>a[k]&&(!(a[i]==a[j]||a[j]==a[k]))
cnt+=1
end
end
end
end
puts cnt
| [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 283,390 | 283,391 | u054798759 | ruby |
p02584 | x, k, d = gets.chomp.split(" ").map(&:to_i)
min = 0
if x.abs > k*d
min = x.abs - k*d
if x < 0
min *= -1
end
else
if (k - x/d).even?
#偶数の場合
min = x - d * (x / d)
elsif
#奇数の場合
min = (x - d * (x / d + 1)).abs
end
end
puts min | x, k, d = gets.chomp.split(" ").map(&:to_i)
min = 0
x = x.abs
if x > k*d
min = x - k*d
if x < 0
min *= -1
end
else
if (k - x/d).even?
#偶数の場合
min = x - d * (x / d)
elsif
#奇数の場合
min = (x - d * (x / d + 1)).abs
end
end
puts min | [
"assignment.variable.change",
"call.remove"
] | 285,332 | 285,333 | u994502918 | ruby |
p02584 | x, k, d = gets.split.map(&:to_i)
ans = 0
if x > (k * d)
ans = x - (k * d)
else
num = x / d
if (k - num) % 2 == 0
ans = x - (d * (x / d))
else
ans = x - (d * ((x / d) + 1))
end
end
puts ans.abs
| x, k, d = gets.split.map(&:to_i)
ans = 0
x = x.abs
if x > (k * d)
ans = x - (k * d)
else
num = x / d
if (k - num) % 2 == 0
ans = x - (d * (x / d))
else
ans = x - (d * ((x / d) + 1))
end
end
puts ans.abs
| [
"assignment.add"
] | 286,622 | 286,623 | u854388580 | ruby |
p02596 | K = gets.to_i
wk, x, ans = 7, 1, -1
while x < K do
if wk % K == 0 then
ans = x
break
end
wk = wk % K * 10 + 7
x += 1
end
puts ans
| K = gets.to_i
wk, x, ans = 7, 1, -1
while x <= K do
if wk % K == 0 then
ans = x
break
end
wk = wk % K * 10 + 7
x += 1
end
puts ans
| [
"expression.operator.compare.change",
"expression.operation.binary.change"
] | 297,972 | 297,973 | u276517671 | ruby |
p02598 | N, K = gets.split.map(&:to_i)
A = gets.split.map(&:to_i)
s = A.max
l, r = 1, s
while l < r
m = l + (r - l) / 2
mk = A.map{|v| (v / (m + 0.0)).ceil - 1}.sum
# pp [l,r,m,mk]
if mk > K then
l = m + 1
else mk < K
r = m - 1
end
end
puts r
| N, K = gets.split.map(&:to_i)
A = gets.split.map(&:to_i)
s = A.max
l, r = 1, s
while l <= r
m = l + (r - l) / 2
mk = A.map{|v| (v / (m + 0.0)).ceil - 1}.sum
# pp [l,r,m,mk]
if mk > K then
l = m + 1
else
r = m - 1
end
end
puts l
| [
"expression.operator.compare.change",
"expression.operation.binary.change",
"expression.operation.binary.remove",
"identifier.change",
"call.arguments.change"
] | 299,851 | 299,852 | u990758634 | ruby |
p02603 | n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)
ans = 1000
(1...n).each do |i|
have_stock = 0
have_stock = ans / a[i] if a[i] < a[i+1]
ans += (a[i+1]- a[i]) * have_stock
end
puts ans | n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)
a.unshift(0)
ans = 1000
(1...n).each do |i|
have_stock = 0
have_stock = ans / a[i] if a[i] < a[i+1]
ans += (a[i+1]- a[i]) * have_stock
end
puts ans | [
"call.add"
] | 309,119 | 309,120 | u466332671 | ruby |
p02607 | n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)
puts (0...n).filter { |i|
i % 2 == 1 && a[i] % 2 == 1
}.count | n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)
puts (0...n).filter { |i|
i % 2 == 0 && a[i] % 2 == 1
}.count | [
"literal.number.integer.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 311,039 | 311,040 | u469583382 | ruby |
p02607 | n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)
puts n.times.filter { |i|
i % 2 == 1 && a[i] % 2 == 1
}.count | n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)
puts (0...n).filter { |i|
i % 2 == 0 && a[i] % 2 == 1
}.count | [
"call.arguments.change",
"literal.number.integer.change",
"expression.operation.binary.change"
] | 311,041 | 311,040 | u469583382 | ruby |
p02613 | n = gets.to_i
line = readlines.map(&:chomp)
line.push("AC","WA","TLE","RE")
hash = line.tally
puts "AC x " + ((hash["AC"]) - 1).to_s
puts "WA x " + ((hash["AC"]) - 1).to_s
puts "TLE x " + ((hash["AC"]) - 1).to_s
puts "RE x " + ((hash["AC"]) - 1).to_s | n = gets.to_i
line = readlines.map(&:chomp)
line.push("AC","WA","TLE","RE")
hash = line.tally
puts "AC x " + ((hash["AC"]) - 1).to_s
puts "WA x " + ((hash["WA"]) - 1).to_s
puts "TLE x " + ((hash["TLE"]) - 1).to_s
puts "RE x " + ((hash["RE"]) - 1).to_s | [
"literal.string.change",
"variable_access.subscript.index.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 320,641 | 320,642 | u663882298 | ruby |
p02623 | n, m, k = gets.chomp.split.map(&:to_i)
a = gets.chomp.split.map(&:to_i)
b = gets.chomp.split.map(&:to_i)
a.unshift(0)
b.unshift(0)
1.step(n) do |i|
a[i] += a[i - 1]
end
1.step(m) do |j|
b[j] += b[j - 1]
end
i = 0
j = m
res = 0
while j > 0 && i <= n
break if a[i] > k
j -= 1 while b[j] > k - a[i] && j > 0
r... | n, m, k = gets.chomp.split.map(&:to_i)
a = gets.chomp.split.map(&:to_i)
b = gets.chomp.split.map(&:to_i)
a.unshift(0)
b.unshift(0)
1.step(n) do |i|
a[i] += a[i - 1]
end
1.step(m) do |j|
b[j] += b[j - 1]
end
i = 0
j = m
res = 0
while j >= 0 && i <= n
break if a[i] > k
j -= 1 while b[j] > k - a[i] && j > 0
... | [
"expression.operator.compare.change",
"expression.operation.binary.change"
] | 333,555 | 333,556 | u482840940 | ruby |
p02627 | a = gets.chomp
if a.downcase == a then
puts 'A'
else
puts 'a'
end | a = gets.chomp
if a.downcase == a then
puts 'a'
else
puts 'A'
end | [
"call.remove",
"call.add"
] | 337,782 | 337,783 | u312004378 | ruby |
p02629 | n = gets.chomp.to_i
ans = ''
while n > 0 do
n -= 1
ans += (97 + n % 26).chr
n /= 26
end
print(ans)
| n = gets.chomp.to_i
ans = ''
while n > 0 do
n -= 1
ans += (97 + n % 26).chr
n /= 26
end
print(ans.reverse)
| [
"call.add"
] | 339,876 | 339,877 | u882179152 | ruby |
p02629 | n = gets.to_i
s = ""
r = [*"a".."z"]
while n > 0
s = r[n % 26 - 1] + s
n = n / 26
end
puts s | n = gets.to_i
s = ""
r = [*"a".."z"]
while n > 0
n -= 1
s = r[n % 26] + s
n = n / 26
end
puts s
| [
"expression.operation.binary.remove"
] | 342,297 | 342,298 | u347948131 | ruby |
p02640 | x, y = gets.split.map(&:to_i)
if y.even && (y/2)-x >= 0 && x*2-(y/2) >= 0
puts "Yes"
else
puts "No"
end | x, y = gets.split.map(&:to_i)
if y.even? && (y/2)-x >= 0 && x*2-(y/2) >= 0
puts "Yes"
else
puts "No"
end | [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 351,455 | 351,456 | u437302815 | ruby |
p02640 | x, y = gets.split.map(&:to_i)
(1..x).each do |xx|
if xx * 2 + (x-xx)* 4 == y
puts 'Yes'
exit
end
end
puts 'No' | x, y = gets.split.map(&:to_i)
(0..x).each do |xx|
if xx * 2 + (x-xx)* 4 == y
puts 'Yes'
exit
end
end
puts 'No' | [
"literal.number.integer.change"
] | 354,905 | 354,906 | u729246375 | ruby |
p02641 | eval'X,_,*A='+`dd`.split*?,
p (0..100).reject{A.index _1}.min_by{(X-_1).abs} | eval'X,_,*A='+`dd`.split*?,
p (0..101).reject{A.index _1}.min_by{(X-_1).abs} | [
"literal.number.integer.change",
"call.arguments.change"
] | 358,247 | 358,248 | u657913472 | ruby |
p02641 | x,n=gets.split.map &:to_i
if n==0
bs=[*0..100]
else
as=gets.split.map &:to_i
bs=[*0..100]-as
end
p bs.min_by{|i|(i-x).abs} | x,n=gets.split.map &:to_i
if n==0
bs=[*0..210]
else
as=gets.split.map &:to_i
bs=[*0..210]-as
end
p bs.min_by{|i|(i-x).abs} | [
"literal.number.integer.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 360,606 | 360,607 | u128694188 | ruby |
p02641 | x,n=gets.split.map &:to_i
if n==0
bs=[*1..100]
else
as=gets.split.map &:to_i
bs=[*1..100]-as
end
p bs.min_by{|i|(i-x).abs} | x,n=gets.split.map &:to_i
if n==0
bs=[*0..210]
else
as=gets.split.map &:to_i
bs=[*0..210]-as
end
p bs.min_by{|i|(i-x).abs} | [
"literal.number.integer.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 360,608 | 360,607 | u128694188 | ruby |
p02658 | N = gets.to_i
numbers = gets.strip.split(nil).map(&:to_i)
i = 0
pr = 1
unless numbers.include?(0) then
while i < N do
if pr <= 10**18 then
pr *= numbers[i]
i += 1
else
pr = -1
break
end
end
if pr <= 10**18 then
puts pr
else
puts "-1"
end
else
pr = "0"
end | N = gets.to_i
numbers = gets.strip.split(nil).map(&:to_i)
i = 0
pr = 1
unless numbers.include?(0) then
while i < N do
if pr <= 10**18 then
pr *= numbers[i]
i += 1
else
pr = -1
break
end
end
if pr <= 10**18 then
puts pr
else
puts "-1"
end
else
puts "0"
end | [] | 372,017 | 372,018 | u313103408 | ruby |
p02658 | N = gets.to_i
numbers = gets.strip.split(nil).map(&:to_i)
i = 0
pr = 1
unless numbers.include?(0) then
while i < N do
if pr <= 10**18 then
pr *= numbers[i]
i += 1
else
pr = -1
break
end
end
if pr <= 10**18 then
puts pr
else
puts -1
end
else
pr = 0
end | N = gets.to_i
numbers = gets.strip.split(nil).map(&:to_i)
i = 0
pr = 1
unless numbers.include?(0) then
while i < N do
if pr <= 10**18 then
pr *= numbers[i]
i += 1
else
pr = -1
break
end
end
if pr <= 10**18 then
puts pr
else
puts "-1"
end
else
puts "0"
end | [
"call.arguments.change"
] | 372,019 | 372,018 | u313103408 | ruby |
p02658 | n = gets.strip.to_i
arr = gets.chomp.split(" ").map(&:to_i)
# n = 2
# arr = [1000000000, 1000000000]
# n = 3
# arr = [101, 9901, 999999000001]
MAX = 10**18
arr = arr.sort{|a, b| b<=>a}
if arr.include?(0)
puts 0
exit(0)
end
i = 1
sum = arr[0]
loop do
sum = sum * arr[i]
p sum
if sum > MAX
puts "-1... | n = gets.strip.to_i
arr = gets.chomp.split(" ").map(&:to_i)
# n = 2
# arr = [1000000000, 1000000000]
# n = 3
# arr = [101, 9901, 999999000001]
MAX = 10**18
arr = arr.sort{|a, b| b<=>a}
if arr.include?(0)
puts 0
exit(0)
end
i = 1
sum = arr[0]
loop do
sum = sum * arr[i]
# p sum
if sum > MAX
puts "... | [
"call.remove"
] | 375,312 | 375,313 | u798059579 | ruby |
p02659 | x,y=gets.split.to_r
puts (x*y).to_i
| x,y=gets.split.map &:to_r
puts (x*y).to_i
| [
"assignment.value.change",
"identifier.change"
] | 376,470 | 376,471 | u977506075 | ruby |
p02659 | x,y=gets.split.map(&:to_f)
puts (x*y).to_i
| x,y=gets.split.map &:to_r
puts (x*y).to_i
| [
"call.arguments.change",
"assignment.value.change"
] | 376,472 | 376,471 | u977506075 | ruby |
p02659 | x,y=gets.split.map(&:to_r)
puts x
puts y
puts (x*y).floor
| x,y=gets.split.map(&:to_r)
puts (x*y).floor
| [
"call.remove"
] | 376,473 | 376,474 | u977506075 | ruby |
p02659 | x,y=gets.split.map(&:to_f)
puts (x*y).to_i
| x,y=gets.split.map(&:to_r)
puts (x*y).floor
| [
"assignment.value.change",
"call.arguments.change",
"identifier.change",
"io.output.change"
] | 376,472 | 376,474 | u977506075 | ruby |
p02659 | # https://atcoder.jp/contests/abc169/tasks/abc169_c
A, B = gets.split.map(&:to_f)
ans = (A * (B * 100)).to_i / 100
puts ans
| # https://atcoder.jp/contests/abc169/tasks/abc169_c
A, B = gets.split.map(&:to_r)
ans = (A * (B * 100)).to_i / 100
puts ans
| [
"assignment.value.change",
"call.arguments.change"
] | 376,928 | 376,929 | u091367113 | ruby |
p02659 | #exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']
require 'prime'
def inpf() a=gets.chomp.split(" ").map(&:to_f)end
def inps() a=gets.chomp.split(" ")end
def copy(a) Marshal.load(Marshal.dump(a)) end
def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|... | #exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']
require 'prime'
def inpf() a=gets.chomp.split(" ").map(&:to_f)end
def inps() a=gets.chomp.split(" ")end
def copy(a) Marshal.load(Marshal.dump(a)) end
def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|... | [
"literal.number.integer.change",
"assignment.value.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 380,663 | 380,664 | u145123922 | ruby |
p02663 | a,b,c,d,e=gets.split.map!{|i| i.to_i}
ans=0
if b>d
ans=(c-a-1)*60+60+d-b-e
else
ans=(c-a)*60+d-b
end
if ans>=0
puts ans
else
puts 0
end | a,b,c,d,e=gets.split.map!{|i| i.to_i}
ans=0
if b>d
ans=(c-a-1)*60+60+d-b-e
else
ans=(c-a)*60+d-b-e
end
if ans>=0
puts ans
else
puts 0
end | [
"assignment.change"
] | 387,091 | 387,092 | u977506075 | ruby |
p02675 | puts case gets.to_i % 10
when 0,2, 4, 5, 7, 9
"hon"
when 1, 6, 8
"pon"
else
"bon"
end | puts case gets.to_i % 10
when 2, 4, 5, 7, 9
"hon"
when 0, 1, 6, 8
"pon"
else
"bon"
end
| [] | 391,316 | 391,317 | u306465660 | ruby |
p02675 | puts case gets.to_i
when 0,2, 4, 5, 7, 9
"hon"
when 1, 6, 8
"pon"
else
"bon"
end | puts case gets.to_i % 10
when 2, 4, 5, 7, 9
"hon"
when 0, 1, 6, 8
"pon"
else
"bon"
end
| [
"expression.operation.binary.add"
] | 391,318 | 391,317 | u306465660 | ruby |
p02675 | puts case gets.to_i
when 2, 4, 5, 7, 9
"hon"
when 0, 1, 6, 8
"pon"
else
"bon"
end | puts case gets.to_i % 10
when 2, 4, 5, 7, 9
"hon"
when 0, 1, 6, 8
"pon"
else
"bon"
end
| [
"expression.operation.binary.add"
] | 391,319 | 391,317 | u306465660 | ruby |
p02675 | N = gets.chomp
case N[-1]
when "2", "4", "5", "7", "9"
puts "hon"
when "0", "1", "6", "8"
puts "pon"
when "3"
puts "pbon"
end | N = gets.chomp
case N[-1]
when "2", "4", "5", "7", "9"
puts "hon"
when "0", "1", "6", "8"
puts "pon"
when "3"
puts "bon"
end | [
"literal.string.change",
"call.arguments.change"
] | 392,902 | 392,903 | u842041313 | ruby |
p02676 | input_lines = readlines.map(&:chomp)
K = input_lines.shift.to_i
S = input_lines.shift
result = if S.size < K
S
else
"#{S[0, K]}..."
end
puts result | input_lines = readlines.map(&:chomp)
K = input_lines.shift.to_i
S = input_lines.shift
result = if S.size <= K
S
else
"#{S[0, K]}..."
end
puts result | [
"expression.operator.compare.change",
"assignment.value.change",
"control_flow.branch.if.condition.change"
] | 395,618 | 395,619 | u329083941 | ruby |
p02676 | input_lines = readlines.map(&:chomp)
K = input_lines.shift.to_i
S = input_lines.shift
result = if S.size < K
S
else
"#{S[0, K]}..."
end
puts result
| input_lines = readlines.map(&:chomp)
K = input_lines.shift.to_i
S = input_lines.shift
result = if S.size <= K
S
else
"#{S[0, K]}..."
end
puts result | [
"expression.operator.compare.change",
"assignment.value.change",
"control_flow.branch.if.condition.change"
] | 395,620 | 395,619 | u329083941 | ruby |
p02676 | k = gets.to_i
s = gets.chomp
if s.size() < k
puts s
else
puts s[0...k] + "..."
end
| k = gets.to_i
s = gets.chomp
if s.size() <= k
puts s
else
puts s[0...k] + "..."
end
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 395,713 | 395,714 | u843127718 | ruby |
p02677 | a, b, h, m = gets.split.map(&:to_i)
def angle(h, m)
# 720 min => rotate
h_angle = 360.0 * (h * 60 + m) / 720.0
m_angle = 360.0 * (m / 60.0)
diff = (h_angle - m_angle).to_i.abs
diff = 360 - diff if diff > 180
return diff
end
def to_rad(angle)
angle * Math::PI / 180
end
# puts angle(h, m)
# puts (angle... | a, b, h, m = gets.split.map(&:to_i)
def angle(h, m)
# 720 min => rotate
h_angle = 360.0 * (h * 60 + m) / 720.0
m_angle = 360.0 * (m / 60.0)
diff = (h_angle - m_angle).abs
diff = 360 - diff if diff > 180
return diff
end
def to_rad(angle)
angle * Math::PI / 180
end
# puts angle(h, m)
# puts (angle(h, m... | [
"call.remove"
] | 398,226 | 398,227 | u624505752 | ruby |
p02681 | k = gets.chomp
l = gets.chomp
puts l.match(/^#{k}.$/) ? "YES" : "NO" | k = gets.chomp
l = gets.chomp
puts l.match(/^#{k}.$/) ? "Yes" : "No" | [] | 405,036 | 405,037 | u137521549 | ruby |
p02682 | a,b,c,k=gets.chomp.split(" ").map(&:to_i)
puts a+b>=k ? [a,k].max : a-(k-a-b) | a,b,c,k=gets.chomp.split(" ").map(&:to_i)
puts a+b>=k ? [a,k].min : a-(k-a-b) | [
"misc.opposites",
"identifier.change",
"call.arguments.change",
"io.output.change"
] | 407,659 | 407,660 | u141968173 | ruby |
p02683 | n,m,x = gets.split.map(&:to_i)
list = []
n.times {list.push(gets.split.map(&:to_i))}
ans = 10**9
[1,0].repeated_permutation(n) do |perm|
sum = [0]*(m+1)
list.zip(perm).each do |i|
tmp = i[0]*i[1]
sum = sum.zip(tmp).map{|f,s| f+s} unless tmp.empty?
end
flag = true
1.upto(m-1) do... | n,m,x = gets.split.map(&:to_i)
list = []
n.times {list.push(gets.split.map(&:to_i))}
ans = 10**9
[1,0].repeated_permutation(n) do |perm|
sum = [0]*(m+1)
list.zip(perm).each do |i|
tmp = i[0]*i[1]
sum = sum.zip(tmp).map{|f,s| f+s} unless tmp.empty?
end
flag = true
1.upto(m) do |... | [
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 411,667 | 411,668 | u712322283 | ruby |
p02687 | puts gets=="ABC" ? "ARC" : "ABC" | puts gets=="ABC\n" ? "ARC" : "ABC" | [
"literal.string.change",
"control_flow.branch.if.condition.change"
] | 418,868 | 418,869 | u141968173 | ruby |
p02687 | line = gets.to_s
if line == "ABC" then
print "ARC"
else
print "ABC"
end | line = gets.chomp.to_s
if line == "ABC" then
print "ARC"
else
print "ABC"
end | [
"call.add"
] | 419,008 | 419,009 | u569559028 | ruby |
p02687 | line = gets
if line == "ABC" then
print "ARC"
else
print "ABC"
end | line = gets.chomp.to_s
if line == "ABC" then
print "ARC"
else
print "ABC"
end | [
"call.add"
] | 419,010 | 419,009 | u569559028 | ruby |
p02687 | line = gets
if line == "ABC" then
print "ARC"
else
print "ABC"
end | line = gets.chomp.to_s
if line == "ABC" then
print "ARC"
else
print "ABC"
end | [
"call.add"
] | 419,011 | 419,009 | u569559028 | ruby |
p02687 | line = gets
if line == "ABC" then
print "ARC"
else
print "ABC"
end | line = gets
if line[1] == "B" then
print "ARC"
else
print "ABC"
end | [
"control_flow.branch.if.condition.change",
"literal.string.change"
] | 419,010 | 419,012 | u569559028 | ruby |
p02687 | line = gets
if line == "ABC" then
print "ARC"
else
print "ABC"
end | line = gets
if line[1] == "B" then
print "ARC"
else
print "ABC"
end | [
"control_flow.branch.if.condition.change",
"literal.string.change"
] | 419,011 | 419,012 | u569559028 | ruby |
p02688 | sunukes, k = gets.split.map(&:to_i)
ary = Array.new(sunukes) { 0 }
sunukes.times do |i|
len = gets.to_i
a = gets.split.map(&:to_i)
a.each do |el|
ary[el - 1] += 1
end
end
puts ary.filter{|el| el == 0 }.count | sunukes, k = gets.split.map(&:to_i)
ary = Array.new(sunukes) { 0 }
k.times do |i|
len = gets.to_i
a = gets.split.map(&:to_i)
a.each do |el|
ary[el - 1] += 1
end
end
puts ary.filter{|el| el == 0 }.count | [
"identifier.change"
] | 422,014 | 422,015 | u664737319 | ruby |
p02689 | cnt = 0
n, m = gets.chomp.split(" ").map{|i|i.to_i}
h = gets.chomp.split(" ").map{|i|i.to_i}
a=[]; b=[]
m.times do |i|
a[i], b[i] = gets.chomp.split(" ").map{|j|j.to_i}
end
max=Array.new(n+1, 0)
p max
0.upto(a.size-1) do |i|
max[a[i]] = [h[b[i]-1], max[a[i]]].max
max[b[i]] = [h[a[i]-1], max[b[i]]].max
end
1.upt... | cnt = 0
n, m = gets.chomp.split(" ").map{|i|i.to_i}
h = gets.chomp.split(" ").map{|i|i.to_i}
a=[]; b=[]
m.times do |i|
a[i], b[i] = gets.chomp.split(" ").map{|j|j.to_i}
end
max=Array.new(n+1, 0)
0.upto(a.size-1) do |i|
max[a[i]] = [h[b[i]-1], max[a[i]]].max
max[b[i]] = [h[a[i]-1], max[b[i]]].max
end
1.upto(n) d... | [
"call.remove"
] | 422,620 | 422,621 | u742129941 | ruby |
p02693 | #!/usr/bin/env ruby
N = gets.chomp.to_i
A,B = gets.split.map(&:to_i)
res = false
(A..B).each do |i|
if i % N == 0
res = true
break
end
end
puts res ? "Yes" : "No"
| #!/usr/bin/env ruby
N = gets.chomp.to_i
A,B = gets.split.map(&:to_i)
res = false
(A..B).each do |i|
if i % N == 0
res = true
break
end
end
puts res ? "OK" : "NG"
| [
"literal.string.change",
"call.arguments.change"
] | 433,366 | 433,367 | u305512012 | ruby |
p02693 | k = gets.to_i
a,b = gets.split.map(&:to_i)
num = 0
while (num <= b) do
if num % k == 0 && a <= num && num <= b
return puts "OK"
end
num += k
puts num
end
puts "NG" | k = gets.to_i
a,b = gets.split.map(&:to_i)
num = 0
while (num <= b) do
if num % k == 0 && a <= num && num <= b
return puts "OK"
end
num += k
end
puts "NG" | [
"call.remove"
] | 434,997 | 434,998 | u523351024 | ruby |
p02696 | A,B,N=$<.read.split.map(&:to_i)
if N < B
x = N
else
x = N/B - 1
end
ret = (A*x)/B - A*(x/B)
puts ret
| A,B,N=$<.read.split.map(&:to_i)
if N < B
x = N
else
x = N/B*B-1
end
ret = (A*x)/B - A*(x/B)
puts ret
| [
"assignment.change"
] | 444,619 | 444,620 | u852974293 | ruby |
p02699 | line = gets.split(' ').map(&:to_i)
ss = line[1]
ww = line[2]
if ss > ww then
answer = 'safe'
else
answer = 'unsafe'
end
print answer | line = gets.split(' ').map(&:to_i)
ss = line[0]
ww = line[1]
if ss > ww then
answer = 'safe'
else
answer = 'unsafe'
end
print answer | [
"assignment.add",
"assignment.remove"
] | 446,557 | 446,558 | u569559028 | ruby |
p02700 | a, b, c, d = gets.split(' ').map(&:to_i)
takahashi = c.quo(b).to_f.ceil
aoki = a.quo(d).to_f.ceil + 1
puts takahashi <= aoki ? 'Yes' : 'No' | a, b, c, d = gets.split(' ').map(&:to_i)
takahashi = c.quo(b).to_f.ceil
aoki = a.quo(d).to_f.ceil
puts takahashi <= aoki ? 'Yes' : 'No' | [
"expression.operation.binary.remove"
] | 451,491 | 451,492 | u308460366 | ruby |
p02705 | r = gets.to_i
puts r * Math::PI | r = gets.to_i
puts 2 * r * Math::PI
| [
"expression.operation.binary.add"
] | 458,242 | 458,243 | u437368899 | ruby |
p02706 | N, M = readline().split(' ').map(&:to_i)
A = readline().split(' ').map(&:to_i)
result = N - A.reduce(&:+)
if result > 0
puts result
else
puts -1
end
| N, M = readline().split(' ').map(&:to_i)
A = readline().split(' ').map(&:to_i)
result = N - A.reduce(&:+)
if result >= 0
puts result
else
puts -1
end
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 460,817 | 460,818 | u214887789 | ruby |
p02711 | input = gets
if input.include?("7")
puts "yes"
else
puts "no"
end | input = gets
if input.include?("7")
puts "Yes"
else
puts "No"
end | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 465,746 | 465,747 | u892327257 | ruby |
p02712 | #ABC162B_FizzBuzzSum.rb
n = gets.to_i
sum = 0
for i in 1 .. n
if i%3==0 || i%5==0
sum += i
end
end
p sum
| #ABC162B_FizzBuzzSum.rb
n = gets.to_i
sum = 0
for i in 1 .. n
unless i%3==0 || i%5==0
sum += i
end
end
p sum
| [] | 471,011 | 471,012 | u735997141 | ruby |
p02717 | line = gets
nums=line.chop.split(' ')
p("#{nums[2]} #{nums[0]} #{nums[1]}") | line = gets
nums=line.strip.split(' ')
puts "#{nums[2]} #{nums[0]} #{nums[1]}" | [
"assignment.value.change",
"identifier.change",
"call.function.change",
"io.output.change",
"call.arguments.change"
] | 480,639 | 480,640 | u262392777 | ruby |
p02717 | line = gets
nums=line.strip.split(' ')
p("#{nums[2]} #{nums[0]} #{nums[1]}") | line = gets
nums=line.strip.split(' ')
puts "#{nums[2]} #{nums[0]} #{nums[1]}" | [
"call.function.change",
"io.output.change",
"call.arguments.change"
] | 480,641 | 480,640 | u262392777 | ruby |
p02717 | line = gets
nums=line.split(' ')
p("#{nums[2]} #{nums[0]} #{nums[1]}") | line = gets
nums=line.strip.split(' ')
puts "#{nums[2]} #{nums[0]} #{nums[1]}" | [
"call.add",
"call.function.change",
"io.output.change",
"call.arguments.change"
] | 480,642 | 480,640 | u262392777 | ruby |
p02718 | input = gets.split(" ")
m = input[1].to_i
arr_tokuhyousuu = gets.split(" ").map(&:to_i)
soutouhyousuu = arr_tokuhyousuu.sum
cnt_select = 0
arr_tokuhyousuu.each do |tokuhyousuu|
if tokuhyousuu >= soutouhyousuu/(4*m)
cnt_select += 1
end
end
if cnt_select >= m
puts "Yes"
else
puts "No"
end
| input = gets.split(" ")
m = input[1].to_i
arr_tokuhyousuu = gets.split(" ").map(&:to_i)
soutouhyousuu = arr_tokuhyousuu.sum
cnt_select = 0
arr_tokuhyousuu.each do |tokuhyousuu|
if tokuhyousuu >= soutouhyousuu*1.0/(4*m)
cnt_select += 1
end
end
if cnt_select >= m
puts "Yes"
else
puts "No"
end | [
"control_flow.branch.if.condition.change"
] | 482,039 | 482,040 | u182277075 | ruby |
p02718 | n, m = gets.chomp.split(' ').map(&:to_i)
a = gets.chomp.split(' ').map(&:to_i)
border = a.reduce(:+) / (4 * m)
c = a.count{ |x| x >= border }
c >= m ? print('Yes') : print('No')
| n, m = gets.chomp.split(' ').map(&:to_i)
a = gets.chomp.split(' ').map(&:to_i)
border = (a.reduce(:+) / (4.0 * m)).ceil
c = a.count{ |x| x >= border }
c >= m ? print('Yes') : print('No')
| [
"assignment.value.change",
"expression.operation.binary.change",
"call.add"
] | 482,638 | 482,639 | u882179152 | ruby |
p02718 | n, m = gets.split(' ').map(&:to_i)
a = gets.split(' ').map(&:to_i)
sorted_a = a.sort.reverse
sum = a.inject(0) { |s, a_i| s + a_i }
print(sorted_a[m - 1] < (sum / (4 * m)) ? 'No' : 'Yes')
| _, m = gets.split(' ').map(&:to_i)
a = gets.split(' ').map(&:to_i)
sorted_a = a.sort.reverse
sum = a.inject(0) { |s, a_i| s + a_i }
print(sorted_a[m - 1] < (sum / (4 * m).to_f) ? 'No' : 'Yes')
| [
"assignment.variable.change",
"identifier.change",
"control_flow.branch.if.condition.change",
"call.add"
] | 487,493 | 487,494 | u387092823 | ruby |
p02718 | N, M = gets.chomp.split(' ').map(&:to_i)
A = gets.chomp.split(' ').map(&:to_i)
sum_a = A.inject(&:+)
A.sort! {|x,y| y<=>x}
puts A[M - 1] < sum_a / 4 / M ? 'No' : 'Yes'
| N, M = gets.chomp.split(' ').map(&:to_i)
A = gets.chomp.split(' ').map(&:to_i)
sum_a = A.inject(&:+)
A.sort! {|x,y| y<=>x}
puts A[M - 1] < sum_a / 4.0 / M ? 'No' : 'Yes'
| [
"control_flow.branch.if.condition.change"
] | 489,494 | 489,495 | u484832756 | ruby |
p02722 | require 'prime'
n = gets.to_i
ans = (n-1).prime_division.inject(1){|r, (_, v)| r * (v + 1)} - 1
n.prime_division.map do |k, v|
Array.new(v+1) {|i| k ** i}
end.inject(:product).map{|e| e.flatten.inject(:*)}.drop(1).each do |x|
y = n
y /= x while y % x == 0
ans += 1 if y % x == 1
end
puts ans | require 'prime'
n = gets.to_i
ans = (n-1).prime_division.inject(1){|r, (_, v)| r * (v + 1)} - 1
n.prime_division.map do |k, v|
Array.new(v+1) {|i| k ** i}
end.inject([1], :product).map{|e| e.flatten.inject(:*)}.drop(1).each do |x|
y = n
y /= x while y % x == 0
ans += 1 if y % x == 1
end
puts ans | [
"call.arguments.add"
] | 493,973 | 493,974 | u692254521 | ruby |
p02722 | require 'prime'
n = gets.to_i
ans = (n-1).prime_division.inject(1){|r, (_, v)| r * (v + 1)} - 1
n.prime_division.map do |k, v|
Array.new(v+1) {|i| k ** i}
end.inject(:product).map{|e| e.inject(:*)}.drop(1).each do |x|
y = n
y /= x while y % x == 0
ans += 1 if y % x == 1
end
puts ans | require 'prime'
n = gets.to_i
ans = (n-1).prime_division.inject(1){|r, (_, v)| r * (v + 1)} - 1
n.prime_division.map do |k, v|
Array.new(v+1) {|i| k ** i}
end.inject([1], :product).map{|e| e.flatten.inject(:*)}.drop(1).each do |x|
y = n
y /= x while y % x == 0
ans += 1 if y % x == 1
end
puts ans | [
"call.arguments.add",
"call.add"
] | 493,975 | 493,974 | u692254521 | ruby |
p02724 | x = gets.to_i
score = 0
score += x/500 * 1000
x = x/500
score += x/5 * 5
puts score | x = gets.to_i
score = 0
score += x/500 * 1000
x -= x/500 * 500
score += x/5 * 5
puts score | [
"assignment.value.change"
] | 497,192 | 497,193 | u358554431 | ruby |
p02725 | K, N = gets.split(" ").map(&:to_i)
A = gets.split(" ").map(&:to_i)
t = 0
max = 0
A.each_with_index{|v,i|
if i == 0
r = K - A[N-1] + v
else
r = v - t
t = v
end
if max < r
max = r
end
}
puts K - max | K, N = gets.split(" ").map(&:to_i)
A = gets.split(" ").map(&:to_i)
t = 0
max = 0
A.each_with_index{|v,i|
if i == 0
r = K - A[N-1] + v
else
r = v - t
end
t = v
if max < r
max = r
end
}
puts K - max | [] | 501,129 | 501,130 | u039504682 | ruby |
p02726 | N, X, Y = gets.split.map(&:to_i)
ans = [0] * (N - 1)
1.upto(N - 1) do |i|
(i + 1).upto(N) do |j|
l1 = (j - i).abs
l2 = (X - i).abs + 1 + (Y - j).abs
l3 = (X - j).abs + 1 + (Y - j).abs
min = [l1, l2, l3].min
ans[min - 1] += 1
end
end
puts ans.join("\n") | N, X, Y = gets.split.map(&:to_i)
ans = [0] * (N - 1)
1.upto(N - 1) do |i|
(i + 1).upto(N) do |j|
l1 = (j - i).abs
l2 = (X - i).abs + 1 + (Y - j).abs
l3 = (X - j).abs + 1 + (Y - i).abs
min = [l1, l2, l3].min
ans[min - 1] += 1
end
end
puts ans.join("\n") | [
"assignment.value.change",
"identifier.change",
"expression.operation.binary.change"
] | 502,286 | 502,287 | u039293076 | ruby |
p02730 | s = gets.chomp.split("").map(&:to_s);
sl=s.length
ans = "Yes"
ck1 = s.slice(0..(sl/2)-1)
ck2 = s.slice(((sl/2)+1)..sl-1).reverse
if (ck1!=ck2) then
ans = "No"
end
#check2
s2 = s.slice(0..(sl/2)-1)
s2l=s2.length
if s2l%2==0 then
ck3 = s2.slice(0..(s2l/2))
ck4 = s2.reverse.slice(0..(s2l/2))
if ck3 != ck4 then
... | s = gets.chomp.split("").map(&:to_s);
sl=s.length
ans = "Yes"
ck1 = s.slice(0..(sl/2)-1)
ck2 = s.slice(((sl/2)+1)..sl-1).reverse
if (ck1!=ck2) then
ans = "No"
end
#check2
s2 = s.slice(0..(sl/2)-1)
s2l=s2.length
if s2l%2==0 then
ck3 = s2.slice(0..(s2l/2))
ck4 = s2.reverse.slice(0..(s2l/2))
if ck3 != ck4 then
... | [
"assignment.value.change",
"identifier.change"
] | 506,312 | 506,313 | u663882298 | ruby |
p02731 | l = gets.strip.to_f
puts (l/3.to_f)^3
| l = gets.strip.to_f
puts (l/3.to_f)**3
| [
"call.arguments.change",
"expression.operation.binary.change"
] | 508,803 | 508,804 | u811445854 | ruby |
p02732 | n = gets.to_i
a = gets.split.map(&:to_i)
h = a.group_by(&:itself).map{|k,v| [k, v.count]}.to_h
total = h.values.map{|i| i*(i-1)/2}.inject(:+)
a.each{|ai|
hi = h[ai]
p hi==1 ? 0 : total - hi*(hi-1)/2 + (hi-1)*(hi-2)/2
}
| n = gets.to_i
a = gets.split.map(&:to_i)
h = a.group_by(&:itself).map{|k,v| [k, v.count]}.to_h
total = h.values.map{|i| i*(i-1)/2}.inject(:+)
a.each{|ai|
hi = h[ai]
p hi==1 ? total : total - hi*(hi-1)/2 + (hi-1)*(hi-2)/2
}
| [
"identifier.replace.add",
"literal.replace.remove",
"call.arguments.change"
] | 514,516 | 514,517 | u679291177 | ruby |
p02741 | s = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
puts s[gets.to_i] | s = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
puts s[gets.to_i - 1] | [
"expression.operation.binary.add"
] | 518,425 | 518,426 | u056083754 | ruby |
p02747 | 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... | 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... | [
"control_flow.branch.if.condition.change"
] | 526,555 | 526,556 | u415400221 | ruby |
p02748 | a,b,m = gets.split.map(&:to_i)
list_a = gets.split.map(&:to_i)
list_b = gets.split.map(&:to_i)
discount = []
m.times { discount << gets.split.map(&:to_i) }
min = list_a.min + list_b.min
discount.each do |ia,ib,d|
min = [min,list_a[ia-1] + list_a[ib-1] - d].min
end
puts min
| _,_,m = gets.split.map(&:to_i)
list_a = gets.split.map(&:to_i)
list_b = gets.split.map(&:to_i)
discount = []
m.times { discount << gets.split.map(&:to_i) }
min = list_a.min + list_b.min
discount.each do |ia,ib,d|
min = [min,list_a[ia-1] + list_b[ib-1] - d].min
end
puts min
| [
"assignment.variable.change",
"identifier.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 526,884 | 526,885 | u966810027 | ruby |
p02753 | stations = gets
puts stations == "AAA" || stations == "BBB" ? "No" : "Yes" | stations = gets.chomp
puts stations == "AAA" || stations == "BBB" ? "No" : "Yes" | [
"call.add"
] | 529,429 | 529,430 | u965436898 | ruby |
p02753 | S = gets
if S == "AAA" || S == "BBB"
puts "No"
else
puts "Yes"
end | S = gets.chomp
if S == "AAA" || S == "BBB"
puts "No"
else
puts "Yes"
end | [
"call.add"
] | 529,792 | 529,793 | u890342277 | ruby |
p02753 | s = gets.chomp
puts (s == 'AAA' || s == 'BBB') ? 'NO' : 'YES'
| s = gets.chomp
puts (s == 'AAA' || s == 'BBB') ? 'No' : 'Yes'
| [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 531,157 | 531,158 | u757358412 | ruby |
p02755 | def price_list(number, tax)
(1..100).map do |i|
i if (tax * i).floor == number
end.compact
end
a, b = gets.split(' ').map(&:to_i)
a_result = price_list(a, 0.08)
b_result = price_list(b, 0.10)
result = a_result & b_result
if result.empty? then
puts '-1'
else
puts result.min
end | def price_list(number, tax)
(1..1000).map do |i|
i if (tax * i).floor == number
end.compact
end
a, b = gets.split(' ').map(&:to_i)
a_result = price_list(a, 0.08)
b_result = price_list(b, 0.10)
result = a_result & b_result
if result.empty? then
puts '-1'
else
puts result.min
end | [
"literal.number.integer.change"
] | 539,649 | 539,650 | u025803699 | ruby |
p02755 | def price_list(number, tax)
(1..100).map do |i|
i if (tax * i).floor == number
end.compact
end
a, b = gets.split(' ').map(&:to_i)
a_result = price_list(a, 0.08)
b_result = price_list(b, 0.10)
result = a_result & b_result
if result.empty? then
puts -1
else
puts result.min
end | def price_list(number, tax)
(1..1000).map do |i|
i if (tax * i).floor == number
end.compact
end
a, b = gets.split(' ').map(&:to_i)
a_result = price_list(a, 0.08)
b_result = price_list(b, 0.10)
result = a_result & b_result
if result.empty? then
puts '-1'
else
puts result.min
end | [
"literal.number.integer.change",
"call.arguments.change"
] | 539,651 | 539,650 | u025803699 | ruby |
p02755 | a,b=gets.split.map(&:to_i)
puts (1000.times.find{|x|x=x.succ; (x*1.08).to_i == a && (x*1.10).to_i == b} || -2)+1 | a,b=gets.split.map(&:to_i)
puts (1000.times.find{|x|x=x.succ; (x*0.08).to_i == a && (x*0.10).to_i == b} || -2)+1
| [
"literal.number.float.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 540,069 | 540,070 | u056944756 | ruby |
p02756 | s = gets.chomp.split("")
q = gets.to_i
arr = Array.new
while line = $stdin.gets
arr << line.chomp.split(" ")
end
t = 0
arr.each{|item|
if item[0] == "1"
t +=1
else
if (item[1].to_i + t )%2 == 1 then
s.unshift(item[2])
else
s.push(item[2])
end
end
}
p s... | s = gets.chomp.split("")
q = gets.to_i
arr = Array.new
while line = $stdin.gets
arr << line.chomp.split(" ")
end
t = 0
arr.each{|item|
if item[0] == "1"
t +=1
else
if (item[1].to_i + t )%2 == 1 then
s.unshift(item[2])
else
s.push(item[2])
end
end
}
if ... | [
"call.remove"
] | 542,082 | 542,083 | u312004378 | ruby |
p02759 | n=gets.to_i
ans=(n/2).round
puts ans
| n=gets.to_f
ans=(n/2).round
puts ans
| [
"call.function.change",
"type_conversion.to_float.change",
"type_conversion.to_number.change"
] | 544,591 | 544,592 | u977506075 | ruby |
p02759 | n=gets.to_i
ans=(n/2+0.5).round
puts ans
| n=gets.to_f
ans=(n/2).round
puts ans
| [
"call.function.change",
"type_conversion.to_float.change",
"type_conversion.to_number.change",
"expression.operation.binary.remove"
] | 544,593 | 544,592 | u977506075 | ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.