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 |
|---|---|---|---|---|
k=gets.to_i
z=*1..9
a=0
k.times{
a=z.shift
b=a%10
z << a*10 + (a-1) if a != 0
z << a*10 + a
z << a*10 + (a+1) if a != 9
}
p a | k=gets.to_i
z=*1..9
a=0
k.times{
a=z.shift
b=a%10
z << a*10 + (b-1) if b != 0
z << a*10 + b
z << a*10 + (b+1) if b != 9
}
p a | [["-", 8, 738, 12, 738, 12, 739, 0, 738, 31, 22], ["+", 8, 738, 12, 738, 12, 739, 0, 738, 31, 22], ["-", 196, 196, 8, 734, 0, 751, 15, 738, 31, 22], ["+", 196, 196, 8, 734, 0, 751, 15, 738, 31, 22], ["-", 196, 196, 8, 734, 0, 738, 12, 738, 12, 22], ["+", 196, 196, 8, 734, 0, 738, 12, 738, 12, 22]] | 4 | 68 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int k;
cin >> k;
queue<int> q;
for (int i = 1; i < 10; i++)
q.push(i);
int ans = 0;
for (int i = 0; i < k; i++) {
int x = q.front();
q.pop();
if (i == k - 1) {
ans = x;
}
if (x % 10 != 0) {
q.push(x * 10 + x % 1... | #include <bits/stdc++.h>
using namespace std;
int main() {
int k;
cin >> k;
queue<long long> q;
for (int i = 1; i < 10; i++)
q.push(i);
long long ans = 0;
for (int i = 0; i < k; i++) {
long long x = q.front();
q.pop();
if (i == k - 1) {
ans = x;
}
if (x % 10 != 0) {
q.p... | [["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 0, 7, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 168 |
from collections import deque
def main():
K = int(input())
if K <= 0:
print(K)
que = deque(range(1,10))
# print(que)
cnt = 9
while True:
x = que.popleft()
mod = x % 10
if mod != 0:
que.append(10 * x + mod - 1)
# print(que)
cn... | from collections import deque
def main():
K = int(input())
if K <= 9:
print(K)
return
que = deque(range(1,10))
# print(que)
cnt = 9
while True:
x = que.popleft()
mod = x % 10
if mod != 0:
que.append(10 * x + mod - 1)
# print(que)... | [["-", 0, 14, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 8, 196, 0, 57, 64, 196, 0, 37, 0, 38]] | 5 | 157 |
K = int(input())
def cal():
count = 9
d = [[1,2,3,4,5,6,7,8,9]]
for i in range(10**9):
d_ = []
for j in range(len(d[i])):
a = str(d[i][j])
if a[-1]=="0":
for k in [0,1]:
d_.append(int(a)*10+k)
count += 1
... | K = int(input())
def cal():
count = 9
d = [[1,2,3,4,5,6,7,8,9]]
for i in range(10**9):
d_ = []
for j in range(len(d[i])):
a = str(d[i][j])
if a[-1]=="0":
for k in [0, 1]:
d_.append(int(a)*10+k)
count += 1
... | [["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22]] | 5 | 252 |
def jud(n1,n2):
if abs(n1-int(str(n2)[0]))<=1:
return 1
else:
return 0
rnrn = [[1,2,3,4,5,6,7,8,9],[10,11,12,21,22,23,32,33,34,43,44,45,54,55,56,65,66,67,76,77,78,87,88,89,98,99]]
for div in range(1,12):
rnrn.append([])
for i in range(len(rnrn[div])):
y = str(rnrn[div][i])
x = int(y[-1])
if x-1!=-1:
... | def jud(n1,n2):
if abs(n1-int(str(n2)[0]))<=1:
return 1
else:
return 0
rnrn = [[1,2,3,4,5,6,7,8,9],[10,11,12,21,22,23,32,33,34,43,44,45,54,55,56,65,66,67,76,77,78,87,88,89,98,99]]
for div in range(1,10):
rnrn.append([])
for i in range(len(rnrn[div])):
y = str(rnrn[div][i])
x = int(y[-1])
if x-1!=-1:
... | [["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 652, 3, 4, 0, 206, 206, 657, 17, 33], ["+", 0, 652, 3, 4, 0, 206, 206, 657, 12, 612]] | 5 | 275 |
#include <iostream>
#include <queue>
using namespace std;
int me[20][10];
void fu(int dp, int di, int k) {
cout << di;
if (dp == 1)
return;
for (int l = di - 1; l <= di + 1; l++)
if (l >= 0 && l < 10) {
if (me[dp][l] < k)
k -= me[dp][l];
else {
fu(dp - 1, l, k);
retu... | #include <iostream>
#include <queue>
using namespace std;
int me[20][10];
void fu(int dp, int di, int k) {
cout << di;
if (dp == 1)
return;
for (int l = di - 1; l <= di + 1; l++)
if (l >= 0 && l < 10) {
if (me[dp - 1][l] < k)
k -= me[dp - 1][l];
else {
fu(dp - 1, l, k);
... | [["+", 31, 69, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 31, 69, 28, 69, 341, 342, 0, 16, 12, 13], ["+", 12, 69, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 12, 69, 28, 69, 341, 342, 0, 16, 12, 13]] | 1 | 349 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; ++i)
void dfs(long long n, vector<long long> &lun) {
if (n > 3234566667)
return;
lun.push_back(n);
int q = n % 10;
if (q < 9)
dfs(n * 10 + q - 1, lun);
dfs(n * 10 + q, lun);
if (q > 0)
dfs(n * 10 + q + 1, lun... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; ++i)
void dfs(long long n, vector<long long> &lun) {
if (n > 3234566667)
return;
lun.push_back(n);
int q = n % 10;
if (q < 9)
dfs(n * 10 + q + 1, lun);
dfs(n * 10 + q, lun);
if (q > 0)
dfs(n * 10 + q - 1, lun... | [["-", 64, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 64, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 64, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 64, 1, 0, 2, 3, 4, 0, 16, 17, 33]] | 1 | 172 |
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <stdio.h>
#include <vector>
using namespace std;
#define int long long
#define double long double
#define rep(s, i, n) for (int i = s; i < n; i++)
#define c(n) cout << n << endl;
#define ic(n) ... | #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <stdio.h>
#include <vector>
using namespace std;
#define int long long
#define double long double
#define rep(s, i, n) for (int i = s; i < n; i++)
#define c(n) cout << n << endl;
#define ic(n) ... | [["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13]] | 1 | 2,389 |
#include <iostream>
#include <queue>
using namespace std;
int main() {
int K;
cin >> K;
queue<int> Q;
for (int i = 1; i != 10; i++) {
Q.push(i);
};
int curr = 0;
int cnt = 0;
while (cnt < K) {
curr = Q.front();
if (curr % 10 != 0) {
Q.push(10 * curr + (curr % 10) - 1);
}
Q... | #include <iostream>
#include <queue>
using namespace std;
int main() {
int K;
cin >> K;
queue<long> Q;
for (int i = 1; i != 10; i++) {
Q.push(i);
};
long curr = 0;
int cnt = 0;
while (cnt < K) {
curr = Q.front();
if (curr % 10 != 0) {
Q.push(10 * curr + (curr % 10) - 1);
}
... | [["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 48], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72]] | 1 | 159 |
#include <iostream>
using namespace std;
using ll = long long;
constexpr int DMAX = 20;
ll nl[DMAX][10];
int main() {
int k;
cin >> k;
int cnt{};
for (int i = 0; i != 10; ++i) {
nl[0][i] = 1;
if (i)
cnt += nl[0][i];
if (cnt == k) {
cout << i << endl;
return 0;
}
}
int... | #include <iostream>
using namespace std;
using ll = long long;
constexpr int DMAX = 20;
ll nl[DMAX][10];
int main() {
int k;
cin >> k;
int cnt{};
for (int i = 0; i != 10; ++i) {
nl[0][i] = 1;
if (i)
cnt += nl[0][i];
if (cnt == k) {
cout << i << endl;
return 0;
}
}
int... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 375 |
K = int(input())
import queue
q = queue.Queue()
for i in range(1,10):
q.put(i)
for i in range(K-1):
num = q.get()
if num%10!=0:
q.put(10*num+(num%10)-1)
q.put(num*10)
if num%10!=9:
q.put(10*num+(num%10)+1)
print(q.get()) | K = int(input())
import queue
q = queue.Queue()
for i in range(1,10):
q.put(i)
for i in range(K-1):
num = q.get()
if num%10!=0:
q.put(10*num+(num%10)-1)
q.put(num*10+(num%10))
if num%10!=9:
q.put(10*num+(num%10)+1)
print(q.get()) | [["+", 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 | 112 |
queue = (1..9).map {|x| [x] }
# k = gets.to_i
k = 100000
count = 0
ans = -1
loop do
x = queue.shift
count += 1
if count == k
ans = x
break
end
if x.last == 0
queue << (x + [0]) << (x + [1])
elsif x.last != 9
last = x.last
queue << (x + [last - 1]) << (x + [last]) << (x + [last + 1])... | queue = (1..9).map {|x| [x] }
k = gets.to_i
count = 0
ans = -1
loop do
x = queue.shift
count += 1
if count == k
ans = x
break
end
if x.last == 0
queue << (x + [0]) << (x + [1])
elsif x.last != 9
last = x.last
queue << (x + [last - 1]) << (x + [last]) << (x + [last + 1])
elsif x.la... | [["-", 36, 36, 36, 36, 0, 493, 0, 662, 12, 612], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 486, 22], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 17, 131], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 735, 22]] | 4 | 143 |
#include "bits/stdc++.h"
using namespace std;
int main() {
int K;
cin >> K;
int count = 0;
int keta = 0;
vector<long long> num;
for (int i = 0; i < 9; i++)
num.push_back(i + 1);
count = 9;
int head1 = 0;
int head2 = 8;
while (true) {
for (int i = head1; i <= head2; i++) {
if (num[i] ... | #include "bits/stdc++.h"
using namespace std;
int main() {
int K;
cin >> K;
int count = 0;
int keta = 0;
vector<long long> num;
for (int i = 0; i < 9; i++)
num.push_back(i + 1);
count = 9;
int head1 = 0;
int head2 = 8;
while (true) {
for (int i = head1; i <= head2; i++) {
if (num[i] ... | [["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]] | 1 | 280 |
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
void solve() {
ll k;
cin >> k;
queue<ll> q;
for (int i = 1; i <= 9; ++i)
q.push(i);
k--;
while (k--) {
ll x = q.front();
q.pop();
if (x % 10 != 0)
q.push(10 * x + x % 10 - 1);
q.push(10 * x);
if (x % 10 != 9)
... | #include <bits/stdc++.h>
using ll = long long;
using namespace std;
void solve() {
ll k;
cin >> k;
queue<ll> q;
for (int i = 1; i <= 9; ++i)
q.push(i);
k--;
while (k--) {
ll x = q.front();
q.pop();
if (x % 10 != 0)
q.push(10 * x + x % 10 - 1);
q.push(10 * x + x % 10);
if (x % ... | [["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 2, 3, 4, 0, 16, 12, 16, 31, 22], ["+", 0, 2, 3, 4, 0, 16, 12, 16, 17, 109], ["+", 0, 2, 3, 4, 0, 16, 12, 16, 12, 13]] | 1 | 205 |
import queue
k = int(input())
q = queue.Queue()
for i in range(1,10):
q.put(i)
c = 1
while c<k:
x = q.get()
r = x%10
if r != 0 and r != 9:
q.put(10*x+r-1)
q.put(10*x+r)
q.put(10*x+r+1)
c = c+1
if r == 0:
q.put(10*x)
q.put(10*x+1)
c = c+... | import queue
k = int(input())
q = queue.Queue()
for i in range(1,10):
q.put(i)
c = 0
while c<k:
x = q.get()
r = x%10
if r != 0 and r != 9:
q.put(10*x+r-1)
q.put(10*x+r)
q.put(10*x+r+1)
c = c+1
if r == 0:
q.put(10*x)
q.put(10*x+1)
c = c+... | [["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 12, 61... | 5 | 165 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int k;
cin >> k;
queue<ll> q;
for (ll i = 0; i <= 9; i++)
q.push(i);
ll ans;
for (int i = 0; i < k; i++) {
ans = q.front();
q.pop();
if (ans % 10 != 0)
q.push((ans * 10 + ans % 10 - 1));
q.push((ans *... |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int k;
cin >> k;
queue<ll> q;
for (ll i = 1; i <= 9; i++)
q.push(i);
ll ans;
for (int i = 0; i < k; i++) {
ans = q.front();
q.pop();
if (ans % 10 != 0)
q.push((ans * 10 + ans % 10 - 1));
q.push((ans *... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 160 |
#include <bits/stdc++.h>
using namespace std;
using namespace __detail;
typedef long long ll;
#define ar array
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define fork(i, n) for (ll i = 0; i < (n); i++)
#define forn for (ll i = 0; i < (n); i++)
#define fori(i, k, n) for (ll i =... | #include <bits/stdc++.h>
using namespace std;
using namespace __detail;
typedef long long ll;
#define ar array
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define fork(i, n) for (ll i = 0; i < (n); i++)
#define forn for (ll i = 0; i < (n); i++)
#define fori(i, k, n) for (ll i =... | [["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 52, 8, 9, 0, 43, 39, 78]] | 1 | 508 |
#include <bits/stdc++.h>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const long long MOD = 1000000007;
const long long INF = 1LL << 60;
const int INT_INF = 1000000000;
// int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int d... | #include <bits/stdc++.h>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const long long MOD = 1000000007;
const long long INF = 1LL << 60;
const int INT_INF = 1000000000;
// int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int d... | [["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 19], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 20], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 20], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 19]] | 1 | 258 |
k = int(input())
#n, k = list(map(int, input().split()))
#a = list(map(int, input().split()))
q = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])
for i in range(k):
x = q.popleft()
a = 10*x+(x % 10)
if x % 10 != 0:
q.append(a-1)
q.append(a)
if x % 10 != 9:
q.append(a+1)
print(x) | from collections import deque
k = int(input())
q = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])
for i in range(k):
x = q.popleft()
a = 10*x+(x % 10)
if x % 10 != 0:
q.append(a-1)
q.append(a)
if x % 10 != 9:
q.append(a+1)
print(x)
| [["+", 36, 36, 36, 36, 0, 656, 0, 686, 0, 314], ["+", 36, 36, 0, 656, 0, 686, 687, 673, 0, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 686, 0, 487], ["+", 36, 36, 0, 656, 0, 686, 141, 673, 0, 22]] | 5 | 100 |
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
K = int(read())
pre_lis = []
for i in range(1,10):
pre_lis.append(str(i))
print(pre_lis)
ct = 9
if K <= 9:
print(pre_lis[K-1])
else:
new_lis = []
flag = False
while ct < K:
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
K = int(read())
pre_lis = []
for i in range(1,10):
pre_lis.append(str(i))
ct = 9
if K <= 9:
print(pre_lis[K-1])
else:
new_lis = []
flag = False
while ct < K:
for num in... | [["-", 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, 25]] | 5 | 171 |
#include <bits/stdc++.h>
using namespace std;
void rec(int d, long long val, vector<long long> &all) {
all.push_back(val);
if (d == 10)
return;
for (int j = -1; j <= 1; j++) {
int add = (val % 10) + j;
if (add >= 0 && add <= 9)
rec(d + 1, val * 10 + add, all);
}
}
int main() {
int K;
... | #include <bits/stdc++.h>
using namespace std;
void rec(int d, long long val, vector<long long> &all) {
all.push_back(val);
if (d == 10)
return;
for (int j = -1; j <= 1; j++) {
int add = (val % 10) + j;
if (add >= 0 && add <= 9)
rec(d + 1, val * 10 + add, all);
}
}
int main() {
int K;
... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 162 |
#include <algorithm>
#include <iostream>
#include <math.h>
#include <string.h>
#include <utility>
#include <vector>
using namespace std;
typedef long long int ll;
const ll mod = 998244353;
const ll INF = 1e9 + 5;
ll ap(ll c) {
ll k = 0;
while (c > 0) {
k = c % 10;
c /= 10;
}
return k;
}
ll jari(ll c) {... | #include <algorithm>
#include <iostream>
#include <math.h>
#include <string.h>
#include <utility>
#include <vector>
using namespace std;
typedef long long int ll;
const ll mod = 998244353;
const ll INF = 1e9 + 5;
ll ap(ll c) {
ll k = 0;
while (c > 0) {
k = c % 10;
c /= 10;
}
return k;
}
ll jari(ll c) {... | [["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 19]] | 1 | 511 |
# import numpy as np
def solve():
print(ll_no_dup[k-1])
return
#a = [int(i) for i in input().split(" ")]
lunluns = [str(i) for i in range(1, 10)]
it = 0
count = 0
all_count = len(lunluns)
while count <= 10 ** 5:
it = len(lunluns)
last_count = all_count
all_count = 0
for i in range(i... | # import numpy as np
def solve():
print(ll_no_dup[k-1])
return
#a = [int(i) for i in input().split(" ")]
lunluns = [str(i) for i in range(1, 10)]
it = 0
count = 0
all_count = len(lunluns)
while count <= 10 ** 5:
it = len(lunluns)
last_count = all_count
all_count = 0
for i in range(i... | [["-", 0, 662, 12, 634, 0, 652, 3, 4, 0, 612], ["+", 0, 662, 12, 634, 0, 652, 3, 4, 0, 612]] | 5 | 226 |
#include <bits/stdc++.h>
using namespace std;
#define MOD_NUMBER 1000000007
template <class T> void vector_print(vector<T> vec) {
for (unsigned int i = 0; i < vec.size(); i++) {
cout << vec.at(i);
if (i < vec.size() - 1) {
cout << " ";
} else if (i == vec.size() - 1) {
cout << endl;
}
}
... | #include <bits/stdc++.h>
using namespace std;
#define MOD_NUMBER 1000000007
template <class T> void vector_print(vector<T> vec) {
for (unsigned int i = 0; i < vec.size(); i++) {
cout << vec.at(i);
if (i < vec.size() - 1) {
cout << " ";
} else if (i == vec.size() - 1) {
cout << endl;
}
}
... | [["-", 0, 57, 64, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 17, 151]] | 1 | 269 |
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int k = Integer.parseInt(scanner.next());
ArrayList<Long> list = new ArrayList();
for (long i = 1; i < 10; i++) {
list.add(i);
}
if (k < 10) {
System.out.prin... | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int k = Integer.parseInt(scanner.next());
ArrayList<Long> list = new ArrayList();
for (long i = 1; i < 10; i++) {
list.add(i);
}
if (k < 10) {
System.out.prin... | [["-", 0, 52, 8, 196, 0, 1, 0, 492, 0, 131], ["-", 0, 52, 8, 196, 0, 1, 0, 492, 141, 22], ["+", 0, 52, 8, 196, 0, 1, 0, 11, 17, 32], ["+", 8, 196, 0, 1, 0, 11, 12, 230, 0, 228], ["+", 8, 196, 0, 1, 0, 11, 12, 230, 39, 78]] | 3 | 307 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep2(i, n, m) for (int i = n; i < m; ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, m;
string s;
int i, b, c = 0, sum = 0;
queue<... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep2(i, n, m) for (int i = n; i < m; ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
ll n, m;
string s;
ll i, b, c = 0, sum = 0;
queue<ll... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 218 |
#include <bits/stdc++.h>
template <typename InputIterator>
typename InputIterator::value_type summation(InputIterator first,
InputIterator last) {
return std::accumulate(first, last, typename InputIterator::value_type());
}
template <typename T>
std::istream &operator>>(s... | #include <bits/stdc++.h>
template <typename InputIterator>
typename InputIterator::value_type summation(InputIterator first,
InputIterator last) {
return std::accumulate(first, last, typename InputIterator::value_type());
}
template <typename T>
std::istream &operator>>(s... | [["+", 0, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 16, 31, 69, 341, 342, 0, 16, 12, 13]] | 1 | 1,119 |
import collections
k = int(input())
li = [str(i) for i in range(1,10)]
st_li = li[:]
q = collections.deque(li)
count = 0
n = 10 ** 10
for i in range(1,n):
# print(st_li)
a = q.popleft()
num = int(a[-1])
# print(num)
if num != 0:
aa = a + str(num-1)
st_li.append(aa)
q.append... | import collections
k = int(input())
li = [str(i) for i in range(1,10)]
st_li = li[:]
q = collections.deque(li)
count = 0
n = 10 ** 10
for i in range(1,n):
# print(st_li)
a = q.popleft()
num = int(a[-1])
# print(num)
if num != 0:
aa = a + str(num-1)
st_li.append(aa)
q.append... | [["+", 8, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 173 |
k = int(input())
a[i] = [1, 2, 3, 4, 5, 6, 7, 8, 9]
for i in range(k):
if a[i] % 10 != 0:
a.append(10*a[i] + a[i] % 10 - 1)
a.append(10*a[i] + a[i] % 10)
if a[i] % 10 != 9:
a.append(10*a[i] + a[i] % 10 + 1)
print(a[k - 1])
| k = int(input())
a = [1, 2, 3, 4, 5, 6, 7, 8, 9]
for i in range(k):
if a[i] % 10 != 0:
a.append(10*a[i] + a[i] % 10 - 1)
a.append(10*a[i] + a[i] % 10)
if a[i] % 10 != 9:
a.append(10*a[i] + a[i] % 10 + 1)
print(a[k - 1])
| [["-", 0, 656, 0, 1, 0, 662, 31, 206, 0, 70], ["-", 0, 656, 0, 1, 0, 662, 31, 206, 206, 22], ["-", 0, 656, 0, 1, 0, 662, 31, 206, 0, 73]] | 5 | 127 |
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
int main() {
ll k;
cin >> k;
vector<ll> s = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
int i = 1;
while (s.size() <= k + 1) {
... | #include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
int main() {
ll k;
cin >> k;
vector<ll> s = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
int i = 1;
while (s.size() <= k + 1) {
... | [["-", 8, 9, 0, 43, 49, 50, 51, 16, 31, 22], ["+", 0, 43, 49, 50, 51, 16, 31, 69, 28, 22], ["+", 49, 50, 51, 16, 31, 69, 341, 342, 0, 70], ["+", 49, 50, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 49, 50, 51, 16, 31, 69, 341, 342, 0, 73]] | 1 | 211 |
k = int(input())
def fun(k):
lun_luns = [1, 2, 3, 4, 5, 6, 7, 8, 9]
index = 0
while True:
if len(lun_luns) >= k:
break
num = lun_luns[index]
mod = num%10
n = num*10
if mod == 9:
lun_luns.extend([n+mod-1, n+mod])
elif mod == 0:
... | k = int(input())
def fun(k):
lun_luns = [1, 2, 3, 4, 5, 6, 7, 8, 9]
index = 0
while True:
if len(lun_luns) >= k:
break
num = lun_luns[index]
mod = num%10
n = num*10
if mod == 9:
lun_luns.extend([n+mod-1, n+mod])
elif mod == 0:
... | [["+", 0, 652, 3, 4, 0, 634, 0, 657, 17, 72], ["+", 0, 652, 3, 4, 0, 634, 0, 657, 12, 22]] | 5 | 143 |
#include <iostream>
#include <queue>
using namespace std;
int main() {
int K;
cin >> K;
if (1 <= K && K <= 9) {
cout << K << endl;
return 0;
}
queue<long long> lunlun;
for (int i = 1; i <= 9; i++) {
lunlun.push(i);
}
int order = 9;
for (;;) {
long long num = lunlun.front();
lunlun.... | #include <iostream>
#include <queue>
using namespace std;
int main() {
int K;
cin >> K;
if (1 <= K && K <= 9) {
cout << K << endl;
return 0;
}
queue<long long> lunlun;
for (int i = 1; i <= 9; i++) {
lunlun.push(i);
}
int order = 9;
for (;;) {
long long num = lunlun.front();
lunlun.... | [["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 0, 7, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 238 |
#include <iostream>
#include <queue>
using namespace std;
long long lunlun_number(int k) {
int count = 0;
queue<long long> que;
for (int i = 1; i <= 9; i++) {
que.push(i);
}
long long ans;
while (count < k) {
ans = que.front();
que.pop();
count++;
// minus;
if (ans % 10 != 0) {
... | #include <iostream>
#include <queue>
using namespace std;
long long lunlun_number(int k) {
int count = 0;
queue<long long> que;
for (int i = 1; i <= 9; i++) {
que.push(i);
}
long long ans;
while (count < k) {
ans = que.front();
que.pop();
count++;
// minus;
if (ans % 10 != 0) {
... | [["-", 0, 30, 0, 14, 8, 9, 0, 37, 0, 38], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151]] | 1 | 173 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<long long> v;
void dfs(ll x, ll num, ll st, ll cc) {
if (v.size() > 100050)
return;
if (num == 0)
num += x;
else {
num *= 10;
num += x;
}
if (cc > st)
return;
if (cc == st) {
v.push_back(num);
return;
}... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<long long> v;
void dfs(ll x, ll num, ll st, ll cc) {
if (v.size() > 100050)
return;
if (num == 0)
num += x;
else {
num *= 10;
num += x;
}
if (cc > st)
return;
if (cc == st) {
v.push_back(num);
return;
}... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]] | 1 | 238 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i < n + 1; i++)
#define sort(A) sort(A.begin(), A.end())
#define reverse(A) reverse(A.begin(), A.end())
typedef long long ll;
int main() {
int k;
cin >> k;
ll left = 0;
ll right = 3234... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i < n + 1; i++)
#define sort(A) sort(A.begin(), A.end())
#define reverse(A) reverse(A.begin(), A.end())
typedef long long ll;
int main() {
int k;
cin >> k;
ll left = 0;
ll right = 3234... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]] | 1 | 382 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i < n + 1; i++)
#define sort(A) sort(A.begin(), A.end())
#define reverse(A) reverse(A.begin(), A.end())
typedef long long ll;
int main() {
int n;
cin >> n;
queue<int> q;
rep1(i, 9) q.p... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i < n + 1; i++)
#define sort(A) sort(A.begin(), A.end())
#define reverse(A) reverse(A.begin(), A.end())
typedef long long ll;
int main() {
int n;
cin >> n;
queue<ll> q;
rep1(i, 9) q.pu... | [["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 52, 8, 9, 0, 43, 39, 78]] | 1 | 174 |
K = int(input())
# 1桁
K1 = [x for x in range(1, 10)]
#2桁
def add_2(Kn):
K_ = []
for i in Kn:
K_.append(10*i + (i % 10 - 1))
K_.append(10*i + i % 10)
if i % 10 < 9:
K_.append(10*i + (i % 10+ 1))
return K_
def add_(Kn):
K_ = []
for i in Kn:
if i%... | K = int(input())
# 1桁
K1 = [x for x in range(1, 10)]
#2桁
def add_2(Kn):
K_ = []
for i in Kn:
K_.append(10*i + (i % 10 - 1))
K_.append(10*i + i % 10)
if i % 10 < 9:
K_.append(10*i + (i % 10+ 1))
return K_
def add_(Kn):
K_ = []
for i in Kn:
if i%... | [["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 221 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int N;
cin >> N;
vector<ll> a;
ll w;
for (int i = 1; i <= 9; i++)
a.push_back(i); //まずは欲しい数を集めた配列を用意する
while (1) {
if (N <= a.size()) {
cout << a.at(N - 1) << endl; //例えば8が欲しければindex7を取り出せばよい
return 0;
}... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int N;
cin >> N;
vector<ll> a;
ll w;
for (int i = 1; i <= 9; i++)
a.push_back(i); //まずは欲しい数を集めた配列を用意する
while (1) {
if (N <= a.size()) {
cout << a.at(N - 1) << endl; //例えば8が欲しければindex7を取り出せばよい
return 0;
}... | [["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 20], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 47], ["+", 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 | 178 |
def resolve():
from collections import deque
k = int(input())
a = [1,2,3,4,5,6,7,8,9]
a = deque(a)
c = 0
if k < 10:
print(k)
else:
while c != k:
c += 1
t = a.popleft()
if t % 10 == 0:
a.append(t*10)
a.append(... | def resolve():
from collections import deque
k = int(input())
a = [1,2,3,4,5,6,7,8,9]
a = deque(a)
c = 0
if k < 10:
print(k)
else:
while c != k:
c += 1
t = a.popleft()
if t % 10 == 0:
a.append(t*10)
a.append(... | [["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612]] | 5 | 180 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, n) for (int i = 1; i <= n; i++)
typedef long long ll;
ll const INF = 1e+18;
ll dp[60][2][2][10];
ll k;
bool check(ll m) {
string s = to_string(m);
int n = s.size();
rep(i, n) rep(smaller, 2) rep(zero, 2) r... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, n) for (int i = 1; i <= n; i++)
typedef long long ll;
ll const INF = 1e+18;
ll dp[60][2][2][10];
ll k;
bool check(ll m) {
string s = to_string(m);
int n = s.size();
rep(i, n) rep(smaller, 2) rep(zero, 2) r... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 530 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int k;
cin >> k;
queue<long long> lunlun;
for (int i = 1; i <= 9; i++)
lunlun.push(i);
long long ans;
for (int i = 0; i < k; i++) {
long long ans = lunlun.front();
if (ans % 10 == 0) {
lunlun.push(ans * 10);
lunlun.push(ans ... | #include <bits/stdc++.h>
using namespace std;
int main() {
int k;
cin >> k;
queue<long long> lunlun;
for (int i = 1; i <= 9; i++)
lunlun.push(i);
long long ans;
for (int i = 0; i < k; i++) {
ans = lunlun.front();
if (ans % 10 == 0) {
lunlun.push(ans * 10);
lunlun.push(ans * 10 + 1);... | [["-", 0, 7, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 199 |
import sys
from itertools import accumulate
K = int(input())
MAX = 22
dp = [[0]*10 for _ in [0]*MAX]
for j in range(0, 10):
dp[1][j] = 1
for i in range(2, MAX):
for j in range(1, 9):
dp[i][j] = dp[i-1][j-1] + dp[i-1][j] + dp[i-1][j+1]
dp[i][0] = dp[i-1][0] + dp[i-1][1]
dp[i][9] = dp[i-1][8] +... | import sys
from itertools import accumulate
K = int(input())
MAX = 22
dp = [[0]*10 for _ in [0]*MAX]
for j in range(0, 10):
dp[1][j] = 1
for i in range(2, MAX):
for j in range(1, 9):
dp[i][j] = dp[i-1][j-1] + dp[i-1][j] + dp[i-1][j+1]
dp[i][0] = dp[i-1][0] + dp[i-1][1]
dp[i][9] = dp[i-1][8] +... | [["+", 8, 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 | 379 |
// include
//------------------------------------------
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
... |
// include
//------------------------------------------
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
... | [["+", 49, 53, 54, 55, 0, 56, 49, 352, 0, 67]] | 1 | 443 |
k = int(input())
que = []
for i in range(1,10):
que.append(i)
ct = 0
while(len(que) < k):
ct += 1
value = que[0]
que.remove(value)
for i in [-1,0,1]:
if 0 <= (value%10) + i and (value%10) + i <= 9:
tmp = 10*value + (value%10) + i
q.append(tmp)
print(que[k-1-ct]) | k = int(input())
que = []
for i in range(1,10):
que.append(i)
ct = 0
while(len(que) < k):
ct += 1
value = que[0]
que.remove(value)
for i in [-1,0,1]:
if 0 <= (value%10) + i and (value%10) + i <= 9:
tmp = 10*value + (value%10) + i
que.append(tmp)
print(que[k-1-ct]) | [["-", 64, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 64, 196, 0, 1, 0, 652, 63, 319, 500, 22]] | 5 | 119 |
// AtCoder template
// 世界はとっても美しい!
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
int k;
vector<string> ans;
void dfs(string s) {
ans.push_back(s);
int n = s.size();
if (n >= 11)
return;
if (s[n - 1] == '0')
rep(i, 2) dfs(s + char(s[n -... | // AtCoder template
// 世界はとっても美しい!
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
int k;
vector<string> ans;
void dfs(string s) {
ans.push_back(s);
int n = s.size();
if (n >= 11)
return;
if (s[n - 1] == '0')
rep(i, 2) dfs(s + char(s[n -... | [["+", 0, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 16, 12, 2, 3, 4, 0, 16, 12, 13]] | 1 | 295 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int k;
cin >> k;
queue<long long> que;
for (int i = 1; i <= 9; i++)
que.push(i);
for (int i = 0; i < k - 1; i++) {
long long tmp = que.front();
if (tmp % 10 != 0)
que.push(tmp * 10 + tmp % 10 - 1);
que.push(tmp * 10 + tmp % 10... | #include <bits/stdc++.h>
using namespace std;
int main() {
int k;
cin >> k;
queue<long long> que;
for (int i = 1; i <= 9; i++)
que.push(i);
for (int i = 0; i < k - 1; i++) {
long long tmp = que.front();
que.pop();
if (tmp % 10 != 0)
que.push(tmp * 10 + tmp % 10 - 1);
que.push(tmp ... | [["+", 8, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 17, 131], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]] | 1 | 147 |
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template <class S, class T>
ostream &op... | #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template <class S, class T>
ostream &op... | [["-", 0, 1, 0, 11, 12, 2, 63, 118, 119, 120], ["+", 0, 1, 0, 11, 12, 2, 63, 118, 119, 120]] | 1 | 756 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int K;
cin >> K;
queue<long long int> p;
for (int i = 1; i < 10; i++) {
p.push(i);
}
long long int sum = 0;
long long int a;
while (sum < K) {
int num = p.front();
p.pop();
sum++;
if (num % 10 == 0) {
a = num * 10 + num... | #include <bits/stdc++.h>
using namespace std;
int main() {
int K;
cin >> K;
queue<long long int> p;
for (int i = 1; i < 10; i++) {
p.push(i);
}
long long int sum = 0;
long long int a;
while (sum < K - 1) {
long long int num = p.front();
p.pop();
sum++;
if (num % 10 == 0) {
a =... | [["+", 0, 52, 15, 339, 51, 16, 12, 16, 17, 33], ["+", 0, 52, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 0, 52, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 252 |
#n桁のるんるん数のrisutoを求める
import sys
sys.setrecursionlimit(10**9)
def runrun(n):
if n == 1:
return [['1','2','3','4','5','6','7','8','9']]
else:
li = runrun(n-1)
li2 = []
for i in range(len(li[n-2])):
p = int(li[n-2][i][-1])
if p == 0:
li2.app... | #n桁のるんるん数のrisutoを求める
import sys
sys.setrecursionlimit(10**9)
def runrun(n):
if n == 1:
return [['1','2','3','4','5','6','7','8','9']]
else:
li = runrun(n-1)
li2 = []
for i in range(len(li[n-2])):
p = int(li[n-2][i][-1])
if p == 0:
li2.app... | [["-", 75, 76, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 406 |
#include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define fore(i, l, r) for (int i = int(l); i < int(r); i++)
#define pb push_back
#define deb(x) cout << #x << " " << x << endl;
#define deb2(x, y) cout << #x << " " << x << " " << #y << " " << y << endl;
#define deb3(x, y,... | #include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define fore(i, l, r) for (int i = int(l); i < int(r); i++)
#define pb push_back
#define deb(x) cout << #x << " " << x << endl;
#define deb2(x, y) cout << #x << " " << x << " " << #y << " " << y << endl;
#define deb3(x, y,... | [["-", 0, 52, 15, 339, 51, 16, 31, 16, 17, 72], ["-", 0, 52, 15, 339, 51, 16, 31, 16, 12, 13]] | 1 | 786 |
#include <bits/stdc++.h>
using namespace std;
int K;
int main() {
queue<int> Q;
cin >> K;
for (int i = 1; i < 10; i++)
Q.push(i);
long long x = 0;
for (int i = 0; i < K; i++) {
x = Q.front();
Q.pop();
if (x % 10 != 0) {
Q.push(10 * x + x % 10 - 1);
}
Q.push(10 * x + x % 10);
... | #include <bits/stdc++.h>
using namespace std;
int K;
int main() {
queue<long long> Q;
cin >> K;
for (int i = 1; i < 10; i++)
Q.push(i);
long long x = 0;
for (int i = 0; i < K; i++) {
x = Q.front();
Q.pop();
if (x % 10 != 0) {
Q.push(10 * x + x % 10 - 1);
}
Q.push(10 * x + x % 10... | [["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96]] | 1 | 154 |
# coding: utf-8
DATA = """
100000
""".split("\n")
def get_debug_line():
for i in DATA:
yield i
if 1:
get_line = input
else:
get_line = get_debug_line().__next__
get_line()
def Calc():
K = [int(i) for i in get_line().strip().split(" ")][0]
ret = [str(_) for _ in range(1,10)]
size = len(ret)
start = 0
pri... | # coding: utf-8
DATA = """
100000
""".split("\n")
def get_debug_line():
for i in DATA:
yield i
if 1:
get_line = input
else:
get_line = get_debug_line().__next__
get_line()
def Calc():
K = [int(i) for i in get_line().strip().split(" ")][0]
ret = [str(_) for _ in range(1,10)]
size = len(ret)
start = 0
count... | [["-", 0, 14, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]] | 5 | 239 |
K=int(input())
from collections import deque
num=deque()
for i in range(1,10):
num.append(i)
for j in range(K):
l=num.popleft()
if l%10 !=0:
num.append(l*10+(l%10-1))
num.append(l*10)
if l%10 != 9:
num.append(l*10+(l%10+1))
print(l) | K=int(input())
from collections import deque
num=deque()
for i in range(1,10):
num.append(i)
for j in range(K):
l=num.popleft()
if l%10 !=0:
num.append(l*10+(l%10-1))
num.append(l*10+(l %10))
if l%10 != 9:
num.append(l*10+(l%10+1))
print(l) | [["+", 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 | 106 |
from collections import deque
q=deque([1,2,3,4,5,6,7,8,9])
n=int(input())
def check(k):
while k<=n:
a=q.popleft()
if a%10-1>=0:
q.append(a*10+a%10-1)
k=k+1
if k==n:
return a*10+a%10-1
k=k+1
q.append(a*10+a%10)
if k==n:
return a*10+a%10
if a%10+1<=9:
q.app... | from collections import deque
q=deque([1,2,3,4,5,6,7,8,9])
n=int(input())
def check(k):
while k<=n:
a=q.popleft()
if a%10-1>=0:
q.append(a*10+a%10-1)
k=k+1
if k==n:
return a*10+a%10-1
k=k+1
q.append(a*10+a%10)
if k==n:
return a*10+a%10
if a%10+1<=9:
q.app... | [["-", 0, 37, 0, 657, 31, 657, 31, 657, 17, 109], ["+", 0, 37, 0, 657, 31, 657, 31, 657, 17, 48]] | 5 | 188 |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
ll i, j, k, l, m, n, o, p, q, r, s, t, x, a[500], tt = 0;
cin >> n;
vector<ll> ans;
queue<ll> pq;
for (i = 1; i <= 9; i++)
pq.push(i);
i = 0;
while (!pq.empty() && i <... | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
ll i, j, k, l, m, n, o, p, q, r, s, t, x, a[500], tt = 0;
cin >> n;
vector<ll> ans;
queue<ll> pq;
for (i = 1; i <= 9; i++)
pq.push(i);
i = 0;
while (!pq.empty() && i <... | [["+", 0, 2, 3, 4, 0, 16, 12, 16, 17, 109], ["+", 0, 2, 3, 4, 0, 16, 12, 16, 12, 13]] | 1 | 236 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
int main() {
int k;
cin >> k;
queue<int> q;
for (int i = 1; i < 10; i++) {
q.push(i);
}
for (int i = 0; i < k - 1; i++) {
int x = q.front();
q.pop();
... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
int main() {
ll k;
cin >> k;
queue<ll> q;
for (int i = 1; i < 10; i++) {
q.push(i);
}
for (ll i = 0; i < k - 1; i++) {
ll x = q.front();
q.pop();
l... | [["-", 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, 7, 10, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 78], ["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 7, 8... | 1 | 179 |
k=int(input())
a=[i for i in range(10)]
while True:
#るんるん数の候補を、桁数ごとに積み上げます。まず1桁
if k<=len(a):
print(a[k-1])
break
"""
1桁に成果がなければ、kから1桁のlen(るんるん数リスト)を引いて、
2桁のリストを作ります。作り方は、元のるんるんリストのそれぞれの数を10倍して、
その10の位と同じか隣接する値を加えたものをappend.
以下同様
"""
k-=len(a)
old=[]
old, a=a... | k=int(input())
a=[i for i in range(1,10)]
while True:
#るんるん数の候補を、桁数ごとに積み上げます。まず1桁
if k<=len(a):
print(a[k-1])
break
"""
1桁に成果がなければ、kから1桁のlen(るんるん数リスト)を引いて、
2桁のリストを作ります。作り方は、元のるんるんリストのそれぞれの数を10倍して、
その10の位と同じか隣接する値を加えたものをappend.
以下同様
"""
k-=len(a)
old=[]
old, a... | [["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 21], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22]] | 5 | 108 |
#pragma GCC optimize("Ofast")
#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;
/*
common mistakes
1) long long vs int overflow
2) read question carefully please!!!! it can cost you a ... | #pragma GCC optimize("Ofast")
#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;
/*
common mistakes
1) long long vs int overflow
2) read question carefully please!!!! it can cost you a ... | [["+", 8, 1, 0, 2, 3, 4, 0, 16, 17, 48], ["+", 8, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 2,195 |
/*
* written by Yaqi Zhang
* University of Wisconsin-Madison
* 2020
*/
#include <algorithm>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stdio.h>
#include <vector>
#define INF 0x3f3f3f3f
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie... | /*
* written by Yaqi Zhang
* University of Wisconsin-Madison
* 2020
*/
#include <algorithm>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stdio.h>
#include <vector>
#define INF 0x3f3f3f3f
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie... | [["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 0, 7, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 183 |
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
using namespace std;
#define fi first
#define se second
#define ll long long
#define _for(i, j, k) for (int i = j; i < k; i++)
#define endl '\n'
#define inf 0x3f3f3f3f
const int mod = 1e9 + 7;
const int MAX = 1e+7;
ll a[MAX], ans[MAX];
int mai... |
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
using namespace std;
#define fi first
#define se second
#define ll long long
#define _for(i, j, k) for (int i = j; i < k; i++)
#define endl '\n'
#define inf 0x3f3f3f3f
const int mod = 1e9 + 7;
const int MAX = 1e+7;
ll a[MAX], ans[MAX];
int mai... | [["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 11, 12, 16, 31, 16, 31, 16, 12, 13], ["+", 0, 11, 12, 16, 31, 16, 31, 16, 12, 13], ["-", 0, 16, 12, 69, 341, 342, 0, 16, 12, 13], ["+", 0, 16, 12, 69, 341, 342, 0, 16, 12, 13]] | 1 | 243 |
#include <bits/stdc++.h>
using namespace std;
int main() {
queue<int> numbers;
for (int i = 1; i < 10; i++) {
numbers.push(i);
}
int k, x = 1;
cin >> k;
while (k--) {
x = numbers.front();
numbers.pop();
if (x % 10 != 0)
numbers.push(10 * x + x % 10 - 1);
numbers.push(10 * x + x % ... | #include <bits/stdc++.h>
using namespace std;
int main() {
queue<long long int> numbers;
for (int i = 1; i < 10; i++) {
numbers.push(i);
}
long long int k, x = 1;
cin >> k;
while (k--) {
x = numbers.front();
numbers.pop();
if (x % 10 != 0)
numbers.push(10 * x + x % 10 - 1);
number... | [["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 141 |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
//#define DEBUG
#ifdef DEBUG
#define PRINT(A) std::cout << (#A) << ":" << (A) << std::endl;
#else
#define PRINT(A)
#endif
int main() {
int K;
cin >> K;
int right;
long long j = 0;
vector<long long> l;
for (int i = 1; i < 10; i++) {
l.... | #include <bits/stdc++.h>
#define ll long long
using namespace std;
//#define DEBUG
#ifdef DEBUG
#define PRINT(A) std::cout << (#A) << ":" << (A) << std::endl;
#else
#define PRINT(A)
#endif
int main() {
int K;
cin >> K;
int right;
long long j = 0;
vector<long long> l;
for (int i = 1; i < 10; i++) {
l.... | [["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 19]] | 1 | 184 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vll = vector<ll>;
using vi = vector<int>;
using vb = vector<bool>;
using pll = pair<ll, ll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vpll = vector<pll>;
const ll LINF = 1ll << 55;
const ll INF... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vll = vector<ll>;
using vi = vector<int>;
using vb = vector<bool>;
using pll = pair<ll, ll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vpll = vector<pll>;
const ll LINF = 1ll << 55;
const ll INF... | [["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46], ["-", 0, 57, 64, 9, 0, 57, 64, 9, 0, 46]] | 1 | 1,313 |
// Author:Eleus Ahammad, CSE, KUET
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define vii vector<pii>
#define vi vector<int>
#define F first
#define S second
#define endl "\n"
#define fastio \
ios::sync_... | // Author:Eleus Ahammad, CSE, KUET
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define vii vector<pii>
#define vi vector<int>
#define F first
#define S second
#define endl "\n"
#define fastio \
ios::sync_... | [["-", 0, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 0, 9, 0, 52, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 39, 78]] | 1 | 461 |
import queue
num=int(input())
q=queue.Queue()
for i in range(1,10):
q.put(i)
for j in range(num):
ans=q.get()
if ans%10!=0:
q.put(10*ans+(ans%10)-1)
q.put(10*ans+(ans%10))
if ans%10!=0:
q.put(10*ans+(ans%10)+1)
print(ans) | import queue
num=int(input())
q=queue.Queue()
for i in range(1,10):
q.put(i)
for j in range(num):
ans=q.get()
if ans%10!=0:
q.put(10*ans+(ans%10)-1)
q.put(10*ans+(ans%10))
if ans%10!=9:
q.put(10*ans+(ans%10)+1)
print(ans) | [["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612]] | 5 | 112 |
#include <bits/stdc++.h>
#define cout16 cout << setprecision(16)
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, f, n) for (int i = f; i < n; i++)
#define SORT(A) sort(A.begin(), A.end())
#define REV(A) reverse(A.begin(), A.end())
typedef long long int ll;
using vi = std::vector<int>;
using vvi = std::vec... | #include <bits/stdc++.h>
#define cout16 cout << setprecision(16)
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, f, n) for (int i = f; i < n; i++)
#define SORT(A) sort(A.begin(), A.end())
#define REV(A) reverse(A.begin(), A.end())
typedef long long int ll;
using vi = std::vector<int>;
using vvi = std::vec... | [["+", 8, 9, 0, 7, 15, 16, 12, 2, 63, 22], ["+", 0, 7, 15, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 7, 15, 16, 12, 2, 3, 4, 0, 13], ["+", 0, 7, 15, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 7, 15, 16, 12, 2, 3, 4, 0, 25]] | 1 | 321 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int K, tmp;
cin >> K;
queue<int> q;
if (K <= 9) {
cout << K;
return 0;
}
for (int i = 1; i < 10; ++i) {
q.push(i);
}
while (true) {
tmp = q.front();
K -= 1;
if (K == 0) {
cout << tmp;
return 0;
... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int K, tmp;
cin >> K;
queue<long long int> q;
if (K <= 9) {
cout << K;
return 0;
}
for (int i = 1; i < 10; ++i) {
q.push(i);
}
while (true) {
tmp = q.front();
K -= 1;
if (K == 0) {
cout << tmp;
... | [["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96]] | 1 | 169 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int y;
cin >> y;
queue<int> x;
for (int i = 1; i <= 9; i++) {
x.push(i);
}
for (int j = 0; j < y; j++) {
if (j == y - 1) {
cout << x.front() << endl;
return 0;
}
if (x.front() % 10 != 0) {
x.push(10 * x.front() + x... | #include <bits/stdc++.h>
using namespace std;
int main() {
int y;
cin >> y;
queue<long long> x;
for (int i = 1; i <= 9; i++) {
x.push(i);
}
for (int j = 0; j < y; j++) {
if (j == y - 1) {
cout << x.front() << endl;
return 0;
}
if (x.front() % 10 != 0) {
x.push(10 * x.front... | [["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96]] | 1 | 188 |
#include <bits/stdc++.h>
#define pb push_back
#define sz(a) long long(a.size())
#define re return
#define all(a) a.begin(), a.end()
using namespace std;
vector<long long> ans[17];
signed main() {
long long x;
cin >> x;
for (long long i = 1; i <= 9; i++) {
ans[0].pb(i);
}
for (int i = 0; i < 15; i++) {
... | #include <bits/stdc++.h>
#define pb push_back
#define sz(a) long long(a.size())
#define re return
#define all(a) a.begin(), a.end()
using namespace std;
vector<long long> ans[17];
signed main() {
long long x;
cin >> x;
for (long long i = 1; i <= 9; i++) {
ans[0].pb(i);
}
for (int i = 0; i < 10; i++) {
... | [["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]] | 1 | 239 |
from collections import deque
k = int(input())
d = deque([1,2,3,4,5,6,7,8,9])
for i in range(k):
a = d.popleft()
if a % 10 != 0:
d.append(a*10 + a % 10 - 1)
d.append(a*10 + a % 10)
if a % 10 != 9:
d.append(i*10 + i % 10 + 1)
print(a)
| from collections import deque
k = int(input())
d = deque([1,2,3,4,5,6,7,8,9])
for i in range(k):
a = d.popleft()
if a % 10 != 0:
d.append(a*10 + a % 10 - 1)
d.append(a*10 + a % 10)
if a % 10 != 9:
d.append(a*10 + a % 10 + 1)
print(a)
| [["-", 3, 4, 0, 657, 31, 657, 31, 657, 31, 22], ["+", 3, 4, 0, 657, 31, 657, 31, 657, 31, 22], ["-", 3, 4, 0, 657, 31, 657, 12, 657, 31, 22], ["+", 3, 4, 0, 657, 31, 657, 12, 657, 31, 22]] | 5 | 109 |
#include <algorithm>
#include <iostream>
#include <queue>
#include <set>
#include <string>
using namespace std;
typedef long long ll;
const int INF = 100;
typedef pair<int, int> P;
const int ld = 10;
int main() {
int n;
cin >> n;
int a[ld];
fill(a, a + ld, 0);
// cout<<n<<endl;
int i = 0;
while (i < n) {... | #include <algorithm>
#include <iostream>
#include <queue>
#include <set>
#include <string>
using namespace std;
typedef long long ll;
const int INF = 100;
typedef pair<int, int> P;
const int ld = 10;
int main() {
int n;
cin >> n;
int a[ld];
fill(a, a + ld, 0);
// cout<<n<<endl;
int i = 0;
while (i < n) {... | [["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 22]] | 1 | 305 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
int main() {
int k;
cin >> k;
queue<int> q;
for (int i = 1; i < 10; i++) {
q.push(i);
}
ll x;
while (k--) {
x = q.front();
q.pop();
if (x % 10 != 0) {
q.push(x * 10 + ... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
int main() {
int k;
cin >> k;
queue<ll> q;
for (int i = 1; i < 10; i++) {
q.push(i);
}
ll x;
while (k--) {
x = q.front();
q.pop();
if (x % 10 != 0) {
q.push(x * 10 + x... | [["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78]] | 1 | 153 |
#include <bits/stdc++.h>
#include <cmath>
const double PI = 3.14159265358979323846;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
// typedef pair<ll, ll> P;
typedef pair<ll, ll> P;
const ll INF = 10e1... | #include <bits/stdc++.h>
#include <cmath>
const double PI = 3.14159265358979323846;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
// typedef pair<ll, ll> P;
typedef pair<ll, ll> P;
const ll INF = 10e1... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 913 |
from collections import deque
k = int(input())
a = deque([1,2,3,4,5,6,7,8,9])
count=0
while count !=k:
b = a.popleft()
count += 1
if b%10==0:
a.append(b*10)
a.append(b*10+1)
elif b%9==0:
a.append(b*11-1)
a.append(b*10+9)
else:
a.append(b*10+b%10-1)
a.append(b*10+b%10)
a.append(b*10... | from collections import deque
k = int(input())
a = deque([1,2,3,4,5,6,7,8,9])
count=0
while count !=k:
b = a.popleft()
count += 1
if b%10==0:
a.append(b*10)
a.append(b*10+1)
elif b%10==9:
a.append(b*10+8)
a.append(b*10+9)
else:
a.append(b*10+b%10-1)
a.append(b*10+b%10)
a.append(b*1... | [["-", 0, 57, 75, 665, 15, 666, 0, 657, 12, 612], ["+", 0, 57, 75, 665, 15, 666, 0, 657, 12, 612], ["-", 8, 196, 0, 57, 75, 665, 15, 666, 0, 612], ["+", 8, 196, 0, 57, 75, 665, 15, 666, 0, 612], ["-", 0, 652, 3, 4, 0, 657, 31, 657, 12, 612], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 1... | 5 | 152 |
k=int(input())
a=[i+1 for i in range(9)]
while (1):
if k<=len(a):
print(a[k-1])
f=1
break
k=k-len(a)
#print(k)
b=[]
for x in a:
for i in [-1,0,1]:
d=x%10+i
#print(d)
if d<0 or d>10: continue
b.append(x*10+d)
a=b.copy()
| k=int(input())
a=[i+1 for i in range(9)]
while (1):
if k<=len(a):
print(a[k-1])
f=1
break
k=k-len(a)
#print(k)
b=[]
for x in a:
for i in [-1,0,1]:
d=x%10+i
#print(d)
if d<0 or d>=10: continue
b.append(x*10+d)
a=b.copy()
#print(a)
| [["-", 8, 196, 0, 57, 15, 679, 12, 666, 667, 47], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 667, 20]] | 5 | 113 |
from copy import deepcopy
k = int(input())
lun = []
for i in range(1,10):
lun.append(i)
if k <= 9:
print(lun[k-1])
exit()
prev_lun = deepcopy(lun)
while True:
size = len(lun)
for pl in prev_lun:
for i in [-1, 0, 1]:
d = pl%10 + i
if 0 <= d <= 9:
lu... | from copy import deepcopy
k = int(input())
lun = []
for i in range(1,10):
lun.append(i)
if k <= 9:
print(lun[k-1])
exit()
prev_lun = deepcopy(lun)
while True:
size = len(lun)
for pl in prev_lun:
for i in [-1, 0, 1]:
d = pl%10 + i
if 0 <= d <= 9:
lu... | [["-", 3, 4, 0, 206, 206, 663, 0, 657, 17, 72], ["-", 3, 4, 0, 206, 206, 663, 0, 657, 12, 612]] | 5 | 137 |
from collections import deque
n = int(input())
c = 0
q = deque()
for i in range(1, 10):
q.append(i)
k = 1
while c < n:
k = q.popleft()
if k%10:
q.append(10*k + k%10 - 1)
q.append(10 * k + k % 10)
if k%10 != 9:
q.append(10*k + (k%10) + 1)
c += 1
print(k)
# c = 0
#... | from collections import deque
n = int(input())
c = 0
q = deque()
for i in range(1, 10):
q.append(i)
k = 1
while c < n:
k = q.popleft()
# print(k)
if k%10:
q.append(10*k + k%10 - 1)
q.append(10 * k + k % 10)
if k%10 != 9:
q.append(10*k + (k%10) + 1)
c += 1
print(k) | [] | 5 | 134 |
n=int(input())
from collections import deque
k=deque([])
z=9
m=0
if n<10:
print(n)
exit()
for i in range(1,10):
k.append(i)
while z!=n:
m=k.pop()
k.popleft
if m%10!=0:
ans=10*m+(m%10)-1
k.append(ans)
z+=1
if z==n:
print(ans)
exit()
ans... | n=int(input())
from collections import deque
k=deque([])
z=9
m=0
if n<10:
print(n)
exit()
for i in range(1,10):
k.append(i)
while z!=n:
m=k.popleft()
if m%10!=0:
ans=10*m+(m%10)-1
k.append(ans)
z+=1
if z==n:
print(ans)
exit()
ans=10*m+(m%10... | [["-", 0, 1, 0, 662, 12, 652, 63, 319, 319, 22], ["+", 0, 1, 0, 662, 12, 652, 63, 319, 319, 22], ["-", 0, 52, 8, 196, 0, 1, 0, 319, 500, 22], ["-", 0, 52, 8, 196, 0, 1, 0, 319, 0, 131], ["-", 0, 52, 8, 196, 0, 1, 0, 319, 319, 22]] | 5 | 182 |
from collections import deque
def make_lunlun():
lst = []
que = deque([1,2,3,4,5,6,7,8,9])
for i in range(10):
str_num = str(que.popleft())
str_one = str_num[-1]
a = str(int(str_one) - 1)
b = str(int(str_one) + 1)
#minus = int(str_num + a)
same = int(str_num ... | from collections import deque
def make_lunlun():
lst = []
que = deque([1,2,3,4,5,6,7,8,9])
for i in range(100000):
str_num = str(que.popleft())
str_one = str_num[-1]
a = str(int(str_one) - 1)
b = str(int(str_one) + 1)
#minus = int(str_num + a)
same = int(str_... | [["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]] | 5 | 241 |
#include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> result, tmp;
for (int i = 1; i <= 9; i++) {
result.push_back(i);
tmp.push_back(i);
}
for (int i = 0; i < 9; i++) {
vector<int> tmp2 = tmp;
tmp.clear();
for (int j = 0; j < tmp2.size(); j++) {
int num =... | #include <iostream>
#include <vector>
using namespace std;
int main() {
vector<long long> result, tmp;
for (int i = 1; i <= 9; i++) {
result.push_back(i);
tmp.push_back(i);
}
for (int i = 0; i < 9; i++) {
vector<long long> tmp2 = tmp;
tmp.clear();
for (int j = 0; j < tmp2.size(); j++) {
... | [["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96], ["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 0, 7, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 216 |
from collections import deque
def main(k):
q = deque([])
for i in range(1, 10):
q.append(i)
count = 0
top = -1
while True:
top = q.popleft()
count += 1
if count == k:
return top
if top%10 != 0:
q.append(top*10 + top%10-1)
... | from collections import deque
def main(k):
q = deque([])
for i in range(1, 10):
q.append(i)
count = 0
top = -1
while True:
top = q.popleft()
count += 1
if count == k:
return top
if top%10 != 0:
q.append(top*10 + top%10-1)
... | [["+", 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 | 128 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define PI acos(-1)
#define fast_io \
ios_base::sync_with_stdio(false); \
cin.tie(0); ... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define PI acos(-1)
#define fast_io \
ios_base::sync_with_stdio(false); \
cin.tie(0); ... | [["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78]] | 1 | 258 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int k;
cin >> k;
vector<long long int> v;
for (int i = 0; i < 10; i++) {
v.push_back(i);
}
while (1) {
if (k <= v.size()) {
cout << v[k - 1] << endl;
return 0;
}
k -= v.size();
vector<long long int> old;
swap(ol... | #include <bits/stdc++.h>
using namespace std;
int main() {
int k;
cin >> k;
vector<long long int> v;
for (int i = 1; i < 10; i++) {
v.push_back(i);
}
while (1) {
if (k <= v.size()) {
cout << v[k - 1] << endl;
return 0;
}
k -= v.size();
vector<long long int> old;
swap(ol... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 174 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll k, x;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> k;
queue<ll> q;
for (int i = 1; i < 10; i++)
q.push(i);
while (k--) {
x = q.front();
q.pop();
if (x)
q.push(x * 10 + x % 10 - 1)... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll k, x;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> k;
queue<ll> q;
for (int i = 1; i < 10; i++)
q.push(i);
while (k--) {
x = q.front();
q.pop();
if (x % 10)
q.push(x * 10 + x % 10... | [["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 109], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13]] | 1 | 157 |
K = int(input())
queue = list(range(1, 10))
if K < 10:
print(K)
else:
i = 0
while K > len(queue):
if queue[i] % 10 != 0:
l = 10 * queue[i] + queue[i] % 10 - 1
queue.append(l)
l = 10 * queue[i] + queue[i] % 10
queue.append(l)
if queu... | K = int(input())
queue = list(range(1, 10))
if K < 10:
print(K)
else:
i = 0
while K > len(queue):
if queue[i] % 10 != 0:
l = 10 * queue[i] + queue[i] % 10 - 1
queue.append(l)
l = 10 * queue[i] + queue[i] % 10
queue.append(l)
if queu... | [["+", 0, 652, 3, 4, 0, 206, 206, 657, 31, 22]] | 5 | 139 |
from collections import deque
def main():
K = int(input())
cnt = 0
mod = 10
q = deque([])
for i in range(1, 10):
q.append(i)
while cnt < K:
x = q.popleft()
cnt += 1
if x%mod == 0:
q.append(10*x + (x%mod))
q.append(10*x + (x%mod)+1... | ## キューとスタックhttp://ailaby.com/deque/
## https://qiita.com/drken/items/6a95b57d2e374a3d3292
from collections import deque
def main():
K = int(input())
cnt = 0
mod = 10
q = deque([])
for i in range(1, 10):
q.append(i)
while cnt < K:
x = q.popleft()
cnt += 1
... | [["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612]] | 5 | 190 |
#include <iostream>
#include <queue>
using namespace std;
long long k, ans[100005], idx = 1;
queue<long long> q;
int main() {
cin >> k;
for (int i = 1; i < 10; i++) {
q.push(i);
}
while (ans[k] == 0) {
int now = q.front();
q.pop();
int n = now % 10;
if (n != 0)
q.push(now * 10 + n - ... | #include <iostream>
#include <queue>
using namespace std;
long long k, ans[100005], idx = 1;
queue<long long> q;
int main() {
cin >> k;
for (int i = 1; i < 10; i++) {
q.push(i);
}
while (ans[k] == 0) {
long long now = q.front();
q.pop();
int n = now % 10;
if (n != 0)
q.push(now * 10 ... | [["-", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["+", 0, 52, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 164 |
N, K = map(int, input().split())
tmp = N%K
print(min(N,K-tmp)) | N, K = map(int, input().split())
tmp = N%K
print(min(N,K-tmp,tmp)) | [["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22]] | 5 | 32 |
/* _/ _/ _/_/_/ _/
_/_/_/_/ _/_/ _/_/_/_/ _/_/ _/ _/_/
_/ _/ _/ _/ _/ _/ _/_/_/ _/
_/ _/ _/ _/ _/ _/ _/ _/ _/
_/_/ _/_/ _/_/ _/_/ _/_/ _/ */
#include <algorithm>
#include <cmath>
#include <iomanip>
... | /* _/ _/ _/_/_/ _/
_/_/_/_/ _/_/ _/_/_/_/ _/_/ _/ _/_/
_/ _/ _/ _/ _/ _/ _/_/_/ _/
_/ _/ _/ _/ _/ _/ _/ _/ _/
_/_/ _/_/ _/_/ _/_/ _/_/ _/ */
#include <algorithm>
#include <cmath>
#include <iomanip>
... | [["-", 8, 9, 0, 1, 0, 11, 12, 2, 63, 22], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 25], ["+", 31, 16, 12, 2, 3, 4, 0, 83, 0, 45], ["+", 31, 16, 12, 2, 3, 4, 0, 83, 0, 46]] | 1 | 169 |
#include <iostream>
// #include <cassert>
#include <algorithm>
#include <climits>
#include <vector>
#include <queue>
#include <stack>
// #include <deque>
#include <map>
#include <set>
// #include <string>
// #include <unordered_set>
// #include <unordered_map>
#include <tuple>
// #include <cmath>
// #include <numeri... |
#include <iostream>
// #include <cassert>
#include <algorithm>
#include <climits>
#include <vector>
#include <queue>
#include <stack>
// #include <deque>
#include <map>
#include <set>
// #include <string>
// #include <unordered_set>
// #include <unordered_map>
#include <tuple>
// #include <cmath>
// #include <numeri... | [["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13]] | 1 | 211 |
require 'pp'
n, k = gets.split.map(&:to_i)
t1 = n % 4
t2 = ((n % 4) - k).abs
puts [t1, t2].min
| require 'pp'
n, k = gets.split.map(&:to_i)
t1 = n % k
t2 = ((n % k) - k).abs
puts [t1, t2].min
| [["-", 36, 36, 0, 493, 0, 662, 12, 738, 12, 612], ["+", 36, 36, 0, 493, 0, 662, 12, 738, 12, 22], ["-", 486, 739, 0, 738, 31, 739, 0, 738, 12, 612], ["+", 486, 739, 0, 738, 31, 739, 0, 738, 12, 22]] | 4 | 43 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, j, n) for (int i = (int)(j); i < (int)(n); i++)
#define REP(i, j, n) for (int i = (int)(j); i <= (int)(n); i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(), (a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<i... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, j, n) for (int i = (int)(j); i < (int)(n); i++)
#define REP(i, j, n) for (int i = (int)(j); i <= (int)(n); i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(), (a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<i... | [["-", 0, 11, 12, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 11, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 12, 22]] | 1 | 122 |
// -----------------------------------
// Author : MatsuTaku
// Affiliation: Tokushima University
// Country : Japan
// Date : 04/04/2020
// -----------------------------------
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(fal... | // -----------------------------------
// Author : MatsuTaku
// Affiliation: Tokushima University
// Country : Japan
// Date : 04/04/2020
// -----------------------------------
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(fal... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]] | 1 | 69 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using mii = map<int, int>;
const int INF = 1e9;
const ll LINF = 1e18;
#define MP(a, b) make_pair((a), (b))
#define MT(...) make_tuple(__VA_ARGS__)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, x) for (... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using mii = map<int, int>;
const int INF = 1e9;
const ll LINF = 1e18;
#define MP(a, b) make_pair((a), (b))
#define MT(...) make_tuple(__VA_ARGS__)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, x) for (... | [["-", 0, 42, 0, 53, 54, 55, 0, 56, 39, 40], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]] | 1 | 181 |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int bit[50];
ll dp[50][15];
ll dfs(int pos, int t, int lead, int lim) {
if (pos == 0)
return lead ? 0 : 1;
if (!lim && !lead && dp[pos][t] != -1)
return dp[pos][t];
int num = lim ? bit[pos] : 9;
ll res = 0;
for (int i = 0; i <= num; i... | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int bit[50];
ll dp[50][15];
ll dfs(int pos, int t, int lead, int lim) {
if (pos == 0)
return lead ? 0 : 1;
if (!lim && !lead && dp[pos][t] != -1)
return dp[pos][t];
int num = lim ? bit[pos] : 9;
ll res = 0;
for (int i = 0; i <= num; i... | [["-", 8, 9, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 31, 13], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]] | 1 | 371 |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
queue<int> Q;
for (int i = 1; i < 10; ++i)
Q.push(i);
int K, X;
cin >> K;
for (int i = 0; i < K; ++i) {
X = Q.front();
Q.pop();
if (X % 10 != 0)
Q.push(10 * X + (X % 10) - 1... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
queue<long long> Q;
for (int i = 1; i < 10; ++i)
Q.push(i);
long long K, X;
cin >> K;
for (int i = 0; i < K; ++i) {
X = Q.front();
Q.pop();
if (X % 10 != 0)
Q.push(10 * X + ... | [["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 164 |
#include <iostream>
#include <queue>
using namespace std;
int main() {
int K;
priority_queue<int, vector<int>, greater<>> q;
cin >> K;
if (K < 10) {
cout << K << endl;
return 0;
}
for (int i = 1; i < 10; i++) {
q.push(i);
}
for (int i = 0; i < K - 1; i++) {
int n = q.top();
q.pop();... | #include <iostream>
#include <queue>
using namespace std;
int main() {
int K;
priority_queue<long long, vector<long long>, greater<>> q;
cin >> K;
if (K < 10) {
cout << K << endl;
return 0;
}
for (int i = 1; i < 10; i++) {
q.push(i);
}
for (int i = 0; i < K - 1; i++) {
long long n = q.t... | [["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96], ["-", 0, 77, 39, 344, 3, 347, 0, 77, 39, 40], ["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 0, 7, 8, 9, 0, 43, 39, 86, 0, 96]] | 1 | 200 |
K = gets.to_i
lun2 = (1 .. 9).to_a
i = 0
until lun2.size > K
a = lun2[i]
d = a % 10
if d == 0
lun2 << a * 10
lun2 << a * 10 + 1
elsif d == 9
lun2 << a * 10 + 8
lun2 << a * 10 + 9
else
lun2 << a * 10 + d
lun2 << a * 10 + d - 1
lun2 << a * 10 + d + 1
end
i += 1
end
puts lun2[K - ... | K = gets.to_i
lun2 = (1 .. 9).to_a
i = 0
until lun2.size >= K
a = lun2[i]
d = a % 10
if d == 0
lun2 << a * 10
lun2 << a * 10 + 1
elsif d == 9
lun2 << a * 10 + 8
lun2 << a * 10 + 9
else
lun2 << a * 10 + d - 1
lun2 << a * 10 + d
lun2 << a * 10 + d + 1
end
i += 1
end
puts lun2[K -... | [["-", 36, 36, 0, 493, 0, 750, 15, 738, 17, 47], ["+", 36, 36, 0, 493, 0, 750, 15, 738, 17, 20], ["+", 75, 759, 75, 95, 0, 738, 12, 738, 17, 33], ["+", 75, 759, 75, 95, 0, 738, 12, 738, 12, 612], ["-", 75, 759, 75, 95, 0, 738, 12, 738, 17, 33], ["-", 75, 759, 75, 95, 0, 738, 12, 738, 12, 612]] | 4 | 106 |
#input
K = int(input())
#output
q = queue.Queue()
for i in range(1, 10):
q.put(i)
for i in range(1, K+2):
x = q.get()
if x % 10 != 0:
q.put(10*x + (x % 10)-1)
q.put(10*x+(x % 10))
if x % 10 != 9:
q.put(10*x + (x % 10)+1)
if i == K:
print(x) | import queue
#input
K = int(input())
#output
q = queue.Queue()
for i in range(1, 10):
q.put(i)
for i in range(1, K+2):
x = q.get()
if x % 10 != 0:
q.put(10*x + (x % 10)-1)
q.put(10*x+(x % 10))
if x % 10 != 9:
q.put(10*x + (x % 10)+1)
if i == K:
print(x) | [["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22]] | 5 | 121 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
int main() {
int K;
cin >> K;
vector<ll> lun(K + 3);
rep1(i, 10) { lun[i] = i; }
int i = 1, j = 10;
while (j <= K) {
int r = lun[i] % ... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
int main() {
int K;
cin >> K;
vector<ll> lun(max(11, K + 3));
rep1(i, 10) { lun[i] = i; }
int i = 1, j = 10;
while (j <= K) {
int r = ... | [["+", 0, 43, 49, 50, 51, 4, 0, 2, 63, 22], ["+", 49, 50, 51, 4, 0, 2, 3, 4, 0, 24], ["+", 49, 50, 51, 4, 0, 2, 3, 4, 0, 13], ["+", 49, 50, 51, 4, 0, 2, 3, 4, 0, 21], ["+", 49, 50, 51, 4, 0, 2, 3, 4, 0, 25]] | 1 | 162 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.