problem_id
stringlengths 6
6
| buggy_code
stringlengths 8
526k
| fixed_code
stringlengths 12
526k
| labels
listlengths 0
15
⌀ | buggy_submission_id
int64 1
1.54M
| fixed_submission_id
int64 2
1.54M
| user_id
stringlengths 10
10
| language
stringclasses 8
values |
|---|---|---|---|---|---|---|---|
p03919
|
H,W = gets.split.map &:to_i
x = (0...H).map{ gets.chomp.split }.flatten(true).index("snuke")
i = x / W; j = x % W
puts ("A".."Z").to_a[j]+"#{i+1}"
|
H,W = gets.split.map &:to_i
x = (0...H).map{ gets.chomp.split }.flatten(1).index("snuke")
i = x / W; j = x % W
puts ("A".."Z").to_a[j]+"#{i+1}"
|
[
"assignment.value.change",
"call.arguments.change"
] | 1,477,514
| 1,477,515
|
u670503797
|
ruby
|
p03919
|
H,W = gets.split.map &:to_i
x = (0...H).map{ gets.chomp.split }.flatten(true).index("snuke")
i = x / W; j = x % W
puts ("A".."Z")[j]+"#{i+1}"
|
H,W = gets.split.map &:to_i
x = (0...H).map{ gets.chomp.split }.flatten(1).index("snuke")
i = x / W; j = x % W
puts ("A".."Z").to_a[j]+"#{i+1}"
|
[
"assignment.value.change",
"call.arguments.change",
"call.add"
] | 1,477,516
| 1,477,515
|
u670503797
|
ruby
|
p03931
|
eval"N,K,*A,D=#{`tr -! ,`}(R=0..255).map{[0]*101}"
D[0][0]=1
A.map{|a|R.map{|j|256.times{D[_1^a][i=N-j]+=D[_1][i-1]*i}}}
p D[K].sum.%10**9+7
|
eval"N,K,*A,D=#{`tr -! ,`}(R=0..255).map{[0]*101}"
D[0][0]=1
A.map{|a|N.times{|j|R.map{D[_1^a][i=N-j]+=D[_1][i-1]*i}}}
p D[K].sum.%10**9+7
|
[
"identifier.change"
] | 1,478,730
| 1,478,731
|
u657913472
|
ruby
|
p03943
|
a=gets.split.map(&:to_i).sort
if a[0] + a[1] == a[2]
puts "YES"
else
puts "NO"
end
|
a=gets.split.map(&:to_i).sort
if a[0] + a[1] == a[2]
puts "Yes"
else
puts "No"
end
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,480,703
| 1,480,704
|
u315652648
|
ruby
|
p03943
|
a,b,c=gets.split(" ").map(&:to_i)
if a+b=c
puts "Yes"
elsif a+c=b
puts "Yes"
elsif b+c=a
puts "Yes"
else
puts "No"
end
|
a,b,c=gets.split(" ").map(&:to_i)
if a+b==c
puts "Yes"
elsif a+c==b
puts "Yes"
elsif b+c==a
puts "Yes"
else
puts "No"
end
|
[
"expression.operation.compare.replace.add",
"assignment.replace.remove",
"misc.typo"
] | 1,480,919
| 1,480,920
|
u085647568
|
ruby
|
p03943
|
arr = gets.chomp.split(" ").map(&:to_i)
sort = arr.sort
max = sort.max
puts result = (max == sort[0] + sort[1]) ? 'YES' : 'NO'
|
arr = gets.chomp.split(" ").map(&:to_i)
sort = arr.sort
max = sort.max
puts max == sort[0] + sort[1] ? 'Yes' : 'No'
|
[
"control_flow.branch.if.condition.change",
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,480,987
| 1,480,988
|
u393932832
|
ruby
|
p03943
|
arr = gets.chomp.split(" ").map(&:to_i)
sort = arr.sort
max = sort.max
puts result = (max == sort[0] + sort[1]) ? 'YES' : 'NO'
|
arr = gets.chomp.split(" ").map(&:to_i)
sort = arr.sort
max = sort.max
puts result = (max == sort[0] + sort[1]) ? 'Yes' : 'No'
|
[
"literal.string.change",
"literal.string.case.change",
"assignment.value.change",
"call.arguments.change"
] | 1,480,987
| 1,480,989
|
u393932832
|
ruby
|
p03943
|
a,b,c = gets.split.map(&:to_i)
if a + b == c || b + c == a || a + c == b
puts "YES"
else
puts "NO"
end
|
a,b,c = gets.split.map(&:to_i)
if a + b == c || b + c == a || a + c == b
puts "Yes"
else
puts "No"
end
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,480,992
| 1,480,993
|
u649242511
|
ruby
|
p03943
|
arr = gets.split(' ').map(&:to_i).sort
if (arr[0] + arr[1]) == arr[2]
puts 'YES'
else
puts 'NO'
end
|
arr = gets.split(' ').map(&:to_i).sort
if (arr[0] + arr[1]) == arr[2]
puts 'Yes'
else
puts 'No'
end
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,481,000
| 1,481,001
|
u315984289
|
ruby
|
p03943
|
a = gets.chomp.split(' ').map(&:to_i)
a.sort!
if a[0] + a[1] == a[2]
p 'Yes'
else
p 'No'
end
|
a = gets.chomp.split(' ').map(&:to_i)
a.sort!
if a[0] + a[1] == a[2]
puts 'Yes'
else
puts 'No'
end
|
[
"call.function.change",
"io.output.change"
] | 1,481,010
| 1,481,011
|
u875730451
|
ruby
|
p03943
|
a = gets.chomp.split(' ').map(&:to_i).sort!
if a[0] + a[1] == a[2]
p 'Yes'
else
p 'No'
end
|
a = gets.chomp.split(' ').map(&:to_i)
a.sort!
if a[0] + a[1] == a[2]
puts 'Yes'
else
puts 'No'
end
|
[
"call.add",
"call.function.change",
"io.output.change"
] | 1,481,012
| 1,481,011
|
u875730451
|
ruby
|
p03943
|
a = gets.split(' ').map(&:to_i).sort!
if a[0] + a[1] == a[2]
p 'Yes'
else
p 'No'
end
|
a = gets.chomp.split(' ').map(&:to_i)
a.sort!
if a[0] + a[1] == a[2]
puts 'Yes'
else
puts 'No'
end
|
[
"call.add",
"call.function.change",
"io.output.change"
] | 1,481,013
| 1,481,011
|
u875730451
|
ruby
|
p03943
|
abc = gets.split.map(&:to_i)
abc.sort!
p abc[0] + abc[1] == abc[2] ? "Yes" : "No"
|
abc = gets.split.map(&:to_i)
abc.sort!
puts abc[0] + abc[1] == abc[2] ? "Yes" : "No"
|
[
"call.function.change",
"io.output.change"
] | 1,481,199
| 1,481,200
|
u390727364
|
ruby
|
p03943
|
ary = gets.split.map(&:to_i)
a = ary[0]
b = ary[1]
c = ary[2]
3.times do
if a == b + c
puts 'Yes'
exit
elsif b == a + c
puts 'Yes'
exit
elsif c == b + c
puts 'Yes'
exit
else
puts 'No'
exit
end
end
|
ary = gets.split.map(&:to_i)
a = ary[0]
b = ary[1]
c = ary[2]
3.times do
if a == b + c
puts 'Yes'
exit
elsif b == a + c
puts 'Yes'
exit
elsif c == a + b
puts 'Yes'
exit
else
puts 'No'
exit
end
end
|
[
"control_flow.branch.if.condition.change",
"expression.operation.binary.remove"
] | 1,481,261
| 1,481,262
|
u467800529
|
ruby
|
p03943
|
input = gets.split.map(&:to_i).sort
p input
if input[0] == input[1] + input[2] || input[0] + input[1] == input[2]
puts 'Yes'
else
puts 'No'
end
|
input = gets.split.map(&:to_i).sort
if input[0] == input[1] + input[2] || input[0] + input[1] == input[2]
puts 'Yes'
else
puts 'No'
end
|
[
"call.remove"
] | 1,481,271
| 1,481,272
|
u579668395
|
ruby
|
p03943
|
a=gets.split.map(&:to_i)
puts a.find_index(a.sum/3.to_f) ? "Yes" : "No"
|
a=gets.split.map(&:to_i)
puts a.find_index(a.sum/2.to_f) ? "Yes" : "No"
|
[
"literal.number.integer.change",
"control_flow.branch.if.condition.change"
] | 1,481,349
| 1,481,350
|
u966810027
|
ruby
|
p03943
|
a=gets.split.map(&:to_i)
puts a.find_index(a.sum/3) ? "Yes" : "No"
|
a=gets.split.map(&:to_i)
puts a.find_index(a.sum/2.to_f) ? "Yes" : "No"
|
[
"literal.number.integer.change",
"control_flow.branch.if.condition.change",
"call.add"
] | 1,481,351
| 1,481,350
|
u966810027
|
ruby
|
p03943
|
a = gets.split.map(&:to_i)
max = a.sort.pop
sum = a.inject(:+) - max
puts max == sum ? "YES" : "NO"
|
a = gets.split.map(&:to_i)
max = a.sort.pop
sum = a.inject(:+) - max
puts max == sum ? "Yes" : "No"
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,481,525
| 1,481,526
|
u819939299
|
ruby
|
p03943
|
d = gets.split.map(&:to_i).sort
m = d.pop
if m - d.inject(&:+).zero?
puts 'Yes'
else
puts 'No'
end
|
d = gets.split.map(&:to_i).sort
m = d.pop
if (m - d.inject(&:+)).zero?
puts 'Yes'
else
puts 'No'
end
|
[
"control_flow.branch.if.condition.change"
] | 1,481,612
| 1,481,613
|
u093372948
|
ruby
|
p03943
|
a=gets.chomp.split(&:to_i)
b=a.inject(:+)
for x in 0..2
if b==a[x]*2
puts "Yes"
exit
end
end
puts "No"
|
a=gets.chomp.split.map(&:to_i);
b=a.inject(:+)
for x in 0..2
if b==a[x]*2
puts "Yes"
exit
end
end
puts "No"
|
[
"call.add"
] | 1,481,878
| 1,481,879
|
u411903982
|
ruby
|
p03943
|
a,b,c=gets.split.map &:hex;puts a==b+c||b==c+a||c ==a+b ?:Yes: :No
|
a,b,c=gets.split.map &:to_i;puts a==b+c||b==c+a||c ==a+b ?:Yes: :No
|
[
"assignment.value.change",
"call.arguments.change"
] | 1,481,953
| 1,481,954
|
u598016178
|
ruby
|
p03943
|
a,b,c=gets.split.sort.map &:to_i;puts a+b==c ?"Yes":"No"
|
a,b,c=gets.split.map(&:to_i).sort;puts a+b==c ?"Yes":"No"
|
[
"call.remove",
"call.arguments.change",
"call.add"
] | 1,482,089
| 1,482,090
|
u578697635
|
ruby
|
p03943
|
a, b, c = gets.split.map(&:to_i)
result = [
[a, (b + c)],
[a, (b - c).abs],
[b, (a + c)],
[b, (a - c).abs],
[c, (a + b)],
[c, (a - b).abs],
].any? { |o, t| o == t }
puts(result ? 'YES' : 'NO')
|
a, b, c = gets.split.map(&:to_i)
result = [
[a, (b + c)],
[a, (b - c).abs],
[b, (a + c)],
[b, (a - c).abs],
[c, (a + b)],
[c, (a - b).abs]
].any? { |o, t| o == t }
puts(result ? 'Yes' : 'No')
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,482,177
| 1,482,178
|
u083707708
|
ruby
|
p03943
|
c = gets.split.map(&:to_i)
3.times do
c.rotate!
if c[0] + c[1] == c[2]
puts "YES"
exit
end
end
puts "NO"
|
c = gets.split.map(&:to_i)
3.times do
c.rotate!
if c[0] + c[1] == c[2]
puts "Yes"
exit
end
end
puts "No"
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 1,482,179
| 1,482,180
|
u736611421
|
ruby
|
p03943
|
a = gets.chomp.split(" ").map(&:to_i).sort
if a[0] + a[1] == a[2]
puts "YES"
else
puts "NO"
end
|
a = gets.chomp.split(" ").map(&:to_i).sort
if a[0] + a[1] == a[2]
puts "Yes"
else
puts "No"
end
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,482,183
| 1,482,184
|
u506255180
|
ruby
|
p03944
|
W,H,n = gets.split.map(&:to_i)
dp = [nil, 0, W, 0, H]
n.times do
x,y,a = gets.split.map(&:to_i)
dp[1] = x if x > dp[1] && a == 1
dp[2] = x if x < dp[2] && a == 2
dp[3] = y if x > dp[3] && a == 3
dp[4] = y if x < dp[4] && a == 4
end
puts [dp[2] - dp[1], 0].max * [dp[4] - dp[3], 0].max
|
W,H,n = gets.split.map(&:to_i)
dp = [nil, 0, W, 0, H]
n.times do
x,y,a = gets.split.map(&:to_i)
dp[1] = x if x > dp[1] && a == 1
dp[2] = x if x < dp[2] && a == 2
dp[3] = y if y > dp[3] && a == 3
dp[4] = y if y < dp[4] && a == 4
end
puts [dp[2] - dp[1], 0].max * [dp[4] - dp[3], 0].max
|
[
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,483,135
| 1,483,136
|
u627981707
|
ruby
|
p03945
|
puts gets.chomp.squeeze - 1
|
p gets.chop.squeeze.size-1
|
[
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change",
"call.add"
] | 1,483,380
| 1,483,381
|
u979552932
|
ruby
|
p03945
|
puts gets.chomp.squeeze - 1
|
puts gets.chomp.squeeze.size - 1
|
[
"call.add"
] | 1,483,380
| 1,483,382
|
u979552932
|
ruby
|
p03943
|
a,b,c=gets.split.map(&:to_i).sort;puts (a+b==c)?"Yes":"NO"
|
a,b,c=gets.split.map(&:to_i).sort;puts (a+b==c)?"Yes":"No"
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,483,643
| 1,483,644
|
u017744950
|
ruby
|
p03945
|
S = gets.chomp
ans = 0
(S.length).times { |i| ans += 1 if S[i] != S[i+1] }
puts ans
|
S = gets.chomp
ans = 0
(S.length-1).times { |i| ans += 1 if S[i] != S[i+1] }
puts ans
|
[
"expression.operation.binary.add"
] | 1,484,065
| 1,484,066
|
u693378622
|
ruby
|
p03945
|
S = gets.chomp
a = ""
ans = 0
S.times do |c|
if a.empty?
a = c
end
if a != c
a = c
ans += 1
end
end
puts ans
|
S = gets.chomp
a = ""
ans = 0
S.chars do |c|
if a.empty?
a = c
end
if a != c
a = c
ans += 1
end
end
puts ans
|
[
"identifier.change"
] | 1,484,101
| 1,484,102
|
u081980084
|
ruby
|
p03945
|
s = gets.chomp
step = 0
char = nil
for i in 0...s.size
puts s[i]
char = s[i] if char.nil?
if char != s[i]
char = s[i]
step += 1
end
end
puts step
|
s = gets.chomp
step = 0
char = nil
for i in 0...s.size
char = s[i] if char.nil?
if char != s[i]
char = s[i]
step += 1
end
end
puts step
|
[
"call.remove"
] | 1,484,108
| 1,484,109
|
u984502432
|
ruby
|
p03945
|
s = gets.chomp
step = 0
char = nil
for i in 0...s.size
puts s[i]
char = s[i] if char.nil?
if char != s[i]
char = s[i]
step += 1
end
end
puts step
|
s = gets.chomp
step = 0
char = nil
for i in 0...s.size
char = s[i] if char.nil?
if char != s[i]
char = s[i]
step += 1
end
end
puts step
|
[
"call.remove"
] | 1,484,110
| 1,484,109
|
u984502432
|
ruby
|
p03945
|
s = gets.split
puts s.squeeze.length-1
|
s = gets.chomp
puts s.squeeze.length-1
|
[
"assignment.value.change",
"identifier.change"
] | 1,484,117
| 1,484,118
|
u243107999
|
ruby
|
p03951
|
n=gets.to_i
s=gets.chomp.codepoints
t=gets.chomp.codepoints
n.times do |i|
if (s[i..-1]==t[0..n-i-1])
puts n+i
exit
end
end
|
n=gets.to_i
s=gets.chomp.codepoints
t=gets.chomp.codepoints
n.times do |i|
if (s[i..-1]==t[0..n-i-1])
puts n+i
exit
end
end
puts 2*n
|
[
"call.add"
] | 1,485,025
| 1,485,026
|
u926099741
|
ruby
|
p03951
|
a = gets.chomp.to_i
b = gets.chomp
c = gets.chomp
count = a*2
ans = 0
a.times do |i|
if(b[(-1-i)..-1] == c[0..i])
ans = count - (i + 1)
end
end
puts ans
|
a = gets.chomp.to_i
b = gets.chomp
c = gets.chomp
count = a*2
ans = a*2
a.times do |i|
if(b[(-1-i)..-1] == c[0..i])
ans = count - (i + 1)
end
end
puts ans
|
[
"assignment.value.change",
"identifier.replace.add",
"literal.replace.remove"
] | 1,485,320
| 1,485,321
|
u145123922
|
ruby
|
p03957
|
s = gets
puts (s.include?("C") && s.include?("F")) && s.index("C") < s.index("F")? :Yes : :No
|
s = gets
puts (s.include?("C") && s.include?("F")) && s.index("C") < s.rindex("F")? :Yes : :No
|
[
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,487,288
| 1,487,289
|
u091810847
|
ruby
|
p03957
|
puts gets.chomp=~/.*C.*F.*/ ? "YES" : "NO"
|
puts gets.chomp=~/.*C.*F.*/ ? "Yes" : "No"
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,487,601
| 1,487,602
|
u079330987
|
ruby
|
p03957
|
s = gets
puts s.index('C') && s.rindex('F') && s.index('C') < s.rindex('F') && 'YES' || 'NO'
|
s = gets
puts s.index('C') && s.rindex('F') && s.index('C') < s.rindex('F') && 'Yes' || 'No'
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 1,487,624
| 1,487,625
|
u312770600
|
ruby
|
p03957
|
str=gets.chomp
if /.*C.*F/=~str
puts "YES"
else
puts "NO"
end
|
str=gets.chomp
if /.*C.*F/=~str
puts "Yes"
else
puts "No"
end
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,487,770
| 1,487,771
|
u576176110
|
ruby
|
p03962
|
a=gets.split.map(&:to_i)
puts a.uniq!.length
|
a=gets.split.map(&:to_i)
puts a.uniq.length
|
[
"identifier.change",
"call.arguments.change"
] | 1,489,303
| 1,489,304
|
u585819925
|
ruby
|
p03962
|
colors = gets.chomp.split(" ").map(&:to_i)
puts colors.uniq
|
colors = gets.chomp.split(" ").map(&:to_i)
puts colors.uniq.length
|
[
"call.add"
] | 1,489,582
| 1,489,583
|
u653737129
|
ruby
|
p03962
|
puts gets.split(" ").uniq!.length
|
puts gets.split(" ").uniq.length
|
[
"identifier.change",
"call.arguments.change"
] | 1,489,916
| 1,489,917
|
u441320643
|
ruby
|
p03962
|
puts(gets.chomp.split(" ").size)
|
puts(gets.chomp.split(" ").uniq.size)
|
[
"call.add"
] | 1,490,260
| 1,490,261
|
u970198083
|
ruby
|
p03963
|
N, K = gets.split.map(&:to_i)
p K*((N-1)**(K-1))
|
N, K = gets.split.map(&:to_i)
p K*((K-1)**(N-1))
|
[
"call.arguments.change",
"expression.operation.binary.change"
] | 1,490,336
| 1,490,337
|
u693378622
|
ruby
|
p03963
|
N, K = gets.split.map(&:to_i)
p N==1? K : K*((N-1)**(K-1))
|
N, K = gets.split.map(&:to_i)
p N==1? K : K*((K-1)**(N-1))
|
[
"call.arguments.change",
"expression.operation.binary.change"
] | 1,490,338
| 1,490,339
|
u693378622
|
ruby
|
p03963
|
n,k=gets.split.map &:to_i
p k*(k-1)**n-1
|
n,k=gets.split.map &:to_i
p k*(k-1)**(n-1)
|
[
"call.arguments.change"
] | 1,490,386
| 1,490,387
|
u264508862
|
ruby
|
p03963
|
k, n = gets.chomp.split.map(&:to_i)
p k*((k-1)**(n-1))
|
n, k = gets.chomp.split.map(&:to_i)
p k*((k-1)**(n-1))
|
[] | 1,490,451
| 1,490,452
|
u147126921
|
ruby
|
p03963
|
a,b=gets.chomp.split.map(&:to_i)
c=b
a-1.times{
c*=b-1
}
puts c
|
a,b = gets.chomp.split.map(&:to_i)
c=b
(a-1).times{ c*=b-1 }
puts c
|
[] | 1,490,492
| 1,490,493
|
u585819925
|
ruby
|
p03962
|
p $<.map{|s| s.split(" ").uniq.length}
|
$<.map{|s|p s.split(" ").uniq.length}
|
[
"io.output.change",
"call.remove",
"call.add"
] | 1,490,701
| 1,490,702
|
u599406741
|
ruby
|
p03964
|
n = gets.to_i
t, a = [1, 1]
n.times do
rT, rA = gets.split.map(&:to_i)
tT = (t % rT == 0 ? 0 : 1) + t / rT
tA = (a % rA == 0 ? 0 : 1) + a / rA
r = [rT, rA].max
t, a = rT * r, rA * r
end
puts (t + a).to_i
|
n = gets.to_i
t, a = [1, 1]
n.times do
rT, rA = gets.split.map(&:to_i)
tT = (t % rT == 0 ? 0 : 1) + t / rT
tA = (a % rA == 0 ? 0 : 1) + a / rA
r = [tT, tA].max
t, a = rT * r, rA * r
end
puts (t + a).to_i
|
[
"assignment.value.change",
"identifier.change"
] | 1,491,384
| 1,491,385
|
u785521224
|
ruby
|
p03964
|
n = gets.to_i
t, a = [1, 1]
n.times do
rT, rA = gets.split.map(&:to_i)
tT = (t % rt == 0 ? 0 : 1) + t / rT
tA = (a % rA == 0 ? 0 : 1) + a / rA
r = [rT, rA].max
t, a = rT * r, rA * r
end
puts (t + a).to_i
|
n = gets.to_i
t, a = [1, 1]
n.times do
rT, rA = gets.split.map(&:to_i)
tT = (t % rT == 0 ? 0 : 1) + t / rT
tA = (a % rA == 0 ? 0 : 1) + a / rA
r = [tT, tA].max
t, a = rT * r, rA * r
end
puts (t + a).to_i
|
[
"assignment.value.change",
"identifier.change",
"control_flow.branch.if.condition.change"
] | 1,491,386
| 1,491,385
|
u785521224
|
ruby
|
p03964
|
n=gets.to_i
a,b=gets.split.map &:to_i
for i in 2..n
c,d=gets.split.map &:to_i
s=[(a+c-1)/c,(b+d-1)/d].max
a=c*s,b=d*s
end
p a+b
|
n=gets.to_i
a,b=gets.split.map &:to_i
for i in 2..n
c,d=gets.split.map &:to_i
s=[(a+c-1)/c,(b+d-1)/d].max
a=c*s
b=d*s
end
p a+b
|
[
"call.arguments.change"
] | 1,491,625
| 1,491,626
|
u459746049
|
ruby
|
p03964
|
n=gets.to_i
a,b=gets. split.map &:to_i
for i in 2..n
c,d=gets. split.map &:to_i
s=[(a+c-1)/c,(b+d-1)/d].max
a=c*s,b=d*s
end
p a+b
|
n=gets.to_i
a,b=gets.split.map &:to_i
for i in 2..n
c,d=gets.split.map &:to_i
s=[(a+c-1)/c,(b+d-1)/d].max
a=c*s
b=d*s
end
p a+b
|
[
"call.arguments.change"
] | 1,491,627
| 1,491,626
|
u459746049
|
ruby
|
p03964
|
n=gets.to_i
a,b=gets. split.map &to_i
for i in 2..n
c,d=gets. split.map &to_i
s=[(a+c-1)/c,(b+d-1)/d].max
a=c*s,b=d*s
end
p a+b
|
n=gets.to_i
a,b=gets.split.map &:to_i
for i in 2..n
c,d=gets.split.map &:to_i
s=[(a+c-1)/c,(b+d-1)/d].max
a=c*s
b=d*s
end
p a+b
|
[
"assignment.value.change",
"call.arguments.change"
] | 1,491,628
| 1,491,626
|
u459746049
|
ruby
|
p03965
|
str = gets.chomp
(str.count("g")-str.count("p"))/2
|
str = gets.chomp
puts (str.count("g")-str.count("p"))/2
|
[
"io.output.change",
"call.add"
] | 1,491,669
| 1,491,670
|
u591480374
|
ruby
|
p03965
|
str = gets
puts str.count("g")-str.count("p")
|
str = gets.chomp
puts (str.count("g")-str.count("p"))/2
|
[
"call.add",
"call.arguments.change"
] | 1,491,671
| 1,491,670
|
u591480374
|
ruby
|
p03965
|
s = gets()
puts(s.length() / 2 - s.count('p'))
|
s = gets().chomp()
puts(s.length() / 2 - s.count('p'))
|
[
"call.add"
] | 1,491,676
| 1,491,677
|
u420267469
|
ruby
|
p03963
|
n, k = gets.split(" ").map {|s| s.to_i }
r = k
(n-1).times {
r = r * (k-1)
}
r = [r, 2**31-1].min
|
n,k = gets.split(" ").map {|s| s.to_i }
r = k
(n-1).times {
r = r * (k-1)
}
r = [r, 2**31-1].min
puts r
|
[
"call.add"
] | 1,491,726
| 1,491,727
|
u463614488
|
ruby
|
p03963
|
a,b=gets.split.map &:to_i
p a*(a-1)**(b-1)
|
b,a=gets.split.map &:to_i
p a*(a-1)**(b-1)
|
[] | 1,491,777
| 1,491,778
|
u459746049
|
ruby
|
p03967
|
hands = gets.chars
puts hands.length / 2 - hands.count('p')
|
hands = gets.chomp
puts hands.length / 2 - hands.count('p')
|
[
"assignment.value.change",
"identifier.change"
] | 1,492,189
| 1,492,190
|
u604352408
|
ruby
|
p03967
|
hands = gets.chop.chars
puts hands.length / 2 - hands.chars.count('p')
|
hands = gets.chomp
puts hands.length / 2 - hands.count('p')
|
[
"assignment.value.change",
"identifier.change",
"call.remove"
] | 1,492,191
| 1,492,190
|
u604352408
|
ruby
|
p03967
|
hands = gets.chars
puts hands.length / 2 - hands.count('p')
|
hands = gets.chop.chars
puts hands.length / 2 - hands.count('p')
|
[
"call.add"
] | 1,492,189
| 1,492,192
|
u604352408
|
ruby
|
p03967
|
hands = gets.chop.chars
puts hands.length / 2 - hands.chars.count('p')
|
hands = gets.chop.chars
puts hands.length / 2 - hands.count('p')
|
[
"call.remove"
] | 1,492,191
| 1,492,192
|
u604352408
|
ruby
|
p03970
|
S = "C0DEFESTIVAL2O16"
T = gets.chomp
p (0...S.size).count{ |i| S[i] != T[i] }
|
S = "CODEFESTIVAL2016"
T = gets.chomp
p (0...S.size).count{ |i| S[i] != T[i] }
|
[
"literal.string.change",
"assignment.value.change"
] | 1,492,425
| 1,492,426
|
u670503797
|
ruby
|
p03970
|
puts gets.chars.zip("CODEFESTIVAL2016".chars).count{|i,j|i!=j}
|
puts gets.chomp.chars.zip("CODEFESTIVAL2016".chars).count{|i,j|i!=j}
|
[
"call.add"
] | 1,492,455
| 1,492,456
|
u264508862
|
ruby
|
p03970
|
gets.chomp.chars.zip('CODEFESTIVAL2016'.chars).count{|x,y|x!=y}
|
p gets.chomp.chars.zip('CODEFESTIVAL2016'.chars).count{|x,y|x!=y}
|
[
"io.output.change",
"call.add"
] | 1,492,585
| 1,492,586
|
u280667879
|
ruby
|
p03971
|
n,a,b=gets.split.map(&:to_i)
s=gets.chomp
ab=a+b
n.times do |i|
if s[i] == "a"
if ab>0
puts "Yes"
ab-=1
else
puts "No"
end
elsif s[i] == "b"
if b>0
puts "Yes"
b-=1
ab-=1
else
puts "No"
end
else
puts "No"
end
end
|
n,a,b=gets.split.map(&:to_i)
s=gets.chomp
ab=a+b
n.times do |i|
if s[i] == "a"
if ab>0
puts "Yes"
ab-=1
else
puts "No"
end
elsif s[i] == "b"
if b>0 && ab>0
puts "Yes"
b-=1
ab-=1
else
puts "No"
end
else
puts "No"
end
end
|
[
"control_flow.branch.if.condition.change"
] | 1,493,176
| 1,493,177
|
u744908753
|
ruby
|
p03971
|
a_count = 0
b_count = 0
N,A,B =gets.chomp.split(' ').map{|n| n.to_i}
S = gets.chop
for num in 0..N-1 do
if S[num] == 'a' && (a_count + b_count) < A + B
puts "YES"
a_count += 1
elsif S[num] == 'b' && (a_count + b_count) < A + B && b_count < B
puts "YES"
b_count += 1
else
puts"NO"
end
end
|
a_count = 0
b_count = 0
N,A,B =gets.chomp.split(' ').map{|n| n.to_i}
S = gets.chop
for num in 0..N-1 do
if S[num] == 'a' && (a_count + b_count) < A + B
puts "Yes"
a_count += 1
elsif S[num] == 'b' && (a_count + b_count) < A + B && b_count < B
puts "Yes"
b_count += 1
else
puts"No"
end
end
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change"
] | 1,493,366
| 1,493,367
|
u999449420
|
ruby
|
p03971
|
n, a, b = gets.split.map(&:to_i)
sa, sb = 0, 0
s = gets.chomp.split(//)
n.times do |i|
if s[i] == 'a'
if sa + sb < a + b
sa += 1
puts 'YES'
else
puts 'NO'
end
elsif s[i] == 'b'
if sa + sb < a + b && sb < b
sb += 1
puts 'YES'
else
puts 'NO'
end
else
puts 'NO'
end
end
|
n, a, b = gets.split.map(&:to_i)
sa, sb = 0, 0
s = gets.chomp.split(//)
n.times do |i|
if s[i] == 'a'
if sa + sb < a + b
sa += 1
puts 'Yes'
else
puts 'No'
end
elsif s[i] == 'b'
if sa + sb < a + b && sb < b
sb += 1
puts 'Yes'
else
puts 'No'
end
else
puts 'No'
end
end
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 1,493,409
| 1,493,410
|
u074147690
|
ruby
|
p03971
|
n, a, b = gets.split.map(&:to_i)
na = 0
nb = 0
gets.each_char{|c|
if case c
when "a"
if na + nb < a + b
na += 1
true
else false end
when "b"
if na + nb < a + b && nb < b
nb += 1
true
else false end
else
false
end then
puts "Yes"
else
puts "No"
end
}
|
n, a, b = gets.split.map(&:to_i)
na = 0
nb = 0
gets.chomp.each_char{|c|
if case c
when "a"
if na + nb < a + b
na += 1
true
else false end
when "b"
if na + nb < a + b && nb < b
nb += 1
true
else false end
else
false
end then
puts "Yes"
else
puts "No"
end
}
|
[
"call.add"
] | 1,493,485
| 1,493,486
|
u520404466
|
ruby
|
p03973
|
n = gets.to_i
a = n.times.map { gets.to_i }
sum = 0
maxa = 0
n.times do |i|
if i.zero?
sum = a[0].pred
a[0] = 1
else
if a[i] <= maxa.succ
else
t = a[i] / maxa.succ
f = a[i] % maxa.succ
if f.zero?
a[i] = maxa.succ
sum += t.pred
else
a[i] = f
sum += t
end
end
end
maxa = [a[i], maxa].max
end
p sum
|
n = gets.to_i
a = n.times.map { gets.to_i }
sum = 0
maxa = 0
n.times do |i|
if i.zero?
sum = a[0].pred
a[0] = 1
else
if a[i] <= maxa.succ
else
t = a[i] / maxa.succ
f = a[i] % maxa.succ
if f.zero?
a[i] = 1
sum += t.pred
else
a[i] = f
sum += t
end
end
end
maxa = [a[i], maxa].max
end
p sum
|
[
"assignment.value.change",
"identifier.replace.remove",
"literal.replace.add",
"call.remove"
] | 1,494,098
| 1,494,099
|
u074147690
|
ruby
|
p03975
|
N,A,B = gets.split.map(&:to_i)
count = 0
N.times do
t = gets.to_i
if t<A||B<=t
t+=1
end
end
puts count
|
N,A,B = gets.split.map(&:to_i)
count = 0
N.times do
t = gets.to_i
if t<A||B<=t
count+=1
end
end
puts count
|
[
"identifier.change"
] | 1,494,248
| 1,494,249
|
u607327241
|
ruby
|
p03975
|
N,A,B = gets.split.map(&:to_i)
count = 0
N.times do
t = gets.to_i
if t<A&&B<=t
t+=1
end
end
puts count
|
N,A,B = gets.split.map(&:to_i)
count = 0
N.times do
t = gets.to_i
if t<A||B<=t
count+=1
end
end
puts count
|
[
"misc.opposites",
"control_flow.branch.if.condition.change",
"identifier.change"
] | 1,494,250
| 1,494,249
|
u607327241
|
ruby
|
p03971
|
n,a,b = gets.strip.split(' ').map(&:to_i)
str = gets.strip
cj = 0
co = 0
str.each_char do |c|
if c.eql? 'a'
if cj + co + 1 <= a+b
cj+=1
puts "YES"
else
puts "NO"
end
elsif c.eql? 'b'
if cj + co + 1 <= a+b and co + 1 <= b
co+=1
puts "YES"
else
puts "NO"
end
else
puts "NO"
end
end
|
n,a,b = gets.strip.split(' ').map(&:to_i)
str = gets.strip
cj = 0
co = 0
str.each_char do |c|
if c.eql? 'a'
if cj + co + 1 <= a+b
cj+=1
puts "Yes"
else
puts "No"
end
elsif c.eql? 'b'
if cj + co + 1 <= a+b and co + 1 <= b
co+=1
puts "Yes"
else
puts "No"
end
else
puts "No"
end
end
|
[
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 1,494,524
| 1,494,525
|
u494610174
|
ruby
|
p03986
|
c=0
cc=0
gets.chars.map{|i|
if i==?S
c+=1
else
if c==0
cc+=1
else
c-=1
end
end
}
puts c+cc
|
c=0
cc=0
gets.chomp.chars.map{|i|
if i==?S
c+=1
else
if c==0
cc+=1
else
c-=1
end
end
}
p c+cc
|
[
"call.add",
"identifier.change"
] | 1,494,968
| 1,494,969
|
u554838392
|
ruby
|
p03986
|
c=0
cc=0
gets.chars.map{|i|
if i==?S
c+=1
else
if c==0
cc+=1
else
c-=1
end
end
}
p c+cc
|
c=0
cc=0
gets.chomp.chars.map{|i|
if i==?S
c+=1
else
if c==0
cc+=1
else
c-=1
end
end
}
p c+cc
|
[
"call.add"
] | 1,494,970
| 1,494,969
|
u554838392
|
ruby
|
p03992
|
s=gets
puts s[0..4]+" "+s[5..11]
|
s=gets
puts s[0..3]+" "+s[4..11]
|
[
"literal.number.integer.change",
"variable_access.subscript.index.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 1,496,284
| 1,496,285
|
u408023666
|
ruby
|
p03992
|
s = gets.chomp
puts (s[0...4] + ' ' + [4..-1])
|
s = gets.chomp
puts (s[0...4] + ' ' + s[4..-1])
|
[
"call.arguments.change"
] | 1,496,409
| 1,496,410
|
u976045235
|
ruby
|
p03994
|
s=gets.chomp
k=gets.to_i
zord="z".ord
ret=""
s.each_char do |c|
need=zord-c.ord+1
if k >= need
ret+="a"
k-=need
else
ret+=c
end
end
ret[-1]=(ret[-1].ord + k%26).chr
puts ret
|
s=gets.chomp
k=gets.to_i
zord="z".ord
ret=""
s.each_char do |c|
need=(zord-c.ord+1)%26
if k >= need
ret+="a"
k-=need
else
ret+=c
end
end
ret[-1]=(ret[-1].ord + k%26).chr
puts ret
|
[
"assignment.change"
] | 1,498,053
| 1,498,054
|
u058568575
|
ruby
|
p03994
|
s=gets.chomp
k=gets.to_i
zord="z".ord
ret=[]
s.each_char do |c|
need=(zord-c.ord+1)%26
break if k==0
if k >= need
ret.push("a")
k-=need
else
ret.push(c)
end
end
ret[-1]=(ret[-1].ord + k%26).chr
puts ret.join
|
s=gets.chomp
k=gets.to_i
zord="z".ord
ret=[]
s.each_char do |c|
need=(zord-c.ord+1)%26
if k >= need
ret.push("a")
k-=need
else
ret.push(c)
end
end
ret[-1]=(ret[-1].ord + k%26).chr
puts ret.join
|
[] | 1,498,055
| 1,498,056
|
u058568575
|
ruby
|
p03994
|
def conv(s)
s.chars.map{ |c| c.ord - ?a.ord }
end
def solve(s,k)
a = conv(s)
n = a.size
(n-1).times do |i|
next if a[i] + k < 26
next if a[i] == 0
k -= 26 - a[i]
a[i] = 0
p [i,k]
end
a[-1] = (a[-1] + k) % 26
return a.map{ |c| (c + ?a.ord).chr }.join
end
def main
s = gets.chomp
k = gets.to_i
puts solve(s,k)
end
main
|
def conv(s)
s.chars.map{ |c| c.ord - ?a.ord }
end
def solve(s,k)
a = conv(s)
n = a.size
(n-1).times do |i|
next if a[i] + k < 26
next if a[i] == 0
k -= 26 - a[i]
a[i] = 0
end
a[-1] = (a[-1] + k) % 26
return a.map{ |c| (c + ?a.ord).chr }.join
end
def main
s = gets.chomp
k = gets.to_i
puts solve(s,k)
end
main
|
[
"call.remove"
] | 1,498,578
| 1,498,579
|
u106964380
|
ruby
|
p03997
|
a,b,h = gets.strip.map(&:to_i)
#a,b,h = 4,4,4
def area(a,b,h)
(a+b) * h / 2
end
puts area(a,b,h)
|
a, b, h = 3.times.map{gets.to_i}
def area (a,b,h)
(a+b)*h/2
end
puts area(a,b,h)
|
[
"assignment.value.change",
"identifier.replace.remove",
"literal.replace.add",
"identifier.change"
] | 1,498,934
| 1,498,935
|
u896269838
|
ruby
|
p03997
|
a = gets.to_i
b = gets.to_i
c = gets.to_i
puts "#{(a+b)*2/2}"
|
a = gets.to_i
b = gets.to_i
c = gets.to_i
puts "#{(a+b)*c/2}"
|
[
"literal.string.change",
"call.arguments.change"
] | 1,499,358
| 1,499,359
|
u542313027
|
ruby
|
p03997
|
# 上底の長さが a 、下底の長さが b 、高さが h の台形があります。
# この台形の面積を求めてください。
# 情報を取得
a = gets.to_i
b = gets.to_i
h = gets.to_i
# 計算し、結果を出力
puts ((a + b) / h) / 2
|
# 上底の長さが a 、下底の長さが b 、高さが h の台形があります。
# この台形の面積を求めてください。
# 情報を取得
a = gets.to_i
b = gets.to_i
h = gets.to_i
# 計算し、結果を出力
puts ((a + b) * h) / 2
|
[
"expression.operator.arithmetic.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 1,499,369
| 1,499,370
|
u139850627
|
ruby
|
p03997
|
a = gets.chomp.to_i
b = gets.chomp.to_i
h = gets.chomp.to_i
puts (a+b)*2/h
|
a = gets.chomp.to_i
b = gets.chomp.to_i
h = gets.chomp.to_i
puts (a+b)*h/2
|
[
"expression.operation.binary.remove"
] | 1,500,085
| 1,500,086
|
u326891688
|
ruby
|
p03997
|
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 bit(n) n.to_s(2).split("").map(&:to_i) end
def inp() a=gets.chomp.split(" ").map(&:to_i)end
a=`dd`.split().map(&:to_i)
puts (a[0]+a[1])*a[2]/2.0
|
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 bit(n) n.to_s(2).split("").map(&:to_i) end
def inp() a=gets.chomp.split(" ").map(&:to_i)end
a=`dd`.split().map(&:to_i)
puts (a[0]+a[1])*a[2]/2
|
[
"call.arguments.change",
"expression.operation.binary.change"
] | 1,500,381
| 1,500,382
|
u145123922
|
ruby
|
p03997
|
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 bit(n) n.to_s(2).split("").map(&:to_i) end
def inp() a=gets.chomp.split(" ").map(&:to_i)end
a=`dd`.split().map(&:to_i)
puts (a[0]+a[1])/2*a[2]
|
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 bit(n) n.to_s(2).split("").map(&:to_i) end
def inp() a=gets.chomp.split(" ").map(&:to_i)end
a=`dd`.split().map(&:to_i)
puts (a[0]+a[1])*a[2]/2
|
[
"expression.operation.binary.remove"
] | 1,500,383
| 1,500,382
|
u145123922
|
ruby
|
p03997
|
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 bit(n) n.to_s(2).split("").map(&:to_i) end
def inp() a=gets.chomp.split(" ").map(&:to_i)end
a='dd'.split().map(&:to_i)
puts (a[0]+a[1])/2*a[2]
|
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 bit(n) n.to_s(2).split("").map(&:to_i) end
def inp() a=gets.chomp.split(" ").map(&:to_i)end
a=`dd`.split().map(&:to_i)
puts (a[0]+a[1])*a[2]/2
|
[
"assignment.value.change",
"expression.operation.binary.remove"
] | 1,500,384
| 1,500,382
|
u145123922
|
ruby
|
p03997
|
p (gets.hex+gets.hex)*gets.to_i/2
|
p (gets.to_i+gets.to_i)*gets.to_i/2
|
[
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 1,500,513
| 1,500,514
|
u598016178
|
ruby
|
p03997
|
a = gets.to_i
b = gets.to_i
h = gets.to_i
print (a+b)*h/h
|
a = gets.to_i
b = gets.to_i
h = gets.to_i
puts (a+b)*h/2
|
[
"identifier.change",
"identifier.replace.remove",
"literal.replace.add",
"call.arguments.change",
"expression.operation.binary.change"
] | 1,500,558
| 1,500,557
|
u012179538
|
ruby
|
p03997
|
a=gets.to_i
b=gets.to_i
c=gets.to_i
p (a+b)*h/2
|
a=gets.to_i
b=gets.to_i
h=gets.to_i
p (a+b)*h/2
|
[
"assignment.variable.change",
"identifier.change"
] | 1,500,631
| 1,500,632
|
u459746049
|
ruby
|
p03998
|
alp = ['a', 'b', 'c']
a = Array.new(3) do
gets.split('').map do |v|
alp.index(v)
end
end
turn = 0
while true do
next_turn = a[turn].shift
if a[turn].length == 0 then
break
end
turn = next_turn
end
puts alp[turn]
|
alp = ['a', 'b', 'c']
a = Array.new(3) do
gets.split('').map do |v|
alp.index(v)
end
end
turn = 0
while true do
next_turn = a[turn].shift
if a[turn].length == 0 then
break
end
turn = next_turn
end
puts alp[turn].upcase
|
[
"call.add"
] | 1,500,775
| 1,500,776
|
u990758634
|
ruby
|
p03998
|
A = STDIN.gets.chomp.split('')
B = STDIN.gets.chomp.split('')
C = STDIN.gets.chomp.split('')
shifted = A.shift
while true do
p shifted
if shifted == 'a'
if A.size == 0
puts 'A'
break
end
shifted = A.shift
elsif shifted == 'b'
if B.size == 0
puts 'B'
break
end
shifted = B.shift
elsif shifted == 'c'
if C.size == 0
puts 'C'
break
end
shifted = C.shift
end
end
|
A = STDIN.gets.chomp.split('')
B = STDIN.gets.chomp.split('')
C = STDIN.gets.chomp.split('')
shifted = A.shift
while true do
if shifted == 'a'
if A.size == 0
puts 'A'
break
end
shifted = A.shift
elsif shifted == 'b'
if B.size == 0
puts 'B'
break
end
shifted = B.shift
elsif shifted == 'c'
if C.size == 0
puts 'C'
break
end
shifted = C.shift
end
end
|
[
"call.remove"
] | 1,501,159
| 1,501,160
|
u853554960
|
ruby
|
p03998
|
A = STDIN.gets.chomp.split('')
B = STDIN.gets.chomp.split('')
C = STDIN.gets.chomp.split('')
shifted = A.shift
while true do
if shifted == 'a'
if A.size == 0
puts 'A'
break
end
shifted = A.shift
elsif shifted == 'b'
if B.size == 0
puts 'B'
break
end
shifted = B.shift
elsif shifted == 'c'
if C.size
puts 'C'
break
end
shifted = C.shift
end
end
|
A = STDIN.gets.chomp.split('')
B = STDIN.gets.chomp.split('')
C = STDIN.gets.chomp.split('')
shifted = A.shift
while true do
if shifted == 'a'
if A.size == 0
puts 'A'
break
end
shifted = A.shift
elsif shifted == 'b'
if B.size == 0
puts 'B'
break
end
shifted = B.shift
elsif shifted == 'c'
if C.size == 0
puts 'C'
break
end
shifted = C.shift
end
end
|
[
"control_flow.branch.if.condition.change"
] | 1,501,161
| 1,501,160
|
u853554960
|
ruby
|
p03998
|
as=Array.new(3){Array.new}
as[0]=gets.chomp.codepoints.map{|e|e-"a".ord}
as[1]=gets.chomp.codepoints.map{|e|e-"a".ord}
as[2]=gets.chomp.codepoints.map{|e|e-"a".ord}
turn=0
while true
num=as[turn].shift
break if as[turn].empty?
turn=num
end
puts (turn+"a".ord).chr.upcase
|
as=Array.new(3){Array.new}
as[0]=gets.chomp.codepoints.map{|e|e-"a".ord}
as[1]=gets.chomp.codepoints.map{|e|e-"a".ord}
as[2]=gets.chomp.codepoints.map{|e|e-"a".ord}
turn=0
while true
num=as[turn].shift
turn=num
break if as[turn].empty?
end
puts (turn+"a".ord).chr.upcase
|
[
"assignment.add",
"assignment.remove"
] | 1,501,200
| 1,501,201
|
u926099741
|
ruby
|
p03998
|
g = Hash[["A","B","C"].map{ |a| [a, gets.chomp.upcase.split("")] }]
hand = "A"
while g[hand].size > 0
hand = g[hand].pop
end
puts hand
|
g = Hash[["A","B","C"].map{ |a| [a, gets.chomp.upcase.split("")] }]
hand = "A"
while g[hand].size > 0
hand = g[hand].shift
end
puts hand
|
[
"assignment.value.change",
"identifier.change"
] | 1,501,670
| 1,501,671
|
u670503797
|
ruby
|
p03998
|
require 'prime'
include Math
def max(a,b); a > b ? a : b end
def min(a,b); a < b ? a : b end
def swap(a,b); a, b = b, a end
def gif; gets.to_i end
def gff; gets.to_f end
def gsf; gets.chomp end
def gi; gets.split.map(&:to_i) end
def gf; gets.split.map(&:to_f) end
def gs; gets.chomp.split.map(&:to_s) end
def gc; gets.chomp.split('') end
def pr(num); num.prime_division end
def digit(num); num.to_s.length end
def array(s,ini=nil); Array.new(s){ini} end
def darray(s1,s2,ini=nil); Array.new(s1){Array.new(s2){ini}} end
def rep(num); num.times {|i|yield(i)} end
def repl(st,en,n=1); n*= -1 if st>en;st.step(en,n){|i|yield(i)} end
pl = Hash.new
pl['a'] = gc
pl['b'] = gc
pl['c'] = gc
turn = 'a'
loop{
break if pl[turn].empty?
turn = pl[turn].pop
}
puts turn.upcase
|
require 'prime'
include Math
def max(a,b); a > b ? a : b end
def min(a,b); a < b ? a : b end
def swap(a,b); a, b = b, a end
def gif; gets.to_i end
def gff; gets.to_f end
def gsf; gets.chomp end
def gi; gets.split.map(&:to_i) end
def gf; gets.split.map(&:to_f) end
def gs; gets.chomp.split.map(&:to_s) end
def gc; gets.chomp.split('') end
def pr(num); num.prime_division end
def digit(num); num.to_s.length end
def array(s,ini=nil); Array.new(s){ini} end
def darray(s1,s2,ini=nil); Array.new(s1){Array.new(s2){ini}} end
def rep(num); num.times {|i|yield(i)} end
def repl(st,en,n=1); n*= -1 if st>en;st.step(en,n){|i|yield(i)} end
pl = Hash.new
pl['a'] = gc
pl['b'] = gc
pl['c'] = gc
turn = 'a'
loop{
break if pl[turn].empty?
turn = pl[turn].shift
}
puts turn.upcase
|
[
"assignment.value.change",
"identifier.change"
] | 1,501,738
| 1,501,739
|
u988228861
|
ruby
|
p03998
|
cards['a']=gets.chomp.chars.to_a
cards['b']=gets.chomp.chars.to_a
cards['c']=gets.chomp.chars.to_a
turn = 'a'
loop do
break if cards[turn].empty?
turn = cards[turn].shift
end
puts turn.to_s.upcase
|
cards = {}
cards['a']=gets.chomp.chars.to_a
cards['b']=gets.chomp.chars.to_a
cards['c']=gets.chomp.chars.to_a
turn = 'a'
loop do
break if cards[turn].empty?
turn = cards[turn].shift
end
puts turn.to_s.upcase
|
[
"assignment.add"
] | 1,501,745
| 1,501,746
|
u056944756
|
ruby
|
p03998
|
a,b,c = gets.chomp.split(""),gets.chomp.split(""),gets.chomp.split("");second = "a"
loop{
if (eval("#{second}.size") == 0) then
puts second
break
else
old_next = second
eval("second = #{old_next}[0]")
eval("#{old_next}.delete_at(0)")
end
}
|
a,b,c = gets.chomp.split(""),gets.chomp.split(""),gets.chomp.split("");second = "a"
loop{
if (eval("#{second}.size") == 0) then
puts second.upcase
break
else
old_next = second
eval("second = #{old_next}[0]")
eval("#{old_next}.delete_at(0)")
end
}
|
[
"call.add"
] | 1,501,777
| 1,501,778
|
u970198083
|
ruby
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.