akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define endl "\n"
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

int main() {
    int n;
    cin >> n;
    vector<ll> dp(n+1, 1);
    vector<ll> used(n+1, false);
    for(int i = 2; i <= n; i++) {
        if (used[i] == false) { // primes;
            dp[i] *= 2;
            for(int j = i*2; j <= n; j+=i) {
                used[j] = true;
                if (j % (i*i) == 0) {
                    int cnt = 0;
                    int orig = j;
                    while(orig % i == 0) {
                        cnt += 1;
                        orig /= i;
                    }
                    dp[j] *= (cnt+1);
                } else {
                    dp[j] *= 2;
                }
            }
        }
    }
    ll ans = 0;
    for(ll i = 1; i <= n; i++) {
        // cout << dp[i] << " ";
        ans += i * dp[i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 159468
#include<bits/stdc++.h>
using namespace std;
#include<math.h>
#define ll long long
#define ld long double
#define Summon_Tourist ios::sync_with_stdio(false);cin.tie(0);
ll gcd(ll a , ll b) { return b==0?a: gcd( b, a%b); }
ll lcm(ll a , ll b) { return a/gcd(a,b) * b ; }
ll inf = 1e9 + 7;
ll modexp( ll base ,ll power)
 {
     if( power == 0  ) return 1;
     if( power & 1) return base*modexp( base , power-1 )%inf;
     return modexp(base*base%inf,power/2);
 }
 int main()
{
  Summon_Tourist
  //freopen("input.txt" , "r" , stdin ) ;
  ll x,y;
  cin>>x>>y;
  for( ll i = 0 ; i<=x ; i++ )
  {
      if( (i*2 + (x-i)*4) == y ) { cout<<"Yes"; return 0;}
  }
  cout<<"No";
  return 0;

}


Measured memory_bytes: 3624
//agrawal117
//chahatagrawal117
#include<bits/stdc++.h>
#define endl '\n'
#define mod 998244353
typedef long long int ll;
using namespace std;
#define MAX 100005
vector<vector<int>> merge(vector<vector<int>>& intervals) {
        sort(intervals.begin(), intervals.end());
        vector<vector<int>> merged;
        
        for (auto interval : intervals) {
            if (merged.empty() || (merged.back()[1] < interval[0])) {
                merged.push_back({interval[0], interval[1]});
            }
            else {
                merged.back()[1] = max(merged.back()[1], interval[1]);
            }
        }
        
        return merged;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n,k; cin>>n>>k;
    set<ll> st;
    vector<pair<ll,ll>> v;
    for(int i=1;i<=k;i++){
        ll a,b; cin>>a>>b;
        v.push_back({a,b});
    }
    ll dp[n+3]={0};
     dp[1]=1;
     sort(v.begin(),v.end());
     ll pre[n+3]={0};
     pre[1]=1;
     for(int i=2;i<=n;i++){
         vector<vector<int>> temp,vv;
         for(auto j: v)
         {
             int a=i-j.first; int b=i-j.second;
            //   cout<<a<<" "<<b<<endl;
            
             b=max(b,1);
             a=min(i-1,a);
             if(a<1) continue;
             vector<int> fck;
             fck.push_back(b); fck.push_back(a);
             temp.push_back(fck);
             
         }
         vv=merge(temp);
         for(auto j: vv)
         {
             ll a=j[0]; ll b=j[1];
             ll val=pre[b]-pre[a-1];
             val%=mod; val+=mod; val%=mod;
             dp[i]=(dp[i]+val)%mod;
         }
         pre[i]=(pre[i-1]+dp[i])%mod;
     }
     cout<<dp[n]%mod<<endl;
    
}

Measured memory_bytes: 6784
from itertools import *
N, M = map(int, input().split())
cakes = [list(map(int, input().split())) for i in range(N)]

plus_or_minus = (1, -1)

ans = 0
for a1, a2, a3 in product(*[plus_or_minus] * 3):
    cakes_value = []
    for cake in cakes:
        cakes_value += [cake[0]*a1 + cake[1]*a2 + cake[2]*a3]
    ans = max(ans, sum(sorted(cakes_value, reverse = True)[:M]))
    
print(ans)

Measured memory_bytes: 3388
//When I wrote this only God and I knew what it is
//Now, only The_Blitz knows...
#pragma GCC optimize ("Ofast,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define sz(x) int(x.size())
#define pb push_back
#define FER(i,a,b) for(int i =int(a); i < int(b); ++ i)
#define IFR(i,a,b) for(ll i = ll(a); i >= ll(b); -- i)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ff first
#define ss second
typedef long long ll;
typedef pair<int, int> ii;

const int N = 1e5 + 2;
ll A[N], B[N], C[N];

int main(){
	fastio;
	ll x,y,a,b,c; cin >> x >> y >> a >> b >> c;
	FER(i, 0, a) cin >> A[i];
	FER(i, 0, b) cin >> B[i];
	FER(i, 0, c) cin >> C[i];
	sort(A, A + a); sort(B, B + b); sort(C, C + c);
	reverse(A, A + a); reverse(B, B+b);
	priority_queue<ll, vector<ll>, greater<ll> > ans;
	priority_queue<ll> add;
	FER(i, 0, x) ans.push(A[i]);
	FER(i, 0, y) ans.push(B[i]);
	FER(i, 0, c) add.push(C[i]);
	while(!add.empty()){
		ll addt = add.top(); add.pop();
		ll anst = ans.top();
		if(anst < addt){
			ans.pop();
			ans.push(addt);
		}
		else break;
	}
	ll ret = 0;
	while(!ans.empty()){
		ret += ans.top();
		ans.pop();
	}
	cout << ret << endl;
	return 0;
}



Measured memory_bytes: 5872
#include<iostream>
#include<algorithm>
#include<set>
using namespace std;
using ll = long long;

int main() {
    int n,a,s=0;
    cin >> n;
    set<int> b;
    for (int i=0;i<n;i++) {
        cin >> a;
        if (a<=399) b.insert(0);
        else if (a<=799) b.insert(1);
        else if (a<=1199) b.insert(2);
        else if (a<=1599) b.insert(3);
        else if (a<=1999) b.insert(4);
        else if (a<=2399) b.insert(5);
        else if (a<=2799) b.insert(6);
        else if (a<=3199) b.insert(7);
        else ++s;
    }
    if (b.size()!=0) cout << b.size() << " " << b.size() + s << endl;    
    else cout << 1 << " " << s << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long a[] = new long[n];
    Map<Long, Long> map = new HashMap<>();
    long res = 0;
    for (int i = 0; i < n; i++) {
      a[i] = sc.nextInt();
    }
    for (int i = 0; i < n; i++) {
      map.put((long) (i + a[i]), map.getOrDefault(i + a[i], (long) 0) + 1);
    }
    for (int i = 0; i < n; i++) {
      res += map.getOrDefault(i-a[i], (long) 0);
    }
    System.out.println(res);
    sc.close();
  }
}

Measured memory_bytes: 66584
let n = stdin.ReadLine() |> int
let r = [1..n] |> List.map (fun x -> stdin.ReadLine().Split() |> Array.map double |> fun x -> (x.[0],x.[1]))
let d (x1,y1) (x2,y2) = ((x1-x2)**2.0 + (y1-y2)**2.0)**(0.5)

let rec f i s =
    if i=n then s*2.0/(double n)
    else
        let sl = [(i+1)..(n-1)] |> List.map (fun x -> d (r.[i]) (r.[x])) |> List.sum
        f (i+1) (s + sl)

f 0 0.0 |> stdout.WriteLine

Measured memory_bytes: 11348
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <assert.h>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,a) for(ll i=ll(a-1);i>=0;--i)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
using ull = unsigned long long;
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; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}

const ll INF = 1e18;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ll MOD3 = 1e6;
const ll EPS = 1e-10;
int sgn(const double a){
    return (a < -EPS ? -1 : (a > EPS ? +1 : 0));
}
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> tri;
typedef pair<long double,long double> point;
typedef complex<long double> Point;
const ll MAX = 3000;
constexpr ll nx[4] = {-1,0,1,0};
constexpr ll ny[4] = {0,1,0,-1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    ll n = s.length();
    if (s[n-1] == 's') PRINT(s+"es");
    else PRINT(s+"s");
}


Measured memory_bytes: 3664
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <map>
const int MOD = 1e9+7;
#define PI 3.14159265359
typedef long long ll;
using namespace std;

ll dp0[100001];
ll dp1[100001];

int main(){
	string s;
	cin >> s;
	
	dp1[0] = 2;
	dp0[0] = 1;
	for (int i = 1; i < s.length(); i++){
		if (s[i] == '1'){
			dp1[i] = dp1[i-1]*2%MOD;
			dp0[i] += dp1[i-1];
		}else{
			dp1[i] = dp1[i-1]%MOD;
		}
		dp0[i] += dp0[i-1]*3;
		dp0[i] %= MOD;
	}
	cout << (dp1[s.length()-1] + dp0[s.length()-1])%MOD<< endl;
	return 0;
}


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

bool countC(string s)
{
    const int n = s.size();
    int count = 0;
    for (int i = 0; i < n; i++)
    {
        if (i <= 1 || i >= n - 1)
            continue;
        if (s[i] == 'C')
            count++;
    }
    return count;
}

int countLargeCase(string s)
{
    int count = 0;
    for (auto &&i : s)
    {
        if ('A' <= i && i <= 'Z')
            count++;
    }
    return count;
}

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(16);

    string s;
    cin >> s;
    const int n = s.size();

    bool can = false;

    if (s[0] == 'A')
        if (countC(s) == 1)
            if (countLargeCase(s) == 2)
                can = true;

    cout << (can ? "AC" : "WA") << endl;
}


Measured memory_bytes: 256
# define _CRT_SECURE_NO_WARNINGS 1
# define _USE_MATH_DEFINES
# include <iostream>
# include <numeric>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <unordered_set>
# include <unordered_map>
# include <climits>
# include <complex>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <ctime>
# include <set>
# include <forward_list>
# include <map>
# include <stack>
using namespace std;
# define INF ((int)(1<<25))
# define REP(i,n) for(int i=0;i<(int)n;i++)
# define FOR(i,n) REP(i,n)
# define FORI(i,k,n) for(int i=k;i<(int)n;i++)
# define TORAD 2.0*M_PI/360.0
# define INT(x) int x;cin>>x;
# define STRING(x) string x;cin>>x;
# define STR(x) STRING(x);
# define DOUBLE(x) double x;cin>>x;
# define DBL(x) DOUBLE(x); 
# define ALL(x) begin(x),end(x)
# define RALL(x) (x).rbegin(),(x).rend()
# define DEBUG(x) cout<<#x<<":"<<x<<endl;
# define EPS 1e-12
#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#endif
typedef long long lint;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<int> vi;
typedef vector<lint> vl;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
const int dx[4] = { 0,1,0,-1 }, dy[4] = { -1,0,1,0 };
const int M = 1000000007;
template<class T> void debug(T a) { for ( auto i : a )cout << i << endl; }

signed main()
{
	lint n, x;
	vector<lint> a,c;
	cin >> n >> x;
	FOR(i, n)
	{
		lint k; cin >> k;
		a.push_back(k);
		c.push_back(i);
	}
	auto prev = [n] (int j) { return j == 0 ? n - 1 : j - 1; };
	lint ans = 0;
	FOR(j, n)ans += a[j];
	vector<lint> b = a;
	FOR(i, n)
	{
		FOR(t, n)
		{
			c[t] = prev(c[t]);
			b[t] = min(b[t], a[c[t]]);
		}
		lint tmp = x*(i + 1);
		FOR(j, n)tmp += b[j];
		ans = min(ans, tmp);
	}
	cout << ans << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll ,P> P3;
typedef pair<P ,P> PP;
const ll MOD = ll(1e9+7);
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(1e5 + 5);
const double EPS = 1e-6;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()

ll n, p[1000], d[1000];
vector<vector<P> > g;

int main() {
    while(cin >> n, n){
        g.clear();
        g.resize(n);
        REP(i,n-1){
            cin >> p[i];
            p[i]--;
        }
        REP(i,n-1){
            cin >> d[i];
        }
        REP(i,n-1){
            g[i+1].push_back({p[i],d[i]});
            g[p[i]].push_back({i+1,d[i]});
        }

        bool visited[1000]{};
        ll dmin[1000], ma=0, idx=0;
        REP(k,3){
            fill(visited,visited+n,false);
            fill(dmin,dmin+n,0);
            ma = 0;
            queue<int> que;
            que.push(idx);
            dmin[idx] = 0;
            while(!que.empty()){
                int now = que.front();
                que.pop();
                visited[now] = true;
                for(auto e : g[now]){
                    if(!visited[e.first]){
                        que.push(e.first);
                        dmin[e.first] = dmin[now] + e.second;
                    }
                }
            }
            REP(i,n){
                if(int(g[i].size())>1){
                    if(dmin[i] > ma){
                        ma = dmin[i];
                        idx = i;
                    }
                }
            }
        }
        ll ans = 0;
        REP(i,n-1){
            ans += d[i]*3;
        }
        REP(i,n){
            if(int(g[i].size())==1){
                for(auto e : g[i]){
                    ans -= e.second*2;
                }
            }
        }
        ans -= ma;
        cout << ans << endl;

    }
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

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

    // start
    int x, a, b;
    cin >> x >> a >> b;
    if (b <= a)
        cout << "delicious" << endl;
    else if (x >= (b - a))
        cout << "safe" << endl;
    else
        cout << "dangerous" << endl;
    // end

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

int main(){
    ll n, d;
    cin >> n >> d;
    d = 2*d + 1;
    cout << (n + d - 1) / d << endl;
    return 0;
}

Measured memory_bytes: 3552
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String n = sc.next();
    char[] c = n.toCharArray();
    
    int cnt = 0;
    for(int i=0; i<n.length(); i++){
      if(c[i]=='2'){
        cnt++;
      }
    }
    
    System.out.println(cnt);
  }
}


Measured memory_bytes: 21844
#include <iostream>

using namespace std;

int N;
int h[100];

int main(){
    cin >> N;
    for(int i=0;i<N;i++) cin >> h[i];
    int c = h[0];
    for(int i=1;i<N;i++){
        if(h[i-1] < h[i]) c += (h[i]-h[i-1]);
    }
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int n;
    cin>>n;
    int a[n], b[n], c[n], dp[n][4];
    
    for (int i=0; i<n; i++)
        cin>>a[i]>>b[i]>>c[i];
        
    dp[0][1] = a[0];
    dp[0][2] = b[0];
    dp[0][3] = c[0];
    
    for (int i=1; i<n; i++){
        dp[i][1] = a[i] + max(dp[i-1][2], dp[i-1][3]);
        dp[i][2] = b[i] + max(dp[i-1][1], dp[i-1][3]);
        dp[i][3] = c[i] + max(dp[i-1][2], dp[i-1][1]);
    }
    
    cout<<max(dp[n-1][1], max(dp[n-1][2], dp[n-1][3]));
}

Measured memory_bytes: 6284
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<cstring>
#include<complex>
#include<cmath>
#include<algorithm>
#include<list>
#include<functional>
#define mp make_pair
#define X first
#define Y second
#define INF 1987654321
#define PI 3.14159265358979323846264
#define MOD 100000LL
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset(a,0,sizeof(a));
#define MEM_1(a) memset(a,-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef complex<double> base;
ll POW(ll a, ll b) { if (b == 0)return 1; if (b == 1)return a; if (b & 1)return (a*POW(a, b - 1)) % MOD; ll t = POW(a, b / 2); return (t*t) % MOD; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int dx[] = { 0,-1,1,0 }, dy[] = { 1,0,0,-1 };//동북남서

char s[101];
int main() {
	bool ok = 0;
	scanf("%s", s);
	for (int i = 0; s[i]; i++)
	{
		if (s[i] == 'C')ok = 1;
		if (ok && s[i] == 'F')
		{
			puts("Yes");
			return 0;
		}
	}
	puts("No");
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <stack>
#include <queue>
#include <map>
using namespace std;

#define max_n 50
#define max_m 50
#define max_w 1000
#define max_h 1000
#define max_k 100010
#define max_l 10000
#define INF 9999999

typedef long long lint;

int main()
{
    int a1[max_k],b1[max_k];
    int n;
    long long k;
    cin>>n>>k;
    vector<pair <int,int>> v;
    for(int i=0;i<n;i++){
        int a,b;
        cin>>a>>b;
        v.push_back(make_pair(a,b));
    }
    sort(v.begin(),v.end());
    for(int i=0;i<n;i++){
        a1[i]=v[i].first;
        b1[i]=v[i].second;
    }
    
    
    for(int i=0;i<n;i++){
        if(b1[i]>=k){
            cout<<a1[i]<<endl;
            break;
        }else{
            k-=b1[i];
        }
    }
    return 0;
    
}

Measured memory_bytes: 1908
n, k = map(int, input().split())
s = list(map(int,input()))

a = []
x = 0 #1の個数
y = 0 #0の個数
if s[0] == 0:
  a.append(0)
for i in range(n):
  if s[i] == 1:
    x += 1
  else:
    y += 1
  if x > 0 and y > 0:
    if s[i] == 0:
      a.append(x)
      x = 0
    else:
      a.append(y)
      y = 0
if x > y:
  a.append(x)
else:
  a.append(y)
  a.append(0)


m = len(a)
left=[0]*(m+1)
right=[0]*(m+1)

for i in range(m):
  left[i+1] = left[i] + a[i]
for i in range(m):
  right[m-i-1] = right[m-i] + a[m-i-1]

ans = 0
if m%2 == 0:
  r = int(m/2) + 1
else:
  r = int((m+1)/2) 
#print(r,a,right,left)
for i in range(r):
  if 2*i+2*k+1 <= m:
    x = left[2*i+2*k+1]-left[2*i]
  else:
    x = left[-1] - left[2*i]
  if ans < x:
    ans = x
print(ans)

Measured memory_bytes: 12520
#define DEBUGGING  // Enables DEBUG macro.
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
#define REP(i, n) for (int i = 0; (i64)(i) < (i64)(n); ++i)

#ifndef DEBUGGING
#define debug(...)
#define DEBUG(...)
#else
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define DEBUG(...)                     \
  do {                                 \
    cerr << " (L" << __LINE__ << ") "; \
    cerr << #__VA_ARGS__ << ": ";      \
    debug(__VA_ARGS__);                \
    cerr << endl;                      \
  } while (0)
#endif

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  vector<i64> A(N);
  i64 X = 0;
  for (auto& x : A) {
    cin >> x;
    X ^= x;
  }
  REP(i, N) {
    cout << (X ^ A[i]);
    if (i == N - 1)
      cout << '\n';
    else
      cout << ' ';
  }
}


Measured memory_bytes: 4768
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#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
const ll INF = 1LL << 60;
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()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}

int main() {
    string S;
    cin >>S;
    ll N =S.size();
    vector<vector<ll>> md(10,vector<ll>(200010));
    rep2(i,9){
        md[i][0] = i;
        rep(j,200001){
            md[i][j+1] = (md[i][j]*10)%2019;
        }
    }

    vector<ll> sum(N+1);
    sum[0] = 0;;
    reverse(all(S));
    rep(i,N){
        sum[i+1] = (sum[i] + md[ctoi(S[i])][i])%2019;
        //cout<<sum[i+1]<<endl;
    }

    sort(all(sum));
    ll now = -1;
    ll cnt = 1;
    ll ans = 0;
    rep(i,N+1){
        if(sum[i] == now){
            cnt++;
        }else{
            ans += cnt*(cnt-1)/2;
            cnt = 1;
        }
        now = sum[i];
        

    }
    ans += cnt*(cnt-1)/2;

    cout << ans << endl;


    return 0;
    

}

Measured memory_bytes: 20796
h,w = map(int,input().split())
a = []
for i in range(h):
    a.append(input())
hh = [False]*h
ww = [False]*w
for i in range(h):
    for j in range(w):
        if a[i][j]=="#":
            hh[i]=True
            ww[j]=True
for i in range(h):
    if hh[i]:
        for j in range(w):
            if ww[j]:
                print(a[i][j],end="")
        print()


Measured memory_bytes: 4468
#include<bits/stdc++.h>
using namespace std;
const long long INF = 1e9;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define ll long long int
typedef vector<int> vi;
typedef vector < pair<int, int > > vp;
typedef vector <string> vs;
typedef vector <char> vc;
int n, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;
 
/*--------------------template--------------------*/
 
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (c >= a&&c <= b) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<queue>
#include<set>
#include<stack>
#include<cstring>
#include<map>
#include<vector>
#define ll long long int
using namespace std;
ll gcd(ll a,ll b,ll &x,ll &y)
{
    if(b==0)
    {
        x=1;
        y=0;
        return 0;
    }
    gcd(b,a%b,x,y);
    ll x1=x,y1=y;
    x=y1;
    y=x1-(a/b)*y1;
    return 0;
}
int main()
{
    ll a,b,t,i,j,m,n,check=0;
    cin>>a>>b;
        gcd(a,b,i,j);
        cout<<i<<" "<<j<<endl;
}



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

int main(){
    int N, D, X;
    cin >> N >> D >> X;
    int count = 0;
    for (int i = 0; i < N; i++){
        int A;
        cin >> A;
        int eat_day = 1;
        while (eat_day <= D){
            count++;
            eat_day += A;
        }
    }
    cout << X + count << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pair<int,int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
#define rep(i,n) for(int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define P 1000000007
#define STI(s) atoi(s.c_str())//string to int
#define mp(p,q) make_pair(p,q)
#define Sort(a) sort(a.begin(),a.end())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
//g++ -std=c++1z temp.cpp
//./a.exe



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


int k,x,min,max;
cin  >> k >> x;

min = x-k+1;
max = x+k-1;
if (min < -1000000)
{
    min = -1000000;
}
if (max > 1000000)
{
    max = 1000000;
}

for (int i = min;i <= max;i++){
    cout << i << ' ';
}









//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
using namespace std;
int n;
unsigned long long a,m;
int main()
{
	ios::sync_with_stdio(false);
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>m;
		a+=m-1;
	}
	cout<<a;
	return 0;
}

Measured memory_bytes: 256
#include <assert.h>
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;

int two[25];
struct Node{
    int a, b, c;
    Node(int _a=0, int _b=0, int _c=0):a(_a), b(_b), c(_c) {}
};

vector<Node> vc;
int main() {
    int L;

    while (~scanf("%d", &L)) {
        vc.clear();
        int tmp = L;
        int cnt1 = 0; 
        while(tmp) {
            tmp /= 2;
            cnt1 ++;
        }

        for(int i = 1; i < cnt1; ++i) {
            vc.push_back(Node(i, i + 1, 0));
            vc.push_back(Node(i, i + 1, 1<<(i-1)));
        }

        tmp = L; 
        bool flag = true;
        int tmp2 = 0;
        for(int i = cnt1 - 1; i >= 0; --i) {
            if( (tmp >> i) & 1 ) {
                tmp -= 1 << i;
                if(!flag) {
                    vc.push_back(Node(i+1, cnt1, tmp2));
                }
                tmp2 += 1 << i;
                flag = false;
            }
        }

        printf("%d %d\n", cnt1, (int)vc.size());
        for(int i = 0; i < (int)vc.size(); ++i) {
            printf("%d %d %d\n", vc[i].a, vc[i].b, vc[i].c);
        }
    }
    return 0;
}

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

w = []
count = 0

for i in range(n):
    w.append(input())
    if i >= 1:
        m = w[i - 1]
        l = m[-1]
        hantei = w[i].startswith(l)
        if hantei == False:
            count = 1
    a = 0
    for j in w:
        if w[i] == j:
            a += 1
        if a > 1:
            count = 1

if count == 1:
    print('No')
else:
    print('Yes')

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

typedef long long ll;
const ll MOD = 1e9 + 7;
const long long INF = 1LL<<60;
const double PI=3.14159265358979323846;
const int NMAX=100005;
using namespace std;

struct UnionFind{
    int root[101];
    
    UnionFind(){
        for(int i = 0; i < 101; i++){
            root[i] = i;
        }
    }

    int getRoot(int x){
        if(root[x] == x) return x;
        root[x] = getRoot(root[x]);
        return root[x];
    }

    bool isSame(int x, int y){
        int px = getRoot(x);
        int py = getRoot(y);
        if(px == py) return true;
        else return false;
    }

    void unite(int x, int y){
        if(isSame(x,y)) return;
        int px = getRoot(x);
        int py = getRoot(y);
        root[py] = px;
    }
};

void solve(int n){
    vector<double> x(n),y(n),z(n),r(n);
    for(int i = 0; i < n; i++){
        cin >> x[i] >> y[i] >> z[i] >> r[i];
    }
    vector<pair<double, pair<int,int> > > edge;
    for(int i = 0; i < n; i++){
        for(int j = i+1; j < n; j++){
            double d = (x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j])+(z[i]-z[j])*(z[i]-z[j]);
            d = sqrt(d);
            d = d - r[i] - r[j];
            if(d < 0) d = 0;
            edge.push_back(make_pair(d,make_pair(i,j)));
        }
    }
    sort(edge.begin(), edge.end());
    
    UnionFind uf;

    double ans = 0;
    for(int i = 0; i < edge.size(); i++){
        auto d = edge[i].first;
        auto path = edge[i].second;
        if(uf.isSame(path.first, path.second) == true) continue;
        uf.unite(path.first, path.second);
        ans += d;
    }

    cout << std::fixed << std::setprecision(3) <<  ans << endl;
    return;
}

int main(){
    while(true){
        int n;
        cin >> n;
        if(n == 0) break;
        solve(n);
    }
    return 0;
}


Measured memory_bytes: 3280
#include <stdio.h>
int main(){
  int H,W,h,w;
  while(1){
scanf("%d %d",&H,&W);
for(h=1;h<=H;h++){
    for(w=1;w<=W;w++){
      if(w<W){
	printf("#");
      }
      else if(w==W){
	printf("#\n");
      }
    }
  }
 if(H!=0){
   if(h=H+1){
   printf("\n");
 }
 }
  if(H==0&&W==0){
    break;
  }
  }
  return 0;
}

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

int main(){
  int N;
  cin>>N;
  int h[110];
  int temp=0;
  int ans=0;
  
  for(int i=0;i<N;i++){
    cin>> h[i];
    if(h[i]>temp){
      ans=ans+h[i]-temp;
    }
    temp=h[i];
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define ull unsigned long long int 
#define pb push_back
#define xx first
#define yy second

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll t;
	t=1;
	while(t--)
	{
		ll n,d,cnt=0;
		cin>>n>>d;
		while(n--)
		{
		    ll x,y;
		    cin>>x>>y;
		    if(x*x+y*y<=d*d)
		        cnt++;
		}
		cout<<cnt;
	}
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define int long long
using namespace std;
map<int,int>mm;
int n;
int dfs(int x){
    if(mm[x])return mm[x];
    return mm[x]=(dfs(x/2)+dfs((x-1)/2)+dfs((x-2)/2))%((int)(1e9+7));
}
signed main(){
    cin>>n;
    mm[0]=1,mm[1]=2;
    cout<<dfs(n);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <stdlib.h>
using namespace std;

int main(int argc, const char * argv[]) {
    int a, b;
    cin >> a >> b;
    int sum, dif, mul;
    sum = a + b;
    dif = a - b;
    mul = a * b;
    if(sum >= dif && sum >= mul){
        cout << sum;
    }else if(dif >= sum && dif >= mul){
        cout << dif;
    }else if(mul >= sum && mul >= dif){
        cout << mul;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stack>
#include <math.h>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <vector>

using namespace std;





int main()
{
	string s;
	getline(cin, s);
	for (int i = 0; i < s.size(); i++) {
		s[i]=toupper(s[i]);
	}
	cout << s << endl;
}

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

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = ReadArrayInt();
            var A = input[0];
            var B = input[1];
            if (B == 1)
            {
                Console.WriteLine(0);
                return;
            }
            var ans = 0;
            while (B > 0)
            {
                if (A >= B)
                {
                    ans++;
                    B -= A;
                }
                else if (A < B)
                {
                    ans++;
                    B -= A - 1;
                }
            }

            Console.WriteLine(ans);
            Console.ReadLine();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

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

#define ll long long int
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define all(A) A.begin(), A.end()
#define sz(A) (int)A.size()
typedef vector <int> vi;
typedef vector <ll> vl;
typedef pair <int, int> pii;
const ll mod = 1e9 + 7;
//const ll mod = 998244353;
const int inf = 1e9;
//const ll inf = 1e18;
const int N = 2e5;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin >> n;
	int cnt[n + 1] = {0};
	for (int i = 1; i < n; i++) {
		int x;
		cin >> x;
		cnt[x]++;
	}
	for (int i = 1; i <= n; i++) {
		cout << cnt[i] << '\n';
	}
 	return 0;
}

Measured memory_bytes: 4392
// Copyright [2020] <unknown>
#include <bits/stdc++.h>
using namespace std;
// #define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
#define dbg(x...) { cerr << "\033[32;1m" << #x << " -> "; err(x); }
void err() { cerr << "\033[39;0m" << endl; }
template<typename T, typename... A>
void err(T a, A... x) { cerr << a << ' '; err(x...); }
#else
#define dbg(...)
#endif

#define sz(x) ((int)x.size())

typedef long long LL;

const int N = 1e5+50;

int x, y, a, b, c;

int p[N], q[N], r[N];


int main(int argc, char const *argv[]) {
    // code
    scanf("%d%d%d%d%d", &x, &y, &a, &b, &c);
    for (int i=0; i<a; ++i)
        scanf("%d", &p[i]);
    for (int i=0; i<b; ++i)
        scanf("%d", &q[i]);
    for (int i=0; i<c; ++i)
        scanf("%d", &r[i]);
    sort(p, p+a);
    sort(q, q+b);
    sort(r, r+c);
    vector<int> v;
    v.reserve(x+y+c);
    for (int i=0; i<x; ++i)
        v.push_back(p[a-i-1]);
    for (int i=0; i<y; ++i)
        v.push_back(q[b-i-1]);
    for (int i=0; i<c; ++i)
        v.push_back(r[i]);
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    LL ans = 0;
    for (int i=0; i<x+y; ++i)
        ans += v[i];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
 
template<class T>
inline void read(T &x) {
    static char ch;
    static bool opt;
    while (!isdigit(ch = getchar()) && ch != '-');
    x = (opt = ch == '-') ? 0 : ch - '0';
    while (isdigit(ch = getchar()))
        x = x * 10 + ch - '0';
    if (opt)
        x = ~x + 1;
}
 
const int MaxN = 2e5 + 5;
const int MaxS = MaxN << 2;
 
const int INF = 0x3f3f3f3f;
 
#define lcc x << 1, l, mid
#define rcc x << 1 | 1, mid + 1, r
 
int n, m, cur;
int seg[MaxS], tag[MaxS];
 
inline void upt(int x) {
    seg[x] = std::min(seg[x << 1], seg[x << 1 | 1]);
}
 
inline void nodeCover(int x, int l, int r, int val) {
    seg[x] = l - val;
    tag[x] = val;
}
 
inline void dnt(int x, int l, int r) {
    if (tag[x]) {
        int mid = (l + r) >> 1;
        nodeCover(lcc, tag[x]);
        nodeCover(rcc, tag[x]);
        tag[x] = 0;
    }
}
 
inline void segCover(int u, int v, int t, int x = 1, int l = 1, int r = m) {
    if (u <= l && r <= v) {
        nodeCover(x, l, r, t);
        return;
    }
    dnt(x, l, r);
    int mid = (l + r) >> 1;
    if (u <= mid) segCover(u, v, t, lcc);
    if (v > mid) segCover(u, v, t, rcc);
    upt(x);
}
 
inline int segQuery(int p, int x = 1, int l = 1, int r = m) {
    if (l == r)return p - seg[x];
    dnt(x, l, r);
    int mid = (l + r) >> 1;
    return p <= mid ? segQuery(p, lcc) : segQuery(p, rcc);
}
 
int main() {
    read(n), read(m);
    cur = 1;
    for (int i = 1; i <= n; ++i) {
        int l, r;
        read(l), read(r);
        if (cur >= l && cur <= r) 
            segCover(cur, r, -INF),cur = r + 1;
        else if (cur < l) 
            segCover(l, r, segQuery(l - 1));
        if (cur > m) {
            for (int j = i; j <= n; ++j) {
                puts("-1");
            }
            return 0;
        }
        printf("%d\n", i + seg[1]);
    }
    return 0;
}

Measured memory_bytes: 7848
#include<cstdio>
#include<cstring>
#include<algorithm>

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

using namespace std;

int n,x1[10000],y1[10000],x2[10000],y2[10000];

int calc_area(){
	int ans=0,imos[10001];
	rep(y,10000){
		memset(imos,0,sizeof imos);
		rep(i,n) if(y1[i]<=y && y<y2[i]) {
			imos[x1[i]]++;
			imos[x2[i]]--;
		}
		rep(x,10000){
			imos[x+1]+=imos[x];
			if(imos[x]>0) ans++;
		}
	}
	return ans;
}

int calc_peri(){
	int ans=0,imos[10001];
	rep(t,2){
		rep(y,10000){
			memset(imos,0,sizeof imos);
			rep(i,n) if(y1[i]<=y && y<y2[i]) {
				imos[x1[i]]++;
				imos[x2[i]]--;
			}
			rep(x,10000) imos[x+1]+=imos[x];
			rep(x,10001) if(imos[x]>0) {
				if(x==  0   || imos[x-1]==0) ans++;
				if(x==10000 || imos[x+1]==0) ans++;
			}
		}

		rep(i,n){
			swap(x1[i],y1[i]);
			swap(x2[i],y2[i]);
		}
	}

	return ans;
}

int main(){
	for(int type;scanf("%d%d",&n,&type),n;){
		rep(i,n) scanf("%d%d%d%d",x1+i,y1+i,x2+i,y2+i);
		printf("%d\n",calc_area());
		if(type==2) printf("%d\n",calc_peri());
	}
	return 0;
}

Measured memory_bytes: 1228
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;


public class Main {

	public static class pair implements Comparable<pair> {
		int id;
		int ans;

		pair(int x, int y) {

			id = x;
			ans = y;

		}

		public pair() {

		}

		public int compareTo(pair o) {
			// TODO Auto-generated method stub

			return this.id - o.id;
		}
	}

//	static int mod = (int) 998244353.;
	static int mod=(int)1e9+7;
	static ArrayList<Integer> gr[];
	static int[] ar;
	static Scanner sc = new Scanner(System.in);
	static int pri[] = new int[(int) 1e6 + 5];
	static StringBuilder out = new StringBuilder();

	static long dp[][];

	public static void main(String[] args) throws IOException {
		int t =1;// sc.nextInt();
		
		while (t-- > 0) {
		
			int n=sc.nextInt();
			ar=new int[n];
			long sum=0;
			for(int i=0;i<n;i++) {
				ar[i]=sc.nextInt();
				sum+=ar[i];
			}
			dp=new long[n][n];
			long ans=solve(0,n-1);
			
			
			System.out.println(ans);
			
		}

		System.out.println(out);
	}
	
	static long solve(int i,int j) {
		if(i==j) {
			return 0;
		}
		if(dp[i][j]!=0)return dp[i][j];
		long sum=0;
		for(int k=i;k<=j;k++) {
			sum+=ar[k];
		}
		long ans=(long)1e18;
		for(int k=i;k<j;k++) {
			
		long 	ans1=solve(i,k)+solve(k+1,j)+sum;
		if(ans1<ans)ans=ans1;
		}
		return dp[i][j]= ans;
		
	}


}


Measured memory_bytes: 30260
#include <bits/stdc++.h>
#define smax(a, b) ((a) < (b) ? ((a)=(b), true) : false)
#define smin(a, b) ((a) > (b) ? ((a)=(b), true) : false)
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using namespace std;

int n;
int h[100000];
int dp[100000];
int k;
int main() {
    cin >> n >> k;
    for(int i = 0; i < n; i++)
    {
        cin >> h[i];
        dp[i] = 0x7fffffff;
    }
    
    dp[0] = 0;
    for(int i = 1; i < n; i++)
    {
        for(int j = 1; j <= k; j++)
        {
            if(i-j >= 0)
            {
                dp[i] = min(dp[i], dp[i-j] + abs(h[i] - h[i-j]));
            }
        }
    }
    cout << dp[n-1] << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <cstdio>

int di(int n)
{
	int res = 0;
	while (n != 0) {
		res += n % 10;
		n /= 10;
	}
	return res;
}

int main()
{
	int n, a, b, res = 0;
	scanf("%d %d %d", &n, &a, &b);
	for (int i = 1; i <= n; i++) {
		int t = di(i);
		if (t >= a && t <= b) res += i;
	}
	printf("%d\n", res);
	return  0;
}

Measured memory_bytes: 128
#include<stdio.h>

int main(void){

	long long x;
	scanf("%lld",&x);

	if(x%11==0)printf("%lld\n",(x/11)*2);
	else if(x%11<7)printf("%lld\n",(x/11)*2+1);
	else printf("%lld\n",(x/11)*2+2);
	
	return 0;
}

Measured memory_bytes: 128
def Com(n, k):
    p, q = 1, 1
    for i in range(n-k+1, n+1):
        p *= i
    for i in range(2, k+1):
        q *= i
    return p//q

N = int(input())
print(Com(N, 2)-N//2)
if N & 1:
    for i in range(1, N):
        for j in range(i+1, N+1):
            if i+j != N:
                print(i, j)
else:
    for i in range(1, N):
        for j in range(i+1, N+1):
            if i+j != N+1:
                print(i, j)


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

int main(){
  string A,B,C;
  cin >> A >> B >> C;
  char turn = 'a';
  while(1){
  if(turn == 'a'){
   if(A.size() == 0) { cout << 'A' << endl;return 0;}
   turn = A.at(0);
   A.erase(A.begin()); 
  }else if(turn == 'b'){
   if(B.size() == 0) { cout << 'B' << endl;return 0;}
   turn = B.at(0);
   B.erase(B.begin());
  }else{
   if(C.size() == 0) { cout << 'C' << endl;return 0;}
   turn = C.at(0);
   C.erase(C.begin());
  }
}
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#define FOR(i, m, n) for(int i = m;i < n;i++)
using namespace std;

int main(){  
  int D, N;
  cin >> D >> N;
  int i;
  int p = 1;
  FOR(i, 0, D) p *= 100;
  
  if(N==100) cout << p*(N+1) << endl;
  else cout << p*N << endl;
}

Measured memory_bytes: 256
X, Y, Z, K = map(int, input().split())
*A, = sorted(map(int, input().split()))
*B, = sorted(map(int, input().split()))
*C, = sorted(map(int, input().split()))
ab = [i+j for i in A for j in B]
ab = sorted(ab, reverse=True)[:K]
abc= [i+j for i in ab for j in C]
abc.sort(reverse=True)
for i in abc[:K]:
    print(i)

Measured memory_bytes: 140100
from fractions import gcd
a,b,c,d = map(int,input().split())
lcm = c*d//gcd(c,d)
dis = b-a
l = [c,d,lcm]
ans = []
for i in range(3):
  if a % l[i] == 0:
    ans.append(dis//l[i]+ 1)
  elif l[i] < a:
    ans.append((dis + a%l[i])//l[i])
  elif a < l[i] <= b:
    ans.append((b-l[i])//l[i] + 1)
  else:
    ans.append(0)
print(dis + 1 - ans[0] - ans[1] + ans[2])

Measured memory_bytes: 63852
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<math.h>
#include<iostream>
#include<string>
#include<algorithm>

#define Max_N 1000
#define Max_W 10000

using namespace std;

int dp[Max_N+1][Max_W+1];

int v[101],w[101];

int N, W;

int nap(int a,int b)
{
	if (dp[a][b] != -1)
	{
		return dp[a][b];

	}
	int res;

	if (a==N)
	{
		res = 0;
	}
	else if (b<w[a])
	{
		res = nap(a + 1, b);
	}
	else
	{
		res = max(nap(a+1,b),nap(a+1,b-w[a])+v[a]);
	}

	return dp[a][b] = res;
}

int main()
{
	int ans = 0;

	cin >> N >> W;

	for (int i = 0; i < Max_N+1;i++)
	{
		for (int k = 0; k < Max_W+1;k++)
		{
			dp[i][k] = -1;
		}
	}

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

	cout << nap(0,W) << endl;

	return 0;
}

Measured memory_bytes: 42204
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#define test ll t; cin>>t; while(t--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<1000007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
/*int inv[1000001]={0};
void findinverse(){inv[1] = 1;for(int i = 2; i <=1e6 ; ++i)	inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;}
*/
using namespace std;
int solve()
{
	int n,k;
	cin>>n>>k;
	int a[n+1];
	
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	int last=1;
	for(int i=k+1;i<=n;i++){
		if(a[last]<a[i])
			cout<<"Yes"<<endl;
		else
			cout<<"No"<<endl;
		last++;
	}
	return 0;
}
signed main()
{
	fastio;
//	test
		solve();
}







Measured memory_bytes: 5208
x = int(input())

num_list = {}
result = [ 0, 0 ]

for i in range(121):
    num_list[i ** 5] = i

for i in num_list:
    temp = i - x
    if(abs(temp) in num_list):
        result[0] = num_list[i]
        if(temp < 0):
            result[1] = num_list[abs(temp)] * -1
        else:
            result[1] = num_list[temp]

        break

print('{} {}'.format(result[0], result[1]))

Measured memory_bytes: 9144
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <tuple>

using namespace std;

int main()
{  
    int P, Q, R;
    cin >> P >> Q >> R;
    int PQ = P + Q;
    int PR = P + R;
    int QR = Q + R;
    int m = min({PQ,PR,QR});
    cout << m << endl;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(a)  (a).begin(),(a).end()

int main(){
    int S;
    cin >> S;
    int bef = S / 100;
    int aft = S % 100;
    if ((bef > 12) or (bef == 0)){
        if ((aft > 12) or (aft == 0)) {
            cout << "NA" << endl;
        } else {
            cout << "YYMM" << endl;
        }
    } else {
        if ((aft > 12) or (aft == 0)){
            cout << "MMYY" << endl;
        } else {
            cout << "AMBIGUOUS" << endl;
        }
    }
}

Measured memory_bytes: 3564
#include<stdio.h>

main(){

  int m,n,another_n = 1;

  scanf("%d %d",&m,&n);

  while(another_n != 0){
    another_n = m % n;
    m = n;
    n = another_n;
  }

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

  return 0;

}

Measured memory_bytes: 0
#include <iostream>
#include <vector>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    int h, w, k, ans = 0;
    cin >> h >> w >> k;
    vector<string> v(h);
    for (int i = 0; i < h; ++i) cin >> v.at(i);
    for (int i = 0; i < (1 << h); ++i) for (int j = 0; j < (1 << w); ++j) {
        int cnt = 0;
        for (int y = 0; y < h; ++y) for (int x = 0; x < w; ++x) if (v.at(y).at(x) == '#' && (i & (1 << y)) && (j & (1 << x))) ++cnt;
        if (cnt == k) ++ans;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std; 
#define rep(i, n) for (int i = 0; i < (n); ++i)
 
int main() {
	
	
	string s;cin >>s;
	bool ok = true;
	if(s[0] != 'A')ok=false;
	
	int cnt = 0;
	
	for(int i=2;i<s.length()-1;i++) if(s[i]=='C')cnt++;
	if(cnt !=1)ok=false;
	
	cnt = 0;
	
	rep(i,s.size()) if('a'-s[i]>0)cnt++;
	if(cnt != 2) ok=false;
	
	cout <<(ok?"AC":"WA") << endl;
	
	
	
}

Measured memory_bytes: 256