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 |
|---|---|---|---|---|
N, K = map(int, input().split(' '))
d_list = input().split(' ')
for i in range(10):
for j in range(10):
for k in range(10):
for l in range(10):
number = i * 1000 + j * 100 + k * 10 + l
result = set(list(str(number)))
if set(d_list) & result != set... | N, K = map(int, input().split(' '))
d_list = input().split(' ')
for h in range(10):
for i in range(10):
for j in range(10):
for k in range(10):
for l in range(10):
number = h * 10000 + i * 1000 + j * 100 + k * 10 + l
result = set(list(str(n... | [["+", 36, 36, 36, 36, 0, 656, 0, 7, 31, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 267], ["+", 36, 36, 0, 656, 0, 7, 12, 652, 63, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 25], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 0, 102], ["+", 0,... | 5 | 125 |
def main():
N, K = map(int, input().split())
D = list(map(int, input().split()))
rec = 0
rec2 = 1
for d in D:
if rec != d:
break
rec += 1
for d in D:
if rec2 != d:
break
rec2 += 1
strN = str(N)
carry = False
ans = ""
for i in range(len(strN)-1, -1, -1):
cur = int(strN[i])
if carry:
cur +... | def main():
N, K = map(int, input().split())
D = list(map(int, input().split()))
rec = 0
rec2 = 1
for d in D:
if rec != d:
break
rec += 1
for d in D:
if rec2 != d:
break
rec2 += 1
strN = str(N)
carry = False
ans = ""
for i in range(len(strN)-1, -1, -1):
cur = int(strN[i])
chanegd = False
... | [["+", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 12, 147], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 146], ["+", 0, 52, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 52... | 5 | 230 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""042-c"""
import sys
def solve(dislike_digits_table, first_like_digit, N):
"""Solve."""
for i, c in enumerate(N):
while dislike_digits_table[int(c)]:
if c == '9':
if i == 0:
return solve(dislike_digits_t... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""042-c"""
import sys
def solve(dislike_digits_table, first_like_digit, N):
"""Solve."""
for i, _ in enumerate(N):
c = N[i]
while dislike_digits_table[int(c)]:
if c == '9':
if i == 0:
return solve... | [["-", 0, 14, 8, 196, 0, 7, 31, 684, 0, 22], ["+", 0, 14, 8, 196, 0, 7, 31, 684, 0, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 8, 196, 0, 1, 0, 662, 12, 206, 51, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 206, 0, 70], ["+", 8, 196, 0, 1, 0, 662, 12, 206, 206, 22], ["+", 8,... | 5 | 250 |
#include <cstdio>
using namespace std;
int n, k, ans, now, w, a[10];
bool b[10];
int main(void) {
register int i, j, k, x;
scanf("%d%d", &n, &k);
for (i = 1; i <= k; ++i)
scanf("%d", &x), b[x] = 1;
x = n, now = 0;
while (x)
a[++now] = x % 10, x /= 10, w += b[a[now]];
if (now == 0)
now = 1, w = b... | #include <cstdio>
using namespace std;
int n, k, ans, now, w, a[10];
bool b[10];
int main(void) {
register int i, j, k, x;
scanf("%d%d", &n, &k);
for (i = 1; i <= k; ++i)
scanf("%d", &x), b[x] = 1;
x = n, now = 0;
while (x)
a[++now] = x % 10, x /= 10, w += b[a[now]];
if (now == 0)
now = 1, w = b... | [["+", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 57, 15, 339, 51, 91, 17, 111], ["+", 0, 57, 15, 339, 51, 91, 28, 23, 0, 24], ["+", 51, 91, 28, 23, 0, 16, 31, 16, 31, 22], ["+", 51, 91, 28, 23, 0, 16, 31, 16, 17, 60], ["+", 51, 91, 28, 23, 0, 16, 31, 16, 12, 22], ["+", 1... | 1 | 317 |
import sys
N,K = list(map(int,input().split()))
D = input().split()
while True:
for i in range(len(str(N))):
if str(N)[i] in D:
break
else:
print(N)
sys.exit()
N += 1 | import sys
N,K = list(map(int,input().split()))
D = input().split()
while True:
breaked = False
for i in range(len(str(N))):
if str(N)[i] in D:
breaked = True
break
if not(breaked):
print(N)
sys.exit()
N += 1 | [["+", 0, 52, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 52, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 52, 8, 196, 0, 1, 0, 662, 12, 147], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 146], ["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 95], ["+", 0, ... | 5 | 73 |
require 'prime'
include Math
def max(a,b); a > b ? a : b end
def min(a,b); a < b ? a : b end
def swap(a,b); a, b = b, a end
def gif; gets.to_i ... | require 'prime'
include Math
def max(a,b); a > b ? a : b end
def min(a,b); a < b ? a : b end
def swap(a,b); a, b = b, a end
def gif; gets.to_i ... | [["-", 36, 36, 36, 36, 0, 493, 0, 662, 31, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 36, 36, 0, 493, 0, 652, 196, 196, 0, 45], ["+", 0, 652, 196, 196, 8, 734, 0, 662, 31, 22], ["-", 36, 36, 0, 493, 0, 662, 12, 516, 0, 70], ["-", 36, 36, 0, 493, 0, 662, 12, 516, 0, 73], ["-", 36, 36, 36, 36, 0, 493, 0, ... | 4 | 308 |
import java.io.*;
import java.util.*;
public class Main {
public static PrintWriter out;
public static FastScanner in;
List<Integer> list = new ArrayList<>();
int min, y, n;
private void permutations(int num) {
// out.println(num);
if (cntDigits(num) == y) {
if (num >= n) {
min = Math... | import java.io.*;
import java.util.*;
public class Main {
public static PrintWriter out;
public static FastScanner in;
List<Integer> list = new ArrayList<>();
int min, y, n;
private void permutations(int num) {
// out.println(num);
if (cntDigits(num) == y) {
if (num >= n) {
min = Math... | [["+", 64, 196, 0, 57, 64, 196, 0, 37, 0, 38], ["+", 64, 196, 0, 57, 64, 196, 0, 37, 0, 35], ["+", 0, 57, 64, 196, 0, 57, 64, 196, 0, 46], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 46], ["+", 8, 498, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 0, 195, 8, 196, 0, 57, 15, 15, 0, 24], ["+", 0, 57, 15, 15, 0, 16, 31, 492, 141, 22... | 3 | 523 |
#include <iostream>
#include <vector>
#define eol '\n'
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, k;
cin >> n >> k;
vector<int> d(k);
for (int i = 0; i < k; i++) {
cin >> d[i];
}
int N, v;
while (true) {
N = n;
bool ok = true;
for (int j... | #include <iostream>
#include <vector>
#define eol '\n'
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, k;
cin >> n >> k;
vector<int> d(k);
for (int i = 0; i < k; i++) {
cin >> d[i];
}
int N, v;
while (true) {
N = n;
bool ok = true;
for (int j... | [["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 0, 7, 8, 9, ... | 1 | 192 |
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>... | #include <algorithm>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>... | [["-", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 52, 8, 9, 0, 1, 0, 11, 17, 90], ["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["-", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 90], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, ... | 1 | 164 |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class Main {
private static Scanner sc;
public static void main(String[] args) {
Main instance = new Ma... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class Main {
private static Scanner sc;
public static void main(String[] args) {
Main instance = new Ma... | [["+", 0, 195, 8, 196, 0, 1, 0, 11, 31, 22], ["+", 0, 195, 8, 196, 0, 1, 0, 11, 17, 32], ["+", 8, 196, 0, 1, 0, 11, 12, 230, 0, 22], ["+", 8, 196, 0, 1, 0, 11, 12, 230, 0, 131], ["+", 8, 196, 0, 1, 0, 11, 12, 230, 0, 228], ["+", 8, 196, 0, 1, 0, 11, 12, 230, 39, 78], ["+", 0, 1, 0, 11, 12, 230, 3, 4, 0, 24], ["+", 0, 1... | 3 | 524 |
#include <iostream>
#include <vector>
using namespace std;
int main() {
int yen;
int k;
cin >> yen >> k;
int digits[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
for (int i = 0; i < k; i++) {
int d;
cin >> d;
digits[d]++;
}
vector<int> valid;
vector<int> backyen;
int index = 0;
for (int i = 0; ... | #include <iostream>
#include <vector>
using namespace std;
int main() {
int yen;
int k;
cin >> yen >> k;
int digits[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
for (int i = 0; i < k; i++) {
int d;
cin >> d;
digits[d]++;
}
vector<int> valid;
vector<int> backyen;
int index = 0;
for (int i = 0; ... | [["-", 64, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["-", 64, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 16, 17, 151], ["-", 64, 9, 0, 1, 0, 16, 12, 5, 0, 62], ["-", 64, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["-", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["-", 0, 14, 8, 9, 0, 1, ... | 1 | 266 |
#include <iostream>
#include <vector>
int main(void) {
int n;
int k;
std::cin >> n >> k;
auto ds = std::vector<int>(k);
for (int i = 0; i < k; i++) {
std::cin >> ds[i];
}
int result = n;
while (true) {
auto s = std::to_string(result);
for (auto &&c : s) {
for (auto &&d : ds) {
... | #include <iostream>
#include <vector>
int main(void) {
int n;
int k;
std::cin >> n >> k;
auto ds = std::vector<int>(k);
for (int i = 0; i < k; i++) {
std::cin >> ds[i];
}
while (true) {
auto s = std::to_string(n);
for (auto &&c : s) {
for (auto &&d : ds) {
if (d == c - '0') {
... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 0, 43, 49, 50, 51, 2, 3, 4, 0, 22], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 16,... | 1 | 138 |
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int N;
int D;
Scanner sc = new Scanner(System.in);
N = sc.nextInt();
D = sc.nextInt();
int d[] = new int[10];
for (int i = 0; i < D; i++) {
d[sc.nextInt()] = 1;
}
i... | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int N;
int D;
Scanner sc = new Scanner(System.in);
N = sc.nextInt();
D = sc.nextInt();
int d[] = new int[10];
for (int i = 0; i < D; i++) {
d[sc.nextInt()] = 1;
}
int sum = 0;
int maxD ... | [["-", 36, 36, 0, 493, 0, 454, 0, 522, 141, 22], ["-", 36, 36, 36, 36, 0, 493, 0, 454, 0, 35], ["-", 36, 36, 36, 36, 0, 493, 0, 454, 0, 487], ["-", 0, 493, 0, 454, 0, 522, 345, 522, 345, 22], ["-", 0, 493, 0, 454, 0, 522, 345, 522, 0, 131], ["-", 0, 493, 0, 454, 0, 522, 345, 522, 141, 22], ["-", 36, 36, 0, 493, 0, 454,... | 3 | 317 |
n, k = gets.split(" ").map(&:to_i)
dis = gets.chomp.split.map(&:to_i)
likes = (0..9).to_a - dis
max = likes.max
l = n.to_s.size
l += 1 if (max * l).to_i < n
c = nil
likes.repeated_permutation(l) do |ary|
c = ary.join.to_i
break if n <= c
end
puts c | n, k = gets.split(" ").map(&:to_i)
dis = gets.chomp.split
likes = ('0'..'9').to_a - dis
max = likes.max
l = n.to_s.size
l += 1 if (max * l).to_i < n
c = nil
likes.repeated_permutation(l) do |ary|
c = ary.join.to_i
break if n <= c
end
puts c | [["-", 36, 36, 0, 493, 0, 662, 12, 652, 17, 131], ["-", 36, 36, 0, 493, 0, 662, 12, 652, 735, 22], ["-", 0, 493, 0, 662, 12, 652, 3, 4, 0, 24], ["-", 0, 662, 12, 652, 3, 4, 0, 752, 0, 67], ["-", 0, 662, 12, 652, 3, 4, 0, 752, 0, 753], ["-", 0, 493, 0, 662, 12, 652, 3, 4, 0, 25], ["+", 31, 652, 486, 739, 0, 475, 756, 55... | 4 | 95 |
#include <stdio.h>
int tenthousand(int price);
int thousand(int price);
int hundred(int price);
int ten(int price);
int main(void) {
int n, k, i, j, price, tenth, th, hu, te, on, judge = 0;
int d[10];
scanf("%d %d", &n, &k);
for (i = 0; i < k; i++)
scanf("%d", &d[i]);
// printf("n = %d,k = %d\n",n,k... | #include <stdio.h>
int tenthousand(int price);
int thousand(int price);
int hundred(int price);
int ten(int price);
int main(void) {
int n, k, i, j, price, tenth, th, hu, te, on, judge = 0;
int d[10];
scanf("%d %d", &n, &k);
for (i = 0; i < k; i++)
scanf("%d", &d[i]);
// printf("n = %d,k = %d\n",n,k... | [["+", 0, 57, 15, 23, 0, 16, 31, 23, 0, 24], ["+", 15, 23, 0, 16, 31, 23, 0, 16, 12, 13], ["+", 0, 57, 15, 23, 0, 16, 31, 23, 0, 25], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 98], ["+", 0, 57, 15, 23, 0, 16, 12, 23, 0, 24], ["+", 0, 16, 12, 23, 0, 16, 31, 16, 31, 22], ["+", 0, 16, 12, 23, 0, 16, 31, 16, 17, 72], ["+", 0, ... | 0 | 567 |
#include <iostream>
using namespace std;
int main() {
int n, k, ans, f = 1, t;
int d[10];
cin >> n >> k;
ans = n;
for (int i = 0; i < k; i++)
cin >> d[i];
while (f) {
f = 0;
t = ans;
for (int i = 0; i < k; i++) {
while (t != 0) {
if (t % 10 == d[i]) {
f = 1;
... | #include <iostream>
using namespace std;
int main() {
int n, k, ans, f = 1, t;
int d[10];
cin >> n >> k;
ans = n;
for (int i = 0; i < k; i++)
cin >> d[i];
while (f) {
f = 0;
t = ans;
for (int i = 0; i < k; i++) {
t = ans;
while (t != 0) {
if (t % 10 == d[i]) {
... | [["+", 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, 22], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35], ["+", 0, 52, 8, 9, 0, 57, 64, 9, 0, 46], ["+", 8, 9, 0, 52, 8, 9, 0, 57, 0, 121], ["+", 0, 52, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 52, 8, 9, 0, 57, 15, 339, 5... | 1 | 143 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctype.h>
#include <iostream>
#include <map>
#include <stack>
#include <string>
#include <vector>
#define ll long long
#define LL long long
#define ULL unsigned long long
#define ull unsigned long long
#define FOR(i, a, b) for (int i =... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctype.h>
#include <iostream>
#include <map>
#include <stack>
#include <string>
#include <vector>
#define ll long long
#define LL long long
#define ULL unsigned long long
#define ull unsigned long long
#define FOR(i, a, b) for (int i =... | [["-", 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], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 49, 22], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 49, 22], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 31, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 31... | 1 | 352 |
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < ((int)(n)); i++)
#define reg(i, a, b) for (int i = ((int)(a)); i... | #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < ((int)(n)); i++)
#define reg(i, a, b) for (int i = ((int)(a)); i... | [["-", 0, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 90], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 9, 0, 57... | 1 | 236 |
// include
//------------------------------------------
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include... | // include
//------------------------------------------
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include... | [["+", 0, 52, 8, 9, 0, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 9, 0, 43, 49, 50, 49, 22], ["+", 8, 9, 0, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 9, 0, 43, 49, 50, 51, 16, 31, 22], ["+", 0, 9, 0, 43, 49, 50, 51, 16, 17, 109], ["+", 0, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 0, 52, 8, 9, 0, 9, 0, 43, 0, 35], ["-", 49, 50, 51, 2, 3... | 1 | 529 |
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
vector<int> d(k);
for (auto &ref : d) {
cin >> ref;
}
while (true) {
n++;
string str_n = to_string(n);
bool find_f = false;
for (auto i : d) {
if (str_n.find(to_string(i)) != -1) { /... | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
vector<int> d(k);
for (auto &ref : d) {
cin >> ref;
}
while (true) {
string str_n = to_string(n);
bool find_f = false;
for (auto i : d) {
if (str_n.find(to_string(i)) != -1) { //嫌いな数字が含ま... | [["-", 0, 52, 8, 9, 0, 1, 0, 27, 28, 22], ["-", 0, 52, 8, 9, 0, 1, 0, 27, 17, 29], ["-", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 0, 52, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 27, 17, 29], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 3... | 1 | 115 |
#include <bits/stdc++.h>
#define int long long int
#define rep(a, b) for (int a = 0; a < b; a++)
#define pb push_back
#define str string
#define INF 1 << 64
#define sf(a) scanf("%d", &a)
using namespace std;
int n, k, m;
int memo[10] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
/// moudame
signed main() {
fill(memo, memo + 10,... |
#include <bits/stdc++.h>
#define int long long int
#define rep(a, b) for (int a = 0; a < b; a++)
#define pb push_back
#define str string
#define INF 1 << 64
#define sf(a) scanf("%d", &a)
using namespace std;
int n, k, m;
int memo[10] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
/// moudame
signed main() {
// fill(memo,memo+10... | [["-", 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, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 8... | 1 | 217 |
def no_dislike_number(num, D):
for dislike in D:
if dislike in num:
return False
return True
MAX = 10000
N, K = map(int, input().split())
D = input().split()
for num in range(N, MAX+1):
if no_dislike_number(str(num), D):
print(num)
break | def no_dislike_number(num, D):
for dislike in D:
if dislike in num:
return False
return True
MAX = 10000
N, K = map(int, input().split())
D = input().split()
num = N
while(True):
if no_dislike_number(str(num), D):
print(num)
break
num += 1 | [["-", 36, 36, 36, 36, 0, 656, 0, 7, 0, 88], ["-", 36, 36, 36, 36, 0, 656, 0, 7, 0, 267], ["-", 36, 36, 0, 656, 0, 7, 12, 652, 63, 22], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 24], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["-", 0, 7... | 5 | 78 |
import java.util.Scanner;
import java.util.regex.Pattern;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
char d[] = new char[k];
String s = "";
String f = "";
for (int i = 0; i < k; i++) {
... | import java.util.Scanner;
import java.util.regex.Pattern;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
char d[] = new char[k];
String s = "";
String f = "";
for (int i = 0; i < k; i++) {
... | [["-", 8, 196, 0, 1, 0, 492, 500, 509, 500, 22], ["-", 8, 196, 0, 1, 0, 492, 500, 509, 0, 131], ["-", 8, 196, 0, 1, 0, 492, 500, 509, 119, 22], ["-", 0, 195, 8, 196, 0, 1, 0, 492, 0, 131], ["-", 0, 195, 8, 196, 0, 1, 0, 492, 141, 22], ["-", 8, 196, 0, 1, 0, 492, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 492, 3, 4, 0, 22], [... | 3 | 194 |
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Main {
public static void main(String[] args) throws IOException {
ContestScanner scan = new ContestScanner();
... | import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Main {
public static void main(String[] args) throws IOException {
ContestScanner scan = new ContestScanner();
... | [["+", 8, 196, 0, 57, 75, 196, 0, 57, 0, 121], ["+", 0, 57, 75, 196, 0, 57, 15, 15, 0, 24], ["+", 75, 196, 0, 57, 15, 15, 0, 16, 31, 22], ["+", 75, 196, 0, 57, 15, 15, 0, 16, 17, 60], ["+", 75, 196, 0, 57, 15, 15, 0, 16, 12, 499], ["+", 0, 57, 75, 196, 0, 57, 15, 15, 0, 25], ["+", 0, 57, 75, 196, 0, 57, 64, 93, 0, 94],... | 3 | 868 |
import java.util.Arrays;
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int k = in.nextInt();
String[] s = new String[k];
for (int i = 0; i < k; i++) {
s[i] = in.next();
}
long sum = 0;
... | import java.util.Arrays;
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int k = in.nextInt();
String[] s = new String[k];
for (int i = 0; i < k; i++) {
s[i] = in.next();
}
long sum = n -... | [["-", 0, 195, 8, 196, 0, 503, 49, 200, 51, 499], ["+", 8, 196, 0, 503, 49, 200, 51, 16, 31, 22], ["+", 8, 196, 0, 503, 49, 200, 51, 16, 17, 33], ["+", 8, 196, 0, 503, 49, 200, 51, 16, 12, 499], ["-", 0, 52, 8, 196, 0, 1, 0, 11, 17, 107], ["-", 0, 52, 8, 196, 0, 1, 0, 11, 12, 22], ["+", 0, 52, 8, 196, 0, 1, 0, 27, 0, 2... | 3 | 219 |
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define... | #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define... | [["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 79], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-",... | 1 | 276 |
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define REP(i, k, n) for (int i = k; i < n; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(v) v.begin(), v.end()
#define... | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define REP(i, k, n) for (int i = k; i < n; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(v) v.begin(), v.end()
#define... | [["-", 8, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["-", 0, 16, 31, 16, 12, 2, 63, 118, 28, 22], ["-", 0, 16, 31, 16, 12, 2, 63, 118, 17, 131], ["-", 0, 16, 31, 16, 12, 2, 63, 118, 119, 120], ["-", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["-", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25], ["-", 0, ... | 1 | 296 |
/* {{{ Shinobu kawaii */
/*
______ __ _ __
.' ____ \ [ | (_) [ |
| (___ \_| | |--. __ _ .--. .--. | |.--. __ _
_.____`. | .-. | [ | [ `.-. |/ .'`\ \| '/'`\ \[ | | |
| \____) | | | | | | | | | | || \__. || \__/ | | \_/ |,
\______.'[___]|__][___][___||_... | /* {{{ Shinobu kawaii */
/*
______ __ _ __
.' ____ \ [ | (_) [ |
| (___ \_| | |--. __ _ .--. .--. | |.--. __ _
_.____`. | .-. | [ | [ `.-. |/ .'`\ \| '/'`\ \[ | | |
| \____) | | | | | | | | | | || \__. || \__/ | | \_/ |,
\______.'[___]|__][___][___||_... | [["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 7, 0, 88], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 0, 32], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 14, 8, 9, 0, 7, 10, 43, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 7, 0, 35]... | 1 | 455 |
n, k = map(int,input().split())
d = list(map(str,input().split()))
ans = n
f = 0
while True:
ansstr = list(str(ans))
l = len(ansstr)
for i in range(l):
if ansstr[i] in d:
break
else:
f = 1
break
if f:
break
ans += 1
print(ans) | n, k = map(int,input().split())
d = list(map(str,input().split()))
ans = n
f = 0
while True:
ansstr = list(str(ans))
l = len(ansstr)
cnt = 0
for i in range(l):
if ansstr[i] in d:
break
else:
cnt += 1
if cnt == l:
f = 1
... | [["+", 0, 52, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 52, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 52, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 7, 8, 196, 0, 57, 75, 76, 0, 102], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 31, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 17, 107], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 12, 612], ["+", ... | 5 | 91 |
#include <bits/stdc++.h>
#define ll long long
#define all(x) x.begin(), x.end()
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL)
#define MOD 1000000007
using namespace std;
vector<ll> factm... | #include <bits/stdc++.h>
#define ll long long
#define all(x) x.begin(), x.end()
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL)
#define MOD 1000000007
using namespace std;
vector<ll> factm... | [["+", 51, 16, 31, 2, 3, 4, 0, 16, 17, 33], ["+", 51, 16, 31, 2, 3, 4, 0, 16, 12, 13], ["+", 31, 2, 3, 4, 0, 16, 12, 23, 0, 24], ["+", 3, 4, 0, 16, 12, 23, 0, 16, 31, 13], ["+", 3, 4, 0, 16, 12, 23, 0, 16, 17, 72], ["+", 3, 4, 0, 16, 12, 23, 0, 16, 12, 13], ["+", 31, 2, 3, 4, 0, 16, 12, 23, 0, 25], ["-", 12, 16, 12, 2,... | 1 | 324 |
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxN = 3e5 + 10;
long long int fact[maxN] = {0};
long long int power(long long int a, long long int b) {
if (a == 1 || b == 0) {
return 1;
}
long long int ans = 1;
while (b) {
if (b & 1) {
ans = (ans % mod) * (a % mod... | #include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxN = 3e5 + 10;
long long int fact[maxN] = {0};
long long int power(long long int a, long long int b) {
if (a == 1 || b == 0) {
return 1;
}
long long int ans = 1;
while (b) {
if (b & 1) {
ans = (ans % mod) * (a % mod... | [["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["-", 0, 11, 12, 16, 31, 23, 0, 16, 31, 22], ["-", 0, 11, 12, 16, 31, 23, 0, 16, 17, 109], ["-", 0, 11, 12, 16, 31, 23, 0, 16, 12, 22], ["-", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 0, 7, 8, ... | 1 | 392 |
P = 10**9+7
fac = [1]
ifac = [1]
ff = 1
for i in range(1,200001):
ff *= i
ff %= p
fac.append(ff)
ifac.append(pow(ff, p-2, p))
def ncr(n, r, p):
return (fac[n] * ifac[r] % p * ifac[n-r] % p);
h,w,a,b = map(int,input().split())
s = 0
nC = b-1
kC = 0
nD = w-b-1+h-1
kD = h-1
for i in range(h-a):
C = ncr(nC, k... | P = 10**9+7
fac = [1]
ifac = [1]
ff = 1
for i in range(1,200001):
ff *= i
ff %= P
fac.append(ff)
ifac.append(pow(ff, P-2, P))
def ncr(n, r):
return (fac[n] * ifac[r] % P * ifac[n-r] % P);
h,w,a,b = map(int,input().split())
s = 0
nC = b-1
kC = 0
nD = w-b-1+h-1
kD = h-1
for i in range(h-a):
C = ncr(nC, kC)
... | [["-", 0, 7, 8, 196, 0, 1, 0, 677, 12, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 12, 22], ["-", 3, 4, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 31, 22], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["-", 36, 36, 0, 656, 0, 14, 54, 54, 0, 21], ["-", 36, 36, 0, 6... | 5 | 195 |
H, W, A, B = map(int, open(0).read().split())
MOD = 10**9+7
factorials = [1] * (H + W + 1)
inv_factorials = [1] * (H + W + 1)
for i in range(H + W):
factorials[i+1] = factorials[i] * (i + 1) % MOD
inv_factorials = list(map(lambda n: pow(n, MOD - 2, MOD), factorials))
def modcomb(m, n, mod):
return factorial... | H, W, A, B = map(int, open(0).read().split())
MOD = 10**9+7
factorials = [1] * (H + W + 1)
inv_factorials = [1] * (H + W + 1)
for i in range(H + W):
factorials[i+1] = factorials[i] * (i + 1) % MOD
inv_factorials = list(map(lambda n: pow(n, MOD - 2, MOD), factorials))
def modcomb(m, n, mod):
return factorial... | [["+", 0, 37, 0, 657, 31, 657, 31, 657, 17, 109], ["+", 0, 37, 0, 657, 31, 657, 31, 657, 12, 22], ["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["-", 12, 652, 3, 4, 0, 657, 31, 657, 31, 22], ["-", 12, 652, 3, 4, 0, 657, 31, 657, 17, 72], ["-", 12, 652, 3, 4, 0, 657, 31, 657, 1... | 5 | 206 |
H, W, A, B = map(int, open(0).read().split())
MOD = 10**9+7
factorials = [1] * (H + W + 1)
inv_factorials = [1] * (H + W + 1)
for i in range(H + W):
factorials[i+1] = factorials[i] * (i + 1) % MOD
inv_factorials = list(map(lambda n: pow(n, MOD - 2, MOD), factorials))
def modcomb(m, n, mod):
return factorial... | H, W, A, B = map(int, open(0).read().split())
MOD = 10**9+7
factorials = [1] * (H + W + 1)
inv_factorials = [1] * (H + W + 1)
for i in range(H + W):
factorials[i+1] = factorials[i] * (i + 1) % MOD
inv_factorials = list(map(lambda n: pow(n, MOD - 2, MOD), factorials))
def modcomb(m, n, mod):
return factorial... | [["+", 0, 37, 0, 657, 31, 657, 31, 657, 17, 109], ["+", 0, 37, 0, 657, 31, 657, 31, 657, 12, 22], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 33], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 17, 110], ["+", 8, 196, 0, 1, 0, 677, 12, 657, 17, 109... | 5 | 206 |
#include <bits/stdc++.h>
using namespace std;
#define oo 1e9
#define fi first
#define se second
#define sp(iiii) setprecision(iiii)
#define IO \
ios_base::sync_with_stdio(false); \
cin.tie(0)
#define ms(a... | #include <bits/stdc++.h>
using namespace std;
#define oo 1e9
#define fi first
#define se second
#define sp(iiii) setprecision(iiii)
#define IO \
ios_base::sync_with_stdio(false); \
cin.tie(0)
#define ms(a... | [["-", 0, 30, 0, 14, 49, 53, 54, 55, 0, 21], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 49, 22], ["-", 0, 43, 49, 50, 51, 2, 3, 4, 0, 21], ["-", 0, 43, 49, 50, 51, 2, 3, 4, 0, 22], ["-", 0, 57, 64, 9, 0, 37, 0, 16, 12, 22], ["+", 0, 57, 64, 9, 0, 37, 0, 16, 12, 22], ["-", 31, 23, 0... | 1 | 457 |
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <algorithm>
#include <cstring>
#include <iostream>
using namespace std;
const int MAX_H = 1E+05;
const long long MOD = 1E+09 + 7;
int H, W, A, B;
long long modfac[MAX_H * 2 + 1];
long long modfacinv[MAX_H * 2 + 1];... | #pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <algorithm>
#include <cstring>
#include <iostream>
using namespace std;
const int MAX_H = 1E+05;
const long long MOD = 1E+09 + 7;
int H, W, A, B;
long long modfac[MAX_H * 2 + 1];
long long modfacinv[MAX_H * 2 + 1];... | [["-", 8, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151], ["-", 8, 9, 0, 1, 0, 16, 12, 5, 0, 62], ["-", 8, 9, 0, 1, 0, 16, 12, 5, 0, 44], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]] | 1 | 451 |
#include <iostream>
using namespace std;
typedef long long ll;
const ll Mod = 1e9 + 7;
const int N = 200005;
ll Inv[N], Fac[N];
ll C(ll n, ll m) {
if (!m)
return 1;
return Fac[n] * Inv[n - m] % Mod * Inv[m] % Mod;
}
ll Cal(ll x, ll y) { return C(x + y - 2, y - 1); }
ll ex_gcd(ll a, ll b, ll &x, ll &y) {
ll r,... | #include <iostream>
using namespace std;
typedef long long ll;
const ll Mod = 1e9 + 7;
const int N = 200005;
ll Inv[2 * N], Fac[2 * N];
ll C(ll n, ll m) {
if (!m || (n == m))
return 1;
return Fac[n] * Inv[n - m] % Mod * Inv[m] % Mod;
}
ll Cal(ll x, ll y) { return C(x + y - 2, y - 1); }
ll ex_gcd(ll a, ll b, ll ... | [["+", 0, 30, 0, 43, 49, 80, 81, 16, 31, 13], ["+", 0, 30, 0, 43, 49, 80, 81, 16, 17, 48], ["+", 0, 57, 15, 339, 51, 16, 31, 91, 28, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 0, 57, 15, 339, 51, 16, 12, 23, 0, 24], ["+", 15, 339, 51, 16, 12, 23, 0, 16, 31, 22], ["+", 15, 339, 51, 16, 12, 23, 0, 16, 17, 6... | 1 | 384 |
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define FIO \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0)... | #include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define FIO \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0)... | [["-", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["-", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["-", 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, 355], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ... | 1 | 368 |
h,w,a,b=map(int,input().split())
p=10**9+7
#p=127
def modp_factorial(n):
s=1
for x in range(1,h+1):
s=(s*x) % p
return s
def modp_prod(lst):
s=1
for x in lst:
s=(s*x)%p
return s
def inv(n):
s=1
q=p-2
while q>0:
if q&1:
s=s*n % p
n=n*n % p... | h,w,a,b=map(int,input().split())
p=10**9+7
#p=127
def modp_factorial(n):
s=1
for x in range(1,h+1):
s=(s*x) % p
return s
def modp_prod(lst):
s=1
for x in lst:
s=(s*x)%p
return s
def inv(n):
s=1
q=p-2
while q>0:
if q&1:
s=(s*n) % p
n=(n*n)... | [["+", 0, 1, 0, 662, 12, 657, 31, 23, 0, 24], ["+", 0, 1, 0, 662, 12, 657, 31, 23, 0, 25], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 31, 23, 0, 657, 12, 652, 3, 4, 0, 25]] | 5 | 301 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5 + 5, M = 1e6 + 5, inf = 0x3f3f3f3f, mod = 1e9 + 7;
#define mst(a) memset(a, 0, sizeof a)
#define lx x << 1
#define rx x << 1 | 1
#define reg register
#define PII pair<int, int>
#define fi first
#define se second
ll fac[N];
ll ksm(ll a... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5 + 10, M = 1e6 + 5, inf = 0x3f3f3f3f, mod = 1e9 + 7;
#define mst(a) memset(a, 0, sizeof a)
#define lx x << 1
#define rx x << 1 | 1
#define reg register
#define PII pair<int, int>
#define fi first
#define se second
ll fac[N];
ll ksm(ll ... | [["-", 0, 30, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 8, 9, 0, 4... | 1 | 351 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e6 + 5, M = 1e6 + 5, inf = 0x3f3f3f3f, mod = 1e9 + 7;
#define mst(a) memset(a, 0, sizeof a)
#define lx x << 1
#define rx x << 1 | 1
#define reg register
#define PII pair<int, int>
#define fi first
#define se second
ll fac[N];
ll ksm(ll a... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e6 + 5, M = 1e6 + 5, inf = 0x3f3f3f3f, mod = 1e9 + 7;
#define mst(a) memset(a, 0, sizeof a)
#define lx x << 1
#define rx x << 1 | 1
#define reg register
#define PII pair<int, int>
#define fi first
#define se second
ll fac[N];
ll ksm(ll a... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["-", 8, 9, 0, 43, 49, 50, 51, 23, 0, 24], ["-", 51, 23, 0, 16, 31, 16, 31, 16, 31, 22], ["-", 51, 23, 0, 16, 31, 16, 31, 16, 17, 33], ["-", 51, 23, 0, 16, 31, 16, 31, 16, 12, 22], ["-", 49, 5... | 1 | 353 |
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef long long ll;
#define rep(i, l, r) for (int i = l; i <= r; i++)
#define REP(i, l, r) for (int i = l; i >= r; i--)
#define fi first
#define se second
#define eb emplace_back
#define fastio ... | #include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef long long ll;
#define rep(i, l, r) for (int i = l; i <= r; i++)
#define REP(i, l, r) for (int i = l; i >= r; i--)
#define fi first
#define se second
#define eb emplace_back
#define fastio ... | [["-", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 30, 0, 14, 8, 9, 0, 7, 0, 88], ["+", 0, 30, 0, 14, 8, 9, 0, 7, 0, 35], ["+", 0, 14, 8, 9, 0, 7, 26, 27, 17, 29], ["+", 0, 14, 8, 9, 0, 7, 26, 27, 28, 22], ["-", 0, 11, 31, 69, 341, 342, 0, 27, 17, 29], ["+", 0, 11, 31, 69, 341, 342, 0, 16, 17, 72], ["+", 0, 11, 31, 69,... | 1 | 509 |
//
// main.cpp
// comp
//
// Created by Brenda Aurelie on 6/14/20.
// Copyright © 2020 Brenda Aurelie. All rights reserved.
//
#include <iostream>
using namespace std;
int main() {
int n, L, temp;
cout << "Enter the number of skewer: " << endl;
cout << "Enter the number of length: " << endl;
cin >> n;
i... | //
// main.cpp
// comp
//
// Created by Brenda Aurelie on 6/14/20.
// Copyright © 2020 Brenda Aurelie. All rights reserved.
//
#include <iostream>
using namespace std;
int main() {
int n, temp;
cin >> n;
int arr[2 * n];
for (int i = 0; i < 2 * n; i++) {
cin >> arr[i];
}
for (int i = 0; i < 2 * n;... | [["-", 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], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 31, 22], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 62], ["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["-", 0, 14, 8, 9, 0, 1, 0,... | 1 | 192 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int arr[n];
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
sort(arr, arr + n);
long sum = 0;
for (int i = 0; i < n; i += 2) {
sum += arr[i];
}
cout << sum << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int arr[2 * n];
for (int i = 0; i < (2 * n); i++) {
cin >> arr[i];
}
sort(arr, arr + (2 * n));
long sum = 0;
for (int i = 0; i < (2 * n); i += 2) {
sum += arr[i];
}
cout << sum << endl;
} | [["+", 8, 9, 0, 43, 49, 80, 81, 16, 31, 13], ["+", 8, 9, 0, 43, 49, 80, 81, 16, 17, 48], ["+", 8, 9, 0, 7, 15, 16, 12, 23, 0, 24], ["+", 0, 7, 15, 16, 12, 23, 0, 16, 31, 13], ["+", 0, 7, 15, 16, 12, 23, 0, 16, 17, 48], ["+", 8, 9, 0, 7, 15, 16, 12, 23, 0, 25], ["+", 0, 2, 3, 4, 0, 16, 12, 23, 0, 24], ["+", 3, 4, 0, 16,... | 1 | 92 |
# -*- coding: utf-8 -*-
import numpy as np
def main(p1,p2):
print(p1)
print(p2)
L_np = np.sort(np.array(p2))
x_total = 0
for i in range(p1):
x_total += L_np[2*i]
print(x_total)
if __name__ == "__main__":
#a = [int(input()) for i in range(5)]
N = int(input())
L = [int(item)... | # -*- coding: utf-8 -*-
import numpy as np
def main(p1,p2):
L_np = np.sort(np.array(p2))
x_total = 0
for i in range(p1):
x_total += L_np[2*i]
print(x_total)
if __name__ == "__main__":
#a = [int(input()) for i in range(5)]
N = int(input())
L = [int(item) for item in input().split()... | [["-", 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 | 97 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int x;
cin >> x;
int a[x], s = 0;
for (int i = 0; i < x; i++)
cin >> a[i];
sort(a, a + x);
for (int i = 0; i < x; i++) {
s = s + min(a[i], a[i + 1]);
i++;
}
cout << s << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int x;
cin >> x;
int a[2 * x], s = 0;
for (int i = 0; i < 2 * x; i++)
cin >> a[i];
sort(a, a + 2 * x);
for (int i = 0; i < 2 * x; i++) {
s = s + min(a[i], a[i + 1]);
i++;
}
cout << s << endl;
} | [["+", 8, 9, 0, 43, 49, 80, 81, 16, 31, 13], ["+", 8, 9, 0, 43, 49, 80, 81, 16, 17, 48], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 31, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 48], ["+", 0, 2, 3, 4, 0, 16, 12, 16, 31, 13], ["+", 0, 2, 3, 4, 0, 16, 12, 16, 17, 48]] | 1 | 103 |
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
#define int long long
#define re register
#define pb(x) push_back(x)
#define ce(x) cout << x << '\n';
#define db long double;
#define pll pair<ll, ll>;
#define rep(i, x, n, inc) for (i = x; i < n; i += inc)
#define repr(i, x, n, inc... | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
#define int long long
#define re register
#define pb(x) push_back(x)
#define ce(x) cout << x << '\n';
#define db long double;
#define pll pair<ll, ll>;
#define rep(i, x, n, inc) for (i = x; i < n; i += inc)
#define repr(i, x, n, inc... | [["-", 0, 30, 0, 14, 8, 9, 0, 171, 0, 184], ["-", 0, 30, 0, 14, 8, 9, 0, 171, 141, 22], ["-", 8, 9, 0, 171, 0, 1, 0, 2, 63, 22], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 2... | 1 | 293 |
#include <stdio.h>
int main() {
int i, j, tmp;
/* 数値を格納する配列 */
int l[200];
/* 数値の総数を入力 */
int n;
scanf("%d", &n);
/* 配列に格納する数値を入力 */
for (i = 0; i < 2 * n; ++i)
scanf("%d", &l[i]);
/* 数値を昇順にソート */
for (i = 0; i < n; ++i) {
for (j = i + 1; j < n; ++j) {
if (l[i] > l[j]) {
tm... | #include <stdio.h>
int main() {
int i, j, tmp;
/* 数値を格納する配列 */
int l[200];
/* 数値の総数を入力 */
int n;
scanf("%d", &n);
/* 配列に格納する数値を入力 */
for (i = 0; i < 2 * n; ++i)
scanf("%d", &l[i]);
/* 数値を昇順にソート */
for (i = 0; i < 2 * n; ++i) {
for (j = i + 1; j < 2 * n; ++j) {
if (l[i] > l[j]) {
... | [["+", 8, 9, 0, 7, 15, 16, 12, 16, 31, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 48], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 180 |
#include <bits/stdc++.h>
using namespace std;
int n, a[100], ans, x, y;
int main() {
cin >> n;
for (int i = 1; i <= n * 2; i++) {
cin >> a[i];
}
sort(a + 1, a + 1 + 2 * n);
for (int i = 1; i <= n * 2; i += 2) {
ans += a[i];
}
cout << ans;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int a[201], ans, n;
int main() {
cin >> n;
for (int i = 1; i <= 2 * n; i++) {
cin >> a[i];
}
sort(a + 1, a + 2 * n + 1);
for (int i = 1; i <= 2 * n; i += 2) {
ans += a[i];
}
cout << ans;
return 0;
} | [["-", 36, 36, 36, 36, 0, 30, 0, 43, 49, 22], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 49, 22], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 48], ["+", 8, ... | 1 | 103 |
# D イロハちゃんと升目
cnt=0
h,w,a,b=map(int,input().split())
def find_power(n):
# 0!からn!までのびっくりを出してくれる関数
powlist=[0]*(n+1)
powlist[0]=1
powlist[1]=1
for i in range(2,n+1):
powlist[i]=powlist[i-1]*i%(10**9+7)
return powlist
def find_inv_power(n):
#0!からn!までの逆元を10**9+7で割ったあまりリストを作る関数
powli... | # D イロハちゃんと升目
cnt=0
h,w,a,b=map(int,input().split())
def find_power(n):
# 0!からn!までのびっくりを出してくれる関数
powlist=[0]*(n+1)
powlist[0]=1
powlist[1]=1
for i in range(2,n+1):
powlist[i]=powlist[i-1]*i%(10**9+7)
return powlist
def find_inv_power(n):
#0!からn!までの逆元を10**9+7で割ったあまりリストを作る関数
powli... | [["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 109], ["+", 0, 652, 3, 4, 0, 657, 12, 23, 0, 24], ["+", 0, 657, 12, 23, 0, 657, 31, 657, 31, 612], ["+", 0, 657, 12, 23, 0, 657, 31, 657, 17, 578], ["+", 0, 657, 12, 23, 0, 657, 31, 657, 12, 612], ["+", 3, 4, 0, 657, 12, 23, 0, 657, 17, 72], ["+", 3, 4, 0, 657, 12, 23, 0, 657, 12,... | 5 | 401 |
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import ... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from ... | [["+", 36, 36, 0, 656, 0, 686, 141, 673, 0, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 686, 0, 21], ["-", 36, 36, 36, 36, 0, 656, 0, 686, 0, 21], ["-", 36, 36, 0, 656, 0, 686, 141, 673, 0, 22], ["-", 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... | 5 | 408 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using vll = vector<ll>;
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const ll MAX = 110000;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = ... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using vll = vector<ll>;
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const ll MAX = 210000;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = ... | [["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 0, 2, 3, 4, 0, 16, 31, 23, 0, 24], ["-", 0, 16, 31, 23, 0, 16, 31, 16, 17, 33], ["-", 0, 16, 31, 23, 0, 16, 31, 16, 12, 13], ["-", 0, 2, 3, 4, 0, 16, 31, 23, 0, 25], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2,... | 1 | 375 |
#include <bits/stdc++.h>
using namespace std;
int mod = pow(10, 9) + 7;
int inv(int n) {
int e = pow(10, 9) + 5;
int64_t p = n;
int64_t ans = 1;
while (e > 0) {
if (e % 2 == 0) {
p *= p;
p %= mod;
e /= 2;
} else {
ans *= p;
ans %= mod;
e--;
}
}
return ans;
... | #include <bits/stdc++.h>
using namespace std;
int mod = pow(10, 9) + 7;
int inv(int n) {
int e = pow(10, 9) + 5;
int64_t p = n;
int64_t ans = 1;
while (e > 0) {
if (e % 2 == 0) {
p *= p;
p %= mod;
e /= 2;
} else {
ans *= p;
ans %= mod;
e--;
}
}
return ans %... | [["+", 0, 14, 8, 9, 0, 37, 0, 16, 17, 109], ["+", 0, 14, 8, 9, 0, 37, 0, 16, 12, 22], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 11, 12, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 11, 12, 2, 3, 4, 0, 16, 12, 13], ["-", 12, 2, 3, 4, 0, 16, 31, 16, 12, 13], ["+", 12, 2, 3, 4, 0, 1... | 1 | 401 |
mod = 10 ** 9 + 7
fac_table = [1 for i in range(200001)]
inv_table = [1 for i in range(200001)]
def make_table(h, w):
for i in range(1, h + w - 1):
fac_table[i] = fac_table[i - 1] * i % mod
inv_table[i] = pow(fac_table[i], mod - 2, mod)
def comb(n, r):
return fac_table[n] * inv_table[n - r]... | mod = 10 ** 9 + 7
fac_table = [1 for i in range(200001)]
inv_table = [1 for i in range(200001)]
def make_table(h, w):
for i in range(1, h + w - 1):
fac_table[i] = fac_table[i - 1] * i % mod
inv_table[i] = pow(fac_table[i], mod - 2, mod)
def comb(n, r):
return fac_table[n] * inv_table[n - r]... | [["+", 36, 36, 36, 36, 0, 656, 0, 57, 0, 121], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 60], ["+", 0, 656, 0, 57, 15, 666, 0, 557, 0, 654], ["+", 0, 656, 0, 57, 15, 666, 0, 557, 0, 6], ["+", 0, 656, 0, 57, 15, 666, 0, 557, 0, 655], ["+", 36, 36, 36, 36, 0, 656, 0, 57, 0, ... | 5 | 196 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww {
cww() {
ios::sync_with_stdio(false);
cin.tie(0);
}
} star;
const long long INF = numeric_limits<long long>::max();
ty... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww {
cww() {
ios::sync_with_stdio(false);
cin.tie(0);
}
} star;
const long long INF = numeric_limits<long long>::max();
ty... | [["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 355], ["+", 15, 339, 51, 16, 31, 16, 12, 16, 31, 22], ["+", 15, 339, 51, 16, 31, 16, 12, 16, 17, 20], ["+", 15, 339, 51, 16, 31, 16, 12, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 355], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, ... | 1 | 1,155 |
#include <algorithm>
#include <cassert>
#include <iostream>
#include <string>
#include <vector>
#define M 1000000007
#define S 200000
typedef unsigned long long ull;
std::vector<ull> fac(S);
std::vector<ull> ifac(S);
ull pow_mod(ull x, ull n) {
ull ans = 1;
while (n != 0) {
if (n & 1) {
ans = ans * x ... | #include <algorithm>
#include <cassert>
#include <iostream>
#include <string>
#include <vector>
#define M 1000000007
#define S 200000
typedef unsigned long long ull;
std::vector<ull> fac(S);
std::vector<ull> ifac(S);
ull pow_mod(ull x, ull n) {
ull ans = 1;
while (n != 0) {
if (n & 1) {
ans = ans * x ... | [["+", 8, 9, 0, 7, 8, 9, 0, 43, 0, 21], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 49, 22], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 0, 35], ["+", 8, 9, 0, 7, 8, 9, 0, 57, 0, 121], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 5... | 1 | 357 |
H,W,A,B = map(int,input().split())
class Combination:
"""
O(n)の前計算を1回行うことで,O(1)でnCr mod mを求められる
n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
使用例:
comb = Combination(1000000)
print(comb(5, 3)) # 10
"""
def __init__(self, n_max, mod=10 ** 9 + 7):
self.mod = mod
self.mod... | H,W,A,B = map(int,input().split())
class Combination:
"""
O(n)の前計算を1回行うことで,O(1)でnCr mod mを求められる
n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
使用例:
comb = Combination(1000000)
print(comb(5, 3)) # 10
"""
def __init__(self, n_max, mod=10 ** 9 + 7):
self.mod = mod
self.mod... | [["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 0, 1, 0, 662, 12, 657, 31, 657, 31, 612], ["+", 0, 1, 0, 662, 12, 657, 31, 657, 17, 578], ["+", 0, 1, 0, 662, 12, 657, 31, 657, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12,... | 5 | 309 |
#include <bits/stdc++.h>
#define ll long long
const int mod = 1e9 + 7;
using namespace std;
ll dp[200010];
ll gt[200010];
ll ksm(ll a, ll b) {
ll ans = 1;
for (; b; b >>= 1, a = a * a % mod)
if (b & 1)
ans = ans * a % mod;
return ans;
}
ll C(ll m, ll n) {
return (gt[m] * ksm(gt[n], mod - 2) % mod) * ... | #include <bits/stdc++.h>
#define ll long long
const int mod = 1e9 + 7;
using namespace std;
ll dp[200010];
ll gt[200010];
ll ksm(ll a, ll b) {
ll ans = 1;
for (; b; b >>= 1, a = a * a % mod)
if (b & 1)
ans = ans * a % mod;
return ans;
}
ll C(ll m, ll n) {
return (gt[m] * ksm(gt[n], mod - 2) % mod) * ... | [["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]] | 1 | 308 |
#include "bits/stdc++.h"
using namespace std;
#define Rep(i, n) for (int i = 0; i < (int)(n); i++)
#define For(i, n1, n2) for (int i = (int)(n1); i < (int)(n2); i++)
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define RREP(i, n) for (ll i = ((ll)(n)-1); i >= 0; i--)
#define FOR(i, n1, n2) for (ll i = (ll)(n1); i... | #include "bits/stdc++.h"
using namespace std;
#define Rep(i, n) for (int i = 0; i < (int)(n); i++)
#define For(i, n1, n2) for (int i = (int)(n1); i < (int)(n2); i++)
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define RREP(i, n) for (ll i = ((ll)(n)-1); i >= 0; i--)
#define FOR(i, n1, n2) for (ll i = (ll)(n1); i... | [["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 2, 3, 4, 0, 2, 63, 343, 0, 349], ["-", 0, 2, 3, 4, 0, 2, 63, 343, 141, 22], ["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["... | 1 | 1,639 |
/*
最短経路は(h+w)!/h!*w!
ここから(a+b)!/a!b! + (a+(b-1))!/a!(b-1)! +..+1
*/
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define sc(x) scanf("%d", &x);
static const... | /*
最短経路は(h+w)!/h!*w!
ここから(a+b)!/a!b! + (a+(b-1))!/a!(b-1)! +..+1
*/
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define sc(x) scanf("%d", &x);
static const... | [["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 78], ["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 14, 39, 78], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0... | 1 | 330 |
def extended_gcd(a, b)
last_remainder, remainder = a.abs, b.abs
x, last_x, y, last_y = 0, 1, 1, 0
while remainder != 0
last_remainder, (quotient, remainder) = remainder, last_remainder.divmod(remainder)
x, last_x = last_x - quotient*x, x
y, last_y = last_y - quotient*y, y
end
return last_remainde... | require 'openssl'
def extended_gcd(a, b)
last_remainder, remainder = a.abs, b.abs
x, last_x, y, last_y = 0, 1, 1, 0
while remainder != 0
last_remainder, (quotient, remainder) = remainder, last_remainder.divmod(remainder)
x, last_x = last_x - quotient*x, x
y, last_y = last_y - quotient*y, y
end
re... | [["+", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 0, 493, 0, 652, 3, 4, 0, 557, 0, 62], ["+", 0, 493, 0, 652, 3, 4, 0, 557, 0, 6], ["-", 36, 36, 36, 36, 0, 493, 0, 735, 141, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 735, 141, 22], ["+", 196, 737, 8, 736, 0, 662, 12, 738, 17, 109], ["+", 196, 737, 8, 736, 0, 662, 12, 7... | 4 | 327 |
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for (int i = (n); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
type... | #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for (int i = (n); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
type... | [["+", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 22], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22], ["+", 8,... | 1 | 357 |
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for (int i = (n); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
type... | #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for (int i = (n); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
type... | [["+", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 22], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22], ["+", 8,... | 1 | 359 |
#include <algorithm>
#include <cmath>
#include <iostream>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
const ll MAX = 100005;
const ll MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
... | #include <algorithm>
#include <cmath>
#include <iostream>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
const ll MAX = 200000;
const ll MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
... | [["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 24], ["+", 51, 2, 3, 4, 0, 16, 31, 16, 31, 22], ["+", 51, 2, 3, 4, 0, 16, 31, 16, 17, 72], ["+", 51, 2, 3,... | 1 | 336 |
#include <bits/stdc++.h>
using namespace std;
namespace mylib {
template <int mod> struct ModInt {
using ll = long long;
int x;
const static int M = mod;
ModInt(ll x_) {
x = x_ % mod;
if (x < 0)
x += mod;
}
ModInt() : ModInt(0) {}
inline ModInt &operator+=(const ModInt rhs) {
x += rhs.... | #include <bits/stdc++.h>
using namespace std;
namespace mylib {
template <int mod> struct ModInt {
using ll = long long;
int x;
const static int M = mod;
ModInt(ll x_) {
x = x_ % mod;
if (x < 0)
x += mod;
}
ModInt() : ModInt(0) {}
inline ModInt &operator+=(const ModInt rhs) {
x += rhs.... | [["+", 0, 2, 3, 4, 0, 16, 31, 16, 17, 72], ["+", 0, 2, 3, 4, 0, 16, 31, 16, 12, 22], ["+", 51, 4, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 51, 4, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 2, 3, 4, 0, 16, 31, 16, 31, 22]] | 1 | 1,033 |
#include <bits/stdc++.h>
#define SIZE 300005
#define MOD 1000000007LL
#define EPS 1e-10
#define INF 2147483647
#define LLINF 9223372036854775807
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, a, b) for (int i = a; i <= b; i++)
#define DOWN(i, b, a) for (int i = b; i >= a; i--)
#define SET(a, c) memset(a, ... | #include <bits/stdc++.h>
#define SIZE 300005
#define MOD 1000000007LL
#define EPS 1e-10
#define INF 2147483647
#define LLINF 9223372036854775807
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, a, b) for (int i = a; i <= b; i++)
#define DOWN(i, b, a) for (int i = b; i >= a; i--)
#define SET(a, c) memset(a, ... | [["-", 0, 57, 15, 339, 51, 16, 31, 23, 0, 24], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["-", 0, 52, 8, 9, 0, 57, 15, 339, 0, 25], ["-", 0, 43, 49, 50, 51, 16, 31, 16, 12, 22], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["+", ... | 1 | 461 |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int MAX_N = 100202;
const int mod = 1e9 + 7;
ll modPow(ll x, ll n) {
if (n == 0)
return 1;
ll ret = modPow(x, n / 2);
ret = (ret * ret) % mod;
if (n & 1)
ret = (ret * x) % mod;
return ret;
}
ll modInv(ll a) { return modPo... | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int MAX_N = 1002020;
const int mod = 1e9 + 7;
ll modPow(ll x, ll n) {
if (n == 0)
return 1;
ll ret = modPow(x, n / 2);
(ret *= ret) %= mod;
if (n & 1)
(ret *= x) %= mod;
return ret;
}
ll modInv(ll a) { return modPow(a, mo... | [["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 11, 12, 16, 31, 23, 0, 16, 17, 48], ["+", 0, 1, 0, 11, 31, 23, 0, 42, 0, 108], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 0, 14, 8, ... | 1 | 355 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
ll fact[200005], inv[200005];
ll n, m, a, b;
ll pw(ll a, ll b) {
if (b == 0)
return 1;
ll temp = pw((a * a) % MOD, b >> 1);
if (b & 1)
return temp % MOD * a % MOD;
else
return temp % MOD;
}
ll C(ll k, ll... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
ll fact[200005], inv[200005];
ll n, m, a, b;
ll pw(ll a, ll b) {
if (b == 0)
return 1;
ll temp = pw((a * a) % MOD, b >> 1);
if (b & 1)
return temp % MOD * a % MOD;
else
return temp % MOD;
}
ll C(ll k, ll... | [["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]] | 1 | 339 |
#include <algorithm>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <string>
#include <vector>
class CombinationMod {
public:
CombinationMod(int nmax)
: nmax_(nmax), xfact_(nmax + 1), xfactinv_(nmax + 1) {
xfact_[0] = 1;
xfactinv_[0] = 1;
for (lo... | #include <algorithm>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <string>
#include <vector>
class CombinationMod {
public:
CombinationMod(int nmax)
: nmax_(nmax), xfact_(nmax + 1), xfactinv_(nmax + 1) {
xfact_[0] = 1;
xfactinv_[0] = 1;
for (lo... | [["+", 8, 123, 0, 14, 8, 9, 0, 57, 0, 121], ["+", 0, 14, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22],... | 1 | 465 |
#include <bits/stdc++.h>
using namespace std;
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD % i... | #include <bits/stdc++.h>
using namespace std;
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD % i... | [["-", 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, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 8, 9, 0, 7, 10, 43, 39, 86, 0, 96], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 109], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 2... | 1 | 334 |
#include <algorithm>
#include <cstdint>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
const uint64_t kP = 1000000007;
uint64_t mmul(uint64_t a, uint64_t b, uint64_t p) {
return ((a % p) * (b % p)) % p;
}
uint64_t mpow(uint64_t a, uint64_t e, uint64_t p) {
e %= p;
uint64_t ret = 1... | #include <algorithm>
#include <cstdint>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
const uint64_t kP = 1000000007;
uint64_t mmul(uint64_t a, uint64_t b, uint64_t p) {
return ((a % p) * (b % p)) % p;
}
uint64_t mpow(uint64_t a, uint64_t e, uint64_t p) {
uint64_t ret = 1;
uint64... | [["-", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 17, 132], ["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22], ["-", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 52, 8, 9, 0, 1, 0, ... | 1 | 348 |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
// namespace model{
const ll mod = 1e9 + 7;
ll ksm(ll a, ll b) {
int ans = 1ll;
a %= mod;
while (b) {
if (b & 1)
ans = ans * a % mod;
b >>= 1;
a = a * a % mod;
}
return ans;
}
const int maxn = 1e5 + 7;
ll fac[maxn + 10], inv... | #include <bits/stdc++.h>
#define ll long long
using namespace std;
// namespace model{
const ll mod = 1e9 + 7;
ll ksm(ll a, ll b) {
int ans = 1ll;
a %= mod;
while (b) {
if (b & 1)
ans = ans * a % mod;
b >>= 1;
a = a * a % mod;
}
return ans;
}
const int maxn = 5e5 + 7;
ll fac[maxn + 10], inv... | [["-", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["-", 0, 7, 8, 1, 0, 34, 31, 11, 17, 107], ["+", 8, 9, 0, 7, 8, 1, 0, 11, 17, 32], ["+", 8, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 31, 22], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 72], ["-", 8, 9, 0... | 1 | 363 |
#include <bits/stdc++.h>
//#include <ext/numeric>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define oo 0x3f3f3f3f
#define OO 0x3f3f3f3f3f3f3f3f
#define popcount(n) __builtin_popcount(n)
#define popcountll(n) __builtin_popc... | #include <bits/stdc++.h>
//#include <ext/numeric>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define oo 0x3f3f3f3f
#define OO 0x3f3f3f3f3f3f3f3f
#define popcount(n) __builtin_popcount(n)
#define popcountll(n) __builtin_popc... | [["-", 8, 9, 0, 171, 0, 1, 0, 2, 63, 22], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 0, 171, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 14, 8, 9, 0, 171, 0, 1, 0, 35]] | 1 | 545 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll MOD = 1000000007;
// xのn乗をmodで割った余り//
ll mod_pow(ll x, ll n, ll mod) {
ll res = 1;
while (n > 0) {
if (n & 1) {
res = res * x % mod;
}
x = x * x % mod;
n >>= 1;
}
return res;
}
int main() {
long long H, W, A, B;
c... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll MOD = 1000000007;
// xのn乗をmodで割った余り//
ll mod_pow(ll x, ll n, ll mod) {
ll res = 1;
while (n > 0) {
if (n & 1) {
res = res * x % mod;
}
x = x * x % mod;
n >>= 1;
}
return res;
}
int main() {
long long H, W, A, B;
c... | [["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["-", 0, 7, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 7, 8, 9, 0, 43, 0, 35], ["-", 0, 7, 8, 9, 0, 1, 0, ... | 1 | 318 |
#include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, s, n) for (ll i = s; i < n; i++)
#define repe(i, s, n) for (ll i = s; i <= n; i++)
#define rep_r(i, s, n) for (ll i = n - 1; i >= s; i--)... | #include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, s, n) for (ll i = s; i < n; i++)
#define repe(i, s, n) for (ll i = s; i <= n; i++)
#define rep_r(i, s, n) for (ll i = n - 1; i >= s; i--)... | [["-", 0, 14, 8, 9, 0, 1, 0, 11, 17, 107], ["-", 0, 11, 12, 16, 31, 16, 31, 2, 63, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["-", 3, 4, 0, 16, 31, 16, 31, 16, 31, 22], ["-", 3, 4, 0, 16, 31, 16, 31, 16, 17, 33], ["-", 3, 4, 0, 16, 31, 16, 31, 16, 12, 13], ["-", 31, 2, 3, 4, 0, 16, 31, 16, 17, 33], ["-", 31, 2, 3, ... | 1 | 403 |
H, W, A, B = map(int, input().split())
ans = 0
MOD = 10**9 + 7
N = H + W - 2
fac = [1] * N
inv = [1] * N
# 階乗
for i in range(1, N):
fac[i] = (fac[i - 1] * i) % MOD
# 普通の逆元テーブル
for i in range(1, N):
inv[i] = pow(i, MOD-2, MOD)
def f(x, y):
ans = fac[x + y] * inv[x] * inv[y] % MOD
return ans
f... | H, W, A, B = map(int, input().split())
ans = 0
MOD = 10**9 + 7
N = H + W - 2
fac = [1] * (N+1)
inv = [1] * (N+1)
# 階乗
for i in range(1, N+1):
fac[i] = i * fac[i - 1] % MOD
# 普通の逆元テーブル
for i in range(1, N+1):
inv[i] = pow(fac[i], MOD-2, MOD)
def f(x, y):
ans = fac[x + y] * inv[x] * inv[y] % MOD
... | [["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 24], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 17, 72], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 12, 612], ["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 25], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["-", 0, 1, 0, 662, 12, 657, 31, 23, 0, 24]... | 5 | 179 |
#include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdio.h>
#include <string.h>
#include <vector>
#define mp make_pair
using namespace std;
typedef long long ll;
inline ll in() {
ll res = 0, p = 1;
char c = getchar();
while (c < '0' || c > '9') {
... | #include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdio.h>
#include <string.h>
#include <vector>
#define mp make_pair
using namespace std;
typedef long long ll;
inline ll in() {
ll res = 0, p = 1;
char c = getchar();
while (c < '0' || c > '9') {
... | [["+", 0, 16, 31, 16, 31, 16, 31, 16, 17, 33], ["+", 0, 16, 31, 16, 31, 16, 31, 16, 12, 13], ["-", 12, 16, 31, 2, 3, 4, 0, 16, 12, 13], ["+", 12, 16, 31, 2, 3, 4, 0, 16, 12, 13], ["-", 12, 2, 3, 4, 0, 16, 31, 16, 17, 33], ["-", 12, 2, 3, 4, 0, 16, 31, 16, 12, 13], ["+", 12, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 12, 16... | 1 | 539 |
#include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdio.h>
#include <string.h>
#include <vector>
#define mp make_pair
using namespace std;
typedef long long ll;
inline ll in() {
ll res = 0, p = 1;
char c = getchar();
while (c < '0' || c > '9') {
... | #include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdio.h>
#include <string.h>
#include <vector>
#define mp make_pair
using namespace std;
typedef long long ll;
inline ll in() {
ll res = 0, p = 1;
char c = getchar();
while (c < '0' || c > '9') {
... | [["-", 0, 16, 31, 16, 31, 16, 31, 16, 31, 22], ["+", 0, 16, 31, 16, 31, 16, 31, 16, 31, 22], ["-", 0, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["+", 0, 16, 31, 16, 31, 16, 31, 16, 12, 13], ["-", 3, 4, 0, 16, 31, 16, 31, 16, 12, 22], ["+", 3, 4, 0, 16, 31, 16, 31, 16, 12, 22], ["-", 12, 2, 3, 4, 0, 16, 31, 16, 12, 22], ["+"... | 1 | 508 |
#include <iostream>
using namespace std;
#define int long long
#define MOD (long long)(1e9 + 7)
#define MAX_VAL (long long)(1e5 + 10)
long long fac[MAX_VAL], mmi[MAX_VAL], temp[MAX_VAL];
void factorial() {
fac[0] = fac[1] = 1;
for (long long i = 2; i < MAX_VAL; fac[i] %= MOD, i++)
fac[i] = fac[i - 1] * (i % M... | #include <iostream>
using namespace std;
#define int long long
#define MOD (long long)(1e9 + 7)
#define MAX_V (long long)(1e5 * 2 + 100)
long long MAX_VAL;
long long fac[MAX_V], mmi[MAX_V], temp[MAX_V];
void factorial() {
fac[0] = fac[1] = 1;
for (long long i = 2; i < MAX_VAL; fac[i] %= MOD, i++)
fac[i] = fac... | [["+", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 0, 30, 0, 43, 39, 86, 0, 96], ["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 0, 35], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 22], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 22], ["+",... | 1 | 356 |
#include <algorithm>
#include <climits>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define P pair<int, ... | #include <algorithm>
#include <climits>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define P pair<int, ... | [["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 0, 30, 0, 43, 0, 153, 0, 154], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 49, 22], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 0, 32], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 0, 35], ["-", 0, 30, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 0,... | 1 | 420 |
#include <cmath>
#include <complex.h>
#include <complex>
#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;
typedef long long ll;
int mod = 1000000007;
ll po(ll a, ll b) {
if (b == 0)
return 1;
ll z = po(a, b / 2);
z = z * z % mod;
if (b % 2 == 1)
z = z * a % mod;
return z;
... | #include <cmath>
#include <complex.h>
#include <complex>
#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;
typedef long long ll;
int mod = 1000000007;
ll po(ll a, ll b) {
if (b == 0)
return 1;
ll z = po(a, b / 2);
z = z * z % mod;
if (b % 2 == 1)
z = z * a % mod;
return z;
... | [["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 8, 9, 0, 1, 0, 11, 12, 16... | 1 | 297 |
MOD = 1_000_000_007
class Combination
def initialize
@fact = (1..10**5+1).to_a
@fact.each_with_index do |e, idx|
@fact[idx] = @fact[idx] * @fact[idx-1] % MOD if idx > 0
end
end
def choose(n, r)
return 0 if not (0 <= r and r <= n)
return 1 if r == 0 or r == n
fact(n) * inverse( fact... | MOD = 1_000_000_007
class Combination
def initialize
@fact = (1..10**5*2+1).to_a
@fact.each_with_index do |e, idx|
@fact[idx] = @fact[idx] * @fact[idx-1] % MOD if idx > 0
end
end
def choose(n, r)
return 0 if not (0 <= r and r <= n)
return 1 if r == 0 or r == n
fact(n) * inverse( fa... | [["+", 486, 739, 0, 475, 444, 738, 31, 738, 17, 48], ["+", 486, 739, 0, 475, 444, 738, 31, 738, 12, 612], ["+", 36, 36, 0, 493, 0, 662, 31, 761, 0, 22], ["+", 36, 36, 0, 493, 0, 662, 31, 761, 0, 21], ["+", 36, 36, 36, 36, 0, 493, 0, 662, 0, 32], ["+", 36, 36, 0, 493, 0, 662, 12, 762, 0, 612], ["+", 36, 36, 0, 493, 0, 6... | 4 | 291 |
#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int mpow(int a, int b) {
if (b == 0)
return 1;
if (b % 2)
return 1LL * a * mpow(a, b - 1) % mod;
else {
int d = mpow(a, b / 2);
return 1LL * d * d % mod;
}
}
int main() {
ios::sync_with_stdio(false);
int h, w, a, b... | #include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int mpow(int a, int b) {
if (b == 0)
return 1;
if (b % 2)
return 1LL * a * mpow(a, b - 1) % mod;
else {
int d = mpow(a, b / 2);
return 1LL * d * d % mod;
}
}
int main() {
ios::sync_with_stdio(false);
int h, w, a, b... | [["+", 31, 16, 12, 69, 341, 342, 0, 16, 31, 22], ["+", 31, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 31, 16, 12, 69, 341, 342, 0, 16, 12, 13], ["+", 31, 16, 31, 16, 12, 69, 341, 342, 0, 73], ["+", 12, 2, 3, 4, 0, 16, 31, 16, 17, 48], ["+", 3, 4, 0, 16, 31, 16, 12, 69, 28, 22], ["+", 0, 16, 31, 16, 12, 69, 341, 342, 0... | 1 | 288 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>
using namespace std;
typedef long long LL;
#define M(a, b) memset(a, b, sizeof(a))
#define pb push_back
const int maxn = 200000 + 5;
const... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>
using namespace std;
typedef long long LL;
#define M(a, b) memset(a, b, sizeof(a))
#define pb push_back
const int maxn = 200000 + 5;
const... | [["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 11, 12, 16, 31, 23, 0... | 1 | 340 |
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <cmath>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stac... | #define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <cmath>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stac... | [["+", 51, 16, 31, 23, 0, 16, 31, 23, 0, 24], ["+", 0, 16, 31, 23, 0, 16, 31, 23, 0, 24], ["+", 0, 16, 31, 23, 0, 16, 31, 23, 0, 25], ["+", 31, 23, 0, 16, 31, 23, 0, 16, 17, 109], ["+", 31, 23, 0, 16, 31, 23, 0, 16, 12, 22], ["+", 51, 16, 31, 23, 0, 16, 31, 23, 0, 25], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 107], ["+", 0, ... | 1 | 566 |
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, a) for (int i = 0; i < a; i++)
#define mp make_pair
#define pb push_back
#define ll __int... | #include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, a) for (int i = 0; i < a; i++)
#define mp make_pair
#define pb push_back
#define ll __int... | [["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 49, 22], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 0, 70], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 0, 73], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 35], ["+", 36... | 1 | 497 |
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#define ull unsigned long long
#define ul unsigned long
#define size_t unsigned long long
using namespace std;
ull modular_pow(ull base, ull exponent, int modulus) {
ull result = 1;
while (exponent > 0) {
if (expone... | #include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#define ull unsigned long long
#define ul unsigned long
#define ll long long
#define size_t unsigned long long
using namespace std;
ll modular_pow(ll base, ll exponent, int modulus) {
ll result = 1;
while (exponent > 0)... | [["+", 36, 36, 36, 36, 0, 30, 0, 58, 141, 22], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 0, 148], ["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 78], ["+", 36, 36, 36, 36, 0, 30, 0, 14, 39, 78], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["-... | 1 | 392 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
ll fact[(ll)1e6] = {1};
ll anabi(ll a, ll b) {
return b ? (b & 1 ? a : 1) * anabi(a * a % MOD, b / 2) % MOD : 1;
}
ll comb(ll n, ll k) {
return (!n ? 1 || n <= k
: fact[n] * anabi(fact[k] * fact[n - k] % MOD, MO... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
ll fact[(ll)1e6] = {1};
ll anabi(ll a, ll b) {
return b ? (b & 1 ? a : 1) * anabi(a * a % MOD, b / 2) % MOD : 1;
}
ll comb(ll n, ll k) {
return (!n || n <= k
? 1
: fact[n] * anabi(fact[k] * fact[n... | [["-", 8, 9, 0, 37, 0, 23, 0, 41, 0, 101], ["-", 0, 37, 0, 23, 0, 41, 64, 16, 31, 13], ["+", 8, 9, 0, 37, 0, 23, 0, 41, 0, 101], ["+", 8, 9, 0, 37, 0, 23, 0, 41, 64, 13], ["-", 8, 9, 0, 7, 8, 1, 0, 11, 17, 107], ["+", 8, 9, 0, 7, 8, 1, 0, 11, 17, 32], ["+", 8, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 11, 12, 16, 31, ... | 1 | 260 |
// darkstallion's template
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define fi first
#define se second
#define mp make_pair
#defin... | // darkstallion's template
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define fi first
#define se second
#define mp make_pair
#defin... | [["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 0, 73], ["-", 36, 36, 36, 36, 0, 30, 0, 43, 0, 21], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 49, 22], ["-", 36, 36, 0, 30, 0, 43, 49, 80, 0, 70], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 49, 50, 51, 16, 31, 16, 31, 69, 28, 22], ["+",... | 1 | 423 |
#include <algorithm>
#include <stdio.h>
#define MOD 1000000007
#define ll long long
#define maxf 200000
int f[maxf + 1], invf[maxf + 1];
inline int lgput(int a, int n) {
ll rez = 1;
while (n) {
if (n % 2 == 0)
rez = (1LL * rez * a) % MOD;
a = (1LL * a * a) % MOD, n /= 2;
}
return rez;
}
inline i... | #include <algorithm>
#include <stdio.h>
#define MOD 1000000007
#define ll long long
#define maxf 200000
int f[maxf + 1], invf[maxf + 1];
inline int lgput(int a, int n) {
int rez = 1;
while (n) {
if (n % 2 == 1)
rez = (1LL * rez * a) % MOD;
a = (1LL * a * a) % MOD, n /= 2;
}
return rez;
}
inline... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 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, 57, 75, 76, 0, 95], ["+", 31, 16, 31, 16, 31, 16, 31, 16, 17, 109], ["+", 31, 16, 31, 16, 31, 16, 31, 16, 12, 22], ["+", 0,... | 1 | 303 |
H, W, A, B = map(int,input().split())
MOD = 10**9 + 7
def prepare(n, MOD):
# 1! - n! の計算
f = 1
factorials = [1] # 0!の分
for m in range(1, n + 1):
f *= m
f %= MOD
factorials.append(f)
# n!^-1 の計算
inv = pow(f, MOD - 2, MOD)
# n!^-1 - 1!^-1 の計算
invs = [1] * (n + 1)
... | H, W, A, B = map(int,input().split())
MOD = 10**9 + 7
def prepare(n, MOD):
# 1! - n! の計算
f = 1
factorials = [1] # 0!の分
for m in range(1, n + 1):
f *= m
f %= MOD
factorials.append(f)
# n!^-1 の計算
inv = pow(f, MOD - 2, MOD)
# n!^-1 - 1!^-1 の計算
invs = [1] * (n + 1)
... | [["+", 0, 662, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 12, 612], ["-", 0, 1, 0, 677, 12, 657, 31, 23, 0, 24], ["-", 12, 657, 31, 23, 0, 657, 12, 23, 0, 25], ["-", 8, 196, 0, 1, 0, 677, 12, 657, 17, 109], ["-", 8, 196, 0, 1, 0, 677, 12, 657, 12, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 109... | 5 | 238 |
h,w,a,b = map(int, input().split())
mod = 10**9 + 7
n = 10**5 * 2 + 1
fact = [1]*(n+1)
rfact = [1]*(n+1)
r = 1
for i in range(1, n+1):
fact[i] = r = r * i % mod
rfact[n] = r = pow(fact[n], mod-2, mod)
for i in range(n, 0, -1):
rfact[i-1] = r = r * i % mod
# nPk (mod MOD) を求める
def perm(n, k):
return fact[n] * r... | h,w,a,b = map(int, input().split())
mod = 10**9 + 7
n = 10**5 * 2 + 1
fact = [1]*(n+1)
rfact = [1]*(n+1)
r = 1
for i in range(1, n+1):
fact[i] = r = r * i % mod
rfact[n] = r = pow(fact[n], mod-2, mod)
for i in range(n, 0, -1):
rfact[i-1] = r = r * i % mod
# nPk (mod MOD) を求める
def perm(n, k):
return fact[n] * r... | [["-", 0, 656, 0, 14, 8, 196, 0, 57, 0, 121], ["-", 8, 196, 0, 57, 15, 679, 31, 666, 0, 22], ["-", 8, 196, 0, 57, 15, 679, 31, 666, 667, 60], ["-", 8, 196, 0, 57, 15, 679, 31, 666, 0, 612], ["-", 0, 14, 8, 196, 0, 57, 15, 679, 17, 355], ["-", 8, 196, 0, 57, 15, 679, 12, 666, 0, 22], ["-", 8, 196, 0, 57, 15, 679, 12, 66... | 5 | 246 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return
// true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a
// > b) { a = b; return true; } return false; }
/* attention
long longのシフト演算には気をつけよう
... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return
// true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a
// > b) { a = b; return true; } return false; }
/* attention
long longのシフト演算には気をつけよう
... | [["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 39, 78], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 107], ["-", 8, 9, 0, 1, 0, 11, 12, 23, 0, 24], ["-", 0, 1, 0, 11, 12, 23, 0, 16, 31, 22], ["-", 0, 1, 0, 11, 12, 23, 0, 16, 17, 33], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 110], ["+", 8, 9, 0, 7, 8, 9, 0, 1, ... | 1 | 340 |
#include <bits/stdc++.h>
using namespace std;
// conversion
//------------------------------------------
inline int toInt(string s) {
int v;
istringstream sin(s);
sin >> v;
return v;
}
template <class T> inline string toString(T x) {
ostringstream sout;
sout << x;
return sout.str();
}
// math
//----------... | #include <bits/stdc++.h>
using namespace std;
// conversion
//------------------------------------------
inline int toInt(string s) {
int v;
istringstream sin(s);
sin >> v;
return v;
}
template <class T> inline string toString(T x) {
ostringstream sout;
sout << x;
return sout.str();
}
// math
//----------... | [["-", 0, 14, 8, 9, 0, 7, 10, 43, 39, 40], ["+", 8, 9, 0, 7, 10, 43, 39, 86, 0, 96], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 43, 49, 50, 51, 16, 31, 16, 31, 22], ["+", 0, 43, 49, 50, ... | 1 | 883 |
n=200000
def pf(x,y,p):
if y==0: return 1
if y%2==0:
d=pf(x,y//2,p)
return d*d%p
if y%2==1:
return (x*pf(x,y-1,p))%p
facl=[1]
for i in range(1,n+2):
facl.append(facl[i-1]*i%mod)
invl=[1]*(n+2)
for i in range(1,n+2):
invl[i]=pf(facl[i],mod-2,mod)
def comb(x,k):
if x<0 or k<0 or x<k: return 0
if... | n=200000
mod=10**9+7
def pf(x,y,p):
if y==0: return 1
if y%2==0:
d=pf(x,y//2,p)
return d*d%p
if y%2==1:
return (x*pf(x,y-1,p))%p
facl=[1]
for i in range(1,n+2):
facl.append(facl[i-1]*i%mod)
invl=[1]*(n+2)
for i in range(1,n+2):
invl[i]=pf(facl[i],mod-2,mod)
def comb(x,k):
if x<0 or k<0 or x<k: r... | [["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 0, 1, 0, 662, 12, 657, 31, 657, 31, 612], ["+", 0, 1, 0, 662, 12, 657, 31, 657, 17, 578], ["+", 0, 1, 0, 662, 12, 657, 31, 657, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12,... | 5 | 297 |
#include <iostream>
#include <vector>
using namespace std;
long long int binpow(long long int a, long long int p, long long int D) {
long long res = 1LL;
while (p > 0) {
if (p & 1)
res = res * a % D;
a = a * a % D;
p >>= 1;
}
return res;
}
// long long int fac(long long int a, long long int... | #include <iostream>
#include <vector>
using namespace std;
long long int binpow(long long int a, long long int p, long long int D) {
long long int res = 1LL;
while (p > 0) {
if (p & 1)
res = (res * a) % D;
a = (a * a) % D;
p >>= 1;
}
return res;
}
// long long int fac(long long int a, long ... | [["+", 0, 14, 8, 9, 0, 43, 39, 86, 39, 40], ["+", 64, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 64, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 14, 8, ... | 1 | 373 |
#include <bits/stdc++.h>
using namespace std;
long long maximum;
long long mod;
vector<long long> fct(0), invfct(0);
long long modpow(long long a, long long n, long long mod) {
long long res = 1;
while (n > 0) {
if (n & 1)
res = (res * a) % mod;
a = (a * a) % mod;
n >>= 1;
}
return res;
}
v... | #include <bits/stdc++.h>
using namespace std;
long long maximum;
long long mod;
vector<long long> fct(0), invfct(0);
long long modpow(long long a, long long n, long long mod) {
long long res = 1;
while (n > 0) {
if (n & 1)
res = (res * a) % mod;
a = (a * a) % mod;
n >>= 1;
}
return res;
}
v... | [["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 12, 23, 0, 24], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 12, 22], ["+", 0, 1, 0, 11, 12, 16, 12, 23, 0, 25], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 1... | 1 | 448 |
// https://atcoder.jp/contests/abc042/tasks/arc058_b
#include <bits/stdc++.h>
template <int N, typename T, T M> struct factorial_mod {
T mod[N + 1];
T inv_mod[N + 1];
constexpr factorial_mod() : mod(), inv_mod() {
mod[0] = 1;
for (int i = 0; i < N; ++i) {
mod[i + 1] = (mod[i] * (i + 1)) % M;
}... | // https://atcoder.jp/contests/abc042/tasks/arc058_b
#include <bits/stdc++.h>
const int MOD = 1e9 + 7;
template <int N, typename T, T M> struct factorial_mod {
T mod[N + 1];
T inv_mod[N + 1];
constexpr factorial_mod() : mod(), inv_mod() {
mod[0] = 1;
for (int i = 0; i < N; ++i) {
mod[i + 1] = (mod... | [["+", 36, 36, 0, 30, 0, 43, 0, 153, 0, 154], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 49, 22], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 0, 32], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 31, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 17, 72], ["+", 0, 30, 0, 43, 49, 50, 51, 16, 12, 13], ["+",... | 1 | 379 |
#include <bits/stdc++.h>
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
using namespace std;
const int MAX = 100001;
const int MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
rep(i, MAX) {
if (i... | #include <bits/stdc++.h>
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
const int MAX = 200001;
const int MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
rep(i, MAX) {
if (i == 0 || i ==... | [["-", 36, 36, 36, 36, 0, 30, 0, 112, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 112, 51, 59], ["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 14, 8, 9, 0, 14, 49, 53, 49, 22], ["+", 0, 3... | 1 | 300 |
h, w, a, b = map(int,input().split())
mod = 10**9 + 7
def inv(x, p):
pp = p-2
ans = 1
while pp > 0:
if pp % 2 == 1:
ans = (ans * x) % p
x = (x ** 2) % p
pp //= 2
return ans
I = [1] + [inv(i, mod) for i in range(1, h+w+1)]
a0 = 1
a1 = 1
for i in range(w-b+a-1, w-b-1... | h, w, a, b = map(int,input().split())
mod = 10**9 + 7
def inv(x, p):
pp = p-2
ans = 1
while pp > 0:
if pp % 2 == 1:
ans = (ans * x) % p
x = (x ** 2) % p
pp //= 2
return ans
I = [1] + [inv(i, mod) for i in range(1, h+w+1)]
a0 = 1
a1 = 1
for i in range(w-b+a-1, (w-b+... | [["+", 12, 652, 3, 4, 0, 657, 31, 23, 0, 24], ["+", 31, 23, 0, 657, 31, 657, 31, 657, 31, 22], ["+", 31, 23, 0, 657, 31, 657, 31, 657, 17, 33], ["+", 31, 23, 0, 657, 31, 657, 31, 657, 12, 22], ["+", 0, 657, 31, 23, 0, 657, 31, 657, 17, 72], ["+", 0, 657, 31, 23, 0, 657, 31, 657, 12, 22], ["+", 3, 4, 0, 657, 31, 23, 0, ... | 5 | 309 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.