Datasets:

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
p03285
CP = 4 DP = 7 N = gets.strip.to_i def dfs(c, d, p) return c + d if p == 0 return 0 if p < 0 res = 0 res += dfs(c + 1, d, p - CP) res += dfs(c, d, p - DP) if res == 0 return res end res = dfs(0, 0, N) puts res > 0 ? 'Yes' : 'No'
CP = 4 DP = 7 N = gets.strip.to_i def dfs(c, d, p) return c + d if p == 0 return 0 if p < 0 res = 0 res += dfs(c + 1, d, p - CP) res += dfs(c, d + 1, p - DP) if res == 0 return res end res = dfs(0, 0, N) puts res > 0 ? 'Yes' : 'No'
[ "expression.operation.binary.add" ]
1,070,452
1,070,453
u707614029
ruby
p03285
n=gets.chomp.to_i res=:No (1..100).each do |i| (1..100).each do |j| if 4 * i + 7 * j == n res = :Yes end end end puts res
n=gets.chomp.to_i res=:No (0..100).each do |i| (0..100).each do |j| if 4 * i + 7 * j == n res = :Yes end end end puts res
[ "literal.number.integer.change" ]
1,070,608
1,070,609
u135201316
ruby
p03285
n = gets.to_i puts (0..25).to_a.product((1..15).to_a).any?{ |a,b| a*4+b*7== n } ? "Yes" : "No"
n = gets.to_i puts (0..25).to_a.product((0..14).to_a).any?{ |a,b| a*4+b*7== n } ? "Yes" : "No"
[ "literal.number.integer.change", "control_flow.branch.if.condition.change" ]
1,070,782
1,070,783
u647522078
ruby
p03285
n = gets.to_i flag = false 15.times do |i| t = n - i * 7 flag = true if t > 0 && t % 4 == 0 end puts flag ? "Yes" : "No"
n = gets.to_i flag = false 15.times do |i| t = n - i * 7 flag = true if t >= 0 && t % 4 == 0 end puts flag ? "Yes" : "No"
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
1,071,228
1,071,229
u123276241
ruby
p03285
n = gets.to_i flag = false 14.times do |i| t = n - i * 7 flag = true if t > 0 && t % 4 == 0 end puts flag ? "Yes" : "No"
n = gets.to_i flag = false 15.times do |i| t = n - i * 7 flag = true if t >= 0 && t % 4 == 0 end puts flag ? "Yes" : "No"
[ "literal.number.integer.change", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
1,071,230
1,071,229
u123276241
ruby
p03284
a, b = gets.split(" ").map(&:to_i) humans = Array.new(b, 0) max = 0 while a > 0 do for i in 0...humans.length do humans[i] += 1 if a > 0 a -=1 end end p humans min = humans[0] humans.each do |item| max = item if item > max min = item if item < min end p (max - min).abs
a, b = gets.split(" ").map(&:to_i) humans = Array.new(b, 0) max = 0 while a > 0 do for i in 0...humans.length do humans[i] += 1 if a > 0 a -=1 end end min = humans[0] humans.each do |item| max = item if item > max min = item if item < min end p (max - min).abs
[ "call.remove" ]
1,071,295
1,071,296
u249327445
ruby
p03285
n = gets.to_i puts (0..25).to_a.zip((0..14).to_a).any?{|a,b|4*a+7*b==n} ? "Yes" : "No"
n = gets.to_i puts (0..25).to_a.product((0..14).to_a).any?{|a,b|4*a+7*b==n} ? "Yes" : "No"
[ "identifier.change", "control_flow.branch.if.condition.change" ]
1,071,373
1,071,374
u467508794
ruby
p03286
n = gets.to_i until n.zero? S << (n.odd? ? 1 : 0) n = -(n >> 1) end S << 0 if S.empty? puts S.reverse.join
n = gets.to_i S = [] until n.zero? S << (n.odd? ? 1 : 0) n = -(n >> 1) end S << 0 if S.empty? puts S.reverse.join
[ "assignment.add" ]
1,072,101
1,072,102
u627981707
ruby
p03286
def to_bin(n) ans = "" divisor = 2 while n != 0 do r = n%divisor if r == 0 ans = "0#{ans}" else ans = "1#{ans}" n -= r end divisor *= -2 end ans end n = gets.to_i puts to_bin(n)
def to_bin(n) ans = "" divisor = 2 while n != 0 do r = n%divisor if r == 0 ans = "0#{ans}" else ans = "1#{ans}" n -= r end divisor *= -2 end ans.to_i end n = gets.to_i puts to_bin(n)
[ "call.add" ]
1,072,176
1,072,177
u468878441
ruby
p03286
n = gets.to_i ans = "" i = 1 while n != 0 if n%2 == 0 ans += "0" else ans += "1" n -= i end n /= 2 i = i == 1 ? -1 : 1 end puts ans.reverse
n = gets.to_i ans = "" i = 1 while n != 0 if n%2 == 0 ans += "0" else ans += "1" n -= i end n /= 2 i = i == 1 ? -1 : 1 end puts ans.reverse.to_i
[ "call.add" ]
1,072,412
1,072,413
u506255180
ruby
p03286
n = gets.to_i ans = "" i = 0 while n != 0 if n%((-2)**(i+1)) == 0 ans += "0" else ans += "1" n -= (-2)**i end i += 1 end puts ans.reverse
n = gets.to_i ans = "" i = 0 while n != 0 if n%((-2)**(i+1)) == 0 ans += "0" else ans += "1" n -= (-2)**i end i += 1 end puts ans.reverse.to_i
[ "call.add" ]
1,072,414
1,072,415
u506255180
ruby
p03286
n = gets.chomp.to_i s = [] while n != 0 if n.even? s << 0 n /= -2 else s << 1 n -= 1 n /= -2 end end if s.empty? puts "0" else s.join("").reverse end
n = gets.chomp.to_i s = [] while n != 0 if n.even? s << 0 n /= -2 else s << 1 n -= 1 n /= -2 end end if s.empty? puts "0" else puts s.join("").reverse end
[ "io.output.change", "call.add" ]
1,072,485
1,072,486
u910756197
ruby
p03286
n = gets.to_i ans = [] if(n > 0) st = n.abs.to_s(2) i = -1 while(-(st.size)<= i) if (st[i]=="0") ans.push(0) else if(i%2 == 1) ans.push(1) else ans.push(1) p st = (st.to_i(2)+2**(i.abs-1)).to_s(2) end end i -= 1 end puts ans.join.reverse else st = n.to_i.abs.to_s(2) i = -1 while(-(st.size)<= i) if (st[i]=="0") ans.push(0) else if(i%2 == 0) ans.push(1) else ans.push(1) st = (st.to_i(2)+2**(i.abs-1)).to_s(2) end end i -= 1 end puts ans.join.reverse end
n = gets.to_i ans = [] if(n > 0) st = n.abs.to_s(2) i = -1 while(-(st.size)<= i) if (st[i]=="0") ans.push(0) else if(i%2 == 1) ans.push(1) else ans.push(1) st = (st.to_i(2)+2**(i.abs-1)).to_s(2) end end i -= 1 end puts ans.join.reverse else st = n.to_i.abs.to_s(2) i = -1 while(-(st.size)<= i) if (st[i]=="0") ans.push(0) else if(i%2 == 0) ans.push(1) else ans.push(1) st = (st.to_i(2)+2**(i.abs-1)).to_s(2) end end i -= 1 end puts ans.join.reverse end
[ "io.output.change", "call.remove" ]
1,072,509
1,072,510
u145123922
ruby
p03285
cake = 4 donuts = 7 money = gets.to_i cakeNum = 0 donutsNum = 0 result = "No" donutsArray = Array.new cakeArray = Array.new (money/ cake + 1).times do cakeArray.push(cake * (cakeNum)) cakeNum += 1 end (money / donuts + 1).times do donutsArray.push(donuts * (donutsNum)) donutsNum += 1 end cakeArray.each do |cakeItem| if cakeItem == money then result = "Yes" end donutsArray.each do |donutsItem| if cakeItem + donutsItem == money || donutsItem == money then resutl = "Yes" end end end puts result
cake = 4 donuts = 7 money = gets.to_i cakeNum = 0 donutsNum = 0 result = "No" donutsArray = Array.new cakeArray = Array.new (money/ cake + 1).times do cakeArray.push(cake * (cakeNum)) cakeNum += 1 end (money / donuts + 1).times do donutsArray.push(donuts * (donutsNum)) donutsNum += 1 end cakeArray.each do |cakeItem| if cakeItem == money then result = "Yes" end donutsArray.each do |donutsItem| if (cakeItem + donutsItem == money) || (donutsItem == money) then result = "Yes" end end end puts result
[ "control_flow.branch.if.condition.change", "assignment.variable.change", "identifier.change" ]
1,072,635
1,072,636
u249327445
ruby
p03285
N = gets.to_i message = 'No' (0..(N/11)).each do |i| if (N-(i*11)) % 4 == 0 message = 'Yes' break end end puts message
N = gets.to_i message = 'No' (0..(N/7)).each do |i| if (N-(i*7)) % 4 == 0 message = 'Yes' break end end puts message
[ "literal.number.integer.change", "expression.operation.binary.change", "control_flow.branch.if.condition.change" ]
1,072,651
1,072,652
u255579447
ruby
p03287
(N, M), As = readlines.map{|l| l.split.map(&:to_i)} puts As.inject([0]){|r, a| r << r.last + a}.group_by{|x| x % M}.values.map(&:size).select{|n| n > 1}.map{|n| n*(n - 1)/2}.inject(:+)
(N, M), As = readlines.map{|l| l.split.map(&:to_i)} puts As.inject([0]){|r, a| r << r.last + a}.group_by{|x| x % M}.values.map(&:size).select{|n| n > 1}.map{|n| n*(n - 1)/2}.inject(:+) || 0
[ "expression.operation.binary.add" ]
1,073,337
1,073,338
u304198114
ruby
p03286
n = gets.to_i ans = "" i = 0 while(n != 0) if n & 1 == 1 ans += '1' n -= (-1) ** i else ans += '0' end n >>= 1 i += 1 end puts n == 0 ? 0 : ans.reverse
n = gets.to_i ans = "" i = 0 while(n != 0) if n & 1 == 1 ans += '1' n -= (-1) ** i else ans += '0' end n >>= 1 i += 1 end puts ans == "" ? 0 : ans.reverse
[ "identifier.change", "control_flow.branch.if.condition.change" ]
1,073,481
1,073,482
u331906013
ruby
p03288
puts gets.to_i<1200?"ABC":$_<2800?"ARC":"AGC"
puts gets.to_i<1200?"ABC":$_.to_i<2800?"ARC":"AGC"
[ "control_flow.branch.if.condition.change", "call.add" ]
1,073,663
1,073,664
u966810027
ruby
p03288
r = gets.to_i if r < 1200 puts "ABC" elsfi 1200 <= r && r < 2800 puts "ARC" else puts "AGC" end
r = gets.to_i if r < 1200 puts "ABC" elsif 1200 <= r && r < 2800 puts "ARC" else puts "AGC" end
[]
1,073,676
1,073,677
u313103408
ruby
p03288
r = gets.to_i if r <= 1200 puts 'ABC' elsif r <= 2800 puts 'ARC' else puts 'AGC' end
r = gets.to_i if r < 1200 puts 'ABC' elsif r < 2800 puts 'ARC' else puts 'AGC' end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
1,073,749
1,073,750
u503270460
ruby
p03288
n = gets.chomp.to_i if n < 1200 puts "ABC" elsif n < 2800 puts "AGC" else puts "AGC" end
n = gets.chomp.to_i if n < 1200 puts "ABC" elsif n < 2800 puts "ARC" else puts "AGC" end
[ "literal.string.change", "call.arguments.change" ]
1,073,920
1,073,921
u412789323
ruby
p03288
R = gets.to_i puts R < 1200 ? 'ABC' : R < 1800 ? 'ARC' : 'AGC'
R = gets.to_i puts R < 1200 ? 'ABC' : R < 2800 ? 'ARC' : 'AGC'
[ "literal.number.integer.change", "control_flow.branch.if.condition.change" ]
1,073,956
1,073,957
u019986937
ruby
p03288
num = gets.to_i if num < 1200 puts "ABC" elsif num > 1200 && num < 2800 puts "ARC" else puts "AGC" end
num = gets.to_i if num < 1200 puts "ABC" elsif num >= 1200 && num < 2800 puts "ARC" else puts "AGC" end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
1,074,021
1,074,022
u353707427
ruby
p03288
r=gets.to_i p r<1200?:ABC: r<2800?:ARC: :AGC
r=gets.to_i puts r<1200?:ABC: r<2800?:ARC: :AGC
[ "call.function.change", "io.output.change" ]
1,074,094
1,074,095
u025592199
ruby
p03288
r = gets.to_i puts r <= 1200 ? "ABC" : (r <= 2800 ? "ARC" : "AGC")
r = gets.to_i puts r < 1200 ? "ABC" : (r < 2800 ? "ARC" : "AGC")
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
1,074,222
1,074,223
u561391668
ruby
p03288
r = gets_to_i if r < 1200 puts "ABC" elsif r < 2800 puts "ARC" else puts "AGC" end
r = gets.to_i if r < 1200 puts "ABC" elsif r < 2800 puts "ARC" else puts "AGC" end
[ "assignment.value.change", "call.add" ]
1,074,262
1,074,263
u246562160
ruby
p03288
# Rated for Me R = gets.chomp.to_i if R < 1200 puts "ABC" elsif R < 2800 && R > 1200 puts "ARC" else puts "AGC" end
# Rated for Me R = gets.chomp.to_i if R < 1200 puts "ABC" elsif R < 2800 && R >= 1200 puts "ARC" else puts "AGC" end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
1,074,402
1,074,403
u743283842
ruby
p03288
input = gets.to_i if input < 1200 echo "ABC" elsif input < 2800 echo "ARC" else echo "AGC" end
input = gets.to_i if input < 1200 puts "ABC" elsif input < 2800 puts "ARC" else puts "AGC" end
[ "identifier.change" ]
1,074,764
1,074,765
u277797473
ruby
p03288
#!/usr/bin/env ruby r = gets.chomp.to_i result = "" if (r < 1200) result = "ABC" elsif (r < 2800) result = "ARC" else result = "AGC" end
#!/usr/bin/env ruby r = gets.chomp.to_i result = "" if (r < 1200) result = "ABC" elsif (r < 2800) result = "ARC" else result = "AGC" end puts result
[ "call.add" ]
1,074,837
1,074,838
u029843816
ruby
p03289
#s[i] =~ /^[A-Z]/ #この A-Zの表現について考える。 s = gets.chomp.split("") fff = 1 if s[0] != "A" && fff == 1 puts "WA" fff -= 1 end mojisize = s.size count = 0 (2..(mojisize-2)).each do |i| if s[i] == "C" count += 1 end end if count != 1 && fff == 1 puts "WA" fff -= 1 end s.delete("A") s.delete("C") #p s saigo = s.size # p saigo # p saigo all = 0 # p s # p saigo (0..(saigo-1)).each do |i| if s[i] =~ /^[A-Z]/ break else all += 1 end end #p all #p all if all == saigo && fff == 1 puts "AC" fff -= 1 else puts "WA" end
#s[i] =~ /^[A-Z]/ #この A-Zの表現について考える。 s = gets.chomp.split("") fff = 1 if s[0] != "A" && fff == 1 puts "WA" fff -= 1 end mojisize = s.size count = 0 (2..(mojisize-2)).each do |i| if s[i] == "C" count += 1 end end if count != 1 && fff == 1 puts "WA" fff -= 1 end s.delete("A") s.delete("C") #p s saigo = s.size # p saigo # p saigo all = 0 # p s # p saigo (0..(saigo-1)).each do |i| if s[i] =~ /^[A-Z]/ break else all += 1 end end #p all #p all if all == saigo && fff == 1 puts "AC" fff -= 1 elsif fff == 1 puts "WA" end
[ "control_flow.branch.if.condition.change" ]
1,075,075
1,075,076
u412789323
ruby
p03289
s = gets.chomp.split("") fff = 1 if s[0] != "A" && fff == 1 puts "WA" fff -= 1 end mojisize = s.size count = 0 (2..(mojisize-2)).each do |i| if s[i] == "C" count += 1 end end if count != 1 && fff == 1 puts "WA" fff -= 1 end s.delete("A") s.delete("C") #p s saigo = s.size # p saigo # p saigo all = 0 # p s # p saigo (0..(saigo-1)).each do |i| if s[i] =~ /^[A-Z]/ break else all += 1 end end #p all if all == saigo && fff == 1 puts "AC" fff -= 1 else puts "WA" end
#s[i] =~ /^[A-Z]/ #この A-Zの表現について考える。 s = gets.chomp.split("") fff = 1 if s[0] != "A" && fff == 1 puts "WA" fff -= 1 end mojisize = s.size count = 0 (2..(mojisize-2)).each do |i| if s[i] == "C" count += 1 end end if count != 1 && fff == 1 puts "WA" fff -= 1 end s.delete("A") s.delete("C") #p s saigo = s.size # p saigo # p saigo all = 0 # p s # p saigo (0..(saigo-1)).each do |i| if s[i] =~ /^[A-Z]/ break else all += 1 end end #p all #p all if all == saigo && fff == 1 puts "AC" fff -= 1 elsif fff == 1 puts "WA" end
[ "control_flow.branch.if.condition.change" ]
1,075,077
1,075,076
u412789323
ruby
p03289
s = gets.chomp.split("") fff = 1 if s[0] != "A" && fff == 1 puts "WA" fff -= 1 end mojisize = s.size count = 0 (2..(mojisize-2)).each do |i| if s[i] == "C" count += 1 end end if count != 1 && fff == 1 puts "WA" fff -= 1 end s.delete("A") s.delete("C") #p s saigo = s.size # p saigo # p saigo all = 0 # p s # p saigo (0..(saigo-1)).each do |i| if s[i] =~ /^[A-Z]/ break else all += 1 end end #p all if all == saigo && fff == 1 puts "AC" fff -= 1 else puts "WA" end
#s[i] =~ /^[A-Z]/ #この A-Zの表現について考える。 s = gets.chomp.split("") fff = 1 if s[0] != "A" && fff == 1 puts "WA" fff -= 1 end mojisize = s.size count = 0 (2..(mojisize-2)).each do |i| if s[i] == "C" count += 1 end end if count != 1 && fff == 1 puts "WA" fff -= 1 end s.delete("A") s.delete("C") #p s saigo = s.size # p saigo # p saigo all = 0 # p s # p saigo (0..(saigo-1)).each do |i| if s[i] =~ /^[A-Z]/ break else all += 1 end end #p all #p all if all == saigo && fff == 1 puts "AC" fff -= 1 elsif fff == 1 puts "WA" end
[ "control_flow.branch.if.condition.change" ]
1,075,078
1,075,076
u412789323
ruby
p03289
s=gets.chomp flag=true l=s.size flag=false if s[0]!=?A flag=false if s[1].upcase==s[1] c=0 (2...l-1).each do |i| if s[i].upcase==s[i] c+=1 if s[i]==?C flag=false if s[i]!=?C end flag=false if c!=1 end flag=false if s[l-1].upcase==s[l-1] puts flag ? 'AC':'WA'
s=gets.chomp flag=true l=s.size flag=false if s[0]!=?A flag=false if s[1].upcase==s[1] c=0 (2...l-1).each do |i| if s[i].upcase==s[i] c+=1 if s[i]==?C flag=false if s[i]!=?C end end flag=false if c!=1 flag=false if s[l-1].upcase==s[l-1] puts flag ? 'AC':'WA'
[]
1,075,136
1,075,137
u966810027
ruby
p03289
p (gets.chomp[/^A[a-z]+C[a-z]*[a-z]$/])? "AC" : "WA"
puts (gets.chomp[/^A[a-z]+C[a-z]*[a-z]$/])? "AC" : "WA"
[ "call.function.change", "io.output.change" ]
1,075,462
1,075,463
u482840940
ruby
p03289
s = gets.chomp.chars if s[0] != 'A' puts 'WA' exit end if s[2..-2].count('C') != 1 puts 'WA' exit end s.shift if s.count('C') != 1 puts 'WA' exit end s.each do |i| if !i.match(/[a-z]C/) puts 'WA' exit end end puts 'AC'
s = gets.chomp.chars if s[0] != 'A' puts 'WA' exit end if s[2..-2].count('C') != 1 puts 'WA' exit end s.shift if s.count('C') != 1 puts 'WA' exit end s.each do |i| if !i.match(/[a-zC]/) puts 'WA' exit end end puts 'AC'
[ "literal.string.change", "control_flow.branch.if.condition.change" ]
1,075,531
1,075,532
u238956837
ruby
p03288
r=gets.to_i puts r<1800 ? :ABC : r<2800 ? :ARC : :AGC
r=gets.to_i puts r<1200 ? :ABC : r<2800 ? :ARC : :AGC
[ "literal.number.integer.change", "control_flow.branch.if.condition.change" ]
1,075,643
1,075,644
u785521224
ruby
p03288
r=gets.to_i if r<1200 puts "ABC" elsif r<2800 puts "ARC" elsif r<1200 puts "AGC" end
r=gets.to_i if r<1200 puts "ABC" elsif r<2800 puts "ARC" else puts "AGC" end
[ "expression.operation.binary.remove" ]
1,075,669
1,075,670
u308416164
ruby
p03289
def isup(s) /[[:upper:]]/.match(s) end S=gets.strip if S[0]!='A' puts 'WA' exit end a=[] a<<0 ok=false (2..S.size-2).each do |i| if S[i]=='C' ok=true a<<i end end if !ok || a.size!=2 puts 'WA' exit end (0..S.size-1).each do |i| if !a.include?(i) && !isup(S[i]) puts 'WA' exit end end puts 'AC'
def isup(s) /[[:upper:]]/.match(s) end S=gets.strip if S[0]!='A' puts 'WA' exit end a=[] a<<0 ok=false (2..S.size-2).each do |i| if S[i]=='C' ok=true a<<i end end if !ok || a.size!=2 puts 'WA' exit end (0..S.size-1).each do |i| if !a.include?(i) && isup(S[i]) puts 'WA' exit end end puts 'AC'
[]
1,075,755
1,075,756
u061071198
ruby
p03289
arr = gets.chomp.split("") a = arr[0]==="A" c = arr.slice(2, arr.size-2).count("C") == 1 isLower = arr.select{|e| e =~ /[a-z]/}.size == arr.size - 2 puts (a && c && isLower) ? "AC" : "WA"
arr = gets.chomp.split("") a = arr[0]==="A" c = arr.slice(2..arr.size-2).count("C") == 1 isLower = arr.select{|e| e =~ /[a-z]/}.size == arr.size - 2 puts (a && c && isLower) ? "AC" : "WA"
[ "assignment.value.change", "call.arguments.change", "expression.operation.binary.change" ]
1,075,757
1,075,758
u466332671
ruby
p03289
arr = gets.chomp.split("") a = arr[0]==="A" c = arr.slice(2).count("C") == 1 isLower = arr.select{|e| e =~ /[a-z]/}.size == arr.size - 2 puts (a && c && isLower) ? "AC" : "WA"
arr = gets.chomp.split("") a = arr[0]==="A" c = arr.slice(2..arr.size-2).count("C") == 1 isLower = arr.select{|e| e =~ /[a-z]/}.size == arr.size - 2 puts (a && c && isLower) ? "AC" : "WA"
[]
1,075,759
1,075,758
u466332671
ruby
p03289
S = gets.to_s.chomp! a = S[2..-2] b = 0 c = 0 a.length.times{|i| if a[i]=="C" b=b+1 c=i end } T = "#{S}" U = "#{S.downcase}" T[0]=T[0].downcase T[c+2]=T[c+2].downcase if S.start_with?("A") && T == U puts "AC" else puts "WA" end
S = gets.to_s.chomp! a = S[2..-2] b = 0 c = 0 a.length.times{|i| if a[i]=="C" b=b+1 c=i end } T = "#{S}" U = "#{S.downcase}" T[0]=T[0].downcase T[c+2]=T[c+2].downcase if S.start_with?("A") && T == U && b == 1 puts "AC" else puts "WA" end
[ "control_flow.branch.if.condition.change" ]
1,075,858
1,075,859
u794149135
ruby
p03289
s = gets.chomp.split("") if (s[0] == "A")&& (s[2..-2].count{|t|t == "C"} == 1) s.delete("A") s.delete("C") require 'set' al = ("a".."z").to_a if p Set.new(al).superset?(Set.new(s)) puts "AC" else puts "WA" end else puts "WA" end
s = gets.chomp.split("") if (s[0] == "A")&& (s[2..-2].count{|t|t == "C"} == 1) s.delete_at(0) s.delete("C") require 'set' al = ("a".."z").to_a if Set.new(al).superset?(Set.new(s)) puts "AC" else puts "WA" end else puts "WA" end
[ "identifier.change", "call.arguments.change", "io.output.change", "call.remove" ]
1,076,313
1,076,314
u012110567
ruby
p03289
s = gets.chomp.split("") if (s[0] == "A" && s.count{|st| st == "A" } == 1)&& (s[2..-2].count{|t|t == "C"} == 1) s.delete("A") s.delete("C") require 'set' al = ("a".."z").to_a if p Set.new(al).superset?(Set.new(s)) puts "AC" else puts "WA" end else puts "WA" end
s = gets.chomp.split("") if (s[0] == "A" && s.count{|st| st == "A" } == 1)&& (s[2..-2].count{|t|t == "C"} == 1) s.delete("A") s.delete("C") require 'set' al = ("a".."z").to_a if Set.new(al).superset?(Set.new(s)) puts "AC" else puts "WA" end else puts "WA" end
[ "io.output.change", "call.remove" ]
1,076,315
1,076,316
u012110567
ruby
p03289
s = gets.chomp.split("") if (s[0] == "A")&& (s[2..-2].count{|t|t == "C"} == 1) s.delete("A") s.delete("C") require 'set' al = ("a".."z").to_a if p Set.new(al).superset?(Set.new(s)) puts "AC" else puts "WA" end else puts "WA" end
s = gets.chomp.split("") if (s[0] == "A")&& (s[2..-2].count{|t|t == "C"} == 1) s.delete("A") s.delete("C") require 'set' al = ("a".."z").to_a if Set.new(al).superset?(Set.new(s)) puts "AC" else puts "WA" end else puts "WA" end
[ "io.output.change", "call.remove" ]
1,076,313
1,076,317
u012110567
ruby
p03289
s=gets.chomp if(s=~/A[a-z]+C[a-z]{2,}/) puts("AC") else puts("WA") end
s=gets.chomp if(s=~/^A[a-z]+C[a-z]+$/) puts("AC") else puts("WA") end
[ "control_flow.branch.if.condition.change" ]
1,076,677
1,076,678
u415400221
ruby
p03289
s=gets.chomp if(s=~/A[a-z]+C[a-z]{2}/) puts("AC") else puts("WA") end
s=gets.chomp if(s=~/^A[a-z]+C[a-z]+$/) puts("AC") else puts("WA") end
[ "control_flow.branch.if.condition.change" ]
1,076,679
1,076,678
u415400221
ruby
p03289
s=gets.chomp if(s=~/A[a-z]+[C][a-z]{2}/) puts("AC") else puts("WA") end
s=gets.chomp if(s=~/^A[a-z]+C[a-z]+$/) puts("AC") else puts("WA") end
[ "control_flow.branch.if.condition.change" ]
1,076,680
1,076,678
u415400221
ruby
p03289
s = gets.chomp screenOutput = "AC" screenOutput = "WA" if s[0] != "A" cCount = 0 cIndexNumber = 0 s.slice(2..(s.length-3)).split("").each_with_index do |str, index| if str == "C" cCount += 1 cIndexNumber = index + 2 end end screenOutput = "WA" if cCount != 1 if screenOutput == "AC" smallAlphabets = {} ("a".."z").each do |smallAlphabet| smallAlphabets.store(smallAlphabet,0) end s.slice!(cIndexNumber) s.slice!(0) tempS = s tempSCount=0 tempS.split("").each do |tempStr| tempSCount += 1 if smallAlphabets.has_key?(tempStr) end screenOutput = "WA" if tempSCount != tempS.length end puts screenOutput
s = gets.chomp screenOutput = "AC" screenOutput = "WA" if s[0] != "A" cCount = 0 cIndexNumber = 0 s.slice(2..(s.length-2)).split("").each_with_index do |str, index| if str == "C" cCount += 1 cIndexNumber = index + 2 end end screenOutput = "WA" if cCount != 1 if screenOutput == "AC" smallAlphabets = {} ("a".."z").each do |smallAlphabet| smallAlphabets.store(smallAlphabet,0) end s.slice!(cIndexNumber) s.slice!(0) tempS = s tempSCount=0 tempS.split("").each do |tempStr| tempSCount += 1 if smallAlphabets.has_key?(tempStr) end screenOutput = "WA" if tempSCount != tempS.length end puts screenOutput
[ "literal.number.integer.change", "call.arguments.change", "expression.operation.binary.change" ]
1,077,024
1,077,025
u802371628
ruby
p03289
S = gets.chomp s = S.split('') l = S.length t = S.unpack("C*") if s.count('A') != 1 || s.count('C') != 1 || s.index('A') != 0 || s.index('C') < 1 || s.index('C') == l-1 puts 'WA' elsif t.any?{|x| x == 66 || (68 <= x && x <= 90 ) } puts 'WA' else puts 'AC' end
S = gets.chomp s = S.split('') l = S.length t = S.unpack("C*") if s.count('A') != 1 || s.count('C') != 1 || s.index('A') != 0 || s.index('C') <= 1 || s.index('C') == l-1 puts 'WA' elsif t.any?{|x| x == 66 || (68 <= x && x <= 90 ) } puts 'WA' else puts 'AC' end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
1,077,077
1,077,078
u162758522
ruby
p03289
puts (gets.chomp =~ /A[a-z]+C[a-z]*/ ? "AC" : "WA")
puts (gets.chomp =~ /\AA[a-z]+C[a-z]+\z/ ? "AC" : "WA")
[ "control_flow.branch.if.condition.change", "literal.string.change", "expression.operator.arithmetic.change" ]
1,077,140
1,077,141
u359025499
ruby
p03289
a = gets.chomp result = "AC" result = "WA" if a[0] != "A" || !a[2,-2].include?("C") || a.count("A-Z") > 2 print result
a = gets.chomp result = "AC" result = "WA" if a[0] != "A" || !a[2..-2].include?("C") || a.count("A-Z") > 2 print result
[ "variable_access.subscript.index.change", "control_flow.branch.if.condition.change" ]
1,077,217
1,077,218
u093975453
ruby
p03289
a = gets.chomp result = "AC" result = "WA" if a[0] != "A" || !a.include?("C") || a.count("A-Z") > 2 print result
a = gets.chomp result = "AC" result = "WA" if a[0] != "A" || !a[2..-2].include?("C") || a.count("A-Z") > 2 print result
[ "control_flow.branch.if.condition.change" ]
1,077,219
1,077,218
u093975453
ruby
p03289
s = gets flg = 1 cnt = 0 if(s[0] == "A")then s[0] = s[0].downcase flg = 0 end s[0] = s[0].downcase for i in 2..s.length-3 if(s[i] == "C")then if(cnt == 0)then s[i] = s[i].downcase end cnt += 1 end end if(cnt != 1)then flg = 0 end if(s.downcase! != nil)then flg = 0 end if(flg == 1)then puts "AC" else puts "WA" end
s = gets flg = 1 cnt = 0 if(s[0] != "A")then s[0] = s[0].downcase flg = 0 end s[0] = s[0].downcase for i in 2..s.length-3 if(s[i] == "C")then if(cnt == 0)then s[i] = s[i].downcase end cnt += 1 end end if(cnt != 1)then flg = 0 end if(s.downcase! != nil)then flg = 0 end if(flg == 1)then puts "AC" else puts "WA" end
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
1,077,247
1,077,248
u330533916
ruby
p03289
s = gets.chomp frag = "AC" if s[0] != "A" frag = "WA" end count = 0;cp = nil 2.upto(s.length-2) do |i| if s[i] == "C" count += 1 cp = i end end if count != 1 frag = "WA" end s[0] = "a" s[cp] = "c" if s != s.downcase frag = "WA" end puts frag
s = gets.chomp frag = "AC" if s[0] != "A" frag = "WA" end count = 0;cp = nil 2.upto(s.length-2) do |i| if s[i] == "C" count += 1 cp = i end end if count != 1 frag = "WA" end s[0] = "a" if cp != nil s[cp] = "c" end if s != s.downcase frag = "WA" end puts frag
[]
1,077,658
1,077,659
u974214237
ruby
p03289
s = gets.chomp if s[0] == 'A' && s[2..-2].count('C') == 1 && s.gsub(/[AC]/, '') =~ /[a-z]*/ puts 'AC' else puts 'WA' end
s = gets.chomp if s[0] == 'A' && s[2..-2].count('C') == 1 && s.gsub(/[AC]/, '') =~ /^[a-z]*$/ puts 'AC' else puts 'WA' end
[ "control_flow.branch.if.condition.change" ]
1,077,677
1,077,678
u434509016
ruby
p03289
s = 'AtCoder' if s[0] == 'A' && s[2..-2].count('C') == 1 && s.chars.count{|i| i =~ /[a-z]/ } == s.size - 2 puts :AC else puts :WA end
s = gets.strip if s[0] == 'A' && s[2..-2].count('C') == 1 && s.chars.count{|i| i =~ /[a-z]/ } == s.size - 2 puts :AC else puts :WA end
[]
1,077,732
1,077,733
u782656139
ruby
p03289
s = gets.chomp p s[0] == "A" \ && s[2...-1].count("C") == 1 \ && s.gsub("A", "a").gsub("C", "c") == s.downcase\ ? "AC" : "WA"
s = gets.chomp puts s[0] == "A" \ && s[2...-1].count("C") == 1 \ && s.gsub("A", "a").gsub("C", "c") == s.downcase\ ? "AC" : "WA"
[ "call.function.change", "io.output.change" ]
1,077,796
1,077,797
u964208493
ruby
p03289
s=gets.chomp if s.match(/A[a-z][a-z]*C[a-z]*[a-z]/) puts 'AC' else puts 'WA' end
s=gets.chomp if s.match(/^A[a-z][a-z]*C[a-z]*[a-z]$/) puts 'AC' else puts 'WA' end
[ "control_flow.branch.if.condition.change" ]
1,077,861
1,077,862
u868089307
ruby
p03289
puts gets[2..-2].count(?C)==1&&~/^A[a-z]*C[a-z]*$/?:AC: :WA
puts gets[2..-3].count(?C)==1&&~/^A[a-z]*C[a-z]*$/?:AC: :WA
[ "literal.number.integer.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change" ]
1,077,928
1,077,929
u711705317
ruby
p03289
if STDIN.gets.match /^A[a-z]+C[a-z]+/ puts 'AC' else puts 'WA' end
if STDIN.gets.match /^A[a-z]+C[a-z]+$/ puts 'AC' else puts 'WA' end
[ "control_flow.branch.if.condition.change" ]
1,077,942
1,077,943
u369152052
ruby
p03289
if STDIN.gets ~ /^A[a-z]+C[a-z]+/ puts 'AC' else puts 'WA' end
if STDIN.gets.match /^A[a-z]+C[a-z]+$/ puts 'AC' else puts 'WA' end
[ "control_flow.branch.if.condition.change", "call.add" ]
1,077,944
1,077,943
u369152052
ruby
p03289
S = gets.chomp Sa = S.dup Sa[0, 2] = "" Sa[-1] = "" if ((S[0] == "A") && (Sa.count("C") == 1) && (S.count("A-C") == 2)) puts("AC") else puts("WA") end
S = gets.chomp Sa = S.dup Sa[0, 2] = "" Sa[-1] = "" if (S[0] == "A") && (Sa.count("C") == 1) && (S.count("A-Z") == 2) puts("AC") else puts("WA") end
[ "control_flow.branch.if.condition.change", "literal.string.change" ]
1,078,040
1,078,041
u479293225
ruby
p03289
S = gets.chomp Sa = S.dup Sa[0, 2] = "" Sa[-1] = "" if (S[0] == "A") && (Sa.count("C") == 1) && (Sa.count("A-Z") == 1) puts("AC") else puts("WA") end
S = gets.chomp Sa = S.dup Sa[0, 2] = "" Sa[-1] = "" if (S[0] == "A") && (Sa.count("C") == 1) && (S.count("A-Z") == 2) puts("AC") else puts("WA") end
[ "control_flow.branch.if.condition.change", "literal.number.integer.change" ]
1,078,042
1,078,041
u479293225
ruby
p03289
s = gets.chomp.split(" ").map(&:to_s) s = s[0] if s =~ /^A[a-z]([Ca-z]+)[a-z]$/ then if $1.chars.sort.join =~ /^C[a-z]*/ then print "AC" else print "WA" end else print "WA" end
s = gets.chomp.split(" ").map(&:to_s) s = s[0] if s =~ /^A[a-z]([Ca-z]+)[a-z]$/ then if $1.chars.sort.join =~ /^C[a-z]*$/ then print "AC" else print "WA" end else print "WA" end
[ "control_flow.branch.if.condition.change" ]
1,078,162
1,078,163
u957810040
ruby
p03289
s = gets.chomp.split(" ").map(&:to_s) s = s[0] if s =~ /^A[a-z]([Ca-z]+)[a-z]$/ then if $1.chars.sort.join =~ /^C[a-z]+/ then print "AC" else print "WA" end else print "WA" end
s = gets.chomp.split(" ").map(&:to_s) s = s[0] if s =~ /^A[a-z]([Ca-z]+)[a-z]$/ then if $1.chars.sort.join =~ /^C[a-z]*$/ then print "AC" else print "WA" end else print "WA" end
[ "literal.string.change", "expression.operator.arithmetic.change", "control_flow.branch.if.condition.change" ]
1,078,164
1,078,163
u957810040
ruby
p03289
s = gets.chomp # s = "AtCoder" # s = "ACoder" # s = "AcycliC" # s = "AtCoCo" # s = "Atcoder" def accept?(str) unless str[0] == "A" return false end # puts "a1" c_idx = str.index("C") puts c_idx if c_idx.nil? || !(2 <= c_idx && c_idx <= str.length - 2) return false end # puts "a2" str.slice!(c_idx) str.slice!(0) unless str == str.downcase return false end # puts "a3" return true end if accept?(s) == true puts "AC" else puts "WA" end
s = gets.chomp # s = "AtCoder" # s = "ACoder" # s = "AcycliC" # s = "AtCoCo" # s = "Atcoder" def accept?(str) unless str[0] == "A" return false end # puts "a1" c_idx = str.index("C") # puts c_idx if c_idx.nil? || !(2 <= c_idx && c_idx <= str.length - 2) return false end # puts "a2" str.slice!(c_idx) str.slice!(0) unless str == str.downcase return false end # puts "a3" return true end if accept?(s) == true puts "AC" else puts "WA" end
[ "call.remove" ]
1,078,343
1,078,344
u202894455
ruby
p03289
s=gets.chomp b=s.slice(2..s.size-2) if s[0]=='A' && b.count('C')==1 s=s.delete('C').chars s.shift s=s.join if s==s.downcase then puts :AC else puts :WA end end
s=gets.chomp b=s.slice(2..s.size-2) if s[0]=='A' && b.count('C')==1 s=s.delete('C').chars s.shift s=s.join if s==s.downcase then puts :AC; exit end end puts :WA
[ "call.arguments.change", "call.add" ]
1,078,472
1,078,473
u785521224
ruby
p03290
io = STDIN d,G=io.gets.split.map(&:to_i) ar=d.times.map do |i| q,c = io.gets.split.map(&:to_i) [100*(i+1),q,100*(i+1)*q+c] #点数、問題数、合計 end $ans=1000 def dfs(questions,highest,amt,num) if amt>=G $ans=[$ans,num].min else if questions==[] x,q,tot=highest if G-amt<=x*(q-1) $ans=[$ans,num+((G-amt)/x).ceil].min end return end x,q,tot=questions[0] dfs(questions[1..-1],highest,amt+tot,num+q) dfs(questions[1..-1],questions[0],amt,num) end end dfs(ar,[],0,0) p $ans
io = STDIN d,G=io.gets.split.map(&:to_i) ar=d.times.map do |i| q,c = io.gets.split.map(&:to_i) [100*(i+1),q,100*(i+1)*q+c] #点数、問題数、合計 end $ans=1000 def dfs(questions,highest,amt,num) if amt>=G $ans=[$ans,num].min else if questions==[] x,q,tot=highest if G-amt<=x*(q-1) $ans=[$ans,num+((G-amt).to_f/x).ceil].min end return end x,q,tot=questions[0] dfs(questions[1..-1],highest,amt+tot,num+q) dfs(questions[1..-1],questions[0],amt,num) end end dfs(ar,[],0,0) p $ans
[ "call.add" ]
1,079,165
1,079,166
u132360211
ruby
p03290
D, G = gets.split.map(&:to_i) p = [] c = [] D.times do |i| p[i], c[i] = gets.split.map(&:to_i) end ans = Float::INFINITY 0.upto((1<<D)-1) do |s| count = 0 sum = 0 0.upto(D-1) do |i| if s & 1<<i > 0 sum += 100*(i+1)*p[i] + c[i] count += p[i] end end if sum < G (D-1).downto(0) do |i| if s & 1<<i == 0 tmp = ((G-sum)/(100*(i+1))).ceil count += if tmp >= p[i] Float::INFINITY else tmp end break end end end ans = count if ans > count end puts ans
D, G = gets.split.map(&:to_i) p = [] c = [] D.times do |i| p[i], c[i] = gets.split.map(&:to_i) end ans = Float::INFINITY 0.upto((1<<D)-1) do |s| count = 0 sum = 0 0.upto(D-1) do |i| if s & 1<<i > 0 sum += 100*(i+1)*p[i] + c[i] count += p[i] end end if sum < G (D-1).downto(0) do |i| if s & 1<<i == 0 tmp = ((G-sum).to_f/(100*(i+1))).ceil count += if tmp >= p[i] Float::INFINITY else tmp end break end end end ans = count if ans > count end puts ans
[ "call.add" ]
1,079,177
1,079,178
u708550576
ruby
p03290
(d,g),*a=$<.map{|s|s.split.map &:to_i} f=[] (0...1<<d).map{|b| s=0 n=0 r=nil (0...d).map{|i|b[i]>0?(n+=a[i][0];s+=a[i][0]*-~i*100+a[i][1]):r=i} f<<n+[0,(g-s-1)/(-~r*100)+1].max if r&&g-s<=a[r][0]*-~r*100 } p f.min
(d,g),*a=$<.map{|s|s.split.map &:to_i} f=[] (0...1<<d).map{|b| s=0 n=0 r=nil (0...d).map{|i|b[i]>0?(n+=a[i][0];s+=a[i][0]*-~i*100+a[i][1]):r=i} f<<n+[0,(g-s-1)/(-~r*100)+1].max if r&&g-s<=a[r][0]*-~r*100 r||f<<n } p f.min
[]
1,079,786
1,079,787
u019489252
ruby
p03292
arr = gets.split(" ").map{|i|i.to_i}.sort puts arr[2] - [0]
arr = gets.split(" ").map{|i|i.to_i}.sort puts arr[2] - arr[0]
[ "call.arguments.change" ]
1,080,383
1,080,384
u606976120
ruby
p03292
arr = $stdin.gets.chomp.split(" ") arr.map! do |a_j| a_j.to_i end arr.sort! puts arr[2] - arr[1]
arr = $stdin.gets.chomp.split(" ") arr.map! do |a_j| a_j.to_i end arr.sort! puts arr[2] - arr[0]
[ "literal.number.integer.change", "variable_access.subscript.index.change", "call.arguments.change", "expression.operation.binary.change" ]
1,080,421
1,080,422
u294388467
ruby
p03292
array = gets.split.map(&:to_i) arr.sort! puts array[1] - array[0] + array[2] - array[1]
array = gets.split.map(&:to_i) array.sort! puts array[1] - array[0] + array[2] - array[1]
[ "misc.typo", "identifier.change" ]
1,080,518
1,080,519
u866325115
ruby
p03292
A, B, C = gets.split.map(&:to_i) puts (B - A).abs + (C - B).abs
A, B, C = gets.split.map(&:to_i).sort puts (B - A).abs + (C - B).abs
[ "call.add" ]
1,080,578
1,080,579
u193470608
ruby
p03292
a1,a2,a3 = gets.split.map(&:to_i) puts (a1 - a1).abs + (a2 - a1).abs + (a3 - a2).abs
a1,a2,a3 = gets.split.map(&:to_i).sort puts (a1 - a1).abs + (a2 - a1).abs + (a3 - a2).abs
[ "call.add" ]
1,080,800
1,080,801
u502774641
ruby
p03292
a=gets.split.map(&:to_i).sort puts a[2]-a[1]
a=gets.split.map(&:to_i).sort puts a[2]-a[0]
[ "literal.number.integer.change", "variable_access.subscript.index.change", "call.arguments.change", "expression.operation.binary.change" ]
1,080,994
1,080,995
u785521224
ruby
p03292
line = gets input = line.split(',').map {|e| e.chomp.to_i} ans = input.max - input.min puts ans
line = gets input = line.split.map {|e| e.chomp.to_i} ans = input.max - input.min puts ans
[ "call.arguments.change" ]
1,081,004
1,081,005
u617524852
ruby
p03292
a1, a2, a3 = gets.chomp.split(' ').map(&:to_i) b = [] b << (a1 - a2).abs b << (a2 - a3).abs b << (a3 - a1).abs b.sort puts b[2] + b[1]
a1, a2, a3 = gets.chomp.split(' ').map(&:to_i) b = [] b << (a1 - a2).abs b << (a2 - a3).abs b << (a3 - a1).abs b.sort! puts b[0] + b[1]
[ "call.suffix.change", "literal.number.integer.change", "variable_access.subscript.index.change", "call.arguments.change", "expression.operation.binary.change" ]
1,081,082
1,081,083
u482389534
ruby
p03293
s = gets.chomp.split('') t = gets.chomp.split('') check = 0 n = s.size if s.join('') != t.join('') n.times do tmp = s.pop s.unshift(tmp) check += 1 if s.join('') == t.join('') end end if check > 0 puts :Yes else puts:No end
s = gets.chomp.split('') t = gets.chomp.split('') check = 0 n = s.size if s.join('') != t.join('') n.times do tmp = s.pop s.unshift(tmp) check += 1 if s.join('') == t.join('') end else check += 1 end if check > 0 puts :Yes else puts:No end
[]
1,081,253
1,081,254
u437368899
ruby
p03293
def bb s = gets.chomp t = gets.chomp if s == t puts 'Yes' end u = s.split(//) for i in 1..(s.length-1) u = u.rotate(-1) if u.join == t puts 'Yes' exit end end puts 'No' end bb
def bb s = gets.chomp t = gets.chomp if s == t puts 'Yes' exit end u = s.split(//) for i in 1..(s.length-1) u = u.rotate(-1) if u.join == t puts 'Yes' exit end end puts 'No' end bb
[ "control_flow.exit.add" ]
1,081,543
1,081,544
u510887956
ruby
p03293
s = gets.chomp.chars t = gets.chomp.chars ns = s.count res = false res = true if s == t unless res ns.times do |i| first = s.delete_at(0) s << first puts s.inspect if s == t res = true break end end end puts res ? 'Yes' : 'No'
s = gets.chomp.chars t = gets.chomp.chars ns = s.count res = false res = true if s == t unless res ns.times do |i| first = s.delete_at(0) s << first if s == t res = true break end end end puts res ? 'Yes' : 'No'
[ "call.remove" ]
1,081,659
1,081,660
u630043039
ruby
p03293
s = gets.chomp.chars t = gets.chomp.chars ns = s.count res = false res = true if s == t unless res ns.times do |i| first = s.delete(0) s << first if s == t res = true break end end end puts res ? 'Yes' : 'No'
s = gets.chomp.chars t = gets.chomp.chars ns = s.count res = false res = true if s == t unless res ns.times do |i| first = s.delete_at(0) s << first if s == t res = true break end end end puts res ? 'Yes' : 'No'
[ "assignment.value.change", "identifier.change" ]
1,081,661
1,081,660
u630043039
ruby
p03293
S = gets.chomp T = gets.chomp T.size rotated = S can_rotate = false T.size.times do |t| first = rotated[0] rotated = rotated[1..-1] rotated += first if rotated == T can_rotate = true break end end status = can_rotate == true ? 'Yes' : 'No' p status
S = gets.chomp T = gets.chomp T.size # charsの1回転 rotated = S can_rotate = false T.size.times do |t| first = rotated[0] rotated = rotated[1..-1] rotated += first if rotated == T can_rotate = true break end end status = can_rotate == true ? 'Yes' : 'No' puts status
[ "call.function.change", "io.output.change" ]
1,081,742
1,081,743
u377076838
ruby
p03293
s = gets.chomp t = gets.chomp ans = false for i in 0..s.length-1 do new_st = s[i+1..s.length-1] + s[0..i] p new_st if new_st == t ans = true break end end puts (ans ? 'Yes' : 'No')
s = gets.chomp t = gets.chomp ans = false for i in 0..s.length-1 do new_st = s[i+1..s.length-1] + s[0..i] if new_st == t ans = true break end end puts (ans ? 'Yes' : 'No')
[ "call.remove" ]
1,081,773
1,081,774
u271411583
ruby
p03293
s = gets.chomp t = gets.chomp frag = false s.length.times do a = s[-1] s = s[0..-2] s = a + s if s == t frag = true end end puts frag
s = gets.chomp t = gets.chomp frag = "No" s.length.times do a = s[-1] s = s[0..-2] s = a + s if s == t frag = "Yes" end end puts frag
[ "assignment.value.change" ]
1,081,922
1,081,923
u974214237
ruby
p03293
s = gets.chomp t = gets.chomp ans = "false" s.length.times{ if s == t puts :Yes ans = "true" end s.insert!(0,s[s.length-1]) s.slice!(s.length-1) } if ans == "false" puts :No end
s = gets.chomp t = gets.chomp ans = "false" s.length.times{ if s == t puts :Yes ans = "true" break end s.insert(0,s[s.length-1]) s.slice!(s.length-1) } if ans == "false" puts :No end
[ "control_flow.break.add", "identifier.change", "io.output.change" ]
1,082,023
1,082,022
u990788654
ruby
p03293
s = gets.chomp t = gets.chomp l = s.size puts l l.times do |i| if t == s[(l-1-i)..(l-1)] + s[0...(l-1-i)] puts "Yes" exit end end puts "No"
s = gets.chomp t = gets.chomp l = s.size l.times do |i| if t == s[(l-1-i)..(l-1)] + s[0...(l-1-i)] puts "Yes" exit end end puts "No"
[ "call.remove" ]
1,082,039
1,082,040
u124214522
ruby
p03293
s = gets.chomp t = gets.chomp l = s.size (l-1).times do |i| if t == s[(l-1-i)..(l-1)] + s[0..(l-2-i)] puts "Yes" exit end end puts "No"
s = gets.chomp t = gets.chomp l = s.size l.times do |i| if t == s[(l-1-i)..(l-1)] + s[0...(l-1-i)] puts "Yes" exit end end puts "No"
[ "control_flow.branch.if.condition.change", "literal.number.integer.change", "variable_access.subscript.index.change" ]
1,082,041
1,082,040
u124214522
ruby
p03293
s = gets.chomp t = gets.chomp time = s.size time.times do last = s[-1] s.chop! s = last + s if s == t puts "Yes" exit! end end puts "No"
s = gets.chomp t = gets.chomp time = s.size time.times do last = s[-1] s.chop! s = last + s if s == t puts "Yes" exit end end puts "No"
[ "call.suffix.change" ]
1,082,239
1,082,240
u872636244
ruby
p03293
s = gets.chomp t = gets.chomp s.size.times do last = s[-1] s.chop! s = last + s if s == t puts "Yes" exit! end end puts "No"
s = gets.chomp t = gets.chomp time = s.size time.times do last = s[-1] s.chop! s = last + s if s == t puts "Yes" exit end end puts "No"
[ "call.add", "call.suffix.change" ]
1,082,241
1,082,240
u872636244
ruby
p03293
a=gets.chomp.split('') b=gets.chomp.split('') c=0 (a.count+1).times do if a == b c = 1 break end a.rotate!(-1) end p c==1 ? 'Yes' : 'No'
a=gets.chomp.split('') b=gets.chomp.split('') c=0 (a.count*2).times do if a == b c = 1 break end a.rotate!(-1) end puts c==1 ? 'Yes' : 'No'
[ "call.function.change", "io.output.change" ]
1,082,319
1,082,320
u098870186
ruby
p03293
a=gets.chomp.split('') b=gets.chomp.split('') c=0 a.count.times do if a == b c = 1 break end a.rotate!(-1) end p c==1 ? 'Yes' : 'No'
a=gets.chomp.split('') b=gets.chomp.split('') c=0 (a.count*2).times do if a == b c = 1 break end a.rotate!(-1) end puts c==1 ? 'Yes' : 'No'
[ "call.function.change", "io.output.change" ]
1,082,321
1,082,320
u098870186
ruby
p03294
n = gets.chomp.to_i ary = gets.chomp.map(&:to_i) # mに素数を選べば(各整数 - 1)の和を取れる puts(ary.inject(&:+) - n)
n = gets.chomp.to_i ary = gets.chomp.split.map(&:to_i) # mにary.maxより大きい素数を選べば(各整数 - 1)の和を取れる puts(ary.inject(&:+) - n)
[ "call.add" ]
1,082,397
1,082,398
u792512290
ruby
p03294
n = gets.chomp.to_i ary = gets.chomp.map(&:to_i) # mに素数を選べば(各整数 - 1)の和を取れる puts(ary.inject(&:+) - n)
n = gets.chomp.to_i ary = gets.chomp.split.map(&:to_i) # mに素数を選べば(各整数 - 1)の和を取れる puts(ary.inject(&:+) - n)
[ "call.add" ]
1,082,397
1,082,399
u792512290
ruby
p03294
# N 個の正整数 a1,a2,...,aN が与えられます。 # 非負整数 m に対して、f(m)=(m mod a1)+(m mod a2)+...+(m mod aN) とします。 # ここで、X mod Y は X を Y で割った余りを表します。 # f の最大値を求めてください。 n = gets.to_i input_a = gets.chomp.split a = Array.new n.times do |i| a << input_a[i].to_i end sum = 0 n.times do |i| sum += a[i] end puts sum
# N 個の正整数 a1,a2,...,aN が与えられます。 # 非負整数 m に対して、f(m)=(m mod a1)+(m mod a2)+...+(m mod aN) とします。 # ここで、X mod Y は X を Y で割った余りを表します。 # f の最大値を求めてください。 n = gets.to_i input_a = gets.chomp.split a = Array.new n.times do |i| a << input_a[i].to_i end sum = 0 n.times do |i| sum += a[i] - 1 end puts sum
[ "expression.operation.binary.add" ]
1,082,486
1,082,487
u139850627
ruby
p03294
n=gets.chomp.to_i a=gets.chop.split(" ").map { |e| e.to_i } m=1 for i in 0..n-1 m *= a[i] end puts m-n
n=gets.chomp.to_i a=gets.chop.split(" ").map { |e| e.to_i } m=0 for i in 0..n-1 m += a[i] end puts m-n
[ "literal.number.integer.change", "assignment.value.change", "expression.operator.change" ]
1,082,812
1,082,813
u267552846
ruby
p03294
n=gets.chomp.to_i a=gets.chop.split(" ").map { |e| e.to_i } m=1 for i in 0..n-1 m *= a[i] end puts m-1
n=gets.chomp.to_i a=gets.chop.split(" ").map { |e| e.to_i } m=0 for i in 0..n-1 m += a[i] end puts m-n
[ "literal.number.integer.change", "assignment.value.change", "expression.operator.change", "identifier.replace.add", "literal.replace.remove", "call.arguments.change", "expression.operation.binary.change" ]
1,082,814
1,082,813
u267552846
ruby
p03293
s = gets.chomp t = gets.chomp puts s puts t temp = t for i in 0...s.length do if s == temp then puts "Yes" exit end temp = temp[-1] + temp[0...-1] end puts "No"
s = gets.chomp t = gets.chomp temp = t for i in 0...s.length do if s == temp then puts "Yes" exit end temp = temp[-1] + temp[0...-1] end puts "No"
[ "call.remove" ]
1,083,380
1,083,381
u868379147
ruby
p03293
z = $stdin.read.split("\n") def f(arr, n) (arr.slice(arr.size - n, n) + arr.slice(0, arr.size - n)).join end s = z[0].split("") t = z[1] i = 1 result = false loop do if f(s, i) == t result = true break end if i == s.size - 1 break end i+=1 end if result puts 'Yes' else puts 'No' end
z = $stdin.read.split("\n") def f(arr, n) (arr.slice(arr.size - n, n) + arr.slice(0, arr.size - n)).join end s = z[0].split("") t = z[1] i = 0 result = false loop do if f(s, i) == t result = true break end if i == s.size - 1 break end i+=1 end if result puts 'Yes' else puts 'No' end
[ "literal.number.integer.change", "assignment.value.change" ]
1,083,397
1,083,398
u220501704
ruby
p03293
puts (gets*2).index(gets)?:Yes: :No
puts (gets.chop*2).index(gets.chop)?:Yes: :No
[ "control_flow.branch.if.condition.change", "call.add" ]
1,083,417
1,083,418
u657913472
ruby