buggy_code stringlengths 11 625k | fixed_code stringlengths 17 625k | bug_type stringlengths 2 4.45k | language int64 0 8 | token_count int64 5 200k |
|---|---|---|---|---|
import java.lang.Math;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int K = in.nextInt();
int num = 0;
Deque<Integer> lunlun = new ArrayDeque<Integer>(9);
for (int i = 1; i <= 9; i++) {
lunlun.add(i);
}
for... | import java.lang.Math;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int K = in.nextInt();
long num = 0;
Deque<Long> lunlun = new ArrayDeque<Long>(9);
for (long i = 1; i <= 9; i++) {
lunlun.add(i);
}
for (lo... | [["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 506, 0, 96], ["-", 8, 196, 0, 503, 39, 513, 0, 237, 0, 78], ["+", 8, 196, 0, 503, 39, 513, 0, 237, 0, 78], ["-", 49, 200, 51, 230, 39, 513, 0, 237, 0, 78], ["+", 49, 200, 51, 230, 39, 513, 0, 237, 0, 78], ["-", 8, 196, 0, 7, 502, 503, 39... | 3 | 202 |
#include <bits/stdc++.h>
using namespace std;
long long k;
int main() {
cin >> k;
queue<long long> q;
for (int i = 0; i < 10; i++) {
q.push(i);
}
while (!q.empty()) {
int x = q.front();
q.pop();
k--;
if (k == 0) {
cout << x << endl;
break;
}
for (int y = x % 10 - 1; y <... | #include <bits/stdc++.h>
using namespace std;
long long k;
int main() {
cin >> k;
queue<long long> q;
for (int i = 1; i < 10; i++) {
q.push(i);
}
while (!q.empty()) {
long x = q.front();
q.pop();
k--;
if (k == 0) {
cout << x << endl;
break;
}
for (int y = x % 10 - 1; y ... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 0, 52, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 147 |
import queue
k = int(input())
q = queue.Queue()
for l in range(10)[1:]:
q.put(l)
if k < 10:
print(q.queue[k])
k -= 9
for l in range(k):
dequeued = q.get()
mod = dequeued % 10
if mod != 0:
q.put(dequeued * 10 + mod - 1)
q.put(dequeued * 10 + mod)
if mod != 9:
q.put(dequeued *... | import queue
k = int(input())
q = queue.Queue()
for l in range(10)[1:]:
q.put(l)
if k < 10:
print(q.queue[k-1])
exit()
k -= 9
for l in range(k):
dequeued = q.get()
mod = dequeued % 10
if mod != 0:
q.put(dequeued * 10 + mod - 1)
q.put(dequeued * 10 + mod)
if mod != 9:
q.p... | [["+", 0, 652, 3, 4, 0, 206, 206, 657, 17, 33], ["+", 0, 652, 3, 4, 0, 206, 206, 657, 12, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24]] | 5 | 125 |
k = int(input())
from collections import deque
queue = deque(range(1,10))
count = 0
while count < k:
count += 1
tmp = deque.popleft()
tail = tmp % 10
if tail!=0:
deque.append(tmp*10+tail-1)
deque.append(tmp*10+tail)
if tail!=9:
deque.append(tmp*10+tail+1)
print(tmp) | k = int(input())
from collections import deque
queue = deque(range(1,10))
count = 0
while count < k:
count += 1
tmp = queue.popleft()
tail = tmp % 10
if tail!=0:
queue.append(tmp*10+tail-1)
queue.append(tmp*10+tail)
if tail!=9:
queue.append(tmp*10+tail+1)
print(tmp) | [["-", 0, 1, 0, 662, 12, 652, 63, 319, 500, 22], ["+", 0, 1, 0, 662, 12, 652, 63, 319, 500, 22], ["-", 64, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 64, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["-", 8, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 500, 22]] | 5 | 94 |
k = int(input())
from collections import deque
queue = deque(range(1,10))
count = 0
while count < k:
count += 1
tmp = queue.popleft()
tail = tmp%10
if tail != 0:
queue.append(10*tmp+tail-1)
queue.append(10*tmp)
if tail != 9:
queue.append(10*tmp+tail+1)
print(tmp) | k = int(input())
from collections import deque
queue = deque(range(1,10))
count = 0
while count < k:
count += 1
tmp = queue.popleft()
tail = tmp%10
if tail != 0:
queue.append(10*tmp+tail-1)
queue.append(10*tmp+tail)
if tail != 9:
queue.append(10*tmp+tail+1)
print(tmp) | [["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 22]] | 5 | 92 |
k = int(input())
numset = {i for i in range(1,10)}
flag = False
count = len(numset)
if count >= k:
flag = True
arr = [numset]
index = 0
while not flag:
beforeset = arr[index]
tmpset = set()
for i in beforeset:
tail = str(i)[-1]
if tail == "0":
tmpset.add(int(str(i)+str(0)))... | k = int(input())
numset = {i for i in range(1,10)}
flag = False
count = len(numset)
if count >= k:
flag = True
arr = [numset]
index = 0
while not flag:
beforeset = arr[index]
tmpset = set()
for i in beforeset:
tail = str(i)[-1]
if tail == "0":
tmpset.add(int(str(i)+str(0)))... | [["+", 0, 652, 3, 4, 0, 206, 206, 657, 17, 33], ["+", 0, 652, 3, 4, 0, 206, 206, 657, 12, 612]] | 5 | 275 |
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// int k = sc.nextInt();
int k = 13;
if (k == 100000) {
System.out.println("3234566667");
return;
}
List<Long> list = new ArrayList<>();
for (int keta = 1; ke... | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int k = sc.nextInt();
if (k == 100000) {
System.out.println("3234566667");
return;
}
List<Long> list = new ArrayList<>();
for (int keta = 1; keta <= 10; keta++) {... | [["-", 0, 195, 8, 196, 0, 503, 49, 200, 51, 499], ["+", 8, 196, 0, 503, 49, 200, 51, 492, 500, 22], ["+", 8, 196, 0, 503, 49, 200, 51, 492, 0, 131], ["+", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22], ["+", 0, 503, 49, 200, 51, 492, 3, 4, 0, 24], ["+", 0, 503, 49, 200, 51, 492, 3, 4, 0, 25]] | 3 | 243 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep1(i, n) for (int i = 1; i <= n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
cons... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep1(i, n) for (int i = 1; i <= n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
cons... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 0, 14, 8, 9, 0, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 9, 0, 43, 39, 78]] | 1 | 530 |
#include <iostream>
#include <queue>
using namespace std;
queue<int> q;
int main() {
int k;
cin >> k;
for (int i = 1; i < 10; i++) {
q.push(i);
}
while (k--) {
int x = q.front();
q.pop();
if (k == 0) {
cout << x << endl;
return 0;
}
if (x % 10 != 0)
q.push(10 * x + x ... | #include <iostream>
#include <queue>
using namespace std;
queue<long long int> q;
int main() {
int k;
cin >> k;
for (int i = 1; i < 10; i++) {
q.push(i);
}
while (k--) {
long long int x = q.front();
q.pop();
if (k == 0) {
cout << x << endl;
return 0;
}
if (x % 10 != 0)
... | [["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96], ["+", 0, 52, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 148 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
vector<ll> v;
void Try(int d, ll val, int cur_d, int lim_d) {
if ((int)v.size() > 100005)
return;
val = val * 10 + 1ll * d;
if (cur_d > lim_d)
return;
if (cur_d == lim_d)
v.push_back(val);
if (d ... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
vector<ll> v;
void Try(int d, ll val, int cur_d, int lim_d) {
if ((int)v.size() > 100100)
return;
val = val * 10 + 1ll * d;
if (cur_d > lim_d)
return;
if (cur_d == lim_d)
v.push_back(val);
if (d ... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]] | 1 | 238 |
#include <bits/stdc++.h>
#include <cstdio>
using namespace std;
long long c;
long long k;
vector<int> a;
void counter(int n) {
if (n == a.size()) {
c++;
if (c == k) {
for (int i : a) {
cout << to_string(i);
}
exit(0);
} else
return;
}
// if(n>10)
// return;
if (... | #include <bits/stdc++.h>
#include <cstdio>
using namespace std;
long long c;
long long k;
vector<int> a;
void counter(int n) {
if (n == a.size()) {
c++;
if (c == k) {
for (int i : a) {
cout << to_string(i);
}
exit(0);
} else
return;
}
// if(n>10)
// return;
if (... | [["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38], ["+", 8, 9, 0, 57, 64, 9, 0, 37, 0, 35]] | 1 | 238 |
a = [1,2,3,4,5,6,7,8,9,10,100,1000,10000,100000,1000000,10000000,100000000,1000000000]
import heapq
heapq.heapify(a)
cnt = 18
c = 1
while True:
if cnt > 10**5:
break
for i in a:
if len(str(i)) == c:
m = i//10**(c-1)
if i//10**(c-1) == 1:
heapq.heappush(a,i+10**c*(i//10**(c-1)))
h... | a = [1,2,3,4,5,6,7,8,9,10,100,1000,10000,100000,1000000,10000000,100000000,1000000000]
import heapq
heapq.heapify(a)
cnt = 18
c = 1
while True:
if cnt > 10**5:
break
for i in a:
if len(str(i)) == c:
m = i//10**(c-1)
if i//10**(c-1) == 1:
heapq.heappush(a,i+10**c*(i//10**(c-1)))
h... | [["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 375 |
import heapq
import sys
def solve(k):
if k < 10:
return k
heap = [1,2,3,4,5,6,7,8,9]
heapq.heapify(heap)
for i in range(k-1):
lunlun = heapq.heappop(heap)
lastDigit = lunlun % 10
# print lunlun
heapq.heappush(heap, (lunlun*10) + lastDigit)
if last... | import heapq
import sys
def solve(k):
if k < 10:
return k
heap = [1,2,3,4,5,6,7,8,9]
heapq.heapify(heap)
for i in range(k-1):
lunlun = heapq.heappop(heap)
lastDigit = lunlun % 10
# print lunlun
heapq.heappush(heap, (lunlun*10) + lastDigit)
if last... | [["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]] | 5 | 187 |
require 'set'
def main(str)
k = str.to_i
currents = Set.new([1, 2, 3, 4, 5, 6, 7, 8, 9])
results = currents
loop do
nexts = Set.new
currents.each do |x|
m = x % 10
n = 10 * x
case m
when 0
nexts << n + 0
nexts << n + 1
when 9
nexts << n + 9
... | require 'set'
def main(str)
k = str.to_i
currents = Set.new([1, 2, 3, 4, 5, 6, 7, 8, 9])
results = currents
loop do
nexts = Set.new
currents.each do |x|
m = x % 10
n = 10 * x
case m
when 0
nexts << n + 0
nexts << n + 1
when 9
nexts << n + 9
... | [["-", 0, 652, 3, 4, 0, 652, 486, 652, 486, 744], ["+", 0, 652, 3, 4, 0, 652, 486, 652, 486, 744]] | 4 | 149 |
import sys
from collections import deque
sys.setrecursionlimit(10 ** 6) # 再帰関数の再帰の深さを設定
to_index = lambda x: int(x) - 1 # 入力した数字に1を引いたものを返す
print_list_in_2D = lambda x: print(*x, sep="\n") # リストの要素を改行を挟んで表示する関数
# 入力を整数に変換して受け取る
def input_int():
return int(input())
def map_int_input():
return map(int, input... | import sys
from collections import deque
sys.setrecursionlimit(10 ** 6) # 再帰関数の再帰の深さを設定
to_index = lambda x: int(x) - 1 # 入力した数字に1を引いたものを返す
print_list_in_2D = lambda x: print(*x, sep="\n") # リストの要素を改行を挟んで表示する関数
# 入力を整数に変換して受け取る
def input_int():
return int(input())
def map_int_input():
return map(int, input... | [["-", 8, 196, 0, 57, 64, 196, 0, 37, 0, 38], ["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 315 |
/*input
16
*/
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define max(x, y) ((x) > (y) ? (x) : (y))
#define pii pair<int, int>
#define vi vector<int>
#define REP(i, st, en) for (int i = st; i < (int)en; i++)
#define REPD(i, en, st) for (int i = en; i >= (int)st; i--)
#define SZ(a) (int)a.siz... | /*input
100000
*/
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define max(x, y) ((x) > (y) ? (x) : (y))
#define pii pair<int, int>
#define vi vector<int>
#define REP(i, st, en) for (int i = st; i < (int)en; i++)
#define REPD(i, en, st) for (int i = en; i >= (int)st; i--)
#define SZ(a) (int)a... | [["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 79]] | 1 | 482 |
#include <bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define endl '\n'
using namespace std;
main() {
fast;
int k, x, i;
cin >> k;
queue<int> q;
for (i = 1; i < 10; i++)
q.push(i);
for (i = 1; i < k; i++) {
x = q.front();
q.pop();
if (x % 10 !=... | #include <bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define endl '\n'
using namespace std;
main() {
fast;
int k, i;
ll x;
cin >> k;
queue<ll> q;
for (i = 1; i < 10; i++)
q.push(i);
for (i = 1; i < k; i++) {
x = q.front();
q.pop();
if (x % 1... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78]] | 1 | 157 |
#include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <vector>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
... | #include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <vector>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
... | [["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78]] | 1 | 266 |
#include <algorithm>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1000000;
using ll = long long;
using namespace std;
int main() {
int k;
cin >> k;
vector<ll> a;
for (int i = 0; i <= 9; i++)
a.push_back(i);
whi... | #include <algorithm>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1000000;
using ll = long long;
using namespace std;
int main() {
int k;
cin >> k;
vector<ll> a;
for (int i = 1; i <= 9; i++)
a.push_back(i);
whi... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 38], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 35]] | 1 | 187 |
k = int(input())
#print(k)
l = [[0 for i in range(10)] for j in range(10)]
for j in range(10):
l[0][j] = 1
for i in range(1,10):
for j in range(10):
if(j != 0)and(j != 9):
l[i][j] = l[i-1][j-1]+l[i-1][j]+l[i-1][j+1]
elif j == 0:
l[i][j] = l[i-1][j]+l[i-1][j+1]
else:
l[i][j] = l[i-1][j-1]+l[i-1][j]
#... | k = int(input())
#print(k)
l = [[0 for i in range(10)] for j in range(10)]
for j in range(10):
l[0][j] = 1
for i in range(1,10):
for j in range(10):
if(j != 0)and(j != 9):
l[i][j] = l[i-1][j-1]+l[i-1][j]+l[i-1][j+1]
elif j == 0:
l[i][j] = l[i-1][j]+l[i-1][j+1]
else:
l[i][j] = l[i-1][j-1]+l[i-1][j]
#... | [["-", 0, 1, 0, 677, 12, 206, 206, 657, 17, 33], ["-", 0, 1, 0, 677, 12, 206, 206, 657, 12, 612]] | 5 | 438 |
K = int(input())
from collections import deque
que=deque([1,2,3,4,5,6,7,8,9])
for i in range(K):
x=que.popleft()
if x%10!=0:
que.append(10*x+(x%10-1))
que.append(10*x)
if x%10!=9:
que.append(10*x+(x%10+1))
print(x) | K = int(input())
from collections import deque
que=deque([1,2,3,4,5,6,7,8,9])
for i in range(K):
x=que.popleft()
if x%10!=0:
que.append(10*x+(x%10-1))
que.append(10*x+x%10)
if x%10!=9:
que.append(10*x+(x%10+1))
print(x) | [["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 652, 3, 4, 0, 657, 12, 657, 31, 22], ["+", 0, 652, 3, 4, 0, 657, 12, 657, 17, 109], ["+", 0, 652, 3, 4, 0, 657, 12, 657, 12, 612]] | 5 | 109 |
#include <bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template <typename T, typename cmp=less<T>> using oset =tree<T, null_type,
// cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define inf 10000000000000... | #include <bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template <typename T, typename cmp=less<T>> using oset =tree<T, null_type,
// cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define inf 10000000000000... | [["-", 8, 9, 0, 1, 0, 34, 31, 2, 63, 22], ["-", 0, 1, 0, 34, 31, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 34, 31, 2, 3, 4, 0, 25], ["-", 0, 14, 8, 9, 0, 1, 0, 34, 0, 21], ["-", 0, 14, 8, 9, 0, 1, 0, 34, 12, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]] | 1 | 229 |
package main
import(
"fmt"
)
func main() {
var K int
var lunlunNum int64
var i int64
fmt.Scan(&K)
q := make([]int64, 0)
for i=1; i<=9; i++ {
q = append(q,i)
}
for i:=1; i<K; i++ {
if q[0]%10 == 0 {
q = append(q, q[0]*10 + q[0]%10)
q = append(q, q[0]*10 + q[0]%10 + 1)
} else if q[0] == ... | package main
import(
"fmt"
)
func main() {
var K int
var lunlunNum int
var i int
fmt.Scan(&K)
q := make([]int, 0)
for i=1; i<=9; i++ {
q = append(q,i)
}
for i:=1; i<K; i++ {
if q[0]%10 == 0 {
q = append(q, q[0]*10 + q[0]%10)
q = append(q, q[0]*10 + q[0]%10 + 1)
} else if q[0]%10 == 9 {... | [["-", 0, 435, 8, 196, 0, 440, 0, 441, 39, 78], ["+", 0, 435, 8, 196, 0, 440, 0, 441, 39, 78], ["-", 12, 432, 0, 2, 3, 4, 0, 467, 468, 78], ["+", 12, 432, 0, 2, 3, 4, 0, 467, 468, 78], ["+", 0, 57, 75, 57, 15, 16, 31, 16, 17, 109], ["+", 0, 57, 75, 57, 15, 16, 31, 16, 12, 433]] | 7 | 291 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
int K, X, A = 0;
cin >> K;
vector<long long> Q;
rep(i, 9) Q.push_back(i + 1);
while (Q.size() <= K) {
X = Q.at(A);
if (X % 10 != 0)
Q.push_back(10 * X + X % 10 - 1);
Q.push_back(1... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
int K, A = 0;
long long X;
cin >> K;
vector<long long> Q;
rep(i, 9) Q.push_back(i + 1);
while (Q.size() <= K) {
X = Q.at(A);
if (X % 10 != 0)
Q.push_back(10 * X + X % 10 - 1);
Q... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22]] | 1 | 152 |
#include <bits/stdc++.h>
using namespace std;
#define int long long
// #define double long double
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a); i > (b); --i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOREACH(x... | #include <bits/stdc++.h>
using namespace std;
#define int long long
// #define double long double
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a); i > (b); --i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOREACH(x... | [["+", 51, 16, 31, 16, 31, 16, 31, 16, 17, 109], ["+", 51, 16, 31, 16, 31, 16, 31, 16, 12, 13], ["+", 51, 16, 12, 16, 31, 16, 31, 16, 17, 109], ["+", 51, 16, 12, 16, 31, 16, 31, 16, 12, 13], ["+", 51, 16, 12, 23, 0, 16, 31, 16, 17, 109], ["+", 51, 16, 12, 23, 0, 16, 31, 16, 12, 13]] | 1 | 935 |
#include <bits/stdc++.h>
using namespace std;
int main() {
queue<int> q;
for (int i = 1; i < 10; i++)
q.push(i);
int k;
cin >> k;
while (--k) {
int x = q.front();
q.pop();
if (x % 10 != 0)
q.push(10 * x + x % 10 - 1);
q.push(10 * x + x % 10);
if (x % 10 != 9)
q.push(10 * ... | #include <bits/stdc++.h>
using namespace std;
int main() {
queue<long long int> q;
for (int i = 1; i < 10; i++)
q.push(i);
int k;
cin >> k;
while (--k) {
long long int x = q.front();
// cout<<x<<endl;
q.pop();
if (x % 10 != 0)
q.push(10 * x + x % 10 - 1);
q.push(10 * x +... | [["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96], ["+", 0, 52, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 135 |
#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
int main() {
int K;
cin >> K;
queue<long long> q;
FOR(i, 1, 10) q.push(i);
REP(i, K) {
lo... | #include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
int main() {
int K;
cin >> K;
queue<long long> q;
FOR(i, 1, 10) q.push(i);
REP(i, K - 1) {
... | [["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]] | 1 | 162 |
from collections import deque
K = int(input())
a = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])
for i in range(K-1):
j = a.popleft()
if j%10 != 0:
a.append((10*j) + ((j%10) -1))
a.append((10*j)+j%10)
if j%10 != 9:
a.append((10*j) +((j%10)+1))
a.popleft() | from collections import deque
K = int(input())
a = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])
for i in range(K-1):
j = a.popleft()
if j%10 != 0:
a.append((10*j) + ((j%10) -1))
a.append((10*j)+j%10)
if j%10 != 9:
a.append((10*j) +((j%10)+1))
print(a.popleft()) | [["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]] | 5 | 126 |
def dp(i, j, memo):
key = "{}.{}".format(i, j)
if i == 1:
memo[key] = 1
return memo[key]
if key in memo:
return memo[key]
if j == 0:
memo[key] = dp(i-1, j, memo) + dp(i-1, j+1, memo)
return memo[key]
if j == 9:
memo[key] = dp(i-1, j-1, memo) + dp(i... | def dp(i, j, memo):
key = "{}.{}".format(i, j)
if i == 1:
memo[key] = 1
return memo[key]
if key in memo:
return memo[key]
if j == 0:
memo[key] = dp(i-1, j, memo) + dp(i-1, j+1, memo)
return memo[key]
if j == 9:
memo[key] = dp(i-1, j-1, memo) + dp(i... | [["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 21], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 343 |
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
typedef long long ll;
using namespace std;
vector<int> num;
void prin(int i) { cout << num[i] << endl; }
int main() {
num.push_back(1);
num.push_back(0);
int n, cnt = 1;
cin >> n;
if (n < 10) {
cout << n << endl;
return 0;
}
n -= 10;
while (n--) {
... | #include <bits/stdc++.h>
#define INF 0x3f3f3f3f
typedef long long ll;
using namespace std;
vector<int> num;
void prin(int i) { cout << num[i]; }
int main() {
num.push_back(1);
num.push_back(0);
int n, cnt = 1;
cin >> n;
if (n < 10) {
cout << n << endl;
return 0;
}
n -= 10;
while (n--) {
int ... | [["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]] | 1 | 319 |
k = gets.to_i
h = {1 => ('0'..'9').to_a }
luns = [*h[1]]
i = 2
while true do
nums = h[i-1]
h[i] = nums.flat_map do |n|
a = n[0].to_i
[a-1, a, a+1].select {|b| b >= 0 && b < 10}.map{|b| b.to_s + n }
end.uniq
luns = [*luns, *h[i]]
new = luns.map(&:to_i).uniq
if new.size >= k
puts new.sort... | k = gets.to_i
h = {1 => ('0'..'9').to_a }
luns = [*h[1]]
i = 2
while true do
nums = h[i-1]
h[i] = nums.flat_map do |n|
a = n[0].to_i
[a-1, a, a+1].select {|b| b >= 0 && b < 10}.map{|b| b.to_s + n }
end.uniq
luns = [*luns, *h[i]]
new = luns.map(&:to_i).uniq
if new.size > k
puts new.sort[... | [["-", 0, 89, 8, 170, 0, 121, 15, 738, 17, 20], ["+", 0, 89, 8, 170, 0, 121, 15, 738, 17, 47]] | 4 | 148 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int K;
cin >> K;
string A[K + 1];
A[0] = "0";
for (int i = 1; i <= K; i++) {
string S = A[i - 1];
int N = S.size() - 1;
while (N > 0 && (S.at(N) == '9' || S.at(N - 1) < S.at(N)))
N--;
if (S.at(0) == '9')
A[i] = to_string(st... | #include <bits/stdc++.h>
using namespace std;
int main() {
int K;
cin >> K;
string A[K + 1];
A[0] = "0";
for (int i = 1; i <= K; i++) {
string S = A[i - 1];
int N = S.size() - 1;
while (N > 0 && (S.at(N) == '9' || S.at(N - 1) < S.at(N)))
N--;
if (N == 0 && S.at(0) == '9')
A[i] = to... | [["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98]] | 1 | 212 |
#include <stdio.h>
int main() {
int k, i, j = 0;
long list[100005], l;
scanf("%d", &k);
for (i = 0; i < 9; i++) {
list[i] = i + 1;
j++;
}
if (k < 9) {
printf("%d", k);
} else {
for (i = 0; j < k; i++) {
l = list[i] % 10;
switch (l) {
case 0:
list[j] = list[i] * 1... | #include <stdio.h>
int main() {
int k, i, j = 0;
long list[100005], l;
scanf("%d", &k);
for (i = 0; i < 9; i++) {
list[i] = i + 1;
j++;
}
if (k < 9) {
printf("%d", k);
} else {
for (i = 0; j < k; i++) {
l = list[i] % 10;
switch (l) {
case 0:
list[j] = list[i] * 1... | [["-", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]] | 0 | 260 |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_... | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_... | [["-", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 12, 13], ["-", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35], ["+", 0, 57, 64, 9, 0, 57, 64, 116, 0, 117], ["+", 0, 57, 64, 9, 0, 57, 64, 116, 0, 35]] | 1 | 923 |
def main():
K = int(input())
if K < 10:
print(K)
return
R = [1,2,3,4,5,6,7,8,9]
x = 9
while True:
T = []
for r in R:
if r % 10 > 0:
T.append(r * 10 + (r % 10) - 1)
x += 1
if x >= K:
pri... | def main():
K = int(input())
if K < 10:
print(K)
return
R = [1,2,3,4,5,6,7,8,9]
x = 9
while True:
T = []
for r in R:
if r % 10 > 0:
T.append(r * 10 + (r % 10) - 1)
x += 1
if x >= K:
pri... | [["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 652, 3, 4, 0, 657, 12, 23, 0, 24], ["+", 3, 4, 0, 657, 12, 23, 0, 657, 31, 22], ["+", 3, 4, 0, 657, 12, 23, 0, 657, 17, 109], ["+", 3, 4, 0, 657, 12, 23, 0, 657, 12, 612], ["+", 0, 652, 3, 4, 0, 657, 12, 23, 0, 25]] | 5 | 197 |
k = int(input())
ans = [str(i) for i in range(1,10)]
c = 0
while len(ans)!=k:
now = ans[c]
t = int(now[-1])
if t != 0:
ans.append(str(now) +str(t-1))
ans.append(str(now) +str(now)[-1])
if t != 9:
ans.append(str(now) +str(t+1))
c += 1
print(ans[k-1]) | k = int(input())
ans = [str(i) for i in range(1,10)]
c = 0
while len(ans) < k:
now = ans[c]
t = int(now[-1])
if t != 0:
ans.append(str(now) +str(t-1))
ans.append(str(now) +str(now)[-1])
if t != 9:
ans.append(str(now) +str(t+1))
c += 1
print(ans[k-1]) | [["-", 36, 36, 0, 656, 0, 52, 15, 666, 667, 79], ["+", 36, 36, 0, 656, 0, 52, 15, 666, 667, 18]] | 5 | 124 |
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;... | #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;... | [["-", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13]] | 1 | 307 |
# -*- coding: utf-8 -*-
def f(n):
C = [[1 for i in range(10)]]
while sum(d for c in C for d in c[1:]) < n:
C.append([sum(C[-1][max(0,i-1):min(i+2,10)]) for i in range(10)])
return C
def solve():
n = int(input())
C = f(n)
X = []
m = sum(d for c in C[:-1] for d in c[1:])
x = 1
... | # -*- coding: utf-8 -*-
def f(n):
C = [[1 for i in range(10)]]
while sum(d for c in C for d in c[1:]) < n:
C.append([sum(C[-1][max(0,i-1):min(i+2,10)]) for i in range(10)])
return C
def solve():
n = int(input())
C = f(n)
X = []
m = sum(d for c in C[:-1] for d in c[1:])
x = 1
... | [["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612]] | 5 | 278 |
def main():
k=int(input())
l=[[] for _ in range(20)]
l[1]=[0,1,2,3,4,5,6,7,8,9]
cnt=9
if cnt>=k:
print(l[k])
exit()
for i in range(2,20):
for keta in range(1,i):
for j in l[keta]:
f=j//10**(i-2)
if j==0:
l[i]... | def main():
k=int(input())
l=[[] for _ in range(20)]
l[1]=[0,1,2,3,4,5,6,7,8,9]
cnt=9
if cnt>=k:
print(l[1][k])
exit()
for i in range(2,20):
for keta in range(1,i):
for j in l[keta]:
f=j//10**(i-2)
if j==0:
l... | [["+", 0, 652, 3, 4, 0, 206, 51, 206, 206, 612], ["+", 0, 652, 3, 4, 0, 206, 51, 206, 0, 73], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 0, 70]] | 5 | 405 |
#include <iostream>
#include <vector>
using namespace std;
int K;
vector<vector<long long>> rnrn;
int main() {
cin >> K;
int r = 10;
rnrn = vector<vector<long long>>(r, vector<long long>(11));
for (int i = 0; i < 10; i++) {
rnrn[0][i] = 1;
}
for (int i = 1; i < r; i++) {
for (int j = 0; j < ... | #include <iostream>
#include <vector>
using namespace std;
int K;
vector<vector<long long>> rnrn;
int main() {
cin >> K;
int r = 10;
rnrn = vector<vector<long long>>(r, vector<long long>(11));
for (int i = 0; i < 10; i++) {
rnrn[0][i] = 1;
}
for (int i = 1; i < r; i++) {
for (int j = 0; j < ... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 20], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98]] | 1 | 359 |
k = int(input())
if k < 10:
print(k)
else:
dp = [[0 for _ in range(10)] for _ in range(30)] #確認
for i in range(10):
dp[1][i] = 1
for i in range(2, 30):
for j in range(10):
if j == 0:
dp[i][j] = dp[i-1][j] + dp[i-1][j+1]
elif j == 9:
dp[i][j] = dp[i-1][j] + dp[i-1][j-1]
else:
dp[i][j] = dp[i... | k = int(input())
if k < 10:
print(k)
else:
dp = [[0 for _ in range(10)] for _ in range(30)] #確認
for i in range(10):
dp[1][i] = 1
for i in range(2, 30):
for j in range(10):
if j == 0:
dp[i][j] = dp[i-1][j] + dp[i-1][j+1]
elif j == 9:
dp[i][j] = dp[i-1][j] + dp[i-1][j-1]
else:
dp[i][j] = dp[i... | [["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20]] | 5 | 386 |
import sys
stdin = sys.stdin
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
K=int(input())
c=9
cb=0
r_list=[1,2,3,4,5,6,7,8,9]
while(c<K):
tmp=[]
for i in r_list:
i... | import sys
stdin = sys.stdin
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
K=int(input())
c=9
cb=0
r_list=[1,2,3,4,5,6,7,8,9]
while(c<K):
tmp=[]
for i in r_list:
i... | [["-", 8, 196, 0, 7, 8, 196, 0, 57, 0, 121], ["+", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683]] | 5 | 255 |
#dpより愚直に作るか
k = int(input())
lun = [i for i in range(10)]
while len(lun)<k:
lun2 = []
for i in lun:
lun2.append(i*10+(i%10))
if i%10:
lun2.append(i*10+(i%10)-1)
if (i%10)<9:
lun2.append(i*10+(i%10)+1)
lun = list(set(lun+lun2))
lun.sort()
print(lun[k]) | #dpより愚直に作るか
k = int(input())
lun = [i for i in range(10)]
while len(lun)<k+1:#正の整数
lun2 = []
for i in lun:
lun2.append(i*10+(i%10))
if i%10:
lun2.append(i*10+(i%10)-1)
if (i%10)<9:
lun2.append(i*10+(i%10)+1)
lun = list(set(lun+lun2))
lun.sort()
print(lun[k]) | [["+", 0, 656, 0, 52, 15, 666, 0, 657, 17, 72], ["+", 0, 656, 0, 52, 15, 666, 0, 657, 12, 612]] | 5 | 121 |
#include <algorithm>
#include <cctype>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; i++)
typedef int long long ll;... | #include <algorithm>
#include <cctype>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; i++)
typedef int long long ll;... | [["-", 0, 16, 31, 16, 12, 16, 31, 16, 31, 22], ["+", 0, 16, 31, 16, 12, 16, 31, 16, 31, 22]] | 1 | 517 |
K = int(input())
list0 = ['0']
list1 = ['1']
list2 = ['2']
list3 = ['3']
list4 = ['4']
list5 = ['5']
list6 = ['6']
list7 = ['7']
list8 = ['8']
list9 = ['9']
an = 0
def AAA(list0,list1,list2,list3,list4,list5,list6,list7,list8,list9):
nlist0 = [0]*(len(list0)+len(list1))
nlist1 = [0]*(len(list0)+len(list1)+l... |
K = int(input())
list0 = ['0']
list1 = ['1']
list2 = ['2']
list3 = ['3']
list4 = ['4']
list5 = ['5']
list6 = ['6']
list7 = ['7']
list8 = ['8']
list9 = ['9']
an = 0
def AAA(list0,list1,list2,list3,list4,list5,list6,list7,list8,list9):
nlist0 = [0]*(len(list0)+len(list1))
nlist1 = [0]*(len(list0)+len(list1... | [["+", 31, 657, 31, 657, 31, 657, 31, 657, 31, 22], ["+", 31, 657, 31, 657, 31, 657, 31, 657, 17, 72]] | 5 | 1,568 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template <typename T1, typename T2> bool chmin(T1 &a, T2 b) {
if (a <= b)
return 0;
a = b;
return 1;
}
template <typename T1, typename T2> bool chmax(T1 &a, T2 b) {
if (a >= b)
return 0;
a = b;
return 1;
}
signed main() {
ios::sy... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template <typename T1, typename T2> bool chmin(T1 &a, T2 b) {
if (a <= b)
return 0;
a = b;
return 1;
}
template <typename T1, typename T2> bool chmax(T1 &a, T2 b) {
if (a >= b)
return 0;
a = b;
return 1;
}
signed main() {
ios::sy... | [["+", 31, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 31, 16, 31, 69, 341, 342, 0, 16, 12, 13]] | 1 | 753 |
#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define re... | #include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define re... | [["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]] | 1 | 909 |
#include <bits/stdc++.h>
using namespace std;
long long a[10][14];
int k, s = 0;
long long find(int k, int hd, int dgt) {
// cout << k << ' ' << hd << ' ' << dgt << endl;
if (k > a[hd][dgt]) {
int hdd = hd + 1, dgtt = dgt;
if (hdd > 9) {
hdd = 1;
dgtt++;
}
return find(k - a[hd][dgt], h... | #include <bits/stdc++.h>
using namespace std;
long long a[10][14];
int k, s = 0;
long long find(int k, int hd, int dgt) {
// cout << k << ' ' << hd << ' ' << dgt << ' ' << a[hd][dgt] << endl;
if (k > a[hd][dgt]) {
int hdd = hd + 1, dgtt = dgt;
if (hdd > 9) {
hdd = 1;
dgtt++;
}
return f... | [["+", 12, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 12, 16, 12, 69, 341, 342, 0, 16, 12, 13]] | 1 | 329 |
#include <algorithm>
#include <iostream>
#include <limits.h>
#include <math.h>
#include <stdlib.h>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(A) A.begin(), A.end()
... | #include <algorithm>
#include <iostream>
#include <limits.h>
#include <math.h>
#include <stdlib.h>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(A) A.begin(), A.end()
... | [["-", 0, 57, 64, 9, 0, 7, 26, 27, 17, 29], ["+", 0, 57, 64, 9, 0, 7, 26, 27, 17, 68]] | 1 | 545 |
#include <algorithm>
#include <cmath> // auto &Name : STLName Name.
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue> //priority_queue
#include <set> //multiset set<int,greater<int>>大到小
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector> /... | #include <algorithm>
#include <cmath> // auto &Name : STLName Name.
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue> //priority_queue
#include <set> //multiset set<int,greater<int>>大到小
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector> /... | [["-", 0, 14, 8, 9, 0, 7, 26, 27, 17, 29], ["+", 0, 14, 8, 9, 0, 7, 26, 27, 17, 29], ["-", 0, 7, 8, 9, 0, 7, 26, 27, 17, 29], ["+", 0, 7, 8, 9, 0, 7, 26, 27, 17, 29], ["-", 51, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["-", 51, 16, 12, 69, 341, 342, 0, 16, 12, 13]] | 1 | 467 |
#include <iostream>
#include <queue>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
int main() {
int k;
cin >> k;
queue<string> que;
rep(i, 9) que.push(to_string(i + 1));
string ans;
rep(i, k) {
ans = que.front();
que.p... | #include <iostream>
#include <queue>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
int main() {
int k;
cin >> k;
queue<string> que;
rep(i, 9) que.push(to_string(i + 1));
string ans;
rep(i, k) {
ans = que.front();
que.p... | [["+", 0, 57, 15, 339, 51, 16, 12, 103, 0, 104]] | 1 | 201 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, i, j, x, y, m, k, t;
cin >> n;
m = 0;
x = 0;
queue<string> q;
long long int arr[n];
k = 0;
for (i = 1; i <= 9; i++) {
q.push(to_string(i));
arr[k++] = i;
}
while (1) {
if (x == 1)
break;
long long int ... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, i, j, x, y, m, k, t;
cin >> n;
m = 0;
x = 0;
queue<string> q;
long long int arr[10 + n];
k = 0;
for (i = 1; i <= 9; i++) {
q.push(to_string(i));
arr[k++] = i;
}
while (1) {
if (x == 1)
break;
long long... | [["+", 8, 9, 0, 43, 49, 80, 81, 16, 31, 13], ["+", 8, 9, 0, 43, 49, 80, 81, 16, 17, 72], ["-", 64, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 64, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22]] | 1 | 422 |
k=int(input())
def dp(k):
if k<=9:
return k
else:
prev_keta_nums=[1,2,3,4,5,6,7,8,9]
count=9
flag = False
while True:
next_keta_nums=[]
for num in prev_keta_nums:
num_last = int(str(num)[-1])
if num_last == 9:
... | k=int(input())
def dp(k):
if k<=9:
return k
else:
prev_keta_nums=[1,2,3,4,5,6,7,8,9]
count=9
flag = False
while True:
next_keta_nums=[]
for num in prev_keta_nums:
num_last = int(str(num)[-1])
if num_last == 9:
... | [["-", 64, 196, 0, 1, 0, 662, 12, 634, 0, 612], ["-", 64, 196, 0, 1, 0, 662, 12, 634, 0, 21], ["+", 64, 196, 0, 1, 0, 662, 12, 634, 0, 21], ["+", 64, 196, 0, 1, 0, 662, 12, 634, 0, 612]] | 5 | 180 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pl;
#define all(a) (a).begin(), (a).end()
#define overload4(_1, _2, _3, _4, name, ...) name
#define rep1(n) for (ll i = 0; i < (n); i++)
#define rep2(i, n) for (ll i = 0; i < (n); i++)
#define rep3(i, a, b) for (ll i = (a); i < (b)... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pl;
#define all(a) (a).begin(), (a).end()
#define overload4(_1, _2, _3, _4, name, ...) name
#define rep1(n) for (ll i = 0; i < (n); i++)
#define rep2(i, n) for (ll i = 0; i < (n); i++)
#define rep3(i, a, b) for (ll i = (a); i < (b)... | [["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21]] | 1 | 511 |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
vector<ll> v;
for (int i = 1; i <= 9; i++)
v.push_back(i);
int ptr = 0;
while (v.size() < 1e5 + 3) {
int num = v[ptr];
ptr++;
int d = num % 10;
if (d - 1 >= 0)
v.push_back(num * 10 + (d - 1));
v.pu... | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
vector<ll> v;
for (int i = 1; i <= 9; i++)
v.push_back(i);
int ptr = 0;
while (v.size() < 1e5 + 3) {
ll num = v[ptr];
ptr++;
ll d = num % 10;
if (d - 1 >= 0)
v.push_back(num * 10 + (d - 1));
v.push... | [["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 52, 8, 9, 0, 43, 39, 78], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 162 |
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)
count = 0
def solve(K: int):
def cDfs(prev, prevDigit, remainDigit):
global count
if remainDigit == 0:
count += 1
if count == K:
print(prev)
exit()
return
els... | #!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)
count = 0
def solve(K: int):
def cDfs(prev, prevDigit, remainDigit):
global count
if remainDigit == 0:
count += 1
if count == K:
print(prev)
exit()
# print(prev)
... | [["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]] | 5 | 286 |
def d1(x):
y = x % 10
if y == 0:
return [0, 1]
elif y == 9:
return [8, 9]
else:
return [y-1, y, y+1]
K = int(input())
runrun = []
N = 0
digit = 0
while N < K:
d_i = []
if digit == 0:
for i in range(1, 10):
d_i.append(i)
N += len(d_i)
... | def d1(x):
y = x % 10
if y == 0:
return [0, 1]
elif y == 9:
return [8, 9]
else:
return [y-1, y, y+1]
K = int(input())
runrun = []
N = 0
digit = 0
while N < K:
d_i = []
if digit == 0:
for i in range(1, 10):
d_i.append(i)
N += len(d_i)
... | [["-", 0, 652, 3, 4, 0, 206, 206, 657, 17, 72], ["+", 0, 652, 3, 4, 0, 206, 206, 657, 17, 33]] | 5 | 173 |
#include <bits/stdc++.h>
#define COUT(x) cout << #x << " = " << (x) << ", "
typedef long long ll;
using namespace std;
static const ll MOD = 1000000007;
int main() {
ll K;
cin >> K;
vector<ll> L = {1, 2, 3, 4, 5, 6, 7, 8, 9};
ll len = 9;
ll idx = 0;
while (1) {
ll tmp = L[idx];
ll l = tmp % 10;
... | #include <bits/stdc++.h>
#define COUT(x) cout << #x << " = " << (x) << ", "
typedef long long ll;
using namespace std;
static const ll MOD = 1000000007;
int main() {
ll K;
cin >> K;
vector<ll> L = {1, 2, 3, 4, 5, 6, 7, 8, 9};
ll len = 9;
ll idx = 0;
while (1) {
ll tmp = L[idx];
ll l = tmp % 10;
... | [["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]] | 1 | 225 |
#include <bits/stdc++.h>
using namespace std;
#define f(i, x, y) for (int i = x, i##end = y; i <= i##end; ++i)
#define d(i, x, y) for (int i = x, i##end = y; i >= i##end; --i)
#define ri register int
#define ll long long
#define il inline
#define _ 100005
const ll qwq = 10;
int max(int x, int y) { return x > y ? x : y;... | #include <bits/stdc++.h>
using namespace std;
#define f(i, x, y) for (int i = x, i##end = y; i <= i##end; ++i)
#define d(i, x, y) for (int i = x, i##end = y; i >= i##end; --i)
#define ri register int
#define ll long long
#define il inline
#define _ 100005
const ll qwq = 10;
int max(int x, int y) { return x > y ? x : y;... | [["+", 0, 52, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 0, 57, 75, 76, 0, 57, 75, 76, 0, 95], ["+", 0, 34, 31, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 34, 31, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 34, 12, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 34, 12, 2, 3, 4, 0, 16, 12, 13]] | 1 | 300 |
def main():
K = int(input())
used = [1,2,3,4,5,6,7,8,9]
ans = used
k = 9
now = 0
add = [-1,0,1]
while True:
if k >= K :
break
else:
keep = []
for i in used:
if (i % 10 == 0 ) :
keep.append(i * 10 + 0)
... | def main():
K = int(input())
used = [1,2,3,4,5,6,7,8,9]
ans = used
k = 9
now = 0
add = [-1,0,1]
while True:
if k >= K :
break
else:
keep = []
for i in used:
if (i % 10 == 0 ) :
keep.append(i * 10 + 0)
... | [["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612]] | 5 | 194 |
#include <bits/stdc++.h>
using namespace std;
#define BOUND 27182818284
#define MAT 2
typedef long long ll;
typedef long long int lli;
typedef pair<ll, ll> P;
ll MOD = 1000000007;
const ll INF = (1ll << 60);
const int INFint = (1 << 30);
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) fo... | #include <bits/stdc++.h>
using namespace std;
#define BOUND 27182818284
#define MAT 2
typedef long long ll;
typedef long long int lli;
typedef pair<ll, ll> P;
ll MOD = 1000000007;
const ll INF = (1ll << 60);
const int INFint = (1 << 30);
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) fo... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]] | 1 | 2,385 |
#include <bits/stdc++.h>
#include <stdlib.h>
#include <sys/time.h>
#include <unistd.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, ll> T;
long long int INF = 1e18;
const ll fact_table = 1200008;
double Pi = 3.1415926535897932384626;
priority_queue<ll> pql;
priority_queue<P> pq... | #include <bits/stdc++.h>
#include <stdlib.h>
#include <sys/time.h>
#include <unistd.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, ll> T;
long long int INF = 1e18;
const ll fact_table = 1200008;
double Pi = 3.1415926535897932384626;
priority_queue<ll> pql;
priority_queue<P> pq... | [["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 9, 0, 1, 0, 2, 3, 4, 0, 13]] | 1 | 950 |
# -*- coding: utf-8 -*-
def input_multiple_number():
return map(int, input().split())
def input_multiple_number_as_list():
return list(map(int, input().split()))
K = int(input())
base = [1,2,3,4,5,6,7,8,9]
ans = [1,2,3,4,5,6,7,8,9]
for i in range(100000):
for j in range(3):
if ans[i]%10 == 0 and j ==0:... |
# -*- coding: utf-8 -*-
def input_multiple_number():
return map(int, input().split())
def input_multiple_number_as_list():
return list(map(int, input().split()))
K = int(input())
base = [1,2,3,4,5,6,7,8,9]
ans = [1,2,3,4,5,6,7,8,9]
for i in range(100000):
for j in range(3):
if ans[i]%10 == 0 and j ==0... | [["-", 0, 652, 3, 4, 0, 206, 206, 657, 17, 72], ["+", 0, 652, 3, 4, 0, 206, 206, 657, 17, 33]] | 5 | 167 |
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int N = 2e5 + 10;
ll k;
ll flag;
void dfs(int pos, ll val, int dig, int len) {
val = val * 10 + dig;
// cout << pos << " " << val << " " << dig << " " << len << endl;
if (pos == len) {
k--;
if (k == 0 && flag == 0)
flag = va... | #include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int N = 2e5 + 10;
ll k;
ll flag;
void dfs(ll pos, ll val, ll dig, ll len) {
val = val * 10 + dig;
// cout << pos << " " << val << " " << dig << " " << len << endl;
if (pos == len) {
k--;
if (k == 0 && flag == 0)
flag = val;
... | [["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78], ["-", 0, 7, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 0, 7, 8, 9, 0, 7, 10, 43, 39, 78], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3... | 1 | 282 |
#!usr/bin/env python3
import sys
import math
import string
import collections
import fractions
import random
from operator import itemgetter
import itertools
from collections import deque
import copy
import heapq
import bisect
MOD = 10 ** 9 + 7
INF = float('inf')
input = lambda: sys.stdin.readline().strip()
sys.setre... | #!usr/bin/env python3
import sys
import math
import string
import collections
import fractions
import random
from operator import itemgetter
import itertools
from collections import deque
import copy
import heapq
import bisect
MOD = 10 ** 9 + 7
INF = float('inf')
input = lambda: sys.stdin.readline().strip()
sys.setre... | [["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 33], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612]] | 5 | 254 |
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include ... | #include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include ... | [["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 18], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13]] | 1 | 359 |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pll;
#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)
const ll MOD = 1000000007;
const ll INF = (ll)1e15;
int main() {
cin.tie(0);
ios::sync_wit... | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pll;
#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)
const ll MOD = 1000000007;
const ll INF = (ll)1e15;
int main() {
cin.tie(0);
ios::sync_wit... | [["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 19]] | 1 | 339 |
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPP(i, n) for (int i = 1; i <= n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#d... | #include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPP(i, n) for (int i = 1; i <= n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#d... | [["-", 141, 344, 3, 347, 0, 77, 39, 86, 0, 87], ["-", 141, 344, 3, 347, 0, 77, 39, 86, 39, 40], ["+", 141, 344, 3, 347, 0, 77, 39, 86, 0, 96], ["-", 49, 53, 54, 55, 0, 56, 39, 86, 0, 87], ["-", 49, 53, 54, 55, 0, 56, 39, 86, 39, 40], ["+", 49, 53, 54, 55, 0, 56, 39, 86, 0, 96], ["-", 0, 14, 8, 9, 0, 43, 39, 86, 0, 87],... | 1 | 485 |
/*
* short 2^15-1 ~ 3e4
* int, long x86 2^31-1 ~ 2e9
* long long 2^63-1 ~ 9e18
*/
#include <bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define fr(a, b) for (int a = 0; a < b; ++a)
using namespace std;
typedef long long ll;
const int inf = numeric_limits<int>::max();
void pri... | /*
* short 2^15-1 ~ 3e4
* int, long x86 2^31-1 ~ 2e9
* long long 2^63-1 ~ 9e18
*/
#include <bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define fr(a, b) for (int a = 0; a < b; ++a)
using namespace std;
typedef long long ll;
const int inf = numeric_limits<int>::max();
void pri... | [["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]] | 1 | 484 |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef tree<ii, null_type, less<ii>, rb_tree_tag,
tree_order_statistics_node_update>
indexed_set;
const int lim = 1e5 + 7;
set<ll> eval... | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef tree<ii, null_type, less<ii>, rb_tree_tag,
tree_order_statistics_node_update>
indexed_set;
const int lim = 1e5 + 7;
set<ll> eval... | [["+", 0, 14, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13]] | 1 | 284 |
from collections import deque
k=int(input())
l=deque([i+1 for i in range(9)])
cnt=9
if k<=cnt:print(l[k-1])
else:
while cnt<k:
v=l.popleft()
if v%10==0:l.append(v*10);l.append(v*10+1);cnt+=2
elif v%10==9:l.append(v*10+9);l.append(v*10+8);cnt+=2
else:
rem=v%10
... | from collections import deque
k=int(input())
l=deque([i+1 for i in range(9)])
cnt=9
if k<=cnt:print(l[k-1])
else:
while cnt<k:
v=l.popleft()
if v%10==0:l.append(v*10);l.append(v*10+1);cnt+=2
elif v%10==9:l.append(v*10+8);l.append(v*10+9);cnt+=2
else:
rem=v%10
... | [["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612]] | 5 | 177 |
import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip() # ignore trailing spaces
K = ni() - 1
for le in range(1, 11):
for h in range(1, 10):
for a in itertools.product((-1, 0, 1), repeat=le-1):
cur = h
... | import sys
import itertools
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip() # ignore trailing spaces
K = ni() - 1
for le in range(1, 11):
for h in range(1, 10):
for a in itertools.product((-1, 0, 1), repeat=le-1):
... | [["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22]] | 5 | 181 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, c, k;
cin >> n >> k >> c;
string s;
cin >> s;
int l[n] = {}, r[n] = {};
int x = 1;
for (int i = 0; i < n && x <= k; i++) {
if (s[i] == 'o') {
l[i] = x;
x++;
i += c;
}
}
x = k;
for (int i = n - 1; i >= 0 && x;... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, c, k;
cin >> n >> k >> c;
string s;
cin >> s;
int l[n] = {}, r[n] = {};
int x = 1;
for (int i = 0; i < n && x <= k; i++) {
if (s[i] == 'o') {
l[i] = x;
x++;
i += c;
}
}
x = k;
for (int i = n - 1; i >= 0 && x;... | [["-", 15, 339, 51, 16, 31, 16, 31, 69, 28, 22], ["+", 8, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["-", 8, 57, 15, 339, 51, 16, 31, 16, 17, 60], ["-", 15, 339, 51, 16, 31, 16, 12, 103, 0, 104], ["-", 15, 339, 51, 16, 31, 16, 12, 103, 0, 125]] | 1 | 200 |
#include <bits/stdc++.h>
// clang-format off
using namespace std; using ll = int64_t; using ull = uint64_t; const ll INF = 9e18;
void print() { cout << endl; }
template<typename Head,typename... Tail> void print(Head head,Tail... tail){cout<<head;if(sizeof...(Tail)>0)cout<<" ";print(tail...);}
void print0() {}
template... | #include <bits/stdc++.h>
// clang-format off
using namespace std; using ll = int64_t; using ull = uint64_t; const ll INF = 9e18;
void print() { cout << endl; }
template<typename Head,typename... Tail> void print(Head head,Tail... tail){cout<<head;if(sizeof...(Tail)>0)cout<<" ";print(tail...);}
void print0() {}
template... | [["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 20]] | 1 | 525 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> pint;
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 998244353;
int main() {
int k;
cin >> k;
queue<int> q;
... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> pint;
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 998244353;
int main() {
int k;
cin >> k;
queue<ll> q;
... | [["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 0, 14, 8, 9, 0, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 9, 0, 43, 39, 78]] | 1 | 186 |
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws Exception {
Scanner stdIn = new Scanner(System.in);
int K = stdIn.nextInt();
Deque<Integer> Q = new ArrayDeque<Integer>();
for (int i = 1; i <= 9; i++) {
... | import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws Exception {
Scanner stdIn = new Scanner(System.in);
int K = stdIn.nextInt();
Deque<Long> Q = new ArrayDeque<Long>();
for (int i = 1; i <= 9; i++) {
Q.a... | [["-", 8, 196, 0, 503, 39, 513, 0, 237, 0, 78], ["+", 8, 196, 0, 503, 39, 513, 0, 237, 0, 78], ["-", 49, 200, 51, 230, 39, 513, 0, 237, 0, 78], ["+", 49, 200, 51, 230, 39, 513, 0, 237, 0, 78], ["+", 0, 1, 0, 492, 3, 4, 0, 74, 0, 24], ["+", 0, 492, 3, 4, 0, 74, 39, 506, 0, 96], ["+", 0, 1, 0, 492, 3, 4, 0, 74, 0, 25], [... | 3 | 213 |
K = int(input())
a = []
def dfs(x):
if x > 3234566667:
return
a.append(x)
for i in range(10):
if abs(x%10-i) <= 1:
dfs(x*10+i)
for i in range(1,11):
dfs(i)
a = sorted(a)
print(a[K-1]) | K = int(input())
a = []
def dfs(x):
if x > 3234566667:
return
a.append(x)
for i in range(10):
if abs(x%10-i) <= 1:
dfs(x*10+i)
for i in range(1,10):
dfs(i)
a = sorted(a)
print(a[K-1]) | [["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]] | 5 | 87 |
K = int(input())
if K <= 9:
print(K)
exit()
memo = [[1]*10] + [[1]*10 for _ in range(9)]
n = 9
digit = 1
i = -1
ans = []
while True:
i += 1
if i == 10:
i = 0
digit += 1
tmp = memo[digit-1][i]
if i >= 1:
tmp += memo[digit-1][i-1]
if i <= 8:
tmp += memo[digit... | K = int(input())
if K <= 9:
print(K)
exit()
memo = [[1]*10] + [[1]*10 for _ in range(9)]
n = 9
digit = 1
i = -1
ans = []
while True:
i += 1
if i == 10:
i = 0
digit += 1
tmp = memo[digit-1][i]
if i >= 1:
tmp += memo[digit-1][i-1]
if i <= 8:
tmp += memo[digit... | [["+", 64, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 612], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]] | 5 | 212 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
long long k;
cin >> k;
if (k <= 12) {
cout << k << endl;
return 0;
}
long long dp[20][11] = {0};
for (int i = 0; i < 10; i++) {
dp[1][i] = 1;
}
... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
long long k;
cin >> k;
if (k <= 12) {
cout << k << endl;
return 0;
}
long long dp[20][11] = {0};
for (int i = 0; i < 10; i++) {
dp[1][i] = 1;
}
... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]] | 1 | 413 |
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
typedef long long ll;
#define bay_bay return 0;
#define fori(n) for (int i = 0; i < n; ++i)
#define for1(n) for (int i = 1; i <= n; i += 3)
#define all(v) ((v).begin()), ((v).end())
#define sz... | #define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
typedef long long ll;
#define bay_bay return 0;
#define fori(n) for (int i = 0; i < n; ++i)
#define for1(n) for (int i = 1; i <= n; i += 3)
#define all(v) ((v).begin()), ((v).end())
#define sz... | [["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]] | 1 | 296 |
# coding: utf-8
from collections import deque
K = int(input())
queue = [str(i) for i in range(1, 10)]
# print(queue)
queue = deque(queue)
L = []
cnt = 0
while cnt <= K:
v = queue.popleft()
# L.push(int(v))
L.append(int(v))
if v[-1] == "0":
# print("v =", v)
queue.append(v + v[-1])
... | # coding: utf-8
from collections import deque
K = int(input())
queue = [str(i) for i in range(1, 10)]
# print(queue)
queue = deque(queue)
L = []
cnt = 0
while cnt < K:
v = queue.popleft()
# L.push(int(v))
L.append(int(v))
if v[-1] == "0":
# print("v =", v)
queue.append(v + v[-1])
... | [["-", 36, 36, 0, 656, 0, 52, 15, 666, 667, 19], ["+", 36, 36, 0, 656, 0, 52, 15, 666, 667, 18]] | 5 | 192 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
int main() {
ll K, s, t, a;
cin >> K;
ll ans = 0, sum = 0;
vector<vector<int>> vec(12, vector<int>(12, 0));
for (int i = 1; i < 11; i++) {
vec[1][i] = 1;
}
for (int i = 2; i < 12; i++) {
for (int j = 1... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
int main() {
ll K, s, t, a;
cin >> K;
ll ans = 0, sum = 0;
vector<vector<int>> vec(12, vector<int>(12, 0));
for (int i = 1; i < 11; i++) {
vec[1][i] = 1;
}
for (int i = 2; i < 12; i++) {
for (int j = 1... | [["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13]] | 1 | 376 |
// by Top1
#include <bits/stdc++.h>
#define f first
#define s second
#define int long long
#define ld long double
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<long, long>
#define mp make_pair
#define pb push_back
#define pf push_front
#define pp pop_back
#define cerr cout
#define rev reve... | // by Top1
#include <bits/stdc++.h>
#define f first
#define s second
#define int long long
#define ld long double
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<long, long>
#define mp make_pair
#define pb push_back
#define pf push_front
#define pp pop_back
#define cerr cout
#define rev reve... | [["-", 51, 16, 31, 2, 3, 4, 0, 16, 31, 22], ["+", 3, 4, 0, 16, 31, 16, 31, 69, 28, 22], ["+", 0, 16, 31, 16, 31, 69, 341, 342, 0, 70], ["+", 0, 16, 31, 16, 31, 69, 341, 342, 0, 22], ["+", 0, 16, 31, 16, 31, 69, 341, 342, 0, 73], ["+", 31, 2, 3, 4, 0, 16, 31, 16, 17, 109], ["+", 31, 2, 3, 4, 0, 16, 31, 16, 12, 13]] | 1 | 415 |
#include <bits/stdc++.h>
using namespace std;
int K;
queue<long long> que;
int c = 10;
int main() {
long long answer;
cin >> K;
for (int i = 0; i < 9; i++) {
que.push(i + 1);
}
if (K <= 9) {
answer = K;
} else {
cout << "";
while (que.size()) {
long long a;
a = que.front();
... | #include <bits/stdc++.h>
using namespace std;
int K;
queue<long long> que;
int c = 10;
int main() {
long long answer;
cin >> K;
for (int i = 0; i < 9; i++) {
que.push(i + 1);
}
if (K <= 9) {
answer = K;
} else {
cout << "";
while (que.size()) {
long long a;
a = que.front();
... | [["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46], ["-", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]] | 1 | 397 |
#include <iostream>
using namespace std;
using ll = long long;
int cnt = 1;
int k;
void f(int d, int d_now, int prev, ll sum) {
for (int i = prev - 1; i <= prev + 1; i++) {
if (i < 10) {
// sumを求める
ll s = i;
for (int j = 0; j < d - d_now; j++)
s *= 10;
ll n_sum = sum + s;
... | #include <iostream>
using namespace std;
using ll = long long;
int cnt = 1;
int k;
void f(int d, int d_now, int prev, ll sum) {
for (int i = prev - 1; i <= prev + 1; i++) {
if (0 <= i && i < 10) {
// sumを求める
ll s = i;
for (int j = 0; j < d - d_now; j++)
s *= 10;
ll n_sum = sum + ... | [["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 19], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98]] | 1 | 252 |
import java.io.*;
import java.lang.*;
import java.math.BigInteger;
import java.util.*;
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWri... | import java.io.*;
import java.lang.*;
import java.math.BigInteger;
import java.util.*;
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWri... | [["-", 8, 196, 0, 7, 502, 503, 49, 200, 51, 499], ["+", 8, 196, 0, 7, 502, 503, 49, 200, 51, 22]] | 3 | 1,186 |
#include <iostream>
using namespace std;
long long A[200000];
int k = 0;
long long B[1000];
int N;
int M;
void dfs(int i) {
if (i >= N - 1) {
long long num = 0;
for (int l = 0; l < N - 1; l++) {
num += B[l];
num *= 10;
}
for (int j = max((long long)0, B[i - 1] - 1);
j <= min(B[i ... | #include <iostream>
using namespace std;
long long A[200000];
int k = 0;
long long B[1000];
int N;
int M;
void dfs(int i) {
if (i >= N - 1) {
long long num = 0;
for (int l = 0; l < N - 1; l++) {
num += B[l];
num *= 10;
}
for (int j = max((long long)0, B[i - 1] - 1);
j <= min(B[i ... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]] | 1 | 348 |
#include <bits/stdc++.h>
#define pi 3.14159
using namespace std;
typedef long long LL;
const LL MOD = 1e9 + 7;
const long long N = 2e7 + 9, M = 1e7, OO = 0x3f3f3f3f;
vector<long long> v;
void bfs(long long n, long long m) {
queue<long long> q;
for (long long i = 0; i <= 9; i++)
q.push(i);
while (!q.empty()) ... | #include <bits/stdc++.h>
#define pi 3.14159
using namespace std;
typedef long long LL;
const LL MOD = 1e9 + 7;
const long long N = 2e7 + 9, M = 1e7, OO = 0x3f3f3f3f;
vector<long long> v;
void bfs(long long n, long long m) {
queue<long long> q;
for (long long i = 0; i <= 9; i++)
q.push(i);
while (!q.empty()) ... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 1 | 319 |
data = 'B|B|B|B|B|B|B|B|B|B|B|B|J|B|B|J|B|B|J|B|B|J|B|B|J|B|B|J|B|B|J|B|B|J|B|B|B|J|B|B|J|B|B|9|B|B|J|B|B|J|B|B|9|B|B|J|B|B|J|B|B|9|B|B|J|B|B|J|B|B|9|B|B|J|B|B|J|B|B|9|B|B|J|B|B|J|B|B|9|B|B|J|B|B|J|B|B|9|B|B|J|B|B|J|B|AB|B|B|J|B|B|B|J|B|B|AB|B|J|B|B|J|B|B|9|B|B|J|B|B|J|B|B| J|B|J|B|B|J|B|B|9|B|B|J|B|B|J|B|B|9|B|B|J|B|B... | data = 'B|B|B|B|B|B|B|B|B|B|B|B|J|B|B|J|B|B|J|B|B|J|B|B|J|B|B|J|B|B|J|B|B|J|B|B|B|J|B|B|J|B|B|9|B|B|J|B|B|J|B|B|9|B|B|J|B|B|J|B|B|9|B|B|J|B|B|J|B|B|9|B|B|J|B|B|J|B|B|9|B|B|J|B|B|J|B|B|9|B|B|J|B|B|J|B|B|9|B|B|J|B|B|J|B|AB|B|B|J|B|B|B|J|B|B|AB|B|J|B|B|J|B|B|9|B|B|J|B|B|J|B|B| J|B|J|B|B|J|B|B|9|B|B|J|B|B|J|B|B|9|B|B|J|B|B... | [["-", 0, 7, 8, 196, 0, 1, 0, 677, 12, 612], ["+", 8, 196, 0, 1, 0, 677, 12, 652, 63, 22], ["+", 0, 1, 0, 677, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 677, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 677, 12, 652, 3, 4, 0, 25]] | 5 | 79 |
#!/usr/bin/env python3
ans = [0] * 10
ans[1] = '1'
for i in range(2, 10):
ans[i] = str(i)
alpha = "0123456789"
def dfs(s):
if len(s) == N:
ans.append(s)
if len(ans) >= 100001:
return
else:
for c in range(int(s[-1])-1,int(s[-1])+2):
if c >= 0:
d... | #!/usr/bin/env python3
ans = [0] * 10
ans[1] = '1'
for i in range(2, 10):
ans[i] = str(i)
alpha = "0123456789"
def dfs(s):
if len(s) == N:
ans.append(s)
if len(ans) >= 100001:
return
else:
for c in range(int(s[-1])-1,int(s[-1])+2):
if c >= 0:
d... | [["-", 8, 196, 0, 57, 15, 666, 0, 557, 0, 654], ["-", 8, 196, 0, 57, 15, 666, 0, 557, 0, 655]] | 5 | 176 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(s, i, n) for (int i = (int)s; i < (int)(n); i++)
#define pb push_back
typedef long long ll;
ll k;
ll kt;
ll ans;
ll dfs(string s, ll i) {
ll l = s.length();
if (l == i) {
kt = kt + 1;
if (kt == ... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(s, i, n) for (int i = (int)s; i < (int)(n); i++)
#define pb push_back
typedef long long ll;
ll k;
ll kt;
ll ans;
ll dfs(string s, ll i) {
ll l = s.length();
if (l == i) {
kt = kt + 1;
if (kt == ... | [["+", 51, 16, 31, 16, 12, 16, 31, 16, 17, 72], ["+", 51, 16, 31, 16, 12, 16, 31, 16, 12, 22], ["+", 51, 16, 12, 16, 31, 16, 31, 16, 17, 72], ["+", 51, 16, 12, 16, 31, 16, 31, 16, 12, 22]] | 1 | 254 |
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <queue>
#include <string>
using namespace std;
typedef long long ll;
int a[200005];
int main() {
ll i, n, sum = 0, t, t1 = 0, t2;
cin >> n;
queue<ll> Q;
Q.push(1);
Q.push(2);
Q.push(3);
Q.push(4);
Q.push(5);
Q.push(... | #include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <queue>
#include <string>
using namespace std;
typedef long long ll;
ll a[200005];
int main() {
ll i, n, sum = 0, t, t1 = 0, t2;
cin >> n;
queue<ll> Q;
Q.push(1);
Q.push(2);
Q.push(3);
Q.push(4);
Q.push(5);
Q.push(6... | [["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]] | 1 | 330 |
k = int(input())
n = 1
cnt = 0
flg = 0
while True:
if flg == 1:
n += 1
flg = 0
strn = str(n)
if len(strn) == 1:
cnt += 1
n += 1
else:
for s in range(len(strn)):
if s == len(strn) - 1:
cnt += 1
flg = 1
else:
if abs(int(strn[s]) - int(strn[s+1])) > 1:
... | k = int(input())
n = 1
cnt = 0
flg = 0
while True:
if flg == 1:
n += 1
flg = 0
strn = str(n)
if len(strn) == 1:
cnt += 1
flg = 1
else:
for s in range(len(strn)):
if s == len(strn) - 1:
cnt += 1
flg = 1
else:
if abs(int(strn[s]) - int(strn[s+1])) > 1:
... | [["-", 0, 57, 64, 196, 0, 1, 0, 677, 31, 22], ["-", 0, 57, 64, 196, 0, 1, 0, 677, 17, 107], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32]] | 5 | 250 |
def resolve():
import sys
input = sys.stdin.readline
k = int(input().rstrip())
if k <= 9:
# print(k)
sys.exit()
def judge(number_list, index, total):
if index == len(number_list) - 2: # 最後から2番目の桁
num = number_list[index]
add_num = 2 if num in (0, 9... |
def resolve():
import sys
input = sys.stdin.readline
k = int(input().rstrip())
if k <= 9:
print(k)
sys.exit()
def judge(number_list, index, total):
if index == len(number_list) - 2: # 最後から2番目の桁
num = number_list[index]
add_num = 2 if num in (0, 9) ... | [["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 323 |
#include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
#define PI 3.14159265358979
typedef long long int ll... | #include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
#define PI 3.14159265358979
typedef long long int ll... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 16, 12, 69, 28, 22], ["+", 0, 1, 0, 16, 12, 69, 341, 342, 0, 70], ["+", 0, 1, 0, 16, 12, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 16, 12, 69, 341, 342, 0, 73]] | 1 | 338 |
#define ANSWER
#include <algorithm>
#include <cmath>
#include <iostream>
#include <numeric>
#include <vector>
template <typename T> class mylist {
private:
std::vector<char> alphabets = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
... | #define ANSWER
#include <algorithm>
#include <cmath>
#include <iostream>
#include <numeric>
#include <vector>
template <typename T> class mylist {
private:
std::vector<char> alphabets = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
... | [["-", 0, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["-", 0, 9, 0, 1, 0, 11, 12, 16, 17, 72]] | 1 | 3,833 |
#include <bits/stdc++.h>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cer... | #include <bits/stdc++.h>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cer... | [["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 48]] | 1 | 745 |
#include <bits/stdc++.h>
using namespace std;
vector<int> l1, l2;
int main() {
int n, c, k;
string s;
cin >> n >> k >> c;
cin >> s;
int last = -1e9;
for (int i = 0; i < n; i++) {
if (s[i] == 'o' && last + c <= i) {
l1.push_back(i);
last = i;
}
if (l1.size() == k)
break;
}
i... | #include <bits/stdc++.h>
using namespace std;
vector<int> l1, l2;
int main() {
int n, c, k;
string s;
cin >> n >> k >> c;
cin >> s;
int last = -1e9;
for (int i = 0; i < n; i++) {
if (s[i] == 'o' && last + c < i) {
l1.push_back(i);
last = i;
}
if (l1.size() == k)
break;
}
in... | [["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 19], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 18]] | 1 | 224 |
#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
string s;
int n, k, c;
int l[N], r[N];
int main() {
cin >> n >> k >> c >> s;
int i = 1, kk = 1;
while (kk <= k) {
if (s[i - 1] = 'o') {
l[kk++] = i;
i += c;
}
i++;
}
i = n, kk = k;
while (kk) {
if (s[i - 1] == 'o... | #include <bits/stdc++.h>
using namespace std;
const int N = 200005;
string s;
int n, k, c;
int l[N], r[N];
int main() {
cin >> n >> k >> c >> s;
int i = 1, kk = 1;
while (kk <= k) {
if (s[i - 1] == 'o') {
l[kk++] = i;
i += c;
}
i++;
}
i = n, kk = k;
while (kk) {
if (s[i - 1] == '... | [["-", 8, 9, 0, 57, 15, 339, 51, 11, 17, 32], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60]] | 1 | 179 |
N,K,C = map(int,input().split())
S = list(input())
F = []
maru = 0
last = -10**9
span = C
for i in range(N):
if S[i]=="o" and span >= C:
maru += 1
last = i
F.append([maru,last])
span = 0
else:
span += 1
F.append([maru,last])
#print(F)
s = S[::-1]
maru = 0
last = 1... | N,K,C = map(int,input().split())
S = list(input())
F = []
maru = 0
last = -10**9
span = C
for i in range(N):
if S[i]=="o" and span >= C:
maru += 1
last = i
F.append([maru,last])
span = 0
else:
span += 1
F.append([maru,last])
#print(F)
s = S[::-1]
maru = 0
last = 1... | [["-", 0, 57, 64, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 57, 64, 196, 0, 57, 15, 666, 0, 22]] | 5 | 350 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.