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 |
|---|---|---|---|---|---|---|---|
p03096 | n = gets.to_i
c = n.times.map{gets.to_i-1}
mod = 10**9+7
dp = Array.new(n+1,0)
dp[0] = 1
a = Array.new(n,-1)
n.times do |i|
dp[i+1] = dp[i]
if a[c[i]] != -1 && c[i-1] != c[i]
dp[i+1] += dp[a[c[i]]+1]
dp[i+1] %= mod
end
a[c[i]] = i
end
puts dp[n] | n = gets.to_i
c = n.times.map{gets.to_i-1}
mod = 10**9+7
dp = Array.new(n+1,0)
dp[0] = 1
a = Hash.new(-1)
n.times do |i|
dp[i+1] = dp[i]
if a[c[i]] > -1 && c[i-1] != c[i]
dp[i+1] += dp[a[c[i]]+1]
dp[i+1] %= mod
end
a[c[i]] = i
end
puts dp[n] | [
"assignment.value.change",
"call.arguments.change",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 907,299 | 907,298 | u506255180 | ruby |
p03101 | H,W = gets.chomp.split.map(&:to_i)
h,w = gets.chomp.split.map(&:to_i)
puts ((H-h) * (W*w)) | H,W = gets.chomp.split.map(&:to_i)
h,w = gets.chomp.split.map(&:to_i)
puts ((H-h) * (W-w)) | [
"expression.operator.arithmetic.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 907,757 | 907,758 | u303448696 | ruby |
p03101 | a=gets.split.map(&:to_i)
b=gets.split.map(&:to_i)
puts a[0]*a[1]-b[0]*a[1]-b[1]*a[0]-b[0]*b[1]
| a=gets.split.map(&:to_i)
b=gets.split.map(&:to_i)
puts a[0]*a[1]-b[0]*a[1]-b[1]*a[0]+b[0]*b[1]
| [
"misc.opposites",
"expression.operator.arithmetic.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 907,855 | 907,856 | u585819925 | ruby |
p03101 | a=gets.split.map(&:to_i)
b=gets.split.map(&:to_i)
puts a[0]*a[1]-b[0]*a[1]-b[1]*[0]-b[0]*b[1] | a=gets.split.map(&:to_i)
b=gets.split.map(&:to_i)
puts a[0]*a[1]-b[0]*a[1]-b[1]*a[0]+b[0]*b[1]
| [
"call.arguments.change",
"misc.opposites",
"expression.operator.arithmetic.change",
"expression.operation.binary.change"
] | 907,857 | 907,856 | u585819925 | ruby |
p03101 | H,W=gets.chomp.split(" ").map{|a| a.to_i}
ht,wd=gets.chomp.split(" ").map{|a| a.to_i}
puts ht*wd+(H-ht)*(W-wd) | H,W=gets.chomp.split(" ").map{|a| a.to_i}
ht,wd=gets.chomp.split(" ").map{|a| a.to_i}
puts (H-ht)*(W-wd) | [
"call.remove"
] | 908,077 | 908,078 | u030183888 | ruby |
p03101 | H,W=gets.chomp.split(" ").map{|a| a.to_i}
ht,wd=gets.chomp.split(" ").map{|a| a.to_i}
puts H*W-((H-ht)*(W-wd)) | H,W=gets.chomp.split(" ").map{|a| a.to_i}
ht,wd=gets.chomp.split(" ").map{|a| a.to_i}
puts (H-ht)*(W-wd) | [
"call.remove",
"call.arguments.change"
] | 908,079 | 908,078 | u030183888 | ruby |
p03102 | lines = []
while line = gets
lines << line.chomp.split(' ').map(&:to_i)
end
N = lines[0][0]
M = lines[0][1]
C = lines[0][2]
ans = 0
for i in 1..N do
score = 0
for j in 1..M do
score += lines[i+2][j-1] * lines[1][j-1]
end
if score + C > 0 then
ans += 1
end
end
puts ans | lines = []
while line = gets
lines << line.chomp.split(' ').map(&:to_i)
end
N = lines[0][0]
M = lines[0][1]
C = lines[0][2]
ans = 0
for i in 1..N do
score = 0
for j in 1..M do
score += lines[i+1][j-1] * lines[1][j-1]
end
if score + C > 0 then
ans += 1
end
end
puts ans | [
"literal.number.integer.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change"
] | 908,741 | 908,742 | u569559028 | ruby |
p03102 | N,M,C = gets.chomp.split.map(&:to_i)
b = gets.chomp.split.map(&:to_i)
a = N.times.map{gets.chomp.split.map(&:to_i)}
ans = 0
N.times do |i|
temp = c
M.times do |j|
temp += a[i][j] * b[j]
end
ans += 1 if temp > 0
end | N,M,C = gets.chomp.split.map(&:to_i)
b = gets.chomp.split.map(&:to_i)
a = N.times.map{gets.chomp.split.map(&:to_i)}
ans = 0
N.times do |i|
temp = C
M.times do |j|
temp += a[i][j] * b[j]
end
ans += 1 if temp > 0
end
puts ans | [
"misc.typo",
"assignment.value.change",
"call.add"
] | 908,971 | 908,972 | u585819925 | ruby |
p03102 | N,M,C = gets.split(" ").map(&:to_i)
b = gets.split(" ").map(&:to_i)
count = 0
N.times do
a = gets.split(" ").map(&:to_i)
sum = 0
m.times do |i|
sum += a[i] * b[i]
end
count += 1 if sum + C > 0
end
print count | N,M,C = gets.split(" ").map(&:to_i)
b = gets.split(" ").map(&:to_i)
count = 0
N.times do
a = gets.split(" ").map(&:to_i)
sum = 0
M.times do |i|
sum += a[i] * b[i]
end
count += 1 if sum + C > 0
end
print count | [] | 909,089 | 909,090 | u915238879 | ruby |
p03102 | N, M, C = gets.chomp.split.map(&:to_i)
B = gets.chomp.split.map(&:to_i)
res = 0
sum = 0
N.times do |n|
A = gets.chomp.split.map(&:to_i)
M.times do |n|
sum += B[n]*A[n]
end
if sum + C > 0 then
res += 1
end
end
puts res | N, M, C = gets.chomp.split.map(&:to_i)
B = gets.chomp.split.map(&:to_i)
res = 0
N.times do |n|
sum = 0
A = gets.chomp.split.map(&:to_i)
M.times do |n|
sum += B[n]*A[n]
end
if sum + C > 0 then
res += 1
end
end
puts res | [
"assignment.remove",
"assignment.add"
] | 909,125 | 909,126 | u920525832 | ruby |
p03102 | N, M, C = gets.split(' ').map(&:to_i)
B = gets.split(' ').map(&:to_i)
ans = 0
N.times do
a = gets.split(' ').map(&:to_i)
val = C
M.times do
val += a[i] * B[i]
end
ans += 1 if val > 0
end
puts ans | N, M, C = gets.split(' ').map(&:to_i)
B = gets.split(' ').map(&:to_i)
ans = 0
N.times do
a = gets.split(' ').map(&:to_i)
val = C
M.times do |i|
val += a[i] * B[i]
end
ans += 1 if val > 0
end
puts ans | [] | 909,155 | 909,156 | u548834738 | ruby |
p03102 | N,M,C = gets.split(" ").map(&:to_i)
B = gets.split(" ").map(&:to_i)
count = 0
N.times do |n|
A = gets.chomp.split.map(&:to_i)
score = 0
M.times do |m|
score += A[m] * B[m]
end
if score + C < 0
count += 1
end
end
puts count | N,M,C = gets.split(" ").map(&:to_i)
B = gets.split(" ").map(&:to_i)
count = 0
N.times do |n|
A = gets.chomp.split.map(&:to_i)
score = 0
M.times do |m|
score += A[m] * B[m]
end
if score + C > 0
count += 1
end
end
puts count
| [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 909,326 | 909,327 | u053656954 | ruby |
p03102 | N,M,C = gets.split(" ").map(&:to_i)
B = gets.split(" ").map(&:to_i)
count = 0
(1..N).each do |n|
A = gets.chomp.split.map(&:to_i)
score = 0
M.times do |m|
score += A[m] * B[m]
end
if score + C < 0
count += 1
end
end
puts count | N,M,C = gets.split(" ").map(&:to_i)
B = gets.split(" ").map(&:to_i)
count = 0
N.times do |n|
A = gets.chomp.split.map(&:to_i)
score = 0
M.times do |m|
score += A[m] * B[m]
end
if score + C > 0
count += 1
end
end
puts count
| [
"identifier.change",
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 909,328 | 909,327 | u053656954 | ruby |
p03102 | m,c = gets.split.map {|x| x.to_i}
b = gets.split.map {|x| x.to_i}
res = 0
n.times {
a = gets.split.map {|x| x.to_i}
sum = 0
a.each_index { |i|
sum += a[i]*b[i]
}
if (sum + c > 0)
res += 1
end
}
puts res
| n,m,c = gets.split.map {|x| x.to_i}
b = gets.split.map {|x| x.to_i}
res = 0
n.times {
a = gets.split.map {|x| x.to_i}
sum = 0
a.each_index { |i|
sum += a[i]*b[i]
}
if (sum + c > 0)
res += 1
end
}
puts res
| [] | 909,343 | 909,344 | u584272055 | ruby |
p03102 | n, m, c = gets.split.map(&:to_i)
bs = gets.split.map(&:to_i)
puts (n.times.map do
gets.split.map.with_index{|e, idx| e.to_i * bs[idx]}.inject(&:+) + c
end).max
| n, m, c = gets.split.map(&:to_i)
bs = gets.split.map(&:to_i)
puts (n.times.count do
gets.split.map.with_index{|e, idx| e.to_i * bs[idx]}.inject(&:+) + c > 0
end)
| [
"identifier.change",
"call.arguments.change",
"call.remove"
] | 909,386 | 909,387 | u069429049 | ruby |
p03102 | numbers_of_line, count_of_numbers, c = gets.split.map(&:to_i)
b = gets.split.map(&:to_i)
ar = []
for i in 1..numbers_of_line do
ar << gets.split.map(&:to_i)
end
count = 0
ar.each_with_index do |a, i|
r = 0
a.each_with_index do |a, i|
r += a * b[i]
end
p r
count += 1 if r + c > 0
end
p count | numbers_of_line, count_of_numbers, c = gets.split.map(&:to_i)
b = gets.split.map(&:to_i)
ar = []
for i in 1..numbers_of_line do
ar << gets.split.map(&:to_i)
end
count = 0
ar.each_with_index do |a, i|
r = 0
a.each_with_index do |a, i|
r += a * b[i]
end
count += 1 if r + c > 0
end
p count | [
"call.remove"
] | 909,395 | 909,396 | u262994359 | ruby |
p03103 | n, m = gets.chomp.split(" ").map(&:to_i);
arr = n.times.map{gets.split.map(&:to_i)}
arr = arr.sort
p arr
ans = 0
index = 0
while m > 0 do
tmp = [m, arr[index][1]].min
m -= tmp
ans += arr[index][0] * tmp
index += 1
end
puts ans | n, m = gets.chomp.split(" ").map(&:to_i);
arr = n.times.map{gets.split.map(&:to_i)}
arr = arr.sort
ans = 0
index = 0
while m > 0 do
tmp = [m, arr[index][1]].min
m -= tmp
ans += arr[index][0] * tmp
index += 1
end
puts ans | [
"call.remove"
] | 910,018 | 910,019 | u244203620 | ruby |
p03103 | n, m = gets.chomp.split.map(&:to_i)
array = []
n.times do
a, b = gets.chomp.split.map(&:to_i)
array << [a, b]
end
p array
array.sort_by!{ |x| x[0] }
p array
sum = 0
rest = m
array.each do |a, b|
if rest - b <= 0
sum += rest * a
break
end
sum += a * b
rest -= b
end
puts sum | n, m = gets.chomp.split.map(&:to_i)
array = []
n.times do
a, b = gets.chomp.split.map(&:to_i)
array << [a, b]
end
array.sort_by!{ |x| x[0] }
sum = 0
rest = m
array.each do |a, b|
if rest - b <= 0
sum += rest * a
break
end
sum += a * b
rest -= b
end
puts sum | [
"call.remove"
] | 910,729 | 910,730 | u757568397 | ruby |
p03103 | N,M = gets.split.map(&:to_i)
a = Array.new(N) {Array.new(2)}
for i in 0..N-1 do
a[i][0], a[i][1] = gets.split.map(&:to_i)
end
#安い順にする
a.sort! { |x, y| x[0] <=> y[0] }
puts a
count = 0
ans = 0
for i in 0..N-1 do
if count + a[i][1] < M
count += a[i][1]
ans += a[i][0] * a[i][1]
else
ans += a[i][0] * (M - count)
break
end
end
puts ans
| N,M = gets.split.map(&:to_i)
a = Array.new(N) {Array.new(2)}
for i in 0..N-1 do
a[i][0], a[i][1] = gets.split.map(&:to_i)
end
#安い順にする
a.sort! { |x, y| x[0] <=> y[0] }
count = 0
ans = 0
for i in 0..N-1 do
if count + a[i][1] < M
count += a[i][1]
ans += a[i][0] * a[i][1]
else
ans += a[i][0] * (M - count)
break
end
end
puts ans
| [
"call.remove"
] | 910,792 | 910,793 | u708550576 | ruby |
p03103 | n,m = gets.split.map &:to_i
pairs = []
n.times do |i|
pairs[i] = gets.split.map &:to_i
end
sorted = pairs.sort{|a|a[1]}
sum = 0
sorted.each do |a,b|
if b <= m
sum += (a * b)
m -= b
else
sum += (a * m)
m -= m
end
if m == 0
puts sum
exit
end
end | n,m = gets.split.map &:to_i
pairs = []
n.times do |i|
pairs[i] = gets.split.map &:to_i
end
sorted = pairs.sort_by{|a|a[0]}
sum = 0
sorted.each do |a,b|
if b <= m
sum += (a * b)
m -= b
else
sum += (a * m)
m -= m
end
if m == 0
puts sum
exit
end
end | [
"assignment.value.change",
"identifier.change",
"literal.number.integer.change",
"variable_access.subscript.index.change"
] | 911,049 | 911,050 | u158131514 | ruby |
p03103 | n,m=gets.chomp.split.map(&:to_i)
a=[]
b=Hash.new(0)
n.times do
aa,bb=gets.chomp.split.map(&:to_i)
a << aa
b[aa] += bb
end
a.sort!
ans = 0
a.each do |v|
if m <= b[v]
ans += m * v
puts ans
exit
end
ans += v * b[v]
m -= b[v]
end
puts ans
| n,m=gets.chomp.split.map(&:to_i)
a=[]
b=Hash.new(0)
n.times do
aa,bb=gets.chomp.split.map(&:to_i)
a << aa
b[aa] += bb
end
a.sort!
a.uniq!
ans = 0
a.each do |v|
if m <= b[v]
ans += m * v
puts ans
exit
end
ans += v * b[v]
m -= b[v]
end
puts ans
| [
"call.add"
] | 911,274 | 911,275 | u868089307 | ruby |
p03103 | N,M=gets.split.map &:to_i
c=0;r=0
AB=N.times.map{gets.split.map &:to_i}.sort.map{|a,b|
if c+b<=M
c+=b;r+=a*b
else
r+=a*(M-c)
end
}
p r | N,M=gets.split.map &:to_i
c=0;r=0
AB=N.times.map{gets.split.map &:to_i}.sort.map{|a,b|
if c+b<=M
c+=b;r+=a*b
else
r+=a*(M-c);break
end
}
p r | [] | 911,300 | 911,301 | u782685137 | ruby |
p03104 | def oddsolve(x)
(x + 1) / 2 % 2
end
def solve(x)
if a & 1 == 1 then
oddsolve(x)
else
oddsolve(x+1) ^ oddsolve(x+1)
end
end
a, b = gets.chomp.split.map(&:to_i)
puts solve(b) ^ solve(a-1) | def oddsolve(x)
(x + 1) / 2 % 2
end
def solve(x)
if x & 1 == 1 then
oddsolve(x)
else
oddsolve(x+1) ^ (x+1)
end
end
a, b = gets.chomp.split.map(&:to_i)
puts solve(b) ^ solve(a-1) | [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 911,338 | 911,339 | u466332671 | ruby |
p03104 | a,b = gets.chomp.split().map(&:to_i)
def g(n,w); w==1 ? ((n+1)/2)%2 : [(n+1)%2**w - 2**(w-1), 0].max % 2; end
ans = ''
(1..40).each do |i|
ans += (g(b,i) - (g(a-1,i)) % 2).to_s
end
puts ans.reverse.to_i(2)
| a,b = gets.chomp.split().map(&:to_i)
def g(n,w); w==1 ? ((n+1)/2)%2 : [(n+1)%2**w - 2**(w-1), 0].max % 2; end
ans = ''
(1..40).each do |i|
ans += (g(b,i) ^ (g(a-1,i))).to_s
end
puts ans.reverse.to_i(2) | [
"expression.operation.binary.change",
"expression.operation.binary.remove"
] | 911,417 | 911,418 | u524019694 | ruby |
p03104 | a, b = gets.split.map(&:to_i)
#f(0,a)を求める
def f(a)
sum = 0
i = 0
#各桁の1の数を数える
while (i < b.bit_length) do
cnt = 0
#周期2**(i+1)→一応ビット演算しとく
cycle = 1 << (i+1)
#周期内の1の数を数える
cnt += (a+1)/cycle * cycle/2
#はみ出た分を足す
rest = (a+1)%cycle - cycle/2
cnt += rest if rest > 0
#1の数が奇数ならその桁にビットを立てる
if (cnt%2 == 1) then
sum += 1 << i
end
i += 1
end
return sum
end
#f(a,b) = f(0,a-1)^f(0,b)
puts f(a-1)^f(b) | a, b = gets.split.map(&:to_i)
#f(0,a)を求める
def f(a)
sum = 0
i = 0
#各桁の1の数を数える
while (i < a.bit_length) do
cnt = 0
#周期2**(i+1)→一応ビット演算しとく
cycle = 1 << (i+1)
#周期内の1の数を数える
cnt += (a+1)/cycle * cycle/2
#はみ出た分を足す
rest = (a+1)%cycle - cycle/2
cnt += rest if rest > 0
#1の数が奇数ならその桁にビットを立てる
if (cnt%2 == 1) then
sum += 1 << i
end
i += 1
end
return sum
end
#f(a,b) = f(0,a-1)^f(0,b)
puts f(a-1)^f(b) | [
"identifier.change",
"expression.operation.binary.change"
] | 911,886 | 911,887 | u358554431 | ruby |
p03104 | a, b = gets.split.map(&:to_i)
#f(0,a)を求める
def func(a)
i = 0
sum = 0
#49桁分計算 ∵10**12 < 2**48
while (i < 49) do
cnt = 0
#周期2**(i+1)→一応ビット演算しとく
cycle = 1 << (i+1)
#周期内の1の数を数える
cnt += (a+1)/cycle * cycle/2
#はみ出た分を足す
rest = (a+1)%cycle - cycle/2
cnt += rest if rest > 0
if (cnt%2 == 1) then
sum += 1 << i
end
i += 1
end
return sum
end
#f(a,b) = f(0,a-1)^f(0,b)
puts func(a-1)^f(b)
| a, b = gets.split.map(&:to_i)
#f(0,a)を求める
def f(a)
i = 0
sum = 0
#49桁分計算 ∵10**12 < 2**48
while (i < 49) do
cnt = 0
#周期2**(i+1)→一応ビット演算しとく
cycle = 1 << (i+1)
#周期内の1の数を数える
cnt += (a+1)/cycle * cycle/2
#はみ出た分を足す
rest = (a+1)%cycle - cycle/2
cnt += rest if rest > 0
if (cnt%2 == 1) then
sum += 1 << i
end
i += 1
end
return sum
end
#f(a,b) = f(0,a-1)^f(0,b)
puts f(a-1)^f(b) | [
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 911,888 | 911,889 | u358554431 | ruby |
p03104 | A, B = gets.split.map(&:to_i)
def d_xor(b)
if b % 4 == 0
return b
elsif b % 4 == 1
return 1
elsif b % 4 == 2
return n + 1
end
0
end
puts d_xor( A - 1) ^ d_xor(B) | A, B = gets.split.map(&:to_i)
def d_xor(b)
if b % 4 == 0
return b
elsif b % 4 == 1
return 1
elsif b % 4 == 2
return b + 1
end
0
end
puts d_xor(A - 1) ^ d_xor(B) | [
"identifier.change",
"call.arguments.change",
"function.return_value.change",
"expression.operation.binary.change"
] | 912,012 | 912,013 | u503890246 | ruby |
p03104 | a,b = gets.split.map(&:to_i)
chk = 4
ans = a/2 % 2 + (b+1)/2 %2
40.times do
x = a%chk
y = (b+1)%chk
x = x > chk/2 ? x-chk/2 : 0
y = y > chk/2 ? y-chk/2 : 0
ans += ((x-y) % 2 )*chk/2
#p [x,y, ((x-y) % 2 )*chk ]
chk *= 2
end
p ans
| a,b = gets.split.map(&:to_i)
chk = 4
ans = (a/2 % 2 + (b+1)/2 %2) % 2
40.times do
x = a%chk
y = (b+1)%chk
x = x > chk/2 ? x-chk/2 : 0
y = y > chk/2 ? y-chk/2 : 0
ans += ((x-y) % 2 )*(chk/2)
#p [x,y, ((x-y) % 2 )*chk ]
chk *= 2
end
p ans
| [] | 912,087 | 912,088 | u123276241 | ruby |
p03104 | A, B = gets.chomp.split(" ").map(&:to_i)
def f(x)
if x.even?
a = x / 2
if a.even?
ret = 0 ^ x
else
ret = 1 ^ x
end
else
a = (x - 1) / 2
if a.even?
ret = 0 ^ x
else
ret = 1 ^ x
end
end
ret
end
if A == B
puts A
elsif A > 0
puts f(A - 1) ^ f(B)
else
puts f(B)
end
| A, B = gets.chomp.split(" ").map(&:to_i)
def f(x)
if x.even?
a = x / 2
if a.even?
ret = 0 ^ x
else
ret = 1 ^ x
end
else
a = (x + 1) / 2
if a.even?
ret = 0
else
ret = 1
end
end
ret
end
if A == B
puts A
elsif A > 0
puts f(A - 1) ^ f(B)
else
puts f(B)
end
| [
"misc.opposites",
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change",
"expression.operation.binary.remove"
] | 912,225 | 912,226 | u910756197 | ruby |
p03104 | A,B=gets.split.map &:to_i
a=-~A/2*2
b= ~-B/2*2
p (a!=A ? A : 0)^(-~b!=B ? B : 0)^(b-a>>1&1) | A,B=gets.split.map &:to_i
a=-~A/2*2
b= ~-B/2*2
p (a!=A ? A : 0)^(-~b!=B ? B : 0)^(b-a>>1&1^1) | [
"expression.operation.binary.add"
] | 912,446 | 912,447 | u280667879 | ruby |
p03104 | A,B=gets.split.map &:to_i
a=-~A/2*2
b=~-B/2*2
p (a!=A ? A : 0)^(-~b!=B ? B : 0)^(b-a>>1&1) | A,B=gets.split.map &:to_i
a=-~A/2*2
b= ~-B/2*2
p (a!=A ? A : 0)^(-~b!=B ? B : 0)^(b-a>>1&1^1) | [
"expression.operation.binary.add"
] | 912,448 | 912,447 | u280667879 | ruby |
p03104 | def f(res,i)
return res ^ i
end
A,B = readline.chomp.split.map(&:to_i)
res = nil
if(A == B)
p A
elsif( A % 2 == 0)
# 2,3 => 2 ^ 3
if((B-A)%4== 1)
p 1
# 2,3,4 => 1 ^ 4
elsif((B-A)%4 == 2)
p B
# 2,3,4,5 => 1 ^ 1 => 0
elsif((B-A)%4 == 3)
p 0
# 2,3,4,5,6 => 1 ^ 1 ^ 6 => 0 ^ 6 => 6
elsif((B-A)%4 == 0)
p B
# 2,3,4,5,6,7 = 1 ^ 1 ^ 1 => 0 ^ 1 => 1
# elsif()
# p 1
# # 2,3,4,5,6,7,8 = 1 ^ 1 ^ 1 ^ 8 => 1 ^ 8
# elsif()
# # 2,3,4,5,6,7,8,9 = 1 ^ 1 ^ 1 ^ 1 => 1 ^ 1 => 0
# elsif()
end
else
# 3,4 => 3 ^ 4
if((B-A)%4== 1)
p A ^ B
# 3,4,5 => 3 ^ 1
elsif((B-A)%4== 2)
p A ^ 1
# 3,4,5,6 => 3 ^ 1 ^ 6
elsif((B-A)%4== 3)
p A ^ 1 ^ B
# 3,4,5,6,7 = 3 ^ 1 ^ 1 => 3 ^ 0 => 3
elsif((B-A)%4== 0)
p A
# 3,4,5,6,7,8 = 3 ^ 1 ^ 1 ^ 8 => 3 ^ 0 ^ 8 => 3 ^ 8
# elsif()
# p A ^ B
# # 3,4,5,6,7,8,9 = 3 ^ 1 ^ 1 ^ 1 => 3 ^ 1
# elsif()
end
end
# if ((A - B) % 2 + 1 == 0)
# if (A % 2 == 0) && (B % 2 == 1)
# res = 0
# elsif (A % 2 == 0) && (B % 2 == 0)
# res = f(0,B)
# elsif (A % 2 == 1) && (B % 2 == 0)
# res = f(A,B)
# else
# res = f(A,0)
# end
# else ((A - B) % 2 + 1 == 1)
# if (A % 2 == 0) && (B % 2 == 1)
# res = 1
# elsif (A % 2 == 0) && (B % 2 == 0)
# res = f(1,B)
# elsif (A % 2 == 1) && (B % 2 == 0)
# res = f(A,B)
# else
# res = f(A,1)
# end
# end | def f(res,i)
return res ^ i
end
A,B = readline.chomp.split.map(&:to_i)
res = nil
if(A == B)
p A
elsif( A % 2 == 0)
# 2,3 => 2 ^ 3
if((B-A)%4== 1)
p 1
# 2,3,4 => 1 ^ 4
elsif((B-A)%4 == 2)
p 1 ^ B
# 2,3,4,5 => 1 ^ 1 => 0
elsif((B-A)%4 == 3)
p 0
# 2,3,4,5,6 => 1 ^ 1 ^ 6 => 0 ^ 6 => 6
elsif((B-A)%4 == 0)
p B
# 2,3,4,5,6,7 = 1 ^ 1 ^ 1 => 0 ^ 1 => 1
# elsif()
# p 1
# # 2,3,4,5,6,7,8 = 1 ^ 1 ^ 1 ^ 8 => 1 ^ 8
# elsif()
# # 2,3,4,5,6,7,8,9 = 1 ^ 1 ^ 1 ^ 1 => 1 ^ 1 => 0
# elsif()
end
else
# 3,4 => 3 ^ 4
if((B-A)%4== 1)
p A ^ B
# 3,4,5 => 3 ^ 1
elsif((B-A)%4== 2)
p A ^ 1
# 3,4,5,6 => 3 ^ 1 ^ 6
elsif((B-A)%4== 3)
p A ^ 1 ^ B
# 3,4,5,6,7 = 3 ^ 1 ^ 1 => 3 ^ 0 => 3
elsif((B-A)%4== 0)
p A
# 3,4,5,6,7,8 = 3 ^ 1 ^ 1 ^ 8 => 3 ^ 0 ^ 8 => 3 ^ 8
# elsif()
# p A ^ B
# # 3,4,5,6,7,8,9 = 3 ^ 1 ^ 1 ^ 1 => 3 ^ 1
# elsif()
end
end
# if ((A - B) % 2 + 1 == 0)
# if (A % 2 == 0) && (B % 2 == 1)
# res = 0
# elsif (A % 2 == 0) && (B % 2 == 0)
# res = f(0,B)
# elsif (A % 2 == 1) && (B % 2 == 0)
# res = f(A,B)
# else
# res = f(A,0)
# end
# else ((A - B) % 2 + 1 == 1)
# if (A % 2 == 0) && (B % 2 == 1)
# res = 1
# elsif (A % 2 == 0) && (B % 2 == 0)
# res = f(1,B)
# elsif (A % 2 == 1) && (B % 2 == 0)
# res = f(A,B)
# else
# res = f(A,1)
# end
# end
| [
"expression.operation.binary.add"
] | 912,457 | 912,458 | u634813468 | ruby |
p03105 | a,b,c=gets.chomp.split(" ").map(&:to_i)
if b/a <= c
puts c
else
puts b/a
end | a,b,c=gets.chomp.split(" ").map(&:to_i)
if b/a <= c
puts b/a
else
puts c
end
| [
"call.remove",
"call.add"
] | 912,697 | 912,698 | u688809543 | ruby |
p03105 | a, b, c = readline.split.map(&:to_i)
count = b / c
puts count < b ? c : count | a, b, c = readline.split.map(&:to_i)
count = b / a
puts count > c ? c : count | [
"assignment.value.change",
"identifier.change",
"expression.operation.binary.change"
] | 912,941 | 912,942 | u353707427 | ruby |
p03105 | a, b, c = gets.chomp.split(" ").map(&:to_i)
c >= b / a ? answer = a / b : answer = c
puts answer | a, b, c = gets.chomp.split(" ").map(&:to_i)
c >= b / a ? answer = b / a : answer = c
puts answer | [
"expression.operation.binary.remove"
] | 912,994 | 912,995 | u333374716 | ruby |
p03105 | A, B, C = gets.split.map(&:to_i)
cnt = (A/B).floor
if cnt < C then
puts cnt
else
puts C
end
| A, B, C = gets.split.map(&:to_i)
cnt = (B/A).floor
if cnt < C then
puts cnt
else
puts C
end
| [
"expression.operation.binary.remove"
] | 913,196 | 913,197 | u670006196 | ruby |
p03105 | a,b,c = $stdin.read.split.map(&:to_i)
puts [a/b,c].min | a,b,c = $stdin.read.split.map(&:to_i)
puts [b/a,c].min | [
"expression.operation.binary.remove"
] | 913,221 | 913,222 | u622469330 | ruby |
p03105 | a,b,c = gets.chomp.split(" ").map(&:to_i)
x = 0
if b.div(a) <= c
puts b.div(a)
else
while b >= c
x += 1
b = b - a
end
puts x
end
| a,b,c = gets.chomp.split(" ").map(&:to_i)
x = 0
if b.div(a) <= c
puts b.div(a)
else
while b >= c
x += 1
b = b - a
if x = c
end
end
puts x
end
| [] | 913,424 | 913,425 | u514746845 | ruby |
p03105 | a,b,c = gets.chomp.split(" ").map(&:to_i)
x = 0
if b.div(a) < c
puts b.div(a)
else
while b >= c
x += 1
b = b - a
end
puts x
end | a,b,c = gets.chomp.split(" ").map(&:to_i)
x = 0
if b.div(a) <= c
puts b.div(a)
else
while b >= c
x += 1
b = b - a
if x = c
end
end
puts x
end
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 913,426 | 913,425 | u514746845 | ruby |
p03105 | a,b,c = gets.split.map(&:to_i)
if a>=b*c
puts c
else
puts b/a
end | a,b,c = gets.split.map(&:to_i)
if b>=a*c
puts c
else
puts b/a
end | [
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 913,574 | 913,575 | u987183622 | ruby |
p03105 | a, b, c = gets_split
puts [a.to_i. b.to_i / c.to_i].min | a, b, c = gets.split
puts [c.to_i, b.to_i / a.to_i].min
| [
"assignment.value.change",
"call.add",
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change",
"misc.typo"
] | 913,906 | 913,907 | u073946233 | ruby |
p03105 | money,sound,satis_times = gets.split(" ").map!{|i| i.to_i}
cut = money % sound
max_time = (money - cut) / sound
if max_time > satis_times
puts satis_times
else
puts max_time
end
| sound,money,satis_times = gets.split(" ").map!{|i| i.to_i}
cut = money % sound
max_time = (money - cut) / sound
if max_time > satis_times
puts satis_times
else
puts max_time
end
| [] | 913,927 | 913,928 | u911815052 | ruby |
p03106 | puts (1..(A,B,K = gets.split.map(&:to_i))[0..1].max).to_a.select{|x| A%x==0 && B%x==0}[K-1] | puts (1..(A,B,K = gets.split.map(&:to_i))[0]).to_a.select{|x| A%x==0 && B%x==0}[-K] | [
"call.remove",
"call.arguments.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change"
] | 914,351 | 914,352 | u047816928 | ruby |
p03106 | a,b,k = gets.strip.split.map(&:to_i)
n = a.gcd(b)
ary = []
i = 1
while i <= n
if n%i==0
ary << i
end
i += 1
end
puts ary[k-1] | a,b,k = gets.strip.split.map(&:to_i)
n = a.gcd(b)
ary = []
i = 1
while i <= n
if n%i==0
ary << i
end
i += 1
end
puts ary.reverse[k-1]
| [
"call.add"
] | 914,468 | 914,469 | u313103408 | ruby |
p03106 | # https://atcoder.jp/contests/abc120/tasks/abc120_b
A, B, K = gets.split.map(&:to_i)
puts (1..[A, B].min).select { |i| (A % i).zero? && (B % i).zero? }[K - 1]
| # https://atcoder.jp/contests/abc120/tasks/abc120_b
A, B, K = gets.split.map(&:to_i)
puts (1..[A, B].min).select { |i| (A % i).zero? && (B % i).zero? }.reverse[K - 1]
| [
"call.add"
] | 914,798 | 914,799 | u091367113 | ruby |
p03106 | a, b, k = gets.split.map(&:to_i)
set = []
(1..50).each do |i|
if a % i == 0 && b % i == 0
set.push(i)
end
end
puts set.sort.reverse[k-1] | a, b, k = gets.split.map(&:to_i)
set = []
(1..100).each do |i|
if a % i == 0 && b % i == 0
set.push(i)
end
end
puts set.sort.reverse[k-1] | [
"literal.number.integer.change"
] | 914,907 | 914,908 | u866325115 | ruby |
p03106 | a, b, k = gets.split.map(&:to_i)
x=[]
(1..[a,b].min).each do |i|
if (a%i==0) && (b%i==0)
x << i
end
end
puts x[k-1]
| a, b, k = gets.split.map(&:to_i)
x=[]
(1..[a,b].min).each do |i|
if (a%i==0) && (b%i==0)
x << i
end
end
puts x.reverse[k-1]
| [
"call.add"
] | 915,245 | 915,246 | u585819925 | ruby |
p03106 | a, b, k = gets.split.map(&:to_i)
x=[]
(1..[a,b].min).each do |i|
if (a%i==0) && (b%i==0)
x << i
end
end
puts x.sort[k-1]
| a, b, k = gets.split.map(&:to_i)
x=[]
(1..[a,b].min).each do |i|
if (a%i==0) && (b%i==0)
x << i
end
end
puts x.reverse[k-1]
| [
"identifier.change",
"call.arguments.change",
"io.output.change"
] | 915,247 | 915,246 | u585819925 | ruby |
p03106 | a, b, k = gets.split.map(&:to_i)
count = []
(1..([a, b]. min)).reverse_each{ |i|
if a % i == 0 && b % i == 0
count << i
end
}
puts count[-k]
| a, b, k = gets.split.map(&:to_i)
count = []
(1..([a, b]. min)).reverse_each{ |i|
if a % i == 0 && b % i == 0
count << i
end
}
puts count[k - 1]
| [
"expression.operation.unary.arithmetic.remove",
"call.arguments.change"
] | 915,276 | 915,277 | u861662550 | ruby |
p03106 | a,b,k = gets.split(" ").map(&:to_i)
count = 0
(1..a).each do |i|
count += 1 if a % i == 0 && b % i == 0
if count == k
print i
break
end
end | a,b,k = gets.split(" ").map(&:to_i)
count = 0
(1..100).reverse_each do |i|
count += 1 if a % i == 0 && b % i == 0
if count == k
print i
break
end
end | [
"identifier.replace.remove",
"literal.replace.add",
"identifier.change"
] | 915,289 | 915,290 | u915238879 | ruby |
p03106 | a,b,k=gets.split.map(&:to_i)
puts 200.times.select{|i| (a%i==0) && (b%i==0)}.sort[-k] | a,b,k=gets.split.map(&:to_i)
puts 200.times.map(&:succ).select{|i| (a%i==0) && (b%i==0)}.sort[-k] | [
"call.add"
] | 915,560 | 915,561 | u056944756 | ruby |
p03106 | args = gets.split(" ").map(&:to_i)
input_a = args[0]
input_b = args[1]
input_K = args[2]
calc_divisor = lambda{|input| (1..input).select do |i|
input.modulo(i) == 0
end}
if (input_a <= input_b)
divisors_list = calc_divisor.call(input_a)
res = divisors_list.select{|div| input_b.modulo(div) == 0}.sort.reverse
print res
else
divisors_list = calc_divisor.call(input_b)
res = divisors_list.select{|div| input_a.modulo(div) == 0}.sort.reverse
print res
end
puts res.at(input_K - 1)
| args = gets.split(" ").map(&:to_i)
input_a = args[0]
input_b = args[1]
input_K = args[2]
calc_divisor = lambda{|input| (1..input).select do |i|
input.modulo(i) == 0
end}
if (input_a <= input_b)
divisors_list = calc_divisor.call(input_a)
res = divisors_list.select{|div| input_b.modulo(div) == 0}.sort.reverse
else
divisors_list = calc_divisor.call(input_b)
res = divisors_list.select{|div| input_a.modulo(div) == 0}.sort.reverse
end
puts res.at(input_K - 1)
| [
"call.remove"
] | 916,006 | 916,007 | u464955518 | ruby |
p03106 | args = gets.split(" ").map(&:to_i)
input_a = args[0]
input_b = args[1]
input_K = args[2]
calc_divisor = lambda{|input| (1..input).select do |i|
input.modulo(i) == 0
end}
if (input_a <= input_b)
divisors_list = calc_divisor.call(input_a)
res = divisors_list.select{|div| input_b.modulo(div)}.sort.reverse
else
divisors_list = calc_divisor.call(input_b)
res = divisors_list.select{|div| input_a.modulo(div)}.sort.reverse
end
puts res.at(input_K - 1) | args = gets.split(" ").map(&:to_i)
input_a = args[0]
input_b = args[1]
input_K = args[2]
calc_divisor = lambda{|input| (1..input).select do |i|
input.modulo(i) == 0
end}
if (input_a <= input_b)
divisors_list = calc_divisor.call(input_a)
res = divisors_list.select{|div| input_b.modulo(div) == 0}.sort.reverse
else
divisors_list = calc_divisor.call(input_b)
res = divisors_list.select{|div| input_a.modulo(div) == 0}.sort.reverse
end
puts res.at(input_K - 1)
| [
"assignment.change"
] | 916,008 | 916,007 | u464955518 | ruby |
p03106 | A,B,K=gets.chomp.split.map(&:to_i)
t=[]
1.upto(100) { |i| t << i if A%i==0 && B%i==0}
puts t[K-1] | A,B,K=gets.chomp.split.map(&:to_i)
t=[]
1.upto(100) { |i| t << i if A%i==0 && B%i==0}
t.reverse!
puts t[K-1] | [
"call.add"
] | 916,088 | 916,089 | u868089307 | ruby |
p03106 | a,b,k = gets.split.map(&:to_i)
p [a,b].min.times.map.select{|i|i>0 and a%i==0 and b%i==0}.reverse[k-1]
| a,b,k = gets.split.map(&:to_i)
p ([a,b].min+1).times.map.select{|i|i>0 and a%i==0 and b%i==0}.reverse[k-1] | [
"call.arguments.change"
] | 916,242 | 916,243 | u161323909 | ruby |
p03106 | line = gets.chomp.split.map(&:to_i)
a = line[0]
b = line[1]
k = line[2]
times = 0
ans = 0
i = a < b ? b : a
while i > 1 do
if a % i == 0 and b % i == 0
times += 1
ans = i
end
break if times == k
i -= 1
end
puts ans
| line = gets.chomp.split.map(&:to_i)
a = line[0]
b = line[1]
k = line[2]
times = 0
ans = 0
i = a < b ? b : a
while i > 0 do
if a % i == 0 and b % i == 0
times += 1
ans = i
end
break if times == k
i -= 1
end
puts ans
| [
"literal.number.integer.change",
"expression.operation.binary.change"
] | 916,399 | 916,400 | u847478937 | ruby |
p03106 | A, B, K = gets.split.map(&:to_i)
puts (1..100).select { |i| A % i == 0 && B % i == 0 }[K - 1]
| A, B, K = gets.split.map(&:to_i)
puts (1..100).select { |i| A % i == 0 && B % i == 0 }[-K]
| [
"call.arguments.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change"
] | 916,430 | 916,431 | u740836226 | ruby |
p03106 | def calcs(x,y,ax,ay,bx,by) ((ax-x)*(by-y)-(bx-x)*(ay-y))/2.0 end
def inpf() a=gets.chomp.split(" ").map(&:to_f)end
def inps() a=gets.chomp.split(" ")end
def copy(a) Marshal.load(Marshal.dump(a)) end
def factorial(n)(n < 2)? 1 : (2..n).inject(:*) end
def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end
def na(n,d=0) Array.new(n,d)end
def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end
def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end
def yn(f) return (f)? "Yes": "No" end
def ynb(f) return (f)? "YES": "NO" end
def ap(a) a.each{|u| p u} end
def bit(n) n.to_s(2).split("").map(&:to_i) end
def inp() a=gets.chomp.split(" ").map(&:to_i)end
a,b,k = inp
c = 0
(1..100).reverse.each do |d|
if(a%d == 0 and b%d == 0)
c += 1
if(c == k)
puts d
end
end
end | def calcs(x,y,ax,ay,bx,by) ((ax-x)*(by-y)-(bx-x)*(ay-y))/2.0 end
def inpf() a=gets.chomp.split(" ").map(&:to_f)end
def inps() a=gets.chomp.split(" ")end
def copy(a) Marshal.load(Marshal.dump(a)) end
def factorial(n)(n < 2)? 1 : (2..n).inject(:*) end
def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end
def na(n,d=0) Array.new(n,d)end
def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end
def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end
def yn(f) return (f)? "Yes": "No" end
def ynb(f) return (f)? "YES": "NO" end
def ap(a) a.each{|u| p u} end
def bit(n) n.to_s(2).split("").map(&:to_i) end
def inp() a=gets.chomp.split(" ").map(&:to_i)end
a,b,k = inp
c = 0
(1..100).reverse_each do |d|
if(a%d == 0 and b%d == 0)
c += 1
if(c == k)
puts d
end
end
end | [
"identifier.change",
"io.output.change",
"call.remove"
] | 916,465 | 916,466 | u145123922 | ruby |
p03106 | def calcs(x,y,ax,ay,bx,by) ((ax-x)*(by-y)-(bx-x)*(ay-y))/2.0 end
def inpf() a=gets.chomp.split(" ").map(&:to_f)end
def inps() a=gets.chomp.split(" ")end
def copy(a) Marshal.load(Marshal.dump(a)) end
def factorial(n)(n < 2)? 1 : (2..n).inject(:*) end
def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end
def na(n,d=0) Array.new(n,d)end
def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end
def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end
def yn(f) return (f)? "Yes": "No" end
def ynb(f) return (f)? "YES": "NO" end
def ap(a) a.each{|u| p u} end
def bit(n) n.to_s(2).split("").map(&:to_i) end
def inp() a=gets.chomp.split(" ").map(&:to_i)end
a,b,k = inp
c = 0
(1..100).each do |d|
if(a%d == 0 or b%d == 0)
c += 1
if(c == k)
puts d
end
end
end | def calcs(x,y,ax,ay,bx,by) ((ax-x)*(by-y)-(bx-x)*(ay-y))/2.0 end
def inpf() a=gets.chomp.split(" ").map(&:to_f)end
def inps() a=gets.chomp.split(" ")end
def copy(a) Marshal.load(Marshal.dump(a)) end
def factorial(n)(n < 2)? 1 : (2..n).inject(:*) end
def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end
def na(n,d=0) Array.new(n,d)end
def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end
def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end
def yn(f) return (f)? "Yes": "No" end
def ynb(f) return (f)? "YES": "NO" end
def ap(a) a.each{|u| p u} end
def bit(n) n.to_s(2).split("").map(&:to_i) end
def inp() a=gets.chomp.split(" ").map(&:to_i)end
a,b,k = inp
c = 0
(1..100).reverse_each do |d|
if(a%d == 0 and b%d == 0)
c += 1
if(c == k)
puts d
end
end
end | [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 916,467 | 916,466 | u145123922 | ruby |
p03106 | def calcs(x,y,ax,ay,bx,by) ((ax-x)*(by-y)-(bx-x)*(ay-y))/2.0 end
def inpf() a=gets.chomp.split(" ").map(&:to_f)end
def inps() a=gets.chomp.split(" ")end
def copy(a) Marshal.load(Marshal.dump(a)) end
def factorial(n)(n < 2)? 1 : (2..n).inject(:*) end
def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end
def na(n,d=0) Array.new(n,d)end
def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end
def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end
def yn(f) return (f)? "Yes": "No" end
def ynb(f) return (f)? "YES": "NO" end
def ap(a) a.each{|u| p u} end
def bit(n) n.to_s(2).split("").map(&:to_i) end
def inp() a=gets.chomp.split(" ").map(&:to_i)end
a,b,k = inp
c = 0
(1..100).each do |d|
if(a%d == 0 and b%d == 0)
c += 1
if(c == k)
puts d
end
end
end | def calcs(x,y,ax,ay,bx,by) ((ax-x)*(by-y)-(bx-x)*(ay-y))/2.0 end
def inpf() a=gets.chomp.split(" ").map(&:to_f)end
def inps() a=gets.chomp.split(" ")end
def copy(a) Marshal.load(Marshal.dump(a)) end
def factorial(n)(n < 2)? 1 : (2..n).inject(:*) end
def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end
def na(n,d=0) Array.new(n,d)end
def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end
def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end
def yn(f) return (f)? "Yes": "No" end
def ynb(f) return (f)? "YES": "NO" end
def ap(a) a.each{|u| p u} end
def bit(n) n.to_s(2).split("").map(&:to_i) end
def inp() a=gets.chomp.split(" ").map(&:to_i)end
a,b,k = inp
c = 0
(1..100).reverse_each do |d|
if(a%d == 0 and b%d == 0)
c += 1
if(c == k)
puts d
end
end
end | [
"identifier.change"
] | 916,468 | 916,466 | u145123922 | ruby |
p03106 | n = gets.split
a = n[0].to_i
b = n[1].to_i
k = n[2].to_i
numbers = [a,b]
max = numbers.max {|a2, b2| a2.to_i <=> b2.to_i }
result = []
(1..max).each do |i|
if((a/i) * i == a)
if((b/i) * i == b)
result.push(i)
end
end
end
p result[k-1]
| n = gets.split
a = n[0].to_i
b = n[1].to_i
k = n[2].to_i
numbers = [a,b]
max = numbers.max {|a2, b2| a2.to_i <=> b2.to_i }
result = []
max.downto(1).each do |i|
if((a/i) * i == a)
if((b/i) * i == b)
result.push(i)
end
end
end
p result[k-1]
| [
"call.add"
] | 916,539 | 916,540 | u634813468 | ruby |
p03106 | a, b, k = gets.chomp.split.map(&:to_i)
cnt = 0
num = 1
while cnt != k
if a % num == 0 && b % num == 0
cnt += 1
if cnt == k
puts num
break
end
end
num += 1
end | a, b, k = gets.chomp.split.map(&:to_i)
cnt = 0
num = b
while cnt != k
if a % num == 0 && b % num == 0
cnt += 1
if cnt == k
puts num
break
end
end
num -= 1
end | [
"assignment.value.change",
"identifier.replace.add",
"literal.replace.remove",
"expression.operator.change"
] | 916,570 | 916,569 | u326891688 | ruby |
p03106 | def gcd(a,b)
while b>0 do
a,b = b,a%b
end
return a
end
ar = gets.chomp.split(" ").map{|i|i = i.to_i}
a=ar[0]
b=ar[1]
k=ar[2]
pp ar
arr = []
s=gcd(a,b)
s.times do|i|
if s % (i+1)==0 then
arr << (i+1)
end
end
l = arr.length
puts arr[(l-k)] | def gcd(a,b)
while b>0 do
a,b = b,a%b
end
return a
end
ar = gets.chomp.split(" ").map{|i|i = i.to_i}
a=ar[0]
b=ar[1]
k=ar[2]
arr = []
s=gcd(a,b)
s.times do|i|
if s % (i+1)==0 then
arr << (i+1)
end
end
l = arr.length
puts arr[(l-k)] | [
"call.remove"
] | 916,590 | 916,591 | u281662621 | ruby |
p03107 | s = gets.chomp
h = Hash.new(0)
h[0] = 0
h[1] = 0
s.each_char { |c| h[c] += 1 }
puts h.values.min * 2 | s = gets.chomp
h = Hash.new(0)
h['0'] = 0
h['1'] = 0
s.each_char { |c| h[c] += 1 }
puts h.values.min * 2 | [] | 916,688 | 916,689 | u104886851 | ruby |
p03107 | s = gets.chomp
if s.count('0') == 0 || s.count('1') == 0
puts 0
else
puts [s.count('0'), s.count('1')].min
end
| s = gets.chomp
if s.count('0') == 0 || s.count('1') == 0
puts 0
else
puts [s.count('0'), s.count('1')].min * 2
end
| [
"expression.operation.binary.add"
] | 916,717 | 916,718 | u238956837 | ruby |
p03107 | s = gets.chomp.chars
pre_num_of_one = s.sort.join.to_i
if pre_num_of_one == 0
num_of_one = 0
else
num_of_one = pre_num_of_one.to_s.chars.size
end
puts num_of_one
puts s.size - ((s.size - num_of_one) - num_of_one).abs | s = gets.chomp.chars
pre_num_of_one = s.sort.join.to_i
if pre_num_of_one == 0
num_of_one = 0
else
num_of_one = pre_num_of_one.to_s.chars.size
end
puts s.size - ((s.size - num_of_one) - num_of_one).abs | [
"call.remove"
] | 916,865 | 916,866 | u059126963 | ruby |
p03107 | s=gets.chomp
ans=[]
ans << s.count("1")
ans << s.count("2")
puts ans.min*2 | s=gets.chomp
ans=[]
ans << s.count("1")
ans << s.count("0")
puts ans.min*2
| [
"literal.string.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 917,229 | 917,230 | u585819925 | ruby |
p03107 | s = gets.split("")
countRED = 0
countBLUE = 0
s.each do |c|
if c.eql?('0') then countRED+=1
else countBLUE+=1
end
end
puts [countRED, countBLUE].min * 2 | s = gets.chop.split("")
countRED = 0
countBLUE = 0
s.each do |c|
if c.eql?('0') then countRED+=1
else countBLUE+=1
end
end
puts [countRED, countBLUE].min * 2 | [
"call.add"
] | 917,306 | 917,307 | u686064770 | ruby |
p03107 | S = STDIN.gets
oneNum = 0
zeroNum = 0
S.chars { |c|
if c == '0' then
oneNum = oneNum + 1
else
zeroNum = zeroNum + 1
end
}
small = oneNum < zeroNum ? oneNum : zeroNum
puts small * 2 | S = STDIN.gets.chomp
oneNum = 0
zeroNum = 0
S.chars { |c|
if c == '0' then
oneNum = oneNum + 1
else
zeroNum = zeroNum + 1
end
}
small = oneNum < zeroNum ? oneNum : zeroNum
puts small * 2 | [
"call.add"
] | 917,359 | 917,360 | u231458241 | ruby |
p03107 | s = gets.chomp.chars
puts [s.select { |c| c == "0" }.size, s.select { |c| c == "1" }.size].min | s = gets.chomp.chars
puts [s.select { |c| c == "0" }.size, s.select { |c| c == "1" }.size].min * 2 | [
"expression.operation.binary.add"
] | 917,408 | 917,409 | u721689253 | ruby |
p03107 | a,b = gets.chomp.chars.group_by{|x|x}.map{|x,y|y.size}
a |= 0
b |= 0
puts [a,b].min*2 | a,b = gets.chomp.chars.group_by{|x|x}.map{|x,y|y.size}
a ||= 0
b ||= 0
puts [a,b].min*2 | [] | 917,433 | 917,434 | u056944756 | ruby |
p03107 | s=gets.chomp
z=0;o=0
for c in s.split('')
if c=='0'
z+=1
else
o+=1
end
end
puts 2*[z,o].max | s=gets.chomp
z=0;o=0
for c in s.split('')
if c=='0'
z+=1
else
o+=1
end
end
puts 2*[z,o].min | [
"misc.opposites",
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 917,486 | 917,487 | u459746049 | ruby |
p03107 | s=gets.chomp
z=0,o=0
for c in s.split('')
if c=='0'
z+=1
else
o+=1
end
end
puts 2*[z,o].max | s=gets.chomp
z=0;o=0
for c in s.split('')
if c=='0'
z+=1
else
o+=1
end
end
puts 2*[z,o].min | [
"misc.opposites",
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 917,488 | 917,487 | u459746049 | ruby |
p03107 | s = gets.chomp
count = [0,0]
for i in 0..(-1+s.length) do
if s[i] == "0"
count[0] += 1
else
count[1] += 1
end
end
puts count.min
| s = gets.chomp
count = [0,0]
for i in 0..(-1+s.length) do
if s[i] == "0"
count[0] += 1
else
count[1] += 1
end
end
puts 2*count.min
| [
"expression.operation.binary.add"
] | 917,744 | 917,745 | u708550576 | ruby |
p03107 | n = gets.split("").map(&:to_i)
puts [n.count(1),n.count(0)].min*2 | n = gets.chomp.split("").map(&:to_i)
puts [n.count(1),n.count(0)].min*2 | [
"call.add"
] | 917,790 | 917,791 | u506544056 | ruby |
p03107 | n = gets.split("").map(&:to_i)
print ([n.count(1),n.count(0)].min*2) | n = gets.chomp.split("").map(&:to_i)
puts [n.count(1),n.count(0)].min*2 | [
"call.add",
"identifier.change",
"call.arguments.change"
] | 917,792 | 917,791 | u506544056 | ruby |
p03107 | # 結局消せるので少ない方(考察ゼロ)
s = gets.chomp.chars.map(&:to_i)
ichi, zero = s.count(1), s.count(0)
puts [ichi, zero].min | # 結局消せるので少ない方(考察ゼロ)
s = gets.chomp.chars.map(&:to_i)
ichi, zero = s.count(1), s.count(0)
puts [ichi, zero].min * 2 | [
"expression.operation.binary.add"
] | 917,843 | 917,844 | u445624660 | ruby |
p03106 | a,b,c=gets.split.map &:to_i;p (1..a).select{|i|a%i==0&&b%i==0}[c-1] | a,b,c=gets.split.map &:to_i;p a.downto(1).select{|i|a%i==0&&b%i==0}[c-1] | [
"call.add"
] | 917,917 | 917,918 | u280667879 | ruby |
p03106 | um_a,num_b,num_k = gets.split(" ").map!{|i| i.to_i}
list_com = Array.new
count = 1
while count <= num_a + num_b
if num_a%count == 0 && num_b%count == 0
list_com.push(count)
end
count += 1
end
list_com.reverse!
#p list_com
p list_com[num_k-1] | num_a,num_b,num_k = gets.split(" ").map!{|i| i.to_i}
list_com = Array.new
count = 1
while count <= num_a + num_b
if num_a%count == 0 && num_b%count == 0
list_com.push(count)
end
count += 1
end
list_com.reverse!
#p list_com
p list_com[num_k-1] | [
"assignment.variable.change",
"identifier.change"
] | 917,957 | 917,958 | u911815052 | ruby |
p03106 | def divisable_number(x)
1.upto(x).select{ |_x| (x % _x).zero? }
end
a, b, k = gets.chomp!.split(" ").map(&:to_i)
a_p = divisable_number(a)
b_p = divisable_number(b)
puts (a_p & b_p)[k - 1]
| def divisable_number(x)
1.upto(x).select{ |_x| (x % _x).zero? }
end
a, b, k = gets.chomp!.split(" ").map(&:to_i)
a_p = divisable_number(a)
b_p = divisable_number(b)
puts (a_p & b_p).reverse[k - 1]
| [
"call.add"
] | 918,110 | 918,111 | u081708706 | ruby |
p03106 | A,B,K = gets.chomp.split(" ").map(&:to_i)
require 'prime'
class Integer
def my_divisor_list
divisors = [1]
primes = []
Prime.prime_division(self).each do |prime|
prime[1].times {primes << prime[0]}
end
1.upto(primes.size) do |i|
primes.combination(i) do |prime|
divisors << prime.inject{|a,b| a *= b}
end
end
divisors.uniq!
divisors.sort!
return divisors
rescue ZeroDivisionError
return
end
end
puts (A.my_divisor_list & B.my_divisor_list)[K-1] | A,B,K = gets.chomp.split(" ").map(&:to_i)
require 'prime'
class Integer
def my_divisor_list
divisors = [1]
primes = []
Prime.prime_division(self).each do |prime|
prime[1].times {primes << prime[0]}
end
1.upto(primes.size) do |i|
primes.combination(i) do |prime|
divisors << prime.inject{|a,b| a *= b}
end
end
divisors.uniq!
divisors.sort!
return divisors
rescue ZeroDivisionError
return
end
end
puts ((A.my_divisor_list & B.my_divisor_list)[-K]) | [
"call.arguments.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change"
] | 918,122 | 918,123 | u966695319 | ruby |
p03108 | # coding: utf-8
class UnionFind
def initialize(n)
@Parent = Array.new(n, -1)
end
def root(a)
if @Parent[a] < 0 then
a
else
@Parent[a] = root(@Parent[a])
end
end
def size(a)
-@Parent[root(a)]
end
def connect(a, b)
a = root(a)
b = root(b)
if a == b then
return false
end
if a < b then
a, b = b, a
end
@Parent[a] += @Parent[b]
@Parent[b] = a
return true
end
end
n, m = STDIN.gets.chomp.split(" ").map(&:to_i)
a = Array.new(0)
b = Array.new(0)
for i in 1..m
tmpa, tmpb = STDIN.gets.chomp.split(" ").map(&:to_i)
a.push(tmpa)
b.push(tmpb)
end
uni = UnionFind.new(n)
ans = Array.new(m)
ans[m - 1] = n * (n - 1) / 2
(1..(m-1)).reverse_each do |i|
p i
tmpa, tmpb = a[i] - 1, b[i] - 1
if uni.root(tmpa) != uni.root(tmpb) then
ans[i-1] = ans[i] - uni.size(tmpa) * uni.size(tmpb)
else
ans[i-1] = ans[i]
end
uni.connect(tmpa, tmpb)
end
for i in 0..(m-1)
puts ans[i]
end
| # coding: utf-8
class UnionFind
def initialize(n)
@Parent = Array.new(n, -1)
end
def root(a)
if @Parent[a] < 0 then
a
else
@Parent[a] = root(@Parent[a])
end
end
def size(a)
-@Parent[root(a)]
end
def connect(a, b)
a = root(a)
b = root(b)
if a == b then
return false
end
if a < b then
a, b = b, a
end
@Parent[a] += @Parent[b]
@Parent[b] = a
return true
end
end
n, m = STDIN.gets.chomp.split(" ").map(&:to_i)
a = Array.new(0)
b = Array.new(0)
for i in 1..m
tmpa, tmpb = STDIN.gets.chomp.split(" ").map(&:to_i)
a.push(tmpa)
b.push(tmpb)
end
uni = UnionFind.new(n)
ans = Array.new(m)
ans[m - 1] = n * (n - 1) / 2
(1..(m-1)).reverse_each do |i|
tmpa, tmpb = a[i] - 1, b[i] - 1
if uni.root(tmpa) != uni.root(tmpb) then
ans[i-1] = ans[i] - uni.size(tmpa) * uni.size(tmpb)
else
ans[i-1] = ans[i]
end
uni.connect(tmpa, tmpb)
end
for i in 0..(m-1)
puts ans[i]
end
| [
"call.remove"
] | 919,380 | 919,381 | u231458241 | ruby |
p03108 | # coding: utf-8
class UnionFind
def initialize(n)
@Parent = Array.new(n, -1)
end
def root(a)
if @Parent[a] < 0 then
a
else
@Parent[a] = root(@Parent[a])
end
end
def size(a)
-@Parent[root(a)]
end
def connect(a, b)
a = root(a)
b = root(b)
if a == b then
false
end
if a < b then
a, b = b, a
end
@Parent[a] += @Parent[b]
@Parent[b] = a
true
end
end
n, m = STDIN.gets.chomp.split(" ").map(&:to_i)
a = Array.new(0)
b = Array.new(0)
for i in 1..m
tmpa, tmpb = STDIN.gets.chomp.split(" ").map(&:to_i)
a.push(tmpa)
b.push(tmpb)
end
uni = UnionFind.new(n)
ans = Array.new(m)
ans[m - 1] = n * (n - 1) / 2
(1..(m-1)).reverse_each do |i|
tmpa, tmpb = a[i] - 1, b[i] - 1
if uni.root(tmpa) != uni.root(tmpb) then
ans[i-1] = ans[i] - uni.size(tmpa) * uni.size(tmpb)
else
ans[i-1] = ans[i]
end
uni.connect(tmpa, tmpb)
end
for i in 0..(m-1)
puts ans[i]
end
| # coding: utf-8
class UnionFind
def initialize(n)
@Parent = Array.new(n, -1)
end
def root(a)
if @Parent[a] < 0 then
a
else
@Parent[a] = root(@Parent[a])
end
end
def size(a)
-@Parent[root(a)]
end
def connect(a, b)
a = root(a)
b = root(b)
if a == b then
return false
end
if a < b then
a, b = b, a
end
@Parent[a] += @Parent[b]
@Parent[b] = a
return true
end
end
n, m = STDIN.gets.chomp.split(" ").map(&:to_i)
a = Array.new(0)
b = Array.new(0)
for i in 1..m
tmpa, tmpb = STDIN.gets.chomp.split(" ").map(&:to_i)
a.push(tmpa)
b.push(tmpb)
end
uni = UnionFind.new(n)
ans = Array.new(m)
ans[m - 1] = n * (n - 1) / 2
(1..(m-1)).reverse_each do |i|
tmpa, tmpb = a[i] - 1, b[i] - 1
if uni.root(tmpa) != uni.root(tmpb) then
ans[i-1] = ans[i] - uni.size(tmpa) * uni.size(tmpb)
else
ans[i-1] = ans[i]
end
uni.connect(tmpa, tmpb)
end
for i in 0..(m-1)
puts ans[i]
end
| [
"control_flow.return.add"
] | 919,382 | 919,381 | u231458241 | ruby |
p03108 | class UnionFindWithSize
def initialize(size)
@rank = Array.new(size) { 0 }
@parent = Array.new(size) { |id| id }
@union_size = Array.new(size) { 1 }
end
def unite(id_x, id_y)
x_parent = get_parent(id_x)
y_parent = get_parent(id_y)
return if x_parent == y_parent
ary = [@union_size[x_parent], @union_size[y_parent]]
if @rank[x_parent] > @rank[y_parent]
@parent[y_parent] = x_parent
@union_size[x_parent] += ary[1]
else
@parent[x_parent] = y_parent
@union_size[y_parent] += ary[0]
@rank[y_parent] += 1 if @rank[x_parent] == @rank[y_parent]
end
ary
end
def get_parent(id_x)
@parent[id_x] == id_x ? id_x : (@parent[id_x] = get_parent(@parent[id_x]))
end
end
n, m = gets.split.map(&:to_i)
bridges = Array.new(m) { Array.new(2) }
uf = UnionFindWithSize.new(n)
m.times do |i|
bridges[i] = gets.split.map {|j| j.to_i - 1 }
end
ans = []
curr_value = n * (n-1) / 2
ans << curr_value
bridges.reverse_each do |u, v|
if diff = uf.unite(u, v)
curr_value -= diff[0] * diff[1]
end
ans << curr_value
end
p ans.reverse[1..-1] |
class UnionFindWithSize
def initialize(size)
@rank = Array.new(size) { 0 }
@parent = Array.new(size) { |id| id }
@union_size = Array.new(size) { 1 }
end
def unite(id_x, id_y)
x_parent = get_parent(id_x)
y_parent = get_parent(id_y)
return if x_parent == y_parent
ary = [@union_size[x_parent], @union_size[y_parent]]
if @rank[x_parent] > @rank[y_parent]
@parent[y_parent] = x_parent
@union_size[x_parent] += ary[1]
else
@parent[x_parent] = y_parent
@union_size[y_parent] += ary[0]
@rank[y_parent] += 1 if @rank[x_parent] == @rank[y_parent]
end
ary
end
def get_parent(id_x)
@parent[id_x] == id_x ? id_x : (@parent[id_x] = get_parent(@parent[id_x]))
end
end
n, m = gets.split.map(&:to_i)
bridges = Array.new(m) { Array.new(2) }
uf = UnionFindWithSize.new(n)
m.times do |i|
bridges[i] = gets.split.map {|j| j.to_i - 1 }
end
ans = []
curr_value = n * (n-1) / 2
ans << curr_value
bridges.reverse_each do |u, v|
if diff = uf.unite(u, v)
curr_value -= diff[0] * diff[1]
end
ans << curr_value
end
puts ans.reverse[1..-1] | [
"call.function.change",
"io.output.change"
] | 919,395 | 919,396 | u987208743 | ruby |
p03109 | s = gets.chomp
day = s.delete("/")
if day.to_i >= 2019430
puts "Heisei"
else
puts "TBD"
end | s = gets.chomp
day = s.delete("/")
if day.to_i <= 20190430
puts "Heisei"
else
puts "TBD"
end | [] | 920,213 | 920,214 | u689027433 | ruby |
p03109 | year, month, day = gets.chomp.split("/").map(&:to_i)
answer = "Heisei"
if year <= 2018 || (year == 2019 && month <= 4)
answer = "TBD"
end
puts answer | year, month, day = gets.chomp.split("/").map(&:to_i)
answer = "TBD"
if year <= 2018 || (year == 2019 && month <= 4)
answer = "Heisei"
end
puts answer | [
"literal.string.change",
"assignment.value.change"
] | 920,456 | 920,457 | u333374716 | ruby |
p03109 | y,m,d=gets.split.map(&:to_i)
juge=y*10000+m*100+d
puts juge<=20190440 ? "Heisei" : "TBD" | y,m,d=gets.split("/").map(&:to_i)
juge=y*10000+m*100+d
puts juge<=20190440 ? "Heisei" : "TBD"
| [
"call.arguments.add"
] | 920,564 | 920,565 | u585819925 | ruby |
p03109 | # coding: utf-8
X = class Case01
def initialize
end
def show
p self.instance_variables
.map{ |sym| [sym, self.instance_variable_get(sym)] }
.to_h
end
# 実行する
def execute
read
solve
output
end
# 読込
def read
@s = gets.chomp
end
# 回答
def solve
@result = (@s <= '2019/04/30')
end
# 出力
def output
puts @result ? 'Heisei' : 'TBD'
end
end
#
X.new.execute if $0 == __FILE__ | # coding: utf-8
class Case01
def initialize
end
def show
p self.instance_variables
.map{ |sym| [sym, self.instance_variable_get(sym)] }
.to_h
end
# 実行する
def execute
read
solve
output
end
# 読込
def read
@s = gets.chomp
end
# 回答
def solve
@result = (@s <= '2019/04/30')
end
# 出力
def output
puts @result ? 'Heisei' : 'TBD'
end
end
#
Case01.new.execute if $0 == __FILE__
| [
"assignment.remove"
] | 920,958 | 920,959 | u938270657 | ruby |
p03109 | # coding: utf-8
X = class Case01
def initialize
end
def show
p self.instance_variables
.map{ |sym| [sym, self.instance_variable_get(sym)] }
.to_h
end
# 実行する
def execute
read
solve
output
end
# 読込
def read
@s = gets.chomp
end
# 回答
def solve
@result = (@s <= '2019/04/30')
end
# 出力
def output
puts @result ? 'Heisei' : 'TBD'
end
end
#
X.new.execute
| # coding: utf-8
class Case01
def initialize
end
def show
p self.instance_variables
.map{ |sym| [sym, self.instance_variable_get(sym)] }
.to_h
end
# 実行する
def execute
read
solve
output
end
# 読込
def read
@s = gets.chomp
end
# 回答
def solve
@result = (@s <= '2019/04/30')
end
# 出力
def output
puts @result ? 'Heisei' : 'TBD'
end
end
#
Case01.new.execute | [
"assignment.remove"
] | 920,960 | 920,961 | u938270657 | ruby |
p03109 | if gets.strip.gsub('/','') <= 20190430
puts 'Heisei'
else
puts 'TBD'
end | if gets.strip.gsub('/','').to_i <= 20190430
puts 'Heisei'
else
puts 'TBD'
end | [
"control_flow.branch.if.condition.change",
"call.add"
] | 920,977 | 920,978 | u021358975 | ruby |
p03109 | _a,b,_c=gets.split("/").map(&:to_i)
if b <= 4
puts "Heisei"
else
puts "TBD"
end
| _a,b,_c=gets.split("/").map(&:to_i)
if b > 4
puts "TBD"
else
puts "Heisei"
end
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"call.remove",
"call.add"
] | 921,045 | 921,044 | u987183622 | ruby |
p03109 | a,b,c=gets.split("/").map(&:to_i)
if b <= 4
puts "Heisei"
else
puts "TBD"
end
| _a,b,_c=gets.split("/").map(&:to_i)
if b > 4
puts "TBD"
else
puts "Heisei"
end
| [
"assignment.variable.change",
"identifier.change",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"call.remove",
"call.add"
] | 921,046 | 921,044 | u987183622 | ruby |
p03109 | S = gets.chomp
y, m, d = S.split('/').map(&:to_i)
if m < 4 then
puts "Heisei"
else
puts "TBD"
end | S = gets.chomp
y, m, d = S.split('/').map(&:to_i)
if m <= 4 then
puts "Heisei"
else
puts "TBD"
end | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 921,209 | 921,210 | u670006196 | ruby |
p03109 | s = gets.chomp
puts s <= "2019/04/30" ? "Heisei" : "TDB" | s = gets.chomp
puts s <= "2019/04/30" ? "Heisei" : "TBD" | [
"literal.string.change",
"call.arguments.change"
] | 921,271 | 921,272 | u560867850 | ruby |
p03109 | heisei = gets.chomp
puts heisei <= 2019/04/30 ? 'Heisei' : 'TBD'
| heisei = gets.chomp
puts heisei <= '2019/04/30' ? 'Heisei' : 'TBD'
| [
"expression.operation.binary.remove"
] | 921,329 | 921,330 | u069429049 | ruby |
p03109 | heisei = gets.chomp.gsub(/\//, '').to_i
puts heisei <= 20190430 ? 'heisei' : 'TBD'
| heisei = gets.chomp.gsub(/\//, '').to_i
puts heisei <= 20190430 ? 'Heisei' : 'TBD'
| [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 921,331 | 921,332 | u069429049 | ruby |
p03109 | puts gets.split("/")[1].to_i <= 4 ? "heisei" : "TBD" | puts gets.split("/")[1].to_i <= 4 ? "Heisei" : "TBD" | [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 921,372 | 921,373 | u341279393 | ruby |
p03109 | s = gets.delete!('/')
if s <= 20190430
puts 'Heisei'
else
puts 'TBD'
end | s = gets.delete!('/').to_i
if s <= 20190430
puts 'Heisei'
else
puts 'TBD'
end | [
"call.add"
] | 921,378 | 921,379 | u053656954 | ruby |
p03109 | y,m,d = gets.split("/").map(&:to_i)
puts y >= 2019 and m >= 5 ? "TBD" : "Heisei" | y,m,d = gets.split("/").map(&:to_i)
puts (y >= 2019 and m >= 5) ? "TBD" : "Heisei" | [
"control_flow.branch.if.condition.change"
] | 921,444 | 921,445 | u460049292 | ruby |
p03109 | y,m,d = gets.split("/").map(&:to_i)
if m < 5 then
p "Heisei"
else
p "TBD"
end | y,m,d = gets.split("/").map(&:to_i)
if m < 5 then
puts "Heisei"
else
puts "TBD"
end | [
"call.function.change",
"io.output.change"
] | 921,700 | 921,701 | u070036461 | ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.