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 <cctype> #include <cstdio> #include <cstdlib> #include <iostream> #include <sstream> #include <string> #include <vector> using namespace std; #define REP(i, j) for (int i = 0; i < j; i++) int cal(vector<double> &v, string op) { int right = v[v.size() - 1]; int left = v[v.size() - 2]; v.pop_back(); v.p...
#include <cctype> #include <cstdio> #include <cstdlib> #include <iostream> #include <sstream> #include <string> #include <vector> using namespace std; #define REP(i, j) for (int i = 0; i < j; i++) double cal(vector<double> &v, string op) { double right = v[v.size() - 1]; double left = v[v.size() - 2]; v.pop_back...
[["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
272
6
#include <cctype> #include <cstdio> #include <cstdlib> #include <iostream> #include <stack> using namespace std; stack<double> st; int solve(char s) { double a, b; b = st.top(); st.pop(); a = st.top(); st.pop(); if (s == '+') return (a + b); else if (s == '-') return (a - b); else if (s == '*'...
#include <cctype> #include <cstdio> #include <cstdlib> #include <iostream> #include <stack> using namespace std; stack<double> st; double solve(char s) { double a, b; b = st.top(); st.pop(); a = st.top(); st.pop(); if (s == '+') return (a + b); else if (s == '-') return (a - b); else if (s == ...
[["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40]]
1
287
2
#include <cstdio> #include <cstdlib> #include <iostream> #include <sstream> #include <stack> #include <string> using namespace std; stack<double> s; int calc(string str) { int x = s.top(); s.pop(); int y = s.top(); s.pop(); switch (str[0]) { case '+': return x + y; case '-': return y - x; cas...
#include <cstdio> #include <cstdlib> #include <iostream> #include <sstream> #include <stack> #include <string> using namespace std; stack<double> s; double calc(string str) { double x = s.top(); s.pop(); double y = s.top(); s.pop(); switch (str[0]) { case '+': return x + y; case '-': return y -...
[["-", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
222
6
while _ = $stdin.gets stack = [] terms = _.chomp.split(/ /) terms.each do |t| case t when /^\A\d+\z/ stack << t.to_i when '+' stack << stack.pop(2).inject(:+) when '-' stack << stack.pop(2).inject(:-) when '/' stack << stack.pop(2).inject(:/) when '*' stack <<...
while _ = $stdin.gets stack = [] terms = _.chomp.split(/ /) terms.each do |t| case t when /^\A-?\d+\z/ stack << t.to_f when '+' stack << stack.pop(2).inject(:+) when '-' stack << stack.pop(2).inject(:-) when '/' stack << stack.pop(2).inject(:/) when '*' stack ...
[["+", 0, 173, 0, 763, 374, 374, 0, 575, 0, 6], ["-", 0, 763, 8, 749, 0, 738, 12, 652, 735, 22], ["+", 0, 763, 8, 749, 0, 738, 12, 652, 735, 22]]
4
126
3
$<.each do |line| stack = line.chomp.split #逆ポーランド記法 n = stack.inject([]) do |s, x| x =~ /[0-9]/ ? s << x : s << eval(s.pop(2).join(x)) end puts sprintf("%.6f", n.first + 0) end
$<.each do |line| stack = line.chomp.split #逆ポーランド記法 n = stack.inject([]) do |s, x| x =~ /[0-9]/ ? s << x.to_f : s << eval(s.pop(2).join(x)) end puts sprintf("%.6f", n.first + 0) end
[["+", 8, 736, 0, 754, 64, 738, 12, 652, 17, 131], ["+", 8, 736, 0, 754, 64, 738, 12, 652, 735, 22]]
4
71
14
while str = gets do a = str.split(" ") b = Array.new a.each do |_a| begin b.push Integer(_a) rescue n1,n2 = b.pop,b.pop if _a == '+' b.push n2+n1 elsif _a == '-' b.push n2-n1 elsif _a == '*' b.push n2*n1 elsif _a == '/' b.push n2/n1 end end end puts b.pop.to_f end
while str = gets do a = str.split(" ") b = Array.new a.each do |_a| begin b.push Float(_a) rescue n1,n2 = b.pop,b.pop if _a == '+' b.push n2+n1 elsif _a == '-' b.push n2-n1 elsif _a == '*' b.push n2*n1 elsif _a == '/' b.push n2/n1 end end end puts b.pop end
[["-", 0, 756, 0, 652, 3, 4, 0, 652, 735, 743], ["+", 0, 756, 0, 652, 3, 4, 0, 652, 735, 743], ["-", 8, 170, 0, 652, 3, 4, 0, 652, 17, 131], ["-", 8, 170, 0, 652, 3, 4, 0, 652, 735, 22]]
4
105
4
#!/usr/bin/env python3 import sys def calc_inverse_polish_notation_string(s): tokens = [token for token in s.split(' ') if token != ''] stack = [] for token in tokens: if token in ['+', '-', '*', '/']: val2 = stack.pop() val1 = stack.pop() result = eval("%s %s ...
import sys def calc_inverse_polish_notation_string(s): tokens = [token for token in s.split(' ') if token != ''] stack = [] for token in tokens: if token in ['+', '-', '*', '/']: val2 = stack.pop() val1 = stack.pop() result = eval("%s %s %s" % (val1, token, val2...
[["+", 0, 652, 3, 4, 0, 652, 63, 319, 0, 131], ["+", 0, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
143
4
import sys for line in sys.stdin.readlines(): stack=[] for a in line.strip().split(): if a=="+": a=stack.pop()+stack.pop() elif a=="-": a=-(stack.pop()-stack.pop()) elif a=="*": a=stack.pop()*stack.pop() elif a=="/": a=stack.pop()/s...
import sys for line in sys.stdin.readlines(): stack=[] for a in line.strip().split(): if a=="+": a=stack.pop()+stack.pop() elif a=="-": a=-(stack.pop()-stack.pop()) elif a=="*": a=stack.pop()*stack.pop() elif a=="/": a=1.0/stack.pop...
[["+", 0, 1, 0, 662, 12, 657, 31, 657, 31, 531], ["+", 0, 1, 0, 662, 12, 657, 31, 657, 17, 85], ["-", 64, 196, 0, 1, 0, 662, 12, 657, 17, 85], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 17, 48]]
5
138
4
while True: stack = [] for s in input().split(): if s in ('+', '-', '*', '/'): stack.append(eval('{2}{1}{0}'.format(stack.pop(), s, stack.pop()))) else: stack.append(float(s)) print('%.6f' % stack.pop())
while True: try: stack = [] for s in input().split(): if s in ('+', '-', '*', '/'): stack.append(eval('{2}{1}{0}'.format(stack.pop(), s, stack.pop()))) else: stack.append(float(s)) print('%.6f' % stack.pop()) except EOFError: break
[["+", 0, 656, 0, 52, 8, 196, 0, 246, 0, 247], ["+", 0, 656, 0, 52, 8, 196, 0, 246, 0, 102], ["+", 0, 52, 8, 196, 0, 246, 0, 671, 0, 672], ["+", 0, 52, 8, 196, 0, 246, 0, 671, 0, 22], ["+", 0, 52, 8, 196, 0, 246, 0, 671, 0, 102], ["+", 0, 246, 0, 671, 0, 196, 0, 93, 0, 94]]
5
90
6
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Stack; public class Main { static int nowLoca = 1; public static void main(String args[]) { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try { String line; while ((line = br.readL...
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Stack; public class Main { static int nowLoca = 1; public static void main(String args[]) { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try { String line; while ((line = br.readL...
[["-", 49, 200, 51, 492, 3, 4, 0, 16, 31, 499], ["+", 49, 200, 51, 492, 3, 4, 0, 16, 31, 499], ["-", 51, 492, 3, 4, 0, 16, 31, 16, 31, 499], ["+", 51, 492, 3, 4, 0, 16, 31, 16, 31, 499], ["-", 49, 200, 51, 492, 3, 4, 0, 16, 12, 499], ["+", 49, 200, 51, 492, 3, 4, 0, 16, 12, 499]]
3
1,086
6
import java.io.*; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.Deque; import java.util.HashMap; import java.util.List; import java.util.NoSuchElementException; import java.util.Scanner; public class Main { ...
import java.io.*; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.Deque; import java.util.HashMap; import java.util.List; import java.util.NoSuchElementException; import java.util.Scanner; public class Main { ...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 12, 499], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 12, 499]]
3
1,348
2
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Scanner; public class Main { static final HashMap<Character, String> InMap = new HashMap<Character, String>() { { put(' ', "101"); put('\'', "00000...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Scanner; public class Main { static final HashMap<Character, String> InMap = new HashMap<Character, String>() { { put(' ', "101"); put('\'', "00000...
[["-", 8, 196, 0, 7, 15, 16, 12, 16, 12, 499], ["+", 8, 196, 0, 7, 15, 16, 12, 16, 12, 499]]
3
814
2
#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() { ll a, b...
#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() { ll a, b...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
83
2
#include <stdio.h> int main(void) { int a, b, S; scanf("%d", &a); scanf("%d", &b); S = a * b / 3.305785; printf("%d\n", S); return 0; }
#include <stdio.h> int main(void) { double a, b, S; scanf("%lf", &a); scanf("%lf", &b); S = a * b / 3.305785; printf("%lf\n", S); return 0; }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
57
8
#include <stdio.h> int main() { int a, b; double S; scanf("%d %d", &a, &b); S = (double)(a * b / 3.305785); printf("%lf, S"); return 0; }
#include <stdio.h> int main() { int a, b; double S; scanf("%d %d", &a, &b); S = (double)(a * b / 3.305785); printf("%lf", S); return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
52
4
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <string> #include <vector> #define ll long long #define LL long long #define ULL unsigned long long #define ull unsigned long long #define FOR(i, a, b) for (int i = a; i < b; i++) #define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i-...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <string> #include <vector> #define ll long long #define LL long long #define ULL unsigned long long #define ull unsigned long long #define FOR(i, a, b) for (int i = a; i < b; i++) #define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i-...
[["-", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96]]
1
109
1
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <iostream> #include <iterator> #include <list> #include <map> #include <queue> #include <...
#include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <iostream> #include <iterator> #include <list> #include <map> #include <queue> #include <...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
599
2
#include <cstdio> #include <iostream> using namespace std; int main() { double a, b; cin >> a >> b; printf("%.10lf\n", a * b / 113.437508); return 0; }
#include <cstdio> #include <iostream> using namespace std; int main() { double a, b; cin >> a >> b; printf("%.10f\n", a * b / 3.305785); return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
42
4
p eval(gets.split*?*)/3.30578
p eval(gets.split*?*)/3.305785
[["-", 0, 493, 0, 652, 3, 4, 0, 738, 12, 531], ["+", 0, 493, 0, 652, 3, 4, 0, 738, 12, 531]]
4
11
2
a,b = map(float,raw_input().split(' ')) print((a * b) / 3.305785)
a,b = map(float,input().split(' ')) print((a * b) / 3.305785)
[["-", 3, 4, 0, 652, 63, 319, 500, 652, 63, 22], ["+", 3, 4, 0, 652, 63, 319, 500, 652, 63, 22]]
5
29
2
#include <iostream> using namespace std; void solve() { int a, b; bool init = true; while (cin >> a >> b, a || b) { if (!init) { cout << endl; } init = false; bool ok = false; for (int i = a; i < b; ++i) { if ((i % 4 == 0 && i % 100 != 0) || i % 400 == 0) { cout << i << e...
#include <iostream> using namespace std; void solve() { int a, b; bool init = true; while (cin >> a >> b, a || b) { if (!init) { cout << endl; } init = false; bool ok = false; for (int i = a; i <= b; ++i) { if ((i % 4 == 0 && i % 100 != 0) || i % 400 == 0) { cout << i << ...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19]]
1
136
2
#include <cstdio> main() { int a, b, d = 0, c; while (scanf("%d%d", &a, &b), a) { if (d++) puts(""); c = 0; for (; a <= b; a++) if (a % 4 < 1) if (a % 25) c++, printf("%d\n", a); else if (a % 8 < 1) c++, printf("%d\n", a); if (!c) puts("NA"); }...
#include <cstdio> main() { int a, b, d = 0, c; while (scanf("%d%d", &a, &b), a) { if (d++) puts(""); c = 0; for (; a <= b; a++) if (a % 4 < 1) if (a % 25) c++, printf("%d\n", a); else if (a % 16 < 1) c++, printf("%d\n", a); if (!c) puts("NA"); ...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13]]
1
123
2
#include <cstdio> main() { int a, b, d = 0, c; while (scanf("%d%d", &a, &b), a) { if (d++) puts(""); c = 0; for (; a <= b; a++) if (a % 4 < 1) if (a % 25 || a % 16) c++, printf("%d\n", a); if (!c) puts("NA"); } }
#include <cstdio> main() { int a, b, d = 0, c; while (scanf("%d%d", &a, &b), a) { if (d++) puts(""); c = 0; for (; a <= b; a++) if (a % 4 < 1) if (a % 25 || a % 16 < 1) c++, printf("%d\n", a); if (!c) puts("NA"); } }
[["+", 64, 57, 15, 339, 51, 16, 12, 16, 17, 18], ["+", 64, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
105
20
#include <cstdio> main() { int a, b, c, d = 0; while (scanf("%d%d", &a, &b), a) { d++ &&puts(""); for (c = 0; a <= b; a++) if (a % 4 < 1 && a % 25 | a % 16) printf("%d\n", c = a); !c &&puts("NA"); } }
#include <cstdio> main() { int a, b, c, d = 0; while (scanf("%d%d", &a, &b), a) { d++ &&puts(""); for (c = 0; a <= b; a++) if (a % 4 < 1 && a % 25 | a % 16 < 1) printf("%d\n", c = a); !c &&puts("NA"); } }
[["+", 15, 339, 51, 16, 12, 16, 12, 16, 17, 18], ["+", 15, 339, 51, 16, 12, 16, 12, 16, 12, 13]]
1
97
2
#include <stdio.h> int main() { int a, b; scanf("%d%d", &a, &b); while (1) { int i, sum = 0; for (i = a; i <= b; i++) { if (i % 400 == 0) { printf("%d\n", i); sum++; } else if (i % 100 == 0) { continue; } else if (i % 4 == 0) { printf("%d\n", i); s...
#include <stdio.h> int main() { int a, b; scanf("%d%d", &a, &b); while (1) { int i, sum = 0; for (i = a; i <= b; i++) { if (i % 400 == 0) { printf("%d\n", i); sum++; } else if (i % 100 == 0) { continue; } else if (i % 4 == 0) { printf("%d\n", i); s...
[["+", 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
160
7
#include <iostream> using namespace std; void solve() { int a, b; bool firstFlag = true; while (cin >> a >> b) { if (a == 0 && b == 0) { break; } if (!firstFlag) { cout << endl; } bool existFlag = false; for (int i = a; i < b; ++i) { if (i % 4 == 0 && i % 100 != 0 || i ...
#include <iostream> using namespace std; void solve() { int a, b; bool firstFlag = true; while (cin >> a >> b) { if (a == 0 && b == 0) { break; } if (!firstFlag) { cout << endl; } bool existFlag = false; for (int i = a; i <= b; ++i) { if (i % 4 == 0 && i % 100 != 0 || i...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19]]
1
144
2
#include <cmath> #include <cstdio> #include <iostream> #include <queue> #include <stack> #include <string> #include <utility> using namespace std; int main() { int a; int b; bool first = true; while (cin >> a >> b, a * b) { if (first != true) { cout << endl; } else { first = false; } ...
#include <cmath> #include <cstdio> #include <iostream> #include <queue> #include <stack> #include <string> #include <utility> using namespace std; int main() { int a; int b; bool first = true; while (cin >> a >> b, a * b) { if (first != true) { cout << endl; } else { first = false; } ...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
163
2
#include <iostream> using namespace std; int main() { int a, b; bool flag = false; while (cin >> a >> b, a || b) { int ans = 0; if (flag) cout << endl; for (; a < b; a++) { if (a % 4 == 0 && (a % 100 != 0 || a % 400 == 0)) { cout << a << endl; ans++; } } i...
#include <iostream> using namespace std; int main() { int a, b; bool flag = false; while (cin >> a >> b, a || b) { int ans = 0; if (flag) cout << endl; for (; a <= b; a++) { if (a % 4 == 0 && (a % 100 != 0 || a % 400 == 0)) { cout << a << endl; ans++; } } ...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19]]
1
115
2
#include <stdio.h> int main() { int a, b, i, count = 0, s = 0; while (scanf("%d %d", &a, &b) != 0) { if (a == 0 || b == 0) break; if (s == 1) printf("\n"); for (i = a; i <= b; i++) { if (i % 400 == 0) { printf("%d\n", i); count = 1; } else if (i % 100 == 0) ...
#include <stdio.h> int main() { int a, b, i, count = 0, s = 0; while (scanf("%d %d", &a, &b) != 0) { if (a == 0 || b == 0) break; if (s == 1) printf("\n"); for (i = a; i <= b; i++) { if (i % 400 == 0) { printf("%d\n", i); count = 1; } else if (i % 100 == 0) ...
[["+", 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], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
163
4
// include //------------------------------------------ #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include...
// include //------------------------------------------ #include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19]]
1
438
2
require 'date' f=nil;while(a,b=gets.split.map(&:to_i))!=[0,0]do if f then puts end;f=1 z=a.step(b).select{|i|Date.new(i).leap?} if z.size==0 then puts'NA'else z.each{|e|p e}end end
require 'date' f=nil;while(a,b=gets.split.map(&:to_i))!=[0,0]do if f then puts end;f=1 z=a.step(b).select{|i|Date.leap?(i)} if z.size==0 then puts'NA'else z.each{|e|p e}end end
[["-", 196, 196, 8, 734, 0, 652, 486, 652, 735, 22], ["+", 12, 652, 196, 196, 8, 734, 0, 652, 735, 22], ["-", 12, 652, 196, 196, 8, 734, 0, 652, 17, 131], ["-", 12, 652, 196, 196, 8, 734, 0, 652, 735, 22]]
4
87
4
def isLeap(y): return y % 4 == 0 and (y != 100 or y == 400) flag2 = False while True: a,b = map(int,input().split()) if a == 0: break if flag2:print() flag2 = True flag = True for y in range(a,b + 1): if isLeap(y): print(y) flag = False if(flag):print("N...
def isLeap(y): return y % 4 == 0 and (y % 100 != 0 or y % 400 == 0) flag2 = False while True: a,b = map(int,input().split()) if a == 0: break if flag2:print() flag2 = True flag = True for y in range(a,b + 1): if isLeap(y): print(y) flag = False if(flag):...
[["-", 0, 679, 12, 23, 0, 679, 31, 666, 667, 79], ["+", 12, 23, 0, 679, 31, 666, 0, 657, 17, 109], ["+", 0, 679, 12, 23, 0, 679, 31, 666, 667, 79], ["+", 0, 679, 12, 23, 0, 679, 31, 666, 0, 612], ["-", 0, 679, 12, 23, 0, 679, 12, 666, 667, 60], ["+", 12, 23, 0, 679, 12, 666, 0, 657, 17, 109], ["+", 0, 679, 12, 23, 0, 6...
5
98
8
b=0 for e in iter(input,'0 0'): if b:print();b=1 s,t=map(int,e.split()) u=[y for y in range(s,t+1)if y%4==0 and y%100!=0 or y%400==0] if u: for y in u:print(y) else:print('NA')
b=0 for e in iter(input,'0 0'): if b:print() b=1 s,t=map(int,e.split()) u=[y for y in range(s,t+1)if y%4==0 and y%100!=0 or y%400==0] if u: for y in u:print(y) else:print('NA')
[["-", 0, 7, 8, 196, 0, 57, 64, 196, 0, 35]]
5
93
1
b=0 for e in iter(input,'0 0'): if b:print() b=u=1 s,t=map(int,e.split()) for y in range(s,t+1):y%4==0 and y%100!=0 or y%400==0 and print(y);u=0 if u:print('NA')
b=0 for e in iter(input,'0 0'): if b:print() b=u=1 s,t=map(int,e.split()) for y in range(s,t+1): if y%4==0 and y%100!=0 or y%400==0:print(y);u=0 if u:print('NA')
[["+", 8, 196, 0, 7, 8, 196, 0, 57, 0, 121], ["-", 8, 196, 0, 1, 0, 679, 12, 679, 17, 355], ["+", 8, 196, 0, 7, 8, 196, 0, 57, 0, 102]]
5
87
9
p=print b=0 for e in iter(input,'0 0'): if b:p() b=f=1;s,t=map(int,e.split()) for y in range(s,t+1): if(y%4==0)*(y%100)or y%400==0:p(y);f=0 if u:p('NA')
p=print b=0 for e in iter(input,'0 0'): if b:p() b=f=1;s,t=map(int,e.split()) for y in range(s,t+1): if(y%4==0)*(y%100)or y%400==0:p(y);f=0 if f:p('NA')
[["-", 0, 656, 0, 7, 8, 196, 0, 57, 15, 22], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 15, 22]]
5
94
14
p=print b=0 for e in iter(input,'0 0'): if b:p() b=f=1;s,t=map(int,e.split()) for y in range(s,t+1): if(y%4==0)*(y%100)or y%400==0:p(y);f=0 if u:p('NA')
p=print b=0 for e in iter(input,'0 0'): if b:p() b=f=1;s,t=map(int,e.split()) for y in range(s,t+1): if(y%4==0)*(y%100)or y%400==0:p(y);f=0 f and p('NA')
[["-", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["-", 0, 656, 0, 7, 8, 196, 0, 57, 15, 22], ["-", 0, 656, 0, 7, 8, 196, 0, 57, 0, 102], ["+", 0, 7, 8, 196, 0, 1, 0, 679, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 679, 17, 355]]
5
94
14
ans = [] while True: a, b = list(map(int, input().split())) if a + b == 0: break tmp = [] for i in range(a, b+1): if i % 4 == 0: if i % 400 == 0: tmp.append(i) elif i % 100 == 0: continue else: tmp.append(i) if len(tmp) == 0: tmp.append("NA") ans.append(tmp) print(ans) for i in range(len(...
ans = [] while True: a, b = list(map(int, input().split())) if a + b == 0: break tmp = [] for i in range(a, b+1): if i % 4 == 0: if i % 400 == 0: tmp.append(i) elif i % 100 == 0: continue else: tmp.append(i) if len(tmp) == 0: tmp.append("NA") ans.append(tmp) for i in range(len(ans)): for ...
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
148
4
<?php fscanf(STDIN, "%f%f", $a, $b); sprint("%.6f",($a * $b) / 3.305785); ?>
<?php fscanf(STDIN, "%f%f", $a, $b); print(($a * $b) / 3.305785); ?>
[["-", 36, 36, 0, 493, 0, 1, 0, 613, 63, 141], ["+", 36, 36, 0, 493, 0, 1, 0, 619, 0, 620], ["-", 0, 613, 3, 3, 0, 28, 0, 609, 0, 62], ["-", 0, 613, 3, 3, 0, 28, 0, 609, 0, 610], ["-", 0, 493, 0, 1, 0, 613, 3, 3, 0, 21]]
6
34
6
#include <stdio.h> int main(void) { int a, b; double S; scanf("%d %d", &a, &b); S = a * b * 3.305785; printf("%lf", S); return 0; }
#include <stdio.h> int main(void) { int a, b; double S; scanf("%d %d", &a, &b); S = a * b / 3.305785; printf("%lf", S); return 0; }
[["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 48], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 85]]
0
50
2
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; int[] v = new int[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextInt(); v[i] = sc.nextInt(); } for (int i = 0...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; int[] v = new int[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextInt(); v[i] = sc.nextInt(); } for (int i = 0...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 18], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 47]]
3
343
2
import java.util.Scanner; class Main { Scanner scan = new Scanner(System.in); public static void main(String args[]) { Main app = new Main(); while (app.scan.hasNext()) { int n = Integer.parseInt(app.scan.nextLine()); int[][] entrant = new int[n][2]; app.input(n, entrant); int index ...
import java.util.Scanner; class Main { Scanner scan = new Scanner(System.in); public static void main(String args[]) { Main app = new Main(); while (app.scan.hasNext()) { int n = Integer.parseInt(app.scan.nextLine()); int[][] entrant = new int[n][2]; app.input(n, entrant); int index ...
[["-", 0, 195, 8, 196, 0, 503, 49, 200, 141, 22], ["+", 0, 195, 8, 196, 0, 503, 49, 200, 141, 22], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 12, 22]]
3
345
8
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int max = 101; int c = 0; while (n-- > 0) { int m = sc.nextInt(); int w = sc.nextInt(); if (max < w || max == w && c > m) { m...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int max = -1; int c = 0; while (n-- > 0) { int m = sc.nextInt(); int w = sc.nextInt(); if (max < w || max == w && c > m) { ma...
[["-", 0, 195, 8, 196, 0, 503, 49, 200, 51, 499], ["+", 8, 196, 0, 503, 49, 200, 51, 91, 17, 33], ["+", 8, 196, 0, 503, 49, 200, 51, 91, 439, 499]]
3
120
3
import java.util.*; public class Main { static Scanner sc = new Scanner(System.in); static int[][] fishingData; static int n; public static void main(String[] args) { while (read()) { solve(); } } static boolean read() { if (!sc.hasNext()) return false; n = sc.nextInt(); fis...
import java.util.*; public class Main { static Scanner sc = new Scanner(System.in); static int[][] fishingData; static int n; public static void main(String[] args) { while (read()) { solve(); } } static boolean read() { if (!sc.hasNext()) return false; n = sc.nextInt(); fis...
[["-", 8, 196, 0, 503, 49, 200, 51, 91, 17, 33], ["+", 8, 196, 0, 503, 49, 200, 51, 16, 17, 151], ["+", 8, 196, 0, 503, 49, 200, 51, 16, 12, 499]]
3
265
3
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String s = ""; int[] top = new ...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String s = ""; int[] top = new ...
[["+", 0, 195, 8, 196, 0, 1, 0, 492, 500, 22], ["+", 0, 195, 8, 196, 0, 1, 0, 492, 0, 131], ["+", 0, 195, 8, 196, 0, 1, 0, 492, 141, 22], ["+", 8, 196, 0, 1, 0, 492, 3, 4, 0, 24], ["+", 8, 196, 0, 1, 0, 492, 3, 4, 0, 25], ["+", 8, 498, 0, 195, 8, 196, 0, 1, 0, 35]]
3
198
6
#include <stdio.h> int main(void) { int n; int i; int a; int v; int a_max = 0; int v_max = 0; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d %d", &a, &v); if (v_max <= v) { v_max = v; a_max = a; } else if (v_max == v && a_max > a) { a_max = a; } } printf("...
#include <stdio.h> int main(void) { int n; int i; int a; int v; int a_max = 21; int v_max = 0; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d %d", &a, &v); if (v_max < v) { v_max = v; a_max = a; } else if (v_max == v && a_max > a) { a_max = a; } } printf("...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 18]]
0
119
4
#include <stdio.h> int main() { int i, n, ans = 0, num, j; scanf("%d", &n); int a, v; for (i = 0; i < n; i++) { scanf("%d %d", &a, &v); if (ans < v) { ans = v; num = a; } else if (ans == v && num < a) num = a; } printf("%d %d\n", num, ans); return 0; }
#include <stdio.h> int main() { int i, n, ans = 0, num, j; scanf("%d", &n); int a, v; for (i = 0; i < n; i++) { scanf("%d %d", &a, &v); if (ans < v) { ans = v; num = a; } else if (ans == v && num > a) num = a; } printf("%d %d\n", num, ans); return 0; }
[["-", 0, 57, 15, 23, 0, 16, 12, 16, 17, 18], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 17, 47]]
0
110
2
#include <iostream> using namespace std; int main() { int n; cin >> n; int max = -1; int kouho = 0; for (int i = 0; i < n; i++) { int a, b; cin >> a >> b; if (max = b && kouho > a) { kouho = a; } if (max < b) { max = b; kouho = a; } } cout << kouho << " " << max <...
#include <iostream> using namespace std; int main() { int n; cin >> n; int max = -1; int kouho = 0; for (int i = 0; i < n; i++) { int a, b; cin >> a >> b; if (max == b && kouho > a) { kouho = a; } if (max < b) { max = b; kouho = a; } } cout << kouho << " " << max ...
[["-", 8, 9, 0, 57, 15, 339, 51, 11, 17, 32], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 60]]
1
100
2
#include <bits/stdc++.h> using namespace std; int main() { int n, men, fish, num, fishmax; cin >> n; for (int i = 0; i < n; i++) { cin >> men >> fish; if (i == 0) { num = men; fishmax = fish; } else { if (fish > fishmax) { fishmax = fish; num = men; } else if (n...
#include <bits/stdc++.h> using namespace std; int main() { int n, men, fish, num, fishmax; cin >> n; for (int i = 0; i < n; i++) { cin >> men >> fish; if (i == 0) { num = men; fishmax = fish; } else { if (fish > fishmax) { fishmax = fish; num = men; } else if (n...
[["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
107
4
#include <iostream> using namespace std; int main() { int n, max = -1, num = -1, a[20], v[20]; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i] >> v[i]; if (max < v[i] && max != v[i]) { num = a[i]; max = v[i]; } else if (max == v[i] && num > a[i]) { num = a[i]; } } cout <...
#include <iostream> using namespace std; int main() { int n, max = -1, num = -1, a[20], v[20]; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i] >> v[i]; if (max < v[i] && max != v[i]) { num = a[i]; max = v[i]; } else if (max == v[i] && num > a[i]) { num = a[i]; } } cout <...
[["-", 31, 16, 31, 16, 31, 16, 12, 16, 17, 72], ["-", 31, 16, 31, 16, 31, 16, 12, 16, 12, 13]]
1
140
2
#include <iostream> using namespace std; int main() { int n; while (cin >> n) { int ansA, ansV; ansA = 100, ansV = 0; for (int i = 0; i < n; ++i) { int a, v; cin >> a >> v; if (ansV < v) { ansA = a; ansV = v; } else if (ansA > a) { ansA = a; } }...
#include <iostream> using namespace std; int main() { int n; while (cin >> n) { int ansA, ansV; ansA = 100, ansV = 0; for (int i = 0; i < n; ++i) { int a, v; cin >> a >> v; if (ansV < v) { ansA = a; ansV = v; } else if (ansV == v && ansA > a) { ansA = a; ...
[["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 98]]
1
107
4
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <iostream> #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> #define vvl vector<...
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <iostream> #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> #define vvl vector<...
[["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 98]]
1
197
2
#include <algorithm> #include <iostream> using namespace std; int main() { int n; int x[20]; int y[20] = {}; cin >> n; for (int i = 0; i < n; i++) { int a, v; cin >> a >> v; x[a - 1] = v; y[a - 1] = x[a - 1]; } sort(y, y + 20); for (int i = 0; i < 20; i++) { if (y[19] == x[i]) { ...
#include <algorithm> #include <iostream> using namespace std; int main() { int n; int x[20]; int y[20] = {}; cin >> n; for (int i = 0; i < n; i++) { int a, v; cin >> a >> v; x[a - 1] = v; y[a - 1] = x[a - 1]; } sort(y, y + n); for (int i = 0; i < 20; i++) { if (y[n - 1] == x[i]) { ...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22], ["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 13], ["+", 51, 16, 31, 69, 341, 342, 0, 16, 31, 22], ["+", 51, 16, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 51, 16, 31, 69, 341, 342, 0, 16, 12, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", ...
1
147
8
#include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> #define rep(i, j, k) for (int i = (int)j; i < (int)k; i++) #define itrep(i, x) for (auto i = (x).begin(); i != (x).end(); i++...
#include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> #define rep(i, j, k) for (int i = (int)j; i < (int)k; i++) #define itrep(i, x) for (auto i = (x).begin(); i != (x).end(); i++...
[["-", 51, 16, 12, 118, 28, 69, 341, 342, 0, 22], ["+", 51, 16, 12, 118, 28, 69, 341, 342, 0, 22]]
1
412
2
#include <iostream> using namespace std; int main() { int n; cin >> n; int a = 0, v = 0; for (int i = 0; i < n; ++i) { int aa, vv; cin >> aa >> vv; if (v < vv) { a = aa; v = vv; } else { if (aa < a) { a = aa; } } } cout << a << " " << v << endl; return 0...
#include <iostream> using namespace std; int main() { int n; cin >> n; int a = 1000, v = 0; for (int i = 0; i < n; ++i) { int aa, vv; cin >> aa >> vv; if (v < vv) { a = aa; v = vv; } else { if (v == vv && aa < a) { a = aa; } } } cout << a << " " << v << en...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 98]]
1
101
6
#include <algorithm> #include <iostream> using namespace std; int main(void) { int n, num, w; pair<int, int> p[20]; cin >> n; for (int i = 0; i < n; i++) { cin >> num >> w; p[i] = make_pair(-w, num); } sort(p, p + n); cout << p[0].second << ' ' << p[0].first << endl; return 0; }
#include <algorithm> #include <iostream> using namespace std; int main(void) { int n, num, w; pair<int, int> p[20]; cin >> n; for (int i = 0; i < n; i++) { cin >> num >> w; p[i] = make_pair(-w, num); } sort(p, p + n); cout << p[0].second << ' ' << (-1) * p[0].first << endl; return 0; }
[["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 24], ["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 13], ["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 25], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 48]]
1
106
4
#include <iostream> #include <string> using namespace std; int main() { int n; int p[20] = {}; int a, v; int max = 0; cin >> n; for (int i = 0; i < n; ++i) { cin >> a >> v; p[a] = v; if (v > max) max = v; } for (int i = 0; i < n; ++i) { if (p[i] == max) { cout << i << " ...
#include <iostream> #include <string> using namespace std; int main() { int n; int p[20] = {}; int a, v; int max = 0; cin >> n; for (int i = 0; i < n; ++i) { cin >> a >> v; p[a - 1] = v; if (v > max) max = v; } for (int i = 0; i < n; ++i) { if (p[i] == max) { cout << i +...
[["+", 0, 11, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 11, 31, 69, 341, 342, 0, 16, 12, 13], ["+", 31, 16, 31, 16, 31, 16, 12, 16, 17, 72], ["+", 31, 16, 31, 16, 31, 16, 12, 16, 12, 13]]
1
126
4
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <string> #include <vector> #define pb(in, tmp) in.push_back(tmp) #define loop(i, a, b) for (int i = a; i < b; i++) #define rep(i, b) loop(i, 0, b) #define all(in) in.begin(), in.end() using namespace std; int main() ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <string> #include <vector> #define pb(in, tmp) in.push_back(tmp) #define loop(i, a, b) for (int i = a; i < b; i++) #define rep(i, b) loop(i, 0, b) #define all(in) in.begin(), in.end() using namespace std; int main() ...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 18], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 47]]
1
235
2
gets;p [*$<].max_by{|s|a,b=s.split.map &:to_i;b*100+100-a}
gets;puts [*$<].max_by{|s|a,b=s.split.map &:to_i;b*100+100-a}
[["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22]]
4
33
2
$<.gets data = $<.readlines.map {|l| l.split.map(&:to_i)}.sort_by(&:last) max = data.last.last num = data.select {|a| a.last == max}.sort(&:first).first.first puts "#{num} #{max}"
$<.gets data = $<.readlines.map {|l| l.split.map(&:to_i)}.sort_by(&:last) max = data.last.last num = data.select {|a| a.last == max}.sort_by(&:first).first.first puts "#{num} #{max}"
[["-", 0, 662, 12, 652, 486, 652, 486, 652, 735, 22], ["+", 0, 662, 12, 652, 486, 652, 486, 652, 735, 22]]
4
72
2
a=0;v=-1; gets.to_i.times do line=gets x,y=line.split.map(&:to_i) if y>v then a=x;v=y elsif y=v then if x<a then a=x end end end print a," ",v,"\n"
a=0;v=-1; gets.to_i.times do line=gets x,y=line.split.map(&:to_i) if y>v then a=x;v=y elsif y==v then if x<a then a=x end end end print a," ",v,"\n"
[["-", 8, 736, 0, 121, 75, 759, 15, 662, 0, 32], ["+", 8, 736, 0, 121, 75, 759, 15, 738, 17, 60]]
4
71
2
def main(input = STDIN) maxv = 0 maxa = 1 / 0.0 input.gets.to_i.times do a, v = input.gets.split(" ").map(&:to_i) maxv, maxa = v, a if maxv < v or (maxv == v and maxa <= a) end puts "#{maxa} #{maxv}" end main
def main(input = STDIN) maxv = 0 maxa = 1 / 0.0 input.gets.to_i.times do a, v = input.gets.split(" ").map(&:to_i) maxv, maxa = v, a if maxv < v or (maxv == v and maxa > a) end puts "#{maxa} #{maxv}" end main
[["-", 15, 738, 12, 739, 0, 738, 12, 738, 17, 19], ["+", 15, 738, 12, 739, 0, 738, 12, 738, 17, 47]]
4
77
2
l = [] gets.to_i.times { l << gets.split.map(&:to_i) } puts l.sort_by{ |v| [-v[1], v[0]] }.join(" ")
l = [] gets.to_i.times { l << gets.split.map(&:to_i) } puts l.sort_by{ |v| [-v[1], v[0]] }[0].join(" ")
[["+", 0, 652, 3, 4, 0, 652, 486, 742, 0, 70], ["+", 0, 652, 3, 4, 0, 652, 486, 742, 0, 612], ["+", 0, 652, 3, 4, 0, 652, 486, 742, 0, 73]]
4
50
3
n=eval(input()) a0,v0=n,0 for i in range(n): a,v=list(map(int,input().split())) if v>v0: a0,v0=a,v elif v==v0: a0=min(a0,a) print(a,v)
n=eval(input()) a0,v0=n,0 for i in range(n): a,v=list(map(int,input().split())) if v>v0: a0,v0=a,v elif v==v0: a0=min(a0,a) print(a0,v0)
[["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22]]
5
73
4
n=eval(input()) x=[0]*n for i in range(n): a,v=list(map(int,input().split())) x[a-1]=v m=max(x) print(x.index(m),m)
n=eval(input()) x=[0]*n for i in range(n): a,v=list(map(int,input().split())) x[a-1]=v m=max(x) print(x.index(m)+1,m)
[["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612]]
5
67
2
a = [0] * 20 v = [0] * 20 a_v = [] for i in range(int(input())): a[i],v[i] = list(map(int, input().split())) a_v.append([a[i], v[i]]) a_v.sort() ans2 = max(v) for i in a_v: if i[1] == ans2: ans1 = i[0] print("{} {}".format(ans1, ans2))
a = [0] * 20 v = [0] * 20 a_v = [] for i in range(int(input())): a[i],v[i] = list(map(int, input().split())) a_v.append([a[i], v[i]]) a_v.sort() ans2 = max(v) for i in a_v: if i[1] == ans2: ans1 = i[0] break print("{} {}".format(ans1, ans2))
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
115
1
#include <algorithm> #include <bitset> #include <cstdio> #include <cstdlib> #include <iostream> #include <iterator> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <string> #include <time.h> #include <vector> using namespace std; #define FOR(I, F, N) for (int I = F; I < (int...
#include <algorithm> #include <bitset> #include <cstdio> #include <cstdlib> #include <iostream> #include <iterator> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <string> #include <time.h> #include <vector> using namespace std; #define FOR(I, F, N) for (int I = F; I < (int...
[["-", 31, 69, 28, 69, 28, 2, 3, 4, 0, 13], ["+", 31, 69, 28, 69, 28, 2, 3, 4, 0, 13]]
1
273
27
#include <iostream> using namespace std; int x[100][4000], n; int main() { x[0][0] = 1; for (int i = 1; i < 10; i++) { for (int j = 0; j < 4000; j++) { for (int k = 0; k <= 1000; k++) { x[i][j + k] += x[i - 1][j]; } } } int n; while (cin >> n) { cout << x[4][n]; } }
#include <iostream> using namespace std; int x[100][4001], n; int main() { x[0][0] = 1; for (int i = 1; i < 10; i++) { for (int j = 0; j < 4000; j++) { for (int k = 0; k <= 1000; k++) { x[i][j + k] += x[i - 1][j]; } } } int n; while (cin >> n) { cout << x[4][n] << endl; } }
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 52, 8, 9, 0, 1, 0, 16, 12, 22]]
1
122
4
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; int inf = 1000000000; long long int dp[5][4001]; int main(void)...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; int inf = 1000000000; long long int dp[5][4001]; int main(void)...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 48], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 22]]
1
186
2
#include <iostream> using namespace std; int main() { int dp[4][5000] = {}; for (int i = 0; i <= 1000; i++) dp[1][i] = 1; for (int i = 1; i <= 2; i++) for (int j = 0; j <= 1000 * i; j++) for (int k = 0; k <= 1000 * i; k++) dp[i * 2][j + k] += dp[i][j] * dp[i][k]; for (int n; cin >> n;) ...
#include <iostream> using namespace std; int main() { int dp[8][5000] = {}; for (int i = 0; i <= 1000; i++) dp[1][i] = 1; for (int i = 1; i <= 2; i++) for (int j = 0; j <= 1000 * i; j++) for (int k = 0; k <= 1000 * i; k++) dp[i * 2][j + k] += dp[i][j] * dp[i][k]; for (int n; cin >> n;) ...
[["-", 0, 43, 49, 50, 49, 80, 49, 80, 81, 13], ["+", 0, 43, 49, 50, 49, 80, 49, 80, 81, 13]]
1
147
2
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) #define COUNT(i, n) for ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) #define COUNT(i, n) for ...
[["+", 31, 16, 12, 69, 28, 69, 341, 342, 0, 13], ["+", 31, 16, 12, 69, 28, 69, 341, 342, 0, 73], ["+", 26, 16, 31, 16, 12, 69, 341, 342, 0, 70]]
1
253
3
n=1001 a=list(range(1,n)) a+=[n]+a[::-1] for n in map(int,sys.stdin): x=0 for i in range(max(0,n-2000),min(n,2000)+1): x+=a[i]*a[n-i] print(x)
import sys n=1001 a=list(range(1,n)) a+=[n]+a[::-1] for n in map(int,sys.stdin): x=0 for i in range(max(0,n-2000),min(n,2000)+1): x+=a[i]*a[n-i] print(x)
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22]]
5
83
2
import sys def N(n): return (n+1)*(n+2)*(n+3)/6 for n in sys.stdin: n = int(input()) if n > 2000: n = 4000 - n if n < 1001: print(N(n)) else: m = n - 1000 print(N(n) - (N(2*m) - m - 1)/2)
import sys def N(n): return (n+1)*(n+2)*(n+3)/6 for n in sys.stdin: n = int(n) if n > 2000: n = 4000 - n if n < 1001: print(N(n)) else: m = n - 1000 print(N(n) - (N(2*m) - m - 1)/2)
[["-", 0, 662, 12, 652, 3, 4, 0, 652, 63, 22], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22]]
5
94
4
#include <cstdio> using namespace std; typedef long long lint; int main() { int n, s; lint dp[10][1000] = {0}; dp[0][0] = 1; for (int i = 0; i <= 100; i++) { for (int j = 1000; j >= 0; j--) { for (int k = 9; k >= 1; k--) { if (j - i >= 0) dp[k][j] += dp[k - 1][j - i]; } ...
#include <cstdio> using namespace std; typedef long long lint; int main() { int n, s; lint dp[10][1000] = {0}; dp[0][0] = 1; for (int i = 0; i <= 100; i++) { for (int j = 1000; j >= 0; j--) { for (int k = 9; k >= 1; k--) { if (j - i >= 0) dp[k][j] += dp[k - 1][j - i]; } ...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 22]]
1
161
2
#include <cstring> #include <iostream> using namespace std; int main() { long long int dp[11][1001]; memset(dp, 0, sizeof(dp)); dp[0][0] = 1; for (int i = 0; i <= 100; i++) { for (int j = 9; j >= 0; j--) { for (int k = 0; i + k <= 1000; k++) { dp[j + 1][i + k] += dp[j][k]; } } } ...
#include <cstring> #include <iostream> using namespace std; int main() { long long int dp[11][1001]; memset(dp, 0, sizeof(dp)); dp[0][0] = 1; for (int i = 0; i <= 100; i++) { for (int j = 9; j >= 0; j--) { for (int k = 0; i + k <= 1000; k++) { dp[j + 1][i + k] += dp[j][k]; } } } ...
[["-", 0, 52, 15, 339, 51, 34, 12, 16, 17, 98], ["+", 0, 52, 15, 339, 51, 34, 12, 16, 17, 106]]
1
146
2
#include <bits/stdc++.h> using namespace std; #define reps(i, f, n) for (int i = f; i < int(n); i++) #define rep(i, n) reps(i, 0, n) typedef long long ll; int n, s; bool input() { cin >> n >> s; return n != 0; } const int N = 101; const int M = 10; const int K = 1001; ll memo[N][M][K]; ll saiki(int st, int...
#include <bits/stdc++.h> using namespace std; #define reps(i, f, n) for (int i = f; i < int(n); i++) #define rep(i, n) reps(i, 0, n) typedef long long ll; int n, s; bool input() { cin >> n >> s; return n != 0; } const int N = 101; const int M = 10; const int K = 1001; ll memo[N + 10][M][K]; ll saiki(int st...
[["+", 49, 80, 49, 80, 49, 80, 81, 16, 17, 72], ["+", 49, 80, 49, 80, 49, 80, 81, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]]
1
268
6
#include <cmath> #include <iostream> #define N 100 #define S 1000 using namespace std; int main() { int n, s; long long int soi[N][S + 1] = {}; soi[1][0] = 1; for (int i = 1; i <= 9; i++) { for (int j = i; j > 0; j--) { for (int k = 0; k <= S; k++) { if (soi[j][k] != 0) { soi[j...
#include <cmath> #include <iostream> #define N 100 #define S 1000 using namespace std; int main() { int n, s; long long int soi[10][S + 1] = {}; soi[1][0] = 1; for (int i = 1; i <= N; i++) { for (int j = 8; j > 0; j--) { for (int k = 0; k <= S; k++) { if (soi[j][k] != 0) { soi[...
[["-", 0, 43, 49, 50, 49, 80, 49, 80, 81, 22], ["+", 0, 43, 49, 50, 49, 80, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 22], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
182
6
#include <bits/stdc++.h> using namespace std; typedef long long int lld; int main() { lld dp[10][1001]; memset(dp, 0, sizeof(dp)); dp[0][0] = 1; for (int i = 0; i <= 100; i++) { for (int j = 8; j >= 0; j--) { for (int k = 0; k <= 1000; k++) { if (k + i > 1000) continue; dp[j...
#include <bits/stdc++.h> using namespace std; typedef long long int lld; int main() { lld dp[10][1001]; memset(dp, 0, sizeof(dp)); dp[0][0] = 1; for (int i = 0; i <= 100; i++) { for (int j = 8; j >= 0; j--) { for (int k = 0; k <= 1000; k++) { if (k + i > 1000) continue; dp[j...
[["-", 0, 52, 15, 339, 51, 34, 12, 34, 0, 21], ["+", 0, 52, 15, 339, 51, 34, 12, 16, 17, 106]]
1
158
2
#include <bits/stdc++.h> using namespace std; typedef long long int lld; int n, s; lld dp[10][111][1111]; lld solve(int idx, int now, int sum) { if (idx == n) { if (sum == s) return 1; else return 0; } if (dp[idx][now][sum] != -1) return dp[idx][now][sum]; lld ret = 0; for (int i = n...
#include <bits/stdc++.h> using namespace std; typedef long long int lld; int n, s; lld dp[10][111][1111]; lld solve(int idx, int now, int sum) { if (idx == n) { if (sum == s) return 1; else return 0; } if (dp[idx][now][sum] != -1) return dp[idx][now][sum]; lld ret = 0; for (int i = n...
[["-", 0, 52, 15, 339, 51, 34, 12, 34, 0, 21], ["+", 0, 52, 15, 339, 51, 34, 12, 16, 17, 106]]
1
198
2
#include "bits/stdc++.h" using namespace std; typedef vector<int> vi; typedef pair<int, int> pii; typedef long long ll; #define dump(x) cerr << #x << " = " << (x) << endl #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define all(a) (a).begin(), (a).end() #define pb push_back #define INF 999999999 int main() { ...
#include "bits/stdc++.h" using namespace std; typedef vector<int> vi; typedef pair<int, int> pii; typedef long long ll; #define dump(x) cerr << #x << " = " << (x) << endl #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define all(a) (a).begin(), (a).end() #define pb push_back #define INF 999999999 int main() { ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
205
4
#include <iostream> #include <map> #include <string> #define loop(i, a, b) for (int i = a; i < b; i++) #define rep(i, a) loop(i, 0, a) using namespace std; long long dp[20][1200][200]; long long f(int n, int s, int next) { if (n == 0 && s == 0) return 1; if (n < 0 || s < 0) return 0; if (next > s) r...
#include <iostream> #include <map> #include <string> #define loop(i, a, b) for (int i = a; i < b; i++) #define rep(i, a) loop(i, 0, a) using namespace std; long long dp[20][1200][200]; long long f(int n, int s, int next) { if (n == 0 && s == 0) return 1; if (n < 0 || s < 0) return 0; if (next > s) r...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
242
4
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <ctime> #include <deque> #include <iostream> #include <limits> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std...
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <ctime> #include <deque> #include <iostream> #include <limits> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> using namespace std...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 43, 49, 80, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 80, 49, 80, 81, 13], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
366
6
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll dp[110][10][1010]; int main() { cin.tie(0); ios::sync_with_stdio(false); int n, s; while (cin >> n >> s, n + s) { memset(dp, 0, sizeof dp); dp[0][0][0] = 1; for (int i = 0; i <= 100; i++) { for (int j = 0; j <= n; j++) {...
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll dp[110][15][1010]; int main() { cin.tie(0); ios::sync_with_stdio(false); int n, s; while (cin >> n >> s, n | s) { memset(dp, 0, sizeof dp); dp[0][0][0] = 1; for (int i = 0; i <= 100; i++) { for (int j = 0; j <= n; j++) {...
[["-", 0, 30, 0, 43, 49, 80, 49, 80, 81, 13], ["+", 0, 30, 0, 43, 49, 80, 49, 80, 81, 13], ["-", 0, 52, 15, 339, 51, 34, 12, 16, 17, 72], ["+", 0, 52, 15, 339, 51, 34, 12, 16, 17, 139]]
1
227
4
#include <iostream> using namespace std; typedef long long int ll; ll dp[102][10][1001]; int main() { int n, s; while (cin >> n >> s, n || s) { for (int i = 0; i < 102; i++) { for (int j = 0; j < 10; j++) { for (int k = 0; k < 1001; k++) { dp[i][j][k] = 0; } } } ...
#include <iostream> using namespace std; typedef long long int ll; ll dp[102][11][1001]; int main() { int n, s; while (cin >> n >> s, n || s) { for (int i = 0; i < 102; i++) { for (int j = 0; j < 11; j++) { for (int k = 0; k < 1001; k++) { dp[i][j][k] = 0; } } } ...
[["-", 0, 30, 0, 43, 49, 80, 49, 80, 81, 13], ["+", 0, 30, 0, 43, 49, 80, 49, 80, 81, 13], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 52, 8, 9, 0,...
1
251
8
#include <iostream> using namespace std; typedef long long ll; // dp[n][s] := n個の数字を使って合計がsのときの組合せ数 ll dp[10][1010] = {0}; int main() { dp[0][0] = 1; for (int i = 0; i <= 100; i++) { for (int j = 1000; j >= 0; j--) { for (int k = 9; k >= 1; k--) { if (j - i >= 0) { dp[k][j] += dp[k - ...
#include <iostream> using namespace std; typedef long long ll; // dp[n][s] := n個の数字を使って合計がsのときの組合せ数 ll dp[10][1010] = {0}; int main() { dp[0][0] = 1; for (int i = 0; i <= 100; i++) { for (int j = 1000; j >= 0; j--) { for (int k = 9; k >= 1; k--) { if (j - i >= 0) { dp[k][j] += dp[k - ...
[["+", 8, 9, 0, 52, 15, 339, 51, 34, 0, 21], ["+", 0, 52, 15, 339, 51, 34, 12, 16, 31, 22], ["+", 0, 52, 15, 339, 51, 34, 12, 16, 17, 106], ["+", 0, 52, 15, 339, 51, 34, 12, 16, 12, 22]]
1
146
4
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; int dp[11][1010]; // dp[i][j] := i個からjを作る組み合わせの数 int main() { for (int i = 0; i < 10; i++) for (int j = 0; j <= 1000; j++) dp[i][j] = 0; dp[1][0] = 1; for (int i = 0; i <= 100; i++) { for (int j = 9; ...
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; long long dp[11][1010]; // dp[i][j] := i個からjを作る組み合わせの数 int main() { for (int i = 0; i < 10; i++) for (int j = 0; j <= 1000; j++) dp[i][j] = 0; dp[0][0] = 1; for (int i = 0; i <= 100; i++) { for (int j...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 0, 30, 0, 43, 39, 86, 0, 96], ["-", 0, 11, 31, 69, 28, 69, 341, 342, 0, 13], ["+", 0, 11, 31, 69, 28, 69, 341, 342, 0, 13]]
1
200
5
#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...
[["+", 36, 36, 0, 30, 0, 43, 39, 86, 0, 96], ["+", 0, 52, 15, 339, 51, 34, 31, 16, 12, 22], ["+", 8, 9, 0, 52, 15, 339, 51, 34, 0, 21], ["+", 0, 52, 15, 339, 51, 34, 12, 16, 31, 22], ["+", 0, 52, 15, 339, 51, 34, 12, 16, 17, 106]]
1
310
6
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <...
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <...
[["-", 8, 9, 0, 9, 0, 7, 15, 16, 12, 13], ["+", 8, 9, 0, 9, 0, 7, 15, 16, 12, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
265
4
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <istream> #include <map> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> usin...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <istream> #include <map> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> usin...
[["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
378
2
L = 100 @memo = Array.new(9) {Array.new(101) {[]}} def solve(num, start, sum) return 0 if sum <= 0 or start > L return (sum <= L) ? 1 : 0 if num == 1 a = @memo[num - 1][start][sum] return a if a co = 0 lim = [L, (2 * sum - num ** 2 + num) / (2 * num)].min (start..lim).each do |i| co += solve(num - 1,...
L = 100 @memo = Array.new(9) {Array.new(101) {[]}} def solve(num, start, sum) return 0 if sum < 0 or start > L return (start <= sum and sum <= L) ? 1 : 0 if num == 1 a = @memo[num - 1][start][sum] return a if a co = 0 lim = [L, (2 * sum - num ** 2 + num) / (2 * num)].min (start..lim).each do |i| co +...
[["-", 8, 736, 0, 751, 15, 738, 31, 738, 17, 19], ["+", 8, 736, 0, 751, 15, 738, 31, 738, 17, 18], ["+", 0, 754, 15, 739, 0, 738, 31, 738, 31, 22], ["+", 0, 754, 15, 739, 0, 738, 31, 738, 17, 19], ["+", 0, 754, 15, 739, 0, 738, 31, 738, 12, 22], ["+", 0, 4, 0, 754, 15, 739, 0, 738, 17, 355]]
4
181
6
dp = 11.times.map{ [0]*1001 } dp[0][0] = 1 (1..100).each do |i| 9.downto(0) do |j| (0..1000).each do |k| break if k+i > 1000 dp[j+1][k+i] += dp[j][k] end end end loop do n, s = gets.split.map(&:to_i) break if n == 0 p dp[n][s] end
dp = 11.times.map{ [0]*1001 } dp[0][0] = 1 (0..100).each do |i| 9.downto(0) do |j| (0..1000).each do |k| break if k+i > 1000 dp[j+1][k+i] += dp[j][k] end end end loop do n, s = gets.split.map(&:to_i) break if n == 0 p dp[n][s] end
[["-", 0, 493, 0, 652, 486, 739, 0, 475, 756, 612], ["+", 0, 493, 0, 652, 486, 739, 0, 475, 756, 612]]
4
113
2
dp = Array.new(10){ Array.new(1001) {0} } dp[0][0] = 1 0.upto(100) do |i| 1000.downto(0) do |j| 9.downto(1) do |k| dp[k][j] += dp[k-1][j-i] if j-i>=0 end end end while gets do n, s = $_.split(' ').map(&:to_i) break if n == 0 or s == 0 puts dp[n][s] end
dp = Array.new(10){ Array.new(1001) {0} } dp[0][0] = 1 0.upto(100) do |i| 1000.downto(0) do |j| 9.downto(1) do |k| dp[k][j] += dp[k-1][j-i] if j-i>=0 end end end while gets do n, s = $_.split(' ').map(&:to_i) break if n == 0 and s == 0 puts dp[n][s] end
[["-", 0, 89, 8, 170, 0, 751, 15, 738, 17, 354], ["+", 0, 89, 8, 170, 0, 751, 15, 738, 17, 355]]
4
125
2
m=1001 A=list(range(9)) d=[[0]*m for i in A] for i in range(101): for j in A[:-1][::-1]: for k in range(m-i): d[j][k+i]+=d[j-1][k] d[0][i]=1 while True: n,s=list(map(int,input().split())) if n==s==0: break print(d[n-1][s])
m=1001 A=list(range(9)) d=[[0]*m for i in A] for i in range(101): for j in A[1:][::-1]: for k in range(m-i): d[j][k+i]+=d[j-1][k] d[0][i]=1 while True: n,s=list(map(int,input().split())) if n==s==0: break print(d[n-1][s])
[["-", 0, 7, 12, 206, 51, 206, 206, 663, 0, 102], ["-", 12, 206, 51, 206, 206, 663, 0, 664, 17, 33], ["+", 0, 7, 12, 206, 51, 206, 206, 663, 0, 102]]
5
129
3
var input = require('fs').readFileSync('/dev/stdin', 'utf8'); var arr = input.trim().split("\n"); var n = arr.shift() - 0; var yx = []; var zero = []; for (var i = 0; i < n + 1; i++) zero.push(0); yx.push(zero); for (var i = 0; i < n; i++) yx.push(("0 " + arr.shift()).split(" ").map(Number)); n = n + 1; var sum = [...
var input = require('fs').readFileSync('/dev/stdin', 'utf8'); var arr = input.trim().split("\n"); var n = arr.shift() - 0; var yx = []; var zero = []; for (var i = 0; i < n + 1; i++) zero.push(0); yx.push(zero); for (var i = 0; i < n; i++) yx.push(("0 " + arr.shift()).split(" ").map(Number)); n = n + 1; var sum = [...
[["-", 8, 556, 0, 57, 15, 23, 0, 16, 17, 47], ["+", 8, 556, 0, 57, 15, 23, 0, 16, 17, 18]]
2
427
2
import java.util.Scanner; // Maximum Sum Sequence II public class Main { void run() { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[][] a = new int[n + 1][n + 1]; for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) { int x = sc.nextInt(); a[i][j] = a[i - ...
import java.util.Scanner; // Maximum Sum Sequence II public class Main { void run() { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[][] a = new int[n + 1][n + 1]; for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) { int x = sc.nextInt(); a[i][j] = a[i - ...
[["-", 0, 7, 8, 7, 8, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 7, 8, 7, 15, 16, 12, 22], ["-", 8, 7, 8, 7, 8, 7, 15, 16, 12, 22], ["+", 8, 7, 8, 7, 8, 7, 15, 16, 12, 22]]
3
282
4
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[][] map = new int[n + 1][n + 1]; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { map[i][j] = sc.nextInt() + map[i -...
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[][] map = new int[n + 1][n + 1]; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { map[i][j] = sc.nextInt() + map[i -...
[["-", 8, 196, 0, 7, 502, 503, 49, 200, 51, 499], ["+", 8, 196, 0, 7, 502, 503, 49, 200, 51, 22]]
3
275
4
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int res = Integer.MIN_VALUE; int[][] mat = new int[n][n]; for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { mat[i][j] = sc.nextInt(...
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int res = Integer.MIN_VALUE; int[][] mat = new int[n][n]; for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { mat[i][j] = sc.nextInt(...
[["-", 0, 7, 502, 503, 49, 200, 51, 16, 17, 72], ["-", 0, 7, 502, 503, 49, 200, 51, 16, 12, 499]]
3
413
4
#include <climits> #include <iostream> using namespace std; int main() { int n; cin >> n; // 要素 int a[100][100] = {}; // 要素の横方向の累積和を取る int sum[101][101] = {}; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { cin >> a[i][j]; } } for (int i = 0; i < n; i++) { for (int j ...
#include <climits> #include <iostream> using namespace std; int main() { int n; cin >> n; // 要素 int a[100][100] = {}; // 要素の横方向の累積和を取る int sum[101][101] = {}; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { cin >> a[i][j]; } } for (int i = 0; i < n; i++) { for (int j ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 31, 22], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["+", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13]]
1
274
4
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i < ((int)b); ++i) #define RFOR(i, a) for (int i = (a); i >= 0; --i) #define FOE(i, a) for (auto i : a) #define ALL(c) (c).begin(), (c).end() #define RALL(c) (c).rbegin(), (c).rend() #define DUMP(x) cerr << #x << " = " << (x) << endl; #define SUM(x) std::...
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i < ((int)b); ++i) #define RFOR(i, a) for (int i = (a); i >= 0; --i) #define FOE(i, a) for (auto i : a) #define ALL(c) (c).begin(), (c).end() #define RALL(c) (c).rbegin(), (c).rend() #define DUMP(x) cerr << #x << " = " << (x) << endl; #define SUM(x) std::...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35]]
1
1,072
6
/*     ∧_∧ やあ    (´・ω・`)     /     ようこそ、バーボンハウスへ。    /∇y:::::\    [ ̄]     このテキーラはサービスだから、まず飲んで落ち着いて欲しい。    |:⊃:|:::::|   |──|  ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄| うん、「また」なんだ。済まない。  ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄| ̄  仏の顔もって言うしね、謝って許してもらおうとも思っていない。  ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄/|     ∇ ∇ ∇ ∇   /./|   でも、この提出を見たとき、君は、きっと言葉では言い表せない     ┴ ┴ ┴ ┴ / /  |   「ときめき」みたいなものを感じてくれ...
/*     ∧_∧ やあ    (´・ω・`)     /     ようこそ、バーボンハウスへ。    /∇y:::::\    [ ̄]     このテキーラはサービスだから、まず飲んで落ち着いて欲しい。    |:⊃:|:::::|   |──|  ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄| うん、「また」なんだ。済まない。  ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄| ̄  仏の顔もって言うしね、謝って許してもらおうとも思っていない。  ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄/|     ∇ ∇ ∇ ∇   /./|   でも、この提出を見たとき、君は、きっと言葉では言い表せない     ┴ ┴ ┴ ┴ / /  |   「ときめき」みたいなものを感じてくれ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 22]]
1
548
4
#include <bits/stdc++.h> using namespace std; int main() { int n, a[110][110]; cin >> n; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) cin >> a[i][j]; } long long sum[110][110]; for (int i = 0; i < n; i++) { sum[i + 1][0] = 0; for (int j = 0; j < n; j++) sum[i + 1][j + ...
#include <bits/stdc++.h> using namespace std; int main() { int n, a[110][110]; cin >> n; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) cin >> a[i][j]; } long long sum[110][110]; for (int i = 0; i < n; i++) { sum[i + 1][0] = 0; for (int j = 0; j < n; j++) sum[i + 1][j + ...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]]
1
330
4