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 |
|---|---|---|---|---|---|---|---|
p03434
|
n = gets.to_i
a = gets.split.map(&:to_i).sort.reverse
q = o
a.each_with_index do |o,n|
if n.even?
q += o
else
q -= o
end
end
puts q
|
n = gets.to_i
a = gets.split.map(&:to_i).sort.reverse
q = 0
a.each_with_index do |o,n|
if n.even?
q += o
else
q -= o
end
end
puts q
|
[
"misc.typo",
"assignment.value.change",
"identifier.replace.remove",
"literal.replace.add"
] | 1,186,976
| 1,186,977
|
u217283930
|
ruby
|
p03434
|
n = gets.to_i
a = gets.split.map(&:to_i).sort.reverse
q = 0
a.each_with_index do |o,n|
if n.even?
q += 0
else
q -= 0
end
end
puts q
|
n = gets.to_i
a = gets.split.map(&:to_i).sort.reverse
q = 0
a.each_with_index do |o,n|
if n.even?
q += o
else
q -= o
end
end
puts q
|
[
"identifier.replace.add",
"literal.replace.remove"
] | 1,186,978
| 1,186,977
|
u217283930
|
ruby
|
p03434
|
n = gets
a = gets.split.map(&:to_i).sort.reverse
alice = bob = 0
(0..n-1).each do |i|
alice += a[i] if (i+1).odd?
bob += a[i] if (i+1).even?
end
puts alice-bob
|
n = gets.to_i
a = gets.split.map(&:to_i).sort.reverse
alice = bob = 0
(0..n-1).each do |i|
alice += a[i] if (i+1).odd?
bob += a[i] if (i+1).even?
end
puts alice-bob
|
[
"call.add"
] | 1,186,986
| 1,186,987
|
u374190629
|
ruby
|
p03434
|
_n = gets.to_i
a = gets.strip.split.map(&:to_i).sort.reverse
p a
i = 0
al = 0
bo = 0
a.each do |num|
if i % 2 == 0
al += num
else
bo += num
end
i += 1
end
puts al - bo
|
_n = gets.to_i
a = gets.strip.split.map(&:to_i).sort.reverse
i = 0
al = 0
bo = 0
a.each do |num|
if i % 2 == 0
al += num
else
bo += num
end
i += 1
end
puts al - bo
|
[
"call.remove"
] | 1,187,066
| 1,187,067
|
u511421299
|
ruby
|
p03434
|
n = gets.to_i
a = gets.strip.split.map(&:to_i).sort.reverse
p a
i = 0
al = 0
bo = 0
a.each do |num|
if i % 2 == 0
al += num
else
bo += num
end
i += 1
end
puts al - bo
|
_n = gets.to_i
a = gets.strip.split.map(&:to_i).sort.reverse
i = 0
al = 0
bo = 0
a.each do |num|
if i % 2 == 0
al += num
else
bo += num
end
i += 1
end
puts al - bo
|
[
"assignment.variable.change",
"identifier.change",
"call.remove"
] | 1,187,068
| 1,187,067
|
u511421299
|
ruby
|
p03434
|
n = gets.to_i
as = gets.strip.split.map(&:to_i).sort.reverse
alice = 0
bob = 0
i = 0
as.each do |a|
if i.even?
alice += a
else
bob += a
end
i += 1
end
|
_n = gets.to_i
as = gets.strip.split.map(&:to_i).sort.reverse
alice = 0
bob = 0
i = 0
as.each do |a|
if i.even?
alice += a
else
bob += a
end
i += 1
end
p alice - bob
|
[
"assignment.variable.change",
"identifier.change",
"call.add"
] | 1,187,167
| 1,187,168
|
u650215290
|
ruby
|
p03434
|
N = gets.to_i
a = gets.split.map(&:to_i)
c = 0
d = 0
for i in 0..N-1
for j in i..N-1
if a[i] > a[j]
b = a[j]
a[j] = a[i]
a[i] = b
end
end
# puts a[i]
end
# for k in (N-1)..0
# if k % 2 == 1
# c += a[k]
# else
# d += a[k]
# end
# end
# for k in 0..N-1
# if k % 2 == 1
# B += a[N-k-1]
# else
# A += a[N-k-1]
# end
# end
k = 1
while k <= N
c += a[N-k]
d += a[N-k-1]
k += 2
end
if N % 2 == 1
c += a[0]
end
print c-d
|
N = gets.to_i
a = gets.split.map(&:to_i)
c = 0
d = 0
for i in 0..N-1
for j in i..N-1
if a[i] > a[j]
b = a[j]
a[j] = a[i]
a[i] = b
end
end
# puts a[i]
end
# for k in (N-1)..0
# if k % 2 == 1
# c += a[k]
# else
# d += a[k]
# end
# end
# for k in 0..N-1
# if k % 2 == 1
# B += a[N-k-1]
# else
# A += a[N-k-1]
# end
# end
k = 1
while k < N
c += a[N-k]
d += a[N-k-1]
k += 2
end
if N % 2 == 1
c += a[0]
end
print c-d
|
[
"expression.operator.compare.change",
"expression.operation.binary.change"
] | 1,187,181
| 1,187,182
|
u456173040
|
ruby
|
p03434
|
n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i).sort!
alice_point = a.select.with_index{|num, index| index%2 != 0}.inject(&:+)
bob_point = a.select.with_index{|num, index| index%2 == 0}.inject(&:+)
print("#{alice_point - bob_point}")
|
n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i).sort!.reverse!
alice_point = a.select.with_index{|num, index| index%2 == 0}.inject(&:+)
bob_point = a.select.with_index{|num, index| index%2 != 0}.inject(&:+)
print("#{alice_point - bob_point}")
|
[
"call.arguments.change"
] | 1,187,377
| 1,187,379
|
u171717855
|
ruby
|
p03434
|
n = gets.to_i
m = gets.split.map(&:to_i).sort!
alice = []
bob = []
for i in 0..(n - 1)
if i.even?
alice << m[i]
elsif i.odd?
bob << m[i]
end
end
puts alice.inject(:+) - bob.inject(:+)
|
n = gets.to_i
m = gets.split.map(&:to_i).sort!.reverse!
alice = []
bob = []
for i in 0..(n - 1)
if i.even?
alice << m[i]
elsif i.odd?
bob << m[i]
end
end
puts alice.inject(:+) - bob.inject(:+)
|
[
"call.add"
] | 1,187,437
| 1,187,439
|
u990788654
|
ruby
|
p03433
|
n = gets.to_i
a = gets.to_i
if (n % 500) <= (a % 500)
puts("Yes")
else
puts("No")
end
|
n = gets.to_i
a = gets.to_i
if (n % 500) <= a
puts("Yes")
else
puts("No")
end
|
[
"control_flow.branch.if.condition.change"
] | 1,187,694
| 1,187,695
|
u776725702
|
ruby
|
p03433
|
n = gets.to_i
a = gets.to_i
if n % 500 <= a then
puts 'YES'
else
puts 'NO'
end
|
n = gets.to_i
a = gets.to_i
if (n % 500) <= a then
puts 'Yes'
else
puts 'No'
end
|
[
"control_flow.branch.if.condition.change",
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,187,757
| 1,187,758
|
u998662234
|
ruby
|
p03434
|
eval"N,*A="+gets(p).split*?,;a,*b=A.sort;b.map{|n|a+=n*$.=-$.};p -a
|
eval"N,*A="+gets(p).split*?,;a,*b=A.sort.reverse;b.map{|n|a+=n*$.=-$.};p a
|
[
"call.add",
"expression.operation.unary.arithmetic.remove",
"call.arguments.change"
] | 1,187,822
| 1,187,823
|
u711705317
|
ruby
|
p03435
|
c=[]
3.times do
c << gets.split.map(&:to_i)
end
if c[0][1]-c[0][0]==c[1][1]-c[1][0]&&c[1][1]-c[1][0]==c[2][1]-c[2][0]||c[0][2]-c[0][1]==c[1][2]-c[1][1]&&c[1][2]-c[1][1]==c[2][2]-c[2][1]||c[1][0]-c[0][0]==c[1][1]-c[0][1]&&c[1][1]-c[0][1]==c[1][2]-c[0][2]||c[2][0]-c[1][0]==c[2][1]-c[1][1]&&c[2][1]-c[1][1]==c[2][2]-c[1][2]
puts "Yes"
else
puts "No"
end
|
c=[]
3.times do
c << gets.split.map(&:to_i)
end
if c[0][1]-c[0][0]==c[1][1]-c[1][0]&&c[1][1]-c[1][0]==c[2][1]-c[2][0]&&c[0][2]-c[0][1]==c[1][2]-c[1][1]&&c[1][2]-c[1][1]==c[2][2]-c[2][1]&&c[1][0]-c[0][0]==c[1][1]-c[0][1]&&c[1][1]-c[0][1]==c[1][2]-c[0][2]&&c[2][0]-c[1][0]==c[2][1]-c[1][1]&&c[2][1]-c[1][1]==c[2][2]-c[1][2]
puts "Yes"
else
puts "No"
end
|
[
"misc.opposites",
"control_flow.branch.if.condition.change"
] | 1,187,879
| 1,187,880
|
u744908753
|
ruby
|
p03435
|
C=3.times.map { gets.chomp.split.map(&:to_i) }
# 各行の最小値を減算
3.times do |i|
m=C[i].min
3.times do |j|
C[i][j]-=m
end
end
p C
# 列の数値が同じか検証
3.times do |i|
if C[0][i]!=C[1][i] || C[1][i]!=C[2][i]
puts 'No'
exit
end
end
puts 'Yes'
|
C=3.times.map { gets.chomp.split.map(&:to_i) }
# 各行の最小値を減算
3.times do |i|
m=C[i].min
3.times do |j|
C[i][j]-=m
end
end
# 列の数値が異なった場合、Noを出力
3.times do |i|
if C[0][i]!=C[1][i] || C[1][i]!=C[2][i]
puts 'No'
exit
end
end
puts 'Yes'
|
[
"call.remove"
] | 1,188,252
| 1,188,253
|
u854471099
|
ruby
|
p03435
|
C=3.times.map { gets.chomp.split.map(&:to_i) }
# 各行の最小値を減算
3.times do |i|
m=C[i].min
3.times do |j|
C[i][j]-=m
end
end
# 列の数値が同じか検証
3.times do |i|
if C[0][i]!=C[1][i] && C[1][i]!=C[2][i]
puts 'No'
exit
end
end
puts 'Yes'
|
C=3.times.map { gets.chomp.split.map(&:to_i) }
# 各行の最小値を減算
3.times do |i|
m=C[i].min
3.times do |j|
C[i][j]-=m
end
end
# 列の数値が異なった場合、Noを出力
3.times do |i|
if C[0][i]!=C[1][i] || C[1][i]!=C[2][i]
puts 'No'
exit
end
end
puts 'Yes'
|
[
"misc.opposites",
"control_flow.branch.if.condition.change"
] | 1,188,254
| 1,188,253
|
u854471099
|
ruby
|
p03435
|
C = 3.times.map{gets.split.map(&:to_i)}
r,m = C.flatten.inject(0,&:+).divmod(3)
puts (m == 0 && (0..2).permutation.all?{|i,j,k| C[0][i] + C[1][j] + C[2][k] == r}) ? "Yes" : "No"
|
C = 3.times.map{gets.split.map(&:to_i)}
r,m = C.flatten.inject(0,&:+).divmod(3)
puts (m == 0 && [0,1,2].permutation.all?{|i,j,k| C[0][i] + C[1][j] + C[2][k] == r}) ? "Yes" : "No"
|
[
"control_flow.branch.if.condition.change"
] | 1,188,270
| 1,188,271
|
u627981707
|
ruby
|
p03435
|
c = []
while s = gets
c.push(s.split.map(&:to_i))
end
if (c[0][0]-c[1][0]) != (c[0][1]-c[1][1]) ||(c[0][0]-c[1][0]) != (c[0][2]-c[1][2])
puts "No1"
exit
elsif (c[1][0]-c[2][0]) != (c[1][1]-c[2][1]) ||(c[1][0]-c[2][0]) != (c[1][2]-c[2][2])
puts "No2"
exit
elsif (c[0][0]-c[0][1]) != (c[1][0]-c[1][1]) ||(c[0][0]-c[0][1]) != (c[2][0]-c[2][1])
puts "No3"
exit
elsif (c[0][1]-c[0][2]) != (c[1][1]-c[1][2]) ||(c[0][1]-c[0][2]) != (c[2][1]-c[2][2])
puts "No4"
exit
end
puts "Yes"
|
c = []
while s = gets
c.push(s.split.map(&:to_i))
end
if (c[0][0]-c[1][0]) != (c[0][1]-c[1][1]) ||(c[0][0]-c[1][0]) != (c[0][2]-c[1][2])
puts "No"
exit
elsif (c[1][0]-c[2][0]) != (c[1][1]-c[2][1]) ||(c[1][0]-c[2][0]) != (c[1][2]-c[2][2])
puts "No"
exit
elsif (c[0][0]-c[0][1]) != (c[1][0]-c[1][1]) ||(c[0][0]-c[0][1]) != (c[2][0]-c[2][1])
puts "No"
exit
elsif (c[0][1]-c[0][2]) != (c[1][1]-c[1][2]) ||(c[0][1]-c[0][2]) != (c[2][1]-c[2][2])
puts "No"
exit
end
puts "Yes"
|
[
"literal.string.change",
"call.arguments.change"
] | 1,188,389
| 1,188,390
|
u614043796
|
ruby
|
p03435
|
grid = []
3.times do
grid << gets.split(" ").map(&:to_i)
end
ans = "Yes"
2.times do |i|
row = grid[i]
nextrow = grid[i+1]
tmp1 = row[0] - nextrow[0]
tmp2 = row[1] - nextrow[1]
tmp3 = row[2] - nextrow[2]
if !(tmp1 == tmp2 && tmp1 == tmp3)
ans = "No"
break
end
end
2.times do |i|
grid = grid.transpose
row = grid[i]
nextrow = grid[i+1]
tmp1 = row[0] - nextrow[0]
tmp2 = row[1] - nextrow[1]
tmp3 = row[2] - nextrow[2]
if !(tmp1 == tmp2 && tmp1 == tmp3)
ans = "No"
break
end
end
p ans
|
grid = []
3.times do
grid << gets.split(" ").map(&:to_i)
end
ans = "Yes"
2.times do |i|
row = grid[i]
nextrow = grid[i+1]
tmp1 = row[0] - nextrow[0]
tmp2 = row[1] - nextrow[1]
tmp3 = row[2] - nextrow[2]
if !(tmp1 == tmp2 && tmp1 == tmp3)
ans = "No"
break
end
end
2.times do |i|
grid = grid.transpose
row = grid[i]
nextrow = grid[i+1]
tmp1 = row[0] - nextrow[0]
tmp2 = row[1] - nextrow[1]
tmp3 = row[2] - nextrow[2]
if !(tmp1 == tmp2 && tmp1 == tmp3)
ans = "No"
break
end
end
puts ans
|
[
"call.function.change",
"io.output.change"
] | 1,188,437
| 1,188,438
|
u298628832
|
ruby
|
p03435
|
mat = 3.times.map{ gets.split.map(&:to_i) }
def check(mat)
mat[0][0] - mat[1][0] == mat[0][1] - mat[1][1] &&
mat[0][1] - mat[1][1] == mat[0][2] - mat[1][2] &&
mat[1][0] - mat[1][1] == mat[1][1] - mat[2][1] &&
mat[1][1] - mat[2][1] == mat[1][2] - mat[2][2]
end
if check(mat) && check(mat.transpose) then puts "Yes"
else puts "No"
end
|
mat = 3.times.map{ gets.split.map(&:to_i) }
def check(mat)
mat[0][0] - mat[1][0] == mat[0][1] - mat[1][1] &&
mat[0][1] - mat[1][1] == mat[0][2] - mat[1][2] &&
mat[1][0] - mat[2][0] == mat[1][1] - mat[2][1] &&
mat[1][1] - mat[2][1] == mat[1][2] - mat[2][2]
end
if check(mat) && check(mat.transpose) then puts "Yes"
else puts "No"
end
|
[
"literal.number.integer.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change"
] | 1,188,450
| 1,188,451
|
u331906013
|
ruby
|
p03435
|
mat = 3.times.map{ gets.split.map(&:to_i) }
def check(mat)
mat[0][0] - mat[1][0] == mat[0][1] - mat[1][1] &&
mat[0][1] - mat[1][1] == mat[0][2] - mat[1][2] &&
mat[1][0] - mat[1][1] == mat[1][1] - mat[2][1] &&
mat[1][1] - mat[2][1] == mat[1][2] - mat[2][2]
end
if check(mat) && check(mat.tanspose) then puts "Yes"
else puts "No"
end
|
mat = 3.times.map{ gets.split.map(&:to_i) }
def check(mat)
mat[0][0] - mat[1][0] == mat[0][1] - mat[1][1] &&
mat[0][1] - mat[1][1] == mat[0][2] - mat[1][2] &&
mat[1][0] - mat[2][0] == mat[1][1] - mat[2][1] &&
mat[1][1] - mat[2][1] == mat[1][2] - mat[2][2]
end
if check(mat) && check(mat.transpose) then puts "Yes"
else puts "No"
end
|
[
"literal.number.integer.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change",
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,188,452
| 1,188,451
|
u331906013
|
ruby
|
p03435
|
c=Array.new(3)
c[0]=gets.split.map(&:to_i)
c[1]=gets.split.map(&:to_i)
c[2]=gets.split.map(&:to_i)
if 0 == c[0][0]+c[1][1]+c[2][2]-c[0][1]-c[1][2]-c[2][0] || 0 == c[0][0]+c[1][1]+c[2][2]-c[0][2]-c[1][0]-c[2][1] then
print "Yes\n"
else
print "No\n"
end
|
c=Array.new(3)
c[0]=gets.split.map(&:to_i)
c[1]=gets.split.map(&:to_i)
c[2]=gets.split.map(&:to_i)
if 0 == c[0][0]+c[1][1]+c[2][2]-c[0][1]-c[1][2]-c[2][0] && 0 == c[0][0]+c[1][1]+c[2][2]-c[0][2]-c[1][0]-c[2][1] then
print "Yes\n"
else
print "No\n"
end
|
[
"misc.opposites",
"control_flow.branch.if.condition.change"
] | 1,188,675
| 1,188,676
|
u308416164
|
ruby
|
p03436
|
@queue = [[0,0,1]]
@s = []
def retrieve(y, x)
while !@queue.empty?
point = @queue.shift
if point[0, 2] == [x - 1, y - 1]
@s[point[1]][point[0]] = "*"
@queue.push point
return
end
if @s[point[1]][point[0] + 1] == "."
@s[point[1]][point[0] + 1] = "*"
@queue.push [point[0] + 1, point[1], point[2] + 1]
end
if @s[point[1] + 1][point[0]] == "."
@s[point[1] + 1][point[0]] = "*"
@queue.push [point[0], point[1] + 1, point[2] + 1]
end
if @s[point[1] - 1][point[0]] == "."
@s[point[1] - 1][point[0]] = "*"
@queue.push [point[0], point[1] - 1, point[2] + 1]
end
if @s[point[1]][point[0] - 1] == "."
@s[point[1]][point[0] - 1] = "*"
@queue.push [point[0] - 1, point[1], point[2] + 1]
end
end
end
h,w = gets.split.map(&:to_i)
whites = 0
h.times do |i|
@s[i] = gets
whites += @s[i].count(".")
end
@s[h] = "#" * w.next
@s[0][0] = "*"
retrieve(h, w)
p @queue
if @queue[0].nil?
puts -1
else
puts whites - @queue[-1][2]
end
|
@queue = [[0,0,1]]
@s = []
def retrieve(y, x)
while !@queue.empty?
point = @queue.shift
if point[0, 2] == [x - 1, y - 1]
@s[point[1]][point[0]] = "*"
@queue.push point
return
end
if @s[point[1]][point[0] + 1] == "."
@s[point[1]][point[0] + 1] = "*"
@queue.push [point[0] + 1, point[1], point[2] + 1]
end
if @s[point[1] + 1][point[0]] == "."
@s[point[1] + 1][point[0]] = "*"
@queue.push [point[0], point[1] + 1, point[2] + 1]
end
if @s[point[1] - 1][point[0]] == "."
@s[point[1] - 1][point[0]] = "*"
@queue.push [point[0], point[1] - 1, point[2] + 1]
end
if @s[point[1]][point[0] - 1] == "."
@s[point[1]][point[0] - 1] = "*"
@queue.push [point[0] - 1, point[1], point[2] + 1]
end
end
end
h,w = gets.split.map(&:to_i)
whites = 0
h.times do |i|
@s[i] = gets
whites += @s[i].count(".")
end
@s[h] = "#" * w.next
@s[0][0] = "*"
retrieve(h, w)
if @queue[0].nil?
puts -1
else
puts whites - @queue[-1][2]
end
|
[
"call.remove"
] | 1,189,761
| 1,189,762
|
u004919448
|
ruby
|
p03436
|
h,w = gets.chomp.split(" ").map(&:to_i)
s = h.times.map{"#"+gets.chomp+"#"}.unshift("#"*(w+2)).push("#"*(w+2))
ans = 0
s.each do |str|
ans += str.count(".")
end
vst = [[1,1]]
disp = [[0,1],[0,-1],[1,0],[-1,0]]
size = 0
bsize = 0
while size != bsize
size = bsize
bsize = vst.size
vst[size..-1].each do |i,j|
if i == h && j == w
puts ans-1
exit
end
disp.each do |k,l|
if s[i+k][j+l] == "."
vst << [i+k,j+l]
s[i+k][j+l] = "#"
end
end
end
ans -= 1
end
puts "-1"
|
h,w = gets.chomp.split(" ").map(&:to_i)
s = h.times.map{"#"+gets.chomp+"#"}.unshift("#"*(w+2)).push("#"*(w+2))
ans = 0
s.each do |str|
ans += str.count(".")
end
vst = [[1,1]]
disp = [[0,1],[0,-1],[1,0],[-1,0]]
size = -1
bsize = 0
while size != bsize
size = bsize
bsize = vst.size
vst[size..-1].each do |i,j|
if i == h && j == w
puts ans-1
exit
end
disp.each do |k,l|
if s[i+k][j+l] == "."
vst << [i+k,j+l]
s[i+k][j+l] = "#"
end
end
end
ans -= 1
end
puts "-1"
|
[
"assignment.value.change",
"expression.operation.unary.add"
] | 1,189,786
| 1,189,787
|
u506255180
|
ruby
|
p03436
|
def s()
gets()
end
def i()
gets.to_i
end
def li()
gets.split.map(&:to_i)
end
def ls()
gets.split
end
def ili()
n = gets.to_i
as = gets.split.map(&:to_i)
[n, as]
end
H, W =li()
def getMovePos(pos)
res = [[pos[0]+1, pos[1]], [pos[0]-1, pos[1]], [pos[0], pos[1]+1], [pos[0], pos[1]-1]]
if pos[0] == 0
res -= [[pos[0]-1, pos[1]]]
end
if pos[0] == H-1
res -= [[pos[0]+1, pos[1]]]
end
if pos[1] == 0
res -= [[pos[0], pos[1]-1]]
end
if pos[1] == W-1
res -= [[pos[0], pos[1]+1]]
end
res
end
s = []
H.times{
s << s()
}
que = [[0, 0]]
visited = []
dist = []
H.times{
visited << Array.new(W, 0)
dist << Array.new(W, 0)
}
white_count = 0
H.times{|i|
W.times{|j|
if s[i][j] == "."
white_count += 1
end
}
}
visited[0][0] = 1
goal = false
while que.length > 0
current = que.pop
movePos = getMovePos(current)
movePos.each{|m|
if s[m[0]][m[1]] == "." && visited[m[0]][m[1]] == 0
visited[m[0]][m[1]] = 1
que.push(m)
dist[m[0]][m[1]] = dist[current[0]][current[1]] + 1
end
if m[0] == H-1 && m[1] == W-1
goal = true
break
end
}
end
if goal && s[0][0] != "#" && s[H-1][W-1] != "#"
puts white_count - dist[H-1][W-1] -1
else
puts -1
end
|
def s()
gets()
end
def i()
gets.to_i
end
def li()
gets.split.map(&:to_i)
end
def ls()
gets.split
end
def ili()
n = gets.to_i
as = gets.split.map(&:to_i)
[n, as]
end
H, W =li()
def getMovePos(pos)
res = [[pos[0]+1, pos[1]], [pos[0]-1, pos[1]], [pos[0], pos[1]+1], [pos[0], pos[1]-1]]
if pos[0] == 0
res -= [[pos[0]-1, pos[1]]]
end
if pos[0] == H-1
res -= [[pos[0]+1, pos[1]]]
end
if pos[1] == 0
res -= [[pos[0], pos[1]-1]]
end
if pos[1] == W-1
res -= [[pos[0], pos[1]+1]]
end
res
end
s = []
H.times{
s << s()
}
que = [[0, 0]]
visited = []
dist = []
H.times{
visited << Array.new(W, 0)
dist << Array.new(W, 0)
}
white_count = 0
H.times{|i|
W.times{|j|
if s[i][j] == "."
white_count += 1
end
}
}
visited[0][0] = 1
goal = false
while que.length > 0
current = que.shift
movePos = getMovePos(current)
movePos.each{|m|
if s[m[0]][m[1]] == "." && visited[m[0]][m[1]] == 0
visited[m[0]][m[1]] = 1
que.push(m)
dist[m[0]][m[1]] = dist[current[0]][current[1]] + 1
end
if m[0] == H-1 && m[1] == W-1
goal = true
break
end
}
end
if goal && s[0][0] != "#" && s[H-1][W-1] != "#"
puts white_count - dist[H-1][W-1] -1
else
puts -1
end
|
[
"assignment.value.change",
"identifier.change"
] | 1,189,840
| 1,189,841
|
u884847580
|
ruby
|
p03437
|
a,b=gets.split.map(&:to_i)
puts a%b==0 ? a : "-1"
|
a,b=gets.split.map(&:to_i)
puts a%b!=0 ? a : "-1"
|
[] | 1,190,162
| 1,190,163
|
u744908753
|
ruby
|
p03437
|
a,b=gets.split.map(&:to_i)
puts a!=b ? a : "-1"
|
a,b=gets.split.map(&:to_i)
puts a%b!=0 ? a : "-1"
|
[
"call.arguments.change",
"assignment.value.change",
"identifier.replace.remove",
"literal.replace.add",
"control_flow.branch.if.condition.change"
] | 1,190,164
| 1,190,163
|
u744908753
|
ruby
|
p03437
|
x,y=gets.strip.split.map(&:to_i)
puts y%x==0 ? -1 : x
|
x,y=gets.strip.split.map(&:to_i)
puts x%y==0 ? -1 : x
|
[
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 1,190,208
| 1,190,209
|
u172873334
|
ruby
|
p03437
|
x,y=gets.split.map(&:to_i)
puts y%x==0 ? -1 : x
|
x,y=gets.strip.split.map(&:to_i)
puts x%y==0 ? -1 : x
|
[
"call.add",
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 1,190,210
| 1,190,209
|
u172873334
|
ruby
|
p03437
|
x, y = gets.split.map(&:to_i)
if y % x == 0
puts -1
else
puts x
end
|
x, y = gets.split.map(&:to_i)
if x % y == 0
puts -1
else
puts x
end
|
[
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 1,190,318
| 1,190,319
|
u729246375
|
ruby
|
p03437
|
x,y=gets.chomp.split.map(&:to_i)
puts x/y==0 ? -1 : x
|
x,y=gets.chomp.split.map(&:to_i)
puts x%y==0 ? -1 : x
|
[
"expression.operator.arithmetic.change",
"control_flow.branch.if.condition.change"
] | 1,190,377
| 1,190,378
|
u868089307
|
ruby
|
p03437
|
x,y = gets.split.map &:to_i
if y%x==0
puts -1
else
puts x
end
|
x,y = gets.split.map &:to_i
if x%y==0
puts -1
else
puts x
end
|
[
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 1,190,934
| 1,190,935
|
u397763977
|
ruby
|
p03436
|
def moves(pos)
return [[-1, 0], [1, 0], [0, -1], [0, 1]].map do |move|
pos.zip(move).map{|x, d| x + d}
end
end
h, w = gets.chomp.split(" ").map(&:to_i)
# input padded with wall
s = [[false] * (w + 2)]
h.times do
s << [false, gets.chomp.split("").map{|chr| chr == "."}, false].flatten
end
s << [false] * (w + 2)
brank_cell = s.flatten.count(true)
# bfs
visited = Array.new(h + 2).map{|row| Array.new(w + 2)}
visited[1][1] = true
queue = [[1, 1]]
step = 1
while !visited[h][w] && brank_cell - step > 0
new_queue = []
queue.each do |pos|
moves(pos).each do |newpos|
x, y = newpos
if s[x][y] && !visited[x][y]
new_queue << newpos
visited[x][y] = true
end
end
end
step += 1
queue = new_queue
end
# puts brank_cell - step > 0 ? brank_cell - step : -1
puts [brank_cell - step, -1].max
|
def moves(pos)
return [[-1, 0], [1, 0], [0, -1], [0, 1]].map do |move|
pos.zip(move).map{|x, d| x + d}
end
end
h, w = gets.chomp.split(" ").map(&:to_i)
# input padded with wall
s = [[false] * (w + 2)]
h.times do
s << [false, gets.chomp.split("").map{|chr| chr == "."}, false].flatten
end
s << [false] * (w + 2)
brank_cell = s.flatten.count(true)
# bfs
visited = Array.new(h + 2).map{|row| Array.new(w + 2)}
visited[1][1] = true
queue = [[1, 1]]
step = 1
while !visited[h][w] && brank_cell - step > -1
new_queue = []
queue.each do |pos|
moves(pos).each do |newpos|
x, y = newpos
if s[x][y] && !visited[x][y]
new_queue << newpos
visited[x][y] = true
end
end
end
step += 1
queue = new_queue
end
# puts brank_cell - step > 0 ? brank_cell - step : -1
puts [brank_cell - step, -1].max
|
[
"expression.operation.binary.change",
"expression.operation.unary.add"
] | 1,190,975
| 1,190,976
|
u655122274
|
ruby
|
p03438
|
n=gets.to_i
a=gets.split.map(&:to_i)
b=gets.split.map(&:to_i)
aa,bb=0,0
n.times do |i|
if a[i]<b[i]
aa+=(b[i]-a[i]-1)/2
else
bb+=a[i]-b[i]
end
end
puts aa>=bb ? "Yes" : "No"
|
n=gets.to_i
a=gets.split.map(&:to_i)
b=gets.split.map(&:to_i)
aa,bb=0,0
n.times do |i|
if a[i]<b[i]
aa+=(b[i]-a[i])/2
else
bb+=a[i]-b[i]
end
end
puts aa>=bb ? "Yes" : "No"
|
[
"expression.operation.binary.remove"
] | 1,191,515
| 1,191,516
|
u744908753
|
ruby
|
p03438
|
n=gets.to_i
a=gets.split.map(&:to_i)
b=gets.split.map(&:to_i)
aa,bb=0,0
n.times do |i|
if a[i]<b[i]
bb+=1 if (b[i]-a[i]).odd?
aa+=(b[i]-a[i])/2+1
else
bb+=a[i]-b[i]
end
end
if aa>=bb
puts "Yes"
else
puts "No"
end
|
n=gets.to_i
a=gets.split.map(&:to_i)
b=gets.split.map(&:to_i)
aa,bb=0,0
n.times do |i|
if a[i]<b[i]
bb+=1 if (b[i]-a[i]).odd?
aa+=(b[i]-a[i]+1)/2
else
bb+=a[i]-b[i]
end
end
if aa>=bb
puts "Yes"
else
puts "No"
end
|
[
"expression.operation.binary.remove"
] | 1,191,517
| 1,191,518
|
u744908753
|
ruby
|
p03438
|
n=gets.to_i
a=gets.split.map(&:to_i)
b=gets.split.map(&:to_i)
aa,bb=0,0
n.times do |i|
if a[i]<b[i]
bb+=1 if (b[i]-a[i]).odd?
aa+=(b[i]-a[i])/2
else
bb+=a[i]-b[i]
end
end
if aa>=bb
puts "Yes"
else
puts "No"
end
|
n=gets.to_i
a=gets.split.map(&:to_i)
b=gets.split.map(&:to_i)
aa,bb=0,0
n.times do |i|
if a[i]<b[i]
bb+=1 if (b[i]-a[i]).odd?
aa+=(b[i]-a[i]+1)/2
else
bb+=a[i]-b[i]
end
end
if aa>=bb
puts "Yes"
else
puts "No"
end
|
[
"expression.operation.binary.add"
] | 1,191,519
| 1,191,518
|
u744908753
|
ruby
|
p03438
|
b = 0
n = gets.to_i
xs = gets.split.map(&:to_i)
ys = gets.split.map(&:to_i)
ts = xs.zip(ys).map{|x,y| x-y}.sort.reverse
p ts
ts.each_with_index do |d, i|
if d > 0
if i == n-1
puts :No
exit
end
b += d # +2*b
elsif d < 0
k = [(-d)/2, b].min
b -= k
end
end
if b == 0
puts :Yes
else
puts :No
end
|
b = 0
n = gets.to_i
xs = gets.split.map(&:to_i)
ys = gets.split.map(&:to_i)
ts = xs.zip(ys).map{|x,y| x-y}.sort.reverse
ts.each_with_index do |d, i|
if d > 0
if i == n-1
puts :No
exit
end
b += d # +2*b
elsif d < 0
k = [(-d)/2, b].min
b -= k
end
end
if b == 0
puts :Yes
else
puts :No
end
|
[
"call.remove"
] | 1,192,078
| 1,192,079
|
u161323909
|
ruby
|
p03447
|
(gets.to_i-gets.to_i)%gets.to_i
|
p (gets.to_i-gets.to_i)%gets.to_i
|
[
"io.output.change",
"call.add"
] | 1,194,158
| 1,194,159
|
u891258088
|
ruby
|
p03447
|
money = gets.to_i
cake_price = gets.to_i
donut_price = gets.to_i
money -= (cake_price + donut_price)
puts money
|
money = gets.to_i
cake_price = gets.to_i
donut_price = gets.to_i
money -= cake_price
money = money % donut_price
puts money
|
[
"assignment.variable.change",
"expression.operation.binary.change"
] | 1,194,195
| 1,194,196
|
u437808336
|
ruby
|
p03447
|
x,a,b=gets.split.map(&:to_i);puts (x-a)%b
|
x,a,b=readlines.map(&:to_i);puts (x-a)%b
|
[
"assignment.value.change",
"identifier.change",
"call.remove"
] | 1,194,256
| 1,194,257
|
u050914494
|
ruby
|
p03447
|
x=gets.chomp.to_i
a=gets.chomp.to_i
c=gets.chomp.to_i
(x-a)%c
|
x=gets.chomp.to_i
a=gets.chomp.to_i
c=gets.chomp.to_i
puts (x-a)%c
|
[
"io.output.change",
"call.add"
] | 1,194,564
| 1,194,565
|
u831999711
|
ruby
|
p03447
|
x,a,b=gets.split.map(&:to_i)
puts (x-a)%b
|
x,a,b=[gets,gets,gets].map(&:to_i)
puts (x-a)%b
|
[
"literal.array.change"
] | 1,194,584
| 1,194,585
|
u056944756
|
ruby
|
p03448
|
a, b, c, x = 4.times.map { gets.to_i }
cnt = 0
(0..a).each do |i|
(0..b).each do |j|
(0..c).each do |k|
if i * 500 + j * 100 + k * 50 == x
cnt.succ
end
end
end
end
puts cnt
|
a, b, c, x = 4.times.map { gets.to_i }
cnt = 0
(0..a).each do |i|
(0..b).each do |j|
(0..c).each do |k|
if i * 500 + j * 100 + k * 50 == x
cnt +=1
end
end
end
end
puts cnt
|
[] | 1,195,044
| 1,195,045
|
u246530341
|
ruby
|
p03448
|
A, B, C, X = 4.times.map { gets.to_i }
count = 0
(0..A).each do |i|
(0..B).each do |j|
(0..c).each do |k|
count += 1 if 500*i + 100*j + 50*k == X
end
end
end
puts count
|
A, B, C, X = 4.times.map { gets.to_i }
count = 0
(0..A).each do |i|
(0..B).each do |j|
(0..C).each do |k|
count += 1 if 500*i + 100*j + 50*k == X
end
end
end
puts count
|
[
"misc.typo"
] | 1,195,090
| 1,195,091
|
u197559656
|
ruby
|
p03448
|
a,b,c,x = 4.times.map { gets.to_i}
cnt = 0
(0..a).each do |i|
(0..b).each do |j|
(0..c).each do |k|
cnt += 1 if i * 50 + j * 100 + k * 500 == x
end
end
end
puts cnt
|
a,b,c,x = 4.times.map { gets.to_i}
cnt = 0
(0..a).each do |i|
(0..b).each do |j|
(0..c).each do |k|
cnt += 1 if i * 500 + j * 100 + k * 50 == x
end
end
end
puts cnt
|
[
"literal.number.integer.change",
"control_flow.branch.if.condition.change"
] | 1,195,174
| 1,195,175
|
u921695699
|
ruby
|
p03448
|
a,b,c,x = 4.times.map{gets.to_i}
cnt = 0
(0...a).each do |i|
(0...b).each do |j|
(0...c).each do |k|
cnt += 1 if i*500 + j*100 + k*50 == x
end
end
end
puts cnt
|
a, b, c, x = 4.times.map { gets.to_i }
cnt = 0
(0..a).each do |i|
(0..b).each do |j|
(0..c).each do |k|
cnt += 1 if i * 500 + j * 100 + k * 50 == x
end
end
end
puts cnt
|
[] | 1,195,401
| 1,195,402
|
u287369786
|
ruby
|
p03448
|
a, b, c, d = 4.times.map { gets.to_i }
cnt = 0
(0..a).each do |i|
(0..b).each do |j|
(0..c).each do |k|
cnt += 1 if i * 500 + j * 100 + k * 50 == x
end
end
end
puts cnt
|
a, b, c, x = 4.times.map { gets.to_i }
cnt = 0
(0..a).each do |i|
(0..b).each do |j|
(0..c).each do |k|
cnt += 1 if i * 500 + j * 100 + k * 50 == x
end
end
end
puts cnt
|
[
"assignment.variable.change",
"identifier.change"
] | 1,195,450
| 1,195,451
|
u487733837
|
ruby
|
p03448
|
a = gets.to_i
b = gets.to_i
c = gets.to_i
x = gets.to_i
count = 0
(a+1).times do |i|
(b+1).times do |j|
(c+1).times do |k|
count += 1 if 500*a + 100*b + 50*c == x
end
end
end
puts count
|
a = gets.to_i
b = gets.to_i
c = gets.to_i
x = gets.to_i
count = 0
(a+1).times do |i|
(b+1).times do |j|
(c+1).times do |k|
count += 1 if 500*i + 100*j + 50*k == x
end
end
end
puts count
|
[
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,195,534
| 1,195,535
|
u356158489
|
ruby
|
p03448
|
a,b,c,x = 4.times.map{ gets.to_i }
cnt = 0
(0..a).each do |i|
(0..b).each do |m|
(0..c).each do |n|
cnt += 1 if a * 500 + b * 100 + c * 50 == x
end
end
end
puts cnt
|
a,b,c,x = 4.times.map{ gets.to_i }
cnt = 0
(0..a).each do |i|
(0..b).each do |m|
(0..c).each do |n|
cnt += 1 if i * 500 + m * 100 + n * 50 == x
end
end
end
puts cnt
|
[
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,195,650
| 1,195,651
|
u809809975
|
ruby
|
p03448
|
a,b,c,d=`dd`.split.map(&:to_i)
e=0
0.upto(a){|x|0.upto(b){|y|0.upto(c){|z|d+=1 if 500*x+100*y+50*z==d}}}
p e
|
a,b,c,d=`dd`.split.map(&:to_i)
e=0
0.upto(a){|x|0.upto(b){|y|0.upto(c){|z|e+=1 if 500*x+100*y+50*z==d}}}
p e
|
[
"identifier.change"
] | 1,195,919
| 1,195,918
|
u264508862
|
ruby
|
p03448
|
a,b,c,x=`dd`.split.map(&:to_i)
d=0
0.upto(a){|x|0.upto(b){|y|0.upto(c){|z|d+=1 if 500*x+100*y+50*z==x}}}
p d
|
a,b,c,d=`dd`.split.map(&:to_i)
e=0
0.upto(a){|x|0.upto(b){|y|0.upto(c){|z|e+=1 if 500*x+100*y+50*z==d}}}
p e
|
[
"assignment.variable.change",
"identifier.change",
"control_flow.branch.if.condition.change",
"call.arguments.change"
] | 1,195,920
| 1,195,918
|
u264508862
|
ruby
|
p03448
|
A,B,C,X=4.times.map{gets.to_i}
i=0
for a in 0..A
for b in 0..B
for c in 0..C
i+=1 if 500*a+100*b+50*c==X
end
end
end
p c
|
A,B,C,X=4.times.map{gets.to_i}
i=0
for a in 0..A
for b in 0..B
for c in 0..C
i+=1 if 500*a+100*b+50*c==X
end
end
end
puts i
|
[] | 1,195,939
| 1,195,940
|
u585819925
|
ruby
|
p03448
|
A,B,C,X=4.times.map{gets.to_i}
i=0
for a in 0..A
for b in 0..B
for c in 0..C
c+=1 if 500*a+100*b+50*c==X
end
end
end
p c
|
A,B,C,X=4.times.map{gets.to_i}
i=0
for a in 0..A
for b in 0..B
for c in 0..C
i+=1 if 500*a+100*b+50*c==X
end
end
end
puts i
|
[
"identifier.change"
] | 1,195,941
| 1,195,940
|
u585819925
|
ruby
|
p03448
|
coin500 = gets.chomp.to_i
coin100 = gets.chomp.to_i
coin50 = gets.chomp.to_i
pay = gets.chomp.to_i
answer = 0
0.upto(coin500 + 1) do |i|
pay500 = 500 * i
0.upto(coin100 + 1) do |j|
pay100 = 100 * j
0.upto(coin50 + 1) do |k|
pay50 = 50 * k
if pay == pay500 + pay100 + pay50
answer += 1
end
end
end
end
print answer
|
coin500 = gets.chomp.to_i
coin100 = gets.chomp.to_i
coin50 = gets.chomp.to_i
pay = gets.chomp.to_i
answer = 0
0.upto(coin500) do |i|
pay500 = 500 * i
0.upto(coin100) do |j|
pay100 = 100 * j
0.upto(coin50) do |k|
pay50 = 50 * k
if pay == pay500 + pay100 + pay50
answer += 1
end
end
end
end
print answer
|
[
"expression.operation.binary.remove"
] | 1,196,118
| 1,196,119
|
u891506774
|
ruby
|
p03448
|
a, b, c, x = 4.tiems.map { gets.to_i }
count = 0
(0..a).each do |i|
(0..b).each do |j|
(0..c).each do |k|
count += 1 if 500 * i + 100 * j + 50 * k == x
end
end
end
puts count
|
a, b, c, x = 4.times.map { gets.to_i }
count = 0
(0..a).each do |i|
(0..b).each do |j|
(0..c).each do |k|
count += 1 if 500 * i + 100 * j + 50 * k == x
end
end
end
puts count
|
[
"assignment.value.change",
"identifier.change"
] | 1,196,133
| 1,196,134
|
u004986150
|
ruby
|
p03448
|
a = gets.to_i
b = gets.to_i
c = gets.to_i
x = gets.to_i
count = 0
(0..a).each do |i|
(0..b).each do |j|
(0..c).each do |k|
count += 1 if 500 * i + 100 * j * 50 * k == x
end
end
end
puts count
|
a = gets.to_i
b = gets.to_i
c = gets.to_i
x = gets.to_i
count = 0
(0..a).each do |i|
(0..b).each do |j|
(0..c).each do |k|
count += 1 if 500 * i + 100 * j + 50 * k == x
end
end
end
puts count
|
[
"expression.operator.arithmetic.change",
"control_flow.branch.if.condition.change"
] | 1,196,135
| 1,196,136
|
u004986150
|
ruby
|
p03448
|
a,b,c,x = 4.times.map{gets.to_i}
count = o
(0..a).each do |h|
(0..b).each do |i|
(0..c).each do |j|
count += 1 if h * 500 + i * 100 + j * 50 == x
end
end
end
puts count
|
a,b,c,x = 4.times.map{gets.to_i}
count = 0
(0..a).each do |h|
(0..b).each do |i|
(0..c).each do |j|
count += 1 if h * 500 + i * 100 + j * 50 == x
end
end
end
puts count
|
[
"misc.typo",
"assignment.value.change",
"identifier.replace.remove",
"literal.replace.add"
] | 1,196,302
| 1,196,303
|
u217283930
|
ruby
|
p03448
|
a,b,c,x = 4.tomes.map{gets.to_i}
count = o
(0..a).each do |h|
(0..b).each do |i|
(0..c).each do |j|
count += 1 if h * 500 + i * 100 + j * 50 == x
end
end
end
puts count
|
a,b,c,x = 4.times.map{gets.to_i}
count = 0
(0..a).each do |h|
(0..b).each do |i|
(0..c).each do |j|
count += 1 if h * 500 + i * 100 + j * 50 == x
end
end
end
puts count
|
[
"assignment.value.change",
"identifier.change",
"misc.typo",
"identifier.replace.remove",
"literal.replace.add"
] | 1,196,304
| 1,196,303
|
u217283930
|
ruby
|
p03448
|
a,b,c,x = 4.times.map{gets.to_i}
ans = 0
(0..a).each do |i|
(0..b).each do |j|
(0..c).each do |k|
ans +=1 if 500*a + 100*b + 50*c ==x
end
end
end
puts ans
|
a,b,c,x = 4.times.map{gets.to_i}
ans = 0
(0..a).each do |i|
(0..b).each do |j|
(0..c).each do |k|
ans +=1 if 500*i + 100*j + 50*k ==x
end
end
end
puts ans
|
[
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,196,309
| 1,196,310
|
u374190629
|
ruby
|
p03448
|
a,b,c,x = 4.times.map{get.to_i}
ans = 0
(0..a).each do |i|
(0..b).each do |j|
(0..c).each do |k|
ans +=1 if 500*a + 100*b + 50*c ==x
end
end
end
puts ans
|
a,b,c,x = 4.times.map{gets.to_i}
ans = 0
(0..a).each do |i|
(0..b).each do |j|
(0..c).each do |k|
ans +=1 if 500*i + 100*j + 50*k ==x
end
end
end
puts ans
|
[
"assignment.value.change",
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,196,311
| 1,196,310
|
u374190629
|
ruby
|
p03448
|
a,b,c,x = 4.times.map{get.to_i}
ans = 0
(0..a).each do |i|
(0..b).each do |j|
(0..c).each do |k|
ans +=1 if 500*a + 100*b + 50*c =x
end
end
end
puts ans
|
a,b,c,x = 4.times.map{gets.to_i}
ans = 0
(0..a).each do |i|
(0..b).each do |j|
(0..c).each do |k|
ans +=1 if 500*i + 100*j + 50*k ==x
end
end
end
puts ans
|
[
"assignment.value.change",
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,196,312
| 1,196,310
|
u374190629
|
ruby
|
p03448
|
a,b,c,x=4.times.map{gets.to_i}
z=0
for n in 0..a do
for m in 0..b do
for l in 0..c do
n*500+m*100+l*50==x if z+=1
end
end
end
puts z
|
a,b,c,x=4.times.map{gets.to_i}
z=0
for n in 0..a do
for m in 0..b do
for l in 0..c do
if n*500+m*100+l*50==x then
z+=1
end
end
end
end
puts z
|
[] | 1,196,405
| 1,196,406
|
u854471099
|
ruby
|
p03448
|
_500_num = gets.to_i
_100_num = gets.to_i
_50_num = gets.to_i
total = gets.to_i
count = 0
(0.._500_num).each do |i|
(0.._100_num).each do |j|
(0.._100_num).each do |k|
if 500 * i + 100 * j + k * 50 == total
count += 1
end
end
end
end
p count
|
_500_num = gets.to_i
_100_num = gets.to_i
_50_num = gets.to_i
total = gets.to_i
count = 0
(0.._500_num).each do |i|
(0.._100_num).each do |j|
(0.._50_num).each do |k|
if 500 * i + 100 * j + 50 * k == total
count += 1
end
end
end
end
p count
|
[
"identifier.change",
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 1,196,484
| 1,196,485
|
u511421299
|
ruby
|
p03448
|
a=gets.to_i
b=gets.to_i
c=gets.to_i
x=gets.to_i
(0..a).each do |i|
(0..b).each do |j|
(0..c).each do |k|
if i*500 + j*100 + k*50 == x
count += 1
end
end
end
end
puts count
|
a=gets.to_i
b=gets.to_i
c=gets.to_i
x=gets.to_i
count= 0
(0..a).each do |i|
(0..b).each do |j|
(0..c).each do |k|
if i*500 + j*100 + k*50 == x
count += 1
end
end
end
end
puts count
|
[
"assignment.add"
] | 1,196,790
| 1,196,791
|
u202708319
|
ruby
|
p03448
|
a,b,c,x = 4.times.map{gets.to_i}
ans = 0
for i in 0..a
for j in 0..b
for k in 0..c
if 500*i+100*j+50*k == x
ans += 1
end
end
end
end
puts [ans,256].min
|
a,b,c,x = 4.times.map{gets.to_i}
ans = 0
for i in 0..a
for j in 0..b
for k in 0..c
if 500*i+100*j+50*k == x
ans += 1
end
end
end
end
puts [ans,511].min
|
[
"literal.number.integer.change",
"call.arguments.change",
"io.output.change"
] | 1,196,796
| 1,196,797
|
u506255180
|
ruby
|
p03448
|
a = gets.chomp.to_i
b = gets.chomp.to_i
c = gets.chomp.to_i
x = gets.chomp.to_i
count = 0
(a + 1).times do |i|
(b+1).times do |j|
(c+1).times do |k|
count += 1 if i * 500 + k * 100 + k * 50 == x
end
end
end
puts count
|
a = gets.chomp.to_i
b = gets.chomp.to_i
c = gets.chomp.to_i
x = gets.chomp.to_i
count = 0
(a + 1).times do |i|
(b+1).times do |j|
(c+1).times do |k|
count += 1 if i * 500 + j * 100 + k * 50 == x
end
end
end
puts count
|
[
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,196,872
| 1,196,873
|
u501869915
|
ruby
|
p03448
|
a,b,c,x=gets(p).split.map(&:to_i)
ans=0
(a+1).times{|i|(b+1).times{|j|(c+1).times{|k|ans+=1 if 500+i+100*j+50*k==x}}}
p ans
|
a,b,c,x=gets(p).split.map(&:to_i)
ans=0
(a+1).times{|i|(b+1).times{|j|(c+1).times{|k|ans+=1 if 500*i+100*j+50*k==x}}}
p ans
|
[
"expression.operator.arithmetic.change",
"control_flow.branch.if.condition.change"
] | 1,197,030
| 1,197,031
|
u726630158
|
ruby
|
p03448
|
a = gets.to_i
b = gets.to_i
c = gets.to_i
x = gets.to_i
count = 0
(0..a).each do |ia|
(0..b).each do |ib|
d = x - ia * 500 + ib * 100
count+=1 if d % 50 == 0 && (0..c)===(d / 50)
end
end
puts count
|
a = gets.to_i
b = gets.to_i
c = gets.to_i
x = gets.to_i
count = 0
(0..a).each do |ia|
(0..b).each do |ib|
d = x - ia * 500 - ib * 100
count+=1 if d % 50 == 0 && (0..c)===(d / 50)
end
end
puts count
|
[
"misc.opposites",
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 1,197,159
| 1,197,160
|
u664737319
|
ruby
|
p03448
|
a = gets.to_i
b = gets.to_i
c = gets.to_i
x = gets.to_i
count = 0
(0..a).each do |ia|
(0..b).each do |ib|
d = x - ia * 500 + ib * 100
count+=1 if d % c == 0 && (0..c)===(d / c)
end
end
puts count
|
a = gets.to_i
b = gets.to_i
c = gets.to_i
x = gets.to_i
count = 0
(0..a).each do |ia|
(0..b).each do |ib|
d = x - ia * 500 - ib * 100
count+=1 if d % 50 == 0 && (0..c)===(d / 50)
end
end
puts count
|
[
"misc.opposites",
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change",
"identifier.replace.remove",
"literal.replace.add",
"control_flow.branch.if.condition.change"
] | 1,197,161
| 1,197,160
|
u664737319
|
ruby
|
p03448
|
a500 = gets.chomp.to_i
b100 = gets.chomp.to_i
c50 = gets.chomp.to_i
x = gets.chomp.to_i
cnt = 0
(0..a500).times do |ia|
(0..b100).times do |ib|
(0..c50).times do |ic|
cnt += 1 if ia * 500 + ib * 100 + ic * 50 == x
end
end
end
puts cnt
|
a500 = gets.chomp.to_i
b100 = gets.chomp.to_i
c50 = gets.chomp.to_i
x = gets.chomp.to_i
cnt = 0
(0..a500).each do |ia|
(0..b100).each do |ib|
(0..c50).each do |ic|
cnt += 1 if ia * 500 + ib * 100 + ic * 50 == x
end
end
end
puts cnt
|
[
"identifier.change"
] | 1,197,168
| 1,197,169
|
u174442903
|
ruby
|
p03449
|
n=gets.to_i
up,under=2.times.map{gets.split.map(&:to_i)}
a=0
for i in 1...n-1
v1=up[0..i].inject(&:+)
v2=under[i..-1].inject(&:+)
if v1+v2>a
a=v1+v2
end
end
puts a
|
n=gets.to_i
up,under=2.times.map{gets.split.map(&:to_i)}
a=0
for i in 0..n-1
v1=up[0..i].inject(&:+)
v2=under[i..-1].inject(&:+)
if v1+v2>a
a=v1+v2
end
end
puts a
|
[
"literal.number.integer.change"
] | 1,197,247
| 1,197,248
|
u590472228
|
ruby
|
p03449
|
h=2
w=gets.to_i
m=$<.map{|e|e.split.map &:to_i}
(1...h).each{|i|m[i][0]+=m[i-1][0]}
(1...w).each{|j|m[0][j]+=m[0][j-1]}
(1...h).each{|i|(1...w).each{|j|
m[i][j]+=[m[i-1][j],m[i][j-1]].max
}}
p m[i-1][j-1]
|
h=2
w=gets.to_i
m=$<.map{|e|e.split.map &:to_i}
(1...h).each{|i|m[i][0]+=m[i-1][0]}
(1...w).each{|j|m[0][j]+=m[0][j-1]}
(1...h).each{|i|(1...w).each{|j|
m[i][j]+=[m[i-1][j],m[i][j-1]].max
}}
p m[h-1][w-1]
|
[
"identifier.change",
"variable_access.subscript.index.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 1,198,068
| 1,198,069
|
u280667879
|
ruby
|
p03455
|
a, b = gets.split(" ").to_i
if a * b % 2 == 0
print('Even')
else
print('Odd')
end
|
a, b = gets.split(" ").map(&:to_i)
if a * b % 2 == 0
print('Even')
else
print('Odd')
end
|
[
"assignment.value.change",
"identifier.change",
"call.arguments.add"
] | 1,199,045
| 1,199,046
|
u219618070
|
ruby
|
p03455
|
puts (gets.split.map(&:to_i).then{(_1*_2).odd?} ? :odd : :even)
|
puts (gets.split.map(&:to_i).then{(_1*_2).odd?} ? :Odd : :Even)
|
[
"call.arguments.change"
] | 1,199,104
| 1,199,105
|
u882851536
|
ruby
|
p03455
|
a,b = gets.chomp.split('').map(&:to_i)
puts (a*b).odd? ? 'Odd' : 'Even'
|
a,b = gets.chomp.split.map(&:to_i)
puts (a*b).odd? ? 'Odd' : 'Even'
|
[
"call.arguments.change"
] | 1,199,562
| 1,199,563
|
u287369786
|
ruby
|
p03455
|
a,b = gets.chomp.split('').map(&:to_i)
puts (a*b).odd? ? 'Odd' : 'Even'
|
a, b = gets.chomp.split.map(&:to_i)
puts (a * b).odd? ? 'Odd' : 'Even'
|
[
"call.arguments.change"
] | 1,199,562
| 1,199,564
|
u287369786
|
ruby
|
p03455
|
a,b = gets.split(" ").map(&:to_i)
result = a * b
result.odd? ? "Odd" : "Even"
|
a,b = gets.split(" ").map(&:to_i)
result = a * b
puts result.odd? ? "Odd" : "Even"
|
[
"io.output.change",
"call.add"
] | 1,199,615
| 1,199,616
|
u870610735
|
ruby
|
p03455
|
line = gets.split(' ').to_i
if (line[0] * line[1]) % 2 == 0
puts 'Even'
else
puts 'Odd'
end
|
line = gets.split(' ')
line.map!(&:to_i)
if (line[0] * line[1]) % 2 == 0
puts 'Even'
else
puts 'Odd'
end
|
[
"call.add",
"identifier.change",
"call.arguments.add"
] | 1,199,663
| 1,199,664
|
u661415513
|
ruby
|
p03455
|
a, b = gets.strip.split.map(&:to_i)
puroduct = a * b
puts product.odd? ? 'Odd' : 'Even'
|
a, b = gets.strip.split.map(&:to_i)
product = a * b
puts product.odd? ? 'Odd' : 'Even'
|
[
"assignment.variable.change",
"identifier.change"
] | 1,199,826
| 1,199,827
|
u856154762
|
ruby
|
p03455
|
a,b = gets.split("").map(&:to_i);
if (a*b) % 2 == 0
puts "Even"
else
puts "Odd"
end
|
a,b = gets.chomp.split(" ").map(&:to_i);
if (a*b) % 2 == 0
puts "Even"
else
puts "Odd"
end
|
[
"call.add",
"literal.string.change",
"assignment.value.change",
"call.arguments.change"
] | 1,199,865
| 1,199,866
|
u683471974
|
ruby
|
p03455
|
a, b = gets.chomp.split(" ").maap(&:to_i)
ans = a * b
if ans % 2 == 0
puts "Even"
else
puts "Odd"
end
|
a, b = gets.chomp.split(" ").map(&:to_i)
ans = a * b
if ans % 2 == 0
puts "Even"
else
puts "Odd"
end
|
[
"assignment.value.change",
"identifier.change"
] | 1,199,867
| 1,199,868
|
u412789323
|
ruby
|
p03455
|
a,b = gets.split.map(&:to_i)
puts(a*b).odd? 'Odd':'Even'
|
a, b = gets.strip.split.map(&:to_i)
puts (a * b).odd? ? 'Odd' : 'Even'
|
[
"call.add",
"call.arguments.change"
] | 1,199,869
| 1,199,870
|
u246530341
|
ruby
|
p03455
|
a, b = gets.split.map(&:to_i)
puts (a * b).even? ? "EVEN": "ODD"
|
a, b = gets.split.map(&:to_i)
puts (a * b).even? ? "Even": "Odd"
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,200,022
| 1,200,023
|
u684458716
|
ruby
|
p03455
|
puts gets =~ /[02468]\z/ ? "Even" : "Odd"
|
puts gets =~ /[02468]\b/ ? "Even" : "Odd"
|
[
"control_flow.branch.if.condition.change"
] | 1,200,076
| 1,200,077
|
u693378622
|
ruby
|
p03455
|
a,b = gets.chomp.split.map {|x| x.to_i}
p (if (a*b)%2 == 1 then
'Odd'
else
'Even'
end)
|
a,b = gets.chomp.split.map {|x| x.to_i}
puts (if (a*b)%2 == 1 then
'Odd'
else
'Even'
end)
|
[
"call.function.change",
"io.output.change"
] | 1,200,194
| 1,200,195
|
u441575327
|
ruby
|
p03455
|
a,b = gets.strip.split.map(&:to_i)
a * b % 2 == 1 ? 'Odd' : 'Even'
|
a,b = gets.split.map(&:to_i)
puts a * b % 2 == 1 ? 'Odd' : 'Even'
|
[
"call.remove",
"io.output.change",
"call.add"
] | 1,200,248
| 1,200,249
|
u558478533
|
ruby
|
p03455
|
a,b = gets.splits.map(&:to_i)
a * b % 2 == 1 ? 'Odd' : 'Even'
|
a,b = gets.split.map(&:to_i)
puts a * b % 2 == 1 ? 'Odd' : 'Even'
|
[
"assignment.value.change",
"identifier.change",
"io.output.change",
"call.add"
] | 1,200,252
| 1,200,249
|
u558478533
|
ruby
|
p03455
|
a,b = gets.strip.split.map(&:to_i)
a * b % 2 == 1 ? 'Odd' : 'Even'
|
a,b = gets.strip.split.map(&:to_i)
puts a * b % 2 == 1 ? 'Odd' : 'Even'
|
[
"io.output.change",
"call.add"
] | 1,200,248
| 1,200,254
|
u558478533
|
ruby
|
p03455
|
a,b = gets.splits.map(&:to_i)
a * b % 2 == 1 ? 'Odd' : 'Even'
|
a,b = gets.strip.split.map(&:to_i)
puts a * b % 2 == 1 ? 'Odd' : 'Even'
|
[
"assignment.value.change",
"identifier.change",
"call.add",
"io.output.change"
] | 1,200,252
| 1,200,254
|
u558478533
|
ruby
|
p03455
|
arr = gets.chomp.split('')
a = arr[0].to_i
b = arr[1].to_i
if (a % 2 != 0) && (b % 2 != 0)
print ("Odd")
else
print ("Even")
end
|
arr = gets.chomp.split(' ')
a = arr[0].to_i
b = arr[1].to_i
if (a % 2 != 0) && (b % 2 != 0)
print ("Odd")
else
print ("Even")
end
|
[
"literal.string.change",
"assignment.value.change",
"call.arguments.change"
] | 1,200,412
| 1,200,413
|
u059126963
|
ruby
|
p03455
|
a, b = gets.split(' ').map(&:to_i)
(a*b).even? ? "Even" : "Odd"
|
a, b = gets.split(' ').map(&:to_i)
puts (a*b).even? ? "Even" : "Odd"
|
[
"io.output.change",
"call.add"
] | 1,200,495
| 1,200,496
|
u957289826
|
ruby
|
p03455
|
a, b = gets.split(' ').map(&:to_i)
a*b.even? ? "Even" : "Odd"
|
a, b = gets.split(' ').map(&:to_i)
puts (a*b).even? ? "Even" : "Odd"
|
[
"call.add",
"control_flow.branch.if.condition.change"
] | 1,200,497
| 1,200,496
|
u957289826
|
ruby
|
p03455
|
a, b = gets.split(' ').map(&:to_i)
if a.even?
puts "Even"
else
puts "ODD"
end
|
a, b = gets.split(' ').map(&:to_i)
if (a*b).even?
puts "Even"
else
puts "Odd"
end
|
[
"control_flow.branch.if.condition.change",
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,200,523
| 1,200,524
|
u709852962
|
ruby
|
p03455
|
a, b = gets.strip.split.map(:to_i)
puts a * b % 2 == 0 ? 'Even' : 'Odd'
|
a, b = gets.strip.split.map(&:to_i)
puts (a * b) % 2 == 0 ? 'Even' : 'Odd'
|
[
"call.arguments.change",
"control_flow.branch.if.condition.change"
] | 1,200,922
| 1,200,923
|
u450617345
|
ruby
|
p03455
|
a, b = gets.split(' ').map {|it| it.to_i}
puts((a&1).zero? && (b&1).zero? ? 'Even' : 'Odd')
|
a, b = gets.split(' ').map {|it| it.to_i}
puts((a&1).zero? || (b&1).zero? ? 'Even' : 'Odd')
|
[
"misc.opposites",
"control_flow.branch.if.condition.change"
] | 1,201,131
| 1,201,132
|
u356158489
|
ruby
|
p03455
|
a, b = gets.strip.split.map(&:to_i)
p (a*b).even? ? 'Even' : 'Odd'
|
a, b = gets.strip.split.map(&:to_i)
puts (a*b)%2==0 ? 'Even' : 'Odd'
|
[
"call.function.change",
"io.output.change",
"control_flow.branch.if.condition.change"
] | 1,201,298
| 1,201,299
|
u168181447
|
ruby
|
p03455
|
a, b = gets.strip.split.map(&:to_i)
p (a*b)%2==0 ? 'Even' : 'Odd'
|
a, b = gets.strip.split.map(&:to_i)
puts (a*b)%2==0 ? 'Even' : 'Odd'
|
[
"call.function.change",
"io.output.change"
] | 1,201,300
| 1,201,299
|
u168181447
|
ruby
|
p03455
|
a, b = gets.strip.split.map(&:to_i)
(a*b)%2==0 ? 'Even' : 'Odd'
|
a, b = gets.strip.split.map(&:to_i)
puts (a*b)%2==0 ? 'Even' : 'Odd'
|
[
"io.output.change",
"call.add"
] | 1,201,301
| 1,201,299
|
u168181447
|
ruby
|
p03455
|
a, b = gets.strip.split.map(&:to_i)
p (a*b).even? ? 'Even' : 'Odd'
|
a, b = gets.strip.split.map(&:to_i)
puts (a*b).even? ? 'Even' : 'Odd'
|
[
"call.function.change",
"io.output.change"
] | 1,201,298
| 1,201,302
|
u168181447
|
ruby
|
p03455
|
a, b = gets.strip.split.map(&:to_i)
p (a*b).even?? 'Even' : 'Odd'
|
a, b = gets.strip.split.map(&:to_i)
puts (a*b).even? ? 'Even' : 'Odd'
|
[
"call.function.change",
"io.output.change"
] | 1,201,303
| 1,201,302
|
u168181447
|
ruby
|
p03455
|
a, b = gets.strip.split.map(&:to_i)
p (a*b)%2==0 ? 'Even' : 'Odd'
|
a, b = gets.strip.split.map(&:to_i)
puts (a*b).even? ? 'Even' : 'Odd'
|
[
"call.function.change",
"io.output.change",
"expression.operation.binary.remove"
] | 1,201,300
| 1,201,302
|
u168181447
|
ruby
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.