src stringlengths 95 64.6k | complexity stringclasses 7
values | problem stringlengths 6 50 | from stringclasses 1
value |
|---|---|---|---|
import java.util.Scanner;
public class B2 {
public static void main (String args[]){
Scanner in = new Scanner(System.in);
long n = in.nextLong();
long k = in.nextLong();
long upn = k;
long tmp=upn;
if(n==1){
System.out.println(0);
return;
}
if(n<=k){
System.out.println(1);
return;
}
/... | logn | 287_B. Pipeline | CODEFORCES |
import java.io.*;
import java.util.*;
public class Main
{
long sum ( long n ) { return (n*(n+1))/2; }
public void solve ( ) throws Exception
{
Scanner in = new Scanner ( System.in );
long n = in.nextLong()-1;
long k = in.nextLong()-1;
long lo = 0, hi = k, mi;
while ( lo < hi )
{
mi = ( lo + hi ) ... | logn | 287_B. Pipeline | CODEFORCES |
import java.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author dy
*/
public class Main {
public static void main(String[] args) {
InputStream inputStre... | logn | 287_B. Pipeline | CODEFORCES |
import java.util.Scanner;
public class B{
public static void main(String args[]){
Scanner input = new Scanner(System.in);
long n = input.nextLong();
long k = input.nextLong();
System.out.println(solve(n, k));
input.close();
}
public static long solve(long n, lon... | logn | 287_B. Pipeline | CODEFORCES |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
String[] info = s.split(" ");
long n = Long.parseLong(info[0]);
long k = Long.parseLong(info[1]);
sc.close();
... | logn | 287_B. Pipeline | CODEFORCES |
import java.io.*;
import java.util.*;
public class SolutionB {
BufferedReader in;
StringTokenizer str;
PrintWriter out;
String SK;
String next() throws IOException {
while ((str == null) || (!str.hasMoreTokens())) {
SK = in.readLine();
if (SK == null)
return null;
... | logn | 287_B. Pipeline | CODEFORCES |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class TaskB {
static BufferedReader in = new BufferedReader(new InputStreamReader(
System.in));
static StringTokenizer str;
static String SK;
static String... | logn | 287_B. Pipeline | CODEFORCES |
import java.util.*;
import java.io.*;
public class Contest176B {
public static void main(String[] args) throws IOException{
Scanner sc = new Scanner(System.in);
long n = sc.nextLong();
int k = sc.nextInt();
if( ((long)k * (long)(k + 1))/2 - 1 - (k - 2) < n){
Sys... | logn | 287_B. Pipeline | CODEFORCES |
import java.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author Saul
*/
public class Main {
public static void main(String[] args) {
InputStream inputSt... | logn | 287_B. Pipeline | CODEFORCES |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
/**
* Created with IntelliJ IDEA.
* User: ira
* Date: 3/23/13
* Time: 12:19 PM
*/
public class B2 {
public static void main(String[] args) throws IOEx... | logn | 287_B. Pipeline | CODEFORCES |
import java.util.Scanner;
public class CodeforcesRound176B {
/**
* @param args
*/
public static void main(String[] args)
{
Scanner kde =new Scanner (System.in);
Long n = kde.nextLong(); //дома и кол труб
Long k = kde.nextLong(); // разветлители
if(((k-1)*(k-2)+2*k)<(n*(long)2))
{
System.out... | logn | 287_B. Pipeline | CODEFORCES |
import java.math.BigInteger;
import java.util.Scanner;
public class ehsan
{
public static BigInteger f(BigInteger m,BigInteger n){
BigInteger s,l;
s=n.multiply(m.add(BigInteger.valueOf(1)));
l=m.multiply(m.add(BigInteger.valueOf(1)));
l=l.divide(BigInteger.valueOf(2));
s=s.subtract(l);
s=s.subtract(m);
... | logn | 287_B. Pipeline | CODEFORCES |
/**
* Created with IntelliJ IDEA.
* User: yuantian
* Date: 3/24/13
* Time: 2:18 AM
* Copyright (c) 2013 All Right Reserved, http://github.com/tyuan73
*/
import java.util.*;
public class Pipeline {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
long n = in.next... | logn | 287_B. Pipeline | CODEFORCES |
import java.io.IOException;
import java.util.Scanner;
public class TC
{
static long N;
static int k;
static long WHOLESUM;
static long SUM( long k )
{
long res=k*( k+1 )/2;
return res-1;
}
static long returnPipes( int mid )
{
long not=SUM( mid-1 );
... | logn | 287_B. Pipeline | CODEFORCES |
import java.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author Dzmitry Paulenka
*/
public class Main {
public static void main(String[] args) {
InputSt... | logn | 287_B. Pipeline | CODEFORCES |
import java.util.Locale;
import java.util.Scanner;
public class PipelineSolver {
private long n;
private long k;
public static void main(String[] args) {
PipelineSolver solver = new PipelineSolver();
solver.readData();
int solution = solver.solve();
solver.print(solution... | logn | 287_B. Pipeline | CODEFORCES |
import java.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author Dzmitry Paulenka
*/
public class Main {
public static void main(String[] args) {
InputSt... | logn | 287_B. Pipeline | CODEFORCES |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import static java.lang.Math.*;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Character.*;
@SuppressWarnings("unused")
public class round176B {
static BufferedReader br = ... | logn | 287_B. Pipeline | CODEFORCES |
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
// Pipeline
// 2013/03/23
public class P287B{
Scanner sc=new Scanner(System.in);
long n, k;
void run(){
n=sc.nextLong();
k=sc.n... | logn | 287_B. Pipeline | CODEFORCES |
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class B {
public static void main(String[] args){
FastScanner sc = new FastScanner();
long n = sc.nextLong();
i... | logn | 287_B. Pipeline | CODEFORCES |
import java.util.*;
public class Main{
public static void main(String[]args){
Scanner cin=new Scanner(System.in);
long z=cin.nextLong()-1<<1,n=cin.nextInt(),l=-1,r=1+n,m;
while(l<(m=l+r>>1)) if(z>(m+n-1)*(n-m)) r=m;else l=m;
if(0<l) l=n-l;
System.out.print(l);
}
}
| logn | 287_B. Pipeline | CODEFORCES |
// practice with rainboy
import java.io.*;
import java.util.*;
public class CF256B extends PrintWriter {
CF256B() { super(System.out, true); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF256B o = new CF256B(); o.main(); o.flush();
}
long count(int n, int x, int y, int r) {
lo... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.io.*;
import java.util.*;
public class B {
final String filename = new String("B").toLowerCase();
int n;
int r, c;
void solve() throws Exception {
n = nextInt();
r = nextInt() - 1;
c = nextInt() - 1;
long count = nextLong();
long left = -1, right = n * 2L;
while (left < right - 1) {
... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.util.Scanner;
public class Problem {
public static void main(String[] args) throws Exception {
Scanner input = new Scanner(System.in);
int side = input.nextInt()-1;
int x = input.nextInt()-1;
int y = input.nextInt()-1;
long target = input.nextLong();
... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.util.Scanner;
public class B {
public static final boolean DEBUG = false;
Scanner sc;
public void debug(Object o) {
if (DEBUG) {
int ln = Thread.currentThread().getStackTrace()[2].getLineNumber();
String fn = Thread.currentThread().getStackTrace()[2].getFileName();
System.out.println("(" +... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
//package codeforces.cf156;
import java.io.*;
import java.util.Arrays;
public class ProblemB {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
PrintWriter writer = new PrintWriter(new OutputStreamWriter(System.out));
long[] readInts() throws IOException {
String[] str... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.io.*;
import java.util.*;
public class bender {
static long[] dx = new long[]{0, 1, 0, -1};
static long[] dy = new long[]{-1, 0, 1, 0};
static long n, x, y, c;
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamRead... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
//package code;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Random;
import java.util.Scanner;
import java.util.TreeMap;
/... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.io.*;
import java.math.*;
import java.util.*;
public class B {
public static void main(String[] args) throws Exception {
new B().solve(System.in, System.out);
// new FileInputStream(new File("input.txt")),
// new PrintStream(new FileOutputStream(new File("output.txt"))));
}
... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.io.OutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.Writer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @auth... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
public class B {
static Scanner in; static int next() throws Exception {return in.nextInt();};
// static StreamTokenizer in; static int next() throws Exception {in.nextToken(); return (int) in.nval;}
// static BufferedReader in;
sta... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.StringTokenizer;
public class Main implements Runnable {
private BufferedReader br;
private Stri... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.StringTokenizer;
public class P {
public static void main(String[] args) throws NumberFo... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Locale;
import java.util.StringTokenizer;
public class Main {
private void solve() throws IOException {
int n = nextInt();
int x = nextInt();
int y = nextInt();
int c = ne... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.util.Scanner;
public class Main {
static Scanner cin = new Scanner(System.in);
static int n, x, y;
static long c;
private static long f(int mid) {
long block = 1 + 4 * (long)(mid + 1) * mid / 2;
int l = y - mid;
int r = y + mid;
int u = x - mid;
int d = x + mid;
if(l <= 0)
block -= (... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.util.Scanner;
import java.math.BigInteger;
import java.io.*;
public class Main{
/**
* @param args
*/
static BigInteger n, x, y, c;
static BigInteger mk[] = new BigInteger[8];
public static BigInteger f(BigInteger t) {
return t.multiply(t);
}
public static BigInteger g(BigInteger t) {
retur... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.util.Scanner;
public class Main {
/**
* @param args
*/
static long[] dx = new long[]{0, 1, 0, -1};
static long[] dy = new long[]{-1, 0, 1, 0};
public static void main(String[] args) {
Scanner r = new Scanner(System.in);
long N = r.nextLong();
long X = r.nextLong();
long Y = r.nextLong(... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.util.*;
public class cf256b {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
long n = in.nextLong();
long x = in.nextLong()-1;
long y = in.nextLong()-1;
long c = in.nextLong();
long lo = 0, hi = 2*n+10;
while(hi - lo > 2) {
long mid = (hi+lo)/2;
if(cal... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.util.*;
import java.math.BigInteger;
import javax.naming.BinaryRefAddr;
public class acm
{
public static BigInteger n;
public static BigInteger TWO = new BigInteger("2");
public static BigInteger solve(BigInteger x, BigInteger y, BigInteger c)
{
BigInteger res = (c.add(BigInteger.O... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class ProblemB {
public static void main(String[] args) throws IOException {
ProblemB... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.io.*;
import java.util.*;
public class Example {
BufferedReader in;
PrintWriter out;
StringTokenizer st;
String next() {
while (st == null || !st.hasMoreTokens()) {
try {
st = new StringTokenizer(in.readLine());
} catch (Exception e) {
... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.math.BigDecimal;
import java.io.BufferedWriter;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.StringTokenizer;
import java.math.B... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
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.Input... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.util.*;
import java.math.*;
import java.io.*;
public class b2 {
public static void main(String[] args) throws IOException
{
input.init(System.in);
int n = input.nextInt(), x = input.nextInt(), y = input.nextInt(), c = input.nextInt();
long lo = 0, hi = 2*n;
while(hi > lo+1)
{
lo... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.io.*;
import java.util.*;
public class ProblemB {
InputReader in; PrintWriter out;
void solve() {
int n = in.nextInt();
int x = in.nextInt();
int y = in.nextInt();
int c = in.nextInt();
int cur = 1;
for (int k = 1; k <= c; k++) {
// out.print... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Scanner;
import java.util.concurrent.LinkedBlockingQueue;
public class D {
static long n;
static long x;
static long y;
static long c;
static long f(long t){
long s=0;
if(t==0)... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
//package round156;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
public class B {
InputStream is;
PrintWriter out;
String INPUT = "";
void solve()
{
int n = ni(), x = n... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import static java.lang.Math.*;
import java.io.*;
import java.util.*;
public class A {
BufferedReader in;
PrintWriter out;
StringTokenizer st;
public String next() {
while (st == null || !st.hasMoreTokens()) {
try {
st = new StringTokenizer(in.readLine());
} catch(Exception e) {}
}
return st... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.io.*;
import java.util.*;
public class MrBenderAndSquare {
static long n, x, y, c;
public static void main(String[] args) throws IOException {
Kattio io = new Kattio(System.in);
n = io.getLong();
x = io.getLong();
y = io.getLong();
c = io.getLong();
// for (int i = 0; i < 10; i++) io.printl... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;
/**
*... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main{
public static long howMany(long n, long x, long y, long s){
long res = 0;
int cnt = 0;
long[] px = new long[9];
long[] py = new long[9];
if(x - s < 1){
... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class taskB {
StringTokenizer st;
BufferedReader in;
PrintWriter out;
public static void main(String[] args) throws NumberFormatException,
... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.util.*;
import java.io.*;
import java.math.*;
public class Solution
{
static long n, x, y, c;
static boolean can (long len)
{
BigInteger blen = BigInteger.valueOf(len);
//BigInteger sum = blen.multiply(blen.add(BigInteger.ONE)).multiply(blen.shiftLeft(1).add(BigInteger... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class Solution {
BufferedReader in;
PrintWriter out;
StringTokenizer st;
String nextToken() throws Exception {
while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(in.readLine());
return st.nextToken();
}
int nextInt... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.TreeSet;
public class B {
public static void main(String[] args) {
MScanner sc = new MScanner();
PrintWriter out = new PrintWriter(System.out);
long N = sc.nextLong();
... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.io.*;
import java.util.*;
import java.math.*;
import java.awt.geom.*;
import static java.lang.Math.*;
public class Main implements Runnable {
int n;
boolean inBound (int x, int y) {
return x >= 1 && y >= 1 && x <= n && y <= n;
}
void solve() throws Exception {
n = sc.nextInt();
int y = sc.... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.util.*;
import java.math.*;
import java.io.*;
public class Main
{
public static void main(String args[]) throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
//System.out.println(f(1,100,30));
String S[]=br.readLine().split(" ");
int N=Integer.parseInt(S[... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.util.*;
import java.io.*;
import java.math.*;
public class Main
{
static class Reader
{
private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;}
public int read() {if (nu... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.math.BigInteger;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.io.*;
import java.util.*;
public class BBi implements Runnable {
public static void main(String[] args) {
new Thread(new BBi()).run();
}
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer in;
PrintWriter out = new PrintWriter(System.out);
public String nextT... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.io.*;
import java.lang.reflect.*;
import java.util.*;
public class B {
final int MOD = (int)1e9 + 7;
final double eps = 1e-12;
final int INF = (int)1e9;
public B () {
long N = sc.nextInt();
long X = sc.nextInt() - 1;
long Y = sc.nextInt() - 1;
long C = sc.nextInt();
long [] A1 = new long ... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
public class ProblemB {
public static void main(String[] args) throws IOException {
BufferedReader... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
public class Solver {
StringTokenizer st;
BufferedReader in;
PrintWriter out;
public static void m... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.io.*;
import java.util.*;
import java.math.*;
public class P255D {
@SuppressWarnings("unchecked")
public void run() throws Exception {
long n = nextLong();
long x = nextLong();
long y = nextLong();
long c = nextLong();
if ((n == 1) || (c == 1)) {
println(0);
return;
... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.PrintStream;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.Writer;
import java.io.InputStream;
/**
* Built using CHelper... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.io.*;
import java.util.*;
public class B {
BufferedReader br;
PrintWriter out;
StringTokenizer st;
boolean eof;
long f(int x, int y, int sz) {
if (x > y) {
int tmp = x;
x = y;
y = tmp;
}
if (sz <= x)
return (long) sz * (sz + 1) / 2;
if (sz >= x + y - 1)
return (long) x * y;
... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
// practice with rainboy
import java.io.*;
import java.util.*;
public class CF256B extends PrintWriter {
CF256B() { super(System.out, true); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF256B o = new CF256B(); o.main(); o.flush();
}
long count(int n, int x, int y, int r) {
lo... | logn | 256_B. Mr. Bender and Square | CODEFORCES |
import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Proj implements Runnable {
BufferedReader in;
PrintWriter out;
StringTokenizer str;
public void solve() throws IOException {
long l = nextLong();
long r = nextLong();
int g = 0;
long x = l ^ r;
long i = 1;
w... | logn | 276_D. Little Girl and Maximum XOR | CODEFORCES |
/**
* Created with IntelliJ IDEA.
* User: brzezinsky
* Date: 12/16/12
* Time: 7:44 PM
* To change this template use File | Settings | File Templates.
*/
import java.io.*;
import java.util.*;
import java.util.StringTokenizer;
public class E extends Thread {
public E(String inputFileName, String outputFileNa... | logn | 276_D. Little Girl and Maximum XOR | CODEFORCES |
import java.awt.Point;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.StringTokenizer;
import static java.lang.Math.*;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Character.*;
import s... | logn | 276_D. Little Girl and Maximum XOR | CODEFORCES |
import java.util.Scanner;
public class D {
static long max;
public static long[] getOneRange(long min, long max,int bit) {
long st=(min&(((1l<<63)-1)&~((1l<<(bit+1))-1)))|(1l<<bit);
long end=st|((1l<<(bit+1))-1);
long interSt=Math.max(st,min);
long interEnd=Math.min(end, max)... | logn | 276_D. Little Girl and Maximum XOR | CODEFORCES |
import java.util.*;
import java.io.*;
public class a {
public static void main(String[] args) throws IOException
{
//Scanner input = new Scanner(new File("input.txt"));
//PrintWriter out = new PrintWriter(new File("output.txt"));
PrintWriter out = new PrintWriter(System.out);
input.init(System.in);... | logn | 276_D. Little Girl and Maximum XOR | CODEFORCES |
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the to... | logn | 276_D. Little Girl and Maximum XOR | CODEFORCES |
import java.io.*;
import java.util.*;
public class D {
BufferedReader br;
PrintWriter out;
StringTokenizer st;
boolean eof;
String toStr(long a) {
String s = Long.toBinaryString(a);
while (s.length() < 64)
s = "0" + s;
return s;
}
void solve() throws IOException {
long a = nextLong();
long b = ... | logn | 276_D. Little Girl and Maximum XOR | CODEFORCES |
import java.util.Scanner;
public class D {
public static void main(String [] args){
Scanner in = new Scanner(System.in);
long a = in.nextLong();
long b = in.nextLong();
String sa = Long.toBinaryString(a);
String sb = Long.toBinaryString(b);
long ans = 0;
if(sb.length()-sa.length()>0){
for(int i = 0 ... | logn | 276_D. Little Girl and Maximum XOR | CODEFORCES |
import java.util.Scanner;
public class Main3 {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
long l = s.nextLong();
long r = s.nextLong();
String a = Long.toBinaryString(l);
String b = Long.toBinaryString(r);
wh... | logn | 276_D. Little Girl and Maximum XOR | CODEFORCES |
import java.util.Scanner;
public class d_169 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long x=sc.nextLong();
long y=sc.nextLong();
String s=Long.toBinaryString(x);
String p=Long.toBinaryString(y);
int id=p.length()-s.length();
for (int i =1; i <=id; i++) {
s="0"+s;
}
... | logn | 276_D. Little Girl and Maximum XOR | CODEFORCES |
import java.io.*;
import java.lang.reflect.*;
public class D {
final int MOD = (int)1e9 + 7;
final double eps = 1e-12;
final int INF = (int)1e9;
public D () {
long L = sc.nextLong();
long R = sc.nextLong();
for (int i = 60; i >= 0; --i) {
long b = (1L << i);
long A = (L & b), B = (R & b);
if (... | logn | 276_D. Little Girl and Maximum XOR | CODEFORCES |
import java.io.*;
import java.util.*;
public class D {
public static void main(String[] args) throws IOException {
new D().solve();
}
void solve() throws IOException {
Scanner sc = new Scanner(System.in);
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
... | logn | 276_D. Little Girl and Maximum XOR | CODEFORCES |
// @author Sanzhar
import java.io.*;
import java.util.*;
import java.awt.Point;
public class Template {
BufferedReader in;
PrintWriter out;
StringTokenizer st;
String next() {
while (st == null || !st.hasMoreTokens()) {
try {
st = new StringTokenizer(in.readLine()... | logn | 276_D. Little Girl and Maximum XOR | CODEFORCES |
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {... | logn | 276_D. Little Girl and Maximum XOR | CODEFORCES |
import java.util.Scanner;
public class D {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
long l = s.nextLong();
long r = s.nextLong();
long a = l ^ r;
long b = a;
while (b != 0) {
a = b;
b = (b-1) & b;
}... | logn | 276_D. Little Girl and Maximum XOR | CODEFORCES |
import java.util.*;
public class Dj {
public static long run(long l, long r) {
if(l == r) {
return 0;
}
long[] sq2 = new long[62];
sq2[0] = 1;
for(int i = 1; i < 62; i++) sq2[i] = sq2[i-1]*2;
//System.out.println(sq2[61]);
for(int i = sq2.length - 1; i >= 0; i--) {
//log("L = " + l + " R = " +... | logn | 276_D. Little Girl and Maximum XOR | CODEFORCES |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.StringTokenizer;
public class LittleGirlAndXor {
static long L, R;
static Long[][][][][] dp = new Long[64][2][2][2][2];
public static long... | logn | 276_D. Little Girl and Maximum XOR | CODEFORCES |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.text.*;
public class cf276d {
static BufferedReader br;
static Scanner sc;
static PrintWriter out;
public static void ini... | logn | 276_D. Little Girl and Maximum XOR | CODEFORCES |
import java.util.*;
import java.io.*;
import java.math.*;
import java.awt.geom.*;
import static java.lang.Math.*;
public class Solution implements Runnable {
boolean hasBit(long n, int pos) {
return (n & (1L << pos)) != 0;
}
public void solve() throws Exception {
long l = sc.next... | logn | 276_D. Little Girl and Maximum XOR | CODEFORCES |
import java.util.*;
import static java.lang.System.*;
public class D276 {
Scanner sc = new Scanner(in);
public void run() {
long l=sc.nextLong(),r=sc.nextLong();
long tes=l^r;
int d=0;
while(tes!=0){
tes/=2;
d++;
}
ln((1L<<d)-1);
}... | logn | 276_D. Little Girl and Maximum XOR | CODEFORCES |
//package codeforces;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
imp... | logn | 276_D. Little Girl and Maximum XOR | CODEFORCES |
import java.util.*;
import java.io.*;
public class Main {
BufferedReader in;
StringTokenizer str = null;
private String next() throws Exception{
if (str == null || !str.hasMoreElements())
str = new StringTokenizer(in.readLine());
return str.nextToken();
}
private int nextInt() throws Exception{
retu... | logn | 276_D. Little Girl and Maximum XOR | CODEFORCES |
/* Codeforces Template */
import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.fill;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.sort;
public class Main {
static long initTime;
static final Random rnd = new Random(7777L);
static boo... | logn | 276_D. Little Girl and Maximum XOR | CODEFORCES |
import java.awt.Point;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.StringTokenizer;
import static java.lang.Math.*;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Character.*;
import s... | logn | 276_D. Little Girl and Maximum XOR | CODEFORCES |
import java.util.*;
public class Main{
public static void main(String[]args){
for(Scanner cin=new Scanner(System.in);cin.hasNextLong();System.out.println(Math.max(0,(Long.highestOneBit(cin.nextLong()^cin.nextLong())<<1)-1)));
}
}
| logn | 276_D. Little Girl and Maximum XOR | CODEFORCES |
//package round169;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
public class D2 {
InputStream is;
PrintWriter out;
String INPUT = "";
void solve()
{
long L = nl(), R =... | logn | 276_D. Little Girl and Maximum XOR | CODEFORCES |
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author ocelopilli
*/
public class ... | logn | 276_D. Little Girl and Maximum XOR | CODEFORCES |
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author George Marcus
*/
public class Main {
public static void main(String[] args) {
Inpu... | logn | 276_D. Little Girl and Maximum XOR | CODEFORCES |
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
public class Main {
public static void main(String [] args ) {
try{
String str;
BufferedReader br = new BufferedReader(new InputStreamReader(System... | logn | 276_D. Little Girl and Maximum XOR | CODEFORCES |
import java.io.*;
import java.util.*;
public class CFDiv1 {
FastScanner in;
PrintWriter out;
boolean canBe(int from, long curVal, long l, long r) {
if (curVal > r)
return false;
for (int i = 0; i <= from; i++)
curVal += 1L << i;
if (curVal >= l)
return true;
return false;
}
long stupid(long l, ... | logn | 276_D. Little Girl and Maximum XOR | CODEFORCES |
/**
* Created with IntelliJ IDEA.
* User: brzezinsky
* Date: 12/16/12
* Time: 7:44 PM
* To change this template use File | Settings | File Templates.
*/
import java.io.*;
import java.util.*;
import java.util.StringTokenizer;
public class E extends Thread {
public E(String inputFileName, String outputFileNa... | logn | 276_D. Little Girl and Maximum XOR | CODEFORCES |
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.Writer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author emotionalBlind
*/
public class Main {... | logn | 276_D. Little Girl and Maximum XOR | CODEFORCES |
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;
/**
* @author Abhimanyu Singh
*
*/
public class LittleGirlAndMaximumXOR {
private InputStream input;
private PrintStream output;
private Scanner inputSc;
static final boolean ONE = true;
... | logn | 276_D. Little Girl and Maximum XOR | CODEFORCES |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.