akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds;
#define ordered_set tree<pair<int,int>, null_type,less<pair<int,int> >, rb_tree_tag,tree_order_statistics_node_update>
#define standardVar ll n,m,i,j,k,num,num1,num2,flag=0
#define nn <<"\n"
#define __ <<" "<<
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define ittr(x,v) for(auto x=v.begin();x!=v.end();x++)                  //COMMON FOR LOOP (ITERATOR)
#define itr(x,n) for(x=0;x<n;x++)                                       //COMMON FOR LOOP (VARIABLE)
#define itrab(x,a,b) for(x=a;x<b;x++)                                   //FOR LOOP WITH SPECIFIED START/END
#define itpr(v) ittr(x,v)cout<<*x<<" "; cout nn                         //PRINTS VECTOR,SET,MAP OF INTS
#define itppr(v) ittr(x,v)cout<<(*x).ff<<" "<<(*x).ss<<"  "; cout nn    //PRINTS VECTOR,SET,MAP OF PAIRS
#define sz(x) (ll)((x).size())
#define dTor(x) ((x)*pi)/180.0

#define pi   3.14159265359
#define INF  1000000000
#define INFF 1000000000000000000

typedef long long int ll;       //TYPEDEFS
typedef long double ld;
typedef vector<ll> vl;
typedef map<ll,ll> ml;
typedef set<ll> sl;
typedef string str;
typedef pair<ll, ll> pl;
typedef vector< pl > vpl;
typedef map<pl,ll> mpl;
typedef set< pl > spl;
typedef vector<str> vst;
typedef vector<vl> vvl;

const ll M=1000000007;          //COMMON MODULO PRIMES
const ll N=998244353;

ll power(ll x, ll y, ll p){     //MODULAR EXPONENTIATION
    ll res=1;
    x=x%p;
    if(x==0)
        return 0;
    while(y>0){
        if(y&1)
            res=(res*x)%p;
        y=y>>1;
        x=(x*x)%p;
    }
    return res;
}
ll inv(ll x, ll m){             //FERMAT INVERSE
    return power(x,m-2,m);
}
ll nCr(ll n, ll r){              //nCr MOD P
    if (r==0) 
        return 1;
    vl fac(n);
    return (fac[n]*inv(fac[r],M)%M*inv(fac[n-r],M)%M)%M;
}
struct comp{                    //COMPARISON ON PAIRS
    template<typename T>        
    bool operator()(const T &a, const T &b){
        if (a.ff==b.ff)
            return (a.ss<b.ss);
        else
            return (a.ff<b.ff);
    }
};
bool mod(const pair<ll,ll> &a, const pair<ll,ll> &b){   //COMPARATOR FOR PAIRS (SORTING)
    if(a.ff!=b.ff)
        return (a.ff>b.ff);
    else
        return (a.ss>b.ss);
}
void sieve(){       //SIEVE OF ERATOSTHENES
    vector<bool> pr(1000000+1,1);
    for(ll i=2;i*i<=1000000;i++)
        if(pr[i]==1)
            for(ll j=i*i;j<=1000000;j+=i)
                pr[j]=0;
}
bool isValid(ll i, ll j, ll n, ll m){   //CHECKS FOR OVERFLOW
    if(i>=0&&i<n&&j>=0&&j<m){
        return true;
    }
    return false;
}

//MAIN FUNCTION STARTS HERE

int main(){
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    standardVar;
    cin>>k;
    str s;
    cin>>s;
    if(sz(s)<=k)
        cout<<s nn;
    else{
        itr(i,k)
            cout<<s[i];
        cout<<"..." nn;
    }
    return 0;
}

Measured memory_bytes: 3656
#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>
#include <utility>
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 digit(int a){
    int count = 0;
    for (int i = 0; i < a; i++)
    {   if (a == 0)
        {
            break;
        }else
        {
            a = a/10;
            count++;
        }     
    }
    return count;
}
//pow(x,n) == x^n

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

int n,count = 1,date;
cin >> n;
vector<int> d(n);
rep(i,n) {
    cin >> date; 
    d[i] = date;
} 
Sort(d);

for(int i = 1;i < n;i++){
    if (d[i] != d[i-1])
    {
        count++;
    }
    
}
cout << count << endl;
//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for ((i)=1;(i)<=(n);(i)++)
#define per(i,n) for ((i)=n;(i)>=(1);(i)--)
using namespace std;


int n,m,i,x,y,vis[100005],lst;
vector<int> e[100005];
deque<int> dq;
int main(){
	scanf("%d%d",&n,&m);
	rep(i,m){
		scanf("%d%d",&x,&y);
		e[x].push_back(y);
		e[y].push_back(x); 
	}
	dq.push_back(1);
	dq.push_back(e[1][0]);
	vis[1]=vis[e[1][0]]=1;
	lst=1;
	for(;;){
		for(i=0;i<e[lst].size();i++){
			if(!vis[e[lst][i]]){
				dq.push_front(e[lst][i]);
				vis[e[lst][i]]=1;
				break;
			}
		}
		if(i<e[lst].size()) lst=e[lst][i]; else break;
	}
	lst=e[1][0];
	for(;;){
		for(i=0;i<e[lst].size();i++){
			if(!vis[e[lst][i]]){
				dq.push_back(e[lst][i]);
				vis[e[lst][i]]=1;
				break;
			}
		}
		if(i<e[lst].size()) lst=e[lst][i]; else break;
	}
	cout<<dq.size()<<endl;
	for(i=0;i<dq.size();i++) cout<<dq[i]<<' ';
	return 0;
}

Measured memory_bytes: 7040
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = (1e9)+7;
void fastIO(){
  ios_base::sync_with_stdio(0); cin.tie(0);
}


int main(){
  fastIO();
  ll s,c;
  cin>>s>>c;
  ll cc = c/2;
  if(s>=cc){
  	cout<<cc<<endl;
  }else{
  	cout<<s+(abs(s-cc)/2)<<endl;
  }
}  






Measured memory_bytes: 256
// D - 高橋君と見えざる手

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const int MOD = 1e9 + 7;

int main() {
	int N, T;
	cin >> N >> T;

	vector<int> A(N);

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

	// 差の最大値を求める
	int A_min = A[0];
	int d_max = 0;
	for (int i=1; i<N; i++) {
		A_min = min(A_min, A[i]);
		d_max = max(d_max, A[i] - A_min);
	}

	// 差が最大となる組み合わせの数を求める
	int ans = 0;
	A_min = A[0];
	for (int i=1; i<N; i++) {
		A_min = min(A_min, A[i]);
		if (A[i] - A_min == d_max) ans++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		
		int val = scan.nextInt();
		int valLen = 0;
		int count = 0;
		
		for(int i=1;i<=val;i++){
			valLen = String.valueOf(i).length();
			if(valLen%2 == 1){
				count++;
			}
		}
		
		System.out.println(count);
	}
}

Measured memory_bytes: 28372
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

#define N 1048576
char ss[N], *s[N];
int as[N] = {}, *a[N];
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
queue<pii> que;
set<int> ys[N], xs[N];

int main(){
	int h, w, k; scanf("%d%d%d", &h, &w, &k);
	int x1, y1, x2, y2; scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
	x1--; y1--; x2--; y2--;
	REP(i, h) s[i] = ss + i*w, a[i] = as + i*w;
	REP(i, h) scanf("%s", s[i]);

	REP(i, h) {
		ys[i].emplace(INT_MIN / 10);
		REP(j, w) ys[i].emplace(j);
		ys[i].emplace(INT_MAX / 10);
	}
	REP(j, w){
		xs[j].emplace(INT_MIN / 10);
		REP(i, h) xs[j].emplace(i);
		xs[j].emplace(INT_MAX / 10);
	}

	que.emplace(x1, y1);
	ys[x1].erase(y1);
	xs[y1].erase(x1);
	while(que.size()){
		auto [x, y] = que.front(); que.pop();
		DEBUG("(%d, %d): %d\n", x, y, a[x][y]);
		if(x == x2 && y == y2) {
			printf("%d\n", a[x][y]);
			return 0;
		}
		REP(d, 4){
			int i = x, j = y;
			while(1){
				if(d == 0) j = *ys[i].upper_bound(j);
				if(d == 1) i = *xs[j].upper_bound(i);
				if(d == 2) j = *--ys[i].lower_bound(j);
				if(d == 3) i = *--xs[j].upper_bound(i);
				if(abs(x-i) > k || abs(y-j) > k) break;
				if(s[i][j] == '@') break;
				a[i][j] = a[x][y] + 1;
				ys[i].erase(j);
				xs[j].erase(i);
				que.emplace(i, j);
			}
		}
	}
	printf("-1\n");
}




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

int main(void) {
    string s,sref;
    struct tm stm = {0};
    struct tm ref = {0};
    cin >> s;
    sref = "2019/04/30"; 
    strptime(&s[0], "%Y/%m/%d", &stm);
    strptime(&sref[0], "%Y/%m/%d", &ref);

    if(difftime(mktime(&ref), mktime(&stm)) >= 0) {
        cout << "Heisei\n";
    } else {
        cout << "TBD\n";
    }
    
    return 0;
}


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

using namespace std;

#define MAX_N 22
#define MAX_M 200
#define MAX_D 500

int N, M, D;
int d[MAX_M];
int table[MAX_D];

vector<int> L;
bool check(int x) {
  bool flag = true;
  for(int y : L) {
    if(--table[abs(x-y)] < 0) flag = false;
  }
  return flag;
}
void resume(int x) {
  for(int y : L) {
    ++table[abs(x-y)];
  }
}

set< vector<int> > st;
void solve(int idx, int now) {
  //cout<<now<<endl;
  if(now == N) {
    auto vec = L;
    sort(begin(vec), end(vec));
    vector<int> ans;
    for(int i = 1; i < (int)vec.size(); ++i) {
      ans.push_back(vec[i]-vec[i-1]);
    }
    st.insert(ans);
    return;
  }
  while(idx > 0 && table[idx] == 0) --idx;
  //cout<<idx<<" "<<table[idx]<<endl;
  if(table[idx] <= 0) return;
  if(check(idx)) {
    L.push_back(idx);
    solve(idx, now+1);
    L.pop_back();
  }
  resume(idx);
  if(table[D-idx] <= 0) return;
  if(check(D-idx)) {
    L.push_back(D-idx);
    solve(idx, now+1);
    L.pop_back();
  }
  resume(D-idx);
}

int main() {
  while(cin >> N, N) {
    M = N*(N-1)/2;
    memset(table, 0, sizeof(table));
    for(int i = 0; i < M; ++i) {
      cin >> d[i];
      ++table[d[i]];
    }
    D = d[0];
    st.clear();
    L.clear();
    L.push_back(0);
    L.push_back(D);
    --table[D];
    solve(D, 2);
    for(auto&& v : st) {
      for(int i = 0; i < (int)v.size(); ++i) {
	if(i) cout << " ";
	cout << v[i];
      }
      cout << endl;
    }
    cout << "-----" << endl;
  }

  return 0;
}

Measured memory_bytes: 3124
//“ In order to be irreplaceable, one must always be different”
#include <bits/stdc++.h>
using namespace std;
# define ll long long
#define endl "\n"
# define pi 3.14159265359
#define mod 1000000007
# define str string
# define vll vector<ll>
# define vstr vector<str>
# define vchar vector<char>
# define pb push_back
# define mll map<ll,ll>
#define mchar map<char, ll>
# define mstr map<str,ll>
# define vp vector< pair<ll,ll> >
#define mp make_pair
#define ff first
#define ss second
#define pll pair<ll,ll>
# define f(x,y) for(int x=0;x<y;x++)
# define r(x,y) for(int x=y;x>=0;x--)
# define loop(x,y,z) for(int x=y;x<z;x++)
ll power(ll a , ll b){ll res=1;for(ll i=0; i<b; ++i){res*=a;}return res;}
ll logx(ll base, ll num){int cnt=0;while(num!=1){num/=base; ++cnt;}return cnt;}
ll gcd(ll a, ll b){
    if(b == 0)
        return a;
    return gcd(b, a % b);
}
ll lcm(ll a, ll b){
    return (a*b)/gcd(a, b);
}
void print(vll a){
    for(int i=0;i<a.size();i++){
        cout<<a[i]<<' ';
    }
    cout<<endl;
}
vll inp(int n){
    vll a;
    ll x;
    f(i,n){
        cin>>x;
        a.pb(x);
    }
    return a;
}
int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll x,y;
    cin>>x>>y;
    if(x>y){
        cout<<"safe";
    }
    else{
        cout<<"unsafe";
    }
    return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0
#define ll long long

int n;
string s, t;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> s >> t;
    for(int i = 0 ; i < n ; i++){
        if(s.substr(i) == t.substr(0, n - i)){
            finish(2 * n - (n - i));
        }
    }
    cout << 2 * n << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    int tmp;

    tmp=a;
    a=b;
    b=tmp;
    tmp=c;
    c=a;
    a=tmp;
    printf("%d %d %d\n",a,b,c);
    return 0;
}

Measured memory_bytes: 128
def main():
    i = list(map(int, input().split()))

    k = i[0]
    x = i[1]

    if not(1 <= k and k <= 100 and 0 <= x and x <= 100):
        return

    min = x - k + 1
    max = x + k - 1

    for j in range(max - min + 1):
        print(j + min)
    

if __name__ == "__main__":
    main()

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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define MOD 1e9+7
#define sp ' '


using ll = long long;


ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll b, ll e, ll m){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n, k;
    cin >> n >> k;

    vector<ll> a(n), b(n);
    ll mx = 0LL;
    rep(i, n){
        cin >> a[i];
        b[i] = a[i];
        mx = max(mx, a[i]);
    }

    ll two = 1LL;
    int digit = static_cast<int>(log2(k));
    string strx = "";

    if(k == 0){
        ppp(accumulate(a.begin(), a.end(), 0LL));
        return 0;
    }

    for(ll d = 0; d <= digit; ++d){
        ll cnt = 0;
        for(ll i = 0; i < n; ++i){
            cnt += a[i]%2;
            a[i] /= 2;
        }
        if(cnt <= n / 2LL){
            strx += '1';
        }
        else{
            strx += '0';
        }
    }

    reverse(strx.begin(), strx.end());
    ll nx = 0LL;
    for(ll i = 0; i < strx.size(); ++i){
        if(strx[i] == '1' and (pow(2,(strx.size()-i-1))+nx) <= k){
            nx += pow(2,(strx.size()-i-1));
        }
    }

    ll ans = 0LL;
    for(ll i = 0; i < n; ++i){
        ans += nx^b[i];
    }

    ppp(ans);

    return 0;
}


Measured memory_bytes: 1792
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**5)


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    s, t = geta()

    print(t + s)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3316
#include <iostream>
using namespace std;
int n,d[100],s=1,k,m;
int main()
{
   cin>>n;
   for (int i=1;i<=n;i++)
   {
       cin>>d[i];
       for (int e=1;e<=n;e++)
       {
           if(e!=i){
                s=d[i]*d[e];
                k=s+k;}
       }
   }
   cout <<k;
   return 0;
}


Measured memory_bytes: 256
package main

import (
        "bufio"
        "fmt"
        "os"
        "strconv"
)

var si = bufio.NewScanner(os.Stdin)

func readInt() int {
        si.Scan()
        r, _ := strconv.Atoi(si.Text())
        return r
}

func main() {
        si.Split(bufio.ScanWords)
        si.Buffer(make([]byte, 0), 10000000)
        isPrime := make([]bool, 100001)

        for i := 2; i < 100001; i++ {
                isPrime[i] = true
        }
        for i := 2; i < 100000; i++ {
                if isPrime[i] {
                        for j := 2; j*i <= 100000; j++ {
                                isPrime[j*i] = false
                        }
                }
        }
        numPrime := make([]int, 100001)
        for i := 3; i < 100000; i = i + 2 {
                numPrime[i] = numPrime[i-2]
                if isPrime[i] && isPrime[(i+1)/2] {
                        numPrime[i] += 1
                }
        }

        Q := readInt()
        for i := 0; i < Q; i++ {
                l, r := readInt(), readInt()
                if l > 1 {
                        l -= 2
                }
                fmt.Println(numPrime[r] - numPrime[l])
        }

}

Measured memory_bytes: 4352
import java.util.*;

public class Main{
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                String str = sc.nextLine();
        int N = Integer.parseInt(str);

                long count=0;
        int prev_person = sc.nextInt();

        for(int i = 1; i < N; i++){
            int now_person = sc.nextInt();
            if(now_person < prev_person){
                count += prev_person - now_person;
            }
            else{
                prev_person = now_person;
            }
        }


                System.out.println(count);
                sc.close();
        }
}



Measured memory_bytes: 59104
/** author: __nishad__ **/

#include<bits/stdc++.h>
using namespace std;


typedef long long ll ;
typedef vector<ll> vll ;

#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define precision(k) cout<<setprecision(k)<<fixed;
#define loop(i,a) for(int i=0; i<a;i++)
#define loop2(i,a,b) for(int i=(a);i<=(b);++i)
#define minv(v) *min_element(all(v))
#define maxv(v) *max_element(all(v))
#define getpos(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define unq(v) sort(all(v)),(v).erase(unique((v).begin(),(v).end()),(v).end())
#define pb push_back
#define pi 3.14159265358979323
#define endl "\n"

int main()
{
    ll k, a, b;
    cin>>k>>a>>b;
    bool ans = false;

    for(int i=a; i<=b; i++){
        if(i%k == 0)
            ans = true;
    }

    cout<<(ans? "OK" : "NG");






}




Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
const int maxn = 123456;
vector<int> e[maxn];
int vis[maxn], cor[maxn];
int sz, ok;
void dfs(int u, int v, int d = 0){
	vis[u] = 1;
	sz++;
	cor[u] = d;
	for(int nxt : e[u]){
		if(!vis[nxt]){
			dfs(nxt, u, d ^ 1);
		} else {
			if(cor[nxt] != (d^1)){
				ok = 0;
			}
		}
	}
}
int main(){
	int n, m; cin >> n >> m;
	for(int i = 0; i < m; i++){
		int x, y; cin >> x >> y;
		e[x].push_back(y);
		e[y].push_back(x);
	}
	int lone = 0, by = 0, no = 0;
	for(int i = 1; i <= n; i++){
		if(!vis[i]){
			sz = 0;
			ok = 1;
			dfs(i, 0, 0);
			if(sz == 1) lone++;
			else if(ok) by++;
			else no++;
		}
	}
	long long ans = 0;
	ans += 2ll * lone * (n - lone);
	ans += 1ll * lone * lone;
	ans += 1ll * no * no;
	ans += 2ll * no * by;
	ans += 2ll * by * by;
	cout << ans << endl;
	return 0;
}


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

using namespace std;
using LL = long long;
const int N = 1024;
const int INF = 1E9;
const double EPS = 1E-9;

int a[N];
int n, m;

int main() {
    ios_base::sync_with_stdio(false);

#ifdef CF_DEBUG
    freopen("../cf/input.txt","r",stdin);
#endif
    cin>>n;
    LL res=0;
    for(int i=1;i<=n;++i){
        if(i%3!=0 && i%5!=0){
            res+=i;
        }
    }
    cout<<res;
    return 0;
}

Measured memory_bytes: 3652
#include <stdio.h>

int main()
{
    long long X,Y,i,count=0;

    scanf("%lld %lld",&X,&Y);

    i = 0;
    while(1){
        if(X % Y == 0){
            printf("%d",-1);
            count++;
            break;
        }else if(i % X == 0){
            if(i % Y != 0){
                printf("%lld\n",i);
                count++;
                break;
            }else{
                i = i + X;
            }
        }else{
            i++;
        }
    }

    if(count == 0) printf("%d",-1);

    return 0;
}

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

vector<string> s;
vector<string> code;

int main(){
while(1){//start
	int n;
	cin >> n;
	if(n == 0) break;
	for(int i = 0; i < n; i++){
		string tmp;
		cin >> tmp;
		s.push_back(tmp);
	}

	int max_k = 0;
	for(int i = 0; i < n; i++){
		string tmp = string() + s[i][0];
		for(int j = 0; j < (int)s[i].size() - 1; j++){
			if(s[i][j] == 'a' or s[i][j] == 'i' or s[i][j] == 'u' or s[i][j] == 'e' or s[i][j] == 'o') tmp += s[i][j + 1];
		}
		code.push_back(tmp);
		max_k = max(max_k, (int)tmp.size());
	}

	//cout << "max_k = " << max_k << endl;

	//pading
	for(int i = 0; i < n; i++){
		int len = (int)code[i].size();
		for(int j = 0; j < max_k - len; j++){
			code[i] += "A";
		}
	}

	//debug
	//for(int i = 0; i < n; i++){
	//	cout << code[i] << endl;
	//}


	int g_flag = 1;
	for(int i = 1; i <= max_k; i++){
		vector<string> temp;
		for(int j = 0; j < n; j++){
			temp.push_back(code[j].substr(0, i));
			//cout << code[j].substr(0, i) << endl;
		}
		sort(temp.begin(), temp.end());
		int flag = 1;
		for(int j = 1; j < n; j++){
			if(temp[j - 1] == temp[j]) flag = 0;
		}
		if(flag){
			cout << i << endl;
			g_flag = 0;
			break;
		}
	}


	if(g_flag) cout << -1 << endl;

	s.clear();
	code.clear();
}//end

	return 0;
}



Measured memory_bytes: 3172
/**
>>> In The Name Of GOD
**/
#include <bits/stdc++.h>

using namespace std;

//freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);

///ifstream fin("input.txt");
///ofstream fout("output.txt");

vector <int> mark;

vector < vector <int> > adj;
vector <int> vertex;
vector <int> h;


int dfs(int v)
{
    mark[v-1]=1;
    int m1,m2;
    m1=m2=h[v-1]+1;
    int c=0;
    int check=1;
    for (auto i:adj[v-1])
        if (!mark[i-1])
        {
            h[i-1]=h[v-1]+1;
            int x=dfs(i);
            c++;
            if (x>=h[v-1] && c!=0 &&  adj[v-1].size()>1 && v!=1 && check)
            {
                vertex.push_back(v-1);
                check=0;
                //cout << v << ' ' << m1 << ' ' <<  h[v-1] << endl;
            }
            m1=min(m1,x);

        }
        else
            if (h[i-1]!=h[v-1]-1)
                m2=min(h[i-1],m2);
    //cout << v-1  << ' '<< m1 << endl;

    //if (m1>=h[v-1] && c!=0 &&  adj[v-1].size()>1 && v!=1)
    //{
      //  vertex.push_back(v-1);
        //cout << v << ' ' << m1 << ' ' <<  h[v-1] << endl;
    //}

        if (v==1 && c>1)
            vertex.push_back(0);
    return min(m2,m1);

}



int main()
{
    int n,i,m;
    cin >> n >> m;
    for (i=0;i<n;i++)
        mark.push_back(0), h.push_back(0), adj.push_back({});
    int x,y;
    for (i=0;i<m;i++)
        cin >> x >> y, adj[x].push_back(y+1), adj[y].push_back(x+1);
    if (n<3 || m<1)
        return 0;
    //if (adj[0].size()>1)
    //cout << endl;
      //  vertex.push_back(0);
    dfs(1);
    sort(vertex.begin(),vertex.end());
    for (i=0;i<vertex.size();i++)
        cout << vertex[i] << endl;
    return 0;
}



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

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

const int MC = 704;
int N,M;
bool e[MC][MC];
int b[MC];
bool t[MC];

int main(){
	cin >> N >> M;
	repp(i,0,M){
		int A,B; cin >> A >> B; --A; --B;
		e[A][B] = e[B][A] = 1;
	}
	int s = 0;
	t[0] = 1;
	repp(i,0,N) if(!b[i]){
		int x = 0, y = 0;
		queue<int> Q; Q.push(i);
		b[i] = 1;
		while(!Q.empty()){
			int v = Q.front(); Q.pop();
			++(b[v]>0?x:y);
			repp(u,0,N) if(v != u && !e[v][u]){
				if(!b[u]){
					Q.push(u);
					b[u] = -b[v];
				} else if(b[v] == b[u]) return cout << -1 << endl , 0;
			}
		}
		if(x > y) swap(x,y);
		s += x;
		repm(k,N,y-x-1) t[k] |= t[k-y+x];
	}
	int ans = 1e9;
	repp(i,s,N+1) if(t[i-s]) ans = min(ans,i*(i-1)/2+(N-i)*(N-i-1)/2);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 768
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iostream>
#include <map>
#include <stack>
#include <queue>
#include <vector>

static const int IINF = 1 << 30;
static const long long LINF = 1LL << 60;
static const long long MOD = 1.0e+9 + 7;

template <typename T> std::vector<T> vectors(std::size_t n, T val) {
  return std::vector<T>(n, val);
}

template <typename T, typename... Args>
auto vectors(std::size_t n, Args... args) {
  return std::vector<decltype(vectors<T>(args...))>(n, vectors<T>(args...));
}

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

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

template <class T> inline void chadd(T &a, const T &b) {
  a += b, a %= MOD;
  // TODO minus case
}

template <class T>
std::ostream &operator<<(std::ostream &s, const std::vector<T> &v) {
  if (v.empty())
    return s;
  s << *v.begin();
  for (auto iter = v.begin() + 1; iter != v.end(); ++iter)
    if (std::is_fundamental<T>::value)
      s << " " << *iter;
    else
      s << std::endl << *iter;
  return s;
}

int main() {
  int A, B, C;
  std::cin >> A >> B >> C;

  std::string ans;
  if (A == B and B == C) {
    ans = "No";
  } else if (A == B or B == C or C == A) {
    ans = "Yes";
  } else {
    ans = "No";
  }

  std::cout << ans << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<string>
#include <bitset>
#include <type_traits>
#include <string>
#include <climits>
#include <cmath>



using namespace std;

// long long func(long long a, long long b, long long c){ 
//     long long ret = 0;
//     a %= c; 
//     while (b) { 
//         if (b & 1){
//         	ret = (ret + a) % c; 
//         }  
//         a = (2 * a)%c; 
//         b >>= 1;
//     } 
//     return ret; 
// } 

int main(){
	#ifndef ONLINE_JUDGE
	    // for getting input from input.txt
	    freopen("input.txt", "r", stdin);
	    // for writing output to output.txt
	    freopen("output.txt", "w", stdout);
	#endif

	int n, flag;
	long long summy=0;
	long long som=0;
	long long bruh = pow(10,9)+7;
	cin >> n;
	long long arr [n];

	for(int i=0;i<n;i++){
		cin >> arr[i];
	}

	for(int j=1;j<n;j++){
		som += arr[j-1];
		// cout << som << endl;
		// summy += func(som, arr[j], bruh);
		summy += som%bruh * (arr[j]%bruh);
		summy = summy % bruh;
	}

	cout << summy << endl;

	return 0;
}

Measured memory_bytes: 5204
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
ll dp[3002][3002];
int main()
{	//dp[i][j] answer of segment [i,j]
	int n;cin>>n;
	ll a[n];
	for(int i=0;i<n;i++)
	cin>>a[i];
	for(int l=n-1;~l;l--)
	for(int r=l;r<n;r++)
	{
		if(l==r)dp[l][r]=a[l];
		else
		dp[l][r]=max(a[l]-dp[l+1][r], a[r]-dp[l][r-1]);
	}
	cout<<dp[0][n-1]<<"\n";
	
}


Measured memory_bytes: 70016
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
	public static void main(String[] args){
		FastScanner sc = new FastScanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int out = 0;
		out = K * (int) Math.pow(K-1, N-1);
		System.out.println(out);


	}

}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
     }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}

Measured memory_bytes: 21076
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define erep(i,N) for(int i = N - 1; i >= 0; i--)
const ll INF = 1000000000;
const ll mod = 1000000007;
#define PI 3.1415926535
using Graph = vector<vector<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;}
typedef pair<int, int> pair;
bool seen[505][505];

//dpTable
int dp[100050];

int main(){
    ll X;
    cin >> X;
    ll ans;
    rep (i,X) {
        if ((i * (i + 1) / 2) == X) {
            ans = i;
            break;
        }
        if ((i * (i + 1) / 2) < X && ((i + 1) * (i + 2) / 2) >= X) {
            ans = i + 1;
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3588
import sys
from collections import defaultdict, Counter, deque
from itertools import accumulate, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right, bisect
from heapq import heappop, heappush
from fractions import gcd
from math import ceil, floor, sqrt, cos, sin, pi
from copy import deepcopy

# If you use recursive call, uncomment this code
#sys.setrecursionlimit(10**6)

def main():
    A = list(map(int, input().split()))
    if sum(A) >= 22:
        print("bust")
    else:
        print("win")

if __name__ == '__main__':
    main()


Measured memory_bytes: 5628
H, W, A, B = map(int, input().split())


def cmb(n, r, mod):
    if (r < 0 or r > n):
        return 0
    r = min(r, n-r)
    # print(n, r)
    return g1[n] * g2[r] * g2[n-r] % mod


mod = 10**9+7  # 出力の制限
N = 10**5*2
g1 = [1, 1]  # 元テーブル
g2 = [1, 1]  # 逆元テーブル
inverse = [0, 1]  # 逆元テーブル計算用テーブル

for i in range(2, N + 1):
    g1.append((g1[-1] * i) % mod)
    inverse.append((-inverse[mod % i] * (mod//i)) % mod)
    g2.append((g2[-1] * inverse[-1]) % mod)
# print(len(g1), len(g2))


ans = 0
for i in range(B, W+1):
    ans += cmb(H-A-1+i, i, mod)*cmb(W+A-2-i, W-1-i, mod)
    ans %= mod
    # nCr % mod
print(ans)


Measured memory_bytes: 81392
n = int(input())
s = input()
ch = {}
for c in s:
  if c in ch:
    ch[c] += 1
  else:
    ch[c] = 1

ans = 1

for c in ch:
  ans *= 1 + ch[c]
  
  while ans >= 1000000007:
    ans -= 1000000007

ans += 1000000007
ans -= 1
while ans >= 1000000007:
  ans -= 1000000007

print(ans)

Measured memory_bytes: 3188
#include<iostream>
#include<map>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#define rep(i, n) for(int i=0; i<n; i++)
#define rrep(i, n) for(int i=n-1; i>=0; i--)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define rFOR(i, a, b) for(int i=b-1; i>=a; i--)
#define MAX 50
typedef long long ll;
using namespace std;

int main(void){
  string s; cin >> s;
  do{
    int i = s.find(",");
    if(i != -1){
      s.replace(i, 1, " ");
    }else{
      break;
    }
  }while(true);
  cout << s << endl;
  return 0;
}

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

typedef long long ll;
#define endl "\n"
#define deb(x) cerr << #x << ":" << x << "\n"

ll n,k,mod=1e9+7,ans=0;

ll fastMod(ll a,ll b){
    ll res=1;
    while(b>0){
        if(b&1)res=(res*a)%mod;
        b/=2;
        a=(a*a)%mod;
    }
    return res;
}

void solve(){    
    cin>>n>>k;
    vector<ll> v(k+1);
    for(int i=k;i>0;i--){
        v[i]=fastMod(k/i,n);
        for(int j=2*i;j<=k;j+=i){
            v[i]=(v[i]-v[j]+mod)%mod;
        }
    }
    for(int i=1;i<=k;i++){
        ll val=(v[i]*i)%mod;
        ans=(ans+val)%mod;
    }
    cout<<ans%mod;
}

int main()
{

    ios::sync_with_stdio(0);
    cin.tie(0);
    ll t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3988
N, Q = map(int, input().split())
S=input()
lr=[]
for _ in range(Q):
    lr.append(tuple(map(int, input().split())))
#print(N, Q, S, lr)

accum=[0]*(N+1)
should_plus=0
for i in range(2, N+1):
    if S[i-2]=='A' and S[i-1]=='C':
        should_plus+=1
    accum[i]=should_plus
#print(accum)

for val in lr:
    left=val[0]
    right=val[1]
    OK=accum[right]-accum[left-1]
    if S[(left-2):left]=='AC':
        OK-=1
    print(OK)



Measured memory_bytes: 19920
#include<bits/stdc++.h>
typedef long long ll ; 
using namespace std;
const ll N = 1e6 + 10;
map<string,int>a,b;
int main(){
// #ifndef ONLINE_JUDGE
// 	freopen("input.in" , "r" , stdin);
// #endif
int n,m;
cin>>n;
int ans = 0;
vector<string>v(n);
for(int i = 0 ; i < n ;++i)
{
	string s;
	cin>>s;
	++a[s];
	v[i]=s;
}
cin>>m;
for(int  i = 0 ; i < m;++i)
{
	string s;
	cin>>s;
	--a[s];
}
for(int i = 0 ; i < n ;++i)ans = max(ans,a[v[i]]);
cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<numeric>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define int64 long long
#define yokuwaruprime (10*10*10*10*10*10*10*10*10+7)
using namespace std;

int64 power2(int n){
  int64 ans=1;
  rep(i,n){
    ans*=2;
  }
  return ans;
}

int main(){
  int n,p,a=0,b=0;
  cin>>n>>p;
  int x[n];
  rep(i,n){
    cin>>x[i];
    if(x[i]%2!=0){
      a++;
    }else{
      b++;
    }
  }
  if(a==0){
    if(p==0){
      cout<<power2(n);
    }else{
      cout<<0;
    }
  }else{
    cout<<power2(n-1);
  }
}

Measured memory_bytes: 256
{-# LANGUAGE PatternGuards #-}

import Data.List (stripPrefix)

ps :: [String]
ps = fmap reverse ["dream", "dreamer", "erase", "eraser"]

judge :: String -> Bool
judge "" = True
judge s0
    | Just r <- stripPrefix (head ps) s0 = judge r
    | Just r <- stripPrefix (ps !! 1) s0 = judge r
    | Just r <- stripPrefix (ps !! 2) s0 = judge r
    | Just r <- stripPrefix (ps !! 3) s0 = judge r
    | otherwise = False

main :: IO ()
main = do
    s <- getLine
    putStrLn $ if judge (reverse s) then "YES" else "NO"


Measured memory_bytes: 7548
import bisect
def zaatu(a):
    b=list(set(a))
    for i in range(len(a)):
        a[i]=bisect.bisect_left(b,a[i])
    return a
n,m=map(int,input().split())
a=[[] for _ in range(n)]
b=[]
for i in range(m):
    p,y=map(int,input().split())
    a[p-1].append([p,y,i])
for i in range(n):
    a[i].sort(key=lambda x:x[1])
for i in range(n):
    for j in range(len(a[i])):
        b.append([a[i][j],j+1])
b.sort(key=lambda x:x[0][2])
for i in b:
    print('0'*(6-len(str(i[0][0])))+str(i[0][0])+'0'*(6-len(str(i[1])))+str(i[1]))

Measured memory_bytes: 49352
#include<stdio.h>
int main()
{
     int n,x,y,c=0;
     scanf("%d%d%d",&n,&x,&y);
     for(int i=x;i<=y;i++)
     {
          if(i%n==0) c++;
          if(c==1) break;
     }
     if(c==1)
          printf("OK\n");
     if(c==0)
          printf("NG\n");
}


Measured memory_bytes: 1608
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<string>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<complex>
#include<iomanip>
#include<unordered_map>
#define deg(x) cerr<<#x<<"="<<x<<endl;
#define fd(x) for(int i=0;i<x;i++)
#define fdd(a,x) for(int i=a;i<x;i++)
#define fx(x,n) for(int i=n-1;i>=x;i--)
#define mst(x) memset(x,0,sizeof(x));
#define fi first
#define se second
#define TB ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define ok "ok"
#define HH puts("");
#define ls rt<<1
#define rs rt<<1|1
#define pb(a,b) a.push_back(b);
#define FIN  freopen("1.in","r",stdin);
#define FOUT freopen("1.out","w",stdout);
using namespace std;
typedef long long ll;typedef long long LL;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<string,int> pss;
typedef unsigned long long ull;
const ll mod=998244353;
const int inf=1e9+7;
const double eps=1e-6;
ll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return (r+m)%m;}
const double pi=acos(-1);


int main(){
    TB
    int n,x,t; 
    cin>>n>>x>>t;
    int g=n/x;
    if(n%x) g++;
    cout<<g*t<<'\n';
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const ll INF = 1e9;

int main() {
  int n, k;
  cin >> n >> k;
  int cnt[n + 1];
  for (int i = 1; i <= n; ++i) {
    cnt[i] = 0;
    int t = i;
    while (t < k) t *= 2, cnt[i]++;
  }

  double ans;
  for (int i = 1; i <= n; ++i) {
    ans += pow(0.5, cnt[i]);
  }

  cout << setprecision(14) << ans / (double)n << endl;
  return 0;
}


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

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

    int n;
    cin>>n;

    vector<pair<ll,ll > >vec;

    for(int i=0;i<n;i++){
        ll a,b;
        cin>>a>>b;

        vec.pb({a,0LL});
        vec.pb({b,1LL});
    }
    sort(vec.begin(),vec.end());

    int opened = 0;
    int closed = 0;

    if(n%2==0){
        int half = n/2;
        ll start1;
        ll End1;
        ll start2;
        ll End2;
        for(int i=0;i<vec.size();i++){
            if(vec[i].second==0){
                opened++;
                if(opened==half){
                    start1=vec[i].first;
                }
                if(opened==half+1){
                    start2=vec[i].first;
                }
            }
            else{
                closed++;
                if(closed==half){
                    End1 = vec[i].first;
                }
                if(closed==half+1){
                    End2= vec[i].first;
                }
            }

        }
        ll mn = start1+start2;
        ll mx = End1+End2;
        cout<<mx-mn +1LL <<"\n";
    }
    else{
        int half = n/2;
        ll start;
        ll End;
        for(int i=0;i<vec.size();i++){
            if(vec[i].second==0){
                opened++;
                if(opened==half+1){
                    start=vec[i].first;
                }
            }
            else{
                closed++;
                if(closed==half+1){
                    End = vec[i].first;
                }
            }

        }
        cout<<End-start+1<<"\n";
    }
}
/*
4
1 2
3 4
5 8
90 777
*/


Measured memory_bytes: 11620
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;

int N,M,L;
int s,t,e;

vector<P> A[10005];
int B[105][10005];


int main(){
  scanf("%d %d",&N,&M);
  while(1){
    scanf("%d %d %d",&s,&t,&e);
    if(s==0&&t==0&&e==0)break;
    A[s-1].push_back(P(t-1,e));
  }
  scanf("%d",&L);
  for(int i=0;i<L;i++){
    for(int j=0;j<M;j++){
      scanf("%d",&B[i][j]);
    }
    for(int j=0;j<N;j++){
      int sum=0;
      for(int k=0;k<(int)A[j].size();k++){
        sum+=B[i][A[j][k].first]*A[j][k].second;
      }
      if(j)printf(" ");
      printf("%d",sum);
    }
    printf("\n");
  }  
  return 0;
}

Measured memory_bytes: 6256
def resolve():
    '''
    code here
    '''
    a, b, x = [int(item) for item in input().split()]
    _a = a // x
    _b = b // x

    if a % x == 0:
        res = _b - _a + 1
    else:
        res = _b - _a
    
    print(res)



if __name__ == "__main__":
    resolve()


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
using namespace std;
typedef pair<ll,ll> lp;
const int inf=0x3f3f3f3f;
const ll alph=26;
void A() {
    char c;
    cin>>c;
    if(c<='z'&&c>='a') cout<<'a'<<endl;
    else cout<<'A'<<endl;
}
void B() {
    int n,k;
    cin>>n>>k;
    vector<int> a(n,0);
    for(int i=0;i<n;i++) cin>>a[i];
    sort(a.begin(),a.end());
    int res=0;
    for(int i=0;i<k;i++) res+=a[i];
    cout<<res<<endl;
}
void C() {
    ll n;
    cin>>n;
    string s;
    while(n>0){
        s+=((n-1)%alph+'a');
        n=(n-1)/alph;
    }
    reverse(s.begin(),s.end());
    cout<<s<<endl;
}
void D() {
    ll n;
    cin>>n;
    unordered_map<ll,ll> cnt;
    ll sum=0;
    for(int i=0;i<n;i++) {
        ll a;
        cin>>a;
        sum+=a;
        cnt[a]++;
    }
    ll q;
    cin>>q;
    for(int i=0;i<q;i++){
        ll b,c;
        cin>>b>>c;
        if(!cnt.count(b)){
            cout<<sum<<endl;
            continue;
        }
        sum+=(c-b)*cnt[b];
        cnt[c]+=cnt[b];
        cnt.erase(b);
        cout<<sum<<endl;
    }
}
void E(){
    int n;
    cin>>n;
    vector<ll> a(n,0);
    ll res=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        res^=a[i];
    }
    vector<ll> ans(n,0);
    for(int i=0;i<n;i++){
        ans[i]=res^a[i];
    }
    for(int i=0;i<n;i++) cout<<ans[i]<<" ";
    cout<<endl;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    E();
}


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

int main() {
    int n, ans = 0;
    cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; i++) {
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            auto ite = lower_bound(v.begin(), v.end(), v[i] + v[j]);
            int l = ite - v.begin();
            ans += l - 1 - j;
        }
    }
    cout << ans << 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);
		long n = sc.nextLong();
		long m = 1000000007;
		long ans = power(10,n,m);
		long ans1 = power(9,n,m);
		long ans2 = power(8,n,m);
		long ans3 = ((ans+ans2)%m-(2*ans1)%m+m)%m;
		System.out.println(ans3);
	}
	public static long power(long x, long y, long m){
		long res =1;
		x=x%m;
		if(x==0){
			return 0;
		}
		while(y>0){
			if((y&1)==1){
				res=(res*x)%m;
			}
			y=y>>1;
			x=(x*x)%m;
		}
		return res;
	}
}

Measured memory_bytes: 35656
#include <stdio.h>
//#include <stdlib.h>
//#include <string.h>
//#include <stdbool.h>
//#include <limits.h>
//#include <math.h>

int main() {
  int a, b, c;
  scanf("%d%d%d", &a, &b, &c);
  if (a+b>=c) printf("Yes\n");
  else printf("No\n");
  return 0;
}


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

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

    int a, b;
    int city[4];
    memset(city, 0, sizeof(city));
    for (int i = 0; i < 3; ++i) {
        cin >> a >> b;
        city[a - 1]++;
        city[b - 1]++;
    }
    for (auto c: city) {
        if (c == 0 || c > 2) {
            cout << "NO" << '\n';
            return 0;
        }
    }
    cout << "YES" << '\n';

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.lang.*;
public class Main{
  public static void main(String[]args){
    Scanner sc=new Scanner(System.in);
    //キーボードから文字列を入力
    String S = sc.next();
    //1文字目、2文字目、3文字目を取り出す
    char a = S.charAt(0);
    char b = S.charAt(1);
    char c = S.charAt(2);

	if(a!=b||b!=c||a!=c){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
 }
}

Measured memory_bytes: 22868
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second

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

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

template<typename T> T chmax(T& a, const T& b){return a = (a > b ? a : b);}
template<typename T> T chmin(T& a, const T& b){return a = (a < b ? a : b);}

struct UF{ //O(loga(n))
    int n;
    int m;
    vi d, r;
    UF(int n) : n(n), m(n), d(n, -1), r(n, 0){};
    int root(int i){
        if(d[i] < 0) return i;
        return d[i] = root(d[i]);
    }
    bool same(int x, int y){
        return root(x) == root(y);
    }
    bool unite(int x, int y){
        x = root(x);
        y = root(y);
        if(x == y) return false;
 
        if(r[x] < r[y]) swap(x, y);
        else if(r[x] == r[y]) r[x]++;
        d[x] += d[y];
        d[y] = x;
        --m;
        return true;
    }
    int size(int i){
        return -d[root(i)];
    }
    int size() {
        return m;
    }
};

int main(){
    int n, m;
    cin >> n >> m;
    UF uf(n);
    rep(i, m) {
        int a, b, c;
        cin >> a >> b >> c;
        --a;
        --b;
        uf.unite(a, b);
    }
    cout << uf.size() << endl;
    return 0;
}

Measured memory_bytes: 1024
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace B
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var s = Console.ReadLine();
            var max = 0;
            var current = 0;
            for (var i = 0; i < s.Length; i++)
            {
                if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T')
                {
                    current++;
                }
                else
                {
                    max = Math.Max(max, current);
                    current = 0;
                }
            }
            max = Math.Max(max, current);
            Console.WriteLine(max);
        }
    }
}


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

typedef long long ll;

int main() {
    int N, K;
    ll ans = 0;
    cin >> N >> K;
    
    for (int b = K+1; b <= N; b++) {
        ll a = N%b;
        ll cnt = N/b;
        ans += cnt * (b-K);
        if (a != 0 && a >= K) {
            if (K == 0) {
                ans += a;
            } else {
                ans += (a-K+1);
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scanf("%s", &s)

	rs := []rune(s)
	h := 0

	for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {
		rs[i], rs[j] = rs[j], rs[i]
	}

	for i, c := range s {
		//fmt.Printf("%c, %c\n", c, rs[i])
		if c != rs[i] {
			h += 1
		}
	}

	fmt.Printf("%d", h / 2)
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
const int P=1e9+7,M=1e5+5;
int A[M],B[M],mark[M],n,d;

int inv(int a){
	int b=P-2,res=1;
	while(b){
		if(b&1)res=1LL*res*a%P;
		a=1LL*a*a%P;
		b>>=1;
	}
	return res;
}
int Cmd(int n,int m){
	if(n<m)return 0;
	return 1LL*A[n]*inv(A[m])%P*inv(A[n-m])%P;
}
int main(){
	A[0]=1;
	for(int i=1;i<M;i++)A[i]=1LL*A[i-1]*i%P;
	scanf("%d",&n);
	for(int i=1;i<=n+1;i++){
		scanf("%d",&B[i]);
		if(mark[B[i]])d=i-mark[B[i]];
		mark[B[i]]=i;
	}
	for(int i=1;i<=n+1;i++){
		printf("%d\n",(Cmd(n+1,i)-Cmd(n-d,i-1)+P)%P);
//		printf(" %d\n",Cmd(n+1,i));
//		printf(" %d\n",Cmd(n-d,i-1));
	}
    return 0;
}

Measured memory_bytes: 2432