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
change_count
int64
0
100
def sol(a1,b1,a2,b2,a3,b3): return (a3-a2)*b1-(b3-b2)*a1+a2*b3-a3*b2 while True: try: x1,y1,x2,y2,x3,y3,x4,y4=list(map(float,input().split())) if sol(x1,y1,x2,y2,x4,y4)*sol(x3,y3,x2,y2,x4,y4)<0 and sol(x4,y4,x1,y1,x3,y3)*sol(x2,y2,x1,y1,x3,y3)<0: print('YES') else: ...
def sol(a1,b1,a2,b2,a3,b3): return (a3-a2)*b1-(b3-b2)*a1+a2*b3-a3*b2 while True: try: x1,y1,x2,y2,x3,y3,x4,y4=list(map(float,input().split(','))) if sol(x1,y1,x2,y2,x4,y4)*sol(x3,y3,x2,y2,x4,y4)<0 and sol(x4,y4,x1,y1,x3,y3)*sol(x2,y2,x1,y1,x3,y3)<0: print('YES') else: ...
[["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 654], ["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 655]]
5
158
3
import sys for line in sys.stdin(): p = list(map(float, line.split(','))) v = [p[i] - p[(i + 2) % 8] for i in range(8)] ip = [v[j] * v[(j + 3) % 8] - v[j + 1] * v[(j + 2) % 8] > 0 for j in range(0,8,2)] if sum(ip) == 0 or sum(ip) == 4: print('YES') else: print('NO')
import sys for line in sys.stdin: try: p = list(map(float, line.split(','))) except: break v = [p[i] - p[(i + 2) % 8] for i in range(8)] ip = [v[j] * v[(j + 3) % 8] - v[j + 1] * v[(j + 2) % 8] > 0 for j in range(0,8,2)] if sum(ip) == 0 or sum(ip) == 4: print('YES') else: ...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 25], ["+", 0, 656, 0, 7, 8, 196, 0, 246, 0, 247], ["+", 0, 656, 0, 7, 8, 196, 0, 246, 0, 102], ["+", 0, 7, 8, 196, 0, 246, 0, 671, 0, 672], ["+", 0, 7, 8, 196, 0, 246, 0, 671, 0, 102], ["+", 0, 246, 0, 671, 0, 196, 0, 93, 0, 94]]
5
134
7
import java.util.*; public class Main { void doIt() { Scanner stdIn = new Scanner(System.in); while (stdIn.hasNext()) { int[] input = new int[8]; for (int r = 0; r < 8; r++) { input[r] = stdIn.nextInt(); } int count = 0; ArrayList<Integer> temp = new ArrayList<Integer>()...
import java.util.*; public class Main { void doIt() { Scanner stdIn = new Scanner(System.in); while (stdIn.hasNext()) { int[] input = new int[8]; for (int r = 0; r < 8; r++) { input[r] = stdIn.nextInt(); } int count = 0; ArrayList<Integer> temp = new ArrayList<Integer>()...
[["-", 0, 520, 0, 57, 15, 15, 0, 16, 17, 47], ["+", 0, 520, 0, 57, 15, 15, 0, 16, 17, 18], ["-", 0, 57, 75, 57, 15, 15, 0, 16, 17, 18], ["+", 0, 57, 75, 57, 15, 15, 0, 16, 17, 47]]
3
356
4
import java.util.*; public class Main { private static final Scanner scan = new Scanner(System.in); static String A = "1100000011"; static String B = "10000000100000001"; static String C = "1111"; static String D = "1000000110000001"; static String E = "11000000011"; static String F = "100000001100000001...
import java.util.*; public class Main { private static final Scanner scan = new Scanner(System.in); static String A = "1100000011"; static String B = "10000000100000001"; static String C = "1111"; static String D = "1000000110000001"; static String E = "11000000011"; static String F = "100000001100000001...
[["-", 8, 196, 0, 57, 64, 196, 0, 37, 0, 38], ["-", 0, 57, 64, 196, 0, 37, 0, 91, 17, 33], ["-", 0, 57, 64, 196, 0, 37, 0, 91, 439, 499], ["+", 8, 196, 0, 57, 64, 196, 0, 116, 0, 117]]
3
330
4
import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class Main { private static Map<Integer, String> map = new HashMap<Integer, String>(); static { map.put(77, "A"); map.put(16843009, "B"); map.put(15, "C"); map.put(33153, "D"); map.put(1539, "E"); map.put(13184...
import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class Main { private static Map<Integer, String> map = new HashMap<Integer, String>(); static { map.put(771, "A"); map.put(16843009, "B"); map.put(15, "C"); map.put(33153, "D"); map.put(1539, "E"); map.put(1318...
[["-", 0, 196, 0, 1, 0, 492, 3, 4, 0, 499], ["+", 0, 196, 0, 1, 0, 492, 3, 4, 0, 499], ["-", 0, 57, 64, 196, 0, 1, 0, 11, 17, 176], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 17, 521]]
3
221
4
import java.util.Scanner; public class Main { public static void main(String aeg[]) { Scanner in = new Scanner(System.in); while (in.hasNext()) { char b[][] = new char[8][8]; for (int i = 0; i < 8; i++) b[i] = in.next().toCharArray(); for (int i = 0; i < 8; i++) { for (int j ...
import java.util.Scanner; public class Main { public static void main(String aeg[]) { Scanner in = new Scanner(System.in); while (in.hasNext()) { char b[][] = new char[8][8]; for (int i = 0; i < 8; i++) b[i] = in.next().toCharArray(); for (int i = 0; i < 8; i++) { for (int j ...
[["+", 0, 16, 31, 16, 31, 16, 12, 16, 31, 22], ["+", 0, 16, 31, 16, 31, 16, 12, 16, 17, 18], ["+", 0, 16, 31, 16, 31, 16, 12, 16, 12, 499], ["+", 64, 57, 15, 15, 0, 16, 31, 16, 17, 98]]
3
615
4
import java.awt.geom.*; import java.io.*; import java.util.*; public class Main { int[][] data; int[][][] p = { {{0, 1, 0, 1}, {0, 0, 1, 1}}, {{0, 0, 0, 0}, {0, 1, 2, 3}}, {{0, 1, 2, 3}, {0, 0, 0, 0} }, {{0, 0, -1, -1}, {0, 1, 1, 2} }, {{0, 1, 1, 2}, {0, 0, 1, 1} ...
import java.awt.geom.*; import java.io.*; import java.util.*; public class Main { int[][] data; int[][][] p = { {{0, 1, 0, 1}, {0, 0, 1, 1}}, {{0, 0, 0, 0}, {0, 1, 2, 3}}, {{0, 1, 2, 3}, {0, 0, 0, 0} }, {{0, 0, -1, -1}, {0, 1, 1, 2} }, {{0, 1, 1, 2}, {0, 0, 1, 1} ...
[["-", 8, 196, 0, 57, 75, 196, 0, 116, 0, 117], ["+", 8, 196, 0, 57, 75, 196, 0, 37, 0, 38], ["+", 8, 196, 0, 57, 75, 196, 0, 37, 0, 147]]
3
553
3
import java.util.*; public class Main { private static int board[][] = new int[8][8]; public static void main(String[] args) { // input Scanner sc = new Scanner(System.in); char[] c; char ret; int call_cnt = 0; while (sc.hasNext()) { call_cnt++; for (int i = 0; i < 8; i++) {...
import java.util.*; public class Main { private static int board[][] = new int[8][8]; public static void main(String[] args) { // input Scanner sc = new Scanner(System.in); char[] c; char ret; int call_cnt = 0; while (sc.hasNext()) { call_cnt++; for (int i = 0; i < 8; i++) {...
[["-", 15, 15, 0, 16, 12, 16, 31, 16, 31, 22], ["+", 15, 15, 0, 16, 12, 16, 31, 16, 31, 22]]
3
931
2
#include <stdio.h> #include <string.h> int main() { char d[8][10]; char s; int x, y, p, i, j; while (1) { p = 0; for (i = 0; i < 8; i++) { if (scanf("%s", d[i]) == EOF) break; for (j = 0; j < 8; j++) { if (p == 0 && d[i][j] == '1') { p = 1; x = j; ...
#include <stdio.h> #include <string.h> int main() { char d[8][10]; char s; int x, y, p, i, j; while (1) { p = 0; for (i = 0; i < 8; i++) { if (scanf("%s", d[i]) == EOF) break; for (j = 0; j < 8; j++) { if (p == 0 && d[i][j] == '1') { p = 1; x = j; ...
[["-", 15, 23, 0, 16, 12, 16, 31, 16, 12, 13], ["+", 15, 23, 0, 16, 12, 16, 31, 16, 12, 13]]
0
360
2
#include <stdio.h> #include <string.h> int main(void) { char b[65]; char p[7][33] = { "1100000011", "10000000100000001000000010000001", "1111", "1000000110000001", "11000000011", "100000001100000001", "110000011", }; char *bi; int i, t = 0; while (1) { if (scanf("%s", b...
#include <stdio.h> #include <string.h> int main(void) { char b[65]; char p[7][33] = { "1100000011", "1000000010000000100000001", "1111", "1000000110000001", "11000000011", "100000001100000001", "110000011", }; char *bi; int i, t = 0; while (1) { if (scanf("%s", b) == EO...
[["-", 0, 43, 49, 50, 51, 83, 0, 5, 0, 6], ["+", 0, 43, 49, 50, 51, 83, 0, 5, 0, 6]]
0
188
2
#include <stdio.h> int main(void) { char a[8][8]; int i, j; while (scanf("%s", a[0]) != EOF) { for (i = 1; i < 8; i++) { scanf("%s", a[i]); } for (i = 0; i < 8; i++) { for (j = 0; j < 8; j++) { if (a[i][j] == '1') break; } if (a[i][j] == '1') break; ...
#include <stdio.h> int main(void) { char a[9][9]; int i, j; while (scanf("%s", a[0]) != EOF) { for (i = 1; i < 8; i++) { scanf("%s", a[i]); } // for(i=0;i<8;i++){ // for(j=0;j<8;j++){ // printf("%c",a[i][j]); // if(j==7)puts(""); // } //} for (i = 0...
[["-", 8, 9, 0, 43, 49, 80, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 80, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]]
0
558
4
#include <math.h> #include <stdio.h> int main() { char men[10][10], t; int i, j; for (i = 0; i < 10; i++) { for (j = 0; j < 10; j++) { men[i][j] = 0; } } while (0 <= scanf("%*c%s%*c", men[0])) { for (i = 1; i < 8; i++) { scanf("%*c%s%*c", men[i]); } t = '0'; for (i = 0;...
#include <math.h> #include <stdio.h> int main() { char men[10][10], t; int i, j; for (i = 0; i < 10; i++) { for (j = 0; j < 10; j++) { men[i][j] = 0; } } while (0 <= scanf("%s%*c", men[0])) { for (i = 1; i < 8; i++) { scanf("%s%*c", men[i]); } t = '0'; for (i = 0; i < 8...
[["-", 0, 16, 12, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 16, 12, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
408
4
#include <stdio.h> #include <string.h> int main() { int i, type, j, x; char str[9]; while (scanf("%s", str) != EOF) { type = 0; for (i = 0; i < 8; i++) { if (str[i] == '1') { x = i; if (i + 1 < 8 && str[i + 1] == '1') { if (i + 3 < 8 && str[i + 3] == '1') { pri...
#include <stdio.h> #include <string.h> int main() { int i, type, j, x; char str[9]; while (scanf("%s", str) != EOF) { type = 0; for (i = 0; i < 8; i++) { if (str[i] == '1') { x = i; if (i + 1 < 8 && str[i + 1] == '1') { if (i + 3 < 8 && str[i + 3] == '1') { pri...
[["-", 0, 57, 15, 23, 0, 16, 12, 16, 17, 33], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 17, 72]]
0
426
2
#include <stdio.h> #define WIDTH 8 #define HEIGHT 8 char field[WIDTH + 3][HEIGHT + 2] = {}; int main(void) { char type; int x, y; for (; ungetc(getchar(), stdin) != EOF; printf("%c\n", type)) { for (y = 0; y < HEIGHT; y++) for (x = 1; x <= WIDTH; x++) scanf("%c ", field[x] + y); for (y ...
#include <stdio.h> #define WIDTH 8 #define HEIGHT 8 char field[WIDTH + 3][HEIGHT + 2] = {}; int main(void) { char type; int x, y; for (; ungetc(getchar(), stdin) != EOF; printf("%c\n", type)) { for (y = 0; y < HEIGHT; y++) for (x = 1; x <= WIDTH; x++) scanf("%c ", field[x] + y); for (y ...
[["-", 8, 7, 8, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 7, 8, 57, 64, 9, 0, 126, 0, 127], ["+", 8, 7, 8, 57, 64, 9, 0, 126, 128, 129]]
0
307
3
#include <stdio.h> int main(void) { int i, j; char board[8][8]; while (scanf(" %s\n", board[0]) != EOF) { for (i = 1; i < 8; i++) scanf(" %s", board[i]); for (i = 0;; i++) { for (j = 0; j < 8; j++) { if (board[i][j] == '1') break; } if (board[i][j] == '1') ...
#include <stdio.h> int main(void) { int i, j; char board[9][9]; while (scanf(" %s\n", board[0]) != EOF) { for (i = 1; i < 8; i++) scanf(" %s", board[i]); for (i = 0;; i++) { for (j = 0; j < 8; j++) { if (board[i][j] == '1') break; } if (board[i][j] == '1') ...
[["-", 8, 9, 0, 43, 49, 80, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 80, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]]
0
561
4
import java.util.Arrays; import java.util.Scanner; public class Main { private int num; private int[] a; final String[] rom = {"I", "V", "X", "L", "C", "D", "M"}; final int[] nrom = {1, 5, 10, 50, 100, 500, 1000}; public static void main(String[] args) { new Main().run(); } private void run() { Scann...
import java.util.Arrays; import java.util.Scanner; public class Main { private int num; private int[] a; final String[] rom = {"I", "V", "X", "L", "C", "D", "M"}; final int[] nrom = {1, 5, 10, 50, 100, 500, 1000}; public static void main(String[] args) { new Main().run(); } private void run() { Scann...
[["-", 0, 52, 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, 25], ["-", 8, 196, 0, 52, 8, 196, 0, 1, 0, 35]]
3
404
4
#include <stdio.h> #include <string.h> int main(void) { char s[200]; int i, j, n, S[200], sum; while (scanf("%s", s) != EOF) { sum = 0; for (i = 0; i < strlen(s); i++) { if (s[i] == 'I') S[i] = 1; if (s[i] == 'V') S[i] = 5; if (s[i] == 'X') S[i] = 10; if (s[...
#include <stdio.h> #include <string.h> int main(void) { char s[200]; int i, j, n, S[200], sum; while (scanf("%s", s) != EOF) { sum = 0; for (i = 0; i < strlen(s); i++) { if (s[i] == 'I') S[i] = 1; if (s[i] == 'V') S[i] = 5; if (s[i] == 'X') S[i] = 10; if (s[...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13]]
0
274
2
#include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> using namespace std; main() { map<char, int> kioku; kioku['I'] = 1; kioku['V'] = 5; kioku['X'] = 10; kioku['L'] = 50; kioku['C'] = 100; kioku['D'] = 500; kioku['M'] = 1000; char tmp[1000]; char c; int num = 0;...
#include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> using namespace std; main() { map<char, int> kioku; kioku['I'] = 1; kioku['V'] = 5; kioku['X'] = 10; kioku['L'] = 50; kioku['C'] = 100; kioku['D'] = 500; kioku['M'] = 1000; char tmp[1000]; char c; int num = 0;...
[["+", 0, 52, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 52, 8, 9, 0, 1, 0, 16, 12, 22]]
1
231
2
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; int main(void) { ios::sync_with_stdio(false); string s; map<char, int> conv; conv['I'] = 1; conv['V'] = 5; conv['X'] = 10; conv['L'] = 50; conv['C'] = 10...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <string> #include <vector> using namespace std; int main(void) { ios::sync_with_stdio(false); string s; map<char, int> conv; conv['I'] = 1; conv['V'] = 5; conv['X'] = 10; conv['L'] = 50; conv['C'] = 10...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 17, 107], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 17, 110], ["-", 0, 57, 75, 76, 0, 1, 0, 11, 17, 110], ["+", 0, 57, 75, 76, 0, 1, 0, 11, 17, 107]]
1
207
4
#include <iostream> #include <string> using namespace std; string S; char T[8] = "IVXLCDM"; int X[7] = {1, 5, 10, 50, 100, 500, 1000}, l[10000]; int main() { while (cin >> S) { int cnt = 0; for (int i = 0; i < S.size(); i++) { for (int j = 0; j < 7; j++) { if (S[i] == T[j]) { l[i] = j;...
#include <iostream> #include <string> using namespace std; string S; char T[8] = "IVXLCDM"; int X[7] = {1, 5, 10, 50, 100, 500, 1000}, l[10000]; int main() { while (cin >> S) { int cnt = 0; for (int i = 0; i < S.size(); i++) { for (int j = 0; j < 7; j++) { if (S[i] == T[j]) { l[i] = j;...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 48], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
185
4
#include <iostream> #include <math.h> #include <stdio.h> // I は1, V は5, X は10, L は50, C は100, D は500, M は1000, #define I 1 #define V 5 #define X 10 #define L 50 #define C 100 #define D 500 #define M 1000 using namespace std; int main() { string str; while (cin >> str) { cin >> str; int data[200]; i...
#include <iostream> #include <math.h> #include <stdio.h> // I は1, V は5, X は10, L は50, C は100, D は500, M は1000, #define I 1 #define V 5 #define X 10 #define L 50 #define C 100 #define D 500 #define M 1000 using namespace std; int main() { string str; while (cin >> str) { int data[200]; int sum = 0; ...
[["-", 0, 52, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 52, 8, 9, 0, 1, 0, 16, 17, 152], ["-", 0, 52, 8, 9, 0, 1, 0, 16, 12, 22], ["-", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
291
4
// 0039 // include------------------------------------- #include <algorithm> #include <cmath> #include <iostream> #include <map> #include <stack> #include <string> #include <vector> using namespace std; // typedef-------------------------------------- typedef vector<int> VI; typedef vector<string> VS; typedef pair<in...
// 0039 // include------------------------------------- #include <algorithm> #include <cmath> #include <iostream> #include <map> #include <stack> #include <string> #include <vector> using namespace std; // typedef-------------------------------------- typedef vector<int> VI; typedef vector<string> VS; typedef pair<in...
[["-", 8, 9, 0, 9, 0, 1, 0, 2, 63, 22], ["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 52, 8, 9, 0, 9, 0, 1, 0, 35]]
1
317
5
char = {} char["I"] = 1 char["V"] = 5 char["X"] = 10 char["L"] = 50 char["C"] = 100 char["D"] = 500 char["M"] = 500 while input = gets chars = input.chomp.split("") n = chars.size n.times{|i| chars[i] = char[chars[i]] } (n-1).downto(1){|i| if chars[i] > chars[i-1] chars[i] -= chars[i-1] ch...
char = {} char["I"] = 1 char["V"] = 5 char["X"] = 10 char["L"] = 50 char["C"] = 100 char["D"] = 500 char["M"] = 1000 while input = gets chars = input.chomp.split("") n = chars.size n.times{|i| chars[i] = char[chars[i]] } (n-1).downto(1){|i| if chars[i] > chars[i-1] chars[i] -= chars[i-1] c...
[["-", 36, 36, 36, 36, 0, 493, 0, 662, 12, 612], ["+", 36, 36, 36, 36, 0, 493, 0, 662, 12, 612]]
4
155
2
import sys def dec_num(x): for i in range(len(x)): if x[i] == 2: x[i] = 5 elif x[i] == 3: x[i] = 10 elif x[i] == 4: x[i] = 50 elif x[i] == 5: x[i] = 100 elif x[i] == 6: x[i] = 500 elif x[i] == 7: ...
import sys def dec_num(x): for i in range(len(x)): if x[i] == 2: x[i] = 5 elif x[i] == 3: x[i] = 10 elif x[i] == 4: x[i] = 50 elif x[i] == 5: x[i] = 100 elif x[i] == 6: x[i] = 500 elif x[i] == 7: ...
[["-", 0, 57, 75, 665, 15, 679, 31, 666, 667, 19], ["+", 0, 57, 75, 665, 15, 679, 31, 666, 667, 18], ["+", 75, 665, 15, 679, 31, 666, 0, 657, 17, 33], ["+", 75, 665, 15, 679, 31, 666, 0, 657, 12, 612]]
5
304
4
#define _CRT_SECURE_NO_WARNINGS #include "bits/stdc++.h" using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #define FOR(i, m, n) for (int i = (m); i < (n); ++i) #define sz(x) ((int)(x).size()) #define all(x) (x).begin(), (x).end() #define mp make_pair #define pb push_back #define Cout(x) cout << (x) <...
#define _CRT_SECURE_NO_WARNINGS #include "bits/stdc++.h" using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #define FOR(i, m, n) for (int i = (m); i < (n); ++i) #define sz(x) ((int)(x).size()) #define all(x) (x).begin(), (x).end() #define mp make_pair #define pb push_back #define Cout(x) cout << (x) <...
[["-", 15, 16, 31, 69, 28, 69, 341, 342, 0, 22], ["-", 15, 16, 31, 69, 28, 69, 341, 342, 0, 73], ["-", 12, 41, 15, 16, 31, 69, 341, 342, 0, 70], ["+", 15, 16, 31, 69, 28, 69, 341, 342, 0, 73], ["+", 12, 41, 15, 16, 31, 69, 341, 342, 0, 70], ["+", 12, 41, 15, 16, 31, 69, 341, 342, 0, 22]]
1
436
6
#include <algorithm> #include <stdio.h> using namespace std; int pow(int a, int n) { if (n <= 0) { return 1; } return a * pow(a, n - 1); } int main() { char a[8][9]; int ans = 0; while (1) { for (int i = 0; i < 8; i++) { if (scanf("%s", &a[i]) == EOF) { return 0; } } f...
#include <algorithm> #include <stdio.h> using namespace std; int pow(int a, int n) { if (n <= 0) { return 1; } return a * pow(a, n - 1); } int main() { char a[8][9]; int ans = 0; while (1) { for (int i = 0; i < 8; i++) { if (scanf("%s", &a[i]) == EOF) { return 0; } } f...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
634
8
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <functional> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> typedef long long Int; #define REP(i, n) for (int i = 0; i < n; ++i) #define REPS(a, i...
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <functional> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> typedef long long Int; #define REP(i, n) for (int i = 0; i < n; ++i) #define REPS(a, i...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
554
2
#include <iostream> using namespace std; #define rep(i, a) for (int i = 0; i < a; i++) int main(void) { char maze[9][9]; while (true) { rep(i, 8) rep(j, 8) cin >> maze[i][j]; if (cin.eof()) break; bool used = false; rep(y, 8) { rep(x, 8) { if (maze[y][x] == '1') { if (m...
#include <iostream> using namespace std; #define rep(i, a) for (int i = 0; i < a; i++) int main(void) { char maze[9][9]; while (true) { rep(i, 8) rep(j, 8) cin >> maze[i][j]; if (cin.eof()) break; bool used = false; rep(y, 8) { rep(x, 8) { if (maze[y][x] == '1') { if (...
[["-", 31, 16, 31, 69, 341, 342, 0, 16, 12, 13], ["+", 31, 16, 31, 69, 341, 342, 0, 16, 12, 13], ["-", 12, 16, 31, 69, 341, 342, 0, 16, 12, 13], ["+", 12, 16, 31, 69, 341, 342, 0, 16, 12, 13], ["-", 31, 16, 12, 16, 31, 69, 341, 342, 0, 13], ["+", 12, 16, 31, 69, 341, 342, 0, 16, 31, 22], ["+", 12, 16, 31, 69, 341, 342,...
1
463
8
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<pair<int, int>> vii; #define rrep(i, m, n) for (int(i) = (m); (i) < (n); (i)++) #define erep(i, m, n) for (int(i) = (m); (i) <= (n); (i)++) #define rep(i, n) for (int(i) = 0; (i) <...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<pair<int, int>> vii; #define rrep(i, m, n) for (int(i) = (m); (i) < (n); (i)++) #define erep(i, m, n) for (int(i) = (m); (i) <= (n); (i)++) #define rep(i, n) for (int(i) = 0; (i) <...
[["-", 31, 16, 31, 2, 3, 4, 0, 16, 12, 13], ["+", 31, 16, 31, 2, 3, 4, 0, 16, 12, 13], ["-", 31, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 17, 72], ["-", 31, 16, 12, 2, 3, 4, 0, 16, 17, 72], ["-", 31, 16, 12, 2, 3, 4, 0, 16, 12, 13], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 31, 16, 12, ...
1
763
8
#include <cstdio> #include <iostream> using namespace std; int main() { char f[9][9]; while (1) { bool flag = false; for (int i = 0; i < 8; ++i) { for (int j = 0; j < 8; ++j) { if (scanf(" %c", &f[i][j]) == EOF) { flag = true; break; } } if (flag) ...
#include <cstdio> #include <iostream> using namespace std; int main() { char f[9][9]; while (1) { bool flag = false; for (int i = 0; i < 8; ++i) { for (int j = 0; j < 8; ++j) { if (scanf(" %c", &f[i][j]) == EOF) { flag = true; break; } } if (flag) ...
[["-", 31, 16, 31, 16, 31, 16, 31, 16, 12, 13], ["+", 31, 16, 31, 16, 31, 16, 31, 16, 12, 13], ["-", 31, 16, 31, 16, 31, 16, 12, 16, 12, 13], ["+", 31, 16, 31, 16, 31, 16, 12, 16, 12, 13]]
1
622
4
#include <iostream> #include <string> using namespace std; int main() { while (true) { int i = 0; string map[8]; while (cin >> map[i], !cin.eof()) { i++; if (i == 8) { break; } } if (cin.eof()) { break; } for (int i = 0; i < 8; i++) { for (int j = 0; ...
#include <iostream> #include <string> using namespace std; int main() { while (true) { int i = 0; string map[8]; while (cin >> map[i], !cin.eof()) { i++; if (i == 8) { break; } } if (cin.eof()) { break; } for (int i = 0; i < 8; i++) { for (int j = 0; ...
[["-", 12, 16, 31, 69, 341, 342, 0, 16, 31, 22], ["+", 12, 16, 31, 69, 341, 342, 0, 16, 31, 22]]
1
665
2
#include <bits/stdc++.h> using namespace std; double eps = 1e-10; int main() { string s[16]; while (cin >> s[0]) { for (int i = 1; i < 8; ++i) { cin >> s[i]; } int h, w; for (int i = 0; i < 8; ++i) { for (int j = 0; j < 8; ++j) { if (s[i][j] == '1') { h = i; ...
#include <bits/stdc++.h> using namespace std; double eps = 1e-10; int main() { string s[16]; while (cin >> s[0]) { for (int i = 1; i < 8; ++i) { cin >> s[i]; } int h, w; for (int i = 0; i < 8; ++i) { for (int j = 0; j < 8; ++j) { if (s[i][j] == '1') { h = i; ...
[["-", 31, 16, 12, 16, 31, 69, 341, 342, 0, 22], ["+", 31, 16, 12, 16, 31, 69, 341, 342, 0, 22]]
1
527
2
#include <cstdio> using namespace std; int main() { char ch[8][8]; bool judged; while ((scanf("%s", ch[0])) != EOF) { for (int i = 1; i < 8; i++) { scanf("%s", ch[i]); } judged = false; for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { if (ch[i][j] == '1') { ...
#include <cstdio> using namespace std; int main() { char ch[10][10]; bool judged; while ((scanf("%s", ch[0])) != EOF) { for (int i = 1; i < 8; i++) { scanf("%s", ch[i]); } judged = false; for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { if (ch[i][j] == '1') { ...
[["-", 8, 9, 0, 43, 49, 80, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 80, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 31, 16, 31, 16, 31, 16, 31, 16, 12, 13], ["+", 31, 16, 31, 16, 31, 16, 31, 16, 12, 13], ["-", 31, 16, 31, 16, 12, 16, 31, 16, 12, 13], ["+"...
1
654
8
#include <iostream> #include <string> using namespace std; bool check(int (&field)[8][8], int x, int y) { if (x < 0 || x >= 8 || y < 0 || y >= 8 || (field[y][x] == 0)) { return false; } return true; } int main() { int inptf[8][8] = {0}, i, j, x, y; string str; char btype; while (true) { i = 0; ...
#include <iostream> #include <string> using namespace std; bool check(int (&field)[8][8], int x, int y) { if (x < 0 || x >= 8 || y < 0 || y >= 8 || (field[y][x] == 0)) { return false; } return true; } int main() { int inptf[8][8] = {0}, i, j, x, y; string str; char btype; while (true) { i = 0; ...
[["-", 0, 57, 64, 1, 0, 11, 12, 103, 0, 125], ["+", 0, 57, 64, 1, 0, 11, 12, 103, 0, 125]]
1
618
2
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <set> #include <stack> #include <string> #include <vector> using namespace std; int main() { char p[8][9]; int i, j; while (cin >> p[0] >> p[1] >> p[2] >> p[3] >> p[4] >> p[5] >> p[6] >> p[7]) { for (i = 0; i < 8; ++i) { ...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <set> #include <stack> #include <string> #include <vector> using namespace std; int main() { char p[8][9]; int i, j; while (cin >> p[0] >> p[1] >> p[2] >> p[3] >> p[4] >> p[5] >> p[6] >> p[7]) { for (i = 0; i < 8; ++i) { ...
[["-", 12, 16, 31, 69, 341, 342, 0, 16, 17, 72], ["-", 12, 16, 31, 69, 341, 342, 0, 16, 12, 13]]
1
526
2
#include <bits/stdc++.h> using namespace std; int main() { char str[20][20]; while (1) { for (int i = 4; i < 12; i++) { for (int j = 4; j < 12; j++) { cin >> str[i][j]; if (cin.eof()) return 0; } } char ans; for (int i = 0; i < 8; i++) { for (int j = 0; j...
#include <bits/stdc++.h> using namespace std; int main() { char str[20][20]; while (1) { for (int i = 4; i < 12; i++) { for (int j = 4; j < 12; j++) { cin >> str[i][j]; if (cin.eof()) return 0; } } char ans; for (int i = 4; i < 12; i++) { for (int j = 4; ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13]]
1
580
8
#include <iostream> #include <string> using namespace std; string table[8]; bool range(int y, int x) { if (y < 0 || x < 0 || y >= 8 || x >= 8) return false; return true; } bool A(int y, int x) { int dx[] = {0, 1, 1, 0}; int dy[] = {0, 0, 1, 1}; for (int i = 0; i < 4; i++) { int ny = y + dy[i]; in...
#include <iostream> #include <string> using namespace std; string table[8]; bool range(int y, int x) { if (y < 0 || x < 0 || y >= 8 || x >= 8) return false; return true; } bool A(int y, int x) { int dx[] = {0, 1, 1, 0}; int dy[] = {0, 0, 1, 1}; for (int i = 0; i < 4; i++) { int ny = y + dy[i]; in...
[["-", 8, 9, 0, 43, 49, 50, 51, 83, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 13]]
1
1,034
4
#include <cstdio> #include <iostream> using namespace std; bool map[8][8]; char Solve(int x, int y) { if (x != 7 && map[y][x + 1] == 1 && y != 7 && map[y + 1][x] == 1 && map[y + 1][x + 1] == 1) return 'A'; else if (y <= 4 && map[y + 1][x] == 1 && map[y + 2][x] == 1 && map[y + 3][x] == 1) ...
#include <cstdio> #include <iostream> using namespace std; bool map[8][8]; char Solve(int x, int y) { if (x != 7 && map[y][x + 1] == 1 && y != 7 && map[y + 1][x] == 1 && map[y + 1][x + 1] == 1) return 'A'; else if (y <= 4 && map[y + 1][x] == 1 && map[y + 2][x] == 1 && map[y + 3][x] == 1) ...
[["-", 31, 69, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 31, 69, 28, 69, 341, 342, 0, 16, 17, 72]]
1
533
12
#include <iostream> #include <string> using namespace std; string s[10]; int main() { while (1) { int t = 0; int r = 0; bool flag = false; for (int i = 0; i < 9; i++) { if (!(cin >> s[i])) return 0; } for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { if ...
#include <iostream> #include <string> using namespace std; string s[10]; int main() { while (1) { int t = 0; int r = 0; bool flag = false; for (int i = 0; i < 8; i++) { if (!(cin >> s[i])) return 0; } for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { if ...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
259
8
#include <iostream> #include <string> int main(int argc, char *argv[]) { std::string ans[7] = {"1100000011", "1000000010000000100000001", "1111", "1000000110000001", "11000000011", "100000001100000001", "110000011"}; std::string alpha[...
#include <iostream> #include <string> int main(int argc, char *argv[]) { std::string ans[7] = {"1100000011", "1000000010000000100000001", "1111", "1000000110000001", "11000000011", "100000001100000001", "110000011"}; std::string alpha[...
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 8, 9, 0, 1, 0, 11, 12, 5, 0, 62], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
228
5
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <numeric> #include <stack> #include <string> #include <vector> using namespace std; #define REP(i, n) for (int(i) = 0; (i) < (n); (i)++) #define For(i, a, b) for (int(i) = (a); (i) < (b); (i)++) #define PUSH(n, v) ...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <map> #include <numeric> #include <stack> #include <string> #include <vector> using namespace std; #define REP(i, n) for (int(i) = 0; (i) < (n); (i)++) #define For(i, a, b) for (int(i) = (a); (i) < (b); (i)++) #define PUSH(n, v) ...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13]]
1
913
4
#define _USE_MATH_DEFINES #include "bits/stdc++.h" using namespace std; //#define int long long #define DBG 1 #define dump(o) \ if (DBG) { \ cerr << #o << " " << o << endl; ...
#define _USE_MATH_DEFINES #include "bits/stdc++.h" using namespace std; //#define int long long #define DBG 1 #define dump(o) \ if (DBG) { \ cerr << #o << " " << o << endl; ...
[["-", 31, 16, 31, 16, 31, 16, 31, 16, 31, 22], ["+", 31, 16, 31, 16, 31, 16, 31, 16, 31, 22], ["-", 31, 16, 31, 16, 12, 16, 31, 16, 31, 22], ["+", 31, 16, 31, 16, 12, 16, 31, 16, 31, 22], ["-", 31, 69, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 31, 69, 28, 69, 341, 342, 0, 16, 17, 72]]
1
655
8
#include <bits/stdc++.h> using namespace std; #define FOR(i, j, k) for (int i = j; i < k; ++i) #define rep(i, j) FOR(i, 0, j) #define repr(i, j) for (int i = j; i >= 0; --i) #define INF (1 << 30) #define MOD 1e9 + 7 char s[10][10]; int main() { while (cin >> s[0]) { FOR(i, 1, 8) cin >> s[i]; rep(i, 8) rep...
#include <bits/stdc++.h> using namespace std; #define FOR(i, j, k) for (int i = j; i < k; ++i) #define rep(i, j) FOR(i, 0, j) #define repr(i, j) for (int i = j; i >= 0; --i) #define INF (1 << 30) #define MOD 1e9 + 7 char s[10][10]; int main() { while (cin >> s[0]) { FOR(i, 1, 8) cin >> s[i]; rep(i, 8) rep...
[["-", 31, 69, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 31, 69, 28, 69, 341, 342, 0, 16, 17, 72]]
1
425
2
#include <iostream> #include <string> #include <utility> #include <vector> using namespace std; int main(void) { string s[8]; while (cin >> s[0]) { std::vector<pair<int, int>> v; for (int i = 1; i < 8; i++) cin >> s[i]; for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { if ...
#include <iostream> #include <string> #include <utility> #include <vector> using namespace std; int main(void) { string s[8]; while (cin >> s[0]) { std::vector<pair<int, int>> v; for (int i = 1; i < 8; i++) cin >> s[i]; for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { if ...
[["-", 0, 16, 31, 118, 28, 69, 341, 342, 0, 13], ["+", 0, 16, 31, 118, 28, 69, 341, 342, 0, 13]]
1
366
2
#include <bits/stdc++.h> using namespace std; #define REP(i, s, n) for (int i = s; i < n; ++i) #define rep(i, n) REP(i, 0, n) #define SORT(c) sort((c).begin(), (c).end()) #define IINF INT_MAX #define LLINF LLONG_MAX #define DEBUG false int main() { while (true) { string a[8]; vector<int> tracex; vector<...
#include <bits/stdc++.h> using namespace std; #define REP(i, s, n) for (int i = s; i < n; ++i) #define rep(i, n) REP(i, 0, n) #define SORT(c) sort((c).begin(), (c).end()) #define IINF INT_MAX #define LLINF LLONG_MAX #define DEBUG false int main() { while (true) { string a[8]; vector<int> tracex; vector<...
[["-", 51, 16, 31, 16, 31, 69, 341, 342, 0, 13], ["+", 51, 16, 31, 16, 31, 69, 341, 342, 0, 13]]
1
341
2
#include <array> #include <iostream> using namespace std; char checkData(array<int, 4> data_i, array<int, 4> data_j) { int i = 0, j = 0; if (data_i[i] + 1 == data_i[i + 1] && data_j[j] == data_j[j + 1] && data_i[i] == data_i[i + 2] && data_j[j] + 1 == data_j[i + 2] && data_i[i] + 1 == data_i[j + 3] &&...
#include <array> #include <iostream> using namespace std; char checkData(array<int, 4> data_i, array<int, 4> data_j) { int i = 0, j = 0; if (data_i[i] + 1 == data_i[i + 1] && data_j[j] == data_j[j + 1] && data_i[i] == data_i[i + 2] && data_j[j] + 1 == data_j[i + 2] && data_i[i] + 1 == data_i[j + 3] &&...
[["-", 15, 339, 51, 16, 12, 16, 31, 16, 12, 13], ["+", 15, 339, 51, 16, 12, 16, 31, 16, 12, 13]]
1
756
2
#include <stdio.h> int main(void) { char s[8][10]; int i, j, k, l; int dx[7][3] = {{1, 1, 0}, {0, 0, 0}, {1, 2, 3}, {0, -1, -1}, {1, 1, 2}, {0, 1, 1}, {1, -1, 0}}, dy[7][3] = {{0, 1, 1}, {1, 2, 3}, {0, 0, 0}, {1, 1, 2}, {0, 1, 1}, {1, 1, 2}, {0, 1, 1}}; while (scanf("%...
#include <stdio.h> int main(void) { char s[8][10]; int i, j, k, l; int dx[7][3] = {{1, 1, 0}, {0, 0, 0}, {1, 2, 3}, {0, -1, -1}, {1, 1, 2}, {0, 1, 1}, {1, -1, 0}}, dy[7][3] = {{0, 1, 1}, {1, 2, 3}, {0, 0, 0}, {1, 1, 2}, {0, 1, 1}, {1, 1, 2}, {0, 1, 1}}; while (scanf("%...
[["-", 31, 16, 31, 16, 31, 16, 12, 16, 17, 47], ["+", 31, 16, 31, 16, 31, 16, 12, 16, 17, 20], ["-", 15, 339, 51, 16, 31, 16, 12, 16, 17, 47], ["+", 15, 339, 51, 16, 31, 16, 12, 16, 17, 20]]
1
404
4
#include <algorithm> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <map> #include <sstream> #include <string> #include <vector> using namespace std; #define reep(i, f, n) for (int i = f; i < int(n); ++i) #define rep(i, n) reep(i, 0, n) typedef vector<int> vi; in...
#include <algorithm> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <map> #include <sstream> #include <string> #include <vector> using namespace std; #define reep(i, f, n) for (int i = f; i < int(n); ++i) #define rep(i, n) reep(i, 0, n) typedef vector<int> vi; in...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22]]
1
296
2
#include <algorithm> #include <cctype> #include <cstdio> #include <iostream> #include <math.h> using namespace std; int main() { int d[64]; char c[64]; while (1) { int k = 0; for (int i = 0; i < 64; i++) { c[i] = 0; d[i] = 0; } for (int i = 0; i < 64; i++) { cin >> c[i]; ...
#include <algorithm> #include <cctype> #include <cstdio> #include <iostream> #include <math.h> using namespace std; int main() { int d[64]; char c[64]; while (1) { int k = 0; for (int i = 0; i < 64; i++) { c[i] = 0; d[i] = 0; } for (int i = 0; i < 64; i++) { cin >> c[i]; ...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
279
2
#include <cstdio> #include <iostream> using namespace std; int dx[7][3] = {1, 1, 0, 0, 0, 0, 1, 2, 3, 0, -1, -1, 1, 1, 2, 0, 1, 1, 1, 0, -1}; int dy[7][3] = {0, -1, -1, -1, -2, -3, 0, 0, 0, -1, -1, -2, 0, -1, -1, -1, -1, -2, 0, -1, -1}; char field[10][10]; int main() { while (...
#include <cstdio> #include <iostream> using namespace std; int dx[7][3] = {1, 1, 0, 0, 0, 0, 1, 2, 3, 0, -1, -1, 1, 1, 2, 0, 1, 1, 1, 0, -1}; int dy[7][3] = {0, -1, -1, -1, -2, -3, 0, 0, 0, -1, -1, -2, 0, -1, -1, -1, -1, -2, 0, -1, -1}; char field[10][10]; int main() { while (...
[["+", 0, 1, 0, 2, 3, 4, 0, 103, 0, 104]]
1
417
2
#include <cstdio> #define REP(i, a, b) for (int i = (a); i < (b); ++i) #define rep(i, n) REP(i, 0, n) char m[16][16], buf[16]; int main() { while (true) { bool done = false; rep(i, 8) if (scanf("%s", m[i]) == EOF) done = true; if (done) break; char res = 0; rep(i, 8) rep(j, 8) { if (m...
#include <cstdio> #define REP(i, a, b) for (int i = (a); i < (b); ++i) #define rep(i, n) REP(i, 0, n) char m[16][16], buf[16]; int main() { while (true) { bool done = false; rep(i, 8) if (scanf("%s", m[i]) == EOF) done = true; if (done) break; char res = 0; rep(i, 8) rep(j, 8) { if (m...
[["+", 31, 69, 28, 69, 341, 342, 0, 16, 17, 72], ["+", 31, 69, 28, 69, 341, 342, 0, 16, 12, 13], ["-", 12, 16, 31, 69, 341, 342, 0, 16, 17, 72], ["-", 12, 16, 31, 69, 341, 342, 0, 16, 12, 13], ["-", 31, 69, 28, 69, 341, 342, 0, 16, 17, 33]]
1
583
6
#include <cstdio> #include <iostream> using namespace std; char w[8][8]; int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0}, s[8][8], q[4]; //ツ湘」ツ、ツ可コツ、ツ右ツ、ツ債カ void func(int y, int x) { s[y][x] = 0; for (int i = 0; i < 4; i++) if (y + dy[i] >= 0 && y + dy[i] < 8 && x + dx[i] >= 0 && x + dx[i] < 8) if (s[y + d...
#include <cstdio> #include <iostream> using namespace std; char w[8][8]; int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0}, s[8][8], q[4]; //ツ湘」ツ、ツ可コツ、ツ右ツ、ツ債カ void func(int y, int x) { s[y][x] = 0; for (int i = 0; i < 4; i++) if (y + dy[i] >= 0 && y + dy[i] < 8 && x + dx[i] >= 0 && x + dx[i] < 8) if (s[y + d...
[["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 13], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 13]]
1
523
2
#include <iostream> #include <string> #include <vector> using namespace std; bool one(const vector<string> &v, int x, int y) { if (x < 0 || y < 0 || x >= v[0].size() || y >= v.size()) return false; return v[y][x] == '1'; } int main() { vector<string> v(8); while (cin >> v[0]) { for (int i = 1; i < 8;...
#include <iostream> #include <string> #include <vector> using namespace std; bool one(const vector<string> &v, int x, int y) { if (x < 0 || y < 0 || x >= v[0].size() || y >= v.size()) return false; return v[y][x] == '1'; } int main() { vector<string> v(8); while (cin >> v[0]) { for (int i = 1; i < 8;...
[["-", 51, 16, 12, 2, 3, 4, 0, 16, 12, 13], ["+", 51, 16, 12, 2, 3, 4, 0, 16, 12, 13]]
1
492
2
#include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; int main() {...
#include <algorithm> #include <bitset> #include <cfloat> #include <climits> #include <cmath> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; int main() {...
[["-", 8, 9, 0, 43, 49, 50, 51, 83, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 13]]
1
291
2
#include <stdio.h> #include <string.h> int main(void) { char b[65]; char p[7][33] = { "1100000011", "10000000100000001000000010000000", "1111", "1000000110000001", "11000000011", "100000001100000001", "110000011", }; char *bi; int t = 0; while (true) { if (scanf("%s", b...
#include <stdio.h> #include <string.h> int main(void) { char b[65]; char p[7][33] = { "1100000011", "1000000010000000100000001", "1111", "1000000110000001", "11000000011", "100000001100000001", "110000011", }; char *bi; int t = 0; while (true) { if (scanf("%s", b) == EO...
[["-", 0, 43, 49, 50, 51, 83, 0, 5, 0, 6], ["+", 0, 43, 49, 50, 51, 83, 0, 5, 0, 6]]
1
188
2
#define _USE_MATH_DEFINES #include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <limits> #include <map> #include <queue> #include <sstream> #include <stack> #include <string> typedef long long ll; using namespace std; bool in(int i, int j) { if (i >= 0 && i < 8 && j >= 0 && j < 8) ...
#define _USE_MATH_DEFINES #include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <limits> #include <map> #include <queue> #include <sstream> #include <stack> #include <string> typedef long long ll; using namespace std; bool in(int i, int j) { if (i >= 0 && i < 8 && j >= 0 && j < 8) ...
[["-", 31, 16, 12, 2, 3, 4, 0, 16, 17, 72], ["-", 31, 16, 12, 2, 3, 4, 0, 16, 12, 13]]
1
1,134
4
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; char judge(vector<string> surface) { for...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; char judge(vector<string> surface) { for...
[["-", 31, 69, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 31, 69, 28, 69, 341, 342, 0, 16, 17, 72], ["-", 31, 69, 28, 69, 341, 342, 0, 16, 17, 72], ["-", 31, 69, 28, 69, 341, 342, 0, 16, 12, 13]]
1
637
8
#include <iostream> #include <vector> using namespace std; string match(const vector<string> v) { const string PTN[7][4]{ {"11", "11"}, {"1", "1", "1", "1"}, {"1111"}, {"01", "11", "10"}, {"110", "011"}, {"10", "11", "01"}, {"011", "110"}}; const int PTN_H[7]{2, 4, 1, 3, 2, 3, 2}; const strin...
#include <iostream> #include <vector> using namespace std; string match(const vector<string> v) { const string PTN[7][4]{ {"11", "11"}, {"1", "1", "1", "1"}, {"1111"}, {"01", "11", "10"}, {"110", "011"}, {"10", "11", "01"}, {"011", "110"}}; const int PTN_H[7]{2, 4, 1, 3, 2, 3, 2}; const strin...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 19]]
1
427
2
#include <iostream> #include <string> using namespace std; int main(void) { string s, shape[7]; string tmp; shape[0] = "1100000011"; shape[1] = "1000000010000000100000001"; shape[2] = "1111"; shape[3] = "1000000110000001"; shape[4] = "11000000011"; shape[5] = "100000001100000001"; shape[6] = "110000...
#include <iostream> #include <string> using namespace std; int main(void) { string s, shape[7]; string tmp; shape[0] = "1100000011"; shape[1] = "1000000010000000100000001"; shape[2] = "1111"; shape[3] = "1000000110000001"; shape[4] = "11000000011"; shape[5] = "100000001100000001"; shape[6] = "110000...
[["-", 0, 52, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 52, 8, 9, 0, 1, 0, 16, 17, 152], ["-", 0, 52, 8, 9, 0, 1, 0, 16, 12, 22], ["-", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
174
4
#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <memory> #include <string> #include <algorithm> #include <complex> #include <list> #include <map> #inclu...
#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <memory> #include <string> #include <algorithm> #include <complex> #include <list> #include <map> #inclu...
[["+", 0, 43, 49, 50, 49, 80, 49, 80, 81, 13], ["-", 64, 9, 0, 42, 0, 2, 3, 4, 0, 13], ["+", 64, 9, 0, 42, 0, 2, 3, 4, 0, 13]]
1
721
3
#include <iostream> using namespace std; int main() { while (true) { char board[8][8]; for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { cin >> board[i][j]; } } bool flag = false; for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { if (board[i]...
#include <iostream> using namespace std; int main() { while (true) { char board[8][8]; for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { cin >> board[i][j]; } } bool flag = false; for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { if (board[i]...
[["+", 0, 52, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 52, 8, 9, 0, 1, 0, 16, 12, 22]]
1
344
2
#include <iostream> using namespace std; int main() { char mas[8][8]; while (1) { for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { cin >> mas[i][j]; } } if (cin.eof()) break; for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { if (mas[i][j]...
#include <iostream> using namespace std; int main() { char mas[8][8]; while (1) { for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { cin >> mas[i][j]; } } if (cin.eof()) break; for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { if (mas[i][j]...
[["-", 31, 69, 28, 69, 341, 342, 0, 16, 17, 33], ["+", 31, 69, 28, 69, 341, 342, 0, 16, 17, 72]]
1
513
2
#include <iostream> #include <string> using namespace std; string s[8]; int check(int i, int j) { if (i + 1 < 8 && j + 1 < 8) { if (s[i][j + 1] == '1' && s[i + 1][j + 1] == '1' && s[i + 1][j] == '1') { return 1; } } if (i + 3 < 8) { if (s[i + 1][j] == '1' && s[i + 2][j] == '1' && s[i + 3][j]...
#include <iostream> #include <string> using namespace std; string s[8]; int check(int i, int j) { if (i + 1 < 8 && j + 1 < 8) { if (s[i][j + 1] == '1' && s[i + 1][j + 1] == '1' && s[i + 1][j] == '1') { return 1; } } if (i + 3 < 8) { if (s[i + 1][j] == '1' && s[i + 2][j] == '1' && s[i + 3][j]...
[["-", 15, 339, 51, 16, 31, 16, 31, 16, 12, 22], ["+", 15, 339, 51, 16, 31, 16, 31, 16, 12, 13]]
1
621
2
#include <algorithm> #include <cstdlib> #include <fstream> #include <iostream> #include <iterator> #include <map> #include <queue> #include <stack> #include <string> #include <vector> typedef long long int lli; using namespace std; int dx[7][4] = {{0, 0, 1, 1}, {0, 0, 0, 0}, {0, 1, 2, 3}, {0, 0, -1, -1}, ...
#include <algorithm> #include <cstdlib> #include <fstream> #include <iostream> #include <iterator> #include <map> #include <queue> #include <stack> #include <string> #include <vector> typedef long long int lli; using namespace std; int dx[7][4] = {{0, 0, 1, 1}, {0, 0, 0, 0}, {0, 1, 2, 3}, {0, 0, -1, -1}, ...
[["-", 8, 9, 0, 57, 15, 339, 51, 91, 17, 111]]
1
445
1
#include <iostream> using namespace std; int main() { int num[8]; int pattan[7][4] = { {11000000, 11000000, 0, 0}, {10000000, 10000000, 10000000, 10000000}, {11110000, 0, 0, 0}, {1000000, 11000000, 10000000, 0}, {11000000, 1100000, 0, 0}, {10000000, 11000000, 1000000, 0}, {1100000, ...
#include <iostream> using namespace std; int main() { int num[8]; int pattan[7][4] = { {11000000, 11000000, 0, 0}, {10000000, 10000000, 10000000, 10000000}, {11110000, 0, 0, 0}, {1000000, 11000000, 10000000, 0}, {11000000, 1100000, 0, 0}, {10000000, 11000000, 1000000, 0}, {1100000, ...
[["+", 0, 7, 8, 57, 15, 339, 51, 16, 17, 98], ["+", 15, 339, 51, 16, 12, 16, 31, 16, 31, 22], ["+", 15, 339, 51, 16, 12, 16, 31, 16, 17, 72], ["+", 15, 339, 51, 16, 12, 16, 31, 16, 12, 22], ["+", 8, 57, 15, 339, 51, 16, 12, 16, 17, 18], ["+", 8, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
271
6
while gets l = $_.chomp t = 8 t = 7 if l != "" t.times do l << gets.chomp end puts "A" if l.include?("1100000011") puts "B" if l.include?("1000000100000010000001000000") puts "C" if l.include?("1111") puts "D" if l.include?("1000000110000001") puts "E" if l.include?("11000000011") puts "F" if ...
while gets l = $_.chomp t = 8 t = 7 if l != "" t.times do l << gets.chomp end puts "A" if l.include?("1100000011") puts "B" if l.include?("1000000010000000100000001") puts "C" if l.include?("1111") puts "D" if l.include?("1000000110000001") puts "E" if l.include?("11000000011") puts "F" if l.i...
[["-", 0, 751, 15, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 751, 15, 652, 3, 4, 0, 557, 0, 6]]
4
120
2
#encoding=utf-8 import sys def inp(): fe, fe1 = [], [] for line in sys.stdin: fe += line.split() i,j = 0,8 while True: fe1 = fe[i:j] if a(fe1): if b(fe1): if c(fe1): if d(fe1): if e(fe1): ...
#encoding=utf-8 import sys def inp(): fe, fe1 = [], [] for line in sys.stdin: fe += line.split() i,j = 0,8 while True: fe1 = fe[i:j] if a(fe1): if b(fe1): if c(fe1): if d(fe1): if e(fe1): ...
[["+", 0, 656, 0, 14, 8, 196, 0, 37, 0, 38]]
5
732
1
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Scanner; public class Main { static int[][] mapA = new int[5][4]; static int[][] mapB = new int[4][5]; static int x, y, d; static boolean flag; static ArrayList<Character> list = new ArrayList<Char...
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Scanner; public class Main { static int[][] mapA = new int[5][4]; static int[][] mapB = new int[4][5]; static int x, y, d; static boolean flag; static ArrayList<Character> list = new ArrayList<Char...
[["-", 64, 196, 0, 514, 8, 1, 0, 492, 141, 22], ["+", 64, 196, 0, 514, 8, 1, 0, 492, 141, 22]]
3
1,341
2
require("fs") .readFileSync("/dev/stdin", "utf8") .split('\n') .slice(-1) .map(function(i) { for (t = 26; t--;) for (s = 26; s--;) r = i.replace(/[\w]/g, function(j) { return String.fromCharCode((j.charCodeAt(0) * t + s) % 26 + 97) }), r.match(/th(is|at)/) ?...
require("fs").readFileSync("/dev/stdin", "utf8").split('\n').map(function(i) { for (t = 26; t--;) for (s = 26; s--;) r = i.replace(/[\w]/g, function(j) { return String.fromCharCode((j.charCodeAt(0) * t + s) % 26 + 97) }), r.match(/th(is|at)/) ? console.log(r) : 0 })
[["-", 0, 2, 63, 558, 500, 2, 63, 558, 559, 560], ["-", 0, 2, 63, 558, 500, 2, 3, 3, 0, 24], ["-", 63, 558, 500, 2, 3, 3, 0, 91, 17, 33], ["-", 63, 558, 500, 2, 3, 3, 0, 91, 28, 555], ["-", 0, 2, 63, 558, 500, 2, 3, 3, 0, 25], ["-", 0, 493, 0, 1, 0, 2, 63, 558, 0, 131]]
2
118
6
#!ruby -p $.>1&&(1..97).find{|i|(1..26).find{|j|/th[ai]/=~$s=$_.bytes.map{|c|(c<97?c:97+(c%26*i+j)%26).chr}*""}} $_=$s
#!ruby -p $.>1&&(1..26).find{|i|(1..26).find{|j|/th(at|is)/=~$s=$_.bytes.map{|c|(c<97?c:97+(c%26*i+j)%26).chr}*""}} $_=$s
[["-", 0, 738, 12, 652, 486, 739, 0, 475, 444, 612], ["+", 0, 738, 12, 652, 486, 739, 0, 475, 444, 612], ["-", 196, 196, 8, 734, 0, 738, 31, 575, 0, 6], ["+", 196, 196, 8, 734, 0, 738, 31, 575, 0, 6]]
4
74
12
for _ in[0]*int(input()): e=input() for i in range(26,2): for j in range(26): a=''.join([c,chr(((ord(c)-97)*i+j)%26+97)][c.islower()]for c in e) if('that'or'this')in a:print(a);break
for _ in[0]*int(input()): e=input() for i in range(26): for j in range(26): a=''.join([c,chr(((ord(c)-97)*i+j)%26+97)][c.islower()]for c in e) if'that'in a or'this'in a:print(a);break
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 21], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 8, 196, 0, 57, 15, 666, 0, 23, 0, 24], ["+", 8, 196, 0, 57, 15, 679, 31, 666, 667, 267], ["+", 8, 196, 0, 57, 15, 679, 31, 666, 0, 22], ["-", 8, 196, 0, 57, 15, 666, 0, 23, 0, 25]]
5
100
6
for i in range(int(input())): s = input() for a in range(1, 1000): for b in range(26): def f(s, a, b): return ''.join([chr(((ord(c) - ord('a')) * a + b) % 26 + ord('a')) for c in s]) if f('that', a, b) in s or f('this', a, b) in s: dic = dict([(chr...
for i in range(int(input())): s = input() for a in range(1, 1000): for b in range(26): def f(s, a, b): return ''.join([chr(((ord(c) - ord('a')) * a + b) % 26 + ord('a')) for c in s]) if f('that', a, b) in s or f('this', a, b) in s: dic = dict([(chr...
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24]]
5
196
4
#include <stdio.h> #include <stdlib.h> #include <string.h> #define BUF_UNIT_SIZE 10000 #define MAX_LINE_LENGTH 1000 typedef struct { int x, y; } vector_t; void complex_mul(const vector_t *v1, const vector_t *v2, vector_t *t) { t->x = v1->x * v2->x - v1->y * v2->y; t->y = v1->x * v2->y + v1->y * v2->x; } char ...
#include <stdio.h> #include <stdlib.h> #include <string.h> #define BUF_UNIT_SIZE 10000 #define MAX_LINE_LENGTH 1000 typedef struct { int x, y; } vector_t; void complex_mul(const vector_t *v1, const vector_t *v2, vector_t *t) { t->x = v1->x * v2->x - v1->y * v2->y; t->y = v1->x * v2->y + v1->y * v2->x; } char ...
[["-", 0, 43, 49, 50, 51, 83, 0, 83, 0, 13], ["+", 0, 43, 49, 50, 51, 83, 0, 83, 0, 13]]
0
724
4
#include <bits/stdc++.h> using namespace std; const int dx[] = {-1, 0, 1, 0}; const int dy[] = {0, -1, 0, 1}; const char ch[] = {"ULDR"}; bool g[10][10][10][10]; int main() { char c; for (int i = 1; i <= 5; i++) { for (int j = 1; j <= 4; j++) { scanf(" %c", &c); if (c == '0') continue; ...
#include <bits/stdc++.h> using namespace std; const int dx[] = {-1, 0, 1, 0}; const int dy[] = {0, -1, 0, 1}; const char ch[] = {"ULDR"}; bool g[10][10][10][10]; int main() { char c; for (int i = 1; i <= 5; i++) { for (int j = 1; j <= 4; j++) { scanf(" %c", &c); if (c == '0') continue; ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 20], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 0, 52, 8, 9, 0, 7, 26, 27, 17, 29], ["+", 0, 52, 8, 9, 0, 7...
1
376
8
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <ctype.h> #include <fstream> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #includ...
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <ctype.h> #include <fstream> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #includ...
[["+", 49, 50, 51, 16, 31, 23, 0, 16, 17, 72], ["+", 49, 50, 51, 16, 31, 23, 0, 16, 12, 13]]
1
455
2
d=2 map=*$< o=?R x,y=1,0 (u,v=1,1 (d+=1 u=x+[0,0,-1,0][d%4] v=y+[0,1,0,-1][d%4] )until u>=0&&v>=0&&v<9&&map[v][u]==?1 e=d%4 x+=[1,0,-1,0][e] y+=[0,2,0,-2][e] o+="RDLU"[e] d+=2 )while [x,y]!=[0,0] puts o
d=2 map=*$< o=?R x,y=1,0 (u,v=9,9 (d+=1 u=x+[0,0,-1,0][d%4] v=y+[0,1,0,-1][d%4] )until u>=0&&v>=0&&v<9&&map[v][u]==?1 e=d%4 x+=[1,0,-1,0][e] y+=[0,2,0,-2][e] o+="RDLU"[e] d+=2 )while [x,y]!=[0,0] puts o
[["-", 0, 740, 8, 739, 0, 662, 12, 762, 0, 612], ["+", 0, 740, 8, 739, 0, 662, 12, 762, 0, 612]]
4
151
4
g=[[0]*5 for _ in[0]*5] for i in range(9): e=input() for j in range(4+i%2): if int(e[j]): if i%2:g[i//2][j]+=4;g[i//2+1][j]+=1 else:r=g[i//2];r[j]+=2;r[j+1]+=8 y,x=0,1 k=1 a=[1] while 1: k+=2 for _ in[0]*4: k+=1 if g[y][x]&int(2**(k%4)):a+=[k%4];break if k%2:x+=1-2*((k%4)>0) else:y+=2*((k%4)>0)-1 if ...
g=[[0]*5 for _ in[0]*5] for i in range(9): e=input() for j in range(4+i%2): if int(e[j]): if i%2:g[i//2][j]+=4;g[i//2+1][j]+=1 else:r=g[i//2];r[j]+=2;r[j+1]+=8 y,x=0,1 k=1 a=[1] while 1: k+=2 for _ in[0]*4: k+=1 if g[y][x]&int(2**(k%4)):a+=[k%4];break if k%2:x+=1-2*((k%4)>1) else:y+=2*((k%4)>0)-1 if ...
[["-", 12, 657, 12, 657, 12, 23, 0, 666, 0, 612], ["+", 12, 657, 12, 657, 12, 23, 0, 666, 0, 612], ["-", 0, 52, 8, 196, 0, 57, 15, 666, 667, 60], ["-", 0, 52, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 52, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 0, 52, 8, 196, 0, 57, 15, 666, 0, 612]]
5
233
6
import sys grid=[line.strip() for line in sys.stdin.readlines()] xgrid=["0"+grid[i]+"0" for i in range(9) if i%2==0] ygrid=[grid[i] for i in range(9) if i%2==1] ygrid.insert(5,"0"*5) ygrid.insert(0,"0"*5) graph=[[None]*5 for i in range(5)] #0->north 1->east... for y in range(5): for x in range(5): graph[y][...
import sys grid=[line.strip() for line in sys.stdin.readlines()] xgrid=["0"+grid[i]+"0" for i in range(9) if i%2==0] ygrid=[grid[i] for i in range(9) if i%2==1] ygrid.insert(5,"0"*5) ygrid.insert(0,"0"*5) graph=[[None]*5 for i in range(5)] for y in range(5): for x in range(5): graph[y][x]=[ygrid[y][x],xgrid...
[["-", 0, 206, 206, 657, 31, 23, 0, 657, 12, 612], ["+", 0, 206, 206, 657, 31, 23, 0, 657, 12, 612], ["-", 0, 662, 12, 657, 31, 23, 0, 657, 12, 612], ["+", 0, 662, 12, 657, 31, 23, 0, 657, 12, 612], ["-", 0, 662, 12, 657, 31, 23, 0, 657, 17, 33], ["+", 0, 662, 12, 657, 31, 23, 0, 657, 17, 72]]
5
331
6
import sys class Grid: def __init__(self, lines): lines = list(map((lambda line: list(line)), lines)) l = [] for i in range(len(lines)): if i % 2 == 0: l.append(intersperse2(lines[i], '+')) else: l.append(intersperse(lines[i], 'x')) ...
import sys class Grid: def __init__(self, lines): lines = list(map((lambda line: list(line)), lines)) l = [] for i in range(len(lines)): if i % 2 == 0: l.append(intersperse2(lines[i], '+')) else: l.append(intersperse(lines[i], 'x')) ...
[["-", 0, 656, 0, 682, 8, 196, 0, 14, 141, 22], ["+", 0, 656, 0, 682, 8, 196, 0, 14, 141, 22], ["-", 75, 665, 64, 196, 0, 1, 0, 677, 17, 110], ["+", 75, 665, 64, 196, 0, 1, 0, 677, 17, 107], ["-", 75, 76, 8, 196, 0, 1, 0, 677, 17, 107], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 17, 110]]
5
1,236
6
wx=[] wy=[] def readdata(): it=0 x=[] y=[] while True: try: tmp = list(map(int,input())) except: return x,y if it%2==0: x.append(tmp) else: y.append(tmp) it +=1 def nextpath(p, dir0): # 0:north, 1:east, 2:south, 3:west tmp...
wx=[] wy=[] def readdata(): it=0 x=[] y=[] while True: try: tmp = list(map(int,input())) except: return x,y if it%2==0: x.append(tmp) else: y.append(tmp) it +=1 def nextpath(p, dir0): tmp = ispath(p, (dir0+3)%4) if tmp...
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
489
2
import java.util.*; public class Main { public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); while (stdIn.hasNext()) { String str = stdIn.nextLine(); int[] number = new int[5]; int[] count = new int[14]; int j = 0; for (int i = 0; i < str.length(); ...
import java.util.*; public class Main { public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); while (stdIn.hasNext()) { String str = stdIn.nextLine(); int[] number = new int[5]; int[] count = new int[14]; int j = 0; for (int i = 0; i < str.length(); ...
[["-", 8, 196, 0, 7, 8, 196, 0, 57, 0, 95], ["-", 0, 57, 75, 57, 15, 15, 0, 16, 12, 499], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 12, 499], ["-", 0, 16, 12, 23, 0, 16, 12, 16, 17, 79], ["-", 0, 16, 12, 23, 0, 16, 12, 16, 12, 499], ["+", 0, 16, 12, 23, 0, 16, 12, 16, 17, 60], ["+", 0, 16, 12, 23, 0, 16, 12, 16, 12, 499]]
3
491
7
/** * * No.0038 Poker Hand * * * @author yuichirw <y.iky917@gmail.com> * @see * http://rose.u-aizu.ac.jp/onlinejudge/ProblemSet/description.jsp?id=0038&lang=jp */ import static java.lang.Math.*; import java.util.*; public class Main { static Scanner sc = new Scanner(System.in); static int[] cards; ...
/** * * No.0038 Poker Hand * * * @author yuichirw <y.iky917@gmail.com> * @see * http://rose.u-aizu.ac.jp/onlinejudge/ProblemSet/description.jsp?id=0038&lang=jp */ import static java.lang.Math.*; import java.util.*; public class Main { static Scanner sc = new Scanner(System.in); static int[] cards; ...
[["-", 0, 57, 64, 196, 0, 37, 0, 5, 0, 491], ["+", 0, 57, 64, 196, 0, 37, 0, 5, 0, 491]]
3
462
2
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; class Main { static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws Exception { String row; while ((row = reader.readLine()) != null) { ...
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; class Main { static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws Exception { String row; while ((row = reader.readLine()) != null) { ...
[["-", 0, 520, 0, 1, 0, 11, 12, 5, 0, 491], ["+", 0, 520, 0, 1, 0, 11, 12, 5, 0, 491]]
3
617
2
#include <stdio.h> int main() { int c[5], i; while (scanf("%d,%d,%d,%d,%d", &c[0], &c[1], &c[2], &c[3], &c[4]) != EOF) { int t[14] = {0}; int max = 0, c2 = 0; for (i = 0; i < 5; i++) { t[c[i]]++; if (t[c[i]] > max) { max = t[c[i]]; } } for (i = 0; i < 13; i++) { i...
#include <stdio.h> int main() { int c[5], i; while (scanf("%d,%d,%d,%d,%d", &c[0], &c[1], &c[2], &c[3], &c[4]) != EOF) { int t[14] = {0}; int max = 0, c2 = 0; for (i = 0; i < 5; i++) { t[c[i]]++; if (t[c[i]] > max) { max = t[c[i]]; } } for (i = 0; i < 14; i++) { i...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13]]
0
363
2
#include <ctype.h> #include <math.h> #include <stdio.h> #include <string.h> int main() { int num[5], i, j, k, l, m, key, flag = 0, count = 0; while (scanf("%d,%d,%d,%d,%d", &num[0], &num[1], &num[2], &num[3], &num[4]) != EOF) { for (i = 0; i < 5; i++) { for (j = i; j < 5; j++) if (num[...
#include <ctype.h> #include <math.h> #include <stdio.h> #include <string.h> int main() { int num[5], i, j, k, l, m, key, flag = 0, count = 0; while (scanf("%d,%d,%d,%d,%d", &num[0], &num[1], &num[2], &num[3], &num[4]) != EOF) { for (i = 0; i < 5; i++) { for (j = i; j < 5; j++) if (num[...
[["-", 0, 7, 8, 9, 0, 7, 10, 11, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 10, 11, 12, 13], ["-", 31, 16, 31, 16, 12, 69, 71, 16, 31, 22], ["-", 31, 16, 31, 16, 12, 69, 71, 16, 17, 72]]
0
819
4
#include <stdio.h> int main() { int a[5], b[13]; int i, j; while (scanf("%d,%d,%d,%d,%d", &a[0], &a[1], &a[2], &a[3], &a[4]) != EOF) { for (i = 0; i < 13; i++) { b[i] = 0; } for (i = 0; i < 5; i++) { b[a[i] - 1]++; } for (i = 0; i < 13; i++) { if (b[i] == 4) { print...
#include <stdio.h> int main() { int a[5], b[13]; int i, j; while (scanf("%d,%d,%d,%d,%d", &a[0], &a[1], &a[2], &a[3], &a[4]) != EOF) { for (i = 0; i < 13; i++) { b[i] = 0; } for (i = 0; i < 5; i++) { b[a[i] - 1]++; } for (i = 0; i < 13; i++) { if (b[i] == 4) { print...
[["+", 75, 76, 0, 57, 15, 23, 0, 16, 17, 98], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 17, 79], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 12, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
438
6
#include <stdio.h> char judge(int hand[5]); void sort(int *hand); int main(void) { int hand[5]; char rank; char OF; while (scanf(" %c,", &OF) != EOF) { hand[0] = OF - '0'; scanf("%d,%d,%d,%d", &hand[1], &hand[2], &hand[3], &hand[4]); sort(hand); rank = judge(hand); switch (rank) { ...
#include <stdio.h> char judge(int hand[5]); void sort(int *hand); int main(void) { int hand[5]; char rank; int OF; while (scanf(" %d,", &OF) != EOF) { hand[0] = OF; scanf("%d,%d,%d,%d", &hand[1], &hand[2], &hand[3], &hand[4]); sort(hand); rank = judge(hand); switch (rank) { case ('...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 16, 31, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 16, 31, 2, 3, 4, 0, 5, 0, 6], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["-", 0, 1, 0, 11, 12, 16, 12, 103, 0, 104], ["-", 0, 1, 0, 11, 12, 16, 12, 103, 0, 125]]
0
609
8
main() { int a[6], i, j; while (scanf("%d,%d,%d,%d,%d", &a[0], &a[1], &a[2], &a[3], &a[4]) != -1) { for (i = 0; i < 5 - 1; i++) for (j = i + 1; j < 5; j++) if (a[i] > a[j]) { a[5] = a[i]; a[i] = a[j]; a[j] = a[5]; } if ((a[0] == a[1] && a[1] == a[2] && a[2...
main() { int a[6], i, j; while (scanf("%d,%d,%d,%d,%d", &a[0], &a[1], &a[2], &a[3], &a[4]) != -1) { for (i = 0; i < 5 - 1; i++) for (j = i + 1; j < 5; j++) if (a[i] > a[j]) { a[5] = a[i]; a[i] = a[j]; a[j] = a[5]; } if ((a[0] == a[1] && a[1] == a[2] && a[2...
[["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
589
2
#include <stdio.h> int main() { int card[14]; int c[5]; int i, j, t; int pair, tri, fo, st; int flag = 0; while (scanf("%d,%d,%d,%d,%d", &c[0], &c[1], &c[2], &c[3], &c[4]) != EOF) { flag = pair = tri = fo = st = 0; for (i = 1; i < 14; i++) card[i] = 0; for (i = 0; i < 5; i++) { card...
#include <stdio.h> int main() { int card[14]; int c[5]; int i, j, t; int pair, tri, fo, st; int flag = 0; while (scanf("%d,%d,%d,%d,%d", &c[0], &c[1], &c[2], &c[3], &c[4]) != EOF) { flag = pair = tri = fo = st = 0; for (i = 1; i < 14; i++) card[i] = 0; for (i = 0; i < 5; i++) { card...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
460
2
#include <math.h> #include <stdio.h> main() { int data[10000], p, i, j, k, n; data[0] = 2; data[1] = 3; k = 2; for (i = 5; i < 100000; i += 2) { p = 0; for (j = 0;; j++) { if ((double)data[j] > sqrt((double)i)) break; if (i % data[j] == 0) { p = 1; break; }...
#include <math.h> #include <stdio.h> main() { int data[10000], p, i, j, k, n; data[0] = 2; data[1] = 3; k = 2; for (i = 5; i < 100000; i += 2) { p = 0; for (j = 0;; j++) { if ((double)data[j] > sqrt((double)i)) break; if (i % data[j] == 0) { p = 1; break; }...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13]]
0
250
2
#include <stdio.h> int isprime(int n) { int i; for (i = 2; i * i < n; i++) { if (n % i == 0) { return (0); } } return (1); } int main(void) { int n; int i; while (scanf("%d", &n) != EOF) { i = n; while (isprime(--i) == 0) ; printf("%d ", i); i = n; while (ispri...
#include <stdio.h> int isprime(int n) { int i; for (i = 2; i * i <= n; i++) { if (n % i == 0) { return (0); } } return (1); } int main(void) { int n; int i; while (scanf("%d", &n) != EOF) { i = n; while (isprime(--i) == 0) ; printf("%d ", i); i = n; while (ispr...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
0
133
2
#include <math.h> #include <stdio.h> int sosuu(int n); int b(int n); int s(int n); int main() { int n, big, small; while (scanf("%d", &n) != EOF) { big = b(n); small = s(n); printf("%d %d\n", small, big); } return 0; } int s(int n) { int i, result; for (i = 0; i < n; i++) { if (sosuu(i) != 0...
#include <math.h> #include <stdio.h> int sosuu(int n); int b(int n); int s(int n); int main() { int n, big, small; while (scanf("%d", &n) != EOF) { big = b(n); small = s(n); printf("%d %d\n", small, big); } return 0; } int s(int n) { int i, result; for (i = 0; i < n; i++) { if (sosuu(i) != 0...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
0
224
2
#include <stdio.h> int prime[1000000] = {0}; int main() { int i, j, k, flag; while (scanf("%d", &i) != EOF) { flag = 0; for (j = 2; j <= i + 100; j++) { for (k = 2; k * j <= i; k++) { prime[j * k] = 1; } } for (j = i * 2; j > 1; j--) { if (j < i && prime[j] == 0) { ...
#include <stdio.h> int prime[1000000] = {0}; int main() { int i, j, k, flag; while (scanf("%d", &i) != EOF) { flag = 0; for (j = 2; j <= i; j++) { for (k = 2; k * j < 55000; k++) { prime[j * k] = 1; } } for (j = i * 2; j > 1; j--) { if (j < i && prime[j] == 0) { pri...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13]]
0
182
6
#include <cmath> #include <iostream> using namespace std; bool Judge_Prime_Number(int x) { for (int i = 2; i <= sqrt(x); i++) { if (x % i == 0) return false; } return true; } int main() { int a; cin >> a; int min = a - 1, max = a + 1; while (Judge_Prime_Number(min) == false) min--; wh...
#include <cmath> #include <iostream> using namespace std; bool Judge_Prime_Number(int x) { for (int i = 2; i <= sqrt(x); i++) { if (x % i == 0) return false; } return true; } int main() { int a; while (cin >> a) { int min = a - 1, max = a + 1; while (Judge_Prime_Number(min) == false) ...
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
114
6
#include <cstdio> #include <iostream> using namespace std; int main(void) { int i, no, input; int prime[500]; int ptr = 0, c = 0; int flag = 0; int last; while (cin >> input) { flag = ptr = c = 0; prime[ptr++] = 2; prime[ptr++] = 3; for (no = 5;; no += 2) { if (flag == 2) { br...
#include <cstdio> #include <iostream> using namespace std; int main(void) { int i, no, input; int prime[10000]; int ptr = 0, c = 0; int flag = 0; int last; while (cin >> input) { flag = ptr = c = 0; prime[ptr++] = 2; prime[ptr++] = 3; for (no = 5;; no += 2) { if (flag == 2) { ...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]]
1
228
2
#include <iostream> using namespace std; int main() { int n; while (cin >> n) { int na, nb; bool flag = true; for (int i = n - 1;; i--) { for (int j = 2; j * j < i; j++) { if (i % j == 0) { flag = false; break; } } if (flag) { na = i; ...
#include <iostream> using namespace std; int main() { int n; while (cin >> n) { int na, nb; bool flag = true; for (int i = n - 1;; i--) { for (int j = 2; j * j <= i; j++) { if (i % j == 0) { flag = false; break; } } if (flag) { na = i; ...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]]
1
182
4
#include <iostream> using namespace std; int main() { bool prime[100000]; for (int i = 0; i < 100000; i++) { prime[i] = true; } prime[0] = prime[1] = false; for (int i = 2; i < 1000; i++) { for (int j = i * 2; j * i < 60000; j += i) { prime[j] = false; } } int n; int cnt1, cnt2; whi...
#include <iostream> using namespace std; int main() { bool prime[100000]; for (int i = 0; i < 100000; i++) { prime[i] = true; } prime[0] = prime[1] = false; for (int i = 2; i <= 1000; i++) { for (int j = i * 2; j < 100000; j += i) { prime[j] = false; } } int n; int cnt1, cnt2; while...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 8, 9, 0, 7, 15, 16, 31, 16, 17, 48], ["-", 8, 9, 0, 7, 15, 16, 31, 16, 12, 22], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13]]
1
185
6
#include <algorithm> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> #define PI 3.14159265359 #define INF 1000000; #define rep(i, n) for (int i = 0; i < n; i++) #define REP(n) rep(i, n) t...
#include <algorithm> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <string> #include <vector> #define PI 3.14159265359 #define INF 1000000; #define rep(i, n) for (int i = 0; i < n; i++) #define REP(n) rep(i, n) t...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 0, 11, 31, 69, 28, 2, 3, 4, 0, 13], ["+", 0, 11, 31, 69, 28, 2, 3, 4, 0, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 0, 57, 64, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 57, 64, 9...
1
270
10
#include <bits/stdc++.h> #define _ \ ios_base::sync_with_stdio(0); \ cin.tie(0); #define REP(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; set<int> primes = {2, 3, 5, 7, 11, ...
#include <bits/stdc++.h> #define _ \ ios_base::sync_with_stdio(0); \ cin.tie(0); #define REP(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; set<int> primes = {2, 3, 5, 7, 11, ...
[["-", 75, 76, 0, 9, 0, 1, 0, 27, 28, 22], ["-", 75, 76, 0, 9, 0, 1, 0, 27, 17, 68], ["-", 0, 57, 75, 76, 0, 9, 0, 1, 0, 35]]
1
273
3
#include <cmath> #include <iostream> using namespace std; int x[1000000]; int main() { for (int i = 2; i < 1000000; i++) { for (int j = 2; j <= sqrt(i); j++) { if (i % j == 0) { goto E; } } x[i] = 1; E:; } int a, b; while (cin >> a >> b) { for (int i = a - 1; i >= 0; i--) {...
#include <cmath> #include <iostream> using namespace std; int x[1000000]; int main() { for (int i = 2; i < 1000000; i++) { for (int j = 2; j <= sqrt(i); j++) { if (i % j == 0) { goto E; } } x[i] = 1; E:; } int a, b; while (cin >> a) { for (int i = a - 1; i >= 0; i--) { ...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 152], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 12, 22]]
1
169
2