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
p03264
n=gets.to_i puts n/2*(n+1)/2
n=gets.to_i puts (n/2)*((n+1)/2)
[ "call.arguments.change" ]
1,050,220
1,050,221
u977506075
ruby
p03264
k = gets.chomp.to_i puts ((k/2).ceil * (k/2).floor)
k = gets.chomp.to_i puts ((k/2.0).ceil * (k/2.0).floor)
[ "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
1,050,286
1,050,287
u792512290
ruby
p03264
k=gets.to_i t=k/2 p k.odd?? t**2: t**2
k=gets.to_i t=k/2 p k.odd?? t**2+t: t**2
[ "expression.operation.binary.add" ]
1,050,655
1,050,656
u408023666
ruby
p03264
k = gets.to_i if k % 2 == 0 puts k/2 * k/2 else puts k/2 * (k*2+1) end
k = gets.to_i if k % 2 == 0 puts k/2 * k/2 else puts k/2 * (k/2+1) end
[ "expression.operator.arithmetic.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
1,050,853
1,050,854
u622469330
ruby
p03264
a=gets.to_i if a%2==0 then puts a/2**2 else puts a/2*(a/2+1) end
a=gets.to_i if a%2==0 then puts (a/2)**2 else puts a/2*(a/2+1) end
[ "call.arguments.change" ]
1,051,187
1,051,188
u562148988
ruby
p03264
k = gets.to_i if k%2==0 answer = (k/2)**2 else answer = ((k-1)/2)*((k-1)/2) end puts answer
k = gets.to_i if k%2==0 answer = (k/2)**2 else answer = ((k+1)/2)*((k-1)/2) end puts answer
[ "misc.opposites", "expression.operator.arithmetic.change", "assignment.value.change", "expression.operation.binary.change" ]
1,051,205
1,051,206
u257354345
ruby
p03264
tmp=gets.chomp.to_i;puts "#{tmp/2*tmp/2+tmp%2}"
tmp=gets.chomp.to_i;puts "#{tmp/2*(tmp/2+tmp%2)}"
[ "literal.string.change", "call.arguments.change" ]
1,051,342
1,051,343
u415591191
ruby
p03264
a = gets.to_i p a.even? ? (a / 2)**2 : (a/2)*((a-1)/2)
a = gets.to_i p a.even? ? (a / 2)**2 : ((a+1)/2)*((a-1)/2)
[ "call.arguments.change" ]
1,051,414
1,051,415
u436025245
ruby
p03264
a = gets.to_i a.even? ? (a / 2)**2 : (a/2)*((a-1)/2)
a = gets.to_i p a.even? ? (a / 2)**2 : ((a+1)/2)*((a-1)/2)
[ "io.output.change", "call.add", "call.arguments.change" ]
1,051,416
1,051,415
u436025245
ruby
p03262
N,X = STDIN.gets.split.map(&:to_i) x = STDIN.gets.split.map(&:to_i).map{|i| i - X} puts x.reduce(x[0]){|a, b| gcd(a, b)}
N,X = STDIN.gets.split.map(&:to_i) x = STDIN.gets.split.map(&:to_i).map{|i| i - X} puts x.reduce(x[0]){|a, b| a.gcd(b)}.abs
[ "call.add", "call.arguments.change" ]
1,051,531
1,051,532
u526365096
ruby
p03262
def gcd(a,b) a,b = b,a%b while b > 0 a end N,X = STDIN.gets.split.map(&:to_i) x = STDIN.gets.split.map(&:to_i).map{|i| i - X} p x puts x.reduce(x[0]){|a, b| gcd(a.abs, b.abs)}.abs
def gcd(a,b) a,b = b,a%b while b > 0 a end N,X = STDIN.gets.split.map(&:to_i) x = STDIN.gets.split.map(&:to_i).map{|i| i - X} puts x.reduce(x[0]){|a, b| gcd(a.abs, b.abs)}.abs
[ "call.remove" ]
1,051,533
1,051,534
u526365096
ruby
p03262
def gcd(a,b) a,b = b,a%b while b > 0 a end N,X = STDIN.gets.split.map(&:to_i) x = STDIN.gets.split.map(&:to_i).map{|i| i - X} puts x.reduce(x[0]){|a, b| gcd(a, b)}.abs
def gcd(a,b) a,b = b,a%b while b > 0 a end N,X = STDIN.gets.split.map(&:to_i) x = STDIN.gets.split.map(&:to_i).map{|i| i - X} puts x.reduce(x[0]){|a, b| gcd(a.abs, b.abs)}.abs
[ "call.add" ]
1,051,535
1,051,534
u526365096
ruby
p03262
def gcd(a,b) a,b = b,a%b while b > 0 a end N,X = STDIN.gets.split.map(&:to_i) x = STDIN.gets.split.map(&:to_i).map{|i| i - X} puts x.reduce(x[0]){|a, b| gcd(a, b)}
def gcd(a,b) a,b = b,a%b while b > 0 a end N,X = STDIN.gets.split.map(&:to_i) x = STDIN.gets.split.map(&:to_i).map{|i| i - X} puts x.reduce(x[0]){|a, b| gcd(a.abs, b.abs)}.abs
[ "call.add" ]
1,051,536
1,051,534
u526365096
ruby
p03262
n,x = gets.split(' ') y = [] y = gets.split(' ').map(&:to_i) common_deviser = [] y.each do |i| common_deviser << (i - x.to_i).abs end puts common_deviser.min
n,x = gets.split(' ') y = [] y = gets.split(' ').map(&:to_i) common_deviser = [] y.each do |i| common_deviser << (i - x.to_i).abs end puts common_deviser.inject(:gcd)
[ "identifier.change", "call.arguments.change", "io.output.change", "call.arguments.add" ]
1,051,581
1,051,582
u546441021
ruby
p03265
require 'pp' x1, y1, x2, y2 = gets.split.map(&:to_i) # 3-2 # / # 4-1 if x1 <= x2 && y1 <= y2 x3 = x2 - (y2 - y1) y3 = y2 + (x2 - x1) x4 = x1 - (y2 - y1) y4 = y1 + (x2 - x1) end # 4-3 # / # 1-2 if x1 <= x2 && y2 <= y1 x3 = x2 + (y1 - y2) y3 = y2 + (x2 - x1) x4 = x1 + (y1 - y2) y4 = y1 + (x2 - x1) end # 1-4 # / # 2-3 if x2 <= x1 && y2 <= y1 x3 = x2 * (y1 - y2) y3 = y2 - (x1 - x2) x4 = x1 + (y1 - y2) y4 = y1 - (x1 - x2) end # 2-1 # / # 3-4 if x2 <= x1 && y1 <= y2 x3 = x2 - (y2 - y1) y3 = y2 - (x1 - x2) x4 = x1 - (y2 - y1) y4 = y1 - (x1 - x2) end puts [x3,y3,x4,y4].join(' ')
require 'pp' x1, y1, x2, y2 = gets.split.map(&:to_i) # 3-2 # / # 4-1 if x1 <= x2 && y1 <= y2 x3 = x2 - (y2 - y1) y3 = y2 + (x2 - x1) x4 = x1 - (y2 - y1) y4 = y1 + (x2 - x1) end # 4-3 # / # 1-2 if x1 <= x2 && y2 <= y1 x3 = x2 + (y1 - y2) y3 = y2 + (x2 - x1) x4 = x1 + (y1 - y2) y4 = y1 + (x2 - x1) end # 1-4 # / # 2-3 if x2 <= x1 && y2 <= y1 x3 = x2 + (y1 - y2) y3 = y2 - (x1 - x2) x4 = x1 + (y1 - y2) y4 = y1 - (x1 - x2) end # 2-1 # / # 3-4 if x2 <= x1 && y1 <= y2 x3 = x2 - (y2 - y1) y3 = y2 - (x1 - x2) x4 = x1 - (y2 - y1) y4 = y1 - (x1 - x2) end puts [x3,y3,x4,y4].join(' ')
[ "expression.operator.arithmetic.change", "assignment.value.change", "expression.operation.binary.change" ]
1,051,715
1,051,716
u315597999
ruby
p03266
n,k=gets.split.map &:to_i ans=0 ans1=0 if k%2==0 (1..n).to_a.each{|i| ans+=1 if i%k==0 ans1+=1 if i%k == k/2 } ans=ans**3 + ans1**3 else (1..n).to_a.each{|i| ans+=1 if i%k==0 ans=ans**3 } end puts ans
n,k=gets.split.map &:to_i ans=0 ans1=0 if k%2==0 (1..n).to_a.each{|i| ans+=1 if i%k==0 ans1+=1 if i%k == k/2 } ans=ans**3 + ans1**3 else (1..n).to_a.each{|i| ans+=1 if i%k==0 } ans=ans**3 end puts ans
[]
1,052,295
1,052,296
u977506075
ruby
p03265
x1, y1, x2, y2 = STDIN.read.split(' ').map(&:to_i) dx = (x2 - x1).abs dy = (y2 - y1).abs if x1 == x2 && y1 < y2 # 右下、右上パターン x3 = x2 - (y2 - y1).abs y3 = y2 x4 = x3 y4 = y1 elsif x1 > x2 && y1 == y2 # 右上、左上パターン x3 = x2 y3 = y2 - (x1 - x2).abs x4 = x1 y4 = y3 elsif x1 == x2 && y1 > y2 # 左上、左下パターン x3 = x2 - (y1 - y2).abs y3 = y2 x4 = x3 y4 = y1 elsif x1 < x2 && y1 == y2 # 左下、右下パターン x3 = x2 y3 = y2 + (x2 - x1) x4 = x1 y4 = y3 elsif x1 < x2 && y1 < y2 x3 = x2 - dy y3 = y2 + dx x4 = x3 - dx y4 = y3 - dy elsif x1 > x2 && y1 < y2 x3 = x2 - dy y3 = y2 - dx x4 = x3 + dx y4 = y3 - dy elsif x1 < x2 && y1 > y2 x3 = x2 + dy y3 = y2 - dx x4 = x3 + dx y4 = y3 + dy else x3 = x2 + dy y3 = y2 + dx x4 = x3 - dx y4 = y3 + dy end puts "#{x3} #{y3} #{x4} #{y4}"
x1, y1, x2, y2 = STDIN.read.split(' ').map(&:to_i) dx = (x2 - x1).abs dy = (y2 - y1).abs if x1 == x2 && y1 < y2 # 右下、右上パターン x3 = x2 - (y2 - y1).abs y3 = y2 x4 = x3 y4 = y1 elsif x1 > x2 && y1 == y2 # 右上、左上パターン x3 = x2 y3 = y2 - (x1 - x2).abs x4 = x1 y4 = y3 elsif x1 == x2 && y1 > y2 # 左上、左下パターン x3 = x2 + (y1 - y2).abs y3 = y2 x4 = x3 y4 = y1 elsif x1 < x2 && y1 == y2 # 左下、右下パターン x3 = x2 y3 = y2 + (x2 - x1).abs x4 = x1 y4 = y3 elsif x1 < x2 && y1 < y2 x3 = x2 - dy y3 = y2 + dx x4 = x3 - dx y4 = y3 - dy elsif x1 > x2 && y1 < y2 x3 = x2 - dy y3 = y2 - dx x4 = x3 + dx y4 = y3 - dy elsif x1 > x2 && y1 > y2 x3 = x2 + dy y3 = y2 - dx x4 = x3 + dx y4 = y3 + dy else x3 = x2 + dy y3 = y2 + dx x4 = x3 - dx y4 = y3 + dy end puts "#{x3} #{y3} #{x4} #{y4}"
[ "misc.opposites", "expression.operator.arithmetic.change", "assignment.value.change", "expression.operation.binary.change", "call.add", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
1,053,864
1,053,863
u369152052
ruby
p03266
n,k=gets.split.map(&:to_i) c=0 if k%2==1 then p (n/k)**3 else p (n/k)**3+(n/k+1)**3 end
n,k=gets.split.map(&:to_i) c=0 if k%2==1 then p (n/k)**3 else p (n/k)**3+((n-k/2)/k+1)**3 end
[ "call.arguments.change" ]
1,054,008
1,054,009
u656771711
ruby
p03268
n,k = gets.split.map(&:to_i) cnt = Array.new(n, 0) 1.upto(n) do |i| cnt[i % k] += 1 end ans = 0 k.times do |i| a = i b = (k - a) % k c = (k - a) % k next unless (b + c) % k == 0 ans += cnt[a] * cnt[b] * cnt[c] end puts ans
n,k = gets.split.map(&:to_i) cnt = Array.new(k, 0) 1.upto(n) do |i| cnt[i % k] += 1 end ans = 0 k.times do |i| a = i b = (k - a) % k c = (k - a) % k next unless (b + c) % k == 0 ans += cnt[a] * cnt[b] * cnt[c] end puts ans
[ "assignment.value.change", "identifier.change", "call.arguments.change" ]
1,054,237
1,054,238
u392423112
ruby
p03268
n, k = gets.split.map(&:to_i) z = Array.new(n + 1, 0) 1.upto(n) do |i| z[i % k] += 1 end ans = 0 k.times do |a| b = (k - a) % k c = (k - a) % k ans += z[a] * z[b] * z[c] if (b + c) % k == 0 end puts ans
n, k = gets.split.map(&:to_i) z = Array.new(k + 1, 0) 1.upto(n) do |i| z[i % k] += 1 end ans = 0 k.times do |a| b = (k - a) % k c = (k - a) % k ans += z[a] * z[b] * z[c] if (b + c) % k == 0 end puts ans
[ "assignment.value.change", "identifier.change", "call.arguments.change", "expression.operation.binary.change" ]
1,054,255
1,054,256
u979552932
ruby
p03266
n, k = gets.split.map(&:to_i) ans = n/k if k%2 == 0 tmp = n.quo(k).ceil ans = ans**3 + tmp**3 else ans = ans**3 end puts ans
n, k = gets.split.map(&:to_i) ans = n/k if k%2 == 0 tmp = n.quo(k).round ans = ans**3 + tmp**3 else ans = ans**3 end puts ans
[ "assignment.value.change", "identifier.change" ]
1,054,608
1,054,609
u707879795
ruby
p03272
n, i = f.gets.split.map(&:to_i) puts n - i + 1
n, i = gets.split.map(&:to_i) puts n - i + 1
[ "call.remove" ]
1,056,097
1,056,098
u866325115
ruby
p03272
puts gets.strip.map(&:to_i).inject(:-) + 1
puts gets.strip.split.map(&:to_i).inject(:-) + 1
[ "call.add" ]
1,056,139
1,056,140
u707614029
ruby
p03272
N,i = gets.split.map(&:to_i) pus(N-i+1)
N,i = gets.split.map(&:to_i) puts(N-i+1)
[ "identifier.change" ]
1,056,220
1,056,221
u241469130
ruby
p03272
a=gets.split(" ").map{|b|b.to_i};p w[0]-w[1]+1
a=gets.split(" ").map{|b|b.to_i};p a[0]-a[1]+1
[ "identifier.change", "call.arguments.change", "expression.operation.binary.change" ]
1,056,345
1,056,347
u335619873
ruby
p03272
a=gets.split(" ").map{|b|b.to_i};p w[0]-w[1]+1
a=gets.split(" ").map{|b| b.to_i};p a[0]-a[1]+1
[ "identifier.change", "call.arguments.change", "expression.operation.binary.change" ]
1,056,345
1,056,348
u335619873
ruby
p03272
# Here your code ! n,m = gets.chomp.split.map(&:to_i) puts n
n,m = gets.chomp.split.map(&:to_i) puts n - m + 1
[ "expression.operation.binary.add" ]
1,056,374
1,056,375
u334929552
ruby
p03273
h, w = gets.split.map(&:to_i) hs = [] h.times{ hs << gets.chomp.split("") } def del_same_line(target_ary) target_ary.reject{|e| e.all?('.') }.transpose end del_same_line(del_same_line(hs)).each{|e| puts e.inject(:+)}
h, w = gets.split.map(&:to_i) hs = [] h.times{ hs << gets.chomp.split("") } def del_same_line(target_ary) target_ary.reject{|e| !e.include?('#') }.transpose end del_same_line(del_same_line(hs)).each{|e| puts e.inject(:+)}
[ "expression.operation.unary.add", "identifier.change", "literal.string.change", "call.arguments.change" ]
1,057,037
1,057,038
u069429049
ruby
p03273
H,W=gets.split.map &:to_i a=$<.map &:chomp h=(0...H).select{|h|a[h].chars.any{|c|c=='#'}} w=(0...W).select{|w|(0...H).any?{|k|a[k][w]=='#'}} h.each{|i|w.each{|j|print a[i][j]};puts}
H,W=gets.split.map &:to_i a=$<.map &:chomp h=(0...H).select{|h|a[h].chars.any?{|c|c=='#'}} w=(0...W).select{|w|(0...H).any?{|k|a[k][w]=='#'}} h.each{|i|w.each{|j|print a[i][j]};puts}
[ "assignment.value.change", "identifier.change" ]
1,057,406
1,057,407
u280667879
ruby
p03274
n,k = gets.chomp.split(" ").map(&:to_i) x_arr = gets.chomp.split(" ").map(&:to_i) min = (10 ** 8) * 2 (0..(n - k)).each do |i| left = x_arr[i] right = x_arr[k - 1 + i] if left <= 0 && right <= 0 d = left.abs elsif left >= 0 && right >= 0 d = right.abs elsif left.abs > right.abs d = right.abs * 2 + left.abs else d = left.abs * 2 + right.abs end min = d if d < min end puts min
n,k = gets.chomp.split(" ").map(&:to_i) x_arr = gets.chomp.split(" ").map(&:to_i) # -10 ** 8 から 10 ** 8 の間を移動するのが最長 min = (10 ** 8) * 3 (0..(n - k)).each do |i| left = x_arr[i] right = x_arr[k - 1 + i] if left < 0 && right < 0 # 0 -> left とたどる d = left.abs elsif left > 0 && right > 0 # 0 -> right とたどる d = right.abs elsif left.abs > right.abs # 0 -> right -> 0 -> left とたどる d = right.abs * 2 + left.abs else # 0 -> left -> 0 -> right とたどる d = left.abs * 2 + right.abs end min = d if d < min end puts min
[ "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.change", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
1,057,803
1,057,804
u257668305
ruby
p03274
n,k = gets.chomp.split(" ").map(&:to_i) x_arr = gets.chomp.split(" ").map(&:to_i) min = (10 ** 8) * 2 (0..(n - k)).each do |i| left = x_arr[i] right = x_arr[k - 1 + i] if left < 0 && right < 0 d = left.abs elsif left >= 0 && right >= 0 d = right.abs elsif left.abs > right.abs d = right.abs * 2 + left.abs else d = left.abs * 2 + right.abs end min = d if d < min end puts min
n,k = gets.chomp.split(" ").map(&:to_i) x_arr = gets.chomp.split(" ").map(&:to_i) # -10 ** 8 から 10 ** 8 の間を移動するのが最長 min = (10 ** 8) * 3 (0..(n - k)).each do |i| left = x_arr[i] right = x_arr[k - 1 + i] if left < 0 && right < 0 # 0 -> left とたどる d = left.abs elsif left > 0 && right > 0 # 0 -> right とたどる d = right.abs elsif left.abs > right.abs # 0 -> right -> 0 -> left とたどる d = right.abs * 2 + left.abs else # 0 -> left -> 0 -> right とたどる d = left.abs * 2 + right.abs end min = d if d < min end puts min
[ "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.change", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
1,057,805
1,057,804
u257668305
ruby
p03274
n,k = gets.chomp.split(" ").map(&:to_i) x_arr = gets.chomp.split(" ").map(&:to_i) min = (10 ** 8) * 2 (0..(n - k)).each do |i| left = x_arr[i] right = x_arr[k - 1 + i] if left <= 0 && right <= 0 d = left.abs elsif left >= 0 && right >= 0 d = right.abs elsif left.abs > right.abs d = right.abs * 2 + left.abs else d = left.abs * 2 + right.abs end min = d if d < min end puts min
n,k = gets.chomp.split(" ").map(&:to_i) x_arr = gets.chomp.split(" ").map(&:to_i) min = (10 ** 8) * 3 (0..(n - k)).each do |i| left = x_arr[i] right = x_arr[k - 1 + i] if left <= 0 && right <= 0 d = left.abs elsif left >= 0 && right >= 0 d = right.abs elsif left.abs > right.abs d = right.abs * 2 + left.abs else d = left.abs * 2 + right.abs end min = d if d < min end puts min
[ "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.change" ]
1,057,803
1,057,806
u257668305
ruby
p03274
n,k = gets.chomp.split(" ").map(&:to_i) x_arr = gets.chomp.split(" ").map(&:to_i) min = (10 ** 8) * 2 (0..(n - k)).each do |i| left = x_arr[i] right = x_arr[k - 1 + i] if left < 0 && right < 0 d = left.abs elsif left >= 0 && right >= 0 d = right.abs elsif left.abs > right.abs d = right.abs * 2 + left.abs else d = left.abs * 2 + right.abs end min = d if d < min end puts min
n,k = gets.chomp.split(" ").map(&:to_i) x_arr = gets.chomp.split(" ").map(&:to_i) min = (10 ** 8) * 3 (0..(n - k)).each do |i| left = x_arr[i] right = x_arr[k - 1 + i] if left <= 0 && right <= 0 d = left.abs elsif left >= 0 && right >= 0 d = right.abs elsif left.abs > right.abs d = right.abs * 2 + left.abs else d = left.abs * 2 + right.abs end min = d if d < min end puts min
[ "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.change", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
1,057,805
1,057,806
u257668305
ruby
p03274
n,k = gets.chomp.split(" ").map(&:to_i) x_arr = gets.chomp.split(" ").map(&:to_i) min = (10 ** 8) * 2 (0..(n - k)).each do |i| left = x_arr[i] right = x_arr[k - 1 + i] d1 = left.abs + (right - left).abs d2 = right.abs + (right - left).abs d = d1 < d2 ? d1 : d2 min = d if d < min end puts min
n,k = gets.chomp.split(" ").map(&:to_i) x_arr = gets.chomp.split(" ").map(&:to_i) min = (10 ** 9) (0..(n - k)).each do |i| left = x_arr[i] right = x_arr[k - 1 + i] d1 = left.abs + (right - left).abs d2 = right.abs + (right - left).abs d = d1 < d2 ? d1 : d2 min = d if d < min end puts min
[ "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.change", "expression.operation.binary.remove" ]
1,057,807
1,057,808
u257668305
ruby
p03274
n, k = gets.split.map(&:to_i) xs = gets.split.map(&:to_i) ans = 2 * 10**8 (n - k + 1).times do |i| xl = xs[i] xr = xs[i + k - 1] lr = xl.abs + (xr - xl).abs rl = xr.abs + (xl - xr).abs t = [lr, rl].min ans = t if t <= ans end puts ans
n, k = gets.split.map(&:to_i) xs = gets.split.map(&:to_i) ans = 10**18 (n - k + 1).times do |i| xl = xs[i] xr = xs[i + k - 1] lr = xl.abs + (xr - xl).abs rl = xr.abs + (xl - xr).abs t = [lr, rl].min ans = t if t <= ans end puts ans
[ "expression.operation.binary.remove", "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.change" ]
1,058,030
1,058,031
u889326464
ruby
p03274
n, k = gets.split.map(&:to_i) xs = gets.split.map(&:to_i) ans = 10**5 (n - k + 1).times do |i| xl = xs[i] xr = xs[i + k - 1] lr = xl.abs + (xr - xl).abs rl = xr.abs + (xl - xr).abs t = [lr, rl].min ans = t if t <= ans end puts ans
n, k = gets.split.map(&:to_i) xs = gets.split.map(&:to_i) ans = 10**18 (n - k + 1).times do |i| xl = xs[i] xr = xs[i + k - 1] lr = xl.abs + (xr - xl).abs rl = xr.abs + (xl - xr).abs t = [lr, rl].min ans = t if t <= ans end puts ans
[ "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.change" ]
1,058,032
1,058,031
u889326464
ruby
p03274
n, k = gets.split.map(&:to_i) xs = gets.split.map(&:to_i) ans = 10**8 (n - k + 1).times do |i| xl = xs[i] xr = xs[i + k - 1] lr = xl.abs + (xr - xl).abs rl = xr.abs + (xl - xr).abs t = [lr, rl].min ans = t if t <= ans end puts ans
n, k = gets.split.map(&:to_i) xs = gets.split.map(&:to_i) ans = 10**18 (n - k + 1).times do |i| xl = xs[i] xr = xs[i + k - 1] lr = xl.abs + (xr - xl).abs rl = xr.abs + (xl - xr).abs t = [lr, rl].min ans = t if t <= ans end puts ans
[ "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.change" ]
1,058,033
1,058,031
u889326464
ruby
p03274
n, k = gets.split.map(&:to_i) x = gets.split.map(&:to_i) ans = 10 ** 9 (k - 1).upto(n - 1) do |i| if x[i] <= 0 d = x[i - k + 1] elsif x[i - k + 1] >= 0 d = x[i] else d = x[i] - x[i - k + 1] +(x[i] < -x[i - k + 1] ? x[i] : -x[i - k + 1]) end ans = d if ans > d end puts ans
n, k = gets.split.map(&:to_i) x = gets.split.map(&:to_i) ans = 10 ** 9 (k - 1).upto(n - 1) do |i| if x[i] <= 0 d = -x[i - k + 1] elsif x[i - k + 1] >= 0 d = x[i] else d = x[i] - x[i - k + 1] + (x[i] < -x[i - k + 1] ? x[i] : -x[i - k + 1]) end ans = d if ans > d end puts ans
[ "expression.operation.unary.add" ]
1,058,057
1,058,058
u692254521
ruby
p03274
n, k = gets.chop.split.map(&:to_i) x = gets.chop.split.map(&:to_i) ans = 10**7 (n-k+1).times do |i| # 右端からいくパターン 左端からパターンがある r = x[i+k-1] l = x[i] r_dist = (r-l).abs + r.abs l_dist = (l-r).abs + l.abs ans =[r_dist,l_dist, ans].min end p ans
n, k = gets.chop.split.map(&:to_i) x = gets.chop.split.map(&:to_i) ans = 10**10 (n-k+1).times do |i| # 右端からいくパターン 左端からパターンがある r = x[i+k-1] l = x[i] r_dist = (r-l).abs + r.abs l_dist = (l-r).abs + l.abs ans =[r_dist,l_dist, ans].min end p ans
[ "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.change" ]
1,058,249
1,058,250
u157887852
ruby
p03274
n,k=gets.split.map(&:to_i) x=gets.split.map(&:to_i) s=x[k-1]-x[0] ans=s+((x[0].abs<x[k-1].abs)?x[0]:x[k-1]) (k..(n-1)).each{|i| f=i-k+1 t=x[i]-x[f] u=t+((x[f].abs<x[i].abs)? x[f].abs : x[i].abs) ans=ans<u ? ans:u } puts ans
n,k=gets.split.map(&:to_i) x=gets.split.map(&:to_i) s=x[k-1]-x[0] ans=s+((x[0].abs<x[k-1].abs)? x[0].abs : x[k-1].abs) (k..(n-1)).each{|i| f=i-k+1 t=x[i]-x[f] u=t+((x[f].abs<x[i].abs)? x[f].abs : x[i].abs) ans=ans<u ? ans:u } puts ans
[ "assignment.value.change", "expression.operation.binary.change", "call.add" ]
1,058,422
1,058,423
u883824971
ruby
p03274
n, k = gets.split(" ").map(&:to_i) l0 = [] m0 = [] gets.split(" ").each do |x| x = x.to_i if x < 0 l0.unshift(-x) else m0 << x end end ans = 2 * 10**8 + 1 ans = [ans, m0[k - 1]].min if m0.length >= k ans = [ans, l0[k - 1]].min if l0.length >= k 1.upto(k - 1) do |i| a = [] if l0.length >= i && m0.length >= (k - i) a << l0[i - 1]*2 + m0[k - i - 1] end if m0.length >= i && l0.length >= (k - i) a << m0[i - 1]*2 + l0[k - i - 1] end ans = [a.min, ans].min if a.size > 0 end puts ans
n, k = gets.split(" ").map(&:to_i) l0 = [] m0 = [] gets.split(" ").each do |x| x = x.to_i if x < 0 l0.unshift(-x) else m0 << x end end ans = 4 * 10**8 + 1 ans = [ans, m0[k - 1]].min if m0.length >= k ans = [ans, l0[k - 1]].min if l0.length >= k 1.upto(k - 1) do |i| a = [] if l0.length >= i && m0.length >= (k - i) a << l0[i - 1]*2 + m0[k - i - 1] end if m0.length >= i && l0.length >= (k - i) a << m0[i - 1]*2 + l0[k - i - 1] end ans = [a.min, ans].min if a.size > 0 end puts ans
[ "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.change" ]
1,058,683
1,058,684
u742213796
ruby
p03274
n, k = gets.split.map(&:to_i) candles = Array.new candles = gets.split.map(&:to_i) #find the time to time to light k candles for every sequence of k candles min_sum = 2*[candles[0].abs, candles[n-1].abs].max for i in 0..candles.length-k if candles[i] > 0 sum = candles[i+k-1] elsif candles[i+k-1] < 0 sum = -candles[i] else if -candles[i] <= candles[i+k-1] sum = 2*(-candles[i]) + candles[i+k-1] else sum = -candles[i] + 2*candles[i+k-1] end end if sum < min_sum min_sum = sum end end puts min_sum
n, k = gets.split.map(&:to_i) candles = Array.new candles = gets.split.map(&:to_i) min_sum = 4*[candles[0].abs, candles[n-1].abs].max #find the time to time to light k candles for every sequence of k candles for i in 0..candles.length-k if candles[i] > 0 sum = candles[i+k-1] elsif candles[i+k-1] < 0 sum = -candles[i] else if -candles[i] <= candles[i+k-1] sum = 2*(-candles[i]) + candles[i+k-1] else sum = -candles[i] + 2*candles[i+k-1] end end if sum < min_sum min_sum = sum end end puts min_sum
[ "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.change" ]
1,059,384
1,059,385
u367768008
ruby
p03274
n, k = gets.split.map(&:to_i) candles = Array.new candles = gets.split.map(&:to_i) #find the time to time to light k candles for every sequence of k candles min_sum = 2*[candles[0].abs, candles[n-1].abs].max for i in 0..candles.length-(k+1) if candles[i] > 0 sum = candles[i+k-1] elsif candles[i+k-1] < 0 sum = -candles[i] else if -candles[i] <= candles[i+k-1] sum = 2*(-candles[i]) + candles[i+k-1] else sum = -candles[i] + 2*candles[i+k-1] end end if sum < min_sum min_sum = sum end end puts min_sum
n, k = gets.split.map(&:to_i) candles = Array.new candles = gets.split.map(&:to_i) min_sum = 4*[candles[0].abs, candles[n-1].abs].max #find the time to time to light k candles for every sequence of k candles for i in 0..candles.length-k if candles[i] > 0 sum = candles[i+k-1] elsif candles[i+k-1] < 0 sum = -candles[i] else if -candles[i] <= candles[i+k-1] sum = 2*(-candles[i]) + candles[i+k-1] else sum = -candles[i] + 2*candles[i+k-1] end end if sum < min_sum min_sum = sum end end puts min_sum
[ "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.change" ]
1,059,386
1,059,385
u367768008
ruby
p03274
n, k = gets.split.map(&:to_i) x = gets.split.map(&:to_i) l_count = x.select{|e| e < 0}.count r_count = x.select{|e| e >= 0}.count ans = 2 * 10**8 (k+1).times do |l| next if l_count < l next if r_count < k - l if l == 0 r_dis = x[l_count - 1 + k] ans = r_dis if r_dis < ans elsif l == k l_dis = -1 * x[l_count - k] ans = l_dis if l_dis < ans else l_dis = -1 * x[l_count - l] r_dis = x[l_count + k - l - 1] if r_dis > l_dis dis = 2 * l_dis + r_dis ans = dis if dis < ans else dis = l_dis + 2 * r_dis ans = dis if dis < ans end end end p ans
n, k = gets.split.map(&:to_i) x = gets.split.map(&:to_i) l_count = x.select{|e| e < 0}.count r_count = x.select{|e| e >= 0}.count ans = 10**10 (k+1).times do |l| next if l_count < l next if r_count < k - l if l == 0 r_dis = x[l_count - 1 + k] ans = r_dis if r_dis < ans elsif l == k l_dis = -1 * x[l_count - k] ans = l_dis if l_dis < ans else l_dis = -1 * x[l_count - l] r_dis = x[l_count + k - l - 1] if r_dis > l_dis dis = 2 * l_dis + r_dis ans = dis if dis < ans else dis = l_dis + 2 * r_dis ans = dis if dis < ans end end end p ans
[ "expression.operation.binary.remove", "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.change" ]
1,060,149
1,060,150
u709879360
ruby
p03280
a,b = gets.split.map(&:to_i) puts a - 1 * b - 1
a,b = gets.split.map(&:to_i) puts (a - 1) * (b - 1)
[ "call.arguments.change" ]
1,061,342
1,061,343
u622469330
ruby
p03280
p gets.split.mpa{|i|i.to_i-1}.inject(:*)
p gets.split.map{|i|i.to_i-1}.inject(:*)
[ "identifier.change", "call.arguments.change" ]
1,061,444
1,061,445
u966810027
ruby
p03280
a,b=gets.split.map(&to_i) puts (a-1)*(b-1)
a,b=gets.split.map(&:to_i) puts (a-1)*(b-1)
[ "assignment.value.change", "call.arguments.change" ]
1,061,553
1,061,554
u064515743
ruby
p03280
a, b = gets.chomp.collect(&:to_i) puts((a - 1) * (b - 1))
a, b = gets.chomp.split(/ /).collect(&:to_i) puts((a - 1) * (b - 1))
[ "call.add" ]
1,061,674
1,061,675
u758799884
ruby
p03281
n=gets.to_i i=1 divisor=0 ans=0 while i<=n divisor=0 1.upto(i) do |j| if i%j==0 divisor+=1 end end if divisor==8 ans=1 end i+=2 end puts ans
n=gets.to_i i=1 divisor=0 ans=0 while i<=n divisor=0 1.upto(i) do |j| if i%j==0 divisor+=1 end end if divisor==8 ans+=1 end i+=2 end puts ans
[ "assignment.value.change" ]
1,061,732
1,061,733
u556046719
ruby
p03281
n = gets.to_i puts 1.step(n, 2).map {|i| (1..i).select {|x| (n % x).zero?}.size == 8 }.count(true)
n = gets.to_i puts 1.step(n, 2).map {|i| (1..i).select {|x| (i % x).zero?}.size == 8 }.count(true)
[ "identifier.change", "call.arguments.change", "expression.operation.binary.change" ]
1,062,384
1,062,385
u297507288
ruby
p03281
# https://atcoder.jp/contests/abc106/tasks/abc106_b require 'prime' N = gets.to_i if N < 105 puts 0 exit end ans = 1 (106..N).each do |x| ans += 1 if Prime.prime_division(x).inject(1) { |result, set| result * (set[1] + 1) } == 8 end puts ans
# https://atcoder.jp/contests/abc106/tasks/abc106_b require 'prime' N = gets.to_i if N < 105 puts 0 exit end ans = 1 (106..N).each do |x| ans += 1 if x.odd? && Prime.prime_division(x).inject(1) { |result, set| result * (set[1] + 1) } == 8 end puts ans
[ "control_flow.branch.if.condition.change" ]
1,062,672
1,062,673
u019986937
ruby
p03281
# https://atcoder.jp/contests/abc106/tasks/abc106_b require 'prime' N = gets.to_i if N < 105 puts 0 exit end ans = 1 (106..N).each do |x| ans += 1 if Prime.prime_division(N).inject(1) { |result, set| result * (set[1] + 1) } == 8 end puts ans
# https://atcoder.jp/contests/abc106/tasks/abc106_b require 'prime' N = gets.to_i if N < 105 puts 0 exit end ans = 1 (106..N).each do |x| ans += 1 if x.odd? && Prime.prime_division(x).inject(1) { |result, set| result * (set[1] + 1) } == 8 end puts ans
[ "control_flow.branch.if.condition.change" ]
1,062,674
1,062,673
u019986937
ruby
p03281
require "prime" def get_i() #空白区切の入力を数値(整数)の配列で返す return gets.chomp.split(" ").map(&:to_i) end def get_f() #空白区切の入力を数値(実数)の配列で返す return gets.chomp.split(" ").map(&:to_f) end def get() #空白区切の入力を文字列の配列で返す return gets.chomp.split(" ") end def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す return gets.chomp.split("") end def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する return bool ? y : n end def array(size,n=1,init=nil) #nに配列の次元数、sizeに配列の大きさ、initに初期値を投げることでその配列を返す if n==1 return Array.new(size){init} else return Array.new(n).map{Array.new(size){init}} end end n=gets.to_i if n<105 puts 0 else ans=1 for i in 106..n cnt=0 next if (i%2).zero? ((i**0.5).to_i).times do|j| cnt+=2 if (i%j).zero? end ans+=1 if cnt==8 end puts ans end
require "prime" def get_i() #空白区切の入力を数値(整数)の配列で返す return gets.chomp.split(" ").map(&:to_i) end def get_f() #空白区切の入力を数値(実数)の配列で返す return gets.chomp.split(" ").map(&:to_f) end def get() #空白区切の入力を文字列の配列で返す return gets.chomp.split(" ") end def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す return gets.chomp.split("") end def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する return bool ? y : n end def array(size,n=1,init=nil) #nに配列の次元数、sizeに配列の大きさ、initに初期値を投げることでその配列を返す if n==1 return Array.new(size){init} else return Array.new(n).map{Array.new(size){init}} end end n=gets.to_i if n<105 puts 0 else ans=1 for i in 106..n cnt=0 next if (i%2).zero? ((i**0.5).to_i).times do|j| cnt+=2 if (i% (j+1)).zero? end ans+=1 if cnt==8 end puts ans end
[ "control_flow.branch.if.condition.change" ]
1,062,687
1,062,688
u415400221
ruby
p03281
n = gets.to_i x = 0 c = 0 for i in 1..n do if(i % 2 != 0)then for j in 1..i do if(i % j == 0)then c += 1; end end if(c == 8)then x += 1 end end end puts x
n = gets.to_i x = 0 for i in 1..n do if(i % 2 != 0)then c = 0 for j in 1..i do if(i % j == 0)then c += 1; end end if(c == 8)then x += 1 end end end puts x
[ "assignment.remove", "assignment.add" ]
1,063,434
1,063,435
u336224958
ruby
p03281
require 'prime' p (1..gets.to_i).select{|i| i.prime_division.map{|a|a[1]+1}.inject(&:*) == 8 }.count
require 'prime' p (1..gets.to_i).select{|i| i.odd? && i.prime_division.map{|a|a[1]+1}.inject(&:*) == 8 }.count
[ "expression.operation.binary.add" ]
1,063,515
1,063,516
u214983738
ruby
p03281
require 'prime' N=gets.chomp.to_i def num(a) k=1 for temp in a do k *= temp.length end return k end k=0 N.times do |i| if num((i+1).prime_division) == 8 && (i+1)%2 != 0 k+=1 end end puts k
require 'prime' N=gets.chomp.to_i def num(a) k=1 for temp in a do k *= temp[1]+1 end return k end k=0 N.times do |i| if num((i+1).prime_division) == 8 && (i+1)%2 != 0 k+=1 end end puts k
[ "expression.operation.binary.add" ]
1,063,691
1,063,692
u267552846
ruby
p03281
require 'prime' N=gets.chomp.to_i def num(a) k=1 for temp in a do k *= temp.length end return k end k=0 N.times do |i| if num((i+1).prime_division) == 8 && (i+1)%2 != 0 k+=1 end end puts k
require 'prime' N=gets.chomp.to_i def num(a) k=1 for temp in a do k *= temp[1]+1 end return k end k=0 N.times do |i| if num((i+1).prime_division) == 8 && (i+1)%2 != 0 k+=1 end end puts k
[ "expression.operation.binary.add" ]
1,063,693
1,063,692
u267552846
ruby
p03281
def number_of_divisors(m) count = 1 for i in 2..m/2 if m%i == 0 count += 1 end end if (m > 1) count += 1 end return count end n = gets.chop.to_i total_count = 0 for j in 1..n if j%2 == 1 && number_of_divisors(j) == 8 total_count += 1 puts j end end puts total_count.to_s
def number_of_divisors(m) count = 1 for i in 2..m/2 if m%i == 0 count += 1 end end if (m > 1) count += 1 end return count end n = gets.chop.to_i total_count = 0 for j in 1..n if j%2 == 1 && number_of_divisors(j) == 8 total_count += 1 end end puts total_count.to_s
[ "call.remove" ]
1,063,746
1,063,747
u367768008
ruby
p03282
s=gets.split("").map &:to_i k=gets.to_i n=5000*10**12 ans=0 s.each{|i| n-=i**n if n<=0 ans=i break end } puts ans
s=gets.split("").map &:to_i k=gets.to_i n=5000*10**12 ans=0 s.each{|i| k-=i**n if k<=0 ans=i break end } puts ans
[ "identifier.change", "control_flow.branch.if.condition.change" ]
1,063,796
1,063,797
u977506075
ruby
p03282
s=gets.chomp.split("").map(&:to_i) k=gets.to_i ans=1 k.times do |i| if s[i]!='1' ans=s[i] break end end puts ans
s=gets.chomp.split("").map(&:to_i) k=gets.to_i ans=1 k.times do |i| if s[i]!=1 ans=s[i] break end end puts ans
[ "control_flow.branch.if.condition.change" ]
1,064,274
1,064,275
u960080897
ruby
p03282
s = gets.chomp.to_s.split(//) n = gets.chomp.to_i i = 0 s.each do |j| if s == 1 i += 1 else break end end puts i <= n ? 1: s[i]
s = gets.chomp.to_s.split(//) n = gets.chomp.to_i i = 0 s.each do |j| if j == "1" i += 1 else break end end puts i >= n ? 1: s[i]
[ "identifier.change", "control_flow.branch.if.condition.change", "misc.opposites", "expression.operator.compare.change" ]
1,064,781
1,064,782
u928941036
ruby
p03282
s = gets.chomp k = gets.to_i puts !(x = s.index(/[^1]/)) || x > k ? 1 : s[x]
s = gets.chomp k = gets.to_i puts !(x = s.index(/[^1]/)) || x >= k ? 1 : s[x]
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
1,064,936
1,064,937
u692254521
ruby
p03282
s = gets.chomp k = gets.to_i puts (x = s.index(/[^1]/)) > k ? 1 : s[x]
s = gets.chomp k = gets.to_i puts !(x = s.index(/[^1]/)) || x >= k ? 1 : s[x]
[ "expression.operation.unary.add", "control_flow.branch.if.condition.change" ]
1,064,938
1,064,937
u692254521
ruby
p03282
S = gets.chomp K = gets.to_i last1idx = -1 S.size.times do |i| break if S[i] !='1' last1idx = i end if K <= last1idx puts 1 else # 1がなければ0番目の値が表示される puts S[last1idx+1] end
S = gets.chomp K = gets.to_i last1idx = -1 S.size.times do |i| break if S[i] !='1' last1idx = i end if K <= last1idx+1 puts 1 else puts S[last1idx+1] end
[ "control_flow.branch.if.condition.change" ]
1,065,276
1,065,277
u244087909
ruby
p03282
s = gets.chomp.chars.map(&:to_i) k = gets.to_i sum = 0 s.each do |i| sum += i**5_000_000_000_000_000 if sum > k puts i exit end end
s = gets.chomp.chars.map(&:to_i) k = gets.to_i sum = 0 s.each do |i| sum += i**5_000_000_000_000_000 if sum >= k puts i exit end end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
1,065,623
1,065,624
u579668395
ruby
p03282
s = gets.chomp.chars k = gets.to_i i = 0 while s[i] == '1' i += 1 end if k <= (i + 1) puts '1' else puts s[i] end
s = gets.chomp.chars k = gets.to_i i = 0 while s[i] == '1' i += 1 end if k <= i puts '1' else puts s[i] end
[ "control_flow.branch.if.condition.change" ]
1,065,664
1,065,665
u457499130
ruby
p03282
s = gets.chomp k = gets.to_i if s[0...k].match(/1{k}/) puts s[0] else puts s.match(/[2-9]/) end
s = gets.chomp k = gets.to_i if s[0...k].match(/1{#{[k, s.length].min}}/) puts s[0] else puts s.match(/[2-9]/) end
[ "call.arguments.change" ]
1,065,844
1,065,843
u358554431
ruby
p03282
S = gets.chomp K = gets.to_i if S.chars.all? { |ch| ch == '1' } puts 1 else if K > 100 puts S.chars.find { |ch| ch > '1' } else if S[0..K].chars.all? { |ch| ch == '1' } puts 1 else puts S.chars.find { |ch| ch > '1' } end end end
S = gets.chomp K = gets.to_i if S.chars.all? { |ch| ch == '1' } puts 1 else if K > 100 puts S.chars.find { |ch| ch > '1' } else if S[0..(K - 1)].chars.all? { |ch| ch == '1' } puts 1 else puts S.chars.find { |ch| ch > '1' } end end end
[ "control_flow.branch.if.condition.change" ]
1,066,065
1,066,066
u740836226
ruby
p03282
s=gets.chomp k=gets.to_i q=(1...[k,s.size].min).find{|i|s[i]!=?1} puts q ? s[q] : 1
s=gets.chomp k=gets.to_i q=(0...[k,s.size].min).find{|i|s[i]!=?1} puts q ? s[q] : 1
[ "literal.number.integer.change", "assignment.value.change" ]
1,066,424
1,066,425
u280667879
ruby
p03282
s = gets.chomp k = gets.chomp.to_i /(1*)([23456789]*)/ =~ s first = Regexp.last_match[1] last = Regexp.last_match[2] if k < first.size then puts 1.to_s else puts Regexp.last_match[2][0] end
s = gets.chomp k = gets.chomp.to_i /(1*)([23456789]*)/ =~ s first = Regexp.last_match[1] last = Regexp.last_match[2] if k <= first.size then puts 1.to_s else puts Regexp.last_match[2][0] end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
1,066,495
1,066,496
u198355306
ruby
p03282
s=gets.chomp.chars.map(&:to_i).select{|x|x>0} k=gets.to_i t1 = t0 = s[0] while (s[0] == 1) && (k > 0) t1 = t0 t0 = s.shift k-=1 end p s[0]? s[0] : t1
s=gets.chomp.chars.map(&:to_i).select{|x|x>0} k=gets.to_i t1 = t0 = s[0] while (s[0] == 1) && (k > 1) t1 = t0 t0 = s.shift k-=1 end p s[0]? s[0] : t1
[ "literal.number.integer.change", "expression.operation.binary.change" ]
1,066,520
1,066,521
u017744950
ruby
p03282
a = $stdin.read.split("\n") s,k = a[0], a[1] position = nil i = 0 s.split('').each do |b| unless b == '1' position = i break end i+=1 end if position.nil? puts '1' else if k.to_i <= 100 if k.to_i < i puts '1' else puts s.split('')[i] end else puts s.split('')[i] end end
a = $stdin.read.split("\n") s,k = a[0], a[1] position = nil i = 0 s.split('').each do |b| unless b == '1' position = i break end i+=1 end if position.nil? puts '1' else if k.to_i <= 100 if k.to_i <= i puts '1' else puts s.split('')[i] end else puts s.split('')[i] end end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
1,066,533
1,066,534
u220501704
ruby
p03282
s=gets.split("").map(&:to_i) k=gets.to_i sum=0 s.each{|suji| sum+=suji**5000000000000000 if(sum>k) p suji break end }
s=gets.split("").map(&:to_i) k=gets.to_i sum=0 s.each{|suji| sum+=suji**5000000000000000 if(sum>=k) p suji break end }
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
1,066,576
1,066,577
u752146271
ruby
p03282
s = gets k = gets.to_i NISSUU = 5000*(10**12) count = 0 s.chars{|num| num = num.to_i count += num**NISSUU+1 if count>=k puts num break end }
s = gets k = gets.to_i NISSUU = 5000*(10**12) count = 0 s.chars{|num| num = num.to_i count += num**NISSUU if count>=k puts num break end }
[ "expression.operation.binary.remove" ]
1,066,580
1,066,581
u386799456
ruby
p03282
io = STDIN s=io.gets.chomp.split(//).map(&:to_i) k=io.gets.to_i ss=0 while (ss=s.shift) x=(ss==1) ? 1 : ss**(10**12) break if k < x k-=x end puts ss
io = STDIN s=io.gets.chomp.split(//).map(&:to_i) k=io.gets.to_i ss=0 while (ss=s.shift) x=(ss==1) ? 1 : ss**(10**12) break if k <= x k-=x end puts ss
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
1,066,582
1,066,583
u132360211
ruby
p03282
s = gets.chomp k = gets.to_i for i in 0..k if s[i].to_i == 1 if i == k puts s[i].to_i break end else puts s[i].to_i break end end
s = gets.chomp k = gets.to_i for i in 0..k if s[i].to_i == 1 if i == k - 1 puts s[i].to_i break end else puts s[i].to_i break end end
[ "control_flow.branch.if.condition.change" ]
1,066,590
1,066,591
u271044469
ruby
p03282
s = gets.chomp.chars.map(&:to_i) k = gets.to_i ftrillion = 5e15.to_i s.each do |i| if k < i**ftrillion puts i exit else k -= i**ftrillion end end
s = gets.chomp.chars.map(&:to_i) k = gets.to_i ftrillion = 5e15.to_i s.each do |i| if k <= i**ftrillion puts i exit else k -= i**ftrillion end end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
1,066,625
1,066,626
u320576758
ruby
p03282
S = gets.chomp K = gets.to_i ipos = 0 first = "1" S.each_char do |c| if c != "1" then first = c break end ipos += 1 end if ipos <= K then print first, "\n" else print '1', "\n" end
S = gets.chomp K = gets.to_i ipos = 0 first = "1" S.each_char do |c| if c != "1" then first = c break end ipos += 1 end if ipos < K then print first, "\n" else print '1', "\n" end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
1,066,700
1,066,701
u576106056
ruby
p03282
a = [] a = gets.chomp.split("").map(&:to_i) n = gets.chomp.to_i #p a[0].class #p n t = 0 cnt = 0 for i in 0..a.length-1 if a[i] != 1 t = i cnt = a[i] break end end if t+1 >= n puts 1 #exit else puts cnt end
a = [] a = gets.chomp.split("").map(&:to_i) n = gets.chomp.to_i #p a[0].class #p n t = 0 cnt = 1 for i in 0..a.length-1 if a[i] != 1 t = i cnt = a[i] break end end if t >= n puts 1 #exit else puts cnt end
[ "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.remove" ]
1,066,711
1,066,712
u614043796
ruby
p03282
a = [] a = gets.chomp.split("").map(&:to_i) n = gets.chomp.to_i #p a[0].class #p n t = 0 cnt = 0 for i in 0..a.length-1 if a[i] != 1 t = i cnt = a[i] break end end if t-1 >= n puts 1 #exit else puts cnt end
a = [] a = gets.chomp.split("").map(&:to_i) n = gets.chomp.to_i #p a[0].class #p n t = 0 cnt = 1 for i in 0..a.length-1 if a[i] != 1 t = i cnt = a[i] break end end if t >= n puts 1 #exit else puts cnt end
[ "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.remove" ]
1,066,713
1,066,712
u614043796
ruby
p03282
s = gets.chomp k = gets.to_i if s.delete('1').length == 0 || s[0...k].delete('1').length == 0 puts 1 else s.delete('1')[0] end
s = gets.chomp k = gets.to_i if s.delete('1').length == 0 || s[0...k].delete('1').length == 0 puts 1 else puts s.delete('1')[0] end
[ "io.output.change", "call.add" ]
1,066,734
1,066,735
u331906013
ruby
p03282
s = gets.chomp k = gets.chomp.to_i i = 0 flag = true while i<=k if s[i] != "1" flag = false puts s[i] break end i += 1 end if flag puts 1 end
s = gets.chomp k = gets.chomp.to_i i = 0 flag = true while i<=k-1 if s[i] != "1" flag = false puts s[i] break end i += 1 end if flag puts 1 end
[ "expression.operation.binary.add" ]
1,066,817
1,066,818
u706730549
ruby
p03282
Proc.new{|s,k|p s.chars.take(k.to_i).find{|c|c!='1'}||'1'}.call *$<
Proc.new{|s,k|puts s.chars.take(k.to_i).find{|c|c!='1'}||'1'}.call *$<
[ "call.function.change", "io.output.change" ]
1,066,870
1,066,871
u214983738
ruby
p03282
s=gets.chomp.split("").map(&:to_i) k=gets.chomp.to_i 0.upto(k-1) do |i| if s[i] != 1 puts i exit end end puts 1
s=gets.chomp.split("").map(&:to_i) k=gets.chomp.to_i 0.upto(k-1) do |i| if s[i] != 1 puts s[i] exit end end puts 1
[ "call.arguments.change" ]
1,066,923
1,066,924
u868089307
ruby
p03284
a,b = gets.split(" ").map(&:to_i) c = a / b d = a % b if d > 0 puts c - d + 1 else puts 0 end
a,b = gets.split(" ").map(&:to_i) c = a / b d = a % b if d != 0 puts 1 else puts 0 end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change", "expression.operation.binary.remove" ]
1,067,935
1,067,936
u944733909
ruby
p03284
a,b = gets.split(" ").map(&:to_i) c = a / b d = a % b if d > 0 puts c - d else puts 0 end
a,b = gets.split(" ").map(&:to_i) c = a / b d = a % b if d != 0 puts 1 else puts 0 end
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change", "identifier.replace.remove", "literal.replace.add", "call.arguments.change", "expression.operation.binary.change", "expression.operation.binary.remove" ]
1,067,937
1,067,936
u944733909
ruby
p03284
n, k = gets.split.map(&:to_i) puts n%k
n, k = gets.split.map(&:to_i) puts n % k > 0 ? 1 : 0
[]
1,067,972
1,067,973
u561391668
ruby
p03284
p gets.split.map(&:to_i).inject(:%)
p gets.split.map(&:to_i).inject(:%)<1 ? 0 : 1
[]
1,068,128
1,068,129
u744908753
ruby
p03284
N,K=gets.split.map(&:to_i) puts N/K==0 ? 0 : 1
N,K=gets.split.map(&:to_i) puts N%K==0 ? 0 : 1
[ "expression.operator.arithmetic.change", "control_flow.branch.if.condition.change" ]
1,068,300
1,068,301
u502306384
ruby
p03284
N, K = gets.split.map(&:to_i) if N % K puts 1 else puts 0 end
N, K = gets.split.map(&:to_i) if N % K == 0 puts 0 else puts 1 end
[ "call.add" ]
1,068,552
1,068,553
u503890246
ruby
p03285
lines = gets ary = [] for i in 0..25 do for t in 0..15 do if 4*i + 7*t == lines ary << 1 end end end if ary.count != 0 puts "Yes" else puts "No" end
lines = gets.to_i ary = [] for i in 0..25 do for t in 0..15 do if 4*i + 7*t == lines ary << 1 end end end if ary.count != 0 puts "Yes" else puts "No" end
[ "call.add" ]
1,069,349
1,069,350
u565580226
ruby
p03285
lines = gets ary = [] for i in 0..25 for t in 0..15 if 4*i + 7*t == lines ary << 1 end end end if ary.count != 0 puts "Yes" else puts "No" end
lines = gets.to_i ary = [] for i in 0..25 do for t in 0..15 do if 4*i + 7*t == lines ary << 1 end end end if ary.count != 0 puts "Yes" else puts "No" end
[ "call.add" ]
1,069,351
1,069,350
u565580226
ruby
p03285
lines = gets ary = [] for i in 0..25 for t in 0..15 if 4*i + 7*t == lines ary << 1 end end end if ary.count != 0 puts "Yes" else puts "No" end
lines = gets.to_i ary = [] for i in 0..25 do for t in 0..15 do if 4*i + 7*t == lines ary << 1 end end end if ary.count != 0 puts "Yes" else puts "No" end
[ "call.add" ]
1,069,352
1,069,350
u565580226
ruby
p03285
n = gets.chomp.to_i 0.upto(25) do |i| 0.upto(15) do |j| if i * 4 + j + 7 == n puts 'Yes' exit end end end puts 'No'
n = gets.chomp.to_i 0.upto(25) do |i| 0.upto(15) do |j| if i * 4 + j * 7 == n puts 'Yes' exit end end end puts 'No'
[ "expression.operator.arithmetic.change", "control_flow.branch.if.condition.change" ]
1,069,455
1,069,456
u157887852
ruby
p03285
n = gets.to_i i = 0 possibility = "No" while n - 7 * i >= 0 if n - 7 * i % 4 == 0 possibility = "Yes" end i += 1 end puts possibility
n = gets.to_i i = 0 possibility = "No" while n - 7 * i >= 0 if (n - 7 * i) % 4 == 0 possibility = "Yes" end i += 1 end puts possibility
[ "control_flow.branch.if.condition.change" ]
1,069,754
1,069,755
u984276646
ruby
p03285
n = gets.to_i i = 0 possibility = "No" while n - 7 * i >= 0 if n - 7 * i % 4 == 0 possibility = "Yes" end i += 1 end puts p
n = gets.to_i i = 0 possibility = "No" while n - 7 * i >= 0 if (n - 7 * i) % 4 == 0 possibility = "Yes" end i += 1 end puts possibility
[ "control_flow.branch.if.condition.change", "identifier.change", "call.arguments.change" ]
1,069,756
1,069,755
u984276646
ruby
p03285
n = gets.to_i s = (n/4) t = (n/7) (1..s).each do |v| (1..t).each do |w| if (4*v) + (7*w) == n puts "Yes" exit end end end puts "No"
n = gets.to_i s = (n/4) t = (n/7) (0..s).each do |v| (0..t).each do |w| if (4*v) + (7*w) == n puts "Yes" exit end end end puts "No"
[ "literal.number.integer.change", "io.output.change" ]
1,069,757
1,069,758
u012110567
ruby
p03285
n = gets.to_i max = n / 7 answer = "No" (1..max).each do |number| if (n - number * 7) % 4 == 0 answer = "Yes" break end end puts answer
n = gets.to_i max = n / 7 answer = "No" (0..max).each do |number| if (n - number * 7) % 4 == 0 answer = "Yes" break end end puts answer
[ "literal.number.integer.change" ]
1,069,812
1,069,813
u333374716
ruby
p03285
n = gets.to_i (n/4+1).times do |i| (n/7+1).times do |j| s = i*4 + j*7 if s==11 then puts "Yes" exit end end end puts "No"
n = gets.to_i (n/4+1).times do |i| (n/7+1).times do |j| s = i*4 + j*7 if s==n then puts "Yes" exit end end end puts "No"
[ "identifier.replace.add", "literal.replace.remove", "control_flow.branch.if.condition.change" ]
1,070,057
1,070,058
u186737744
ruby
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) 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 res += dfs(c, d + 1, p - DP) return res end res = dfs(0, 0, N) puts res > 0 ? 'Yes' : 'No'
[ "expression.operation.binary.add" ]
1,070,450
1,070,451
u707614029
ruby