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 |
|---|---|---|---|---|---|
#include <stdio.h>
#include <string.h>
int main(void) {
int i, n;
char *p;
char a[1000];
char word[] = "Hoshino";
scanf("%d\n", &n);
for (i = 0; i < n; i++) {
fgets(a, sizeof(a), stdin);
while ((p = strstr(a, "hoshino")) != NULL) {
p[6] = 'a';
}
printf("%s", a);
}
return 0;
} | #include <stdio.h>
#include <string.h>
int main(void) {
int i, n;
char *p;
char a[1002];
char word[] = "Hoshino";
scanf("%d\n", &n);
for (i = 0; i < n; i++) {
fgets(a, sizeof(a), stdin);
while ((p = strstr(a, word)) != NULL) {
p[6] = 'a';
}
printf("%s", a);
}
return 0;
} | [["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 31, 23, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 31, 23, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 51, 16, 31, 23, 0, 2, 3, 4, 0, 22]] | 1 | 113 | 6 |
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;
int main() {
string st;
int n;
string::size_type id;
cin >> n;
getchar();
for (n; n > 0; n--) {
getline(cin, st);
id = 0;
while (true) {
id = st.find("Hoshino", id);
if (id == string::npos)
break;
... | #include <iostream>
#include <stdio.h>
#include <string>
using namespace std;
int main() {
string st;
int n;
string::size_type id;
cin >> n;
getchar();
for (n; n > 0; n--) {
getline(cin, st);
id = 0;
while (true) {
id = st.find("Hoshino", id);
if (id == string::npos)
break;
... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 1 | 113 | 2 |
#include <iostream>
#include <string>
using namespace std;
int rep(string a, int *loc) {
*loc = a.find("Hoshino");
return *loc;
}
int main() {
string a, t = "Hoshina";
int n, loc;
cin >> n;
getline(cin, a);
while (n--) {
loc = 0;
getline(cin, a);
while (!rep(a, &loc))
a.replace(loc, t.le... | #include <iostream>
#include <string>
using namespace std;
int search(string a, int *loc) {
*loc = a.find("Hoshino", 0);
return *loc;
}
int main() {
string a, t = "Hoshina";
int n, loc;
cin >> n;
getline(cin, a);
while (n--) {
loc = 0;
getline(cin, a);
while (~search(a, &loc))
a.replace(... | [["-", 36, 36, 0, 30, 0, 14, 49, 53, 49, 22], ["+", 36, 36, 0, 30, 0, 14, 49, 53, 49, 22], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 21], ["+", 0, 1, 0, 11, 12, 2, 3, 4, 0, 13], ["-", 8, 9, 0, 52, 15, 339, 51, 91, 17, 111], ["-", 0, 52, 15, 339, 51, 91, 28, 2, 63, 22], ["+", 8, 9, 0, 52, 15, 339, 51, 91, 17, 92], ["+", 0, 52,... | 1 | 120 | 8 |
#include <iostream>
using namespace std;
int main() {
string str;
int n;
cin >> n;
cin.ignore();
while (n--) {
getline(cin, str);
for (int pos = str.find("Hoshino"); pos != string::npos;
pos = str.find("Hoshino", 7 + pos)) {
str.replace(pos, 7, "Hashina");
}
cout << str << endl... | #include <iostream>
using namespace std;
int main() {
string str;
int n;
cin >> n;
cin.ignore();
while (n--) {
getline(cin, str);
for (int pos = str.find("Hoshino"); pos != string::npos;
pos = str.find("Hoshino", 7 + pos)) {
str.replace(pos, 7, "Hoshina");
}
cout << str << endl... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 1 | 101 | 2 |
#include <iostream>
#include <string>
using namespace std;
int main(void) {
int D_Set;
cin >> D_Set;
for (int i = 0; i < D_Set; i++) {
string text;
getline(cin, text);
while (1) {
string::size_type pos = text.find("Hoshino");
if (pos == string::npos) {
break;
} else {
... | #include <iostream>
#include <string>
using namespace std;
int main(void) {
int D_Set;
cin >> D_Set;
cin.ignore();
for (int i = 0; i < D_Set; i++) {
string text;
getline(cin, text);
while (1) {
string::size_type pos = text.find("Hoshino");
if (pos == string::npos) {
break;
... | [["+", 8, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 17, 131], ["+", 8, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]] | 1 | 103 | 6 |
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
void Hoshina(string &str) {
if (str.size() < 7) {
} else {
for (unsigned int i = 0; i < str.size() - 6; ++i) {
if (str[i] == 'H' && str[i + 1] == 'o' && str[i + 2] == 's' &&
str[i + 3] == 'h' && st... | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
void Hoshina(string &str) {
if (str.size() < 7) {
} else {
for (unsigned int i = 0; i < str.size() - 6; ++i) {
if (str[i] == 'H' && str[i + 1] == 'o' && str[i + 2] == 's' &&
str[i + 3] == 'h' && st... | [["-", 8, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["-", 8, 9, 0, 1, 0, 2, 63, 118, 17, 131], ["-", 8, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]] | 1 | 214 | 6 |
#include <iostream>
#include <string>
int main() {
const std::string str_false = "Hoshino";
const std::string str_true = "Hoshina";
u_int num_of_data;
std::string text;
std::cin >> num_of_data;
std::cin.ignore();
for (u_int i = 0; i < num_of_data; ++i) {
getline(std::cin, text);
u_int index = 0... | #include <iostream>
#include <string>
int main() {
const std::string str_false = "Hoshino";
const std::string str_true = "Hoshina";
u_int num_of_data;
std::string text;
std::cin >> num_of_data;
std::cin.ignore();
for (u_int i = 0; i < num_of_data; ++i) {
getline(std::cin, text);
int index = 0;
... | [["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 78], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40]] | 1 | 131 | 26 |
#include <iostream>
#include <string>
int main() {
const std::string str_false = "Hoshino";
const std::string str_true = "Hoshina";
u_int num_of_data;
std::string text;
std::cin >> num_of_data;
std::cin.ignore();
for (u_int i = 0; i < num_of_data; ++i) {
getline(std::cin, text);
int index;
... | #include <iostream>
#include <string>
int main() {
const std::string str_false = "Hoshino";
const std::string str_true = "Hoshina";
u_int num_of_data;
std::string text;
std::cin >> num_of_data;
std::cin.ignore();
for (u_int i = 0; i < num_of_data; ++i) {
getline(std::cin, text);
int index = 0;
... | [["+", 0, 7, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 7, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 132 | 2 |
n = gets.chomp.to_i
n.times do |i|
line = gets.chomp
line.gsub(/Hoshino/, "Hoshina")
puts line
end | n = gets.chomp.to_i
n.times do |i|
line = gets.chomp
line.gsub!(/Hoshino/, "Hoshina")
puts line
end | [["-", 0, 652, 196, 737, 8, 736, 0, 652, 735, 22], ["+", 0, 652, 196, 737, 8, 736, 0, 652, 735, 22]] | 4 | 34 | 2 |
n = gets
puts $_.gsub("Hoshiro", "Hoshina") while gets | n = gets
puts $_.gsub("Hoshino", "Hoshina") while gets | [["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 6]] | 4 | 18 | 2 |
n = gets.to_i
n.times do
line = gets.chomp!
puts line.gsub('Hosino', 'Hoshina')
end | n = gets.to_i
n.times do
line = gets.chomp!
puts line.gsub('Hoshino', 'Hoshina')
end | [["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 6]] | 4 | 28 | 2 |
n = gets().to_i
n.times do |i|
str = gets()
puts str.gsub("hoshino","hoshina")
end | # -*- coding: utf-8 -*-
n = gets().to_i
n.times do |i|
str = gets()
puts str.gsub("Hoshino", "Hoshina")
end | [["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 6]] | 4 | 33 | 4 |
#繰り返し回数
count = gets.to_i
count.times do
#入力された値の"Hoshino"を"Hoshina"に置き換えて表示
p gets.gsub("Hoshino","Hoshina")
end | #繰り返し回数
count = gets.to_i
count.times do
#入力された値の"Hoshino"を"Hoshina"に置き換えて表示
puts gets.gsub("Hoshino","Hoshina")
end | [["-", 0, 652, 196, 737, 8, 736, 0, 652, 735, 22], ["+", 0, 652, 196, 737, 8, 736, 0, 652, 735, 22]] | 4 | 25 | 2 |
gets.to_i.times { p gets.chomp.gsub("Hoshino", "Hoshina") } | gets.to_i.times { puts gets.chomp.gsub("Hoshino", "Hoshina") } | [["-", 0, 652, 196, 196, 8, 734, 0, 652, 735, 22], ["+", 0, 652, 196, 196, 8, 734, 0, 652, 735, 22]] | 4 | 22 | 2 |
n=int(input())
for i in range(n):
print(input().replace("Hoshino","hoshina")) | n=int(input())
for i in range(n):
print(input().replace("Hoshino","Hoshina")) | [["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 6]] | 5 | 33 | 2 |
[print(input().replace('Hoshino', 'Hoshina')) for _ in range(int(inpu()))] | [print(input().replace('Hoshino', 'Hoshina')) for _ in range(int(input()))] | [["-", 3, 4, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 3, 4, 0, 652, 3, 4, 0, 652, 63, 22]] | 5 | 31 | 2 |
import sys
input()
for i in sys.stdin.readlines():
print(i.replace('Hoshino', 'Hoshina')) | import sys
input()
for i in sys.stdin.readlines():
print(i.replace('Hoshino', 'Hoshina'), end='') | [["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["+", 0, 1, 0, 652, 3, 4, 0, 653, 141, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 653, 0, 32], ["+", 0, 652, 3, 4, 0, 653, 51, 557, 0, 654], ["+", 0, 652, 3, 4, 0, 653, 51, 557, 0, 655]] | 5 | 31 | 5 |
n=int(input())
for i in range(n):
s=input()
s.replace("Hoshino","Hoshina")
print(s) | n=int(input())
for i in range(n):
s=input()
s=s.replace("Hoshino","Hoshina")
print(s) | [["+", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 1, 0, 662, 12, 652, 63, 319, 500, 22]] | 5 | 37 | 2 |
import string
n=int(raw_input())
for i in range(n):
print(raw_input().replace("Hoshino", "Hoshina")) | import string
n=int(input())
for i in range(n):
print(input().replace("Hoshino", "Hoshina")) | [["-", 0, 662, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 662, 12, 652, 3, 4, 0, 652, 63, 22], ["-", 3, 4, 0, 652, 63, 319, 500, 652, 63, 22], ["+", 3, 4, 0, 652, 63, 319, 500, 652, 63, 22]] | 5 | 35 | 4 |
num = int(input())
for i in range(num):
box = input()
box.replace("Hoshino", "Hoshina")
print(box) | num = int(input())
for i in range(num):
box = input()
print(box.replace("Hoshino", "Hoshina"))
| [["+", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]] | 5 | 37 | 5 |
import sys
#from me.io import dup_file_stdin
#@dup_file_stdin
def solve():
for index in range(int(sys.stdin.readline())):
print(sys.stdin.readline().replace("Hoshino","Hoshina"))
solve() | import sys
#from me.io import dup_file_stdin
#@dup_file_stdin
def solve():
for index in range(int(sys.stdin.readline())):
print(sys.stdin.readline()[:-1].replace("Hoshino","Hoshina"))
solve() | [["+", 3, 4, 0, 652, 63, 319, 500, 206, 0, 70], ["+", 0, 652, 63, 319, 500, 206, 206, 663, 0, 102], ["+", 63, 319, 500, 206, 206, 663, 0, 664, 17, 33], ["+", 63, 319, 500, 206, 206, 663, 0, 664, 28, 612], ["+", 3, 4, 0, 652, 63, 319, 500, 206, 0, 73]] | 5 | 50 | 5 |
for i in [0]*eval(input()):print(input().replace("hino","hina")) | for i in [0]*eval(input()):print(input().replace("Hoshino","Hoshina")) | [["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 6]] | 5 | 31 | 4 |
var print = console.log;
function read_input(_input) {
var lines = _input.split("\n");
return function() { return lines.shift(); };
}
String.prototype.dot = function dot(x) {
var res = "";
for (var i = 0; i < x; i++) {
res += this.toString();
}
return res;
};
function IL(line, min1Flg) {
var s = li... | var print = console.log;
function read_input(_input) {
var lines = _input.split("\n");
return function() { return lines.shift(); };
}
String.prototype.dot = function dot(x) {
var res = "";
for (var i = 0; i < x; i++) {
res += this.toString();
}
return res;
};
function IL(line, min1Flg) {
var s = li... | [["-", 3, 3, 0, 2, 3, 3, 0, 557, 0, 491], ["+", 3, 3, 0, 2, 3, 3, 0, 557, 0, 491]] | 2 | 569 | 2 |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (true) {
int n = sc.nextInt();
if (n == 0)
break;
int[][] a = new int[n + 1][n + 1];
int sum = 0;
for (int i = 0; i < n; i++) {
for (... | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (true) {
int n = sc.nextInt();
if (n == 0)
break;
int[][] a = new int[n + 1][n + 1];
int sum = 0;
for (int i = 0; i < n; i++) {
for (... | [["-", 0, 1, 0, 11, 12, 504, 516, 504, 71, 22], ["+", 0, 1, 0, 11, 12, 504, 516, 504, 71, 22], ["-", 8, 196, 0, 1, 0, 11, 12, 504, 71, 22], ["+", 8, 196, 0, 1, 0, 11, 12, 504, 71, 22]] | 3 | 272 | 4 |
#include <stdio.h>
int main(void) {
int n;
int mat[11][11] = {0};
int i, j;
while (1) {
scanf("%d", &n);
if (n == 0)
break;
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) {
scanf("%d", &mat[i][j]);
mat[i][n] += mat[i][j];
mat[n][j] += mat[i][j];
}
... | #include <stdio.h>
int main(void) {
int n;
int mat[11][11] = {0};
int i, j;
while (1) {
scanf("%d", &n);
if (n == 0)
break;
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) {
scanf("%d", &mat[i][j]);
mat[i][n] += mat[i][j];
mat[n][j] += mat[i][j];
}
... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 215 | 2 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void matrix_like_computation(const int);
void listen_input(int *[], const int);
void calc_sums(int *[], const int);
void echo_matrix(int *[], const int);
int main() {
int data_count;
while (scanf("%d", &data_count), data_count) {
matrix_like_computati... | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
void matrix_like_computation(const int);
void listen_input(int *[], const int);
void calc_sums(int *[], const int);
void echo_matrix(int *[], const int);
int main() {
int data_count;
while (scanf("%d", &data_count), data_count) {
matrix_like_computati... | [["-", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22]] | 0 | 507 | 2 |
#include <stdio.h>
int main(void) {
for (;;) {
int n, i, j, hyo[12][12] = {{0}}, w = 0, all = 0;
scanf("%d", &n);
if (n == 0)
break;
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) {
scanf("%d", &hyo[i][j]);
w += hyo[i][j];
if (j == n - 1) {
hyo[i][j + 1... | #include <stdio.h>
int main(void) {
for (;;) {
int n, i, j, hyo[12][12] = {{0}}, w = 0, all = 0;
scanf("%d", &n);
if (n == 0)
break;
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) {
scanf("%d", &hyo[i][j]);
w += hyo[i][j];
if (j == n - 1) {
hyo[i][j + 1... | [["-", 8, 9, 0, 57, 64, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 2, 63, 22]] | 0 | 410 | 2 |
#include <stdio.h>
int main(void) {
int i, j, ans[10] = {0}, n, tmp, sum;
while (scanf("%d", &n) != EOF) {
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) {
scanf("%d", &tmp);
if (i == 0)
ans[j] = tmp;
else
ans[j] += tmp;
if (j == 0)
sum = tm... | #include <stdio.h>
int main(void) {
int i, j, ans[10] = {0}, n, tmp, sum;
while (scanf("%d", &n), n) {
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) {
scanf("%d", &tmp);
if (i == 0)
ans[j] = tmp;
else
ans[j] += tmp;
if (j == 0)
sum = tmp;
... | [["-", 8, 9, 0, 52, 15, 23, 0, 16, 17, 79], ["-", 8, 9, 0, 52, 15, 23, 0, 16, 12, 22], ["+", 8, 9, 0, 52, 15, 23, 0, 34, 0, 21], ["+", 8, 9, 0, 52, 15, 23, 0, 34, 12, 22]] | 0 | 191 | 4 |
#include <stdio.h>
int a[16][16];
int main(void) {
int n;
int i, j;
while (1) {
scanf("%d", &n);
if (n == 0)
break;
a[n][n] = 0;
for (i = 0; i < n; i++) {
a[i][n] = 0;
for (j = 0; j < n; j++) {
scanf("%d", &a[i][j]);
a[i][n] += a[i][j];
}
a[n][n] +=... | #include <stdio.h>
int a[16][16];
int main(void) {
int n;
int i, j;
while (1) {
scanf("%d", &n);
if (n == 0)
break;
a[n][n] = 0;
for (i = 0; i < n; i++) {
a[i][n] = 0;
for (j = 0; j < n; j++) {
scanf("%d", &a[i][j]);
a[i][n] += a[i][j];
}
a[n][n] +=... | [["-", 0, 1, 0, 11, 12, 69, 28, 69, 71, 22], ["+", 0, 1, 0, 11, 12, 69, 28, 69, 71, 22], ["-", 8, 9, 0, 1, 0, 11, 12, 69, 71, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 69, 71, 22]] | 0 | 261 | 4 |
#include <stdio.h>
int main(int argc, char **argv) {
int dataset, i, j;
int data[11][11];
scanf("%d", &dataset);
while (dataset != 0) {
for (i = 0; i <= dataset; i++)
for (j = 0; j <= dataset; j++)
data[i][j] = 0;
for (i = 0; i < dataset; i++) {
for (j = 0; j < dataset; j++) {
... | #include <stdio.h>
int main(int argc, char **argv) {
int dataset, i, j;
int data[11][11];
scanf("%d", &dataset);
while (dataset != 0) {
for (i = 0; i <= dataset; i++)
for (j = 0; j <= dataset; j++)
data[i][j] = 0;
for (i = 0; i < dataset; i++) {
for (j = 0; j < dataset; j++) {
... | [["-", 8, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 8, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 242 | 2 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
int m[11][11], n, i, j, t;
for (; scanf("%d", &n) && n != 0;) {
memset(m, 0, sizeof(m));
for (i = 0; i <= n; i++)
for (j = 0; j <= n; j++) {
if (i < n && j < n) {
scanf("%d", &t);
m[i][j] = t;
... | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
int m[11][11], n, i, j, t;
for (; scanf("%d", &n) && n != 0;) {
memset(m, 0, sizeof(m));
for (i = 0; i <= n; i++) {
for (j = 0; j <= n; j++) {
if (i < n && j < n) {
scanf("%d", &t);
m[i][j] = t;
... | [["+", 0, 7, 8, 9, 0, 7, 8, 9, 0, 45], ["+", 0, 7, 8, 9, 0, 7, 8, 9, 0, 46]] | 0 | 176 | 2 |
#include <stdio.h>
int main() {
int n, i, j, val[11][11];
scanf("%d", &n);
while (n != 0) {
val[n][n] = 0;
for (i = 0; i < n; i++) {
val[i][n] = 0;
val[n][i] = 0;
}
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) {
scanf("%d", &val[i][j]);
val[n][n] += val[i][j... | #include <stdio.h>
int main() {
int n, i, j, val[11][11];
scanf("%d", &n);
while (n != 0) {
val[n][n] = 0;
for (i = 0; i < n; i++) {
val[i][n] = 0;
val[n][i] = 0;
}
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) {
scanf("%d", &val[i][j]);
val[n][n] += val[i][j... | [["-", 0, 7, 8, 9, 0, 7, 10, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 7, 10, 11, 31, 22], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 31, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 31, 22], ["-", 0, 7, 8, 9, 0, 7, 26, 27, 28, 22], ["+", 0, 7, 8, 9, 0, 7, 26, 27, 28, 22]] | 0 | 245 | 6 |
#include <stdio.h>
int main() {
int i, j, n, tmp = 0, total = 0;
while (scanf("%d", &n)) {
if (n == 0) {
break;
}
int mas[n + 1][n + 1];
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) {
scanf("%d", &mas[i][j]);
tmp += mas[i][j];
}
mas[i][n] = tmp;
t... | #include <stdio.h>
int main() {
int i, j, n, tmp = 0, total = 0;
while (scanf("%d", &n)) {
if (n == 0) {
break;
}
int mas[n + 1][n + 1];
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) {
scanf("%d", &mas[i][j]);
tmp += mas[i][j];
}
mas[i][n] = tmp;
t... | [["-", 0, 52, 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, 44], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]] | 0 | 268 | 7 |
#include <stdio.h>
int main(void) {
int total[11];
int i, n, k, s, val;
while (1) {
scanf("%d", &n);
if (!n)
break;
for (i = 0; i <= n; i++) {
total[i] = 0;
}
for (i = 0; i < n; i++) {
s = 0;
for (k = 0; k < n; k++) {
scanf("%d", &val);
total[i] += va... | #include <stdio.h>
int main(void) {
int total[11];
int i, n, k, s, val;
while (1) {
scanf("%d", &n);
if (!n)
break;
for (i = 0; i <= n; i++) {
total[i] = 0;
}
for (i = 0; i < n; i++) {
s = 0;
for (k = 0; k < n; k++) {
scanf("%d", &val);
total[k] += va... | [["-", 8, 9, 0, 1, 0, 11, 31, 69, 71, 22], ["+", 8, 9, 0, 1, 0, 11, 31, 69, 71, 22]] | 0 | 189 | 2 |
#include <stdio.h>
#include <string.h>
int main() {
int i, j, n, matrix[11][11];
while (scanf("%d", &n)) {
if (!0)
break;
memset(matrix, 0, sizeof(matrix));
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) {
scanf("%d", &matrix[i][j]);
matrix[i][n] += matrix[i][j];
... | #include <stdio.h>
#include <string.h>
int main() {
int i, j, n, matrix[11][11];
while (scanf("%d", &n)) {
if (!n)
break;
memset(matrix, 0, sizeof(matrix));
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) {
scanf("%d", &matrix[i][j]);
matrix[i][n] += matrix[i][j];
... | [["-", 8, 9, 0, 57, 15, 23, 0, 91, 28, 13], ["+", 8, 9, 0, 57, 15, 23, 0, 91, 28, 22]] | 0 | 206 | 2 |
#include <memory.h>
#include <stdio.h>
int main(void) {
int i, j, n, t;
int A[20][20];
while (scanf("%d\n", &n) == 1) {
if (n == 0)
break;
memset((char *)A, 0x00, sizeof(A));
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) {
scanf("%d", &t);
A[i][j] = t;
A[i][n... | #include <memory.h>
#include <stdio.h>
int main(void) {
int i, j, n, t;
int A[20][20];
while (scanf("%d\n", &n) == 1) {
if (n == 0)
break;
memset((char *)A, 0x00, sizeof(A));
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) {
scanf("%d", &t);
A[i][j] = t;
A[i][n... | [["-", 0, 52, 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, 44], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]] | 0 | 216 | 7 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <typeinfo>
#include <vector>
#define INF 100000000
#define rep(i, a) for (int i = 0; i < (a); i++)
using namespace std;
typedef long long ll;
int main() {
int n;
... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <typeinfo>
#include <vector>
#define INF 100000000
#define rep(i, a) for (int i = 0; i < (a); i++)
using namespace std;
typedef long long ll;
int main() {
int n;
... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 1 | 228 | 2 |
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
int main() {
int n;
while (cin >> n, n) {
int table[n][n], x[n], y[n], sum = 0;
REP(i, n) {
REP(j, n) cin >> table[i][j];
x[i] = y[i] = 0;
}
... | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
int main() {
int n;
while (cin >> n, n) {
int table[n][n], x[n], y[n], sum = 0;
REP(i, n) {
REP(j, n) cin >> table[i][j];
x[i] = y[i] = 0;
}
... | [["-", 31, 16, 31, 16, 12, 2, 3, 4, 0, 13], ["+", 31, 16, 31, 16, 12, 2, 3, 4, 0, 13]] | 1 | 286 | 12 |
#include <iostream>
using namespace std;
int main() {
int n;
while (cin >> n, n) {
int excel[11][11] = {};
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cin >> excel[i][j];
excel[n][n] += excel[i][j] * 2;
}
}
for (int i = 0; i < n; i++) {
for (int j... | #include <iostream>
using namespace std;
int main() {
int n;
while (cin >> n, n) {
int excel[11][11] = {};
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cin >> excel[i][j];
excel[n][n] += excel[i][j];
}
}
for (int i = 0; i < n; i++) {
for (int j = 0... | [["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 48], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]] | 1 | 255 | 2 |
#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
while (cin >> n) {
if (!n)
break;
int data[n + 1][n + 1];
for (int i = 0; i < n; ++i) {
int tmp, sum;
for (int j = 0; j < n; ++j) {
cin >> tmp;
data[i][j] = tmp;
sum += tmp;
}
data[i][n... | #include <bits/stdc++.h>
using namespace std;
int n;
int main() {
while (cin >> n) {
if (!n)
break;
int data[n + 1][n + 1];
for (int i = 0; i < n; ++i) {
int tmp = 0, sum = 0;
for (int j = 0; j < n; ++j) {
cin >> tmp;
data[i][j] = tmp;
sum += tmp;
}
d... | [["+", 0, 7, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 7, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 240 | 4 |
#include <iomanip>
#include <iostream>
using namespace std;
int main(void) {
int n;
int i, j;
while (1) {
cin >> n;
if (n == 0) {
break;
}
int array[11][11] = {};
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) {
cin >> array[i][j];
array[i][n] = array[i][n] + a... | #include <iomanip>
#include <iostream>
using namespace std;
int main(void) {
int n;
int i, j;
while (1) {
cin >> n;
if (n == 0) {
break;
}
int array[11][11] = {};
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) {
cin >> array[i][j];
array[i][n] = array[i][n] + a... | [["-", 0, 16, 31, 16, 12, 2, 3, 4, 0, 13], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 13]] | 1 | 227 | 2 |
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
int n, h[11][11];
while (scanf("%d", &n)) {
if (!n)
break;
for (int i = 0; i < n; i++) {
int num = 0;
for (int j = 0; j < n; j++) {
scanf("%d", &h[i][j]);
num += h[i][j];
printf("%5d", h[i][j])... | #include <cstdio>
#include <iostream>
using namespace std;
int main() {
int n, h[11][11];
while (scanf("%d", &n)) {
if (!n)
break;
for (int i = 0; i < n; i++) {
int num = 0;
for (int j = 0; j < n; j++) {
scanf("%d", &h[i][j]);
num += h[i][j];
printf("%5d", h[i][j])... | [["+", 0, 52, 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, 44], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]] | 1 | 198 | 7 |
#include <bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(), vec.end()
typedef long long int ll;
typedef pair<ll, ll> P;
const ll MOD = 10000;
const ll INF = 1000000010;
const ll LINF = 1000000000000000010;
const int MAX = 100001;
int dx[8] = {0, 1, 0, -1, 1, -1, 1, -1};
int dy[8] = {1, 0, -1, 0, 1, -1, ... | #include <bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(), vec.end()
typedef long long int ll;
typedef pair<ll, ll> P;
const ll MOD = 10000;
const ll INF = 1000000010;
const ll LINF = 1000000000000000010;
const int MAX = 100001;
int dx[8] = {0, 1, 0, -1, 1, -1, 1, -1};
int dy[8] = {1, 0, -1, 0, 1, -1, ... | [["-", 0, 52, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 52, 8, 9, 0, 1, 0, 16, 17, 151], ["-", 0, 52, 8, 9, 0, 1, 0, 16, 12, 22], ["-", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]] | 1 | 357 | 4 |
#include <iomanip>
#include <iostream>
using namespace std;
int main() {
int n;
int area[11][11];
while (cin >> n) {
if (n == 0)
break;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cin >> area[i][j];
}
}
for (int i = 0; i < n; i++) {
int count = 0;
... | #include <iomanip>
#include <iostream>
using namespace std;
int main() {
int n;
int area[11][11];
while (cin >> n) {
if (n == 0)
break;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cin >> area[i][j];
}
}
for (int i = 0; i < n; i++) {
int count = 0;
... | [["-", 0, 16, 31, 16, 12, 2, 3, 4, 0, 13], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 13]] | 1 | 252 | 2 |
#include <cstdio>
int main(void) {
int data[11][11];
int n;
while (1) {
scanf("%d", &n);
if (n == 0)
break;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
data[i][j] = 0;
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
sc... | #include <cstdio>
int main(void) {
int data[11][11];
int n;
while (1) {
scanf("%d", &n);
if (n == 0)
break;
for (int i = 0; i <= n; i++) {
for (int j = 0; j <= n; j++) {
data[i][j] = 0;
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
... | [["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]] | 1 | 242 | 4 |
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
while (cin >> N, N) {
int num[150][150] = {{0}};
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
cin >> num[i][j];
num[i][N] += num[i][j];
num[N][j]... | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
while (cin >> N, N) {
int num[150][150] = {{0}};
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
cin >> num[i][j];
num[i][N] += num[i][j];
num[N][j]... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 324 | 2 |
#include <stdio.h>
int main() {
int n;
while (1) {
int l, r;
int a[11][11];
scanf("%d", &n);
if (!n)
break;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++)
scanf("%d", &a[i][j]);
}
for (int i = 0; i < n + 1; i++) {
l = r = 0;
for (int j = 0; j < ... | #include <stdio.h>
int main() {
int n;
while (1) {
int l, r;
int a[11][11];
scanf("%d", &n);
if (!n)
break;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++)
scanf("%d", &a[i][j]);
}
for (int i = 0; i < n + 1; i++) {
l = r = 0;
for (int j = 0; j < ... | [["-", 8, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 8, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 1 | 233 | 2 |
#include <iomanip>
#include <iostream>
int main() {
int n;
int *table;
while (1) {
std::cin >> n;
if (!n) {
return 0;
}
table = new int[(n + 1) * (n + 1)];
for (int i = 0; i < n * n; i++) {
std::cin >> table[i / n * (n + 1) + i % n];
}
for (int r = 0; r < n; r++) {
f... | #include <iomanip>
#include <iostream>
int main() {
int n;
int *table;
while (1) {
std::cin >> n;
if (!n) {
return 0;
}
table = new int[(n + 1) * (n + 1)]();
for (int i = 0; i < n * n; i++) {
std::cin >> table[i / n * (n + 1) + i % n];
}
for (int r = 0; r < n; r++) {
... | [["+", 0, 1, 0, 11, 12, 350, 3, 4, 0, 24], ["+", 0, 1, 0, 11, 12, 350, 3, 4, 0, 25]] | 1 | 279 | 2 |
num=[]
while gets
x=[]
y=[]
z=0
s=$_.to_i
break if (s==0)
s.times do |i|
x[i]=0
num<<gets.chomp.split(nil).map(&:to_i)
x[i]=num[i].inject(:+)
z+=x[i]
end
s.times do |i|
y[i]=0
s.times do |j|
y[i]+=num[j][i]
end
end
... | loop do
num=[]
x=[]
y=[]
z=0
s=gets.to_i
break if (s==0)
s.times do |i|
x[i]=0
num<<gets.chomp.split(nil).map(&:to_i)
x[i]=num[i].inject(:+)
z+=x[i]
end
s.times do |i|
y[i]=0
s.times do |j|
y[i]+=num[j][i]
end
en... | [["+", 36, 36, 36, 36, 36, 36, 0, 42, 0, 22], ["+", 36, 36, 36, 36, 36, 36, 0, 42, 0, 170], ["-", 36, 36, 36, 36, 36, 36, 0, 42, 0, 89], ["-", 36, 36, 36, 36, 36, 36, 0, 42, 0, 22], ["-", 36, 36, 0, 42, 0, 662, 12, 652, 486, 744], ["+", 36, 36, 0, 42, 0, 662, 12, 652, 486, 22]] | 4 | 63 | 6 |
while n = STDIN.gets.to_i do
break if n == 0
twodarr = []
n.times{ |i|
arr = STDIN.gets.split.map(&:to_i)
twodarr[i] = arr
}
(n).times{ |i|
twodarr[i][twodarr.size] = twodarr[i].inject(:+)
(twodarr.size+2).times{ |j|
print twodarr[i][j].to_s.rjust(5)
}
puts ""
}
rowsum = []
... | while n = STDIN.gets.to_i do
break if n == 0
twodarr = []
n.times{ |i|
arr = STDIN.gets.split.map(&:to_i)
twodarr[i] = arr
}
n.times{ |i|
twodarr[i][twodarr.size] = twodarr[i].inject(:+)
(twodarr.size+1).times{ |j|
print twodarr[i][j].to_s.rjust(5)
}
puts
}
rowsum = []
rows... | [["-", 0, 89, 8, 170, 0, 652, 486, 739, 0, 24], ["-", 0, 89, 8, 170, 0, 652, 486, 739, 0, 25], ["-", 8, 734, 0, 652, 486, 739, 0, 738, 12, 612], ["+", 8, 734, 0, 652, 486, 739, 0, 738, 12, 612], ["-", 8, 734, 0, 652, 3, 4, 0, 557, 0, 62], ["+", 36, 36, 0, 493, 0, 89, 8, 170, 0, 22]] | 4 | 156 | 7 |
#include <algorithm>
#include <assert.h>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#incl... | #include <algorithm>
#include <assert.h>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#incl... | [["-", 15, 339, 51, 34, 31, 16, 31, 16, 12, 22], ["-", 0, 52, 15, 339, 51, 34, 31, 16, 17, 152], ["+", 0, 52, 15, 339, 51, 34, 31, 16, 17, 152], ["+", 0, 52, 15, 339, 51, 34, 31, 16, 12, 22]] | 1 | 372 | 4 |
#include <cstdio>
#include <iostream>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
int main(void) {
int w, h;
char map[100][100];
while (cin >> w >> h, w | h) {
rep(j, h) rep(i, w) cin >> map[i][j];
int x = 0, y = 0;
while (true) {
i... | #include <cstdio>
#include <iostream>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
int main(void) {
int w, h;
char map[100][100];
while (cin >> h >> w, w | h) {
rep(j, h) rep(i, w) cin >> map[i][j];
int x = 0, y = 0;
while (true) {
i... | [["-", 15, 339, 51, 34, 31, 16, 31, 16, 12, 22], ["-", 0, 52, 15, 339, 51, 34, 31, 16, 17, 152], ["+", 0, 52, 15, 339, 51, 34, 31, 16, 17, 152], ["+", 0, 52, 15, 339, 51, 34, 31, 16, 12, 22]] | 1 | 279 | 4 |
#include <iostream>
#include <vector>
using namespace std;
int main() {
int w, h;
int i, j;
while (1) {
cin >> w;
cin >> h;
if (w == 0 || h == 0)
break;
vector<vector<char>> v(101, vector<char>(101));
for (j = 0; j < h; ++j) {
for (i = 0; i < w; ++i) {
cin >> v[i][j];
... | #include <iostream>
#include <vector>
using namespace std;
int main() {
int w, h;
int i, j;
while (1) {
cin >> h;
cin >> w;
if (w == 0 || h == 0)
break;
vector<vector<char>> v(101, vector<char>(101));
for (j = 0; j < h; ++j) {
for (i = 0; i < w; ++i) {
cin >> v[i][j];
... | [["-", 0, 52, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 16, 12, 22]] | 1 | 244 | 4 |
#include <iostream>
using namespace std;
char tile[150][150];
bool flag[150][150];
int solve(int x, int y) {
if (flag[x][y])
return -1;
int ans;
flag[x][y] = true;
switch (tile[x][y]) {
case '>':
ans = solve(x + 1, y);
break;
case '<':
ans = solve(x - 1, y);
break;
case 'v':
ans... | #include <iostream>
using namespace std;
char tile[150][150];
bool flag[150][150];
int solve(int x, int y) {
if (flag[x][y])
return -1;
int ans;
flag[x][y] = true;
switch (tile[x][y]) {
case '>':
ans = solve(x + 1, y);
break;
case '<':
ans = solve(x - 1, y);
break;
case 'v':
ans... | [["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["-", 0, 52, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 52, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 0, 52, 8, 9, 0, 1, 0, 16, 12, 22]] | 1 | 331 | 4 |
#include <iostream>
using namespace std;
int main() {
int H, W, x, y;
while (cin >> H >> W) {
if (H == 0 && W == 0)
break;
char space[H][W], c;
for (int i = 0; i < W; i++) {
for (int j = 0; j < H; j++) {
cin >> space[j][i];
}
}
x = y = 0;
while (1) {
c = space... | #include <iostream>
using namespace std;
int main() {
int H, W, x, y;
while (cin >> H >> W) {
if (H == 0 && W == 0)
break;
char space[W][H], c;
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
cin >> space[j][i];
}
}
x = y = 0;
while (1) {
c = space... | [["-", 8, 9, 0, 43, 49, 80, 49, 80, 81, 22], ["+", 8, 9, 0, 43, 49, 80, 49, 80, 81, 22], ["-", 0, 52, 8, 9, 0, 43, 49, 80, 81, 22], ["+", 0, 52, 8, 9, 0, 43, 49, 80, 81, 22], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0,... | 1 | 226 | 8 |
#include <iostream>
using namespace std;
int main() {
int a, b, i, j;
char map[102][102];
while (1) {
cin >> a >> b;
if (a + b == 0)
break;
for (i = 0; i < a; i++) {
for (j = 0; j < b; j++) {
cin >> map[i][j];
}
}
i = 0, j = 0;
while (1) {
if (map[i][j] =... | #include <iostream>
using namespace std;
int main() {
int a, b, i, j;
char map[102][102];
while (1) {
cin >> a >> b;
if (a + b == 0)
break;
for (i = 0; i < a; i++) {
for (j = 0; j < b; j++) {
cin >> map[i][j];
}
}
i = 0, j = 0;
while (1) {
if (map[i][j] =... | [["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]] | 1 | 294 | 2 |
#include <stdio.h>
int main() {
int i, j, w, h;
char c, m[101][101];
bool b[101][101], loop;
while (1) {
scanf("%d %d", &w, &h);
if (!w && !h)
break;
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
do {
scanf("%c", &c);
m[i][j] = c;
} while (c ==... | #include <stdio.h>
int main() {
int i, j, w, h;
char c, m[101][101];
bool b[101][101], loop;
while (1) {
scanf("%d %d", &h, &w);
if (!w && !h)
break;
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
do {
scanf("%c", &c);
m[i][j] = c;
} while (c ==... | [["-", 0, 1, 0, 2, 3, 4, 0, 66, 28, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 66, 28, 22]] | 1 | 313 | 4 |
def onTile tile, x, y
(0 <= x && x < tile[0].length) && (0 <= y && y < tile.length)
end
def onArrow tile, x, y
tile[y][x] == ">" || tile[y][x] == "<" || tile[y][x] == "^" || tile[y][x] == "v"
end
def createTile width, height
tile = Array.new
height.times do
tile << $stdin.gets.chomp.split("")
end
tile... | def onTile tile, x, y
(0 <= x && x < tile[0].length) && (0 <= y && y < tile.length)
end
def onArrow tile, x, y
tile[y][x] == ">" || tile[y][x] == "<" || tile[y][x] == "^" || tile[y][x] == "v"
end
def createTile width, height
tile = Array.new
height.times do
tile << $stdin.gets.chomp.split("")
end
tile... | [["-", 36, 36, 0, 493, 0, 662, 31, 761, 0, 22], ["+", 36, 36, 0, 493, 0, 662, 31, 761, 0, 22]] | 4 | 330 | 2 |
loop do
w, h = gets.chomp.split.map(&:to_i)
break if [w, h].all?(&:zero?)
tile_map = Array.new
h.times do |i|
tile_map[i] = gets.chomp.split('')
end
x = y = 0
tile_already_arrived = Array.new
h.times { tile_already_arrived << Array.new(w, false) }
is_loop = false
while true
tile = tile_map[y][x]
if t... | loop do
h, w = gets.chomp.split.map(&:to_i)
break if [w, h].all?(&:zero?)
tile_map = Array.new
h.times do |i|
tile_map[i] = gets.chomp.split('')
end
x = y = 0
tile_already_arrived = Array.new
h.times { tile_already_arrived << Array.new(w, false) }
is_loop = false
while true
tile = tile_map[y][x]
if t... | [["-", 196, 737, 8, 736, 0, 662, 31, 761, 0, 22], ["-", 196, 737, 8, 736, 0, 662, 31, 761, 0, 21], ["+", 196, 737, 8, 736, 0, 662, 31, 761, 0, 21], ["+", 196, 737, 8, 736, 0, 662, 31, 761, 0, 22]] | 4 | 190 | 4 |
loop do
h, w = gets.chomp.split.map(&:to_i)
break if [h, w].all?(&:zero?)
tile_map = tile_already_arrived = Array.new
h.times do
tile_map << gets.chomp.split('')
tile_already_arrived << Array.new(w, false)
end
x = y = 0
while true
tile_present = tile_map[y][x]
if tile_already_arrived[y][x] == true
... | loop do
h, w = gets.chomp.split.map(&:to_i)
break if [h, w].all?(&:zero?)
tile_map = Array.new
tile_already_arrived = Array.new
h.times do
tile_map << gets.chomp.split('')
tile_already_arrived << Array.new(w, false)
end
x = y = 0
while true
tile_present = tile_map[y][x]
if tile_already_arrived[y][x... | [["+", 196, 737, 8, 736, 0, 662, 12, 652, 486, 743], ["+", 196, 737, 8, 736, 0, 662, 12, 652, 17, 131], ["+", 196, 737, 8, 736, 0, 662, 12, 652, 735, 22]] | 4 | 157 | 20 |
import sys
import math
def decide_move(x,y,tile,check):
if tile == '<':
x -= 1
check[x][y] += 1
return x,y,check
elif tile == '>':
x += 1
check[x][y] += 1
return x,y,check
elif tile == '^':
y -= 1
check[x][y] += 1
return x,y,check
else:
y += 1
check[x][y] += 1
return x,y,check
while True:... | import sys
import math
def decide_move(x,y,tile,check):
if tile == '<':
y -= 1
check[x][y] += 1
return x,y,check
elif tile == '>':
y += 1
check[x][y] += 1
return x,y,check
elif tile == '^':
x -= 1
check[x][y] += 1
return x,y,check
else:
x += 1
check[x][y] += 1
return x,y,check
while True:... | [["-", 0, 57, 64, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 31, 22], ["-", 75, 665, 64, 196, 0, 1, 0, 677, 31, 22], ["+", 75, 665, 64, 196, 0, 1, 0, 677, 31, 22], ["-", 75, 76, 8, 196, 0, 1, 0, 677, 31, 22], ["+", 75, 76, 8, 196, 0, 1, 0, 677, 31, 22]] | 5 | 264 | 8 |
DIR = {">": (0, 1), "<": (0, -1), "^": (-1, 0), "v": (1, 0)}
while True:
w, h = m(int, input().split())
if w == 0 and h == 0:
break
m = []
for i in range(w):
m.append([c for c in input().strip()])
x = 0
y = 0
while m[x][y] != '.':
i = m[x][y]
if i == 'x':
... | DIR = {">": (0, 1), "<": (0, -1), "^": (-1, 0), "v": (1, 0)}
while True:
w, h = list(map(int, input().split()))
if w == 0 and h == 0:
break
m = []
for i in range(w):
m.append([c for c in input().strip()])
x = 0
y = 0
while m[x][y] != '.':
i = m[x][y]
if i =... | [["-", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 662, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]] | 5 | 205 | 5 |
import java.util.PriorityQueue;
import java.util.Scanner;
public class Main {
static class Dic implements Comparable<Dic> {
String moji;
int page;
Dic(String moji, int page) {
this.moji = moji;
this.page = page;
}
public int compareTo(Dic d) {
if (this.moji == d.moji) {
... | import java.util.PriorityQueue;
import java.util.Scanner;
public class Main {
static class Dic implements Comparable<Dic> {
String moji;
int page;
Dic(String moji, int page) {
this.moji = moji;
this.page = page;
}
public int compareTo(Dic d) {
if (this.moji.equals(d.moji)) {
... | [["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 60], ["+", 8, 196, 0, 57, 15, 15, 0, 492, 0, 131], ["+", 8, 196, 0, 57, 15, 15, 0, 492, 141, 22], ["+", 0, 57, 15, 15, 0, 492, 3, 4, 0, 24], ["+", 0, 195, 8, 196, 0, 57, 15, 15, 0, 25], ["-", 0, 57, 64, 196, 0, 1, 0, 492, 141, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 492, 141, 22]] | 3 | 345 | 7 |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.TreeMap;
public class Main {
public static void main(String[] args) {
try {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String l... |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.TreeMap;
public class Main {
public static void main(String[] args) {
try {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String l... | [["-", 0, 1, 0, 492, 500, 492, 3, 4, 0, 22], ["+", 0, 1, 0, 492, 500, 492, 3, 4, 0, 22], ["-", 0, 492, 3, 4, 0, 492, 3, 4, 0, 22], ["+", 0, 492, 3, 4, 0, 492, 3, 4, 0, 22]] | 3 | 344 | 4 |
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.TreeMap;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
Map<String, List<Integ... |
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.TreeMap;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
Map<String, List<Integ... | [["+", 0, 52, 8, 196, 0, 57, 64, 196, 0, 46], ["-", 0, 52, 8, 196, 0, 57, 64, 196, 0, 46]] | 3 | 284 | 2 |
#include <bits/stdc++.h>
using namespace std;
int main(void) {
pair<string, int> t[1010];
int i;
for (i = 0; cin >> t[i].first >> t[i].second; i++)
;
sort(t, t + i);
cout << t[0].first << "\n";
cout << t[1].second;
for (int j = 1; j < i; j++) {
if (t[j - 1].first == t[j].first) {
cout << " "... | #include <bits/stdc++.h>
using namespace std;
int main(void) {
pair<string, int> t[1010];
int i;
for (i = 0; cin >> t[i].first >> t[i].second; i++)
;
sort(t, t + i);
cout << t[0].first << "\n";
cout << t[0].second;
for (int j = 1; j < i; j++) {
if (t[j - 1].first == t[j].first) {
cout << " "... | [["-", 0, 16, 12, 118, 28, 69, 341, 342, 0, 13], ["+", 0, 16, 12, 118, 28, 69, 341, 342, 0, 13]] | 1 | 170 | 2 |
#include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <string>
#include <vector>
using namespace std;
#define INF 1 << 20
struct edge {
int to;
int cost;
edge(){};
edge(int a, int b) {
to = a;
cost = b;
}
};
struct Node {
int pos;
int cost;
Node(){... | #include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <string>
#include <vector>
using namespace std;
#define INF 1 << 20
struct edge {
int to;
int cost;
edge(){};
edge(int a, int b) {
to = a;
cost = b;
}
};
struct Node {
int pos;
int cost;
Node(){... | [["-", 8, 9, 0, 57, 15, 339, 51, 11, 17, 32], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60]] | 1 | 1,143 | 2 |
#include <bits/stdc++.h>
using namespace std;
pair<string, int> a[100];
int main() {
int t = 0, g;
string f;
while (cin >> a[t].first >> a[t].second)
t++;
sort(a, a + t);
cout << a[0].first << endl << a[0].second;
for (int i = 1; i < t; i++) {
bool n;
f = a[i].first, g = a[i].second;
if (i)
... | #include <bits/stdc++.h>
using namespace std;
pair<string, int> a[100];
int main() {
int t = 0, g;
string f;
while (cin >> a[t].first >> a[t].second)
t++;
sort(a, a + t);
cout << a[0].first << endl << a[0].second;
for (int i = 1; i < t; i++) {
bool n = 0;
f = a[i].first, g = a[i].second;
if ... | [["+", 0, 7, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 7, 8, 9, 0, 43, 49, 50, 51, 13]] | 1 | 169 | 25 |
#define scanf_s scanf
//#define sscanf_s sscanf
//#define gets_s gets
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
using namespace std;
#define MAX 1001
#define _MAX 100
#define HO 6
int main(void) {
char str[MAX];
string word[_MAX];
int pa[_MAX], rank[_MAX], cou, a;
for (cou = 0; ... | #define scanf_s scanf
//#define sscanf_s sscanf
//#define gets_s gets
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
using namespace std;
#define MAX 1001
#define _MAX 100
#define HO 6
int main(void) {
char str[MAX];
string word[_MAX];
int pa[_MAX], rank[_MAX], cou, a;
for (cou = 0; ... | [["-", 0, 7, 15, 16, 31, 2, 3, 4, 0, 22], ["-", 0, 7, 15, 16, 31, 2, 3, 4, 0, 21]] | 1 | 409 | 2 |
#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; ... | [["+", 0, 9, 0, 57, 15, 339, 51, 27, 17, 29]] | 1 | 211 | 1 |
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define vi vector<int>
#define vvi vector<vector<int>>
#define ll long long int
#define vl vector<ll>
#def... | #include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define vi vector<int>
#define vvi vector<vector<int>>
#define ll long long int
#define vl vector<ll>
#def... | [["-", 8, 9, 0, 1, 0, 16, 12, 5, 0, 62], ["-", 8, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 7, 8, 9, 0, 1, 0, 16, 12, 22]] | 1 | 246 | 4 |
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
int main() {
std::string s;
int p;
std::map<std::string, std::vector<int>> m;
while (std::cin >> s >> p, !std::cin.eof()) {
m[s].push_back(p);
}
std::map<std::string, std::vector<int>>::iterator m_it = m.begin();
while (m_it !=... | #include <algorithm>
#include <iostream>
#include <map>
#include <vector>
int main() {
std::string s;
int p;
std::map<std::string, std::vector<int>> m;
while (std::cin >> s >> p, !std::cin.eof()) {
m[s].push_back(p);
}
std::map<std::string, std::vector<int>>::iterator m_it = m.begin();
while (m_it !=... | [["-", 0, 1, 0, 41, 15, 23, 0, 16, 17, 79], ["+", 0, 1, 0, 41, 15, 23, 0, 16, 17, 60]] | 1 | 235 | 2 |
#include <algorithm>
#include <iostream>
#include <list>
#include <map>
#include <string>
#include <vector>
using namespace std;
int main() {
string strInput;
map<string, vector<int>> index;
int intInput = 0;
while (cin >> strInput >> intInput) {
index[strInput].push_back(intInput);
}
for (map<string... | #include <algorithm>
#include <iostream>
#include <list>
#include <map>
#include <string>
#include <vector>
using namespace std;
int main() {
string strInput;
map<string, vector<int>> index;
int intInput = 0;
while (cin >> strInput >> intInput) {
index[strInput].push_back(intInput);
}
for (map<string... | [["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35]] | 1 | 228 | 2 |
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
int main() {
map<string, vector<int>> in;
string goku;
int id;
while (cin >> goku >> id) {
in[goku].push_back(id);
}
for (map<string, vector<int>>::iterator it = in.begin(); it != in.end();
it++) {
... | #include <algorithm>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
int main() {
map<string, vector<int>> in;
string goku;
int id;
while (cin >> goku >> id) {
in[goku].push_back(id);
}
for (map<string, vector<int>>::iterator it = in.begin(); it != in.end();
it++) {
... | [["-", 8, 9, 0, 1, 0, 16, 12, 5, 0, 62], ["-", 8, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 0, 7, 8, 9, 0, 1, 0, 16, 12, 22]] | 1 | 192 | 4 |
data_hash = Hash.new([])
while data = gets do
if data == nil
break
end
word, page = data.chomp.split
data_hash[word] += [page.to_i]
end
data_hash.sort.each do |word, page|
puts word
puts page.sort
end | data_hash = Hash.new([])
while data = gets do
if data == nil
break
end
word, page = data.chomp.split
data_hash[word] += [page.to_i]
end
data_hash.sort.each do |word, page|
puts word
puts page.sort.join(' ')
end | [["+", 8, 736, 0, 652, 3, 4, 0, 652, 17, 131], ["+", 8, 736, 0, 652, 3, 4, 0, 652, 735, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 62], ["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]] | 4 | 58 | 7 |
hash = {}
while gets != nil
word, page = gets.split
if hash[word] == nil
hash[word] = [page.to_i]
else
hash[word] << page.to_i
end
end
hash.values.each {|item| item.sort!}
hash = Hash[hash.sort]
hash.each {|k, v| puts k, v.join(" ")} | hash = {}
while (str = gets) != nil
word, page = str.split
if hash[word] == nil
hash[word] = [page.to_i]
else
hash[word] << page.to_i
end
end
hash.values.each {|item| item.sort!}
hash = Hash[hash.sort]
hash.each {|k, v| puts k, v.join(" ")} | [["+", 0, 493, 0, 89, 15, 738, 31, 739, 0, 24], ["+", 0, 89, 15, 738, 31, 739, 0, 662, 31, 22], ["+", 0, 89, 15, 738, 31, 739, 0, 662, 0, 32], ["+", 0, 493, 0, 89, 15, 738, 31, 739, 0, 25], ["-", 0, 89, 8, 170, 0, 662, 12, 652, 486, 22], ["+", 0, 89, 8, 170, 0, 662, 12, 652, 486, 22]] | 4 | 85 | 6 |
hash = Hash.new {|hash, key| hash[key] = []}
while (str = gets) != nil
word, page = gets.split
hash[word] << page.to_i
end
hash.values.each {|item| item.sort!}
hash = Hash[hash.sort]
hash.each {|k, v| puts k, v.join(" ")} | hash = Hash.new {|hash, key| hash[key] = []}
while (str = gets) != nil
word, page = str.split
hash[word] << page.to_i
end
hash.values.each {|item| item.sort!}
hash = Hash[hash.sort]
hash.each {|k, v| puts k, v.join(" ")} | [["-", 0, 89, 8, 170, 0, 662, 12, 652, 486, 22], ["+", 0, 89, 8, 170, 0, 662, 12, 652, 486, 22]] | 4 | 85 | 2 |
index=Hash.new{|word,page| word[page] = []}
while line =gets do
word,page= line.split(" ")
page =page.to_i
index[word]<<page
end
p index
index.each{|word,page|page.sort!}
index2=index.sort
index2.each{|key,value|
puts key
puts value.join(" ")
} | index=Hash.new{|word,page| word[page] = []}
while line =gets do
word,page= line.split(" ")
page =page.to_i
index[word]<<page
end
index.each{|word,page|page.sort!}
index2=index.sort
index2.each{|key,value|
puts key
puts value.join(" ")
} | [["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["-", 36, 36, 0, 493, 0, 652, 3, 4, 0, 22]] | 4 | 89 | 2 |
cat rb.rb
hash = Hash.new([])
while true do
line = gets
break if line == nil
line.chomp
word, page = line.split(' ')
hash[word] += [page.to_i]
end
arr = hash.sort
arr.each do |w|
puts w[0]
w[1].sort!
puts w[1].join(' ')
end | hash = Hash.new([])
while true do
line = gets
break if line == nil
line.chomp
word, page = line.split(' ')
hash[word] += [page.to_i]
end
arr = hash.sort
arr.each do |w|
puts w[0]
w[1].sort!
puts w[1].join(' ')
end | [["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["-", 0, 493, 0, 652, 3, 4, 0, 652, 486, 22], ["-", 0, 493, 0, 652, 3, 4, 0, 652, 17, 131], ["-", 0, 493, 0, 652, 3, 4, 0, 652, 735, 22]] | 4 | 86 | 4 |
dic = {}
while True:
try:
word,PageNum = input().split()
if word not in dic:
dic[word] = []
dic[word].append(PageNum)
else:
dic[word].append(PageNum)
except:
break
for k,v in sorted(dic.items()):
print(k)
print(" ".join(map(str,sorted... | dic = {}
while True:
try:
word,PageNum = input().split()
if word not in dic:
dic[word] = []
dic[word].append(int(PageNum))
else:
dic[word].append(int(PageNum))
except:
break
for k,v in sorted(dic.items()):
print(k)
print(" ".join(map(... | [["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24]] | 5 | 93 | 6 |
dic = {}
while True:
try:
word, pgn = input().split()
if word in dic.keys():
dic[word].append(int(pgn))
else:
dic[word] = [int(pgn)]
except:
break
for k, v in dic.items():
print(k)
print(' '.join(map(str, sorted(v)))) | dic = {}
while True:
try:
word, pgn = input().split()
if word in dic.keys():
dic[word].append(int(pgn))
else:
dic[word] = [int(pgn)]
except:
break
for k, v in sorted(dic.items()):
print(k)
print(' '.join(map(str, sorted(v)))) | [["+", 36, 36, 0, 656, 0, 7, 12, 652, 63, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]] | 5 | 91 | 3 |
index = {}
while True:
try:
w, p = list(map(str, input().split()))
index.setdefault(w,[]).append(int(p))
except:
break
for k,v in sorted(index.items()):
print(k)
print(" ".join(map(str, v))) | index = {}
while True:
try:
w, p = list(map(str, input().split()))
index.setdefault(w,[]).append(int(p))
except:
break
for k,v in sorted(index.items()):
print(k)
print(" ".join(map(str, sorted(v)))) | [["+", 3, 4, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]] | 5 | 82 | 3 |
function main() {
function howMuch(gram) {
var i, j, w, g, c, p, min, _pat, pat = [ [ 0, [] ] ];
for (i = 0; i < 3; i++) {
w = [ 200, 300, 500 ][i];
_pat = [];
while (p = pat.shift()) {
g = p[0];
c = p[1];
for (j = 0; j * w + g <= gram; j++) {
_pat.push([ j ... | function main() {
function howMuch(gram) {
var i, j, w, g, c, p, min, _pat, pat = [ [ 0, [] ] ];
for (i = 0; i < 3; i++) {
w = [ 200, 300, 500 ][i];
_pat = [];
while (p = pat.shift()) {
g = p[0];
c = p[1];
for (j = 0; j * w + g <= gram; j++) {
_pat.push([ j ... | [["-", 8, 556, 0, 57, 15, 23, 0, 16, 17, 18], ["+", 8, 556, 0, 57, 15, 23, 0, 16, 17, 566]] | 2 | 464 | 2 |
import java.util.Scanner;
// Discounts of Buckwheat
public class Main {
static int[] m = {200, 300, 500};
static int[] p = {380, 550, 850};
static int[] d = {5, 4, 3};
static double[] r = {0.8, 0.85, 0.88};
static int min;
static void dfs(int k, int rest, double x) {
if (rest <= 0) {
min = (in... | import java.util.Scanner;
// Discounts of Buckwheat
public class Main {
static int[] m = {200, 300, 500};
static int[] p = {380, 550, 850};
static int[] d = {5, 4, 3};
static double[] r = {0.8, 0.85, 0.88};
static int min;
static void dfs(int k, int rest, double x) {
if (rest == 0) {
min = (in... | [["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 19], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 60], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 106], ["+", 0, 57, 15, 15, 0, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 15, 0, 16, 12, 16, 17, 18], ["+", 0, 57, 15, 15, 0, 16, 12, 16, 12, 499]] | 3 | 259 | 6 |
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n;
int min;
while (true) {
n = sc.nextInt();
if (n == 0) {
break;
}
min = Integer.MAX_VALUE;
for (int i = 0; i < 100; i++) {
f... | import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n;
int min;
while (true) {
n = sc.nextInt();
if (n == 0) {
break;
}
min = Integer.MAX_VALUE;
for (int i = 0; i < 100; i++) {
f... | [["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 19], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 60]] | 3 | 223 | 2 |
a[6] = {2, 3, 5, 10, 12, 15}, b[6] = {380, 550, 850, 1520, 1870, 2244}, m[51];
main(n, d, T) {
for (n = 2; n < 51; n++)
for (m[n] = 9999, d = 5; ~d; d--)
if (a[d] <= n && m[n] > (T = m[n - a[d]] + b[d]))
m[n] = T;
for (; scanf("%d", &n), n;)
printf("%d\n", m[n / 100]);
exit(0);
} | a[] = {2, 3, 5, 10, 12, 15}, b[] = {380, 550, 850, 1520, 1870, 2244}, m[51];
main(n, d, T) {
for (n = 1; n < 51; n++)
for (m[n] = 9999, d = 5; ~d; d--)
if (a[d] <= n && m[n] > (T = m[n - a[d]] + b[d]))
m[n] = T;
for (; scanf("%d", &n), n;)
printf("%d\n", m[n / 100]);
exit(0);
} | [["-", 36, 36, 0, 30, 0, 42, 0, 69, 71, 13], ["+", 0, 30, 0, 42, 0, 69, 0, 70, 0, 22], ["-", 12, 34, 12, 34, 31, 11, 31, 69, 71, 13], ["+", 12, 34, 31, 11, 31, 69, 0, 70, 0, 22], ["-", 0, 9, 0, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 9, 0, 9, 0, 7, 10, 11, 12, 13]] | 0 | 163 | 27 |
#include <stdio.h>
#define A_MAX 25 // A店25*200=5000
#define B_MAX 16 // B店16*300=4800
#define C_MAX 10 // C店10*500=5000
#define A_PRICE 380 // A店のそば粉1袋の金額
#define B_PRICE 550 // B店のそば粉1袋の金額
#define C_PRICE 850 // C店のそば粉1袋の金額
#define A_QUANT 200 // A店の1袋辺りの内容量
#define B_QUANT 300 // B店の1袋辺りの内容量
#define C_QUANT 500 /... | #include <stdio.h>
#define A_MAX 25 // A店25*200=5000
#define B_MAX 16 // B店16*300=4800
#define C_MAX 10 // C店10*500=5000
#define A_PRICE 380 // A店のそば粉1袋の金額
#define B_PRICE 550 // B店のそば粉1袋の金額
#define C_PRICE 850 // C店のそば粉1袋の金額
#define A_QUANT 200 // A店の1袋辺りの内容量
#define B_QUANT 300 // B店の1袋辺りの内容量
#define C_QUANT 500 /... | [["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 9, 0, 52, 8, 9, 0, 1, 0, 35]] | 0 | 348 | 4 |
#include <iostream>
using namespace std;
int w;
main() {
while (cin >> w, w) {
int ans = 1e9;
w /= 100;
for (int i = 0; i < 51; i++)
for (int j = 0; j < 51; j++)
for (int k = 0; k < 51; k++) {
if (i * 2 + j * 3 + k * 5 < w)
continue;
int now = i / 5 * 5 * 38 *... | #include <iostream>
using namespace std;
int w;
main() {
while (cin >> w, w) {
int ans = 1e9;
w /= 100;
for (int i = 0; i < 51; i++)
for (int j = 0; j < 51; j++)
for (int k = 0; k < 51; k++) {
if (i * 2 + j * 3 + k * 5 != w)
continue;
int now = i / 5 * 5 * 38 ... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79]] | 1 | 160 | 2 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
int bw[][2] = {{2, 380}, {3, 550}, {5, 850},
{10, 1520}, {12, 1870}, {15, 2244}};
int dp[51] = {0};
for (int i = 0; i < 51; ++i) {
dp[i] = 1e+9;
}
for (int i = 0; i < 51; ++i) {
for (int j = 0; j < 6; ++j) {
... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
int bw[][2] = {{2, 380}, {3, 550}, {5, 850},
{10, 1520}, {12, 1870}, {15, 2244}};
int dp[51] = {0};
for (int i = 1; i < 51; ++i) {
dp[i] = 1e+9;
}
for (int i = 0; i < 51; ++i) {
for (int j = 0; j < 6; ++j) {
... | [["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]] | 1 | 200 | 2 |
#include <bits/stdc++.h>
using namespace std;
/* template {{{ */
/* vim: set foldmethod=marker: */
/* Roadagain {{{ */
/****************************************************************************************/
/* */
/* ... | #include <bits/stdc++.h>
using namespace std;
/* template {{{ */
/* vim: set foldmethod=marker: */
/* Roadagain {{{ */
/****************************************************************************************/
/* */
/* ... | [["-", 0, 338, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 338, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]] | 1 | 770 | 4 |
#include <iostream>
using namespace std;
//?????????
#define AG 200
#define BG 300
#define CG 500
//?????????
#define AM 380
#define BM 550
#define CM 850
//??????????????????
#define AN 5
#define BN 4
#define CN 3
//??????????????????
#define AP 20
#define BP 15
#define CP 12
int main() {
int g;
int a, b, c;
i... | #include <iostream>
using namespace std;
//?????????
#define AG 200
#define BG 300
#define CG 500
//?????????
#define AM 380
#define BM 550
#define CM 850
//??????????????????
#define AN 5
#define BN 4
#define CN 3
//??????????????????
#define AP 20
#define BP 15
#define CP 12
int main() {
int g;
int a, b, c;
i... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 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, 106], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 47]] | 1 | 286 | 6 |
#include <algorithm>
#include <stdio.h>
using namespace std;
int n, ret;
int main() {
while (true) {
scanf("%d", &n);
if (n == 0)
break;
ret = 999999999;
for (int a = 0; a <= 13; a++) {
for (int b = 0; b <= 9; b++) {
for (int c = 0; c <= 5; c++) {
int value = a * 200 + b ... | #include <algorithm>
#include <stdio.h>
using namespace std;
int n, ret;
int main() {
while (true) {
scanf("%d", &n);
if (n == 0)
break;
ret = 999999999;
for (int a = 0; a <= 25; a++) {
for (int b = 0; b <= 16; b++) {
for (int c = 0; c <= 10; c++) {
int value = a * 200 + ... | [["-", 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], ["-", 31, 16, 31, 16, 12, 16, 31, 16, 17, 48], ["+", 3, 4, 0, 16, 31, 16, 31, 16, 17, 72]] | 1 | 186 | 8 |
#include <bits/stdc++.h>
#define mk make_pair
using namespace std;
int sum;
set<pair<pair<int, int>, int>> s;
void dfs(int a, int b, int c, int n) {
if (s.count(mk(mk(a, b), c)))
return;
s.insert(mk(mk(a, b), c));
if (n == 0) {
int aa = 0, bb = 0, cc = 0;
if (a >= 5)
aa = a / 5 * 1520;
if (b... | #include <bits/stdc++.h>
#define mk make_pair
using namespace std;
int sum;
set<pair<pair<int, int>, int>> s;
void dfs(int a, int b, int c, int n) {
if (s.count(mk(mk(a, b), c)))
return;
s.insert(mk(mk(a, b), c));
if (n == 0) {
int aa = 0, bb = 0, cc = 0;
if (a >= 5)
aa = a / 5 * 1520;
if (b... | [["+", 8, 9, 0, 52, 15, 339, 51, 34, 0, 21], ["+", 8, 9, 0, 52, 15, 339, 51, 34, 12, 22]] | 1 | 293 | 2 |
// 0-1 knapsack
#include <cstring>
#include <iostream>
using namespace std;
const int INF = (1 << 21);
int main() {
int w[7] = {0, 2, 3, 5, 10, 12, 15};
int c[7] = {0, 380, 500, 850, 1520, 1870, 2244};
int dp[7][51] = {};
for (int i = 0; i < 7; i++) {
for (int j = 1; j < 51; j++) {
dp[i][j] = INF;
... | // 0-1 knapsack
#include <cstring>
#include <iostream>
using namespace std;
const int INF = (1 << 21);
int main() {
int w[7] = {0, 2, 3, 5, 10, 12, 15};
int c[7] = {0, 380, 550, 850, 1520, 1870, 2244};
int dp[7][51] = {};
for (int i = 0; i < 7; i++) {
for (int j = 1; j < 51; j++) {
dp[i][j] = INF;
... | [["-", 8, 9, 0, 43, 49, 50, 51, 83, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 13]] | 1 | 258 | 2 |
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include... | #include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include... | [["-", 28, 69, 28, 69, 341, 342, 0, 16, 12, 13], ["+", 28, 69, 28, 69, 341, 342, 0, 16, 12, 13]] | 1 | 448 | 2 |
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <string>
using namespace std;
int n;
int main() {
while (cin >> n) {
if (n == 0)
return 0;
int ans = 9999;
for (int i = 0; i < 26; i++)
for (int j = 0; j < ... | #include <algorithm>
#include <cctype>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <string>
using namespace std;
int n;
int main() {
while (cin >> n) {
if (n == 0)
return 0;
int ans = 9999;
for (int i = 0; i < 26; i++)
for (int j = 0; j < ... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60]] | 1 | 199 | 2 |
#include <algorithm>
#include <climits>
#include <iostream>
using namespace std;
int priceA(int amount) {
if (amount % 200 != 0) {
return -1;
}
amount /= 200;
return (amount / 5 * 5) * 380 * 80 / 100 + (amount % 5) * 380;
}
int priceB(int amount) {
if (amount % 300 != 0) {
return -1;
}
amount /=... | #include <algorithm>
#include <climits>
#include <iostream>
using namespace std;
int priceA(int amount) {
if (amount % 200 != 0) {
return -1;
}
amount /= 200;
return (amount / 5 * 5) * 380 * 80 / 100 + (amount % 5) * 380;
}
int priceB(int amount) {
if (amount % 300 != 0) {
return -1;
}
amount /=... | [["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]] | 1 | 303 | 2 |
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
using nam... | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
using nam... | [["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60]] | 1 | 393 | 2 |
data=[]
while True:
n = int(input())
if n==0:
break
for i in range(n):
spam=list(map(int,input().split()))
spam.append(sum(spam))
data.append(spam)
spam=[]
for i in range(n+1):
spam.append(sum(x[i] for x in data))
data.append(spam)
for i in range(n+1):... | while True:
data=[]
n = int(input())
if n==0:
break
for i in range(n):
spam=list(map(int,input().split()))
spam.append(sum(spam))
data.append(spam)
spam=[]
for i in range(n+1):
spam.append(sum(x[i] for x in data))
data.append(spam)
for i in range(n... | [["+", 36, 36, 36, 36, 0, 656, 0, 52, 0, 89], ["+", 36, 36, 36, 36, 0, 656, 0, 52, 15, 146], ["+", 36, 36, 36, 36, 0, 656, 0, 52, 0, 102], ["-", 36, 36, 36, 36, 0, 656, 0, 52, 0, 89], ["-", 36, 36, 36, 36, 0, 656, 0, 52, 15, 146], ["-", 36, 36, 36, 36, 0, 656, 0, 52, 0, 102]] | 5 | 144 | 6 |
n = int(input())
while n != 0:
input_list = []
for x in range(n):
input_list.append(list(map(int, input().split(' '))))
for x in range(n):
input_list[x].append(sum(input_list[x]))
print(''.join(["{:>5}".format(n) for n in input_list]))
input_len = len(input_list[0])
column_l... | n = int(input())
while n != 0:
input_list = []
for x in range(n):
input_list.append(list(map(int, input().split(' '))))
for x in range(n):
input_list[x].append(sum(input_list[x]))
print(''.join(["{:>5}".format(n) for n in input_list[x]]))
input_len = len(input_list[0])
colum... | [["+", 3, 4, 0, 658, 0, 659, 12, 206, 0, 70], ["+", 3, 4, 0, 658, 0, 659, 12, 206, 206, 22], ["+", 3, 4, 0, 652, 3, 4, 0, 658, 0, 73]] | 5 | 172 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.