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
a = input() print(a.upper)
a = input() print(a.upper())
[["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
11
s = input().lower() print(s)
s = input().upper() print(s)
[["-", 0, 1, 0, 662, 12, 652, 63, 319, 319, 22], ["+", 0, 1, 0, 662, 12, 652, 63, 319, 319, 22]]
5
13
import java.util.Scanner; public class Main { public static boolean solve(double[][] x) { if (x[1][0] - x[0][0] == 0 && x[3][0] - x[2][0] == 0) { return true; } else if (x[1][0] - x[0][0] == 0 || x[3][0] - x[2][0] == 0) { return false; } double a = (x[1][1] - x[0][1]) / (x[1][0] - x[0][0]...
import java.util.Scanner; public class Main { public static boolean solve(double[][] x) { if (x[1][0] - x[0][0] == 0 && x[3][0] - x[2][0] == 0) { return true; } else if (x[1][0] - x[0][0] == 0 || x[3][0] - x[2][0] == 0) { return false; } double a = (x[1][1] - x[0][1]) / (x[1][0] - x[0][0]...
[["-", 64, 196, 0, 1, 0, 11, 12, 5, 0, 491], ["+", 64, 196, 0, 1, 0, 11, 12, 5, 0, 491], ["-", 75, 196, 0, 1, 0, 11, 12, 5, 0, 491], ["+", 75, 196, 0, 1, 0, 11, 12, 5, 0, 491]]
3
375
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintStream; class Main { public static void main(String[] args) throws IOException { doit(args, System.in, System.out); } static void doit(String[] args, InputStream in, ...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintStream; class Main { public static void main(String[] args) throws IOException { doit(args, System.in, System.out); } static void doit(String[] args, InputStream in, ...
[["-", 0, 492, 3, 4, 0, 510, 15, 16, 17, 18], ["-", 0, 492, 3, 4, 0, 510, 15, 16, 12, 515], ["+", 0, 492, 3, 4, 0, 510, 15, 16, 17, 60], ["+", 0, 492, 3, 4, 0, 510, 15, 16, 12, 515]]
3
299
import java.io.IOException; import java.util.Locale; import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); while (N-- > 0) { double x1 = sc.nextDouble(); double y1 = sc.nextDouble(...
import java.io.IOException; import java.util.Locale; import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); while (N-- > 0) { double x1 = sc.nextDouble(); double y1 = sc.nextDouble(...
[["+", 8, 196, 0, 503, 49, 200, 51, 492, 500, 22], ["+", 8, 196, 0, 503, 49, 200, 51, 492, 0, 131], ["+", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22], ["+", 0, 503, 49, 200, 51, 492, 3, 4, 0, 24], ["+", 0, 503, 49, 200, 51, 492, 3, 4, 0, 25]]
3
224
#include <stdio.h> int main(void) { float x1, y1, x2, y2, x3, y3, x4, y4; double dm, dn; int i, n; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4); dm = (y2 - y1) / (x2 - x1); dn = (y4 - y3) / (x4 - y3); if (dm == dn) { ...
#include <stdio.h> int main(void) { float x1, y1, x2, y2, x3, y3, x4, y4; double dm, dn; int i, n; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4); dm = (y2 - y1) / (x2 - x1); dn = (y4 - y3) / (x4 - x3); if (dm == dn) { ...
[["-", 0, 11, 12, 16, 12, 23, 0, 16, 12, 22], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 12, 22]]
0
150
#include <math.h> #include <stdio.h> #define delta 0.0000001 int main(void) { double d[20]; int n, i, j; double xd1, xd2, yd1, yd2; scanf("%d", &n); for (i = 0; i < n; i++) { for (j = 0; j < 8; j++) { scanf("%lf", &d[j]); } xd1 = d[0] - d[2]; xd2 = d[4] - d[6]; yd1 = d[1] - d[3]; ...
#include <math.h> #include <stdio.h> #define delta 0.0000001 int main(void) { double d[20]; int n, i, j; double xd1, xd2, yd1, yd2; scanf("%d", &n); for (i = 0; i < n; i++) { for (j = 0; j < 8; j++) { scanf("%lf", &d[j]); } xd1 = d[0] - d[2]; xd2 = d[4] - d[6]; yd1 = d[1] - d[3]; ...
[["-", 0, 57, 15, 23, 0, 16, 31, 16, 17, 18], ["+", 0, 57, 15, 23, 0, 16, 31, 16, 17, 47], ["-", 0, 57, 15, 23, 0, 16, 12, 16, 17, 18], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 17, 47]]
0
232
#include <stdio.h> int main(void) { int i, j, n; float d[4], x[4], y[4]; scanf("%d", &n); for (i = 0; i < n; i++) { for (j = 0; j < 4; j++) { scanf("%lf%lf", &x[j], &y[j]); } d[0] = x[1] - x[0]; d[1] = y[1] - y[0]; d[2] = x[3] - x[2]; d[3] = y[3] - y[2]; if (d[0] * d[3] == d[...
#include <stdio.h> int main(void) { int i, j, n; float d[4], x[4], y[4]; scanf("%d", &n); for (i = 0; i < n; i++) { for (j = 0; j < 4; j++) { scanf("%f%f", &x[j], &y[j]); } d[0] = x[1] - x[0]; d[1] = y[1] - y[0]; d[2] = x[3] - x[2]; d[3] = y[3] - y[2]; if (d[0] * d[3] == d[1]...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
197
#include <math.h> #include <stdio.h> const double eps = 1e-10; int n; // math.hラむブラγƒͺでy1, y2...γ¨γ‹γ£γ¦ε€‰ζ•°εγŒδ½Ώγ‚γ‚Œγ¦γ‚‹γ‚‰γ—γ„ double ix1, ix2, ix3, ix4; double iy1, iy2, iy3, iy4; //ε’—εŠ ηŽ‡γ‚’θ¦‹γ‚‹ζ–Ήζ³• int solve() { double Ax = ix2 - ix1; double Ay = iy2 - iy1; double Bx = ix4 - ix3; double By = iy4 - iy3; double val = Ax * By - A...
#include <math.h> #include <stdio.h> const double eps = 1e-10; int n; // math.hラむブラγƒͺでy1, y2...γ¨γ‹γ£γ¦ε€‰ζ•°εγŒδ½Ώγ‚γ‚Œγ¦γ‚‹γ‚‰γ—γ„ double ix1, ix2, ix3, ix4; double iy1, iy2, iy3, iy4; //ε’—εŠ ηŽ‡γ‚’θ¦‹γ‚‹ζ–Ήζ³• int solve() { double Ax = ix2 - ix1; double Ay = iy2 - iy1; double Bx = ix4 - ix3; double By = iy4 - iy3; double val = Ax * By - A...
[["+", 0, 37, 0, 23, 0, 16, 31, 2, 63, 22], ["+", 0, 23, 0, 16, 31, 2, 3, 4, 0, 24], ["+", 0, 23, 0, 16, 31, 2, 3, 4, 0, 25]]
0
175
#include <stdio.h> int main(void) { int i, j, n; float m[8], e; scanf("%d", &n); for (i = 0; i < n; i++) { for (j = 0; j < 8; j++) { scanf("%lf", &m[j]); } m[2] -= m[0]; m[3] -= m[1]; m[6] -= m[4]; m[7] -= m[5]; // e=(m[3]-m[1])*(m[6]-m[4])-(m[7]-m[5])*(m[2]-m[0]); if (m[7...
#include <stdio.h> int main(void) { int i, j, n; float m[8], e; scanf("%d", &n); for (i = 0; i < n; i++) { for (j = 0; j < 8; j++) { scanf("%f", &m[j]); } m[2] -= m[0]; m[3] -= m[1]; m[6] -= m[4]; m[7] -= m[5]; // e=(m[3]-m[1])*(m[6]-m[4])-(m[7]-m[5])*(m[2]-m[0]); if (m[7]...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
161
#include <iostream> #include <string> using namespace std; int main() { int n; string str; /* while(cin >> str) { n = str.size(); for(int i=0;i<n;i++) { if((str[i] <= 122) && (str[i] >= 97)) { str[i] -= 32; } } if(str[n-1] == 46) cout << str; else cout << str...
#include <iostream> #include <string> using namespace std; int main() { int n; string str; /* while(cin >> str) { n = str.size(); for(int i=0;i<n;i++) { if((str[i] <= 122) && (str[i] >= 97)) { str[i] -= 32; } } if(str[n-1] == 46) cout << str; else cout << str...
[["-", 51, 16, 31, 23, 0, 16, 12, 103, 0, 125], ["+", 51, 16, 31, 23, 0, 16, 12, 103, 0, 125], ["-", 51, 16, 12, 23, 0, 16, 12, 103, 0, 125], ["+", 51, 16, 12, 23, 0, 16, 12, 103, 0, 125]]
1
91
#include <ctype.h> #include <iostream> #include <string> using namespace std; int main() { string s; cin >> s; for (int i = 0; i < s.size(); i++) { if (isalpha(s[i])) { s[i] -= 32; } } cout << s << endl; }
#include <ctype.h> #include <iostream> #include <string> using namespace std; int main() { string s; getline(cin, s); for (int i = 0; i < s.size(); i++) { if (isalpha(s[i])) { s[i] -= 32; } } cout << s << endl; }
[["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25]]
1
68
#include <algorithm> #include <iostream> #include <string> char ToUpper(char cX) { return toupper(cX); } using namespace std; int main() { string in; cin >> in; transform(in.begin(), in.end(), in.begin(), ToUpper); cout << in << endl; return 0; }
#include <algorithm> #include <iostream> #include <string> char ToUpper(char cX) { return toupper(cX); } using namespace std; int main() { string in; getline(cin, in); transform(in.begin(), in.end(), in.begin(), ToUpper); cout << in << endl; return 0; }
[["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25]]
1
69
#include <cstdio> using namespace std; int main(void) { char inp; while (scanf("%c", &inp) != EOF) { putchar((inp > 'a' && inp < 'z') ? inp - 32 : inp); } return 0; }
#include <cstdio> using namespace std; int main(void) { char inp; while (scanf("%c", &inp) != EOF) { putchar((inp >= 'a' && inp <= 'z') ? inp - 32 : inp); } return 0; }
[["-", 0, 41, 15, 23, 0, 16, 31, 16, 17, 47], ["+", 0, 41, 15, 23, 0, 16, 31, 16, 17, 20], ["-", 0, 41, 15, 23, 0, 16, 12, 16, 17, 18], ["+", 0, 41, 15, 23, 0, 16, 12, 16, 17, 19]]
1
58
# coding=utf-8 sentence = input() sentence.upper() print(sentence)
# coding=utf-8 sentence = input() sentence = sentence.upper() print(sentence)
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 0, 1, 0, 662, 12, 652, 63, 319, 500, 22]]
5
15
import cmath,math,sys z=0;p=90 for e in sys.stdin: r,d=map(int,e.split(',')) z+=cmath.rect(r,math.radians(p)) p-=d print(int(z.real),int(z.imag))
import cmath,math,sys z=0;p=90 for e in sys.stdin: r,d=map(int,e.split(',')) z+=cmath.rect(r,math.radians(p)) p-=d print(int(z.real),int(z.imag),sep='\n')
[["+", 0, 656, 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], ["+", 3, 4, 0, 653, 51, 557, 0, 6, 0, 44], ["+", 0, 652, 3, 4, 0, 653, 51, 557, 0, 655]]
5
71
import cmath,math,sys z=0;p=90 for e in sys.stdin: r,d=map(int,e.split(',')) z+=cmath.rect(r,math.radians(p)) p-=d print(int(z.real),int(z.imag))
import cmath,math,sys z=0;p=90 for e in sys.stdin: r,d=map(int,e.split(',')) z+=cmath.rect(r,math.radians(p)) p-=d print(int(z.real)) print(int(z.imag))
[["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 21], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25], ["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24]]
5
71
import math x = y = n= 0 while True: d,a = map(int,input().split(',')) if d == a == 0: break x += d*math.sin(math.radians(n)) y += d*math.cos(math.radians(n)) n+=a print(map(int,(x,y)),sep='\n')
import math x = y = n= 0 while True: d,a = map(int,input().split(',')) if d == a == 0: break x += d*math.sin(math.radians(n)) y += d*math.cos(math.radians(n)) n+=a print(*map(int,(x,y)),sep='\n')
[["+", 0, 652, 3, 4, 0, 652, 63, 661, 0, 48]]
5
91
from math import radians from cmath import rect z = 0 deg = 90 while True: r, d = map(int, input().split(',')) if r == d == 0: break z += rect(r, radians(deg)) deg -= d print(int(z.real), int(z.imag))
from math import radians from cmath import rect z = 0 deg = 90 while True: r, d = map(float, input().split(',')) if r == d == 0: break z += rect(r, radians(deg)) deg -= d print(int(z.real)) print(int(z.imag))
[["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 21], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25], ["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24]]
5
74
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { String b = sc.next(); char[] a = b.toCharArray(); for (int i = 0; i < 26; ++i) { for (int j = 0; j < a.length; ++j) { if ('a' <= a[j]...
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { String b = sc.nextLine(); char[] a = b.toCharArray(); for (int i = 0; i < 26; ++i) { for (int j = 0; j < a.length; ++j) { if ('a' <= ...
[["-", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22], ["+", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22], ["-", 0, 7, 8, 196, 0, 503, 49, 200, 141, 22], ["+", 0, 7, 8, 196, 0, 503, 49, 200, 141, 22], ["-", 15, 15, 0, 16, 31, 16, 31, 492, 500, 22], ["+", 15, 15, 0, 16, 31, 16, 31, 492, 500, 22], ["-", 15, 15, 0, 16, 31, 16, ...
3
196
import java.io.*; import java.util.regex.Pattern; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); Pattern pattern = Pattern.compile("the|this|that"); String str; try { while ((str = br.readL...
import java.io.*; import java.util.regex.Pattern; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); Pattern pattern = Pattern.compile("the|this|that"); String str; try { while ((str = br.readL...
[["-", 15, 15, 0, 492, 500, 492, 3, 4, 0, 22], ["+", 0, 492, 500, 492, 3, 4, 0, 492, 500, 22], ["+", 0, 492, 500, 492, 3, 4, 0, 492, 0, 131], ["+", 0, 492, 500, 492, 3, 4, 0, 492, 141, 22], ["+", 500, 492, 3, 4, 0, 492, 3, 4, 0, 24], ["+", 500, 492, 3, 4, 0, 492, 3, 4, 0, 22], ["+", 500, 492, 3, 4, 0, 492, 3, 4, 0, 25]...
3
217
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); for (; scanner.hasNext();) { String in = scanner.nextLine(); int shift = getShift(in); String out = ""; for (int i = 0; i < in.length(); i++) { o...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); for (; scanner.hasNext();) { String in = scanner.nextLine(); int shift = getShift(in); String out = ""; for (int i = 0; i < in.length(); i++) { o...
[["-", 49, 200, 51, 492, 3, 4, 0, 5, 0, 491], ["+", 49, 200, 51, 492, 3, 4, 0, 5, 0, 491], ["+", 0, 11, 12, 74, 51, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 74, 51, 23, 0, 16, 12, 499]]
3
324
import java.util.Scanner; public class Main { private Scanner sc; public static void main(String[] args) { new Main(); } public Main() { sc = new Scanner(System.in); String[] strtest = new String[26 * 3]; String[] ts = {"the", "this", "that"}; for (int i = 0; i < 26; i++) { for (int j =...
import java.util.Scanner; public class Main { private Scanner sc; public static void main(String[] args) { new Main(); } public Main() { sc = new Scanner(System.in); String[] strtest = new String[26 * 3]; String[] ts = {"the", "this", "that"}; for (int i = 0; i < 26; i++) { for (int j =...
[["+", 51, 23, 0, 16, 31, 23, 0, 16, 17, 72], ["+", 51, 23, 0, 16, 31, 23, 0, 16, 12, 499]]
3
498
import java.util.*; class Main { private static final Scanner scan = new Scanner(System.in); public static void main(String args[]) { while (scan.hasNext()) { String line = scan.nextLine(); for (int i = 0; i < 26; i++) { String now = ""; StringBuffer sb = new StringBuffer(); ...
import java.util.*; class Main { private static final Scanner scan = new Scanner(System.in); public static void main(String args[]) { while (scan.hasNext()) { String line = scan.nextLine(); for (int i = 0; i < 26; i++) { String now = ""; StringBuffer sb = new StringBuffer(); ...
[["-", 0, 16, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 16, 12, 16, 31, 23, 0, 16, 17, 72]]
3
389
import java.util.Scanner; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { while (sc.hasNext()) { char[] code = sc.nextLine().toCharArray(); decode(code); } } private static void decode(char[] code) { char[] decode = new char[c...
import java.util.Scanner; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { while (sc.hasNext()) { char[] code = sc.nextLine().toCharArray(); decode(code); } } private static void decode(char[] code) { char[] decode = new char[c...
[["-", 0, 57, 15, 15, 0, 16, 31, 16, 17, 98], ["+", 0, 57, 15, 15, 0, 16, 31, 16, 17, 106], ["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 98], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 106]]
3
245
import java.io.*; import java.util.*; class Main { public static ArrayList<String> remove_sentence(String a) { ArrayList<String> b = new ArrayList<String>(); String[] strAry = a.split(" "); strAry[strAry.length - 1] = strAry[strAry.length - 1].replaceAll("\\.", ""); for (int i = 0; i < strAry.lengt...
import java.io.*; import java.util.*; class Main { public static ArrayList<String> remove_sentence(String a) { ArrayList<String> b = new ArrayList<String>(); String[] strAry = a.split(" "); strAry[strAry.length - 1] = strAry[strAry.length - 1].replaceAll("\\.", ""); for (int i = 0; i < strAry.lengt...
[["-", 64, 196, 0, 1, 0, 11, 12, 16, 12, 499], ["+", 64, 196, 0, 1, 0, 11, 12, 16, 12, 499], ["-", 64, 196, 0, 57, 15, 15, 0, 16, 17, 20], ["+", 64, 196, 0, 57, 15, 15, 0, 16, 17, 47], ["-", 0, 7, 8, 196, 0, 7, 15, 16, 12, 499], ["+", 0, 7, 8, 196, 0, 7, 15, 16, 12, 499]]
3
875
import java.util.Scanner; public class Main { private static Scanner scan; public static void main(String[] args) { scan = new Scanner(System.in); scan.useDelimiter("\\r\\n"); while (scan.hasNext()) { String str = scan.next(); int m = 0; String string = null; for (int i = 0; i <...
import java.util.Scanner; public class Main { private static Scanner scan; public static void main(String[] args) { scan = new Scanner(System.in); scan.useDelimiter("\\r\\n"); while (scan.hasNext()) { String str = scan.nextLine(); int m = 0; String string = null; for (int i = 0;...
[["-", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22], ["+", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22]]
3
258
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { private static String str; private static String[] keys = {"the ", "this ", "that "}; public static void main(String args[]) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ...
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { private static String str; private static String[] keys = {"the ", "this ", "that "}; public static void main(String args[]) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ...
[["-", 49, 200, 51, 492, 3, 4, 0, 74, 0, 24], ["-", 51, 492, 3, 4, 0, 74, 39, 506, 0, 517], ["-", 49, 200, 51, 492, 3, 4, 0, 74, 0, 25], ["-", 0, 195, 54, 495, 0, 496, 39, 506, 0, 517], ["+", 0, 195, 54, 495, 0, 496, 39, 506, 0, 507], ["-", 75, 196, 0, 503, 49, 200, 51, 16, 12, 499], ["+", 75, 196, 0, 503, 49, 200, 51,...
3
287
#include <stdio.h> int c(char *p, int d) { return ((26 + *p - *(p + 1)) % 26 == d); } int a(char *p) { return ((*p < 'a') || (*p > 'z')); } char *decode(char *inbuf, int s) { int p = 0; while (inbuf[p]) { if (!a(&inbuf[p])) { int t = inbuf[p] + s; if (t > 'z') inbuf[p] = (char)(t - 26); ...
#include <stdio.h> int c(char *p, int d) { return ((26 + *p - *(p + 1)) % 26 == d); } int a(char *p) { return ((*p < 'a') || (*p > 'z')); } char *decode(char *inbuf, int s) { int p = 0; while (inbuf[p]) { if (!a(&inbuf[p])) { int t = inbuf[p] + s; if (t > 'z') inbuf[p] = (char)(t - 26); ...
[["-", 0, 52, 15, 23, 0, 66, 28, 27, 28, 22], ["+", 0, 52, 15, 23, 0, 66, 28, 27, 28, 22]]
0
345
#include <stdio.h> #include <string.h> int main() { int i, j; char s[90], t[90]; for (; gets(s);) { for (i = 0; i < 27; i++) { for (j = 0, memcpy(t, s, sizeof(s)); s[j]; j++) if (s[j] >= 97 && s[j] < 123) t[j] = s[j] + i < 123 ? s[j] + i : s[j] + i - 26; if (strstr(t, "the") || s...
#include <stdio.h> #include <string.h> int main() { int i, j; char s[90], t[90]; for (; gets(s);) { for (i = 0; i < 27; i++) { for (j = 0, memcpy(t, s, sizeof(s)); s[j]; j++) if (s[j] >= 97 && s[j] < 123) t[j] = s[j] + i < 123 ? s[j] + i : s[j] + i - 26; if (strstr(t, "the") || s...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
163
#include <ctype.h> #include <stdio.h> #include <string.h> void caesar(const char *str, char *d_str, const int n) { int i, len; len = strlen(str); for (i = 0; i < len; i++) { if (isalpha(str[i])) d_str[i] = str[i] + n > 'z' ? str[i] + n - 24 : str[i] + n; else d_str[i] = str[i]; } d_str[i]...
#include <ctype.h> #include <stdio.h> #include <string.h> void caesar(const char *str, char *d_str, const int n) { int i, len; len = strlen(str); for (i = 0; i < len; i++) { if (isalpha(str[i])) d_str[i] = str[i] + n > 'z' ? str[i] + n - 26 : str[i] + n; else d_str[i] = str[i]; } d_str[i]...
[["-", 64, 1, 0, 11, 12, 41, 64, 16, 12, 13], ["+", 64, 1, 0, 11, 12, 41, 64, 16, 12, 13]]
0
215
#include <stdio.h> #include <string.h> int main() { char str[81]; // char cstr[80]; int s = 0; int i; char c; char *p; p = str; while ((c = getchar()) != EOF) { if (c != '\n') { *p = c; p++; } if (c == '\n') { *p = '\0'; p = str; s = 0; while (s <= 26) ...
#include <stdio.h> #include <string.h> int main() { char str[81]; // char cstr[80]; int s = 0; int i; char c; char *p; p = str; while ((c = getchar()) != EOF) { if (c != '\n') { *p = c; p++; } if (c == '\n') { *p = '\0'; p = str; s = 0; while (s <= 26) ...
[["-", 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, 57, 64, 9, 0, 45], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46], ["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 0, 57, 75, 76, 0, 57, 64, 9, 0, 45], ["+", 0, 57, 75, 76, 0, 57, 64, 9, 0, 46]]
0
223
#include <stdio.h> #include <string.h> int main(void) { int i; int len; int f; int n; char str[128]; while (fgets(str, 100, stdin) != NULL) { f = 0; n = 0; while (n < 25) { len = strlen(str); for (i = 0; i < len; i++) { if (strncmp(&str[i], "the", 3) == 0) { f = 1...
#include <stdio.h> #include <string.h> int main(void) { int i; int len; int f; int n; char str[128]; while (fgets(str, 100, stdin) != NULL) { f = 0; n = 0; while (1) { len = strlen(str); for (i = 0; i < len; i++) { if (strncmp(&str[i], "the", 3) == 0) { f = 1; ...
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 18], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13], ["+", 0, 52, 8, 9, 0, 52, 15, 339, 51, 13], ["+", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95]]
1
249
#include <cstring> #include <iostream> using namespace std; int main(void) { while (true) { string str; if (getline(cin, str)) break; ; while (true) { for (int i = 0; i < str.size(); i++) { if (isalpha(str[i]) && str[i] == 'z') { str[i] = 'a'; } else if (isalpha(...
#include <cstring> #include <iostream> using namespace std; int main(void) { while (true) { string str; if (!getline(cin, str)) break; ; while (true) { for (int i = 0; i < str.size(); i++) { if (isalpha(str[i]) && str[i] == 'z') { str[i] = 'a'; } else if (isalpha...
[["+", 8, 9, 0, 57, 15, 339, 51, 91, 17, 111], ["-", 12, 16, 31, 2, 3, 4, 0, 5, 0, 6], ["+", 12, 16, 31, 2, 3, 4, 0, 5, 0, 6]]
1
163
#include <algorithm> #include <iostream> using namespace std; int main() { int n; long long m, a[5001]; a[0] = 0; while (cin >> n, n != 0) { for (int i = 1; i <= n; i++) { cin >> a[i]; a[i] += a[i - 1]; } m = 0; for (int i = 0; i <= n; i++) { for (int j = 0; j <= n; j++) { ...
#include <algorithm> #include <iostream> using namespace std; int main() { int n; long long m, a[5001]; a[0] = 0; while (cin >> n, n != 0) { for (int i = 1; i <= n; i++) { cin >> a[i]; a[i] += a[i - 1]; } m = -100000; for (int i = 0; i <= n; i++) { for (int j = i + 1; j <= ...
[["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["-", 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
142
#include <iostream> using namespace std; int S[5000]; int main() { int n; while (cin >> n, n) { S[0] = 0; int tmp, sum = 0; for (int i = 1; i < n; i++) { cin >> tmp; sum += tmp; S[i] = sum; } tmp = S[1] - S[0]; for (int i = 0; i < n; i++) { for (int j = i + 1; i < ...
#include <iostream> using namespace std; int S[5000]; int main() { int n; while (cin >> n, n) { S[0] = 0; int tmp, sum = 0; for (int i = 1; i <= n; i++) { cin >> tmp; sum += tmp; S[i] = sum; } tmp = S[1] - S[0]; for (int i = 0; i <= n; i++) { for (int j = i + 1; 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, 31, 22], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 31, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]]
1
157
#include <cstdio> #include <iostream> using namespace std; int main() { int n, sum = 0, ans, sumkeep; while (cin >> n) { if (n == 0) break; ans = 0; sumkeep = 0; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { sumkeep = 0; ...
#include <cstdio> #include <iostream> using namespace std; int main() { int n, sum = 0, ans, sumkeep; while (cin >> n) { if (n == 0) break; ans = 0; sumkeep = 0; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { sumkeep = 0; ...
[["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 60], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
152
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <string> #include <vector> using namespace std; int main() { int n, a[5000], s, ans; while (1) { cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } if (n == 0) { break; } ans = 0; for (...
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <string> #include <vector> using namespace std; int main() { int n, a[5000], s, ans; while (1) { cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } if (n == 0) { break; } ans = 0; for (...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22]]
1
292
#include <climits> #include <iostream> using namespace std; template <typename Type> long long Maximum_Sum_Sequence(Type N[], int size) { long long max = LLONG_MIN; for (int i = 0; i < size; i++) { long long sum = 0; for (int j = i; j < size; j++) { sum += N[j]; if (sum > max) { max...
#include <climits> #include <iostream> using namespace std; template <typename Type> long long Maximum_Sum_Sequence(Type N[], int size) { long long max = LLONG_MIN; for (int i = 0; i < size; i++) { long long sum = 0; for (int j = i; j < size; j++) { sum += N[j]; if (sum > max) { max...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
217
#include <iostream> int calcMaxSum(int amount_set); int main() { while (true) { int amount_set; std::cin >> amount_set; if (amount_set == 0) { break; } std::cout << calcMaxSum(amount_set) << std::endl; } return 0; } int calcMaxSum(int amount_set) { const int MAXNUMBER = 100000; //?...
#include <iostream> int calcMaxSum(int amount_set); int main() { while (true) { int amount_set; std::cin >> amount_set; if (amount_set == 0) { break; } std::cout << calcMaxSum(amount_set) << std::endl; } return 0; } int calcMaxSum(int amount_set) { const int MAXNUMBER = 100000; //?...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
250
#include <iostream> using namespace std; #define rep(i, n) for (int i = 0; i < int(n); ++i) int main() { int n, a[5010], sum[5010], res; while (true) { cin >> n; if (n == 0) break; rep(i, n) cin >> a[i]; sum[0] = 0; rep(i, n) sum[i + 1] = a[i] + sum[i]; res = 0; rep(i, n) rep(j,...
#include <iostream> using namespace std; #define rep(i, n) for (int i = 0; i < int(n); ++i) int main() { int n, a[5010], sum[5010], res; while (true) { cin >> n; if (n == 0) break; rep(i, n) cin >> a[i]; sum[0] = 0; rep(i, n) sum[i + 1] = a[i] + sum[i]; res = -1000000000; rep(i,...
[["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 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
141
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n, num; vector<int> a; while (1) { cin >> n; if (n == 0) break; int Max = -100001; a.push_back(0); for (int i = 0; i < n; i++) { cin >> num; a.push_back(num); } f...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n, num; vector<int> a; while (1) { cin >> n; if (n == 0) break; int Max = -100001; a.push_back(0); for (int i = 0; i < n; i++) { cin >> num; a.push_back(num); } ...
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19]]
1
152
#include <iostream> #include <vector> using namespace std; int main() { int n, num; vector<int> a; while (1) { int Max = -100000; cin >> n; if (n == 0) break; a.push_back(0); for (int i = 0; i < n; i++) { cin >> num; a.push_back(num); } for (int i = 1; i < n;...
#include <iostream> #include <vector> using namespace std; int main() { int n, num; vector<long int> a; while (1) { int Max = -1000001; cin >> n; if (n == 0) break; a.push_back(0); for (int i = 0; i < n; i++) { cin >> num; a.push_back(num); } //?????Β§??? ...
[["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96], ["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 19]]
1
175
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (i = 0; i < n; ++i) #define each(itr, c) \ for (__typeof(c.begin()) itr = c.begin(); itr != c.end(); itr++) #define mp make_pair #define pb push_back #define fi first #d...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (i = 0; i < n; ++i) #define each(itr, c) \ for (__typeof(c.begin()) itr = c.begin(); itr != c.end(); itr++) #define mp make_pair #define pb push_back #define fi first #d...
[["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13]]
1
236
#include <iostream> using namespace std; int main() { int n; while (cin >> n) { if (n == 0) break; int a[n], S[n], sum = 0; for (int i = 0; i < n; ++i) { cin >> a[i]; sum += a[i]; S[i] = sum; } long max = S[0]; for (int i = 0; i < n; ++i) { if (S[i] > max) ...
#include <iostream> using namespace std; int main() { int n; while (cin >> n) { if (n == 0) break; int a[n], S[n], sum = 0; for (int i = 0; i < n; ++i) { cin >> a[i]; sum += a[i]; S[i] = sum; } long max = S[0]; for (int i = 1; i < n; ++i) { if (S[i] > max) ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
1
174
#include <algorithm> #include <iostream> #include <math.h> #include <string> #include <vector> using namespace std; int main() { int n; while (cin >> n && n > 0) { vector<int> a = vector<int>(n); for (int i = 0; i < n; i++) cin >> a[i]; vector<int> s = vector<int>(1, 0); bool f = true; b...
#include <algorithm> #include <iostream> #include <math.h> #include <string> #include <vector> using namespace std; int main() { int n; while (cin >> n && n > 0) { vector<int> a = vector<int>(n); for (int i = 0; i < n; i++) cin >> a[i]; vector<int> s = vector<int>(1, 0); bool f = true; b...
[["+", 0, 57, 15, 339, 51, 16, 12, 2, 63, 22], ["+", 15, 339, 51, 16, 12, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 16, 12, 2, 3, 4, 0, 25]]
1
315
#include <bits/stdc++.h> using namespace std; int main() { int n, m, s, a; while (cin >> n, n) { cin >> a; m = s = a; n--; while (n--) { cin >> a; if (s < 0) s = a; else s += a; m = max(s, m); } cout << m; } }
#include <bits/stdc++.h> using namespace std; int main() { int n, m, s, a; while (cin >> n, n) { cin >> a; m = s = a; n--; while (n--) { cin >> a; if (s < 0) s = a; else s += a; m = max(s, m); } cout << m << endl; } }
[["+", 0, 52, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 52, 8, 9, 0, 1, 0, 16, 12, 22]]
1
83
#include <stdio.h> int main(void) { int a[5010] = {}; int tr; int i, j; int n; int max; for (scanf("%d", &n); n; scanf("%d", &n)) { for (i = 0; i < 5010; i++) a[i] = 0; max = 0x80000000; for (i = 1; i <= n; i++) { scanf("%d", &tr); a[i] = a[i - 1] + tr; } for (i = 0; ...
#include <stdio.h> int main(void) { int a[5010] = {}; int tr; int i, j; int n; int max; for (scanf("%d", &n); n; scanf("%d", &n)) { for (i = 0; i < 5010; i++) a[i] = 0; max = 0x80000000; for (i = 1; i <= n; i++) { scanf("%d", &tr); a[i] = a[i - 1] + tr; } for (i = 0; ...
[["+", 0, 7, 8, 7, 10, 11, 12, 16, 17, 72], ["+", 0, 7, 8, 7, 10, 11, 12, 16, 12, 13], ["-", 12, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["-", 12, 16, 12, 69, 341, 342, 0, 16, 12, 13]]
1
183
#include <algorithm> #include <iostream> using namespace std; int main() { int n; int a[5000]; while (cin >> n && n > 0) { for (int i = 0; i < n; i++) cin >> a[i]; long long sum = 0, tmp = 0, ma = -100000; int m = -100000; bool flg = true; for (int i = 0; i < n; i++) { if (flg) ...
#include <algorithm> #include <iostream> using namespace std; int main() { int n; int a[5000]; while (cin >> n && n > 0) { for (int i = 0; i < n; i++) cin >> a[i]; long long sum = 0, tmp = 0, ma = -100000; int m = -100000; bool flg = true; for (int i = 0; i < n; i++) { if (flg) ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 19], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 27, 17, 68], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
212
#include <iostream> #include <vector> using namespace std; int main() { int n; while (cin >> n && n) { vector<int> a(n, 0); for (int i = 0; i < n; ++i) { cin >> a[i]; } // ????????Β£?ΒΆ??????????????????Β§??Β£?ΒΆ???????dp??Β¨????????? vector<int> dp(n, 0); dp[0] = a[0]; int max = 0; ...
#include <iostream> #include <vector> using namespace std; int main() { int n; while (cin >> n && n) { vector<int> a(n, 0); for (int i = 0; i < n; ++i) { cin >> a[i]; } // ????????Β£?ΒΆ??????????????????Β§??Β£?ΒΆ???????dp??Β¨????????? vector<int> dp(n, 0); dp[0] = a[0]; int max = dp[0];...
[["+", 8, 9, 0, 43, 49, 50, 51, 69, 28, 22], ["+", 0, 43, 49, 50, 51, 69, 341, 342, 0, 70], ["+", 0, 43, 49, 50, 51, 69, 341, 342, 0, 73]]
1
171
#include <bits/stdc++.h> using namespace std; /*{{{*/ // template #define REP(i, n) for (int i = 0; i < n; i++) #define rep(i, n) for (int i = 0; i < n; i++) #define INF 1 << 29 #define LINF LLONG_MAX / 3 #define MP make_pair #define PB push_back #define pb push_back #define EB emplace_back #define ALL(v) (v).begin(), ...
#include <bits/stdc++.h> using namespace std; /*{{{*/ // template #define REP(i, n) for (int i = 0; i < n; i++) #define rep(i, n) for (int i = 0; i < n; i++) #define INF 1 << 29 #define LINF LLONG_MAX / 3 #define MP make_pair #define PB push_back #define pb push_back #define EB emplace_back #define ALL(v) (v).begin(), ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
521
#include <iostream> using namespace std; int main() { int n = 1, count = 0; int a[10000]; while (cin >> n) { for (int i = 0; i < n; i++) { cin >> a[i]; } int sum = 0, max = -10000; for (int ai = 0; ai < n - 1; ai++) { sum = 0; for (int bi = ai; bi < n; bi++) { sum = sum ...
#include <iostream> using namespace std; int main() { int n = 1, count = 0; int a[10000]; while (cin >> n) { for (int i = 0; i < n; i++) { cin >> a[i]; } int sum = 0, max = -100000; for (int ai = 0; ai < n; ai++) { sum = 0; for (int bi = ai; bi < n; bi++) { sum = sum + a...
[["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
140
#include <iostream> #include <vector> using namespace std; int main() { int n, k; vector<int> dp; while (true) { cin >> n; if (n == 0) return 0; for (int i = 0; i < n; i++) { cin >> k; if (i == 0) dp.push_back(k); else dp.push_back(max(dp[i - 1] + k, k)); }...
#include <iostream> #include <vector> using namespace std; int main() { int n, k; vector<int> dp; while (true) { cin >> n; if (n == 0) return 0; for (int i = 0; i < n; i++) { cin >> k; if (i == 0) dp.push_back(k); else dp.push_back(max(dp[i - 1] + k, k)); }...
[["+", 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, 52, 8, 9, 0, 1, 0, 35]]
1
145
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define LOOP(i, x, n) for (int i = x; i < n; i++) #define ALL(v) (v).begin(), (v).end() #define PB push_back #define MP make_pair #define FR first #define SC second #define int long long using namespace std; const int MOD = 1000000007; const int IN...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define LOOP(i, x, n) for (int i = x; i < n; i++) #define ALL(v) (v).begin(), (v).end() #define PB push_back #define MP make_pair #define FR first #define SC second #define int long long using namespace std; const int MOD = 1000000007; const int IN...
[["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13]]
1
173
/*??Β£?Β¨?*/ #include <algorithm> #include <cstdio> #include <iostream> #include <math.h> #include <queue> #include <string.h> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i <= n; i++) int main() { int max = 0, n, a[5001] = {0}...
/*??Β£?Β¨?*/ #include <algorithm> #include <cstdio> #include <iostream> #include <math.h> #include <queue> #include <string.h> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i <= n; i++) int main() { int max = 0, n, a[5001] = {0}...
[["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13]]
1
151
#include <algorithm> #include <iostream> #include <math.h> #include <stdio.h> #include <string> #include <utility> #include <vector> using namespace std; int main() { long long n, a[5001], rui[5002] = {0}, ans[5002], cnt = 0; while (1) { cnt++; cin >> n; if (n == 0) break; for (int i = 0; i < ...
#include <algorithm> #include <iostream> #include <math.h> #include <stdio.h> #include <string> #include <utility> #include <vector> using namespace std; int main() { long long n, a[5001], rui[5002] = {0}, ans[5002], cnt = 0; while (1) { cnt++; cin >> n; if (n == 0) break; for (int i = 0; i < ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
216
#include <stdio.h> int main() { int a; while (1) { scanf("%d", &a); if (a == 0) return 0; long long int n[10000]; for (int i = 0; i < a; i++) scanf("%lld", n + i); long long int dp[10000]; dp[0] = n[0]; long long int max = 0; for (int i = 1; i < a; i++) { if (dp[i -...
#include <stdio.h> int main() { int a; while (1) { scanf("%d", &a); if (a == 0) return 0; long long int n[10000]; for (int i = 0; i < a; i++) scanf("%lld", n + i); long long int dp[10000]; dp[0] = n[0]; long long int max = dp[0]; for (int i = 1; i < a; i++) { if (dp...
[["+", 8, 9, 0, 43, 49, 50, 51, 69, 28, 22], ["+", 0, 43, 49, 50, 51, 69, 341, 342, 0, 70], ["+", 0, 43, 49, 50, 51, 69, 341, 342, 0, 73]]
1
175
#include <cstdio> #include <iostream> using namespace std; long long a[5000]; int main() { int n; while (cin >> n && n) { long long ans = 1e9; for (int i = 0; i < n; i++) cin >> a[i], ans = max(ans, a[i]); long long sub = 0; for (int i = 0; i < n; i++) { sub += a[i]; if (sub < 0)...
#include <cstdio> #include <iostream> using namespace std; long long a[5000]; int main() { int n; while (cin >> n && n) { long long ans = -1e9; for (int i = 0; i < n; i++) cin >> a[i], ans = max(ans, a[i]); long long sub = 0; for (int i = 0; i < n; i++) { sub += a[i]; if (sub < 0...
[["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13]]
1
132
#include <algorithm> // require sort next_permutation count __gcd reverse etc. #include <cctype> // require tolower, toupper #include <cfloat> #include <climits> #include <cmath> // require fabs #include <cstdio> // require scanf printf #include <cstdlib> // require abs exit atof atoi #include <cstring> // requir...
#include <algorithm> // require sort next_permutation count __gcd reverse etc. #include <cctype> // require tolower, toupper #include <cfloat> #include <climits> #include <cmath> // require fabs #include <cstdio> // require scanf printf #include <cstdlib> // require abs exit atof atoi #include <cstring> // requir...
[["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 22], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13]]
1
289
#include <algorithm> #include <climits> #include <cstdio> using namespace std; int main() { int n; while (scanf("%d", &n) && n != 0) { long long int a[n]; for (int i = 0; i < n; i++) scanf("%lld", &a[i]); long long int dp[n]; dp[0] = a[0]; long long int res = -100000 * 5000 - 1; for (...
#include <algorithm> #include <climits> #include <cstdio> using namespace std; int main() { int n; while (scanf("%d", &n) && n != 0) { long long int a[n]; for (int i = 0; i < n; i++) scanf("%lld", &a[i]); long long int dp[n]; dp[0] = a[0]; long long int res = dp[0]; for (int i = 1; i ...
[["-", 0, 43, 49, 50, 51, 16, 31, 16, 31, 13], ["-", 0, 43, 49, 50, 51, 16, 31, 16, 17, 48], ["-", 0, 43, 49, 50, 51, 16, 31, 16, 12, 13], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 69, 28, 22], ["+", 0, 43, 49, 50, 51, 69, 341, 342, 0, 70], ["...
1
164
#include <cstdio> #include <vector> using namespace std; int main(void) { int n; while (scanf("%d", &n) && n) { int num[5001] = {0}; int total[5001] = {0}; int ans = -2000000000; for (int i = 0; i < n; i++) { scanf("%d", &num[i]); } for (int i = 0; i < n; i++) { for (int j =...
#include <cstdio> #include <vector> using namespace std; int main(void) { int n; while (scanf("%d", &n) && n) { int num[5001] = {0}; int total[5001] = {0}; int ans = -2000000000; for (int i = 0; i < n; i++) { scanf("%d", &num[i]); } for (int i = 0; i < n; i++) { for (int j =...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
155
#include <stdio.h> int main(void) { while (1) { int n; scanf("%d", &n); if (n == 0) { break; } int a[5000]; int max; int i, j, k; for (i = 0; i < n; ++i) { scanf("%d", &a[i]); int sum = 0; for (j = i; j >= 0; --j) { sum += a[j]; } if ((i =...
#include <stdio.h> int main(void) { while (1) { int n; scanf("%d", &n); if (n == 0) { break; } int a[5000]; int max; int i, j; for (i = 0; i < n; ++i) { scanf("%d", &a[i]); int sum = 0; for (j = i; j >= 0; --j) { sum += a[j]; if ((i == 0 && j ...
[["-", 8, 9, 0, 52, 8, 9, 0, 43, 0, 21], ["-", 8, 9, 0, 52, 8, 9, 0, 43, 49, 22], ["-", 0, 7, 8, 9, 0, 7, 8, 9, 0, 46], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
144
#include <iostream> int main() { int n, v[5000], m; while (std::cin >> n, n) { for (int i = 0; i < n; i++) std::cin >> v[i]; m = v[0]; for (int i = 0; i < n; i++) for (int j = i, k = 0; j < n; j++, k += v[j]) if (k > m) m = k; std::cout << m << '\n'; } }
#include <iostream> int main() { int n, v[5000], m; while (std::cin >> n, n) { for (int i = 0; i < n; i++) std::cin >> v[i]; m = v[0]; for (int i = 0; i < n; i++) for (int j = i, k = v[i]; j < n; j++, k += v[j]) if (k > m) m = k; std::cout << m << '\n'; } }
[["-", 0, 7, 8, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 7, 10, 43, 49, 50, 51, 69, 28, 22], ["+", 10, 43, 49, 50, 51, 69, 341, 342, 0, 70], ["+", 10, 43, 49, 50, 51, 69, 341, 342, 0, 22], ["+", 10, 43, 49, 50, 51, 69, 341, 342, 0, 73]]
1
119
#include <iostream> int main() { int n, v[5000], m; while (std::cin >> n, m = n) { for (; m--;) std::cin >> v[m - 1]; m = *v; for (int i = 0; i < n; i++) for (int j = i, k = v[i]; j < n; j++, k += v[j]) m = k > m ? k : m; std::cout << m << '\n'; } }
#include <iostream> int main() { int n, v[5000], m; while (std::cin >> n, m = n) { for (; m--;) std::cin >> v[m]; m = *v; for (int i = 0; i < n; i++) for (int j = i, k = v[i]; j < n; j++, k += v[j]) m = k > m ? k : m; std::cout << m << '\n'; } }
[["-", 0, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["-", 0, 16, 12, 69, 341, 342, 0, 16, 12, 13]]
1
117
#include <iostream> main() { int n, v[5000], m; while (std::cin >> n, m = n) { for (; m--;) std::cin >> v[m]; m = *v; for (int i = 0; i++ < n;) for (int j = i, k = v[i]; j++ < n; k += v[j]) m = k > m ? k : m; std::cout << m << '\n'; } }
#include <iostream> main() { int n, v[5000], m; while (std::cin >> n, m = n) { for (; m--;) std::cin >> v[m]; m = *v; for (int i = 0; i < n; i++) for (int j = i, k = v[i]; j++ < n; k += v[j]) m = k > m ? k : m; std::cout << m << '\n'; } }
[["-", 8, 9, 0, 7, 15, 16, 31, 27, 17, 29], ["+", 0, 52, 8, 9, 0, 7, 26, 27, 28, 22], ["+", 0, 52, 8, 9, 0, 7, 26, 27, 17, 29]]
1
111
#include <algorithm> #include <iostream> using namespace std; int main(void) { int n, prev, d[5001], ret; while (1) { cin >> n; if (n == 0) break; cin >> d[0]; ret = d[0]; for (int i = 1; i < n; i++) { cin >> d[i]; for (int j = 0; j < i; j++) d[j] += d[i]; ret = m...
#include <algorithm> #include <iostream> using namespace std; int main(void) { int n, prev, d[5001], ret; while (1) { cin >> n; if (n == 0) break; cin >> d[0]; ret = d[0]; for (int i = 1; i < n; i++) { cin >> d[i]; for (int j = 0; j < i; j++) d[j] += d[i]; ret = m...
[["+", 0, 66, 28, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 66, 28, 2, 3, 4, 0, 16, 12, 13]]
1
132
#define _USE_MATH_DEFINES #include <algorithm> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; double sq(double x) { return x * x; } int a[5001]...
#define _USE_MATH_DEFINES #include <algorithm> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; double sq(double x) { return x * x; } int a[5001]...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]]
1
170
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> using namespace std; int n; int a[5001]; int sum[5001]; main() { while (1) { int res = 0; scanf("%d", &n); if (n == 0) break; int sm = 0; for (int i = 0; i < n; i++) { scanf("%d", &a[i]); sm += a[i]; ...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> using namespace std; int n; int a[5001]; int sum[5001]; main() { while (1) { int res = -1000000; scanf("%d", &n); if (n == 0) break; int sm = 0; for (int i = 0; i < n; i++) { scanf("%d", &a[i]); sm += a...
[["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13]]
1
185
#include <iostream> using namespace std; int main() { int n; int a; int sum; int sum2; int max; cin >> n; while (n) { cin >> sum; max = -100001; for (int i = 0; i < n - 1; i++) { cin >> sum2; sum += sum2; if (sum < sum2) { sum = sum2; } if (sum > max) { ...
#include <iostream> using namespace std; int main() { int n; int a; int sum; int sum2; long int max; cin >> n; while (n) { cin >> sum; max = sum; for (int i = 0; i < n - 1; i++) { cin >> sum2; sum += sum2; if (sum < sum2) { sum = sum2; } if (sum > max) { ...
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 22]]
1
108
#include <iostream> #include <string.h> int n; int a[5001]; void add(int i, int x) { while (i <= n) { a[i] += x; i += i & (-i); } return; } int sum(int i) { if (i == 0) return 0; int s = 0; while (i > 0) { s += a[i]; i -= i & (-i); } return s; } int main() { while (1) { ...
#include <iostream> #include <string.h> int n; int a[5001]; void add(int i, int x) { while (i <= n) { a[i] += x; i += i & (-i); } return; } int sum(int i) { if (i == 0) return 0; int s = 0; while (i > 0) { s += a[i]; i -= i & (-i); } return s; } int main() { while (1) { ...
[["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 16, 12, 2, 3, 4, 0, 16, 12, 13]]
1
241
#include <stdio.h> #define INF 1000000000 int ar[5000]; int d[5001]; int max(int a, int b) { if (a >= b) return a; else return b; } int main() { int n, i, j; while (1) { scanf("%d", &n); if (n == 0) return 0; for (i = 0; i < n; i++) { scanf("%d", &ar[i]); } d[0] = 0; ...
#include <stdio.h> #define INF -1000000000 int ar[5000]; int d[5001]; int max(int a, int b) { if (a >= b) return a; else return b; } int main() { int n, i, j; while (1) { scanf("%d", &n); if (n == 0) return 0; for (i = 0; i < n; i++) { scanf("%d", &ar[i]); } d[0] = 0; ...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]]
1
212
#include <iostream> using namespace std; int main() { int n; int b; int c; int d; int e; while (cin >> n) { if (n != 0) { break; } int a[n]; b = 0; while (b < n) { cin >> a[b]; b = b + 1; } d = a[0]; b = 0; while (b < n) { e = 0; c = b; ...
#include <iostream> using namespace std; int main() { int n; int b; int c; int d; int e; while (cin >> n) { if (n == 0) { break; } int a[n]; b = 0; while (b < n) { cin >> a[b]; b = b + 1; } d = a[0]; b = 0; while (b < n) { e = 0; c = b; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 79], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60]]
1
150
#include <iostream> using namespace std; int main() { while (1) { int n; cin >> n; if (!n) return 0; long long a[5010]; for (int i = 0; i < n; ++i) { cin >> a[i]; } long long ans; long long buf; for (int i = 0; i < n; ++i) { buf = 0; for (int j = i; j < n;...
#include <iostream> using namespace std; int main() { while (1) { int n; cin >> n; if (!n) return 0; long long a[5010]; for (int i = 0; i < n; ++i) { cin >> a[i]; } long long ans = -20000000000; long long buf; for (int i = 0; i < n; ++i) { buf = 0; for (in...
[["+", 0, 52, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13]]
1
133
#include <cstdio> #include <iostream> using namespace std; int num[5001]; /* int sum(int a,int b){ int s=0; for(int i=0;i<b;i++){ s+=num[a+i]; } return s; } */ int main() { int max; int n, sum; while (cin >> n, n) { max = -10000000; // int sum=-10000000; for (int i = 0; i < n; i++) { ...
#include <cstdio> #include <iostream> using namespace std; int num[5001]; /* int sum(int a,int b){ int s=0; for(int i=0;i<b;i++){ s+=num[a+i]; } return s; } */ int main() { int max; int n, sum; while (cin >> n, n) { max = -10000000; // int sum=-10000000; for (int i = 0; i < n; i++) { ...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
128
#include <algorithm> #include <cstring> #include <iostream> #include <list> #include <map> #include <stack> #include <string> #include <vector> using namespace std; int main() { int n; int max, tmpmax1, tmpmax2; while (cin >> n && n != 0) { max = -100001; int *factor = new int[n]; for (int i = 0; i...
#include <algorithm> #include <cstring> #include <iostream> #include <list> #include <map> #include <stack> #include <string> #include <vector> using namespace std; int main() { int n; int max, tmpmax1, tmpmax2; while (cin >> n && n != 0) { max = -100001; int *factor = new int[n]; for (int i = 0; i...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
172
#include <algorithm> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <stack> #include <vector> using namespace std; bool solve() { while (1) { int n; cin >> n; if (!n) break; vector<int> a(n, 0); ...
#include <algorithm> #include <cctype> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <stack> #include <vector> using namespace std; bool solve() { while (1) { int n; cin >> n; if (!n) break; vector<int> a(n, 0); ...
[["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
198
#include <climits> #include <iostream> #include <iterator> #include <numeric> #include <vector> using namespace std; int main(void) { int N; while (cin >> N, N) { vector<int> a(N); for (int i = 0; i < N; i++) cin >> a[i]; vector<int> sums; sums.push_back(0); partial_sum(a.begin(), a.end()...
#include <climits> #include <iostream> #include <iterator> #include <numeric> #include <vector> using namespace std; int main(void) { int N; while (cin >> N, N) { vector<int> a(N); for (int i = 0; i < N; i++) cin >> a[i]; vector<int> sums; sums.push_back(0); partial_sum(a.begin(), a.end()...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 17, 72], ["-", 0, 7, 10, 43, 49, 50, 51, 16, 12, 13]]
1
163
#include <iostream> using namespace std; int main() { int n; int num[10000]; while (cin >> n, n) { int max = -100001; for (int i = 0; i < n; i++) cin >> num[i]; for (int i = 0; i < n - 1; i++) { int sum = 0; for (int j = i; j < n; j++) { sum += num[j]; if (sum > ma...
#include <iostream> using namespace std; int main() { int n; int num[10000]; while (cin >> n, n) { int max = -100001; for (int i = 0; i < n; i++) cin >> num[i]; for (int i = 0; i < n; i++) { int sum = 0; for (int j = i; j < n; j++) { sum += num[j]; if (sum > max) ...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
122
/*Filename: aoj0022.cpp *Author: Mushiyo */ #include <climits> #include <cmath> #include <iostream> using namespace std; int main() { int n = 0; while (cin >> n) { if (n == 0) { break; } int a[n]; for (int i = 0; i < n; ++i) { cin >> a[i]; } int sum[n]; sum[0] = a[0];...
/*Filename: aoj0022.cpp *Author: Mushiyo */ #include <climits> #include <cmath> #include <iostream> using namespace std; int main() { int n = 0; while (cin >> n) { if (n == 0) { break; } int a[n]; for (int i = 0; i < n; ++i) { cin >> a[i]; } int sum[n]; sum[0] = a[0];...
[["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 22], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13]]
1
179
#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { double x[4], y[4]; int n; scanf("%d", &n); while (n--) { scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &x[0], &y[0], &x[1], &y[1], &x[2], &y[2], &x[3], &y[3]); puts(abs((y[1] - y[0]) * (x[3] - x[2]) - (y[3] - y[2]) * (x[1] - x[0]...
#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { double x[4], y[4]; int n; scanf("%d", &n); while (n--) { scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &x[0], &y[0], &x[1], &y[1], &x[2], &y[2], &x[3], &y[3]); puts(fabs((y[1] - y[0]) * (x[3] - x[2]) - (y[3] - y[2]) * (x[1] - x[0...
[["-", 3, 4, 0, 41, 15, 16, 31, 2, 63, 22], ["+", 3, 4, 0, 41, 15, 16, 31, 2, 63, 22]]
0
173
#include <stdio.h> int main() { int n, i; double x[4], y[4], kat[2]; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x[0], &y[0], &x[1], &y[1], &x[2], &y[2], &x[3], &y[3]); kat[0] = (y[1] - y[0]) / (x[1] - x[0]); kat[1] = (y[4] - y[3]) / (x[4] - x[...
#include <stdio.h> int main() { int n, i; double x[4], y[4], kat[2]; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x[0], &y[0], &x[1], &y[1], &x[2], &y[2], &x[3], &y[3]); kat[0] = (y[1] - y[0]) / (x[1] - x[0]); kat[1] = (y[2] - y[3]) / (x[2] - x[...
[["-", 12, 16, 31, 23, 0, 16, 31, 69, 71, 13], ["+", 12, 16, 31, 23, 0, 16, 31, 69, 71, 13], ["-", 12, 16, 12, 23, 0, 16, 31, 69, 71, 13], ["+", 12, 16, 12, 23, 0, 16, 31, 69, 71, 13]]
0
269
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { int n; int i; scanf("%d", &n); for (i = 0; i < n; i += 1) { double x1, y1, x2, y2, x3, y3, x4, y4; scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4); x2 -= x1; y2 -= y1; x4 -= x3; y4 -= x...
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { int n; int i; scanf("%d", &n); for (i = 0; i < n; i += 1) { double x1, y1, x2, y2, x3, y3, x4, y4; scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4); x2 -= x1; y2 -= y1; x4 -= x3; y4 -= y...
[["-", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13]]
0
145
#include <stdio.h> int main(void) { double x[4], y[4]; int n; scanf("%d", &n); while (n) { scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x[0], &y[0], &x[1], &y[1], &x[2], &y[2], &x[3], &y[3]); if ((y[1] - y[0]) / (x[1] - x[0]) == (y[3] - y[2]) / (x[3] - y[2])) { printf("YES\n"); } el...
#include <stdio.h> int main(void) { double x[4], y[4]; int n; scanf("%d", &n); while (n) { scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x[0], &y[0], &x[1], &y[1], &x[2], &y[2], &x[3], &y[3]); if (((y[1] - y[0]) / (x[1] - x[0])) == ((y[3] - y[2]) / (x[3] - x[2]))) { printf("YES\n"); ...
[["+", 0, 16, 31, 23, 0, 16, 31, 23, 0, 24], ["+", 0, 57, 15, 23, 0, 16, 31, 23, 0, 25], ["+", 0, 57, 15, 23, 0, 16, 12, 23, 0, 24], ["-", 12, 16, 12, 23, 0, 16, 12, 69, 28, 22], ["+", 0, 16, 12, 23, 0, 16, 12, 69, 28, 22], ["+", 0, 16, 12, 23, 0, 16, 12, 23, 0, 25]]
0
173
#include <stdio.h> main() { double x[100], y[100]; double a, b, c, d; int n, j; scanf("%d", &n); for (j = 0; j < n; j++) { scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &x[j], &y[j], &x[j + 1], &y[j + 1], &x[j + 2], &y[j + 2], &x[j + 3], &y[j]); a = x[j] - x[j + 1]; b = y[j] - y[j + 1]; c = x[j ...
#include <stdio.h> main() { double x[100], y[100]; double a, b, c, d; int n, j; scanf("%d", &n); for (j = 0; j < n; j++) { scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &x[j], &y[j], &x[j + 1], &y[j + 1], &x[j + 2], &y[j + 2], &x[j + 3], &y[j + 3]); a = x[j] - x[j + 1]; b = y[j] - y[j + 1]; c = ...
[["+", 3, 4, 0, 66, 28, 69, 71, 16, 17, 72], ["+", 3, 4, 0, 66, 28, 69, 71, 16, 12, 13]]
0
221
#include <stdio.h> int main(void) { int n, i, j, k, jud[n]; double x[4], y[4]; scanf("%d", &n); for (j = 0; j < n; j++) { for (i = 0; i < 4; i++) { scanf("%lf", &x[i]); scanf("%lf", &y[i]); } if ((y[0] - y[1]) / (x[0] - x[1]) == (y[2] - y[3]) / (x[2] - x[3])) jud[j] = 0; else ...
#include <stdio.h> int main(void) { int n, i, j, k, jud[101]; double x[4], y[4]; scanf("%d", &n); for (j = 0; j < n; j++) { for (i = 0; i < 4; i++) { scanf("%lf", &x[i]); scanf("%lf", &y[i]); } if ((y[0] - y[1]) / (x[0] - x[1]) == (y[2] - y[3]) / (x[2] - x[3])) jud[j] = 0; else...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]]
0
222
#include <stdio.h> enum { PARALLEL, NOT_PARALLEL }; int parallel(float *xs, float *ys); int main(void) { float xs[4], ys[4]; int n; scanf("%d", &n); while (n--) { scanf("%f %f %f %f %f %f %f %f", &xs[0], &ys[0], &xs[1], &ys[1], &xs[2], &ys[2], &xs[3], &ys[3]); if (parallel(xs, ys) == PARALLE...
#include <stdio.h> enum { PARALLEL, NOT_PARALLEL }; int parallel(float *xs, float *ys); int main(void) { float xs[4], ys[4]; int n; scanf("%d", &n); while (n--) { scanf("%f %f %f %f %f %f %f %f", &xs[0], &ys[0], &xs[1], &ys[1], &xs[2], &ys[2], &xs[3], &ys[3]); if (parallel(xs, ys) == PARALLE...
[["-", 12, 16, 12, 23, 0, 16, 31, 69, 71, 13], ["+", 12, 16, 12, 23, 0, 16, 31, 69, 71, 13], ["-", 12, 16, 12, 23, 0, 16, 12, 69, 71, 13], ["+", 12, 16, 12, 23, 0, 16, 12, 69, 71, 13]]
0
278
// include //------------------------------------------ #include <algorithm> #include <bitset> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #inc...
// include //------------------------------------------ #include <algorithm> #include <bitset> #include <cctype> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #inc...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 27, 17, 68], ["+", 0, 14, 8, 9, 0, 7, 15, 27, 17, 68]]
1
303
#include <complex.h> #include <iostream> #include <math.h> using namespace std; const double eps = pow(10, -11); double x[4], y[4]; int N; typedef complex<double> xy_t; double cross_product(xy_t a, xy_t b) { return (conj(a) * b).imag(); } int main() { cin >> N; //ε•ι‘Œζ•° for (int t = 0; t < 4; ++t) { for (int i =...
#include <complex.h> #include <iostream> #include <math.h> using namespace std; const double eps = pow(10, -11); double x[4], y[4]; int N; typedef complex<double> xy_t; double cross_product(xy_t a, xy_t b) { return (conj(a) * b).imag(); } int main() { cin >> N; //ε•ι‘Œζ•° for (int t = 0; t < N; ++t) { for (int i =...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
225
#include <algorithm> #include <cmath> #include <cstdio> #include <deque> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; int n; double x1, x2, x3, x4, ya1, y2, y3, y4; int main() { cin >> n; for (int i =...
#include <algorithm> #include <cmath> #include <cstdio> #include <deque> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; int n; double x1, x2, x3, x4, ya1, y2, y3, y4; int main() { cin >> n; for (int i =...
[["+", 0, 57, 15, 339, 51, 16, 31, 2, 63, 22], ["+", 3, 4, 0, 16, 31, 16, 31, 23, 0, 24], ["+", 3, 4, 0, 16, 12, 16, 12, 23, 0, 25]]
1
262
#include <iostream> using namespace std; void Solution() { int n; cin >> n; while (n--) { float x1, y1; float x2, y2; float x3, y3; float x4, y4; cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4; float ab = (y2 - y1) / (x2 - x1); // when "y / x = " another...
// // practise.h // c++practise // // Created by Ubnit04 on 2015/06/10. // // #include <iostream> using namespace std; void Solution() { int n; cin >> n; while (n--) { float x1, y1; float x2, y2; float x3, y3; float x4, y4; cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4; floa...
[["-", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6], ["+", 0, 1, 0, 16, 31, 16, 12, 5, 0, 6]]
1
135
#include <cmath> #include <iostream> #define rep(i, a, n) for (int i = a; i < n; i++) using namespace std; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { double x1, y1, x2, y2, x3, y3, x4, y4; cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4; double a1 = x2 - x1; double b1 = y2 -...
#include <cmath> #include <iostream> #define rep(i, a, n) for (int i = a; i < n; i++) using namespace std; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { double x1, y1, x2, y2, x3, y3, x4, y4; cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4; double a1 = x2 - x1; double b1 = y2 -...
[["+", 0, 57, 15, 339, 51, 16, 31, 2, 63, 22], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 25]]
1
142
#include <iostream> using namespace std; int main() { float a, s, d, f, g, h, j, k; float q, w, e, r; int n; cin >> n; for (int i = 0; i < n; i++) { cin >> a >> s >> d >> f >> g >> h >> j >> k; q = d - a; w = f - s; e = j - g; r = k - h; int key = q * r - w * e; if (!key) co...
#include <iostream> using namespace std; int main() { float a, s, d, f, g, h, j, k; float q, w, e, r; int n; cin >> n; for (int i = 0; i < n; i++) { cin >> a >> s >> d >> f >> g >> h >> j >> k; q = d - a; w = f - s; e = j - g; r = k - h; float key = q * r - w * e; if (!key) ...
[["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40]]
1
139
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <string> #include <vector> using namespace std; int main(void) { int n; cin >> n; for (int i = 0; i < n; i++) { double x1, y1, x2, y2; double x3, y3, x4, y4; cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <string> #include <vector> using namespace std; int main(void) { int n; cin >> n; for (int i = 0; i < n; i++) { double x1, y1, x2, y2; double x3, y3, x4, y4; cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >...
[["+", 0, 57, 15, 339, 51, 16, 31, 2, 63, 22], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 25], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
132
// // // // // // // #include <complex> #include <iostream> using namespace std; typedef complex<double> xy_t; double cross_product(complex<double> a, complex<double> b) { return (conj(a) * b).imag(); } int main() { int n; //??????????????Β° cin >> n; while (n > 0) { complex<double> a, b, c, d, e, f; ...
// // // // // // // #include <complex> #include <iostream> using namespace std; typedef complex<double> xy_t; double cross_product(complex<double> a, complex<double> b) { return (conj(a) * b).imag(); } int main() { int n; //??????????????Β° cin >> n; while (n > 0) { complex<double> a, b, c, d, e, f; ...
[["+", 0, 57, 15, 339, 51, 16, 31, 2, 63, 22], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 24], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 25]]
1
237
#include <algorithm> #include <iostream> using namespace std; int main() { int n; cin >> n; float point[4][2]; for (int i = 0; i < n; i++) { for (int j = 0; j < 4; j++) { for (int k = 0; k < 2; k++) { cin >> point[j][k]; } } if ((point[1][1] - point[0][1]) / (point[1][0] - poi...
#include <algorithm> #include <iostream> using namespace std; int main() { int n; cin >> n; float point[4][2]; for (int i = 0; i < n; i++) { for (int j = 0; j < 4; j++) { for (int k = 0; k < 2; k++) { cin >> point[j][k]; } } if ((point[1][1] - point[0][1]) / (point[1][0] - poi...
[["-", 12, 23, 0, 16, 31, 16, 31, 23, 0, 24], ["+", 15, 339, 51, 16, 12, 16, 12, 23, 0, 24]]
1
182
#include <iostream> using namespace std; int main() { long double x1, y1, x2, y2, x3, y3, x4, y4; int n; cin >> n; int N[100]; for (int i = 0; i < n; i++) { cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4; if ((y1 - y2) / (x1 - x2) == (y3 - y4) / (x3 - x4)) { N[i] = 1; } else { N[i...
#include <iostream> using namespace std; int main() { long double x1, y1, x2, y2, x3, y3, x4, y4; int n; cin >> n; int N[100]; for (int i = 0; i < n; i++) { cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4; if ((y1 - y2) / (x1 - x2) == (y3 - y4) / (x3 - x4)) { N[i] = 1; } else { N[i...
[["-", 8, 9, 0, 57, 15, 339, 51, 11, 17, 32], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 75, 76, 0, 57, 15, 339, 51, 11, 17, 32], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 60]]
1
180
#include <algorithm> #include <cctype> #include <cmath> #include <iostream> #include <map> // pair #include <set> #include <stdio.h> #include <string> #include <vector> #define MAXSIZE 200000 #define PI 3.141592653589 using namespace std; template <typename T> T add(T a, T b) { return a + b; } namespace A { int f(vo...
#include <algorithm> #include <cctype> #include <cmath> #include <iostream> #include <map> // pair #include <set> #include <stdio.h> #include <string> #include <vector> #define MAXSIZE 200000 #define PI 3.141592653589 using namespace std; template <typename T> T add(T a, T b) { return a + b; } namespace A { int f(vo...
[["+", 0, 57, 15, 339, 51, 16, 31, 2, 63, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
192
#include <cmath> #include <iostream> using namespace std; int main(void) { int n; cin >> n; for (int i = 0; i < n; ++i) { double x1, y1, x2, y2, x3, y3, x4, y4; cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4; if ((x2 - x1) == 0 && (x4 - x3) == 0) cout << "YES" << endl; else { int...
#include <cmath> #include <iostream> using namespace std; int main(void) { int n; cin >> n; for (int i = 0; i < n; ++i) { double x1, y1, x2, y2, x3, y3, x4, y4; cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4; if (((x2 - x1) == 0) && ((x4 - x3) == 0)) cout << "YES" << endl; else { ...
[["+", 51, 16, 31, 23, 0, 16, 31, 23, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 31, 23, 0, 25], ["+", 0, 57, 15, 339, 51, 16, 12, 23, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 12, 23, 0, 25], ["-", 0, 57, 75, 76, 0, 9, 0, 43, 39, 40], ["+", 0, 57, 75, 76, 0, 9, 0, 43, 39, 40]]
1
155
#include <complex> #include <iostream> int main() { const double E = 1e-10; int n; double x1, y1, x2, y2, x3, y3, x4, y4; std::cin >> n; while (n--) { std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4; std::cout << (std::abs((y2 - y1) * (x4 - x3) - (y4 - y3) * (x2 - x1)) < E) ? "YES\n" ...
#include <complex> #include <iostream> int main() { const double E = 1e-10; int n; double x1, y1, x2, y2, x3, y3, x4, y4; std::cin >> n; while (n--) { std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4; std::cout << ((std::abs((y2 - y1) * (x4 - x3) - (y4 - y3) * (x2 - x1)) < E) ...
[["+", 0, 16, 12, 23, 0, 41, 15, 23, 0, 24], ["+", 8, 9, 0, 1, 0, 16, 12, 23, 0, 25]]
1
116
#include <cmath> #include <iostream> using namespace std; int main() { int N; cin >> N; while (N--) { double x1, x2, x3, x4, y1, y2, y3, y4; cin >> x1 >> y1 >> x2 >> y2; cin >> x3 >> y3 >> x4 >> y4; x2 -= x1; y2 -= y1; x4 -= x3; y4 -= y3; cout << (fabs(x2 * y4 - x4 * y2 < 1e-5) ...
#include <cmath> #include <iostream> using namespace std; int main() { int N; cin >> N; while (N--) { double x1, x2, x3, x4, y1, y2, y3, y4; cin >> x1 >> y1 >> x2 >> y2; cin >> x3 >> y3 >> x4 >> y4; x2 -= x1; y2 -= y1; x4 -= x3; y4 -= y3; cout << (fabs(x2 * y4 - x4 * y2) < 1e-10...
[["-", 0, 41, 15, 2, 3, 4, 0, 16, 17, 18], ["-", 0, 41, 15, 2, 3, 4, 0, 16, 12, 13], ["+", 31, 16, 12, 23, 0, 41, 15, 16, 17, 18], ["+", 31, 16, 12, 23, 0, 41, 15, 16, 12, 13]]
1
108