akhauriyash/Code-Regression huggingface dataset:
/**
 * Title:
 * Url:
 */
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<numeric>
#include<functional>
#include<sstream>
#include<iomanip>

using namespace std;

#define ll long long

/**
* 10進数 v を base進数の文字列へ変換する。
* @param [in] v    10進数の整数
* @param [in] base 変換した 2~36 のN進数の値
* @return base進数へ変換した文字列
*/
template<typename TypeInt>
std::string Itoa(const TypeInt v, int base)
{
    static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    string ret;
    static numeric_limits<TypeInt> t;
    TypeInt n = v;
    if (t.is_signed) {
        if (v < 0) n *= -1;
    }

    while (n >= base) {
        ret += table[n%base];
        n /= base;
    }
    ret += table[n];
    if (t.is_signed) {
        if (v < 0 && base == 10) ret += '-';
    }
    // 文字列の順番を逆にする
    std::reverse(ret.begin(), ret.end());

    return ret;
}

int main() {
    int n, k; cin >> n >> k;
    string s = Itoa(n, k);
    cout << s.length() << endl;

    return 0;
}

Measured memory_bytes: 256
n,T=map(int,input().split())
ansc=1000
k=0
for _ in range(n):
    c,t=map(int,input().split())
    if T>=t:
        ansc=min(c,ansc)
    else:
        k+=1
if not n==k:
    print(ansc)
else:
    print('TLE')

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

struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) { }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};

using pint = pair<int,int>;
int main () {
    int N, M, K;
    cin >> N >> M >> K;
    vector<set<int> > dame(N);
    UnionFind uf(N);
    for (int i = 0; i < M; ++i) {
        int a, b; cin >> a >> b; --a, --b;
        dame[a].insert(b);
        dame[b].insert(a);
        uf.merge(a, b);
    }
    for (int i = 0; i < K; ++i) {
        int c, d; cin >> c >> d; --c, --d;
        if (!uf.issame(c, d)) continue;
        dame[c].insert(d);
        dame[d].insert(c);
    }

    for (int i = 0; i < N; ++i) {
        int mem = uf.size(i) - 1; // 同じ連結成分の「自分以外」の人数
        mem -= dame[i].size(); // その中ですでに友達かブロック関係の人数
        cout << mem << " ";
    }
    cout << endl;
}

Measured memory_bytes: 25728
import java.util.*;
public class Main {
 
         
        public static void main(String[] args) throws java.io.IOException{
            Scanner scan = new Scanner(System.in);
            boolean [] prime = new boolean [10001];
            for(int i=3;i<=10000;i+=2)prime[i]=true;
            prime[2]=true;
            for(int i=3;i<=100;i++){
            	for(int j=i*i;j<=10000;j+=i*2)prime[j]=false;
            }
            
            while(scan.hasNext()){
            	
            	int n =scan.nextInt();
            	int ans=0;
            	
            	for(int i=2;i<n;i++){
            		if(prime[i]&&prime[n+1-i])ans++;
            	}
            	System.out.println(ans);
            }
        }
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	ll n; cin>>n;
	vl v(n);
	ll m=0;
	rep(i,0,n){
		cin>>v[i];
		m+=abs(v[i]-(i!=0 ? v[i-1]:0));
		if(i==n-1){
			m+=abs(v[i]);
		}
	}
	v.push_back(0);
	vl ans(0);
	rep(i,0,n){
		ll c=0;
		if(i==0){
			c-=abs(v[i]);
			c-=abs(v[i+1]-v[i]);
			c+=abs(v[i+1]);
		}
		else{
			c-=abs(v[i]-v[i-1]);
			c-=abs(v[i]-v[i+1]);
			c+=abs(v[i-1]-v[i+1]);
		}
		ans.push_back(m+c);
	}
	for(ll c:ans){
		cout<<c<<endl;
	}
			
	
	return 0;
}

Measured memory_bytes: 5736
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pf push_front
#define fr first
#define sc second
#define r_0 return 0
#define ld long double

using namespace std;

    const ll N = 1e2 + 7;
    const ll mod = 1e9 + 7;
    const ld eps = 1e-9;



void solve(){
    int n;
    cin >> n;
    map < string , int > mp;
    string s;
    for(int i = 1; i <= n; ++ i){
        cin >> s;
        mp[s] ++;
    }
    cout << "AC x " << mp["AC"] << "\n" << "WA x " << mp["WA"] << "\n" << "TLE x " << mp["TLE"] << "\n" << "RE x " << mp["RE"];
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int tt = 1;
    //cin >> tt;
    while(tt --){
            solve();
    }
}

/**

**/


Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define ll 				long long
#define ld 				long double
#define fastio 			ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define debug(x) 		cerr<<#x<<" "<<x<<endl
#define cina(a,n) 		for(ll i = 0;i<n;i++)	cin>>a[i];
#define couta(a,n) 		for(ll i = 0;i<n;i++) cout<<a[i]<<" ";
#define fauto(ar)		for(auto x : ar)	cout<<x<<" ";
#define mod 			1000000007
#define siz 			62
#define f 				first
#define s 				second
#define pb 				push_back
#define endl 			"\n"
#define ci 				cin.ignore()
using namespace std;
int main()
{
	ll n,k,i,j;
	cin>>n>>k;
	ll a[n],dp[n+1][siz];
	memset(dp,-1,sizeof(dp));
	
	for(i = 0;i<n;i++)
	{
		cin>>a[i];
		dp[i+1][0] = a[i];
	}
	
	for(j = 0;j<siz-1;j++)
	{
		for(i = 1;i<=n;i++)
		{
			dp[i][j+1] = dp[dp[i][j]][j];
		}
	}
	
//	for(i = 1;i<=n;i++)
//	{
//		cerr<<i<<" -> ";
//		for(j = 0;j<8;j++)
//		cerr<<dp[i][j]<<" ";
//		cerr<<endl;
//	}
	
	i = 1;
	for(j = siz-1;j>=0;j--)
	{
		if((1LL<<j)&k)
		{
//			cerr<<i<<" ,"<<j<<endl;
			i = dp[i][j];
		}
	}
	
//	cerr<<"\n\n";
	cout<<i;
	
	
	
	
	
	
	
	
	
}

Measured memory_bytes: 102064
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
using namespace std;
 
template <class T> using V = vector<T>;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
const long long INF = 1LL << 60;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;

 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>=(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
  
 

ll sum(ll n) {
ll m=0;
  while(n){
    m+=n%10;
    n/=10;
  }
  return m;
}
 
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
 
#define comuse Comuse()
 
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
 
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}




 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll n;
  	ci(n);
  n=sqrt(n)/1;
  co(n*n)
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
const long long MOD = 1000000007;

ll N, a[300010];
ll L[300010], R[300010];

signed main(){
    cin >> N;
    REP(i, 3 * N) cin >> a[i];
    L[0] = a[0];
    FOR(i, 1, N) L[i] = L[i - 1] + a[i];
    priority_queue<ll, vector<ll>, greater<ll>> que(a, a + N);
    FOR(i, N, 2 * N){
        if(a[i] < que.top()){
            L[i] = L[i - 1];
        }else{
            L[i] = L[i - 1] + a[i] - que.top();
            que.pop();
            que.push(a[i]);
        }
    }
    R[3 * N - 1] = a[3 * N - 1];
    for(ll i = 3 * N - 2; i >= 2 * N; i--) R[i] = R[i + 1] + a[i];
    priority_queue<ll, vector<ll>, less<ll>> que2(a + 2 * N, a + 3 * N);
    for(ll i = 2 * N - 1; i >= N; i--){
        if(que2.top() < a[i]){
            R[i] = R[i + 1];
        }else{
            R[i] = R[i + 1] + a[i] - que2.top();
            que2.pop();
            que2.push(a[i]);
        }
    }
    ll ans = LONG_LONG_MIN;
    FOR(i, N - 1, 2 * N){
        ans = max(ans, L[i] - R[i + 1]);
    }
    PRINT(ans);
    return 0;
}

Measured memory_bytes: 10384
// AOJ 1137 "Numeral System" (ICPC国内予選 2005 Problem C)
import java.util.Scanner;
import java.util.Set;
import java.util.HashSet;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        for (int i = 0; i < n; i++) {
            String s1 = sc.next();
            String s2 = sc.next();
            int ans = parseInt(s1) + parseInt(s2);
            System.out.println(toMCXI(ans));
        }
    }
    
    public static int parseInt(String s) {
        int n = 0;
        int tmp = 1;
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if ('2' <= c && c <= '9') {
                tmp = c - '0';
            } else {
                if (c == 'm') {
                    n += tmp * 1000;
                } else if (c == 'c') {
                    n += tmp * 100;
                } else if (c == 'x') {
                    n += tmp * 10;
                } else if (c == 'i') {
                    n += tmp;
                }
                tmp = 1;
            } 
        }
        return n;
    }
    
    public static String toMCXI(int n) {
        StringBuffer s = new StringBuffer();
        char[] c = {'i', 'x', 'c', 'm'};
        
        for (int i = 0; i < c.length; i++) {
            int tmp = n % 10;
            if (tmp > 0) {
                s.insert(0, c[i]);
                if (tmp > 1) {
                    s.insert(0, tmp);
                }
            }
            n /= 10;
        }
        return s.toString();
    }
}

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


int main(){
    int N;
    cin >> N;
    for (int i = 1; i < 10; i++){
        int x = 111 * i;
        if (x >= N){
            cout << x << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//const ll INF = 1LL << 60;
//const int INF = 1001001001;

const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  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 { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // 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 { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
int main(void){
    int n,k;
    cin >> n >> k;
    vector<int> l(k), r(k);
    REP(i,k) cin >> l[i] >> r[i];
    vector<mint> dp(n+1);
    vector<mint> dpsum(n+1);
    dp[1] = 1;
    dpsum[1] = 1;
    for(int i=2;i<=n;i++){
      REP(j,k){
        //[l[j],r[j]]
        int li = i-r[j];
        int ri = i-l[j];
        if(ri < 0) continue;
        li = max(li,1);
        dp[i] += dpsum[ri] - dpsum[li-1]; //dp[li]~dp[ri]
      }
      dpsum[i]=dpsum[i-1]+dp[i];
    }
    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 6424
S = input()

allsum = 0

def calcStr(s) :
    return sum(list(map(int, s.split("+"))))

def dosum(s, idx) :
    global allsum
    if idx >= len(s) :
        allsum += calcStr(s)
        # do sum
    else :
        if len(s) > idx :
            dosum(s[0:idx] + "+" + s[idx:len(s)], idx + 2)
            dosum(s, idx + 1)
            
dosum(S, 1)
print(allsum)

Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <cmath>
#include <cstring>

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;

const ll LINF = 1001002003004005006LL;
const int INF = 1001001001;

const int mod = 1000000007;

int main() {
    int n; cin >> n;
    int ans = n % 1000;
    if (ans != 0) ans = 1000-ans;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3596
import java.io.ByteArrayInputStream;
import java.io.UnsupportedEncodingException;
import java.util.Scanner;
import java.util.jar.Pack200;

public class Main {
    private static String solve(Scanner scanner) {
        String line = scanner.nextLine();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < line.length(); i ++) {
            if (i % 2 == 0) sb.append(line.charAt(i));
        }
        return new String(sb);
    }

    public static void main(String[] args) {
//        tests();

        Scanner scanner = new Scanner(System.in);
        System.out.println(solve(scanner));
    }

    private static String ex1 = "atcoder";
    private static String ex2 = "aaaa";
    private static String ex3 = "z";

    private static void tests() {
        System.out.println(solve(new Scanner(testCaseToInputStream(ex1))));
        System.out.println(solve(new Scanner(testCaseToInputStream(ex2))));
        System.out.println(solve(new Scanner(testCaseToInputStream(ex3))));
    }

    private static ByteArrayInputStream testCaseToInputStream(String ex) {
        try {
            return new ByteArrayInputStream(ex.getBytes("utf-8"));
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
            throw new RuntimeException();
        }
    }
}

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

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

  int n, k;
  cin >> n >> k;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v.at(i);
  
  for (int i = k; i < n; i++)
  {
    if(v.at(i) > v.at(i-k)) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  

  return 0;
}

Measured memory_bytes: 3988
/************************************
/ AUTHOR : YATHARTH GOSWAMI         /  
/ ALIAS : hacker_yg                 /
/ INSTITUTE : IIT Kanpur            /
************************************/
//          TEMPLATE                //

#include <bits/stdc++.h>

#define ll long long
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define PI 3.14159265359

using namespace std;

/*ll powMod(ll a, ll y)
{
    ll ans = 1;
    
    while (y > 0) 
    { 
        if (y & 1) 
            ans = (ans*a) % MOD; 
  
        y = y>>1;
        a = (a*a) % MOD; 
    } 
    return ans;
}*/

/*ll modInv(ll a)
{
    return powMod(a, MOD-2);	
}*/

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    ll n, x, m;
    cin >> n >> x >> m;
    ll ans = 0, a = x, count = 1;
    map <int, int> mpz;
    ans += a%m;
    while (!mpz[a] && n > count) {
        mpz[a]++;
        a = (a*a)%m;
        ans += a;
        count++;
    }
    ll cycle_sum = 0, len = 0;
    map <int, int> m2;
    while (!m2[a]) {
        m2[a]++;
        cycle_sum += a;
        a = (a*a)%m;
        len++;
    }
    ans += ((n-count)/len)*cycle_sum;
    n = (n-count)%len;
    while (n--) {
        ans += (a*a)%m;
        a = (a*a)%m;
    }
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 8248
/* You can't connect the dots looking forward 
   you can only connect them looking backwards. */

#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned long long
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cout.precision(10);cout << fixed;
#define dbset(x) for(int i=0 ; i<x.size(); i++) cerr << x[i] << " "; cerr << endl;
#define inf 1000000007
#define INF 1000000000000000000LL
#define PI 3.14159265358979323846
#define mod 1000000007
#define mod1 1000696969
#define flusz fflush(stdout);
#define VI vector<int>
#define VPI vector < pair<int,int> >
#define PII pair<int, int>
#define BIT bitset<N>
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define endl '\n'
#define REP(x, y) for(int x = 0; x < (y); ++x)
#define FOR(x, y, z) for(int x = y; x <= (z); ++x)
#define FORR(x, y, z) for(int x = y; x >= (z); --x)
using namespace std;

template<class TH> void _dbg(const char *sdbg, TH h){cerr<<sdbg<<"="<<h<<"\n";}
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;cerr<<"="<<h<<","; _dbg(sdbg+1, a...);
}
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)

#define int long long
#define N 500007

int test;

int n,res;

VPI g[N];

int siz[N];

int xd,xd1;

bool kek = false;

void dfs(int v,int p,int ed){
    siz[v] = 1;

    bool czy = false,lul;

    for(auto it:g[v]){
        if (it.st!=p){
            dfs(it.st,v,it.nd);

            siz[v] += siz[it.st];

            if (siz[it.st]>=(n+1)/2){
                czy=true;
            }
        }else{
            lul = it.nd;
        }
    }

    for(auto it:g[v]){
        if (it.st!=p){
            res+=2*it.nd*min(siz[it.st],n-siz[it.st]);
        }
    }

    if(siz[v] == n/2 && n%2==0){
        kek = true;
        xd1=ed;
    }else if (!czy && n-siz[v]<(n+1)/2){
        xd = v;
    }

    return;
}

void solve()
{
    cin >> n;

    FOR(i,1,n-1){
        int a,b,c;
        cin >> a >> b >> c;

        g[a].eb(b,c);
        g[b].eb(a,c);
    }

    dfs(1,1,0);

    if (kek){
        cout << res-xd1;
    }else{
        int odp = inf;

        for(auto it:g[xd]){
            odp = min(odp,it.nd);
        }

        cout << res-odp;
    }

    return;
}

int32_t main()
{
    boost

    test=1;

    while(test--)
    {
        solve();
    }

  return 0;
}


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

int main(){
    int n,k;
    cin>>n>>k;
    ll ans=k;
    rep(i,n-1) ans*=(k-1);
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 3596
#include<stdio.h>
int LCM(long long int x,long long int y)
{
    long long int r,m,gcd,lcm;
    m=x*y;
    while(y!=0){
        r=x%y;
        x=y;
        y=r;
    }
    gcd=x;
    lcm=m/gcd;
    return lcm;
}
int main()
{
    long long int n,i,k;
    scanf("%lld",&n);
    long long int a[n];
    for(i=0;i<n;i++){
        scanf("%lld",&a[i]);
    }
    k=LCM(a[0],a[1]);
    for(i=2;i<n;i++){
        k=LCM(k,a[i]);
    }
    printf("%lld\n",k);
    return 0;
}



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

int main()
{
	int W, H, x, y, r;
	cin >> W >> H >> x >> y >> r;
	char* ret = "No";
	if (x >= r && x <= W-r &&
	    y >= r && y <= H-r)
	{
		ret = "Yes";		
	}
		
	cout << ret << endl;
	
	return 0;
}

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

#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FILL0(x) memset(x,0,sizeof(x))

using namespace std;

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

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; }
 
const int MOD = ll(1e9)+7;

const int MAX = 510000;
ll fac[MAX], finv[MAX], inv[MAX];

void comInit()
{
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;

    for(int i=2; i<MAX; i++)
    {
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}

ll com(int n, int r)
{
    if(n<r)
        return 0;
    if(n<0 || r<0)
        return 0;
    
    return fac[n]*(finv[r]*finv[n-r]%MOD)%MOD;
}

// a^n MOD を計算する
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

// a^{-1} MOD を計算する
ll modinv(ll a) {
    return modpow(a, MOD - 2);
}


ll factorial(int n, int p)
{
    ll r=1;
    for(int i=n; i>p; i--)
    {
        r*=i;
        r%=MOD;
    }
    return r;
}

int main()
{
    int N;
    cin >> N;
    int a, b;
    cin >> a >> b;

    ll ans=modpow(2, N)-1;

    comInit();

    ll v1 = (factorial(N, N-a)*finv[a])%MOD;
    ll v2 = (factorial(N, N-b)*finv[b])%MOD;    
    ll v1v2 = (v1+v2)%MOD;
    ans-=v1v2;
    ans+=MOD;
    ans%=MOD;
    cout << ans << endl;

    return 0;
}
 

//cout << setprecision(13);
//next_permutation();
//__gcd();
//reverse();
//set ,tuple ,pair;
//bitset
//vector.find



Measured memory_bytes: 12160
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <stdio.h>
#include <set>
#include <map>
#include <algorithm>
#include <queue>
#include <vector>
#define ll long long
#define pb push_back
#define mp make_pair
#define f first
#define s second

using namespace std;

const int inf = 1e9 + 7;
const long long INF = 1e18 + 7;
const int maxn = 2e5 + 7;

int n, a[maxn], cnt[maxn], was[maxn], ok[maxn];

int main(){
	ios_base::sync_with_stdio(NULL);
	cin.tie(0);
	cout.tie(0);
	cin >> n;
	for (int i = 1; i <= n; i++){
		cin >> a[i];
		was[a[i]]++;
		cnt[abs((i - 1) - (n - i))]++;
	}
	if (was[0] == 1 && n % 2 == 0 || was[0] > 1){
		cout << 0;
		return 0;
	}
	int res = 1;
	for (int i = 1; i <= n; i++){
		res = res * cnt[a[i]];
		if (!ok[a[i]])
			res /= was[a[i]], ok[a[i]]++;
		res %= inf;
	}
	cout << res;
	return 0;
} 

Measured memory_bytes: 1792
import sys
sys.setrecursionlimit(1000000)
input=sys.stdin.readline

N,M=map(int,input().split())
P=[i for i in range(N+1)]
size=[1 for i in range(N+1)]

def find(a):
    if a==P[a]:
        return a
    else:
        return find(P[a])
        
def union(b,c):
    B=find(b)
    C=find(c)
    if size[B]<size[C]:
        P[B]=P[C]
        size[C]+=size[B]
    else:
        P[C]=P[B]
        size[B]+=size[C]

for i in range(M):
    a,b=map(int,input().split())
    if find(a)==find(b):
        P[a]=find(a)
        P[b]=find(b)
        continue
    else:
        union(a,b)
for i in range(N+1):
    P[i]=find(P[i])
#print(P)
D={}
for i in range(1,N+1):
    if P[i] not in D:
        D[P[i]]=1
    else:
        D[P[i]]+=1
ans=0
for k,v in D.items():
    if ans<v:
        ans=v
print(ans)

Measured memory_bytes: 33644
#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>
#include <queue>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define S2(x,y) scanf("%d%d",&x,&y)
#define P(x) printf("%d\n",x)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second
#define pb push_back
#define mp make_pair

typedef long long int LL;
typedef pair<int, int > pii;
typedef vector<int > vi;

const int N = 500005;

int A[N], ans[N], P[N];
vector<pii > Q[N];

class BinaryIndexTree {
  vector<int > BIT;
  int sz;

public:

  BinaryIndexTree(int _sz) {
    sz = _sz;
    BIT.resize(_sz+1, 0);
  }

  void update(int idx, int val) {
    for(int i = idx; i < sz; i += i & -i) {
      BIT[i] += val;
    }
  }

  int query(int idx) {
    int res = 0;
    for(int i = idx; i; i -= i & -i) {
      res += BIT[i];
    }
    return res;
  }

};

BinaryIndexTree bit(N);

int main() {
  int n,q;
  S2(n,q);
  rep(i,1,n+1) {
    S(A[i]);
  }
  rep(i,0,q) {
    int l,r;
    S2(l,r);
    Q[r].pb(mp(l,i));
  }
  rep(i,1,n+1) {
    if(P[A[i]]) {
      bit.update(P[A[i]], -1);
    }
    bit.update(i, 1);
    P[A[i]] = i;
    rep(j,0,Q[i].size()) {
      ans[Q[i][j].SS] = bit.query(i) - bit.query(Q[i][j].FF - 1);
    }
  }
  rep(i,0,q) P(ans[i]);
  return 0;
}


Measured memory_bytes: 33232
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
 
using namespace std;
 
#define pai 3.14159265359
#define mod 1000000007

int main()
{
    int a[3];
    for(int i = 0; i < 3; i++){
        cin >> a[i];
    }
    sort(a, a + 3);
    if(a[0] == 5 && a[1] == 5 && a[2] == 7) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

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

int main(){
	vector<string> line;
	string s, buff;
	int y=0, x=0;
	
	while( getline(cin,s) ){
		if( s == "END_OF_TEXT" ) break;
		line.push_back( s );
	}
	while( getline(cin,s) ){
		if( s == "-" ) break;
		
		if( s[0] == 'a' ){
			x = 0;
		}else if( s[0] == 'e' ){
			x = line[y].size();
		}else if( s[0] == 'p' ){
			if( y == 0 ){
				x = 0;
			}else{
				y--;
				x = 0;
			}
		}else if( s[0] == 'n' ){
			if( y == line.size()-1 ){
				x = 0;
			}else{
				y++;
				x = 0;
			}
		}else if( s[0] == 'f' ){
			if( x != line[y].size() ){
				x++;
			}else if( y != line.size()-1 ){
				y++;
				x = 0;
			}
		}else if( s[0] == 'b' ){
			if( x != 0 ){
				x--;
			}else if( y != 0 ){
				y--;
				x = line[y].size();
			}
		}else if( s[0] == 'd' ){
			if( x != line[y].size() ){
				string str;
				for(int i=0 ; i < line[y].size() ; i++ ){
					if( i == x ) continue;
					str.push_back( line[y][i] );
				}
				line[y] = str;
			}else if( y != line.size()-1 ){
				line[y] += line[y+1];
				for(int i = y+2 ; i < line.size() ; i++ ){
					line[i-1] = line[i];
				}
				line.pop_back();
			}
		}else if( s[0] == 'k' ){
			if( x == line[y].size() ){
				if( y != line.size()-1 ){
					buff = ";";
					line[y] += line[y+1];
					for(int i = y+2 ; i < line.size() ; i++ ){
						line[i-1] = line[i];
					}
					line.pop_back();
				}
			}else{
				string str;
				for(int i=x ; i < line[y].size() ; i++ ){
					str.push_back( line[y][i] );
				}
				buff = str;
				str.clear();
				for(int i=0 ; i < x ; i++ ){
					str.push_back( line[y][i] );
				}
				line[y] = str;
			}
		}else if( s[0] == 'y' ){
			if( !buff.empty() ){
				if( buff == ";" ){
					string str;
					for(int i=x ; i < line[y].size() ; i++ ){
						str.push_back( line[y][i] );
					}
					line.push_back( line[line.size()-1] );
					for(int i = line.size()-2 ; i >= y+2 ; i-- ){
						line[i] = line[i-1];
					}
					line[y+1] = str;
					str.clear();
					for(int i=0 ; i < x ; i++ ){
						str.push_back( line[y][i] );
					}
					line[y] = str;
					y++;
					x = 0;
				}else{
					string str;
					for(int i=0 ; i < x ; i++ ){
						str.push_back( line[y][i] );
					}
					str += buff;
					for(int i=x ; i < line[y].size() ; i++ ){
						str.push_back( line[y][i] );
					}
					line[y] = str;
					x += buff.size();
				}
			} 
		}
	}
	for(int y_=0 ; y_ < line.size() ; y_++ ){
		for(int x_=0 ; x_ < line[y_].size() ; x_++ ){
			cout << line[y_][x_];
		}
		cout << endl;
	}
}

Measured memory_bytes: 0
#include <stdio.h>

int main() {
	int N, M, C, A[20][20], B[20], cnt = 0, sum;
	scanf("%d%d%d", &N, &M, &C);
	int i, j;
	for (i = 0; i < M; i++)scanf("%d", &B[i]);
	for (i = 0; i < N; i++) for (j = 0; j < M; j++) scanf("%d", &A[i][j]);
	for (i = 0; i < N; i++) {
		sum = C;
		for (j = 0; j < M; j++) {
			sum += A[i][j] * B[j];
		}
		if (sum > 0)cnt++;
	}
	printf("%d\n", cnt);
	return 0;
}


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

int main() {
  int n, k, x, y;
  cin >> n >> k >> x >> y;
  int ans = 0;
  
  if(n <= k) ans += n*x;
  else ans += k*x + (n-k)*y;
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3612
#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); ++i)

using namespace std;
using ll = long long;
using P = pair<int,int>;
using ull= unsigned long long;
const ll K_MAX=1e5+5;
const int INF=1e9;


int main(){
  int x,n;
  cin>>x>>n;
  int ans=INF;
  int min1=INF;
  map<int,int> p;
  rep(i,n){
    int pp;
    cin>>pp;
    p[pp]=1;
  }

  rep(i,100){
    if(p[x-i]!=1){
      cout<<x-i<<endl;
      return 0;
    }

    if(p[x+i]!=1){
      cout<<x+i<<endl;
      return 0;
    }

    
  }



  
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
long long f(long long n)
{
    long long cnt =0;
    while(n){
        cnt+=(n%10);
        n/=10;
    }
    return cnt;
}
int main()
{
    long long n,k;
    cin>>k;
    long long s=1, d=1;
    for(int i=0; i<k; i++){
        cout<<s<<endl;
        while(1.0 *(s+d)/f(s+d)> 1.0 *(s+2*d)/f(s+2*d)){
            d*=10;
        }
        s+=d;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>

#define ll long long

using namespace std;

ll my_pow(ll a, ll n){
    if(n == 0) return 1;
    return a * my_pow(a, n - 1);
}

ll radix_change(ll n, ll from, ll to){
    ll digit = 1;
    ll tmp = n;
    ll base10 = 0;

    if(from != 10){
    
        while(tmp > 1){
            digit++;
            tmp = tmp / 10;
        }
        
        tmp = n;
        
        for(ll i = 0; i < digit; i++){
            ll d = tmp / my_pow(10,digit - 1 - i);
            base10 = base10 + my_pow(from, digit - 1 - i) * d;
            tmp = tmp % my_pow(10, digit - 1 - i);
        }

    }else base10 = n;

    if(to == 10) return base10;

    digit = 1;

    while(my_pow(to,digit) < base10){
        digit++;
    }

    ll baseto = 0;
    tmp = base10;

    for(ll i = 0; i < digit; i++){
        ll d = tmp / my_pow(to,digit - 1 - i);
        tmp = tmp - d * my_pow(to, digit - 1 -i);
        baseto = baseto * 10 + d; 
    }

    return baseto;
}

ll to753(ll n){
    ll base4 = radix_change(n, 10, 4);

    ll k = 1;
    ll sum = 0;

    while(base4 > 0){
        ll tmp = base4 % 10;
        if(tmp == 1) sum = sum + 3 * k;
        if(tmp == 2) sum = sum + 5 * k;
        if(tmp == 3) sum = sum + 7 * k;
        base4 = base4 / 10;
        k = k * 10;
   }

   return sum;

}

bool check(ll n){
    bool seven = false;
    bool five = false;
    bool three = false;

    while(n > 0){
        if(n % 10 == 7){
            seven = true;
        }else if(n % 10 == 5){
            five = true;
        }else if(n % 10 == 3){
            three = true;
        }else return false;
        n = n / 10;
    }

    return seven && five && three;
}

int main(){

    ll n;
    cin >> n;

    ll cnt = 0;
    ll k = 1;
    ll tmp;

    while(true){
        tmp = to753(k);
        if(tmp > n) break;
        if(check(tmp)){
            cnt++;
        }
        k++;
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python2
# coding: utf-8

n, m = map(int, raw_input().split())
c = map(int, raw_input().split())

dp = ['inf'] * 50001
dp[0] = 0;

for i in range(m):
    for j in range(n+1):
        if j + c[i] > n:
            break
        else:
            dp[j + c[i]] = min(dp[j + c[i]], dp[j] + 1)

print dp[n]



Measured memory_bytes: 7728
C = []
for _ in range(3):
    c = list(map(int ,input().split()))
    C.append(c)

b0 = C[0][0]
b1 = C[0][1]
b2 = C[0][2]

a2_1 = C[1][0] - b0
a2_2 = C[1][1] - b1
a2_3 = C[1][2] - b2

a3_1 = C[2][0] - b0
a3_2 = C[2][1] - b1
a3_3 = C[2][2] - b2

if a2_1 == a2_2 and a2_2 == a2_3:
    if a3_1 == a3_2 and a3_2 == a3_3:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=1e6+23;

char s[1023][1023];
int f[maxn],vis[1023][1023],_vis[maxn];
int n,m,cnt;
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};
int d[maxn];

vector<int> g[maxn];

int id(int i,int j){
	return (i-1)*m+j;
}

void dfs(int i,int j){
	if(s[i][j]=='#'||vis[i][j]) return ;
	vis[i][j]=cnt;
	for(int k=0;k<4;k++){
		dfs(i+dx[k],j+dy[k]);
	}
}

int main(){
	cin>>n>>m;
	int A,B,C,D;
	cin>>A>>B>>C>>D;
	for(int i=0;i<1023;i++) for(int j=0;j<1023;j++) s[i][j]='#';
	for(int i=1;i<=n;i++)
		scanf("%s",s[i]+1),s[i][m+1]='#';
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			if(s[i][j]=='#'||vis[i][j]) continue;
			cnt++;
			dfs(i,j);
		}
	}
	
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			for(int k=-2;k<=2;k++){
				for(int l=-2;l<=2;l++){
					if(k==0&&l==0) continue;
					if(k+i<0||j+l<0) continue;
					int x=vis[i][j],y=vis[i+k][j+l];
					if(!x||!y) continue;
					if(x!=y){
						g[x].push_back(y);
						g[y].push_back(x);
					}
				}
			}
		}
	}

	queue<int> q;
	q.push(vis[A][B]);
	memset(d,0x3f,sizeof(d));
	d[vis[A][B]]=0;_vis[vis[A][B]]=1;
	while(!q.empty()){
		int x=q.front();q.pop();
		for(int i:g[x]){
			if(_vis[i]) continue;
			q.push(i);
			d[i]=d[x]+1;
			_vis[i]=1;
		}
	}
	printf("%d",d[vis[C][D]]<1e7?d[vis[C][D]]:-1);
}

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

int main(){

    ll N;
    cin >> N;

    vector<vector<ll> > G(N,vector<ll>(N,0));
    for (int i = 0; i < N; i++)
    {
        ll u,k;
        cin >> u >> k;
        for (int j = 0; j < k; j++)
        {
            ll v;
            cin >> v;
            G[u-1][v-1] = 1;
        }
    }
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < N; j++)
        {
            cout << G[i][j] ;
            if( j != N-1 )
                cout << " ";
        }
        cout << endl;
        
    }
    
    




}


Measured memory_bytes: 3172
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class Main {
    private final int[][] search = new int[][]{
            {0, 1},
            {0, -1},
            {1, 1},
            {1, -1},
            {1, 0},
            {-1, 1},
            {-1, 0},
            {-1, -1}
    };

    public static void main(final String[] args) throws IOException {
        new Main().run();
    }

    private void run() throws IOException {
        boolean b = true;
        final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        while (b) {
            b = runOnce(reader);
        }

        reader.close();
    }

    private boolean runOnce(final BufferedReader reader) throws IOException {
        final String[] params = reader.readLine().split(" ");
        final int x = Integer.parseInt(params[0]);
        final int y = Integer.parseInt(params[1]);
        if (x == 0 && y == 0) return false;

        final Map<Field, Boolean> fields = new HashMap<>();
        for (int i = 0; i < y; i++) {
            final String[] line = reader.readLine().split(" ");
            for (int j = 0; j < line.length; j++) {
                fields.put(new Field(i, j, line[j].equals("1")), line[j].equals("1"));
            }
        }
        int landCount = 0;
        while (true) {
            final Iterator<Field> iterator = fields.keySet().iterator();
            if (!iterator.hasNext()) {
                break;
            }
            final Field next = iterator.next();
            if (next.land) {
                searchLand(next, fields);
                landCount++;
            } else {
                fields.remove(next);
            }
        }
        System.out.println(landCount);
        return true;
    }

    private void searchLand(final Field field, final Map<Field, Boolean> fields) {
        fields.remove(field);

        final Field tmp = new Field(0, 0, true);
        for (final int[] s: search) {
            tmp.x = field.x + s[0];
            tmp.y = field.y + s[1];
            if(fields.containsKey(tmp)) {
                if (fields.get(tmp)) {
                    searchLand(tmp, fields);
                }
                fields.remove(tmp);
            }
        }
    }

    private final class Field {
        int x, y;
        boolean land;

        Field(final int x, final int y, final boolean land) {
            this.x = x;
            this.y = y;
            this.land = land;
        }

        @Override
        public int hashCode() {
            return x * 2 + y * 101;
        }

        @Override
        public boolean equals(final Object obj) {
            if (obj instanceof Field) {
                return ((Field) obj).x == this.x && ((Field) obj).y == this.y;
            }
            return super.equals(obj);
        }
    }
}

Measured memory_bytes: 33068
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;

int main() {
    int n,q;
    cin >> n >> q;
    string s;
    cin >> s;
    vector<int> ac(n,0);
    int now = 0;
    rep2(i,1,n) {
        ac[i] = ac[i-1];
        if(s[i-1] == 'A' && s[i] == 'C') ac[i]++;
    }
    vector<int> ans;
    rep(i,q) {
        int l,r;
        cin >> l >> r;
        l--; r--;
        if(l == 0) {
            ans.pb(ac[r]);
            continue;
        }
        int nans = ac[r]-ac[l-1];
        if(ac[l-1] != ac[l]) nans--;
        ans.pb(nans);
    }
    for(int i : ans) cout << i << endl;
}

Measured memory_bytes: 1912
#include<bits/stdc++.h>
using namespace std;
int main(){
  int x1,y1,x2,y2;cin>>x1>>y1>>x2>>y2;
  cout<<x2+y1-y2<<" "<<y2+x2-x1<<" "<<x1-y2+y1<<" "<<y1-x1+x2<<endl;
}

Measured memory_bytes: 256
//c++ -std=gnu++14 a.cpp
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <climits>
#include <fstream>
#include <random>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
//typedef pair<ll, ll> P;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define revrep(i, n) for(int i = (n)-1; i >= 0; i--)
#define pb push_back
#define f first
#define s second
#define chmin(x, y) x = min(x, y);
#define chmax(x, y) x = max(x, y);
#define len(x) ((int)(x).size())

//const ll INFL = LLONG_MAX;//10^18 = 2^60
const ll INFL = 1LL<<60;
//const int INF = INT_MAX;
const int INF = 1 << 30;//10^9
const ll MOD = 1000000007;
//const ll MOD = 998244353;
double EPS = 1e-10;

vector<ll> dy = {0, 1, 0, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, 0, -1, 0, 1, -1, 1, -1, 0};

void pres(double A){printf("%.9lf\n", A);}
void BinarySay(ll x, ll y = 60){rep(i, y) cout << (x>>(y-1-i) & 1); cout << endl;}
ll cnt_bit(ll x){return __builtin_popcountll(x);}

ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x; k /= 2;
  }
  return res;
}

ll pow_mod(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}

ll inverse(ll x){return pow_mod(x, MOD - 2);};

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

ll lcm(ll x, ll y){
  ll res = x / gcd(x, y);
  res *= y;
  return res;
};


//コンビネーション
const int MAXcomb = 2000010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAXcomb; i++){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
ll comb(int n, int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * finv[k] % MOD * finv[n-k] % MOD;
}



ll disit(ll s, ll base = 10){
  ll res = 0;
  while(s){
    res++;
    s /= base;
  }
  return res;
}

void solve(){
  int n;
  cin >> n;
  vector<int> a(n);
  int ans = 0;
  rep(i, n) cin >> a[i];
  sort(a.begin(), a.end());
  rep(i, n)rep(j, n)rep(k, n){
    if(i >= j || j >= k) continue;
    if(a[i] == a[j] || a[j] == a[k]) continue;
    if(a[i] + a[j] <= a[k]) continue;
    ans += 1;
  }
  cout << ans << endl;
}

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


Measured memory_bytes: 3660
"""
    こんにちは。これはクシャルです
    
    Author : thekushalghosh (クシャル)
    Team   : CodeDiggers
 
    I prefer Python language over the C++ language :p :D
        
    Visit my website : thekushalghosh.github.io
"""
import sys,math,cmath,time
start_time = time.time()
##########################################################################
################# ---- THE ACTUAL CODE STARTS BELOW ---- #################

def solve():
    n = inp()
    a = inlt()
    q = 0
    for i in range(len(a)):
        q = q ^ a[i]
    for i in range(len(a)):
        a[i] = a[i] ^ q
    print(*a)
            
################## ---- THE ACTUAL CODE ENDS ABOVE ---- ##################
##########################################################################
 
def main():
    global tt
    if not ONLINE_JUDGE:
        sys.stdin = open("input.txt","r")
        sys.stdout = open("output.txt","w")
    t = 1
    for tt in range(t):
        solve()
    if not ONLINE_JUDGE:
        print("Time Elapsed :",time.time() - start_time,"seconds")
        sys.stdout.close()
    
#---------------------- USER DEFINED INPUT FUNCTIONS ----------------------#
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    return(input().strip())
def invr():
    return(map(int,input().split()))
 
#------------------ USER DEFINED PROGRAMMING FUNCTIONS ------------------#
def counter(a):
    q = [0] * 100000
    for i in range(len(a)):
        q[a[i] - 1] = q[a[i] - 1] + 1
    return(q)
 
def string_counter(a):
    q = [0] * 26
    for i in range(len(a)):
        q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
    return(q)

#-----------------------------------------------------------------------#  
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
    input = sys.stdin.readline
main()

Measured memory_bytes: 104628
#include <bits/stdc++.h>
#define sz(c)       int(c.size())
#define rep(i,a,b)  for (int i=a; i<(b); ++i)
#define per(i,a,b)  for (int i=(b)-1; i>=(a); --i)
#define fore(c,...) for (auto __VA_ARGS__:(c))
using namespace std;
typedef long long ll;



int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	cout<<fixed<<setprecision(10);

	int a,b,c,d;
	cin>>a>>b>>c>>d;

	while (true) {
		c-=b;
		if (c<=0) {
			cout<<"Yes"<<'\n';
			return 0;
		}
		a-=d;
		if (a<=0) {
			cout<<"No"<<'\n';
			return 0;
		}
	}
}


Measured memory_bytes: 3636
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;

void solve() {
	double n; cin >> n;
	bool loop_flg = true;
	int calc_num = 0;
	while(loop_flg) {
		calc_num = floor(sqrt(n));
		if ((calc_num * calc_num) == n) {
			loop_flg = false;
			continue;
		}
		n--;
	}
	int ans = n;
	cout << ans << endl;
	return;
}

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

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;


public class Main {

	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
		
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            line=br.readLine();
            Set<Integer> set1=new HashSet<Integer>();
            Set<Integer> set2=new HashSet<Integer>();
            line=br.readLine();
            String[] str=line.split(" ");
            for(int i=0;i<str.length;i++){
            	set1.add(Integer.parseInt(str[i]));
            }
            line=br.readLine();
            line=br.readLine();
            str=line.split(" ");
            for(int i=0;i<str.length;i++){
            	set2.add(Integer.parseInt(str[i]));
            }
            int result=0;
            if(set1.size()>set2.size()){
            	Iterator it=set2.iterator();
            	while(it.hasNext()){
            		if(set1.contains(it.next())){
            			result++;
            		}
            	}
            }else{
            	Iterator it=set1.iterator();
            	while(it.hasNext()){
            		if(set2.contains(it.next())){
            			result++;
            		}
            	}
            }
            System.out.println(result);
        }
	}

}

Measured memory_bytes: 71204
# -*- coding: utf-8 -*-

def main():

    c = input()

    listVowel = ['a', 'i', 'u' ,'e', 'o']

    if c in listVowel:
        ans = 'vowel'

    else:
        ans = 'consonant'

    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 8908
# python には結構厳しいTLE・・・python以外のお勉強時間ないよ～( ;∀;)
# . から見た # の最大距離の方が楽ではあるが・・・
# 嫌いだけど def main も使ってみた．
from collections import deque
import copy

def main():
  H, W = list(map(int, input().split()))
  L = [[j=="#" for j in input()] for i in range(H)]
  q = deque([(i, j) for i in range(H) for j in range(W) if L[i][j]])
  cands = [(0, -1), (0, 1), (-1, 0), (1, 0)]
  result = 0
  while True:
    nq = deque()
    while q:
      i, j = q.popleft()
      if i > 0 and not L[i-1][j]:
        L[i-1][j] = True
        nq.append((i-1, j))
      if j > 0 and not L[i][j-1]:
        L[i][j-1] = True
        nq.append((i, j-1))
      if i < H-1 and not L[i+1][j]:
        L[i+1][j] = True
        nq.append((i+1, j))
      if j < W-1 and not L[i][j+1]:
        L[i][j+1] = True
        nq.append((i, j+1))
    if nq:
      q = copy.copy(nq)
    else:
      break    
    result += 1
  print(result)

if __name__ == "__main__":
  main()

Measured memory_bytes: 115492