akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define MAX 128
#define fst first
#define sec second
#define pb push_back
#define mp make_pair
#define ALL(x) (x).begin(), (x).end()
#define bit(n) (1LL << (n))
#define int long long
const double PI = 3.141593;
const ll MOD = 1e9 + 7;
const int INF = 100100100;
const double EPS = 1e-9;
template <class T>
bool chmax(T &a, const T &b){if (a < b){a = b;return 1;}return 0;}
template <class T>bool chmin(T &a, const T &b){if (b < a){a = b;return 1;}return 0;}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最大公約数
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }     //最小公倍数
ll combination(ll n, ll r){if (r * 2 > n)r = n - r;ll dividend = 1;ll divisor = 1;for (ll i = 1; i <= r; ++i){dividend *= (n - i + 1);divisor *= i;}return dividend / divisor;}


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

    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    rep(i,n){
        cout << s[i] << t[i];
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
n, a, b = map(int, input().split())
p = 10 ** 9 + 7

def mod_inverse(a, p):
    mod = 1
    p_bin = bin(p-2)
    for i in range(len(p_bin) - 1, 1, -1):
        if i == len(p_bin) - 1:
            mul = a
            mul %= p
            mod *= (mul ** int(p_bin[i]))
            mod %= p
        else:
            mul = mul ** 2
            mul %= p
            mod *= (mul ** int(p_bin[i]))
            mod %= p
    return mod

c = [2]
for i in range(len(bin(n)) - 3):
    c.append(c[-1] ** 2 % p)
ans = -1
temp = 1
bin_n = bin(n)[2:]
for i in range(len(bin_n)):
    if bin_n[-i-1] == "1":
        temp *= c[i]
        temp %= p
d = []
for i in range(max(a, b)):
    d.append(mod_inverse(i + 1, p))
temp2 = 1
for i in range(a):
    temp2 *= (n - i)
    temp2 %= p
    temp2 *= d[i]
    temp2 %= p
temp3 = 1
for i in range(b):
    temp3 *= (n - i)
    temp3 %= p
    temp3 *= d[i]
    temp3 %= p
ans += temp
ans -= temp2
ans -= temp3
ans %= p
print(ans)

Measured memory_bytes: 55900
def linearSearch(key, list, N):
    list[N] = key
    i = 0
    while list[i] != key:
        i += 1
    return int(i != N)


N1 = int(input())
arr1 = [int(n) for n in input().split()] + [0]
N2 = int(input())
arr2 = [int(n) for n in input().split()]

print(sum([linearSearch(key, arr1, N1) for key in arr2]))



Measured memory_bytes: 6552
#include<stdio.h>
#include<string.h>
int main(){
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    int mod = c%b;
    int i;
    for(i = 1; i <= 1000; i++){
        if(mod==a*i%b){
            printf("YES\n");
            return 0;
        }
    }
    printf("NO\n");
    return 0;
}


Measured memory_bytes: 128
package main
import "fmt"
func main() {
  var s string
  fmt.Scan(&s)
  var m,t int
  m = len(s)
  for i:=0;i<len(s)-1;i++ {
    if s[i:i+1] != s[i+1:i+2] {
      t = max(i+1,len(s)-i-1)
      if m > t { m = t }
    }
  }
  fmt.Println(m)
}
func max(n,m int) int {
  if n > m { return n }
  return m
}

Measured memory_bytes: 1280
#include <iostream>
#include <algorithm>
#include <sstream>

using namespace std;

int main(){
	string HRSP[22]={"Rock", "Fire", "Scissors", "Snake", "Human", "Tree", "Wolf", "Sponge", "Paper", "Air", "Water", 
		"Dragon", "Devil", "Lightning", "Gun","Rock", "Fire", "Scissors", "Snake", "Human", "Tree","Wolf"};
	int number; //numberÍ1000¢
	string hand;
	while(cin >> number){
		bool hands[22];
		for(int b=0;b<22;b++){
			hands[b]=1;
		}
		if(!number) break; // 0ªfalse¾ÆvÁÄ¢é
		//		if(!number) break;

		for(int j=0;j<number;j++){
			cin >> hand;
			for(int i=0;i<15;i++){
				if(hand == HRSP[i]){
					hands[i] = 0;
					break;
				}
			}
		}
		//for(int i=0;i<15;i++){
		//	cout << i << ":" << hands[i] << endl;
		//}

		int sum = 0;
		for(int i=0;i<15;i++){
			sum += !hands[i];
		}

		//handîñÌRs[
		for(int i=0;i<7;i++){
			hands[i+15] = hands[i];
//			cout << hands[i] << endl;
		}

		bool flag = 1;
		int count = 0;
		string win_hand = "Draw";

//		cout << sum << endl;
		if(sum == 1){ // ¢±ÌêÅèªêÊè
//			cout <<"hitotoori" << endl;
			cout << win_hand << endl;
			continue;
		}

		for(int index=0;index < 22;index++){
			flag &= hands[index];
			if(count >= 7 && !flag){
				win_hand = HRSP[index];
				break;
			}
			else if(!flag){
				flag = !flag;
				count = 0;
			}
			else{
				count++;
			}
		}
		cout << win_hand << endl;
	}
}

//Rock, Fire, Scissors, Snake, Human, Tree, Wolf, Sponge, Paper, Air, Water, Dragon, Devil, Lightning, and Gun.

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

using ll = long long;
using namespace std;
const int INFint = 2e9+1;
const ll INFll = 2e18+1;
ll MOD=1e9+7;

ll gcd(ll a, ll b) { return __gcd(a,b); } //最大公約数
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; } //最小公倍数
int main(){
  int N;
  cin>>N;
  vector<ll> A(N);
  for(int i(0);i<N;i++) cin>>A[i];
  ll ans(A[0]);
  for(int i(1);i<N;i++){
    ans = lcm(ans,A[i]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

const int dat[8] = {4, 1, 4, 1, 2, 1, 2, 1};
int a[8];

int main() {
    while (scanf("%d", a) != EOF) {
        rep (i, 7) scanf("%d", a+i+1);
        vector<int> c, ans;
        rep (i, 8) c.push_back(dat[i]);
        int ansk = 1<<30;
        rep (_, 8) {
            rotate(c.begin(), c.begin()+1, c.end());
            int k = 0;
            rep (i, 8) k += max(0, a[i]-c[i]);
            if (ansk > k) ansk = k, ans = c;
            else if (ansk == k) ans = min(ans, c);
        }
        rep (i, 8) printf("%d%c", ans[i], "\n "[i<7]);
    }
    return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
#define INF 200000000000
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()

bool compare(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}
// 入力



int main() {
    ll A,B;
    cin >>A>>B;
    
    cout << 6-A-B << endl;


    return 0;
    

}

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

using namespace std;
typedef long long ll;

#define LOOP(i, a, n) for (int i = (int)a; i < (int)n; ++i)
#define REP(i, n) LOOP(i, 0, n)
#define MOD 1000000007
#define INF 1000000000
#define PI 3.14159265359

int prime(int l, int r) {
  int ret = 0;

  for (int i = l+1; i <= r; i++) {
    // i????´???°???
    bool flag = true;
    for (int j = 2; j <= sqrt(i); j++) {
      if (i % j == 0) {
        flag = false;
        break;
      }
    }
    if(flag) {
      ret++;
    }
  }

  return ret;
}

int main(void) {
  vector<int> ans;

  while(true) {
    int n;
    cin >> n;
    if(n == 0) break;

    ans.push_back(prime(n, 2*n));
  }

  for(int i=0; i<ans.size(); i++) {
    cout << ans[i] << endl;
  }

  return 0;
}

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

using namespace std;

#define sz(x) ((int) ((x).size()))
typedef long long ll;
typedef long double ld;

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
uniform_int_distribution<int> unii(0, 1 << 30);

int randNum() {
	return unii(rng);
}

struct treap {
	struct node {
		int size,prio,val,data;
		node *l=0,*r=0;
	} *root=0;
	int get(node *n) { return n?n->size:0; }
	int getData(node *n) { return n?n->data:(1<<30); }
	void upd(node *n) {
		if (n) {
			n->size=1+get(n->l)+get(n->r);
			n->data = min(n->val, min(getData(n->l), getData(n->r)));
    }
	}
	void split(node *n, node *&l, node *&r, int key, int add=0) {
		if (!n)
			return void(l=r=0);
		int nkey=add+get(n->l)+1;
		if (nkey<key)
			split(n->r,n->r,r,key,nkey),l=n;
		else
			split(n->l,l,n->l,key,add),r=n;
		upd(n);
	}
	void splitData(node *n, node *&l, node *&r, int key) {
		if (!n)
			return void(l=r=0);
		int nkey = min(n->val, getData(n->r));
		if (nkey<=key)
			splitData(n->r,n->r,r,key),l=n;
		else
			splitData(n->l,l,n->l,key),r=n;
		upd(n);
	}
	void merge(node *l, node *r, node *&n) {
		if (!l||!r)
			n=l?l:r;
		else if (l->prio>r->prio)
			merge(l->r,r,l->r),n=l;
		else
			merge(l,r->l,r->l),n=r;
		upd(n);
	}
	void insert(int key, int val) {
		node *n=new node();
		n->prio=randNum(),n->val=val;
		node *l,*r;
		splitData(root,l,r,key);
		merge(l,n,l);
		merge(l,r,root);
	}
	int get(int pos) {
		node *l,*n,*r;
		split(root,l,r,pos);
		split(r,n,r,2);
		int res=n?n->val:0;
		merge(l,n,l);
		merge(l,r,root);
		return res;
	}
} tr;

int n, k, p[600000], pos[600000];

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(10);
  cin >> n >> k;
  for (int i = 0; i < n; i++)
    cin >> p[i], p[i]--, pos[p[i]] = i;
  for (int i = 0; i < n; i++)
		tr.insert(pos[i] + k - 1, pos[i]);
  for (int i = 0; i < n; i++)
    pos[i] = tr.get(i + 1), p[pos[i]] = i;
  for (int i = 0; i < n; i++)
    cout << p[i] + 1 << "\n";
}


Measured memory_bytes: 31232
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define INF 1000000000
#define rep(i,a,b) for (int i=(a);i<(b);i++)
#define rev(i,a,b) for (int i=(a)-1;i>=b;i--)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef queue<int> qi;
typedef vector<int> vi;
typedef vector<string> vs;
int dx[4] = { 0, 1, 0, -1 };
int dy[4] = { 1, 0, -1, 0 };

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

  int p = INF, g = INF;
  rep(i,0,3) {
    int a;
    cin >> a;
    p = min(p, a);
  }
  rep(i,0,2) {
    int a;
    cin >> a;
    g = min(g, a);
  }

  cout << p+g-50 << endl;


	return 0;
}

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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF   = 1e9;
const ll  INFLL = 1e18;
typedef pair<int, int> PII;
typedef vector<vector<int>> Graph;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

int main()
{
    ios::sync_with_stdio(false);
    ll A, B, C, K;
    cin >> A >> B >> C >> K;

    ll ans = K%2 ? B - A : A - B;
    if (llabs(ans) > (ll)1e18) cout << "Unfair" << endl;
    else cout << ans << endl;
}

Measured memory_bytes: 256
N = int(input())
A = sorted([int(input()) for _ in range(N)])

if len(A) % 2:
    print(
        max(
            2 * (sum(A[len(A) // 2:]) - sum(A[:len(A) // 2])) - A[len(A) // 2] - A[len(A) // 2 + 1],
            2 * (sum(A[len(A) // 2 + 1:]) - sum(A[:len(A) // 2 + 1])) + A[len(A) // 2 - 1] + A[len(A) // 2]
        )
    )
else:
    print(2 * (sum(A[len(A) // 2:]) - sum(A[:len(A) // 2])) + A[len(A) // 2 - 1] - A[len(A) // 2])

Measured memory_bytes: 8284
#include <cstdio>
#include <string>
  
class List
{
    int* data_; //[4000000];
    int begin_;
    int end_;
public:
    List()
    {
        data_ = new int[4000000];
        begin_ = 2000000;
        end_  = 2000000;
    }
    // ~List()
    // {
    //     delete[] data_;
    // }
    void Insert(int X)
    {
        --begin_;
        data_[begin_] = X;
    }
    void Delete(int X)
    {
        int Index = end_;
        for(int i = begin_; i < end_; ++i){
            if(X == data_[i]){
                Index = i;
                break;
            }
        }
        if(Index == end_) return;
        for(int i = Index; i < end_; ++i){
            data_[i] = data_[i+1];
        }
        end_--;
    }
    void DeleteFirst()
    {
        begin_++;
    }
    void DeleteLast()
    {
        end_--;
    }
    void Show()const
    {
        printf("%d", data_[begin_]);
        for(int i = begin_ + 1; i < end_; ++i){
            printf(" %d", data_[i]);
        }
        printf("\n");
    }
};
  
int main()
{
    List list;
    int n, X;
    std::scanf("%d\n", &n);
    char com[1024];
    for(int i = 0; i < n; ++i){
        std::fgets(com, 1024, stdin);
        if(com[6] == 'F'){
            list.DeleteFirst();
        }else
        if(com[6] == 'L'){
            list.DeleteLast();
        }else{
            int v = 0;
            for(int j = 7; com[j] >= '0' && com[j] <= '9'; ++j){
                v = v*10 + (com[j] - '0');
            }
            if(com[0] == 'i'){
                list.Insert(v);
            }else
            if(com[0] == 'd'){
                list.Delete(v);
            }
        }
    }
    list.Show();
    return 0;
}

Measured memory_bytes: 6492
#include<stdio.h>
int main (){
  int x;
  int y;
  int result;
  scanf("%d%d",&x,&y);
  printf("%d\n",divisor(x,y));
  return 0;
}
int divisor(int x,int y){
  int temp;
  if(x<y){
    temp=x;
    x=y;
    y=temp;
  }
  if(y==0)return x;
  return divisor(y,x%y);
}



Measured memory_bytes: 2140
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

long long n, ans;

long long fun()
{
	long long ret = 0, tmp = n - 1;
	for (int i = 1; i * 1LL * i <= tmp; i++) {
		if (tmp % i == 0) {
			if (n % i && i > 1) ret++;
			if (tmp / i != i) {
				if (n % (tmp / i) && tmp / i > 1) ret++;
			}
		}
	}
	return ret;
}

long long gun()
{
	long long ret = 0;
	for (int i = 2; i * 1LL * i <= n; i++) {
		long long tmp = n;
		while (tmp % i == 0) {
			tmp /= i;
		}
		if (tmp == 1) ret++;
	}
	return ret;
}

long long hun()
{
	long long ret = 0;
	for (int i = 2; i * 1LL * i <= n; i++) {
		if (n % i == 0) {
			long long tmp = n;
			while (tmp % i == 0) {
				tmp /= i;
			}
			tmp--;
			if (tmp > 0) {
				if (tmp % i == 0) ret++;
			}
		}
	}
	return ret;
}
int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	ans += fun();
	ans += gun();
	ans += hun();
	ans++;
	cout << ans << E;
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(void)
{
    int n, i;

    scanf("%d", &n);
    for (i = 0; i < n; ++i) {
        char s1[801], s2[801], ss[81];
        int n1, n2, nl, ns, j, s, c;

        scanf(" %s %s", s1, s2);
        n1 = strlen(s1);
        n2 = strlen(s2);
        nl = (n1 > n2 ? n1 : n2);
        ns = (n1 < n2 ? n1 : n2);
        if (nl > 80) {
            printf("overflow\n");
            continue;
        }

        c = 0;
        for (j = 0; j < ns; ++j) {
            s = (s1[n1 - 1 - j] - '0') + (s2[n2 - 1 - j] - '0') + c;
            ss[nl - 1 - j] = s % 10 + '0';
            c = s / 10;
        }
        for (; j < nl; ++j) {
            if (n1 > n2)
                s = (s1[n1 - 1 - j] - '0') + c;
            else
                s = (s2[n2 - 1 - j] - '0') + c;
            ss[nl - 1 - j] = s % 10 + '0';
            c = s / 10;
        }
        ss[nl] = '\0';
        if (nl == 80 && c)
            printf("overflow\n");
        else
            printf("%s%s\n", c ? "1" : "", ss);
    }

    return 0;
}

Measured memory_bytes: 612
/**
 * File    : A.cpp
 * Author  : Kazune Takahashi
 * Created : 2018-10-28 21:56:02
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <functional>
#include <random> // auto rd = bind(uniform_int_distribution<int>(0, 9), mt19937(19920725));
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

string S;

int main()
{
  cin >> S;
  for (auto i = 0; i < (int)S.size(); i++)
  {
    if (S[i] == '1')
    {
      S[i] = '9';
    }
    else if (S[i] == '9')
    {
      S[i] = '1';
    }
  }
  cout << S << endl;
}

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

using namespace std;

#define ll long long
#define vi  vector<int>
#define vvi vector<vi>
#define pi  pair<int,int>
#define mp  make_pair
#define pb  push_back
#define MOD 1e9 + 7
#define PAI  3.1415
#define all(x) (x).begin(),(x).end()
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
#define pr(x) cout << x << endl
#define Endl endl
#define rep(i,n) for(int i = 0 ; i < n; i++)

const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int ddx[8] = {-1,0,1,-1,1,-1,0,1};
const int ddy[8] = {-1,-1,-1,0,0,1,1,1};
const int inf = 99999999;
const ll linf = 1LL << 62;

ll gcd(ll a,ll b){
  if(a < b)swap(a , b);
  if(a % b == 0) return b;
  else gcd(b, a%b);
}

ll lcm(ll a,ll b){
  if(a < b)swap(a , b);
  return (a/gcd(a , b))*b;
}

int main(){

  int a,b;cin >> a >> b;
  vi v(1010 , 0);
  v[0] = 1;
  for(int i = 1 ;i< 1002;i++){
    v[i] = v[i-1] + i + 1;
  }

  cout << v[b-a-1] - b << endl;

  return 0;

}


Measured memory_bytes: 256
import Control.Applicative

quicksort :: [Int] -> [Int]
quicksort [] = []
quicksort (x:xs) = (quicksort gt) ++ [x] ++ (quicksort lteq)
  where gt = [a | a <- xs, a > x]
        lteq = [a | a <- xs, a <= x]

main = do
  n <- fmap (read :: String -> Int) . words <$> getContents
  putStrLn $  unwords $ fmap show (quicksort n)

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

int N;
int a[100000];

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

    cin >> N;
    for(int i=0; i<N; i++){
        cin >> a[i];
        a[i]--;
    }

    int res = 0;
    for(int i=0; i<N; i++){
        if(a[a[i]]==i) res++;
    }
    cout << res / 2 << endl;


	return 0;
}


Measured memory_bytes: 640
H,W,D = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(H)]
Q = int(input())
px = [0]*(H*W+1)
py = [0]*(H*W+1)
for y in range(H):
    for x in range(W):
        n = A[y][x]
        px[n] = x + 1
        py[n] = y + 1
csum = [0]*(H*W+1)
for i in range(D+1,H*W+1):
    csum[i] = csum[i-D] + abs(px[i]-px[i-D]) + abs(py[i]-py[i-D])
for q in range(Q):
    L, R = map(int,input().split())
    print(csum[R]-csum[L])



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

int GCD(int a,int b);
int LCM(int a,int b);

int main()
{
	int a,b,gcd,lcm;

	while(cin>>a>>b)
	{
		if(a==0 || b==0)
			cout<<"0 0"<<endl;
		gcd=GCD(a,b);
		lcm=LCM(a,b);
		cout<<gcd<<' '<<lcm<<endl;
	}
}

int GCD(int a,int b)
{
	while(a!=b)
		if(a>b) a=a-b;
		else    b=b-a;
	return a;
}
int LCM(int a,int b)
{
	return ((a / GCD(a, b)) * b);
}

//大文字を小文字に変換
/*
for(int i=0;i<inp.size();i++)
if(inp[i]>='A' && inp[i]<='Z')
inp[i]+='a'-'A';
*/

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

using namespace std;

const int N=20,M=33005,inf=0x3F3F3F3F;

int n,m,ec[N][N],ans=inf,U;
int dp[M][N],sc[N][M]; 
bool ok[N][M];

int find(int*fa,int x){return fa[x]==x?x:fa[x]=find(fa,fa[x]);}
bool judge(int u,int S){
	if(S>>u&1)return -1;
	static int fa[N];
	static bool vi[N],ok[N];
	for(int i=0;i<n;i++)fa[i]=i,vi[i]=ok[i]=0;
	for(int i=0;i<n;i++)if(S>>i&1)for(int j=i+1;j<n;j++)if(S>>j&1)fa[find(fa,i)]=find(fa,j);
	for(int i=0;i<n;i++)if(S>>i&1){int k=find(fa,i);vi[k]=true;if(!ec[u][i])continue;ok[k]=true;}
	for(int i=0;i<n;i++)if(vi[i]&&!ok[i])return false;
	return true;
}

inline void upd(int&x,int y){x<y?:x=y;}

inline int sumcost(int S,int T){
	int res=0;
	for(int i=0;i<n;i++)if(S>>i&1)res+=sc[i][T];
	return res;
}

// O(3^n * n^3)

int main(){
	scanf("%d%d",&n,&m);
	for(int i=1,u,v,c;i<=m;i++)scanf("%d%d%d",&u,&v,&c),u--,v--,ec[u][v]=ec[v][u]=c;
	U=(1<<n)-1;
	for(int i=0;i<n;i++)for(int j=0;j<=U;j++)ok[i][j]=judge(i,j);
	for(int i=0;i<n;i++)for(int j=0;j<=U;j++)for(int k=0;k<n;k++)if(j>>k&1)sc[i][j]+=ec[i][k];
	memset(dp,0x3F,sizeof(dp));
	for(int S=1;S<=U;S+=2)if(ok[0][S^1])dp[S][0]=0;
	for(int S=0;S<=U/2;S++)for(int u=0;u<n;u++)if(dp[S][u]!=inf){
		for(int v=0;v<n;v++)if(~S>>v&1){
			if(!ec[u][v])continue;
			int T=U-S-(1<<v),cur=sc[v][S^(1<<u)];
			for(int z=T;z;z=(z-1)&T)if(ok[v][z])
				upd(dp[S|1<<v|z][v],dp[S][u]+cur+sumcost(S,z));
			upd(dp[S|1<<v][v],dp[S][u]+cur);
		}
	}
	for(int S=U/2+1;S<=U;S++)if(dp[S][n-1]!=inf){
		upd(ans,dp[S][n-1]+sumcost(S,U^S));
	}
	printf("%d\n",ans);
	return 0;
}

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

#define ff first
#define ss second
#define PI acos(-1)
#define pb push_back
#define int long long
#define ld long double
#define sp fixed<<setprecision
#define bp __builtin_popcountll
#define all(x) x.begin(),x.end()
#define pii pair<long long,long long>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

const int M = (1e9)+7;
const int N = 1e6+5;

vector<int> a[N];
int vis[N],cnt;

void dfs(int c)
{
    vis[c] = 1;
    cnt++;
    for(int cc:a[c])
        if(!vis[cc])
            dfs(cc);
}

signed main()
{
    FAST
    int tc=1;
    //cin>>tc;
    for(int ti=1;ti<=tc;ti++)
    {
        int n,m;
        cin>>n>>m;
        while(m--)
        {
            int x,y;
            cin>>x>>y;
            a[x].pb(y);
            a[y].pb(x);
        }
        int ans = 0;
        for(int i=1;i<=n;i++)if(!vis[i])
        {
            cnt = 0;
            dfs(i);
            ans = max(ans,cnt);
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 41140
#include<stdio.h>
#include<math.h>
#include<string.h>

#define FOR(n) for(int i=0;i<n;i++)
#define PRN(n) printf("%d\n",n)
#define PRS(s) printf("%s\n",s)

int main(void){
  int a,b;
  scanf("%d %d",&a,&b);
  FOR(2*a-1)PRN(b-a+1+i);
  return 0;
}

Measured memory_bytes: 128
n = int(input())
A = sorted(list(map(int,input().split())))
MOD = 10**9+7
B = []
for i in range(n):
    if n%2 == 1:
        B += [2*((i+1)//2)]
    else:
        B += [(i//2)*2 + 1]
if A != B:
    print(0)
else:
    ans = 1
    for i in range(n//2):
        ans *= 2
        ans %= MOD
    print(ans)

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

typedef long long ll;
typedef pair<int,int> P;

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

template<typename T1,typename T2>ostream& operator<<(ostream& os,const pair<T1,T2>& a) {os << "(" << a.first << ", " << a.second << ")";return os;}

const char newl = '\n';

int main() {
    int n,k,q;
    cin >> n >> k;
    vector<int> x(n);
    for (int i = 0;i < n;++i) cin >> x[i];
    vector<int> edge1(n),edge2(n,-1);
    vector<vector<pair<int,ll>>> anc1(n),anc2(n);
    for (int i = 0;i < n;++i) edge1[i] = lower_bound(x.begin(),x.end(),x[i]+k)-x.begin();
    for (int i = 0;i < n;++i) if (edge1[i] < n) edge2[edge1[i]] = i;
    for (int i = 1;i < n;++i) edge2[i] = max(edge2[i],edge2[i-1]);
    for (int i = 0;i < n;++i) if (edge1[i] < n) anc1[i].push_back({edge1[i],edge1[i]});
    for (int i = 0;i < n;++i) if (edge2[i] >= 0) anc2[i].push_back({edge2[i],edge2[i]+1});
    for (int i = 0;i < 20;++i) {
        for (int j = 0;j < n;++j) {
            if (anc1[j].size() < i+1 || anc1[anc1[j][i].first].size() < i+1) continue;
            anc1[j].push_back(anc1[anc1[j][i].first][i]);
            anc1[j].back().second += anc1[j][i].second;
        }
    }
    for (int i = 0;i < 20;++i) {
        for (int j = 0;j < n;++j) {
            if (anc2[j].size() < i+1 || anc2[anc2[j][i].first].size() < i+1) continue;
            anc2[j].push_back(anc2[anc2[j][i].first][i]);
            anc2[j].back().second += anc2[j][i].second;
        }
    }
    cin >> q;
    while (q--) {
        int l,r;
        cin >> l >> r;
        l--;r--;
        ll ans = r+1-l;
        int i = l,j = anc1[l].size();
        while (j) {
            j--;
            if (anc1[i].size() < j+1 || anc1[i][j].first > r) continue;
            ans -= anc1[i][j].second;
            i = anc1[i][j].first;
        }
        i = r,j = anc2[r].size();
        while (j) {
            j--;
            if (anc2[i].size() < j+1 || anc2[i][j].first < l) continue;
            ans += anc2[i][j].second;
            i = anc2[i][j].first;
        }
        cout << ans << newl;
    }
}

Measured memory_bytes: 190232
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main(){
  int a,b;
  cin >> a >> b;
  if(a%3==0||b%3==0||(a+b)%3==0)cout<<"Possible"<<endl;
    else{cout<<"Impossible"<<endl;}
 
  return 0;
}

Measured memory_bytes: 256
def generate(n):
    ans = []
    for i in range(2,n+1):
        flag = True
        for j in range(2,i):
            if(i%j == 0):
                flag = False
        if flag:
            ans.append(i)
    return ans

def factorial(n):
    ans = 1
    for i in range(1,n+1):
        ans *= i
    return ans

ans = 1
N = int(input())
l = generate(N)
N = factorial(N)
for p in l:
    q = 1
    while(N%p == 0):
        q += 1
        N = N // p
    ans *= q
    ans %= 1000000007
print(ans)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<ll, ll> pll;
#define mod 1000000007
#define all(x) (x).begin(), (x).end()
#define call(x) (x).cbegin(), (x).cend()
#define pb push_back
#define yes(a) printf(a ? "yes\n" : "no\n")
#define Yes(a) printf(a ? "Yes\n" : "No\n")
#define YES(a) printf(a ? "YES\n" : "NO\n") 
const long double PI = acos(-1);
const long long INF = (1 << 30);
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}

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

  ll n, k;
  cin >> n >> k;
  vector<ll> a(n);
  for(ll i = 0; i < n; i++) cin >> a[i];

  ll ans = 1;
  n -= k;
  while(n > 0){
    n -= k-1;
    ans++;
  }
  cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
h0, w0, k0 = [ int(x) for x in input().split() ]
found, buf = 0, {}
for i in range(h0): buf[1 << i] = { 1 << j for j,x in enumerate(input()) if x == '#' }
for i in range(1, 1 << h0):
  idx = {}
  for k,vs in buf.items():
    if k & i == 0: continue
    for v in vs: idx[v] = idx.get(v, 0) + 1
  for j in range(1, 1 << w0):
    n = sum([ v for k,v in idx.items() if k & j ])
    if n == k0: found += 1
print(found)

Measured memory_bytes: 8972
#include <iostream>
#include <stack>
#include <string>
#include <cstdlib>
using namespace std;
int main(){

  string tmp;
  stack <int> a;
  int tmp1;

  while(cin>>tmp){
    if(tmp=="+"){
      tmp1=a.top(); a.pop();
      tmp1+=a.top(); a.pop();
      a.push(tmp1);
    } else if(tmp=="*"){
      tmp1=a.top(); a.pop();
      tmp1*=a.top(); a.pop();
      a.push(tmp1);
    } else if(tmp=="-"){
      tmp1=-a.top(); a.pop();
      tmp1+=a.top(); a.pop();
      a.push(tmp1);
    } else a.push(atoi(tmp.c_str()));
  }

  cout<<a.top()<<endl;

  return 0;
}



Measured memory_bytes: 3160
# -*- coding: utf-8 -*-
def inpl(): return list(map(int, input().split()))

N, K = inpl()
A = inpl()
tmp = 0
S = [0]*N
Q = []
for i in range(N):
    tmp += A[i]
    S[i] = tmp
    Q.append(tmp)

tmp = 0
for i in range(1, N):
    tmp = S[i-1]
    for j in range(i, N):
        #print(i, j)
        v = S[j] -S[i-1]
        Q.append(v)

res = 0
L = len(Q)
I = len(bin(sum(A))) - 2
while True:
    ok = 0
    for i in range(I):
        num = res + 2**i
        tmp = 0
        for j in range(L):
            if num & Q[j] == num:
                tmp += 1
        if tmp >= K:
            ok = num

    I = len(bin(res - ok)) - 2
    if res < ok & ok > 0:
        res = ok
    else:
        break

print(res)

Measured memory_bytes: 67196
n,p=map(int,input().split())

def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

kekka=factorize(p)

ans=1
for i in range(len(kekka)):
    ans=ans* kekka[i][0] ** (kekka[i][1]//n)
print(ans)

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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

int main(){
	int n;cin>>n;
	for(int x=1;x<=n;x++){
		int d=x*1.08;
		if(n==d){
			cout<<x<<endl;
			return 0;
		}
	}
	puts(":(");
}

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

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0) : x((x%mod+mod)%mod) {}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  mint fastPow(ll t) const {
    if(t==0) return 1;
    if(t%2==0){
        mint s = fastPow(t/2);
        return s*s;
    }
    return *this * fastPow(t-1);
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

int main() {
  ll n;
  int a, b;
  cin >> n >> a >> b;
  mint res(2), temp(1);
  mint ans = res.fastPow(n);
  if (a > b) swap(a,b);
  for (int i = 1; i <= b; ++i) {
    temp *= (n-i+1);
    temp /= i;
    if (i == a || i == b) ans -= temp;
  }
  std::cout << ans.x-1 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(n) for (int I = 0; (I) < (n); ++(I) )
#define repeat(i, n) for( int i = 0; (i) < (n); ++(i) )
#define repeat_to(i, n) for( int i = 0; (i) <= (n); ++(i) )
#define repeat_from(i, m, n) for( int i = (m); (i) < (n); ++(i) )
#define repeat_from_to(i, m, n) for( int i = (m); (i) <= (n); ++(i) )
#define dump(x) cout << " " << #x << "=" << x
#define vdump(v) for(size_t T=0; T<v.size(); ++T){cout << " " << #v << "[" << T << "]=" << v[T];} cout << endl
using namespace std;
using lint = long long;
using ld = long double;

int main(void) {
    lint n, bag_w;
    cin >> n >> bag_w;
    
    lint std_w;
    vector<vector<lint>> item(4);
    repeat(i, n) {
        lint w, v;
        cin >> w >> v;
        if (i == 0) {
            item[0].emplace_back(v);
            std_w = w;
        }
        else {
            lint dif = w - std_w;
            item[dif].emplace_back(v);
        }
    }
    
    repeat(i, 4) {
        sort(item[i].begin(), item[i].end(), greater<lint>());
    }
    
    vector<vector<lint>> item_value(4);
    repeat(i, 4) item_value[i].emplace_back(0);
        
    repeat(i, 4) {
        lint partial_sum = 0;
        repeat(j, (int)item[i].size()) {
            partial_sum += item[i][j];
            item_value[i].emplace_back(partial_sum);
        }
    }
    
    auto calc_val = [&item_value](int a, int b, int c, int d) -> lint {
        lint ret = 0;
        ret += item_value[0][a];
        ret += item_value[1][b];
        ret += item_value[2][c];
        ret += item_value[3][d];
        return ret;
    };
        
    lint ans = 0;
    repeat_from_to(a, 0, n) {
        repeat_from_to(b, 0, n) {
            repeat_from_to(c, 0, n) {
                repeat_from_to(d, 0, n) {
                    if (a > (int)item[0].size() || b > (int)item[1].size() || c > (int)item[2].size() || d > (int)item[3].size()) continue;
                    lint tot_w = a * std_w + b * (std_w+1) + c * (std_w+2) + d * (std_w+3);
                    if (tot_w > bag_w) continue;
                    ans = max(ans, calc_val(a, b, c, d));
                    //dump(a); dump(b); dump(c); dump(d); dump(tot_w); dump(ans); cout << endl;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	vector <vector<int>> g(n + 1, vector<int>(n - 1));
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j < n - 1; j++) {
			cin >> g[i][j];
		}
	}
	vector <int> pointer(n + 1);
	map <pair<int, int>, int> now;
	queue <pair<int, int>> simple;
	queue <pair<int, int>> future;
	for (int i = 1; i <= n; i++) {
		int v = i, u = g[i][pointer[i]];
		if (v > u) swap(v, u);
		now[{v, u}]++;
	}
	for (auto q : now) {
		if (q.second == 2) {
			future.push(q.first);
			//~ cout << q.first.first << " " << q.first.second << endl;
		}
	} 
	//~ cout << endl;
	int games = 0;
	for (int i = 0; i <= n * (n - 1) / 2; i++) {
		simple = future;
		future = queue<pair<int, int>>();
		if (simple.empty()) {
			if (games == n * (n - 1) / 2) {
				cout << i;
				return 0;
			} else {
				cout << -1;
				return 0;
			}
		}
		while (!simple.empty()) {
			int v = simple.front().first;
			int u = simple.front().second;
			//~ cout << v << " " << u << "\n";
			simple.pop();
			games++;
			now.erase({v, u});
			pointer[v]++;
			pointer[u]++;
			if (pointer[v] < n - 1) {
				int w = v;
				int p = g[v][pointer[v]];
				if (w > p) swap(w, p);
				//~ cout << "w " << w << " p " << p << endl;
				now[{w, p}]++;
				if (now[{w, p}] == 2) {
					future.push({w, p});
				}
			}
			if (pointer[u] < n - 1) {
				int w = u;
				int p = g[u][pointer[u]];
				if (w > p) swap(w, p);
				//~ cout << "w " << w << " p " << p << endl;
				now[{w, p}]++;
				if (now[{w, p}] == 2) {
					future.push({w, p});
				}
			}
		}
	}
	return 0;
}


Measured memory_bytes: 4224
#include<bits/stdc++.h>
using namespace std;
using lli = long long;
#define rep(i,n) for(int i=0;i<n;i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

lli n;
string s;

int main(void){
    cin >> n >> s;
    lli W, B, w, b;
    W = B = 0;
    rep(i, n){
        if(s[i] == '.')W++;
        else B++;
    }

    w = b = 0;
    lli ans = W;
    rep(i, n){
        if(s[i] == '.') w++;
        else b++;
        ans = min(ans, b+W-w);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3716
#include<bits/stdc++.h>
using namespace std;
int ans;
unordered_map<int,int> dp;
int dfs(vector<vector<int>> &adj,int index){
  if(dp.find(index) != dp.end())
    return dp[index];
  int tempAns = 0;
  for(int j=0; j<adj[index].size(); j++){
    int u = adj[index][j];
    int temp = 1+dfs(adj,u);
    tempAns = max(tempAns,temp);
  }
  return dp[index] = tempAns;
}
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n,m;
  cin>>n>>m;
  vector<vector<int>> adj(n+1);
  int x,y;
  for(int i=0; i<m; i++){
    cin>>x>>y;
    adj[x].push_back(y);
  }
  ans = 0;
  for(int i=1; i<n+1; i++){
      // cout<<ans<<endl;
      ans = max(ans,dfs(adj,i));
  }
  cout<<ans;
  return 0;
}


Measured memory_bytes: 11940
#include <bits/stdc++.h>
using namespace std;
int main () {
    int A, B, K;
    set<int> ans;
    cin >> A >> B >> K;
    for (int i = 0; i < K; i++) {
        ans.insert(A+i);
        ans.insert(B-i);
    }
    for (auto x: ans) {
        if (x >= A && x <= B) {
            cout << x << endl;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
 
int main(){
    int n;
    cin >> n;
    vector<int>L(n);
    for(int i=0;i<n;i++){
        cin >> L[i];
    }
    sort(L.begin(),L.end());
    int sum=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            int x=upper_bound(L.begin()+j+1,L.end(),L[j]-L[i])-(L.begin()+j+1);
            int y=lower_bound(L.begin()+j+1,L.end(),L[i]+L[j])-(L.begin()+j+1);
            sum+=(y-x);
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 3508
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<bitset>
#include<vector>
#include<deque>
#include<list>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1 << 28;
const double EPS = 1e-10;
//cout << fixed << std::setprecision(9)
//memset(a, 0, sizeof(a));
//--------------------------

int n;
string a, b, c;

int main()
{
	cin >> n;
	cin >> a >> b >> c;
	int ans = 0;
	for (int i = 0;i < n;i++) {
		set<char> st;
		st.insert(a[i]);
		st.insert(b[i]);
		st.insert(c[i]);
		ans += (st.size() - 1);
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef int ll;
typedef long double ld;
const ll N = 200005;
char en = '\n';
ll inf = 1e16;
ll mod = 1e9 + 7;
ll power(ll x, ll n, ll mod) {
  ll res = 1;
  x %= mod;
  while (n) {
    if (n & 1)
      res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}

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

  ll arr[3];
  cin >> arr[1] >> arr[2];

  for (ll i = 1; i <= 3; i++) {
    if (i != arr[1] && i != arr[2]) {
      cout << i << en;
      return 0;
    }
  }

  return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD
int n, cnt;
vi s;
const int INF = INT_MAX;
void merge(int left, int mid, int right){
    int n1 = mid-left;
    int n2 = right-mid;
    vi L(n1+1), R(n2+1);
    REP(i,n1) L[i] = s[left + i];
    REP(i,n2) R[i] = s[mid  + i];
    L[n1] = INF;
    R[n2] = INF;

    {
        int i=0,j=0;
        FOR(k,left,right){
            if(L[i] <= R[j]){
                s[k] = L[i];
                i++;
            }else{
                s[k] = R[j];
                j++;
            }

            cnt++;
        }
    }
}

void mergeSort(int left, int right){
    if(left+1 < right){
        int mid = (left+right)/2;
        mergeSort(left, mid);
        mergeSort(mid, right);
        merge(left, mid , right);
    }
}

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    cin>>n;
    s.resize(n);
    REP(i,n) cin>>s[i];

    mergeSort(0, s.size());

    REP(i,n){
        cout<<s[i];
        if(i==n-1) cout<<endl;
        else cout<<" ";
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 6800
N = int(input())
SP = [[i+1, list(input().split())] for i in range(N)]
#print(N)
#SP.sort()
#print(SP)
#SP.sort(key=lambda x: x[0][0])

sorted_items = sorted(
  SP,
  key = lambda x: (x[1][0], -int(x[1][1]))
)
for i in sorted_items:
  print(i[0])

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int p=1e9+7;
const int maxn=1e5+10;
ll ans=1;
int n,x[maxn];
int main()
{
    cin>>n;int i,j;
    for(i=1;i<=n;i++)
        scanf("%d",&x[i]);
    for(i=1,j=0;i<=n;i++)
        if(x[i]<2*(i-j)-1)
            (ans*=i-j)%=p,++j;
    for(;j<n;j++) (ans*=n-j)%=p;
    cout<<ans;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
int n;
int a,b;
int p[114];
signed main(){
	cin>>n>>a>>b;
	int x=0,y=0,z=0;
	rep(i,n){
		cin>>p[i];
		if(p[i]<=a)x++;
		else if(p[i]<=b)y++;
		else z++;
	}
	cout<<min({x,y,z})<<endl;
	return 0;
}


Measured memory_bytes: 256
A,B,K = map(int,input().split())
if A == B:
    print(A)
else:
    if K > B - A:
        K = B - A
    tmp1 = list(range(A,A+K))
    tmp2 = list(range(B-K+1,B+1))
    ans = sorted(list(set(tmp1 + tmp2)))
    for i in ans:
        print(i)


Measured memory_bytes: 3060
#include<cstdio>
using namespace std;
int n,k,m;
int main(){
	scanf("%d",&n); k=0;
	while ((1<<(k+1))-1<=n) k++;
	m=(1<<k);
	if (m==n||n==1){
		puts("No");
		return 0;
	}
	puts("Yes");
	for (int i=1;i<m-1;i++){
		printf("%d %d\n",i,i+1);
		printf("%d %d\n",n+i,n+i+1);
	}
	printf("%d %d\n",m-1,n+1);
	if (n!=m-1){
		printf("1 %d\n",m+n);
		printf("%d %d\n",m,m+n+1);
	}
	for (int i=m+1;i<=n;i++){
		printf("%d %d\n",i+n-1,i);
		printf("%d %d\n",i-m,i+n);
	}
	return 0;
}


Measured memory_bytes: 2816
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  int N; cin >> N;
  vector<ll> counter(N+1, 0);
  ll tmp;
  ll maxi = 0;
  rep(i,N){
    cin >> tmp;
    if(i==0 && tmp!=0){
      cout << 0 << endl;
      return 0;
    }
    if(i!=0 && tmp == 0){
      cout << 0 << endl;
      return 0;
    }
    maxi = max(maxi, tmp);
    counter[tmp]++;
  }
  ll ans = 1;
  if(maxi == 1) {
    cout << 1 << endl;
    return 0;
  }
  rep(i,maxi+1){
    if(i==0) continue;
    rep(j,counter[i]){
      ans *= counter[i-1];
      ans %= 998244353;
    }
  }
  cout << ans%998244353 << endl;

  return 0;
}


Measured memory_bytes: 1024
/*
FIND YOUR PURPOSE BECOME UNSTOPPABLE---->>> ?????? 
                    ,.
                  ,_> `.   ,';
              ,-`'      `'   '`'._
            ,,-) ---._   |   .---''`-),.
          ,'      `.  \  ;  /   _,'     `,
      ,--' ____       \   '  ,'    ___  `-,
      _>   /--. `-.              .-'.--\   \__
    '-,  (    `.  `.,`~ \~'-. ,' ,'    )    _\
    _<    \     \ ,'  ') )   `. /     /    <,.
  ,-'   _,  \    ,'    ( /      `.    /        `-,
  `-.,-'     `.,'       `         `.,'  `\    ,-'
  ,'       _  /   ,,,      ,,,     \     `-. `-._
  /-,     ,'  ;   ' _ \    / _ `     ; `.     `(`-\
  /-,        ;    (o)      (o)      ;          `'`,
,~-'  ,-'    \     '        `      /     \      <_
/-. ,'        \                   /       \     ,-'
  '`,     ,'   `-/             \-' `.      `-. <
    /_    /      /   (_     _)   \    \          `,
      `-._;  ,' |  .::.`-.-' :..  |       `-.    _\
        _/       \  `:: ,^. :.:' / `.        \,-'
      '`.   ,-'  /`-..-'-.-`-..-'\            `-.
        >_ /     ;  (\/( ' )\/)  ;     `-.    _<
        ,-'      `.  \`-^^^-'/  ,'        \ _<
        `-,  ,'   `. `"""""' ,'   `-.   <`'
          ')        `._.,,_.'        \ ,-'
            '._        '`'`'   \       <
              >   ,'       ,   `-.   <`'
                `,/          \      ,-`
                `,   ,' |   /     /
                  '; /   ;        (
                  _)|   `       (
                  `')         .-'
                    <_   \   /    
                      \   /\(
                        `;/  `
*/
#include<bits/stdc++.h>
using namespace std;
#define speed ios::sync_with_stdio(0);cin.tie(0);
#define ll long long int
using ld = long double;
#define INF 100000000
int main(){
	speed;
	ld a;
	ld b;
	cin>>a>>b;
	b*=1000;
	ll ans=a*b/1000;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3744
#include <bits/stdc++.h>
#define _for(i,b,e) for (common_type_t<decltype(b),decltype(e)> i = (b), i ## __end = (e); i < i ## __end; ++ i)
#define FOR(...)   _for (__VA_ARGS__)
#define rep(i,n)   FOR (i, size_t{}, n)
#define ALL(x)     begin (x), end (x)
using namespace std;
using ll = int64_t;

inline auto dist (size_t i, size_t j) -> size_t
{
  return static_cast <size_t> (abs (static_cast <ll> (i) - static_cast <ll> (j)));
}

auto main () -> int
{
  cin.tie (nullptr);
  ios::sync_with_stdio (false);

  size_t n, x, y;
  cin >> n >> x >> y;
  -- x; -- y;
  vector <size_t> ans (n, 0);
  rep (j, n) rep (i, j)
  {
    auto d1 = dist (i, j);
    auto d2 = dist (i, x) + 1 + dist (y, j);
    auto d = min (d1, d2);
    ++ ans[d];
  }
  FOR (i, 1, n)
  {
    cout << ans[i] << endl;
  }
}


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

#define int long long
#define ff first
#define ss second
#define endl "\n"
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x.size())
int powmod(int a,int l, int md){a%=md; int res=1;while(l){if(l&1)res=res*a%md;l/=2;a=a*a%md;}return res;}
int binpow(int a,int l){int res=1;while(l){if(l&1)res=res*a;l/=2;a=a*a;}return res;}
int invmod(int a, int md){return powmod(a,md-2,md);}
typedef long long ll; typedef unsigned long long ull; typedef long double ld;
typedef vector<int> vi; typedef pair<int, int> ii; typedef vector< ii > vii;
#define pb push_back
int __set(int b, int i) {return b|(1LL<<i);} //set ith bit
int __unset(int b, int i) {return b&(~(1UL<<i));}
int __check(int b, int i) {return b&(1LL<<i);} //returns 0 if ith bit is 0
int mulmod(int a, int b, int md) {return (((a%md)*(b%md))%md+md)%md;}
int addmod(int a, int b, int md) {return ((a%md+b%md)%md+md)%md;}
int submod(int a, int b, int md) {return (((a%md-b%md)%md)+md)%md;}
int divmod(int a, int b, int md) {return mulmod(a, powmod(b, md-2, md), md);} //if md is prime;
const ll inf = 0xFFFFFFFFFFFFFFFL; //very large number
priority_queue<int, vector<int>, greater<int> > pq; //for min priority_queue
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);



signed main(void)
{
	IOS;
	int  n; cin>>n;
	map<string,int> m;
	m["AC"]=0;
	m["WA"]=0;
	m["TLE"]=0;
	m["RE"]=0;
	for(int i = 0; i < n; i++) {
		string s; cin>>s;
		m[s]++;
	}
	cout<<"AC x "<<m["AC"]<<endl;
	cout<<"WA x "<<m["WA"]<<endl;
	cout<<"TLE x "<<m["TLE"]<<endl;
	cout<<"RE x "<<m["RE"]<<endl;

	return 0;
}

Measured memory_bytes: 3664