prompt
stringlengths 396
31.4k
|
---|
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.util.Scanner;
public class AlexAndARhombus {
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
System.out.println(n*n+(n-1)*(n-1));
sc.close();
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.util.*;
import static java.lang.Math.*;
import java.io.*;
public class SolutionB {
public static void main(String args[])throws IOException{
Scanner sc = new Scanner(System.in);
int a[] = new int[1501];
for(int i = 0; i < 3; i++){
a[sc.nextInt()]++;
}
if(a[1] > 0 || a[2] > 1 || a[3] > 2 || (a[4] == 2 && a[2] == 1)){
System.out.println("YES");
}else{
System.out.println("NO");
}
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.BufferedReader;
import java.io.InputStreamReader;
public class TestClass1 {
public static void main(String[] args) throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String s[] = br.readLine().split(" ");
long A,B,y,g,b;
A= Long.parseLong(s[0]);
B= Long.parseLong(s[1]);
s=br.readLine().split(" ");
y = Long.parseLong(s[0]);
g = Long.parseLong(s[1]);
b = Long.parseLong(s[2]);
long ans=0;
if(A-2*y-g < 0){
ans+=Math.abs(A-2*y-g);
}
if(B-g-3*b < 0){
ans+=Math.abs(B-g-3*b);
}
System.out.println(ans);
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>/**
* Author: Ridam Nagar
* Date: 27 February 2019
* Time: 01:17:36
**/
/*
package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.BigInteger;
/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
static String reverse(String s){
String reverse="";
for(int i=s.length()-1;i>=0;i--){
reverse=reverse + s.charAt(i);
}
return reverse;
}
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int m=sc.nextInt();
int x=m%(int)Math.pow(2,n);
System.out.println(x);
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.util.*;
import java.util.Scanner;
public class task1{
public static void main(String args[]){
Scanner in = new Scanner(System.in);
int n=in.nextInt();
int pos=in.nextInt();
int l=in.nextInt();
int r=in.nextInt();
boolean b=false;
boolean c=true;
if(l==1&&r==n){
c=false;
System.out.println(0);
}
if(c){
if(l==1){
if(pos<r){
System.out.println(r-pos+1);
b=true;}
else{
System.out.println(pos-r+1);
b=true;
}
}
if(r==n){
if(pos>l){
System.out.println(pos-l+1);
b=true;}
else{
System.out.println(l-pos+1);
b=true;
}
}
}
if(b==false&&c){
if(pos<l){
System.out.println(l-pos+1+r-l+1);
}
else if(pos>r){
System.out.println(pos-r+1+r-l+1);
}
else{
if(((pos-l)<(r-pos))){
System.out.println(pos-l+1+r-l+1);
}
else if((pos-l)>(r-pos)){
System.out.println(r-pos+1+r-l+1);
}
else{
System.out.println((r-pos)*3+2);
}
}
}
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
import java.io.*;
import java.math.*;
import java.util.*;
// author @mdazmat9
public class codeforces{
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int test = 1;
for (int ind = 0; ind < test; ind++) {
int [] a=new int[3];
a[0]=sc.nextInt();
a[1]=sc.nextInt();
a[2]=sc.nextInt();
Arrays.sort(a);
int k1=a[0];
int k2=a[1];
int k3=a[2];
if(k1==1 || k2==1 || k3==1){
out.println("YES");
}
else if((k1==2 && k2==2)||(k2==2 && k3==2)){
out.println("YES");
}
else if(k1==3 && k2==3 && k3==3){
out.println("YES");
}
else if(k1==2 && k2==4 && k3==4){
out.println("YES");
}
else
out.println("NO");
}
out.flush();
}
static void shuffle(int[] a) {
int n = a.length;
for(int i = 0; i < n; i++) {
int r = i + (int) (Math.random() * (n - i));
int tmp = a[i];
a[i] = a[r];
a[r] = tmp;
}
}
static long gcd(long a , long b)
{
if(b == 0)
return a;
return gcd(b , a % b);
}
}
class Scanner {
public BufferedReader reader;
public StringTokenizer st;
public Scanner(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream));
st = null;
}
public String next() {
while (st == null || !st.hasMoreTokens()) {
try {
String line = reader.readLine();
if (line == null) return null;
st = new StringTokenizer(line);
} catch (Exception e) {
throw (new RuntimeException());
}
}
return st.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
public long nextLong() {
return Long.parseLong(next());
}
public double nextDouble() {
return Double.parseDouble(next());
}
}
class OutputWriter {
BufferedWriter writer;
public OutputWriter(OutputStream stream) {
writer = new BufferedWriter(new OutputStreamWriter(stream));
}
public void print(int i) throws IOException {
writer.write(i);
}
public void print(String s) throws IOException {
writer.write(s);
}
public void print(char[] c) throws IOException {
writer.write(c);
}
public void close() throws IOException {
writer.close();
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.*;
import java.util.*;
public class C
{
static StringBuilder st = new StringBuilder();
public static void main(String[] args) throws Exception
{
Scanner sc = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int [] freq = new int [5] ;
int k = 3;
while(k -- >0)
{
int x = sc.nextInt();
if(x <= 4) freq[x]++;
}
freq[2] += freq[4]/ 2 ;
if(freq[1] >= 1 || freq[2] >= 2 || freq[3] >= 3)
out.println("YES");
else
out.println("NO");
out.flush();
out.close();
}
static class Scanner
{
BufferedReader br;
StringTokenizer st;
Scanner(InputStream in)
{
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() throws Exception {
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return st.nextToken();
}
int nextInt() throws Exception {
return Integer.parseInt(next());
}
long nextLong() throws Exception {
return Long.parseLong(next());
}
double nextDouble() throws Exception {
return Double.parseDouble(next());
}
}
static void shuffle(int[] a) {
int n = a.length;
for (int i = 0; i < n; i++) {
int r = i + (int) (Math.random() * (n - i));
int tmp = a[i];
a[i] = a[r];
a[r] = tmp;
}
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class TrickyAlchemy {
public static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
public static StringTokenizer st;
public static void main(String[] args) throws IOException {
long a = nextLong();
long b = nextLong();
long x = nextLong();
long y = nextLong();
long z = nextLong();
System.out.println(Math.max(2*x+y-a, 0) + Math.max(y+3*z-b, 0));
}
public static String nextLine() throws IOException {
return in.readLine();
}
public static String nextString() throws IOException {
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(in.readLine());
return st.nextToken();
}
public static int nextInt() throws IOException {
return Integer.parseInt(nextString());
}
public static long nextLong() throws IOException {
return Long.parseLong(nextString());
}
public static int[] intArray(int n) throws IOException {
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = nextInt();
return a;
}
public static int[][] intArray(int n, int m) throws IOException {
int[][] a = new int[n][m];
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
a[i][j] = nextInt();
return a;
}
public static long[] longArray(int n) throws IOException {
long[] a = new long[n];
for (int i = 0; i < n; i++)
a[i] = nextLong();
return a;
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.util.*;
public class A912 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scan = new Scanner(System.in);
int A = scan.nextInt();
int B = scan.nextInt();
long x = scan.nextInt();
long y = scan.nextInt();
long z = scan.nextInt();
long requiredA = x * 2 + y;
long requiredB = y + z * 3;
long neededA = Math.max(0, requiredA - A);
long neededB = Math.max(0, requiredB - B);
System.out.print(neededA + neededB);
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Test3 {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int x=Integer.parseInt(br.readLine());
int y=Integer.parseInt(br.readLine());
System.out.print((int)(y%(Math.pow(2, x))));
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.math.BigInteger;
import java.util.Scanner;
public class RENAMETHISBITCH {
public static void main(String[] args) {
try (Scanner sc = new Scanner(System.in)) {
int n = sc.nextInt();
BigInteger m = sc.nextBigInteger();
System.out.println(m.mod(BigInteger.valueOf(2).pow(n)));
}
catch (Exception e) {
e.printStackTrace();
}
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while(sc.hasNext()) {
int n = sc.nextInt();
int pos = sc.nextInt();
int l = sc.nextInt();
int r = sc.nextInt();
/*if(l==r) {
System.out.print(Math.abs(r-pos)+1);
}*/
if(l==1&&r==n) {
System.out.println(0);
}
else if(l==1&&r<n) {
System.out.println(Math.abs(r-pos)+1);
}
else if(l>1&&r==n) {
System.out.println(Math.abs(l-pos)+1);
}
else if(l>1&&r<n) {
int c = Math.min(Math.abs(r-pos), Math.abs(l-pos));//Math.abs(r-pos)>Math.abs(l-pos)?Math.abs(l-pos):Math.abs(r-pos);
System.out.println(c+2+r-l);
}
}
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Objects;
import java.util.Stack;
import java.util.StringTokenizer;
public class Test
{
static PrintWriter pw = new PrintWriter(System.out);
public static void main(String[] args)throws Exception
{
Reader.init(System.in);
int n = Reader.nextInt();
int p = Reader.nextInt();
int L = Reader.nextInt();
int R = Reader.nextInt();
int a = 1;
int b = n;
int res = 0;
if(a == L && b == R)
{
res = 0;
}
else if(L != a && R != b && p >= L && p <= R)
{
res = Math.min(p-L, R-p);
res += R- L + 2;
}
else if(L != a && R != b && p < L )
{
res += L-p + 1;
res += R - L +1;
}
else if(L != a && R != b && p > R)
{
res += p-R + 1;
res += R - L +1;
}
else if(a == L && p >=L && p<=R)
{
res += R - p + 1;
}
else if(R == b && p>=L && p<=R)
{
res += p - L + 1;
}
else if(a == L && p > R)
{
res += p - R + 1;
}
else if(R == b && p<L)
{
res += L - p + 1;
}
pw.print(res);
pw.close();
}
}
class Reader {
static BufferedReader reader;
static StringTokenizer tokenizer;
public static int pars(String x) {
int num = 0;
int i = 0;
if (x.charAt(0) == '-') {
i = 1;
}
for (; i < x.length(); i++) {
num = num * 10 + (x.charAt(i) - '0');
}
if (x.charAt(0) == '-') {
return -num;
}
return num;
}
static void init(InputStream input) {
reader = new BufferedReader(
new InputStreamReader(input));
tokenizer = new StringTokenizer("");
}
static void init(FileReader input) {
reader = new BufferedReader(input);
tokenizer = new StringTokenizer("");
}
static String next() throws IOException {
while (!tokenizer.hasMoreTokens()) {
tokenizer = new StringTokenizer(
reader.readLine());
}
return tokenizer.nextToken();
}
static int nextInt() throws IOException {
return pars(next());
}
static long nextLong() throws IOException {
return Long.parseLong(next());
}
static double nextDouble() throws IOException {
return Double.parseDouble(next());
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.util.*;
import java.io.*;
public class A
{
public static void main(String ar[]) throws Exception
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String s1[]=br.readLine().split(" ");
int n=Integer.parseInt(s1[0]);
int S=Integer.parseInt(s1[1]);
if(S%n==0)
System.out.println(S/n);
else
System.out.println(S/n+1);
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;
public class A {
static FastReader scan;
static PrintWriter out;
public static void main(String[] args) throws FileNotFoundException {
Solver solver = new Solver();
scan = new FastReader();
out = new PrintWriter(System.out);
int testCases = 1;
for(int i = 1; i <= testCases; i++) {
// out.print("Case #" + i + ": ");
solver.solve();
}
out.close();
}
static class Solver {
void solve() {
int a = scan.nextInt(), b = scan.nextInt();
if(b <= a) out.println(1);
else out.println(b/a + Math.min(1, b%a));
}
}
// Sathvik's Template Stuff BELOW!!!!!!!!!!!!!!!!!!!!!!
static class DSU {
int[] root, size;
int n;
DSU(int n) {
this.n = n;
root = new int[n];
size = new int[n];
for (int i = 0; i < n; i++) {
root[i] = i;
size[i] = 1;
}
}
int findParent(int idx) {
while (root[idx] != idx) {
root[idx] = root[root[idx]];
idx = root[idx];
}
return idx;
}
boolean union(int x, int y) {
int parX = findParent(x);
int parY = findParent(y);
if (parX == parY)
return false;
if (size[parX] < size[parY]) {
root[parY] = parX;
size[parX] += size[parY];
} else {
root[parX] = parY;
size[parY] += size[parX];
}
return true;
}
}
static class Extra {
static void sort(int[] a) {
Integer[] aa = new Integer[a.length];
for (int i = 0; i < aa.length; i++)
aa[i] = a[i];
Arrays.sort(aa);
for (int i = 0; i < aa.length; i++)
a[i] = aa[i];
}
static void sort(long[] a) {
Long[] aa = new Long[a.length];
for (int i = 0; i < aa.length; i++)
aa[i] = a[i];
Arrays.sort(aa);
for (int i = 0; i < aa.length; i++)
a[i] = aa[i];
}
static void sort(double[] a) {
Double[] aa = new Double[a.length];
for (int i = 0; i < aa.length; i++)
aa[i] = a[i];
Arrays.sort(aa);
for (int i = 0; i < aa.length; i++)
a[i] = aa[i];
}
static void sort(char[] a) {
Character[] aa = new Character[a.length];
for (int i = 0; i < aa.length; i++)
aa[i] = a[i];
Arrays.sort(aa);
for (int i = 0; i < aa.length; i++)
a[i] = aa[i];
}
static long gcd(long a, long b) {
while (b > 0) {
long temp = b;
b = a % b;
a = temp;
}
return a;
}
static long lcm(long a, long b) {
return a * (b / gcd(a, b));
}
static boolean isPrime(long n) {
if (n <= 1)
return false;
if (n <= 3)
return true;
if (n % 2 == 0 || n % 3 == 0)
return false;
for (long i = 5; i * i <= n; i = i + 6) {
if (n % i == 0 || n % (i + 2) == 0)
return false;
}
return true;
}
static HashSet<Integer> sieve(int n) {
boolean[] prime = new boolean[n + 1];
HashSet<Integer> res = new HashSet<>();
for (int p = 2; p * p <= n; p++) {
if (!prime[p]) {
res.add(p);
for (int i = p * p; i <= n; i += p)
prime[i] = true;
}
}
return res;
}
static HashMap<Long, Integer> primeFactorization(long n) {
HashMap<Long, Integer> res = new HashMap<>();
while (n % 2 == 0) {
res.put(2L, res.getOrDefault(2L, 0) + 1);
n /= 2;
}
for (long i = 3; i * i <= n; i += 2) {
while (n % i == 0) {
res.put(i, res.getOrDefault(i, 0) + 1);
n /= i;
}
}
if (n > 2)
res.put(n, 1);
return res;
}
}
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
public FastReader(String s) throws FileNotFoundException {
br = new BufferedReader(new FileReader(new File(s)));
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
int[] nextIntArray(int n) {
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = nextInt();
return a;
}
long nextLong() {
return Long.parseLong(next());
}
long[] nextLongArray(int n) {
long[] a = new long[n];
for (int i = 0; i < n; i++)
a[i] = nextLong();
return a;
}
double nextDouble() {
return Double.parseDouble(next());
}
double[] nextDoubleArray(int n) {
double[] a = new double[n];
for (int i = 0; i < n; i++)
a[i] = nextDouble();
return a;
}
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.util.*;
import java.io.*;
public class Param
{
public static void main( String[]args)
{
MyScanner param = new MyScanner();
out = new PrintWriter(new BufferedOutputStream(System.out));
int highestcoin=param.nextInt();
int sum=param.nextInt();
int remainder=sum%highestcoin;
if(remainder!=0){
remainder=1;
}
else{
remainder=0;
}
int count=(sum-remainder)/highestcoin;
if (highestcoin>=sum){
System.out.println("1");
}
else{
System.out.println(count+remainder);
}
out.close();
}
public static PrintWriter out;
//-----------MyScanner class for faster input----------
public static class MyScanner {
BufferedReader br;
StringTokenizer st;
public MyScanner() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
String nextLine(){
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>//Author: Patel Rag
//Java version "1.8.0_211"
import java.util.*;
import java.io.*;
public class Main
{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in)); }
String next()
{
while (st == null || !st.hasMoreElements())
{
try
{
st = new StringTokenizer(br.readLine());
}
catch (IOException e)
{
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() { return Integer.parseInt(next()); }
long nextLong(){ return Long.parseLong(next()); }
double nextDouble(){ return Double.parseDouble(next()); }
float nextFloat() { return Float.parseFloat(next()); }
boolean nextBoolean() { return Boolean.parseBoolean(next()); }
String nextLine()
{
String str = "";
try
{
str = br.readLine();
}
catch (IOException e)
{
e.printStackTrace();
}
return str;
}
}
static long modExp(long x, long n, long mod) //binary Modular exponentiation
{
long result = 1;
while(n > 0)
{
if(n % 2 == 1)
result = (result%mod * x%mod)%mod;
x = (x%mod * x%mod)%mod;
n=n/2;
}
return result;
}
static long gcd(long a, long b)
{
if(a==0) return b;
return gcd(b%a,a);
}
public static void main(String[] args)
throws IOException
{
FastReader fr = new FastReader();
long n = fr.nextLong();
long x = fr.nextLong();
long y = fr.nextLong();
long w = Long.min(x,y) - 1 + (x - Long.min(x,y)) + (y - Long.min(x,y));
long b = n - Long.max(x,y) + (Long.max(x,y) - x) + (Long.max(x,y) - y);
if(w <= b) System.out.println("White");
else System.out.println("Black");
}
}
class Pair<U, V> // Pair class
{
public final U first; // first field of a Pair
public final V second; // second field of a Pair
private Pair(U first, V second)
{
this.first = first;
this.second = second;
}
@Override
public boolean equals(Object o)
{
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Pair<?, ?> pair = (Pair<?, ?>) o;
if (!first.equals(pair.first)) return false;
return second.equals(pair.second);
}
@Override
public int hashCode()
{
return 31 * first.hashCode() + second.hashCode();
}
public static <U, V> Pair <U, V> of(U a, V b)
{
return new Pair<>(a, b);
}
}
class myComp implements Comparator<Pair>
{
public int compare(Pair a,Pair b)
{
if(a.first != b.first) return ((int)a.first - (int)b.first);
if(a.second != b.second) return ((int)a.second - (int)b.second);
return 0;
}
}
class BIT //Binary Indexed Tree aka Fenwick Tree
{
public long[] m_array;
public BIT(long[] dat)
{
m_array = new long[dat.length + 1];
Arrays.fill(m_array,0);
for(int i = 0; i < dat.length; i++)
{
m_array[i + 1] = dat[i];
}
for(int i = 1; i < m_array.length; i++)
{
int j = i + (i & -i);
if(j < m_array.length)
{
m_array[j] = m_array[j] + m_array[i];
}
}
}
public final long prefix_query(int i)
{
long result = 0;
for(++i; i > 0; i = i - (i & -i))
{
result = result + m_array[i];
}
return result;
}
public final long range_query(int fro, int to)
{
if(fro == 0)
{
return prefix_query(to);
}
else
{
return (prefix_query(to) - prefix_query(fro - 1));
}
}
public void update(int i, long add)
{
for(++i; i < m_array.length; i = i + (i & -i))
{
m_array[i] = m_array[i] + add;
}
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.awt.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
import java.util.List;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
long n = scanner.nextLong();
long x = scanner.nextLong(), y = scanner.nextLong();
long whiteSteps, blackSteps;
if(x == 1 || y == 1){
whiteSteps = (x - 1) + (y - 1);
} else {
whiteSteps = Math.min((x - 1) + Math.abs(y - x), (y - 1) + Math.abs(y - x));
}
if(x == n || y == n){
blackSteps = (n - x) + (n - y);
} else {
blackSteps = Math.min((n - x) + Math.abs(y - x), (n - y) + Math.abs(y - x));
}
if (whiteSteps <= blackSteps){
System.out.println("White");
} else {
System.out.println("Black");
}
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
import java.util.Scanner;
import javafx.geometry.Point2D;
public class ChessKing {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
long size = input.nextLong();
long a = input.nextLong();
long b = input.nextLong();
long sum = a+b;
long d = sum-2;
long d1 = size*2 - sum;
if(d<d1) System.out.println("White");
else if(d>d1) System.out.println("Black");
else System.out.println("White");
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.PrintWriter;
import java.util.Scanner;
public class pr1023B {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
long n = sc.nextLong();
long k = sc.nextLong();
out.println(solve(n, k));
out.flush();
out.close();
}
static long solve(long n, long k) {
if(k <= n) return (long)Math.floor((double)(k-1)/2);
else{
long mx = n;
long mn = k-n;
return Math.max(0, (long)Math.floor((double)(mx-mn+1)/2));
}
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;
public class B {
public static void main(String[] args) throws Exception {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
// int n = Integer.parseInt(bf.readLine());
StringTokenizer st = new StringTokenizer(bf.readLine());
// int[] a = new int[n]; for(int i=0; i<n; i++) a[i] = Integer.parseInt(st.nextToken());
int n = Integer.parseInt(st.nextToken());
int m = Integer.parseInt(st.nextToken());
StringBuilder ans1 = new StringBuilder();
StringBuilder ans2 = new StringBuilder();
for(int i=0; i<2229; i++) ans1.append('5');
ans1.append('6');
for(int i=0; i<2230; i++) ans2.append('4');
out.println(ans1.toString());
out.println(ans2.toString());
out.close(); System.exit(0);
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
/**
*
* @author Antonio "Teo" Alurralde
*/
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
StringTokenizer tok = new StringTokenizer(br.readLine());
int ax = Integer.parseInt(tok.nextToken());
int ay = Integer.parseInt(tok.nextToken());
tok = new StringTokenizer(br.readLine());
int bx = Integer.parseInt(tok.nextToken());
int by = Integer.parseInt(tok.nextToken());
tok = new StringTokenizer(br.readLine());
int cx = Integer.parseInt(tok.nextToken());
int cy = Integer.parseInt(tok.nextToken());
boolean ans = (bx < ax && cx < ax && by < ay && cy < ay) ||
(bx < ax && cx < ax && by > ay && cy > ay) ||
(bx > ax && cx > ax && by < ay && cy < ay) ||
(bx > ax && cx > ax && by > ay && cy > ay);
System.out.print(ans?"YES":"NO");
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.BufferedReader;
import java.io.PrintWriter;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;
import java.util.Arrays;
public class Main {
static Scanner in = new Scanner();
static PrintWriter out = new PrintWriter(System.out);
public static void main(String[] args) throws IOException {
long n = in.nextLong(), m = in.nextLong();
out.print(m / n + (m % n == 0 ? 0 : 1));
out.close();
}
static class Scanner {
BufferedReader br;
StringTokenizer st;
public Scanner() {
br = new BufferedReader(new InputStreamReader(System.in));
st = new StringTokenizer("");
}
public String next() throws IOException {
if(!st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return st.nextToken();
}
public int nextInt() throws IOException {
return Integer.parseInt(next());
}
public long nextLong() throws IOException {
return Long.parseLong(next());
}
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.BufferedReader;
import java.io.PrintWriter;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;
public class Main {
static Scanner in = new Scanner();
static PrintWriter out = new PrintWriter(System.out);
public static void main(String[] args) throws IOException {
int x = in.nextInt(),
y = in.nextInt(),
z = in.nextInt(),
t1 = in.nextInt(),
t2 = in.nextInt(),
t3 = in.nextInt()*3,
d = Math.abs(x - y);
out.print(((Math.abs(x - z) + d) * t2 + t3 > d * t1 ? "NO" : "YES"));
out.close();
}
static class Scanner {
BufferedReader br;
StringTokenizer st;
public Scanner() {
br = new BufferedReader(new InputStreamReader(System.in));
st = new StringTokenizer("");
}
public String next() throws IOException {
if(!st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return st.nextToken();
}
public int nextInt() throws IOException {
return Integer.parseInt(next());
}
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.*;
public class coins
{
public static void main(String args[])throws IOException
{
InputStreamReader read=new InputStreamReader(System.in);
BufferedReader in=new BufferedReader(read);
int i,k,n,v;
String a;
a=in.readLine();
for(i=0;i<a.length();i++)
{
if(a.charAt(i)==' ')
break;
}
n=Integer.parseInt(a.substring(0,i));
v=Integer.parseInt(a.substring(i+1));
k=v%n;
v=v/n;
if(k>0)
v++;
System.out.println(v);
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Solution {
static long MOD = 1_000_000_000 + 7;
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
long n = Long.parseLong(st.nextToken());
long m = Long.parseLong(st.nextToken());
long k = Long.parseLong(st.nextToken());
long l = Long.parseLong(st.nextToken());
long p = (l + k) / m;
if (p * m != l + k) {
p++;
}
if (m * p <= n) {
System.out.println(p);
} else {
System.out.println(-1);
}
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.Math;
public class A {
public static void main(String[] args) {
BufferedReader br = null;
br = new BufferedReader(new InputStreamReader(System.in));
String input;
try {
input = br.readLine();
long n = Long.parseLong(input.split(" ")[0]);
long k = Long.parseLong(input.split(" ")[1]);
long red = (long) (Math.ceil((n * 2.0)/k));
long blue = (long) (Math.ceil((n * 5.0)/k));
long green = (long) (Math.ceil((n * 8.0)/k));
System.out.println(red + blue +green);
} catch (IOException e) {
e.printStackTrace();
}
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class EhabAndAnotherConstructionProblem {
public static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
public static StringTokenizer st;
public static void main(String[] args) throws IOException {
int x = nextInt();
System.out.println(x == 1 ? -1 : x + " " + x);
}
public static String nextLine() throws IOException {
return in.readLine();
}
public static String nextString() throws IOException {
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(in.readLine());
return st.nextToken();
}
public static int nextInt() throws IOException {
return Integer.parseInt(nextString());
}
public static long nextLong() throws IOException {
return Long.parseLong(nextString());
}
public static int[] intArray(int n) throws IOException {
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = nextInt();
return a;
}
public static int[][] intArray(int n, int m) throws IOException {
int[][] a = new int[n][m];
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
a[i][j] = nextInt();
return a;
}
public static long[] longArray(int n) throws IOException {
long[] a = new long[n];
for (int i = 0; i < n; i++)
a[i] = nextLong();
return a;
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long n = sc.nextLong();
long k = sc.nextLong();
System.out.println(solve(n, k));
sc.close();
}
static long solve(long n, long k) {
return Math.max(0, Math.min(n, k - 1) - ((k + 2) / 2) + 1);
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.*;
import java.util.*;
public class A1008 {
public static void main(String [] args) /*throws Exception*/ {
InputStream inputReader = System.in;
OutputStream outputReader = System.out;
InputReader in = new InputReader(inputReader);//new InputReader(new FileInputStream(new File("input.txt")));new InputReader(inputReader);
PrintWriter out = new PrintWriter(outputReader);//new PrintWriter(new FileOutputStream(new File("output.txt")));
Algorithm solver = new Algorithm();
solver.solve(in, out);
out.close();
}
}
class Algorithm {
void solve(InputReader ir, PrintWriter pw) {
long n = ir.nextLong(), k = ir.nextLong();
long l = Math.max(1, k - n), r = (k + 1) / 2;
l = Math.max(0, r - l);
pw.print(l);
}
}
class InputReader {
private BufferedReader reader;
private StringTokenizer tokenizer;
InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream), 32768);
tokenizer = null;
}
String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
String nextLine(){
String fullLine = null;
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
fullLine = reader.readLine();
} catch (IOException e) {
throw new RuntimeException(e);
}
return fullLine;
}
return fullLine;
}
String [] toArray() {
return nextLine().split(" ");
}
int nextInt() {
return Integer.parseInt(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
long nextLong() {
return Long.parseLong(next());
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class AAA {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int n=Integer.parseInt(st.nextToken());
int m=Integer.parseInt(st.nextToken());
String a="";
String b="";
for(int i=0;i<1129;i++) {
a+="1";
b+="8";
}
a+="9";
b+="1";
System.out.println(a);
System.out.println(b);
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class B
{
static StringBuilder st ;
public static void main(String[] args) throws Exception
{
Scanner sc = new Scanner () ;
PrintWriter out = new PrintWriter(System.out);
int n = sc.nextInt();
int m = sc.nextInt();
String first = "" ;
String second = "" ;
for(int i = 0 ; i < 126 ;i++ )
{
first+= "9";
second+="9";
}
for(int i = 0 ; i < 125 ;i++ )
first+= "0";
first += "1";
out.println(first+" "+second);
out.flush();
out.close();
}
static int sumDigits(int num)
{
int ans = 0 ;
while(num > 0)
{
ans += num % 10 ;
num /= 10;
}
return ans ;
}
static class Scanner
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st;
String next() throws Exception
{
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return st.nextToken();
}
int nextInt() throws Exception { return Integer.parseInt(next()); }
long nextLong() throws Exception { return Long.parseLong(next()); }
double nextDouble() throws Exception { return Double.parseDouble(next()); }
char nextChar() throws Exception { return next().charAt(0); }
char [] nextCharArray() throws Exception{ return next().toCharArray() ; }
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class A {
public static void main(String[] args) {
BufferedReader br = null;
br = new BufferedReader(new InputStreamReader(System.in));
String input;
try {
input = br.readLine();
int n = Integer.parseInt(input);
input = br.readLine();
int qx = Integer.parseInt(input.split(" ")[0]);
int qy = Integer.parseInt(input.split(" ")[1]);
input = br.readLine();
int kx = Integer.parseInt(input.split(" ")[0]);
int ky = Integer.parseInt(input.split(" ")[1]);
input = br.readLine();
int gx = Integer.parseInt(input.split(" ")[0]);
int gy = Integer.parseInt(input.split(" ")[1]);
if((kx<qx && gx<qx)||(kx>qx && gx>qx)) {
if((ky<qy && gy<qy)||(ky>qy && gy>qy))System.out.println("YES");
else System.out.println("NO");
}else System.out.println("NO");
} catch (IOException e) {
e.printStackTrace();
}
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;
public class KingEscape {
public static void main(String[] args) {
Reader read = new Reader();
int n = read.nextInt();
int a1 = read.nextInt();
int a2 = read.nextInt();
int b1 = read.nextInt();
int b2 = read.nextInt();
int c1 = read.nextInt();
int c2 = read.nextInt();
if (b1 > a1 && b2 > a2 && c1 > a1 && c2 > a2)
System.out.print("YES");
else if (b1 > a1 && b2 < a2 && c1 > a1 && c2 < a2)
System.out.print("YES");
else if (b1 < a1 && b2 > a2 && c1 < a1 && c2 > a2)
System.out.print("YES");
else if (b1 < a1 && b2 < a2 && c1 < a1 && c2 < a2)
System.out.print("YES");
else
System.out.print("NO");
}
private static class Reader {
private final BufferedReader reader;
private final String separator;
private String ln;
private String[] tokens;
private int ptr;
Reader(String separator, InputStream input) {
this.reader = new BufferedReader(new InputStreamReader(input));
this.separator = separator;
this.ptr = -1;
}
Reader(String separator) { this(separator, System.in); }
Reader() { this(" "); }
String nextStr(){
if (Objects.isNull(ln)) {
try {
ln = reader.readLine();
} catch (IOException e) {
System.out.println(e.getMessage());
}
if (Objects.nonNull(ln)) {
tokens = ln.split(separator);
ptr = 0;
} else {
throw new NoSuchElementException("no next element");
}
} else if (ptr == tokens.length) {
ln = null;
tokens = null;
ptr = -1;
return nextStr();
}
return tokens[ptr++];
}
int nextInt() { return Integer.parseInt(nextStr()); }
long nextLong() { return Long.parseLong(nextStr()); }
double nextDouble() { return Double.parseDouble(nextStr()); }
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.*;
import java.util.*;
public class A_KingEscape {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader inp = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
Solver solver = new Solver();
solver.solve(inp, out);
out.close();
}
private static class Solver {
private void solve(InputReader inp, PrintWriter out) {
int n = inp.nextInt();
int Qx = inp.nextInt(), Qy = inp.nextInt();
int Kx = inp.nextInt(), Ky = inp.nextInt();
int Tx = inp.nextInt(), Ty = inp.nextInt();
if (((Kx < Qx && Tx < Qx) || (Kx > Qx && Tx > Qx)) && ((Ky < Qy && Ty < Qy) || (Ky > Qy && Ty > Qy))) out.println("YES");
else out.println("NO");
}
}
static class InputReader {
BufferedReader reader;
StringTokenizer tokenizer;
InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream), 32768);
tokenizer = null;
}
String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
public long nextLong() {
return Long.parseLong(next());
}
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.*;
import java.util.*;
import java.math.*;
public class Main
{
//static long k = 0;
public static void main(String[] args) throws IOException
{
BufferedReader st = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer s = new StringTokenizer(st.readLine());
long n = Long.parseLong(s.nextToken());
long k = Long.parseLong(s.nextToken());
long ans = k/n;
if(k%n != 0) ans++;
System.out.println(ans+"");
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.*;
import java.util.*;
public class A1008 {
public static void main(String [] args) /*throws Exception*/ {
InputStream inputReader = System.in;
OutputStream outputReader = System.out;
InputReader in = new InputReader(inputReader);//new InputReader(new FileInputStream(new File("input.txt")));new InputReader(inputReader);
PrintWriter out = new PrintWriter(outputReader);//new PrintWriter(new FileOutputStream(new File("output.txt")));
Algorithm solver = new Algorithm();
solver.solve(in, out);
out.close();
}
}
class Algorithm {
void solve(InputReader ir, PrintWriter pw) {
long n = ir.nextLong(), k = ir.nextLong();
pw.print((n + k - 1) / n);
}
private static void Qsort(int[] array, int low, int high) {
int i = low;
int j = high;
int x = array[low + (high - low) / 2];
do {
while (array[i] < x) ++i;
while (array[j] > x) --j;
if (i <= j) {
int tmp = array[i];
array[i] = array[j];
array[j] = tmp;
i++;
j--;
}
} while (i <= j);
if (low < j) Qsort(array, low, j);
if (i < high) Qsort(array, i, high);
}
}
class InputReader {
private BufferedReader reader;
private StringTokenizer tokenizer;
InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream), 32768);
tokenizer = null;
}
String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
String nextLine(){
String fullLine = null;
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
fullLine = reader.readLine();
} catch (IOException e) {
throw new RuntimeException(e);
}
return fullLine;
}
return fullLine;
}
String [] toArray() {
return nextLine().split(" ");
}
int nextInt() {
return Integer.parseInt(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
long nextLong() {
return Long.parseLong(next());
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.util.*;
import java.io.*;
import java.math.*;
import java.awt.geom.*;
public class FunctionHeight {
public static void main(String[] args) {
MyScanner sc = new MyScanner();
long n = sc.nl();
long k = sc.nl();
long ans = (n+k-1)/n;
System.out.println(ans);
}
/////////// TEMPLATE FROM HERE /////////////////
private static class MyScanner {
BufferedReader br;
StringTokenizer st;
public MyScanner() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int ni() {
return Integer.parseInt(next());
}
float nf() {
return Float.parseFloat(next());
}
long nl() {
return Long.parseLong(next());
}
double nd() {
return Double.parseDouble(next());
}
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
public class ElevatorOrStairs {
private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
private static final OutputStreamWriter writer = new OutputStreamWriter(System.out);
public static void main(String...strings) throws Exception {
String[] specs = reader.readLine().split(" ");
int x = Integer.parseInt(specs[0]);
int y = Integer.parseInt(specs[1]);
int z = Integer.parseInt(specs[2]);
int t1 = Integer.parseInt(specs[3]);
int t2 = Integer.parseInt(specs[4]);
int t3 = Integer.parseInt(specs[5]);
reader.close();
String ans = solve(x, y, z, t1, t2, t3);
writer.append(ans);
writer.flush();
writer.close();
}
private static String solve(int x, int y, int z, int t1, int t2, int t3) {
int time_using_stairs = Math.abs(x - y) * t1;
int elevator_time_between_floor = Math.abs(x - z) * t2;
int elevator_from_z_to_x = elevator_time_between_floor + 2*t3;
int time_using_elevator = elevator_from_z_to_x + (Math.abs(x - y) * t2) + t3;
if(time_using_elevator <= time_using_stairs) {
return "YES";
}
return "NO";
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main (String[] args) {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
try {
String parameterStringList[] = reader.readLine().split(" ");
int x = Integer.parseInt(parameterStringList[0]);
int y = Integer.parseInt(parameterStringList[1]);
int z = Integer.parseInt(parameterStringList[2]);
int t1 = Integer.parseInt(parameterStringList[3]);
int t2 = Integer.parseInt(parameterStringList[4]);
int t3 = Integer.parseInt(parameterStringList[5]);
int T1 = Math.abs(x-y) * t1;
int T2 = Math.abs(x-z) * t2 + 3*t3 + Math.abs(x-y) * t2;
if(T2 <= T1) System.out.println("YES");
else System.out.println("NO");
} catch (IOException e) {
e.printStackTrace();
}
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Solve4 {
public static void main(String[] args) throws IOException {
FastReader sc = new FastReader();
int x= sc.nextInt();
int y= sc.nextInt();
int z= sc.nextInt();
int t1= sc.nextInt();
int t2= sc.nextInt();
int t3= sc.nextInt();
if(Math.abs(x-y)*t1 < (Math.abs(x-z)+Math.abs(x-y))*t2+3*t3 ) System.out.println("NO");
else System.out.println("YES");
}
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
public String next() throws IOException {
if (st == null || !st.hasMoreTokens()) {
st = new StringTokenizer(br.readLine());
}
return st.nextToken();
}
public int nextInt() throws IOException {
return Integer.parseInt(next());
}
public long nextLong() throws IOException {
return Long.parseLong(next());
}
public double nextDouble() throws IOException {
return Double.parseDouble(next());
}
public String nextLine() {
String s = "";
try {
s = br.readLine();
} catch (IOException ex) {
}
return s;
}
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.util.*;
import java.io.*;
public class A
{
public static void main(String ar[]) throws Exception
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String s1[]=br.readLine().split(" ");
int n=Integer.parseInt(s1[0]);
int S=Integer.parseInt(s1[1]);
if(S%n==0)
System.out.println(S/n);
else
System.out.println(S/n+1);
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.*;
import java.util.*;
public class A {
public static void main(String args[]) {
FastScanner scn = new FastScanner();
int n = scn.nextInt();
int s = scn.nextInt();
if (s <= n) {
System.out.println(1);
} else if (s > n) {
if(s%n == 0){
System.out.println(s/n);
} else {
System.out.println(s/n + 1);
}
}
}
public static class FastScanner {
BufferedReader br;
StringTokenizer st;
public FastScanner(String s) {
try {
br = new BufferedReader(new FileReader(s));
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public FastScanner() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String nextToken() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(nextToken());
}
long nextLong() {
return Long.parseLong(nextToken());
}
double nextDouble() {
return Double.parseDouble(nextToken());
}
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.util.*;
import java.io.*;
public class Param
{
public static void main( String[]args)
{
MyScanner param = new MyScanner();
out = new PrintWriter(new BufferedOutputStream(System.out));
int highestcoin=param.nextInt();
int sum=param.nextInt();
int remainder=sum%highestcoin;
if(remainder!=0){
remainder=1;
}
else{
remainder=0;
}
int count=(sum-remainder)/highestcoin;
if (highestcoin>=sum){
System.out.println("1");
}
else{
System.out.println(count+remainder);
}
out.close();
}
public static PrintWriter out;
//-----------MyScanner class for faster input----------
public static class MyScanner {
BufferedReader br;
StringTokenizer st;
public MyScanner() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
String nextLine(){
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in Actual solution is at the top
*
* @author @Ziklon
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
OutputWriter out = new OutputWriter(outputStream);
ABirthday solver = new ABirthday();
solver.solve(1, in, out);
out.close();
}
static class ABirthday {
public void solve(int testNumber, InputReader in, OutputWriter out) {
long N = in.readLong(), M = in.readLong(), K = in.readLong(), L = in.readLong();
long ans = ((L + K) - 1) / M + 1;
if (ans * M > N || ans * M - K < L) out.printLine(-1);
else out.printLine(ans);
}
}
static class OutputWriter {
private final PrintWriter writer;
public OutputWriter(OutputStream outputStream) {
writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
}
public OutputWriter(Writer writer) {
this.writer = new PrintWriter(writer);
}
public void close() {
writer.close();
}
public void printLine(long i) {
writer.println(i);
}
public void printLine(int i) {
writer.println(i);
}
}
static class InputReader {
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
private InputReader.SpaceCharFilter filter;
public InputReader(InputStream stream) {
this.stream = stream;
}
public int read() {
if (numChars == -1) {
throw new InputMismatchException();
}
if (curChar >= numChars) {
curChar = 0;
try {
numChars = stream.read(buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (numChars <= 0) {
return -1;
}
}
return buf[curChar++];
}
public long readLong() {
int c = read();
while (isSpaceChar(c)) {
c = read();
}
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
long res = 0;
do {
if (c < '0' || c > '9') {
throw new InputMismatchException();
}
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
public boolean isSpaceChar(int c) {
if (filter != null) {
return filter.isSpaceChar(c);
}
return isWhitespace(c);
}
public static boolean isWhitespace(int c) {
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
public interface SpaceCharFilter {
public boolean isSpaceChar(int ch);
}
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) {
SpeedScanner speedScanner = new SpeedScanner();
PrintWriter out = new PrintWriter(System.out);
taskSolver(speedScanner, out);
out.close();
}
public static void taskSolver(SpeedScanner speedScanner, PrintWriter out) {
long n = speedScanner.nextLong();
long m = speedScanner.nextLong();
long k = speedScanner.nextLong();
long l = speedScanner.nextLong();
long tempM ;
if ((k+l) < m){
if (n<m)
out.print(-1);
else
out.print(1);
}else {
tempM = (k+l)/m;
if ((k+l)%m == 0){
if (tempM*m <= n)
out.print(tempM);
else
out.print(-1);
}else {
if ((tempM+1)*m <= n)
out.print(tempM+1);
else
out.print(-1);
}
}
}
public static class SpeedScanner {
BufferedReader br;
StringTokenizer st;
public SpeedScanner() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String nextToken() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(nextToken());
}
long nextLong() {
return Long.parseLong(nextToken());
}
double nextDouble() {
return Double.parseDouble(nextToken());
}
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.util.*;
import java.math.*;
import java.io.*;
public class CF1068A {
public CF1068A() {
FS scan = new FS();
long n = scan.nextLong(), m = scan.nextLong(), k = scan.nextLong(), l = scan.nextLong();
long ceil = (k + l + m - 1) / m;
if(k + l <= n && ceil * m <= n) System.out.println(ceil);
else System.out.println(-1);
}
class FS {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer("");
public String next() {
while(!st.hasMoreTokens()) {
try { st = new StringTokenizer(br.readLine()); }
catch(Exception e) { e.printStackTrace(); }
}
return st.nextToken();
}
public int nextInt() { return Integer.parseInt(next()); }
public long nextLong() { return Long.parseLong(next()); }
}
public static void main(String[] args) { new CF1068A(); }
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.*;
import java.util.*;
public class Main {
static StringBuilder data;
final static FastReader in = new FastReader();
public static void main(String[] args) {
int n = in.nextInt(), k = in.nextInt();
long answ = 0;
if (n * 2 > k) {
if((n*2)%k==0){
answ+=(n*2)/k;
}else{
answ+=((n*2)/k)+1;
}
}else{
answ++;
}
if (n * 5 > k) {
if((n*5)%k==0){
answ+=(n*5)/k;
}else{
answ+=((n*5)/k)+1;
}
}else{
answ++;
}
if (n * 8 > k) {
if((n*8)%k==0){
answ+=(n*8)/k;
}else{
answ+=((n*8)/k)+1;
}
}else{
answ++;
}
System.out.println(answ);
}
static void fileOut(String s) {
File out = new File("output.txt");
try {
FileWriter fw = new FileWriter(out);
fw.write(s);
fw.flush();
fw.close();
} catch (IOException e) {
e.printStackTrace();
}
}
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new
InputStreamReader(System.in));
}
public FastReader(String path) {
try {
br = new BufferedReader(new
InputStreamReader(new FileInputStream(path)));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
float nextFloat() {
return Float.parseFloat(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.util.*;
import java.math.*;
import java.io.*;
public class programA {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int n = Integer.parseInt(st.nextToken());
int k = Integer.parseInt(st.nextToken());
int t1 = (int)Math.ceil((double)n*2/k);
int t2 = (int)Math.ceil((double)n*5/k);
int t3 = (int)Math.ceil((double)n*8/k);
System.out.println(t1+t2+t3);
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.*;
import java.util.*;
import java.math.*;
public class bhaa {
InputStream is;
PrintWriter o;
/////////////////// CODED++ BY++ ++ ++ ++ BHAVYA++ ARORA++ ++ ++ ++ FROM++ JAYPEE++ INSTITUTE++ OF++ INFORMATION++ TECHNOLOGY++ ////////////////
///////////////////////// Make it work, make it right, make it fast. Make it work, make it right, make it fast. Make it work, make it right, make it fast. Make it work, make it right, make it fast. /////////////////
boolean chpr(int n)
{
if(n==1)
{
return true;
}if(n==2)
{
return true;
}
if(n==3)
{
return true;
}
if(n%2==0)
{
return false;
}
if(n%3==0)
{
return false;
}
int w=2;
int i=5;
while(i*i<=n)
{
if(n%i==0)
{
return false;
}
i+=w;
w=6-w;
}
return true;
}
void solve() {
int n=ni();
int k=ni();
int rr=2*n;
int gr=5*n;
int br=8*n;
o.println((long)(Math.ceil(rr*1.0/k)+Math.ceil(gr*1.0/k)+Math.ceil(br*1.0/k)));
}
//---------- I/O Template ----------
public static void main(String[] args) { new bhaa().run(); }
void run() {
is = System.in;
o = new PrintWriter(System.out);
solve();
o.flush();
}
byte input[] = new byte[1024];
int len = 0, ptr = 0;
int readByte() {
if(ptr >= len) { ptr = 0;
try { len = is.read(input); }
catch(IOException e) { throw new InputMismatchException(); }
if(len <= 0) { return -1; }
} return input[ptr++];
}
boolean isSpaceChar(int c) { return !( c >= 33 && c <= 126 ); }
int skip() {
int b = readByte();
while(b != -1 && isSpaceChar(b)) { b = readByte(); }
return b;
}
char nc() { return (char)skip(); }
String ns() {
int b = skip();
StringBuilder sb = new StringBuilder();
while(!isSpaceChar(b)) { sb.appendCodePoint(b); b = readByte(); }
return sb.toString();
}
String nLine() {
int b = skip();
StringBuilder sb = new StringBuilder();
while( !(isSpaceChar(b) && b != ' ') ) { sb.appendCodePoint(b); b = readByte(); }
return sb.toString();
}
int ni() {
int n = 0, b = readByte();
boolean minus = false;
while(b != -1 && !( (b >= '0' && b <= '9') || b == '-')) { b = readByte(); }
if(b == '-') { minus = true; b = readByte(); }
if(b == -1) { return -1; } //no input
while(b >= '0' && b <= '9') { n = n * 10 + (b - '0'); b = readByte(); }
return minus ? -n : n;
}
long nl() {
long n = 0L; int b = readByte();
boolean minus = false;
while(b != -1 && !( (b >= '0' && b <= '9') || b == '-')) { b = readByte(); }
if(b == '-') { minus = true; b = readByte(); }
while(b >= '0' && b <= '9') { n = n * 10 + (b - '0'); b = readByte(); }
return minus ? -n : n;
}
double nd() { return Double.parseDouble(ns()); }
float nf() { return Float.parseFloat(ns()); }
int[] nia(int n) {
int a[] = new int[n];
for(int i = 0; i < n; i++) { a[i] = ni(); }
return a;
}
long[] nla(int n) {
long a[] = new long[n];
for(int i = 0; i < n; i++) { a[i] = nl(); }
return a;
}
int [][] nim(int n)
{
int mat[][]=new int[n][n];
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
mat[i][j]=ni();
}
}
return mat;
}
long [][] nlm(int n)
{
long mat[][]=new long[n][n];
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
mat[i][j]=nl();
}
}
return mat;
}
char[] ns(int n) {
char c[] = new char[n];
int i, b = skip();
for(i = 0; i < n; i++) {
if(isSpaceChar(b)) { break; }
c[i] = (char)b; b = readByte();
} return i == n ? c : Arrays.copyOf(c,i);
}
void piarr(int arr[])
{
for(int i=0;i<arr.length;i++)
{
o.print(arr[i]+" ");
}
o.println();
}
void plarr(long arr[])
{
for(int i=0;i<arr.length;i++)
{
o.print(arr[i]+" ");
}
o.println();
}
void pimat(int mat[][])
{
for(int i=0;i<mat.length;i++)
{
for(int j=0;j<mat[0].length;j++)
{
o.print(mat[i][j]);
}
o.println();
}
}
void plmat(long mat[][])
{
for(int i=0;i<mat.length;i++)
{
for(int j=0;j<mat[0].length;j++)
{
o.print(mat[i][j]);
}
o.println();
}
}
//////////////////////////////////// template finished //////////////////////////////////////
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.*;
public class DS {
/*
* Complete the twoStacks function below.
*/
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int x=Integer.parseInt(br.readLine());
if (x==1)
System.out.println(-1);
else
System.out.println(x+" "+x);
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
import java.util.regex.*;
public class DS {
/*
* Complete the twoStacks function below.
*/
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int x=Integer.parseInt(br.readLine());
if (x==1)
System.out.println(-1);
else
System.out.println(x+" "+x);
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import java.io.*;
import java.util.*;
/**
*
* @author luismiguel
*/
public class FirstApp {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
TaskA solve = new TaskA();
solve.solve(1, in, out);
out.close();
}
static class TaskA {
public void solve(int testNumber, InputReader in, PrintWriter out) {
int number = in.nextInt();
if(number > 2 && number % 2 == 0) {
out.println("YES");
} else {
out.println("NO");
}
}
}
static class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream), 32768);
tokenizer = null;
}
public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
import java.io.*;
import java.util.StringTokenizer;
/**
* CodeForces Round 5D. Follow Traffic Rules
* Created by Darren on 14-9-14.
*/
public class Main {
Reader in = new Reader(System.in);
PrintWriter out = new PrintWriter(System.out);
public static void main(String[] args) throws IOException {
new Main().run();
}
int a, v;
int l, d, w;
void run() throws IOException {
a = in.nextInt();
v = in.nextInt();
l = in.nextInt();
d = in.nextInt();
w = in.nextInt();
double totalTime = 0.0;
if (v >= w) {
if (w*w >= 2*a*d) {
double x = Math.sqrt(2*a*d);
totalTime = x / a;
if ((v*v-x*x) >= 2*a*(l-d))
totalTime += (-2*x+Math.sqrt(4*x*x+8*a*(l-d))) / (2*a);
else
totalTime += (v-x)/(1.0*a) + (l-d-(v*v-x*x)/(2.0*a))/v;
} else {
// totalTime = (-2*w+Math.sqrt(4*w*w+8*a*(l-d))) / (2*a);
if (2*v*v-w*w <= 2*a*d) {
totalTime = v / (1.0*a) + (v-w) / (1.0*a) + (d-(2*v*v-w*w)/(2.0*a)) / v;
} else {
double x = Math.sqrt((2*a*d+w*w)/2.0);
totalTime = x / a + (x-w) / a;
}
if ((v*v-w*w) >= 2*a*(l-d))
totalTime += (-2*w+Math.sqrt(4*w*w+8*a*(l-d))) / (2*a);
else
totalTime += (v-w)/(1.0*a) + (l-d-(v*v-w*w)/(2.0*a))/v;
}
} else {
if (v*v >= 2*a*l)
totalTime = Math.sqrt(l*2.0/a);
else
totalTime = v / (1.0*a) + (l-v*v/(2.0*a)) / v;
}
out.printf("%.10f", totalTime);
out.flush();
}
void solve() throws IOException {
}
static class Reader {
BufferedReader reader;
StringTokenizer tokenizer;
public Reader(InputStream input) {
reader = new BufferedReader(new InputStreamReader(input));
tokenizer = new StringTokenizer("");
}
/** get next word */
String nextToken() throws IOException {
while ( ! tokenizer.hasMoreTokens() ) {
//TODO add check for eof if necessary
tokenizer = new StringTokenizer( reader.readLine() );
}
return tokenizer.nextToken();
}
String readLine() throws IOException {
return reader.readLine();
}
char nextChar() throws IOException {
return (char)reader.read();
}
int nextInt() throws IOException {
return Integer.parseInt( nextToken() );
}
long nextLong() throws IOException {
return Long.parseLong( nextToken() );
}
double nextDouble() throws IOException {
return Double.parseDouble( nextToken() );
}
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.IOException;
import java.util.*;
public class Main implements Runnable {
static String readLn(int maxLength) {
byte line[] = new byte[maxLength];
int length = 0;
int input = -1;
try {
while (length < maxLength) {
input = System.in.read();
if ((input < 0) || (input == '\n')) {
break;
}
line[length++] += input;
}
if ((input < 0) && (length == 0)) {
return null;
}
return new String(line, 0, length);
} catch (IOException e) {
return null;
}
}
public static void main(String args[]) {
Main myWork = new Main();
myWork.run();
}
public void run() {
new Watermelon().run();
}
}
class Watermelon implements Runnable {
public void run() {
String line = Main.readLn(100).trim();
int weight = Integer.parseInt(line);
System.out.println(weight % 2 == 0 && weight > 2 ? "YES": "NO");
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.*;
import java.util.*;
import java.lang.String;
public class Solution
{
public static void main(String[] args)
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try
{
String str = br.readLine();
int q = Integer.parseInt(str);
//int q = 7;
//int q = 1345679;
if(q%2 == 0 && q!=2)
System.out.println("YES");
else
System.out.println("NO");
}
catch(IOException e)
{
System.out.println("Input Error");
}
/* String str = "hello";
String str1 = Character.toUpperCase(str.charAt(0))+str.substring(1);
System.out.println(str1);
*/
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.*;
public class n5D
{
public static void main(String[] args)
{
double a = 0, v = 0, l = 0, d = 0, w = 0;
try
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] str = br.readLine().split(" ");
a = Double.parseDouble(str[0]);
v = Double.parseDouble(str[1]);
str = br.readLine().split(" ");
l = Double.parseDouble(str[0]);
d = Double.parseDouble(str[1]);
w = Double.parseDouble(str[2]);
}
catch(Exception e)
{
System.out.println(e);
}
double t1, t2, t3, t4, t5, t, D = 0;
if (w > v) w = v;
t2 = d / v - v / a + w * w / 2 / a / v;
if (t2 >= 0)
{
t1 = v / a;
t3 = t1 - w / a;
}
else
{
if (Math.sqrt(2 * d / a) > (w / a))
{
t1 = Math.sqrt((2 * a * d + w * w) / (a * a * 2));
t3 = t1 - w / a;
}
else
{
t1 = Math.sqrt(2 * d / a);
t3 = 0;
}
t2 = 0;
}
t5 = (l - d - v * v / 2 / a + a * (t1 - t3) * (t1 - t3) / 2) / v;
if (t5 >= 0) t4 = v / a - (t1 - t3);
else
{
t5 = 0;
t4 = -t1 + t3 + Math.sqrt((t1 - t3) * (t1 - t3) + 2 * (l - d) / a);
}
t = t1 + t2 + t3 + t4 + t5;
System.out.println(t);
//System.out.println(t1 + " " + t2 + " " + t3 + " " + t4 + " " + t5);
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner read = new Scanner(System.in);
double a = (double)read.nextInt();
double v = (double)read.nextInt();
double l = (double)read.nextInt();
double d = (double)read.nextInt();
double w = (double)read.nextInt();
double t=0;
if(w>=v){
double d1=v*v/(2*a);
if(d1>l){
t+= Math.sqrt(2*l/a);
}
else{
t+= v/a + (l-d1)/v;
}
}
else{
double temp = (v-w)/a;
double d1 = v*v/(2*a);
double d2 = d - v*temp + a*temp*temp/2;
if(d1>d2){
double temp2 = Math.sqrt(2*a*d);
if(temp2<w){
w=temp2;
temp=(v-w)/a;
t+= temp2/a;
}
else{
double vx=Math.sqrt(v*v/2+a*d2);
t+= (vx/a) + ((vx-w)/a);
}
}
else{
t+= (v/a) + ((d2-d1)/v) + (temp);
}
double d3 = d + w*temp + a*temp*temp/2;
if(d3>l){
t+= (-w+Math.sqrt(w*w+2*a*(l-d)))/a;
}
else{
t+= (temp) + ((l-d3)/v);
}
}
System.out.printf("%.6f", t);
read.close();
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.util.Scanner;
public class Main {
public static void main(String[] args) {
//kai
Scanner kai = new Scanner(System.in);
while (kai.hasNext()) {
int a = kai.nextInt();
if ((a & 1) == 0) {
System.out.println("Mahmoud");
}else {
System.out.println("Ehab");
}
}
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>//Author: Patel Rag
//Java version "1.8.0_211"
import java.util.*;
import java.io.*;
public class Main
{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in)); }
String next()
{
while (st == null || !st.hasMoreElements())
{
try
{
st = new StringTokenizer(br.readLine());
}
catch (IOException e)
{
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() { return Integer.parseInt(next()); }
long nextLong(){ return Long.parseLong(next()); }
double nextDouble(){ return Double.parseDouble(next()); }
float nextFloat() { return Float.parseFloat(next()); }
boolean nextBoolean() { return Boolean.parseBoolean(next()); }
String nextLine()
{
String str = "";
try
{
str = br.readLine();
}
catch (IOException e)
{
e.printStackTrace();
}
return str;
}
}
static long modExp(long x, long n, long mod) //binary Modular exponentiation
{
long result = 1;
while(n > 0)
{
if(n % 2 == 1)
result = (result%mod * x%mod)%mod;
x = (x%mod * x%mod)%mod;
n=n/2;
}
return result;
}
static long gcd(long a, long b)
{
if(a==0) return b;
return gcd(b%a,a);
}
public static void main(String[] args)
throws IOException
{
FastReader fr = new FastReader();
System.out.println((int)(fr.nextInt()/2) + 1);
}
}
class pair
{
public int first;
public int second;
public pair(int first,int second)
{
this.first = first;
this.second = second;
}
public int first() { return first; }
public int second() { return second; }
public void setFirst(int first) { this.first = first; }
public void setSecond(int second) { this.second = second; }
}
class myComp implements Comparator<pair>
{
public int compare(pair a,pair b)
{
return (a.first - b.first);
}
}
class BIT //Binary Indexed Tree aka Fenwick Tree
{
public long[] m_array;
public BIT(long[] dat)
{
m_array = new long[dat.length + 1];
Arrays.fill(m_array,0);
for(int i = 0; i < dat.length; i++)
{
m_array[i + 1] = dat[i];
}
for(int i = 1; i < m_array.length; i++)
{
int j = i + (i & -i);
if(j < m_array.length)
{
m_array[j] = m_array[j] + m_array[i];
}
}
}
public final long prefix_query(int i)
{
long result = 0;
for(++i; i > 0; i = i - (i & -i))
{
result = result + m_array[i];
}
return result;
}
public final long range_query(int fro, int to)
{
if(fro == 0)
{
return prefix_query(to);
}
else
{
return (prefix_query(to) - prefix_query(fro - 1));
}
}
public void update(int i, long add)
{
for(++i; i < m_array.length; i = i + (i & -i))
{
m_array[i] = m_array[i] + add;
}
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;
public class CodeForces
{
public static void main(String[] args)
{
Scanner input = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
System.out.println(input.nextInt() / 2 + 1);
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
import java.util.*;
import java.io.*;
import java.math.*;
public class loser
{
static class InputReader {
public BufferedReader br;
public StringTokenizer token;
public InputReader(InputStream stream)
{
br=new BufferedReader(new InputStreamReader(stream),32768);
token=null;
}
public String next()
{
while(token==null || !token.hasMoreTokens())
{
try
{
token=new StringTokenizer(br.readLine());
}
catch(IOException e)
{
throw new RuntimeException(e);
}
}
return token.nextToken();
}
public int nextInt()
{
return Integer.parseInt(next());
}
public long nextLong()
{
return Long.parseLong(next());
}
}
static class card{
long a;
int i;
public card(long a,int i)
{
this.a=a;
this.i=i;
}
}
static class sort implements Comparator<pair>
{
public int compare(pair o1,pair o2)
{
if(o1.a!=o2.a)
return (int)(o1.a-o2.a);
else
return (int)(o1.b-o2.b);
}
}
static void shuffle(long a[])
{
List<Long> l=new ArrayList<>();
for(int i=0;i<a.length;i++)
l.add(a[i]);
Collections.shuffle(l);
for(int i=0;i<a.length;i++)
a[i]=l.get(i);
}
/*static long gcd(long a,long b)
{
if(b==0)
return a;
else
return gcd(b,a%b);
}*/
/*static boolean valid(int i,int j)
{
if(i<4 && i>=0 && j<4 && j>=0)
return true;
else
return false;
}*/
static class pair{
int a,b;
public pair(int a,int b)
{
this.a=a;
this.b=b;
}
}
public static void main(String[] args)
{
InputReader sc=new InputReader(System.in);
int k=sc.nextInt();
int n=sc.nextInt();
int s=sc.nextInt();
int p=sc.nextInt();
long d=(long)Math.ceil((double)n/s);
if(d==0)
d=1;
d=k*d;
long ans=(long)Math.ceil((double)d/p);
System.out.println(ans);
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.util.*;
import static java.lang.Math.*;
import java.io.*;
public class SolutionB {
public static void main(String args[])throws IOException{
Scanner sc = new Scanner(System.in);
long a[] = new long[14];
for(int i = 0; i < 14; i++)
a[i] = sc.nextLong();
long cpy[] = new long[14];
long max = 0;
for(int i = 0; i < 14; i++){
if(a[i] == 0)continue;
long score = 0;
long curr = a[i];
for(int j = 0; j < 14; j++)
cpy[j] = a[j];
cpy[i] = 0;
long amnt = curr / 14l;
for(int j = 0; j < 14; j++){
cpy[j] += amnt;
}
amnt = curr % 14;
for(int j = i + 1; j < i + 1 + amnt; j++){
cpy[j % 14]++;
}
for(int j = 0; j < 14; j++){
if(cpy[j] % 2 == 0)
score += cpy[j];
}
max = Math.max(max, score);
}
System.out.println(max);
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Sid
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
OutputWriter out = new OutputWriter(outputStream);
A979 solver = new A979();
solver.solve(1, in, out);
out.close();
}
static class A979 {
public void solve(int testNumber, InputReader in, OutputWriter out) {
long n = in.nextLong();
n = n + 1;
if (n % 2 == 0) {
out.println(n / 2);
} else {
if (n != 1) {
out.println(n);
} else {
out.println(0);
}
}
}
}
static class OutputWriter {
private final PrintWriter writer;
public OutputWriter(OutputStream outputStream) {
writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
}
public OutputWriter(Writer writer) {
this.writer = new PrintWriter(writer);
}
public void close() {
writer.close();
}
public void println(long i) {
writer.println(i);
}
public void println(int i) {
writer.println(i);
}
}
static class InputReader {
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
private InputReader.SpaceCharFilter filter;
public InputReader(InputStream stream) {
this.stream = stream;
}
public int read() {
if (numChars == -1) {
throw new InputMismatchException();
}
if (curChar >= numChars) {
curChar = 0;
try {
numChars = stream.read(buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (numChars <= 0) {
return -1;
}
}
return buf[curChar++];
}
public long nextLong() {
int c = read();
while (isSpaceChar(c)) {
c = read();
}
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
long res = 0;
do {
if (c < '0' || c > '9') {
throw new InputMismatchException();
}
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
public boolean isSpaceChar(int c) {
if (filter != null) {
return filter.isSpaceChar(c);
}
return isWhitespace(c);
}
public static boolean isWhitespace(int c) {
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
public interface SpaceCharFilter {
public boolean isSpaceChar(int ch);
}
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.util.*;
public class A
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
long n=sc.nextLong();
if(n==0)
System.out.println(0);
else if(n%2==1)
System.out.println((n+1)/2);
else
System.out.println(n+1);
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
import static java.lang.Math.*;
public class Main implements Runnable {
static class InputReader {
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
private SpaceCharFilter filter;
private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
public InputReader(InputStream stream) {
this.stream = stream;
}
public int read() {
if (numChars==-1)
throw new InputMismatchException();
if (curChar >= numChars) {
curChar = 0;
try {
numChars = stream.read(buf);
}
catch (IOException e) {
throw new InputMismatchException();
}
if(numChars <= 0)
return -1;
}
return buf[curChar++];
}
public String nextLine() {
String str = "";
try {
str = br.readLine();
}
catch (IOException e) {
e.printStackTrace();
}
return str;
}
public int nextInt() {
int c = read();
while(isSpaceChar(c))
c = read();
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
int res = 0;
do {
if(c<'0'||c>'9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = read();
}
while (!isSpaceChar(c));
return res * sgn;
}
public long nextLong() {
int c = read();
while (isSpaceChar(c))
c = read();
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
long res = 0;
do {
if (c < '0' || c > '9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = read();
}
while (!isSpaceChar(c));
return res * sgn;
}
public double nextDouble() {
int c = read();
while (isSpaceChar(c))
c = read();
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
double res = 0;
while (!isSpaceChar(c) && c != '.') {
if (c == 'e' || c == 'E')
return res * Math.pow(10, nextInt());
if (c < '0' || c > '9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = read();
}
if (c == '.') {
c = read();
double m = 1;
while (!isSpaceChar(c)) {
if (c == 'e' || c == 'E')
return res * Math.pow(10, nextInt());
if (c < '0' || c > '9')
throw new InputMismatchException();
m /= 10;
res += (c - '0') * m;
c = read();
}
}
return res * sgn;
}
public String readString() {
int c = read();
while (isSpaceChar(c))
c = read();
StringBuilder res = new StringBuilder();
do {
res.appendCodePoint(c);
c = read();
}
while (!isSpaceChar(c));
return res.toString();
}
public boolean isSpaceChar(int c) {
if (filter != null)
return filter.isSpaceChar(c);
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
public String next() {
return readString();
}
public interface SpaceCharFilter {
public boolean isSpaceChar(int ch);
}
}
public static void main(String args[]) throws Exception {
new Thread(null, new Main(),"Main",1<<26).start();
}
static void merge(int arr[], int l, int m, int r) {
int n1 = m - l + 1;
int n2 = r - m;
int L[] = new int [n1];
int R[] = new int [n2];
for (int i=0; i<n1; ++i)
L[i] = arr[l + i];
for (int j=0; j<n2; ++j)
R[j] = arr[m + 1+ j];
int i = 0, j = 0;
int k = l;
while (i < n1 && j < n2){
if (L[i] <= R[j]){
arr[k] = L[i];
i++;
}
else{
arr[k] = R[j];
j++;
}
k++;
}
while (i < n1){
arr[k] = L[i];
i++;
k++;
}
while (j < n2)
{
arr[k] = R[j];
j++;
k++;
}
}
static void sort(int arr[], int l, int r) {
if (l < r)
{
int m = (l+r)/2;
sort(arr, l, m);
sort(arr , m+1, r);
merge(arr, l, m, r);
}
}
static void merge(long arr[], int l, int m, int r) {
int n1 = m - l + 1;
int n2 = r - m;
long L[] = new long [n1];
long R[] = new long [n2];
for (int i=0; i<n1; ++i)
L[i] = arr[l + i];
for (int j=0; j<n2; ++j)
R[j] = arr[m + 1+ j];
int i = 0, j = 0;
int k = l;
while (i < n1 && j < n2){
if (L[i] <= R[j]){
arr[k] = L[i];
i++;
}
else{
arr[k] = R[j];
j++;
}
k++;
}
while (i < n1){
arr[k] = L[i];
i++;
k++;
}
while (j < n2)
{
arr[k] = R[j];
j++;
k++;
}
}
static void sort(long arr[], int l, int r) {
if (l < r)
{
int m = (l+r)/2;
sort(arr, l, m);
sort(arr , m+1, r);
merge(arr, l, m, r);
}
}
static int gcd(int a, int b){
if (b == 0)
return a;
return gcd(b, a % b);
}
static long gcd(long a, long b){
if (b == 0)
return a;
return gcd(b, a % b);
}
public long m=(long)1e9+7;;
public void run() {
InputReader in = new InputReader(System.in);
PrintWriter out = new PrintWriter(System.out);
int a=in.nextInt(),b=in.nextInt(),c=in.nextInt(),n=in.nextInt();
int nnew=a+b-c;
if((n>nnew) && (a>=c) && (b>=c))
out.println(n-nnew);
else
out.println(-1);
out.close();
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.util.Scanner;
public class IfAtFIrstYouDIdnt {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input = new Scanner(System.in);
int a = input.nextInt();
int b = input.nextInt();
int c = input.nextInt();
int n = input.nextInt();
if(a<n && b<n && c < n && (a+b-c)<n && c<=a && c<=b){
System.out.println((n)-(a+b-c));
}
else
System.out.println("-1");
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class cf2 {
static final double EPS = 1e-9;
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
//rec
int xr1=sc.nextInt(), yr1=sc.nextInt(), xr2=sc.nextInt(),yr2=sc.nextInt();
int xr3=sc.nextInt(), yr3=sc.nextInt(), xr4=sc.nextInt(),yr4=sc.nextInt();
Point pr1 = new Point(xr1, yr1);
Point pr2 = new Point(xr2, yr2);
Point pr3 = new Point(xr3, yr3);
Point pr4 = new Point(xr4, yr4);
LineSegment lr1 = new LineSegment(pr1, pr2);
LineSegment lr2 = new LineSegment(pr2, pr3);
LineSegment lr3 = new LineSegment(pr3, pr4);
LineSegment lr4 = new LineSegment(pr4, pr1);
//diamond
int xd1=sc.nextInt(), yd1=sc.nextInt(), xd2=sc.nextInt(),yd2=sc.nextInt();
int xd3=sc.nextInt(), yd3=sc.nextInt(), xd4=sc.nextInt(),yd4=sc.nextInt();
Point p1 = new Point(xd1, yd1);
Point p2 = new Point(xd2, yd2);
Point p3 = new Point(xd3, yd3);
Point p4 = new Point(xd4, yd4);
Point [] pt = new Point [5];
pt[0]=p1; pt[1]=p2; pt[2]=p3; pt[3]=p4; pt[4]=p1;
Polygon pg = new Polygon(pt);
if(pg.inside(pr1)||pg.inside(pr2)||pg.inside(pr3)||pg.inside(pr4)) {
System.out.println("YES");
return;
}
LineSegment ld1 = new LineSegment(p1, p2);
LineSegment ld2 = new LineSegment(p2, p3);
LineSegment ld3 = new LineSegment(p3, p4);
LineSegment ld4 = new LineSegment(p4, p1);
Rectangle rec = new Rectangle(new Point(Math.min(Math.min(xr3,xr4),Math.min(xr1,xr2)), Math.min(Math.min(yr3,yr4),Math.min(yr1,yr2))),
new Point(Math.max(Math.max(xr3,xr4),Math.max(xr1,xr2)), Math.max(Math.max(yr3,yr4),Math.max(yr1,yr2))) );
if(rec.contains(p1)||rec.contains(p2)||rec.contains(p3)||rec.contains(p4)) {
System.out.println("YES");
return;
}
if(ld1.intersect(lr1)||ld1.intersect(lr3)||ld1.intersect(lr3)||ld1.intersect(lr4)) {
System.out.println("YES");
return;
}
if(ld2.intersect(lr1)||ld2.intersect(lr3)||ld2.intersect(lr3)||ld2.intersect(lr4)) {
System.out.println("YES");
return;
}
if(ld3.intersect(lr1)||ld3.intersect(lr3)||ld3.intersect(lr3)||ld3.intersect(lr4)) {
System.out.println("YES");
return;
}
if(ld4.intersect(lr1)||ld4.intersect(lr3)||ld4.intersect(lr3)||ld4.intersect(lr4)) {
System.out.println("YES");
return;
}
System.out.println("NO");
}
public static class Polygon {
// Cases to handle: collinear points, polygons with n < 3
static final double EPS = 1e-9;
Point[] g; //first point = last point, counter-clockwise representation
Polygon(Point[] o) { g = o; }
double perimeter()
{
double sum = 0.0;
for(int i = 0; i < g.length - 1; ++i)
sum += g[i].dist(g[i+1]);
return sum;
}
double area() //clockwise/anti-clockwise check, for convex/concave polygons
{
double area = 0.0;
for(int i = 0; i < g.length - 1; ++i)
area += g[i].x * g[i+1].y - g[i].y * g[i+1].x;
return Math.abs(area) / 2.0; //negative value in case of clockwise
}
boolean inside(Point p) //for convex/concave polygons - winding number algorithm
{
double sum = 0.0;
for(int i = 0; i < g.length - 1; ++i)
{
double angle = Point.angle(g[i], p, g[i+1]);
if((Math.abs(angle) < EPS || Math.abs(angle - Math.PI) < EPS) && p.between(g[i], g[i+1]))
return true;
if(Point.ccw(p, g[i], g[i+1]))
sum += angle;
else
sum -= angle;
}
return Math.abs(2 * Math.PI - Math.abs(sum)) < EPS; //abs makes it work for clockwise
}
/*
* Another way if the polygon is convex
* 1. Triangulate the poylgon through p
* 2. Check if sum areas == poygon area
* 3. Handle empty polygon
*/
Point centroid() //center of mass
{
double cx = 0.0, cy = 0.0;
for(int i = 0; i < g.length - 1; i++)
{
double x1 = g[i].x, y1 = g[i].y;
double x2 = g[i+1].x, y2 = g[i+1].y;
double f = x1 * y2 - x2 * y1;
cx += (x1 + x2) * f;
cy += (y1 + y2) * f;
}
double area = area(); //remove abs
cx /= 6.0 * area;
cy /= 6.0 * area;
return new Point(cx, cy);
}
}
static class LineSegment {
Point p, q;
LineSegment(Point a, Point b) { p = a; q = b; }
boolean intersect(LineSegment ls)
{
Line l1 = new Line(p, q), l2 = new Line(ls.p, ls.q);
if(l1.parallel(l2))
{
if(l1.same(l2))
return p.between(ls.p, ls.q) || q.between(ls.p, ls.q) || ls.p.between(p, q) || ls.q.between(p, q);
return false;
}
Point c = l1.intersect(l2);
return c.between(p, q) && c.between(ls.p, ls.q);
}
}
static class Rectangle {
static final double EPS = 1e-9;
Point ll, ur;
Rectangle(Point a, Point b) { ll = a; ur = b; }
double area() { return (ur.x - ll.x) * (ur.y - ll.y); }
boolean contains(Point p)
{
return p.x <= ur.x + EPS && p.x + EPS >= ll.x && p.y <= ur.y + EPS && p.y + EPS >= ll.y;
}
Rectangle intersect(Rectangle r)
{
Point ll = new Point(Math.max(this.ll.x, r.ll.x), Math.max(this.ll.y, r.ll.y));
Point ur = new Point(Math.min(this.ur.x, r.ur.x), Math.min(this.ur.y, r.ur.y));
if(Math.abs(ur.x - ll.x) > EPS && Math.abs(ur.y - ll.y) > EPS && this.contains(ll) && this.contains(ur) && r.contains(ll) && r.contains(ur))
return new Rectangle(ll, ur);
return null;
}
}
static class Line {
static final double INF = 1e9, EPS = 1e-9;
double a, b, c;
Line(Point p, Point q)
{
if(Math.abs(p.x - q.x) < EPS) { a = 1; b = 0; c = -p.x; }
else
{
a = (p.y - q.y) / (q.x - p.x);
b = 1.0;
c = -(a * p.x + p.y);
}
}
Line(Point p, double m) { a = -m; b = 1; c = -(a * p.x + p.y); }
boolean parallel(Line l) { return Math.abs(a - l.a) < EPS && Math.abs(b - l.b) < EPS; }
boolean same(Line l) { return parallel(l) && Math.abs(c - l.c) < EPS; }
Point intersect(Line l)
{
if(parallel(l))
return null;
double x = (b * l.c - c * l.b) / (a * l.b - b * l.a);
double y;
if(Math.abs(b) < EPS)
y = -l.a * x - l.c;
else
y = -a * x - c;
return new Point(x, y);
}
Point closestPoint(Point p)
{
if(Math.abs(b) < EPS) return new Point(-c, p.y);
if(Math.abs(a) < EPS) return new Point(p.x, -c);
return intersect(new Line(p, 1 / a));
}
}
public static class Vector {
double x, y;
Vector(double a, double b) { x = a; y = b; }
Vector(Point a, Point b) { this(b.x - a.x, b.y - a.y); }
Vector scale(double s) { return new Vector(x * s, y * s); } //s is a non-negative value
double dot(Vector v) { return (x * v.x + y * v.y); }
double cross(Vector v) { return x * v.y - y * v.x; }
double norm2() { return x * x + y * y; }
Vector reverse() { return new Vector(-x, -y); }
Vector normalize()
{
double d = Math.sqrt(norm2());
return scale(1 / d);
}
}
static class Point implements Comparable<Point>{
static final double EPS = 1e-9;
double x, y;
Point(double a, double b) { x = a; y = b; }
public int compareTo(Point p)
{
if(Math.abs(x - p.x) > EPS) return x > p.x ? 1 : -1;
if(Math.abs(y - p.y) > EPS) return y > p.y ? 1 : -1;
return 0;
}
static double angle(Point a, Point o, Point b) // angle AOB
{
Vector oa = new Vector(o, a), ob = new Vector(o, b);
return Math.acos(oa.dot(ob) / Math.sqrt(oa.norm2() * ob.norm2()));
}
static boolean ccw(Point p, Point q, Point r)
{
return new Vector(p, q).cross(new Vector(p, r)) > 0;
}
public double dist(Point p) { return Math.sqrt(sq(x - p.x) + sq(y - p.y)); }
static double sq(double x) { return x * x; }
Point rotate(double angle)
{
double c = Math.cos(angle), s = Math.sin(angle);
return new Point(x * c - y * s, x * s + y * c);
}
// for integer points and rotation by 90 (counterclockwise) : swap x and y, negate x
boolean between(Point p, Point q)
{
return x < Math.max(p.x, q.x) + EPS && x + EPS > Math.min(p.x, q.x)
&& y < Math.max(p.y, q.y) + EPS && y + EPS > Math.min(p.y, q.y);
}
//returns true if it is on the line defined by a and b
//returns true if it is on the ray whose start point is a and passes through b
// Another way: find closest point and calculate the distance between it and p
}
static class Scanner {
StringTokenizer st;
BufferedReader br;
public Scanner(InputStream s) {
br = new BufferedReader(new InputStreamReader(s));
}
public String next() throws IOException {
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return st.nextToken();
}
public Scanner(String file) throws FileNotFoundException {
br = new BufferedReader(new FileReader(file));
}
public int nextInt() throws IOException {
return Integer.parseInt(next());
}
public long nextLong() throws IOException {
return Long.parseLong(next());
}
public String nextLine() throws IOException {
return br.readLine();
}
public long nextlong() throws IOException {
String x = next();
StringBuilder sb = new StringBuilder("0");
long res = 0, f = 1;
boolean dec = false, neg = false;
int start = 0;
if (x.charAt(0) == '-') {
neg = true;
start++;
}
for (int i = start; i < x.length(); i++)
if (x.charAt(i) == '.') {
res = Long.parseLong(sb.toString());
sb = new StringBuilder("0");
dec = true;
} else {
sb.append(x.charAt(i));
if (dec)
f *= 10;
}
res += Long.parseLong(sb.toString()) / f;
return res * (neg ? -1 : 1);
}
public boolean ready() throws IOException {
return br.ready();
}
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.awt.Point;
import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class C {
static StringBuilder st = new StringBuilder();
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
Point [] square = new Point [4] ;
Point [] rotSquare = new Point[4] ;
for(int i = 0 ; i < 4 ;i++)
square[i] = new Point(sc.nextInt() , sc.nextInt());
for(int i = 0 ; i < 4 ;i++)
rotSquare[i] = new Point(sc.nextInt() , sc.nextInt());
boolean can = false ;
for(int x = -100 ; x <= 100 ; x++)
for(int y = -100 ; y <= 100 ; y++)
can |= inside(new Point(x , y), square) & inside(new Point (x , y), rotSquare);
out.println(can ? "YES" : "NO");
out.flush();
out.close();
}
static int crossProduct(Point a , Point b)
{
int ans = a.x * b.y - a.y * b.x ;
if(ans < 0)return -1 ;
if(ans == 0) return 0 ;
return 1 ;
}
static boolean inside(Point a , Point [] points)
{
boolean allPos = true ;
boolean allNeg = true ;
for(int i = 0 ; i < 4 ; i++)
{
Point v1 = new Point (points[i].x - a.x , points[i].y - a.y) ;
Point v2 = new Point (points[(i + 1) % 4].x - a.x , points[(i + 1) % 4].y - a.y) ;
allPos &= crossProduct(v1, v2) >= 0;
allNeg &= crossProduct(v1, v2) <= 0;
}
return allPos | allNeg ;
}
static class Scanner {
BufferedReader br;
StringTokenizer st;
Scanner(InputStream in) {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() throws Exception {
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return st.nextToken();
}
int nextInt() throws Exception {
return Integer.parseInt(next());
}
long nextLong() throws Exception {
return Long.parseLong(next());
}
double nextDouble() throws Exception {
return Double.parseDouble(next());
}
}
static void shuffle(int[] a) {
int n = a.length;
for (int i = 0; i < n; i++) {
int r = i + (int) (Math.random() * (n - i));
int tmp = a[i];
a[i] = a[r];
a[r] = tmp;
}
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class e {
public static class FastReader {
BufferedReader br;
StringTokenizer st;
//it reads the data about the specified point and divide the data about it ,it is quite fast
//than using direct
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreTokens()) {
try {
st = new StringTokenizer(br.readLine());
} catch (Exception r) {
r.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());//converts string to integer
}
double nextDouble() {
return Double.parseDouble(next());
}
long nextLong() {
return Long.parseLong(next());
}
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (Exception r) {
r.printStackTrace();
}
return str;
}
}
static ArrayList<String>list1=new ArrayList<String>();
static void combine(String instr, StringBuffer outstr, int index,int k)
{
if(outstr.length()==k)
{
list1.add(outstr.toString());return;
}
if(outstr.toString().length()==0)
outstr.append(instr.charAt(index));
for (int i = 0; i < instr.length(); i++)
{
outstr.append(instr.charAt(i));
combine(instr, outstr, i + 1,k);
outstr.deleteCharAt(outstr.length() - 1);
}
index++;
}
static ArrayList<ArrayList<Integer>>l=new ArrayList<>();
static void comb(int n,int k,int ind,ArrayList<Integer>list)
{
if(k==0)
{
l.add(new ArrayList<>(list));
return;
}
for(int i=ind;i<=n;i++)
{
list.add(i);
comb(n,k-1,ind+1,list);
list.remove(list.size()-1);
}
}
public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
public static void main(String[] args) {
// TODO Auto-generated method stub
FastReader in=new FastReader();
HashMap<Integer,Integer>map=new HashMap<Integer,Integer>();
int n=in.nextInt();
int r=in.nextInt();
double theta=(double)360/(double)n;
double b=1-((double)2/(double)(1-Math.cos((double)2*Math.PI/(double)n)));
double x=Math.sqrt(1-b)-1;
double ans=(double)r/(double)x;
System.out.println(ans);
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class e {
public static class FastReader {
BufferedReader br;
StringTokenizer st;
//it reads the data about the specified point and divide the data about it ,it is quite fast
//than using direct
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreTokens()) {
try {
st = new StringTokenizer(br.readLine());
} catch (Exception r) {
r.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());//converts string to integer
}
double nextDouble() {
return Double.parseDouble(next());
}
long nextLong() {
return Long.parseLong(next());
}
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (Exception r) {
r.printStackTrace();
}
return str;
}
}
static ArrayList<String>list1=new ArrayList<String>();
static void combine(String instr, StringBuffer outstr, int index,int k)
{
if(outstr.length()==k)
{
list1.add(outstr.toString());return;
}
if(outstr.toString().length()==0)
outstr.append(instr.charAt(index));
for (int i = 0; i < instr.length(); i++)
{
outstr.append(instr.charAt(i));
combine(instr, outstr, i + 1,k);
outstr.deleteCharAt(outstr.length() - 1);
}
index++;
}
static ArrayList<ArrayList<Integer>>l=new ArrayList<>();
static void comb(int n,int k,int ind,ArrayList<Integer>list)
{
if(k==0)
{
l.add(new ArrayList<>(list));
return;
}
for(int i=ind;i<=n;i++)
{
list.add(i);
comb(n,k-1,ind+1,list);
list.remove(list.size()-1);
}
}
public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
public static void main(String[] args) {
// TODO Auto-generated method stub
FastReader in=new FastReader();
HashMap<Integer,Integer>map=new HashMap<Integer,Integer>();
int n=in.nextInt();
int r=in.nextInt();
double theta=(double)360/(double)n;
double b=1-((double)2/(double)(1-Math.cos((double)2*Math.PI/(double)n)));
double x=Math.sqrt(1-b)-1;
double ans=(double)r/(double)x;
System.out.println(ans);
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.*;
import java.util.*;
public class C_NNAndTheOpticalIllusion {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader inp = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
Solver solver = new Solver();
solver.solve(inp, out);
out.close();
}
private static class Solver {
private void solve(InputReader inp, PrintWriter out) {
double n = inp.nextInt(), r = inp.nextInt();
double x = Math.cos((n - 2) * Math.PI / (2 * n));
out.print((r * x) / (1 - x));
}
}
static class InputReader {
BufferedReader reader;
StringTokenizer tokenizer;
InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream), 32768);
tokenizer = null;
}
String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
public long nextLong() {
return Long.parseLong(next());
}
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
public class HelloWorld {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
Palindrome solver = new Palindrome();
solver.solve(1, in, out);
out.close();
}
static class Palindrome {
public void solve(int testNumber, InputReader in, PrintWriter out) {
long l = in.nextLong();
if(l%4 == 0 || l%4 == 3)
{
out.print("0");
}
else
{
out.print("1");
}
}
}
static class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream), 32768);
tokenizer = null;
}
public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public long nextLong(){
return Long.parseLong(next());
}
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.*;
import java.util.*;
import java.lang.*;
import java.math.BigInteger;
public class Main {
private static final FS scanner = new FS(System.in);
//private static final Scanner scanner = new Scanner(System.in);
public static void main(String[] args) throws Exception {
int n = scanner.nextInt();
int sumA = 0;
int sumB = 0;
int rem = n % 4;
for (int i = rem; i >= 1 ; i--) {
if (sumB <= sumA) {
sumB += i;
}
else {
sumA +=i;
}
}
System.out.println(Math.abs(sumA - sumB));
}
static class FS {
BufferedReader br;
StringTokenizer st;
public FS(InputStream i) {
br = new BufferedReader(new InputStreamReader(i));
st = new StringTokenizer("");
}
public String next() throws IOException {
if(st.hasMoreTokens())
return st.nextToken();
else
st = new StringTokenizer(br.readLine());
return next();
}
public int nextInt() throws IOException {
return Integer.parseInt(next());
}
public long nextLong() throws IOException {
return Long.parseLong(next());
}
public double nextDouble() throws IOException {
return Double.parseDouble(next());
}
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
public class usd {
static int r=0;static int c=0;
static void fillzero(int a[][],int n)
{
for(int i=0;i<n;i++)
{
for(int j=0;j<n-1;j++)
{
if(a[j][i]==0&&a[j+1][i]==0)
{
a[j][i]=1;a[j+1][i]=1;
r=j;c=i;
return;
}
}
}
}
static void fillone(int a[][],int n)
{
for(int i=0;i<n;i++)
{
for(int j=0;j<n-1;j++)
{
if(a[i][j]==0&&a[i][j+1]==0)
{
a[i][j]=1;a[i][j+1]=1;
r=i;c=j;
return;
}
}
}
}
static void check(int a[][],int n)
{
for(int i=0;i<4;i++)
{
if(a[i][0]==1&&a[i][1]==1&&a[i][2]==1&&a[i][3]==1)
{
a[i][0]=0;a[i][1]=0;a[i][2]=0;a[i][3]=0;
}
}
for(int i=0;i<4;i++)
{
if(a[0][i]==1&&a[1][i]==1&&a[2][i]==1&&a[3][i]==1)
{
a[0][i]=0;a[1][i]=0;a[2][i]=0;a[3][i]=0;;
}
}
}
public static void main(String[] args) throws NumberFormatException, IOException {
Scanner in=new Scanner (System.in);
HashMap<String,Integer>map=new HashMap<String,Integer>();
ArrayList<Integer>list=new ArrayList<Integer>();
long n=in.nextLong();
long ans=Long.MAX_VALUE;
long sum=0;long sum2=(n*(n+1))/2;
if(sum2%2==0)
System.out.println(0);
else
System.out.println(1);
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.util.Scanner;
public class SashaAndHisTrip {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int N = in.nextInt();
int v = in.nextInt();
if (v > N) {
System.out.println(N-1);
}
else {
int price = v + ((N-v-1) * (2+ N - v))/2;
int counter = 0;
System.out.println(price);
}
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.util.*;
import java.io.*;
public class Main {
public static void main(String args[]) {
FastReader fr = new FastReader();
PrintWriter out = new PrintWriter(System.out);
int n = fr.nextInt(), v = fr.nextInt();
if (v >= n)
out.println(n - 1);
else
out.println((n - v) * (n - v + 1) / 2 + v - 1);
out.flush();
}
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
int[] nextIntArray(int n) {
int a[] = new int[n];
for (int i = 0; i < n; i++) {
a[i] = nextInt();
}
return a;
}
int[] memset(int n, int val) {
int ar[] = new int[n];
Arrays.fill(ar, val);
return ar;
}
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|> import java.util.Scanner;
public class Sasha1113A {
static int solution(int n, int v){
int count;
if(v>=n)
return n-1;
else{
count = (v-1) + ((n-v)*(n-v+1))/2;
}
return count;
}
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int v = scan.nextInt();
System.out.print(solution(n, v));
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
int n = sc.nextInt();
if (n % 2 != 0) {
System.out.println("Ehab");
} else {
System.out.println("Mahmoud");
}
}
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
while(sc.hasNext()) {
int n=sc.nextInt();
if(n%2==0) {
System.out.println("Mahmoud");
}else {
System.out.println("Ehab");
}
}
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
import java.io.PrintWriter;
import java.util.*;
import java.util.Arrays ;
import java .lang.String.* ;
import java .lang.StringBuilder ;
public class Test{
static int pos = 0 ;
static int arr[] ;
static LinkedList l1 = new LinkedList() ;
static void find(int p ,char[]x,int put[],String s){
int c= 0 ;
for (int i = 0; i < s.length(); i++) {
if(x[p]==s.charAt(i)){
c++ ; }
}
put[p] = c ;
}
static int mode(int m ,int[]x ){
int temp = 0 ;
for (int i = x.length-1; i >=0; i--) {
if(x[i]<=m){
temp= x[i] ;
/// break ;
return m-temp ;
}
}
return m-temp ;
}
static int mode2(int m ,int[]x ){
int temp = 0 ;
for (int i = x.length-1; i >=0; i--) {
if(x[i]<=m){
temp= x[i] ;
/// break ;
return x[i] ;
}
}
return 0 ;
}
static int find(int x[],int temp){
int j = 0 ;
for (int i = x.length-1; i >=0; i--) {
if(x[i]==temp) return j+1 ;
j++ ;
}
return -1 ;
}
static String ch(long[]x,long b){
for (int i = 0; i < x.length; i++) {
if(x[i]==b)return "YES" ;
}
return "NO" ;
}
public static void main(String[] args) {
Scanner in = new Scanner(System.in) ;
PrintWriter pw = new PrintWriter(System.out);
long n = in.nextLong() ;
long count =1 ;
long temp =n/2;
temp+=count ;
System.out.println(temp);
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.util.*;
import java.io.*;
public class programA {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
if(n%2 == 0)System.out.println(n/2 +1);
else System.out.println((int)Math.ceil((double)n/2));
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;
public class CodeForces
{
public static void main(String[] args)
{
Scanner input = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
int k = input.nextInt();
int n = input.nextInt();
int s = input.nextInt();
int p = input.nextInt();
int each = n / s;
if (n % s != 0)
{
each++;
}
int all = each * k;
if (all % p == 0)
{
System.out.println(all / p);
} else
{
System.out.println(all / p + 1);
}
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
import java.io.PrintWriter;
import java.util.*;
import java.util.Arrays ;
import java .lang.String.* ;
import java .lang.StringBuilder ;
public class Test{
static int pos = 0 ;
static int arr[] ;
static LinkedList l1 = new LinkedList() ;
static void find(int p ,char[]x,int put[],String s){
int c= 0 ;
for (int i = 0; i < s.length(); i++) {
if(x[p]==s.charAt(i)){
c++ ; }
}
put[p] = c ;
}
static int mode(int m ,int[]x ){
int temp = 0 ;
for (int i = x.length-1; i >=0; i--) {
if(x[i]<=m){
temp= x[i] ;
/// break ;
return m-temp ;
}
}
return m-temp ;
}
static int mode2(int m ,int[]x ){
int temp = 0 ;
for (int i = x.length-1; i >=0; i--) {
if(x[i]<=m){
temp= x[i] ;
/// break ;
return x[i] ;
}
}
return 0 ;
}
static int find(int x[],int temp){
int j = 0 ;
for (int i = x.length-1; i >=0; i--) {
if(x[i]==temp) return j+1 ;
j++ ;
}
return -1 ;
}
static String ch(long[]x,long b){
for (int i = 0; i < x.length; i++) {
if(x[i]==b)return "YES" ;
}
return "NO" ;
}
public static void main(String[] args) {
Scanner in = new Scanner(System.in) ;
PrintWriter pw = new PrintWriter(System.out);
int k=in.nextInt(), n=in.nextInt(), s=in.nextInt(), p=in.nextInt() ;
int paper =n/s;
if(n%s!=0) paper++ ;
paper*=k ;
int fin = paper/p ;
if(paper%p!=0) fin++ ;
System.out.println( fin );
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|> import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
import javax.print.attribute.standard.QueuedJobCount;
public class A {
static int n;
static TreeSet<Integer> Primes;
static int[] arr;
static int[] arr2;
public static int[] copyOf(int[] arr) {
for (int i = 0; i < arr.length; i++)
arr2[i] += arr[i];
return arr2;
}
public static long addEvens(int[] arr) {
long r = 0;
for (int i = 0; i < arr.length; i++)
if (arr[i] % 2 == 0)
r += arr[i];
return r;
}
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
PrintWriter pw = new PrintWriter(System.out);
arr = new int[14];
for (int i = 0; i < 14; i++) {
arr[i] = sc.nextInt();
}
int x = 5535;
int y = x;
int s;
long max = Integer.MIN_VALUE;
for (int i = 0; i < 14; i++) {
int a = arr[i];
arr2 = new int[14];
arr2 = copyOf(arr);
arr2[i]=0;
int j =0;
int rem = arr[i] / 14;
int steps = 0;
int c = 0;
for ( j = i+1;c<14; j++) {
if (j >=14 )
j = 0;
arr2[c] += rem;
c++;
}
steps = arr[i] % 14;
j = i;
c=0;
int adasd;
for ( j = i+1;c<steps; j++) {
if (j >= 14)
j = 0;
arr2[j] += 1;
c++;
}
max = Math.max(max, addEvens(arr2));
}
pw.print(max);
pw.flush();
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.util.HashSet;
import java.util.StringTokenizer;
public class Main {
public static String conv(String str) {
boolean[] Arr = new boolean[26];
for (int i = 0; i < str.length(); i++) {
Arr[str.charAt(i) - 'a'] = true;
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 26; i++) {
if (Arr[i])
sb.append((char) (i + 'a'));
}
return "" + sb;
}
public static void main(String[] args) throws IOException, InterruptedException {
PrintWriter pw = new PrintWriter(System.out);
Scanner sc = new Scanner(System.in);
HashSet<String> hs = new HashSet<String>();
int[] Arr = new int[14];
long max = 0;
for (int i = 0; i < 14; i++) {
Arr[i] = sc.nextInt();
}
for (int i = 0; i < 14; i++) {
int[] arr = Arr.clone();
long sum = 0;
int r = arr[i];
arr[i] = 0;
for (int j = i + 1; j < arr.length && r > 0; j++) {
arr[j]++;
r--;
}
for (int j = 0; j < arr.length; j++) {
arr[j] +=( r / 14);
if (j + 1 <= (r % 14)) {
arr[j]++;
}
if (arr[j] % 2 == 0) {
sum += arr[j];
}
}
max = Math.max(max, sum);
}
System.out.println(max);
}
static class Scanner {
StringTokenizer st;
BufferedReader br;
public Scanner(InputStream s) {
br = new BufferedReader(new InputStreamReader(s));
}
public String next() throws IOException {
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return st.nextToken();
}
public int nextInt() throws IOException {
return Integer.parseInt(next());
}
public long nextLong() throws IOException {
return Long.parseLong(next());
}
public String nextLine() throws IOException {
return br.readLine();
}
public double nextDouble() throws IOException {
String x = next();
StringBuilder sb = new StringBuilder("0");
double res = 0, f = 1;
boolean dec = false, neg = false;
int start = 0;
if (x.charAt(0) == '-') {
neg = true;
start++;
}
for (int i = start; i < x.length(); i++)
if (x.charAt(i) == '.') {
res = Long.parseLong(sb.toString());
sb = new StringBuilder("0");
dec = true;
} else {
sb.append(x.charAt(i));
if (dec)
f *= 10;
}
res += Long.parseLong(sb.toString()) / f;
return res * (neg ? -1 : 1);
}
public boolean ready() throws IOException {
return br.ready();
}
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.util.*;
public class helloWorld
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
long n = in.nextLong();
long ans = n+1;
if(ans == 1)
ans = 0;
if(ans % 2 == 0)
ans /= 2;
System.out.println(ans);
in.close();
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.util.*;
public class Pizza {
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
long num = sc.nextLong() + 1;
sc.close();
System.out.println(num % 2 == 0 || num == 1 ? num / 2 : num);
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.util.*;
import java.io.*;
public class A
{
public static void main(String ar[]) throws Exception
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String s1[]=br.readLine().split(" ");
int a=Integer.parseInt(s1[0]);
int b=Integer.parseInt(s1[1]);
int c=Integer.parseInt(s1[2]);
int n=Integer.parseInt(s1[3]);
int S=a+b-c;
if(n-S<1 || c>Math.min(a,b))
System.out.println("-1");
else
System.out.println(n-S);
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.util.*;
import java.io.*;
public class aaaaaaaaaaaaaaaa {
public void run() throws Exception {
Scanner file = new Scanner(System.in);
int a = file.nextInt(), b= file.nextInt(), c = file.nextInt(), n = file.nextInt();
a -= c;
b -= c;
if (a < 0 || b < 0) System.out.println(-1);
else {
int x = a + b + c;
if (x >= n) System.out.println(-1);
else System.out.println(n - x);
}
}
public static void main(String[] args) throws Exception {
new aaaaaaaaaaaaaaaa().run();
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.util.*;
import java.io.*;
public class C994{
static double area(double x1,double y1,double x2,double y2,double x3,double y3){
return Math.abs((x1 * (y2 - y3) +
x2 * (y3 - y1) + x3 * (y1 - y2)) / 2.0);
}
public static void main(String args[])throws IOException{
Scanner sc=new Scanner(new BufferedReader(new InputStreamReader(System.in)));
PrintWriter pw=new PrintWriter(System.out);
int x11=sc.nextInt();
int y11=sc.nextInt();
int x12=sc.nextInt();
int y12=sc.nextInt();
int x13=sc.nextInt();
int y13=sc.nextInt();
int x14=sc.nextInt();
int y14=sc.nextInt();
double x1c=(x11+x12+x13+x14)/4.0;
double y1c=(y11+y12+y13+y14)/4.0;
int x21=sc.nextInt();
int y21=sc.nextInt();
int x22=sc.nextInt();
int y22=sc.nextInt();
int x23=sc.nextInt();
int y23=sc.nextInt();
int x24=sc.nextInt();
int y24=sc.nextInt();
double x2c=(x21+x22+x23+x24)/4.0;
double y2c=(y21+y22+y23+y24)/4.0;
double a1=area(x11,y11,x12,y12,x13,y13)+area(x11,y11,x13,y13,x14,y14);
double a2=area(x21,y21,x22,y22,x23,y23)+area(x21,y21,x23,y23,x24,y24);
if(a1==area(x11,y11,x12,y12,x21,y21)+area(x11,y11,x21,y21,x14,y14)+area(x21,y21,x12,y12,x13,y13)+area(x21,y21,x14,y14,x13,y13)){
pw.println("YES");
pw.close();
return;
}
if(a1==area(x11,y11,x12,y12,x22,y22)+area(x11,y11,x22,y22,x14,y14)+area(x22,y22,x12,y12,x13,y13)+area(x22,y22,x14,y14,x13,y13)){
pw.println("YES");
pw.close();
return;
}
if(a1==area(x11,y11,x12,y12,x23,y23)+area(x11,y11,x23,y23,x14,y14)+area(x23,y23,x12,y12,x13,y13)+area(x23,y23,x14,y14,x13,y13)){
pw.println("YES");
pw.close();
return;
}
if(a1==area(x11,y11,x12,y12,x24,y24)+area(x11,y11,x24,y24,x14,y14)+area(x24,y24,x12,y12,x13,y13)+area(x24,y24,x14,y14,x13,y13)){
pw.println("YES");
pw.close();
return;
}
if(a1==area(x11,y11,x12,y12,x2c,y2c)+area(x11,y11,x2c,y2c,x14,y14)+area(x2c,y2c,x12,y12,x13,y13)+area(x2c,y2c,x14,y14,x13,y13)){
pw.println("YES");
pw.close();
return;
}
if(a2==area(x21,y21,x22,y22,x11,y11)+area(x21,y21,x11,y11,x24,y24)+area(x11,y11,x22,y22,x23,y23)+area(x11,y11,x24,y24,x23,y23)){
pw.println("YES");
pw.close();
return;
}
if(a2==area(x21,y21,x22,y22,x12,y12)+area(x21,y21,x12,y12,x24,y24)+area(x12,y12,x22,y22,x23,y23)+area(x12,y12,x24,y24,x23,y23)){
pw.println("YES");
pw.close();
return;
}
if(a2==area(x21,y21,x22,y22,x13,y13)+area(x21,y21,x13,y13,x24,y24)+area(x13,y13,x22,y22,x23,y23)+area(x13,y13,x24,y24,x23,y23)){
pw.println("YES");
pw.close();
return;
}
if(a2==area(x21,y21,x22,y22,x14,y14)+area(x21,y21,x14,y14,x24,y24)+area(x14,y14,x22,y22,x23,y23)+area(x14,y14,x24,y24,x23,y23)){
pw.println("YES");
pw.close();
return;
}
if(a2==area(x21,y21,x22,y22,x1c,y1c)+area(x21,y21,x14,y14,x2c,y2c)+area(x1c,y1c,x22,y22,x23,y23)+area(x1c,y1c,x24,y24,x23,y23)){
pw.println("YES");
pw.close();
return;
}
pw.println("NO");
pw.close();
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
/**
* @author Don Li
*/
public class TwoSquares {
int INF = 1000;
void solve() {
int[][] s1 = new int[4][2];
for (int i = 0; i < 4; i++) {
s1[i][0] = in.nextInt();
s1[i][1] = in.nextInt();
}
int[][] s2 = new int[4][2];
for (int i = 0; i < 4; i++) {
s2[i][0] = in.nextInt();
s2[i][1] = in.nextInt();
}
if (ok(s1, s2)) {
out.println("Yes");
return;
}
rotate(s1);
rotate(s2);
if (ok(s2, s1)) {
out.println("Yes");
return;
}
out.println("No");
}
void rotate(int[][] s) {
for (int i = 0; i < 4; i++) {
int x = s[i][0], y = s[i][1];
s[i][0] = x - y;
s[i][1] = x + y;
}
}
boolean ok(int[][] s1, int[][] s2) {
int xmin = INF, xmax = -INF, ymin = INF, ymax = -INF;
for (int i = 0; i < 4; i++) {
xmin = Math.min(xmin, s1[i][0]);
xmax = Math.max(xmax, s1[i][0]);
ymin = Math.min(ymin, s1[i][1]);
ymax = Math.max(ymax, s1[i][1]);
}
for (int i = 0; i < 4; i++) {
if (s2[i][0] >= xmin && s2[i][0] <= xmax && s2[i][1] >= ymin && s2[i][1] <= ymax) return true;
}
int[] mid2 = new int[]{s2[0][0] + s2[2][0], s2[0][1] + s2[2][1]};
return mid2[0] >= xmin * 2 && mid2[0] <= xmax * 2 && mid2[1] >= ymin * 2 && mid2[1] <= ymax * 2;
}
public static void main(String[] args) {
in = new FastScanner(new BufferedReader(new InputStreamReader(System.in)));
out = new PrintWriter(System.out);
new TwoSquares().solve();
out.close();
}
static FastScanner in;
static PrintWriter out;
static class FastScanner {
BufferedReader in;
StringTokenizer st;
public FastScanner(BufferedReader in) {
this.in = in;
}
public String nextToken() {
while (st == null || !st.hasMoreTokens()) {
try {
st = new StringTokenizer(in.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
public int nextInt() {
return Integer.parseInt(nextToken());
}
public long nextLong() {
return Long.parseLong(nextToken());
}
public double nextDouble() {
return Double.parseDouble(nextToken());
}
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.util.*;
public class C {
public static void main(String[]args){
Scanner sc=new Scanner(System.in);
double n=sc.nextDouble(),r=sc.nextDouble();
System.out.println(r/(1/Math.sin(Math.PI/n)-1));
sc.close();
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.*;
import java.util.NoSuchElementException;
public class Main_1100C {
private static Scanner sc;
private static Printer pr;
private static void solve() {
int n = sc.nextInt();
int r = sc.nextInt();
double sin = Math.sin(Math.PI / n);
double ans = r * sin / (1 - sin);
pr.printf("%.7f%n", ans);
}
// ---------------------------------------------------
public static void main(String[] args) {
sc = new Scanner(System.in);
pr = new Printer(System.out);
solve();
pr.close();
sc.close();
}
static class Scanner {
BufferedReader br;
Scanner (InputStream in) {
br = new BufferedReader(new InputStreamReader(in));
}
private boolean isPrintable(int ch) {
return ch >= '!' && ch <= '~';
}
private boolean isCRLF(int ch) {
return ch == '\n' || ch == '\r' || ch == -1;
}
private int nextPrintable() {
try {
int ch;
while (!isPrintable(ch = br.read())) {
if (ch == -1) {
throw new NoSuchElementException();
}
}
return ch;
} catch (IOException e) {
throw new NoSuchElementException();
}
}
String next() {
try {
int ch = nextPrintable();
StringBuilder sb = new StringBuilder();
do {
sb.appendCodePoint(ch);
} while (isPrintable(ch = br.read()));
return sb.toString();
} catch (IOException e) {
throw new NoSuchElementException();
}
}
int nextInt() {
try {
// parseInt from Integer.parseInt()
boolean negative = false;
int res = 0;
int limit = -Integer.MAX_VALUE;
int radix = 10;
int fc = nextPrintable();
if (fc < '0') {
if (fc == '-') {
negative = true;
limit = Integer.MIN_VALUE;
} else if (fc != '+') {
throw new NumberFormatException();
}
fc = br.read();
}
int multmin = limit / radix;
int ch = fc;
do {
int digit = ch - '0';
if (digit < 0 || digit >= radix) {
throw new NumberFormatException();
}
if (res < multmin) {
throw new NumberFormatException();
}
res *= radix;
if (res < limit + digit) {
throw new NumberFormatException();
}
res -= digit;
} while (isPrintable(ch = br.read()));
return negative ? res : -res;
} catch (IOException e) {
throw new NoSuchElementException();
}
}
long nextLong() {
try {
// parseLong from Long.parseLong()
boolean negative = false;
long res = 0;
long limit = -Long.MAX_VALUE;
int radix = 10;
int fc = nextPrintable();
if (fc < '0') {
if (fc == '-') {
negative = true;
limit = Long.MIN_VALUE;
} else if (fc != '+') {
throw new NumberFormatException();
}
fc = br.read();
}
long multmin = limit / radix;
int ch = fc;
do {
int digit = ch - '0';
if (digit < 0 || digit >= radix) {
throw new NumberFormatException();
}
if (res < multmin) {
throw new NumberFormatException();
}
res *= radix;
if (res < limit + digit) {
throw new NumberFormatException();
}
res -= digit;
} while (isPrintable(ch = br.read()));
return negative ? res : -res;
} catch (IOException e) {
throw new NoSuchElementException();
}
}
float nextFloat() {
return Float.parseFloat(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
String nextLine() {
try {
int ch;
while (isCRLF(ch = br.read())) {
if (ch == -1) {
throw new NoSuchElementException();
}
}
StringBuilder sb = new StringBuilder();
do {
sb.appendCodePoint(ch);
} while (!isCRLF(ch = br.read()));
return sb.toString();
} catch (IOException e) {
throw new NoSuchElementException();
}
}
int[] nextIntArray(int n) {
int[] ret = new int[n];
for (int i = 0; i < n; i++) {
ret[i] = sc.nextInt();
}
return ret;
}
int[][] nextIntArrays(int n, int m) {
int[][] ret = new int[m][n];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
ret[j][i] = sc.nextInt();
}
}
return ret;
}
void close() {
try {
br.close();
} catch (IOException e) {
// throw new NoSuchElementException();
}
}
}
static class Printer extends PrintWriter {
Printer(OutputStream out) {
super(out);
}
void printInts(int... a) {
StringBuilder sb = new StringBuilder(32);
for (int i = 0, size = a.length; i < size; i++) {
if (i > 0) {
sb.append(' ');
}
sb.append(a[i]);
}
println(sb);
}
void printLongs(long... a) {
StringBuilder sb = new StringBuilder(64);
for (int i = 0, size = a.length; i < size; i++) {
if (i > 0) {
sb.append(' ');
}
sb.append(a[i]);
}
println(sb);
}
void printStrings(String... a) {
StringBuilder sb = new StringBuilder(32);
for (int i = 0, size = a.length; i < size; i++) {
if (i > 0) {
sb.append(' ');
}
sb.append(a[i]);
}
println(sb);
}
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
import java.io.*;
import java.util.*;
public class IntegerSequenceDividing {
static PrintWriter pw = new PrintWriter(System.out);
public static void main(String[] args) throws IOException{
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
if(n%2==0)
{
n=n/2;
if(n%2==0)
System.out.println(0);
else
System.out.println(1);
}else
{
n++;
n=n/2;
if(n%2==0)
System.out.println(0);
else
System.out.println(1);
}
}
static class Scanner {
StringTokenizer st;
BufferedReader br;
public Scanner(InputStream system) {
br = new BufferedReader(new InputStreamReader(system));
}
public Scanner(String file) throws Exception {
br = new BufferedReader(new FileReader(file));
}
public String next() throws IOException {
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return st.nextToken();
}
public String nextLine() throws IOException {
return br.readLine();
}
public int nextInt() throws IOException {
return Integer.parseInt(next());
}
public double nextDouble() throws IOException {
return Double.parseDouble(next());
}
public char nextChar() throws IOException {
return next().charAt(0);
}
public Long nextLong() throws IOException {
return Long.parseLong(next());
}
public boolean ready() throws IOException {
return br.ready();
}
public void waitForInput() throws InterruptedException {
Thread.sleep(3000);
}
}
}
<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.util.*;import java.lang.*;import java.io.*;
public class Codechef
{ static PrintWriter out=new PrintWriter(System.out);
static FastScanner in = new FastScanner(System.in);
static class FastScanner {BufferedReader br;StringTokenizer stok;FastScanner(InputStream is) {br = new BufferedReader(new InputStreamReader(is));}
String next() throws IOException {while (stok == null || !stok.hasMoreTokens()) {String s = br.readLine();if (s == null) {return null;}
stok = new StringTokenizer(s);}return stok.nextToken();}
int ni() throws IOException { return Integer.parseInt(next());}
long nl() throws IOException {return Long.parseLong(next());}
double nd() throws IOException {return Double.parseDouble(next());}
char nc() throws IOException {return (char) (br.read());}
String ns() throws IOException {return br.readLine();}
int[] nia(int n) throws IOException{int a[] = new int[n];for (int i = 0; i < n; i++)a[i] = ni();return a;}
long[] nla(int n) throws IOException {
long a[] = new long[n];for (int i = 0; i < n; i++)a[i] = nl();return a;}
double[] nda(int n)throws IOException {double a[] = new double[n];for (int i = 0; i < n; i++) a[i] = nd(); return a;}
int [][] imat(int n,int m) throws IOException
{ int mat[][]=new int[n][m];for(int i=0;i<n;i++){ for(int j=0;j<m;j++)mat[i][j]=ni();}return mat;}
}
///MAIN METHOD
static long mod=Long.MAX_VALUE;
public static void main (String[] args) throws java.lang.Exception
{ int i,j;
HashMap<Integer,Integer> hm=new HashMap<Integer,Integer>();
/* if(hm.containsKey(z))
hm.put(z,hm.get(z)+1);
else
hm.put(z,1);
*/
ArrayList<Integer> arr=new ArrayList<Integer>();
HashSet<Integer> set=new HashSet<Integer>();
PriorityQueue<Integer> pq=new PriorityQueue<Integer>();
/* int n = in.ni();
int m = in.ni();
String s=in.ns();
int a[]=in.nia(n);
int b[][]=in.im(n,m);
pia(a);
pimat(b);
sort(a,0,a.length-1);
*/
long n=in.nl();
long v=in.nl();
long temp=n-1;
long ans=0;
ans+=Math.min(v,temp);
temp-=v;
if(temp>0)
ans+=((temp+1)*(temp+2))/(long)2-1;
out.println(ans);
out.close();
}
static long gcd(long a,long b)
{ if(b==0)
return a;
return gcd(b,a%b);
}
static long exponent(long a,long n)
{ long ans=1;
while(n!=0)
{ if(n%2==1)
ans=(ans*a)%mod;
a=(a*a)%mod;
n=n>>1;
}
return ans;
}
static int binarySearch(int a[], int item, int low, int high)
{ if (high <= low)
return (item > a[low])? (low + 1): low;
int mid = (low + high)/2;
if(item == a[mid])
return mid+1;
if(item > a[mid])
return binarySearch(a, item, mid+1, high);
return binarySearch(a, item, low, mid-1);
}
static void merge(int arr[], int l, int m, int r)
{ int n1 = m - l + 1; int n2 = r - m; int L[] = new int [n1]; int R[] = new int [n2];
for (int i=0; i<n1; ++i) L[i] = arr[l + i]; for (int j=0; j<n2; ++j) R[j] = arr[m + 1+ j]; int i = 0, j = 0; int k = l;
while (i < n1 && j < n2) { if (L[i] <= R[j]) { arr[k] = L[i]; i++; } else{ arr[k] = R[j]; j++; } k++; } while (i < n1){ arr[k] = L[i]; i++; k++; } while (j < n2) { arr[k] = R[j]; j++; k++; }
}
static void Sort(int arr[], int l, int r)
{ if (l < r) { int m = (l+r)/2; Sort(arr, l, m); Sort(arr , m+1, r); merge(arr, l, m, r); } }
static void sort(int a[])
{Sort(a,0,a.length-1);}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class SashaAndHisTrip {
public static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
public static StringTokenizer st;
public static void main(String[] args) throws IOException {
int n = nextInt();
int v = nextInt();
if (v >= n-1)
System.out.println(n-1);
else
System.out.println((n-v)*(n-v+1)/2+v-1);
}
public static String nextLine() throws IOException {
return in.readLine();
}
public static String nextString() throws IOException {
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(in.readLine());
return st.nextToken();
}
public static int nextInt() throws IOException {
return Integer.parseInt(nextString());
}
public static long nextLong() throws IOException {
return Long.parseLong(nextString());
}
public static int[] intArray(int n) throws IOException {
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = nextInt();
return a;
}
public static int[][] intArray(int n, int m) throws IOException {
int[][] a = new int[n][m];
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
a[i][j] = nextInt();
return a;
}
public static long[] longArray(int n) throws IOException {
long[] a = new long[n];
for (int i = 0; i < n; i++)
a[i] = nextLong();
return a;
}
}<|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
// Java program to delete a node from
// Doubly Linked List
// Class for Doubly Linked List
public
class
DLL {
Node head;
// head of list
/* Doubly Linked list Node*/
class
Node {
int
data;
Node prev;
Node next;
// Constructor to create a new node
// next and prev is by default initialized
// as null
Node(
int
d) { data = d; }
}
// Adding a node at the front of the list
public
void
push(
int
new_data)
{
// 1. allocate node
// 2. put in the data
Node new_Node =
new
Node(new_data);
// 3. Make next of new node as head
// and previous as NULL
new_Node.next = head;
new_Node.prev =
null
;
// 4. change prev of head node to new node
if
(head !=
null
)
head.prev = new_Node;
// 5. move the head to point to the new node
head = new_Node;
}
// This function prints contents of linked list
// starting from the given node
public
void
printlist(Node node)
{
Node last =
null
;
while
(node !=
null
) {
System.out.print(node.data +
" "
);
last = node;
node = node.next;
}
System.out.println();
}
// Function to delete a node in a Doubly Linked List.
// head_ref --> pointer to head node pointer.
// del --> data of node to be deleted.
void
deleteNode(Node head_ref, Node del)
{
// Base case
if
(head ==
null
|| del ==
null
) {
return
;
}
// If node to be deleted is head node
if
(head == del) {
head = del.next;
}
// Change next only if node to be deleted
// is NOT the last node
if
(del.next !=
null
) {
del.next.prev = del.prev;
}
// Change prev only if node to be deleted
// is NOT the first node
if
(del.prev !=
null
) {
del.prev.next = del.next;
}
// Finally, free the memory occupied by del
return
;
}
// Driver Code
public
static
void
main(String[] args)
{
// Start with the empty list
DLL dll =
new
DLL();
// Insert 2. So linked list becomes 2->NULL
dll.push(
2
);
// Insert 4. So linked list becomes 4->2->NULL
dll.push(
4
);
// Insert 8. So linked list becomes 8->4->2->NULL
dll.push(
8
);
// Insert 10. So linked list becomes 10->8->4->2->NULL
dll.push(
10
);
System.out.print(
"Created DLL is: "
);
dll.printlist(dll.head);
// Deleting first node
dll.deleteNode(dll.head, dll.head);
// List after deleting first node
// 8->4->2
System.out.print(
"\nList after deleting first node: "
);
dll.printlist(dll.head);
// Deleting middle node from 8->4->2
dll.deleteNode(dll.head, dll.head.next);
System.out.print(
"\nList after Deleting middle node: "
);
dll.printlist(dll.head);
}
} <|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
// Java program to keep track of maximum
// element in a stack
import
java.util.*;
class
GfG {
static
class
StackWithMax
{
// main stack
static
Stack<Integer> mainStack =
new
Stack<Integer> ();
// tack to keep track of max element
static
Stack<Integer> trackStack =
new
Stack<Integer> ();
static
void
push(
int
x)
{
mainStack.push(x);
if
(mainStack.size() ==
1
)
{
trackStack.push(x);
return
;
}
// If current element is greater than
// the top element of track stack, push
// the current element to track stack
// otherwise push the element at top of
// track stack again into it.
if
(x > trackStack.peek())
trackStack.push(x);
else
trackStack.push(trackStack.peek());
}
static
int
getMax()
{
return
trackStack.peek();
}
static
void
pop()
{
mainStack.pop();
trackStack.pop();
}
};
// Driver program to test above functions
public
static
void
main(String[] args)
{
StackWithMax s =
new
StackWithMax();
s.push(
20
);
System.out.println(s.getMax());
s.push(
10
);
System.out.println(s.getMax());
s.push(
50
);
System.out.println(s.getMax());
}
} <|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
// Java program to split a number into maximum
// number of composite numbers.
import
java.io.*;
class
GFG
{
// function to calculate the maximum number of
// composite numbers adding upto n
static
int
count(
int
n)
{
// 4 is the smallest composite number
if
(n <
4
)
return
-
1
;
// stores the remainder when n is divided
// by 4
int
rem = n %
4
;
// if remainder is 0, then it is perfectly
// divisible by 4.
if
(rem ==
0
)
return
n /
4
;
// if the remainder is 1
if
(rem ==
1
) {
// If the number is less then 9, that
// is 5, then it cannot be expressed as
// 4 is the only composite number less
// than 5
if
(n <
9
)
return
-
1
;
// If the number is greater then 8, and
// has a remainder of 1, then express n
// as n-9 a and it is perfectly divisible
// by 4 and for 9, count 1.
return
(n -
9
) /
4
+
1
;
}
// When remainder is 2, just subtract 6 from n,
// so that n is perfectly divisible by 4 and
// count 1 for 6 which is subtracted.
if
(rem ==
2
)
return
(n -
6
) /
4
+
1
;
// if the number is 7, 11 which cannot be
// expressed as sum of any composite numbers
if
(rem ==
3
)
{
if
(n <
15
)
return
-
1
;
// when the remainder is 3, then subtract
// 15 from it and n becomes perfectly
// divisible by 4 and we add 2 for 9 and 6,
// which is getting subtracted to make n
// perfectly divisible by 4.
return
(n -
15
) /
4
+
2
;
}
return
0
;
}
// Driver program
public
static
void
main (String[] args)
{
int
n =
90
;
System.out.println(count(n));
n =
143
;
System.out.println(count(n));
}
}
// This code is contributed by vt_m. <|eot_id|><|start_header_id|>user<|end_header_id|>0.1<|eot_id|><|start_header_id|>assistant<|end_header_id|><|eot_id|> |
End of preview. Expand
in Dataset Viewer.
README.md exists but content is empty.
- Downloads last month
- 20