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

using namespace std;

#define REP(i,m) for(int i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define INF 1000000001
#define INFL (1LL << 60)
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define ll long long int
#define P pair<ll, ll>

int main() {
  int n;
  cin >> n;
  bool prime[55555] = { };
  FOR(i, 2, 30000){
    if(!prime[i]){
      int j = 2*i;
      while(j < 55555){
        prime[j] = true;
        j += i;
      }
    }
  }
  int cnt = 0;
  FOR(i, 11, 55555){
    if(i%5 == 1 && !prime[i]){
      cout << i;
      cnt++;
    if(cnt != n){
      cout << " ";
    }
    else{
      cout << endl;
      return 0;
    }
    }
  }
  return 0;
}


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

int main()
{
    int h,w,n;
    cin >> h >> w >> n;
    char mas[h+2][w+2];
    int x[4]={1,0,-1,0},y[4]={0,1,0,-1},co=0;
    int qx[n],qy[n];
    int a[h+2][w+2],c[h+2][w+2];
    for(int i=0;i<h+2;i++)
        for(int j=0;j<w+2;j++){
            a[i][j]=-1;
            c[i][j]=0;
        }
    for(int i=1;i<h+1;i++)
        for(int j=1;j<w+1;j++){
            cin >> mas[i][j];
            if(mas[i][j]=='.')
                a[i][j]=0;
            else if(mas[i][j]=='S'){
                qx[0]=i;
                qy[0]=j;
                a[i][j]=0;
            }
            else if(mas[i][j]=='X') continue;
            else{
                a[i][j]=0;
                qx[(int)mas[i][j]-'1'+1]=i;qy[(int)mas[i][j]-'1'+1]=j;
                c[i][j]=(int)mas[i][j]-'1'+1;
            }
        }
    int b[h+2][w+2];
    queue< pair<int,int> > q[n];
    for(int i=0;i<n;i++){
        int life=i+1;
        for(int k=0;k<h+2;k++)
            for(int j=0;j<w+2;j++)
                b[k][j]=a[k][j];
        q[i].push(make_pair(qx[i],qy[i]));
        int ty=0;
        for(;;){
            for(int ij=0;ij<4;ij++){
                if(b[q[i].front().first+x[ij]][q[i].front().second+y[ij]]==0){
                    if(c[q[i].front().first+x[ij]][q[i].front().second+y[ij]]==life){
                        co+=b[q[i].front().first][q[i].front().second]+1;
                        ty=1;
                        break;
                    }
                    b[q[i].front().first+x[ij]][q[i].front().second+y[ij]]=b[q[i].front().first][q[i].front().second]+1;
                    q[i].push(make_pair(q[i].front().first+x[ij],q[i].front().second+y[ij]));
                }
            }
            q[i].pop();
            if(ty==1){
                ty=0;
                break;
            }
        }
    }
    cout << co << endl;
    return 0;
}



Measured memory_bytes: 15808
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 100000 + 10;
const int M = 1000000007;
const double eps = 1e-9;
const double PI = acos(-1);
const int oo = 1000000000;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
#define pb push_back 
#define all(c) (c).begin(),(c).end()
string s;
int k,dp[301][301][301];
int calc(int a, int b, int t){
	if(t<0)return -oo;
	if(a==b)return 1;
	if(a>b)return 0;
	int &ret=dp[a][b][t];
	if(ret+1)return ret;
	ret=max(calc(a+1,b,t), calc(a, b-1, t));
	ret=max(ret, 2+calc(a+1,b-1,t-1));
	if(s[a]==s[b])
		ret=max(ret, 2+calc(a+1,b-1,t));
	return ret;
}
int main(){
	cin>>s>>k;
	memset(dp,-1,sizeof(dp));
	cout<<calc(0,s.size()-1, k)<<endl;
	return 0;	
}

Measured memory_bytes: 106752
def num_sum(n):
	b = 0
	for i in range(16):
		a = n % 10
		b = b + a
		n = n // 10
	return b

x = int(input())
f = 0
for i in range(17):
	c = 10**(16-i)*(x//(10**(16-i))) -1
	if c <= 0:
		c = 0
	d = max(num_sum(x), num_sum(c), f)
	f = d
print(f)

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

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

int main() {
  for(;;) {
    int W, Q; cin >> W >> Q;
    if( W == 0 && Q == 0 ) break;
    const int inf = 987654321;
    vector<int> v(W, inf);
    REP(i, Q) {
      string s; cin >> s;
      if( s == "s" ) {
        int a, b; cin >> a >> b;

        int start;
        bool ok = false;
        for(start = 0; start + b <= W; start++) {
          ok = true;
          for(int j = 0; j < b; j++) {
            if( v[start + j] != inf )  {
              ok = false;
              break;
            }
          }
          if( ok ) {
            for(int j = 0; j < b; j++) v[start + j] = a;
            break;
          }
        }
        if( ok ) cout << start << endl;
        else cout << "impossible" << endl;
      } else {
        int id;
        cin >> id;
        REP(j, v.size()) if( v[j] == id ) v[j] = inf;
      }
    }
    cout << "END" << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define MP make_pair
#define fi first
#define se second
#define sz(x) (int)(x).size()
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int N = 1e5 + 5;

int K;

double Snuke(ll x) {
    ll tmp = 0, c = x;
    while(c) {
        tmp += c % 10;
        c /= 10;
    }
    return 1.0 * x / tmp;
}

void run() {
    ll res = 0, x = 1;
    while(K--) {
        double t1, t2;
        while(true) {
            t1 = Snuke(res + x), t2 = Snuke(res + x * 10);
            if(t1 <= t2) break;
            x *= 10;
        }
        res += x;
        cout << res << '\n';
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(20);
#ifdef Local
    freopen("../input.in", "r", stdin);
    freopen("../output.out", "w", stdout);
#endif
    while(cin >> K) run();
    return 0;
}


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

using namespace std;
using lli = int_fast64_t;
using ulli = uint_fast64_t;
#define debug(x) cerr << #x << " : " << x << endl
#define debugv(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x << ", ";}cerr << endl
#define debugst(x) auto xt = x;cerr << #x << " : {";for(int i=0;i<x.size();i++){ cerr << xt.top() << ", ";xt.pop();}cerr << endl
#define debugvp(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x.first << " : " << value_of_x.second << ", ";}cerr << endl
#define HYPP(x) hypot(x.first,x.second)

constexpr lli MOD = 1e9 + 7;
constexpr lli LIMIT = 1000000000000000000 * 5;
constexpr int tenfive = 100000;


int main() {
	int a = 0, b = 0, c = 0;
	string as, bs, cs;
	cin >> as >> bs >> cs;
	char turn = 'a';
	while (true) {
		switch (turn)
		{
		case 'a':
			if (a == as.size()) {
				cout << "A" << endl;
				return 0;
			}
			turn = as[a];
			a++;

			break;
		case 'b':
			if (b == bs.size()) {
				cout << "B" << endl;
				return 0;
			}
			turn = bs[b];
			b++;
			break;
		case 'c':
			if (c == cs.size()) {
				cout << "C" << endl;
				return 0;
			}
			turn = cs[c];
			c++;
			break;
		default:
			break;
		}
	}
	return 0;
}


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

int main()
{
    string N;
    cin >> N;
    
    if(N[0] == N[1] && N[1] == N[2])
        cout << "Yes" << endl;
    else if(N[1] == N[2] && N[2] == N[3])
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


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

using namespace std;
using Int = long long;

int main(){
    Int N;
    char candidate[] = {3, 5, 7, 11, 13, 17, 19};
    char candidateNum[] = {0, 0, 0, 0, 0, 0, 0};

    cin >> N;

    // 素因数分解
    // 2^4 = 4
    Int num = 0;

    for (int i = 3; i<=N; i+=2){
        Int deriv = i;

        while(deriv != 1){
            bool isDev = false;
            for (int j=0; j<7; j++){
                if (deriv % candidate[j] == 0){
                    deriv = deriv / candidate[j];
                    candidateNum[j]++;
                    isDev = true;
                }
            }
            if (!isDev) break;
        }

        int accum = 1;
        for (int j=0;j<7; j++){
            accum *= candidateNum[j] + 1;
            candidateNum[j] = 0;
        }

        if (accum == 8){
            num ++;
        }

    }

    cout << num << endl;

}

Measured memory_bytes: 384
/*input
FCC
*/
#include <bits/stdc++.h>
using namespace std;

int main(int argc, char const *argv[]) {
  char s[102];
  scanf("%s",s);
  int n = strlen(s);
  for (int i = 0; i < n - 1; ++i) {
    if (s[i] == 'C')
    for (int j = i + 1; j < n; ++j) {
      if (s[j] == 'F') {
        puts("Yes");
        return 0;
      }
    }
  }
  puts("No");
  return 0;
}

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

signed main() {
	int ai, ao, aj, al;
	scanf("%lld%lld%*lld%lld%lld%*lld%*lld", &ai, &ao, &aj, &al);
	if (ai&&aj&&al)
		printf("%lld\n", max((ai / 2) * 2 + (aj / 2) * 2 + (al / 2) * 2 + ao, 3 + ((ai - 1) / 2) * 2 + ((aj - 1) / 2) * 2 + ((al - 1) / 2) * 2 + ao));
	else printf("%lld\n", (ai / 2) * 2 + (aj / 2) * 2 + (al / 2) * 2 + ao);	
}

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

using namespace std;

using int64 = long long;

int main() {
  int N, M, X, Y;
  cin >> N >> M >> X >> Y;
  int latte = -(1 << 30), malta = 1 << 30;
  for(int i = 0; i < N; i++) {
    int x;
    cin >> x;
    latte = max(latte, x);
  }
  for(int i = 0; i < M; i++) {
    int x;
    cin >> x;
    malta = min(malta, x);
  }
  X = max(X, latte);
  Y = min(Y, malta);
  if(X < Y) cout << "No War\n";
  else cout << "War\n";
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n,h,d;
vl dp;

int main(){
	cin>>n>>h>>d;
	ll t=0,tmp=1,S;
	dp=vl(h+1);
	for(int i=1;i<=n;i++) (tmp*=i)%=mod,(t+=tmp)%=mod;
	S=dp[0]=tmp;
	for(int i=1;i<=h;i++){
		if(i-d>0) S=(S-dp[i-d-1]+mod)%mod;
		dp[i]=S;
		if(i<h) (dp[i]*=t)%=mod;
		(S+=dp[i])%=mod;
	}
	cout<<dp[h]<<endl;
}

Measured memory_bytes: 8064
fun main(args: Array<String>) {
    val n = readLine()!!.toLong()
    if (n%2L == 1L) {
        println(0)
        return
    }

    var powFive = 5L
    var res = 0L
    var ans = 0L
    do {
        res = n / (powFive * 2)
        ans += res
        powFive *= 5L
    } while (res != 0L)

    println(ans)
}


Measured memory_bytes: 34504
//package abc178;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int S = Integer.parseInt(br.readLine());
		
		if(S < 3) {
			System.out.println(0);
			return;
		}
		
		int mod = (int)1e9+7;
		
		int[] dp = new int[S+1];
		
		dp[0] = dp[1] = dp[2] = 0;
		dp[3] = 1;
		
		
		for(int i = 4 ; i <= S ; i++) {
			dp[i] = 1;
			
			for(int j = 3 ; j <= i ; j++) {
				dp[i] = (dp[i]%mod +  dp[i-j]%mod)%mod;
			}
		}
		
		System.out.println(dp[S]);
	}
}


Measured memory_bytes: 32600
#include <iostream>
#include <fstream>
#include <iomanip>
#include <math.h>
#include <limits.h>
#include <algorithm>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <string>
#include <string.h>
#include <sstream>
#include <ctime>

using namespace std;

#define eps 1e-12
#define pi 3.14159265358979323846
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define bgn begin
#define ll long long
#define ld long double
#define ull unsigned long long
#define ii pair<ll,ll>










ll x, y, b;




void solve()
{
	cin >> x;
	b = 100;
	for(y = 1;; y++)
	{
		b = b + (b / 100);
		if(b >= x)break;
	}
	cout << y << "\n";
}

int main()
{
	std::ios::sync_with_stdio(0);
	cin.tie(0);
#ifdef localProject
	freopen("in.txt","r",stdin);
#endif
	solve();
	return 0;
}

Measured memory_bytes: 3652
#include "bits/stdc++.h"
using namespace std;
vector<double> a;
vector<vector<double> > f;
int main()
{
    int n;
    int i,j;
    double ans=0.0;
    scanf("%d",&n);
    a.resize(n+1);
    f.resize(n+1);
    f[0].resize(1);
    f[0][0]=1.0;
    for(i=1;i<=n;i++)
    {
        f[i].resize(i+1);
        scanf("%lf",&a[i]);
        f[i][0]=f[i-1][0]*(1.0-a[i]);
    }
    f[1][1]=a[1];
    for(i=2;i<=n;i++)
    {
        for(j=1;j<i;j++)
        {
            f[i][j]=f[i-1][j]*(1.0-a[i])+f[i-1][j-1]*a[i];
        }
        f[i][j]=f[i-1][j-1]*a[i];
    }
    for(j=n/2+1;j<=n;j++)
    {
        ans+=f[n][j];
    }
    printf("%.10lf\n",ans);
    return 0;
}

Measured memory_bytes: 35584
#include <bits/stdc++.h>
#define endl '\n'

//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")

using namespace std;
template<class T, class T2> inline void chkmax(T &x, const T2 &y) { if(x < y) x = y; }
template<class T, class T2> inline void chkmin(T &x, const T2 &y) { if(x > y) x = y; }
const int MAXN = (1 << 20);

int n;
vector<int> adj[MAXN];
int val[MAXN], low[MAXN], high[MAXN];

void read()
{
	cin >> n;
	for(int i = 0; i < n - 1; i++)
	{
		int u, v;
		cin >> u >> v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}

	for(int i = 1; i <= n; i++) val[i] = -1;

	int cnt = 0;
	cin >> cnt;
	while(cnt--)
	{
		int v;
		cin >> v;
		cin >> val[v];
	}
}

void pre_dfs(int u, int pr)
{
	if(val[u] == -1) low[u] = -1e9, high[u] = 1e9; 
	else low[u] = high[u] = val[u];

	for(int v: adj[u])
		if(v != pr)
		{
			pre_dfs(v, u);
			chkmax(low[u], low[v] - 1);
			chkmin(high[u], high[v] + 1);
		}
}

void dfs1(int u, int pr)
{
	if(u != pr)
	{
		chkmax(low[u], low[pr] - 1);
		chkmin(high[u], high[pr] + 1);
	}

	for(int v: adj[u])
		if(v != pr)
			dfs1(v, u);
}

vector<int> li[2];

void dfs_p(int u, int pr, int d)
{
	if(val[u] != -1) li[d].push_back(val[u]);
	for(int v: adj[u])
		if(v != pr)
			dfs_p(v, u, d ^ 1);
}

void solve()
{
	dfs_p(1, 1, 0);
	
	for(int v: li[0])
		if(v % 2 != li[0][0] % 2)
		{
			cout << "No" << endl;
			return;
		}

	for(int v: li[1])
		if(v % 2 != li[1][0] % 2)
		{
			cout << "No" << endl;
			return;
		}

	int d0 = li[0].empty() ? -1 : li[0][0];
	int d1 = li[1].empty() ? -1 : li[1][0];

	if(d0 != -1 && d1 != -1 && d1 == d0)
	{
		cout << "No" << endl;
		return;
	}

	pre_dfs(1, 1);
	dfs1(1, 1);

	for(int u = 1; u <= n; u++)
		if(low[u] > high[u])
		{
			cout << "No" << endl;
			return;
		}

	cout << "Yes" << endl;
	for(int i = 1; i <= n; i++)
		cout << high[i] << endl;
}

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

	read();
	solve();
	return 0;
}



Measured memory_bytes: 39552
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
using namespace std;
long long h,ans,now=1;
int main(){
	ios::sync_with_stdio(false);
	cin>>h;
	while (h) {
		ans+=now;
		now<<=1;
		h/=2;
	}
	cout<<ans<<endl;
	return 0;
} 

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

int main(){
    using namespace std;
    constexpr unsigned long MOD = 1000000007;
    size_t N, M;
    cin >> N >> M;
    vector<unsigned long> S(N), T(M);
    copy_n(istream_iterator<unsigned long>(cin), N, S.begin());
    copy_n(istream_iterator<unsigned long>(cin), M, T.begin());
    vector<vector<unsigned long>> dp(N + 1, vector<unsigned long>(M + 1));
    for(size_t i = 0; i != N; ++i)for(size_t j = 0; j != M; ++j)dp[i + 1][j + 1] = (dp[i][j + 1] + dp[i + 1][j] + (S[i] != T[j] ? MOD - dp[i][j] : 1)) % MOD;
    cout << dp.back().back() + 1 << endl;
    return 0;
}

Measured memory_bytes: 31616
s = gets.chomp
k = gets.to_i
n = s.length
s *= 3
if n == 1
  p k/2
else
  tmp = 0
  1.upto(n-1) do |i|
    if s[i] == s[i-1]
      s[i] = (i % 10).to_s
      tmp += 1
    end
  end
  tmp2 = 0
  n.upto(2*n-1) do |i|
    if s[i] == s[i-1]
      s[i] = (i % 10).to_s
      tmp2 += 1
    end
  end
  tmp3 = 0
  (2*n).upto(3*n-1) do |i|
    if s[i] == s[i-1]
      s[i] = (i % 10).to_s
      tmp3 += 1
    end
  end
  p tmp + tmp2*(k/2) + tmp3*((k-1)/2)
end


Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using llint = long long int;
using namespace std;

int main() {
    fastIO;
    int n;
    cin >> n;
    vector<double> A(n);
    rep(i, n) cin >> A.at(i);

    double rev = 0;
    for (auto a : A) {
        rev += 1 / a;
    }
    cout << precise(20) << (1 / rev) << endl;
}

Measured memory_bytes: 3740
#include<bits/stdc++.h>
#define double long double
using namespace std;
struct node{
    double x,y;
}a[105];
int n;
double ansx,ansy,sy=0,sx=0;
double ans=2000,t;
double del=0.9995; 
inline double dis(node aa,node bb){
    return sqrt((aa.x-bb.x)*(aa.x-bb.x)+(aa.y-bb.y)*(aa.y-bb.y));
}
double calc(double x,double y){
    double ans=0;
    for(int i=1;i<=n;i++){
        ans=max(ans,dis((node){x,y},a[i]));
    }
    return ans;
}
void SA(){
    double x=ansx,y=ansy;
    t=2000;
    while(t>1e-14){
        double X=x+((rand()<<1)-RAND_MAX)*t;
        double Y=y+((rand()<<1)-RAND_MAX)*t;
        double now=calc(X,Y);
        double Delta=now-ans;
        if(Delta<0){
            x=X,y=Y;
            ans=now;
        }
        else if (exp(-Delta/t)*RAND_MAX>rand()) x=X,y=Y;
        t*=del;
    }
}
int main(){
    int cnt=0;
    srand(1000211237);
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        cin>>a[i].x>>a[i].y;
        sx+=a[i].x,sy+=a[i].y;
    }
    ansx=(double)sx/n,ansy=(double)sy/n;
    while((double)clock()/CLOCKS_PER_SEC<0.93) SA(),cnt++;
    printf("%.14Lf",ans);
    return 0;
}

Measured memory_bytes: 512
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.par = [i for i in range(n)]
        self.rank = [0] * n

    def root(self, x):
        if x != self.par[x]:
            self.par[x] = self.root(self.par[x])
        return self.par[x]

    def same(self, x, y):
        return self.root(x) == self.root(y)

    def unite(self, x, y):
        rx = self.root(x)
        ry = self.root(y)
        if rx == ry:
            return

        if self.rank[rx] < self.rank[ry]:
            self.par[rx] = ry
        else:
            self.par[ry] = rx
            if self.rank[rx] == self.rank[ry]:
                self.rank[rx] += 1

    def update_p(self):
        for x in range(self.n):
            self.root(x)

    def get_size(self, x):
        return self.size[self.find_set(x)]




def main():
    n, m = [int(i) for i in input().split()]
    uf = UnionFind(n)
    for _ in range(m):
        x, y, _ = [int(i) for i in input().split()]
        uf.unite(x-1, y-1)
    uf.update_p()
    print(len(set(uf.par)))

if __name__ == '__main__':
    main()



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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll n, p;
    string s;
    cin >> n >> p >> s;
    if(p == 2 || p == 5){
        ll ans = 0;
        for(i = n-1;i >= 0;--i){
            ll tmp = s.at(i) - '0';
            if(tmp%p == 0) ans += i+1;
        }
        cout << ans << endl;
        return 0;
    }
    map<ll,ll> mp;
    ll spare = 0;
    ll rui = 1;
    ll ans = 0;
    for(i = n-1;i >= 0;--i){
        ll digit = s.at(i) - '0';
        spare += rui*digit;
        spare %= p;
        ans += mp[spare];
        if(spare == 0) ++ans;

        ++mp[spare];

        rui = rui*10%p;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4212
import java.io.IOException;
import java.io.*;
import java.util.*;


class Main {

	static class Res implements Comparable<Res>
	{
		String name;
		int score;
		int index;
		Res(int i,String x, int g)
		{
			index = i;
			name = x;
			score = g;
		}
		public int compareTo(Res res)
		{
			int c = name.compareTo(res.name);
			if(c==0)
			{
				return Integer.compare(res.score, score);
			}
			return c;
		}
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
			FastScanner s = new FastScanner();
			int a = s.nextInt();
			
	Res[] arr = new Res[a];
			for(int i = 0;i<a;i++)
			{
				arr[i] = new Res(i+1,s.nextString(), s.nextInt());
			}
			Arrays.sort(arr);
			
			for(int i = 0;i<a;i++)
				System.out.println(arr[i].index);
			
	}

static   class FastScanner {
		
	    private InputStream mIs;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public FastScanner() {
			this(System.in);
		}

		public FastScanner(InputStream is) {
			mIs = is;
		}

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = mIs.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public String nextString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		
		}	

	}

}


Measured memory_bytes: 22740
s = str(input())
adic = {}

for i in range(4):
  if not s[i] in adic:
    adic[s[i]] = 1
  else:
    adic[s[i]] += 1
    
abool = True
if len(adic) == 2:
  for item in adic:
    if adic.get(item) != 2:
      abool = False
else:
  abool = False
  
if abool:
  print('Yes')
else:
  print('No')


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define MOD 1000000007

typedef long long int ll;

const ll INF=(ll)1e18;
//const int INF=(1<<30);


int main(){
  int n;
  cin >> n;
  ll ans1 = 0, ans2 = 0;;

  vector<ll> a(n);
  REP(i,n)cin>>a[i];

  ll t;
  //正負
  if(a[0]<=0){
    ans1 += -a[0]+1;
    t = 1;
  }else{
    t = a[0];
  }
  FOR(i,1,n){
    if((t > 0 && t + a[i] >= 0) || (t < 0 && t + a[i] <= 0)){
      ans1 += abs(t+a[i]) + 1;
      if(t> 0){
        t = -1;
      }else{
        t = 1;
      }
    }else{
      t += a[i];
    }
  }

  //負正
  if(a[0]>=0){
    ans2 += a[0]+1;
    t = -1;
  }else{
    t = a[0];
  }
  FOR(i,1,n){
    if((t > 0 && t + a[i] >= 0) || (t < 0 && t + a[i] <= 0)){
      ans2 += abs(t+a[i]) + 1;
      if(t> 0){
        t = -1;
      }else{
        t = 1;
      }
    }else{
      t += a[i];
    }
  }

  cout << min(ans1,ans2) << endl;
}



Measured memory_bytes: 1024
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
 
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
 
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
 
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define f(i, n) for(int i = 0; i < n; ++i)
#define pb push_back
#define eb emplace_back
#define m_p make_pair
#define T int t = 0; cin >> t; while(t--)
#define pr(a) for(int i = 0; i < (int)a.size(); ++i)cout << a[i] << " ";cout << endl;
#define b_e(a) a.begin(), a.end()
typedef long long ll;
typedef long double lld;
const ll mod = 1e15;
const ll mx = 2e5;
const ll inf = 1e9;
const int sz = 26;
typedef long long ll;


void input(){
    IOS;
    int x;
    cin >> x;
    if(x >= 30)cout << "Yes" << endl;
    else cout << "No" << endl;
}

int main(){
    input();
    return 0;
} 
/*
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
*/

Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define LL long long
#define FOR(i,a,b) for(int i=a;i<=b;++i)
#define REP(i,n) for(int i=0;i<n;++i)
using namespace std;
static const LL INF = 1LL<<61LL;
typedef pair<int,int> PII;

int N,T,S;
PII V[3030];
int mem[3030][3030];

int cal(int n,int time){
   int res=0;
   if(n>N||time>T)return 0;
   if(mem[n][time]!=-1)return mem[n][time];
   if(time+V[n].second>T)res=max(cal(n+1,time),max(cal(n+1,time),res));
   else if(time+V[n].second>S&&time<S)res=max(cal(n,S),max(cal(n+1,time),res));
   else res=max(cal(n+1,time+V[n].second)+V[n].first,max(cal(n+1,time),res));
   return mem[n][time]=res;
}


int main(){
    memset(mem,-1,sizeof(mem));
    cin>>N>>T>>S;
    FOR(i,1,N){
        cin>>V[i].first>>V[i].second;
    }
    cout<<cal(1,0)<<endl;
}

Measured memory_bytes: 37240
n,k=map(int,input().split())
s=input()
x=s.count('RL')
y=0
cnt=0
for i in range(n-1):
  if s[i]==s[i+1]:
    cnt+=1
if s[0]=='L' and s[n-1]=='R':
  y+=1
while k>0:
  if x>0:
    x-=1
    cnt+=2
    k-=1
  else:
    if y>0:
      cnt+=1
      y-=1
      k-=1
    else:
      break
print(min(n-1,cnt))


Measured memory_bytes: 3316
#include<stdio.h>

int main(void)
{
	int s1,s2,s3;
	
	scanf("%d %d %d",&s1,&s2,&s3);

	if (s1==1&&s2==1&&s3==0){
		printf("Open\n");
		}

	else if (s1==0&&s2==0&&s3==1){
		printf("Open\n");
		}

	else {
		printf("Close\n");
		}

	return 0;
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    if (n == 1) {
        cout << 1 << "\n";
        cout << 0 << "\n";
        return 0;
    } else if (n == 2) {
        cout << 2 << "\n";
        cout << 0 << "\n";
        cout << 11 << "\n";
        return 0;
    }
    cout << n - 1 << "\n";
    for (int i = 2; i <= n; ++i) {
        string ret(i, '0');
        ret[0] = ret[i - 1] = '1';
        cout << ret << "\n";
    }
    return 0;
}


Measured memory_bytes: 3236
/*
[agc039] D - Incenters
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
#define ALL(c) (c).begin(), (c).end()

typedef complex<double> P;

const int MAX_N = 3000;
const P I(0, 1);

int N, L;
int T[MAX_N];

P solve() {
    P ans;
    for (int i = 0; i < N; i++) {
        for (int j = i + 1; j < N; j++) {
            double theta = M_PI * (T[i] + T[j]) / L;
            ans += exp(I * theta) * (double)(N + 2 * i - 2 * j);
        }
    }

    ans *= 6.0 / N / (N - 1) / (N - 2);

    return ans;
}

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

    P ans = solve();
    cout << setprecision(15) << real(ans) << " " << imag(ans) << endl;

    return 0;
}


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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  int n, m; std::cin >> n >> m;
  vector<pair<ll, ll>> ab(n);
  rep(i, n) std::cin >> ab[i].fi >> ab[i].se;
  sort(rng(ab));
  ll ans = 0;
  rep(i, n) {
    if (m > ab[i].se) ans += ab[i].fi * ab[i].se, m -= ab[i].se;
    else {
      ans += ab[i].fi * m;
      break;
    }
  }
  std::cout << ans << "\n";
}


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

using namespace std;

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

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const ld eps = 1e-10;
const ll MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int a, b; cin >> a >> b;
  
  for(int i=1;i<=100000;++i) {
    double tmp1 = i * 0.08;
    double tmp2 = i * 0.1;
    int tmpa = (int)(tmp1+eps);
    int tmpb = (int)(tmp2+eps);
    if(tmpa == a && tmpb == b) {
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define VV vector
#define pb push_back
#define bitc  __builtin_popcountll
#define m_p make_pair
#define infi 1e18+1
#define eps 0.000000000001
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<class T>//usage rand<long long>()
T rand() {
    return uniform_int_distribution<T>()(rng);
}
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
 
//////////////
auto clk=clock();
#define all(x) x.begin(),x.end()
#define S second
#define F first
#define sz(x) ((long long)x.size())
#define int long long  
#define f80 __float128
#define pii pair<int,int>
/////////////

signed main()
{
	fastio;
	#ifdef ANIKET_GOYAL
		freopen("inputf.in","r",stdin);
		freopen("outputf.in","w",stdout);
	#endif
	int ans[100][10]={};
	for(int i=0;i<10;++i)
		ans[1][i]=1;
	for(int i=2;i<15;++i)
	{
		for(int j=0;j<10;++j)
		{
			if(j!=0)
			ans[i][j]+=ans[i-1][j-1];
			ans[i][j]+=ans[i-1][j];
			if(j!=9)
			ans[i][j]+=ans[i-1][j+1];
		}
	}
	int k;
	cin>>k;
	int st=0;
	for(int i=1;i<15;++i)
	{
		for(int j=1;j<=9;++j)
		{
			if(ans[i][j]>=k)
			{
				cout<<j;
				while(i>1)
				{
					if(j!=0&&ans[i-1][j-1]>=k)
					{
						j=j-1;
						cout<<j;
						--i;
						continue;
					}
					else
					{
						if(j!=0)
						{
							k-=ans[i-1][j-1];
						}
					}
					if(ans[i-1][j]>=k)
					{
						i--;
						cout<<j;
						continue;
					}
					else
					{
						k-=ans[i-1][j];
					}
					j=j+1;
					cout<<j;
					--i;
				}
				return 0;
			}
			else
			{
				k-=ans[i][j];
			}
		}
	}
	#ifdef ANIKET_GOYAL
		cout<<endl<<endl<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
	#endif
}

Measured memory_bytes: 256
[a,b,c,x,y] = [int(x) for x in input().split()]

total_price = a*x+b*y
max_num = max(x,y)

for i in range(0,(max_num+1)*2,2):
    new_x = 0 if x-i//2 <= 0 else x-i//2
    new_y = 0 if y-i//2 <= 0 else y-i//2
    current_price = i*c + new_x*a + new_y*b
    
    if current_price < total_price:
        total_price = current_price

print(total_price)

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


int main(){
  int n;
  cin >>n;
  vector <int> a(n+1);
  rep(i,n)cin >>a.at(i);

  int v =a.at(0);
  rep(i,n-1)cout<<a.at(i)<<" ";
  printf("%d\n",a.at(n-1));

  for(int i =1;i<n;i++){
    v = a.at(i);
    int j = i-1;
    //cout<<"v = "<<v <<endl;
    while(j>=0 && a.at(j) >v){
      a.at(j+1)=a.at(j);//大きい値をずらす作業
      j--;
    }
    a.at(j+1) = v;
    rep(i,n-1)cout<<a.at(i)<<" ";
    printf("%d\n",a.at(n-1));

  }
}



Measured memory_bytes: 3232
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int a,b,c,d; cin>>a>>b>>c>>d;
	while (1) {
		c-=b;
		if (c<=0) {
			cout<<"Yes";
				return 0;
		}
		a-=d;
		if (a<=0) {
			cout<<"No";
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 3516
#include<stdio.h>
int main(void)
{
	int a,b;
	int i;
	int temp, temp1, flag = 0;

	scanf("%d %d", &a,&b);
	if (a > b) {
		for (i = 0; i < a ; i++) {
			temp = a - i;
			if (temp < 0) {
				temp *= -1;
			}
			temp1 = i - b;
			if (temp1 < 0)temp1 *= -1;
			if (temp == temp1) {
				flag = 1;
				break;
			}
		}
	}
	else {
		for (i = 0; i < b ; i++) {
			temp = a - i;
			if (temp < 0) {
				temp *= -1;
			}
			temp1 = i - b;
			if (temp1 < 0)temp1 *= -1;
			if (temp == temp1) {
				flag = 1;
				break;
			}
		}
	}

	if (flag == 1) {
		printf("%d\n", i);
	}
	else {
		printf("IMPOSSIBLE\n");
	}
	return 0;
}

Measured memory_bytes: 128
open Printf
open Scanf

let id x = x

let solve n m =
  let ah = Array.init n @@ fun _ -> scanf "%d " id in
  let lab = List.init m @@ fun _ -> scanf "%d %d " @@ fun a b -> (a, b) in
  let ht = Hashtbl.create n in
  let f (a, b) =
    if ah.(a - 1) < ah.(b - 1) then Hashtbl.replace ht a true
    else if ah.(a - 1) > ah.(b - 1) then Hashtbl.replace ht b true
    else begin
        Hashtbl.replace ht a true;
        Hashtbl.replace ht b true
      end in
  List.iter f lab;
  n - Hashtbl.length ht

let () =
  scanf "%d %d " solve |> printf "%d\n"


Measured memory_bytes: 16592
import kotlin.math.*
import java.util.*

const val MOD = 1_000_000_007L

fun readI() = readLine()!!.toInt()
fun readL() = readLine()!!.toLong()
fun readD() = readLine()!!.toDouble()
fun readIs() = readLine()!!.split(' ').map(String::toInt)
fun readLs() = readLine()!!.split(' ').map(String::toLong)
fun readDs() = readLine()!!.split(' ').map(String::toDouble)

fun main(args: Array<String>) {
  val (n, k) = readIs()
  var a = readIs().toIntArray()
  for (i in 1..k) {
    val b = IntArray(n)
    for (j in 0 until n) {
      val p = max(0, j - a[j])
      val q = j + a[j] + 1
      b[p]++
      if (q < n) b[q]--
    }
    for (j in 1 until n) {
      b[j] = b[j - 1] + b[j]
    }
    if (Arrays.equals(a, b)) break
    a = b
  }
  a.forEach {
    print(it)
    print(' ')
  }
  println()
}


Measured memory_bytes: 68596
#include "bits/stdc++.h"
using namespace std;
#ifdef ONLINE_JUDGE
#define trace(...)
#endif

using LL = long long;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	
	int n, k; cin >> n >> k;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	LL ans = 0, mod = 1e9 + 7;
	for (int i = 0; i < n; i++) {
		int f = 0;
		for (int j = i + 1; j < n; j++) {
			if (a[i] > a[j]) f++;
		}
		ans += f;
	}
	ans = (ans * k) % mod;

	LL curr = 0;
	for (int i = 0; i < n; i++) {
		int f = 0;
		for (int j = 0; j < n; j++) {
			if (a[i] > a[j]) f++;
		}
		curr += f;
	}
	LL kc2 = ((k * 1ll * (k - 1)) / 2) % mod;
	curr = (curr * kc2) % mod;

	ans = (ans + curr) % mod;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(auto i=(a);i<(b);i++)
#define per(i,a,b) for(auto i=(a);i>=(b);i--)
#define Min(a,b) ((a) < (b) ? (a) : (b))
#define Max(a,b) ((a) > (b) ? (a) : (b))
#define int_inf 0x3f3f3f3f
#define int_max 2147483647
#define ll_max 9223372036854775807
#define ull_max 18446744073709551615
#define ll_inf 0x7f7f7f7f7f7f7f7f
#define lowbit(x) (x)&(-x)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define eps 1e-8
#define all(v) (v.begin(),v.end())
#define db double
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const ll mod=1e9+7;
const double pi=acos(-1.0);
const double inf = 1e100;
template<class T>
inline T read()
{
	T x=0,f=1;char s=getchar();
	while(s<'0'||s>'9') {if(s=='-')f=-1;s=getchar();};
	while(s>='0'&&s<='9'){x=(x<<3)+(x<<1)+s-48;s=getchar();};
	return x*f;
}
template<typename T>
inline void wri(T x)
{
	if(x<0){x=-x;putchar('-');};
	if(x/10) wri(x/10);
	putchar(x%10+48);
}
template<typename T>
inline void print(T x,char s)
{
	wri(x);
	putchar(s);
}
template<typename T>
T gcd(T a,T b)
{
	return b==0?a:gcd(b,a%b);
}
//关闭流同步就不能手写读入优化啦
int n;
int a[2000100];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    cin>>n;
    int sum=0;
    rep(i,1,n+1){
    	cin>>a[i];
    	sum^=a[i];
	}
	rep(i,1,n+1){
		a[i]=sum^a[i];
	}
	rep(i,1,n+1){
		cout<<a[i]<<" ";
	}
    return 0;
}



Measured memory_bytes: 4332
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()

int main() {
  //
  int N, C;
  cin >> N >> C;
  vector<vector<int> > d(C, vector<int>(C));
  rep(i, C) {
    rep(j, C) { cin >> d[i][j]; }
  }
  vector<vector<int> > c(N, vector<int>(N));
  rep(i, N) {
    rep(j, N) { cin >> c[i][j]; }
  }

  vector<vector<int> > cost(3, vector<int>(C));
  rep(t, 3) {
    rep(i, C) {
      rep(x, N) {
        rep(y, N) {
          int par = (x + y) % 3;
          if (par == t) {
            cost[t][i] += d[c[x][y] - 1][i];
          }
        }
      }
    }
  }
  int ans = INT_MAX;
  rep(i, C) {
    rep(j, C) {
      if (j == i) continue;
      rep(k, C) {
        if (k == j || k == i) continue;
        ans = min(ans, cost[0][i] + cost[1][j] + cost[2][k]);
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1280
from math import *

x , y = 0, 0
rad = radians(90)
while 1:
    d, t = map(int, raw_input().split(','))
    if d == 0: break
    x = x + cos(rad) * d
    y = y + sin(rad) * d
    rad -= radians(t)
print int(x)
print int(y)

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

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
typedef set <int> si;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)
#define maxn 100005
#define mp make_pair
#define int ll
int N,M,A[maxn];

int p[maxn];
int ans = 0;

int fL(int x){
	if (p[x] == x) return x;
	return p[x] = fL(p[x]);
}

void join(int a,int b){
	p[fL(a)] = fL(b);
}

vi B[maxn];
vi C[maxn];
bool vis[maxn];
int32_t main(){
	fast;
	cin>>N>>M;
	
	FOR(i,1,N) p[i] = i;
	
	FOR(i,1,N) cin>>A[i];
	FOR(i,0,M-1){
		int a,b;
		cin>>a>>b;
		join(a,b);
	}


	FOR(i,1,N){
		int a = fL(i);
		B[a].pb(i);
		C[a].pb(A[i]);
	}
	
	FOR(i,1,N){
		if (!vis[fL(i)]){
			sort(all(B[fL(i)]));
			sort(all(C[fL(i)]));
			vis[fL(i)] = 1;
		}
	}
	mem(vis,0);
	int ans = 0;
	FOR(i,1,N){
		int a = fL(i);
		if (!vis[a]){
			aFOR(j,C[a]){
				//cout<<j<<' ';
				auto it = lower_bound(all(B[a]),j);
				if (it != B[a].end() && *it == j) ans++;
			}
			vis[a] = 1;
		}
	}
	cout<<ans;
}


Measured memory_bytes: 12800
#include <algorithm>
#include <cmath>
#include <iostream>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;

int main()
{
    int age;
    cin >> age;
    if (age == 1)
    {
        cout << "Hello World" << endl;
    }
    else
    {
        int A, B;
        cin >> A >> B;
        cout << A + B << endl;
    }
}

Measured memory_bytes: 256
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let k: i64 = sc.read();
    let x: i64 = sc.read();
    let start = x - k + 1;
    let end = x + k - 1;
    for i in start..(end + 1) {
        if i > start {
            print!(" ");
        }
        print!("{}", i);
    }
    println!();
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352
from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import math
sys.setrecursionlimit(4100000)
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
input=lambda :sys.stdin.readline().rstrip()
A,B,C,K=map(int,input().split())
value=0
if A>=K:
    value+=K
    K=0
else:
    value+=A
    K-=A

if B>=K:
    K=0
else:
    K-=B

value-=K
print(value)


Measured memory_bytes: 77312
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <limits>
#include <cmath>
#include <iomanip>
#include <functional>
#include <random>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;


const long long BASE_NUM = 1000000007;

int main()
{
  ll N;
  cin >> N;
  ll ans = 0;
  for(int i = 1;i<= N;i++){
    ans += (N-1)/i;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3644
use std::io::Read;
use std::collections::HashSet;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

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

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let x: isize = iterator.next().unwrap().parse().unwrap();
    let n: usize = iterator.next().unwrap().parse().unwrap();
    let mut p: HashSet<isize> = HashSet::new();
    for _ in 0..n {
        p.insert(iterator.next().unwrap().parse().unwrap());
    }

    for i in 0..200 {
        if !p.contains(&(x - i)) {
            return format!("{}", x - i);
        }
        if !p.contains(&(x + i)) {
            return format!("{}", x + i);
        }
    }

    return String::new();
}


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

using namespace std;

#define all(v)				((v).begin()), ((v).end())
#define allr(v)				((v).rbegin()), ((v).rend())
#define sz(v)				((int)((v).size()))
#define rep(i, v)		for(int i=0;i<sz(v);++i)
#define lp(i, n)		for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)	for(int i=(j);i<(int)(n);++i)
#define lpd(i, j, n)	for(int i=(j);i>=(int)(n);--i)
#define ll long long
#define pb					push_back
#define fIO ios_base::sync_with_stdio(0);cin.tie(0);

const ll oo = 1e8;
const double pi = 3.1415926535897;


const double EPS = (1e-7);
int dcmp(double x, double y) {	return fabs(x-y) <= EPS ? 0 : x < y ? -1 : 1;	}


typedef vector<int>                vi;
typedef vector<pair<int,int>>      vii;
typedef vector<ll>                 vll;
typedef vector<double>             vd;
typedef vector< vi >               vvi;
typedef vector< vd >               vvd;
typedef vector<string>             vs;
typedef pair<int, int>             pii;

/**
    * PLEASEEE READDD PROBLEEEM CARFULLY ****
    * Always check for OVERFLOW ll vs int
    * Always check for array bounds
    * Check for function return
    * READ OUTPUT SECTION AGAIN!!!
**/

struct edge{
    int from, to, w;

    edge(){}
    edge(int x, int y, int we): from(x), to(y), w(we){}

    bool operator < (const edge &rhs) const{
        return w > rhs.w;
    }

};

int main(){
    fIO

    int n;
    cin >> n;

    for(int i = 0; i <= n; i++) {
        int y = (n - 4 * i);
        if(y < 0) break;
        if(y % 7) continue;
        return cout << "Yes\n", 0;
    }

    cout << "No\n";


}









Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
map<long long,int> a;
long long x,ans,sum,n;
int main()
{
	cin>>n;
	a[0]++;
	for(int i=1;i<=n;i++)
	{
		cin>>x;
		sum+=x;
		ans+=a[sum];
		a[sum]++;
	}
	cout<<ans<<endl;
	return 0;
}

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

int n,a[55],pnt1,pnt2;

int main()
{
	cin>>n;
	for(int i=1;i<=n&&cin>>a[i];i++)
		if(a[i]!=i)
		{
			if(pnt2>0)
			{
				cout<<"NO\n";
				exit(0);
			}
			if(pnt1!=0)
				pnt2 = i;
			else
				pnt1 = i;
		}
	if(pnt1>0 && pnt2==0)
		cout<<"NO\n";
	else
		cout<<"YES\n";
	
	return 0;
}

Measured memory_bytes: 256