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 |
|---|---|---|---|---|---|
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int[] values = new int[w];
for (int i = 0; i < values.length; i++) {
values[i] = i + 1;
}
for (int i = 0; i < n; i++) {
... | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int[] values = new int[w];
for (int i = 0; i < values.length; i++) {
values[i] = i + 1;
}
for (int i = 0; i < n; i++) {
... | [["+", 8, 196, 0, 503, 49, 200, 51, 16, 17, 33], ["+", 8, 196, 0, 503, 49, 200, 51, 16, 12, 499]] | 3 | 218 | 2 |
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);
int num = Integer.parseInt(sc.nextLine());
int[] e = new int[num];
for (int i = 0; i < num; i++) {
e[i] = i + 1;
}
... | 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);
int num = Integer.parseInt(sc.nextLine());
int[] e = new int[num];
for (int i = 0; i < num; i++) {
e[i] = i + 1;
}
... | [["+", 8, 196, 0, 503, 49, 200, 51, 16, 17, 33], ["+", 8, 196, 0, 503, 49, 200, 51, 16, 12, 499]] | 3 | 226 | 4 |
import java.util.*;
public class Main {
private static final Scanner scan = new Scanner(System.in);
public static void main(String[] args) {
int w = scan.nextInt();
int[] dl = new int[w];
for (int i = 0; i < w; i++) {
dl[i] = i + 1;
}
int n = scan.nextInt();
for (int i = 0; i < n; i+... | import java.util.*;
public class Main {
private static final Scanner scan = new Scanner(System.in);
public static void main(String[] args) {
int w = scan.nextInt();
int[] dl = new int[w];
for (int i = 0; i < w; i++) {
dl[i] = i + 1;
}
int n = scan.nextInt();
for (int i = 0; i < n; i+... | [["-", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22], ["+", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22], ["-", 49, 200, 51, 492, 3, 4, 0, 5, 0, 44]] | 3 | 224 | 3 |
import sys
n=10**5
s=[True]*n
s[0]=False
s[1]=False
for x in range(2, int(n**0.5)+1):
if s[x]:
for i in range(x+x,n,x):
s[i]=False
for x in sys.stdin.readlines():
x=int(x)
cnt=0
for i in range(x):
if s[i]:
cnt=cnt+1
print(cnt) | import sys
n=10**6
s=[True]*n
s[0]=False
s[1]=False
for x in range(2, int(n**0.5)+1):
if s[x]:
for i in range(x+x,n,x):
s[i]=False
for x in sys.stdin.readlines():
x=int(x)+1
cnt=0
for i in range(x):
if s[i]:
cnt=cnt+1
print(cnt) | [["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612]] | 5 | 112 | 4 |
import math
def get_primes(max_number):#return prime list smaller than max_number
if max_number == 2:
return [2]
elif max_number < 3:
return []
numbers=list(range(1, max_number + 2, 2))
nroot=math.floor(max_number ** 0.5)
n=len(numbers)
numbers[0]=0
for i in range(... | import math
def get_primes(max_number):#return prime list smaller than max_number
if max_number == 2:
return [2]
elif max_number < 3:
return []
numbers=list(range(1, max_number + 2, 2))
nroot=math.floor(max_number ** 0.5)
n=len(numbers)
numbers[0]=0
for i in range(... | [["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]] | 5 | 269 | 2 |
from bisect import bisect
def sieve(n):
num = [True]*n
num[0] = num[1] = False
for i in range(2,int(n**0.5)+1):
if num[i]:
for j in range(i**2, n, i):
num[j] = False
return [i for i in range(2,n) if num[i]]
prime = sieve(999999)
while True:
try:
print(bisect(is_prime, eval(input())))
... | from bisect import bisect
def sieve(n):
num = [True]*n
num[0] = num[1] = False
for i in range(2,int(n**0.5)+1):
if num[i]:
for j in range(i**2, n, i):
num[j] = False
return [i for i in range(2,n) if num[i]]
prime = sieve(999999)
while True:
try:
print(bisect(prime, eval(input())))
e... | [["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 22]] | 5 | 117 | 2 |
<?php
function to_f($e) {
return (int)$e;
}
$n = fgets(STDIN);
for($i=0; $i<(int)$n; $i++) {
$line = fgets(STDIN);
$a = explode(" ", $line);
$a = array_map("to_f", $a);
$a1 = 2*($a[2]-$a[0]);
$a2 = 2*($a[4]-$a[0]);
$b1 = 2*($a[3]-$a[1]);
$b2 = 2*($a[5]-$a[1]);
$c1 = $a[0]*$a[... | <?php
function to_d($e) {
return (double)$e;
}
$n = fgets(STDIN);
for($i=0; $i<(double)$n; $i++) {
$line = fgets(STDIN);
$a = explode(" ", $line);
$a = array_map("to_d", $a);
$a1 = 2*($a[2]-$a[0]);
$a2 = 2*($a[4]-$a[0]);
$b1 = 2*($a[3]-$a[1]);
$b2 = 2*($a[5]-$a[1]);
$c1 = $a[... | [["-", 36, 36, 36, 36, 0, 493, 0, 14, 141, 141], ["+", 36, 36, 36, 36, 0, 493, 0, 14, 141, 141], ["-", 0, 14, 8, 9, 0, 37, 0, 74, 39, 615], ["+", 0, 14, 8, 9, 0, 37, 0, 74, 39, 615], ["-", 0, 493, 0, 7, 0, 16, 12, 74, 39, 615], ["+", 0, 493, 0, 7, 0, 16, 12, 74, 39, 615], ["-", 12, 613, 3, 3, 0, 28, 0, 609, 0, 610], ["... | 6 | 387 | 8 |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int i = 0; i < n; i++) {
double x1 = sc.nextDouble();
double y1 = sc.nextDouble();
double x2 = sc.nextDouble();
double y2 = sc.next... | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int i = 0; i < n; i++) {
double x1 = sc.nextDouble();
double y1 = sc.nextDouble();
double x2 = sc.nextDouble();
double y2 = sc.next... | [["-", 0, 1, 0, 492, 3, 4, 0, 5, 0, 491], ["-", 0, 1, 0, 492, 3, 4, 0, 5, 0, 44], ["+", 0, 1, 0, 492, 3, 4, 0, 5, 0, 491]] | 3 | 393 | 6 |
import java.util.*;
public class Main {
public static double x1, x2, y1, y2, x3, y3, a, b, c, a1, b1, c1, xp, yp;
static double z(double z1, double z2, double z3, double z4) {
return Math.sqrt(Math.pow(z3 - z1, 2) + Math.pow(z4 - z2, 2));
}
public static void main(String[] args) {
Scanner sc = new Scan... | import java.util.*;
public class Main {
public static double x1, x2, y1, y2, x3, y3, a, b, c, a1, b1, c1, xp, yp;
static double z(double z1, double z2, double z3, double z4) {
return Math.sqrt(Math.pow(z3 - z1, 2) + Math.pow(z4 - z2, 2));
}
public static void main(String[] args) {
Scanner sc = new Scan... | [["-", 0, 1, 0, 492, 3, 4, 0, 5, 0, 491], ["+", 0, 1, 0, 492, 3, 4, 0, 5, 0, 491]] | 3 | 382 | 2 |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int i = 0; i < n; i++) {
double x1 = sc.nextDouble();
double y1 = sc.nextDouble();
double x2 = sc.nextDouble();
double y2 = sc.nex... | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int i = 0; i < n; i++) {
double x1 = sc.nextDouble();
double y1 = sc.nextDouble();
double x2 = sc.nextDouble();
double y2 = sc.nex... | [["-", 0, 1, 0, 492, 3, 4, 0, 5, 0, 491], ["+", 0, 1, 0, 492, 3, 4, 0, 5, 0, 491], ["+", 0, 1, 0, 492, 3, 4, 0, 5, 0, 44]] | 3 | 480 | 3 |
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] argv) throws IOException {
//*
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int count = 1;
count = Integer.parseInt(in.readLine());
while (count-- > 0) {
String s = in.r... |
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] argv) throws IOException {
//*
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int count = 1;
count = Integer.parseInt(in.readLine());
while (count-- > 0) {
String s = in.r... | [["-", 51, 16, 12, 23, 0, 16, 31, 504, 71, 499], ["+", 51, 16, 12, 23, 0, 16, 31, 504, 71, 499], ["-", 51, 16, 12, 23, 0, 16, 12, 504, 71, 499], ["+", 51, 16, 12, 23, 0, 16, 12, 504, 71, 499], ["-", 31, 16, 12, 492, 3, 4, 0, 504, 71, 499], ["+", 31, 16, 12, 492, 3, 4, 0, 504, 71, 499]] | 3 | 641 | 8 |
import java.util.ArrayList;
import java.util.NoSuchElementException;
import java.util.Scanner;
public class Main {
private static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
ArrayList<Double> inputs = new ArrayList<Double>(6);
ArrayList<Double> resultsX = new ArrayList<D... |
import java.util.ArrayList;
import java.util.NoSuchElementException;
import java.util.Scanner;
public class Main {
private static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
ArrayList<Double> inputs = new ArrayList<Double>(6);
ArrayList<Double> resultsX = new ArrayList<D... | [["-", 0, 503, 49, 200, 51, 16, 31, 16, 31, 22], ["+", 0, 503, 49, 200, 51, 16, 31, 16, 31, 22], ["-", 0, 503, 49, 200, 51, 16, 31, 16, 12, 22], ["+", 0, 503, 49, 200, 51, 16, 31, 16, 12, 22], ["-", 0, 503, 49, 200, 51, 16, 12, 16, 31, 22], ["+", 0, 503, 49, 200, 51, 16, 12, 16, 31, 22], ["-", 0, 503, 49, 200, 51, 16, ... | 3 | 854 | 8 |
import java.util.*;
public class Main {
static Scanner sc = new Scanner(System.in);
static int N;
public static void main(String[] args) {
N = sc.nextInt();
double[] x = new double[3], y = new double[3];
for (int i = 0; i < N; i++) {
for (int j = 0; j < 3; j++) {
x[j] = sc.nextDouble();
... | import java.util.*;
public class Main {
static Scanner sc = new Scanner(System.in);
static int N;
public static void main(String[] args) {
N = sc.nextInt();
double[] x = new double[3], y = new double[3];
for (int i = 0; i < N; i++) {
for (int j = 0; j < 3; j++) {
x[j] = sc.nextDouble();
... | [["-", 0, 1, 0, 492, 3, 4, 0, 5, 0, 491], ["+", 0, 1, 0, 492, 3, 4, 0, 5, 0, 491], ["+", 0, 1, 0, 492, 3, 4, 0, 5, 0, 44]] | 3 | 458 | 3 |
import java.util.*;
public class Main {
static double[] solve(double a, double b, double c, double d, double e,
double f) {
double det = a * e - b * d;
double[] ans = new double[2];
ans[0] = (c * e - b * f) / det;
ans[1] = (a * f - c * d) / det;
for (int i = 0; i < 2; i++... | import java.util.*;
public class Main {
static double[] solve(double a, double b, double c, double d, double e,
double f) {
double det = a * e - b * d;
double[] ans = new double[2];
ans[0] = (c * e - b * f) / det;
ans[1] = (a * f - c * d) / det;
for (int i = 0; i < 2; i++... | [["-", 0, 16, 12, 16, 31, 23, 0, 16, 12, 22], ["+", 0, 16, 12, 16, 31, 23, 0, 16, 12, 22], ["-", 0, 16, 12, 16, 12, 23, 0, 16, 12, 22], ["+", 0, 16, 12, 16, 12, 23, 0, 16, 12, 22]] | 3 | 375 | 4 |
import java.math.BigDecimal;
import java.util.Scanner;
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
int N = cin.nextInt();
for (; N-- != 0;) {
double x1 = cin.nextDouble();
double y1 = cin.nextDouble();
... | import java.math.BigDecimal;
import java.util.Scanner;
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
int N = cin.nextInt();
for (; N-- != 0;) {
double x1 = cin.nextDouble();
double y1 = cin.nextDouble();
... | [["-", 0, 16, 12, 492, 3, 4, 0, 16, 31, 22], ["+", 0, 16, 12, 492, 3, 4, 0, 16, 31, 22]] | 3 | 492 | 2 |
import java.awt.geom.Point2D;
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n;
Point2D.Double a, b, c;
Point2D.Double middle1, middle2;
double slope1, slope2;
Point2D.Double solve;
double r;
n = sc.next... | import java.awt.geom.Point2D;
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n;
Point2D.Double a, b, c;
Point2D.Double middle1, middle2;
double slope1, slope2;
Point2D.Double solve;
double r;
n = sc.next... | [["+", 0, 1, 0, 492, 3, 4, 0, 5, 0, 44], ["+", 8, 196, 0, 37, 0, 16, 31, 91, 17, 33], ["-", 0, 195, 8, 196, 0, 503, 49, 200, 51, 499], ["+", 0, 195, 8, 196, 0, 503, 49, 200, 51, 515]] | 3 | 610 | 6 |
#include <math.h>
#include <stdio.h>
int main() {
int i, n;
double x1, y1, x2, y2, x3, y3, x, y, a, b, c, d, e, f;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%lg %lg %lg %lg %lg %lg", &x1, &y1, &x2, &y2, &x3, &y3);
x2 -= x1;
y2 -= y1;
x3 -= x1;
y3 -= y1;
a = x2;
b = y2;
c ... | #include <math.h>
#include <stdio.h>
int main() {
int i, n;
double x1, y1, x2, y2, x3, y3, x, y, a, b, c, d, e, f;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%lg %lg %lg %lg %lg %lg", &x1, &y1, &x2, &y2, &x3, &y3);
x2 -= x1;
y2 -= y1;
x3 -= x1;
y3 -= y1;
a = x2;
b = y2;
c ... | [["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]] | 0 | 252 | 4 |
#include <math.h>
#include <stdio.h>
int main(void) {
double x1, x2, x3, y1, y2, y3, x, y, r, a, s;
int n;
scanf("%d", &n);
while ((n != 0) &&
(scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3) != EOF)) {
a = (sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)) +
sqrt(x2 * x2 + y... | #include <math.h>
#include <stdio.h>
int main(void) {
double x1, x2, x3, y1, y2, y3, x, y, r, a, s;
int n;
scanf("%d", &n);
while ((n != 0) &&
(scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3) != EOF)) {
a = (sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)) +
sqrt(x2 * x2 + y... | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 393 | 2 |
#include <math.h>
#include <stdio.h>
int main() {
int n;
double x1, y1, x2, y2, x3, y3, a, b, c, s, q, sina, r, px, py;
scanf("%d", &n);
while (n--) {
scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);
a = sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2));
b = sqrt(pow(x1 - x3, 2) + pow(y1 - y3,... | #include <math.h>
#include <stdio.h>
int main() {
int n;
double x1, y1, x2, y2, x3, y3, a, b, c, s, q, sina, r, px, py;
scanf("%d", &n);
while (n--) {
scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);
a = sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2));
b = sqrt(pow(x1 - x3, 2) + pow(y1 - y3,... | [["-", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22]] | 0 | 343 | 4 |
#include <math.h>
#include <stdio.h>
int main();
double sq(double);
int main() {
double x1, x2, x3, y1, y2, y3, a1, b1, c1, a2, b2, c2, x, y, r, dx, dy;
int n, i;
scanf("%d\n", &n);
for (i = 0; i < n; i++) {
scanf("%lf %lf %lf %lf %lf %lf\n", &x1, &y1, &x2, &y2, &x3, &y3);
a1 = 2 * (x2 - x1);
b1... | #include <math.h>
#include <stdio.h>
int main();
double sq(double);
int main() {
double x1, x2, x3, y1, y2, y3, a1, b1, c1, a2, b2, c2, x, y, r, dx, dy;
int n, i;
scanf("%d\n", &n);
for (i = 0; i < n; i++) {
scanf("%lf %lf %lf %lf %lf %lf\n", &x1, &y1, &x2, &y2, &x3, &y3);
a1 = 2 * (x2 - x1);
b1... | [["+", 12, 2, 3, 4, 0, 16, 31, 2, 63, 22], ["+", 3, 4, 0, 16, 31, 2, 3, 4, 0, 24], ["+", 3, 4, 0, 16, 31, 2, 3, 4, 0, 25], ["+", 12, 2, 3, 4, 0, 16, 12, 2, 63, 22], ["+", 3, 4, 0, 16, 12, 2, 3, 4, 0, 24], ["+", 3, 4, 0, 16, 12, 2, 3, 4, 0, 25]] | 0 | 301 | 6 |
#include <math.h>
#include <stdio.h>
int main() {
int i, n;
double x1, x2, x3, y1, y2, y3;
double a, b, c, d, e, f;
double X1, Y1, r;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);
a = 2 * (x2 - x1);
b = 2 * (y2 - y1);
c = x1 * x1... | #include <math.h>
#include <stdio.h>
int main() {
int i, n;
double x1, x2, x3, y1, y2, y3;
double a, b, c, d, e, f;
double X1, Y1, r;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);
a = 2 * (x2 - x1);
b = 2 * (y2 - y1);
c = x1 * x1... | [["-", 12, 16, 12, 23, 0, 16, 31, 16, 12, 22], ["+", 12, 16, 12, 23, 0, 16, 31, 16, 12, 22]] | 0 | 360 | 2 |
#include <math.h>
#include <stdio.h>
int main() {
int n, i;
double x1, x2, x3, y1, y2, y3;
double x, y, r;
double a, b;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);
if (y1 == y2) {
a = (x2 * x2 + y2 * y2 - (x3 * x3 + y3 * y3)) / (2... | #include <math.h>
#include <stdio.h>
int main() {
int n, i;
double x1, x2, x3, y1, y2, y3;
double x, y, r;
double a, b;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);
if (y1 == y2) {
a = (x2 * x2 + y2 * y2 - (x3 * x3 + y3 * y3)) / (2... | [["-", 64, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["-", 0, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 12, 22]] | 0 | 629 | 4 |
#include <math.h>
#include <stdio.h>
int main(void) {
double x1, x2, x3, y1, y2, y3;
int n;
double a1, b1, c1, a2, b2, c2, x, y, r;
scanf("%d", &n);
while (n--) {
scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);
a1 = 2 * (x2 - x1);
b1 = 2 * (y2 - y1);
c1 = x1 * x1 - x2 * x2 +... | #include <math.h>
#include <stdio.h>
int main(void) {
double x1, x2, x3, y1, y2, y3;
int n;
double a1, b1, c1, a2, b2, c2, x, y, r;
scanf("%d", &n);
while (n--) {
scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);
a1 = 2 * (x2 - x1);
b1 = 2 * (y2 - y1);
c1 = x1 * x1 - x2 * x2 +... | [["-", 0, 11, 12, 16, 12, 23, 0, 16, 12, 22], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 12, 22]] | 0 | 264 | 2 |
#include <math.h>
#include <stdio.h>
#define SQ(X) ((X) * (X))
#define SQDIST(X1, Y1, X2, Y2) (SQ((X2) - (X1)) + SQ((Y2) - (Y1)))
#define DIST(X1, Y1, X2, Y2) (sqrt(SQDIST(X1, Y1, X2, Y2)))
/** Application main entry point. */
int main(int argc, char *argv[]) {
int n;
scanf("%d", &n);
while (n--) {
double... | #include <math.h>
#include <stdio.h>
#define SQ(X) ((X) * (X))
#define SQDIST(X1, Y1, X2, Y2) (SQ((X2) - (X1)) + SQ((Y2) - (Y1)))
#define DIST(X1, Y1, X2, Y2) (sqrt(SQDIST(X1, Y1, X2, Y2)))
/** Application main entry point. */
int main(int argc, char *argv[]) {
int n;
scanf("%d", &n);
while (n--) {
double... | [["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22]] | 0 | 388 | 2 |
main() {
double a, b, c, d, e, f, g, h, i, x, y;
for (scanf("%*d"); ~scanf("%lf%lf%lf%lf%lf%lf", &a, &b, &c, &d, &e, &f);
printf("%.3f %.3f %.3f\n", x, y, hypot(a - x, b - y)))
g = a * a + b * b, h = c * c + d * d, i = e * e + f * f,
x = (a * (h - i) + c * (i - g) + e * (g - h)) /
(y = a * (d... | main() {
double a, b, c, d, e, f, g, h, i, x, y;
for (scanf("%*d"); ~scanf("%lf%lf%lf%lf%lf%lf", &a, &b, &c, &d, &e, &f);
printf("%.3f %.3f %.3f\n", x, y, hypot(a - x, b - y)))
g = a * a + b * b, h = c * c + d * d, i = e * e + f * f,
y = (a * (h - i) + c * (i - g) + e * (g - h)) /
(x = a * (d... | [["-", 12, 34, 12, 34, 12, 34, 31, 11, 31, 22], ["+", 12, 34, 12, 34, 12, 34, 31, 11, 31, 22], ["-", 12, 16, 31, 16, 12, 23, 0, 11, 31, 22], ["+", 12, 16, 31, 16, 12, 23, 0, 11, 31, 22], ["-", 12, 34, 12, 34, 12, 34, 12, 11, 31, 22], ["+", 12, 34, 12, 34, 12, 34, 12, 11, 31, 22], ["-", 12, 34, 12, 11, 12, 16, 31, 16, 1... | 0 | 206 | 8 |
#include <math.h>
#include <stdio.h>
int main(void) {
int n;
float x1, x2, x3;
float y1, y2, y3;
float dx, dy;
float tx, ty, r;
float a1, b1, c1, a2, b2, c2;
scanf("%d", &n);
while (n > 0) {
n--;
scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);
dx = x1;
dy = y1;
//... | #include <math.h>
#include <stdio.h>
int main(void) {
int n;
double x1, x2, x3;
double y1, y2, y3;
double dx, dy;
double tx, ty, r;
double a1, b1, c1, a2, b2, c2;
scanf("%d", &n);
while (n > 0) {
n--;
scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);
dx = x1;
dy = y1;
... | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]] | 0 | 283 | 10 |
#include <math.h>
#include <stdio.h>
int main(void) {
double x, y, r;
double x1, x2, x3, y1, y2, y3;
double ecm[3][2];
double a, b, A;
int i;
int n;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);
ecm[0][0] = x1 - x2;
ecm[0][1] = y1 ... | #include <math.h>
#include <stdio.h>
int main(void) {
double x, y, r;
double x1, x2, x3, y1, y2, y3;
double ecm[2][3];
double a, b, A;
int i;
int n;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);
ecm[0][0] = x1 - x2;
ecm[0][1] = y... | [["-", 8, 9, 0, 43, 49, 80, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 80, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]] | 0 | 389 | 4 |
w = gets.to_i
n = gets.to_i
horizon_bars = []
n.times do
horizon_bars << gets.split(',').map(&:to_i)
end
p horizon_bars
1.upto(w) do |i|
horizon_bars.reverse_each do |bar|
source = bar.index(i)
i = bar[(source + 1) % 2] if source
end
puts i
end
| w = gets.to_i
n = gets.to_i
horizon_bars = []
n.times do
horizon_bars << gets.split(',').map(&:to_i)
end
1.upto(w) do |i|
horizon_bars.reverse_each do |bar|
source = bar.index(i)
i = bar[(source + 1) % 2] if source
end
puts i
end
| [["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["-", 36, 36, 0, 493, 0, 652, 3, 4, 0, 22]] | 4 | 80 | 2 |
class DrawingLots
def initialize(width, switch_ary)
@results = (1..width).to_a
switch_ary.each do |data|
tmp = @results[data[1] - 1]
@results[data[1] - 1] = @results[data[0] - 1]
@results[data[0] - 1] = tmp
end
end
attr_accessor :results
def all_result
@resu... | class DrawingLots
def initialize(width, switch_ary)
@results = (1..width).to_a
switch_ary.each do |data|
tmp = @results[data[1] - 1]
@results[data[1] - 1] = @results[data[0] - 1]
@results[data[0] - 1] = tmp
end
end
attr_accessor :results
def all_result
@resu... | [["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 62], ["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 62], ["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 44]] | 4 | 125 | 6 |
w = gets.chomp.to_i
n = gets.chomp.to_i
array = []
a = []
b = []
(1..w).each do |j|
array[j] = j
end
(1..n).each do |_i|
a, b = gets.chomp.split
a = a.to_i
b = b.to_i
(1..w).each do |k|
next unless a == k
x = array[b]
array[b] = array[k]
array[k] = x
end
end
(1..w).each do |s|
puts a... | w = gets.chomp.to_i
n = gets.chomp.to_i
array = []
a = []
b = []
(1..w).each do |j|
array[j] = j
end
(1..n).each do |_i|
a, b = gets.chomp.split(',')
a = a.to_i
b = b.to_i
(1..w).each do |k|
next unless a == k
x = array[b]
array[b] = array[k]
array[k] = x
end
end
(1..w).each do |s|
p... | [["+", 8, 736, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 662, 12, 652, 3, 4, 0, 557, 0, 62], ["+", 0, 662, 12, 652, 3, 4, 0, 557, 0, 6], ["+", 8, 736, 0, 662, 12, 652, 3, 4, 0, 25]] | 4 | 130 | 5 |
w = gets.to_i
n = gets.to_i
n_list = []
n.times.each do
st = gets.split(/\s/)
n_list << [st[0].to_i, st[1].to_i]
end
answers = []
1.upto(w).each do |i|
current_w = i
n_list.each do |n_line|
if current_w == n_line[0]
current_w = n_line[1]
elsif current_w == n_line[1]
current_w = n_line[0]
... | w = gets.to_i
n = gets.to_i
n_list = []
n.times.each do
st = gets.split(/,/)
n_list << [st[0].to_i, st[1].to_i]
end
answers = []
1.upto(w).each do |i|
current_w = i
n_list.each do |n_line|
if current_w == n_line[0]
current_w = n_line[1]
elsif current_w == n_line[1]
current_w = n_line[0]
... | [["-", 0, 662, 12, 652, 3, 4, 0, 575, 0, 44], ["+", 0, 662, 12, 652, 3, 4, 0, 575, 0, 6]] | 4 | 113 | 2 |
w = gets.to_i
arr = w.times.map { |i| i + 1 }
gets.to_i.times do
a, b = str.split(',').map(&:to_i)
arr[a - 1], arr[b - 1] = arr[b - 1], arr[a - 1]
end
puts arr
| w = gets.to_i
arr = w.times.map { |i| i + 1 }
gets.to_i.times do
a, b = gets.split(',').map(&:to_i)
arr[a - 1], arr[b - 1] = arr[b - 1], arr[a - 1]
end
puts arr
| [["-", 8, 736, 0, 662, 12, 652, 486, 652, 486, 22], ["+", 8, 736, 0, 662, 12, 652, 486, 652, 486, 22]] | 4 | 74 | 2 |
def swap(a, c)
a[c[0] - 1], a[c[1] - 1] = a[c[1] - 1], a[c[0] - 1]
a
end
w = gets.to_i
a = []
0.upto(w - 1) do |i|
a[i] = i + 1
end
n = gets.to_i
n.times do
c = gets.chomp.split(',').map(&:to_i)
a = swap(a, c)
p a
end
a.each { |v| puts v }
| def swap(a, c)
a[c[0] - 1], a[c[1] - 1] = a[c[1] - 1], a[c[0] - 1]
a
end
w = gets.to_i
a = []
0.upto(w - 1) do |i|
a[i] = i + 1
end
n = gets.to_i
n.times do
c = gets.chomp.split(',').map(&:to_i)
a = swap(a, c)
end
a.each { |v| puts v }
| [["-", 0, 652, 196, 737, 8, 736, 0, 652, 735, 22], ["-", 196, 737, 8, 736, 0, 652, 3, 4, 0, 22]] | 4 | 126 | 2 |
l=range(1,eval(input())+1)
for a,b in[list(map(int,input().split(",")))for i in range(eval(input()))]:l[a-1],l[b-1]=l[b-1],l[a-1]
for i in l:print(i) | l=list(range(1,eval(input())+1))
for a,b in[list(map(int,input().split(",")))for i in range(eval(input()))]:l[a-1],l[b-1]=l[b-1],l[a-1]
for i in l:print(i) | [["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]] | 5 | 89 | 3 |
w = int(raw_input())
n = int(raw_input())
l = [i for i in range(1,w+1)]
while n > 0:
a,b = map(int,raw_input().split(','))
l[a-1],l[b-1] = l[b-1],l[a-1]
n -= 1
for i in l:
print(i) | w = int(input())
n = int(input())
l = [i for i in range(1,w+1)]
while n > 0:
a,b = map(int,input().split(','))
l[a-1],l[b-1] = l[b-1],l[a-1]
n -= 1
for i in l:
print(i) | [["-", 0, 662, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 662, 12, 652, 3, 4, 0, 652, 63, 22], ["-", 3, 4, 0, 652, 63, 319, 500, 652, 63, 22], ["+", 3, 4, 0, 652, 63, 319, 500, 652, 63, 22]] | 5 | 95 | 6 |
w = int(input())
n = int(input())
Ami = []
Num = []
for i in range(n):
Ami.append(list(map(int,input().split(","))))
print(Ami)
for i in range(1,w+1):
pos = i
for j in range(n):
if pos == Ami[j][0]:
pos = Ami[j][1]
elif pos == Ami[j][1]:
pos = Ami[j][0]
Num.append... | w = int(input())
n = int(input())
Ami = []
Num = []
for i in range(n):
Ami.append(list(map(int,input().split(","))))
for i in range(1,w+1):
pos = i
for j in range(n):
if pos == Ami[j][0]:
pos = Ami[j][1]
elif pos == Ami[j][1]:
pos = Ami[j][0]
Num.append([pos,i])
N... | [["-", 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 | 158 | 4 |
import sys
n = int(sys.stdin.readline().rstrip())
m = int(sys.stdin.readline().rstrip())
l = []
for i in range(m):
l.append(list(map(int, sys.stdin.readline().rstrip().split(','))))
print(l)
for i in range(n):
cur = i+1
for d in l[::-1]:
if cur in d:
cur = d[0] if cur == d[1] else d[1]
... | import sys
n = int(sys.stdin.readline().rstrip())
m = int(sys.stdin.readline().rstrip())
l = []
for i in range(m):
l.append(list(map(int, sys.stdin.readline().rstrip().split(','))))
for i in range(n):
cur = i+1
for d in l[::-1]:
if cur in d:
cur = d[0] if cur == d[1] else d[1]
print(... | [["-", 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 | 132 | 4 |
w = int(input())
nums = list(range(w + 1))
for _ in range(int(input())):
a, b = map(int, input().split(", "))
nums[a], nums[b] = nums[b], nums[a]
for x in nums[1:]:
print(x) | w = int(input())
nums = list(range(w + 1))
for _ in range(int(input())):
a, b = map(int, input().split(","))
nums[a], nums[b] = nums[b], nums[a]
for x in nums[1:]:
print(x) | [["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 6]] | 5 | 83 | 2 |
a=list(range(int(input())+1))
for _ in[0]*int(input()):
s,t=map(int,input().split(','))
a[s],a[t]=a[t],a[s]
for s in a:
if s:print(s+1)
| a=list(range(int(input())+1))
for _ in[0]*int(input()):
s,t=map(int,input().split(','));a[s],a[t]=a[t],a[s]
for s in a:
if s:print(s)
| [["+", 36, 36, 0, 656, 0, 7, 8, 196, 0, 35], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612]] | 5 | 82 | 3 |
a=list(range(int(input())+1))
for _ in[0]*int(input()):
s,t=map(int,input().split(','))
a[s],a[t]=a[t],a[s]
for s in a:print(s+1)
| a=list(range(int(input())+1))
for _ in[0]*int(input()):s,t=map(int,input().split(','));a[s],a[t]=a[t],a[s]
for s in a:s and print(s)
| [["+", 36, 36, 0, 656, 0, 7, 8, 196, 0, 35], ["+", 0, 7, 8, 196, 0, 1, 0, 679, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 679, 17, 355], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 17, 72], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 12, 612]] | 5 | 79 | 5 |
import math
tate =int(input())
yoko=int(input())
arr = [i+1 for i in range(tate)]
for j in range(yoko):
rep1,rep2=input().split();
rep1=int(rep1)-1
rep2=int(rep2)-1
arr[rep1],arr[rep2] = arr[rep2],arr[rep1]
for k in range(tate):
print(arr[k])
| tate =int(input())
yoko=int(input())
arr = [i+1 for i in range(tate)]
for j in range(yoko):
rep1,rep2=input().split(",")
rep1=int(rep1)-1
rep2=int(rep2)-1
arr[rep1],arr[rep2] = arr[rep2],arr[rep1]
for k in range(tate):
print(arr[k])
| [["-", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["-", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22], ["+", 0, 662, 12, 652, 3, 4, 0, 557, 0, 654], ["+", 0, 662, 12, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 662, 12, 652, 3, 4, 0, 557, 0, 655], ["-", 36, 36, 0, 656, 0, 7, 8, 196, 0, 35]] | 5 | 102 | 6 |
w=int(input())
l=[i+1 for i in range(w)]
n=int(input())
for _ in range(n):
a,b=[int(i)-1 for i in input().split(",")]
t=l[a]
l[a]=l[b]
l[b]=t
for i in w:
print(i)
| w=int(input())
l=[i+1 for i in range(w)]
n=int(input())
for _ in range(n):
a,b=[int(i)-1 for i in input().split(",")]
t=l[a]
l[a]=l[b]
l[b]=t
for i in l:
print(i)
| [["-", 36, 36, 36, 36, 0, 656, 0, 7, 12, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 12, 22]] | 5 | 93 | 2 |
w = int(input())
n = int(input())
amida = []
for i in range(0,w+1):
amida.append(i)
for i in range(n):
ai,bi = map(int,input().split())
aa = amida[ai]
bb = amida[bi]
amida[ai] = bb
amida[bi] = aa
for i in range(1,w+1):
print(w[i])
| w = int(input())
n = int(input())
amida = []
for i in range(0,w+1):
amida.append(i)
for i in range(n):
ai,bi = map(int,input().split(","))
aa = amida[ai]
bb = amida[bi]
amida[ai] = bb
amida[bi] = aa
for i in range(1,w+1):
print(amida[i])
| [["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 654], ["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 655], ["-", 0, 1, 0, 652, 3, 4, 0, 206, 51, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 51, 22]] | 5 | 105 | 5 |
W = list(range(eval(input())+2))
for i in range(eval(input())):
a, b = list(map(int,input().split(",")))
W[a], W[b] = W[b], W[a]
for e in W[1:]:
print(e) | W=list(range(eval(input())+1))
for i in range(eval(input())):
a,b=list(map(int,input().split(",")))
W[a],W[b]=W[b],W[a]
for e in W[1:]:print(e) | [["-", 3, 4, 0, 652, 3, 4, 0, 657, 12, 612], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 12, 612]] | 5 | 83 | 2 |
amida = []
def main():
num_vlines = int(input());
num_wlines = int(input());
init_amida(num_vlines)
count = 0;
while count < num_wlines :
ab = input().strip().split(',')
# print "--- input keys ---"
# pprint.pprint(ab)
transposition(int(ab[0]), int(ab[1]))
# print "--- dump amida ---"
# print amida.... |
amida = []
def main():
num_vlines = int(input());
num_wlines = int(input());
init_amida(num_vlines)
count = 0;
while count < num_wlines :
ab = input().strip().split(',')
# print "--- input keys ---"
# pprint.pprint(ab)
transposition(int(ab[0]), int(ab[1]))
# print "--- dump amida ---"
# print amid... | [["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["-", 0, 1, 0, 652, 3, 4, 0, 653, 141, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 653, 0, 32], ["-", 0, 652, 3, 4, 0, 653, 51, 557, 0, 654], ["-", 0, 652, 3, 4, 0, 653, 51, 557, 0, 6], ["-", 0, 652, 3, 4, 0, 653, 51, 557, 0, 655]] | 5 | 161 | 6 |
w = int(input())
n = int(input())
s = [i+1 for i in range(w)]
for i in range(n):
a, b = list(map(int, input().split()))
tmp = s[a-1]
s[a-1] = s[b-1]
s[b-1] = tmp
for i in s:
print(i) | w = int(input())
n = int(input())
s = [i+1 for i in range(w)]
for i in range(n):
a, b = list(map(int, input().split(",")))
tmp = s[a-1]
s[a-1] = s[b-1]
s[b-1] = tmp
for i in s:
print(i) | [["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 654], ["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 655]] | 5 | 95 | 3 |
import java.util.*;
public class Main {
private static final Scanner scan = new Scanner(System.in);
public static void main(String[] args) {
while (scan.hasNext()) {
double[] x = new double[3];
double[] y = new double[3];
for (int i = 0; i < 3; i++) {
x[i] = scan.nextDouble();
... | import java.util.*;
public class Main {
private static final Scanner scan = new Scanner(System.in);
public static void main(String[] args) {
while (scan.hasNext()) {
double[] x = new double[3];
double[] y = new double[3];
for (int i = 0; i < 3; i++) {
x[i] = scan.nextDouble();
... | [["-", 0, 11, 12, 16, 12, 16, 31, 504, 71, 499], ["+", 0, 11, 12, 16, 12, 16, 31, 504, 71, 499], ["-", 0, 11, 12, 16, 12, 16, 12, 504, 71, 499], ["+", 0, 11, 12, 16, 12, 16, 12, 504, 71, 499]] | 3 | 334 | 4 |
q = [];
require("fs")
.readFileSync("/dev/stdin", "utf8")
.trim()
.split('\n')
.map(function(i) { i ? q.push(i) : console.log(q.pop()) }) | q = [];
require("fs")
.readFileSync("/dev/stdin", "utf8")
.trim()
.split('\n')
.map(function(i) { +i ? q.push(i) : console.log(q.pop()) }) | [["+", 8, 556, 0, 1, 0, 510, 15, 91, 17, 72]] | 2 | 62 | 1 |
<?php
$stack = array();
$result = array();
while (!feof(STDIN)) {
$input = (int)rtrim(fgets(STDIN));
if (0 === $input) {
$result[] = array_pop($stack);
} else {
$stack[] = $input;
}
}
foreach ($result as $key => $value) {
printf("%d\n", $value);
}
| <?php
$stack = array();
$result = array();
while (!feof(STDIN)) {
$input = rtrim(fgets(STDIN));
if ('0' === $input) {
$result[] = array_pop($stack);
} else {
$stack[] = $input;
}
}
foreach ($result as $key => $value) {
printf("%d\n", $value);
}
| [["-", 8, 9, 0, 1, 0, 11, 12, 74, 0, 24], ["-", 8, 9, 0, 1, 0, 11, 12, 74, 39, 615], ["-", 8, 9, 0, 1, 0, 11, 12, 74, 0, 25], ["+", 0, 57, 15, 23, 0, 16, 31, 557, 0, 104]] | 6 | 94 | 5 |
import java.util.LinkedList;
import java.util.Scanner;
public class Main {
private Scanner sc;
private LinkedList<Integer> stack;
public static void main(String[] args) { new Main(); }
public Main() {
sc = new Scanner(System.in);
stack = new LinkedList<Integer>();
while (sc.hasNext() == true) {... | import java.util.LinkedList;
import java.util.Scanner;
public class Main {
private Scanner sc;
private LinkedList<Integer> stack;
public static void main(String[] args) { new Main(); }
public Main() {
sc = new Scanner(System.in);
stack = new LinkedList<Integer>();
while (sc.hasNext() == true) {... | [["-", 0, 57, 75, 196, 0, 1, 0, 492, 141, 22], ["+", 0, 57, 75, 196, 0, 1, 0, 492, 141, 22]] | 3 | 130 | 2 |
import java.util.Scanner;
import java.util.Stack;
public class Main {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
Stack<Integer> s = new Stack<Integer>();
int y = cin.nextInt();
if (y == 0) {
return;
}
s.add(y);
while (!s.isEmpty()) {
int x =... | import java.util.Scanner;
import java.util.Stack;
public class Main {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
Stack<Integer> s = new Stack<Integer>();
int y = cin.nextInt();
if (y == 0) {
return;
}
s.add(y);
while (cin.hasNext()) {
int x ... | [["-", 8, 196, 0, 52, 15, 15, 0, 91, 17, 111], ["-", 0, 52, 15, 15, 0, 91, 439, 492, 500, 22], ["+", 8, 196, 0, 52, 15, 15, 0, 492, 500, 22], ["-", 0, 52, 15, 15, 0, 91, 439, 492, 141, 22], ["+", 8, 196, 0, 52, 15, 15, 0, 492, 141, 22]] | 3 | 133 | 5 |
#include <stdio.h>
int main(int argc, const char *argv[]) {
int a[10], i;
int n = 0;
while (scanf("%d", &i) != EOF) {
if (i != 0) {
a[n++] = i;
} else {
printf("%d", a[--n]);
}
}
return 0;
} | #include <stdio.h>
int main(int argc, const char *argv[]) {
int a[10];
int i, n = 0;
while (scanf("%d", &i) != EOF) {
if (i != 0) {
a[n++] = i;
} else {
printf("%d\n", a[--n]);
}
}
return 0;
} | [["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]] | 0 | 81 | 5 |
#include <stdio.h>
int pop();
void push(int x);
int stack[11];
int stack_top = 0;
int main(void) {
int n, num;
while (scanf("%d", &n) != EOF) {
if (n == 0) {
num = pop();
printf("%d", num);
} else {
push(n);
}
}
return 0;
}
int pop() {
stack_top--;
return stack[stack_top... | #include <stdio.h>
int pop();
void push(int x);
int stack[11];
int stack_top = 0;
int main(void) {
int n, num;
while (scanf("%d", &n) != EOF) {
if (n == 0) {
num = pop();
printf("%d\n", num);
} else {
push(n);
}
}
return 0;
}
int pop() {
stack_top--;
return stack[stack_t... | [["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]] | 0 | 122 | 1 |
#include <stdio.h>
int main() {
int x = 0, i, n, data[100];
while (scanf("%d", &x) != EOF) {
if (x == 0) {
printf("%d", data[i]);
i--;
} else {
i++;
data[i] = x;
}
}
return 0;
} | #include <stdio.h>
int main() {
int x = 0, i, n, data[100];
while (scanf("%d", &x) != EOF) {
if (x == 0) {
printf("%d\n", data[i]);
i--;
} else {
i++;
data[i] = x;
}
}
return 0;
} | [["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]] | 0 | 77 | 1 |
#include <stdio.h>
int main() {
int v[1000], n, i = 0;
while (scanf("%d", &n) != EOF) {
if (n = 0)
printf("%d\n", v[--i]);
else
v[i++] = n;
}
return 0;
} | #include <stdio.h>
int main() {
int v[1000], n, i = 0;
while (scanf("%d", &n) != EOF) {
if (n == 0)
printf("%d\n", v[--i]);
else
v[i++] = n;
}
return 0;
} | [["-", 8, 9, 0, 57, 15, 23, 0, 11, 17, 32], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 60]] | 0 | 68 | 2 |
#include <math.h>
#include <stdio.h>
int main() {
int n, sya[1000], cnt;
cnt = 0;
while (scanf("%d", &n) == 0) {
if (n == 0) {
cnt = cnt - 1;
printf("%d\n", sya[cnt]);
} else {
// scanf("%d",&n);
sya[cnt] = n;
cnt = cnt + 1;
}
}
return 0;
} | #include <math.h>
#include <stdio.h>
int main() {
int n, sya[1000], cnt;
cnt = 0;
while (scanf("%d", &n) != EOF) {
if (n == 0) {
cnt = cnt - 1;
printf("%d\n", sya[cnt]);
} else {
sya[cnt] = n;
cnt = cnt + 1;
}
}
return 0;
} | [["-", 8, 9, 0, 52, 15, 23, 0, 16, 17, 60], ["-", 8, 9, 0, 52, 15, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 52, 15, 23, 0, 16, 17, 79], ["+", 8, 9, 0, 52, 15, 23, 0, 16, 12, 22]] | 0 | 87 | 4 |
#include <stdio.h>
int main() {
int stack[101] = {0};
int n;
int i = 0;
while (scanf("%d", &n) != EOF) {
if (n == 0) {
i--;
printf("%d", stack[i]);
}
else {
stack[i] = n;
i++;
}
}
return 0;
} | #include <stdio.h>
int main() {
int stack[101] = {0};
int n;
int i = 0;
while (scanf("%d", &n) != EOF) {
if (n == 0) {
i--;
printf("%d\n", stack[i]);
}
else {
stack[i] = n;
i++;
}
}
return 0;
} | [["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]] | 0 | 81 | 1 |
#include <stdio.h>
int data[10] = {0}, data2[10] = {0}, i = 0, j = 0;
void push(int n) { data[i] = n; }
void pop(int n) {
data2[j] = data[i];
j++;
data[i + 1] = 0;
}
int main() {
int n, k;
while (scanf("%d", &n) != EOF) {
if (n == 0) {
i--;
pop(n);
} else {
push(n);
i++;
}
... | #include <stdio.h>
int data[10] = {0}, data2[100] = {0}, i = 0, j = 0;
void push(int n) { data[i] = n; }
void pop(int n) {
data2[j] = data[i];
j++;
data[i + 1] = 0;
}
int main() {
int n, k;
while (scanf("%d", &n) != EOF) {
if (n == 0) {
i--;
pop(n);
} else {
push(n);
i++;
}... | [["-", 0, 30, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 0, 30, 0, 43, 49, 50, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]] | 0 | 156 | 4 |
n, *a = &n;
main() {
for (; ~scanf("%s", a);)
*a % 8 ? a++ : puts(--a);
} | n, *a = &n;
main() {
for (; ~scanf("%s", a);)
*a % 12 ? a++ : puts(--a);
} | [["-", 0, 7, 8, 1, 0, 41, 15, 16, 12, 13], ["+", 0, 7, 8, 1, 0, 41, 15, 16, 12, 13]] | 0 | 42 | 2 |
main() {
int i = 0, t[100], w;
while (scanf("%d", &w) != -1) {
if (w == 0)
printf("%d", t[--i]);
else
t[i++] = w;
}
return 0;
} | main() {
int i = 0, t[100], w;
while (scanf("%d", &w) != -1) {
if (w == 0)
printf("%d\n", t[--i]);
else
t[i++] = w;
}
return 0;
} | [["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 44]] | 0 | 64 | 1 |
// AOJ Volume 0 Problem 0012
#include <stdio.h>
int main(void) {
int cars[1000];
int n;
int car_no;
n = 0;
while (scanf("%d", &car_no) != EOF) {
if (car_no == 0) {
printf("[%d]\n", cars[--n]);
} else {
cars[n++] = car_no;
}
}
return (0);
} | // AOJ Volume 0 Problem 0012
#include <stdio.h>
int main(void) {
int cars[1000];
int n;
int car_no;
n = 0;
while (scanf("%d", &car_no) != EOF) {
if (car_no == 0) {
printf("%d\n", cars[--n]);
} else {
cars[n++] = car_no;
}
}
return (0);
} | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 80 | 2 |
#include <stdio.h>
int main(void) {
int in[10];
int i;
int n;
for (i = 0; i < 10; i++) {
in[i] = 0;
}
while (scanf("%d", &n) != 1) {
if (n != 0) {
for (i = 0; i < 10; i++) {
if (in[i] == 0) {
in[i] = n;
break;
}
}
} else {
for (i = 9; i >= ... | #include <stdio.h>
int main(void) {
int in[10];
int i;
int n;
for (i = 0; i < 10; i++) {
in[i] = 0;
}
while (scanf("%d", &n) == 1) {
if (n != 0) {
for (i = 0; i < 10; i++) {
if (in[i] == 0) {
in[i] = n;
break;
}
}
} else {
for (i = 9; i >= ... | [["-", 8, 9, 0, 52, 15, 23, 0, 16, 17, 79], ["+", 8, 9, 0, 52, 15, 23, 0, 16, 17, 60]] | 0 | 158 | 2 |
#include <stdio.h>
int main(void) {
int Cars[10];
int i = 0;
int Temp;
while (scanf("%d", &Temp) == 1) {
if (Temp == 0) {
i--;
printf("%d\n", Cars[Temp]);
} else {
Cars[i] = Temp;
i++;
}
}
return 0;
} | #include <stdio.h>
int main(void) {
int Cars[10];
int i = 0;
int Temp;
while (scanf("%d", &Temp) == 1) {
if (Temp == 0) {
i--;
printf("%d\n", Cars[i]);
} else {
Cars[i] = Temp;
i++;
}
}
return 0;
} | [["-", 0, 1, 0, 2, 3, 4, 0, 69, 71, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 69, 71, 22]] | 0 | 79 | 2 |
#include <stdio.h>
int main(void) {
int stack[11] = {0}, buf, crpos = 0;
while (scanf("%d", &buf) != EOF) {
if (buf == 0) {
crpos--;
printf("___%d\n", stack[crpos]);
} else {
stack[crpos] = buf;
crpos++;
}
}
return 0;
} | #include <stdio.h>
int main(void) {
int stack[10] = {0}, buf, crpos = 0;
while (scanf("%d", &buf) != EOF) {
if (buf == 0) {
crpos--;
printf("%d\n", stack[crpos]);
} else {
stack[crpos] = buf;
crpos++;
}
}
return 0;
} | [["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 81 | 4 |
#include <stdio.h>
int main(void) {
int stack[10] = {0}, buf, crpos = 0;
while (scanf("%d", &buf) != EOF) {
if (buf == 0) {
printf("%d\n", stack[crpos--]);
} else {
stack[crpos++] = buf;
}
}
return 0;
} | #include <stdio.h>
int main(void) {
int stack[10] = {0}, buf, crpos = 0;
while (scanf("%d", &buf) != EOF) {
if (buf == 0) {
printf("%d\n", stack[--crpos]);
} else {
stack[crpos++] = buf;
}
}
return 0;
} | [["-", 0, 2, 3, 4, 0, 69, 71, 27, 28, 22], ["+", 0, 2, 3, 4, 0, 69, 71, 27, 28, 22]] | 0 | 77 | 2 |
s[11];
main(t, p) {
for (; *s = ~scanf("%d", &t); t ? s[p++] = t : printf("%d\n", s[--p]))
;
} | s[9];
main(p, t) {
for (; *s = ~scanf("%d", &t); t ? s[p++] = t : printf("%d\n", s[--p]))
;
} | [["-", 36, 36, 0, 30, 0, 1, 0, 69, 71, 13], ["+", 36, 36, 0, 30, 0, 1, 0, 69, 71, 13], ["-", 0, 30, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 0, 30, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 0, 30, 0, 1, 0, 2, 3, 4, 0, 21], ["+", 0, 30, 0, 1, 0, 2, 3, 4, 0, 22]] | 0 | 56 | 6 |
#include <stdio.h>
int main(void) {
int j, i, l[1000], a[1000], b;
for (i = 0;; i++) {
if (scanf("%d", &a[i]) == EOF)
break;
else if (a[i] == 0) {
printf("a%d\n", a[i - 1]);
i--;
i--;
}
}
return 0;
} | #include <stdio.h>
int main(void) {
int j, i, l[1000], a[1000], b;
for (i = 0;; i++) {
if (scanf("%d", &a[i]) == EOF)
break;
else if (a[i] == 0) {
printf("%d\n", a[i - 1]);
i--;
i--;
}
}
return 0;
} | [["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]] | 0 | 93 | 2 |
#include <stdio.h>
int stack[1000], point = 0;
int fstack(int com, int num) {
int data;
if (com == 0) {
data = stack[point];
stack[point] = num;
point--;
return data;
}
if (com == 1) {
point++;
stack[point] = num;
return 0;
} else {
return -1;
}
}
int main() {
int a;
... | #include <stdio.h>
int stack[1000], point = 0;
int fstack(int com, int num) {
int data;
if (com == 0) {
data = stack[point];
stack[point] = num;
point--;
return data;
}
if (com == 1) {
point++;
stack[point] = num;
return 0;
} else {
return -1;
}
}
int main() {
int a;
... | [["-", 8, 9, 0, 52, 15, 23, 0, 91, 17, 111], ["+", 8, 9, 0, 52, 15, 23, 0, 16, 17, 79], ["+", 8, 9, 0, 52, 15, 23, 0, 16, 12, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]] | 0 | 144 | 4 |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define loop(i, a, b) for (int i = a; i < b; i++)
#define rep(i, a) loop(i, 0, a)
#define pb push_back
#define mp make_pair
#define it ::itera... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define loop(i, a, b) for (int i = a; i < b; i++)
#define rep(i, a) loop(i, 0, a)
#define pb push_back
#define mp make_pair
#define it ::itera... | [["-", 36, 36, 36, 36, 0, 30, 0, 135, 136, 137], ["-", 36, 36, 36, 36, 0, 30, 0, 135, 0, 138], ["+", 36, 36, 36, 36, 0, 30, 0, 135, 0, 138], ["+", 36, 36, 36, 36, 0, 30, 0, 135, 136, 137], ["-", 0, 14, 8, 9, 0, 43, 39, 344, 141, 78], ["+", 0, 14, 8, 9, 0, 43, 39, 344, 141, 78], ["-", 0, 16, 31, 16, 12, 2, 63, 118, 119,... | 1 | 125 | 8 |
#include <stdio.h>
#include <string.h>
#include <stack>
#include <iostream>
using namespace std;
int main() {
int input;
stack<int> train;
while (scanf("%d", &input) != EOF) {
// scanf("%d",&input);
if (input != 0)
train.push(input);
else {
printf("%d", train.top());
tra... | #include <stdio.h>
#include <string.h>
#include <stack>
#include <iostream>
using namespace std;
int main() {
int input;
stack<int> train;
while (scanf("%d", &input) != EOF) {
// scanf("%d",&input);
if (input != 0)
train.push(input);
else {
printf("%d\n", train.top());
t... | [["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]] | 1 | 103 | 7 |
#include <iostream>
#include <malloc.h>
using namespace std;
struct stack {
int element;
struct stack *next;
};
int top(struct stack *s) { return s->element; }
struct stack *pop(struct stack *s) {
struct stack *p, *q;
q = s;
p = s->next;
free(q);
s = p;
return s;
}
struct stack *push(struct stack *s, i... | #include <iostream>
#include <malloc.h>
using namespace std;
struct stack {
int element;
struct stack *next;
};
int top(struct stack *s) { return s->element; }
struct stack *pop(struct stack *s) {
struct stack *p, *q;
q = s;
p = s->next;
free(q);
s = p;
return s;
}
struct stack *push(struct stack *s, i... | [["-", 0, 14, 8, 9, 0, 52, 15, 339, 51, 13], ["-", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["-", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["-", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45]] | 1 | 205 | 6 |
#include <iostream>
#include <stack>
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
stack<int> s;
s.push(n);
int a;
cin >> a;
if (a == 0) {
cout << s.top() << endl;
s.pop();
} else {
s.push(a);
}
return 0;
} | #include <iostream>
#include <stack>
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
stack<int> s;
s.push(n);
int a;
while (cin >> a) {
if (a == 0) {
cout << s.top() << endl;
s.pop();
} else {
s.push(a);
}
}
return 0;
} | [["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]] | 1 | 92 | 6 |
// 0013
#include <bits/stdc++.h>
using namespace std;
int main() {
int tmp, i = 0, j, k = 0, f[11];
vector<int> ans;
while (cin >> tmp) {
if (tmp == 0) {
ans[k] = f[i - 1];
f[i - 1] = '\0';
i--;
k++;
} else {
f[i] = tmp;
i++;
}
}
for (j = 0; j < k; j++) {
... | // 0013
#include <bits/stdc++.h>
using namespace std;
int main() {
int tmp, i = 0, j, k = 0, f[11];
vector<int> ans;
while (cin >> tmp) {
if (tmp == 0) {
ans.push_back(f[i - 1]);
f[i - 1] = '\0';
i--;
k++;
} else {
f[i] = tmp;
i++;
}
}
for (j = 0; j < k; j++) ... | [["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 70], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 73], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 64, 9, 0, 1, 0, 2, 63, 118, 17, 131], ["+", 64, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 64, 9, 0... | 1 | 122 | 8 |
#include <iostream>
#include <stack>
int main() {
std::stack<int> rail;
int buf;
// repeat until "cin" fails.
while (std::cin >> buf) {
if (buf == 0) { // train goes out.
std::cout << rail.top();
rail.pop();
} else { // train comes in.
rail.push(buf);
}
}
return 0;
} |
#include <iostream>
#include <stack>
int main() {
std::stack<int> rail;
int buf;
// repeat until "cin" fails.
while (std::cin >> buf) {
if (buf == 0) { // train goes out.
std::cout << rail.top() << std::endl;
rail.pop();
} else { // train comes in.
rail.push(buf);
}
}
retur... | [["+", 0, 57, 64, 9, 0, 1, 0, 16, 17, 151], ["+", 64, 9, 0, 1, 0, 16, 12, 343, 345, 348], ["+", 64, 9, 0, 1, 0, 16, 12, 343, 0, 349], ["+", 64, 9, 0, 1, 0, 16, 12, 343, 141, 22]] | 1 | 71 | 4 |
#include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> a;
int n;
while (cin >> n) {
if (n == 0) {
cout << a.back();
a.pop_back(); // delete
} else
a.push_back(n);
}
return 0;
} | #include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> a;
int n;
while (cin >> n) {
if (n == 0) {
cout << a.back() << endl;
a.pop_back(); // delete
} else
a.push_back(n);
}
return 0;
} | [["+", 0, 57, 64, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22]] | 1 | 65 | 2 |
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
int a[10], i = 0, n;
while (scanf("%d", n) == 1) {
if (n != 0) {
a[i] = n;
i++;
} else {
i--;
cout << a[i] << endl;
}
}
return 0;
} | #include <cstdio>
#include <iostream>
using namespace std;
int main() {
int a[10], i = 0, n;
while (scanf("%d", &n) == 1) {
if (n != 0) {
a[i] = n;
i++;
} else {
i--;
cout << a[i] << endl;
}
}
return 0;
} | [["+", 51, 16, 31, 2, 3, 4, 0, 66, 17, 67]] | 1 | 77 | 1 |
#include <iostream>
#include <stack>
using namespace std;
int main() {
int n;
stack<int> s;
while (true) {
cin >> n;
if (n == 0) {
cout << s.top() << endl;
s.pop();
} else {
s.push(n);
}
}
return 0;
} | #include <iostream>
#include <stack>
using namespace std;
int main() {
int n;
stack<int> s;
while (cin >> n) {
if (n == 0) {
cout << s.top() << endl;
s.pop();
} else {
s.push(n);
}
}
return 0;
} | [["-", 0, 14, 8, 9, 0, 52, 15, 339, 51, 146], ["-", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["-", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["-", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45]] | 1 | 70 | 6 |
#include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> v;
vector<int>::iterator pv = v.begin();
int n;
while (cin >> n) {
if (n == 0) {
int x = v.size();
cout << v[x - 1] << endl;
v.pop_back();
}
v.push_back(n);
}
return 0;
} | #include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> v;
vector<int>::iterator pv = v.begin();
int n;
while (cin >> n) {
if (n == 0) {
int x = v.size();
cout << v[x - 1] << endl;
v.pop_back();
continue;
}
v.push_back(n);
}
return 0;
} | [["+", 8, 9, 0, 57, 64, 9, 0, 116, 0, 117], ["+", 8, 9, 0, 57, 64, 9, 0, 116, 0, 35]] | 1 | 89 | 2 |
#include "bits/stdc++.h"
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
stack<int> st;
int x;
while (cin >> x) {
if (x == 0) {
cout << st.top();
st.pop();
} else
st.push(x);
}
} | #include "bits/stdc++.h"
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
stack<int> st;
int x;
while (cin >> x) {
if (x == 0) {
cout << st.top() << endl;
st.pop();
} else
st.push(x);
}
} | [["+", 0, 57, 64, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22]] | 1 | 75 | 2 |
/*
C++ ???????????????????????????????????¬??????
??????AOJ-ITP1??????????????????
*/
#define _USE_MATH_DEFINES
#include <algorithm> // max??¢??°??????
#include <cmath> // ??°??????
#include <fstream> // ??????????????\??????
#include <iomanip> // stream???????????¢???
#include <iostream> // ?¨??????\??????
#... | /*
C++ ???????????????????????????????????¬??????
??????AOJ-ITP1??????????????????
*/
#define _USE_MATH_DEFINES
#include <algorithm> // max??¢??°??????
#include <cmath> // ??°??????
#include <fstream> // ??????????????\??????
#include <iomanip> // stream???????????¢???
#include <iostream> // ?¨??????\??????
#... | [["+", 0, 57, 64, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22]] | 1 | 121 | 2 |
#include <iostream>
#include <stack>
using namespace std;
int main() {
stack<int> st;
int a;
while (cin >> a) {
if (a == 0) {
cout << st.top() << endl;
st.pop();
}
st.push(a);
}
return 0;
} | //
// main.cpp
// BT
//
// Created by h3037175 on 2017/07/27.
// Copyright ?? 2017??´ h3037175. All rights reserved.
//
#include <iostream>
#include <stack>
using namespace std;
int main() {
stack<int> st;
int a;
while (cin >> a) {
if (a == 0) {
cout << st.top() << endl;
st.pop();
} else ... | [["+", 0, 52, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]] | 1 | 65 | 3 |
#include <bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(), vec.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1000000007;
const ll INF = 1000000010;
const ll LINF = 4000000000000000010LL;
const int MAX = 310;
const double EPS = 1e-6;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, ... | #include <bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(), vec.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1000000007;
const ll INF = 1000000010;
const ll LINF = 4000000000000000010LL;
const int MAX = 310;
const double EPS = 1e-6;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, ... | [["-", 0, 14, 8, 9, 0, 43, 39, 344, 141, 78], ["+", 0, 14, 8, 9, 0, 43, 39, 344, 141, 78], ["-", 0, 16, 31, 16, 12, 2, 63, 118, 119, 120], ["+", 0, 16, 31, 16, 12, 2, 63, 118, 119, 120]] | 1 | 146 | 4 |
#include <iostream>
#include <utility>
using namespace std;
int main() {
int a[100];
int i = 0;
while (1) {
cin >> a[i];
if (a[i] == 0) {
int j = i;
while (1) {
j--;
if (a[j] != 0) {
cout << a[j] << endl;
a[j] = 0;
break;
}
}
}
... | #include <iostream>
#include <utility>
using namespace std;
int main() {
int a[100];
int i = 0;
while (cin >> a[i]) {
if (a[i] == 0) {
int j = i;
while (1) {
j--;
if (a[j] != 0) {
cout << a[j] << endl;
a[j] = 0;
break;
}
}
}
i++;... | [["-", 0, 14, 8, 9, 0, 52, 15, 339, 51, 13], ["-", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["-", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["-", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45]] | 1 | 98 | 6 |
#include <iostream>
#include <stack>
using namespace std;
int main(void) {
int num;
stack<int> st;
while (1) {
cin >> num;
st.push(num);
if (num == 0) {
st.pop(); // 0ツづーツ渉慊つュ
cout << st.top() << endl;
st.pop();
}
}
return 0;
} | #include <iostream>
#include <stack>
using namespace std;
int main(void) {
int num;
stack<int> st;
while (cin >> num) {
st.push(num);
if (num == 0) {
st.pop(); // 0ツづーツ渉慊つュ
cout << st.top() << endl;
st.pop();
}
}
return 0;
} | [["-", 0, 14, 8, 9, 0, 52, 15, 339, 51, 13], ["-", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["-", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["-", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45]] | 1 | 75 | 6 |
/*
This figure shows railway tracks for reshuffling cars. The rail tracks end in
the bottom and the top-left rail track is used for the entrace and the top-right
rail track is used for the exit. Ten cars, which have numbers from 1 to 10
respectively, use the rail tracks.
We can simulate the movement (comings and going... | /*
This figure shows railway tracks for reshuffling cars. The rail tracks end in
the bottom and the top-left rail track is used for the entrace and the top-right
rail track is used for the exit. Ten cars, which have numbers from 1 to 10
respectively, use the rail tracks.
We can simulate the movement (comings and going... | [["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 20]] | 1 | 124 | 2 |
#include <iostream>
#include <stack>
using namespace std;
int main() {
int n, count = 0;
stack<int> get;
while (1) {
cin >> n;
if (n == 0) {
cout << get.top() << endl;
get.pop();
count -= 1;
} else {
get.push(n);
count += 1;
}
}
return 0;
} | #include <iostream>
#include <stack>
using namespace std;
int main() {
int n, count = 0;
stack<int> get;
while (cin >> n) {
if (n == 0) {
cout << get.top() << endl;
get.pop();
count -= 1;
} else {
get.push(n);
count += 1;
}
}
return 0;
} | [["-", 0, 14, 8, 9, 0, 52, 15, 339, 51, 13], ["-", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["-", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["-", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45]] | 1 | 82 | 6 |
#include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> train;
int n;
while (cin >> n) {
if (n != 0) {
train.push_back(n);
} else {
cout << train.back();
train.pop_back();
}
}
return 0;
} | #include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> train;
int n;
while (cin >> n) {
if (n != 0) {
train.push_back(n);
} else {
cout << train.back() << endl;
;
train.pop_back();
}
}
return 0;
} | [["+", 75, 76, 0, 9, 0, 1, 0, 16, 17, 151], ["+", 75, 76, 0, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 57, 75, 76, 0, 9, 0, 1, 0, 35]] | 1 | 66 | 3 |
#include <iostream>
#include <stack>
using namespace std;
int main() {
int n;
stack<int> S;
while (cin >> n) {
if (n == 0) {
cout << S.top();
S.pop();
} else {
S.push(n);
}
}
return 0;
} | #include <iostream>
#include <stack>
using namespace std;
int main() {
int n;
stack<int> S;
while (cin >> n) {
if (n == 0) {
cout << S.top() << endl;
S.pop();
} else {
S.push(n);
}
}
return 0;
} | [["+", 0, 57, 64, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 57, 64, 9, 0, 1, 0, 16, 12, 22]] | 1 | 66 | 2 |
#include <cstdio>
#include <queue>
using namespace std;
int main() {
int x;
queue<int> q;
while (scanf("%d", &x) != EOF) {
if (x == 0) {
printf("%d\n", q.front());
q.pop();
} else {
q.push(x);
}
}
return 0;
} | #include <cstdio>
#include <stack>
using namespace std;
int main() {
int x;
stack<int> q;
while (scanf("%d", &x) != EOF) {
if (x == 0) {
printf("%d\n", q.top());
q.pop();
} else {
q.push(x);
}
}
return 0;
} | [["-", 36, 36, 36, 36, 0, 30, 0, 135, 136, 137], ["+", 36, 36, 36, 36, 0, 30, 0, 135, 136, 137], ["-", 0, 14, 8, 9, 0, 43, 39, 344, 141, 78], ["+", 0, 14, 8, 9, 0, 43, 39, 344, 141, 78], ["-", 0, 2, 3, 4, 0, 2, 63, 118, 119, 120], ["+", 0, 2, 3, 4, 0, 2, 63, 118, 119, 120]] | 1 | 80 | 6 |
#include <iostream>
#include <stack>
using namespace std;
int main(void) {
stack<int> s;
int buf;
while (1) {
cin >> buf;
if (buf == 0) {
cout << s.top() << endl;
s.pop();
} else {
s.push(buf);
}
}
} | #include <iostream>
#include <stack>
using namespace std;
int main(void) {
stack<int> s;
int buf;
while (cin >> buf) {
if (buf == 0) {
cout << s.top() << endl;
s.pop();
} else {
s.push(buf);
}
}
} | [["-", 0, 14, 8, 9, 0, 52, 15, 339, 51, 13], ["-", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["-", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["-", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45]] | 1 | 68 | 6 |
#include <iostream>
#include <stack>
using namespace std;
int main(void) {
double n;
stack<double> buf;
while (true) {
cin >> n;
if (cin.eof())
break;
if (n != 0)
buf.push(n);
else {
cout << buf.top();
buf.pop();
}
}
return 0;
} | #include <iostream>
#include <stack>
using namespace std;
int main(void) {
double n;
stack<double> buf;
while (true) {
cin >> n;
if (cin.eof())
break;
if (n != 0)
buf.push(n);
else {
cout << buf.top() << endl;
buf.pop();
}
}
return 0;
} | [["+", 75, 76, 0, 9, 0, 1, 0, 16, 17, 151], ["+", 75, 76, 0, 9, 0, 1, 0, 16, 12, 22]] | 1 | 77 | 2 |
#include <iostream>
#include <stack>
using namespace std;
int main() {
int train;
stack<int> out;
while (cin >> train) {
if (train != 0) {
out.push(train);
} else {
cout << out.top() << " ";
out.pop();
}
}
return 0;
} | #include <iostream>
#include <stack>
using namespace std;
int main() {
int train;
stack<int> out;
while (cin >> train) {
if (train != 0) {
out.push(train);
} else {
cout << out.top() << endl;
out.pop();
}
}
return 0;
} | [["-", 0, 9, 0, 1, 0, 16, 12, 5, 0, 62], ["-", 0, 9, 0, 1, 0, 16, 12, 5, 0, 6], ["+", 75, 76, 0, 9, 0, 1, 0, 16, 12, 22]] | 1 | 70 | 4 |
#include <iostream>
using namespace std;
int main() {
int k = 0, b;
int a[1];
while (cin >> b) {
if (b != 0) {
a[k] = b;
k = k + 1;
}
if (b == 0) {
cout << a[k - 1] << endl;
k = k - 1;
}
}
return 0;
} | #include <iostream>
using namespace std;
int main() {
int k = 0, b;
int a[1000000];
while (cin >> b) {
if (b != 0) {
a[k] = b;
k = k + 1;
}
if (b == 0) {
cout << a[k - 1] << endl;
k = k - 1;
}
}
return 0;
} | [["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]] | 1 | 82 | 2 |
#include <iostream>
#include <stack>
using namespace std;
int main() {
int a;
stack<int> syaryo;
while (cin >> a) {
cin >> a;
if (a != 0) {
syaryo.push(a);
}
else {
cout << syaryo.top() << endl;
syaryo.pop();
}
}
return 0;
} | #include <iostream>
#include <stack>
using namespace std;
int main() {
int a;
stack<int> syaryo;
while (cin >> a) {
if (a != 0) {
syaryo.push(a);
}
else {
cout << syaryo.top() << endl;
syaryo.pop();
}
}
return 0;
} | [["-", 0, 52, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 52, 8, 9, 0, 1, 0, 16, 17, 152], ["-", 0, 52, 8, 9, 0, 1, 0, 16, 12, 22], ["-", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]] | 1 | 72 | 4 |
#include <iostream>
#include <stack>
using namespace std;
int main() {
stack<char> stk;
char c;
while (cin >> c) {
if (c == '0') {
cout << stk.top() << endl;
stk.pop();
} else {
stk.push(c);
}
}
return 0;
} | #include <iostream>
#include <stack>
using namespace std;
int main() {
stack<int> stk;
int c;
while (cin >> c) {
if (c == 0) {
cout << stk.top() << endl;
stk.pop();
} else {
stk.push(c);
}
}
return 0;
} | [["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 57, 15, 339, 51, 16, 12, 103, 0, 104]] | 1 | 70 | 6 |
car = []
while input = gets
input = input.to_i
if input.zero? then puts(car.shift)
else
car.push input
end
end
| car = []
while input = gets
input = input.to_i
if input.zero? then puts(car.pop)
else
car.push input
end
end
| [["-", 64, 749, 0, 652, 3, 4, 0, 652, 735, 22], ["+", 64, 749, 0, 652, 3, 4, 0, 652, 735, 22]] | 4 | 31 | 2 |
arr = []
while line = gets
num = line.to_i
if num.zero?
putsarr.pop
else
arr << num
end
end
| arr = []
while line = gets
num = line.to_i
if num.zero?
puts arr.pop
else
arr << num
end
end
| [["-", 8, 170, 0, 121, 64, 749, 0, 652, 486, 22], ["+", 8, 170, 0, 121, 64, 749, 0, 652, 735, 22], ["+", 64, 749, 0, 652, 3, 4, 0, 652, 486, 22]] | 4 | 26 | 3 |
import sys
cars = []
for line in sys.stdin:
car = int(line)
if car:
cars.append(num)
else:
print(cars.pop()) | import sys
cars = []
for line in sys.stdin:
car = int(line)
if car:
cars.append(car)
else:
print(cars.pop()) | [["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]] | 5 | 38 | 2 |
import java.util.Scanner;
class Main {
public static double[][] solEq(double[][] a) {
int n = a.length, m = a[0].length;
for (int ipv = 0; ipv < n; ipv++) {
double max = 0.0;
int row = 0;
for (int i = ipv; i < n; i++) {
if (Math.abs(a[i][ipv]) > max) {
max = a[i][ipv];
... | import java.util.Scanner;
class Main {
public static double[][] solEq(double[][] a) {
int n = a.length, m = a[0].length;
for (int ipv = 0; ipv < n; ipv++) {
double max = 0.0;
int row = 0;
for (int i = ipv; i < n; i++) {
if (Math.abs(a[i][ipv]) > max) {
max = a[i][ipv];
... | [["-", 15, 15, 0, 16, 31, 16, 31, 16, 17, 20], ["+", 15, 15, 0, 16, 31, 16, 31, 16, 17, 47], ["-", 15, 15, 0, 16, 31, 16, 12, 16, 17, 20], ["+", 15, 15, 0, 16, 31, 16, 12, 16, 17, 47], ["-", 12, 16, 31, 16, 12, 504, 516, 504, 71, 499], ["+", 12, 16, 31, 16, 12, 504, 516, 504, 71, 499]] | 3 | 580 | 6 |
import java.util.Scanner;
public class Main {
Scanner sc;
boolean solve(double[][] point) {
double[][] v = new double[3][2];
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 2; ++j) {
v[i][j] = point[i][j] - point[3][j];
}
}
double theta = 0;
for (int i = 0; i < 3; ++i) {
... | import java.util.Scanner;
public class Main {
Scanner sc;
boolean solve(double[][] point) {
double[][] v = new double[3][2];
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 2; ++j) {
v[i][j] = point[i][j] - point[3][j];
}
}
double theta = 0;
for (int i = 0; i < 3; ++i) {
... | [["+", 8, 196, 0, 37, 0, 16, 12, 16, 17, 33], ["+", 8, 196, 0, 37, 0, 16, 12, 16, 12, 515]] | 3 | 381 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.