akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstring>
#include<queue>
using namespace std;

#define REP(i,a,b) for(i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
const int inf = 1<<29;

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int memo[50][50][50][50],mp[50][50];
int X,Y,tx,ty,kx,ky;

struct State{
  int tx,ty,kx,ky;
  State(int tx,int ty,int kx,int ky) : tx(tx), ty(ty), kx(kx), ky(ky) {;}
  State() {;}
};

inline bool range(int x,int m) {
  return (x >= 0 && x < m);
}

bool ok(int tx,int ty) {
  if(range(tx,X) && range(ty, Y) && mp[ty][tx] == 0) return true;
  return false;
}

int main() {
    int i,j,k,l,ans;
    while(cin>>X>>Y, X|Y) {
      cin>>tx>>ty>>kx>>ky;
      tx--,ty--,kx--,ky--;
      rep(i,50) rep(j,50) rep(k,50) rep(l,50) memo[i][j][k][l] = inf;
      ans = inf;
      memo[tx][ty][kx][ky] = 0;

      rep(i,Y) {
	rep(j,X) {
	  cin>>k;
	  mp[i][j] = k;
	}
      }

      queue<State> Q;
      Q.push(State(tx,ty,kx,ky));
      while(!Q.empty()) {

	State now = Q.front(); Q.pop();
	if(now.tx == now.kx && now.ty == now.ky) {
	  ans = memo[now.tx][now.ty][now.kx][now.ky];
	  break;
	}

	rep(i,4) {
	  int ntx = now.tx+dx[i],nty = now.ty+dy[i];
	  int nkx = now.kx-dx[i],nky = now.ky-dy[i];
	  if(ok(ntx,nty) && ok(nkx,nky) && memo[ntx][nty][nkx][nky] == inf) {
	    memo[ntx][nty][nkx][nky] = memo[now.tx][now.ty][now.kx][now.ky]+1;
	    Q.push(State(ntx,nty,nkx,nky));
	  }else if(ok(ntx,nty) && !ok(nkx,nky)
		   && memo[ntx][nty][now.kx][now.ky] == inf) {
	    memo[ntx][nty][now.kx][now.ky] = memo[now.tx][now.ty][now.kx][now.ky]+1;
	    Q.push(State(ntx,nty,now.kx,now.ky));
	  }else if(ok(nkx,nky) && !ok(ntx,nty)
		   && memo[now.tx][now.ty][nkx][nky] == inf) {
	    memo[now.tx][now.ty][nkx][nky] = memo[now.tx][now.ty][now.kx][now.ky]+1;
	    Q.push(State(now.tx,now.ty,nkx,nky));
	  }
	}
      }

      if(ans < inf) cout<<ans<<endl;
      else cout<<"NA"<<endl;
    }
}

Measured memory_bytes: 25000
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
	"unsafe"
)

func main() {
	N := sc.nextInt()
	ST := sc.nexts()
	S := ST[0]
	T := ST[1]

	SArr := strings.Split(S, "")
	TArr := strings.Split(T, "")
	ans := make([]string, N)
	for i := 0; i < N; i++ {
		ans[i] = SArr[i] + TArr[i]
	}
	fmt.Println(strings.Join(ans, ""))
}

var (
	sc scanner
)

func init() {
	sc = scanner{
		buf: make([]string, 0, 0),
		cur: 0,
		r:   bufio.NewReader(os.Stdin),
	}
}

type scanner struct {
	buf []string
	cur int
	r   *bufio.Reader
}

func (s *scanner) readln() {
	rbuf := make([]byte, 0, 0)
	for {
		line, prefix, err := s.r.ReadLine()
		if err != nil {
			panic(err)
		}
		rbuf = append(rbuf, line...)
		if prefix == false {
			break
		}
	}
	s.cur = 0
	s.buf = strings.Split(*(*string)(unsafe.Pointer(&rbuf)), " ")
}
func (s *scanner) isFull() bool {
	if s.cur == len(s.buf) {
		return true
	}
	return false
}
func (s *scanner) resetCur() {
	s.cur = 0
}
func (s *scanner) next() string {
	if s.cur == 0 {
		s.readln()
	}
	res := s.buf[s.cur]
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nexts() []string {
	s.readln()
	s.resetCur()
	return s.buf
}
func (s *scanner) nextInt() int {
	if s.cur == 0 {
		s.readln()
	}
	res, _ := strconv.Atoi(s.buf[s.cur])
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nextInts() []int {
	s.readln()
	res := make([]int, len(s.buf))
	for i := range s.buf {
		res[i], _ = strconv.Atoi(s.buf[i])
	}
	s.resetCur()
	return res
}
func (s *scanner) nextFloat() float64 {
	if s.cur == 0 {
		s.readln()
	}
	res, _ := strconv.ParseFloat(s.buf[s.cur],
		64)
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nextFloats() []float64 {
	s.readln()
	res := make([]float64, len(s.buf))
	for i := range s.buf {
		res[i], _ = strconv.ParseFloat(s.buf[i],
			64)
	}
	s.resetCur()
	return res
}
func digits(x int) int {
	return len(strconv.Itoa(x))
}
func powInt(x, p int) (result int) {
	result = 1
	for i := 0; i < p; i++ {
		result *= x
	}
	return
}
func max(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}
func min(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}
func abs(x int) int {
	return int(math.Abs(float64(x)))
}
func varDump(value ...interface{}) {
	for _, v := range value {
		fmt.Fprintf(os.Stderr, "%#v\n", v)
	}
}
func yes() {
	fmt.Println("Yes")
}
func no() {
	fmt.Println("No")
}

// Pair a
type Pair struct {
	first  int
	second int
}

// Queue a
type Queue struct {
	v []Pair
}

// Push for queue
func (q *Queue) Push(v Pair) {
	q.v = append(q.v, v)
}

// Pop for queue
func (q *Queue) Pop() Pair {
	r := q.v[0]
	q.v = q.v[1:]
	return r
}

// Front for queue
func (q Queue) Front() Pair {
	return q.v[0]
}

// Empty return true if empty
func (q Queue) Empty() bool {
	return len(q.v) == 0
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<string>
using namespace std;

int main() 
{
	while (1)
	{
		vector<int>a(6);
		for (int b = 0; b < 6; b++) {
			cin >> a[b];
		}
		if (a[0] == 0 && a[1] == 0 && a[2] == 0 && a[3] == 0 && a[4] == 0 && a[5] == 0)break;
		int s = a[0] * 90 + a[1] * 60 + a[2] * 7 + a[3] * 2 + 100;
		int l = (a[5] - a[4]) * 3 - a[0] * 5 - a[1] * 3;
		cout << s - l << endl;
	}
}

Measured memory_bytes: 3052
#include "bits/stdc++.h"

#define int long long

using namespace std;
#define REP(i, s, n) for(signed i = (s); i < signed(n); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) for(int i = signed(n) - 1; i >= 0; i--)
#define all(co) co.begin(), co.end()
typedef pair<int, int> P;
typedef long long LL;

#ifdef int
const long long INF = 1ll << 62ll;
#else
const singed INF = 1 << 29;
#endif

struct edge{ int from, to, cost; };

int dr[] = { -1, 0, 1, 0 };
int dc[] = { 0, 1, 0, -1 };

template<typename T = int>
vector<vector<T>> vvector(int h, int w, T def = T()){ return move(vector<vector<T>>(h, vector<T>(w, def))); }
class range {
private: struct I{ int x; int operator*(){ return x; }bool operator!=(I& lhs){ return x < lhs.x; }void operator++(){ ++x; } }; I i, n;
public:range(int n) :i({ 0 }), n({ n }){}range(int i, int n) :i({ i }), n({ n }){}I& begin(){ return i; }I& end(){ return n; }
};

signed main()
{
	int h, w;
	while (cin >> h >> w && h)
	{
		auto dp = vvector(h, w);
		int ans = 0;
		rep(i, h) rep(j, w)
		{
			int x; cin >> x;
			if (!x) dp[i][j] = 1;
			if (i >= 1 && j >= 1 && !x)
				dp[i][j] = min({ dp[i - 1][j - 1], dp[i - 1][j], dp[i][j - 1] }) + 1;
			ans = max(ans, dp[i][j]);
		}
		cout << ans * ans << endl;
	}
	return 0;
}

Measured memory_bytes: 16572
#include<bits/stdc++.h>
using namespace std;

long long driver(vector<long long> &nums,long long i,long long j,vector<vector<long long>> &dp){
   if(i==j){
        dp[i][j] = nums[i];
        return dp[i][j];
    }
    if(i+1 == j){
        dp[i][j] = max(nums[i], nums[j]);
        return dp[i][j];
    }
    if(dp[i][j]==-1)
        dp[i][j] = max(
            (nums[i] + min(driver(nums, i+2, j, dp), driver(nums, i+1, j-1, dp))),
            (nums[j] + min(driver(nums, i+1, j-1, dp), driver(nums, i, j-2, dp)))
        );
    return dp[i][j];
}

int main(){
    long long n;
    cin>>n;
    vector<long long> nums(n,0);
    vector<vector<long long>> dp(n,vector<long long> (n,-1));
    
    long long sum=0;
    for(int i=0;i<n;i++){
        cin>>nums[i];
        sum+=nums[i];
    }
    long long ans=2*driver(nums,0,n-1,dp)-sum;
    cout<<ans;
    return 0;
    
}

Measured memory_bytes: 70912
INT_MAX=10**30+7
MOD=10**9+7
def INPUT():return list(int(i) for i in input().split())
def LIST_1D_ARRAY(n):return [0 for _ in range(n)]
def LIST_2D_ARRAY(m,n):return [[-1 for _ in range(n)]for _ in range(m)]
#=====================================================================
n,k=INPUT()
A=INPUT()
A.sort()
print(sum(A[0:k]))


Measured memory_bytes: 62352
#include <iostream>
#include <cmath>
using namespace std;
int main( void )
{
	while ( !cin.eof() )
	{
		double v_min;
		cin >> v_min;
		if ( cin.eof() )
			break;

		double v = 0.0;
		int N = 1;
		do
		{
			double y = 5 * N - 5;
			double t = sqrt( y / 4.9 );

			v = 9.8 * t;

			N++;
		} while( v < v_min );

		cout << N-1 << endl;

	}
	return 0;
}

Measured memory_bytes: 0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.ABC_125
{
    class B
    {
        static void Main(string[] args)
        {
            Method(args);
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            int[] vs = ReadInts();
            int[] cs = ReadInts();
            int[] deltas = new int[n];
            for(int i = 0; i < n; i++)
            {
                deltas[i] = vs[i] - cs[i];
            }
            Array.Sort(deltas);
            Array.Reverse(deltas);
            int res = 0;
            for(int i = 0; i < n; i++)
            {
                if (deltas[i] >= 0) res += deltas[i];
            }
            WriteLine(res);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 11220
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

#if !defined(M_PI)
#define M_E 2.71828182845904523536
#define M_LOG2E 1.44269504088896340736
#define M_LOG10E 0.434294481903251827651
#define M_LN2 0.693147180559945309417
#define M_LN10 2.30258509299404568402
#define M_PI 3.14159265358979323846
#define M_PI_2 1.57079632679489661923
#define M_PI_4 0.785398163397448309616
#define M_1_PI 0.318309886183790671538
#define M_2_PI 0.636619772367581343076
#define M_2_SQRTPI 1.12837916709551257390
#define M_SQRT2 1.41421356237309504880
#define M_SQRT1_2 0.707106781186547524401
#endif

string solve() {
    int d, s, t;
    cin >> d >> s >> t;

    if ((float) d / s <= t) {
        return "Yes";
    } else {
        return "No";
    }
}

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int tt = 1;
    // cin >> tt;

    for (int tc = 1; tc <= tt; tc++) {
        cout << solve() << "\n";
    }
}


Measured memory_bytes: 3648
import java.text.DecimalFormat;
import java.util.Scanner;

public class Main {
	private Scanner sc;

	public static void main(String[] args) {
		new Main();
	}
	
	public Main() {
		sc = new Scanner(System.in);
		
		while (sc.hasNextLine()) {
			String[] nico = sc.nextLine().split(" ");
			int t = Integer.parseInt(nico[0]);
			int h = Integer.parseInt(nico[1]);
			int s = Integer.parseInt(nico[2]);
			if ((t == -1) && (h == -1) && (s == -1)) break;

			int r1 = 7200 - (t * 3600 + h * 60 + s);
			int r3 = r1 * 3;
			
			DecimalFormat df = new DecimalFormat("00");
			System.out.println(df.format(r1 / 3600) + ":" + df.format(r1 % 3600 / 60) + ":" + df.format(r1 % 60));
			System.out.println(df.format(r3 / 3600) + ":" + df.format(r3 % 3600 / 60) + ":" + df.format(r3 % 60));
		}
	}
}

Measured memory_bytes: 26168
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.10f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e18;
const ll MAX_N = 201010;

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };
char a[110][110];

//long longしか使わない
//素数は1より大きい
//lower_boundは指定したkey以上の要素の一番左のイテレータをかえす
//upper_boundは指定したkeyより大きい要素の一番左のイテレータをかえす
int main() {
	ll n;
	cin >> n;
	vector<ll>a(n);
	vector<ll>L(n), R(n);
	rep(i, n) {
		cin >> a[i];
	}
	L[0] = a[0], R[n - 1] = a[n - 1];
	rep(i, n - 1) {
		L[i + 1] = gcd(L[i], a[i + 1]);
	}
	for (ll i = n - 1;i >= 1;--i) {
		R[i - 1] = gcd(R[i], a[i - 1]);
	}
	ll ans = 0;
	rep(i, n) {
		if (i == 0)ans = max(R[1], ans);
		else if (i == n - 1)ans = max(ans, L[n - 2]);
		else {
			ll res = gcd(L[i - 1], R[i + 1]);
			ans = max(ans, res);
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 5612
#include<bits/stdc++.h>
using namespace std;

#define int long long
#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(0)
#define endl "\n"
#define printarr(arr, n) for(int i = 0; i < n; i++) cout << arr[i] << " "; cout << endl;
#define pii pair<int,int>
#define mp(x, y) make_pair(x, y)
#define debug(x) cout << "#debug " << x << endl;
#define print2D(arr, n) cout << "\n_____________________\n";  for(int i = 1; i  <= n; i++){	for(int j = 1; j <= n; j++){cout << arr[i][j] << " ";}cout << endl;}cout << "\n_____________________\n";
#define mii map<int,int>
#define printmap(mm) for(map<int,int>::iterator itr = mm.begin(); itr!=mm.end(); itr++) cout << itr->first << "->" << itr->second << " "; cout << endl;
#define iterm(mm) for(map<int,int>::iterator itr = mm.begin(); itr!=mm.end(); itr++)
#define NO cout << "NO"; return 0;
#define MO 1000000007
#define N 500100
#define MX 2000000000

void preprocess(){
	
}

signed main(){
	FAST_IO;
	#ifndef ONLINE_JUDGE
	//freopen("/home/divakar/programs/input.txt","r",stdin);
	//freopen("/home/divakar/programs/output.txt","w",stdout);
	#endif
	clock_t clk = clock();

	preprocess();
	int t=1;
	//cout << " dsf ";
	//cin >> t; 
	while(t--){

		int n;
		cin >> n;
		int arr[n];
		for (int i = 0; i < n; ++i)
		{
			cin >> arr[i];
		}

		int dp[n];
		dp[0] = 0;
		dp[1] = abs(arr[0]-arr[1]);

		for (int i = 2; i < n; ++i)
		{
			dp[i]=min(dp[i-1] + abs(arr[i]-arr[i-1]), dp[i-2] + abs(arr[i]-arr[i-2]));
		}

		cout << dp[n-1] << endl;




        
		//cout << "ENDOFTEST "<< t << "\n";
	}









	// #ifndef ONLINE_JUDGE
	// clk = clock() - clk;
	// cout << "Time Elapsed: " << fixed << setprecision(10) << ((long double)clk)/CLOCKS_PER_SEC << "\n";
	// #endif
	return 0;
}






















Measured memory_bytes: 1792
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;


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);
        TaskT solver = new TaskT();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskT {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            
        	int L = in.nextInt();
        	int R = in.nextInt();
        	int D = in.nextInt();
        	int count = 0;
        	for(int i = D; i <= R; i=i+D){
        		if(i > R)
        			break;
        		if(i >= L)
        			count++;
        	}
        	
        	out.print(count);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        
        public long nextLong() {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 32816
let rec comb n xs =
  match n, xs with
  | 0, _ -> [[]]
  | _, [] -> []
  | n, x :: xs ->
      List.map (fun ys -> x :: ys) (comb (n - 1) xs) @ comb n xs

let () =
  let n = Scanf.scanf "%d\n" (fun n -> n) in
  let ss = Array.init n (fun _ -> Scanf.scanf "%s\n" (fun s -> s)) in
  Array.fold_left (fun [m; a; r; c; h] s ->
    match s.[0] with
    | 'M' -> [m + 1; a; r; c; h]
    | 'A' -> [m; a + 1; r; c; h]
    | 'R' -> [m; a; r + 1; c; h]
    | 'C' -> [m; a; r; c + 1; h]
    | 'H' -> [m; a; r; c; h + 1]
    | _ -> [m; a; r; c; h]) [0; 0; 0; 0; 0] ss
  |> comb 3
  |> List.map (List.fold_left ( * ) 1)
  |> List.fold_left ( + ) 0
  |> Printf.printf "%d\n"

Measured memory_bytes: 6784
#include<iostream>
#include<iomanip>
#include<cmath>
#include<cstdio>
using namespace std;

void func(double, int);

int main(){

	double a, b, c, d, e, f, x, y, del;
	  
	while(cin >> a){
	
		cin >> b >> c >> d >> e >> f;
		
		del = a * e - b * d;
		x = (c * e - b * f) / del;
		y = (a * f - c * d) / del;
		
		func(x, -4);
		func(y, -4);
		
		if(x == 0) x = 0;
		if(y == 0) y = 0;
		
	  printf("%.3f %.3f\n", x, y);
	}

	return 0;
}

void func(double x, int n){
	
	x *= pow(10, -n-1);
	x = round(x);
	x *= pow(10, n+1);	

}

Measured memory_bytes: 1236
var
	a,b,i:Longint;
	s:String;
begin
	readln(s);
	for i:=1 to length(s)do begin
		if s[i]='0'then inc(a)else inc(b);
	end;
	if a<b then writeln(2*a)else writeln(2*b);
end.

Measured memory_bytes: 256
package main

import "fmt"

type Cnt struct {
	AC int
	WA int
}

func main() {
	var N, M int
	fmt.Scanf("%d %d", &N, &M)

	m := make(map[int]Cnt)
	for i := 0; i < M; i++ {
		var p int
		var S string
		fmt.Scanf("%d %s", &p, &S)

		v, ok := m[p]
		if !ok {
			v = Cnt{}
		}
		if S == "AC" {
			v.AC++
		}
		if S == "WA" && v.AC == 0 {
			v.WA++
		}
		m[p] = v
	}

	var acCnt, waCnt int
	for _, v := range m {
		if v.AC > 0 {
			acCnt++
			waCnt += v.WA
		}
	}

	fmt.Printf("%d %d", acCnt, waCnt)
}


Measured memory_bytes: 8960
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
int main()
{
    int l, r, d;
    cin >> l >> r >> d;
    int ans = 0;
    for(int i = l; i <= r; i++)
    {
        if(i % d == 0) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3536
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <vector>
#include <string>
#include <bitset>
#include <stack>
#include <queue>
#include <tuple>
#include <regex>
#include <cmath>
#include <map>
#include <set>
#include <functional>
#include <cstring>

using namespace std;

template<typename T> bool chmax( T &a, const T b ) { if ( a <= b ) { a = b; return ( true ); } else { return ( false ); } }
template<typename T> bool chmin( T &a, const T b ) { if ( a >= b ) { a = b; return ( true ); } else { return ( false ); } }

using ll = long long;
using Pint = pair<int, int>;
using Pll  = pair<ll, ll>;

#define eb emplace_back
#define pb push_back
#define mp make_pair

#define F first
#define S second

#define popcnt __builtin_popcountll

#define rep( i, n ) for ( ll i = 0; i < (ll)( n ); ++i )
#define reps( i, n ) for ( ll i = 1; i <= (ll)( n ); ++i )
#define rrep( i, n ) for ( ll i = (ll)( ( n ) - 1 ); i >= 0; --i )
#define rreps( i, n ) for ( ll i = (ll)( ( n ) ); i > 0; --i )
#define arep( i, v ) for ( auto &&i : ( v ) )

#define ALL( c ) ( c ).begin(), ( c ).end()
#define RALL( c ) ( c ).rbegin(), ( c ).rend()
#define UNIQUE( c ) ( c ).erase( unique( ( c ).begin(), ( c ).end() ), ( c ).end() )

template<typename T = ll> constexpr T MAX = numeric_limits<T>::max();
template<typename T> T gcd( const T a, const T b ) { return ( b ? gcd( b, a % b ) : a ); }
template<typename T> T lcm( const T a, const T b ) { return ( a / gcd( a, b ) * b ); }


int main()
{
	ll n; cin >> n;
	vector<ll> a( n );
	rep( i, n ) cin >> a[i];
	map<ll, ll> m;

	auto calc = [&]( ll x ) {
		for ( ll i = 2; i * i <= x; ++i )
		{
			if ( x % i == 0 )
			{
				if ( m[i] != 0 )
					return ( false );
				else
					m[i]++;
				while ( x % i == 0 )
				{
					x /= i;
				}
			}
		}

		if ( x != 1 && m[x] != 0 )
			return ( false );
		m[1]++;
		m[x]++;

		return ( true );
	};

	ll sgcd = a[0];
	bool pc = true, sc = true;
	rep( i, n )
	{
		pc = calc( a[i] );
		if ( pc == false )
			break;
	}
	reps( i, n - 1 )
		sgcd = gcd( sgcd, a[i] );
	sc = sgcd == 1;

	if ( pc )
		cout << "pairwise coprime" << endl;
	else if ( sc )
		cout << "setwise coprime" << endl;
	else
		cout << "not coprime" << endl;

	return ( 0 );
}


Measured memory_bytes: 10644
#include <bits/stdc++.h>
using namespace std;

#define SZ(c) int(c.size())
#define all(c) c.begin(), c.end()
#define rall(a) a.rbegin(),a.rend()
#define pb  push_back
#define clr(a, n) memset(a, n, sizeof a)
#define inf 1e16+1
#define change(a,b) if(a > b) a = b

typedef vector<int> vi;
typedef long long ll;

ll i, j, n, x, a, b, w;
vector<pair<ll,ll>> v;
vector<ll> dp;

int main() {

	cin >> n >> w;
	for (i = 0; i < n; ++i) {
		cin >> a >> b;
		v.pb({a, b});
		x += b;
	}
	dp.assign(x+1, inf);
	dp[0] = 0;
	for (i = 0; i < n; ++i) {
		for (j = x; j >= 0; --j) {
			if (j - v[i].second >= 0) {
				dp[j] = min(dp[j], dp[j - v[i].second]+v[i].first);
			}
		}
	}
	a = 0;
	for (j = x; j >= 0; --j) {
		if (dp[j] <= w) {
			a = j;
			break;
		}
	}
	cout << a << endl;
	return 0;
}


Measured memory_bytes: 1024
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
#pragma GCC optimize("O3")
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdlib>
#include<set>
#include<vector>
#include<sstream>
#include<queue>
#include <iomanip>
#include<unordered_set>
#include <stack>
#include <unordered_map>
#include <map>
#include<numeric>
#include<chrono>
#include <fstream>
constexpr auto INF = 9223372036854775807;
typedef long long int ll;
typedef unsigned long long int ull;
typedef unsigned long int ul;
#define f(i,a,b) for(ll i=(ll)a;i<(ll)b;i+=1)
#define rf(i,a,b) for(ll i=(ll)a;i>=(ll)b;i-=1)
#define endl '\n'
#define N 1000000007 // prime modulo value 
#define M 998244353
#define all(x) x.begin(),x.end()
#define mkp(a,b) make_pair(a,b)
using namespace std;
struct custom_hash {
	static uint64_t splitmix64(uint64_t x) {
		// http://xorshift.di.unimi.it/splitmix64.c
		x += 0x9e3779b97f4a7c15;
		x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
		x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
		return x ^ (x >> 31);
	}

	size_t operator()(uint64_t x) const {
		static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
		return splitmix64(x + FIXED_RANDOM);
	}
};
inline int mex(unordered_set<int> st)
{
	int m = 0;
	while (st.find(m) != st.end())
	{
		m += 1;
	}
	return m;
}
inline int calculateGrundy(int n)
{
	if (n == 1)
		return 0;
	unordered_set<int> mexi;
	for (int i = 1; i <= sqrt(n); i += 1)
	{
		if (n % i == 0)
		{
			if (n / i != n)
				mexi.insert(calculateGrundy(n / i));
			mexi.insert(calculateGrundy(i));
		}
	}
	return mex(mexi);
}
inline ll gcd(ll a, ll b)
{
	// This is code taken from geeksforgeek
	if (b == 0)
		return a;
	return gcd(b, a % b);
}
/*ll power(ll x, ll y)
{
	// This is code taken from geeksforgeek
	ll res = 1;

	x = x % N;
	if (x == 0) return 0;
	while (y > 0)
	{
		if (y & 1)
			res = (res * x) % N;
		y = y >> 1;
		x = (x * x) % N;
	}
	return res;
}*/
ll power(ll x, ll y)
{
	ll res = 1;

	x = x;

	while (y > 0)
	{

		if (y & 1)
			res = (res * x);

		y = y >> 1;
		x = (x * x);
	}
	return res;
}


/*ll modInverse(ll n, ll p)
{
	return power(n, p - 2, p);
}*/

ll sum(ll n)
{
	return (n * (n + 1)) / 2;
}
ll sum_digit(ll n)
{
	ll ans = 0;
	while (n)
	{
		ans += n % 10;
		n /= 10;
	}
	return ans;
}
ll gp(ll r, ll n)
{
	return (pow(r, n) - 1) / (r - 1);
}
int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	string n;
	cin>>n;
	ll ans=0;
	f(i,0,n.length())
	{
		ans+=n[i]-'0';
		ans%=9;
	}
	if(ans%9)
	{
		cout<<"No";
	}
	else
	{
		cout<<"Yes";
	}
	
	return 0;
}

Measured memory_bytes: 3804
n,m = map(int,raw_input().split(' '))
roads = [0 for _ in xrange(n)]
for i in xrange(m):
    a,b = map(int,raw_input().split(' '))
    a -= 1; b -=1
    roads[a] += 1
    roads[b] += 1
for i in roads:
    print i
    

Measured memory_bytes: 2568
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author alireza_kaviani
 */

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef pair<ld, ld> pld;
typedef pair<string, string> pss;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define X                           first
#define Y                           second
#define Mp                          make_pair
#define tab                         '\t'
#define sep                         ' '
#define endl                        '\n'
#define debug(x)                    cerr << #x << " = " << x << endl
#define SZ(x)                       ll(x.size())
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io                     freopen("in.txt" , "r+" , stdin) ; freopen("out.txt" , "w+" , stdout);
#define set_random                  mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

inline ll input() {
    ll n;
    cin >> n;
    return n;
}

ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

set_random;

const ll MAXN = 2e5 + 10;
const ll INF = 8e18;
const ll MOD1 = 998244353;
const ll MOD2 = 1e9 + 7;
const ll MOD3 = 1e9 + 9;

ll n , h[MAXN] , dp[MAXN];

int main() {
    fast_io;

    cin >> n;
    for(ll i = 1 ; i <= n ; i++) cin >> h[i];

    dp[1] = 0;
    dp[2] = abs(h[1] - h[2]);
    for(ll i = 3 ; i <= n ; i++)
    {
        dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]) , dp[i - 1] + abs(h[i] - h[i - 1]));
    }
    cout << dp[n] << endl;

    return 0;
}
/*
todo :
    1- set constants
    2- check TimeLimit and MemoryLimit
    3- check special test cases
    4- don't forget BS can help you that is good idea(use for loop for floats)
    5- don't forget printf and scanf can help you in your code speed
*/


Measured memory_bytes: 1792
array = list(map(int, input().split()))
miniDis = [0]*(array[0] -1)
for i in range(1,array[0]):
  for j in range(i+1,array[0]+1):
    miniDis[min(j-i,abs(array[1]-i)+1+abs(array[2]-j))-1] += 1
    
                   
                   
                   
                   
for i in range(array[0] -1):
  print(miniDis[i])


Measured memory_bytes: 47196
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	string a;
	cin>>a;
	int curr = 0;
	for (int i = 1; i < n; ++i)
	{
		if (a[i] == 'E')
			curr++;
	}
	int ans = curr;
	for (int i = 1; i < n; ++i)
	{
		if (a[i-1] == 'W')
			curr++;;
		if (a[i] == 'E')
			curr--;
		ans = min(curr, ans);
	}
	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 900
#include <iostream>
#include <fstream>
#include <vector>
#include <stack>
#include <queue>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>

using namespace std;

typedef long long ll;
typedef pair<ll,ll> PP;
typedef vector<int> vec;
typedef vector<vec> mat;

/*
    freopen("input","r",stdin);
    freopen("output","w",stdout);
*/

ll MOD = 1E9 + 7;

mat DP = {
	{1, 2, 1, 0, 0, 0},
	{0, 1, 1, 0, 0, 0},
	{1, 2, 2, 1, 2, 1},
	{0, 0, 0, 1, 2, 1},
	{0, 0, 0, 0, 1, 1},
	{0, 0, 0, 0, 0, 1}
};

mat RK[64];

mat mul(mat &A,mat &B) {
    mat C(A.size(), vec(B[0].size()));
    for (int i = 0;i < A.size();i++) {
        for (int k = 0;k < B.size();k++) {
        	if (A[i][k] == 0) continue;
            for (int j = 0;j < B[0].size();j++) {
                C[i][j] = (C[i][j] + 1LL * A[i][k] * B[k][j]) % MOD;
            }
        }
    }
    return C;
}

mat pow(mat A, ll n) {
    mat B(A.size(), vec(A.size()));
    for (int i = 0;i < A.size(); i++) {
        B[i][i] = 1;
    }
    int idx = 1;
    while (n > 0) {
        if (n & 1) B = mul(B,RK[idx]);
        //A = mul(A,A);
        n >>=1;
        idx++;
    }
    return B;
}

mat DP2 = {
	{1, 2, 1, 0, 0, 0},
	{0, 1, 1, 0, 0, 0},
	{0, 0, 1, 0, 0, 0},
	{0, 0, 0, 1, 2, 1},
	{0, 0, 0, 0, 1, 1},
	{0, 0, 0, 0, 0, 1}
};

int main() {
    ios::sync_with_stdio(false);
    ll N, M;
    cin >> N >> M;
    vector<int> L(M);
    for (int i = 0;i < M;i++) cin >> L[i];
    mat K = {
		{1, 0, 0, 0, 0, 0},
		{0, 1, 0, 0, 0, 0},
		{0, 0, 1, 0, 0, 0},
		{0, 0, 0, 1, 0, 0},
		{0, 0, 0, 0, 1, 0},
		{0, 0, 0, 0, 0, 1}
	};
	RK[0] = K;
	RK[1] = DP;
	for (int i = 2;i < 64;i++) RK[i] = mul(RK[i - 1], RK[i - 1]);
	int crt = 0;
	for (int i = 0;i < M;i++) {
		ll run = L[i] - crt - 1;
		if (run > 0) {
			mat tmp = pow(DP, run);
		    K = mul(tmp, K);
		}
		K = mul(DP2, K);
		crt = L[i];
	}
	ll run = N - crt;
	mat tmp = pow(DP, run);
	K = mul(tmp, K);
	cout << (K[0][5] + (N * N) % MOD) % MOD << endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
typedef long long ll;

int main(){

    int n, k;
    cin >> n >> k;
    int copy = n;
    ll cnt = 0;
    double ans = 0;
    for (int i = 1; i <= n; i++)
    {
        copy = n;
        ll sum =1;
        cnt = 0;
        if(i>=k) {
            ans += (double)1 / n;
            continue;
        }
        while (i * sum < k)
        {
            sum *= 2;
            cnt++;
            cerr << cnt << endl;
        }
        ans += pow(0.5,cnt)*(double)1 / n;
        cerr << ans << endl;
    }
    printf("%.12f", ans);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1e9+7;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX Euclidean */           ll gcd(ll a,ll b){if(b==0)return a; return gcd(b,a%b);}
    /*"lcm"   MIN*/                      ll lcm(ll a,ll b){ll g = gcd(a,b);return a/g*b;}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
ll modpow(ll a,ll n, ll mod){ll res = 1;while(n>0){if (n%2==1){res = res * a % mod;}a = a * a % mod;n/=2;}return res;}
int main() {
    string s,t;
    cin >>s >>t;
    ll che = 1e17;
    for(int i=0;i<s.size();i++){
        string z="";
        ll d = 0;
        for(int j=0;j<t.size();j++){
            if(i+j>=s.size())continue;
           // cout<<i+j<<endl;
            z+=s.at(i+j);
        }
        //cout<<z<<endl;
        if(t.size()!=z.size())continue;
        for(int j=0;j<t.size();j++){
            if(z.at(j)!=t.at(j))d++;
        }
        che = min(che,d);
    }
    cout<<che<<endl;
}
    



Measured memory_bytes: 3628
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func main() {
	sc := NewScanner()
	S, T := sc.nextStr(), sc.nextStr()
	count := 0
	for i := 0; i < 3; i++ {
		if S[i] == T[i] {
			count++
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
long long dp[2][100005];
int v[101],w[101];
int W,n;
int main()
{
    scanf("%d%d",&n,&W);
    for(int i=0;i<n;++i)
    {
        scanf("%d%d",&w[i],&v[i]);
    }
    for(int i=0;i<n;++i)
    {
        for(int j=0;j<=W;++j)
        {
            dp[i&1][j]=dp[(i+1)&1][j];
           if(j-w[i]<0) continue;
           dp[i&1][j]=max(dp[i&1][j],dp[(i+1)&1][j-w[i]]+v[i]);
        }
    }
    printf("%lld",dp[(n-1)%2][W]);
    return 0;
}


Measured memory_bytes: 5364
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	if(n >= 1000) cout << "ABD" << endl;
	else cout << "ABC" << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        long A = sc.nextInt();
        long B = sc.nextInt();
        
        if((A + B) % 2 == 0){
            System.out.println((long)Math.sqrt((A + B)*(A + B)) / 2);
        }else{
            System.out.println("IMPOSSIBLE");
        }
        
        
    }
}

Measured memory_bytes: 23508
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
  ll a, b;
  cin >> a >> b;
  cout << lcm(a, b) << endl;
  return 0;
}


Measured memory_bytes: 3624
// AOJ 2060 Tetrahedra
// 2018.3.23 bal4u

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0, c = getchar_unlocked();
	do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
	return n;
}

long long max;
int a[16], a2[16], n;

int check(int i, int j, int k)
{
	int s = a[i] + a[j] + a[k];
	int z = a[i];
	if (z < a[j]) z = a[j];
	if (z < a[k]) z = a[k];
	return (z<<1) >= s;
}

void calc(int i, int j, int k, int p, int q, int r)
{
	long long V;
	long long A, B, C, P, Q, R;

	A = a2[i], B = a2[j], C = a2[k], P = a2[p], Q = a2[q], R = a2[r];
	V = A*R*(-A+B+C+P+Q-R) + B*Q*(A-B+C+P-Q+R) + C*P*(A+B-C-P+Q+R)
		- B*C*R - A*C*Q -A*B*P - P*Q*R;
	if (V > max) max = V;
}

int cmp(int *a, int *b) { return *a - *b; }

int main()
{
	int i, j, k, p, q, r;
	while (n = in()) {
		for (i = 0; i < n; i++) a[i] = in();
		qsort(a, n, sizeof(int), cmp);
		for (i = n-1; ; i--) if (a[i] < a[i-1]+a[i-2]) break;
		n = i+1;

		for (i = 0; i < n; i++) a2[i] = a[i]*a[i];

		max = 0;
		for (i = 0; i < n; i++) for (j = i+1; j < n; j++) for (k = j+1; k < n; k++) {
			if (check(i, j, k)) continue;
			for (p = 0; p < n; p++) {
			if (p == i || p == j || p == k || check(i, j, p)) continue;
			for (q = 0; q < n; q++) {
			if (q == i || q == j || q == k || q == p || check(i, k, q)) continue;
			for (r = 0; r < n; r++) {
			if (r == i || r == j || r == k || r == q || r == p || check(j, k, r)) continue;
			calc(i, j, k, p, q, r);
		}}}}
		printf("%.10lf\n", sqrt((double)max/144));
	}
	return 0;
}



Measured memory_bytes: 2004
import math
from functools import reduce


def gcd_list(numbers):
    return reduce(math.gcd, numbers)
  

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

import sys
input = sys.stdin.buffer.readline
n = int(input())
a = list(map(int, input().split()))

gcdl = gcd_list(a)
if gcdl > 1:
    print('not coprime')
    exit()
    
visited = [False] * (10**6 + 10)
for i in a:
    p = prime_factorize(i)
    for j in p:
        if visited[j]:
            print('setwise coprime')
            exit()
    for j in p:
        visited[j] = True
print('pairwise coprime')

Measured memory_bytes: 176972
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
import java.util.Random;

public class Main {
    private static FastScanner sc = new FastScanner();
    private static boolean DEBUG_FLG = false;

    public static void main(String[] args) {
    	int P = sc.nextInt();
    	int Q = sc.nextInt();
    	int R = sc.nextInt();
    	if(P <= R && Q <= R) {
    		System.out.println(P + Q);
    	} else if(P <= Q && R <= Q) {
    		System.out.println(P + R);
    	} else {
    		System.out.println(Q + R);
    	}
    }

    static void debug(long... args) {
    	if(!DEBUG_FLG) return;
    	boolean flg = false;
    	for(long s : args) {
    		if(flg) System.out.print(" ");
    		flg = true;
    		System.out.print(s);
    	}
    	System.out.println();
    }

    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if(ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch(IOException e) {
                    e.printStackTrace();
                }
                if(buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int nextInt(){
            return Integer.parseInt(next());
        }
        public double nextDouble(){
            return Double.parseDouble(next());
        }
    }

    static void shuffleArray(long[] arr){
        int n = arr.length;
        Random rnd = new Random();
        for(int i=0; i<n; ++i){
            long tmp = arr[i];
            int randomPos = i + rnd.nextInt(n-i);
            arr[i] = arr[randomPos];
            arr[randomPos] = tmp;
        }
    }
}


Measured memory_bytes: 21204
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll MOD = 1000000007;

#define vec                vector<int>
#define vecll              vector<ll>
#define vecd               vector<double>
#define vecst              vector<string>
#define vecb               vector<bool>
#define vec2(var, n, m)    vector<vector<int>>  var(n, vector<int>(m, INF))
#define vecb2(var, n, m)   vector<vector<bool>> var(n, vector<bool>(m, false))
#define vecll2(var, n, m)  vector<vector<ll>>   var(n, vector<ll>(m, 0))

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vecst var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << (var) << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << (var) << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << (var);
#define prt2(v1, v2)     cout << (v1) << " " << (v2) << "\n"
#define prt3(v1, v2, v3) cout << (v1) << " " << (v2) << " " << (v3) << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
void prtok(bool ok){prt(ok ? "YES" : "NO");}
//----------------------------------------------------------------

int main(void) {
  int n;
  cin >> n;
  arr(a,n);

  map<int, int> odd, even;
  rep(i,n){
    if(i&1) even[a[i]]++;
    else odd[a[i]]++;
  }
  int odd_id=-1, odd_mx=0, even_id=-1, even_mx=0;
  int odd_id2=-1, odd_mx2=0, even_id2=-1, even_mx2=0;
  for(auto i : odd){
    if(odd_mx<i.second){
      odd_id2=odd_id, odd_mx2=odd_mx;
      odd_id=i.first, odd_mx=i.second;
    } else if(odd_mx2<i.second){
      odd_id2=i.first, odd_mx2=i.second;
    }
  }
  for(auto i : even){
    if(even_mx<i.second){
      even_id2=even_id, even_mx2=even_mx;
      even_id=i.first, even_mx=i.second;
    } else if(even_mx2<i.second){
      even_id2=i.first, even_mx2=i.second;
    }
  }

  if(odd_id!=even_id){
    prt(n-odd_mx-even_mx);
  } else {
    prt(min(n-odd_mx2-even_mx, n-odd_mx-even_mx2));
  }
}


Measured memory_bytes: 8280
#include <ctime>
#include <iomanip>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <list>
#include <queue>
#include <stack>
#include <numeric>
using namespace std;

#define int long long
#define INF 1e18
#define EPS 1e-9
#define NIL -1
#define N 100

int n, A, B, C;
vector<int> l(10);

int dfs(int d, int a, int b, int c) {
    if(d == n) {
        if(a && b && c) return abs(a - A) + abs(b - B) + abs(c - C) - 30;
        else return INF;
    }
    int ret0 = dfs(d + 1, a, b, c);
    int ret1 = dfs(d + 1, a + l[d], b, c) + 10;
    int ret2 = dfs(d + 1, a, b + l[d], c) + 10;
    int ret3 = dfs(d + 1, a, b, c + l[d]) + 10;
    return min(ret0, min(ret1, min(ret2, ret3)));
}
signed main() {
    cin >> n >> A >> B >> C;
    for(int i = 0; i < n; i++) cin >> l[i];

    int ans = dfs(0, 0, 0, 0);
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define yesno(flg) if(flg){cout<<'YES'<<endl;}else{cout<<'NO'<<endl;}
#define vi vector<int>
#define pb push_back
#define i197 1000000007
#define MAX_N 200002
using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<Pii,int> Piii;
typedef pair<int,ll> Pil;
typedef pair<ll,ll> Pll;
typedef pair<string,int> Psi;
typedef pair<Psi,int> Psii;

const int inf=1000000000;
struct edge{
	int myc,to,c,cost;
};
struct pos{
	int to,cost,color;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

vi vec[200001];
int x[200001]={};
int dp[200001];
int main() {
	string str;
	cin>>str;
	int n=str.size();
	bool flg=true;
	rep(i,n){
		if(i%2>0&&str[i]=='R')flg=false;
		if(i%2==0&&str[i]=='L')flg=false;
	}
	if(flg){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>

using namespace std;

int main(){
  vector<int> A(3);
  for(int i=0;i<3;i++){
    cin >> A.at(i);
  }
  sort(A.begin(),A.end());
  cout << A.at(2)-A.at(0) << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <numeric>
#include<iostream>
#include<set>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include <cstdio>
#include<algorithm>
#include <sstream>
#include<string>
#include<string.h>
#include <cmath>
#include <iomanip>
#include <string>
#include<list>
using namespace std;
#define int long long
#define inf 1000000007
#define rep(i,j,n) for(int i=j;i<n;i++)
typedef pair<int,int>  P;
double pi = 3.141592653589793;
//使うやつはここから下に置こうなh
signed main(){
    int h,w;cin>>h>>w;
    int count=0;
    rep(i,0,h)rep(j,0,w){
        char f;cin>>f;
        if(f=='#')count++;
    }
    if(count==h+w-1)cout<<"Possible"<<endl;
    else cout<<"Impossible"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[3][1000000];
int main()
{
	int numb;
	cin>>numb;
	for(int q=0;q<3;q++)
	{
		for(int i=0;i<numb;i++)
		cin>>a[q][i];
		std::sort(a[q],a[q]+numb);
	}
	long long ans=0;
	int j=0,k=0;
	for(int i=0;i<numb;i++)
	{
		while(j<numb&&a[0][j]<a[1][i])
		j++;
		while(k<numb&&a[1][i]>=a[2][k])
		k++;
		ans+=1LL*j*(numb-k);
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 8832
#include<bits/stdc++.h>
#define ll long long int
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);

    string s,t;
    cin>>s>>t;
    unsigned int cnt=0;
    for(unsigned i=0;i<t.length();i++)
    {
        if(s[i]==t[i])
            cnt++;
    }
    if(cnt==s.size())
        cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 3608