akhauriyash/Code-Regression huggingface dataset:
//AtCoder ABC063 B - Varied
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;

int main() {
    string S;
    cin>>S;
    unordered_set<char> tbl;
    for(const auto& c:S){
		tbl.insert(c);
	}
    cout<<(S.size()==tbl.size()?"yes":"no")<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

int main() {
    int a, b, c, N,K , flag;
    string array[200000];
    vector<int> vec;
    map <string, int> m;
    

    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> array[i];
        m[array[i]] += 1;
    }

    int max = 0;

    for(auto itr = m.begin(); itr != m.end(); ++itr) {
        if (itr->second > max) max = itr->second;
    }

    for(auto itr = m.begin(); itr != m.end(); ++itr) {
        if (itr->second == max) cout << itr->first << endl;
    }

}

Measured memory_bytes: 22272
import std.stdio;

const int MAX = 10001;
bool prime[MAX];

void main(){
	// make prime table
	prime[] = true;
	prime[0] = prime[1] = false;
	foreach (i; 2..MAX) if (prime[i]) for (int j = i+i; j < MAX; j+=i) prime[j] = false;

	int n;
	while (readf("%d\n", &n), n) {
		for (int i = n; i >= 0; i--) {
			if (prime[i] && prime[i-2]) {
				writeln(i-2, " ", i);
				break;
			}
		}
	}
}

Measured memory_bytes: 988
n = int(input())

p_taro = 0
p_hanako = 0

for _ in range(n):
    t, h = input().split()

    if t > h:
        p_taro += 3
    elif h > t:
        p_hanako += 3
    else:
        p_taro += 1
        p_hanako += 1

print(p_taro, p_hanako)



Measured memory_bytes: 5596
from functools import reduce
n = int(input())
S = [input() for _ in range(n)]
ans = ""
for i in range(26):
  now = chr(ord("a")+i)
  t = float("inf")
  for j in S:
    t = min(t, j.count(now))
  ans += now*t
print(ans)

Measured memory_bytes: 3572
#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <cstring>
#include <map> 
#include <set>
#include <queue>
#include <iomanip>
#include <sstream>
typedef long long ll;

#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;

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; }

const long long INF = 1000000000000000;
const ll inf = -1e18;
typedef pair<ll, ll> P;
ll ma = 1000000000 + 7;
ll mx = 1000003;
ll h,n, w,m,t; string s;
ll R, C;
ll sy, sx, gy, gx;
char maze[510][510];
ll dis[20][20];
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
ll gcd(ll x, ll y) {
	if (x % y == 0) return y;
	return gcd(y, x % y);
}
ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
void comb(vector<vector <ll> >& v) {
	for (ll i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (ll k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%ma;
		}
	}
}

ll GetDigit(ll num) {
	return log10(num) + 1;
}
ll Combination(int n, int r)
{
	if (n - r < r) r = n - r;
	if (r == 0) return 1;
	if (r == 1) return n;

	vector<ll> numerator(r);
	vector<ll> denominator(r);

	for (int k = 0; k < r; k++)
	{
		numerator[k] = n - r + k + 1;
		denominator[k] = k + 1;
	}

	for (int p = 2; p <= r; p++)
	{
		int pivot = denominator[p - 1];
		if (pivot > 1)
		{
			int offset = (n - r) % p;
			for (int k = p - 1; k < r; k += p)
			{
				numerator[k - offset] /= pivot;
				denominator[k] /= pivot;
			}
		}
	}

	ll result = 1;
	for (int k = 0; k < r; k++)
	{
		if (numerator[k] > 1) result *= numerator[k];
		result %= ma;
	}

	return result;
}
/*
ll bfs() {
	queue<P> que;
	for (int i = 0; i < R; i++) {
		for (int j = 0; j < C; j++) dis[i][j] = INF;
	}
	que.push(P(sy - 1, sx - 1));
	dis[sy - 1][sx - 1] = 0;

	while (que.size() > 0) {
		P p = que.front();
		que.pop();
		if (p.first == gy - 1 && p.second == gx - 1) break;
		for (ll i = 0; i < 4; i++) {
			ll ny = p.first + dy[i];
			ll nx = p.second + dx[i];
			if (0 <= ny && ny < R && 0 <= nx && nx < C && maze[ny][nx] == '.' && dis[ny][nx] == INF) {
				que.push(P(ny, nx));
				dis[ny][nx] = dis[p.first][p.second] + 1;
			}
		}
	}
	return dis[gy - 1][gx - 1];
}*/
int main() {
	cin >> n >> m;
	ll k;
	cin >> k;
	rep(i, n + 1) {
		rep(j, m + 1) {
			ll sum = i * m + j * n - 2*i * j;
			if (sum == k) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
	
}


Measured memory_bytes: 256
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;

#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let n = read_as_vec::<usize>()[0];

    let ell = read_as_vec::<usize>();

    let mut ab: Vec<(usize, usize)> = Vec::new();

    for i in 0..n{
        for j in i+1..n{
            ab.push((ell[i],ell[j]));
        }
    }

    let mut acc_c = vec![0;2002];

    //count up by the length
    for i in 0..n{
        acc_c[ell[i]] += 1;
    }
    //accumulate
    for i in 1..acc_c.len(){
        acc_c[i] += acc_c[i-1];
    }

    //println!("ll = {:?}", ell);
    let mut ans: usize = 0;
    for (a, b) in ab{
        //println!("-----");
        //println!("{}, {}", a, b);
        let mut diff;
        if a > b{
            diff = a - b;
        }else{
            diff = b - a;
        }
        let sum = a + b;
        //println!("diff = {}, sum = {}", diff, sum);
        let mut maybe_c = acc_c[sum-1] - acc_c[diff];
        //println!("maybec = {}", maybe_c);
        if diff < a && a < sum{
            maybe_c -= 1;
        }

        if diff < b && b < sum{
            maybe_c -= 1;
        }
        //println!("maybec = {}", maybe_c);
        ans += maybe_c;

    }

    println!("{}", ans/3);
}


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

int main()
{
    ll A,B,C,D;
    cin >> A >> B >> C >> D;

    while(1)
    {
        C -= B;
        if(C <= 0)
        {
            cout << "Yes" << endl;
            return 0;
        }

        A -= D;
        if(A <= 0)
        {
            cout << "No" << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3520
import java.util.Scanner;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    final long INF = Long.MAX_VALUE;

    final int NMAX = 1000;
    final int MMAX = 2000;
    int[] a = new int[MMAX];
    int[] b = new int[MMAX];
    long[] c = new long[MMAX];

    for (int i = 0; i < M; i++) {
      a[i] = sc.nextInt();
      b[i] = sc.nextInt();
      c[i] = sc.nextLong();
      c[i] = -c[i];
    }

    long[] dist = new long[NMAX];

    for (int i = 0; i < N; i++) {
      dist[i] = INF; //初期化
    }

    dist[0] = 0L;

    for(int loop = 0; loop < N - 1; loop++) {
      for (int i = 0; i < M; i++) {
        if(dist[a[i] - 1] == INF) continue;

        if(dist[b[i] - 1] > dist[a[i] - 1] + c[i]) {
          dist[b[i] - 1] = dist[a[i] - 1] + c[i];
        }
      }
    }

    long ans = dist[N - 1];

    boolean[] negative = new boolean[NMAX];

    for(int i = 0; i < N; i++) {
      negative[i] = false;
    }

    for (int loop = 0; loop < N; loop++) {
      for (int i = 0; i < M; i++) {
        if (dist[a[i] - 1] == INF) continue;

        if (dist[b[i] - 1] > dist[a[i] - 1] + c[i]) {
          dist[b[i] - 1] = dist[a[i] - 1] + c[i];
          negative[b[i] - 1] = true;
        }

        if (negative[a[i] - 1] == true) {
          negative[b[i] - 1] = true;
        }
      }
    }

    if (negative[N - 1]) System.out.println("inf");
    else System.out.println(-ans);
  }
}


Measured memory_bytes: 28672
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var inputs = Console.ReadLine().Split(' ');
        var N = int.Parse(inputs[0]);
        var K = int.Parse(inputs[1]);
        var Q = int.Parse(inputs[2]);

        var A_i = new List<int>();
        var Ascores = Enumerable.Repeat(0, N).ToList();

        foreach(var i in Enumerable.Range(0, Q))
        {
            A_i.Add(int.Parse(Console.ReadLine()));
        }

        foreach ( var i in A_i )
        {
            Ascores[i - 1] += 1;
        }

        foreach( var index in Enumerable.Range(0, N))
        {
            Ascores[index] = K - (Q - Ascores[index]);
        }

        foreach(var score in Ascores)
        {
            if(score <= 0)
            {
                Console.WriteLine("No");
            } else
            {
                Console.WriteLine("Yes");
            }
        }
    }
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int A, B;
  cin >> A >> B;
  if(A + B >= 10)
    cout << "error" << endl;
  else
    cout << A + B << endl;
  return 0;
}

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

using namespace std;
using ll = long long;

int main() {
	cin.sync_with_stdio(false);
	string a, b;
	cin >> a >> b;
	int flag = false;
	if (a.size()>b.size()) {
		cout << "GREATER" << endl;
		return 0;
	}
	else if (a.size()< b.size()) {
		cout << "LESS" << endl;
		return 0;
	}
	else {
		for (int i = 0;i < a.size();i++){
			if (a[i] > b[i]) {
				cout << "GREATER" << endl;
				return 0;
			}
			else if (a[i] < b[i]) {
				cout << "LESS" << endl;
				return 0;
			}
		}
		cout << "EQUAL" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        String ans = null;
        if(((a * b) % 2) == 0){
            ans = "No";
        }else{
            ans = "Yes";
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 22612
n,k=map(int,input().split())
ans=[]
a=1
b=n
s=set()
for _ in range(k):
  s.add(abs(a-b))
  s.add(abs(n+a-b)%n)
  ans.append([a,b])
  a+=1
  b-=1
  if abs(a-b) in s or abs(n+a-b)%n in s or abs(a-b)==abs(n+a-b):
    b-=1
for i in range(k):
  print(*ans[i])

Measured memory_bytes: 37848
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k;
	cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
	int sum=0;
	for(int i=n-1;i>=0&&k>0;i--)
	{
		sum+=a[i];
		k--;
	}
	cout<<sum;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define ld long double
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define debuge cerr<<"isok"<<endl
#define debug(x) cerr<<#x<<"="<<x<<endl
#define SS second
#define FF first
#define ls (k<<1)
#define rs (k<<1|1)
#define inf 0x3f3f3f3f
#define clr(a,x) memset(a,x,sizeof(a))
using namespace std;
 
const int N=100005,M=100005,mod=1e9+7;
template<class T> inline void gmin(T &x,const T &y){if(x>y) x=y;}
template<class T> inline void gmax(T &x,const T &y){if(x<y) x=y;}
inline void ch(int &x,int y){x+=y;if(x>=mod) x-=mod;}
 
int t,tot,a[505],b[505],s[505];
int la=201,ra=200,lb=201,rb=200;
 
void solve(ll n){
	if(n==1){
		++tot;
		a[--la]=tot;b[--lb]=tot;
		return;
	}
	if(n&1){
		solve(n/2);
		++tot;
		a[--la]=tot;b[--lb]=tot;
	}
	else{
		solve(n-1);
		++tot;
		a[--la]=tot;b[++rb]=tot;
	}
}
 
int main(){
	ll n;cin>>n;
	solve(n);
	printf("%d\n",ra-la+rb-lb+2);
	for(int i=la;i<=ra;i++)
		printf("%d ",a[i]);
	for(int i=lb;i<=rb;i++)
		printf("%d ",b[i]);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define bug1( x ) {cerr << (#x) <<"="<< x << endl;}
#define bug2( x , y ) {cerr << (#x) <<"="<< (x) << "    " << (#y) << "="<< (y) << endl;}
#define bug3( x , y , z ) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << endl;}
#define bug4( x , y , z , w) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << endl;}
#define bug5( x , y , z , w ,p) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << "    " << (#p) <<"="<< p << endl;}
#define bug6( x , y , z , w ,p , q) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << "    " << (#p) <<"="<< p << "    " << (#q) <<"="<< q << endl;}
#define bugn( x , n ) {cerr << (#x) <<":";for(int i=0;i<n;i++)cerr << x[i] <<"  "; cerr << endl;}
#define bugnm( x , n , m ) {cerr << (#x)<<endl;for(int i=0;i<n;i++){cerr << "Row #" << i<< ":";for(int j=0;j<m;j++)cerr << x[i][j] << "   ";cerr << endl;}}
typedef long long ll;
typedef long double ld;
using namespace std;

const int maxn = 1e5+10, mod = 1e9+7;
vector<int>dp(maxn),broke(maxn);
int n,m;
int32_t main(){
	IOS
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		int x;cin>>x;
		broke[x]=1;
	}
	dp[0]=1;
	for(int i=0;i<=maxn;i++){
		for(int dx=1;dx<=2;dx++){
			if(!broke[i+dx]){
				dp[i+dx]+=dp[i];
				dp[i+dx]%=mod;
			}
		}
	}
	cout<<dp[n];
	
}
 
/*
 * long long or int?
 * index out of bound? 
 * Tested on own test case?corner?
 * Make more general solution.
 * Read Read Read Read ....
 */


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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin >> n;
    int cnt = 0;
    int cnt2 = 0;
    for (int i = 0; i < n; i++) {
        int x; cin >> x;
        if (x % 4 == 0) {
            cnt++;
        } else {
            if (x % 2 == 0) {
                cnt2++;
            }
        }
    }
    if (cnt + (cnt2/2) >= n/2) {
        cout << "Yes";
    } else {
        cout << "No";
    }

    return 0;
}


Measured memory_bytes: 3660
n = int(input())
l = list(map(int,input().split()))
if n % 2 == 0:
    ans = [l[i] for i in range(n-1,-1,-2)] + [l[i] for i in range(0,n-1,2)]
    print(*ans)
else:
    ans = [l[i] for i in range(n-1,-1,-2)] + [l[i] for i in range(1,n-1,2)]
    print(*ans)

Measured memory_bytes: 26180
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int m = sc.nextInt();
    int[] freezers = new int[a];
    int[] microwaves = new int[b];
    int aMin = 1000000000;
    int bMin = 1000000000;
    for (int i = 0; i < a; i++) {
      freezers[i] = sc.nextInt();
    }
    for (int i = 0; i < b; i++) {
      microwaves[i] = sc.nextInt();
    }
    // 割引券なし
    for (int freezer : freezers) {
      aMin = Math.min(aMin, freezer);
    }
    for (int microwave : microwaves) {
      bMin = Math.min(bMin, microwave);
    }
    int ans = aMin + bMin;
    for (int i = 0; i < m; i++) {
      int x = sc.nextInt();
      int y = sc.nextInt();
      int c = sc.nextInt();
      int tmp = freezers[x-1] + microwaves[y-1] - c;
      ans = Math.min(ans, tmp);
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 59964
#include <bits/stdc++.h>
using namespace std;
const int NIL = -1;

struct Node
{
  int p, l, r;
};

vector<Node> Tree(26);
vector<int> Depth(26, 0), Height(26, 0);
int N;

void setDepth(int id, int d)
{
  Depth.at(id) = d;
  if (Tree.at(id).l != NIL)
    setDepth(Tree.at(id).l, d + 1);
  if (Tree.at(id).r != NIL)
    setDepth(Tree.at(id).r, d + 1);
}

int setHeight(int id)
{
  int hl = 0, hr = 0;
  if (Tree.at(id).l != NIL)
    hl = setHeight(Tree.at(id).l) + 1;
  if (Tree.at(id).r != NIL)
    hr = setHeight(Tree.at(id).r) + 1;
  return Height.at(id) = max(hl, hr);
}

int getSibling(int id)
{
  int parent_id = Tree.at(id).p;
  if (parent_id == NIL)
    return -1;
  int pl = Tree.at(parent_id).l;
  int pr = Tree.at(parent_id).r;
  if (id == pl)
    return pr;
  else
    return pl;
}

void print()
{
  for (int i = 0; i < N; i++)
  {
    int deg = 0;
    if (Tree.at(i).l != NIL)
      deg++;
    if (Tree.at(i).r != NIL)
      deg++;
    cout << "node " << i << ": parent = " << Tree.at(i).p << ", sibling = " << getSibling(i) << ", degree = " << deg << ", depth = " << Depth.at(i) << ", height = " << Height.at(i) << ", ";
    if (Tree.at(i).p == NIL)
      cout << "root" << endl;
    else if (deg == 0)
      cout << "leaf" << endl;
    else
      cout << "internal node" << endl;
  }
}

int main()
{
  int id, l, r, root_id;
  cin >> N;
  for (int i = 0; i < N; i++)
  {
    Tree.at(i).p = Tree.at(i).l = Tree.at(i).r = NIL;
  }
  for (int i = 0; i < N; i++)
  {
    cin >> id >> l >> r;
    Tree.at(id).l = l;
    Tree.at(id).r = r;
    if (l != NIL)
      Tree.at(l).p = id;
    if (r != NIL)
      Tree.at(r).p = id;
  }
  for (int i = 0; i < N; i++)
  {
    if (Tree.at(i).p == NIL)
    {
      root_id = i;
      break;
    }
  }
  setDepth(root_id, 0);
  setHeight(root_id);
  print();
}


Measured memory_bytes: 3100
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
        int k = sc.nextInt();
        int count = 0;
        
        for (int i=0; i<n; i++) {
            int x=sc.nextInt();
            if (x>=k) {
                count+=1;
            }
        }
        
        System.out.println(count);
}
}

Measured memory_bytes: 46772
n = int(input())
songs = [
    input().split() for i in range(n)
]
x = input()

ans = 0
asleep = 0
for i in range(n):
    if songs[i][0] == x:
        asleep = 1
    elif asleep:
        ans += int(songs[i][1])
    else:
        continue
print(ans)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long x = sc.nextLong();

        long b2 = b / x + 1;
        long a2 = (a - 1) / x + 1;
        if (a == 0) a2 = 0;
        System.out.println(b2 - a2);
    }
}


Measured memory_bytes: 23124
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    if (a<b&&b<c){
        printf("Yes\n");
        
    }else{
        printf("No\n");
        
    }
    
    return 0;
}

Measured memory_bytes: 580
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

class BinaryIndexedTree():

    def __init__(self,init_val):
        self.bit = [0] + init_val
        self.n  = len(init_val)

    def sum(self,i):
        ret = 0
        while i > 0:
            ret += self.bit[i]
            i -= (i & -i)
        return ret
    
    def add(self,i,x):
        while i <= self.n:
            self.bit[i] += x
            i += (i & -i)

def main():
    N = int(input())
    A = list(map(int,input().split()))
    B = sorted(A)
    dic = {b:i for i,b in enumerate(B,1)}
    bit = BinaryIndexedTree([0]*N)
    ans = 0
    for i,a in enumerate(A):
        ans += i - bit.sum(dic[a])
        bit.add(dic[a],1)
    print(ans)
if __name__ == '__main__':
    main()


Measured memory_bytes: 38768
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF 2000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

int n, k;
int main() {
 ios::sync_with_stdio ( false );
 cin.tie ( 0 );
    cin >> n >> k;
    vector<ll> x(n), y(n);
    vector<ll> arrx, arry;
    rep(i, 0, n) {
        cin >> x[i] >> y[i];
        arrx.pb(x[i]);
        arry.pb(y[i]);
    }
    sort(arrx.begin(), arrx.end());
    sort(arry.begin(), arry.end());
    
    ll ans = (arrx[n-1] - arrx[0]) * (arry[n-1] - arry[0]);

    rep(fx, 0, n) rep(ex, fx+1, n) rep(fy, 0, n) rep(ey, fy+1, n) {
        int cnt = 0;
        ll left = arrx[fx], right = arrx[ex], supper = arry[fy], upper = arry[ey];
        rep(i, 0, n) 
            if (left <= x[i] && x[i] <= right && supper <= y[i] && y[i] <= upper) 
                cnt++;
        if (cnt >= k) ans = min(ans, (right - left) * (upper - supper));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
cs = int(input())
l = list()
ar = ['S', 'H', 'C', 'D']
for c in range(cs):
    r,s = input().split()
    s = int(s)
    if r == 'S': l.append(s)
    if r == 'H': l.append(13 + s)
    if r == 'C': l.append(26 + s)
    if r == 'D': l.append(39 + s)

for k in range(1, 53):
    if not (k in l):
        print(ar[(k - 1) // 13],(k-1)%13 + 1)


Measured memory_bytes: 5604
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); 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; }



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

    vector<int> memo(1000100);
    bool is_pc = true;
    rep(i, n){
        if(A[i] > 1 && memo[A[i]])is_pc = false;
        memo[A[i]] = true;
    }
    for(int i=2; i<=1000000; i++){
        if(i!=2 && i%2==0)continue;
        int cnt = 0;
        for(int j=i; j<=1000000; j+=i){
           // if(i==2 && j <= 20)cout << "j:" << j << " memo:" << memo[j] << ln;
            if(memo[j])cnt++;
        }
        if(cnt>1)is_pc = false;
    }
    if(is_pc)cout <<  "pairwise coprime" << ln;
    else{
        ll GCD = A[0];
        rept(i, 1, n){
            GCD = __gcd(GCD, A[i]);
        }
        if(GCD==1)cout << "setwise coprime" << ln;
        else cout << "not coprime" << ln;
    }
}



Measured memory_bytes: 14824
h,w = map(int, input().split())
ch, cw = map(int, input().split())
ch -= 1
cw -= 1
dh,dw = map(int, input().split())
dh -= 1
dw -= 1

def trans(s):
    res = []
    for i in s:
        if i == '.':
            res.append(-1)
        else:
            res.append(-2)
    return res

def move(x,y,dq,dq_next):
    for ix,iy in [(x+1, y), (x-1, y), (x, y+1), (x, y-1)]:
        if ix > h-1 or ix < 0 or iy > w-1 or iy < 0:
            continue
        if (m[ix][iy] == -1) or (m[ix][iy] > m[x][y]):
            m[ix][iy] = m[x][y]
            dq.append((ix, iy))
    for ix, iy in [(x-2, y-2), (x-2, y-1), (x-2, y), (x-2, y+1), (x-2, y+2),
                        (x-1, y-2), (x-1, y-1), (x-1, y+1), (x-1, y+2),
                        (x, y-2), (x, y+2),
                        (x+1, y-2), (x+1, y-1), (x+1, y+1), (x+1, y+2),
                        (x+2, y-2), (x+2, y-1), (x+2, y), (x+2, y+1), (x+2, y+2)]:
        if ix > h-1 or ix < 0 or iy > w-1 or iy < 0:
            continue
        if m[ix][iy] == -1:
            m[ix][iy] = m[x][y] + 1
            dq_next.append((ix, iy))
            
m = [trans(input()) for _ in range(h)]

from collections import deque

m[ch][cw] = 0

def main():
    dq = deque()
    dq_next = deque()
    dq.append((ch,cw))
    while True:
        while len(dq)>0:
            xx, yy = dq.popleft()
            if xx == dh and yy == dw:
                return m[xx][yy]
            move(xx, yy, dq, dq_next)
        if len(dq_next) > 0:
            dq = dq_next.copy()
            dq_next = deque()
        else:
            return -1
          
print(main())


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

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

using D = double;
const D PI = acos(D(-1)), EPS = 1e-10;

struct Pt2 {
    D x, y;
    Pt2() {}
    Pt2(D _x, D _y) : x(_x), y(_y) {}
    Pt2 operator+(const Pt2 &r) const { return Pt2(x+r.x, y+r.y); }
    Pt2 operator-(const Pt2 &r) const { return Pt2(x-r.x, y-r.y); }
    Pt2 operator*(const Pt2 &r) const { return Pt2(x*r.x-y*r.y, x*r.y+y*r.x); }

    Pt2 operator*(const D &r) const { return Pt2(x*r, y*r); }
    Pt2 operator/(const D &r) const { return Pt2(x/r, y/r); }

    Pt2& operator+=(const Pt2 &r) { return *this=*this+r; }
    Pt2& operator-=(const Pt2 &r) { return *this=*this-r; }
    Pt2& operator*=(const Pt2 &r) { return *this=*this*r; }
    
    Pt2 operator-() const { return Pt2(-x, -y); }

    D abs() const { return sqrt(x*x + y*y); }
    D rabs() const { return max(::abs(x), ::abs(y)); } // robust abs
    D arg() const { return atan2(y, x); }

    pair<D, D> to_pair() const { return make_pair(x, y); }
    static Pt2 polar(D le, D th) { return Pt2(le*cos(th), le*sin(th)); }
};
ostream& operator<<(ostream& os, const Pt2 &p) {
    os << "(" << p.x << ", " << p.y << ")";
    return os;
}
using P = Pt2;

struct L {
    P s, t;
    L() {}
    L(P _s, P _t) : s(_s), t(_t) {}
    P vec() const { return t-s; }
    D abs() const { return vec().abs(); }
    D arg() const { return vec().arg(); }
};

int sgn(D a) {
    if (abs(a) <= EPS) return 0;
    return (a < 0) ? -1 : 1;
}
int sgn(D a, D b) { return sgn(a-b); }
//relative sign
int rsgn(D a, D f) {
    if (abs(a) <= f*EPS) return 0;
    return (a < 0) ? -1 : 1;
}

D cross(P a, P b) { return a.x*b.y - a.y*b.x; }
D dot(P a, P b) { return a.x*b.x + a.y*b.y; }

// -2, -1, 0, 1, 2 : front, clock, on, cclock, back
int ccw(P b, P c) {
    int s = rsgn(cross(b, c), b.rabs());
    if (s) return s;
    if (!sgn(c.rabs()) || !sgn((c-b).rabs())) return 0;
    if (dot(b, c) < 0) return 2;
    if (dot(-b, c-b) < 0) return -2;
    return 0;
}
int ccw(P a, P b, P c) { return ccw(b-a, c-a); }
int ccw(L l, P p) { return ccw(l.s, l.t, p); }

int crossLL(const L &l, const L &m, P &r) {
    if (sgn(cross(l.vec(), m.vec())) == 0) {
        r = l.s;
        if (ccw(l.s, l.t, m.s) % 2 == 0) return -1;
        return 0;
    }
    D t = cross(l.vec(), l.t - m.s) / cross(l.vec(), m.vec());
    r = m.s + m.vec() * t;
    return 1;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20) << fixed;
    
    P p1, p2;
    D x, y;
    cin >> x >> y; p1 = P(x, y);
    cin >> x >> y; p2 = P(x, y);

    int q;
    cin >> q;
    for (int ph = 0; ph < q; ph++) {
        cin >> x >> y;
        P p3 = P(x, y);
        P z;
        crossLL(L(p1, p2), L(p3, p3 + (p2-p1)*P(0, 1)), z);
        cout << z.x << " " << z.y << endl;
    }
    return 0;
}



Measured memory_bytes: 3292
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
using namespace std;
long long MOD = 1e9 + 7;

vector<int> v;

int main() {
	v.resize(3);
	cin >> v[0] >> v[1] >> v[2];
	sort(v.begin(), v.end(), [](int a, int b) {
		return a > b;
	});
	cout << (10 * v[0] + v[1]) + v[2] << endl;
	return 0;
}

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

typedef pair<int, int> pii;
typedef long long ll;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cerr << #x << " = " << (x) << endl
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

template<class T, class U> void chmin(T& t, const U& u) { if (t > u) t = u; }
template<class T, class U> void chmax(T& t, const U& u) { if (t < u) t = u; }

template<class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	os<<"{";
	rep(i, v.size()) {
		if (i) os<<",";
		os<<v[i];
	}
	os<<"}";
	return os;
}

template <unsigned int MOD>
struct ModInt {
	using uint = unsigned int;
	using ull = unsigned long long;
	using M = ModInt;

	uint v;

	ModInt(ll _v = 0) { set_norm(_v % MOD + MOD); }
	M& set_norm(uint _v) { //[0, MOD * 2)->[0, MOD)
		v = (_v < MOD) ? _v : _v - MOD;
		return *this;
	}

	explicit operator bool() const { return v != 0; }
	M operator+(const M& a) const { return M().set_norm(v + a.v); }
	M operator-(const M& a) const { return M().set_norm(v + MOD - a.v); }
	M operator*(const M& a) const { return M().set_norm(ull(v) * a.v % MOD); }
	M operator/(const M& a) const { return *this * a.inv(); }
	M& operator+=(const M& a) { return *this = *this + a; }
	M& operator-=(const M& a) { return *this = *this - a; }
	M& operator*=(const M& a) { return *this = *this * a; }
	M& operator/=(const M& a) { return *this = *this / a; }
	M operator-() const { return M() - *this; }
	M& operator++(int) { return *this = *this + 1; }
	M& operator--(int) { return *this = *this - 1; }

	M pow(ll n) const {
		if (n < 0) return inv().pow(-n);
		M x = *this, res = 1;
		while (n) {
			if (n & 1) res *= x;
			x *= x;
			n >>= 1;
		}
		return res;
	}

	M inv() const {
		ll a = v, b = MOD, p = 1, q = 0, t;
		while (b != 0) {
			t = a / b;
			swap(a -= t * b, b);
			swap(p -= t * q, q);
		}
		return M(p);
	}

	bool operator==(const M& a) const { return v == a.v; }
	bool operator!=(const M& a) const { return v != a.v; }
	friend ostream& operator<<(ostream& os, const M& a) { return os << a.v; }
};

using Mint = ModInt<1000000007>;

const int maxn = 100010;

Mint fac[maxn];

int main() {
	fac[0] = Mint(1);
	for (int i = 1; i < maxn; ++i) {
		fac[i] = fac[i-1] * Mint(i);
	}

	int N; cin >> N;
	V<int> x(N);
	rep(i, N) cin >> x[i];

	Mint ans;
	Mint way;

	rep(i, N-1) {
		Mint d(x[i+1] - x[i]);
		way += Mint(i+1).inv() * fac[N-1];
		ans += d * way;
	}

	cout << ans << endl;

	return 0;
}

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

#define rep(x, y) for (int i = (x); i < (y); i++)

typedef long long ll;

using namespace std;

int main() {
    int n;
    cin >> n;

    int a, b;
    switch (n) {
        case 1:
            cout << "Hello World";
            break;
        case 2:
            cin >> a >> b;
            cout << (a + b);
            break;
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
// Created by Krishna Ashok
#pragma GCC optimization("Ofast")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
using namespace std;

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds; 
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> Tree;

#define dbg(x) cout<<#x<<"="<<x<<'\n'
#define ll long long
#define pr pair<int,int>
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define For(i,n,a) for(int i=a;i<(n);++i)
#define Forr(i,n) for(int i=n-1;i>=0;i--)
#define fin ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
#define sz(a) (int)a.size()
#define Fill(a,b) memset(a,b,sizeof(a));
#define fileio freopen("http://in.in", "r", stdin),freopen("out.out", "w", stdout);
#define sd(x) scanf("%d",&x)
#define sld(x) scanf("%lld",&x)
const int INF=1e9;

void topsort(int u,vector<bool> &vis,vector<vi> &adj,stack<int> &order){
	vis[u]=true;
	for(int v:adj[u]){
		if(!vis[v])topsort(v,vis,adj,order);
	}
	order.push(u);
}


void solve(){
	int n,m,x,y;
	cin>>n>>m;
	vector<vi> adj(n+1);
	for(int i=0;i<m;i++){
		cin>>x>>y;
		adj[x].push_back(y);
	}
	stack<int> order;
	vector<int> dist(n+1,-INF);
	dist[0]=INF;
	vector<bool> vis(n+1,false);
	for(int i=1;i<=n;i++){
		if(!vis[i])topsort(i,vis,adj,order),dist[i]=0;
	}
	while(!order.empty()){
		int u=order.top();
		order.pop();
		if(dist[u]==-INF)continue;
		for(int v:adj[u]){
			if(dist[v]==-INF)dist[v]=dist[u]-1;
			else dist[v]=min(dist[v],dist[u]-1);
		}
	}

	cout<<*min_element(all(dist))*-1<<endl;

}



int main()
{
    fin;
    solve();
    return 0;
}

Measured memory_bytes: 12808
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define MOD 1000000007
#define dd double
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;

map<int, list<int>> adjList;


int dp[N];

int dfs(int k){

	int &ans = dp[k];

	if(dp[k]!=-1)
		return ans;
	ans=0;
	//cout << k << " ";
	for(auto i: adjList[k]){
		ans = max(ans, 1+dfs(i));
	}
	return ans;
}


int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
//ios_base& scientific (ios_base& str);

memset(dp, -1, sizeof(dp));
int n, m;
cin >> n >> m;
for(int i=0; i<m;i++){
	int a, b;
	cin >> a >> b;
	adjList[a].push_back(b);
}

int answer =0;

for(int i=1;i<=n;i++){
	answer = max(answer, dfs(i));
}
cout << answer;



return 0;
}



Measured memory_bytes: 13440
#include <iostream>
#include <cstdio>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
using namespace std;
#define MAX 100000001
/*
void eratos(bool *p){
	for(int i=1; i<MAX; ++i){
		p[i] = true;
	}
	for(int i=2; i*i<MAX; ++i){
		for(int j=2; i*j<MAX; ++j){
			p[i*j] = false;
		}
	}
}
*/

int main(){
	int n,sum=0;
	vector<bool> p(MAX);
	cin >> n;
	vector<int> arr(n);
	for(int i=0; i<n; ++i){
		cin >> arr[i];
	}

	for(int i=1; i<MAX; ++i){
		p[i] = true;
	}

	for(int i=2; i*i<MAX; ++i){
		if(p[i] == true){
			for(int j=2; i*j<MAX; ++j){
				p[i*j] = false;
			}
		}
	}
	
	for(int i=0; i<n; ++i){
		if(p[arr[i]] == true) ++sum;
	}
	cout << sum << endl;
	return 0;
}

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

int main() {
    int n;
    cin >> n;
    int no_1, no_2 = 0;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if(no_1 < a[i]){
            no_2 = no_1;
            no_1 = a[i];
        } else if(no_2 < a[i]){
            no_2 = a[i];
        }
    }
    for (int j = 0; j < n; j++) {
        if (no_1 != a[j]) cout << no_1 << endl;
        else cout << no_2 << endl;
    }
    return 0;
}

Measured memory_bytes: 2432
#include<bits/stdc++.h>
using namespace std;
void Main(){
    char c=getchar();
    while(c<'1'||c>'9'){
        c=getchar();
    }
    while(c>='1'&&c<='9'){
        if(c == '9') putchar('1');
        else putchar('9');
        c=getchar();
    }
    putchar('\n');
}
int main(){cin.tie(nullptr);ios::sync_with_stdio(false);Main();return 0;}

Measured memory_bytes: 256
// ÐÐµ Ñ‚Ð¾Ñ‚ Ð²ÐµÐ»Ð¸Ðº, ÐºÑ‚Ð¾ Ð½Ð¸ÐºÐ¾Ð³Ð´Ð° Ð½Ðµ Ð¿Ð°Ð´Ð°Ð», Ð° Ñ‚Ð¾Ñ‚ Ð²ÐµÐ»Ð¸Ðº â€” ÐºÑ‚Ð¾ Ð¿Ð°Ð´Ð°Ð» Ð¸ Ð²ÑÑ‚Ð°Ð²Ð°Ð»!
// 0 <--> 100
#include <algorithm>
#include <iostream>
#include <cstring>
#include <string>
#include <bitset> 
#include <vector>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
                
//#define int long long
#define ll long long 
bool FLAG = 0;
#define debug(x) if (FLAG) {cerr << #x << " = " << x << endl;}
#define debug_vec(x) if (FLAG) {cerr << #x << " = {"; for (auto to x) cout << to << ", "; cout << "}" << endl}
#define F first
#define S second
#define sqr(x) ((x) * (x))
#define make make_pair
#define pb push_back
#define sz(x) (int)(x.size()) 
#define all(x) x.begin (), x.end ()

using namespace std;
                        
typedef unsigned long long ull;
typedef long double ld;

const int MOD = (int)1e9 + 7, N = (int)2e6+ 222;
const ll INF = (ll)1e18;

int a, b;
void solve () {
	cin >> a >> b;
	if (a <= 0 && 0 <= b) {
		cout << "Zero";
		return;
	}
	if (a >= 1 || (a - min(-1, b) + 1) % 2 == 0) cout << "Positive";
	else cout << "Negative";
}

signed main () {
	#ifdef Maga
		freopen("input", "r", stdin);
	#endif  
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);                                              
	int t = 1;
	while (t --) {
		solve ();
	}
	return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <math.h>
#include <string>
using namespace std;
typedef long long int ll;

int main(){
	string s; cin >> s;
	int cnt=0;
	for(int i=0;i<6;i++){
		if(s[i]=='1')cnt++;
	}
	cout << cnt << endl;
}


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

#define int long long

int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif

	int x, n, t;
	cin >> x >> n;

	unordered_map<int, bool> mp;
	for (int i = 0; i < n; ++i) {
		cin >> t;
		mp[t] = 1;
	}

	for (int i = 0;; ++i) {
		if (mp.find(x - i) == mp.end()) {
			cout << x - i;
			return 0;
		}
		if (mp.find(x + i) == mp.end()) {
			cout << x + i;
			return 0;
		}
	}

	return 0;
}

Measured memory_bytes: 3656
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long LL;

struct node{
	LL pos,x;
}b[200005];
bool cmpnode(node x,node y){ return x.pos < y.pos; }

struct queryy{
	LL l,r,id;
}q[400005];

LL n,m,tot = 0;
LL lb[200005],a[200005];
LL fa[200005];

LL ec = 0,to[400005],nxt[400005],w[400005],hed[200005] = {0};
void add_edge(LL f,LL t,LL cst){
	++ ec; to[ec] = t; w[ec] = cst; nxt[ec] = hed[f]; hed[f] = ec;
}

LL getf(LL x){
	if(x == fa[x]) return x;
	return fa[x] = getf(fa[x]);
}

void mergee(LL x,LL y,LL z){
	if(getf(x) == getf(y)) return;
	add_edge(x,y,z); add_edge(y,x,z);
	fa[getf(x)] = getf(y);
}

LL val[200005],fal = 0,ans[200005],vis[200005] = {0};
void dfs(LL u,LL f,LL fe){
	val[u] = a[u]; vis[u] = 1;
	for(LL i = hed[u];i;i = nxt[i]){
		LL v = to[i];
		if(v == f) continue;
		dfs(v,u,w[i]);
		val[u] ^= val[v];
	}
	if(val[u]) ans[fe] = 1;
	if(ans[0]) fal = 1;
}

int main(){
	ios::sync_with_stdio(false);
	cin >> n >> m;
	for(LL i = 1;i <= n;i ++) cin >> b[i].pos >> b[i].x; b[n + 1].x = 0;
	sort(b + 1,b + 1 + n,cmpnode);
	for(LL i = 1;i <= n;i ++) lb[i] = b[i].pos; lb[n + 1] = 0x3f3f3f3f3f3f3f3f;
	for(LL i = 1;i <= n + 1;i ++) a[i] = b[i].x ^ b[i - 1].x;
	for(LL i = 1;i <= n + 1;i ++) fa[i] = i;
	
	for(LL i = 1;i <= m;i ++){
		cin >> q[i].l >> q[i].r; q[i].id = i;
		q[i].l = lower_bound(lb + 1,lb + 2 + n,q[i].l) - lb;
		q[i].r = upper_bound(lb + 1,lb + 2 + n,q[i].r) - lb - 1;
	}
	
    for(LL i = 1;i <= m;i ++) mergee(q[i].l,q[i].r + 1,q[i].id);
	for(LL i = 1;i <= n + 1;i ++) if(!vis[i]) dfs(i,0,0);
	if(fal){ cout << -1 << endl; return 0; }
	for(LL i = 1;i <= m;i ++) if(ans[i]) tot ++;
	cout << tot << endl;
	for(LL i = 1;i <= m;i ++) if(ans[i]) cout << i << ' '; cout << endl;
	return 0;
}

Measured memory_bytes: 30464
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<limits.h>
#include<cmath>
#include<queue>
#include<stack>

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

#define rep(i,n) for(ll i = 0; i < (ll)n; i++)
#define swap(a,b) a^=b;b^=a;a^=b;
#define chmax(a,b) {if(a < b) a = b;}
#define chmin(a,b) {if(a > b) a = b;}

using namespace std;
typedef long long ll;
ll gcd(ll, ll);
vector<bool> to_binary(int);
ll nCr(ll n, ll r);

const ll INF = 1LL << 60;

typedef tuple<ll, ll> mtupl;

/*

bool mycomp(mtupl x, mtupl y) {
	return get<1>(x) < get<1>(y);
}

int vsum(vector<int> v) {
	int res = 0;
	for (auto it = v.begin(); it != v.end(); it++)
		res += *it;
	return res;
}

int vmin(vector<int> v) {
	int min = INT32_MAX;
	for (auto it = v.begin(); it != v.end(); it++)
		min = std::min(min, *it);
	return min;
}

int vmax(vector<int> v) {
	int max = INT32_MIN;
	for (auto it = v.begin(); it != v.end(); it++)
		max = std::max(max, *it);
	return max;
}

ll gcd(ll A, ll B) {
	if (A == 0 || B == 0) return max(A, B);
	int r = A % B;
	while (r != 0) {
		A = B;
		B = r;
		r = A % B;
	}
	return B;
}

vector<ll> prime_factor(int64_t n) {
	//map< ll, ll > ret;
	vector<ll> ret;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			//ret[i]++;
			ret.push_back(i);
			n /= i;
		}
	}
	if (n != 1)ret.push_back(n);// ret[n] = 1;
	return ret;
}

const int MAX = 1000000;
const int MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
ll COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

struct edge {
	ll to;
	ll cost;
};

*/

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//Program Start	

	int n;
	cin >> n;

	cout << n / 2 + n % 2 << endl;



ProgramEndPointLabel:;

	//Program End
#ifndef DEBUG
	system("pause");
#endif // !DEBUG


	return 0;
}




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

using ll = long long;
 
const int mod = 1e9 + 7;
 
void add_self(int&a, int b) {
    a += b;
    if(a >= mod) {
        a -= mod;
    }
}

int mul(int a, int b) {
    return (ll) a * b % mod;
}
 
int n;
 
struct M {
    vector<vector<int>> t;
    M() {
        t.resize(n, vector<int>(n));
    }
    M operator* (const M& b) const {
        M c = M();
        for(int i = 0; i < n; ++i) {
            for(int j = 0; j < n; ++j) {
                for(int k = 0; k < n; ++k) {
                    add_self(c.t[i][k], mul(t[i][j], b.t[j][k]));
                }
            }
        }
        return c;
    }
};
 
int main() {
    ll k;
    scanf("%d%lld", &n, &k);
    vector<vector<int>> can(n, vector<int>(n));
    for(int i = 0; i < n; ++i) {
        for(int j = 0; j < n; ++j) {
            scanf("%d", &can[i][j]);
        }
    }
    M answer = M();
    for(int i = 0; i < n; ++i) {
        answer.t[i][i] = 1;
    }
    M m = M();
    m.t = can;
    while(k) {
        if(k % 2) {
            answer = answer * m;
        }
        m = m * m;
        k /= 2;
    }
    int total = 0;
    for(int i = 0; i < n; ++i) {
        for(int j = 0; j < n; ++j) {
            add_self(total, answer.t[i][j]);
        }
    }
    printf("%d\n", total);
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define max0(a,b,c) max(max(a,b),c)
#define min0(a,b,c) min(min(a,b),c)
#define ft first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
using Graph = vector<vector<int>>;
typedef long long lint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldouble;
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<ull> ulvec;
typedef vector<pair<int,int>> pvec;
typedef vector<pair<ll,ll>> plvec;
typedef vector<tuple<ll,ll,ll>> tvec;
typedef vector<string> svec;

int main(){
    int n;
    cin>>n;
    double ans=0.0;
    vector<double> x(n);
    svec u(n);
    rep(i,n) cin>>x[i]>>u[i];
    rep(i,n){
        if(u[i]=="JPY") ans+=x[i];
        else ans+=x[i]*380000.0;
    }
    printf("%.10f",ans);
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

int main() {
  int N, K;
  cin >> N >> K;
  int maxK = (N - 1) * (N - 2) / 2;
  if (K > maxK) {
    cout << -1 << endl;
  } else {
    int M = (N - 1) + (maxK - K);
    cout << M << endl;
    for (int i = 2; i <= N; i++) {
      cout << 1 << ' ' << i << endl;
    }
    int count = maxK - K;
    for (int i = 2; i <= N; i++) {
      for (int j = i + 1; j <= N; j++) {
        if (count <= 0) break;
        count--;
        cout << i << ' ' << j << endl;
      }
      if (count <= 0) break;
    }
  }
  return 0;
}

Measured memory_bytes: 764
N = int(input())
A = list(map(int, input().split()))
A.sort()

neg = [n for n in A if n < 0]
pos = [n for n in A if n >= 0]

if len(neg) == 0:  # all positive
    x = A.pop(0)
    print(sum(A) - x)
    pivot = A.pop()
    for y in A:
        print(x, y)
        x -= y
    print(pivot, x)
elif len(pos) == 0:  # all negative
    x = A.pop()
    print(x - sum(A))
    for y in A:
        print(x, y)
        x -= y
else:
    print(sum(pos) - sum(neg))
    pivot = pos.pop()
    x = neg.pop()
    for y in pos:
        print(x, y)
        x -= y
    x, pivot = pivot, x
    for y in neg:
        print(x, y)
        x -= y
    print(x, pivot)


Measured memory_bytes: 14144
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        
        HashSet<Integer> set = new HashSet<>();
        int ans = 0;
        for (int i=0; i<N; i++) {
            int d = sc.nextInt();
            if (!set.contains(d)) {
                set.add(d);
                ans++;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int N = 1000000;
const ll mod = 1000000007;
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}

/*------------------------------------------------------------------*/

int main(){
    int n; cin >> n;
    vector<double> x(n);
    vector<double> y(n);
    double ans = 0;
    rep(i, n)cin >> x[i] >> y[i];
    for(int i = 0; i < n; ++i){
        for(int j = i + 1; j < n; ++j){
            ans += pow(pow(x[i] - x[j], 2) + pow(y[i] - y[j], 2), 0.5);
        }
    }
    ans = ans * (2.0 / n);
    cout << setprecision(15) << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
bool chmin(ll&a,ll b){if(a>b){a=b;return true;}return false;}
bool chmax(ll&a,ll b){if(a<b){a=b;return true;}return false;}
#define debg cout<<"debg"<<endl
void printVec(const vector<ll>&a){
  for(auto elm:a)cout<<elm<<" ";
  cout<<endl;
}
signed main(){
  
  int n;cin>>n;
  vector<ll> a(n);
  rep(i,n)cin>>a[i];

  vector<ll> L(n+2),R(n+2);
  L[0]=R[0]=L[n+1]=R[n+1]=0;
  rep(i,n)L[i+1]=gcd(L[i],a[i]);
  for(int i=n;i>0;--i)R[i]=gcd(R[i+1],a[i-1]);
  //printVec(L);printVec(R);
  ll ans=0;
  for(int i=1;i<=n;++i){
    chmax(ans,gcd(L[i-1],R[i+1]));
  }
  cout<<ans<<endl;

  return 0;
}



Measured memory_bytes: 2560
#include <iostream>
using namespace std;
typedef long long ll;

int main(int argc, char* argv[])
{
    int N;
    cin >> N;

    for(int i=1; i<=9; i++){
        if(N%i==0){
            if( N/i <= 9){
                cout << "Yes" << endl;
                return EXIT_SUCCESS;
            }
        }
    }
    cout << "No" << endl;
    return EXIT_SUCCESS;
}

Measured memory_bytes: 384
def Lucas(L1,L2,n,end):
   return L1+L2 if(n==end) else Lucas(L1+L2,L1,n+1,end)
def myAnswer(N:int) -> int:
   if(N == 0):
      return 2
   elif(N == 1):
      return 1
   else:
      return Lucas(1,2,2,N)
def modelAnswer():
   tmp=1
def main():
   N = int(input())
   print(myAnswer(N))

if __name__ == '__main__':
   main()

Measured memory_bytes: 3064