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
p03497
kinds = Hash.new(0) n, k = gets.split.map(&:to_i) gets.split.each {|a| kinds[a.to_i] += 1} tmp = kinds.values.sort.reverse[0, k] puts tmp.empty? ? 0 : tmp.inject(&:+)
kinds = Hash.new(0) n, k = gets.split.map(&:to_i) gets.split.each {|a| kinds[a.to_i] += 1} tmp = kinds.values.sort.reverse.drop(k) puts tmp.empty? ? 0 : tmp.inject(&:+)
[ "assignment.value.change" ]
1,249,911
1,249,912
u297507288
ruby
p03497
kinds = Hash.new(0) n, k = gets.split.map(&:to_i) gets.split.each {|a| kinds[a.to_i] += 1} tmp = kinds.values.reverse[0, k] puts tmp.empty? ? 0 : tmp.inject(&:+)
kinds = Hash.new(0) n, k = gets.split.map(&:to_i) gets.split.each {|a| kinds[a.to_i] += 1} tmp = kinds.values.sort.reverse.drop(k) puts tmp.empty? ? 0 : tmp.inject(&:+)
[ "call.add", "assignment.value.change" ]
1,249,913
1,249,912
u297507288
ruby
p03497
N,K,*A=`dd`.split;p A.group_by(&:b).map{|_,v|v.size}.sort[0..~K.to_i].reduce:+
N,K,*A=`dd`.split;p A.group_by(&:b).map{|_,v|v.size}.sort[0..~K.to_i].reduce 0,:+
[ "call.arguments.add" ]
1,250,285
1,250,286
u019489252
ruby
p03497
gets=~/ /;p`dd`.split.group_by{|a|a}.map{|_,v|v.size}.sort[0..~$'.to_i].reduce 0,:+
gets=~/ /;p gets.split.group_by{|a|a}.map{|_,v|v.size}.sort[0..~$'.to_i].reduce 0,:+
[ "call.arguments.change" ]
1,250,324
1,250,325
u032223772
ruby
p03501
n, a, b = gets.split.map &:to_i p1 = a*t p2 = b p p1 > p2 ? p2 : p1
n, a, b = gets.split.map &:to_i p1 = a*n p2 = b p p1 > p2 ? p2 : p1
[ "assignment.value.change", "identifier.change", "call.arguments.change" ]
1,251,162
1,251,163
u489339677
ruby
p03501
N,A,B = gets.split.map(&:to_i) x = A*N if X >= B puts(B) else puts(X) end
N,A,B = gets.split.map(&:to_i) X = A*N if X >= B puts(B) else puts(X) end
[ "assignment.variable.change" ]
1,252,030
1,252,031
u241469130
ruby
p03501
N,A,B = gets.chomp.spit.map(&:to_i) A = A * T puts A <= B ? A : B
N,A,B = gets.chomp.split.map(&:to_i) A = A * N puts A <= B ? A : B
[ "assignment.value.change", "identifier.change", "expression.operation.binary.change" ]
1,252,331
1,252,332
u592423934
ruby
p03502
n = gets.to_i f = n.to_s.chars.map(&:to_i).sum if x % f == 0 puts "Yes" else puts "No" end
n = gets.to_i f = n.to_s.chars.map(&:to_i).sum if n % f == 0 puts "Yes" else puts "No" end
[ "identifier.change", "control_flow.branch.if.condition.change" ]
1,252,335
1,252,336
u059126963
ruby
p03502
n = gets.to_s ary = n.chars.map(&:to_i) s = ary.sum if n%s==0 puts "Yes" else puts "No" end
#メソッドの変換に注意! n = gets.to_s ary = n.chars.map(&:to_i) s = ary.sum if n.to_i%s==0 puts "Yes" else puts "No" end
[ "control_flow.branch.if.condition.change", "call.add" ]
1,252,352
1,252,353
u313103408
ruby
p03502
n = gets.chomp sum = n.split('').map(&:to_i).inject(:+) p (n.to_i % sum).zero? ? 'Yes' : 'No'
n = gets.chomp sum = n.split('').map(&:to_i).inject(:+) puts (n.to_i % sum).zero? ? 'Yes' : 'No'
[ "call.function.change", "io.output.change" ]
1,252,535
1,252,536
u787859793
ruby
p03502
# frozen_string_literal: true N = gets.to_i if(N < 10) puts "Yes" end if(N < 100 && N >= 10) a = (N % 10) + (N / 10) elsif(N >= 100 && N < 1000) a = (N / 100) + ((N % 100) / 10) + (N % 10) elsif(N >= 1000 && N < 10_000) a = (N / 1000) + (N % 1000) / 100 + (N % 100) / 10 + (N % 10) elsif(N >= 10_000 && N < 100_000) a = (N / 100_000) + (N % 10_000) / 1000 + (N % 1000) / 100 + (N % 100) / 10 + (N % 10) elsif(N >= 100_000 && N < 1_000_000) a = (N / 100_000) + (N % 100_000) / 10_000 + (N % 10_000) / 1_000 + (N % 1_000) / 100 + (N % 100) / 10 + (N % 10) elsif(N / 1_000_000 && N < 10_000_000) a = (N / 1_000_000) + (N % 1_000_000) / 100_000 + (N % 100_000) / 10_000 + (N % 10_000) / 1000 + (N % 1_000) / 100 + (N % 100) / 10 + (N % 10) elsif(N >= 10_000_000 && N < 100_000_000) a = (N / 10_000_000) + (N % 10_000_000) / 1_000_000 + (N % 1_000_000) / 100_000 + (N % 100_000) / 10_000 + (N % 10_000) / 1_000 + (N % 1_000) / 100 + (N % 100) / 10 + (N % 10) elsif(N == 100_000_000) a = 1 end if N % a == 0 puts "Yes" elsif N % a != 0 puts "No" end
# frozen_string_literal: true N = gets.to_i if(N < 10) a = N end if(N < 100 && N >= 10) a = (N % 10) + (N / 10) elsif(N >= 100 && N < 1000) a = (N / 100) + ((N % 100) / 10) + (N % 10) elsif(N >= 1000 && N < 10_000) a = (N / 1000) + (N % 1000) / 100 + (N % 100) / 10 + (N % 10) elsif(N >= 10_000 && N < 100_000) a = (N / 100_000) + (N % 10_000) / 1000 + (N % 1000) / 100 + (N % 100) / 10 + (N % 10) elsif(N >= 100_000 && N < 1_000_000) a = (N / 100_000) + (N % 100_000) / 10_000 + (N % 10_000) / 1_000 + (N % 1_000) / 100 + (N % 100) / 10 + (N % 10) elsif(N / 1_000_000 && N < 10_000_000) a = (N / 1_000_000) + (N % 1_000_000) / 100_000 + (N % 100_000) / 10_000 + (N % 10_000) / 1000 + (N % 1_000) / 100 + (N % 100) / 10 + (N % 10) elsif(N >= 10_000_000 && N < 100_000_000) a = (N / 10_000_000) + (N % 10_000_000) / 1_000_000 + (N % 1_000_000) / 100_000 + (N % 100_000) / 10_000 + (N % 10_000) / 1_000 + (N % 1_000) / 100 + (N % 100) / 10 + (N % 10) elsif(N == 100_000_000) a = 1 end if N % a == 0 puts "Yes" elsif N % a != 0 puts "No" end
[ "call.arguments.change" ]
1,253,187
1,253,188
u962609087
ruby
p03502
n.gets.to_i a = 0 m = n while m > 0 a += m%10 m /= 10 end puts n%a==0 ? :Yes : :No
n=gets.to_i a = 0 m = n while m > 0 a += m%10 m /= 10 end puts n%a==0 ? :Yes : :No
[]
1,253,284
1,253,285
u744908753
ruby
p03502
n.gets.to_i a = 0 m = n while m > 0 a+=m%10 m/=10 end puts n%a==0 ? :Yes : :No
n=gets.to_i a = 0 m = n while m > 0 a += m%10 m /= 10 end puts n%a==0 ? :Yes : :No
[]
1,253,286
1,253,285
u744908753
ruby
p03502
N = gets.to_i fX = N.to_s.chars.inject { |a,b| a.to_i+b.to_i } puts N%fX == 0 ? 'Yes' : 'No'
N = gets.to_i fX = N.to_s.chars.inject(0) { |a,b| a.to_i+b.to_i } puts N%fX == 0 ? 'Yes' : 'No'
[ "call.arguments.add" ]
1,253,302
1,253,303
u244087909
ruby
p03502
n = gets.to_i a = n.to_s.split.map(&:to_i).inject(:+) puts n % a == 0 ? "Yes": "No"
n = gets.to_i a = n.to_s.split("").map(&:to_i).inject(:+) puts n % a == 0 ? "Yes": "No"
[ "call.arguments.add" ]
1,253,353
1,253,354
u374190629
ruby
p03502
N = gets.to_i puts(N % N.to_s.chars.map(&:to_i).inject(:+) ? 'Yes' : 'No')
N = gets.to_i puts(N % N.to_s.chars.map(&:to_i).inject(:+) == 0 ? 'Yes' : 'No')
[ "control_flow.branch.if.condition.change" ]
1,253,570
1,253,571
u437302815
ruby
p03502
p gets.to_i%($_.sum-$_.size*48+38)>0?:No: :Yes
puts gets.to_i%($_.sum-$_.size*48+38)>0?:No: :Yes
[ "call.function.change", "io.output.change" ]
1,253,910
1,253,911
u019489252
ruby
p03502
s = gets.chars sum = s.chars.to_i.map(&:to_i).inject(:+) if s.to_i % sum == 0 puts "Yes" else puts "No" end
s = gets.chomp sum = s.chars.map(&:to_i).inject(:+) if s.to_i % sum == 0 puts "Yes" else puts "No" end
[ "assignment.value.change", "identifier.change", "call.remove" ]
1,254,074
1,254,075
u079330987
ruby
p03502
a = gets.to_i x = a a = a * 10 b = 0 c = 10 while (c > 0) b = b + x%10 x = x/10 c = c - 1 end if a%b == 0 puts "Yes" else puts "No" end
a = gets.to_i x = a x = x * 10 b = 0 c = 12 while (c > 0) b = b + x%10 x = x/10 c = c - 1 end if a%b == 0 puts "Yes" else puts "No" end
[ "assignment.variable.change", "identifier.change", "assignment.value.change", "expression.operation.binary.change", "literal.number.integer.change" ]
1,254,557
1,254,558
u399527088
ruby
p03503
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 kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} 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 inp() a=gets.chomp.split(" ").map(&:to_i)end def r_up(a, b) (a+b-1)/b end def r_sort(a) a.sort{|a,b|b<=>a} end n = inp[0] ti = [] n.times do |i| on = inp ti[i] = on.join.to_i(2) end pr = [] n.times do |i| pr[i] = inp end ans = -1e20 (0..1023).each do |d| now = 0 n.times do |i| pand = ti[i]&d c = pand.to_s(2).count("1") now += pr[i][c] end ans = [now,ans].max end p ans
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 kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} 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 inp() a=gets.chomp.split(" ").map(&:to_i)end def r_up(a, b) (a+b-1)/b end def r_sort(a) a.sort{|a,b|b<=>a} end n = inp[0] ti = [] n.times do |i| on = inp ti[i] = on.join.to_i(2) end pr = [] n.times do |i| pr[i] = inp end ans = -1e20 (1..1023).each do |d| now = 0 n.times do |i| pand = ti[i]&d c = pand.to_s(2).count("1") now += pr[i][c] end ans = [now,ans].max end p ans
[ "literal.number.integer.change" ]
1,254,811
1,254,812
u145123922
ruby
p03503
n = gets.to_i f = [nil] for i in 1..n do f.push(gets.chomp.split(' ').map(&:to_i).unshift(nil)) end p = [nil] for i in 1..n do p.push(gets.chomp.split(' ').map(&:to_i)) end pkiroku = [] nums = [1,2,3,4,5,6,7,8,9,10] for i in 1..10 do num.combination(i).to_a.each do |c| misetasu = [] for j in 1..n do count = 0 c.each{|k| count +=1 if f[j][k] == 1 } misetasu.push(p[j][count]) end pkiroku.push(misetasu.inject(:+)) end end puts pkiroku.max
n = gets.to_i f = [nil] for i in 1..n do f.push(gets.chomp.split(' ').map(&:to_i).unshift(nil)) end p = [nil] for i in 1..n do p.push(gets.chomp.split(' ').map(&:to_i)) end pkiroku = [] nums = [1,2,3,4,5,6,7,8,9,10] for i in 1..10 do nums.combination(i).to_a.each do |c| misetasu = [] for j in 1..n do count = 0 c.each{|k| count +=1 if f[j][k] == 1 } misetasu.push(p[j][count]) end pkiroku.push(misetasu.inject(:+)) end end puts pkiroku.max
[ "identifier.change" ]
1,255,448
1,255,449
u093034675
ruby
p03503
popcnt=->n{n==0?0:popcnt[n/2]+n%2} N=gets.to_i F=N.times.map{gets.tr(' ','').to_i(2)} P=N.times.map{gets.split.map &:to_i} r=-Float::INFINITY 1.upto(1023){|i| c=0 N.times{|j|c+=P[j][popcnt[b&F[j]]]} r=[r,c].max } p r
popcnt=->n{n==0?0:popcnt[n/2]+n%2} N=gets.to_i F=N.times.map{gets.tr(' ','').to_i(2)} P=N.times.map{gets.split.map &:to_i} r=-Float::INFINITY 1.upto(1023){|i| c=0 N.times{|j|c+=P[j][popcnt[i&F[j]]]} r=[r,c].max } p r
[ "identifier.change", "variable_access.subscript.index.change" ]
1,255,522
1,255,523
u280667879
ruby
p03503
popcnt=->n{n==0?0:popcnt[n/2]+n%2} N=gets.to_i F=N.times.map{gets.tr(' ','').to_i(2)} P=N.times.map{gets.split.map &:to_i} r=-Float::INFINITY 1.upto(1023){|i| c=0 N.times{|j|c+=P[i][popcnt[b&F[j]]]} r=[r,c].max } p r
popcnt=->n{n==0?0:popcnt[n/2]+n%2} N=gets.to_i F=N.times.map{gets.tr(' ','').to_i(2)} P=N.times.map{gets.split.map &:to_i} r=-Float::INFINITY 1.upto(1023){|i| c=0 N.times{|j|c+=P[j][popcnt[i&F[j]]]} r=[r,c].max } p r
[ "identifier.change", "variable_access.subscript.index.change" ]
1,255,524
1,255,523
u280667879
ruby
p03504
n, c = gets.split.map(&:to_i) stc = n.times.map {gets.split.map(&:to_i)}.sort_by{|e| e[0]} memo = Array.new(c+1) stc.each do |s,t,ch| i = memo.index{|e| e && e < s} memo[i] = nil if !memo[ch] && i memo[ch] = t p memo end p memo.compact.size
n, c = gets.split.map(&:to_i) stc = n.times.map {gets.split.map(&:to_i)}.sort_by{|e| e[0]} memo = Array.new(c+1) stc.each do |s,t,ch| i = memo.index{|e| e && e < s} memo[i] = nil if !memo[ch] && i memo[ch] = t end p memo.compact.size
[ "call.remove" ]
1,255,788
1,255,789
u692254521
ruby
p03502
require 'prime' require 'set' require 'tsort' include Math ALP = ('a'..'z').to_a INF = 0xffffffffffffffff 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 pr?(num); Prime.prime?(num) 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); st.step(en,n){|i|yield(i)} end x = gif puts x % (eval(x.to_s.split('').join(:+))) == 0 ? 'Yes' : 'No'
require 'prime' require 'set' require 'tsort' include Math ALP = ('a'..'z').to_a INF = 0xffffffffffffffff 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 pr?(num); Prime.prime?(num) 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); st.step(en,n){|i|yield(i)} end x = gif puts x % (eval(x.to_s.split('').join('+'))) == 0 ? 'Yes' : 'No'
[ "control_flow.branch.if.condition.change" ]
1,256,111
1,256,112
u988228861
ruby
p03502
s=gets;puts s.to_i%s.chars.map(&:to_i).reduce(:+)<1?:YES: :NO
s=gets;puts s.to_i%s.chars.map(&:to_i).reduce(:+)<1?:Yes: :No
[ "call.arguments.change", "io.output.change" ]
1,256,114
1,256,115
u280667879
ruby
p03502
g = STDIN.gets d = 0 for i in 0..(g.length - 1) d = d + g[i].to_i end r = g.to_i if r % d puts "Yes" else puts "No" end
g = STDIN.gets d = 0 for i in 0..(g.length - 1) d = d + g[i].to_i end r = g.to_i if r % d == 0 puts "Yes" else puts "No" end
[ "control_flow.branch.if.condition.change" ]
1,256,137
1,256,138
u152646037
ruby
p03502
n = gets.to_i f = 0 while n > 9 do f += n % 10 n /= 10 end if n % f == 0 puts "Yes" else puts "No" end
n = gets.to_i n2 = n f = 0 while n > 0 do f += n % 10 n /= 10 end if n2 % f == 0 puts "Yes" else puts "No" end
[ "literal.number.integer.change", "expression.operation.binary.change", "identifier.change", "control_flow.branch.if.condition.change" ]
1,256,153
1,256,154
u664737319
ruby
p03476
require 'prime' p ={} Prime.each(100000).each { |prime| p[prime] = true } x = {} (1..100000).each { |i| x[i] = (p[i]&&p[(i+1)/2] ? 1 : 0) } (3..100000).each { |i| x[i] += x[i-1]} gets.to_i.times do |_| l, r = gets.split.map(&:to_i) puts x[r]-x[l-1] end
require 'prime' p ={} Prime.each(100000).each { |prime| p[prime] = true } x = {} (0..100000).each { |i| x[i] = (p[i]&&p[(i+1)/2] ? 1 : 0) } (3..100000).each { |i| x[i] += x[i-1]} gets.to_i.times do |_| l, r = gets.split.map(&:to_i) puts x[r]-x[l-1] end
[ "literal.number.integer.change" ]
1,256,256
1,256,257
u871239364
ruby
p03505
K,A,B = gets.split.map &:to_i p K <= A ? 1 : A <= B ? -1 : [(K-A-1)/(A-B), 0].max*2+1
K,A,B = gets.split.map &:to_i p K <= A ? 1 : A <= B ? -1 : [(K-A-1)/(A-B)+1, 0].max*2+1
[ "expression.operation.binary.add" ]
1,256,985
1,256,986
u670503797
ruby
p03505
K,A,B = gets.split.map &:to_i p K > A && A<=B ? -1 : [(K-A-1)/(A-B)+1,0].max*2+1
K,A,B = gets.split.map &:to_i p K <= A ? 1 : A <= B ? -1 : [(K-A-1)/(A-B)+1, 0].max*2+1
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
1,256,987
1,256,986
u670503797
ruby
p03505
k,a,b=gets.split.map &:to_i;p a>b ?(k-b-1)/(a-b)*2+1:-1
k,a,b=gets.split.map &:to_i;p k>a ?a>b ?(k-b-1)/(a-b)*2+1:-1:1
[]
1,257,020
1,257,021
u598016178
ruby
p03505
k,a,b=gets.split.map &:to_i;p a>b ?(k-b-1)/(a-b)*2+1: -1
k,a,b=gets.split.map &:to_i;p k>a ?a>b ?(k-b-1)/(a-b)*2+1:-1:1
[]
1,257,022
1,257,021
u598016178
ruby
p03505
K, A, B = gets.split.map &:to_i if A < K && A < B p -1 else p 1 + (K - A).quo(A - B).ceil*2 end
K, A, B = gets.split.map &:to_i if A >= K p 1 elsif A <= B p -1 else p 1 + (K - A).quo(A - B).ceil*2 end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change", "call.arguments.change" ]
1,257,066
1,257,067
u711705317
ruby
p03543
n = gets().chomp.split('') cnt = 1 n.each_with_index do |chr, i| next if i == 0 if chr == n[i - 1] cnt += 1 break if cnt >= 3 else cnt = 0 end end puts cnt >= 3 ? 'Yes' : 'No'
n = gets().chomp.split('') cnt = 1 n.each_with_index do |chr, i| next if i == 0 if chr == n[i - 1] cnt += 1 break if cnt >= 3 else cnt = 1 end end puts cnt >= 3 ? 'Yes' : 'No'
[ "literal.number.integer.change", "assignment.value.change" ]
1,259,608
1,259,609
u810199299
ruby
p03543
n = gets.to_i puts ((n / 10) % 111 == 0 || n % 111 == 0)? "Yes" : "No"
n = gets.to_i puts ((n / 10) % 111 == 0 || (n % 1000) % 111 == 0)? "Yes" : "No"
[ "control_flow.branch.if.condition.change" ]
1,259,908
1,259,909
u482840940
ruby
p03543
n = $stdin.read.split("") puts ((n[0] == n[1]) && (n[1] == n[2])) || ((n[1] == n[2]) && (n[2] == n[3])) ? "YES" : "NO"
n = $stdin.read.split("") puts ((n[0] == n[1]) && (n[1] == n[2])) || ((n[1] == n[2]) && (n[2] == n[3])) ? "Yes" : "No"
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
1,260,874
1,260,875
u534039323
ruby
p03543
N = gets.chomp (0..3).each do |i| temp = N.dup temp[i] = '' if temp.chars.uniq.size == 1 puts 'Yes' exit end end puts 'No'
N = gets.chomp [0, 3].each do |i| temp = N.dup temp[i] = '' if temp.chars.uniq.size == 1 puts 'Yes' exit end end puts 'No'
[ "misc.typo" ]
1,260,881
1,260,882
u740836226
ruby
p03543
puts gets.scan(/.{3}/).empty? ? "No" : "Yes"
puts gets.scan(/(.)\1\1/).empty? ? "No" : "Yes"
[ "control_flow.branch.if.condition.change" ]
1,261,042
1,261,043
u056944756
ruby
p03543
a0 = gets.to_i a1 = a0%10 a0 = a0/10 a2 = a0%10 a0 = a0/10 a3 = a0%10 a0 = a0/10 a4 = a0%10 if a2 == a3 if a2 == a1 puts "Yes" elsif a2 == a4 puts "Yes" else puts "No" end puts "No" end
a0 = gets.to_i a1 = a0%10 a0 = a0/10 a2 = a0%10 a0 = a0/10 a3 = a0%10 a0 = a0/10 a4 = a0%10 if a2 == a3 if a2 == a1 puts "Yes" elsif a2 == a4 puts "Yes" else puts "No" end else puts "No" end
[]
1,261,237
1,261,238
u399527088
ruby
p03543
a0 = gets.to_i a1 = a0%10 a0 = a0/10 a2 = a0%10 a0 = a0/10 a3 = a0%10 a0 = a0/10 a4 = a0%10 if a2 == a3 if a2 == a1 puts "Yes" elsif a2 == a4 puts "Yes" else puts "No" end end
a0 = gets.to_i a1 = a0%10 a0 = a0/10 a2 = a0%10 a0 = a0/10 a3 = a0%10 a0 = a0/10 a4 = a0%10 if a2 == a3 if a2 == a1 puts "Yes" elsif a2 == a4 puts "Yes" else puts "No" end else puts "No" end
[ "call.add" ]
1,261,239
1,261,238
u399527088
ruby
p03543
integers = gets.split("") if (integers[0] == integers[1] && integers[1] == integers[2]) || (integers[1] == integers[2] && integers[2] == integers[3]) then print "YES" else print "NO" end
integers = gets.split("") if (integers[0] == integers[1] && integers[1] == integers[2]) || (integers[1] == integers[2] && integers[2] == integers[3]) then print "Yes" else print "No" end
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
1,261,270
1,261,271
u931757436
ruby
p03543
#! ruby -Ku str = "No" num = gets.chomp ("1".."9").each do |n| check = "" 3.times do check << n end str = "Yes" if num.include?(check) end puts str
#! ruby -Ku str = "No" num = gets.chomp ("0".."9").each do |n| check = "" 3.times do check << n end str = "Yes" if num.include?(check) end puts str
[ "literal.string.change" ]
1,261,277
1,261,278
u869835499
ruby
p03543
s = gets.chomp f = false (s.size - 3).times do |i| if s[i] == s[i + 1] and s[i + 1] == s[i + 2] then f = true end end puts (f ? "Yes" : "No")
s = gets.chomp f = false (s.size - 2).times do |i| if s[i] == s[i + 1] and s[i + 1] == s[i + 2] then f = true end end puts (f ? "Yes" : "No")
[ "literal.number.integer.change", "expression.operation.binary.change" ]
1,261,311
1,261,312
u198355306
ruby
p03544
n = gets.chomp.to_i a = 2 b = 1 ans = 0 if n >= 2 (n-1).times do |i| ans = b + a a = b b = ans end else puts "1" end puts ans
n = gets.chomp.to_i a = 2 b = 1 ans = 0 if n >= 2 (n-1).times do |i| ans = b + a a = b b = ans end else ans = 1 end puts ans
[ "call.arguments.change" ]
1,261,354
1,261,355
u412789323
ruby
p03544
n = gets.to_i lucas = [2, 1] if n <= 2 puts lucas[n - 1] else (n - 1).times do |i| lucas[i + 2] = lucas[i] + lucas[i + 1] end puts lucas[n] end
n = gets.to_i lucas = [2, 1] if n <= 1 puts lucas[n] else (n - 1).times do |i| lucas[i + 2] = lucas[i] + lucas[i + 1] end puts lucas[n] end
[ "literal.number.integer.change", "control_flow.branch.if.condition.change", "expression.operation.binary.remove" ]
1,262,184
1,262,185
u889326464
ruby
p03544
def fibonacci3(n) if n == 1 2 elsif n == 2 1 else a, b = 2, 1 n.times do a, b = b, a + b end return a end end n = gets.to_i puts fibonacci3(n)
def fibonacci3(n) if n == 0 2 elsif n == 1 1 else a, b = 2, 1 n.times do a, b = b, a + b end return a end end n = gets.to_i puts fibonacci3(n)
[ "literal.number.integer.change", "control_flow.branch.if.condition.change" ]
1,262,604
1,262,605
u945412921
ruby
p03544
def fibonacci3(n) if n == 1 || n == 2 1 else a, b = 0, 1 n.times do a, b = b, a + b end return a end end n = gets.to_i puts fibonacci3(n)
def fibonacci3(n) if n == 0 2 elsif n == 1 1 else a, b = 2, 1 n.times do a, b = b, a + b end return a end end n = gets.to_i puts fibonacci3(n)
[ "control_flow.branch.if.condition.change", "expression.operation.binary.remove", "literal.number.integer.change", "assignment.value.change" ]
1,262,606
1,262,605
u945412921
ruby
p03544
n=gets.to_i l=Array.new(n) l[0]=2 l[1]=1 2.upto(n-1) do |i| l[i]=l[i-1]+l[i-2] end p l[-1]
n=gets.to_i l=Array.new(n+1) l[0]=2 l[1]=1 2.upto(n) do |i| l[i]=l[i-1]+l[i-2] end p l[-1]
[ "expression.operation.binary.remove" ]
1,262,676
1,262,677
u315597999
ruby
p03544
l = [2, 1] n = gets.to_i (n-2).times do l << l[-1] + l[-2] end p l[n-1]
l = [2, 1] n = gets.to_i (n-1).times do l << l[-1] + l[-2] end p l[n]
[ "literal.number.integer.change", "expression.operation.binary.change", "expression.operation.binary.remove" ]
1,262,839
1,262,840
u744908753
ruby
p03544
n=gets.to_i lucas=[2,1] if n>2 (n-1).times do |i| i+=2 lucas[i]=lucas[i-1]+lucas[i-2] end end puts lucas[n]
n=gets.to_i lucas=[2,1] if n>1 (n-1).times do |i| i+=2 lucas[i]=lucas[i-1]+lucas[i-2] end end puts lucas[n]
[ "literal.number.integer.change", "control_flow.branch.if.condition.change" ]
1,263,350
1,263,351
u602591412
ruby
p03544
l=[2,1] 100.times{l<<l[-1]+l[-2]} puts l[gets.to_i-1]
l=[2,1] 100.times{l<<l[-1]+l[-2]} puts l[gets.to_i]
[]
1,263,523
1,263,524
u056944756
ruby
p03545
A, B, C, D = gets.split('').map(&:to_i) %w(+ -).repeated_permutation(3) do |op1, op2, op3| if A.send(op1, B.send(op2, C.send(op3, D))) == 7 puts [A, op1, B, op2, C, op3, D, '=7'].join exit end end
A, B, C, D = gets.split('').map(&:to_i) %w(+ -).repeated_permutation(3) do |op1, op2, op3| if A.send(op1, B).send(op2, C).send(op3, D) == 7 puts [A, op1, B, op2, C, op3, D, '=7'].join exit end end
[ "control_flow.branch.if.condition.change", "call.arguments.change" ]
1,263,925
1,263,926
u039293076
ruby
p03543
n = gets.chomp f = false (1..9).map{ |i| k = i * 100 + i * 10 + i if n.include?(k.to_s) puts "YES" f = true break end } if !f and n.include?("000") puts "Yes" elsif !f puts "No" end
n = gets.chomp f = false (1..9).map{ |i| k = i * 100 + i * 10 + i if n.include?(k.to_s) puts "Yes" f = true break end } if !f and n.include?("000") puts "Yes" elsif !f puts "No" end
[ "literal.string.change", "literal.string.case.change", "call.arguments.change", "io.output.change" ]
1,263,109
1,263,110
u294283114
ruby
p03543
n = gets.chomp f = false (1..9).map{ |i| k = i * 100 + i * 10 + i if n.include?(k.to_s) puts "YES" f = true break end } if !f and n.include?("000") puts "YES" elsif !f puts "NO" end
n = gets.chomp f = false (1..9).map{ |i| k = i * 100 + i * 10 + i if n.include?(k.to_s) puts "Yes" f = true break end } if !f and n.include?("000") puts "Yes" elsif !f puts "No" end
[ "literal.string.change", "literal.string.case.change", "call.arguments.change", "io.output.change" ]
1,263,111
1,263,110
u294283114
ruby
p03535
n,*a=`dd`.split.map &:to_i;a.sort!;r=0;b=[0]+n.times.map{|j|a[j]*(-1)**j%s=24};n.times{|j|(j+1..n).each{|k|s=[s,(b[j]-b[k])%24,(b[k]-b[j])%24].min}};r=[r,s].max;p r
n,*a=`dd`.split.map &:to_i;a.sort!;r=0;b=[0]+n.times.map{|j|a[j]*(-1)**j%24};s=24;n.times{|j|(j+1..n).each{|k|s=[s,(b[j]-b[k])%24,(b[k]-b[j])%24].min}};r=[r,s].max;p r
[]
1,264,148
1,264,149
u280667879
ruby
p03535
n,*a=`dd`.split.map &:to_i r=0 #(1<<n).times{|i| b=[0]+n.times.map{|j|a[j]*(-1)**j%24} s=24 (n+1).times{|j|(j+1..n).each{|k|s=[s,(b[j]-b[k])%24,(b[k]-b[j])%24].min}} r=[r,s].max #} p r
n,*a=`dd`.split.map &:to_i;a.sort! r=0 #(1<<n).times{|i| b=[0]+n.times.map{|j|a[j]*(-1)**j%24} s=24 (n+1).times{|j|(j+1..n).each{|k|s=[s,(b[j]-b[k])%24,(b[k]-b[j])%24].min}} r=[r,s].max #} p r
[]
1,264,150
1,264,151
u280667879
ruby
p03545
s = gets.chomp a = s[0].to_i b = s[1].to_i c = s[2].to_i d = s[3].to_i ans = [] ["-","+"].repeated_permutation(3).each do |x| sum = a sum += b if x[0] == "+" sum -= b if x[0] == "-" sum += c if x[1] == "+" sum -= c if x[1] == "-" sum += d if x[2] == "+" sum -= d if x[2] == "-" if sum == 7 ans << x end end str = s[0] + ans[0][0] + s[1] + ans[0][1] + s[2] + ans[0][2] + s[3] puts str
s = gets.chomp a = s[0].to_i b = s[1].to_i c = s[2].to_i d = s[3].to_i ans = [] ["-","+"].repeated_permutation(3).each do |x| sum = a sum += b if x[0] == "+" sum -= b if x[0] == "-" sum += c if x[1] == "+" sum -= c if x[1] == "-" sum += d if x[2] == "+" sum -= d if x[2] == "-" if sum == 7 ans << x end end str = s[0] + ans[0][0] + s[1] + ans[0][1] + s[2] + ans[0][2] + s[3] + "=7" puts str
[ "assignment.change" ]
1,264,402
1,264,403
u265679940
ruby
p03545
numbers = gets.chomp.chars.map(&:to_i) sum = 0 ["+", "-"].each do |op1| ["+", "-"].each do |op2| ["+", "-"].each do |op3| sum = numbers[0] if op1 == "+" sum += numbers[1] elsif op1 == "-" sum -= numbers[1] end if op2 == "+" sum += numbers[2] elsif op3 == "-" sum -= numbers[2] end if op3 == "+" sum += numbers[3] elsif op3 == "-" sum -= numbers[3] end if sum == 7 puts "#{numbers[0]}#{op1}#{numbers[1]}#{op2}#{numbers[2]}#{op3}#{numbers[3]}=7" exit end end end end
numbers = gets.chomp.chars.map(&:to_i) sum = 0 ["+", "-"].each do |op1| ["+", "-"].each do |op2| ["+", "-"].each do |op3| sum = numbers[0] if op1 == "+" sum += numbers[1] elsif op1 == "-" sum -= numbers[1] end if op2 == "+" sum += numbers[2] elsif op2 == "-" sum -= numbers[2] end if op3 == "+" sum += numbers[3] elsif op3 == "-" sum -= numbers[3] end if sum == 7 puts "#{numbers[0]}#{op1}#{numbers[1]}#{op2}#{numbers[2]}#{op3}#{numbers[3]}=7" exit end end end end
[ "identifier.change", "control_flow.branch.if.condition.change" ]
1,264,504
1,264,505
u653737129
ruby
p03545
a,b,c,d=gets.chomp.split("") x=Proc.new{(rand()>0.5)?"+":"-"} s="" (s=a+x.()+b+x.()+c+x.()+d;puts s) until eval(s)==7 puts s+"=7"
a,b,c,d=gets.chomp.split("") x=Proc.new{(rand()>0.5)?"+":"-"} s="" s=a+x.()+b+x.()+c+x.()+d until eval(s)==7 puts s+"=7"
[]
1,264,848
1,264,849
u883824971
ruby
p03545
ticket = gets.chomp.split('').map(&:to_s) ['+', '-'].repeated_permutation(3) do |bit| str = ticket.zip(bit).flatten.compact.join if eval(str) == 7 p "#{str}=7" break end end
ticket = gets.chomp.split('').map(&:to_s) ['+', '-'].repeated_permutation(3) do |bit| str = ticket.zip(bit).flatten.compact.join if eval(str) == 7 puts "#{str}=7" break end end
[ "call.function.change", "io.output.change" ]
1,265,281
1,265,282
u915238879
ruby
p03545
s = gets.chomp.to_s.split(//) ary = ["+", "-"].repeated_permutation(3).to_a sum = 0 ary.each do |x| sum += s[0].to_i 3.times do |i| if x[i] == "+" sum += s[i+1].to_i elsif x[i] == "-" sum -= s[i+1].to_i end puts sum end if sum == 7 puts s[0] + x[0] + s[1] + x[1] + s[2] + x[2] + s[3] + "=" + "7" exit else sum = 0 end end
s = gets.chomp.to_s.split(//) ary = ["+", "-"].repeated_permutation(3).to_a sum = 0 ary.each do |x| sum += s[0].to_i 3.times do |i| if x[i] == "+" sum += s[i+1].to_i elsif x[i] == "-" sum -= s[i+1].to_i end end if sum == 7 puts s[0] + x[0] + s[1] + x[1] + s[2] + x[2] + s[3] + "=" + "7" exit else sum = 0 end end
[ "call.remove" ]
1,265,119
1,265,120
u928941036
ruby
p03545
ABCD = gets.chomp str = '' (2 ** 3).times do |bit| sum = ABCD[0].to_i 3.times do |i| num = ABCD[i + 1].to_i if bit[i] == 0 num *= -1 end sum += num end if sum == 7 3.times do |i| str += "#{ABCD[i]}" if bit[i] == 0 str += '-' else str += '+' end end str += "#{ABCD[3]}=7" break end end p str
ABCD = gets.chomp str = '' (2 ** 3).times do |bit| sum = ABCD[0].to_i 3.times do |i| num = ABCD[i + 1].to_i if bit[i] == 0 num *= -1 end sum += num end if sum == 7 3.times do |i| str += "#{ABCD[i]}" if bit[i] == 0 str += '-' else str += '+' end end str += "#{ABCD[3]}=7" break end end puts str
[ "call.function.change", "io.output.change" ]
1,265,372
1,265,373
u638552534
ruby
p03545
nums = gets.split("").map(&:to_i) ["+", "-"].repeated_permutation(nums.size - 1) do |a| ans = 0 4.times do |i| if i == 0 ans = nums[i] else if a[i - 1] == "+" ans += nums[i] else ans -= nums[i] end end if ans == 7 puts "#{nums[0]}#{a[0]}#{nums[1]}#{a[1]}#{nums[2]}#{a[2]}#{nums[3]}=7" exit 0 end end end
nums = gets.split("").map(&:to_i) ["+", "-"].repeated_permutation(nums.size - 1) do |a| ans = 0 4.times do |i| if i == 0 ans = nums[i] else if a[i - 1] == "+" ans += nums[i] else ans -= nums[i] end end if i==3 && ans == 7 puts "#{nums[0]}#{a[0]}#{nums[1]}#{a[1]}#{nums[2]}#{a[2]}#{nums[3]}=7" exit 0 end end end
[ "control_flow.branch.if.condition.change" ]
1,265,384
1,265,385
u913209852
ruby
p03545
n = gets.chop a = [] n.each_char do |c| a << c.to_i end pm = [:+, :-] pm.repeated_permutation(3) {|op1, op2, op3| result = a[0].send(op1, a[1]).send(op2, a[2]).send(op2, a[3]) if result == 7 puts "#{a[0]}#{op1.to_s}#{a[1]}#{op2.to_s}#{a[2]}#{op3.to_s}#{a[3]}=7" exit end }
n = gets.chop a = [] n.each_char do |c| a << c.to_i end pm = [:+, :-] pm.repeated_permutation(3) {|op1, op2, op3| result = a[0].send(op1, a[1]).send(op2, a[2]).send(op3, a[3]) if result == 7 puts "#{a[0]}#{op1.to_s}#{a[1]}#{op2.to_s}#{a[2]}#{op3.to_s}#{a[3]}=7" exit end }
[ "assignment.value.change", "identifier.change", "call.arguments.change", "io.output.change" ]
1,265,631
1,265,635
u157887852
ruby
p03545
s = gets.chomp.chars [["+","+","+"],["+","+","-"],["+","-","+"],["+","-","-"],["-","+","+"],["-","+","-"],["-","-","+"],["-","-","-"]].each{|a| f = s[0]+a[0]+s[1]+a[1]+s[2]+a[2]+s[3] if 7 == (eval f) puts f exit end }
s = gets.chomp.chars [["+","+","+"],["+","+","-"],["+","-","+"],["+","-","-"],["-","+","+"],["-","+","-"],["-","-","+"],["-","-","-"]].each{|a| f = s[0]+a[0]+s[1]+a[1]+s[2]+a[2]+s[3] if 7 == (eval f) puts f+"=7" exit end }
[ "expression.operation.binary.add" ]
1,265,751
1,265,752
u679291177
ruby
p03545
def add_or_subtract(numbers, n) if numbers.length == 1 if numbers[0] == n return numbers[0].to_s else return false end end last = numbers[-1] candidate1 = add_or_subtract(numbers[0..(numbers.length - 2)], n - last) candidate2 = add_or_subtract(numbers[0..(numbers.length - 2)], n + last) if candidate1 return candidate1 + "+#{last.to_s}" elsif candidate2 return candidate2 + "-#{last.to_s}" else return false end end numbers = gets.chomp.split("").map(&:to_i) puts add_or_subtract(numbers, 7)
def add_or_subtract(numbers, n) if numbers.length == 1 if numbers[0] == n return numbers[0].to_s else return false end end last = numbers[-1] candidate1 = add_or_subtract(numbers[0..(numbers.length - 2)], n - last) candidate2 = add_or_subtract(numbers[0..(numbers.length - 2)], n + last) if candidate1 return candidate1 + "+#{last.to_s}" elsif candidate2 return candidate2 + "-#{last.to_s}" else return false end end numbers = gets.chomp.split("").map(&:to_i) puts add_or_subtract(numbers, 7) + "=7"
[ "expression.operation.binary.add" ]
1,266,287
1,266,288
u716067812
ruby
p03546
h, w = gets.to_s.split.map{|t|t.to_i} c = Array.new(10){ gets.to_s.split.map{|t|t.to_i} } << ( [0] * 10 ) a = Array.new(h){ gets.to_s.split.map{|t|t.to_i} }.flatten pp c 10.times do |k| 10.times do |i| 10.times do |j| c[i][j] = c[i][k] + c[k][j] if c[i][j] > c[i][k] + c[k][j] end end end ans = 0 a.each{|k| ans += c[k][1] } puts ans
h, w = gets.to_s.split.map{|t|t.to_i} c = Array.new(10){ gets.to_s.split.map{|t|t.to_i} } << ( [0] * 10 ) a = Array.new(h){ gets.to_s.split.map{|t|t.to_i} }.flatten 10.times do |k| 10.times do |i| 10.times do |j| c[i][j] = c[i][k] + c[k][j] if c[i][j] > c[i][k] + c[k][j] end end end ans = 0 a.each{|k| ans += c[k][1] } puts ans
[ "call.remove" ]
1,266,458
1,266,459
u693378622
ruby
p03545
s=gets.chomp.chars;%w(+ -).repeated_permutation(3){|_|a=s.zip(_)*'';(puts a;exit)if eval(a)==7}
s=gets.chomp.chars;%w(+ -).repeated_permutation(3){|_|a=s.zip(_)*'';(puts a+'=7';exit)if eval(a)==7}
[ "expression.operation.binary.add" ]
1,266,595
1,266,596
u280667879
ruby
p03545
pattern = gets.split('').map(&:to_i) pattern = [pattern[0]].product(*pattern[1..3].map{|x|[x, -x]}) print(pattern.map{|ary| ary + [ary.inject(:+)]}.keep_if{|ary| ary[4] == 7 }[0].map.with_index{|n, i| (i==0 ? '' : (i==4 ? '=' : (n<0 ? '-' : '+'))) + n.to_s}.join(''))
pattern = gets.split('').map(&:to_i) pattern = [pattern[0]].product(*pattern[1..3].map{|x|[x, -x]}) print(pattern.map{|ary| ary + [ary.inject(:+)]}.keep_if{|ary| ary[4] == 7 }[0].map.with_index{|n, i| (i==0 ? '' : (i==4 ? '=' : (n<0 ? '' : '+'))) + n.to_s}.join(''))
[ "literal.string.change", "call.arguments.change", "expression.operation.binary.change" ]
1,266,681
1,266,682
u054274223
ruby
p03546
h, w = gets.split.map(&:to_i) c = [] 10.times do c << gets.split.map(&:to_i) end a = [] h.times do a << gets.split.map(&:to_i) end g = Hash.new{|hash, key| hash[key] = []} 0.upto(9) do |i| 0.upto(9) do |j| g[i] << [j, c[i][j]] end end p = Array.new(10, 0) 0.upto(9) do |i| p[i] = c[i][1] end dfs = -> (seen, s, v, w) { if v == 1 p[s] = w if w < p[s] return end t = seen + [v] g[v].each do |j| next if t.include?(j[0]) next if w + j[1] > p[s] dfs.call(t, s, j[0], w + j[1]) end } 0.upto(9) do |i| next if i == 1 dfs.call([], i, i, 0) end ans = 0 a.each do |ai| ai.each do |a| ans += p[a] unless a == -1 && a == 1 end end puts ans
h, w = gets.split.map(&:to_i) c = [] 10.times do c << gets.split.map(&:to_i) end a = [] h.times do a << gets.split.map(&:to_i) end g = Hash.new{|hash, key| hash[key] = []} 0.upto(9) do |i| 0.upto(9) do |j| g[i] << [j, c[i][j]] end end p = Array.new(10, 0) 0.upto(9) do |i| p[i] = c[i][1] end dfs = -> (seen, s, v, w) { if v == 1 p[s] = w if w < p[s] return end t = seen + [v] g[v].each do |j| next if t.include?(j[0]) next if w + j[1] > p[s] dfs.call(t, s, j[0], w + j[1]) end } 0.upto(9) do |i| next if i == 1 dfs.call([], i, i, 0) end ans = 0 a.each do |ai| ai.each do |a| ans += p[a] if a != -1 && a != 1 end end puts ans
[ "misc.opposites", "expression.operator.compare.change", "expression.operation.binary.change" ]
1,266,704
1,266,705
u457499130
ruby
p03547
n = gets.chomp.split(" ") arr = n.sort if n.uniq.size == 1 puts "=" elsif arr.join("") == n.join("") puts ">" else puts "<" end
n = gets.chomp.split(" ") arr = n.sort if n.uniq.size == 1 puts "=" elsif arr.join("") == n.join("") puts "<" else puts ">" end
[ "call.remove", "call.add" ]
1,267,000
1,267,001
u412789323
ruby
p03547
x, y = gets.chomp.split(" ").map(&:ord) if x < y answer = "<" elsif answer = ">" else answer = "=" end puts answer
x, y = gets.chomp.split(" ").map(&:ord) if x < y answer = "<" elsif x > y answer = ">" else answer = "=" end puts answer
[ "control_flow.branch.if.condition.change" ]
1,267,345
1,267,346
u333374716
ruby
p03547
t=get.join; if t[0]==t[1] puts '=' elsif t==t.sort puts '<' else puts '>' end
t=gets.split; if t[0]==t[1] puts '=' elsif t==t.sort puts '<' else puts '>' end
[ "assignment.value.change", "identifier.change" ]
1,267,400
1,267,401
u050914494
ruby
p03548
x, y, z = gets.split(" ").map(&:to_i) a = x - 1 b = y + z i = 0 while a - b >= 0 a -= b i += 1 end puts i
x, y, z = gets.split(" ").map(&:to_i) a = x - z b = y + z i = 0 while a - b >= 0 a -= b i += 1 end puts i
[ "assignment.value.change", "identifier.replace.add", "literal.replace.remove", "expression.operation.binary.change" ]
1,268,243
1,268,244
u928941036
ruby
p03548
X,Y,Z = gets.to_i answer = (X-Z) / (Y+Z) puts (X-Z) / (Y+Z)
X,Y,Z = gets.split.map(&:to_i) answer = (X-Z) / (Y+Z) puts (X-Z) / (Y+Z)
[ "assignment.value.change", "identifier.change", "call.add" ]
1,268,459
1,268,460
u151483411
ruby
p03548
x,y,z=gets.split.map &:to_i;p (x-1)/(y+z)
x,y,z=gets.split.map &:to_i;p (x-z)/(y+z)
[ "identifier.replace.add", "literal.replace.remove", "call.arguments.change", "expression.operation.binary.change" ]
1,268,701
1,268,702
u510556034
ruby
p03549
N, M = gets.split.map(&:to_i) ans = 0 1.upto(Float::INFINITY) do |i| last_pb = 0.5**M rest_pb = 1 - last_pb pb = (rest_pb ** (i-1)) * last_pb break if pb == 0 time = ((N-M)*100 + M*1900) * i #p i: i, pb: pb, time: time ans += pb * time end p ans.ceil
N, M = gets.split.map(&:to_i) ans = 0 1.upto(Float::INFINITY) do |i| last_pb = 0.5**M rest_pb = 1 - last_pb pb = (rest_pb ** (i-1)) * last_pb break if pb == 0 time = ((N-M)*100 + M*1900) * i #p i: i, pb: pb, time: time ans += pb * time end p ans.round
[ "identifier.change", "call.arguments.change" ]
1,269,092
1,269,093
u437302815
ruby
p03549
a=[] a=gets.chomp.to_i puts (1900*a[1]+100*(a[0]-a[1]))*2**a[1]
a = [] a = gets.split.map(&:to_i) #p a puts (1900*a[1]+100*(a[0]-a[1]))*2**a[1]
[ "assignment.value.change", "identifier.change", "call.arguments.add" ]
1,269,258
1,269,259
u614043796
ruby
p03550
if ARGV[0]=="LOCAL_DEV" define_method("debug") do |var| p var end else define_method("debug") do end end N,Z,W = STDIN.gets.strip.split.map(&:to_i) a = STDIN.gets.strip.split.map(&:to_i) debug(a) puts [(W-a[N-1]).abs , (a[N-2]-a[N-1]).abs].max
if ARGV[0]=="LOCAL_DEV" define_method("debug") do |var| p var end else define_method("debug") do |var| end end N, Z, W = STDIN.gets.strip.split.map(&:to_i) a = STDIN.gets.strip.split.map(&:to_i) debug a puts [(W-a[N-1]).abs , (a[N-2]-a[N-1]).abs].max
[ "call.arguments.change" ]
1,269,392
1,269,393
u061071198
ruby
p03550
if ARGV[0]=="LOCAL_DEV" define_method("debug") do |var| p var end else define_method("debug") do end end N,Z,W = STDIN.gets.strip.split.map(&:to_i) a = STDIN.gets.strip.split.map(&:to_i) debug(a) puts [(W-a[N-1]).abs , (a[N-2]-a[N-1]).abs].max
if ARGV[0]=="LOCAL_DEV" define_method("debug") do |var| p var end else define_method("debug") do |var| end end N,Z,W = STDIN.gets.strip.split.map(&:to_i) a = STDIN.gets.strip.split.map(&:to_i) debug(a) puts [(W-a[N-1]).abs , (a[N-2]-a[N-1]).abs].max
[]
1,269,392
1,269,394
u061071198
ruby
p03550
n,z,w,*a=`dd`.split.map &:to_i p [(a[-1]-w).abs,((a[-2]||0)-a[-1]).abs].max
n,z,w,*a=`dd`.split.map &:to_i;p [(a[-1]-w).abs,((a[-2]||a[-1])-a[-1]).abs].max
[ "identifier.replace.add", "literal.replace.remove", "call.arguments.change", "expression.operation.binary.change" ]
1,269,848
1,269,849
u280667879
ruby
p03547
a,b,c=gets.chars;$><<[?<,?>,?=][a<=>c]
a,b,c=gets.chars;$><<[?=,?>,?<][a<=>c]
[ "expression.operation.binary.change" ]
1,270,068
1,270,069
u598016178
ruby
p03547
a,b=gets.split;puts '=<>'[a<=>b]
a,b=gets.split;puts'=><'[a<=>b]
[ "literal.string.change", "call.arguments.change" ]
1,270,079
1,270,080
u280667879
ruby
p03555
lines = [] while line = gets lines << line.chomp.to_s end c=lines[1].reverse puts lines[0]==c ? "Yes":" No"
lines = [] while line = gets lines << line.chomp.to_s end c=lines[1].reverse puts lines[0]==c ? "YES":" NO"
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
1,270,448
1,270,449
u590472228
ruby
p03555
c1 = gets.chomp c2 = gets.chomp if c1[0] == c2[2] && c1[1] == c2[2] && c1[2] == c2[0] puts "YES" else puts "NO" end
c1 = gets.chomp c2 = gets.chomp if c1[0] == c2[2] && c1[1] == c2[1] && c1[2] == c2[0] puts "YES" else puts "NO" end
[ "literal.number.integer.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change" ]
1,270,761
1,270,762
u744908753
ruby
p03555
a=gets.chomp b=gets.chomp puts a[2]==b[0] && a[1]==b[1] && a[0]==b[0] ? "YES" : "NO"
a=gets b=gets puts a[2]==b[0] && a[1]==b[1] && a[0]==b[2] ? "YES" : "NO"
[ "call.remove", "literal.number.integer.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change" ]
1,270,908
1,270,909
u585819925
ruby
p03555
ca = gets.chomp cb = gets.chomp puts ca == cb.reverse ? "Yes" : "No"
ca = gets.chomp cb = gets.chomp puts ca == cb.reverse ? "YES" : "NO"
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
1,270,997
1,270,998
u262994359
ruby
p03555
puts gets.chomp == gets.chomp.reverse ? 'Yes' : 'No'
puts gets.chomp == gets.chomp.reverse ? 'YES' : 'NO'
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
1,271,130
1,271,131
u434509016
ruby
p03555
puts gets.chomp == gets.chomp.reverse ? 'Yes' : 'No'
puts gets.chomp == gets.chomp.reverse ? 'YES' : 'NO'
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
1,271,235
1,271,236
u124214522
ruby
p03555
puts gets==gets.reverse ? :YES : :NO
puts gets.chop==gets.chop.reverse ? :YES: :NO
[ "control_flow.branch.if.condition.change", "call.add" ]
1,271,352
1,271,353
u510556034
ruby
p03555
puts gets==gets.reverse ? :YES : :NO
puts gets.chomp==gets.chomp.reverse ? :YES : :NO
[ "control_flow.branch.if.condition.change", "call.add" ]
1,271,352
1,271,354
u510556034
ruby
p03555
s1, s2 = gets.split puts s1 == s2.reverse ? "YES" : "NO"
s1 = gets.chomp s2 = gets.chomp puts s1 == s2.reverse ? "YES" : "NO"
[ "call.add", "assignment.value.change", "identifier.change" ]
1,271,375
1,271,376
u982342746
ruby
p03555
puts gets.reverse == gets ? "YES" : "NO"
puts gets.chomp.reverse == gets.chomp ? "YES" : "NO"
[ "control_flow.branch.if.condition.change", "call.add" ]
1,271,377
1,271,378
u534173972
ruby
p03555
C1 = gets.chomp C2 = gets.chomp p C1 == C2.reverse ? 'YES' : 'NO'
C1 = gets.chomp C2 = gets.chomp puts C1 == C2.reverse ? 'YES' : 'NO'
[ "call.function.change", "io.output.change" ]
1,271,432
1,271,433
u998238691
ruby
p03555
puts gets.chop==gets.reverse ? :YES: :NO
puts gets.chop==gets.chop.reverse ? :YES: :NO
[ "control_flow.branch.if.condition.change", "call.add" ]
1,271,447
1,271,448
u598016178
ruby
p03555
a=$<.map{|e|e.chomp.chars} puts a==a.reverse.transpose ? :YES : :NO
a=$<.map{|e|e.chomp.chars};puts a==a.reverse.map(&:reverse) ? :YES : :NO
[ "identifier.change", "control_flow.branch.if.condition.change", "call.arguments.add" ]
1,271,469
1,271,470
u280667879
ruby
p03555
input = line.gets.chomp input2 = line.gets.chomp if input == input2.reverse puts "YES" else puts "NO" end
input = gets.chomp input2 = gets.chomp if input == input2.reverse puts "YES" else puts "NO" end
[ "call.remove" ]
1,271,487
1,271,488
u179428857
ruby
p03555
c = Array.new(2) c[0] = gets.chomp.split("") c[1] = gets.chomp.split("") 3.times do |i| if c[0][i] != c[1][2-i] puts "No" exit end end puts "Yes"
c = Array.new(2) c[0] = gets.chomp.split("") c[1] = gets.chomp.split("") 3.times do |i| if c[0][i] != c[1][2-i] puts "NO" exit end end puts "YES"
[ "literal.string.change", "literal.string.case.change", "call.arguments.change", "io.output.change" ]
1,271,605
1,271,606
u868089307
ruby
p03555
a = gets.chomp b = gets.chomp puts a.reverse == b ? 'Yes' : 'No'
a = gets.chomp b = gets.chomp puts a.reverse == b ? 'YES' : 'NO'
[ "literal.string.change", "literal.string.case.change", "call.arguments.change" ]
1,271,646
1,271,647
u987869509
ruby