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 |
|---|---|---|---|---|---|---|---|
p03797 | n, m = gets.split.map(&:to_i)
ans = m > n * 2 ? n + (m - n * 2) / 4 : n
puts ans | n, m = gets.split.map(&:to_i)
ans = m > n * 2 ? n + (m - n * 2) / 4 : m / 2
puts ans
| [
"assignment.value.change"
] | 1,431,317 | 1,431,318 | u091367113 | ruby |
p03797 | s,c= gets.split.map &:to_i
puts [c,(s+c)/2].min | s,c= gets.split.map &:to_i
c/=2
puts [c,(s+c)/2].min | [] | 1,431,345 | 1,431,346 | u459746049 | ruby |
p03799 | # ピース数取得
peaces = STDIN.gets.strip.split(' ')
peace_s = peaces[0].to_i
peace_c = peaces[1].to_i
# 作成個数
count = 0
if peace_s < peace_c * 0.5
count = peace_s
peace_c -= peace_s * 2
count += ( peace_c / 3 ).floor
else
count = ( peace_c * 0.5 ).floor
end
puts count | # ピース数取得
peaces = STDIN.gets.strip.split(' ')
peace_s = peaces[0].to_i
peace_c = peaces[1].to_i
# 作成個数
count = 0
if peace_s < peace_c * 0.5
count = peace_s
peace_c -= peace_s * 2
count += ( peace_c / 4 ).floor
else
count = ( peace_c * 0.5 ).floor
end
puts count | [
"literal.number.integer.change",
"expression.operation.binary.change"
] | 1,431,476 | 1,431,477 | u025803699 | ruby |
p03799 | n, m = gets.split(" ").map &:to_i
if n <= m * 2
puts (n / 2)
else
puts (m + (n - m * 2) / 4)
end | m, n = gets.split(" ").map &:to_i
if n <= m * 2
puts (n / 2)
else
puts (m + (n - m * 2) / 4)
end
| [] | 1,431,509 | 1,431,510 | u976045235 | ruby |
p03799 | if __FILE__==$0
rl_i=lambda{|str,dl|str.strip.split(dl).map(&:to_i)}
dl=" "
s,c=rl_i[gets,dl]
p [s,c]
if s*2>=c
p c/2
else
p ((c-s*2)/4)+s
end
end | if __FILE__==$0
rl_i=lambda{|str,dl|str.strip.split(dl).map(&:to_i)}
dl=" "
s,c=rl_i[gets,dl]
if s*2>=c
p c/2
else
p ((c-s*2)/4)+s
end
end | [
"call.remove"
] | 1,431,568 | 1,431,569 | u036059298 | ruby |
p03799 |
N, M = gets.split(/ /).collect{|n| n.to_i}
c_max = M / 2
if N >= c_max
puts N
else
puts N + (c_max - N) / 2
end
|
N, M = gets.split(/ /).collect{|n| n.to_i}
c_max = M / 2
if N >= c_max
puts c_max
else
puts N + (c_max - N) / 2
end
| [
"call.arguments.change"
] | 1,431,585 | 1,431,586 | u751724075 | ruby |
p03803 | m=gets.split.map(&:to_i)
m=m.map{|n|n==1 ?n=14:n=n}
puts
if m[0]>m[1]
puts "Alice"
elsif m[0]==[1]
puts "Draw"
else
puts "Bob"
end | m=gets.split.map(&:to_i)
m=m.map{|n|n==1 ?n=14:n=n}
puts
if m[0]>m[1]
puts "Alice"
elsif m[0]==m[1]
puts "Draw"
else
puts "Bob"
end | [
"control_flow.branch.if.condition.change"
] | 1,432,655 | 1,432,656 | u590472228 | ruby |
p03803 | a,b = gets.split.map(&:to_i)
a = 14 if a == 1
a = 14 if a == 1
puts a == b ? 'Draw' : (a > b ? 'Alice' : 'Bob') | a,b = gets.split.map(&:to_i)
a = 14 if a == 1
b = 14 if b == 1
puts a == b ? 'Draw' : (a > b ? 'Alice' : 'Bob') | [
"assignment.variable.change",
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,433,101 | 1,433,102 | u315597999 | ruby |
p03803 | a,b = gets.split.map(&:to_i)
if (a>b and b!=1) or (a==1 and b!=1)
puts 'Alice'
elsif a==b
puts 'Dorw'
else
puts 'Bob'
end | a,b = gets.split.map(&:to_i)
if (a>b and b!=1) or (a==1 and b!=1)
puts 'Alice'
elsif a==b
puts 'Draw'
else
puts 'Bob'
end | [
"literal.string.change",
"call.arguments.change"
] | 1,433,146 | 1,433,147 | u050914494 | ruby |
p03803 | a,b = gets.split.map(&:to_i)
if a == b
puts "draw"
elsif a == 1 || (a > b && b != 1)
puts "Alice"
else
puts "Bob"
end | a,b = gets.split.map(&:to_i)
if a == b
puts "Draw"
elsif a == 1 || (a > b && b != 1)
puts "Alice"
else
puts "Bob"
end | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,433,258 | 1,433,259 | u692254521 | ruby |
p03803 | arr = $stdin.gets.chomp.split(" ")
arr.map! do |a_j|
a_j.to_i
end
if arr[0] == arr[1]
puts num "Draw"
elsif
arr[0] == 1
puts "Alice"
elsif
arr[1] == 1
puts "Bob"
elsif
arr[0] > arr[1]
puts "Alice"
else
puts "Bob"
end | arr = $stdin.gets.chomp.split(" ")
arr.map! do |a_j|
a_j.to_i
end
if arr[0] == arr[1]
puts "Draw"
elsif
arr[0] == 1
puts "Alice"
elsif
arr[1] == 1
puts "Bob"
elsif
arr[0] > arr[1]
puts "Alice"
else
puts "Bob"
end | [
"call.arguments.change"
] | 1,433,302 | 1,433,303 | u294388467 | ruby |
p03803 | a, b = gets.chomp.split.map(&:to_i)
a = 14 if a = 1
b = 14 if b = 1
if a < b
puts :Bob
elsif a > b
puts :Alice
else
puts :Draw
end
| a, b = gets.chomp.split.map(&:to_i)
a = 14 if a == 1
b = 14 if b == 1
if a < b
puts :Bob
elsif a > b
puts :Alice
else
puts :Draw
end
| [
"expression.operation.compare.replace.add",
"assignment.replace.remove",
"misc.typo"
] | 1,433,585 | 1,433,586 | u744908753 | ruby |
p03803 | a, b = gets.chomp.split(" ").map(&:to_i)
if a == b
puts "Draw"
elsif a == 1
puts "Alice"
elsif b == 1
puts "Bob"
elsif a > b
puts "Alice"
elsif b < a
puts "Bob"
end | a, b = gets.chomp.split(" ").map(&:to_i)
if a == b
puts "Draw"
elsif a == 1
puts "Alice"
elsif b == 1
puts "Bob"
elsif a > b
puts "Alice"
elsif b > a
puts "Bob"
end | [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,433,671 | 1,433,672 | u126541218 | ruby |
p03803 | a, b = gets.split(" ").map{|d|d.to_i}
if a == 1 and b == 1
puts "draw"
elsif a == 1
puts "alice"
elsif b == 1
puts "bob"
elsif a == b
puts "draw"
elsif a > b
puts "alice"
else
puts "bob"
end | a, b = gets.split(" ").map{|d|d.to_i}
if a == 1 and b == 1
puts "Draw"
elsif a == 1
puts "Alice"
elsif b == 1
puts "Bob"
elsif a == b
puts "Draw"
elsif a > b
puts "Alice"
else
puts "Bob"
end | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,433,805 | 1,433,806 | u692439758 | ruby |
p03803 | a,b=gets.split.map &:to_i;puts a==b ?:Draw:(a<b||b==1?:Bob: :Alice)
| a,b=gets.split.map &:to_i;puts a==b ?:Draw:(a!=1&&a<b||b==1?:Bob: :Alice)
| [
"assignment.add"
] | 1,433,968 | 1,433,969 | u514067551 | ruby |
p03803 | a,b=gets.split.map(&:to_i);puts %w|Draw Bob Alice|[14-a%13<=>14-b%13] | a,b=gets.split.map(&:to_i);puts %w|Draw Bob Alice|[(14-a)%13<=>(14-b)%13] | [
"call.arguments.change"
] | 1,434,021 | 1,434,022 | u397763977 | ruby |
p03803 | file = $stdin
line = file.readlines
file.close
a,b = line[0].split(" ")
if a.to_i == b.to_i
puts "draw"
elsif a.to_i == 1 && b.to_i != 1
puts "Alice"
elsif a.to_i != 1 && b.to_i == 1
puts "Bob"
elsif a.to_i != 1 && b.to_i != 1 && a.to_i > b.to_i
puts "Alice"
else
puts "Bob"
end | file = $stdin
line = file.readlines
file.close
a,b = line[0].split(" ")
if a.to_i == b.to_i
puts "Draw"
elsif a.to_i == 1 && b.to_i != 1
puts "Alice"
elsif a.to_i != 1 && b.to_i == 1
puts "Bob"
elsif a.to_i != 1 && b.to_i != 1 && a.to_i > b.to_i
puts "Alice"
else
puts "Bob"
end | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,434,248 | 1,434,249 | u541318412 | ruby |
p03803 | a, b = gets.chomp.split.map(&:to_i)
a = 100 if a == 1
b = 100 if b == 1
if a > b
puts :Alice
elsif a == b
puts :Draw
else
puts :Box
end
| a, b = gets.chomp.split.map(&:to_i)
a = 100 if a == 1
b = 100 if b == 1
if a > b
puts :Alice
elsif a == b
puts :Draw
else
puts :Bob
end
| [
"call.arguments.change"
] | 1,434,278 | 1,434,279 | u161323909 | ruby |
p03803 | a,b=gets.split.map(&:to_i).map{|e| e==1 ? 99 : e}
p a,b
if a<b
puts "Bob"
exit
elsif a>b
puts "Alice"
exit
elsif a==b
puts "Draw"
exit
end
abort | a,b=gets.split.map(&:to_i).map{|e| e==1 ? 99 : e}
if a<b
puts "Bob"
exit
elsif a>b
puts "Alice"
exit
elsif a==b
puts "Draw"
exit
end
abort | [
"call.remove"
] | 1,435,259 | 1,435,260 | u079330987 | ruby |
p03805 | n, m = gets.chomp.split.map(&:to_i)
h = []
m.times do |i|
h[i] = gets.chomp.split.map {|a| a.to_i - 1 }
end
reached = Array.new(n)
reached[0] = true
def search(from, n, m, h, reached)
ans = 0
queue = []
h.each do |a|
if a[0] == from
queue.push([from, a[1], reached])
elsif a[1] == from
queue.push([from, a[0], reached])
end
end
while !queue.empty?
from, to, reached = queue.shift
reached[to] = true
if reached.all?
ans += 1
else
h.each do |a|
if a[0] == to && !reached[a[1]]
queue.push([to, a[1], reached.dup])
elsif a[1] == to && !reached[a[0]]
queue.push([to, a[0], reached.dup])
end
end
end
end
p ans
end
search(0, n, m, h, reached)
| n, m = gets.chomp.split.map(&:to_i)
h = []
m.times do |i|
h[i] = gets.chomp.split.map {|a| a.to_i - 1 }
end
reached = Array.new(n)
reached[0] = true
def search(from, n, m, h, reached)
ans = 0
queue = []
h.each do |a|
if a[0] == from
queue.push([from, a[1], reached.dup])
elsif a[1] == from
queue.push([from, a[0], reached.dup])
end
end
while !queue.empty?
from, to, reached = queue.shift
reached[to] = true
if reached.all?
ans += 1
else
h.each do |a|
if a[0] == to && !reached[a[1]]
queue.push([to, a[1], reached.dup])
elsif a[1] == to && !reached[a[0]]
queue.push([to, a[0], reached.dup])
end
end
end
end
p ans
end
search(0, n, m, h, reached)
| [
"call.add"
] | 1,437,459 | 1,437,460 | u195257137 | ruby |
p03805 | def f v, list, num, n
ans = 0
jd = true
list.each do |ll|
if ll == 0
jd = false
break
end
end
if jd
return 1
end
n.times do |i|
next if i == num
next if list[i] == 1
if v[num][i] == 1
list[i] = 1
ans += f Marshal.load(Marshal.dump v), Marshal.load(Marshal.dump list), i, n
end
end
return ans
end
N,M = gets.split.map(&:to_i)
v = Array.new(N){Array.new(N){0}}
M.times do
a = gets.split.map(&:to_i)
v[a[0] - 1][a[1] - 1] = 1
v[a[1] - 1][a[0] - 1] = 1
end
list = Array.new(N){0}
list[0] = 1
ans = f Marshal.load(Marshal.dump v), Marshal.load(Marshal.dump list), 0, N
puts ans | def f v, list, num, n
ans = 0
jd = true
list.each do |ll|
if ll == 0
jd = false
break
end
end
if jd
return 1
end
n.times do |i|
next if i == num
next if list[i] == 1
if v[num][i] == 1
list[i] = 1
ans += f Marshal.load(Marshal.dump v), Marshal.load(Marshal.dump list), i, n
list[i] = 0
end
end
return ans
end
N,M = gets.split.map(&:to_i)
v = Array.new(N){Array.new(N){0}}
M.times do
a = gets.split.map(&:to_i)
v[a[0] - 1][a[1] - 1] = 1
v[a[1] - 1][a[0] - 1] = 1
end
list = Array.new(N){0}
list[0] = 1
ans = f Marshal.load(Marshal.dump v), Marshal.load(Marshal.dump list), 0, N
puts ans | [
"assignment.add"
] | 1,438,608 | 1,438,609 | u988228861 | ruby |
p03805 | n, _ = gets.split.map(&:to_i)
ary = (n + 1).times.map { Array.new(n + 1) }
n.times do
x, y = gets.split.map(&:to_i)
ary[x][y] = ary[y][x] = true
end
puts [*2..n].permutation.count { |per|
([1] + per).each_cons(2).all? { |s| ary.dig(*s) }
}
| n, m = gets.split.map(&:to_i)
ary = (n + 1).times.map { Array.new(n + 1) }
m.times do
x, y = gets.split.map(&:to_i)
ary[x][y] = ary[y][x] = true
end
puts [*2..n].permutation.count { |per|
([1] + per).each_cons(2).all? { |s| ary.dig(*s) }
}
| [
"assignment.variable.change",
"identifier.change"
] | 1,438,745 | 1,438,746 | u465342836 | ruby |
p03806 | MAX_G = 40 * 10
N, Ma, Mb, *rest = $stdin.read.split.map(&:to_i)
CHEMICALS = rest.each_slice(3).to_a
dp = Array.new(N){ Array.new(MAX_G+1){ Array.new(MAX_G+1, Float::INFINITY) }}
dp[0][0][0] = 0
for i in 0...N-1
for ca in 0..MAX_G
for cb in 0..MAX_G
next if dp[i][ca][cb] == Float::INFINITY
# iを使わない場合
dp[i+1][ca][cb] = [ dp[i+1][ca][cb],
dp[i][ca][cb] ].min
# iを使う場合
ga, gb, gc = CHEMICALS[i]
dp[i+1][ca + ga][cb + gb] = [ dp[i+1][ca + ga][cb + gb],
dp[i][ca][cb] + gc ].min
end
end
end
ans = Float::INFINITY
for ca in 1..MAX_G
for cb in 1..MAX_G
if ca*Mb == cb*Ma
ans = [ans, dp[N-1][ca][cb]].min
end
end
end
p(ans == Float::INFINITY ? -1 : ans)
| MAX_G = 40 * 10
N, Ma, Mb, *rest = $stdin.read.split.map(&:to_i)
CHEMICALS = rest.each_slice(3).to_a
dp = Array.new(N+1){ Array.new(MAX_G+1){ Array.new(MAX_G+1, Float::INFINITY) }}
dp[0][0][0] = 0
for i in 0...N
for ca in 0..MAX_G
for cb in 0..MAX_G
next if dp[i][ca][cb] == Float::INFINITY
# iを使わない場合
dp[i+1][ca][cb] = [ dp[i+1][ca][cb],
dp[i][ca][cb] ].min
# iを使う場合
ga, gb, gc = CHEMICALS[i]
dp[i+1][ca + ga][cb + gb] = [ dp[i+1][ca + ga][cb + gb],
dp[i][ca][cb] + gc ].min
end
end
end
ans = Float::INFINITY
for ca in 1..MAX_G
for cb in 1..MAX_G
if ca*Mb == cb*Ma
ans = [ans, dp[N][ca][cb]].min
end
end
end
p(ans == Float::INFINITY ? -1 : ans)
| [
"expression.operation.binary.remove"
] | 1,439,478 | 1,439,479 | u437302815 | ruby |
p03806 | n, ma, mb = gets.chomp.split(" ").map(&:to_i)
a, b, c = [], [], []
n.times do |i|
a[i], b[i], c[i] = gets.chomp.split.map(&:to_i)
end
INF = 10**6
dp = Array.new(n+1, INF).map{Array.new(401, INF).map{Array.new(401, INF)}}
dp[0][0][0] = 0
for i in 0..(n-1)
for j in 0..400
for k in 0..400
next if dp[i][j][k] == INF
dp[i+1][j][k] = dp[i][j][k] if dp[i][j][k] < dp[i+1][j][k]
dp[i+1][j+a[i]][k+b[i]] = dp[i][j][k] + c[i] if dp[i][j][k] + c[i] < dp[i+1][j+a[i]][k+b[i]]
end
end
end
ans = INF
for i in 1..(n-1)
for j in 1..400
for k in 1..400
next if k * ma != j * mb
ans = dp[i][j][k] if dp[i][j][k] < ans
end
end
end
puts ans == INF ? -1 : ans | n, ma, mb = gets.chomp.split(" ").map(&:to_i)
a, b, c = [], [], []
n.times do |i|
a[i], b[i], c[i] = gets.chomp.split.map(&:to_i)
end
INF = 10**7
dp = Array.new(n+1, INF).map{Array.new(401, INF).map{Array.new(401, INF)}}
dp[0][0][0] = 0
for i in 0..(n-1)
for j in 0..400
for k in 0..400
next if dp[i][j][k] == INF
dp[i+1][j][k] = dp[i][j][k] if dp[i][j][k] < dp[i+1][j][k]
dp[i+1][j+a[i]][k+b[i]] = dp[i][j][k] + c[i] if dp[i][j][k] + c[i] < dp[i+1][j+a[i]][k+b[i]]
end
end
end
ans = INF
for i in 1..n
for j in 1..400
for k in 1..400
next if k * ma != j * mb
ans = dp[i][j][k] if dp[i][j][k] < ans
end
end
end
puts ans == INF ? -1 : ans | [
"literal.number.integer.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 1,439,493 | 1,439,494 | u868089307 | ruby |
p03806 | N, Ma, Mb = gets.split.map(&:to_i)
M, C = [], []
readlines.each{|l| a, b, c = l.split.map(&:to_i); M << a*Mb - b*Ma; C << c}
INF = 1 << 30
def go(h, n)
return h if n == N
h1 = h.dup
h1[M[n]] = [h1[M[n]], C[n]].min
h.each{|k, v| h1[k + M[n]] = [h[k + M[n]], v + C[n]].min}
go(h1, n + 1)
end
h = go(Hash.new(INF), 0)
puts h[0] == INF ? '-1' : h[0]
| N, Ma, Mb = gets.split.map(&:to_i)
M, C = [], []
readlines.each{|l| a, b, c = l.split.map(&:to_i); M << a*Mb - b*Ma; C << c}
INF = 1 << 30
def go(h, n)
return h if n == N
h1 = h.dup
h1[M[n]] = [h[M[n]], C[n]].min
h.each{|k, v| h1[k + M[n]] = [h[k + M[n]], v + C[n]].min unless k == 0}
go(h1, n + 1)
end
h = go(Hash.new(INF), 0)
puts h[0] == INF ? '-1' : h[0]
| [
"assignment.value.change",
"identifier.change"
] | 1,439,626 | 1,439,627 | u304198114 | ruby |
p03807 | gets;puts gets.split.map(&:to_i).inject(:+)%2==0?:Yes: :No | gets;puts gets.split.map(&:to_i).inject(:+)%2==0?:YES: :NO | [
"call.arguments.change"
] | 1,439,993 | 1,439,994 | u655122274 | ruby |
p03807 | N=gets.chomp!.to_i
a=gets.chomp!.split(" ")
a.map!{|n| n.to_i}
o=0
p N,a
for i in 0..(N-1) do
if ((a[i]%2)==1) then
o+=1
end
end
if N==1
print "YES"
elsif o%2==0
print "YES"
else
print "NO"
end | N=gets.chomp!.to_i
a=gets.chomp!.split(" ")
a.map!{|n| n.to_i}
o=0
for i in 0..(N-1) do
if ((a[i]%2)==1) then
o+=1
end
end
if N==1
print "YES"
elsif o%2==0
print "YES"
else
print "NO"
end | [
"call.remove"
] | 1,440,174 | 1,440,175 | u759070482 | ruby |
p03807 | N=gets.to_i
A=gets.chomp.split.map(&:to_i)
puts A.count{|v| v%2==1} % 2 == 1 ? "No" : "Yes" | N=gets.to_i
A=gets.chomp.split.map(&:to_i)
puts A.count{|v| v%2==1} % 2 == 1 ? "NO" : "YES" | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,440,225 | 1,440,226 | u868089307 | ruby |
p03807 | STDIN.gets.to_i
numbers = STDIN.gets.split(' ').map(&:to_i)
odds = 0
evens = 0
numbers.each do |num|
if (num % 2 == 0)
evens += 1
else
odds += 1
end
end
if (evens == 1 && odds == 0)
puts 'Yes'
elsif (evens == 0 && odds == 1)
puts 'Yes'
else
evens += odds / 2
odds = odds % 2
evens = evens % 2
if (odds == 0 && evens == 0)
puts 'YES'
else
puts 'NO'
end
end | STDIN.gets.to_i
numbers = STDIN.gets.split(' ').map(&:to_i)
odds = 0
evens = 0
numbers.each do |num|
if (num % 2 == 0)
evens += 1
else
odds += 1
end
end
if (evens == 1 && odds == 0)
puts 'Yes'
elsif (evens == 0 && odds == 1)
puts 'Yes'
else
evens += odds / 2
odds = odds % 2
evens = evens % 2
if (odds == 0)
puts 'YES'
else
puts 'NO'
end
end | [
"expression.operation.binary.remove"
] | 1,440,251 | 1,440,252 | u237620737 | ruby |
p03807 | n=gets
p gets.split.map(&:to_i).reduce{|i,j| i+j}%2==0 ? YES : NO | n=gets
puts gets.split.map(&:to_i).reduce{|i,j| i+j}%2==0 ? 'YES' : 'NO' | [
"call.function.change",
"io.output.change",
"call.arguments.change"
] | 1,440,359 | 1,440,361 | u668400048 | ruby |
p03807 | n = gets.to_i
arr = gets.chomp.split(' ').map(&:to_i)
count = 0
arr.each do |num|
if num % 2 == 1
count +=1
end
end
if count % 2 == 0
puts 'Yes'
else
puts "No"
end | n = gets.to_i
arr = gets.chomp.split(' ').map(&:to_i)
count = 0
arr.each do |num|
if num % 2 == 1
count +=1
end
end
if count % 2 == 0
puts "YES"
else
puts "NO"
end | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,441,315 | 1,441,316 | u059126963 | ruby |
p03808 | N,_=gets.chomp.split(" ").map{|n| n.to_i}
A=gets.chomp.split(' ').map{|n| n.to_i}
total = A.inject{|sum,a| sum+a}
unit = N*(N+1)/2
if(total % unit != 0)
puts "NO"
exit(0)
end
times = total / unit
B=Array.new(N)
cnt = 0
for i in 0..(N-1)
B[i] = -(A[i] - A[i-1] - times)
if(B[i] > 0 || B[i] % N != 0)
puts "NO"
exit(0)
end
cnt += B[i] / N
end
if(cnt != times)
puts "NO"
exit(0)
end
puts "YES" | N,_=gets.chomp.split(" ").map{|n| n.to_i}
A=gets.chomp.split(' ').map{|n| n.to_i}
total = A.inject{|sum,a| sum+a}
unit = N*(N+1)/2
if(total % unit != 0)
puts "NO"
exit(0)
end
times = total / unit
B=Array.new(N)
cnt = 0
for i in 0..(N-1)
B[i] = -(A[i] - A[i-1] - times)
if(B[i] < 0 || B[i] % N != 0)
puts "NO"
exit(0)
end
cnt += B[i] / N
end
if(cnt != times)
puts "NO"
exit(0)
end
puts "YES" | [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,441,532 | 1,441,533 | u415591191 | ruby |
p03813 | p 1200>gets.to_i ? "ABC" : "ARC"
| puts gets.to_i<1200 ? "ABC" : "ARC"
| [
"call.function.change",
"io.output.change",
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 1,442,208 | 1,442,209 | u966810027 | ruby |
p03813 | puts 1200<gets.to_i ? "ABC" : "ARC" | puts gets.to_i<1200 ? "ABC" : "ARC"
| [
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 1,442,210 | 1,442,209 | u966810027 | ruby |
p03813 | gets.to_i < 1200 ? "ABC" : "ARC"
| puts gets.to_i < 1200 ? "ABC" : "ARC" | [
"io.output.change",
"call.add"
] | 1,442,357 | 1,442,358 | u085647568 | ruby |
p03813 | include Math
define_method :max, -> (a,b) { a > b ? a : b }
define_method :min, -> (a,b) { a < b ? a : b }
define_method :swap, -> (a,b) { a, b = b, a }
define_method :rep, -> (num, &block) { num.times do |i| block.call(i) end }
define_method :repl, -> (st,en, &block) { st.upto en-1 do |i| block.call(i) end }
define_method :array, -> (size,init = nil) { Array.new(size){init} }
define_method :darray, -> (size1, size2, init = nil) { Array.new(size1){Array.new(size2){init}} }
define_method :gi, -> () { gets.split.map(&:to_i) }
define_method :gs, -> () { gets.chomp }
define_method :putall, -> (obj) { obj.each do |o| puts o end }
define_method :fi, ->() {first}
n = gi.fi
if n >=1200
puts "ABC"
else
puts "ARC"
end
| include Math
define_method :max, -> (a,b) { a > b ? a : b }
define_method :min, -> (a,b) { a < b ? a : b }
define_method :swap, -> (a,b) { a, b = b, a }
define_method :rep, -> (num, &block) { num.times do |i| block.call(i) end }
define_method :repl, -> (st,en, &block) { st.upto en-1 do |i| block.call(i) end }
define_method :array, -> (size,init = nil) { Array.new(size){init} }
define_method :darray, -> (size1, size2, init = nil) { Array.new(size1){Array.new(size2){init}} }
define_method :gi, -> () { gets.split.map(&:to_i) }
define_method :gs, -> () { gets.chomp }
define_method :putall, -> (obj) { obj.each do |o| puts o end }
define_method :fi, ->() {first}
n = gi.fi
if n >=1200
puts "ARC"
else
puts "ABC"
end
| [
"call.remove",
"call.add"
] | 1,443,022 | 1,443,023 | u988228861 | ruby |
p03814 | S = gets.chomp
A_index = S.index("A")
Z_index = S.index("Z")
ans = (Z_index + 1) - (A_index + 1) + 1
puts ans | S = gets.chomp
a_index = S.index("A")
z_index = S.rindex("Z")
ans = (z_index + 1) - (a_index + 1) + 1
puts ans
| [
"assignment.variable.change",
"assignment.value.change",
"identifier.change",
"expression.operation.binary.change"
] | 1,443,089 | 1,443,090 | u552761221 | ruby |
p03814 | s = gets.chomp
a = index("A")
z = rindex("Z")
puts z - a + 1 | s = gets.chomp
a = s.index("A")
z = s.rindex("Z")
puts z - a + 1 | [
"call.add"
] | 1,443,427 | 1,443,428 | u036108511 | ruby |
p03814 | s = gets.strip.chars
puts s.size - s.index('A') - s.index('Z') | s = gets.strip.chars
puts s.size - s.index('A') - s.reverse.index('Z') | [
"call.add"
] | 1,443,441 | 1,443,442 | u848201575 | ruby |
p03814 | word = gets.chomp.split("")
wordr = word.reverse
num = word.length-1
first = 0
last = 0
(0..num).each do |i|
if word[i] == "A"
first = word.index(word[i])
break
end
end
(0..num).each do |i|
if wordr[i] == "Z"
last = word.index(word[i])
break
end
end
last = word.length - last
puts last - first | word = gets.chomp.split("")
wordr = word.reverse
num = word.length-1
first = 0
last = 0
(0..num).each do |i|
if word[i] == "A"
first = word.index(word[i])
break
end
end
(0..num).each do |i|
if wordr[i] == "Z"
last = wordr.index(wordr[i])
break
end
end
last = word.length - last
puts last - first | [
"assignment.value.change",
"identifier.change",
"call.arguments.change"
] | 1,443,489 | 1,443,490 | u343055017 | ruby |
p03814 | s = gets.chomp
index = []
for i in 0..s.length-1
if s[i] == "A"
index.push(i)
break
end
i = s.length-1
while i > 0 do
if s[i] == "Z"
index.push(i)
break
end
i -=1
end
end
puts (index[1] - index[0]).abs + 1 | s = gets.chomp
index = []
for i in 0..s.length-1
if s[i] == "A"
index.push(i)
break
end
end
i = s.length-1
while i > 0 do
if s[i] == "Z"
index.push(i)
break
end
i -=1
end
puts (index[1] - index[0]).abs + 1 | [] | 1,443,950 | 1,443,951 | u990788654 | ruby |
p03814 | s = gets.chomp
a = 0
z = 0
s.chars.each.with_index{|c, i|
a = i if c=='A' && a==0
z = i if c=='Z'
}
puts z-a+1 | s = gets.chomp
a = -1
z = 0
s.chars.each.with_index{|c, i|
a = i if c=='A' && a==-1
z = i if c=='Z'
}
puts z-a+1 | [
"assignment.value.change",
"expression.operation.unary.add",
"control_flow.branch.if.condition.change"
] | 1,444,101 | 1,444,102 | u397763977 | ruby |
p03814 | s = gets
puts (s.rindex('Z') - s.index('A')) | s = gets
puts (s.rindex('Z') - s.index('A') + 1) | [
"expression.operation.binary.add"
] | 1,444,161 | 1,444,162 | u546897790 | ruby |
p03813 | $><<gets.to_i<1200?:ABC: :ARC | $>.<<gets.to_i<1200?:ABC: :ARC | [
"call.add"
] | 1,444,240 | 1,444,241 | u283869437 | ruby |
p03813 | $><<gets.to_i<1200?:ABC: :ARC | $>.<<puts gets.to_i<1200?:ABC: :ARC | [
"call.add",
"io.output.change"
] | 1,444,240 | 1,444,242 | u283869437 | ruby |
p03813 | $><<gets.to_i<1200?:ABC: :ARC | puts gets.to_i<1200?:ABC: :ARC | [
"call.remove"
] | 1,444,240 | 1,444,243 | u283869437 | ruby |
p03813 | str = gets.to_i
if str >= 1200
print("ARC")
else
print("ARB")
end | str = gets.to_i
if str >= 1200
print("ARC")
else
print("ABC")
end | [
"literal.string.change",
"call.arguments.change"
] | 1,444,270 | 1,444,271 | u072714305 | ruby |
p03814 | s = gets
for i in 0..s.length-1
s[i]=="A"
a = i+1
break
end
for i in 1..s.length
s[-i]=="Z"
z = s.length - i
break
end
puts z-a+1 | s = gets
for i in 0..s.length-1
if s[i]=="A"
a = i
break
end
end
for i in 1..s.length
if s[-i]=="Z"
z = s.length - i
break
end
end
puts z-a+1
| [
"expression.operation.binary.remove"
] | 1,444,440 | 1,444,441 | u550943777 | ruby |
p03815 | x = gets.to_i
count = (x / 11) * 2
rest = x - 11 * count
if rest == 0
puts count
elsif rest <= 6
puts count + 1
else
puts count + 2
end
| x = gets.to_i
count = (x / 11) * 2
rest = x % 11
if rest == 0
puts count
elsif rest <= 6
puts count + 1
else
puts count + 2
end
| [
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change",
"expression.operation.binary.remove"
] | 1,444,588 | 1,444,589 | u012133968 | ruby |
p03815 | n = gets.chomp.to_i
tmp = (n/11)*2
flag = n%11
if 1<=flag && flag<=5
tmp += 1
elsif flag>=6
tmp += 2
end
puts tmp
| n = gets.chomp.to_i
tmp = (n/11)*2
flag = n%11
if 1<=flag && flag<=6
tmp += 1
elsif flag>=7
tmp += 2
end
puts tmp
| [
"literal.number.integer.change",
"control_flow.branch.if.condition.change"
] | 1,444,611 | 1,444,612 | u074306398 | ruby |
p03815 | x = gets.to_i
mod = x % 11
if mod == 0
puts x / 11 * 2
else
puts mod <= 5 ? x / 11 * 2 + 1 : x / 11 * 2 + 2
end | x = gets.to_i
mod = x % 11
if mod == 0
puts x / 11 * 2
else
puts mod <= 6 ? x / 11 * 2 + 1 : x / 11 * 2 + 2
end | [
"literal.number.integer.change",
"control_flow.branch.if.condition.change"
] | 1,445,176 | 1,445,177 | u104886851 | ruby |
p03815 | N = gets.to_i
ans = (N / 11) * 2
m = N % 11
if m == 0
elsif m <= 5
ans += 1
else
ans += 2
end
puts ans | N = gets.to_i
ans = (N / 11) * 2
m = N % 11
if m == 0
elsif m <= 6
ans += 1
else
ans += 2
end
puts ans | [
"literal.number.integer.change",
"control_flow.branch.if.condition.change"
] | 1,445,233 | 1,445,234 | u926099741 | ruby |
p03815 | x = gets.to_i
if x % 11 == 0
puts x / 11 * 2
elsif x % 11 < 6
puts (x / 11 * 2) + 1
else
puts (x / 11 * 2) + 2
end | x = gets.to_i
if x % 11 == 0
puts x / 11 * 2
elsif x % 11 <= 6
puts (x / 11 * 2) + 1
else
puts (x / 11 * 2) + 2
end | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,445,268 | 1,445,269 | u191196346 | ruby |
p03815 | x = gets.to_i
count = x / 11 * 2
x = x % 11
count += x < 0 ? 0 : x > 6 ? 2 : 1
puts count
| x = gets.to_i
count = x / 11 * 2
x = x % 11
count += x > 0 ? x > 6 ? 2 : 1 : 0
puts count
| [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,445,475 | 1,445,476 | u785521224 | ruby |
p03815 | x = gets.to_i
count = x / 11 * 2
x = x % 11
count += x > 6 ? 2 : 1
puts count
| x = gets.to_i
count = x / 11 * 2
x = x % 11
count += x > 0 ? x > 6 ? 2 : 1 : 0
puts count
| [] | 1,445,477 | 1,445,476 | u785521224 | ruby |
p03814 | s = gets.chomp.split('').map(&:to_s)
ss = s.reverse
a = s.index('A')
z = ss.index('Z')
p s[a..-z-1] | s = gets.chomp.split('').map(&:to_s)
ss = s.reverse
a = s.index('A')
z = ss.index('Z')
p s[a..-z-1].size | [
"call.add"
] | 1,443,756 | 1,443,757 | u296101474 | ruby |
p03814 | s = gets.to_s
a_index = s.index("a")
z_index = s.reverse.index("z")
ans = s[a_index..-z_index - 1]
puts ans | s = gets.to_s
a_index = s.index("A")
z_index = s.reverse.index("Z")
ans = s[a_index..-z_index - 1]
puts ans.size | [
"literal.string.change",
"literal.string.case.change",
"assignment.value.change",
"call.arguments.change",
"call.add"
] | 1,443,758 | 1,443,759 | u296101474 | ruby |
p03816 | #require 'prime'
MOD=10**9+7; cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.chomp.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end
def ar2(s1,s2,de=nil) Array.new(s1){Array.new(s2,de)} end
def ar3(s1,s2,s3,de=nil) Array.new(s1){Array.new(s2){Array.new(s3,de)}} end
def desc(ar) ar.sort!{|x,y| y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end
def ceil(a,b) (a.to_f/b).ceil end
def C(a,b) b==0||a==b ? 1 : (b=a-b if a/2<b;(a-b+1..a).inject(:*)/(1..b).inject(:*)) end
def rui(ar) s=[0]; ar.size.times{|i| s<<s[-1]+ar[i]}; s end
def rev_rui(ar) s=[0]; ar.size.times.reverse_each{|i| s<<s[-1]+ar[i]}; s end
def puts_yesno(b) puts(b ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def pu(h) begin; require './../nemi_lib/debug.rb'; puts_val(h); rescue LoadError; end; end
########### ( ˘ω˘ )スヤァ… ###########
n=gi
a=gsmi
a.each do |i|
h[i]+=1
end
ar=h.to_a.map{|i|i[1]}.select{|i|i>=2}
sum=sum(ar)-ar.size
puts n-(ceil sum,2)*2 | #require 'prime'
MOD=10**9+7; cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.chomp.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end
def ar2(s1,s2,de=nil) Array.new(s1){Array.new(s2,de)} end
def ar3(s1,s2,s3,de=nil) Array.new(s1){Array.new(s2){Array.new(s3,de)}} end
def desc(ar) ar.sort!{|x,y| y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+).to_i end
def ceil(a,b) (a.to_f/b).ceil end
def C(a,b) b==0||a==b ? 1 : (b=a-b if a/2<b;(a-b+1..a).inject(:*)/(1..b).inject(:*)) end
def rui(ar) s=[0]; ar.size.times{|i| s<<s[-1]+ar[i]}; s end
def rev_rui(ar) s=[0]; ar.size.times.reverse_each{|i| s<<s[-1]+ar[i]}; s end
def puts_yesno(b) puts(b ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def pu(h) begin; require './../nemi_lib/debug.rb'; puts_val(h); rescue LoadError; end; end
########### ( ˘ω˘ )スヤァ… ###########
n=gi
a=gsmi
a.each do |i|
h[i]+=1
end
ar=h.to_a.map{|i|i[1]}.select{|i|i>=2}
sum=sum(ar)-ar.size
puts n-(ceil sum,2)*2 | [
"call.add"
] | 1,445,511 | 1,445,512 | u385631112 | ruby |
p03815 | x=gets.to_i
n=x/11
m=2*n
x%=11
m+=1 if 0<x && x<=5
m+=2 if 5<x
p m
| x=gets.to_i
n=x/11
m=2*n
x%=11
m+=1 if 0<x && x<=6
m+=2 if 6<x
p m | [
"literal.number.integer.change",
"control_flow.branch.if.condition.change"
] | 1,445,896 | 1,445,897 | u647875062 | ruby |
p03816 | gets
cards = gets.split(" ").map(&:to_i)
n = cards.size - cards.uniq.size
n -= 1 if n.even?
p n
| gets
cards = gets.split(" ").map(&:to_i)
n = cards.uniq.size
n -= 1 if n.even?
p n
| [
"expression.operation.binary.remove"
] | 1,446,071 | 1,446,072 | u113091201 | ruby |
p03817 | x = gets.to_i - 1
p x / 11 * 2 + (x%11<5 ? 1 : 2) | x = gets.to_i - 1
p x / 11 * 2 + (x%11<6 ? 1 : 2) | [
"literal.number.integer.change",
"control_flow.branch.if.condition.change"
] | 1,446,636 | 1,446,637 | u467508794 | ruby |
p03817 | x = gets.to_i
p x / 11 * 2 + (x%11<=5 ? 1 : 2) | x = gets.to_i - 1
p x / 11 * 2 + (x%11<6 ? 1 : 2) | [
"assignment.change"
] | 1,446,638 | 1,446,637 | u467508794 | ruby |
p03817 | x = gets.to_i
puts (x / 11) * 2 + case x % 11
when 0
0
when 1..5
1
else
2
end
| x = gets.to_i
puts (x / 11) * 2 + case x % 11
when 0
0
when 1..6
1
else
2
end
| [
"literal.number.integer.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 1,446,677 | 1,446,678 | u232013343 | ruby |
p03815 | x = gets.to_i
q, r = x.divmod(11)
ans = q * 2
if r > 6
ans += 2
elsif r > 0
ans + 1
end
puts ans
| x = gets.to_i
q, r = x.divmod(11)
ans = q * 2
if r > 6
ans += 2
elsif r > 0
ans += 1
end
puts ans
| [
"assignment.compound.arithmetic.replace.add",
"expression.operator.arithmetic.replace.remove",
"expression.operation.binary.change"
] | 1,447,008 | 1,447,009 | u091367113 | ruby |
p03815 | io = STDIN
x=io.gets.chomp.to_i
def calc(x)
if x%11==0
(x/11)*2
elsif (x%11<=5)
(x/11)*2+1
else
(x/11)*2+2
end
end
p calc(x) | io = STDIN
x=io.gets.chomp.to_i
def calc(x)
if x%11==0
(x/11)*2
elsif (x%11<=6)
(x/11)*2+1
else
(x/11)*2+2
end
end
p calc(x) | [
"literal.number.integer.change",
"control_flow.branch.if.condition.change"
] | 1,447,101 | 1,447,102 | u132360211 | ruby |
p03815 | i = gets.to_i
s = i / 11
d = i % 11
s *= 2
if d == 0
elsif d <= 5
s += 1
else
s += 2
end
puts s
| i = gets.to_i
s = i / 11
d = i % 11
s *= 2
if d == 0
elsif d <= 6
s += 1
else
s += 2
end
puts s
| [
"literal.number.integer.change",
"control_flow.branch.if.condition.change"
] | 1,447,129 | 1,447,130 | u489697674 | ruby |
p03815 | m = gets.chomp.to_i
k = m / 11
d = m % 11
p = 0
unless d == 0
if d > 5
p = 2
else
p = 1
end
end
puts k * 2 + p
| m = gets.chomp.to_i
k = m / 11
d = m % 11
p = 0
unless d == 0
if d > 6
p = 2
else
p = 1
end
end
puts k * 2 + p
| [
"literal.number.integer.change",
"control_flow.branch.if.condition.change"
] | 1,447,138 | 1,447,139 | u804047151 | ruby |
p03817 | n=gets.to_i
a=[0,1,1,1,1,1,2,2,2,2,2]
p n/11*2+a[n%11] | n=gets.to_i
a=[0,1,1,1,1,1,1,2,2,2,2]
p n/11*2+a[n%11] | [
"literal.array.change"
] | 1,447,622 | 1,447,623 | u554838392 | ruby |
p03821 | N = gets.to_i
AB = N.times.map{gets.split.map(&:to_i)}
p AB.reverse.inject(0){|sum, (a, b)|
sum += (b == 1) ? 0 : b - (a + sum) % b
} | N = gets.to_i
AB = N.times.map{gets.split.map(&:to_i)}
p AB.reverse.inject(0){|sum, (a, b)|
sum += (b == 1) ? 0 : (b - (a + sum) % b) % b
} | [
"call.arguments.change"
] | 1,448,014 | 1,448,015 | u655122274 | ruby |
p03821 | include Math
def solve(n_a, n_b, l)
total=0
cary=0
ml=0
for i in 0..l
a=n_a[i]; b=n_b[i]
a+=cary
ad=0
if a<=b
ad=b-a
else
ml=(a.to_f/b).ceil
b*=ml
ad=b-a
end
total+=ad
cary+=ad
#p [a,b,ad]
end
p total
end
if __FILE__==$0
rl_i=lambda{|str,dl|str.strip.split(dl).map(&:to_i)}
rl_s=lambda{|str,dl|str.strip.split(dl)}
r_i=lambda{|str|str.strip.to_i}
r_s=lambda{|str|str.strip}
dl=" "
n=r_i[gets]
a=Array.new(n){0}
b=Array.new(n){0}
n.times do |i|
line=rl_i[gets,dl]
a[i]=line[0]
b[i]=line[1]
end
a.reverse!
b.reverse!
solve(a,b,n-1)
end | include Math
def solve(n_a, n_b, l)
total=0
cary=0
ml=0
for i in 0..l
a=n_a[i]; b=n_b[i]
a+=cary
ad=0
if a>0
if a<=b
ad=b-a
else
ml=(a.to_f/b).ceil
b*=ml
ad=b-a
end
end
total+=ad
cary+=ad
end
p total
end
if __FILE__==$0
rl_i=lambda{|str,dl|str.strip.split(dl).map(&:to_i)}
rl_s=lambda{|str,dl|str.strip.split(dl)}
r_i=lambda{|str|str.strip.to_i}
r_s=lambda{|str|str.strip}
dl=" "
n=r_i[gets]
a=Array.new(n){0}
b=Array.new(n){0}
n.times do |i|
line=rl_i[gets,dl]
a[i]=line[0]
b[i]=line[1]
end
a.reverse!
b.reverse!
solve(a,b,n-1)
end | [] | 1,448,968 | 1,448,969 | u036059298 | ruby |
p03826 | A, B, C, D = gets.split.map(&:to_i)
if A * B != C * D
puts A * B
else
puts [A * B, C * D].max
end
| A, B, C, D = gets.split.map(&:to_i)
if A * B == C * D
puts A * B
else
puts [A * B, C * D].max
end
| [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,449,514 | 1,449,515 | u782098901 | ruby |
p03826 | # Your code here!
a,b,c,d=gets.chomp.split(" ").map(&:to_i);
#puts(a,b,c,d)
if a*b<c*d
puts(a*b)
else
puts(c*d)
end
| # Your code here!
a,b,c,d=gets.chomp.split(" ").map(&:to_i);
#puts(a,b,c,d)
if a*b>c*d
puts(a*b)
else
puts(c*d)
end
| [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,449,542 | 1,449,543 | u060936992 | ruby |
p03826 | a,b,c,d = gets.split.map(&:to_i)
a * b >= c * d ? a * b : c * d ; | a,b,c,d = gets.split.map(&:to_i)
puts a * b >= c * d ? a * b : c * d ; | [
"io.output.change",
"call.add"
] | 1,449,568 | 1,449,569 | u510556034 | ruby |
p03826 | a,b,c,d = gets.split.map(&:to_i)
p a * b >= c * d ? a*b : b*c ; | a,b,c,d = gets.split.map(&:to_i)
puts a * b >= c * d ? a * b : c * d ; | [
"call.function.change",
"io.output.change",
"expression.operation.binary.remove"
] | 1,449,570 | 1,449,569 | u510556034 | ruby |
p03826 | A, B, C, D = gets.chomp.split.map(&:to_i)
s1 = A * B / 2
s2 = C * D / 2
puts s1 < s2 ? s2 : s1
| A, B, C, D = gets.chomp.split.map(&:to_i)
s1 = A * B
s2 = C * D
puts s1 < s2 ? s2 : s1
| [
"expression.operation.binary.remove"
] | 1,449,634 | 1,449,635 | u592423934 | ruby |
p03826 | a, b, c, d = gets.chomp.split.map(&:to_i)
if a * b > c * b
puts a * b
else
puts c * b
end | a, b, c, d = gets.chomp.split.map(&:to_i)
if a * b > c * d
puts a * b
else
puts c * d
end | [
"identifier.change",
"control_flow.branch.if.condition.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 1,449,638 | 1,449,639 | u180077477 | ruby |
p03827 | n = gets.to_i
s = gets.split('')
x = 0
y = [0]
s.each do |str|
if str == "I"
x += 1
else
x -= 1
end
y << x
end | n = gets.to_i
s = gets.split('')
x = 0
y = [0]
s.each do |str|
if str == "I"
x += 1
else
x -= 1
end
y << x
end
puts y.max | [
"call.add"
] | 1,449,940 | 1,449,941 | u523351024 | ruby |
p03827 | n = gets.to_i
number = 0
string = gets.chomp.split("")
array = [0]
string.each do |s|
if s == "I"
number += 1
else
number -= 1
end
array.push(number)
p number
end
puts array.max | n = gets.to_i
number = 0
string = gets.chomp.split("")
array = [0]
string.each do |s|
if s == "I"
number += 1
else
number -= 1
end
array.push(number)
end
puts array.max | [
"call.remove"
] | 1,449,988 | 1,449,989 | u333374716 | ruby |
p03827 | n = gets.to_i
number = 0
string = gets.chomp.split("")
array = []
string.each do |s|
if s == "I"
number += 1
else
number -= 1
end
array.push(number)
end
puts array.max | n = gets.to_i
number = 0
string = gets.chomp.split("")
array = [0]
string.each do |s|
if s == "I"
number += 1
else
number -= 1
end
array.push(number)
end
puts array.max | [] | 1,449,990 | 1,449,989 | u333374716 | ruby |
p03827 | n = gets.to_i
s = gets.chomp.split('')
ans = 0
num = 0
(s.length - 1).times do |x|
if s[x] == 'I'
num += 1
elsif s[x] == 'D'
num -= 1
end
ans = [ans,num].max
end
puts ans | n = gets.to_i
s = gets.chomp.split('')
ans = 0
num = 0
s.length.times do |x|
if s[x] == 'I'
num += 1
elsif s[x] == 'D'
num -= 1
end
ans = [ans,num].max
end
puts ans | [] | 1,449,998 | 1,449,999 | u875730451 | ruby |
p03827 | num = gets.to_i
char = gets.chomp.split("")
n = 0
array = []
char.each do |a|
if a == "I"
n += 1
array << n
else
n -= 1
array << n
end
end
puts array.max | num = gets.to_i
char = gets.chomp.split("")
n = 0
array = [0]
char.each do |a|
if a == "I"
n += 1
array << n
else
n -= 1
array << n
end
end
puts array.max | [] | 1,450,422 | 1,450,423 | u510556034 | ruby |
p03827 | n = gets.chomp.to_i
s = gets.chomp
x = 0
ans = 0
for i in 0...n
if s[i]=='I'
x += 1
else
x -= 1
end
ans = [anx, x].max
end
puts ans
| n = gets.chomp.to_i
s = gets.chomp
x = 0
ans = 0
for i in 0...n
if s[i]=='I'
x += 1
else
x -= 1
end
ans = [ans, x].max
end
puts ans
| [
"assignment.value.change",
"identifier.change"
] | 1,450,463 | 1,450,464 | u462560753 | ruby |
p03827 | n = gets.chomp.to_i
s = gets.chomp
x = 0
ans = 0
for i in 0...n
if s[i]=='I'
x += 1
else
x -= 1
end
ans = max(ans, x)
end
puts ans
| n = gets.chomp.to_i
s = gets.chomp
x = 0
ans = 0
for i in 0...n
if s[i]=='I'
x += 1
else
x -= 1
end
ans = [ans, x].max
end
puts ans
| [
"assignment.value.change",
"call.arguments.change",
"call.add"
] | 1,450,465 | 1,450,464 | u462560753 | ruby |
p03827 | s=r=0;gets.chomp.chars{|c|s+=c>?D?1:-1;r=[r,s].max};p r | s=r=0;gets;gets.chars{|c|s+=c>?D?1:-1;r=[r,s].max};p r | [] | 1,450,569 | 1,450,570 | u503549962 | ruby |
p03827 | gets
str = gets.chomp
x = 0
max_x = 0
str.chars do |ch|
if ch == "I"
x += 1
max_x = x if max_x < x
elsif ch == "D"
x -= 1
end
end
puts x | gets
str = gets.chomp
x = 0
max_x = 0
str.chars do |ch|
if ch == "I"
x += 1
max_x = x if max_x < x
elsif ch == "D"
x -= 1
end
end
puts max_x | [
"identifier.change",
"call.arguments.change"
] | 1,450,993 | 1,450,994 | u406810545 | ruby |
p03828 | require 'prime'
n = gets.to_i
primes = Hash.new(0)
(2..n).each { |i|
i.prime_division.each { |p, n|
primes[p] = primes[p] + n
}
}
p primes
p primes.values.inject(1) { |mem, var| mem * (var + 1) } % (10 ** 9 + 7)
| require 'prime'
n = gets.to_i
primes = Hash.new(0)
(2..n).each { |i|
i.prime_division.each { |p, n|
primes[p] = primes[p] + n
}
}
p primes.values.inject(1) { |mem, var| mem * (var + 1) } % (10 ** 9 + 7)
| [
"call.remove"
] | 1,451,224 | 1,451,225 | u340512149 | ruby |
p03817 | x = gets.to_f
ans = 2 * (x / 11).ceil
ans -= 1 if (x - 1) % 11 < 5
puts ans | x = gets.to_i
ans = 2 * (x / 11.0).ceil
ans -= 1 if (x - 1) % 11 < 6
puts ans | [
"call.function.change",
"type_conversion.to_integer.change",
"type_conversion.to_number.change",
"assignment.value.change",
"expression.operation.binary.change",
"literal.number.integer.change",
"control_flow.branch.if.condition.change"
] | 1,451,817 | 1,451,818 | u979552932 | ruby |
p03817 | x = gets.to_f
ans = 2 * (x / 11).ceil
ans -= 1 if (x - 1) % 11 < 5
puts ans | x = gets.to_f
ans = 2 * (x / 11).ceil
ans -= 1 if (x - 1) % 11 < 6
puts ans | [
"literal.number.integer.change",
"control_flow.branch.if.condition.change"
] | 1,451,817 | 1,451,819 | u979552932 | ruby |
p03817 | x = gets.to_i
ans = x / 11 * 2
if x % 11 >= 6
ans += 2
elsif x % 11 > 0
ans += 1
end
puts ans | x = gets.to_i
ans = x / 11 * 2
if x % 11 > 6
ans += 2
elsif x % 11 > 0
ans += 1
end
puts ans | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 1,451,820 | 1,451,821 | u979552932 | ruby |
p03829 | *, a, b = gets.split.map(&:to_i)
puts gets.split.map(&:to_i).each_cons(2).inject(0) do |m, x|
m += [(x[1] - x[0])*a, b].min
end | *, a, b = gets.split.map(&:to_i)
puts gets.split.map(&:to_i).each_cons(2)
.inject(0) {|m, x| m += [(x[1]-x[0])*a, b].min} | [] | 1,452,140 | 1,452,141 | u024807881 | ruby |
p03829 | n, a, b = gets.split.map(&:to_i)
xs = gets.split.map(&:to_i)
fatigue = 0
xs.each_cons(2) do |cur, dest|
dist = dest - cur + 1
fatigue += [dist * a, b].max
end
puts fatigue | n, a, b = gets.split.map(&:to_i)
xs = gets.split.map(&:to_i)
fatigue = 0
xs.each_cons(2) do |cur, dest|
dist = dest - cur
fatigue += [dist * a, b].min
end
puts fatigue | [
"expression.operation.binary.remove",
"misc.opposites",
"identifier.change"
] | 1,452,142 | 1,452,143 | u024807881 | ruby |
p03834 | s = gets.chomp.gsub(/,/, ' ')
p s
| s = gets.chomp.gsub(/,/, ' ')
puts s | [
"call.function.change",
"io.output.change"
] | 1,453,029 | 1,453,030 | u677555714 | ruby |
p03834 | s = gets.chomp.split(",")
p s.join(" ")
| s = gets.chomp.split(',')
puts s.join(' ')
| [
"literal.string.change",
"assignment.value.change",
"call.arguments.change",
"call.function.change",
"io.output.change"
] | 1,453,211 | 1,453,212 | u012110567 | ruby |
p03834 | puts gets.split(',').join | puts gets.split(',').join(' ') | [
"call.arguments.add"
] | 1,453,272 | 1,453,273 | u050914494 | ruby |
p03834 | str = $stdin.gets.chomp
str[6] = " "
str[14] = " "
puts str | str = $stdin.gets.chomp
str[5] = " "
str[13] = " "
puts str | [
"literal.number.integer.change",
"assignment.variable.change",
"variable_access.subscript.index.change"
] | 1,453,340 | 1,453,341 | u294388467 | ruby |
p03834 | s = gets.chomp
p s.gsub(",", " ")
| s = gets.chomp
print s.gsub(","," ") | [
"call.function.change",
"io.output.change"
] | 1,453,490 | 1,453,491 | u641906413 | ruby |
p03834 | a = gets.chomp
puts a.ty(",", " ") | a = gets.chomp
puts a.tr(",", " ") | [
"identifier.change",
"call.arguments.change",
"io.output.change"
] | 1,453,727 | 1,453,728 | u180077477 | ruby |
p03834 | STDOUT.puts STDIN.gets.chomp(',').join(' ') | STDOUT.puts STDIN.gets.chomp.split(',').join(' ') | [
"call.add"
] | 1,453,822 | 1,453,823 | u198355306 | ruby |
p03834 | s = gets.chomp
a = s.split(",")
puts a[0] + " " + a[1] + " " + 1[2] | s = gets.chomp
a = s.split(",")
puts a[0] + " " + a[1] + " " + a[2] | [
"identifier.replace.add",
"literal.replace.remove",
"call.arguments.change",
"expression.operation.binary.change"
] | 1,453,842 | 1,453,843 | u475875758 | ruby |
p03834 | p $<.gets.gsub(/,/, ' ') | puts $<.gets.gsub(/,/, ' ') | [
"call.function.change",
"io.output.change"
] | 1,453,853 | 1,453,854 | u536321196 | ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.