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 |
|---|---|---|---|---|---|---|---|
p02838 | n = gets.to_i
a = gets.split.map(&:to_i)
len = a.max.to_s(2).length
ans = 0
len.times do |l|
base = 2 ** l
n_1 = a.inject(0) { |acc, cur| cur[l] }
ans += (n - n_1) * n_1 * base
end
puts ans % 1000000007
| n = gets.to_i
a = gets.split.map(&:to_i)
len = a.max.to_s(2).length
ans = 0
len.times do |l|
base = 2 ** l
n_1 = a.inject(0) { |acc, cur| acc + cur[l] }
ans += (n - n_1) * n_1 * base
end
puts ans % 1000000007
| [
"assignment.change"
] | 643,853 | 643,854 | u604352408 | ruby |
p02838 | N,*A = $<.read.split.map(&:to_i)
M = 10**9+7
bc = 59.times.map{|b|
A.count{|a| a[b]==1 }
}
p 59.times.inject(0){|s,b|
(s + bc[b]*(N-bc[b])*(1<<b)) % M
}
| N,*A = $<.read.split.map(&:to_i)
M = 10**9+7
bc = 60.times.map{|b|
A.count{|a| a[b]==1 }
}
p 60.times.inject(0){|s,b|
(s + bc[b]*(N-bc[b])*(1<<b)) % M
}
| [
"literal.number.integer.change",
"assignment.value.change",
"call.arguments.change"
] | 644,345 | 644,346 | u977697682 | ruby |
p02839 | H, W = gets.split.map(&:to_i)
As = H.times.map{gets.split.map(&:to_i)}
Bs = H.times.map{gets.split.map(&:to_i)}
ds = (0 ... H).map{|i| (0 ... W).map{|j| (As[i][j] - Bs[i][j]).abs} + [0]} + [[0] * (W + 1)]
mx = ds.flatten.max * (H + W) + 100
dp = Array.new(H){Array.new(W, 0)}
dp[0][0] |= 1 << (mx + ds[0][0])
dp[0][0] |= 1 << (mx - ds[0][0])
H.times do |i|
W.times do |j|
if i > 0
dp[i][j] |= dp[i - 1][j] << ds[i][j]
dp[i][j] |= dp[i - 1][j] >> ds[i][j]
end
if j > 0
dp[i][j] |= dp[i][j - 1] << ds[i][j]
dp[i][j] |= dp[i][j - 1] >> ds[i][j]
end
end
end
ans = dp.last.last
puts (0 .. mx).find{|x| ans[mx + x] == 1 || ans[mx - 1] == 1} | H, W = gets.split.map(&:to_i)
As = H.times.map{gets.split.map(&:to_i)}
Bs = H.times.map{gets.split.map(&:to_i)}
ds = (0 ... H).map{|i| (0 ... W).map{|j| (As[i][j] - Bs[i][j]).abs} + [0]} + [[0] * (W + 1)]
mx = ds.flatten.max * (H + W)
dp = Array.new(H){Array.new(W, 0)}
dp[0][0] |= 1 << (mx + ds[0][0])
dp[0][0] |= 1 << (mx - ds[0][0])
H.times do |i|
W.times do |j|
if i > 0
dp[i][j] |= dp[i - 1][j] << ds[i][j]
dp[i][j] |= dp[i - 1][j] >> ds[i][j]
end
if j > 0
dp[i][j] |= dp[i][j - 1] << ds[i][j]
dp[i][j] |= dp[i][j - 1] >> ds[i][j]
end
end
end
ans = dp.last.last
puts (0 .. mx).find{|x| ans[mx + x] == 1 || ans[mx - x] == 1} | [
"expression.operation.binary.remove",
"identifier.replace.add",
"literal.replace.remove",
"variable_access.subscript.index.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 645,324 | 645,325 | u304198114 | ruby |
p02839 | H, W = gets.split.map(&:to_i)
As = H.times.map{gets.split.map(&:to_i)}
Bs = H.times.map{gets.split.map(&:to_i)}
ds = (0 ... H).map{|i| (0 ... W).map{|j| (As[i][j] - Bs[i][j]).abs} + [0]} + [[0] * (W + 1)]
mx = ds.flatten.max * (H + W)
dp = Array.new(H){Array.new(W, 0)}
dp[0][0] |= 1 << (mx + ds[0][0])
dp[0][0] |= 1 << (mx - ds[0][0])
H.times do |i|
W.times do |j|
if i > 0
dp[i][j] |= dp[i - 1][j] << ds[i][j]
dp[i][j] |= dp[i - 1][j] >> ds[i][j]
end
if j > 0
dp[i][j] |= dp[i][j - 1] << ds[i][j]
dp[i][j] |= dp[i][j - 1] >> ds[i][j]
end
end
end
ans = dp.last.last
puts (0 .. mx).find{|x| ans[mx + x] == 1 || ans[mx - 1] == 1} | H, W = gets.split.map(&:to_i)
As = H.times.map{gets.split.map(&:to_i)}
Bs = H.times.map{gets.split.map(&:to_i)}
ds = (0 ... H).map{|i| (0 ... W).map{|j| (As[i][j] - Bs[i][j]).abs} + [0]} + [[0] * (W + 1)]
mx = ds.flatten.max * (H + W)
dp = Array.new(H){Array.new(W, 0)}
dp[0][0] |= 1 << (mx + ds[0][0])
dp[0][0] |= 1 << (mx - ds[0][0])
H.times do |i|
W.times do |j|
if i > 0
dp[i][j] |= dp[i - 1][j] << ds[i][j]
dp[i][j] |= dp[i - 1][j] >> ds[i][j]
end
if j > 0
dp[i][j] |= dp[i][j - 1] << ds[i][j]
dp[i][j] |= dp[i][j - 1] >> ds[i][j]
end
end
end
ans = dp.last.last
puts (0 .. mx).find{|x| ans[mx + x] == 1 || ans[mx - x] == 1} | [
"identifier.replace.add",
"literal.replace.remove",
"variable_access.subscript.index.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 645,326 | 645,325 | u304198114 | ruby |
p02841 | i = gets.chomp.split(" ").map(&:to_i)
k = gets.chomp.split(" ").map(&:to_i)
if i[0] == k[0]
puts 1
else
puts 0
end
| i = gets.chomp.split(" ").map(&:to_i)
k = gets.chomp.split(" ").map(&:to_i)
if i[0] == k[0]
puts 0
else
puts 1
end
| [
"call.remove",
"call.add"
] | 645,972 | 645,973 | u599631096 | ruby |
p02841 | p $<.read=~/\b1$/?1:0 | p $<.read=~/\s1\s$/?1:0 | [
"control_flow.branch.if.condition.change"
] | 646,034 | 646,035 | u408023666 | ruby |
p02841 | p $<.read=~/\s1$/?1:0 | p $<.read=~/\s1\s$/?1:0 | [
"control_flow.branch.if.condition.change"
] | 646,036 | 646,035 | u408023666 | ruby |
p02841 | p $<.read=~/ 1$/?1:0 | p $<.read=~/\s1\s$/?1:0 | [
"control_flow.branch.if.condition.change"
] | 646,037 | 646,035 | u408023666 | ruby |
p02841 | gets
puts gets[-2..-1] == " 1" ? 1 : 0 | gets
puts gets.chomp[-2..-1] == " 1" ? 1 : 0 | [
"control_flow.branch.if.condition.change",
"call.add"
] | 646,090 | 646,091 | u960706641 | ruby |
p02842 | n = gets.to_i
(1..50000).each do |i|
if i * 108 / 100 == n
puts i
exit
end
end | n = gets.to_i
(1..50000).each do |i|
if i * 108 / 100 == n
puts i
exit
end
end
puts ":("
| [
"call.add"
] | 646,671 | 646,672 | u966810027 | ruby |
p02842 | n = gets.to_i
[(n / 1.08).ceil, (n / 1.08).floor].each do |v|
if (v * 1.08).ceil == n
puts v
exit 0
end
end
puts ':(' | n = gets.to_i
[(n / 1.08).ceil, (n / 1.08).floor].each do |v|
if (v * 1.08).floor == n
puts v
exit 0
end
end
puts ':(' | [
"misc.opposites",
"identifier.change",
"control_flow.branch.if.condition.change"
] | 647,563 | 647,564 | u173515518 | ruby |
p02842 | n = gets.to_i
x = (n/1.08).to_i
if (x*1.08).to_i == n
p x
elsif ((x+1)*1.08).to_i == n
p x+1
else
p ":("
end
| n = gets.to_i
x = (n/1.08).to_i
if (x*1.08).to_i == n
p x
elsif ((x+1)*1.08).to_i == n
p x+1
else
puts ":("
end | [
"call.function.change",
"io.output.change"
] | 647,795 | 647,796 | u712322283 | ruby |
p02842 | N=gets.to_i
100000.times do |i|
if (i*1.08)/1==N
puts i
exit
end
end
puts ":(" | N=gets.to_i
100000.times do |i|
if (i*1.08).to_i==N
puts i
exit
end
end
puts ":("
| [] | 647,952 | 647,953 | u926099741 | ruby |
p02842 | n = gets.to_i
n.times do |k|
if n == (k * 1.08).floor
p k
exit
end
end
puts ":(" | n = gets.to_i
(n+1).times do |k|
if n == (k * 1.08).floor
p k
exit
end
end
puts ":(" | [] | 648,080 | 648,081 | u693378622 | ruby |
p02842 | n = gets.to_i
n.times do |k|
if n == (k * 1.08).floor
p k
exit
end
end
puts ":(" | n = gets.to_i
(n+10).times do |k|
if n == (k * 1.08).floor
p k
exit
end
end
puts ":(" | [] | 648,080 | 648,082 | u693378622 | ruby |
p02842 | n = gets.to_i
(1..50000).each do |i|
if i*27/25 == n
p i
exit
end
end
p :'(' | n = gets.to_i
(1..50000).each do |i|
if i*27/25 == n
p i
exit
end
end
puts ':(' | [
"call.function.change",
"io.output.change"
] | 648,148 | 648,149 | u976045235 | ruby |
p02842 | n = gets.to_i
(1..50000).each do |i|
if i*27/5 == n
p i
exit
end
end
p :'(' | n = gets.to_i
(1..50000).each do |i|
if i*27/25 == n
p i
exit
end
end
puts ':(' | [
"literal.number.integer.change",
"control_flow.branch.if.condition.change",
"call.function.change",
"io.output.change"
] | 648,150 | 648,149 | u976045235 | ruby |
p02842 | n = gets.to_i
50000.times do |i|
if i * 1.08 == n then
puts i
break
elsif i == 49999
puts ":("
end
end
| n = gets.to_i
50000.times do |i|
if (i * 1.08).floor == n then
puts i
break
elsif i == 49999
puts ":("
end
end
| [
"control_flow.branch.if.condition.change",
"call.add"
] | 648,293 | 648,294 | u960706641 | ruby |
p02842 | i = gets_.to_i
f = i / 1.08
if (f.floor * 1.08).floor == i
p f.floor
elsif (f.ceil * 1.08).floor == i
p f.ceil
else
puts ':('
end | i = gets.to_i
f = i / 1.08
if (f.floor * 1.08).floor == i
p f.floor
elsif (f.ceil * 1.08).floor == i
p f.ceil
else
puts ':('
end | [
"assignment.value.change",
"identifier.change"
] | 648,800 | 648,801 | u720281401 | ruby |
p02842 | n = gets.strip.to_i
no_tax = (n / 1.08).round
if n == (no_tax * 1.08).floor
puts no_tax
else
puts ':('
end | n = gets.strip.to_i
no_tax = (n / 1.08).ceil
if n == (no_tax * 1.08).floor
puts no_tax
else
puts ':('
end | [
"assignment.value.change",
"identifier.change"
] | 649,046 | 649,047 | u543681354 | ruby |
p02842 | n = gets.to_i
if ((n + 1) % 27 === 0) || ((n + 14) % 27 === 0)
puts ':('
elsif (n / 1.08) >= 0
puts (n / 1.08).round
end | n = gets.to_i
if ((n + 1) % 27 === 0) || ((n + 14) % 27 === 0)
puts ':('
elsif (n / 1.08) > 0
puts (n / 1.08).ceil
end | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"identifier.change",
"call.arguments.change",
"io.output.change"
] | 649,052 | 649,053 | u630043039 | ruby |
p02842 | N = gets.chomp.to_i
X_cand = (N / 1.08).floor
X_array = [X_cand-2, X_cand-1, X_cand, X_cand+1, X_cand+2]
answer = ":("
X_array.each do |x|
if (x * 1.08).floor == N
answer = x
break
end
end
p answer | N = gets.chomp.to_i
X_cand = (N / 1.08).floor
X_array = [X_cand-2, X_cand-1, X_cand, X_cand+1, X_cand+2]
answer = ":("
X_array.each do |x|
if (x * 1.08).floor == N
answer = x
break
end
end
puts answer | [
"call.function.change",
"io.output.change"
] | 649,066 | 649,067 | u060633673 | ruby |
p02843 | x = gets().chomp.to_i
max_cnt = x / 100
base_rem = x % 100
puts base_rem <= 5 * max_cnt ? 'Yes' : 'No'
| x = gets().chomp.to_i
max_cnt = x / 100
base_rem = x % 100
puts base_rem <= 5 * max_cnt ? 1 : 0
| [
"call.arguments.change"
] | 649,246 | 649,247 | u810199299 | ruby |
p02843 | dp = [true]
n = gets.to_i
(1..n).each do |i|
dp[i] = dp[i-105] || dp[i-104] || dp[i-103] || dp[i-102] || dp[i-101] || dp[i-100]
end
p dp[n] ? 1 : 0
| dp = [true]
n = gets.to_i
(1..n).each do |i|
next if i < 100
dp[i] = dp[i-105] || dp[i-104] || dp[i-103] || dp[i-102] || dp[i-101] || dp[i-100]
end
p dp[n] ? 1 : 0
| [] | 649,252 | 649,253 | u966810027 | ruby |
p02843 | lines = $stdin.read
array = lines.split("\n")
X = array[0].to_i
COINS = [100, 101, 102, 103, 104, 105]
def coin(amount,kind,coins)
coins = [0].concat(coins)
dp = Array.new(kind+1).map{Array.new(amount+1, 0)}
dp.each{|row| row[0] = 1}
for i in 1..kind
for j in 1..amount
dp[i][j] = dp[i][j - coins[i]] + dp[i-1][j]
end
end
dp
end
dp = coin(X,COINS.length,COINS)
if dp[COINS.length][X] > 0
puts 1
else
puts 0
end
| lines = $stdin.read
array = lines.split("\n")
X = array[0].to_i
COINS = [100, 101, 102, 103, 104, 105]
def coin(amount,kind,coins)
coins = [0].concat(coins)
dp = Array.new(kind+1).map{Array.new(10**5+1, 0)}
dp.each{|row| row[0] = 1}
for i in 1..kind
for j in 1..amount
dp[i][j] = dp[i][j - coins[i]] + dp[i-1][j]
end
end
dp
end
dp = coin(X,COINS.length,COINS)
if dp[COINS.length][X] > 0
puts 1
else
puts 0
end | [
"assignment.value.change",
"identifier.replace.remove",
"literal.replace.add",
"call.arguments.change",
"expression.operation.binary.change"
] | 650,004 | 650,005 | u108333452 | ruby |
p02843 | lines = $stdin.read
array = lines.split("\n")
X = array[0].to_i
COINS = [100, 101, 102, 103, 104, 105]
def coin(amount,kind,coins)
coins = [0].concat(coins)
dp = Array.new(kind+1).map{Array.new(amount+1, 0)}
dp.each{|row| row[0] = 1}
for i in 1..kind
for j in 1..amount
dp[i][j] = dp[i][j - coins[i]] + dp[i-1][j]
end
end
dp
end
dp = coin(X,COINS.length,COINS)
if dp[COINS.length-1][X] > 0
puts 1
else
puts 0
end
| lines = $stdin.read
array = lines.split("\n")
X = array[0].to_i
COINS = [100, 101, 102, 103, 104, 105]
def coin(amount,kind,coins)
coins = [0].concat(coins)
dp = Array.new(kind+1).map{Array.new(10**5+1, 0)}
dp.each{|row| row[0] = 1}
for i in 1..kind
for j in 1..amount
dp[i][j] = dp[i][j - coins[i]] + dp[i-1][j]
end
end
dp
end
dp = coin(X,COINS.length,COINS)
if dp[COINS.length][X] > 0
puts 1
else
puts 0
end | [
"assignment.value.change",
"identifier.replace.remove",
"literal.replace.add",
"call.arguments.change",
"expression.operation.binary.change",
"expression.operation.binary.remove"
] | 650,006 | 650,005 | u108333452 | ruby |
p02843 | x = gets.to_i
under_two = x % 100
over_two = x / 100
cnt = 0
(1..5).reverse_each do |i|
cnt += under_two % i
under_two /= i
end
puts cnt > over_two ? "0" : "1" | x = gets.to_i
under_two = x % 100
over_two = x / 100
cnt = 0
(1..5).reverse_each do |i|
cnt += under_two / i
under_two %= i
end
puts cnt > over_two ? "0" : "1" | [
"expression.operator.arithmetic.change",
"expression.operation.binary.change",
"expression.operator.change"
] | 650,017 | 650,018 | u191196346 | ruby |
p02843 | n = gets.chomp.to_i
c = n/100
a = n%100
if a<c*5
puts '1'
else
puts '0'
end
| n = gets.chomp.to_i
c = n/100
a = n%100
if a<=c*5
puts '1'
else
puts '0'
end
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 650,365 | 650,366 | u145950990 | ruby |
p02843 | X = gets.chomp.to_i
# A, B, C = gets.chomp.split.map(&:to_i)
# S = gets.chomp.chars
# 0-5
# X / 100
diff = X / 100
remain = X % 100
if remain <= (diff * 6)
p 1
else
p 0
end | X = gets.chomp.to_i
# A, B, C = gets.chomp.split.map(&:to_i)
# S = gets.chomp.chars
# 0-5
# X / 100
diff = X / 100
remain = X % 100
if remain <= (diff * 5)
p 1
else
p 0
end | [
"literal.number.integer.change",
"control_flow.branch.if.condition.change"
] | 650,459 | 650,460 | u328294851 | ruby |
p02843 | MOD=10**9+7
cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.to_i end
def gsmi() gets.chomp.split.map(&:to_i) 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 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 puts_yesno(can) puts(can ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def debug(k,v) puts "#{k}:#{v}" end
########### ( ˘ω˘ )スヤァ… ###########
x=gi
m = x%100
d = x/100
mm=m
cnt=0
5.downto(1) do |i|
cnt+=mm/i
mm/=i
end
puts cnt<=d ? 1 : 0 | MOD=10**9+7
cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.to_i end
def gsmi() gets.chomp.split.map(&:to_i) 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 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 puts_yesno(can) puts(can ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def debug(k,v) puts "#{k}:#{v}" end
########### ( ˘ω˘ )スヤァ… ###########
x=gi
m = x%100
d = x/100
mm=m
cnt=0
5.downto(1) do |i|
cnt+=mm/i
mm=mm%i
end
puts cnt<=d ? 1 : 0 | [
"assignment.value.change"
] | 650,478 | 650,479 | u385631112 | ruby |
p02843 | MOD=10**9+7
cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.to_i end
def gsmi() gets.chomp.split.map(&:to_i) 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 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 puts_yesno(can) puts(can ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def debug(k,v) puts "#{k}:#{v}" end
########### ( ˘ω˘ )スヤァ… ###########
x=gi
m = x%100
d = x/100
mm=m
cnt=0
5.downto(1) do |i|
cnt+=mm%i
mm/=i
end
puts cnt<=d ? 1 : 0 | MOD=10**9+7
cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.to_i end
def gsmi() gets.chomp.split.map(&:to_i) 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 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 puts_yesno(can) puts(can ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def debug(k,v) puts "#{k}:#{v}" end
########### ( ˘ω˘ )スヤァ… ###########
x=gi
m = x%100
d = x/100
mm=m
cnt=0
5.downto(1) do |i|
cnt+=mm/i
mm=mm%i
end
puts cnt<=d ? 1 : 0 | [
"expression.operation.binary.add",
"assignment.add"
] | 650,480 | 650,479 | u385631112 | ruby |
p02843 | X = gets.to_i
p (X % 100 / 5) <= (X / 100) ? 1 : 0 | X = gets.to_i
p (X % 100 / 5.0).ceil <= (X / 100) ? 1 : 0 | [
"control_flow.branch.if.condition.change",
"call.add"
] | 650,505 | 650,506 | u655122274 | ruby |
p02844 | n = gets.to_i
s = gets.split(//).map &:to_i
a = [nil] * 10
b = [nil] * 100
c = [nil] * 1000
s.each do |m|
100.times do |i|
next unless b[i]
c[i * 10 + m] = true
end
10.times do |i|
next unless a[i]
b[i * 10 + m] = true
end
a[m] = true
end
puts c.count(&:itself)
| n = gets.to_i
s = gets.chomp.split(//).map &:to_i
a = [nil] * 10
b = [nil] * 100
c = [nil] * 1000
s.each do |m|
100.times do |i|
next unless b[i]
c[i * 10 + m] = true
end
10.times do |i|
next unless a[i]
b[i * 10 + m] = true
end
a[m] = true
# p "---"
# p m
# puts 1000.times.select{|i|c[i]}.join(" ")
end
puts c.count(&:itself) | [
"call.add"
] | 650,819 | 650,820 | u106964380 | ruby |
p02844 | n = gets.to_i
s = gets.split(//).map &:to_i
a = [nil] * 10
b = [nil] * 100
c = [nil] * 1000
s.each do |m|
100.times do |i|
next unless b[i]
c[i * 10 + m] = true
end
10.times do |i|
next unless a[i]
b[i * 10 + m] = true
end
a[m] = true
end
puts c.count(&:itself) | n = gets.to_i
s = gets.chomp.split(//).map &:to_i
a = [nil] * 10
b = [nil] * 100
c = [nil] * 1000
s.each do |m|
100.times do |i|
next unless b[i]
c[i * 10 + m] = true
end
10.times do |i|
next unless a[i]
b[i * 10 + m] = true
end
a[m] = true
# p "---"
# p m
# puts 1000.times.select{|i|c[i]}.join(" ")
end
puts c.count(&:itself) | [
"call.add"
] | 650,821 | 650,820 | u106964380 | ruby |
p02844 | N=gets.to_i
S=gets.chomp
a=Array.new(10){Array.new}
N.times do |i|
a[S[i].to_i].push(i)
end
cnt=0
def form(i)
return "00"+i.to_s if i<10
return "0"+i.to_s if i<100
return i.to_s if i<1000
end
1000.times do |i|
s=form(i).split("").map(&:to_i)
next if a[s[0]].nil?
x=a[s[0]][0]
next if a[s[1]].nil?
y=a[s[1]].bsearch{|e|x<e}
next if y.nil?
next if a[s[2]].nil?
z=a[s[2]].bsearch{|e|y<e}
next if z.nil?
cnt+=1
end
puts cnt | N=gets.to_i
S=gets.chomp
a=Array.new(10){Array.new}
N.times do |i|
a[S[i].to_i].push(i)
end
cnt=0
def form(i)
return "00"+i.to_s if i<10
return "0"+i.to_s if i<100
return i.to_s if i<1000
end
1000.times do |i|
s=form(i).split("").map(&:to_i)
next if a[s[0]].empty?
x=a[s[0]][0]
next if a[s[1]].empty?
y=a[s[1]].bsearch{|e|x<e}
next if y.nil?
next if a[s[2]].empty?
z=a[s[2]].bsearch{|e|y<e}
next if z.nil?
cnt+=1
end
puts cnt
| [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 651,154 | 651,155 | u926099741 | ruby |
p02844 | c = 0
s = gets
1000.times { |n|
x = "%03d" % n
c += 1 if (i=s.index(x[0])) && (i=s.index(x[1],i+1)) && s.index(x[2],i+1)
}
p c | gets
s = gets
c = 0
1000.times { |n|
x = "%03d" % n
c += 1 if (i=s.index(x[0])) && (i=s.index(x[1],i+1)) && s.index(x[2],i+1)
}
p c | [
"assignment.remove",
"assignment.add"
] | 651,210 | 651,211 | u720281401 | ruby |
p02847 | S = gets.chomp
a = [0, "SAT", "FRI", "THU", "WED", "TUE", "MON", "SUN"]
a.index(S) | S = gets.chomp
a = [0, "SAT", "FRI", "THU", "WED", "TUE", "MON", "SUN"]
print a.index(S)
| [
"io.output.change",
"call.add"
] | 652,332 | 652,333 | u569559028 | ruby |
p02847 | s = gets.chomp
hh = {}
hh["SAN"] = 7
hh["MON"] = 6
hh["TUE"] = 5
hh["WED"] = 4
hh["THU"] = 3
hh["FRI"] = 2
hh["SAT"] = 1
puts hh[s]
| #n, m, k = gets.split.map(&:to_i)
s = gets.chomp
hh = {}
hh["SUN"] = 7
hh["MON"] = 6
hh["TUE"] = 5
hh["WED"] = 4
hh["THU"] = 3
hh["FRI"] = 2
hh["SAT"] = 1
puts hh[s]
| [
"literal.string.change",
"assignment.variable.change",
"variable_access.subscript.index.change"
] | 652,423 | 652,424 | u714724786 | ruby |
p02847 | a=[:SAT,:FRI,:THU,:WED,:TUE,:MON,:SUN]
p a.index(gets.to_sym)+1 | a=[:SAT,:FRI,:THU,:WED,:TUE,:MON,:SUN]
p a.index(gets.chomp.to_sym)+1
| [
"call.add"
] | 652,440 | 652,441 | u966810027 | ruby |
p02847 | week = {"SUN":7,"MON":6,"TUE":5,"WED":4,"THU":3,"FRI":2,"SAT":1}
puts week[gets.chomp] | week = {"SUN":7,"MON":6,"TUE":5,"WED":4,"THU":3,"FRI":2,"SAT":1}
puts week[gets.chomp.to_sym]
| [
"call.add"
] | 652,442 | 652,443 | u966810027 | ruby |
p02847 | puts %w(SUN MON TUE WE THU FRI SAT).reverse!.index(gets.chomp) + 1 | puts %w(SUN MON TUE WED THU FRI SAT).reverse!.index(gets.chomp) + 1 | [
"literal.string.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 652,893 | 652,894 | u104886851 | ruby |
p02847 | S = gets.chomp
h = {"SUN": 7, "Mon": 6, "TUE": 5, "WED": 4, "THU": 3, "FRI": 2, "SAT": 1}
puts h[:"#{S}"]
| S = gets.chomp
h = {"SUN": 7, "MON": 6, "TUE": 5, "WED": 4, "THU": 3, "FRI": 2, "SAT": 1}
puts h[:"#{S}"]
| [
"literal.string.change",
"literal.string.case.change",
"assignment.value.change"
] | 652,951 | 652,952 | u846185950 | ruby |
p02847 | s = gets.chomp
if s == "SAT"
puts 1
elsif s == "FRI"
puts 2
elsif s == "THU"
puts 3
elsif s == "WED"
puts 4
elsif s == "TUI"
puts 5
elsif s == "MON"
puts 6
else
puts 7
end | s = gets.chomp
if s == "SAT"
puts 1
elsif s == "FRI"
puts 2
elsif s == "THU"
puts 3
elsif s == "WED"
puts 4
elsif s == "TUE"
puts 5
elsif s == "MON"
puts 6
else
puts 7
end | [
"literal.string.change",
"control_flow.branch.if.condition.change"
] | 652,954 | 652,955 | u244401500 | ruby |
p02847 | s = gets.to_i
we = ["SUN","MON","TUE","WED","THU","FRI","SAT"]
for i in 0..6
puts 7-i if we[i] == s
end | s = gets.chomp.to_s
we = ["SUN","MON","TUE","WED","THU","FRI","SAT"]
for i in 0..6
puts 7-i if we[i] == s
end
| [
"assignment.value.change",
"identifier.change",
"call.add"
] | 653,122 | 653,123 | u326891688 | ruby |
p02847 | ays = %w[SUN MON TUE WED THU FRI SAT]
i = days.index(gets.chomp)
puts i.zero? ? 7 : (7 - i) | days = %w[SUN MON TUE WED THU FRI SAT]
i = days.index(gets.chomp)
puts i.zero? ? 7 : (7 - i) | [
"assignment.variable.change",
"identifier.change"
] | 653,346 | 653,347 | u765478029 | ruby |
p02847 | days = %s[SUN MON TUE WED THU FRI SAT]
i = days.index(gets.chomp)
puts i.zero? ? 7 : (7 - i) | days = %w[SUN MON TUE WED THU FRI SAT]
i = days.index(gets.chomp)
puts i.zero? ? 7 : (7 - i) | [
"assignment.value.change"
] | 653,348 | 653,347 | u765478029 | ruby |
p02847 | s = gets.to_s
ary = ["","SAT","FRI","THU","WED","TUE","MON","SUN"]
puts ary.find_index(s.to_s) | s = gets.chomp
ary = ["","SAT","FRI","THU","WED","TUE","MON","SUN"]
puts ary.find_index(s.to_s) | [
"assignment.value.change",
"identifier.change"
] | 653,384 | 653,385 | u944733909 | ruby |
p02847 | 'SAT FRI THU WED TUE MON SUN'.split.index(gets.chomp) + 1 | p 'SAT FRI THU WED TUE MON SUN'.split.index(gets.chomp) + 1 | [
"io.output.change",
"call.add"
] | 653,429 | 653,430 | u488208047 | ruby |
p02847 | S = gets.chomp
if S == 'SUN'
puts 7
elsif S == 'MON'
puts 6
elsif S == 'TUS'
puts 5
elsif S == 'WED'
puts 4
elsif S == 'TUE'
puts 3
elsif S == 'FRI'
puts 2
elsif S == 'SAT'
puts 1
end | S = gets.chomp
if S == 'SUN'
puts 7
elsif S == 'MON'
puts 6
elsif S == 'TUE'
puts 5
elsif S == 'WED'
puts 4
elsif S == 'THU'
puts 3
elsif S == 'FRI'
puts 2
elsif S == 'SAT'
puts 1
end | [
"literal.string.change",
"control_flow.branch.if.condition.change"
] | 653,534 | 653,535 | u010077599 | ruby |
p02847 | S = gets.chomp
if S == 'SUN'
puts 7
elsif S == 'MON'
puts 6
elsif S == 'TUS'
puts 5
elsif S == 'WED'
puts 4
elsif S == 'THU'
puts 3
elsif S == 'FRI'
puts 2
elsif S == 'SAT'
puts 1
end | S = gets.chomp
if S == 'SUN'
puts 7
elsif S == 'MON'
puts 6
elsif S == 'TUE'
puts 5
elsif S == 'WED'
puts 4
elsif S == 'THU'
puts 3
elsif S == 'FRI'
puts 2
elsif S == 'SAT'
puts 1
end | [
"literal.string.change",
"control_flow.branch.if.condition.change"
] | 653,536 | 653,535 | u010077599 | ruby |
p02847 | s = gets.chomp("")
week = {"SUN"=> 0,"MON"=> 6,"TUE"=> 5,"WED"=> 4,"THU"=> 3,"FRI"=> 2,"SAT"=> 1}
puts week[s]
| s = gets.chomp("")
week = {"SUN"=> 7,"MON"=> 6,"TUE"=> 5,"WED"=> 4,"THU"=> 3,"FRI"=> 2,"SAT"=> 1}
puts week[s]
| [
"literal.number.integer.change",
"assignment.value.change"
] | 653,564 | 653,565 | u634342027 | ruby |
p02847 | s = gets.chomp
case s
when "SUN"
puts 7
when "MON"
puts 6
when "TUE"
puts 5
when "WED"
puts 4
when "THU"
puts 3
when "FRI"
puts 2
else
puts "SAT"
end | s = gets.chomp
case s
when "SUN"
puts 7
when "MON"
puts 6
when "TUE"
puts 5
when "WED"
puts 4
when "THU"
puts 3
when "FRI"
puts 2
else
puts 1
end
| [
"call.arguments.change"
] | 653,587 | 653,588 | u147964866 | ruby |
p02847 | S = gets.chomp
if S == "SUN" then
puts 7
end
if S == "MON" then
puts 6
end
if S == "TUE" then
puts 5
end
if S == "WED" then
puts 4
end
if S == "THU" then
puts 3
end
if S == "FRI" then
puts 2
end
if S == "SUT" then
puts 1
end | S = gets.chomp
if S == "SUN" then
puts 7
end
if S == "MON" then
puts 6
end
if S == "TUE" then
puts 5
end
if S == "WED" then
puts 4
end
if S == "THU" then
puts 3
end
if S == "FRI" then
puts 2
end
if S == "SAT" then
puts 1
end | [
"literal.string.change",
"control_flow.branch.if.condition.change"
] | 653,591 | 653,592 | u039504682 | ruby |
p02847 | s = gets.chomp
case s
when "SUN"
puts 0
when "MON"
puts 6
when "TUE"
puts 5
when "WED"
puts 4
when "THU"
puts 3
when "FRI"
puts 2
when "SAT"
puts 1
end
| s = gets.chomp
case s
when "SUN"
puts 7
when "MON"
puts 6
when "TUE"
puts 5
when "WED"
puts 4
when "THU"
puts 3
when "FRI"
puts 2
when "SAT"
puts 1
end
| [
"literal.number.integer.change",
"call.arguments.change"
] | 653,623 | 653,624 | u374765295 | ruby |
p02847 | dict = {"SAT"=>1,"SUN"=>7,"MON"=>6,"THU"=>5,"WED"=>4,"THR"=>3,"FRI"=>2}
input = gets.chomp
puts dict[input] | dict = {"SAT"=>1,"SUN"=>7,"MON"=>6,"TUE"=>5,"WED"=>4,"THU"=>3,"FRI"=>2}
input = gets.chomp
puts dict[input] | [
"literal.string.change",
"assignment.value.change"
] | 653,631 | 653,632 | u864158997 | ruby |
p02847 | dict = {"SAT"=>1,"SUN"=>7,"MON"=>6,"TUE"=>5,"WED"=>4,"THR"=>3,"FRI"=>2}
input = gets.chomp
puts dict[input] | dict = {"SAT"=>1,"SUN"=>7,"MON"=>6,"TUE"=>5,"WED"=>4,"THU"=>3,"FRI"=>2}
input = gets.chomp
puts dict[input] | [
"literal.string.change",
"assignment.value.change"
] | 653,633 | 653,632 | u864158997 | ruby |
p02847 | def num_of_days(string)
days = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']
days.each_with_index do |day, index|
if string == day
return (7 - index)
end
end
-1
end
line = gets
puts num_of_days(line)
| def num_of_days(string)
days = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']
days.each_with_index do |day, index|
if string == day
return (7 - index)
end
end
-1
end
line = gets.chomp
puts num_of_days(line)
| [
"call.add"
] | 653,706 | 653,707 | u917917206 | ruby |
p02847 | s = gets.chomp
MON
w = %w(SUN MON TUE WED THU FRI SAT)
p 7 - w.index(s) | s = gets.chomp
w = %w(SUN MON TUE WED THU FRI SAT)
p 7 - w.index(s)
| [] | 653,776 | 653,777 | u097065307 | ruby |
p02847 | p ["SAT","FRI","THU","WED","TUE","MON","SUN"].index(gets)+1 | p ["SAT","FRI","THU","WED","TUE","MON","SUN"].index(gets.chomp)+1 | [
"call.add"
] | 653,834 | 653,835 | u091810847 | ruby |
p02847 | require"Date"
p 7-(Date.parse(gets)-Date.parse('SUN')).to_i | require"date"
p 7-(Date.parse(gets)-Date.parse('SUN')).to_i
| [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 653,852 | 653,853 | u394033362 | ruby |
p02847 | s=gets
a=['SUN','MON','TUE','WED','THU','FRI','SAT']
a.each_with_index do |e,i|
if e == s
puts 7-i
end
end | s=gets.chomp!
a=['SUN','MON','TUE','WED','THU','FRI','SAT']
a.each_with_index do |e,i|
if e == s
puts 7-i
end
end | [
"call.add"
] | 653,854 | 653,855 | u121794232 | ruby |
p02847 | s=gets
a=['SUN','MON','TUE','WED','THU','FRI','SAT']
a.each_with_index do |e,i|
if e == s
p 7-i
end
end | s=gets.chomp!
a=['SUN','MON','TUE','WED','THU','FRI','SAT']
a.each_with_index do |e,i|
if e == s
puts 7-i
end
end | [
"call.add",
"call.function.change",
"io.output.change"
] | 653,856 | 653,855 | u121794232 | ruby |
p02847 | s=gets
a=['SUN','MON','TUE','WED','THU','FRI','SAT']
a.each_with_index do |e,i|
if e == s
print 7-i
end
end | s=gets.chomp!
a=['SUN','MON','TUE','WED','THU','FRI','SAT']
a.each_with_index do |e,i|
if e == s
puts 7-i
end
end | [
"call.add",
"identifier.change",
"io.output.change"
] | 653,857 | 653,855 | u121794232 | ruby |
p02847 | weeks = %w(SUN MON TUE WED THU FRI SAT)
week = gets.chomp
puts(7 - weeks[week]) | weeks = %w(SUN MON TUE WED THU FRI SAT)
week = gets.chomp
puts(7 - weeks.index(week)) | [
"call.arguments.change",
"expression.operation.binary.change",
"call.add"
] | 653,905 | 653,906 | u474096841 | ruby |
p02847 | s = gets.chomp
if s == "SUN"
put 7
elsif s == "MON"
puts 6
elsif s == "TUE"
puts 5
elsif s == "WED"
puts 4
elsif s == "THU"
puts 3
elsif s == "FRI"
puts 2
elsif s == "SAT"
puts 1
end
| s = gets.chomp
if s == "SUN"
puts 7
elsif s == "MON"
puts 6
elsif s == "TUE"
puts 5
elsif s == "WED"
puts 4
elsif s == "THU"
puts 3
elsif s == "FRI"
puts 2
elsif s == "SAT"
puts 1
end
| [
"misc.typo",
"identifier.change"
] | 653,934 | 653,935 | u911373146 | ruby |
p02847 | s = gets.chomp!
if s == "SUN"
put 7
elsif s == "MON"
puts 6
elsif s == "TUE"
puts 5
elsif s == "WED"
puts 4
elsif s == "THU"
puts 3
elsif s == "FRI"
puts 2
elsif s == "SAT"
puts 1
end | s = gets.chomp
if s == "SUN"
puts 7
elsif s == "MON"
puts 6
elsif s == "TUE"
puts 5
elsif s == "WED"
puts 4
elsif s == "THU"
puts 3
elsif s == "FRI"
puts 2
elsif s == "SAT"
puts 1
end
| [
"assignment.value.change",
"identifier.change",
"misc.typo"
] | 653,936 | 653,935 | u911373146 | ruby |
p02847 | str = gets.to_s
ans = ['SAT','FRI','THU','WED','TUE','MON','SUN']
puts ans.index(str) + 1
| str = gets.chomp.to_s
ans = ['SAT','FRI','THU','WED','TUE','MON','SUN']
puts ans.index(str) + 1
| [
"call.add"
] | 653,937 | 653,938 | u417892119 | ruby |
p02847 | str = gets
ans = ['SAT','FRI','THU','WED','TUE','MON','SUN']
puts ans.index(str) + 1
| str = gets.chomp.to_s
ans = ['SAT','FRI','THU','WED','TUE','MON','SUN']
puts ans.index(str) + 1
| [
"call.add"
] | 653,939 | 653,938 | u417892119 | ruby |
p02848 | n = gets.chomp.to_i
s = gets.chomp
char = s.chars
alphabets = ("A".."Z").to_a
if n > 0
char.each do |i|
index = alphabets.index(i)
strings = alphabets[(index + n) % 26]
end
else strings = s
end
puts strings | n = gets.chomp.to_i
s = gets.chomp
char = s.chars
strings = ""
alphabets = ("A".."Z").to_a
if n > 0
char.each do |i|
index = alphabets.index(i)
strings += alphabets[(index + n) % 26]
end
else strings = s
end
puts strings | [
"assignment.value.change"
] | 654,572 | 654,573 | u895926909 | ruby |
p02848 | n=gets.to_i
s=gets.chomp.split('')
n.times do
s=s.map{|t|t!='Z' ? t.next! : 'A'}
end
p s.join
| n=gets.to_i
s=gets.chomp.split('')
n.times do
s=s.map{|t|t!='Z' ? t.next! : 'A'}
end
puts s.join
| [
"call.function.change",
"io.output.change"
] | 654,951 | 654,952 | u966810027 | ruby |
p02848 | n=gets.to_i
s=gets.chomp.split('')
n.times do
s.each{|t|t!='Z' ? t.next! : 'A'}
end
p s.join | n=gets.to_i
s=gets.chomp.split('')
n.times do
s=s.map{|t|t!='Z' ? t.next! : 'A'}
end
puts s.join
| [
"assignment.value.change",
"identifier.change",
"call.function.change",
"io.output.change"
] | 654,953 | 654,952 | u966810027 | ruby |
p02848 | N = gets.to_i
S = gets.chomp
=begin
文字列を一文字ずつnextメソッドで入力された整数 N 分アルファベットを進めて
代入していく。
=end
str=""
S.length.times do |i|
c = S[i]
num = 0
while num < N
c.next!
if c=="AA"
c="A"
end
num+=1
end
str+=c
end
p str | N = gets.to_i
S = gets.chomp
=begin
文字列を一文字ずつnextメソッドで入力された整数 N 分アルファベットを進めて
代入していく。
=end
str = ""
S.length.times do |i|
c = S[i]
num = 0
while num < N
c.next!
if c=="AA"
c="A"
end
num+=1
end
str+=c
end
puts(str)
| [
"call.function.change",
"io.output.change",
"call.arguments.change"
] | 655,034 | 655,033 | u372923276 | ruby |
p02848 | N = gets.to_i
S = gets.chomp
=begin
文字列を一文字ずつnextメソッドで入力された整数 N 分アルファベットを進めて
代入していく。
=end
str=""
S.length.times do |i|
c = S[i]
num = 0
p c
while num < N
c.next!
if c=="AA"
c="A"
end
num+=1
end
str+=c
end
p str | N = gets.to_i
S = gets.chomp
=begin
文字列を一文字ずつnextメソッドで入力された整数 N 分アルファベットを進めて
代入していく。
=end
str = ""
S.length.times do |i|
c = S[i]
num = 0
while num < N
c.next!
if c=="AA"
c="A"
end
num+=1
end
str+=c
end
puts(str)
| [
"call.remove",
"call.function.change",
"io.output.change",
"call.arguments.change"
] | 655,036 | 655,033 | u372923276 | ruby |
p02848 | N = gets.to_i
S = gets.chomp
alphs = ('A'..'Z').to_a
size = alphabets.length
res = S.split('').map { |s| alphs[(alphs.index(s) + N) % size] }.join('')
puts res
| N = gets.to_i
S = gets.chomp
alphs = ('A'..'Z').to_a
size = alphs.length
res = S.split('').map { |s| alphs[(alphs.index(s) + N) % size] }.join('')
puts res
| [
"assignment.value.change",
"identifier.change"
] | 655,041 | 655,042 | u205505893 | ruby |
p02848 | a = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
n = gets.to_i
s = gets.chomp.chars
ans = s.map do |char|
index = a.index(char) + n
char = a[index % 27]
end
puts ans.join
| a = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
n = gets.to_i
s = gets.chomp.chars
s = s.map do |char|
index = a.index(char) + n
char = a[index % 26]
end
puts s.join
| [
"assignment.variable.change",
"identifier.change",
"literal.number.integer.change",
"assignment.value.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change",
"call.arguments.change",
"io.output.change"
] | 655,054 | 655,055 | u335381753 | ruby |
p02848 | n=gets.to_i
puts gets.chomp.chars.map{|x| ((x.ord-?A.ord+n)%26).chr}.join | n=gets.to_i
puts gets.chomp.chars.map{|x| ((x.ord-?A.ord+n)%26+?A.ord).chr}.join | [
"expression.operation.binary.add"
] | 655,088 | 655,089 | u056944756 | ruby |
p02848 | n = gets.to_i
chars = gets.chomp.split("")
als = ('A'..'Z').to_a
results = []
chars.each do |char|
results << als[als.index(char) % 26 + n]
end
puts results.join
| n = gets.to_i
chars = gets.chomp.split("")
als = ('A'..'Z').to_a
results = []
chars.each do |char|
results << als[(als.index(char)+n) % 26 ]
end
puts results.join
| [
"expression.operation.binary.remove"
] | 655,219 | 655,220 | u012110567 | ruby |
p02848 | n = gets.to_i
chars = gets.chomp.split("")
als = ('a'..'z').to_a
results = []
chars.each do |char|
results << als[(als.index(char) + n) % als.size]
end
puts results.join
| n = gets.to_i
chars = gets.chomp.split("")
als = ('A'..'Z').to_a
results = []
chars.each do |char|
results << als[(als.index(char)+n) % 26 ]
end
puts results.join
| [
"literal.string.change",
"literal.string.case.change",
"assignment.value.change",
"identifier.replace.remove",
"literal.replace.add",
"variable_access.subscript.index.change",
"expression.operation.binary.change",
"call.remove"
] | 655,221 | 655,220 | u012110567 | ruby |
p02848 | n = gets.to_i
chars = gets.chomp.split("")
als = ('a'..'z').to_a
results = []
chars.each do |char|
results << als[(als.index(char) + n) % als.size]
end
puts results.join
| n = gets.to_i
chars = gets.chomp.split("")
als = ('A'..'Z').to_a
results = []
chars.each do |char|
results << als[(als.index(char) + n) % als.size]
end
puts results.join
| [
"literal.string.change",
"literal.string.case.change",
"assignment.value.change"
] | 655,221 | 655,222 | u012110567 | ruby |
p02848 | n = gets.chomp.to_i
s = gets.chomp.split(//)
def alp_index(s,n)
i = n % 26
alp = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z".split.map(&:to_s)
total = (i + alp.find_index(s).to_i + 1) % 26
alp[total]
end
tmp = []
s.each do |s|
tmp.push(alp_index(s,n).chomp)
end
puts tmp.join
| n = gets.chomp.to_i
s = gets.chomp.split(//)
def alp_index(s,n)
i = n % 26
alp = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z".split.map(&:to_s)
total = (i + alp.find_index(s).to_i) % 26
alp[total]
end
tmp = []
s.each do |s|
tmp.push(alp_index(s,n).chomp)
end
puts tmp.join | [
"expression.operation.binary.remove"
] | 655,259 | 655,260 | u944733909 | ruby |
p02848 | n = gets.chomp.to_i
s = gets.chomp.split(//)
def alp_index(s,n)
i = n % 26
alp = "0 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z".split.map(&:to_s)
total = (i + alp.find_index(s).to_i) % 26
alp[total]
end
tmp = []
s.each do |s|
tmp.push(alp_index(s,n).chomp)
end
puts tmp.join | n = gets.chomp.to_i
s = gets.chomp.split(//)
def alp_index(s,n)
i = n % 26
alp = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z".split.map(&:to_s)
total = (i + alp.find_index(s).to_i) % 26
alp[total]
end
tmp = []
s.each do |s|
tmp.push(alp_index(s,n).chomp)
end
puts tmp.join | [
"literal.string.change",
"assignment.value.change"
] | 655,261 | 655,260 | u944733909 | ruby |
p02848 | n = gets.to_i
s = gets.split(//)
def alp_index(s,n)
i = n % 26
alp = "0 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z".split.map(&:to_s)
total = (i + alp.find_index(s).to_i) % 26
alp[total]
end
tmp = []
s.each do |s|
tmp.push(alp_index(s,n).chomp)
end
puts tmp.join
| n = gets.chomp.to_i
s = gets.chomp.split(//)
def alp_index(s,n)
i = n % 26
alp = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z".split.map(&:to_s)
total = (i + alp.find_index(s).to_i) % 26
alp[total]
end
tmp = []
s.each do |s|
tmp.push(alp_index(s,n).chomp)
end
puts tmp.join | [
"call.add",
"literal.string.change",
"assignment.value.change"
] | 655,262 | 655,260 | u944733909 | ruby |
p02848 | N = gets.to_i
S = gets.chomp
a = [*"A".."Z"]
p S.tr(a.to_s, a.rotate(N).to_s) | N = gets.to_i
S = gets.chomp
a = [*"A".."Z"]
puts S.tr(a.to_s, a.rotate(N).to_s) | [
"call.function.change",
"io.output.change"
] | 655,345 | 655,346 | u010077599 | ruby |
p02848 | n=gets.to_i
puts gets.each_char.map{|c|n.times{c.succ!};c[-1]}*"" | n=gets.to_i
puts gets.chomp.each_char.map{|c|n.times{c.succ!};c[-1]}*"" | [
"call.add"
] | 655,390 | 655,391 | u353917577 | ruby |
p02848 | n = gets.to_i
string = gets
arr = []
mod = n % 26
string.each_char do |st|
val = st.ord + mod
if val > 90
arr.push(('A'.ord + val - 90 - 1).chr)
else
arr.push((st.ord + mod).chr)
end
end
# arr.pop
print arr.join('') | n = gets.to_i
string = gets.chomp
arr = []
mod = n % 26
string.each_char do |st|
val = st.ord + mod
if val > 90
arr.push(('A'.ord + val - 90 - 1).chr)
else
arr.push((st.ord + mod).chr)
end
end
print arr.join('') | [
"call.add"
] | 655,437 | 655,438 | u200123768 | ruby |
p02848 | n = gets.to_i
string = gets.split
arr = []
mod = n % 26
string.each_char do |st|
val = st.ord + mod
if val > 90
arr.push(('A'.ord + val - 90 - 1).chr)
else
arr.push((st.ord + mod).chr)
end
end
# arr.pop
print arr.join('') | n = gets.to_i
string = gets.chomp
arr = []
mod = n % 26
string.each_char do |st|
val = st.ord + mod
if val > 90
arr.push(('A'.ord + val - 90 - 1).chr)
else
arr.push((st.ord + mod).chr)
end
end
print arr.join('') | [
"assignment.value.change",
"identifier.change"
] | 655,439 | 655,438 | u200123768 | ruby |
p02848 | n = gets.to_i
string = gets
arr = []
mod = n % 26
string.each_char do |st|
val = st.ord + mod
if val > 90
arr.push(('A'.ord + val - 90 - 1).chr)
else
arr.push((st.ord + mod).chr)
end
end
print arr.join('')
| n = gets.to_i
string = gets.chomp
arr = []
mod = n % 26
string.each_char do |st|
val = st.ord + mod
if val > 90
arr.push(('A'.ord + val - 90 - 1).chr)
else
arr.push((st.ord + mod).chr)
end
end
print arr.join('') | [
"call.add"
] | 655,440 | 655,438 | u200123768 | ruby |
p02848 | n = gets.to_i
string = gets
arr = []
mod = n % 26
string.each_char do |st|
val = st.ord + mod
if val > 90
arr.push(('A'.ord + val - 90 - 1).chr)
else
arr.push((st.ord + mod).chr)
end
end
puts arr.join('') | n = gets.to_i
string = gets.chomp
arr = []
mod = n % 26
string.each_char do |st|
val = st.ord + mod
if val > 90
arr.push(('A'.ord + val - 90 - 1).chr)
else
arr.push((st.ord + mod).chr)
end
end
print arr.join('') | [
"call.add",
"identifier.change"
] | 655,441 | 655,438 | u200123768 | ruby |
p02848 | n = gets.to_i
string = gets
arr = []
mod = n % 26
string.each_char do |st|
val = st.ord + mod
if val > 90
arr.push(('A'.ord + val - 90 - 1).chr)
else
arr.push((st.ord + mod).chr)
end
end
# arr.pop
print arr.join('') | n = gets.to_i
string = gets
arr = []
mod = n % 26
string.each_char do |st|
val = st.ord + mod
if val > 90
arr.push(('A'.ord + val - 90 - 1).chr)
else
arr.push((st.ord + mod).chr)
end
end
arr.pop
print arr.join('')
| [
"call.add"
] | 655,437 | 655,443 | u200123768 | ruby |
p02848 | n = gets.to_i
string = gets.split
arr = []
mod = n % 26
string.each_char do |st|
val = st.ord + mod
if val > 90
arr.push(('A'.ord + val - 90 - 1).chr)
else
arr.push((st.ord + mod).chr)
end
end
# arr.pop
print arr.join('') | n = gets.to_i
string = gets
arr = []
mod = n % 26
string.each_char do |st|
val = st.ord + mod
if val > 90
arr.push(('A'.ord + val - 90 - 1).chr)
else
arr.push((st.ord + mod).chr)
end
end
arr.pop
print arr.join('')
| [
"call.remove",
"call.add"
] | 655,439 | 655,443 | u200123768 | ruby |
p02848 | n = gets.to_i
string = gets
arr = []
mod = n % 26
string.each_char do |st|
val = st.ord + mod
if val > 90
arr.push(('A'.ord + val - 90 - 1).chr)
else
arr.push((st.ord + mod).chr)
end
end
print arr.join('')
| n = gets.to_i
string = gets
arr = []
mod = n % 26
string.each_char do |st|
val = st.ord + mod
if val > 90
arr.push(('A'.ord + val - 90 - 1).chr)
else
arr.push((st.ord + mod).chr)
end
end
arr.pop
print arr.join('')
| [
"call.add"
] | 655,440 | 655,443 | u200123768 | ruby |
p02848 | n = gets.to_i
string = gets
arr = []
mod = n % 26
string.each_char do |st|
val = st.ord + mod
if val > 90
arr.push(('A'.ord + val - 90 - 1).chr)
else
arr.push((st.ord + mod).chr)
end
end
puts arr.join('') | n = gets.to_i
string = gets
arr = []
mod = n % 26
string.each_char do |st|
val = st.ord + mod
if val > 90
arr.push(('A'.ord + val - 90 - 1).chr)
else
arr.push((st.ord + mod).chr)
end
end
arr.pop
print arr.join('')
| [
"identifier.change",
"call.add",
"io.output.change"
] | 655,441 | 655,443 | u200123768 | ruby |
p02848 | n = gets.to_i
string = gets
arr = []
mod = n % 26
string.each_char do |st|
val = st.ord + mod
if val > 90
arr.push(('A'.ord + val - 90 - 1).chr)
else
arr.push((st.ord + mod).chr)
end
end
print arr.join('')
| n = gets.to_i
string = gets
arr = []
mod = n % 26
string.each_char do |st|
val = st.ord + mod
if val > 90
arr.push(('A'.ord + val - 90 - 1).chr)
else
arr.push((st.ord + mod).chr)
end
end
arr.pop
print arr.join('') | [
"call.add"
] | 655,440 | 655,444 | u200123768 | ruby |
p02848 | n = gets.to_i
string = gets
arr = []
mod = n % 26
string.each_char do |st|
val = st.ord + mod
if val > 90
arr.push(('A'.ord + val - 90 - 1).chr)
else
arr.push((st.ord + mod).chr)
end
end
puts arr.join('') | n = gets.to_i
string = gets
arr = []
mod = n % 26
string.each_char do |st|
val = st.ord + mod
if val > 90
arr.push(('A'.ord + val - 90 - 1).chr)
else
arr.push((st.ord + mod).chr)
end
end
arr.pop
print arr.join('') | [
"identifier.change",
"call.add",
"io.output.change"
] | 655,441 | 655,444 | u200123768 | ruby |
p02848 | N = gets.to_i
arr = gets.split("")
alf = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
ans = []
arr.each do |s|
if alf.index(s)+N > 25
ans.push(alf[alf.index(s)+N - 26])
else
ans.push(alf[alf.index(s)+N])
end
end
ans.each do |n|
print n
end
| N = gets.chomp.to_i
arr = gets.chomp.split("")
alf = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
ans = []
arr.each do |s|
if alf.index(s)+N > 25
ans.push(alf[alf.index(s)+N - 26])
else
ans.push(alf[alf.index(s)+N])
end
end
ans.each do |n|
print n
end
| [
"call.add"
] | 655,536 | 655,537 | u417892119 | ruby |
p02848 | N = gets.to_i
arr = gets.split("")
alf = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
ans = []
arr.each do |s|
if alf.index(s)+N > 25
ans.push(alf[alf.index(s)+N - 26])
else
ans.push(alf[alf.index(s)+N - 26])
end
end
ans.each do |n|
print n
end
| N = gets.chomp.to_i
arr = gets.chomp.split("")
alf = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
ans = []
arr.each do |s|
if alf.index(s)+N > 25
ans.push(alf[alf.index(s)+N - 26])
else
ans.push(alf[alf.index(s)+N])
end
end
ans.each do |n|
print n
end
| [
"call.add",
"expression.operation.binary.remove"
] | 655,538 | 655,537 | u417892119 | ruby |
p02848 | n = gets.to_i % 26
s = gets.chomp.chars
T = 'ABCDEFGHIJKLMNOPQRSTUWVXYZABCDEFGHIJKLMNOPQRSTUWVXYZ'.chars
ret = ''
s.each do |v|
ret += T[(T.index(v) + n)]
end
puts ret
| n = gets.to_i % 26
s = gets.chomp.chars
T = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'.chars
ret = ''
s.each do |v|
ret += T[(T.index(v) + n)]
end
puts ret
| [
"literal.string.change",
"assignment.value.change"
] | 655,752 | 655,753 | u498700239 | ruby |
p02848 | n = gets.to_i
s = gets.chomp.chars
T = 'ABCDEFGHIJKLMNOPQRSTUWVXYZABCDEFGHIJKLMNOPQRSTUWVXYZ'.chars
ret = ''
s.each do |v|
ret += T[(T.index(v) + n) % 26]
end
puts ret
| n = gets.to_i % 26
s = gets.chomp.chars
T = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'.chars
ret = ''
s.each do |v|
ret += T[(T.index(v) + n)]
end
puts ret
| [
"literal.string.change",
"assignment.value.change",
"expression.operation.binary.remove"
] | 655,754 | 655,753 | u498700239 | ruby |
p02848 | N = gets.to_i
S = gets.strip.split('')
result = S.map do |s|
n = s.ord + N;
p n
if n < 91
n.chr
else
(n % 90 + 64).chr
end
end
puts result.join('') | N = gets.to_i % 26
S = gets.strip.split('')
result = S.map do |s|
n = s.ord + N;
if n < 91
n.chr
else
(n % 90 + 64).chr
end
end
puts result.join('') | [
"call.remove"
] | 655,830 | 655,831 | u259578064 | ruby |
p02848 | n = gets.to_i
s = gets.chomp.chars.map(&:to_s)
result = []
s.each do |alphabet|
alphabet_ord = alphabet.ord + n
if 90 < alphabet_ord
result.push (alphabet_ord - 26).chr
else
result.push alphabet_ord.chr
end
end
p result.join | n = gets.to_i
s = gets.chomp.chars.map(&:to_s)
result = []
s.each do |alphabet|
alphabet_ord = alphabet.ord + n
if 90 < alphabet_ord
result.push (alphabet_ord - 26).chr
else
result.push alphabet_ord.chr
end
end
print "#{result.join}" | [] | 655,895 | 655,896 | u176517109 | ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.