prompt
string
response
string
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class A_246 { FastScanner in; PrintWriter out; public void run() { try { in = new FastScanner(new InputStreamReader(System.i...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
#include <bits/stdc++.h> using namespace std; void solve() { long long int n; cin >> n; if (n > 2) { for (long long int i = 0; i < n - 1; i++) cout << 2 << " "; cout << 1 << endl; } else cout << -1 << endl; } void testcase() { int t; cin >> t; while (t--) { solve(); } } int main() { io...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import java.util.Scanner; public class BuggySort { public static void main(String []args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); if(n < 3) {System.out.println("-1"); return; } for(int i = 1; i < n + 1; ++i) { if(i == 1) System.out.print("2 "); else if(i == 2) System.out.print(...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
a=int(input()) if a<=2:print(-1) else:print(' '.join(list(map(str,range(1,a+1)))[::-1]))
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import java.util.Scanner; public class A_151 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n=sc.nextInt(); if(n==1 || n==2) System.out.println(-1); else { for (int i =n; i >=1; i--) { System.out.print(i+" "); } } } }
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import java.util.*; import java.io.*; public class codeforce { public static void main(String[] args) { PrintWriter out = new PrintWriter(System.out); Scanner sc = new Scanner(System.in); int n = sc.nextInt(); if(n<=2) System.out.println(-1); else { System.out.pr...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
n = input() if n < 3: print -1 else: l = range(n, 0, -1) for i in l: print i,
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
#include <bits/stdc++.h> using namespace std; int n; int main() { cin >> n; if (n <= 2) cout << -1; else { for (int i = 2; i <= n; ++i) cout << i << " "; cout << 1; } }
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
n=int(raw_input()) if n<3: print -1 else: l=range(n) l.reverse() s="" for i in l: s=s+str(i+1)+" " print s
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n <= 2) cout << "-1\n"; else { for (int i = n; i >= 1; i--) cout << i << " "; } return 0; }
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.StringTokenizer; public class Main implements Runnable { private static void solve() throws IOException { int n = nextInt(); if( n <= 2 ){ ...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import java.util.Scanner; public class teste{ public static void main (String[] args){ int n = new Scanner(System.in).nextInt(); if(n < 3) System.out.println(-1); else{ for(int i = n; i>0; i--) System.out.println(i); } } }
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
n=int(raw_input()) print ' '.join(map(str,[ i for i in range(n,0,-1)] )) if n>2 else -1
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
n = input() print -1 if n<3 else " ".join(map(str,range(n,0,-1)))
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int inputByte=sc.nextInt(); if(inputByte<3) { System.out.print(-1); } else { for(int k=inputByte; k>0; k--){ ...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
n=int(input()) if n==1 or n==2: print(-1) else: for i in range(n): print(n-i, end=" ")
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import java.lang.*; import java.util.*; import java.math.*; public class MyClass{ static class Pair implements Comparable<Pair>{ long a, b; public Pair(long a, long b) { this.a = a; this.b = b; } @Override public int compareTo(Pair o) { ...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
n=int(raw_input()) if n==1 or n==2: print '-1', else : for i in range(n,0,-1): print i,
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
//This code is written by प्रविण शंखपाळ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Collections; import java.util.Arrays; import java.util.ArrayList; import java.util.LinkedList; import java.util.Stack; import java.util.Queue; import java.util.Priori...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import java.util.*; import java.util.Scanner; import java.io.*; import javax.lang.model.util.ElementScanner6; import static java.lang.System.out; public class A246 { public static void main(String args[]) { FastReader in=new FastReader(); PrintWriter pr = new PrintWriter(new Buff...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
/** * @author panicker */ 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.StringTokenizer; public class ProblemA { public static void main(String[] args) { I...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
n=int(input()) if(n>2): for i in range(2,n+1,1): print(i,end=' ') print(1) else: print(-1)
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import java.util.Scanner; public class P246A { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner in = new Scanner (System.in); int n = in.nextInt(); if (n<=2) System.out.println(-1); else { ...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
#include <bits/stdc++.h> using namespace std; int main() { int n; while (scanf("%d", &n) != EOF) { if (n < 3) { puts("-1"); continue; } printf("%d %d", n, n - 1); for (int i = 2; i < n; i++) printf(" %d", i - 1); puts(""); } return 0; }
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
n = int(input()) if n > 2: print(*tuple(range(n+1)[:0:-1])) else: print(-1)
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
n = input() print -1 if n < 3 else ' '.join([`3`, `2`] + [`1`] * (n - 2))
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import java.io.InputStreamReader; import java.util.*; public class d2_151_A { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc=new Scanner(System.in); int n=sc.nextInt(); if(n==1 || n==2) System.out...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
#include <bits/stdc++.h> using namespace std; int main() { int num; while (scanf("%d", &num) != EOF) { if (num > 2) { while (num) { cout << num << " "; num--; } cout << endl; } else { cout << -1 << endl; } } return 0; }
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import java.util.Scanner; public class A264 { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int a=sc.nextInt(); if (a<3) { System.out.println("-1"); }else { for (int i=a;i>0;i--) { System....
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
#include <bits/stdc++.h> int main(void) { int n, a[50], i; scanf("%d", &n); if (n < 3) printf("-1\n"); else { for (i = n; i >= 1; i--) printf("%d ", i); printf("\n"); } return 0; }
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
''' Codeforces Round #151 (Div. 2) | A - Buggy Sorting ''' try: n = int(input()) ans = '-1' if n <= 2 else ' '.join([str(i) for i in range(n, 0, -1)]) print(ans) except EOFError as e: pass
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
n=int(input()) l=[] if n<=2: print(-1) else: for i in range(n,0,-1): l.append(i) for r in l: print(r,end=' ')
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
#include <bits/stdc++.h> using namespace std; int main() { int n, num[100]; while (~scanf("%d", &n)) { if (n == 1 || n == 2) { printf("-1\n"); continue; } for (int i = 1; i <= n; i++) printf("%d ", n - i + 1); cout << endl; } return 0; }
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n < 3) { cout << -1 << endl; } else { for (int i = 2; i <= n; i++) { cout << i << " "; } cout << 1 << endl; } }
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import java.util.Scanner; public class P246A { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int num = sc.nextInt(); if (num <= 2) { System.out.println("-1"); ...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
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) System.out.println(-1); else { for (int i=0; i<n-1; i++) System.out.print(3+" "); ...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import sys import copy import os def main(cin): n = int(cin.readline().strip()) if n<3: print -1 return s = ['3','2'] for i in range(n-2): s.append('1') print ' '.join(s) if __name__ == "__main__": cin = sys.stdin if (os.path.exists('best.txt')): cin = open('best.txt') main(cin)
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import java.util.*; import java.io.*; import java.math.BigInteger; public class a { public static void main(String[] arg) throws IOException { new a(); } public a() throws IOException { FastScanner in = new FastScanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = in.nextInt(); if(n...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
n = int(input()) if n > 2: print(*range(2,n+1), 1) else: print(-1)
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
#include <bits/stdc++.h> using namespace std; int main() { long long int n; scanf("%lld", &n); if (n <= 2) printf("-1"); else { for (int i = n; i >= 1; i--) printf("%d ", i); } }
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import java.io.*; import java.util.*; public class Main{ public static void main(String[] args){ try{ Scanner s = new Scanner(System.in); int n = s.nextInt(); if(n <= 2){ System.out.printf("-1"); }else{ for(int i = n; i > 0; i--){ System.out.printf("%d", i); if(i != 1) System.out.print...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
n=input();print ' '.join(map(str,range(n,0,-1))) if n>2 else '-1'
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
#include <bits/stdc++.h> using namespace std; template <class T> inline T sqr(const T& x) { return x * x; } template <class T> inline string tostr(const T& a) { ostringstream os(""); os << a; return os.str(); } const int inf = 1999999999; const double pi = acos(-1.0); const double eps = 1e-9; int main() { clo...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import java.util.*; public class bucky{ private int contor=0; public static void main (String args[]) { Scanner input=new Scanner(System.in); HashMap<Integer, Integer> map= new HashMap<Integer, Integer>(); HashMap<Integer, Integer> start= new HashMap<Integer, Integer>(); HashMap<Integer, Integer> finish= new HashM...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
#include <bits/stdc++.h> using namespace std; #pragma comment(linker, "/STACK:16777216") const double EPS = 1e-7; double iabs(const double a) { return (a < -EPS) ? -a : a; } double imin(const double a, const double b) { return (a - b > EPS) ? b : a; } double imax(const double a, const double b) { return (a - b > EPS) ?...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import bisect from itertools import accumulate import os import sys import math from io import BytesIO, IOBase BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.writable = "x" in file.mode or "r" not in f...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import java.util.Scanner; //int ar[] =new int[1001]; //st.charAt(i) public class Watermelon { public static void main(String args[]){ Scanner in = new Scanner(System.in); int n; n= in.nextInt(); if(n<=2){ System.out.print("-1"); } else{ for(in...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
n = int(raw_input()) if n <= 2: print -1 else: for i in xrange(2, n + 1): print i, print 1
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import java.util.Scanner; public class BuggySorting { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner s = new Scanner(System.in); int n = s.nextInt(); if(n==1 || n==2) System.out.println(-1); el...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
n=int(input()) if n<=2: print(-1) else: print(*[i for i in range(n,0,-1)])
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import static java.util.Arrays.*; import java.io.*; import java.lang.reflect.*; import java.util.*; public class A { final int MOD = (int)1e9 + 7; final double eps = 1e-12; final int INF = (int)1e9; public A () { int N = sc.nextInt(); if (N <= 2) print(-1); else { Integer [] A = new Integer[N]; ...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
n=input();print-1if n<3 else" ".join(map(str,range(n,0,-1)))
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import sys n = int(sys.stdin.readline()) if(n <= 2): print(-1) exit() res = [] for i in range(n, 0, -1): res.append(str(i)) print(" ".join(res))
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
#include <bits/stdc++.h> int n; int main() { scanf("%d", &n); if (n <= 2) { printf("%d", -1); return 0; } for (; n; n--) printf("%d ", n); return 0; }
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; 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.io.InputStream; /** * Built using...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n > 2) { for (int i = 0; i < n; i++) { cout << n - i << " \n"[i == n - 1]; } return 0; } cout << -1 << endl; return 0; }
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
#include <bits/stdc++.h> using namespace std; int main() { int a; scanf("%d", &a); if (a == 1 || a == 2) { printf("%d\n", -1); return 0; } printf("6 3"); for (int i = 2; i < a; i++) { printf(" %d", i); } printf("\n"); return 0; }
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
def main(): n = int(raw_input()) if n < 3: print -1 else: print 2,3, for i in range(2,n): print 1, if __name__ == "__main__": main()
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
n=int(input()) if n<=2: print(-1) else: for i in range(n,0,-1): print(i,end=" ")
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
a = int(input()) if (a == 2) | (a == 1): print(-1) else: while a > 0: print(a, end = " ") a = a - 1
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf("%d", &n); if (n <= 2) printf("%d\n", -1); else { for (int i = n; i > 0; --i) printf("%d ", i); printf("\n"); } return 0; }
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
#include <bits/stdc++.h> using namespace std; int n, a[52]; int main() { scanf("%d", &n); if (n < 3) { printf("-1"); return 0; } for (int i = n; i > 1; i--) printf("%d ", i); printf("1"); return 0; }
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
def try_sort(array): n = len(array) for i in range(n): for j in range(i, n-1): if array[j] > array[j+1]: array[j], array[j+1] = array[j+1], array[j] return array def main(): n = int(raw_input()) if n == 1 or n == 2: print -1 else: a = [] ...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import java.io.*; import java.util.*; public class Main { public static void main(String args[]) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = t_int(br); if (n <= 2) { System.out.println(-1); } else { f...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
a=int(input("")) if (a==1 or a==2): print(-1) else: for g in range (a,0,-1): print(g)
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
a=int(input()) if a==1 or a==2: print(-1) else: x='' x+=(a-1)*'2 ' x+='1' print(x)
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
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) { ...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
def main(n): if n <= 2: return "-1" l = list(reversed(list(range(1, n + 1)))) return ' '.join(list(map(str, l))) print(main(int(input())))
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
n = int(input()) if n < 3: print(-1) else: print(*list(range(n, 0, -1)))
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import java.util.*; public class con1 { public static void main(String[] args) { Scanner sc =new Scanner(System.in); int n =sc.nextInt(); if(n<3){ System.out.println(-1); }else while(n>0){ System.out.print(n+" "); n--; } ...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
n = int(input()) if n <= 2: print -1 else: for i in range(n): print n - i,
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import sys n = (int)(raw_input()); if (n < 3): print -1; else: for i in range(n): print n - i,; print '\n';
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import java.util.*; public class p246A { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); in.close(); if(n < 3) System.out.println(-1); else for(int i=n; i>0; --i) System.out.print(i+" "); } }
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
n = input() if n <= 2: print -1 else: alist = [2, 3] alist.extend([1] * (n - 2)) print " ".join(map(str, alist))
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import java.io.FileNotFoundException; import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.StringTokenizer; import...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
a = int(input()) d = 4 if a == 1 or a == 2 : print(-1) else: for i in range(a -1): print(d ,end = " ") d += 1 print(1)
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); long long int n; cin >> n; if (n <= 2) { cout << "-1"; return 0; } for (long long int i = n; i > 0; i--) cout << i << " "; return 0; }
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import java.util.Arrays; import java.util.Scanner; public class _0560BuggySorting { static void sort(int[] arr) { int n=arr.length; for(int i=0;i<n-1;i++) { for(int j=0;j<n-i-1;j++) { if(arr[j]>arr[j+1]) { int temp=arr[j]; arr[j]=arr[j+1]; arr[j+1]=temp; } } } System.out.print...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
def readarray(f): return map(f, raw_input().split()) def readint(): return int(raw_input()) def printlist(l): print ' '.join(map(str, l)) n = readint() if n < 3: print -1 else: printlist([3, 2, 1] + [1]*(n-3))
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
print [n<=2 and -1 or ' '.join(map(str,range(n,0,-1))) for n in [int(raw_input())]][0]
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
n = int(input()) if n <= 2: print("-1") else: for i in range(2,n+1): print(str(i) + " ") print(1)
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n <= 2) { cout << -1 << endl; } else { for (int i = n; i >= 1; i--) { cout << i << " "; } cout << endl; } }
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int arr[n]; int x = n; if (n <= 2) cout << -1 << endl; else { for (int i = 0; i < n; i++) { arr[i] = x; x--; } for (int i = 0; i < n; i++) cout << arr[i] << " "; } return 0; }
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
#include <bits/stdc++.h> using namespace std; int main(void) { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n; cin >> n; int arr[n]; for (int i = 0; i < n; i++) { arr[i] = i + 1; } reverse(arr, arr + n); if (n < 3) cout << -1 << "\n"; else { for (auto u : arr) ...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import java.io.*; import java.lang.reflect.Field; import java.math.BigInteger; import java.util.*; public class codeforces implements Runnable { private BufferedReader br = null; private PrintWriter pw = null; private StringTokenizer stk = new StringTokenizer(""); public static void main(String[] arg...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import sys n = input() if(n <= 2): print -1 else: a = range(n, 0, -1) for i in xrange(n): if(i!= 0): sys.stdout.write(" ") sys.stdout.write(str(a[i]))
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import sys n = int(sys.stdin.readline()) if n <= 2: print -1 else: print ' '.join(map(str, xrange(n, 0, -1)))
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import sys import math import string from collections import deque # Function # def read_int() : temp = raw_input().split(); return map(int, temp); def read_str() : temp = raw_input().split(); return temp; def write(output) : sys.stdout.write(output); def writeln(output) : sys.stdout.wri...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
#include <bits/stdc++.h> using namespace std; int main() { int n, i; scanf("%d", &n); if (n < 3) printf("-1\n"); else { printf("%d %d", n - 1, n); for (i = 1; i <= n - 2; i++) printf(" %d", i); printf("\n"); } return 0; }
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
n = int ( raw_input() ) if n <= 2: print -1 else: a = ['2'] * (n-1) + ['1'] print ' '.join(a)
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
n=input() if n>2: print ' '.join(map(str,range(n,0,-1))) else: print -1
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); if(n > 2){ for (int i = 2; i <= n; ++i) { System.out.println(i + " "); } ...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import java.io.BufferedReader; import java.io.PrintWriter; import java.io.InputStreamReader; import java.io.IOException; import java.util.StringTokenizer; public class Main { static Scanner in = new Scanner(); static PrintWriter out = new PrintWriter(System.out); public static void main(String...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
n = int(input()) a = list(map(str,list(range(n,0,-1)))) if n <= 2: print (-1) else: print (" ".join(a))
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
n=int(input()) if n<3:print(-1) else: for i in range(n,0,-1): print(i,end=' ')
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
#include <bits/stdc++.h> using namespace std; int main() { int i, j, k, l, m, n, p, q, a, b, c, d, x, y, z, t, ans = 0; int arr[200006]; cin >> n; if (n == 1 || n == 2) { cout << "-1"; } else { for (i = n; i > 0; i--) { cout << i << " "; } } }
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
n = int(input()) if n < 3: print(-1) else: arr = [2,3,1] for i in range(4,n+1): arr.append(i) print(*arr)
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
#include <bits/stdc++.h> using namespace std; long long int max(long long int a, long long int b) { if (a >= b) return a; else return b; } long long int min(long long int a, long long int b) { if (a >= b) return b; else return a; } long long int diff(long long int a, long long int b) { if (a >...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
import java.io.File; import java.util.Formatter; import java.util.Scanner; // In the name of The Friend // CONTEST TEMPLATE ---- SmileToAzrael ......... bagherbal /** * * @author ali */ public class A { public static void main(String[] args) { try { Scanner input = new Scanner(System.in);...
Problem: Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The ...
#include <bits/stdc++.h> using namespace std; int v[1000000]; int buggy_sorting(int n) { if (n == 1 || n == 2) return 0; v[0] = 5; v[1] = 6; v[2] = 1; for (int i = 3; i < n; i++) v[i] = i; return 1; } void median() { int t, n, k, pas, cnt; long long int s; cin >> t; for (int z = 0; z < t; z++) { ...