src
stringlengths 95
64.6k
| complexity
stringclasses 7
values | problem
stringlengths 6
50
| from
stringclasses 1
value |
---|---|---|---|
import java.util.Scanner;
public class Subtractions {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
int t = scan.nextInt();
while (t-- > 0) {
int a = scan.nextInt();
int b = scan.nextInt();
int res = 0;
while (a != 0 && b != 0) {
if (a > b) {
res += (a / b);
a %= b;
} else {
res += (b / a);
b %= a;
}
}
System.out.println(res);
}
}
}
| constant | 267_A. Subtractions | 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.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author John Martin
*/
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);
ASubtractions solver = new ASubtractions();
solver.solve(1, in, out);
out.close();
}
static class ASubtractions {
public void solve(int testNumber, InputReader c, OutputWriter w) {
int tc = c.readInt();
while (tc-- > 0) {
int a = c.readInt(), b = c.readInt();
int res = 0;
while (a != 0 && b != 0) {
res += b / a;
b = b % a;
int t = b;
b = a;
a = t;
}
w.printLine(res);
}
}
}
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 int readInt() {
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 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);
}
}
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(int i) {
writer.println(i);
}
}
}
| constant | 267_A. Subtractions | CODEFORCES |
//package Demo;
//import java.io.Console;
import java.util.Scanner;
//import javax.swing.plaf.basic.BasicInternalFrameTitlePane.MaximizeAction;
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scanner = new Scanner(System.in);
int T = scanner.nextInt();
while(T-->0){
int m , n , count=0;
m = scanner.nextInt();
n = scanner.nextInt();
while(m!=0&&n!=0){
int tmp;
if(m<n) {
tmp = n;
n = m;
m = tmp;
}
count+=m/n;
m = m%n;
}
if(T!=0)System.out.println(count);
else System.out.print(count);
}
}
}
| constant | 267_A. Subtractions | CODEFORCES |
import java.util.*;
import java.io.*;
public class Subtractions
{
/************************ SOLUTION STARTS HERE ***********************/
static long modifiedEuclidGCD(int a , int b) {
return b == 0 ? 0 : (a / b) + modifiedEuclidGCD(b, a % b);
}
private static void solve(FastScanner s1, PrintWriter out){
int T = s1.nextInt();
while(T-->0)
out.println(modifiedEuclidGCD(s1.nextInt(), s1.nextInt()));
}
/************************ SOLUTION ENDS HERE ************************/
/************************ TEMPLATE STARTS HERE *********************/
public static void main(String []args) throws IOException {
FastScanner in = new FastScanner(System.in);
PrintWriter out =
new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false);
solve(in, out);
in.close();
out.close();
}
static class FastScanner{
BufferedReader reader;
StringTokenizer st;
FastScanner(InputStream stream){reader=new BufferedReader(new InputStreamReader(stream));st=null;}
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();}
String nextLine() {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}
int nextInt() {return Integer.parseInt(next());}
long nextLong() {return Long.parseLong(next());}
double nextDouble(){return Double.parseDouble(next());}
char nextChar() {return next().charAt(0);}
int[] nextIntArray(int n) {int[] a= new int[n]; int i=0;while(i<n){a[i++]=nextInt();} return a;}
long[] nextLongArray(int n) {long[]a= new long[n]; int i=0;while(i<n){a[i++]=nextLong();} return a;}
int[] nextIntArrayOneBased(int n) {int[] a= new int[n+1]; int i=1;while(i<=n){a[i++]=nextInt();} return a;}
long[] nextLongArrayOneBased(int n){long[]a= new long[n+1];int i=1;while(i<=n){a[i++]=nextLong();}return a;}
void close(){try{reader.close();}catch(IOException e){e.printStackTrace();}}
}
/************************ TEMPLATE ENDS HERE ************************/
} | constant | 267_A. Subtractions | CODEFORCES |
import java.io.*;
import java.util.*;
import java.math.*;
public class Main {
public static int gcd(int a , int b) {
if (b == 0) return 0;
else {
return a / b + gcd (b , a % b);
}
}
public static void main(String[] args) {
Scanner sc = new Scanner (System.in);
int testCase = sc.nextInt();
while (testCase-- > 0) {
int n = sc.nextInt();
int m = sc.nextInt();
if (n < m) {
int temp = n;
n = m;
m = temp;
}
int ans = gcd (n , m);
System.out.println(ans);
}
}
} | constant | 267_A. Subtractions | CODEFORCES |
import java.io.*;
import java.util.*;
public class A {
BufferedReader br;
PrintWriter out;
StringTokenizer st;
boolean eof;
long f(int x, int y) {
if (x == 0 || y == 0)
return 0;
if (x >= y) {
return x / y + f(y, x % y);
} else {
return y / x + f(x, y % x);
}
}
A() throws IOException {
br = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter(System.out);
int t = nextInt();
while (t-- > 0) {
int a = nextInt();
int b = nextInt();
out.println(f(a, b));
}
out.close();
}
public static void main(String[] args) throws IOException {
new A();
}
String nextToken() {
while (st == null || !st.hasMoreTokens()) {
try {
st = new StringTokenizer(br.readLine());
} catch (Exception e) {
eof = true;
return null;
}
}
return st.nextToken();
}
String nextString() {
try {
return br.readLine();
} catch (IOException e) {
eof = true;
return null;
}
}
int nextInt() throws IOException {
return Integer.parseInt(nextToken());
}
long nextLong() throws IOException {
return Long.parseLong(nextToken());
}
double nextDouble() throws IOException {
return Double.parseDouble(nextToken());
}
} | constant | 267_A. Subtractions | CODEFORCES |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
public class Task267A {
public static void main(String... args) throws NumberFormatException,
IOException {
Solution.main(System.in, System.out);
}
static class Scanner {
private final BufferedReader br;
private String[] cache;
private int cacheIndex;
Scanner(InputStream is) {
br = new BufferedReader(new InputStreamReader(is));
cache = new String[0];
cacheIndex = 0;
}
int nextInt() throws IOException {
if (cacheIndex >= cache.length) {
cache = br.readLine().split(" ");
cacheIndex = 0;
}
return Integer.parseInt(cache[cacheIndex++]);
}
String next() throws IOException {
if (cacheIndex >= cache.length) {
cache = br.readLine().split(" ");
cacheIndex = 0;
}
return cache[cacheIndex++];
}
void close() throws IOException {
br.close();
}
}
static class Solution {
public static void main(InputStream is, OutputStream os)
throws NumberFormatException, IOException {
PrintWriter pw = new PrintWriter(os);
Scanner sc = new Scanner(is);
int n = sc.nextInt();
while (n-- > 0) {
int ai = sc.nextInt();
int bi = sc.nextInt();
int retVal = 0;
while (ai > 0 && bi > 0) {
if (ai > bi) {
retVal += ai / bi;
ai = ai % bi;
} else {
retVal += bi / ai;
bi = bi % ai;
}
}
pw.println(retVal);
}
pw.flush();
sc.close();
}
}
} | constant | 267_A. Subtractions | CODEFORCES |
import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int a, b, min, max, result = 0, temp;
while(n-->0){
a = sc.nextInt();
b = sc.nextInt();
max = Math.max(a, b);
min = Math.min(a, b);
result = 0;
while(true){
result += max/min;
if(max%min == 0){
System.out.println(result);
break;
}
/* take the min and the remainder as the previous min. */
temp = max;
max = min;
min = temp%min;
}
}
sc.close();
}
} | constant | 267_A. Subtractions | CODEFORCES |
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException{
Scanner cin = new Scanner(System.in);
int t, n, m;
t = cin.nextInt();
while(t > 0) {
t--;
int sum = 0;
n = cin.nextInt();
m = cin.nextInt();
while(n > 0 && m > 0) {
if(n < m) {
int k = n;
n = m;
m = k;
}
sum += n / m; n %= m;
}
System.out.println(sum);
}
}
}
| constant | 267_A. Subtractions | CODEFORCES |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Subtractions {
public static void main(String[] args) {
InputReader r = new InputReader(System.in);
int n = r.nextInt();
while (n-- > 0) {
int a = r.nextInt();
int b = r.nextInt();
int res = 0;
while (a > 0 && b > 0) {
if (a > b) {
int div = a / b;
a -= div * b;
res += div;
} else {
int div = b / a;
b -= div * a;
res += div;
}
}
System.out.println(res);
}
}
static class InputReader {
private BufferedReader reader;
private StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream));
tokenizer = null;
}
public String nextLine() {
try {
return reader.readLine();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return 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());
}
public long nextLong() {
return Long.parseLong(next());
}
}
}
| constant | 267_A. Subtractions | CODEFORCES |
import java.util.*;
import java.io.*;
public class Solution {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
s.nextLine();
while(s.hasNext()) {
int first = s.nextInt();
int second = s.nextInt();
System.out.println(calculate(first,second));
}
}
public static int calculate(int first, int second) {
int operations = 0;
while(first != 0 && second != 0) {
int temp;
if(first < second) {
temp = second/first;
operations += temp;
second -= (first*temp);
}
else {
temp = first/second;
operations += temp;
first -= (second*temp);
}
}
return operations;
}
} | constant | 267_A. Subtractions | CODEFORCES |
import java.util.Arrays;
import java.util.Scanner;
public class ATestingRound5 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int T = in.nextInt();
while(T --> 0) {
int a = in.nextInt();
int b = in.nextInt();
int count = 0;
int[] arr = {a, b};
Arrays.sort(arr);
while(arr[0] != 0) {
count += arr[1] / arr[0];
arr[1] = arr[1] % arr[0];
Arrays.sort(arr);
}
System.out.println(count);
}
in.close();
}
}
/*
2
4 17
7 987654321
outputCopy
8
141093479
*/ | constant | 267_A. Subtractions | 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.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Rb_wahid
*/
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);
ASubtractions solver = new ASubtractions();
solver.solve(1, in, out);
out.close();
}
static class ASubtractions {
int sub(int a, int b) {
if (a % b == 0)
return a / b;
else return a / b + sub(b, a % b);
}
public void solve(int testNumber, InputReader in, OutputWriter out) {
int t = in.nextInt();
int a, b;
while (t-- > 0) {
a = in.nextInt();
b = in.nextInt();
out.println(sub(a, b));
}
}
}
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 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 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);
}
}
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(int i) {
writer.println(i);
}
}
}
| constant | 267_A. Subtractions | CODEFORCES |
import java.util.Scanner;
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
while (n-- > 0) {
int a = in.nextInt();
int b = in.nextInt();
int k = 0;
while (a != 0 && b != 0) {
if (a > b) {
int t = a / b;
k += t;
a = a - b * t;
} else {
int t = b / a;
k += t;
b = b - a * t;
}
}
System.out.println(k);
}
}
}
| constant | 267_A. Subtractions | CODEFORCES |
/*package whatever //do not write package name here */
import java.io.*;
import java.util.*;
public class S {
public static void main (String[] args) {
Scanner in=new Scanner(System.in);
int t=in.nextInt();
while(t--!=0)
{
int a=in.nextInt();
int b=in.nextInt();
int min=Math.min(a,b);
int max=Math.max(a,b);
int res=0;
while(min!=0)
{
res=res+max/min;
int temp=min;
min=max%min;
max=temp;
}
System.out.println(res);
}
}
} | constant | 267_A. Subtractions | CODEFORCES |
/*Talent is something you make bloom , instinct is something you polish*/
import java.io.*;
import java.math.*;
import java.util.*;
public class Main
{
static long mod=((long)1e9)+7;//toString
public static int gcd(int a,int b){if(b==0)return a;else return gcd(b,a%b);}
public static long pow_mod(long x,long y){long res=1;x=x%mod;while(y > 0){if((y & 1)==1)res=(res * x)%mod;y=y>>1;x =(x * x)%mod;}return res;}
public static int lower_bound(int[]arr,int val){int lo=0;int hi=arr.length-1;while(lo<hi){int mid=lo+((hi-lo+1)/2);if(arr[mid]==val){return mid;}else if(arr[mid]>val){hi=mid-1;}else lo=mid;}if(arr[lo]<=val)return lo;else return -1;}
public static int upper_bound(int[]arr,int val){int lo=0;int hi=arr.length-1;while(lo<hi){int mid=lo+((hi-lo)/2);if(arr[mid]==val){return mid;}else if(arr[mid]>val){hi=mid;;}else lo=mid+1;}if(arr[lo]>=val)return lo;else return -1;}
public static void main (String[] args) throws java.lang.Exception
{
Reader sn = new Reader();
Print p = new Print();
int n = sn.nextInt();
while((n--) > 0){
int a = sn.nextInt();
int b = sn.nextInt();
int small = Math.min(a , b);
int large = Math.max(a , b);
long steps = 0;
while(small != 0){
steps += (long)(large/small);
int large1 = small;
small = large % small;
large = large1;
}
p.printLine(Long.toString(steps));
}
p.close();
}
}
class Pair implements Comparable<Pair> {
int val;
int in;
Pair(int a, int b){
val=a;
in=b;
}
@Override
public int compareTo(Pair o) {
if(val==o.val)
return Integer.compare(in,o.in);
else
return Integer.compare(val,o.val);
}}
class Reader
{
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;
private int bufferPointer, bytesRead;
public boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }
public Reader()
{
din = new DataInputStream(System.in);
buffer = new byte[BUFFER_SIZE];
bufferPointer = bytesRead = 0;
}
public Reader(String file_name) throws IOException
{
din = new DataInputStream(new FileInputStream(file_name));
buffer = new byte[BUFFER_SIZE];
bufferPointer = bytesRead = 0;
}
public String readLine() throws IOException
{
byte[] buf = new byte[64]; // line length
int cnt = 0, c;
while ((c = read()) != -1)
{
if (c == '\n')
break;
buf[cnt++] = (byte) c;
}
return new String(buf, 0, cnt);
}
public String readWord()throws IOException
{
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 int nextInt() throws IOException
{
int ret = 0;
byte c = read();
while (c <= ' ')
c = read();
boolean neg = (c == '-');
if (neg)
c = read();
do
{
ret = ret * 10 + c - '0';
} while ((c = read()) >= '0' && c <= '9');
if (neg)
return -ret;
return ret;
}
public long nextLong() throws IOException
{
long ret = 0;
byte c = read();
while (c <= ' ')
c = read();
boolean neg = (c == '-');
if (neg)
c = read();
do {
ret = ret * 10 + c - '0';
}
while ((c = read()) >= '0' && c <= '9');
if (neg)
return -ret;
return ret;
}
public double nextDouble() throws IOException
{
double ret = 0, div = 1;
byte c = read();
while (c <= ' ')
c = read();
boolean neg = (c == '-');
if (neg)
c = read();
do {
ret = ret * 10 + c - '0';
}
while ((c = read()) >= '0' && c <= '9');
if (c == '.')
{
while ((c = read()) >= '0' && c <= '9')
{
ret += (c - '0') / (div *= 10);
}
}
if (neg)
return -ret;
return ret;
}
private void fillBuffer() throws IOException
{
bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
if (bytesRead == -1)
buffer[0] = -1;
}
private byte read() throws IOException
{
if (bufferPointer == bytesRead)
fillBuffer();
return buffer[bufferPointer++];
}
public void close() throws IOException
{
if (din == null)
return;
din.close();
}
}
class Print
{
private final BufferedWriter bw;
public Print()
{
bw=new BufferedWriter(new OutputStreamWriter(System.out));
}
public void print(String str)throws IOException
{
bw.append(str);
}
public void printLine(String str)throws IOException
{
print(str);
bw.append("\n");
}
public void close()throws IOException
{
bw.close();
}} | constant | 267_A. Subtractions | CODEFORCES |
import java.util.*;
public class substraction {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while (t>0) {
long a=sc.nextLong();
long b=sc.nextLong();
int op=0;
if (a>b) {
while (a%b!=0) {
op+=a/b;
a=a%b;
long c=b;
b=a;
a=c;
}
op+=a/b;
}
else{
while (b%a!=0) {
op+=b/a;
b=b%a;
long c=a;
a=b;
b=c;
}
op+=b/a;
}
System.out.println(op);
t--;
}
}
}
| constant | 267_A. Subtractions | CODEFORCES |
import java.util.*;
public class Subtractions {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int tests = scan.nextInt();
while (tests > 0) {
tests--;
int first = scan.nextInt();
int second = scan.nextInt();
int count = 0;
while (first > 0 && second > 0) {
if (first < second) {
count += second / first;
second = second % first;
} else {
count += first / second;
first = first % second;
}
}
System.out.println(count);
}
}
}
| constant | 267_A. Subtractions | CODEFORCES |
import java.util.*;
public class subtractionn {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner(System.in);
int t;
t=in.nextInt();
while(t!=0)
{
int a=in.nextInt();
int b=in.nextInt();
int total=0,neww=0;
if(a%b==0)
{
System.out.println(a/b);
}
else if(b%a==0)
{
System.out.println(b/a);
}
else
{
while(a!=0 && b!=0)
{
if(a>b)
{
total=total+(a/b);
a=a%b;
if(a==0)
{
break;
}
}
else if(b>a)
{
total=total+(b/a);
b=b%a;
if(b==0)
{
break;
}
}
else
{
System.exit(0);
}
}
System.out.println(total);
}
t--;
}
}
} | constant | 267_A. Subtractions | 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.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author John Martin
*/
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);
ASubtractions solver = new ASubtractions();
solver.solve(1, in, out);
out.close();
}
static class ASubtractions {
public void solve(int testNumber, InputReader c, OutputWriter w) {
int tc = c.readInt();
while (tc-- > 0) {
int a = c.readInt(), b = c.readInt();
int op = 0;
while (a != b) {
if (a > b) {
int tm = b;
b = a;
a = tm;
}
int left = b - a;
int rem = (left - 1) / a + 1;
b -= rem * a;
op += rem;
}
op++;
w.printLine(op);
}
}
}
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(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 int readInt() {
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 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);
}
}
}
| constant | 267_A. Subtractions | CODEFORCES |
import java.io.*;
import java.util.*;
import java.lang.*;
public class file{
public static void main(String []args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
while(n-->0)
{
int a=sc.nextInt();
int b=sc.nextInt();
int ans=f(a,b);
System.out.println(ans);
}
}
public static int f(int a,int b)
{
if(a==0||b==0)
return 0;
if(a>b)
{
return a/b + f(b,a%b);
}
else
return b/a + f(a,b%a);
}
} | constant | 267_A. Subtractions | CODEFORCES |
import java.awt.*;
import java.awt.geom.*;
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
/*
br = new BufferedReader(new FileReader("input.txt"));
pw = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
br = new BufferedReader(new InputStreamReader(System.in));
pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
*/
public class Main {
private static BufferedReader br;
private static StringTokenizer st;
private static PrintWriter pw;
public static void main(String[] args) throws IOException {
br = new BufferedReader(new InputStreamReader(System.in));
pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
int qq = readInt();
while(qq-- > 0) {
pw.println(solve(readInt(), readInt()));
}
pw.close();
}
public static int solve(int a, int b) {
if(a < b) {
return solve(b,a);
}
if(a%b == 0) {
return a / b;
}
return a/b + solve(b,a%b);
}
/* NOTEBOOK CODE */
private static long readLong() throws IOException {
return Long.parseLong(nextToken());
}
private static double readDouble() throws IOException {
return Double.parseDouble(nextToken());
}
private static int readInt() throws IOException {
return Integer.parseInt(nextToken());
}
private static String nextToken() throws IOException {
while(st == null || !st.hasMoreTokens()) {
if(!br.ready()) {
pw.close();
System.exit(0);
}
st = new StringTokenizer(br.readLine().trim());
}
return st.nextToken();
}
} | constant | 267_A. Subtractions | CODEFORCES |
import java.util.Scanner;
public class subtractions {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
while(n-->0){
int a=sc.nextInt();
int b=sc.nextInt();
int c=0;
while(a!=0 && b!=0){
if(a>b){
int t=a;
a=b;
b=t;
}
c+=b/a;
b=b%a;
}
System.out.println(c);
}
}
}
| constant | 267_A. Subtractions | 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());
} catch (Exception e) {
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
public void run() throws Exception {
//in = new BufferedReader(new FileReader("input.txt"));
//out = new PrintWriter(new FileWriter("output.txt"));
in = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter(System.out);
solve();
out.flush();
out.close();
in.close();
}
public int sub(int a, int b) {
int res = 0;
while (b > 0) {
res += a / b;
int m = a % b;
a = b;
b = m;
}
return res;
}
public void solve() throws Exception {
int n = nextInt();
while (n-- > 0) {
out.println(sub(nextInt(), nextInt()));
}
}
public static void main(String[] args) throws Exception {
new Template().run();
}
}
| constant | 267_A. Subtractions | CODEFORCES |
import java.io.*;
import java.util.*;
public final class Subtractions
{
public static void main(String[] args)
{
InputReader in = new InputReader(System.in);
PrintWriter out = new PrintWriter(System.out);
Solver solver = new Solver(in, out);
solver.solve();
in.close();
out.flush();
out.close();
}
static class Solver
{
int n;
InputReader in;
PrintWriter out;
void solve()
{
n = in.nextInt();
while (n-- > 0)
{
int a, b;
a = in.nextInt();
b = in.nextInt();
int cnt = 0;
while (a > 0 && b > 0)
{
if (a < b)
a = swap(b, b = a);
cnt += a / b;
a -= b * (a / b);
}
out.println(cnt);
}
}
int swap(int a, int b)
{
return a;
}
public Solver(InputReader in, PrintWriter out)
{
this.in = in;
this.out = out;
}
}
static class InputReader
{
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
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 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 & 15;
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
public boolean isSpaceChar(int c)
{
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
public void close()
{
try
{
stream.close();
} catch (IOException e)
{
e.printStackTrace();
}
}
}
}
| constant | 267_A. Subtractions | CODEFORCES |
import java.io.*;
import java.util.*;
public final class subtractions
{
static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
static FastScanner sc=new FastScanner(br);
static PrintWriter out=new PrintWriter(System.out);
static long solve(long a,long b)
{
if(a<=0 || b<=0)
{
return 0;
}
else
{
long max=Math.max(a,b),min=Math.min(a,b);
long low=1,high=(long)(1e9);
while(low<high)
{
long mid=(low+high)>>1,val=(min*mid),curr=max-val;
if(curr<min)
{
high=mid;
}
else
{
low=mid+1;
}
}
return low+solve(min,max-(low*min));
}
}
public static void main(String args[]) throws Exception
{
int t=sc.nextInt();
while(t>0)
{
long a=sc.nextLong(),b=sc.nextLong();
out.println(solve(a,b));
t--;
}
out.close();
}
}
class FastScanner
{
BufferedReader in;
StringTokenizer st;
public FastScanner(BufferedReader in) {
this.in = in;
}
public String nextToken() throws Exception {
while (st == null || !st.hasMoreTokens()) {
st = new StringTokenizer(in.readLine());
}
return st.nextToken();
}
public String next() throws Exception {
return nextToken().toString();
}
public int nextInt() throws Exception {
return Integer.parseInt(nextToken());
}
public long nextLong() throws Exception {
return Long.parseLong(nextToken());
}
public double nextDouble() throws Exception {
return Double.parseDouble(nextToken());
}
} | constant | 267_A. Subtractions | CODEFORCES |
import java.util.*;
public class Main
{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
while(n-->0){
long a=sc.nextLong(),b=sc.nextLong();
long ans=0,cur=0;
while(a>0 && b>0){
if(b>a)a=a+b-(b=a);
cur=(a/b);
ans+=cur;
a-=(cur*b);
}
System.out.println(ans);
}
}
}
| constant | 267_A. Subtractions | CODEFORCES |
import java.util.Scanner;
public class Subtractions {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int numberOfTests = scanner.nextInt();
while (numberOfTests-- > 0) {
int a = scanner.nextInt();
int b = scanner.nextInt();
int[] res = new int[1];
compute(a, b, res);
System.out.println(res[0]);
}
}
private static void compute(int x, int y, int[] res) {
if (x == 0 || y == 0) {
return;
}
int tmp;
if (x < y) {
tmp = x;
x = y;
y = tmp;
}
res[0] += x / y;
tmp = x % y;
if (tmp == 0) {
return;
}
x = y;
y = tmp;
compute(x, y, res);
}
}
| constant | 267_A. Subtractions | CODEFORCES |
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());
}
}
} | constant | 1036_A. Function Height | CODEFORCES |
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;
}
}
} | constant | 1036_A. Function Height | CODEFORCES |
import java.util.Scanner;
public class A {
static long l, r, A, B, C;
static long GCD(long a, long b) {
if (b == 0)
return a;
return GCD(b, a % b);
}
static boolean gcd(long a, long b) {
return GCD(a, b) == 1;
}
static boolean found(long a, long b, long c) {
if (b <= a || c <= b)
return false;
if (a > r || b > r || c > r)
return false;
if (gcd(a, b) && gcd(b, c) && !gcd(a, c)) {
A = a;
B = b;
C = c;
return true;
}
if (found(a + 1, b + 1, c + 1))
return true;
if (found(a + 1, b, c + 1))
return true;
if (found(a + 1, b + 1, c))
return true;
if (found(a, b, c + 1))
return true;
if (found(a, b + 1, c + 1))
return true;
if (found(a, b + 1, c))
return true;
return found(a + 1, b, c);
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
l = sc.nextLong();
r = sc.nextLong();
if (found(l, l + 1, l + 2))
System.out.println(A + " " + B + " " + C);
else
System.out.println(-1);
}
}
| constant | 483_A. Counterexample | CODEFORCES |
import java.util.Scanner;
public class BB {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
long a=sc.nextLong();
long b=sc.nextLong();
if(b-a>(long)2){
if(a%(long)2==0){
System.out.print(a+" "+(a+1)+" "+(a+2));
return;
}else{
System.out.print(a+1+" "+(a+2)+" "+(a+3));
return;
}
}else{
if(b-a<=(long)1){
System.out.println(-1);
return;
}
if(b-a==(long)2){
if(a%(long)2==0){
System.out.print(a+" "+(a+1)+" "+(a+2));
return;
}else{
System.out.print(-1);
return;
}
}
}
}
}
| constant | 483_A. Counterexample | CODEFORCES |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
/**
* Created by Egor on 24/10/14.
*/
public class TaskA {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
PrintWriter writer = new PrintWriter(System.out);
String[] input = reader.readLine().split(" ");
long l = Long.parseLong(input[0]);
long r = Long.parseLong(input[1]);
if (l % 2 == 0) {
if (r >= l + 2) {
writer.println(l + " " + (l + 1) + " " + (l + 2));
} else {
writer.println(-1);
}
} else {
if (r >= l + 3) {
writer.println((l + 1) + " " + (l + 2) + " " + (l + 3));
} else {
writer.println(-1);
}
}
writer.close();
}
}
| constant | 483_A. Counterexample | CODEFORCES |
import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
long l = in.nextLong();
long r = in.nextLong();
if(r-l < 2 ){
System.out.println("-1");
}
else if(r-l == 2 && l %2 ==1){
System.out.println("-1");
}
else{
if(l%2 == 0){
System.out.println(l+ " "+(l+1)+" "+(l+2));
}
else{
System.out.println((l+1)+ " "+(l+2)+" "+(l+3));
}
}
}
}
| constant | 483_A. Counterexample | CODEFORCES |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class CodeForce275A {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer token = new StringTokenizer(in.readLine());
long l = Long.parseLong(token.nextToken());
long r = Long.parseLong(token.nextToken());
if(r-l<2) {
System.out.println(-1);
return;
}
if(l%2==1&&r-l<3) {
System.out.println(-1);
return;
}
if(l%2==0) {
System.out.println(l+" "+(l+1)+" "+(l+2));
return;
}
if(l%2==1) {
System.out.println((l+1)+" "+(l+2)+" "+(l+3));
}
}
} | constant | 483_A. Counterexample | CODEFORCES |
import java.io.*;
import java.util.*;
import java.math.*;
public class p481a {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long l = sc.nextLong();
long r = sc.nextLong();
if (r - l <= 1) {
System.out.println("-1");
} else if (r - l >= 3) {
if (l % 2 == 0) {
System.out.println(l + " " + (l + 1) + " " + (l + 2));
} else {
System.out.println((l + 1) + " " + (l + 2) + " " + (l + 3));
}
} else {
long g1 = GCD(l, (l + 1));
long g2 = GCD((l + 1), (l + 2));
long g3 = GCD(l, r);
if (g1 == 1 && g2 == 1 && g3 != 1) {
System.out.println(l + " " + (l + 1) + " " + r);
} else {
System.out.println("-1");
}
}
}
public static long GCD(long a, long b) {
if (b == 0) return a;
return GCD(b, a % b);
}
} | constant | 483_A. Counterexample | CODEFORCES |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.TreeSet;
/**
*
* @author таня
*/
public class KF {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException {
B jk = new B();
}
}
class B {
PrintWriter out = new PrintWriter(System.out);
Scanner in = new Scanner(System.in);
long l = in.nextLong();
long r=in.nextLong();
B(){
if(Math.abs(r-l)>=2){
if(l%2==0){
out.print(l+" "+(l+1)+" "+(l+2));
}
else{
if(Math.abs(r-l)==2){
out.print("-1");
}else{
out.print((l+1)+" "+(l+2)+" "+(l+3));
}
}
}else{
out.print("-1");
}
out.flush();
}
}
| constant | 483_A. Counterexample | CODEFORCES |
import java.io.*;
import java.util.*;
public class A{
public static BufferedReader k;
public static BufferedWriter z;
public static void main(String [] args)throws IOException{
k = new BufferedReader(new InputStreamReader(System.in));
z = new BufferedWriter(new OutputStreamWriter(System.out));
String[] dat = k.readLine().split(" ");
long l = Long.parseLong(dat[0]);
long r = Long.parseLong(dat[1]);
if(r-l<=1){
z.write(-1+"\n");
}
else if(r-l == 2){
if((l&1)!=0){
z.write(-1+"\n");
}
else{
z.write(l+" "+(l+1)+" "+r+"\n");
}
}
else{
if((l&1)==0){
z.write(l+" "+(l+1)+" "+(l+2)+"\n");
}
else{
z.write((l+1)+" "+(l+2)+" "+(l+3)+"\n");
}
}
z.flush();
}
} | constant | 483_A. Counterexample | CODEFORCES |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.PriorityQueue;
public class a {
public static class Pair implements Comparable<Pair> {
int f, s;
public Pair(int f, int s) {
this.f = f;
this.s = s;
}
@Override
public int compareTo(Pair o) {
return s - o.s;
}
};
public static void main(String[] args) throws IOException {
PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String s[] = in.readLine().split(" ");
long r = Long.parseLong(s[0]);
long l = Long.parseLong(s[1]);
if (r % 2 == 0) {
if (l - r+1 < 3) {
out.println(-1);
} else {
out.println(r + " " + (r + 1) + " " + (r + 2));
}
} else {
if (l - r+1 < 4) {
out.println(-1);
} else {
out.println((r + 1) + " " + (r + 2) + " " + (r + 3));
}
}
out.close();
}
} | constant | 483_A. Counterexample | CODEFORCES |
import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
public static class pair implements Comparable<pair>
{
int a;
int b;
public pair(int pa, int pb)
{
a = pa; b= pb;
}
@Override
public int compareTo(pair o) {
if(this.a < o.a)
return -1;
if(this.a > o.a)
return 1;
return Integer.compare(o.b, this.b);
}
}
//int n = Integer.parseInt(in.readLine());
//int n = Integer.parseInt(spl[0]);
//String[] spl = in.readLine().split(" ");
public static void main (String[] args) throws Exception
{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String[] spl = in.readLine().split(" ");
long l = Long.parseLong(spl[0]);
long r = Long.parseLong(spl[1]);
if(l+2 <= r && l%2==0)
{
System.out.println(l+" "+(l+1)+" "+(l+2));
}
else if(l+3<=r && (l+1)%2==0)
{
System.out.println((l+1)+" "+(l+2)+" "+(l+3));
}
else System.out.println(-1);
}
} | constant | 483_A. Counterexample | CODEFORCES |
import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class Task483A {
public static void main(String... args) throws NumberFormatException,
IOException {
Solution.main(System.in, System.out);
}
static class Scanner {
private final BufferedReader br;
private String[] cache;
private int cacheIndex;
Scanner(InputStream is) {
br = new BufferedReader(new InputStreamReader(is));
cache = new String[0];
cacheIndex = 0;
}
int nextInt() throws IOException {
if (cacheIndex >= cache.length) {
cache = br.readLine().split(" ");
cacheIndex = 0;
}
return Integer.parseInt(cache[cacheIndex++]);
}
long nextLong() throws IOException {
if (cacheIndex >= cache.length) {
cache = br.readLine().split(" ");
cacheIndex = 0;
}
return Long.parseLong(cache[cacheIndex++]);
}
String next() throws IOException {
if (cacheIndex >= cache.length) {
cache = br.readLine().split(" ");
cacheIndex = 0;
}
return cache[cacheIndex++];
}
void close() throws IOException {
br.close();
}
}
static class Solution {
public static void main(InputStream is, OutputStream os)
throws NumberFormatException, IOException {
PrintWriter pw = new PrintWriter(os);
Scanner sc = new Scanner(is);
long l = sc.nextLong();
long r = sc.nextLong();
long interval = r-l;
if(interval == 0 || interval == 1 || (interval == 2 && l % 2 ==1 )){
pw.println(-1);
} else {
if(l % 2 == 1){
l++;
}
pw.print(l);
pw.print(" ");
pw.print(l+1);
pw.print(" ");
pw.print(l+2);
}
pw.flush();
sc.close();
}
}
} | constant | 483_A. Counterexample | CODEFORCES |
import java.awt.Point;
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import static java.lang.Math.*;
public class A483 implements Runnable {
BufferedReader in;
PrintWriter out;
StringTokenizer tok = new StringTokenizer("");
public static void main(String[] args) {
new Thread(null, new A483(), "", 256 * (1L << 20)).start();
}
public void run() {
try {
long t1 = System.currentTimeMillis();
if (System.getProperty("ONLINE_JUDGE") != null) {
in = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter(System.out);
} else {
in = new BufferedReader(new FileReader("input.txt"));
out = new PrintWriter(System.out);
}
Locale.setDefault(Locale.US);
solve();
in.close();
out.close();
long t2 = System.currentTimeMillis();
System.err.println("Time = " + (t2 - t1));
} catch (Throwable t) {
t.printStackTrace(System.err);
System.exit(-1);
}
}
String readString() throws IOException {
while (!tok.hasMoreTokens()) {
tok = new StringTokenizer(in.readLine());
}
return tok.nextToken();
}
int readInt() throws IOException {
return Integer.parseInt(readString());
}
long readLong() throws IOException {
return Long.parseLong(readString());
}
double readDouble() throws IOException {
return Double.parseDouble(readString());
}
// solution
int choose(int total, int choose){
if(total < choose)
return 0;
if(choose == 0 || choose == total)
return 1;
return choose(total-1,choose-1)+choose(total-1,choose);
}
void solve() throws IOException {
long l = readLong();
long r = readLong();
if(r-l>=3){
long c = l%2==0?l:l+1;
out.println(c+" "+(c+1)+" "+ (c+2));
}else if(r-l==2&&r%2==0){
out.println(l+" "+(l+1)+" "+(l+2));
}else{
out.println(-1);
}
}
}
| constant | 483_A. Counterexample | CODEFORCES |
import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner sc =new Scanner (System.in);
long a=sc.nextLong(); long b=sc.nextLong();
if(b-a <=1)
System.out.println("-1");
else if(b-a==2 && a%2==1)
System.out.println("-1");
else
{
if(a%2==1)
System.out.println((a+1)+" "+(a+2)+" "+(a+3));
else
System.out.println((a)+" "+(a+1)+" "+(a+2));
}
sc.close();
}
}
| constant | 483_A. Counterexample | CODEFORCES |
/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc = new Scanner(System.in);
long l= sc.nextLong();
long r = sc.nextLong();
if(l%2==0){
if(r>=l+2){
System.out.println(l + " " + (l+1) + " " + (l+2));
}
else{
System.out.println(-1);
}
}
else{
if(r>=l+3){
System.out.println((l+1) + " " + (l+2) + " " + (l+3));
}
else{
System.out.println(-1);
}
}
}
} | constant | 483_A. Counterexample | CODEFORCES |
import java.math.BigInteger;
import java.util.Scanner;
/*
* 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.
*/
/**
*
* @author Sagimbekov_MA
*/
public class A483 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
BigInteger l = sc.nextBigInteger();
BigInteger r = sc.nextBigInteger();
if (r.subtract(l).compareTo(new BigInteger("2")) == -1) {
System.out.println("-1");
} else if (r.subtract(l).compareTo(new BigInteger("2")) == 0 && l.mod(new BigInteger("2")) != BigInteger.ZERO) {
System.out.println("-1");
} else if (l.mod(new BigInteger("2")) != BigInteger.ZERO) {
System.out.println(l.add(BigInteger.ONE) + " " + l.add(BigInteger.ONE).add(BigInteger.ONE) + " " + l.add(BigInteger.ONE).add(BigInteger.ONE).add(BigInteger.ONE));
} else {
System.out.println(l + " " + l.add(BigInteger.ONE) + " " + l.add(BigInteger.ONE).add(BigInteger.ONE));
}
}
}
| constant | 483_A. Counterexample | CODEFORCES |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.StringTokenizer;
public class problemA {
public static long GCD(long number1, long number2) {
//base case
if(number2 == 0){
return number1;
}
return GCD(number2, number1%number2);
}
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
long b = Long.parseLong(st.nextToken());
long c = Long.parseLong(st.nextToken());
if(c-b<2 ||((c-b==2)&& GCD(c,b)==1) ){
System.out.println("-1");
}else{
if(b%2==0 ){
System.out.println(b+" "+(b+1)+" "+(b+2));
}else
System.out.println((b+1)+" "+(b+2)+" "+(b+3));
}
}
}
| constant | 483_A. Counterexample | CODEFORCES |
import java.io.*;
import java.math.BigInteger;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
try {
String[] str = reader.readLine().split(" ");
BigInteger b1 = new BigInteger(str[0]);
BigInteger b2 = new BigInteger(str[1]);
if(b2.subtract(b1).compareTo(new BigInteger("1"))<1){
System.out.println(-1);
return;
}
if(b2.subtract(b1).compareTo(new BigInteger("2"))==0){
BigInteger b = b1.add(new BigInteger("1"));
BigInteger c = b1.add(new BigInteger("2"));
if(!b1.gcd(c).equals(new BigInteger("1"))){
System.out.println(b1.toString()+" "+b.toString()+" "+c.toString());
}else{
System.out.println(-1);
}
return;
}
BigInteger b = b1.add(new BigInteger("1"));
BigInteger c = b1.add(new BigInteger("2"));
BigInteger d = b1.add(new BigInteger("3"));
if(b1.remainder(new BigInteger("2")).equals(new BigInteger("1"))){
System.out.println(b.toString()+" "+c.toString()+" "+d.toString());
}else{
System.out.println(b1.toString()+" "+b.toString()+" "+c.toString());
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| constant | 483_A. Counterexample | CODEFORCES |
import java.util.Scanner;
public class dwl {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String[] lr = sc.nextLine().split(" ");
long l = Long.valueOf(lr[0]);
long r = Long.valueOf(lr[1]);
if (r - l <= 1 || (l == 1 && (r - l) == 2)
|| (l % 2 != 0 && (r - l) < 3))
System.out.println(-1);
else {
if (l == 1)
System.out.println(2 + " " + 3 + " " + 4);
else {
if (l % 2 == 0) {
String res = "";
res += l + " ";
res += (l + 1) + " ";
res += (l + 2) + " ";
res = res.trim();
System.out.println(res);
} else {
String res = "";
res += (l + 1) + " ";
res += (l + 2) + " ";
res += (l + 3) + " ";
res = res.trim();
System.out.println(res);
}
}
}
}
}
| constant | 483_A. Counterexample | CODEFORCES |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;
import java.util.StringTokenizer;
public class A {
public static void main(String[] args) {
InputScanner scanner = new InputScanner();
try {
long l = scanner.nextLong();
long r = scanner.nextLong();
if ((r - l) < 2) {
System.out.println("-1");
return;
}
if (l % 2 == 0) {
long a = l;
long b = l + 1;
long c = l + 2;
System.out.println(a + " " + b + " " + c);
} else if (r%2==0){
long a = r;
long b = r-1;
long c = r-2;
System.out.println(c + " " + b + " " + a);
} else {
l++;
if ((r - l) < 2) {
System.out.println("-1");
return;
}
long a = l;
long b = l + 1;
long c = l + 2;
System.out.println(a + " " + b + " " + c);
}
} catch (IOException e) {
}
}
static class InputScanner {
BufferedReader br;
StringTokenizer st;
public InputScanner() {
br = new BufferedReader(new InputStreamReader(System.in));
}
public String next() throws IOException {
if (st == null || !st.hasMoreTokens()) {
String line = br.readLine();
st = new StringTokenizer(line);
}
return st.nextToken();
}
public int nextInt() throws IOException {
String next = next();
next.length();
return Integer.parseInt(next);
}
public long nextLong() throws IOException {
String next = next();
next.length();
return Long.parseLong(next);
}
}
}
| constant | 483_A. Counterexample | CODEFORCES |
import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long l = sc.nextLong(), r = sc.nextLong();
if (l % 2 == 0 && r - l >= 2) {
System.out.println(l + " " + (l + 1) + " " + (l + 2));
} else if (l % 2 == 1 && r - l >= 3) {
System.out.println(l + 1 + " " + (l + 2) + " " + (l + 3));
} else {
System.out.println(-1);
}
}
}
| constant | 483_A. Counterexample | CODEFORCES |
import java.util.Scanner;
public final class b1 {
public static void main(String[] args) {
Scanner datain = new Scanner(System.in);
long l=datain.nextLong();
long r=datain.nextLong();
if(r-l<2){System.out.print(-1);}else{
if(((r-l)==2)&&(l%2==1)){System.out.print(-1);}else{
if((l%2)==0){System.out.print(""+l+" "+(l+1)+" "+(l+2));}else{
System.out.print(""+(l+1)+" "+(l+2)+" "+(l+3));
}
}
}
}
}
| constant | 483_A. Counterexample | CODEFORCES |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.StringTokenizer;
public class C {
/**
* @param args
*/
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer tokenizer= new StringTokenizer(br.readLine());
BigInteger left = new BigInteger(tokenizer.nextToken());
BigInteger right= new BigInteger(tokenizer.nextToken());
BigInteger val= (right.subtract(left)).add(new BigInteger(""+1));
if(val.intValue()<3){
System.out.println(-1);
return;
}
BigInteger a, b, c;
BigInteger i=left;
while(i.intValue()<=right.intValue()){
BigInteger temp1=i; //a
BigInteger temp2= i.add(new BigInteger(""+1));//b
BigInteger j=temp2.add(new BigInteger(""+1));
while(j.intValue()<=right.intValue()){
BigInteger b1= temp2;
BigInteger b2 =j;
BigInteger b3 = temp1;
BigInteger gcd= b1.gcd(b2);
if(gcd.intValue()==1){
BigInteger gcd2 =b2.gcd(b3);
if(gcd2.intValue() !=1){
a=b3;
b= b1;
c= b2;
System.out.print(a+" "+b+" "+c+" ");
System.out.println();
return ;
}
}
j=j.add(new BigInteger(""+1));
}
i=i.add(new BigInteger(""+1));
}
System.out.println(-1);
}
}
| constant | 483_A. Counterexample | CODEFORCES |
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
Scanner t=new Scanner(System.in);
long l=t.nextLong();
long r=t.nextLong();
if(r-l<2) System.out.println(-1);
else if(r-l<3 && l%2!=0){
if(l%3!=0) System.out.println(-1);
else if ((l+3)%2==0) System.out.println(-1);
else System.out.println(l+" "+(l+1)+" "+(l+3));
} else{
while (l%2!=0) l++;
System.out.println(l+" "+(l+1)+" "+(l+2));
}
}
} | constant | 483_A. Counterexample | CODEFORCES |
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Locale;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
import java.util.StringTokenizer;
public class A {
static String file = "";
static BufferedReader br;
static PrintWriter pw;
static StringTokenizer st;
public static void main(String[] args) throws NumberFormatException,
IOException {
Locale.setDefault(Locale.US);
br = new BufferedReader(new InputStreamReader(System.in));
pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(
System.out)));
long a = nextLong();
long b = nextLong();
if (a % 2 == 1 && b - a == 2 || b - a == 1 || a == b) {
pw.print(-1);
} else {
if (a % 2 == 1)
a++;
pw.print(a + " " + (a + 1) + " " + (a + 2));
}
pw.close();
}
private static double yuza(double x1, double y1, double x2, double y2,
double x3, double y3) {
return (x1 * (y3 - y2) + x2 * (y1 - y3) + x3 * (y2 - y1));
}
private static void ffile() throws IOException {
br = new BufferedReader(new FileReader(file + "in"));
pw = new PrintWriter(new BufferedWriter(new FileWriter(file + "out")));
}
private static int nextInt() throws NumberFormatException, IOException {
return Integer.parseInt(next());
}
private static long nextLong() throws NumberFormatException, IOException {
return Long.parseLong(next());
}
private static double nextDouble() throws NumberFormatException,
IOException {
return Double.parseDouble(next());
}
private static String next() throws IOException {
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return st.nextToken();
}
}
| constant | 483_A. Counterexample | 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
*/
public class Main {
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 solver = new TaskA();
solver.solve(1, in, out);
out.close();
}
}
class TaskA {
public void solve(int testNumber, InputReader in, PrintWriter out) {
long l = in.nextLong();
long r = in.nextLong();
int max = (int) (r - l);
if (max >= 2) {
if ((l & 1) == 0) {
out.println(l + " " + (l + 1) + " " + (l + 2));
return;
} else {
if (max >= 3) {
out.println((l + 1) + " " + (l + 2) + " " + (l + 3));
return;
}
}
}
out.println(-1);
}
}
class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream), 32768);
tokenizer = null;
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());
}
}
| constant | 483_A. Counterexample | CODEFORCES |
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.concurrent.LinkedBlockingDeque;
import javax.swing.border.Border;
public class a {
public static long mod = (long) Math.pow(10, 9) + 7;
private static class node implements Comparable<node> {
int x;
int y;
node(int x, int c) {
this.x = x;
this.y = c;
}
@Override
public int compareTo(node o) {
if (o.x < x)
return 1;
else if (o.x > x)
return -1;
else if (o.y < y)
return 1;
else if (o.y > y)
return -1;
else
return 0;
}
}
public static long gcd(long a, long b) {
if (b == 0)
return a;
else
return gcd(b, a % b);
}
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder qq = new StringBuilder();
PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
// int n = Integer.parseInt(in.readLine());
String y[] = in.readLine().split(" ");
long n = Long.parseLong(y[0]);
long m = Long.parseLong(y[1]);
if (m - n < 2) {
System.out.println(-1);
} else if (m - n == 2) {
if (gcd(n, m) != 1)
System.out.println(n + " " + (n + 1) + " " + (n + 2));
else
System.out.println(-1);
} else {
if (n % 2 == 0)
System.out.println(n + " " + (n + 1) + " " + (n + 2));
else
System.out.println((n + 1) + " " + (n + 2) + " " + (n + 3));
}
out.close();
}
} | constant | 483_A. Counterexample | CODEFORCES |
import java.io.*;
import java.util.*;
public class Main
{
public static void main(String args[]) throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String x[]=br.readLine().split(" ");
long l=Long.parseLong(x[0]);
long r=Long.parseLong(x[1]);
if(l%2!=0)
{
l++;
}
if(l+2>r)
{
System.out.println("-1");
}
else
{
System.out.println(l+" "+(l+1)+" "+(l+2));
}
}
} | constant | 483_A. Counterexample | CODEFORCES |
import java.util.*;
import java.math.*;
import java.io.PrintStream;
import static java.lang.Math.*;
public class Task275A {
public static Scanner in = new Scanner(System.in);
public static PrintStream out = System.out;
public static void main(String[] args) {
long l = in.nextLong();
long r = in.nextLong();
if (l % 2 == 1) {
l++;
}
if (r - l < 2) {
out.print(-1);
}
else {
out.print(l + " " + (l + 1) + " " + (l + 2));
}
}
} | constant | 483_A. Counterexample | CODEFORCES |
import java.util.Scanner;
public class Counterexample {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc= new Scanner(System.in);
long l=sc.nextLong(),r=sc.nextLong();
if (l%2==0&&r-l>=2) System.out.print(l+" "+(l+1)+" "+(l+2));
else if (l%2==1&&r-l>=3) System.out.print((l+1)+" "+(l+2)+" "+(l+3));
else System.out.print("-1");
}
}
| constant | 483_A. Counterexample | CODEFORCES |
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc =new Scanner(System.in);
long r,l;
r = sc.nextLong();
l = sc.nextLong();
if ((r+2)>l) { System.out.print("-1"); return;}
if ((r % 2) == 0) {
System.out.print(r);
System.out.print(" ");
System.out.print(r+1);
System.out.print(" ");
System.out.print(r+2);return; }
if((r+3)<=l )
{ System.out.print(r+1);
System.out.print(" ");
System.out.print(r+2);
System.out.print(" ");
System.out.print(r+3);return; }
System.out.print("-1");
}
}
| constant | 483_A. Counterexample | 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.util.StringTokenizer;
import static java.lang.Math.*;
import static java.util.Arrays.*;
public class Main {
public static void main(String[] args) throws IOException {
new Main().run();
}
BufferedReader in;
PrintWriter out;
StringTokenizer st = new StringTokenizer("");
private void run() throws IOException {
if (new File("input.txt").exists())
in = new BufferedReader(new FileReader("input.txt"));
else
in = new BufferedReader(new InputStreamReader(System.in));
if (new File("output.txt").exists())
out = new PrintWriter("output.txt");
else
out = new PrintWriter(System.out);
solve();
in.close();
out.close();
}
void solve() throws IOException {
long l = nextLong();
long r = nextLong();
l += l % 2;
if (l + 2 > r)
out.println("-1");
else {
out.println(l + " " + (l + 1) + " " + (l + 2));
}
}
String nextLine() throws IOException {
st = new StringTokenizer("");
return in.readLine();
}
String nextToken() throws IOException {
while (!st.hasMoreTokens()) {
st = new StringTokenizer(in.readLine());
}
return st.nextToken();
}
int nextInt() throws IOException {
return Integer.parseInt(nextToken());
}
long nextLong() throws IOException {
return Long.parseLong(nextToken());
}
double nextDouble() throws IOException {
return Double.parseDouble(nextToken());
}
boolean EOF() throws IOException {
while (!st.hasMoreTokens()) {
String str = in.readLine();
if (str == null)
return true;
st = new StringTokenizer(str);
}
return false;
}
}
| constant | 483_A. Counterexample | CODEFORCES |
import java.io.*;
import java.util.*;
public class practice {
public static void main(String[] args) throws Exception {
//Scanner in = new Scanner(new File("practice.in"));
Scanner in = new Scanner(System.in);
String str = in.nextLine();
long n = Long.parseLong(str.substring(0, str.indexOf(" ")));
long m = Long.parseLong(str.substring(str.indexOf(" ") + 1));
if(m - n < 2) {
System.out.println("-1");
} else {
if(m - n == 2 && m % 2 == 1) {
System.out.println("-1");
} else {
System.out.println((n + n % 2) + " " + (n + 1 + n % 2) + " " + (n + 2 + n % 2));
}
}
}
} | constant | 483_A. Counterexample | CODEFORCES |
import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
long l = in.nextLong();
long r = in.nextLong();
in.close();
if (r - l < 2) {
System.out.println(-1);
return;
}
if ((r - l > 2)||(l%2 ==0 )) {
long s = l + l%2;
System.out.println(s+" "+(s+1)+" "+(s+2));
} else {
if (l%2 == 1) {
System.out.println(-1);
} else{
long s = l;
System.out.println(s+" "+(s+1)+" "+(s+2));
}
}
}
static long gcd(long a, long b) {
if(a==0) {
return b;
}
if (b==0) {
return a;
}
if (a > b) {
return gcd (a%b, b);
}
return gcd (b%a, a);
}
}
| constant | 483_A. Counterexample | CODEFORCES |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String [] line = br.readLine().split(" ");
long l = Long.parseLong(line[0]);
long r = Long.parseLong(line[1]);
if(r-l < 2 || ((r-l == 2) && (l % 2 == 1)))
System.out.println("-1");
else
{
Long start = l + (l%2);
System.out.println(start + " " + (start + 1) + " " + (start + 2));
}
}
}
| constant | 483_A. Counterexample | CODEFORCES |
import java.util.*;
import java.math.*;
public class fuck {
public static int[] a;
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
long r = input.nextLong();
long l = input.nextLong();
if((l - r + 1) < 3){
System.out.println(-1);
}
else
{
if(r % 2 == 0)
System.out.println(r + " " + (r +1)+ " " + (r+2) );
else{
if(l -r + 1 >3){
++r;
System.out.println(r + " " + (r +1)+ " " + (r+2) );
}
else
System.out.println(-1);
}
}
}
}
| constant | 483_A. Counterexample | CODEFORCES |
import java.util.*;
public class Counterexample483A
{
public static void main(String[] args)
{
// Set up scanner
Scanner sc = new Scanner(System.in);
// System.out.println("Enter l");
long l = sc.nextLong();
// System.out.println("Enter r");
long r = sc.nextLong();
if (l==r || l+1 == r)
{
System.out.println(-1);
return;
}
if (l+2 == r && l%2 == 1)
{
System.out.println(-1);
return;
}
if (l%2 == 0)
{
System.out.println(l + " " + (l+1) + " " + (l+2));
return;
}
System.out.println((l+1) + " " + (l+2) + " " + (l+3));
}
}
| constant | 483_A. Counterexample | CODEFORCES |
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
BigInteger l = new BigInteger(scanner.next());
BigInteger r = new BigInteger(scanner.next());
if(r.subtract(l).intValue() < 2) {
System.out.println(-1);
return;
}
BigInteger a = l.abs(),b,c;
BigInteger toothless = r.subtract(BigInteger.valueOf(1));
while(a.compareTo(toothless) == -1) {
b = l.add(BigInteger.valueOf(1));
while(b.compareTo(r) == -1) {
c = l.add(BigInteger.valueOf(2));
while(c.compareTo(r) == -1 || c.compareTo(r) == 0) {
if(gcd(a,b) == 1 && gcd(b,c) == 1 && gcd(a,c) != 1) {
System.out.println(a + " " + b + " " + c);
return;
}
c = c.add(BigInteger.valueOf(1));
}
b = b.add(BigInteger.valueOf(1));
}
a = a.add(BigInteger.valueOf(1));
}
System.out.println(-1);
}
private static int gcd(BigInteger a, BigInteger b) {
return a.gcd(b).intValue();
}
} | constant | 483_A. Counterexample | CODEFORCES |
import java.util.*;
import java.io.*;
import java.math.*;
public class A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
BigInteger l = sc.nextBigInteger();
BigInteger r = sc.nextBigInteger();
BigInteger a = l.add(BigInteger.ZERO);
while (a.compareTo(r) < 0) {
BigInteger b = a.add(BigInteger.ONE);
while (b.compareTo(r) < 0) {
try {
a.modInverse(b);
} catch (ArithmeticException e) {
b = b.add(BigInteger.ONE);
continue;
}
BigInteger c = b.add(BigInteger.ONE);
while (c.compareTo(r) <= 0) {
try {
b.modInverse(c);
try {
a.modInverse(c);
} catch (ArithmeticException e) {
System.out.printf("%s %s %s\n", a.toString(), b.toString(), c.toString());
return;
}
} catch (ArithmeticException e) {
}
c = c.add(BigInteger.ONE);
}
b = b.add(BigInteger.ONE);
}
a = a.add(BigInteger.ONE);
}
System.out.println("-1");
}
}
| constant | 483_A. Counterexample | CODEFORCES |
import java.util.*;
public class A {
public static void main(String[]args) {
Scanner in = new Scanner(System.in);
long l = in.nextLong();
long r = in.nextLong();
if(r - l < 2) System.out.println(-1);
else {
if(l % 2 == 0)
System.out.println(l + " " + (l+1) + " " + (l+2));
else {
if(r - l < 3) System.out.println(-1);
else
System.out.println((l+1) + " " + (l+2) + " " + (l+3));
}
}
}
}
| constant | 483_A. Counterexample | CODEFORCES |
import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) {
new TaskA().solve();
}
}
class TaskA extends Base {
public static void solve () {
long l = in.nextLong();
long r = in.nextLong();
if (r - l < 2) {
System.out.println(-1);
return;
}
if (l % 2 == 0) {
System.out.println(l + " " + (l + 1) + " " + (l + 2));
return;
}
if (r - l > 2) {
System.out.println((l + 1) + " " + (l + 2) + " " + (l + 3));
return;
}
System.out.println(-1);
}
}
class Base {
public static InputReader in = new InputReader(System.in);
}
class InputReader {
BufferedReader reader;
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) {
e.printStackTrace();
}
}
return tokenizer.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
public long nextLong() {
return Long.parseLong(next());
}
}
| constant | 483_A. Counterexample | CODEFORCES |
import java.util.Scanner;
public class CF275Ad2 {
public static void main(String[] args) throws Exception {
Scanner scan = new Scanner(System.in);
long l = scan.nextLong();
long r = scan.nextLong();
long diff = r-l;
boolean exists = false;
if(diff >= 3){
if(l%2 == 1){
l++;
}
exists = true;
} else if(diff == 2 && l%2 == 0){
exists = true;
} else if(diff == 2 && gcd(l, r) > 1){
exists = true;
}
if(!exists){
System.out.println("-1");
} else {
System.out.println(l + " " + (l+1) + " " + (l+2));
}
}
private static long gcd(long a, long b){
if(b == 0){
return 1;
}
return gcd(b, a % b);
}
}
| constant | 483_A. Counterexample | CODEFORCES |
import java.util.Scanner;
public class A275 {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
long a=sc.nextLong();
long b=sc.nextLong();
if(b-a<2){
System.out.println(-1);
}else if(b-a==2 && a%2==1){
System.out.println(-1);
}else if(b-a==2 && a%2==0){
System.out.println(a+" "+(a+1)+" "+(a+2));
}else{
if(a%2==0){
System.out.println(a+" "+(a+1)+" "+(a+2));
}else{
System.out.println((a+1)+" "+(a+2)+" "+(a+3));
}
}
}
}
| constant | 483_A. Counterexample | CODEFORCES |
import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
long l = in.nextLong();
long r = in.nextLong();
long a = 0;
long b = 0;
long c = 0;
if (r - l < 2)
System.out.println(-1);
else if (r - l < 3 && l % 2 == 1)
System.out.println(-1);
else {
if (l % 2 == 0) {
a = l;
b = l + 1;
c = l + 2;
} else {
if (l == 1) {
a = 2;
b = 3;
c = 4;
} else {
a = l + 1;
b = l + 2;
c = l + 3;
}
}
System.out.println(a + " " + b + " " + c);
}
}
}
| constant | 483_A. Counterexample | CODEFORCES |
import java.util.Scanner;
public class K603 {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
long a=sc.nextLong();
long b=sc.nextLong();
if(b-a<2){
System.out.println(-1);
}else if(b-a==2 && a%2==1){
System.out.println(-1);
}else if(b-a==2 && a%2==0){
System.out.println(a+" "+(a+1)+" "+(a+2));
}else{
if(a%2==0){
System.out.println(a+" "+(a+1)+" "+(a+2));
}else{
System.out.println((a+1)+" "+(a+2)+" "+(a+3));
}
}
}
} | constant | 483_A. Counterexample | CODEFORCES |
import java.io.*;
import java.util.*;
public class A{
public static BufferedReader k;
public static BufferedWriter z;
public static void main(String [] args)throws IOException{
k = new BufferedReader(new InputStreamReader(System.in));
z = new BufferedWriter(new OutputStreamWriter(System.out));
String[] dat = k.readLine().split(" ");
long l = Long.parseLong(dat[0]);
long r = Long.parseLong(dat[1]);
if(r-l<=1){
z.write(-1+"\n");
}
else if(r-l == 2){
if((l&1)!=0){
z.write(-1+"\n");
}
else{
z.write(l+" "+(l+1)+" "+r+"\n");
}
}
else{
if(l%2==0){
z.write(l+" "+(l+1)+" "+(l+2)+"\n");
}
else{
z.write((l+1)+" "+(l+2)+" "+(l+3)+"\n");
}
}
z.flush();
}
} | constant | 483_A. Counterexample | CODEFORCES |
import java.util.*;
import java.math.*;
public class Counterexample {
public static void main(String[] args) {
System.out.println(new Counterexample().solve());
}
String solve() {
Scanner sc = new Scanner(System.in);
final long l = sc.nextLong();
final long r = sc.nextLong();
if ((r - l) > 1) {
long a = l;
long b = l + 1;
long c = l + 2;
while (a < (r - 1)) {
while (b < r) {
while (c <= r) {
if (gcd(a,b) == 1
&& gcd(b,c) == 1
&& gcd(a,c) > 1) {
return Long.toString(a)
+ " "
+ Long.toString(b)
+ " "
+ Long.toString(c);
}
c += 1;
}
c = b + 1;
b += 1;
}
b = a + 1;
a += 1;
}
}
return "-1";
}
long gcd(long a, long b) {
while (b != 0) {
long t = b;
b = a % b;
a = t;
}
return a;
}
}
| constant | 483_A. Counterexample | CODEFORCES |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class A {
FastScanner in;
PrintWriter out;
public void run() {
try {
in = new FastScanner(new InputStreamReader(System.in));
out = new PrintWriter(System.out);
solve();
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
public void solve() throws IOException {
long l = new Long(in.next());
long r = new Long(in.next());
if (r - l < 2 || (r - l == 2 && l % 2 != 0)) {
out.println("-1");
} else {
if (l % 2 != 0) {
l++;
}
out.println(l);
out.println(l+1);
out.println(l+2);
}
}
class FastScanner {
BufferedReader br;
StringTokenizer st;
FastScanner(InputStreamReader in) {
br = new BufferedReader(in);
}
String nextLine() {
String str = null;
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
String next() {
while (st == null || !st.hasMoreTokens()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
}
public static void main(String[] arg) {
A o = new A();
o.run();
}
}
| constant | 483_A. Counterexample | CODEFORCES |
import java.util.*;
public class A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long l = sc.nextLong();
long h = sc.nextLong();
sc.close();
if(h-l<2) {
System.out.println(-1);
return ;
}
if(h-l==2 && l%2==1) {
System.out.println(-1);
return ;
}
if(l%2==1) {
++l;
}
System.out.printf("%d %d %d\n",l,l+1L,l+2L);
}
}
| constant | 483_A. Counterexample | CODEFORCES |
import java.io.*;
import java.util.*;
import java.math.BigInteger;
public class Main {
// main
public static void main(String [] args) throws IOException {
// makes the reader and writer
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
// read in
StringTokenizer st = new StringTokenizer(f.readLine());
BigInteger l = new BigInteger(st.nextToken());
BigInteger r = new BigInteger(st.nextToken());
// write
if (r.subtract(l).intValue()<2 || (r.subtract(l).intValue()==2 && r.mod(new BigInteger("2")).intValue()==1)) out.println(-1);
else out.println(l.add(l.mod(new BigInteger("2"))).toString()+" "+l.add(l.mod(new BigInteger("2"))).add(new BigInteger("1")).toString()+" "+l.add(l.mod(new BigInteger("2"))).add(new BigInteger("2")).toString());
// cleanup
out.close();
System.exit(0);
}
} | constant | 483_A. Counterexample | CODEFORCES |
import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
long l = s.nextLong();
long r = s.nextLong();
s.close();
if (r-l<2 || (r-l==2 && l%2==1)) {
System.out.print("-1");
return;
}
long beg = l%2==0 ? l : l+1;
if (beg+2>r) System.out.print("-1");
else System.out.print(beg+" "+(beg+1)+" "+(beg+2));
}
}
| constant | 483_A. Counterexample | CODEFORCES |
import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
if (n % 2 == 0) {
System.out.printf("%d %d", 4, n - 4);
} else {
System.out.printf("%d %d", 9, n - 9);
}
}
}
| constant | 472_A. Design Tutorial: Learn from Math | CODEFORCES |
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
public class Main {
public static void main(String[] args) throws FileNotFoundException {
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt();
if (n%2==0) {
System.out.println(4+" "+(n-4));
} else {
System.out.println(9+" "+(n-9));
}
in.close();
out.close();
}
}
| constant | 472_A. Design Tutorial: Learn from Math | CODEFORCES |
import java.util.Scanner;
public class Solution {
public static void main(String[] args) throws Exception {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
if (n % 2 == 0)
System.out.println("4 " + (n - 4));
else
System.out.println("9 " + (n - 9));
}
}
| constant | 472_A. Design Tutorial: Learn from Math | CODEFORCES |
import java.util.*;
public class LearnMath {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int N = scan.nextInt();
scan.close();
if ((N%2) == 0) {
System.out.println(4 + " " + (N-4));
}
else {
if (N > 18) {
System.out.println(9 + " " + (N-9));
}
else {
System.out.println((N-9) + " " + 9);
}
}
}
}
| constant | 472_A. Design Tutorial: Learn from Math | CODEFORCES |
import java.util.Scanner;
public class Composite {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
if (n == 12)
System.out.println("4 8");
else if (n % 2 == 1)
System.out.println((n - 9) + " 9");
else
System.out.println((n - 6) + " 6");
}
}
| constant | 472_A. Design Tutorial: Learn from Math | CODEFORCES |
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.math.BigInteger;
import java.util.Scanner;
import java.util.StringTokenizer;
import static java.lang.Integer.*;
public class A {
public static void main(String[] args) throws IOException {
//BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
Scanner sc=new Scanner (System.in);
// StringTokenizer st=new StringTokenizer(buf.readLine());
int n=sc.nextInt();
System.out.println(n%2==0?4+" "+(n-4):9+" "+(n-9));
}
}
| constant | 472_A. Design Tutorial: Learn from Math | 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
*/
public class Main {
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 solver = new TaskA();
solver.solve(1, in, out);
out.close();
}
}
class TaskA {
public void solve(int testNumber, InputReader in, PrintWriter out) {
int n = in.nextInt();
if (n % 2 == 0) {
out.println(4 + " " + (n - 4));
} else {
out.println(9 + " " + (n - 9));
}
}
}
class InputReader {
private final BufferedReader reader;
private StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream));
tokenizer = null;
}
public String nextLine() {
try {
return reader.readLine();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
tokenizer = new StringTokenizer(nextLine());
}
return tokenizer.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
}
| constant | 472_A. Design Tutorial: Learn from Math | CODEFORCES |
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
public class Main
{
public static void main(String[] args)
{
Scanner sc =new Scanner(System.in);
long a=sc.nextLong();
if(a%4==0){System.out.println(a/2 + " " + a/2);}
if(a%4==1){System.out.println(9 + " " + (a-9));}
if(a%4==2){System.out.println(6 + " " + (a-6));}
if(a%4==3 && a>15){System.out.println(15 + " " + (a-15));}
if(a==15){System.out.println("6 9");}
}
}
| constant | 472_A. Design Tutorial: Learn from Math | CODEFORCES |
import java.util.Scanner;
public class Code1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = Integer.valueOf(sc.nextLine());
if (n % 2 == 0)
System.out.println(4 + " " + (n - 4));
else {
System.out.println(9 + " " + (n - 9));
}
}
}
| constant | 472_A. Design Tutorial: Learn from Math | CODEFORCES |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class A {
public static void main(String[] args) throws IOException {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
String input;
while ((input = reader.readLine()) != null && input.length() > 0) {
int n = Integer.parseInt(input);
int start = 4;
int end = n - start;
while (start <= end) {
if ((start % 2 == 0 || start % 3 == 0) && (end % 2 == 0 || end % 3 == 0)) {
System.out.println(start + " " + end);
break;
}
++start;
--end;
}
}
}
}
} | constant | 472_A. Design Tutorial: Learn from Math | CODEFORCES |
import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner x=new Scanner(System.in);
int n=x.nextInt();
if(n%2==0){
System.out.println((n-4)+" "+"4");
}
else{
System.out.println((n-9)+" "+"9");
}
}
}
| constant | 472_A. Design Tutorial: Learn from Math | 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
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
Scanner in = new Scanner(inputStream);
PrintWriter out = new PrintWriter(outputStream);
TaskA solver = new TaskA();
solver.solve(1, in, out);
out.close();
}
}
class TaskA {
public void solve(int testNumber, Scanner in, PrintWriter out) {
int N = in.nextInt();
if (N % 2 == 0){
out.println("4 " + (N - 4));
}
else {
out.println("9 " + (N - 9));
}
}
}
| constant | 472_A. Design Tutorial: Learn from Math | CODEFORCES |
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Solution {
private BufferedReader cin;
private PrintWriter cout;
private StringTokenizer strtok;
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
Solution sol = new Solution();
final boolean CONTEST = true;
if (CONTEST) {
sol.cin = new BufferedReader(new InputStreamReader(System.in));
sol.cout = new PrintWriter(System.out);
} else {
sol.cin = new BufferedReader(new FileReader("input.txt"));
sol.cout = new PrintWriter("output.txt");
}
sol.solve();
sol.cin.close();
sol.cout.close();
}
private int nextInt() throws NumberFormatException, IOException {
return Integer.parseInt(nextToken());
}
private String nextToken() throws IOException {
while (strtok == null || !strtok.hasMoreTokens()) {
strtok = new StringTokenizer(cin.readLine());
}
return strtok.nextToken();
}
private void solve() throws IOException {
int n = nextInt();
if (n % 2 == 0) {
cout.println(n - 4 + " " + 4);
} else {
cout.println(n - 9 + " " + 9);
}
}
}
| constant | 472_A. Design Tutorial: Learn from Math | CODEFORCES |
/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
if(n%2==0){
System.out.println(4 + " " + (n-4));
}
else{
int a = Math.min(9,n-9);
int b = Math.max(9,n-9);
System.out.println(a + " " + b);
}
}
} | constant | 472_A. Design Tutorial: Learn from Math | CODEFORCES |
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;
public class ProblemA {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(new InputStreamReader(System.in));
int n = sc.nextInt();
if (n % 2 == 0) {
System.out.println((n - 4) + " " + 4);
} else {
System.out.println((n - 9) + " " + 9);
}
}
}
| constant | 472_A. Design Tutorial: Learn from Math | CODEFORCES |
import java.util.Scanner;
public class composite {
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
int a=s.nextInt();
if(a%2==0)
{
a=a-4;
System.out.println(4+" "+a);
}
else
{
a=a-9;
System.out.println(9+" "+a);
}
}
} | constant | 472_A. Design Tutorial: Learn from Math | CODEFORCES |
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Stack;
import java.util.StringTokenizer;
public class Main
{
private static BufferedReader in;
private static BufferedWriter out;
public static void main(String[] args) throws NumberFormatException, IOException
{
// streams
boolean file = false;
if (file)
in = new BufferedReader(new FileReader("input.txt"));
else
in = new BufferedReader(new InputStreamReader(System.in));
// out = new BufferedWriter(new OutputStreamWriter(System.out));
out = new BufferedWriter(new FileWriter("output.txt"));
StringTokenizer tok;
int n = Integer.parseInt(in.readLine());
if (n % 2 == 0)
System.out.println(4 + " " + (n-4));
else
System.out.println(9 + " " + (n-9));
}
} | constant | 472_A. Design Tutorial: Learn from Math | CODEFORCES |
import java.io.*;
import java.util.*;
public class Main {
private static PrintWriter out;
private static FastReader in;
private static class FastReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public FastReader(InputStream inputStream) {
reader = new BufferedReader(
new InputStreamReader(inputStream), 1 << 16);
tokenizer = null;
}
public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
return tokenizer.nextToken();
}
public String nextLine() {
try {
return reader.readLine();
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
public int nextInt() {
return Integer.parseInt(next());
}
}
public static void main(String[] args) throws FileNotFoundException, InterruptedException {
in = new FastReader(System.in);
out = new PrintWriter(System.out);
int n = in.nextInt();
int a = ((n & 1) == 0) ? a = 6 : 9;
int b = n - a;
out.println(a + " " + b);
out.flush();
}
} | constant | 472_A. Design Tutorial: Learn from Math | CODEFORCES |
import java.io.*;
import java.util.Scanner;
public class T
{
public static void main(String[] args) throws IOException
{
T t = new T();
t.run();
t.close();
}
private void close()
{
sc.close();
pw.close();
}
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
Scanner sc = new Scanner(reader);
PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
void yesno(boolean b)
{
pw.println(b ? "YES" : "NO");
}
void run() throws IOException
{
int n = sc.nextInt();
if (n % 2 == 0)
{
pw.print(4 + " " + (n - 4));
}
else
{
pw.print(9 + " " + (n - 9));
}
}
}
| constant | 472_A. Design Tutorial: Learn from Math | CODEFORCES |
import java.util.*;
public class a {
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
int n = input.nextInt();
if(n%2 == 0) System.out.println(4+" "+(n-4));
else System.out.println(9+" " +(n-9));
}
}
| constant | 472_A. Design Tutorial: Learn from Math | CODEFORCES |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.