akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main()
{
  int N, K, Q;
  cin >> N >> K >> Q;
  vector<int> bucket(N, K - Q);

  int temp;
  for (int i = 0; i < Q; i++)
  {
    cin >> temp;
    bucket.at(temp - 1)++;
  }

  for (int i = 0; i < N; i++) {
    if (bucket.at(i) <= 0) {
      cout << "No" << endl;
    } else {
      cout << "Yes" << endl;
    }
  }
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;

int main(void) {

	int n, d, x, a[100], ans = 0;

	cin >> n >> d >> x;
	for (int i = 0; i < n; i++)
		cin >> a[i];

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < d; j += a[i])
			ans++;
	}

	cout << ans + x << endl;

	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize "-O3"
#pragma GCC target ("avx")
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v),greater<int>())
#define SPEED ios::sync_with_stdio(false);cin.tie(0);cout<<fixed<<setprecision(12)
#define erase(i) erase(i, 1)
signed gcd(int a, int b){return b?gcd(b,a%b):a;}
signed lcm(int a, int b){return a*b/gcd(a,b);}
template<typename T> void remove(std::vector<T>& vector, unsigned int index){vector.erase(vector.begin() + index);}
//priority_queue<int, vi, greater<int> > que;//昇順
//priority_queue<int> que; // 降順

using namespace std;

const int mod=1e9+7;

signed main()
{
    SPEED;
    string s;
    cin >> s;
    string str[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
    int ans = 7;
    rep(i,7)
    {
        if(str[i] != s)--ans;
        else break;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>

using namespace std;
int jue(int a,int b)
{
    int s;
    if (a-b < 0)
        s = b-a;
    else
        s = a-b;
    return s;
}

int main()
{
   int n;
   int flag = 1;
   int a = 0,b = 0,c = 0;
   int x,y,z;
   while (scanf ("%d",&n) != EOF)
   {
       //scanf ("%d",&n);
       for (int i = 0;i < n;i++)
       {
           int s = 0;
           scanf ("%d%d%d",&x,&y,&z);
           s = jue(y,b) + jue(z,c);
           int t = x - a;
           if (s > t)
               flag = 0;
           else if (s == t)
               continue;
           else if ((t-s)%2 == 1)
               flag = 0;
           a = x;
           b = y;
           c = z;
       }
       if (flag == 0)
           printf ("No\n");
       else if (flag == 1)
           printf ("Yes\n");
   }
   return 0;
}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {
	public static void main(String[] args)throws IOException{
		int count;
		int n,p;//?????°????°????
		int i,j;
		int wan;
		int k=0;
		List<Human> list=new ArrayList<Human>();
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		while(true){
			count=0;
			list.clear();
			wan=0;
			k=0;
			
			String str=br.readLine();
			String[] a=str.split(" ");
			n=Integer.parseInt(a[0]);
			p=Integer.parseInt(a[1]);
			if(n==0&&p==0){
				break;
			}
			for(i=0;i<n;i++){
				Human e=new Human();
				list.add(i,e);
			}
			wan=p;
			
			while(true){
				if(wan>0){
					list.get(k).setStone(list.get(k).getStone()+1);
					wan--;
				}else if(wan==0){
					wan=list.get(k).getStone();
					list.get(k).setStone(0);
				}
				if(list.get(k).getStone()==p){
					System.out.println(k);
					break;
				}
				if(k<n-1){
					k++;
				}else{
					k=0;
				}
			}
		}
	}
	
}

class Human{
	int stone=0;

	public int getStone() {
		return stone;
	}

	public void setStone(int stone) {
		this.stone = stone;
	}
	
}

Measured memory_bytes: 25736
#include<stdio.h>
#include<stdlib.h>
struct node{
  int key;
  struct node *parent;
  struct node *right;
  struct node *left;
};
typedef struct node *Node;
Node T;
#define NIL NULL;
void Insert(int);
Node Find(int);
Node Successor(Node);
Node Minimun(Node);
void Delete(int);
void Preorder(Node);
void Inorder(Node);
int main()
{
  int n,i,key;
  char S[7];
  
  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%s",S);
    if(S[0]=='i'){
      scanf("%d",&key);
      Insert(key);
    }
    else if(S[0]=='f'){
      scanf("%d",&key);
      if(Find(key)!=NULL)printf("yes\n");
      else printf("no\n");
    }
    else if(S[0]=='d'){
      scanf("%d",&key);
      Delete(key);
    }
    else{
      Inorder(T);
      printf("\n");
      Preorder(T);
      printf("\n");

    }
  }
  return 0;
}

void Insert(int key)
{
  Node y,x,z;
  y=NIL;
  x=T;
  z=malloc(sizeof(struct node));
  z->key=key;
  z->left=NIL;
  z->right=NIL;
  while(x!=NULL){
    y=x;
    if( z->key < x->key )x=x->left;
    else x=x->right;
  }
  z->parent=y;
  if(y==NULL){
    T=z;
  }
 else if(z->key<y->key){
      y->left=z;
  }
  else{
    y->right=z;
  }
}

Node Find(int key)
{
  Node TT;
  TT=T;
  while(TT!=NULL && TT->key!=key){
    if(key<TT->key)TT=TT->left;
    else TT=TT->right;
  }
  if(TT==NULL)return NULL;
  else return TT;
}

Node Minimum(Node TT)
{
  while(TT->left!=NULL){
    TT=TT->left;
  }
  return TT;
}

Node Successor(Node Z)
{
  Node X;
  if(Z->right!=NULL)return Minimum(Z->right);
  X=Z->parent;
  while(X!=NULL && Z==X->right){
    Z=X;
    X=X->parent;
  }
  return X;
}

void Delete(int key)
{
  Node X,Y,Z=Find(key);  

  if(Z->left==NULL||Z->right==NULL)Y=Z;
  else{
     Y=Successor(Z);
  } 
  if(Y->left!=NULL)X=Y->left;
  else{
     X=Y->right;
  }
  
  if(X!=NULL)X->parent=Y->parent;
  if(Y->parent==NULL)T=X;
  else if(Y==Y->parent->left)Y->parent->left=X;
  else Y->parent->right=X;
 
  if(Y!=Z)Z->key=Y->key;
}


void Preorder(Node T)
{
  printf(" %d",T->key);
  if(T->left!=NULL){
    Preorder(T->left);
  }
  if(T->right!=NULL){
    Preorder(T->right);
  }

}

void Inorder(Node T)
{
  if(T->left!=NULL && T->right!=NULL){
    Inorder(T->left);
    printf(" %d",T->key);
    Inorder(T->right);

  }
  if(T->left!=NULL && T->right==NULL){
   Inorder(T->left);
     printf(" %d",T->key);
  }

  if(T->right!=NULL && T->left==NULL){
  printf(" %d",T->key);
 Inorder(T->right);

  }
  if(T->left==NULL && T->right==NULL)printf(" %d",T->key);

}

Measured memory_bytes: 19364
N, Q = gets.chomp.split(' ').map(&:to_i)
S = gets.chomp.chars
SPELL_LIST = Q.times.map { gets.chomp.split(' ') }

MEMO = {}
def last_position(i)
  return MEMO[i] if MEMO[i]
  pos = i
  dropped_pos = nil
  SPELL_LIST.each do |t, d|
    ch = S[pos]
    next unless t == ch
    if d == 'L'
      pos -= 1
    else
      pos += 1
    end
    if pos < 0
      ret = -1
      break
    elsif pos > N - 1
      ret = N
      break
    end
  end
  MEMO[i] = dropped_pos || pos
end

def last_left_dropped_pos(l, r)
  return nil if l > r
  center = l + ((r - l) / 2)
  pos = last_position(center)
  if pos == -1
    last_left_dropped_pos(center + 1, r) || center
  elsif pos == N
    last_left_dropped_pos(l, center - 1)
  else
    last_left_dropped_pos(l, center - 1)
  end
end

def last_right_dropped_pos(l, r)
  return nil if l > r
  center = l + ((r - l) / 2)
  pos = last_position(center)
  if pos == -1
    last_right_dropped_pos(center + 1, r)
  elsif pos == N
    last_right_dropped_pos(l, center - 1) || center
  else
    last_right_dropped_pos(center + 1, r)
  end
end

left = last_left_dropped_pos(0, N - 1)
right = last_right_dropped_pos(left.nil? ? 0 : left + 1, N - 1)
ans = N - (left.nil? ? 0 : left + 1) - (right.nil? ? 0 : N - 1 - right + 1)
puts ans


Measured memory_bytes: 76856
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        boolean out = false;
        if(s.charAt(0) == s.charAt(1)){
            if(s.charAt(2) == s.charAt(3)){
                out = true;
            }
        }else if(s.charAt(0) == s.charAt(2)){
            if(s.charAt(1) == s.charAt(3)){
                out = true;
            }
        }else if(s.charAt(0) == s.charAt(3)){
            if(s.charAt(1) == s.charAt(2)){
                out = true;
            }
        }
        if(s.charAt(0) == s.charAt(1) && s.charAt(1) == s.charAt(2) && s.charAt(2) == s.charAt(3)){
            out = false;
        }
        if(out){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 22868
#include <bits/stdc++.h>
using namespace std;
int arr[100000];
int main()
{
    int N;
    int ans=0;
    int a,b;
    cin >> N;
    for(int i=0;i<N;i++) cin >> arr[i];
    sort(arr,arr+N);
    for(int i=0;i<N;i++)
    {
        int p=1;
        while(i<N-1&&arr[i]==arr[i+1])
        {
            p++;
            i++;
        }
        if(p%2==0) continue;
        ans++;
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
#include <stdio.h>

int main(void){
    int k[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51
};
    int K;

    scanf("%d", &K);
    printf("%d", k[K-1]);
}

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

int main() {
	string S, T, U;
	int A, B;
	cin >> S >> T;
	cin >> A >> B;
	cin >> U;

	if (S == U) {
		cout << A - 1 << " " << B << endl;
	}
	else {
		cout << A << " " << B - 1 << endl;
	}

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int N,P;
    cin>>N>>P;
    int num = 0;
    for(int i=0;i<N;i++){
        int bis;
        cin >> bis;
        if(bis%2==1 ){
            num++;
        }
    }
    if(num==0){
        cout<<(P == 0 ? (1LL << N) : 0 );
    }
    else cout <<(1LL <<(N - 1));
    
    return 0;
}


Measured memory_bytes: 3628
# -*- coding: utf-8 -*-
#num= list(map(int, input().split()))
#from operator import itemgetter
n, k= map(int, input().split())
v= list(map(int, input().split()))

sum_max = 0
for t in range(min(2*n+1, k+1)):
  if t > 0:
    for put in range(t//2 + 1):
      pick = t - put
      for left in range(min(pick+1,n+1)):
        right= min(pick,n) - left
        if left!=0:
          vs=v[0:left]
        else:
          vs=[]
        if right!=0:
          vs.extend(v[-right:])
        vs.sort()
        for i in range(put):
          if vs !=[]:
            if vs[0] < 0:
              del vs[0]
            else:
              break
          else:
            break
#        print("pick"+str(pick)+"put"+str(put)+"left"+str(left)+"right"+str(right)+"="+str(sum(vs)))
        sum_max = max(sum_max, sum(vs))
print(sum_max)

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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

int main() {
    string S;
    cin >> S;
    if (S[0] == '7' or S[1] == '7' or S[2] == '7') {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

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

using namespace std;

int n, m;

int func(int i, int j){

    return i * m + j * n - (i * j) * 2;

}

int main(){

    int k;

    cin >> n >> m >> k;

    for (int i = 0; i <= n;i++){
        for (int j = 0; j <= m;j++){
            if(func(i,j) == k){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
K = int(input())

import math
 
gcd_sum = 0
 
for a in range(1,K + 1):
    for b in range(1,K + 1):
        ab = math.gcd(a,b)
        for c in range(1,K + 1):
            gcd_sum += math.gcd(ab,c)       
 
print(gcd_sum)

Measured memory_bytes: 9184
using System;

namespace OnlineJudge
{
    class ITP1_1_D
    {
        static void Main(string[] args)
        {
            var total = int.Parse(Console.ReadLine());

            var temp = total;
            var h = temp / 60 / 60;
            temp -= 60 * 60 * h;
            var m = temp / 60;
            temp -= 60 * m;
            var s = temp;

            // Console.WriteLine($"{x*y} {2*x+2*y}");
            Console.WriteLine(string.Format("{0}:{1}:{2}", h, m, s));
        }
    }
}

Measured memory_bytes: 9236
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REP1(i,n) for(int i = 1; i < n+1 ;i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
using namespace std;
typedef long long ll;

int main(){
    vector<vector<int>> a(3,vector<int>(3));
    REP(i,3){
        REP(j,3){
            cin >> a[i][j];
        }
    }
    int n;
    cin>>n;
    vector<int>b(n);
    REP(i,n) cin >> b[i];
    vector<vector<int>> ans{
        {-1,-2,-3},
        {-4,-5,-6},
        {-7,-8,-9},
    };//印の二次元配列
    REP(i,9){
        REP(j,3){
            REP(k,3){
                if (b[i]==a[j][k]){
                    ans[j][k]=1;
                }
            }
        }
    }

    if((ans[0][0]==ans[0][1] &&ans[0][1]==ans[0][2])||(ans[1][0]==ans[1][1] &&ans[1][1]==ans[1][2])||(ans[2][0]==ans[2][1] &&ans[2][1]==ans[2][2])||(ans[0][0]==ans[1][0] &&ans[1][0]==ans[2][0])||(ans[0][1]==ans[1][1] &&ans[1][1]==ans[2][1])||(ans[0][2]==ans[1][2] &&ans[1][2]==ans[2][2])||(ans[0][0]==ans[1][1] &&ans[1][1]==ans[2][2])||(ans[0][2]==ans[1][1] &&ans[1][1]==ans[2][0])){

    cout << "Yes" << endl;
        }
    else{
        cout << "No" << endl;
    }

    

    return 0;

}

Measured memory_bytes: 256
#include<stdio.h>
#include<string>
#include<math.h>
#include<stdlib.h>
#include<set>
#include<bitset>
#include<map>
#include<vector>
#include<string.h>
#include<algorithm>
#include<iostream>
#include<queue>
#include<deque>
#include<stack>
#include<cmath>
#include<ctime>
#include<complex>
#include<list>
#include<limits.h>
using namespace std;

int n;

int sum(long long x){
	int ret=0;
	while(x){
		ret+=x%10;
		x/=10;
	}
	return ret;
}

int main(){
	scanf("%d",&n);
	long long x=1ll,d=1ll;
	while(n--){
		printf("%lld\n",x);
		if((x+d)*sum(x+d*2)>(x+d*2)*sum(x+d)) d*=10;
		x+=d;
	}
	return 0;
}

/*
数据不清空，爆零两行泪
读题不认真，爆零两行泪
分析不仔细，爆零两行泪
建树不构造，爆零两行泪
变量不统一，爆零两行泪
边界不算清，爆零两行泪
数组不开大，爆零两行泪
*/

Measured memory_bytes: 256
#include<stdio.h>

void show(int A[],int N){
  for (int i = 0; i < N; i++) {
    printf("%d",A[i] );
    if(i!=N-1)printf(" " );
  }
  printf("\n");
}

int  bubble (int A[],int N){
  int i ,j;
  int c=0;
  j=N-1;
  int sw;
for (int j = 0; j < N-1 ; j++)
  for (i= N-1; j<i; i--) { //これだと二回め以降の繰り返しができていない。
    if(A[i]<A[i-1]){
      sw=A[i-1];
      A[i-1]=A[i];
      A[i]=sw;
      c++;
    }
  }
  show(A,N);
  return c;
}

int main(){
  int A[100];
  int N;
scanf("%d\n",&N);
for (int i = 0; i < N; i++) scanf("%d",&A[i]);
printf("%d\n",bubble(A,N) );
  return 0;
}



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

int n, m;
int chk[100001];
struct edg {
    int idx, dst;
};
vector<edg> gph[100001];
int dst[100001];

void go(int now, int cnt) {
    dst[now] = cnt;
    chk[now] = 1;
    for (edg nxt : gph[now]) {
        if (!chk[nxt.idx]) {
            go(nxt.idx, cnt+nxt.dst);
        }
        else {
            if (dst[nxt.idx] != cnt+nxt.dst) {
                puts("No");
                exit(0);
            }
        }
    }
}

int main() {
    scanf("%d %d", &n, &m);
    while (m--) {
        int u, v, w;
        scanf("%d %d %d", &u, &v, &w);
        gph[u].push_back({ v,w });
        gph[v].push_back({ u,-w });
    }

    for (int i = 1; i <= n; i++) {
        if (!chk[i]) {
            go(i, 0);
        }
    }

    puts("Yes");

    return 0;
}


Measured memory_bytes: 11392
#include <stdio.h>
#include <algorithm>
#include <string.h>
using namespace std;
const int MAX_N=1000;
const int MAX_M=1000;
const int INF=1000000000;
int  dp[MAX_M][MAX_N];
int dis[MAX_N];
int wea[MAX_M];
int n,m;
int rec(int i,int j){
	if(j==n){
		   return 0;
	   }
	   if(i==m){
	   	   return INF;
	   }
	if(dp[i][j]>=0){
		return dp[i][j];
	}

   return dp[i][j]=min(rec(i+1,j),rec(i+1,j+1)+wea[i]*dis[j]);
}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++){
		scanf("%d",&dis[i]);
	}
	for(int i=0;i<m;i++){
		scanf("%d",&wea[i]);
	}
	memset(dp,-1,sizeof(dp));

	printf("%d\n",rec(0,0));
	return 0;

}

Measured memory_bytes: 4988
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
template<class T,class U> inline bool chmin(T&x,U y){if(x>y){x=y;return true;}return false;}
template<class T,class U> inline bool chmax(T&x,U y){if(x<y){x=y;return true;}return false;}
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s;
    bool f=true;
    char c;
    fr(i,10){
        char l='0'-1,r='9';
        if(!i) l='0';
        while(r-l>1){
            char m=(l+r)/2;
            cout<<"? "<<s<<m<<"99999999"<<(i?"":"9")<<endl;
            cin>>c;
            if(c=='Y') r=m;
            else l=m;
        }
        if(r=='0'){
            if(f){
                string S;
                fr(j,i) S+='9';
                cout<<"? "<<S<<endl;
                cin>>c;
                if(c=='Y') break;
            }
            else{
                string S="1";
                fr(j,i) S+='0';
                cout<<"? "<<S<<endl;
                cin>>c;
                if(c=='N') break;
            }
        }
        if(i&&r!='0') f=false;
        if(!i&&r!='1') f=false;
        s+=r;
    }
    cout<<"! "<<s<<endl;
}

Measured memory_bytes: 624
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int INF = 1000000000;
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define rep(i,n) REP(i, 0, n)
typedef complex<double> Point;
double cross(const Point& a, const Point& b){
    return (conj(a) * b).imag();
}
int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    int N; cin >> N;
    vector<Point> poly(N);
    rep(i, N) cin >> poly[i].real() >> poly[i].imag();
    double sum = 0;
    Point s = poly[N - 1];
    for(int i = N - 2; i >= 1; --i)
      sum += cross(poly[i] - s, poly[i - 1] - s) / 2.0;
    cout << fixed << setprecision(1) << abs(sum) << endl;
    return 0;
}

Measured memory_bytes: 1300
N = int(input())
A = list(map(int,input().split()))
B = [0]+list(map(int,input().split()))
sum_A = sum(A)
#print(A,B,"\n")
for i in range(N):
    if A[i] >= B[i]:
        A[i] -= B[i]
        B[i] = 0
    else:
        B[i] -= A[i]
        A[i] = 0
    #print(A,B)
    if A[i] >= B[i+1]:
        A[i] -= B[i+1]
        B[i+1] = 0
    else:
        B[i+1] -= A[i]
        A[i] = 0
    #print(A,B)
#print()
i = N
if A[i] >= B[i]:
    A[i] -= B[i]
    B[i] = 0
else:
    B[i] -= A[i]
    A[i] = 0
#print(A,B)
sum_A -= sum(A)
print(sum_A)


Measured memory_bytes: 19004
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
typedef long long ll;
using namespace std;

int main(){
  ll n,k;
  cin >> n >> k;
  ll i,j,h;
  ll ret = 6e18;
  vector<pair<ll,ll> > v(n);
  for(i=0;i<n;i++){
    cin >> v[i].first >> v[i].second;
  }
  ll l,r,u,d;
  for(l=0;l<n;l++){
    for(r=l+1;r<n;r++){
      for(u=0;u<n;u++){
        for(d=u+1;d<n;d++){
          ll lp,rp,up,dp;
          lp = min(v[l].first,v[r].first);
          rp = max(v[l].first,v[r].first);
          up = max(v[u].second,v[d].second);
          dp = min(v[u].second,v[d].second);
          if(lp==rp || up==dp)continue;
          ll cnt=0;
          for(i=0;i<n;i++){
            if(v[i].first>=lp && v[i].first<=rp && v[i].second>=dp && v[i].second<=up)cnt++;
          }
          if(cnt>=k){
            ll wide = max(lp,rp)-min(lp,rp);
            ll height = max(up,dp)-min(up,dp);
            ret = min(ret,wide*height);
          }
        }
      }
    }
  }
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(){
    
    ll N, M;
    cin >> N >> M;
    ll ans[100] = {};
    for(ll i = 0; i < M; i++){
        ll a, b;
        cin >> a >> b;
        ans[a]++;
        ans[b]++;
    }
    for(ll i = 1; i <= N; i++)cout << ans[i] << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
#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() {
  int n;
  cin >> n;
  map<string, int> a;
  int k = 0;
  rep(i, n) {
    string s;
    cin >> s;
    if (a[s] != 1) {a[s] = 1; k++;}
  }
  cout << k << endl;
  return 0;
}

Measured memory_bytes: 19120
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define N 100010
struct node
{
	int l, r;
}s[100010];
int cmp(node a, node b) {
	return a.l < b.l;
}
int main() {

	int n,a,b;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d%d", &s[i].l, &s[i].r);
	}
	sort(s,s+n,cmp);
	printf("%d\n", s[n - 1].l + s[n - 1].r);

}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <climits>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>

using std::vector;
using std::cin;
using std::cout;
using std::endl;
using std::memset;
using std::floor;
using std::abs;
using std::min;
using std::max;
using std::sort;

int main()
{
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    long long int n,a,b;
	cin >> n >> a >> b;
	long long int r = (n-2) * (b-a) + 1;
	if(n==1){
		if(a!=b){
			cout << 0;
		}else{
			cout << 1;
		}
		return 0;
	}
	if(a>b){
		cout << 0;
		return 0;
	}
	cout << r;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll int64_t
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;

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


int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,q;
    cin>>n;
    vector<int> S(n);
    REP(i,n) cin>>S[i];
    cin>>q;
    vector<int> T(q);
    REP(i,q) cin>>T[i];
    int ans=0;
    REP(i,q){
        int l=0,r=n;
        while(r-l>1){
            int mid = (l+r)/2;
            if(S[mid]==T[i]){
                //cout<<S[i]<<endl;
                ans++;
                break;
            }
            if(T[i]<S[mid]) r=mid;
            else l=mid;
        }
    }
    cout<<ans<<endl;
}


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

SUM = sum(A)
left = 0
right = 0
L = 0
M = 0
R = 0

ans = float('inf')

for mid in range(N):
    while abs(M - 2 * L) > abs(M - 2 * L - 2 * A[left]):
        L += A[left]
        left += 1
    
    while right < N and abs(SUM + M - 2 * R) > abs(SUM + M - 2 * R - 2 * A[right]):
        R += A[right]
        right += 1
    
    ans = min(ans, max(L, M - L, R - M, SUM - R) - min(L, M - L, R - M, SUM - R))
    
    M += A[mid]

print(ans)

Measured memory_bytes: 32080
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n;
	cin >> n;
	int r = n / 4;
	int s = n / 7;
	rep(i, 0, r + 1) rep(j, 0, s + 1) {
		if(i * 4 + j * 7 == n) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define INF 1LL << 60
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
#define lowb lower_bound
#define upb upper_bound
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> pque;
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 mod(int a,int b){return (a+b-1)/b;};
int month[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};

int dp[10010];

signed main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);

    int h, n;
    cin >> h >> n;
    int a[n], b[n];
    rep(i, n) cin >> a[i] >> b[i];

    for (int i = 1; i <= h; i++) {
		int now = INF;
		rep(j, n) {
			now = min(dp[max(0LL, i - a[j])] + b[j], now);
		}
		dp[i] = now;
	}

    cout << dp[h] << endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
using namespace std;
#define MAXSIZE 200
#define MAXL 100
typedef long long int lli;

int main(){
    int n;
    cin >> n;
    double sum = 0.0;
    for(int i = 0; i < n; i++){
        double x;
        string u;
        cin >> x >> u;
        
        if(u == "JPY"){
            sum += x;
        }else{
            sum += x * 380000.0;
        }
    }
    
    cout << sum << endl;
    return 0;
}

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

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (m); i < (int)(n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define INF 2000000000

#ifdef LOCAL
  #define eprintf(...) fprintf(stdout, __VA_ARGS__)
#else
  #define eprintf(...) 0
#endif

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;

int ctoi(char c) {
  return c - '0';
}

template <class C>
void printContainer(C &container, const char *delim=",") {
  for(const auto &e : container) {
    std::cout << e << delim;
  }
  std::cout << "\n";
}

// Greatest common divisor
template<class T>
T gcd(T x, T y) {
  if(x < y) {
    std::swap(x, y);
  }
  T r = x % y;
  while(r != 0) {
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}

// Least common multiple
template<class T>
T lcm(T x, T y) {
  return (x*y)/gcd(x,y);
}

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  vector<int> v {a, b, c};
  sort(ALL(v));
  int ans = v[0] + v[1];
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
//set many funcs template
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int strsortfncsj(const void *a,const void *b){return strcmp((char *)a,(char *)b);}
int strsortfnckj(const void *a,const void *b){return strcmp((char *)b,(char *)a);}

int main(void){
    int i,j,n,m,t,k,a,b,c,w,r=0,l;
    double d;
    char s[262144];
    scanf("%d%d%d%d",&a,&b,&c,&n);
    //l=strlen(s);
    for(i=0;i<=a;i++){
        for(j=0;j<=b;j++){
            w=n-500*i-100*j;
            if(0<=w && w/50<=c){r++;}
        }
    }
    printf("%d\n",r);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using namespace std;
const ll mod = 1000000007;
const ll mod998 = 998244353;
const ll intmax = 2147483647;
const ll llmax = 9223372036854775807;
const char sp = ' ';

int N, tree[1 << 18], p;
ll A, B, S[100002];

int get(int l, int r, int p, int q, int k) {
	if (q < l || r < p)return 0;
	if (p <= l&&r <= q)return tree[k];
	return (get(l, (l + r) / 2, p, q, k * 2) + get((l + r) / 2 + 1, r, p, q, k * 2 + 1)) % mod;
}

void update(int x, int a) {
	x += (1 << 17);
	while (x) {
		tree[x] += a;
		tree[x] %= mod;
		x /= 2;
	}
}

int main() {
	cin >> N >> A >> B;
	if (A > B)swap(A, B);
	S[0] = -llmax / 3;
	S[N + 1] = llmax / 3;
	for (int i = 1; i <= N; i++) {
		cin >> S[i];
	}
	for (int i = 3; i <= N; i++) {
		if (S[i] - S[i - 2] < A) {
			cout << 0 << endl;
			return 0;
		}
	}
	update(0, 1);
	for (int i = 1; i <= N + 1; i++) {
		update(i, get(0, (1 << 17) - 1, p, upper_bound(S, S + N + 2, S[i] - B) - S - 1, 1));
		if (S[i] - S[i - 1] < A) {
			p = i - 1;
		}
	}
	cout << get(0, (1 << 17) - 1, N + 1, N + 1, 1) << endl;
}

Measured memory_bytes: 1792
#!/usr/bin/python

def main():
    b = input()
    print(pair(b))

def pair(x: str) -> str:
    if x == "A":
        return "T"
    elif x == "T":
        return "A"
    elif x == "G":
        return "C"
    elif x == "C":
        return "G"


if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
import math

def a():
    l,r,d = map(int,input().split())
    count = 0
    for i in range(l,r+1):
        if i % d == 0:
            count += 1
    print(count)


def b():
    n = int(input())
    a = list(map(int,input().split()))
    count = 0
    for i in range(0,n,2):
        if a[i] % 2 == 1:
            count += 1
    print(count)


def c():
    print('')



def d():
    print('')


b()

Measured memory_bytes: 9128
prime=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97]
lists=[[0 for i in range(101)] for i in range(101)]
for p in prime:
    for n in range(1,101):
        if n==1:
            lists[p][n]=0
        else:
            if n%p!=0:
                lists[p][n]= lists[p][n-1]
        
            elif n%p==0:
                count=1
                order=0
                OK=True
                while OK:
                    if n%(p**count)==0:
                        order=count
                        count+=1
                    else:
                        OK=False
                lists[p][n]=lists[p][n-1]+(count-1)
       


n=int(input())
uselist=[]
for p in prime:
    uselist.append(lists[p][n])


dictio={}
for i in range(len(prime)):
    dictio[prime[i]]=uselist[i]

ans=0


larger_74=0
larger_24=0
larger_14=0
larger_2=0
larger_4=0

for  i in dictio.values():
    if i>=74:
        ans+=1
    if i>=24:
        larger_24+=1
    if i>=14:
        larger_14+=1
    if i>=4:
        larger_4+=1
    if i>=2:
        larger_2+=1

if larger_74>=1:
    answer+=1
if larger_14>=1 and larger_4>=2:
    ans+=(larger_14)*(larger_4-1)
if larger_24>=1 and larger_2>=2:
    ans+=(larger_24)*(larger_2-1)
if larger_4>=2 and larger_2>=3:
    ans+=((larger_4)*(larger_4-1)//2)*(larger_2-2)
print(ans)


Measured memory_bytes: 3188
#include<bits/stdc++.h>
int n,a[100007],b[100007],as[100007],ap=0;
int f[100007],sz[100007],deg[100007];
int gf(int x){
	while(x!=f[x])x=f[x]=f[f[x]];
	return x;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i)scanf("%d",a+i),a[0]^=a[i],as[ap++]=a[i];
	for(int i=1;i<=n;++i)scanf("%d",b+i),b[0]^=b[i];
	as[ap++]=a[0];
	std::sort(as,as+ap);
	ap=std::unique(as,as+ap)-as;
	for(int i=0;i<ap;++i)f[i]=i,sz[i]=0;
	for(int i=0;i<=n;++i)a[i]=std::lower_bound(as,as+ap,a[i])-as;
	for(int i=0;i<=n;++i){
		int x=std::lower_bound(as,as+ap,b[i])-as;
		if(x==ap||as[x]!=b[i])return puts("-1"),0;
		b[i]=x;
	}
	for(int i=0;i<=n;++i)if(a[i]!=b[i]||i==0){
		++deg[a[i]];--deg[b[i]];
		//printf("(%d->%d)",a[i],b[i]);
		int x=gf(a[i]),y=gf(b[i]);
		if(x!=y)f[y]=x,sz[x]+=sz[y];
		++sz[x];
	}
	for(int i=0;i<ap;++i)if(deg[i])return puts("-1"),0;
	int s=0,vv=gf(a[0]);
	for(int i=0;i<ap;++i)if(i==f[i]&&sz[i]){
		s+=sz[i]+1;
		if(i==vv)s-=2;
	}
	printf("%d",s);
	return 0;
}

Measured memory_bytes: 2560
n, m= map(int,input().split())
a =[]

for i in range(n):
    a.append(list(map(int, input().split())))
    a[i].append(sum(a[i]))

for i in range(n):
    print(" ".join(list(map(str,a[i]))))

sum = []
for j in range(m+1):
    s = 0
    for i in range(n):
        s += a[i][j]
    sum.append(s)

print(" ".join(list(map(str,sum))))


Measured memory_bytes: 5700
#include "bits//stdc++.h"
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;

#define rep(i,n) for (int i = 0; i < (n); i++)
#define ALL(v) v.begin(), v.end()
int main() {
	int Q;
	cin >> Q;
	multiset<ll, greater<ll>> L;
	multiset<ll> R;
	L.insert(-INF);
	R.insert(INF);
	ll ans = 0;
	rep(i, Q) {
		int type;
		cin >> type;
		ll l = *L.begin(), r = *R.begin();
		if (type == 1) {
			ll a, b;
			cin >> a >> b;
			ans += b;
			if (l >= a) {
				ans += l - a;
				R.insert(l);
				L.erase(L.begin());
				L.insert(a);
				L.insert(a);
			}
			else if(r<=a) {
				ans += a - r;
				L.insert(r);
				R.erase(R.begin());
				R.insert(a);
				R.insert(a);
			}
			else {
				L.insert(a);
				R.insert(a);
			}
		}
		else {
			cout << l << " " << ans << endl;
		}
	}
}

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

int main() {
   int n,m;
   cin>>n>>m;
   int h[n+1];
   int a,b;
   bool ans[n+1]={0};
   for(int i=1;i<=n;i++)
       cin>>h[i];
   for(int i=0;i<m;i++)
   {
   cin>>a>>b;
   if(h[a]<=h[b])
   	ans[a]=1;
   if(h[b]<=h[a])
   	ans[b]=1;
   }
   int an=0;
   for(int i=1;i<n+1;i++)
   	if(ans[i]==0)
   		an++;
   	cout<<an;

}

Measured memory_bytes: 4120
/* C++14 (Clang 3.8.0) for AtCoder */

#include <iostream>
#include <vector>
#include <string>
// #include <cmath>

namespace AtCoder {
	using Input = std::vector<std::string>;
	using Num = std::vector<int>;

	Input input(void) {
		Input result;
		{
			std::string buf = "", row = "";
			std::getline(std::cin, buf);
			for (unsigned int i = 0; i < buf.size(); i++) {
				if (' ' == buf[i]) {
					result.push_back(row);
					row = "";
				} else {
					row += buf[i];
				}
			}
			result.push_back(row);
		}
		return result;
	}

	Num replaceToInteger(Input original = { "" }) {
		Num result;
		for (unsigned int i = 0; i < original.size(); i++) {
			result.push_back(atoi(original[i].c_str()));
		}
		return result;
	}
}

int main(void) {

	AtCoder::Num s = AtCoder::replaceToInteger(AtCoder::input());

	int a = 0, p = 0;

	a = s[0];
	p = s[1];

	p += a * 3;

	int ans = p / 2;

	printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 888
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
using namespace std;

int main(){
	int a,b,c,d;
  cin >> a >> b >> c >> d;
  if(a+b>c+d){
    cout << "Left" << endl;
  }else if(a+b==c+d){
    cout << "Balanced" << endl;
  }else{
    cout << "Right" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k,i<n;++i)
int main(void){
    // Your code here!
    ll A,B;
    cin>>A>>B;
    if(A==1 || B==1){
        if(A==2 || B==2)cout<<3<<endl;
        else cout<<2<<endl;
    }else{
        cout<<1<<endl;
    }
}


Measured memory_bytes: 256
/*
	*	Created By: 'Present_Sir'
	*	Created On: Saturday 22 August 2020 05:33:21 PM IST
*/

#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL)
#define int long long
using namespace std;


void solve(){
    int n,x,t;
    cin>>n>>x>>t;

    int ans = ((n+x-1)/x)*t;
    cout<<ans<<endl;
}

int32_t main(){
    IOS;
    //int t; cin>>t; while(t--)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 3636
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use proconio::*;
use text_io::*;

const U_INF: usize = 1 << 60;
const I_INF: isize = 1 << 60;

fn main() {
    input! {
        n:usize,
        a:[usize;n],
    }

    let &max_num = a.iter().max().unwrap();
    let is_set_wise = a.iter().fold(0, |acc, ai| acc.gcd(ai)) == 1;

    let era = Eratosthenes::new(max_num);
    let mut divisor_counter = vec![0; max_num + 1];

    for ai in a {
        let hm = era.factorization(ai);

        for (k, _v) in hm {
            divisor_counter[k] += 1;
        }
    }

    let is_pair_wise = *divisor_counter.iter().max().unwrap() <= 1;

    let ans = if is_pair_wise {
        "pairwise coprime"
    } else if is_set_wise {
        "setwise coprime"
    } else {
        "not coprime"
    };

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

use itertools::Itertools;
use std::collections::HashMap;
use num::Integer;
use rustc_hash::FxHashMap;
use smallvec::alloc::collections::BTreeMap;

/// 二分累乗法
pub fn pow(x: isize, n: usize) -> isize {
    if n == 0 {
        1
    } else if n == 1 {
        x
    } else if n % 2 == 1 {
        x * pow(x, n - 1)
    } else {
        pow(x * x, n / 2)
    }
}

/// エラトステネスの篩
/// 構築 O(N log log N)
/// 素因数分解 O(log N)
/// 素数判定 O(log N)
pub struct Eratosthenes {
    smallest_prime_factors: Vec<usize>,
}

impl Eratosthenes {
    pub fn new(n: usize) -> Self {
        let mut smallest_prime_factors = (0..=n).collect_vec();

        for i in 2..n {
            if i * i > n {
                break;
            }

            if smallest_prime_factors[i] != i {
                continue;
            }

            let mut j = i * i;
            while j <= n {
                if smallest_prime_factors[j] == j {
                    smallest_prime_factors[j] = i;
                }

                j += i;
            }
        }

        Self {
            smallest_prime_factors,
        }
    }

    pub fn factorization(&self, mut i: usize) -> BTreeMap<usize, usize> {
        assert_ne!(i, 0);

        let mut factors = BTreeMap::new();

        while i != 1 {
            let divisor = self.smallest_prime_factors[i];
            *factors.entry(divisor).or_insert(0) += 1;

            i /= divisor;
        }

        factors
    }

    pub fn is_prime(&self, i: usize) -> bool {
        i >= 2 && self.smallest_prime_factors[i] == i
    }
}


Measured memory_bytes: 28392
#include<iostream>
using namespace std;
int main(){
  int N;
  int i=1;
  int A=3;
  cin >> N;
  if(N<2||N>2000000000){
    cout << "N : 2<=N<=2000000000" << endl;
    return 0;
  }
  while(N>A){
    i++;
    if(i==20) break; //3^20=3486784401??§???int????????????2147483647????¶???????
    A*=3;
  }
  cout << i << endl;
  return 0;
}

Measured memory_bytes: 1164
import io.StdIn.readLine


object Main {

  def isEven(i: Int): Boolean = i % 2 == 0

  def res(k: Int): Int = {
    val r = 1000000000 + 7
    ((1 to k).foldLeft(1) { (acc, _) => (acc * 2) % r }) % r
  }

  def main(args: Array[String]): Unit = {
    var n = readLine().toInt
    var a = readLine().split(' ').map(_.toInt).groupBy(i => i)

    if (n % 2 == 0) {
      val x = a.keys.toArray
      val y = (1 to (n / 2)).map(_ * 2 - 1)
      if (x.exists(isEven) || x.diff(y).length > 0 || y.diff(x).length > 0 || a.values.map(_.length).exists(_ != 2))
        println(0)
      else
        println(res(n / 2))
    } else {
      val x = a.keys.toArray
      val y = (0 to (n - 1) / 2).map(_ * 2)
      if (x.exists(!isEven(_)) || x.diff(y).length > 0 || y.diff(x).length > 0 || (a - 0).values.map(_.length).exists(_ != 2))
        println(0)
      else
        a.get(0) match {
          case Some(Array(0)) => println(res((n - 1) / 2))
          case None => println(0)
        }
    }
  }

}


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

int main()
{
   int n;
   cin >> n;
   string S, T;
   cin >> S >> T;
   string ans;
   for(int i = 0; i < n; i++){
      ans += S[i];
      ans += T[i];
   }
   cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define se second
#define fi first
#define ll long long
#define INF INT_MAX
#define mod 1000000007
#define chutiyaap ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
ll pw(ll a, ll b) {
    if (b == 0) return 1;
    ll t = pw(a, b / 2);
    if (b % 2 == 0) return (t * t)%mod;
    else return ((t * t)%mod * a)%mod;
}
int main()
{
	ll x,y;cin>>x>>y;
	for(ll i=0;i<=x;i++)
	{
		if(i*2+(x-i)*4==y)
		{
			cout<<"Yes";
			return 0;
		}
		if(i*4+(x-i)*2==y)
		{
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
	return 0;
}


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

int b[10005];
int main(){
	ios::sync_with_stdio(false);cin.tie(0);
	int n,a;cin>>n;
	for(int i=0;i<n;i++)cin>>a,b[a]++;
	for(int i=0;i<=10000;i++)
		if(b[i]){b[i]--;cout<<i;break;}
	for(int i=0;i<=10000;i++)
		while(b[i]--)cout<<' '<<i;
	cout<<endl;
	return 0;
}


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

int n;
int a[3][105];
int d[3][105];

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

	cin >> n;
	for (int i=1; i<=n; i++) {
		cin >> a[1][i];
	}
	for (int i=1; i<=n; i++) {
		cin >> a[2][i];
	}
	for (int i=1; i<=2; i++) {
		for (int j=1; j<=n; j++) {
			d[i][j] = a[i][j] + max(d[i-1][j], d[i][j-1]);
		}
	}
	cout << d[2][n] << '\n';
}

Measured memory_bytes: 256
//Coded by tzc_wk
/*
数据不清空，爆零两行泪。
多测不读完，爆零两行泪。
边界不特判，爆零两行泪。
贪心不证明，爆零两行泪。
D P 顺序错，爆零两行泪。
大小少等号，爆零两行泪。
变量不统一，爆零两行泪。
越界不判断，爆零两行泪。
调试不注释，爆零两行泪。
溢出不 l l，爆零两行泪。
忘文件操作，爆零两行泪。
*/
#include <bits/stdc++.h>
using namespace std;
#define fi			first
#define se			second
#define fz(i,a,b)	for(int i=a;i<=b;i++)
#define fd(i,a,b)	for(int i=a;i>=b;i--)
#define foreach(it,v) for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define all(a)		a.begin(),a.end()
#define giveup(...) return printf(__VA_ARGS__),0;
#define fill0(a)	memset(a,0,sizeof(a))
#define fill1(a)	memset(a,-1,sizeof(a))
#define fillbig(a)	memset(a,0x3f,sizeof(a))
#define fillsmall(a) memset(a,0xcf,sizeof(a))
#define mask(a)		(1ll<<(a))
#define maskx(a,x)	((a)<<(x))
#define _bit(a,x)	(((a)>>(x))&1)
#define _sz(a)		((int)(a).size())
#define filei(a)	freopen(a,"r",stdin);
#define fileo(a)	freopen(a,"w",stdout);
#define fileio(a) 	freopen(a".in","r",stdin);freopen(a".out","w",stdout)
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define put(x)		putchar(x)
#define eoln        put('\n')
#define space		put(' ')
#define y1			y_chenxiaoyan_1
#define y0			y_chenxiaoyan_0
#define int long long
typedef pair<int,int> pii;
inline int read(){
	int x=0,neg=1;char c=getchar();
	while(!isdigit(c)){
		if(c=='-')	neg=-1;
		c=getchar();
	}
	while(isdigit(c))	x=x*10+c-'0',c=getchar();
	return x*neg;
}
inline void print(int x){
	if(x<0){
		putchar('-');
		print(abs(x));
		return;
	}
	if(x<=9)	putchar(x+'0');
	else{
		print(x/10);
		putchar(x%10+'0');
	}
}
inline int qpow(int x,int e,int _MOD){
	int ans=1;
	while(e){
		if(e&1)	ans=ans*x%_MOD;
		x=x*x%_MOD;
		e>>=1;
	}
	return ans;
}
int suf[200005],n,cnt[2020],ans=0;
char s[200005];
const int MOD=2019;
signed main(){
	cin>>s+1;
	n=strlen(s+1);
	cnt[0]++;
	fd(i,n,1)	suf[i]=(suf[i+1]+(s[i]-'0')*qpow(10,n-i,MOD))%MOD,cnt[suf[i]]++;
	fz(i,0,2018)	ans+=(cnt[i])*(cnt[i]-1)/2;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 5352
#include<stdio.h>
#define N 10000
#define NIL -1
typedef struct node{
  int p,l,r;
}S;
S T[N];
int n;
void pre(int x){
  if(x==NIL)return;
  printf(" %d",x);
  pre(T[x].l);
  pre(T[x].r);
}
void in(int x){
  if(x==NIL)return;
  in(T[x].l);
  printf(" %d",x);
  in(T[x].r);
}
void post(int x){
  if(x==NIL)return;
  post(T[x].l);
  post(T[x].r);
  printf(" %d",x);
}
void init(){
  int i,v,l,r,root;
  scanf("%d",&n);
  for(i=0;i<n;i++)T[i].p=NIL;
  for(i=0;i<n;i++){
    scanf("%d%d%d",&v,&l,&r);
    T[v].l=l;
    T[v].r=r;
    if(l!=NIL)T[l].p=v;
    if(r!=NIL)T[r].p=v;
  }
  for(i=0;i<n;i++)if(T[i].p==NIL)root=i;
  printf("Preorder\n");
  pre(root);
  printf("\n");
  printf("Inorder\n");
  in(root);
  printf("\n");
  printf("Postorder\n");
  post(root);
  printf("\n");
}
int main(){
  init();
  return 0;
}



Measured memory_bytes: 2112