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 |
|---|---|---|---|---|---|---|---|
p03660
|
require 'set'
N = gets.to_i
edges = Hash.new { |h, k| h[k] = [] }.tap do |h|
(N-1).times do
a, b = gets.split.map(&:to_i)
h[a] << b
h[b] << a
end
end
nodes = Array.new(N+1, :none)
nodes[0] = :dummy
nodes[1] = :fennec
nodes[N] = :snuke
queue = [[1, :fennec], [N, :snuke]]
until queue.empty?
node, player = queue.shift
edges[node].each do |a|
next unless nodes[a] == :none
nodes[a] = player
queue << [a, player]
end
end
fennec = 0
snuke = 0
nodes.each do |node|
case node
when :fennec
fennec += 1
when :snuke
snuke += 1
end
end
p nodes
puts fennec > snuke ? "Fennec" : "Snuke"
|
require 'set'
N = gets.to_i
edges = Hash.new { |h, k| h[k] = [] }.tap do |h|
(N-1).times do
a, b = gets.split.map(&:to_i)
h[a] << b
h[b] << a
end
end
nodes = Array.new(N+1, :none)
nodes[0] = :dummy
nodes[1] = :fennec
nodes[N] = :snuke
queue = [[1, :fennec], [N, :snuke]]
until queue.empty?
node, player = queue.shift
edges[node].each do |a|
next unless nodes[a] == :none
nodes[a] = player
queue << [a, player]
end
end
fennec = 0
snuke = 0
nodes.each do |node|
case node
when :fennec
fennec += 1
when :snuke
snuke += 1
end
end
puts fennec > snuke ? "Fennec" : "Snuke"
|
[
"call.remove"
] | 1,344,455
| 1,344,456
|
u033378815
|
ruby
|
p03665
|
def c(a,b)
ans = 1
((a-b+1)..a).each do |d|
ans *= d
end
(2..b).each do |d|
ans /= d
end
return ans
end
n,p = gets.chomp.split.map(&:to_i)
a = gets.chomp.split.map(&:to_i)
a0 = 0
a1 = 0
a.each do |d|
if(d%2 == 0)
a0 += 1
else
a1 += 1
end
end
ans = 0
if(p == 1)
((a1+1)/2).times do |t0|
(0..a0).each do |t1|
ans += c(a1,(t0*2-1)) * c(a0,t1)
end
end
else
(0..a0).each do |t0|
(0..(a1/2)).each do |t1|
ans += c(a0,t0) * c(a1,t1*2)
end
end
end
p ans
|
def c(a,b)
ans = 1
((a-b+1)..a).each do |d|
ans *= d
end
(2..b).each do |d|
ans /= d
end
return ans
end
n,p = gets.chomp.split.map(&:to_i)
a = gets.chomp.split.map(&:to_i)
a0 = 0
a1 = 0
a.each do |d|
if(d%2 == 0)
a0 += 1
else
a1 += 1
end
end
ans = 0
if(p == 1)
((a1+1)/2).times do |t0|
(0..a0).each do |t1|
ans += c(a1,(t0*2+1)) * c(a0,t1)
end
end
else
(0..a0).each do |t0|
(0..(a1/2)).each do |t1|
ans += c(a0,t0) * c(a1,t1*2)
end
end
end
p ans
|
[
"misc.opposites",
"expression.operator.arithmetic.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 1,345,620
| 1,345,621
|
u145123922
|
ruby
|
p03665
|
N,P=gets.split.map(&:to_i)
a=gets.split.map(&:to_i)
odd=false
for i in a do
i%2==1&&odd=true
end
if odd==false
if P==0
puts(2**N)
else
puts(0)
end
else
puts(2**N-1)
end
|
N,P=gets.split.map(&:to_i)
a=gets.split.map(&:to_i)
odd=false
for i in a do
i%2==1&&odd=true
end
if odd==false
if P==0
puts(2**N)
else
puts(0)
end
else
puts(2**(N-1))
end
|
[
"call.arguments.change"
] | 1,345,646
| 1,345,647
|
u451610133
|
ruby
|
p03659
|
def main
n = gets.split.map(&:to_i)
xs = gets.split.map(&:to_i)
puts solve(xs)
end
def solve(xs)
min = Float::INFINITY
total = xs.reduce(:+)
x = 0
for i in xs
x += i
cand = (2*x - total).abs
min = cand if cand < min
end
min
end
main
|
def main
n = gets.split.map(&:to_i)
xs = gets.split.map(&:to_i)
puts solve(xs)
end
def solve(xs)
min = Float::INFINITY
total = xs.reduce(:+)
xs.pop
x = 0
for i in xs
x += i
cand = (2*x - total).abs
min = cand if cand < min
end
min
end
main
|
[
"call.add"
] | 1,345,781
| 1,345,782
|
u098367142
|
ruby
|
p03659
|
num = gets.chomp.to_i
a = gets.chomp.split(' ').map(&:to_i)
if(num == 2)
puts (a[0] - a[1]).abs
exit 0
end
total = a.inject(&:+)
sunuke = 0
kuma = total
min = 2*(10**5)
a[0..-2].each do |i|
sunuke += i
kuma -= i
diff = (sunuke - kuma).abs
if(diff == 0)
puts 0
exit 0
elsif(diff < min)
min = diff
end
end
puts min
|
num = gets.chomp.to_i
a = gets.chomp.split(' ').map(&:to_i)
if(num == 2)
puts (a[0] - a[1]).abs
exit 0
end
total = a.inject(&:+)
sunuke = 0
kuma = total
min = 10**9
a[0..-2].each do |i|
sunuke += i
kuma -= i
diff = (sunuke - kuma).abs
if(diff == 0)
puts 0
exit 0
elsif(diff < min)
min = diff
end
end
puts min
|
[
"expression.operation.binary.remove",
"literal.number.integer.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 1,345,911
| 1,345,912
|
u914076797
|
ruby
|
p03666
|
def lscan; gets.split.map(&:to_i); end
def bye(s);puts s;exit 0;end
N_,A,B,C,D = lscan
N = N_-1
ba = (B-A).abs
0.step(N, 2) do |dcnt|
icnt = N-dcnt
l = C*icnt - D*dcnt
r = -C*dcnt + D*icnt
bye "YES" if l <= ba && ba <= r
end
bye "NO"
|
def lscan; gets.split.map(&:to_i); end
def bye(s);puts s;exit 0;end
N_,A,B,C,D = lscan
N = N_-1
ba = (B-A).abs
0.upto(N) do |dcnt|
icnt = N-dcnt
l = C*icnt - D*dcnt
r = -C*dcnt + D*icnt
bye "YES" if l <= ba && ba <= r
end
bye "NO"
|
[
"identifier.change",
"call.arguments.change"
] | 1,346,244
| 1,346,245
|
u079330987
|
ruby
|
p03671
|
def sum(arr)
ans = 0
for i in arr
ans += i
end
end
a = gets.split(" ").map(&:to_i)
p(sum(a) - a.max())
|
def sum(arr)
ans = 0
for i in arr
ans += i
end
return ans
end
a = gets.split(" ").map(&:to_i)
p(sum(a) - a.max())
|
[
"control_flow.return.add"
] | 1,346,643
| 1,346,644
|
u122428774
|
ruby
|
p03671
|
a = gets.chomp.split.map(&:to_i)
a.sort()
print(a[0] + a[1])
|
a = gets.chomp.split.map(&:to_i)
a.sort!
print(a[0] + a[1])
|
[
"call.suffix.change",
"call.arguments.change"
] | 1,346,896
| 1,346,897
|
u691896522
|
ruby
|
p03671
|
sorted_nums = gets.chomp.split(" ").map(&:to_i).sort
print sorted_num[0] + sorted_num[1]
|
sorted_nums = gets.chomp.split(" ").map(&:to_i).sort
print sorted_nums[0] + sorted_nums[1]
|
[
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 1,346,909
| 1,346,910
|
u019986937
|
ruby
|
p03671
|
a, b, c = gets.split.map(&:to_i)
p [a + b, b + c, a + b].min
|
a, b, c = gets.split.map(&:to_i)
p [a + b, b + c, a + c].min
|
[
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 1,346,970
| 1,346,971
|
u503890246
|
ruby
|
p03671
|
abc = gets.split.map(&:to_i)
abc.combination(2).to_a.map{|x|x.inject(:+)}.min
|
abc = gets.split.map(&:to_i)
puts abc.combination(2).to_a.map{|x|x.inject(:+)}.min
|
[
"io.output.change",
"call.add"
] | 1,347,010
| 1,347,011
|
u457499130
|
ruby
|
p03671
|
a, b, c = gets.strip.split.map &:to_i
ans = min(a+b, b+c, c+a)
puts ans
|
a,b,c = gets.strip.split.map &:to_i
ans = [a+b, b+c, c+a].min
puts ans
|
[
"assignment.value.change",
"call.arguments.change",
"call.add"
] | 1,347,328
| 1,347,329
|
u138486156
|
ruby
|
p03672
|
s=gets
while true
s[-1]=""
a=s.size
if a%2!=0
next
end
if s[0..(a/2-1)]==s[a/2..-1]
puts a
break
end
end
|
s=gets.chomp
while true
s[-1]=""
a=s.size
if a%2!=0
next
end
if s[0..(a/2-1)]==s[a/2..-1]
puts a
break
end
end
|
[
"call.add"
] | 1,347,580
| 1,347,581
|
u085647568
|
ruby
|
p03671
|
a, b, c = gets.chomp.split(" ").map(&:to_i)
s = [a,b,c].sort.last(2).inject(0){|sum,i|sum+i}
print(s)
|
a, b, c = gets.chomp.split(" ").map(&:to_i)
s = [a,b,c].sort.first(2).inject(0){|sum,i|sum+i}
print(s)
|
[
"assignment.value.change",
"identifier.change"
] | 1,347,992
| 1,347,993
|
u307265478
|
ruby
|
p03671
|
a = gets.split.map(&:to_i)
p a.sort[1..2].inject :+
|
p gets.split.map(&:to_i).sort[0..1].inject :+
|
[
"call.remove",
"literal.number.integer.change",
"variable_access.subscript.index.change",
"call.arguments.change"
] | 1,348,025
| 1,348,026
|
u964208493
|
ruby
|
p03671
|
a = gets.split.map(&:to_i)
p a.sort[1..2].inject :+
|
a = gets.split.map(&:to_i)
p a.sort[0..1].inject :+
|
[
"literal.number.integer.change",
"variable_access.subscript.index.change",
"call.arguments.change"
] | 1,348,025
| 1,348,027
|
u964208493
|
ruby
|
p03672
|
str = gets.chomp
2.step(8,2) do |n|
s = str.slice(0,str.size - n)
s1 = s.slice(0,s.size/2)
s2 = s.slice(s.size/2,s.size/2)
if s1 == s2
puts s.size
break
end
end
|
str = gets.chomp
2.step(str.size-2,2) do |n|
s = str.slice(0,str.size - n)
s1 = s.slice(0,s.size/2)
s2 = s.slice(s.size/2,s.size/2)
if s1 == s2
puts s.size
break
end
end
|
[
"identifier.replace.add",
"literal.replace.remove",
"call.arguments.change"
] | 1,348,212
| 1,348,213
|
u734485933
|
ruby
|
p03672
|
s=gets.chomp
maxlength=1
(2..s.length-2).each do |value|
next if value%2==0
puts forwardS=s[0..value/2]
puts backS=s[value/2+1..value]
maxlength = value if forwardS == backS && maxlength < value
end
puts (maxlength+1)
|
s=gets.chomp
maxlength=1
(2..s.length-2).each do |value|
next if value%2==0
forwardS=s[0..value/2]
backS=s[value/2+1..value]
maxlength = value if forwardS == backS && maxlength < value
end
puts (maxlength+1)
|
[
"io.output.change",
"call.remove"
] | 1,348,272
| 1,348,273
|
u802371628
|
ruby
|
p03672
|
str = gets.chop
count = str.size
count.times do
size = str.size
if str.size.odd?
str.chop!
elsif str[0..size/2-1] == str[size/2..size-1]
puts size
break
else
str.chop!
end
end
|
str = gets.chomp.chop
count = str.size
count.times do
size = str.size
if size.odd?
str.chop!
elsif str[0..size/2-1] == str[size/2..size-1]
puts size
break
else
str.chop!
end
end
|
[
"call.add",
"call.remove"
] | 1,348,305
| 1,348,306
|
u254851449
|
ruby
|
p03672
|
S = gets.chomp
until S.empty?
S.chop!
S.chop!
l = S.length
if S[0, l] == S[l, l]
p l*2; exit
end
end
|
S = gets.chomp
until S.empty?
S.chop!
S.chop!
l = S.length/2
if S[0, l] == S[l, l]
p l*2; exit
end
end
|
[
"assignment.change"
] | 1,348,319
| 1,348,320
|
u437302815
|
ruby
|
p03672
|
S = gets.chomp
until S.empty?
S.chop!
S.chop!
l = S.length
if S[0, l] == S[l, l]
p l; exit
end
end
|
S = gets.chomp
until S.empty?
S.chop!
S.chop!
l = S.length/2
if S[0, l] == S[l, l]
p l*2; exit
end
end
|
[
"assignment.change"
] | 1,348,321
| 1,348,320
|
u437302815
|
ruby
|
p03672
|
s=gets.chomp
p (s.size/2).downto(0).find{|i|s[0,i]==s[i,i]}*2
|
s=gets;p (s.size/2-1).downto(0).find{|i|s[0,i]==s[i,i]}*2
|
[
"expression.operation.binary.add"
] | 1,348,461
| 1,348,462
|
u280667879
|
ruby
|
p03672
|
s=gets.chomp
p (s.size/2).downto(0).find{|i|s[0,i]==s[i,i]}
|
s=gets;p (s.size/2-1).downto(0).find{|i|s[0,i]==s[i,i]}*2
|
[
"expression.operation.binary.add"
] | 1,348,463
| 1,348,462
|
u280667879
|
ruby
|
p03672
|
s=gets.chomp
p (s.size/2).downto(0).find{|i|s[0,i]==s[i,i]}*2
|
s=gets.chomp
p (~-s.size/2).downto(0).find{|i|s[0,i]==s[i,i]}*2
|
[] | 1,348,461
| 1,348,464
|
u280667879
|
ruby
|
p03672
|
s=gets.chomp
p (s.size/2).downto(0).find{|i|s[0,i]==s[i,i]}
|
s=gets.chomp
p (~-s.size/2).downto(0).find{|i|s[0,i]==s[i,i]}*2
|
[
"expression.operation.binary.add"
] | 1,348,463
| 1,348,464
|
u280667879
|
ruby
|
p03673
|
n = gets.to_i
nums = gets.split.map(&:to_i)
res = []
nums.each_with_index do |num, idx|
if idx % 2 == 0
res.push(num)
else
res.unshift(num)
end
p res
end
res.reverse! if n.odd?
puts res.join(' ')
|
n = gets.to_i
nums = gets.split.map(&:to_i)
res = []
nums.each_with_index do |num, idx|
if idx % 2 == 0
res.push(num)
else
res.unshift(num)
end
end
res.reverse! if n.odd?
puts res.join(' ')
|
[
"call.remove"
] | 1,348,747
| 1,348,748
|
u624505752
|
ruby
|
p03673
|
n = gets.to_i
nums = gets.split.map(&:to_i)
res = []
nums.each_with_index do |num, idx|
if idx % 2 == 0
res.push(num)
else
res.unshift(num)
end
end
res.reverse if n.odd?
puts res.join(' ')
|
n = gets.to_i
nums = gets.split.map(&:to_i)
res = []
nums.each_with_index do |num, idx|
if idx % 2 == 0
res.push(num)
else
res.unshift(num)
end
end
res.reverse! if n.odd?
puts res.join(' ')
|
[
"call.suffix.change"
] | 1,348,749
| 1,348,748
|
u624505752
|
ruby
|
p03673
|
io = STDIN
n=io.gets.to_i
a=io.gets.split.map(&:to_i)
b=Array.new(n)
even=(1..n).select(&:even?)
odd=(1..n).select(&:odd?)
if n.even?
ar=even.reverse+odd
else
ar=odd.reverse+even
end
puts ar.map{|i|a[i-1]}.join
|
io = STDIN
n=io.gets.to_i
a=io.gets.split.map(&:to_i)
b=Array.new(n)
even=(1..n).select(&:even?)
odd=(1..n).select(&:odd?)
if n.even?
ar=even.reverse+odd
else
ar=odd.reverse+even
end
puts ar.map{|i|a[i-1]}.join(" ")
|
[
"call.arguments.add"
] | 1,348,947
| 1,348,948
|
u132360211
|
ruby
|
p03673
|
n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)
flag = 0
if a.size % 2 == 0
(a.size/2).downto(0) do |i|
if flag == 0 then
flag = 1
else
print " "
end
print "#{a[i*2-1]}"
end
0.step(a.size, 2) do |i|
print " #{a[i]}"
end
else
(a.size/2).downto(0) do |i|
if flag == 0 then
flag = 1
else
print " "
end
print "#{a[i*2]}"
end
1.step(a.size-2, 2) do |i|
print " #{a[i]}"
end
end
print "\n"
|
n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)
flag = 0
if a.size % 2 == 0
(a.size/2).downto(1) do |i|
if flag == 0 then
flag = 1
else
print " "
end
print "#{a[i*2-1]}"
end
0.step(a.size-2, 2) do |i|
print " #{a[i]}"
end
else
(a.size/2).downto(0) do |i|
if flag == 0 then
flag = 1
else
print " "
end
print "#{a[i*2]}"
end
1.step(a.size-2, 2) do |i|
print " #{a[i]}"
end
end
print "\n"
|
[
"literal.number.integer.change",
"call.arguments.change"
] | 1,348,999
| 1,349,000
|
u868089307
|
ruby
|
p03679
|
input = gets.chomp.split
x = input[0].to_i
a = input[1].to_i
b = input[2].to_i
if a > b
puts "delicious"
elsif b - a <= x
puts "safe"
else
puts "dangerous"
end
|
input = gets.chomp.split
x = input[0].to_i
a = input[1].to_i
b = input[2].to_i
if a >= b
puts "delicious"
elsif b - a <= x
puts "safe"
else
puts "dangerous"
end
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,351,007
| 1,351,008
|
u139850627
|
ruby
|
p03679
|
x,a,b=gets.split.map(&:to_i)
puts a-b > 0 ? 'delicious' : a+x < b ? 'dangerous' : 'safe'
|
x,a,b=gets.split.map(&:to_i)
puts a-b >= 0 ? 'delicious' : a+x < b ? 'dangerous' : 'safe'
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,351,148
| 1,351,149
|
u173515518
|
ruby
|
p03679
|
x,a,b = gets.split.map(&:to_i)
if b-a < 0
puts "delicious"
elsif b-a <= x
puts "safe"
else
puts "dangerous"
end
|
x,a,b = gets.split.map(&:to_i)
if b-a <= 0
puts "delicious"
elsif b-a <= x
puts "safe"
else
puts "dangerous"
end
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,351,562
| 1,351,563
|
u760636024
|
ruby
|
p03679
|
x,a,b = gets.chomp.split.map(&:to_i)
if a >= x
print("delicious")
elsif a <= x and x <= b
print("safe")
else
print("dangerous")
end
|
x,a,b = gets.chomp.split.map(&:to_i)
if a >= b
print("delicious")
elsif a + x >= b
print("safe")
else
print("dangerous")
end
|
[
"identifier.change",
"control_flow.branch.if.condition.change",
"expression.operation.binary.remove",
"misc.opposites",
"expression.operator.compare.change"
] | 1,352,067
| 1,352,068
|
u691896522
|
ruby
|
p03679
|
x,a,b=gets.split.map &:to_i
if a<b
if (b-a)<x
puts 'safe'
else
puts 'dangerous'
end
else
puts 'delicious'
end
|
x,a,b=gets.split.map &:to_i
if a<b
if (b-a)<=x
puts 'safe'
else
puts 'dangerous'
end
else
puts 'delicious'
end
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,352,097
| 1,352,098
|
u630043039
|
ruby
|
p03679
|
x,a,b=gets.split.map(&:to_i);
if (a-b)>0
puts 'delicious'
elsif -x<(a-b)
puts 'safe'
elsif
puts 'dangerous'
end
|
x,a,b=gets.split.map(&:to_i);
if (a-b)>-1
puts 'delicious'
elsif -x-1<(a-b)
puts 'safe'
elsif
puts 'dangerous'
end
|
[
"control_flow.branch.if.condition.change",
"expression.operation.unary.add"
] | 1,352,346
| 1,352,347
|
u050914494
|
ruby
|
p03679
|
x,a,b=gets.split.map(&:to_i);
if (a-b)>-1
puts 'delicious'
elsif -x<(a-b)
puts 'safe'
elsif
puts 'dangerous'
end
|
x,a,b=gets.split.map(&:to_i);
if (a-b)>-1
puts 'delicious'
elsif -x-1<(a-b)
puts 'safe'
elsif
puts 'dangerous'
end
|
[
"control_flow.branch.if.condition.change"
] | 1,352,348
| 1,352,347
|
u050914494
|
ruby
|
p03679
|
x,a,b=gets.split.map(&:to_i);
if (a-b)>-1
puts 'delicious'
elsif x>(a-b)
puts 'safe'
elsif
puts 'dangerous'
end
|
x,a,b=gets.split.map(&:to_i);
if (a-b)>-1
puts 'delicious'
elsif -x-1<(a-b)
puts 'safe'
elsif
puts 'dangerous'
end
|
[
"expression.operation.unary.add",
"control_flow.branch.if.condition.change"
] | 1,352,350
| 1,352,347
|
u050914494
|
ruby
|
p03679
|
x, a, b = gets.split.map(&:to_i)
if a >= b
puts 'delicious'
elsif b - a <= x + 1
puts 'safe'
else
puts 'dangerous'
end
|
x, a, b = gets.split.map(&:to_i)
if a >= b
puts 'delicious'
elsif b - a < x + 1
puts 'safe'
elsif
puts 'dangerous'
end
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,352,915
| 1,352,916
|
u968699140
|
ruby
|
p03679
|
x, a, b = gets.split.map(&:to_i)
if b < a
puts "delicious"
elsif b < a + x
puts "safe"
else
puts "dangerous"
end
|
x, a, b = gets.split.map(&:to_i)
if b <= a
puts "delicious"
elsif b <= a + x
puts "safe"
else
puts "dangerous"
end
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,352,945
| 1,352,946
|
u653737129
|
ruby
|
p03679
|
X, A, B = gets.chop.split.map(&:to_i)
if A - B >= 0
puts 'delicious'
elsif B - A > 0 && (X + A) - B > 0
puts 'safe'
else
puts 'dangerous'
end
|
X, A, B = gets.chop.split.map(&:to_i)
if A - B >= 0
puts 'delicious'
elsif B - A > 0 && (X + A) - B >= 0
puts 'safe'
else
puts 'dangerous'
end
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,353,240
| 1,353,241
|
u240877196
|
ruby
|
p03679
|
X, A, B = gets.split.map(&:to_i)
if A >= B
puts 'delicious'
elsif A < B && B < A+X
puts 'safe'
else
puts 'dangerous'
end
|
X, A, B = gets.split.map(&:to_i)
if A >= B
puts 'delicious'
elsif A < B && B <= A+X
puts 'safe'
else
puts 'dangerous'
end
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,353,275
| 1,353,276
|
u320576758
|
ruby
|
p03679
|
X,A,B = gets.split.map(&:to_i)
if A-B <= 0
puts "delicious"
elsif B-A <= X
puts "safe"
else
puts "dangerous"
end
|
X,A,B = gets.split.map(&:to_i)
if A-B >= 0
puts "delicious"
elsif B-A <= X
puts "safe"
else
puts "dangerous"
end
|
[
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,353,325
| 1,353,326
|
u502306384
|
ruby
|
p03679
|
X,A,B = gets.split.map(&:to_i)
if a-b <= 0
puts "delicious"
elsif b-a <= X
puts "safe"
else
puts "dangerous"
end
|
X,A,B = gets.split.map(&:to_i)
if A-B >= 0
puts "delicious"
elsif B-A <= X
puts "safe"
else
puts "dangerous"
end
|
[
"control_flow.branch.if.condition.change"
] | 1,353,327
| 1,353,326
|
u502306384
|
ruby
|
p03679
|
x,a,b=gets.split.map &:to_i
if(b-a<0)
puts"delicious"
elsif(b-a<=x)
puts"safe"
else
puts"dangerous"
end
|
x,a,b=gets.split.map &:to_i
if(b-a<=0)
puts"delicious"
elsif(b-a<=x)
puts"safe"
else
puts"dangerous"
end
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,353,944
| 1,353,945
|
u752146271
|
ruby
|
p03679
|
x,a,b = gets.chomp.split(' ').map{|n| n.to_i}
e = a - b
if e >= 0
puts "delicious"
elsif x + 1 >= (e * -1)
puts "safe"
else
puts "dangerous"
end
|
x,a,b = gets.chomp.split(' ').map{|n| n.to_i}
e = a - b
if e >= 0
puts "delicious"
elsif x + 1 > (e * -1)
puts "safe"
else
puts "dangerous"
end
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,353,985
| 1,353,986
|
u698501698
|
ruby
|
p03679
|
x,a,b = gets.chomp.split(' ').map{|n| n.to_i}
e = a - b
if e >= 0
puts "delicious"
elsif x > (e * -1)
puts "safe"
else
puts "dangerous"
end
|
x,a,b = gets.chomp.split(' ').map{|n| n.to_i}
e = a - b
if e >= 0
puts "delicious"
elsif x + 1 > (e * -1)
puts "safe"
else
puts "dangerous"
end
|
[
"control_flow.branch.if.condition.change"
] | 1,353,987
| 1,353,986
|
u698501698
|
ruby
|
p03679
|
X,A,B = gets.split.map &:to_i
if A+B > X
puts "dangerous"
elsif B > A
puts "safe"
else
puts "delicious"
end
|
X,A,B = gets.split.map &:to_i
if B-A > X
puts "dangerous"
elsif B > A
puts "safe"
else
puts "delicious"
end
|
[
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 1,353,988
| 1,353,989
|
u437302815
|
ruby
|
p03679
|
x, a, b = gets.chomp.split.map(&:to_i)
if b - a >= x + 1
puts 'dangerous'
elsif b - a >= 0
puts 'safe'
else
puts 'delicious'
end
|
x, a, b = gets.chomp.split.map(&:to_i)
if b - a >= x + 1
puts 'dangerous'
elsif b - a > 0
puts 'safe'
else
puts 'delicious'
end
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,353,995
| 1,353,996
|
u124214522
|
ruby
|
p03679
|
n, a, b = gets.split.map(&:to_i)
if (b - a) <= 0
puts 'delicious'
elsif (b - a) - n >= 0
puts 'dangerous'
else
puts 'safe'
end
|
n, a, b = gets.split.map(&:to_i)
if (b - a) <= 0
puts 'delicious'
elsif (b - a) - n > 0
puts 'dangerous'
else
puts 'safe'
end
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,354,271
| 1,354,272
|
u987869509
|
ruby
|
p03679
|
x, a, b = gets.chomp.split(' ').map(&:to_i)
if b > x + a
puts 'dangerous'
elsif b <= a
puts 'safe'
else
puts 'safe'
end
|
x, a, b = gets.chomp.split(' ').map(&:to_i)
if b > x + a
puts 'dangerous'
elsif b <= a
puts 'delicious'
else
puts 'safe'
end
|
[
"literal.string.change",
"call.arguments.change"
] | 1,354,408
| 1,354,409
|
u253759478
|
ruby
|
p03679
|
x,a,b = gets.chomp.split(" ").map(&:to_i)
if (a-b) <= 0
if x + (a-b) < 0
puts "dangerous"
else
puts "safe"
end
else
puts "delicious"
end
|
x,a,b = gets.chomp.split(" ").map(&:to_i)
if (a-b) < 0
if x + (a-b) < 0
puts "dangerous"
else
puts "safe"
end
else
puts "delicious"
end
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,354,494
| 1,354,495
|
u872636244
|
ruby
|
p03679
|
x,a,b = gets.chomp.split(" ").map(&:to_i)
if (a-b) <= 0
if -(a-b) >= x
puts "dangerous"
else
puts "safe"
end
else
puts "delicious"
end
|
x,a,b = gets.chomp.split(" ").map(&:to_i)
if (a-b) < 0
if x + (a-b) < 0
puts "dangerous"
else
puts "safe"
end
else
puts "delicious"
end
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,354,496
| 1,354,495
|
u872636244
|
ruby
|
p03679
|
x,a,b = gets.chomp.split(" ").map(&:to_i)
if (a-b) <= 0
if -(a-b) > x
puts "dangerous"
else
puts "safe"
end
else
puts "delicious"
end
|
x,a,b = gets.chomp.split(" ").map(&:to_i)
if (a-b) < 0
if x + (a-b) < 0
puts "dangerous"
else
puts "safe"
end
else
puts "delicious"
end
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,354,497
| 1,354,495
|
u872636244
|
ruby
|
p03679
|
x, a, b = gets.chomp.split(" ").map(&:to_i)
if a > b
puts 'delicious'
elsif x > (b - a)
puts 'safe'
else
puts 'dangerous'
end
|
x, a, b = gets.chomp.split(" ").map(&:to_i)
if a >= b
puts 'delicious'
elsif x >= (b - a)
puts 'safe'
else
puts 'dangerous'
end
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,354,520
| 1,354,521
|
u136468939
|
ruby
|
p03679
|
x, a, b = gets.chomp.split(" ").map(&:to_i)
if a > b
puts 'delicious'
elsif x >= (b - a)
puts 'safe'
else
puts 'dangerous'
end
|
x, a, b = gets.chomp.split(" ").map(&:to_i)
if a >= b
puts 'delicious'
elsif x >= (b - a)
puts 'safe'
else
puts 'dangerous'
end
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,354,522
| 1,354,521
|
u136468939
|
ruby
|
p03679
|
require 'prime'
require 'set'
require 'tsort'
include Math
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 end
def gif; gets.to_i end
def gff; gets.to_f end
def gsf; gets.chomp end
def gi; gets.split.map(&:to_i) end
def gf; gets.split.map(&:to_f) end
def gs; gets.chomp.split.map(&:to_s) end
def gc; gets.chomp.split('') end
def pr(num); num.prime_division end
def digit(num); num.to_s.length end
def array(s,ini=nil); Array.new(s){ini} end
def darray(s1,s2,ini=nil); Array.new(s1){Array.new(s2){ini}} end
def rep(num); num.times{|i|yield(i)} end
def repl(st,en,n=1); st.step(en,n){|i|yield(i)} end
x,a,b = gi
if b-a < 0
puts "delicious"
elsif x >= b -a
puts "yes"
else
puts "dangerous"
end
|
require 'prime'
require 'set'
require 'tsort'
include Math
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 end
def gif; gets.to_i end
def gff; gets.to_f end
def gsf; gets.chomp end
def gi; gets.split.map(&:to_i) end
def gf; gets.split.map(&:to_f) end
def gs; gets.chomp.split.map(&:to_s) end
def gc; gets.chomp.split('') end
def pr(num); num.prime_division end
def digit(num); num.to_s.length end
def array(s,ini=nil); Array.new(s){ini} end
def darray(s1,s2,ini=nil); Array.new(s1){Array.new(s2){ini}} end
def rep(num); num.times{|i|yield(i)} end
def repl(st,en,n=1); st.step(en,n){|i|yield(i)} end
x,a,b = gi
if b-a <= 0
puts "delicious"
elsif x >= b - a
puts "safe"
else
puts "dangerous"
end
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"literal.string.change",
"call.arguments.change"
] | 1,354,523
| 1,354,524
|
u988228861
|
ruby
|
p03679
|
X, A, B = gets.chomp.split(" ").map{ |n| n.to_i }
if X > B - A && B - A < 0 then
p 'delicious'
elsif X > B - A then
p 'safe'
else
p 'dangerous'
end
|
X, A, B = gets.chomp.split(" ").map{ |n| n.to_i }
if X >= B - A && B - A <= 0 then
print 'delicious'
elsif X >= B - A then
print 'safe'
else
print 'dangerous'
end
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"call.function.change",
"io.output.change"
] | 1,354,809
| 1,354,806
|
u505271431
|
ruby
|
p03679
|
x,a,b = gets.split(" ").map(&:to_i)
if b - a <= 0
puts "delicious"
elsif b - a <= x
puts "safe"
else
puts "dengerous"
end
|
x,a,b = gets.split(" ").map(&:to_i)
if b - a <= 0
puts "delicious"
elsif b - a <= x
puts "safe"
else
puts "dangerous"
end
|
[
"literal.string.change",
"call.arguments.change"
] | 1,354,821
| 1,354,822
|
u094826590
|
ruby
|
p03680
|
N=gets.to_i
arrray=[]
N.times{
array << gets.to_i
}
i=1
g=0
while true
i=array[i-1]
g+=1
if i==2
puts g
break
end
if g >= N
puts -1
break
end
end
|
N=gets.to_i
array=[]
N.times{
array << gets.to_i
}
i=1
g=0
while true
i=array[i-1]
g+=1
if i==2
puts g
break
end
if g >= N
puts -1
break
end
end
|
[
"assignment.variable.change",
"identifier.change"
] | 1,355,650
| 1,355,651
|
u085647568
|
ruby
|
p03680
|
n = gets.to_i
a = []
b = Hash.new(0)
n.times do
a << gets.to_i
end
c = a[0]
loop do
if c == 2
p b.values.inject(:+) + 1
break
elsif b[c] == 0
b[c] += 1
c = a[c-1]
else
puts '-1'
break
end
end
|
n = gets.to_i
a = []
b = Hash.new(0)
n.times do
a << gets.to_i
end
c = 1
loop do
if c == 2
p b.values.inject(:+)
break
elsif b[c] == 0
b[c] += 1
c = a[c-1]
else
puts '-1'
break
end
end
|
[
"assignment.value.change",
"identifier.replace.remove",
"literal.replace.add",
"expression.operation.binary.remove"
] | 1,355,704
| 1,355,705
|
u875730451
|
ruby
|
p03680
|
n = gets.to_i
ary = []
n.times do
ary << gets.chomp.to_i
end
i = 1
cnt = 1
n.times do
if ary[i] == 2
puts cnt
exit
else
i = ary[(ary[i]-1)]
cnt += 1
end
end
puts -1
|
n = gets.to_i
ary = []
n.times do
ary << gets.chomp.to_i
end
i = 0
cnt = 1
n.times do
if ary[i] == 2
puts cnt
exit
else
i = ary[i] - 1
cnt += 1
end
end
puts -1
|
[
"literal.number.integer.change",
"assignment.value.change"
] | 1,355,851
| 1,355,852
|
u928941036
|
ruby
|
p03680
|
n = gets.to_i
n.times do |i|
a[i] = gets.to_i
end
c = 0
l = 1
while l != 2
c += 1
l = a[l-1]
if c > 100000
puts "-1"
exit
end
end
p c
|
n = gets.to_i
a = []
n.times do |i|
a[i] = gets.to_i
end
c = 0
l = 1
while l != 2
c += 1
l = a[l-1]
if c > 100000
puts "-1"
exit
end
end
p c
|
[
"assignment.add"
] | 1,356,120
| 1,356,121
|
u744908753
|
ruby
|
p03680
|
N = gets.to_i
a = N.times.map{gets.to_i}
a.unshift(0) #1-indexed
i = 1
count = 0
N.times do |i|
if a[i] == 2
count += 1
puts count
exit
else
count += 1
i = a[i]
end
end
puts -1
|
N = gets.to_i
a = N.times.map{gets.to_i}
a.unshift(0) #1-indexed
i = 1
count = 0
N.times do |n|
if a[i] == 2
count += 1
puts count
exit
else
count += 1
i = a[i]
end
end
puts -1
|
[
"identifier.change"
] | 1,356,500
| 1,356,501
|
u708550576
|
ruby
|
p03680
|
button = $stdin.read.split("\n")
button.map! do |element|
element.to_i
end
button.shift()
current = 0
cnt = 0
while true
if current == 1
print("#{cnt}\n")
break
elsif cnt >= button.size
print("-1\n")
break
end
cnt += 1
current = button[current-1]
end
|
button = $stdin.read.split("\n")
button.map! do |element|
element.to_i
end
button.shift()
#p button
#p button.size
current = 1
cnt = 0
while true
if current == 2
print("#{cnt}\n")
break
elsif cnt >= button.size
print("-1\n")
break
end
cnt += 1
current = button[current-1]
end
|
[
"literal.number.integer.change",
"assignment.value.change",
"control_flow.branch.if.condition.change"
] | 1,356,635
| 1,356,634
|
u080877599
|
ruby
|
p03681
|
n,m=gets.split.map(&:to_i).sort
MOD=1000000007
def f(n)
ret=1
for i in 2..n
ret = (ret * i) % MOD
end
return ret
end
if m-n>1
p 0
elsif m==n
a=f(n)
p (2*a*a)%MOD
else
a=f(n)
p (m*a)%MOD
end
|
n,m=gets.split.map(&:to_i).sort
MOD=1000000007
def f(n)
ret=1
for i in 2..n
ret = (ret * i) % MOD
end
return ret
end
if m-n>1
p 0
elsif m==n
a=f(n)
p (2*a*a)%MOD
else
p (f(n)*f(m))%MOD
end
|
[
"call.add",
"call.arguments.change",
"expression.operation.binary.change"
] | 1,357,167
| 1,357,168
|
u752146271
|
ruby
|
p03679
|
x,a,b=gets.split.map(&:to_i)
y=a-b
if y>=0
puts "delicious"
elsif y*(-1)<x
puts "safe"
else
puts "dangerous"
end
|
x,a,b=gets.split.map(&:to_i)
y=a-b
if y>=0
puts "delicious"
elsif y*(-1)<=x
puts "safe"
else
puts "dangerous"
end
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,357,641
| 1,357,642
|
u922018373
|
ruby
|
p03679
|
array = gets.chomp.split(" ")
x = array[0].to_i
a = array[1].to_i
b = array[2].to_i
if -a + b <= 0
puts "delicious"
elsif -a + b <= x
puts "safe"
else
puts "dengerous"
end
|
array = gets.chomp.split(" ")
x = array[0].to_i
a = array[1].to_i
b = array[2].to_i
if b <= a
puts "delicious"
elsif -a + b <= x
puts "safe"
else
puts "dangerous"
end
|
[
"expression.operation.binary.remove",
"identifier.replace.add",
"literal.replace.remove",
"control_flow.branch.if.condition.change",
"literal.string.change",
"call.arguments.change"
] | 1,357,900
| 1,357,899
|
u847478937
|
ruby
|
p03679
|
array = gets.chomp.split(" ")
x = array[0].to_i
a = array[1].to_i
b = array[2].to_i
if -a + b < 0
puts "delicious"
elsif -a + b <= x
puts "safe"
else
puts "dengerous"
end
|
array = gets.chomp.split(" ")
x = array[0].to_i
a = array[1].to_i
b = array[2].to_i
if b <= a
puts "delicious"
elsif -a + b <= x
puts "safe"
else
puts "dangerous"
end
|
[
"control_flow.branch.if.condition.change",
"expression.operation.binary.remove",
"literal.string.change",
"call.arguments.change"
] | 1,357,901
| 1,357,899
|
u847478937
|
ruby
|
p03679
|
x,a,b = gets.chomp.split(' ').map(&:to_i)
if a-b > 0
puts 'delicious'
elsif x+1 <= b-a
puts 'dangerous'
elsif a-b<0 && x >= b-a
puts 'safe'
end
|
x,a,b = gets.chomp.split(' ').map(&:to_i)
if a-b >= 0
puts 'delicious'
elsif x+1 <= b-a
puts 'dangerous'
elsif a-b<0 && x >= b-a
puts 'safe'
end
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,357,949
| 1,357,950
|
u680963280
|
ruby
|
p03679
|
x,a,b = gets.split.map &:to_i
if a-b > 0
puts 'delicious'
elsif b-a < x
puts 'safe'
else
puts 'dangerous'
end
|
x,a,b = gets.split.map &:to_i
if a-b >= 0
puts 'delicious'
elsif b-a <= x
puts 'safe'
else
puts 'dangerous'
end
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,357,993
| 1,357,994
|
u717625069
|
ruby
|
p03687
|
def func(s, c, d = 1)
t = '*' * (s.size - 1)
k = 0
(s.size - 1).times do |i|
if s[i] == c then
t[i] = c
elsif s[i + 1] == c then
t[i] = c
else
t[i] = s[i]
k += 1
end
end
return (k == 0) ? d : func(t, c, d + 1)
end
def main(argv)
s = gets.chomp
n = s.size
m = 1e+9.to_i
'abcdefghijklmnopqrstuvwxyz'.split('').each do |c|
if s != (c * n) then
m = [func(s, c), m].min
end
end
puts m.to_s
end
if self.to_s == 'main' then
main(ARGV)
end
|
def func(s, c, d = 1)
t = '*' * (s.size - 1)
k = 0
(s.size - 1).times do |i|
if s[i] == c then
t[i] = c
elsif s[i + 1] == c then
t[i] = c
else
t[i] = s[i]
k += 1
end
end
return (k == 0) ? d : func(t, c, d + 1)
end
def main(argv)
s = gets.chomp
n = s.size
m = 1e+9.to_i
'abcdefghijklmnopqrstuvwxyz'.split('').each do |c|
if s != (c * n) then
m = [func(s, c), m].min
else
m = 0
end
end
puts m.to_s
end
if self.to_s == 'main' then
main(ARGV)
end
|
[
"assignment.add"
] | 1,358,954
| 1,358,955
|
u198355306
|
ruby
|
p03687
|
s = gets.chomp.split('')
h = Hash.new([])
0.upto(s.size - 1) do |i|
h[s[i]] += [i]
end
def diffmax(ary, size)
nary = [0] + ary + [size]
max = 0
1.upto(nary.size-1) do |i|
diff = nary[i] - nary[i-1] - 1
max = diff if max < diff
end
max
end
min = 10**12
h.each do |k, v|
diff = diffmax(v, s.size)
min = diff if min > diff
end
puts min
|
s = gets.chomp.split('')
h = Hash.new([])
0.upto(s.size - 1) do |i|
h[s[i]] += [i]
end
def diffmax(ary, size)
nary = [-1] + ary + [size]
max = 0
1.upto(nary.size-1) do |i|
diff = nary[i] - nary[i-1] - 1
max = diff if max < diff
end
max
end
min = 10**12
h.each do |k, v|
diff = diffmax(v, s.size)
min = diff if min > diff
end
puts min
|
[
"assignment.value.change",
"expression.operation.binary.change",
"expression.operation.unary.add"
] | 1,359,062
| 1,359,063
|
u434509016
|
ruby
|
p03687
|
gets;p$_.chars.map{|c|$_.split(c).map(&:size).max||0}.min
|
gets;p$_.chars.map{|c|$_.chop.split(c).map(&:size).max||0}.min
|
[
"call.add"
] | 1,359,077
| 1,359,078
|
u657913472
|
ruby
|
p03687
|
s=gets.chop;p [*?a..?z].map{|c|s.split(c).map{|t|t.size}.max}.min
|
s=gets.chop;p [*?a..?z].map{|c|s.split(c).map{|t|t.size}.max||0}.min
|
[
"expression.operation.binary.add"
] | 1,359,079
| 1,359,080
|
u657913472
|
ruby
|
p03687
|
S = gets
min = 99999999999
arr = *("a".."z")
arr.each{|alp|
tmp = S.split(alp).map{|s| s.size}.max
tmp = 0 if tmp.nil?
min > tmp ? min = tmp : 0
}
puts min
|
S = gets.chomp
min = 99999999999
arr = *("a".."z")
arr.each{|alp|
tmp = S.split(alp).map{|s| s.size}.max
tmp = 0 if tmp.nil?
min > tmp ? min = tmp : 0
}
puts min
|
[
"call.add"
] | 1,359,113
| 1,359,114
|
u415591191
|
ruby
|
p03687
|
s=gets.chop
puts (?a..?z).map{|c|s.split(c).map(&:size).max}.min
|
s=gets.chop
puts (?a..?z).map{|c|s.split(c).map(&:size).max||0}.min
|
[
"expression.operation.binary.add"
] | 1,359,256
| 1,359,257
|
u933935509
|
ruby
|
p03687
|
s=gets.chomp.reverse
p (?a..?z).map{|c|(c+s).scan(/[^#{c}]+/).map(&:size).max}.min
|
s=gets.chomp.reverse
p (?a..?z).map{|c|(c+s).scan(/[^#{c}]+/).map(&:size).max||0}.min
|
[] | 1,359,302
| 1,359,303
|
u353917577
|
ruby
|
p03688
|
n = gets.to_i
a = gets.split.map(&:to_i)
all = true
ans = true
min = a.min
max = a.max
for i in 0..n-2
all = false if a[i] != a[i+1]
end
if !all
cnt = a.count(min)
ans = false if max-1 > min || max <= cnt || (n-cnt)/(max-cnt) < 2
else
ans = false if n/min < 2 && min != n-1
end
puts ans ? "YES" : "NO"
|
n = gets.to_i
a = gets.split.map(&:to_i)
all = true
ans = true
min = a.min
max = a.max
for i in 0..n-2
all = false if a[i] != a[i+1]
end
if !all
cnt = a.count(min)
ans = false if max-1 > min || max <= cnt || (n-cnt)/(max-cnt) < 2
else
ans = false if n/min < 2 && min != n-1
end
puts ans ? "Yes" : "No"
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,359,638
| 1,359,639
|
u506255180
|
ruby
|
p03688
|
N = gets.to_i
get = "3 3 3 3 3"
a = gets.split(" ").map(&:to_i)
max = a.max
max_count = 0
kekka = true
N.times do |i|
kekka = false if a[i] < max - 1
min_count += 1 if a[i] == max - 1
end
if kekka
if 2 * max - min_count > N
kekka = false
elsif min_count >= max
kekka = false
end
end
kekka = true if a.all?{|item| item == N - 1}
if kekka
puts "Yes"
else
puts "No"
end
|
N = gets.to_i
get = "3 3 3 3 3"
a = gets.split(" ").map(&:to_i)
max = a.max
min_count = 0
kekka = true
N.times do |i|
kekka = false if a[i] < max - 1
min_count += 1 if a[i] == max - 1
end
if kekka
if 2 * max - min_count > N
kekka = false
elsif min_count >= max
kekka = false
end
end
kekka = true if a.all?{|item| item == N - 1}
if kekka
puts "Yes"
else
puts "No"
end
|
[
"assignment.variable.change",
"identifier.change"
] | 1,359,768
| 1,359,769
|
u220997159
|
ruby
|
p03688
|
#!/usr/bin/ruby
n,*a=`dd`.split.map(&:to_i)
a.sort!
mi,ma=a[0],a[-1]
if ma-mi>1 || n<=ma || mi<=1
puts :No
elsif ma-mi==0 && (mi==n-1||2*mi<=n)
puts :Yes
elsif ma-mi==1 && (x=(0...n).bsearch{|e|a[e]==ma}||n;x<ma&&2*(ma-x)<=n-x)
puts :Yes
else
puts :No
end
|
#!/usr/bin/ruby
n,*a=`dd`.split.map(&:to_i)
a.sort!
mi,ma=a[0],a[-1]
if ma-mi>1 || n<=ma || mi<1
puts :No
elsif ma-mi==0 && (mi==n-1||2*mi<=n)
puts :Yes
elsif ma-mi==1 && (x=(0...n).bsearch{|e|a[e]==ma}||n;x<ma&&2*(ma-x)<=n-x)
puts :Yes
else
puts :No
end
|
[
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,359,985
| 1,359,986
|
u280667879
|
ruby
|
p03693
|
rgb = gets.chop.strip.to_i
puts rgb % 4 == 0 ? "YES" : "NO"
|
rgb = gets.split.join.to_i
puts rgb % 4 == 0 ? "YES" : "NO"
|
[
"assignment.value.change",
"identifier.change"
] | 1,360,976
| 1,360,977
|
u683471974
|
ruby
|
p03693
|
rgb = gets.chop.strip.join.to_i
puts rgb % 4 == 0 ? "YES" : "NO"
|
rgb = gets.split.join.to_i
puts rgb % 4 == 0 ? "YES" : "NO"
|
[
"assignment.value.change",
"identifier.change",
"call.remove"
] | 1,360,978
| 1,360,977
|
u683471974
|
ruby
|
p03693
|
rgb = gets.chop.strip.to_i
puts rgb % 4 == 0 ? 'YES' : 'NO'
|
rgb = gets.split.join.to_i
puts rgb % 4 == 0 ? "YES" : "NO"
|
[
"assignment.value.change",
"identifier.change",
"literal.string.change",
"call.arguments.change"
] | 1,360,979
| 1,360,977
|
u683471974
|
ruby
|
p03693
|
a= gets.strip.gsub(" ", "").to_i
puts a/4 == 0 ? "YES" : "NO"
|
a= gets.strip.gsub(" ", "").to_i
puts a%4 == 0 ? "YES" : "NO"
|
[
"expression.operator.arithmetic.change",
"control_flow.branch.if.condition.change"
] | 1,361,742
| 1,361,743
|
u025457925
|
ruby
|
p03693
|
num = gets.chop.join.to_i
print num % 4 == 0 ? "YES" : "NO"
|
num = gets.chop.split.join.to_i
print num % 4 == 0 ? "YES" : "NO"
|
[
"call.add"
] | 1,361,827
| 1,361,828
|
u020467031
|
ruby
|
p03693
|
puts gets.chomp.join("").to_i % 4 == 0 ? "YES" : "NO"
|
puts gets.split.join("").to_i % 4 == 0 ? "YES" : "NO"
|
[
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,362,100
| 1,362,101
|
u390727364
|
ruby
|
p03693
|
puts gets.join("").to_i % 4 == 0 ? "YES" : "NO"
|
puts gets.split.join("").to_i % 4 == 0 ? "YES" : "NO"
|
[
"control_flow.branch.if.condition.change",
"call.add"
] | 1,362,102
| 1,362,101
|
u390727364
|
ruby
|
p03693
|
rgb = gets.split.join.to_i
p rgb % 4 == 0 ? 'YES' : 'NO'
|
rgb = gets.split.join.to_i
puts rgb % 4 == 0 ? 'YES' : 'NO'
|
[
"call.function.change",
"io.output.change"
] | 1,362,115
| 1,362,116
|
u968699140
|
ruby
|
p03693
|
r,g,b = gets.split(" ").map(&:to_i)
puts (100*a+10*g+b)%4==0 ? "YES" : "NO"
|
r,g,b=gets.split.map(&:to_i)
puts (100*r + 10*g+b)%4 ==0 ? "YES" : "NO"
|
[
"call.arguments.change",
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,362,170
| 1,362,169
|
u374190629
|
ruby
|
p03693
|
r,g,b = gets.split(" ").map(&:to_i)
p (100*r + 10*g + b) % 4 == 0 ? "YES" : "NO"
|
r,g,b=gets.split.map(&:to_i)
puts (100*r + 10*g+b)%4 ==0 ? "YES" : "NO"
|
[
"call.arguments.change",
"call.function.change",
"io.output.change"
] | 1,362,171
| 1,362,169
|
u374190629
|
ruby
|
p03693
|
r,g,b = gets.map(&:to_i)
puts (100*r + 10*g + b) % 4 == 0 ? "YES" : "NO"
|
r,g,b=gets.split.map(&:to_i)
puts (100*r + 10*g+b)%4 ==0 ? "YES" : "NO"
|
[
"call.add"
] | 1,362,172
| 1,362,169
|
u374190629
|
ruby
|
p03693
|
r,g,b = gets.split(" ").map(&:to_i)
puts (100*a+10*g+b)%4==0 ? "YES" : "NO"
|
r,g,b = gets.split(" ").map(&:to_i)
puts (100*r+10*g+b)%4==0 ? "YES" : "NO"
|
[
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,362,170
| 1,362,173
|
u374190629
|
ruby
|
p03693
|
r,g,b = gets.split(" ").map(&:to_i)
p (100*r + 10*g + b) % 4 == 0 ? "YES" : "NO"
|
r,g,b = gets.split(" ").map(&:to_i)
puts (100*r+10*g+b)%4==0 ? "YES" : "NO"
|
[
"call.function.change",
"io.output.change"
] | 1,362,171
| 1,362,173
|
u374190629
|
ruby
|
p03693
|
r, g, b = gets.split
num = [r,g,b].join.to_i
puts num % 4 == 0 ? 'Yes' : 'No'
|
r, g, b = gets.split
num = [r,g,b].join.to_i
puts num % 4 == 0 ? 'YES' : 'NO'
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,362,189
| 1,362,190
|
u776649162
|
ruby
|
p03693
|
puts gets.chomp.split.join.to_i%4 ? :YES : :NO
|
puts gets.chomp.split.join.to_i%4==0 ? :YES : :NO
|
[
"control_flow.branch.if.condition.change"
] | 1,362,259
| 1,362,260
|
u049159332
|
ruby
|
p03693
|
rgb = gets.chomp.gsub(' ','').to_i
puts rgb%4 == 0 ? 'Yes':'No'
|
rgb = gets.chomp.gsub(' ','').to_i
puts rgb%4 == 0 ? 'YES':'NO'
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,362,423
| 1,362,424
|
u175011963
|
ruby
|
p03693
|
cols = gets.chomp.split(' ').map(&:to_i).sort
if (cols[1].to_s + cols[2].to_s).to_i % 4 == 0
puts "YES"
else
puts "NO"
end
|
cols = gets.chomp.split(' ').map(&:to_i)
if (cols[1].to_s + cols[2].to_s).to_i % 4 == 0
puts "YES"
else
puts "NO"
end
|
[
"call.remove"
] | 1,362,581
| 1,362,582
|
u059126963
|
ruby
|
p03693
|
r,g,b = gets.split.map(&:to_i)
if (100*r)+(10*g)+b % 4 == 0
puts("YES")
else puts("NO")
end
|
r,g,b = gets.split.map(&:to_i)
x = (100*r)+(10*g)+b
if x%4 == 0
puts("YES")
else puts("NO")
end
|
[
"assignment.variable.change"
] | 1,362,644
| 1,362,645
|
u241469130
|
ruby
|
p03693
|
puts gets.delete(' ').to_i%4==0?:Yes: :No
|
puts gets.delete(' ').to_i%4==0?:YES: :NO
|
[
"call.arguments.change"
] | 1,362,666
| 1,362,667
|
u782685137
|
ruby
|
p03693
|
n = gets.split.join.to_i
puts (n/4 == 0) ? 'YES' : 'NO'
|
n = gets.split.join.to_i
puts (n%4 == 0) ? 'YES' : 'NO'
|
[
"expression.operator.arithmetic.change",
"control_flow.branch.if.condition.change"
] | 1,362,826
| 1,362,827
|
u320576758
|
ruby
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.