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 |
|---|---|---|---|---|---|---|---|
p02623 | N, M, k = gets.split.map &:to_i
A = gets.split.map &:to_i
B = gets.split.map &:to_i
ans = 0
current = 0
idx_a = 0
idx_b = 0
while A[idx_a] && k >= A[idx_a]
k -= A[idx_a]
current += 1
idx_a += 1
end
ans = current
while B[idx_b]
k -= B[idx_b]
current += 1
while k < 0 && idx_a >= 0
idx_a -= 1
k += A[idx_a]
current -= 1
end
break if k < 0
ans = current if current > ans
idx_b += 1
end
p ans | N, M, k = gets.split.map &:to_i
A = gets.split.map &:to_i
B = gets.split.map &:to_i
ans = 0
current = 0
idx_a = 0
idx_b = 0
while A[idx_a] && k >= A[idx_a]
k -= A[idx_a]
current += 1
idx_a += 1
end
ans = current
while B[idx_b]
k -= B[idx_b]
current += 1
while k < 0 && idx_a >= 1
idx_a -= 1
k += A[idx_a]
current -= 1
end
break if k < 0
ans = current if current > ans
idx_b += 1
end
p ans | [
"literal.number.integer.change",
"expression.operation.binary.change"
] | 334,270 | 334,271 | u655122274 | 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)
tt = 0
ia = 0
ib = 0
A.each do |a|
break if tt + a > K
tt += a
ia += 1
end
B.each do |b|
break if tt + b > K
tt += b
ib += 1
end
max_n = ia + ib
while ia >= 0
ia -= 1
tt -= A[ia] if A[ia]
loop do
break if !B[ib] || tt + B[ib] > K
tt += B[ib]
ib += 1
end
max_n = ia + ib if max_n < ia + ib
end
puts max_n
| N, M, K = gets.chomp.split(" ").map(&:to_i)
A = gets.chomp.split(" ").map(&:to_i)
B = gets.chomp.split(" ").map(&:to_i)
tt = 0
ia = 0
ib = 0
A.each do |a|
break if tt + a > K
tt += a
ia += 1
end
B.each do |b|
break if tt + b > K
tt += b
ib += 1
end
max_n = ia + ib
while ia > 0
ia -= 1
tt -= A[ia]
loop do
break if !B[ib] || tt + B[ib] > K
tt += B[ib]
ib += 1
end
max_n = ia + ib if max_n < ia + ib
end
puts max_n
| [
"expression.operator.compare.change",
"expression.operation.binary.change"
] | 334,328 | 334,329 | u443924743 | ruby |
p02618 | D = gets.to_i
C,*S = (0..D).map{gets.split.map &:to_i}
L,M,N = [-1]*27,2,10
1 < (I=(0..25).select{C[_1]==0}).size and S.each {|s;z|
I.each {|i| if i!=(z||=i); s[z]<s[i] ? z = i+s[z]=0 : s[i]=0 end }
}
def calc(d,n)
s,x = S[d],0
n = D-d if n > D-d
t = (0..25).map { C[_1]*(d-L[_1])*n+s[_1] }
i = (0..25).max_by(n){t[_1]}
i = n==1 ? i[0] : [i[0],i[n/2+1]].max_by {|i|
l,L[i] = L[i],d
c = t[i] + (calc(d+1,n-1) >> 5)
L[i] = l
x < c ? x=c : c
}
((x>0 ? x : t[i]) << 5) + i
end
D.times { p 1 + i=calc(_1,N)&31; L[i]=_1 } | D = gets.to_i
C,*S = (0..D).map{gets.split.map &:to_i}
L,M,N = [-1]*27,2,10
1 < (I=(0..25).select{C[_1]==0}).size and S.each {|s;z|
I.each {|i| if i!=(z||=i); s[z]<s[i] ? z = i+s[z]=0 : s[i]=0 end }
}
def calc(d,n)
s,x = S[d],0
n = D-d if n > D-d
t = (0..25).map { C[_1]*(d-L[_1])*n+s[_1] }
i = (0..25).max_by(n){t[_1]}
i = n==1 ? i[0] : [i[0],i[(n+1)/3]].max_by {|i|
l,L[i] = L[i],d
c = t[i] + (calc(d+1,n-1) >> 5)
L[i] = l
x < c ? x=c : c
}
((x>0 ? x : t[i]) << 5) + i
end
D.times { p 1 + i=calc(_1,N)&31; L[i]=_1 } | [
"expression.operation.binary.remove"
] | 334,975 | 334,976 | u720281401 | ruby |
p02618 | D = gets.to_i
C,*S = (0..D).map{gets.split.map &:to_i}
L,M,N = [-1]*27,2,10
1 < (I=(0..25).select{C[_1]==0}).size and S.each {|s;z|
I.each {|i| if i!=(z||=i); s[z]<s[i] ? z = i+s[z]=0 : s[i]=0 end }
}
def calc(d,n)
s,x = S[d],0
n = D-d if n > D-d
t = (0..25).map { C[_1]*(d-L[_1])*n+s[_1] }
i = (0..25).max_by(n){t[_1]}
i = n==1 ? i[0] : [i[0],i[n/2+1]].max_by {|i|
l,L[i] = L[i],d
c = t[i] + (calc(d+1,n-1) >> 5)
L[i] = l
x < c ? x=c : c
}
((x>0 ? x : t[i]) << 5) + i
end
D.times { p 1 + i=calc(_1,N)&31; L[i]=_1 } | D = gets.to_i
C,*S = (0..D).map{gets.split.map &:to_i}
L,M,N = [-1]*27,2,10
1 < (I=(0..25).select{C[_1]==0}).size and S.each {|s;z|
I.each {|i| if i!=(z||=i); s[z]<s[i] ? z = i+s[z]=0 : s[i]=0 end }
}
def calc(d,n)
s,x = S[d],0
n = D-d if n > D-d
t = (0..25).map { C[_1]*(d-L[_1])*n+s[_1] }
i = (0..25).max_by(n){t[_1]}
i = n==1 ? i[0] : [i[0],i[n>>1]].max_by {|i|
l,L[i] = L[i],d
c = t[i] + (calc(d+1,n-1) >> 5)
L[i] = l
x < c ? x=c : c
}
((x>0 ? x : t[i]) << 5) + i
end
D.times { p 1 + i=calc(_1,N)&31; L[i]=_1 } | [
"assignment.value.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change",
"expression.operation.binary.remove"
] | 334,975 | 334,977 | u720281401 | ruby |
p02618 | F =->{_1.split.map &:to_i}
D = gets.to_i
C,*S = (0..D).map{F[gets]}
d,*L = [D]*27
A = []
until 0 > d-=1
s = S[d]
i,m = -1,-(1<<60)
26.times {|j|
n = s[j] - C[j]*(L[j]-d)
(i=j;m=n) if m<n
}
L[i] = d
A << i
end
A.reverse_each {p _1} | F =->{_1.split.map &:to_i}
D = gets.to_i
C,*S = (0..D).map{F[gets]}
d,*L = [D]*27
A = []
until 0 > d-=1
s = S[d]
i,m = -1, -(1<<60)
26.times {|j|
n = s[j] - C[j]*(L[j]-d)
(i=j;m=n) if m<n
}
L[i] = d
A << i
end
A.reverse_each {p _1+1} | [
"expression.operation.binary.add"
] | 334,987 | 334,988 | u720281401 | ruby |
p02618 | D = gets.to_i
C = gets.chomp.split.map(&:to_i)
s = D.times.map{gets.split.map(&:to_i)}
c = Array.new(26, 0)
t = []
(0..D-1).each do |i|
ans = 0
boder = s[i][0]+c[0]
(0..25).each do |l|
c[l] += C[l]
end
(1..25).each do |e|
if s[i][e]+c[e] >= boder
ans = e
boder = s[i][e]+c[e]
end
end
c[ans] = 0
t << ans+1
last = boder
end
| D = gets.to_i
C = gets.chomp.split.map(&:to_i)
s = D.times.map{gets.split.map(&:to_i)}
c = Array.new(26, 0)
t = []
(0..D-1).each do |i|
ans = 0
boder = s[i][0]+c[0]
(0..25).each do |l|
c[l] += C[l]
end
(1..25).each do |e|
if s[i][e]+c[e] >= boder
ans = e
boder = s[i][e]+c[e]
end
end
c[ans] = 0
puts ans+1
last = boder
end
| [
"expression.operation.binary.change"
] | 335,050 | 335,051 | u032624914 | ruby |
p02623 | # n + 1 長の array を返す
def cumulative_sum(array)
tmp = [0]
previous = 0
array.each { |num| tmp << previous += num }
tmp
end
n, m, k = gets.split.map(&:to_i)
books_1 = gets.split.map(&:to_i)
cumulative_books_1 = cumulative_sum(books_1)
books_2 = gets.split.map(&:to_i)
cumulative_books_2 = cumulative_sum(books_2)
ans = [0]
(1..n).each do |first|
rest = k - cumulative_books_1[first]
break if rest < 0
sec = cumulative_books_2.bsearch_index { |second| rest - second < 0 }
sec = m + 1 if sec == nil
sec -= 1
ans << first + sec
end
puts ans.max
| # n + 1 長の array を返す
def cumulative_sum(array)
tmp = [0]
previous = 0
array.each { |num| tmp << previous += num }
tmp
end
n, m, k = gets.split.map(&:to_i)
books_1 = gets.split.map(&:to_i)
cumulative_books_1 = cumulative_sum(books_1)
books_2 = gets.split.map(&:to_i)
cumulative_books_2 = cumulative_sum(books_2)
ans = [0]
(0..n).each do |first|
rest = k - cumulative_books_1[first]
break if rest < 0
sec = cumulative_books_2.bsearch_index { |second| rest - second < 0 }
sec = m + 1 if sec == nil
sec -= 1
ans << first + sec
end
puts ans.max
| [
"literal.number.integer.change"
] | 335,642 | 335,643 | u653737129 | ruby |
p02627 | x = gets.chomp
if x == x.upcase
puts "a"
else
puts "A"
end
| x = gets.chomp
if x == x.upcase
puts "A"
else
puts "a"
end
| [
"call.remove",
"call.add"
] | 337,081 | 337,082 | u529683866 | ruby |
p02627 | puts (gets[0].match?(/a-z/) ? :a : :A) | puts (gets[0].match?(/[a-z]/) ? :a : :A) | [
"control_flow.branch.if.condition.change"
] | 337,294 | 337,295 | u306155637 | ruby |
p02627 | p (gets[0].match?(/a-z/) ? :a : :A) | puts (gets[0].match?(/[a-z]/) ? :a : :A) | [
"call.function.change",
"io.output.change",
"control_flow.branch.if.condition.change"
] | 337,296 | 337,295 | u306155637 | ruby |
p02627 | s = gets.chomp
if (s =~ /^[a-z]+$/) == 0
p 'a'
else
p 'A'
end
| s = gets.chomp
if (s =~ /^[a-z]+$/) == 0
print 'a'
else
print 'A'
end
| [
"call.function.change",
"io.output.change"
] | 337,774 | 337,775 | u818540048 | ruby |
p02627 | a = gets.to_s
if [*'a'..'z'].include? a
puts 'a'
else
puts 'A'
end
| a = gets.to_s.chomp
if [*'A'..'Z'].include? a
puts 'A'
else
puts 'a'
end
| [
"call.add",
"literal.string.change",
"literal.string.case.change",
"control_flow.branch.if.condition.change",
"call.arguments.change"
] | 337,979 | 337,980 | u602384426 | ruby |
p02627 | a = gets.to_s
if [*'a'..'z'].include? a
puts 'a'
else
puts 'A'
end | a = gets.to_s.chomp
if [*'A'..'Z'].include? a
puts 'A'
else
puts 'a'
end
| [
"call.add",
"literal.string.change",
"literal.string.case.change",
"control_flow.branch.if.condition.change",
"call.arguments.change"
] | 337,981 | 337,980 | u602384426 | ruby |
p02627 | x = gets
if x == x.upcase
p 'A'
else
p 'a'
end | x = gets
if x == x.upcase
puts "A"
else
puts "a"
end | [
"literal.string.change",
"call.arguments.change"
] | 338,000 | 338,001 | u565580226 | ruby |
p02627 | inpt = gets.chomp.to_s
if /[a-z]/.match(inpt)
print a
else
print A
end | inpt = gets.chomp.to_s
if /[a-z]/.match(inpt)
print "a"
else
print "A"
end | [
"call.arguments.change"
] | 338,076 | 338,077 | u731036814 | ruby |
p02627 | inpt = gets.chomp.to_s
if /[a-z]/.match(inpt)
print inpt.downcase
else
print inpt.upcase
end | inpt = gets.chomp.to_s
if /[a-z]/.match(inpt)
print "a"
else
print "A"
end | [] | 338,078 | 338,077 | u731036814 | ruby |
p02627 | inpt = gets.chomp.to_s
if /[a-z]/.match(inpt)
print inpt.upcase
else
print inpt.downcase
end | inpt = gets.chomp.to_s
if /[a-z]/.match(inpt)
print "a"
else
print "A"
end | [] | 338,079 | 338,077 | u731036814 | ruby |
p02627 | a = gets
a_up = a.upcase
a_down = a.downcase
if a == a_up then
puts a_up
else
puts a_down
end
| a = gets
a_up = a.upcase
a_down = a.downcase
if a == a_up then
puts "A"
else
puts "a"
end | [
"call.arguments.change"
] | 338,136 | 338,137 | u138058826 | ruby |
p02627 | st = gets.strip
if st == st.upcase
puts "A"
else
puts "B"
end | st = gets.strip
if st == st.upcase
puts "A"
else
puts "a"
end | [
"literal.string.change",
"call.arguments.change"
] | 338,171 | 338,172 | u207607938 | ruby |
p02627 | c = gets.to_s
if c >= 'a' && c<= 'z'
print 'a'
else
print 'A'
end | c = gets.chomp.to_s
if c >= 'a' && c <= 'z'
print 'a'
else
print 'A'
end | [
"call.add"
] | 338,254 | 338,255 | u896269838 | ruby |
p02627 | alpha = gets.chomp
puts(alpha.match?(/[A-Z]/) ? "A" : "b")
| alpha = gets.chomp
puts(alpha.match?(/[A-Z]/) ? "A" : "a")
| [
"literal.string.change",
"call.arguments.change"
] | 338,284 | 338,285 | u453682522 | ruby |
p02627 | S = gets.chomp
print S.scan(/[A-Z]/) ? "A" : "a" | S = gets.chomp
print S =~ /^[A-Z]/ ? "A" : "a" | [
"control_flow.branch.if.condition.change"
] | 338,329 | 338,330 | u011809316 | ruby |
p02627 | N = gets.to_s
p 'A' if N =~ /[A-Z]/
p 'a' if N =~ /[a-z]/
| N = gets.to_s
puts 'A' if N =~ /[A-Z]/
puts 'a' if N =~ /[a-z]/
| [
"call.function.change",
"io.output.change"
] | 338,378 | 338,379 | u966810027 | ruby |
p02627 | s = gets.chomp
if s.match(/[A-Z]/)
puts 'a'
else
puts 'A'
end | s = gets.chomp
if s.match(/[A-Z]/)
puts 'A'
else
puts 'a'
end | [
"call.remove",
"call.add"
] | 338,388 | 338,389 | u392423112 | ruby |
p02627 | a = gets.chomp
if a =~ /[a-z]/
puts a.upcase
else
puts a.downcase
end
| a = gets.chomp
if a =~ /[a-z]/
puts "a"
else
puts "A"
end
| [
"call.arguments.change",
"io.output.change"
] | 338,676 | 338,677 | u810064020 | ruby |
p02628 | N, K = gets.chomp.split.map(&:to_i)
array = gets.chomp.split.map(&:to_i)
a = array.sort
ans = 0
a.each_with_index do |n, idx|
if idx <= 2
ans += n
end
end
puts ans
| N, K = gets.chomp.split.map(&:to_i)
array = gets.chomp.split.map(&:to_i)
a = array.sort
ans = 0
a.each_with_index do |n, idx|
if idx < K
ans += n
end
end
puts ans
| [] | 338,922 | 338,923 | u641383521 | ruby |
p02628 | def main(str)
lines = str.split("\n")
_, k = lines[0].split(" ").map(&:to_i)
ps = lines[1].split(" ").map(&:to_i)
ps.sort[0...k].sum.to_s
end
unless ENV["TEST"]
main($stdin.read.chomp)
exit(0)
end
require 'minitest/autorun'
class TestA < Minitest::Test
def test_main
assert_equal("210", main("5 3
50 100 80 120 80"))
# assert_equal("", main(""))
end
end
| def main(str)
lines = str.split("\n")
_, k = lines[0].split(" ").map(&:to_i)
ps = lines[1].split(" ").map(&:to_i)
ps.sort[0...k].sum.to_s
end
unless ENV["TEST"]
puts(main($stdin.read.chomp))
exit(0)
end
require 'minitest/autorun'
class TestA < Minitest::Test
def test_main
assert_equal("210", main("5 3
50 100 80 120 80"))
# assert_equal("", main(""))
end
end
| [
"call.add",
"call.arguments.change"
] | 338,961 | 338,962 | u715816272 | ruby |
p02628 | N,K = gets.split(" ").map(&:to_i)
P = gets.split(" ").map(&:to_i)
p = P.sort
k = 0
N.times{|i|
k = k + p[i]
}
puts k | N,K = gets.split(" ").map(&:to_i)
P = gets.split(" ").map(&:to_i)
p = P.sort
n = 0
K.times{|i|
n = n + p[i]
}
puts n | [
"assignment.variable.change",
"identifier.change",
"assignment.value.change",
"expression.operation.binary.change",
"call.arguments.change"
] | 339,549 | 339,550 | u039504682 | ruby |
p02629 | n = gets.to_i - 1
name = ""
alpha = ("a".."z").to_a
while n >= 0
p n
name = alpha[(n) % 26] + name
n = n / 26 - 1
end
p n
puts name
| n = gets.to_i - 1
name = ""
alpha = ("a".."z").to_a
while n >= 0
name = alpha[(n) % 26] + name
n = n / 26 - 1
end
puts name
| [
"call.remove"
] | 339,811 | 339,812 | u771770008 | ruby |
p02629 | n = gets.to_i - 1
name = ""
alpha = ("a".."z").to_a
while n > 0
name = alpha[(n) % 26] + name
n = n / 26 - 1
end
puts name
| n = gets.to_i - 1
name = ""
alpha = ("a".."z").to_a
while n >= 0
name = alpha[(n) % 26] + name
n = n / 26 - 1
end
puts name
| [
"expression.operator.compare.change",
"expression.operation.binary.change"
] | 339,813 | 339,812 | u771770008 | ruby |
p02629 | n = gets.to_i
alpha = ('a'..'z').to_a
name = []
while n / 26 >= 0
name << alpha[(n % 26)-1]
break if n / 26 == 0
n /= 26
end
puts name.reverse.join | n = gets.to_i
alpha = ('a'..'z').to_a
name = []
while n / 26 >= 0
n -= 1
name << alpha[(n % 26)]
break if n / 26 == 0
n /= 26
end
puts name.reverse.join | [
"expression.operation.binary.remove"
] | 340,039 | 340,040 | u318122299 | ruby |
p02629 | no = gets.to_i
name = ''
while no > 0 do
div, mod = no.divmod(26)
if mod.zero?
div -= 1
mod = 26
end
name = ('a'.ord - 1 + mod).chr + name
no = div
end
puts name.reverse
| no = gets.to_i
name = ''
while no > 0 do
div, mod = no.divmod(26)
if mod.zero?
div -= 1
mod = 26
end
name = ('a'.ord - 1 + mod).chr + name
no = div
end
puts name
| [
"call.remove"
] | 340,297 | 340,298 | u663855777 | ruby |
p02629 | n = gets.to_i
str = 'abcdefghijklmnopqrstuvwxyz'
result = ''
while n > 0
div, mod = n.divmod(26)
p [div, mod]
result = str[mod - 1] + result
n = (div - (mod == 0 ? 1 : 0))
end
puts result | n = gets.to_i
str = 'abcdefghijklmnopqrstuvwxyz'
result = ''
while n > 0
div, mod = n.divmod(26)
result = str[mod - 1] + result
n = (div - (mod == 0 ? 1 : 0))
end
puts result | [
"call.remove"
] | 340,438 | 340,439 | u004919448 | ruby |
p02629 | x = gets.to_i
alf = []
ans = []
for i in "a".."z"
alf.push(i)
end
loop {
x = x - 1
shou = x / 26
amari = x % 26
ans.push(alf[amari])
x = shou
if x == 0
break
end
}
p ans.reverse.join | x = gets.to_i
alf = []
ans = []
for i in "a".."z"
alf.push(i)
end
loop {
x = x - 1
shou = x / 26
amari = x % 26
ans.push(alf[amari])
x = shou
if x == 0
break
end
}
puts ans.reverse.join
| [
"call.function.change",
"io.output.change"
] | 340,582 | 340,583 | u138058826 | ruby |
p02629 | # frozen_string_literal: true
a = [*'a'..'z']
n = gets.to_i
res = []
loop do
res << a[n % 26 - 1]
n /= 26
break if n == 0
end
puts res.reverse.join
| # frozen_string_literal: true
a = [*'a'..'z']
n = gets.to_i
res = []
loop do
n -= 1
res << a[n % 26]
n /= 26
break if n == 0
end
puts res.reverse.join
| [
"expression.operation.binary.remove"
] | 340,948 | 340,949 | u326440422 | ruby |
p02629 | n = gets.to_i
s = []
while n > 0
s.unshift ("a".."z").to_a[n%26-1]
n /= 26
end
puts s*'' | n = gets.to_i
s = []
while n > 0
n -= 1
s.unshift ("a".."z").to_a[n%26]
n /= 26
end
puts s*'' | [
"expression.operation.binary.remove"
] | 341,149 | 341,150 | u207607938 | ruby |
p02629 | n = gets.to_i - 1
answer = ''
chars = ('a'..'z').to_a
loop do
mod = n % chars.size
answer << chars[mod]
n /= chars.size
break if n <= 0
end
puts answer.reverse
| n = gets.to_i
answer = ''
chars = ('a'..'z').to_a
loop do
n -= 1
mod = n % chars.size
answer << chars[mod]
n /= chars.size
break if n <= 0
end
puts answer.reverse
| [
"expression.operation.binary.remove"
] | 341,279 | 341,280 | u158406393 | ruby |
p02629 | n=gets.to_i
alp=[*"a".."z"]
res=[]
mod=26
while n>0
n -= 1
res << alp[n%mod]
n /= mod
end
puts res.join | n=gets.to_i
alp=[*"a".."z"]
res=[]
mod=26
while n>0
n -= 1
res << alp[n%mod]
n /= mod
end
puts res.reverse.join | [
"call.add"
] | 341,352 | 341,353 | u128694188 | ruby |
p02629 | n=gets.to_i
a=[*'a'..'z']
res= ''
while n > 0
n-=1
res += a[N%26]
n/=26
end
puts res | n=gets.to_i
a=[*'a'..'z']
res= ''
while n > 0
n-=1
res += a[n%26]
n/=26
end
puts res.reverse
| [
"variable_access.subscript.index.change",
"expression.operation.binary.change",
"call.add"
] | 341,599 | 341,600 | u630043039 | ruby |
p02629 | n = gets.to_i
rsl = []
neko = n
while neko > 0 do
neko = neko - 1
waruneko = neko % 26
rsl << ('a'.ord + waruneko).chr
neko = neko / 26
end
puts rsl.join('') | n = gets.to_i
rsl = []
neko = n
while neko > 0 do
neko = neko - 1
waruneko = neko % 26
rsl << ('a'.ord + waruneko).chr
neko = neko / 26
end
puts rsl.reverse.join('') | [
"call.add"
] | 341,905 | 341,906 | u413815532 | ruby |
p02629 | n = gets.to_i
a = ""
i = 1
j = 1
while n > j
x = n-j
a += ((x/(26**(i-1))) % 26 +97).chr
j += 26**i
i += 1
end
if n == 1
puts "a"
else
puts a.reverse
end | n = gets.to_i
a = ""
i = 1
j = 1
while n >= j
x = n-j
a += ((x/(26**(i-1))) % 26 +97).chr
j += 26**i
i += 1
end
if n == 1
puts "a"
else
puts a.reverse
end | [
"expression.operator.compare.change",
"expression.operation.binary.change"
] | 341,938 | 341,939 | u911373146 | ruby |
p02629 | n = gets.to_i
map = {}
('a'..'y').to_a.each_with_index do |alp, i|
map[i + 1] = alp
end
map[0] = 'z'
ans = ''
loop do
ans = map[n % 26] + ans
n -= 1 if n % 26 == 0
n /= 26
break if n == 0
end
| n = gets.to_i
map = {}
('a'..'y').to_a.each_with_index do |alp, i|
map[i + 1] = alp
end
map[0] = 'z'
ans = ''
loop do
ans = map[n % 26] + ans
n -= 1 if n % 26 == 0
n /= 26
break if n == 0
end
puts ans
| [
"call.add"
] | 342,004 | 342,005 | u393913844 | ruby |
p02629 | #!/usr/bin/env ruby
n = gets.chomp.to_i
s = ''
loop do
s = s + (n % 26 + 'a'.ord - 1).chr.to_s
n = n / 26
break if n == 0
end
puts s.reverse | #!/usr/bin/env ruby
n = gets.chomp.to_i
s = ''
loop do
n -= 1
s = s + (n % 26 + 'a'.ord).chr.to_s
n = n / 26
break if n == 0
end
puts s.reverse | [
"expression.operation.binary.remove"
] | 342,159 | 342,160 | u305512012 | ruby |
p02629 | n = gets.to_i
s = ""
a = ['z'] + ('a'..'z').to_a
while n > 0
x = n % 26
n = n / 26
s += a[x]
n -= 1 if x == 0
end
puts s | n = gets.to_i
s = ""
a = ['z'] + ('a'..'z').to_a
while n > 0
x = n % 26
n = n / 26
s += a[x]
n -= 1 if x == 0
end
puts s.reverse | [
"call.add"
] | 342,224 | 342,225 | u843127718 | ruby |
p02629 | n = $stdin.gets.chomp.to_i
alp = "abcdefghijklmnopqrstuvwz".split('')
ans = ""
while true do
kotae = n.divmod(26) #商,あまりの順
if kotae[1] == 0
kotae[0] -= 1
ans = "z" + ans
else
ans = alp[kotae[1] -1] + ans
end
if kotae[0] == 0
break
end
n = kotae[0]
end
puts ans | n = $stdin.gets.chomp.to_i
alp = "abcdefghijklmnopqrstuvwxyz".split('')
ans = ""
while true do
kotae = n.divmod(26) #商,あまりの順
if kotae[1] == 0
kotae[0] -= 1
ans = "z" + ans
else
ans = alp[kotae[1]-1] + ans
end
if kotae[0] == 0
break
end
n = kotae[0]
end
puts ans | [
"literal.string.change",
"assignment.value.change"
] | 342,295 | 342,296 | u688809543 | ruby |
p02629 | n=gets.to_i
s=[*?a..?z]*''
res=''
while n>0
res+=s[n%26-1]
n/=26
end
puts res.reverse
| n=gets.to_i
s=[*?a..?z]*''
res=''
while n>0
n-=1
res+=s[n%26]
n/=26
end
puts res.reverse
| [
"expression.operation.binary.remove"
] | 342,636 | 342,637 | u503549962 | ruby |
p02630 | N = gets.to_i
A = Arrey.new(100001, 0)
sum = 0
line = gets.split(' ').map(&:to_i)
for num in 0..N-1 do
n = line[num]
A[n] += 1
sum += n
end
Q = gets.to_i
q_line = []
for num in 0..Q-1 do
q_line = gets.chomp.split(' ').map(&:to_i)
B = q_line[0]
C = q_line[1]
b = A[B].to_i
A[B] = 0
sum += b * (C - B)
A[C] += b
puts sum
end
| N = gets.to_i
A = Array.new(100001, 0)
sum = 0
line = gets.split(' ').map(&:to_i)
for num in 0..N-1 do
n = line[num]
A[n] += 1
sum += n
end
Q = gets.to_i
q_line = []
for num in 0..Q-1 do
q_line = gets.chomp.split(' ').map(&:to_i)
B = q_line[0]
C = q_line[1]
b = A[B].to_i
A[B] = 0
sum += b * (C - B)
A[C] += b
puts sum
end | [
"assignment.value.change"
] | 343,207 | 343,208 | u559424030 | ruby |
p02626 | eval'A,B,*C=#'+`tr ' ' ,`;z=0;44955.times{C.inject(A^B,:^)[i=45-_1%45]>0&&(z+=t=[A[0,i],(~B)[0,i]].min+1;A-=t;B+=t)};p A>0?z:-1 | eval'A,B,*C=#'+`tr ' ' ,`;z=0;45000.times{C.inject(A^B,:^)[i=45-_1%46]>0&&(z+=t=[A[0,i],(~B)[0,i]].min+1;A-=t;B+=t)};p A>0?z:-1 | [
"literal.number.integer.change",
"assignment.value.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change"
] | 343,454 | 343,455 | u503549962 | ruby |
p02626 | eval'A,B,*C=#'+`tr ' ' ,`;z=0;45000.times{C.inject(A^B,:^)[i=45-_1%45]>0&&(z+=t=[A[0,i],(~B)[0,i]].min+1;A-=t;B+=t)};p A>0?z:-1 | eval'A,B,*C=#'+`tr ' ' ,`;z=0;45000.times{C.inject(A^B,:^)[i=45-_1%46]>0&&(z+=t=[A[0,i],(~B)[0,i]].min+1;A-=t;B+=t)};p A>0?z:-1 | [
"literal.number.integer.change",
"assignment.value.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change"
] | 343,456 | 343,455 | u503549962 | ruby |
p02626 | eval'A,B,*C=#'+`tr ' ' ,`
z=x=0
C.map{x^=_1}
999.times{45.downto(0){|i|(x^A^B)[i]>0&&(z+=t=[A[0,i]+1,(-B)[0,i]].min
A-=t
B+=t)}}
p A>0?z:-1 | eval'A,B,*C=#'+`tr ' ' ,`
z=x=0
C.map{x^=_1}
999.times{45.downto(0){|i|(x^A^B)[i]>0&&(z+=t=[A[0,i],(~B)[0,i]].min+1
A-=t
B+=t)}}
p A>0?z:-1 | [
"expression.operation.binary.remove",
"assignment.value.change",
"expression.operation.binary.change"
] | 343,495 | 343,496 | u283869437 | ruby |
p02630 | n = gets.chomp.to_i
raw_as = gets.chomp.split.map(&:to_i)
Q = gets.chomp.to_i
bs = []
cs = []
ss = []
Q.times do
b, c = gets.chomp.split.map(&:to_i)
bs << b; cs << c
end
a_sum = raw_as.inject(:+)
as = {}
raw_as.each do |a|
as[a] ||= 0
as[a] += 1
end
bs.each_with_index do |bi, i|
a_sum += as[bi].nil? ? 0 : ((cs[i] - bi) * as[bi])
ss << a_sum
as[cs[i]] ||= 0
as[cs[i]] += as[bi]
as[bi] = 0
end
puts ss
| n = gets.chomp.to_i
raw_as = gets.chomp.split.map(&:to_i)
Q = gets.chomp.to_i
bs = []
cs = []
ss = []
Q.times do
b, c = gets.chomp.split.map(&:to_i)
bs << b; cs << c
end
a_sum = raw_as.inject(:+)
as = {}
raw_as.each do |a|
as[a] ||= 0
as[a] += 1
end
bs.each_with_index do |bi, i|
a_sum += as[bi].nil? ? 0 : ((cs[i] - bi) * as[bi])
ss << a_sum
as[cs[i]] ||= 0
as[cs[i]] += as[bi] || 0
as[bi] = 0
end
puts ss
| [
"expression.operation.binary.add"
] | 343,529 | 343,530 | u663855777 | ruby |
p02630 | n=gets.to_i
line=gets.split(' ').map(&:to_i)
q=gets.to_i
bc=[]
q.times do
bc << gets.chomp.split(" ").map { |e|e.to_i }
end
sum=line.sum
table=line.tally
bc.each do |i,j|
sum+=table[i]*(j-i)
table[j]+=table[i]
table[i]=0
p sum
end
| n=gets.to_i
line=gets.split(' ').map(&:to_i)
q=gets.to_i
bc=[]
q.times do
bc << gets.chomp.split(" ").map { |e|e.to_i }
end
sum=line.sum
table=line.tally
table.default = 0
bc.each do |i,j|
sum+=table[i]*(j-i)
table[j]+=table[i]
table[i]=0
p sum
end
| [
"assignment.add"
] | 343,858 | 343,859 | u857765095 | ruby |
p02630 | n = gets.chomp.to_i
a = gets.chomp.split(" ").map { |e|e.to_i }
bc = []
q = gets.chomp.to_i
q.times do
bc << gets.chomp.split(" ").map { |e|e.to_i }
end
lsit = a.tally
list.default = 0
sum = a.sum
bc.each do |b, c|
sum += list[b] * (c - b)
list[c] += list[b]
list[b] = 0
puts sum
end | n = gets.chomp.to_i
a = gets.chomp.split(" ").map { |e|e.to_i }
bc = []
q = gets.chomp.to_i
q.times do
bc << gets.chomp.split(" ").map { |e|e.to_i }
end
table = a.tally
table.default = 0
sum = a.sum
bc.each do |b, c|
sum += table[b] * (c - b)
table[c] += table[b]
table[b] = 0
puts sum
end | [
"assignment.variable.change",
"identifier.change",
"expression.operation.binary.change"
] | 343,946 | 343,947 | u521347746 | ruby |
p02633 | x=gets.to_i
p (360%x).zero? ? 360/x : x.lcm(360)
| x=gets.to_i
p (360%x).zero? ? 360/x : x.lcm(360)/x
| [
"expression.operation.binary.add"
] | 347,301 | 347,302 | u434509016 | ruby |
p02633 | require 'pp'
$DEBUG ? define_method(:dpp){|e|pp e} : define_method(:dpp){|e|}
# 入力値を数値で返却する
def gets_i()
gets.chomp.to_i
end
# N = gets_i
x = gets_i
pi2 = 360
if pi2 % x == 0
puts pi2 / x
exit
else
puts pi2.lcm(x)
end
| require 'pp'
$DEBUG ? define_method(:dpp){|e|pp e} : define_method(:dpp){|e|}
# 入力値を数値で返却する
def gets_i()
gets.chomp.to_i
end
x = gets_i
pi2 = 360
if pi2 % x == 0
puts pi2 / x
else
puts pi2.lcm(x) / x
end
| [
"expression.operation.binary.add"
] | 347,621 | 347,622 | u370977023 | ruby |
p02639 | x = gets.split.map(&:to_i)
for i in 0..4
if x[i] == 0
puts x[i]+1
break
end
end
| x = gets.split.map(&:to_i)
for i in 0..4
if x[i] == 0
puts i+1
break
end
end
| [
"call.arguments.change"
] | 348,572 | 348,573 | u326891688 | ruby |
p02639 | x = gets.split.map(&:to_i)
for i in 0..4
if x[i] == 0
puts x+1
break
end
end | x = gets.split.map(&:to_i)
for i in 0..4
if x[i] == 0
puts i+1
break
end
end
| [
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 348,574 | 348,573 | u326891688 | ruby |
p02639 | a = gets.split.map(&:to_i)
for i in 1..a.length-1
if a[i] == 0 then
puts i
break
end
end
| a = gets.split.map(&:to_i)
for i in 0..a.length-1
if a[i] == 0 then
puts i + 1
break
end
end
| [
"literal.number.integer.change"
] | 348,764 | 348,765 | u529683866 | ruby |
p02639 | a = gets.split(' ').map(&:to_i)
c = 0
a[].each do |b|
c += 1
if b == 0
put b
end
end
| a = gets.split(' ').map(&:to_i)
c = 0
a.each do |b|
c += 1
if b == 0
p c
end
end
| [] | 348,981 | 348,982 | u027023459 | ruby |
p02639 | a=gets.split.map(&:to_i)
a.each_with_index do |item,i|
if item==0
puts i
end
end | a=gets.split.map(&:to_i)
a.each_with_index do |item,i|
if item==0
puts i+1
end
end | [
"expression.operation.binary.add"
] | 349,235 | 349,236 | u085647568 | ruby |
p02639 | a=gets.split.map(&:to_i)
a.each_with_index do |item,i|
if itme==0
puts i
end
end
| a=gets.split.map(&:to_i)
a.each_with_index do |item,i|
if item==0
puts i+1
end
end | [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 349,237 | 349,236 | u085647568 | ruby |
p02639 | x = gets.split.map(&:to_i) # スペースで区切られた複数の整数
for num in 0..x.length-1 do
if x[num] == 0 then
puts num
end
end | x = gets.split.map(&:to_i) # スペースで区切られた複数の整数
for num in 0..x.length-1 do
if x[num] == 0 then
puts num + 1
end
end | [
"expression.operation.binary.add"
] | 349,456 | 349,457 | u308495541 | ruby |
p02639 | I = gets.chomp.split(' ').map(&:to_i)
for num1 in 0..I.size - 1 do
unless I.include?(num1)
puts num1
end
end | I = gets.chomp.split(' ').map(&:to_i)
for num1 in 0..5 do
unless I.include?(num1)
puts num1
end
end | [
"expression.operation.binary.change",
"expression.operation.binary.remove"
] | 349,545 | 349,546 | u830913928 | ruby |
p02639 | xs = gets.split.map(&:to_i)
idx=0
xs.each_with_index do |x, i|
if x == 0
idx = i + 1
break
end
end
puts x | xs = gets.split.map(&:to_i)
idx=0
xs.each_with_index do |x, i|
if x == 0
idx = i + 1
break
end
end
puts idx | [
"identifier.change",
"call.arguments.change"
] | 349,878 | 349,879 | u702652578 | ruby |
p02640 | x,y = gets.split(" ").map(&:to_i)
res = 0
(0..x).each do |i|
if (4*i + 2*(x-i)) == y
res = "Yes"
end
end
if res == "Yes"
p res
else
p "No"
end | x,y = gets.split(" ").map(&:to_i)
res = 0
(0..x).each do |i|
if (4*i + 2*(x-i)) == y
res = "Yes"
end
end
if res == "Yes"
puts res
else
puts "No"
end
| [
"call.function.change",
"io.output.change"
] | 350,353 | 350,354 | u306198828 | ruby |
p02640 | x, y = gets.split.map(&:to_i)
a = 4*x-y
b = y-2*x
puts (a%2==0 && b%2==0) && (a>0 && b>0) ? "Yes" : "No" | x, y = gets.split.map(&:to_i)
a = 4*x-y
b = y-2*x
puts (a%2==0 && b%2==0) && (a>=0 && b>=0) ? "Yes" : "No" | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 350,660 | 350,661 | u358554431 | ruby |
p02640 | x, y = gets.split.map(&:to_i)
a = 4*x-y
b = y-2*x
puts (a%2 == 0 && b%2==0) && (a>0 && b>0)? "Yes" : "No" | x, y = gets.split.map(&:to_i)
a = 4*x-y
b = y-2*x
puts (a%2==0 && b%2==0) && (a>=0 && b>=0) ? "Yes" : "No" | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 350,662 | 350,661 | u358554431 | ruby |
p02640 | x, y = gets.split.map(&:to_i)
a = 4*x-y
b = y-2*x
puts (a%2 == 0 && b%2==0) || (a>0 && b>0)? "Yes" : "No" | x, y = gets.split.map(&:to_i)
a = 4*x-y
b = y-2*x
puts (a%2==0 && b%2==0) && (a>=0 && b>=0) ? "Yes" : "No" | [
"misc.opposites",
"control_flow.branch.if.condition.change",
"expression.operator.compare.change"
] | 350,663 | 350,661 | u358554431 | ruby |
p02640 | x, y = gets.chomp.split().map(&:to_i)
b = (y - 2 * x) / 2
if y >= 2 * x && y.even? && x - b > 0
puts 'Yes'
else
puts 'No'
end
| x, y = gets.chomp.split().map(&:to_i)
b = (y - 2 * x) / 2
if y >= 2 * x && y.even? && x - b >= 0
puts 'Yes'
else
puts 'No'
end
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 350,770 | 350,771 | u882179152 | ruby |
p02640 | x,y = gets.chomp.split(' ').map(&:to_i)
if x*2 < y && x*4 > y && y%2 == 0
puts "Yes"
else
puts "No"
end | x,y = gets.chomp.split(' ').map(&:to_i)
if x*2 <= y && x*4 >= y && y%2 == 0
puts "Yes"
else
puts "No"
end | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 350,988 | 350,989 | u847977106 | ruby |
p02640 | x,y = gets.chomp.split.map(&:to_i)
if y <= (4*x) && y >= (2*x)
puts "Yes"
else
puts "No"
end | x,y = gets.chomp.split.map(&:to_i)
if y <= (4*x) && y >= (2*x) && y.even?
puts "Yes"
else
puts "No"
end | [
"control_flow.branch.if.condition.change"
] | 350,990 | 350,991 | u847977106 | ruby |
p02640 | cnt, sum = gets.chomp.split.map(&:to_i)
if sum > 4*cnt || sum % 2 != 0
puts "No"
else
puts "Yes"
end
| cnt, sum = gets.chomp.split.map(&:to_i)
if sum > 4*cnt || sum < 2*cnt || sum % 2 != 0
puts "No"
else
puts "Yes"
end
| [
"control_flow.branch.if.condition.change"
] | 351,062 | 351,063 | u299289108 | ruby |
p02608 | n = gets.to_i
answers = Hash.new { |h, k| h[k] = 0 }
1.upto(50) do |x|
1.upto(50) do |y|
1.upto(50) do |z|
answer = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
answers[answer] += 1
end
end
end
(1..n).each do |num|
puts answers[num]
end
| n = gets.to_i
answers = Hash.new { |h, k| h[k] = 0 }
1.upto(100) do |x|
1.upto(100) do |y|
1.upto(100) do |z|
answer = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
answers[answer] += 1
end
end
end
(1..n).each do |num|
puts answers[num]
end
| [
"literal.number.integer.change",
"call.arguments.change"
] | 351,138 | 351,139 | u623402808 | ruby |
p02608 | N = gets.to_i
a = Array.new(10**5,0)
for x in 1..50
for y in 1..50
for z in 1..50
n = x**2 + y**2 + z**2 + x*y + y*z + z*x
a[n] += 1
end
end
end
a.shift
a.each_with_index do |n,i|
puts n if i <= N - 1
end
| N = gets.to_i
a = Array.new(10**6,0)
for x in 1..100
for y in 1..100
for z in 1..100
n = x**2 + y**2 + z**2 + x*y + y*z + z*x
a[n] += 1
end
end
end
a.shift
a.each_with_index do |n,i|
puts n if i <= N - 1
end
| [
"literal.number.integer.change",
"assignment.value.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 351,218 | 351,219 | u966810027 | ruby |
p02608 | N = gets.to_i
a = Array.new(10**4+100,0)
for x in 1..41
for y in 1..41
for z in 1..41
n = x**2 + y**2 + z**2 + x*y + y*z + z*x
a[n] += 1
end
end
end
a.shift
a.each_with_index do |n,i|
puts n if i <= N - 1
end
| N = gets.to_i
a = Array.new(10**6,0)
for x in 1..100
for y in 1..100
for z in 1..100
n = x**2 + y**2 + z**2 + x*y + y*z + z*x
a[n] += 1
end
end
end
a.shift
a.each_with_index do |n,i|
puts n if i <= N - 1
end
| [
"literal.number.integer.change",
"assignment.value.change",
"call.arguments.change",
"expression.operation.binary.change",
"expression.operation.binary.remove"
] | 351,220 | 351,219 | u966810027 | ruby |
p02640 | x,y=gets.split.map(&:to_i)
ans=(1..x).select{|i|i*2+(x-i)*4==y}
puts ans.empty? ? 'No' : 'Yes' | x,y=gets.split.map(&:to_i)
ans=(0..x).select{|i|i*2+(x-i)*4==y}
puts ans.empty? ? 'No' : 'Yes' | [
"literal.number.integer.change",
"assignment.value.change"
] | 351,397 | 351,398 | u465342836 | ruby |
p02640 | X,Y = gets.split.map(&:to_i)
ans = 'No'
X.times do |i|
n = X * 2 + i * 2
if n == Y
ans = 'Yes'
break
elsif Y < n
break
end
end
puts ans | X,Y = gets.split.map(&:to_i)
ans = 'No'
(X+1).times do |i|
n = X * 2 + i * 2
if n == Y
ans = 'Yes'
break
elsif Y < n
break
end
end
puts ans | [] | 351,479 | 351,480 | u064100484 | ruby |
p02640 | x,y = gets.split.map &:to_i
(1..x).each do |tsuru|
kame = x - tsuru
if tsuru * 2 + kame * 4 === y
puts 'Yes'
exit
end
end
puts 'No'
| x,y = gets.split.map &:to_i
(0..x).each do |tsuru|
kame = x - tsuru
if tsuru * 2 + kame * 4 === y
puts 'Yes'
exit
end
end
puts 'No'
| [
"literal.number.integer.change"
] | 351,555 | 351,556 | u772625937 | ruby |
p02640 | #!/usr/bin/env ruby
x, y = gets.chomp.split(" ").map(&:to_i)
ans = 'No'
1.upto(x) do |t|
if t * 2 + (x - t) * 4 == y
ans = 'Yes'
break
end
end
puts ans
| #!/usr/bin/env ruby
x, y = gets.chomp.split(" ").map(&:to_i)
ans = 'No'
0.upto(x) do |t|
if t * 2 + (x - t) * 4 == y
ans = 'Yes'
break
end
end
puts ans
| [
"literal.number.integer.change"
] | 351,828 | 351,829 | u722851971 | ruby |
p02640 | a, b= gets.split.map(&:to_i)
bool = false
(0..a).each do |i|
if b=i*2+(a-i)*4
bool = true
end
end
if bool
puts("Yes")
else
puts("No")
end
| a, b= gets.split.map(&:to_i)
bool = false
(0..a).each do |i|
if b==i*2+(a-i)*4
bool = true
end
end
if bool
puts("Yes")
else
puts("No")
end
| [
"expression.operation.compare.replace.add",
"assignment.replace.remove",
"misc.typo"
] | 351,953 | 351,954 | u246530341 | ruby |
p02640 | x, y= gets.split.map(&:to_i)
if 2*x <= y && y <= 4*y && y % 2 == 0
puts "Yes"
else
puts "No"
end
| x, y= gets.split.map(&:to_i)
if 2*x <= y && y <= 4*x && y % 2 == 0
puts "Yes"
else
puts "No"
end
| [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 351,955 | 351,956 | u246530341 | ruby |
p02640 | x, y = gets.split.map &:to_i
# x = a + b
# y = 2(a + 2b)
def is_legal(x, y)
1.upto(100) { |a|
1.upto(100) { |b|
return true if x == a + b and y == a * 2 + b * 4
}
}
return false
end
puts (is_legal(x, y)) ? "Yes" : "No" | x, y = gets.split.map &:to_i
# x = a + b
# y = 2(a + 2b)
def is_legal(x, y)
0.upto(100) { |a|
0.upto(100) { |b|
return true if x == a + b and y == a * 2 + b * 4
}
}
return false
end
puts (is_legal(x, y)) ? "Yes" : "No" | [
"literal.number.integer.change"
] | 352,122 | 352,123 | u347948131 | ruby |
p02640 | x, y = gets.split(" ").map(&:to_i)
a = x*2 - y/2
b = x - a
if b >= 0 && a >= 0 && (b * 2) % 2 == 0 && (b * 2) % 2 == 0 && y % 2 == 0
puts "yes"
else
puts "no"
end | x, y = gets.split(" ").map(&:to_i)
a = x*2 - y/2
b = x - a
if b >= 0 && a >= 0 && (b * 2) % 2 == 0 && (b * 2) % 2 == 0 && y % 2 == 0
puts "Yes"
else
puts "No"
end | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 352,802 | 352,803 | u190378842 | ruby |
p02640 | x,y = gets.split.map(&:to_i)
if y.odd?
puts "No"
end
if x*2 <= y && y <= x*4
puts "Yes"
else
puts "No"
end
| x,y = gets.split.map(&:to_i)
if y.odd?
puts "No"
elsif x*2 <= y && y <= x*4
puts "Yes"
else
puts "No"
end
| [] | 353,202 | 353,203 | u791562079 | ruby |
p02640 | xi = gets.chomp.split(" ").map!{|item| item.to_i}
for f in 1..xi[0]
if xi[1] == (f*2) + (xi[0]-f)*4
puts "Yes"
exit
end
end
puts "No" | xi = gets.chomp.split(" ").map!{|item| item.to_i}
for f in 0..xi[0]
if xi[1] == (f*2) + (xi[0]-f)*4
puts "Yes"
exit
end
end
puts "No" | [
"literal.number.integer.change"
] | 353,553 | 353,554 | u949754004 | ruby |
p02640 | x, y = gets.split.map &:to_i
# a = 2 * x - y / 2
# b = y / 2 - x
# puts (a >= 0 && b >= 0) ? "Yes" : "No"
flag = 0
0.upto(X) { |kame|
turu = X - kame
if turu * 2 + kame * 4 == y
flag = 1
break
end
}
puts flag = 1 ? "Yes" : "No"
| x, y = gets.split.map &:to_i
# a = 2 * x - y / 2
# b = y / 2 - x
# puts (a >= 0 && b >= 0) ? "Yes" : "No"
flag = 0
0.upto(x) { |kame|
turu = x - kame
if turu * 2 + kame * 4 == y
flag = 1 # detected
break
end
}
puts flag == 1 ? "Yes" : "No"
| [
"call.arguments.change",
"assignment.value.change",
"expression.operation.binary.change",
"expression.operation.compare.replace.add",
"assignment.replace.remove",
"misc.typo"
] | 353,859 | 353,860 | u635857549 | ruby |
p02640 | many, feet = gets.chomp.split(" ").map(&:to_i)
flag = false
for i in 0..many do
foot = 2 * i + 4 * (many - i)
if foot == feet
flag = true
break
end
end
if flag
puts "YES"
else
puts "NO"
end | many, feet = gets.chomp.split(" ").map(&:to_i)
flag = false
for i in 0..many do
foot = 2 * i + 4 * (many - i)
if foot == feet
flag = true
break
end
end
if flag
puts "Yes"
else
puts "No"
end | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 354,019 | 354,020 | u970313453 | ruby |
p02640 | n, m = gets.chomp.split(" ").map(&:to_i)
y = 2 * n - m / 2.0
x = n - y
if x.to_i == x && y.to_i == y && x >= 0 && y >= 0
puts "YES"
else
puts "NO"
end
| n, m = gets.chomp.split(" ").map(&:to_i)
y = 2 * n - m / 2.0
x = n - y
if x.to_i == x && y.to_i == y && x >= 0 && y >= 0
puts "Yes"
else
puts "No"
end
| [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 354,062 | 354,063 | u022453911 | ruby |
p02640 | x, y = gets.chomp.split.map(&:to_i)
turtles = (y - 2 * x)/2.0
cranes = x - turtles
if turles.to_i != turtles || turtles > 100 || turtles < 0 || cranes > 100 || cranes < 0
puts "No"
else
puts "Yes"
end | x, y = gets.chomp.split.map(&:to_i)
turtles = (y - 2 * x)/2.0
cranes = x - turtles
if turtles.to_i != turtles || turtles > 100 || turtles < 0 || cranes > 100 || cranes < 0
puts "No"
else
puts "Yes"
end | [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 354,073 | 354,074 | u792512290 | ruby |
p02640 | xy = gets.chomp.split
x = xy[0].to_i
y = xy[1].to_i
result = false
if y.even? && y <= x * 4
(1..x).each do |i|
j = x - i
if i * 2 + j * 4 == y
result = true
break
end
end
end
puts result ? "Yes" : "No"
| xy = gets.chomp.split
x = xy[0].to_i
y = xy[1].to_i
result = false
if y.even? && y <= x * 4
(0..x).each do |i|
j = x - i
if i * 2 + j * 4 == y
result = true
break
end
end
end
puts result ? "Yes" : "No"
| [
"literal.number.integer.change"
] | 354,191 | 354,192 | u139850627 | ruby |
p02640 | xy = gets.chomp.split
x = xy[0].to_i
y = xy[1].to_i
result = false
unless y.even? && y > x * 4
(1..x).each do |i|
j = x - i
if i * 2 + j * 4 == y
result = true
break
end
end
end
puts result ? "Yes" : "No"
| xy = gets.chomp.split
x = xy[0].to_i
y = xy[1].to_i
result = false
if y.even? && y <= x * 4
(0..x).each do |i|
j = x - i
if i * 2 + j * 4 == y
result = true
break
end
end
end
puts result ? "Yes" : "No"
| [
"expression.operator.compare.change",
"expression.operation.binary.change",
"literal.number.integer.change"
] | 354,193 | 354,192 | u139850627 | ruby |
p02640 | # https://atcoder.jp/contests/abc170/tasks/abc170_b
X, Y = gets.split.map(&:to_i)
cond = Y.between?(X*2, X*4)
puts cond ? 'Yes' : 'No'
| # https://atcoder.jp/contests/abc170/tasks/abc170_b
X, Y = gets.split.map(&:to_i)
cond = Y.even? && Y.between?(X*2, X*4)
puts cond ? 'Yes' : 'No'
| [
"assignment.change"
] | 354,278 | 354,279 | u091367113 | ruby |
p02640 | x, y = gets.split.map(&:to_i)
a = (4 * x) - y
b = (x * 2) - a
if a >= 0 and b >= 0 and (a % 2 == 0) and (b & 2 == 0)
puts "Yes"
else
puts "No"
end
| x, y = gets.split.map(&:to_i)
a = (4 * x) - y
b = (x * 2) - a
if a >= 0 and b >= 0 and (a % 2 == 0) and (b % 2 == 0)
puts "Yes"
else
puts "No"
end
| [
"control_flow.branch.if.condition.change"
] | 354,647 | 354,648 | u854388580 | ruby |
p02640 | a,b=gets.split.map(&:to_i)
if a*2<=b&&b<=a*4
puts "Yes"
else
puts "No"
end
| a,b=gets.split.map(&:to_i)
if a*2<=b&&b<=a*4&&b.even?
puts "Yes"
else
puts "No"
end
| [
"control_flow.branch.if.condition.change"
] | 355,299 | 355,300 | u744908753 | ruby |
p02641 | x, n = gets.split(' ').map(&:to_i)
ps = n == 0 ? [] : gets.split(' ').map(&:to_i)
result = 100
min_abs = 100
target_arr = (0..100).to_a.select { |i| !ps.include?(i) }
target_arr.each do |i|
abs = (x - i).abs
if abs < min_abs
result = i
min_abs = abs
elsif abs == min_abs && i < result
result = i
end
end
puts result
| x, n = gets.split(' ').map(&:to_i)
ps = n == 0 ? [] : gets.split(' ').map(&:to_i)
result = 100
min_abs = 100
target_arr = (0..101).to_a.select { |i| !ps.include?(i) }
target_arr.each do |i|
abs = (x - i).abs
if abs < min_abs
result = i
min_abs = abs
elsif abs == min_abs && i < result
result = i
end
end
puts result
| [
"literal.number.integer.change",
"assignment.value.change"
] | 355,364 | 355,365 | u775007282 | ruby |
p02641 | x, len = gets.split.map(&:to_i)
min = 100
result = 0
if len == 0
puts x
else
arr = gets.split.map(&:to_i)
(0..99).reverse_each do |i|
if arr.include?(i)
next
end
if (x-i).abs <= min then
min = (x-i).abs
result = i
end
end
puts result
end | x, len = gets.split.map(&:to_i)
min = 100
result = 0
if len == 0
puts x
else
arr = gets.split.map(&:to_i)
(0..101).reverse_each do |i|
if arr.include?(i)
next
end
if (x-i).abs <= min then
min = (x-i).abs
result = i
end
end
puts result
end | [
"literal.number.integer.change"
] | 356,068 | 356,069 | u529683866 | ruby |
p02641 | x, len = gets.split.map(&:to_i)
min = 100
result = 0
if len == 0
puts x
else
arr = gets.split.map(&:to_i)
(0..100).reverse_each do |i|
if arr.include?(i)
next
end
if (x-i).abs <= min then
min = (x-i).abs
result = i
end
end
puts result
end | x, len = gets.split.map(&:to_i)
min = 100
result = 0
if len == 0
puts x
else
arr = gets.split.map(&:to_i)
(0..101).reverse_each do |i|
if arr.include?(i)
next
end
if (x-i).abs <= min then
min = (x-i).abs
result = i
end
end
puts result
end | [
"literal.number.integer.change"
] | 356,070 | 356,069 | u529683866 | ruby |
p02641 | x, len = gets.split.map(&:to_i)
min = 100
result = 0
if len == 0
puts x
else
arr = gets.split.map(&:to_i)
(1..100).reverse_each do |i|
if arr.include?(i)
next
end
if (x-i).abs <= min then
min = (x-i).abs
result = i
end
end
puts result
end | x, len = gets.split.map(&:to_i)
min = 100
result = 0
if len == 0
puts x
else
arr = gets.split.map(&:to_i)
(0..101).reverse_each do |i|
if arr.include?(i)
next
end
if (x-i).abs <= min then
min = (x-i).abs
result = i
end
end
puts result
end | [
"literal.number.integer.change"
] | 356,071 | 356,069 | u529683866 | ruby |
p02641 | x,n = gets.split.map(&:to_i)
if n == 0
puts x
exit
end
a = gets.split.map(&:to_i)
b = (1..100).to_a
ans = 0
cnt = 10**10
(b - a).each do |i|
diff = (x-i).abs
if diff < cnt
ans = i
cnt = diff
end
end
puts ans
| x,n = gets.split.map(&:to_i)
if n == 0
puts x
exit
end
a = gets.split.map(&:to_i)
b = (0..101).to_a
ans = 0
cnt = 10**10
(b - a).each do |i|
diff = (x-i).abs
if diff < cnt
ans = i
cnt = diff
end
end
puts ans
| [
"literal.number.integer.change",
"assignment.value.change"
] | 356,156 | 356,157 | u106964380 | ruby |
p02641 | MAX_N_LENGTH = 100
x, nums_length = gets.chomp.split(' ').map{|i| i.to_i}
if nums_length == 0
puts x
exit
end
nums = gets.chomp.split(' ').map{|i| i.to_i}
answer = 0
x_abs = MAX_N_LENGTH + 1
(0...x).reverse_each do |i|
unless nums.include?(i)
if (x - i).abs < x_abs
x_abs = (x - i).abs
answer = i
end
end
end
(x..MAX_N_LENGTH).each do |i|
unless nums.include?(i)
if (x - i).abs < x_abs
x_abs = (x - i).abs
answer = i
end
end
end
if MAX_N_LENGTH + 1 == x_abs
puts x
else
puts answer
end
| MAX_N_LENGTH = 100
x, nums_length = gets.chomp.split(' ').map{|i| i.to_i}
if nums_length == 0
puts x
exit
end
nums = gets.chomp.split(' ').map{|i| i.to_i}
answer = 0
x_abs = MAX_N_LENGTH + 1
(0...x).reverse_each do |i|
unless nums.include?(i)
if (x - i).abs < x_abs
x_abs = (x - i).abs
answer = i
end
end
end
(x..(MAX_N_LENGTH+1)).each do |i|
unless nums.include?(i)
if (x - i).abs < x_abs
x_abs = (x - i).abs
answer = i
end
end
end
if MAX_N_LENGTH + 1 == x_abs
puts x
else
puts answer
end | [] | 357,501 | 357,502 | u676938821 | ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.