akhauriyash/Code-Regression huggingface dataset:
//# define FLAG
///delet....................................
# include <iostream>
# include <cstring>
# include <cstdlib>
# include <cstdio>
# include <string>
# include <cmath>
# include <ctime>
# include <set>
# include <map>
# include <queue>
# include <stack>
# include <bitset>
# include <vector>
# include <fstream>
# include <algorithm>
using namespace std;
# define eps 1e-8
# define pb push_back
# define mp make_pair
# define pi acos(-1.0)
# define bug puts("H");
# define mem(a,b) memset(a,b,sizeof(a))
# define IOS ios::sync_with_stdio(false);
# define FO(i,n,a) for(int i=n; i>=a; --i)
# define FOR(i,a,n) for(int i=a; i<=n; ++i)
# define MAX 0x7fffffffffffff
# define INF 0x3f3f3f3f
# define MOD 1000000007
///          1234567890
# pragma comment(linker, "/STACK:1024000000,1024000000")
typedef unsigned long long ULL;
typedef long long LL;
inline int Scan(){
    int x=0,f=1; char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
///coding...................................

char a[100005];
int  b[27];
int main()
{
    IOS
#ifdef FLAG
    freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
#endif /// FLAG
    int flag=1;
    mem(b,-1);
    cin>>a;
    FOR(i,0,strlen(a)-1)b[a[i]-'a'+1]=0;
    FOR(i,1,26)if(b[i]){printf("%c\n",i+'a'-1);flag=0;break;}
    if(flag)puts("None");
    return 0;
}
///delete FLAG..............................



















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

  int n;
  double result;
  
  cin >> n;
  int v[n];
  
  rep(i,n){
    cin >> v[i];
  }

  sort(v,v+n);
 
  result=v[0];
  for(int i=1;i<n;i++){
    result=(result+v[i])/2;
  }
  
  
  cout << result << endl;
     
}
 

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;

class Program {
    static void Main(string[] args) {
        int[] inp = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        int a = inp[0];
        int b = inp[1];
        var lst = new List<int>();
        int sum = 0;

        for (int i = 1; i <= 999; i++ ) {
            sum += i;
            lst.Add(sum);
        }

        WriteLine((lst[b - a - 1]) - b);
    }
}



Measured memory_bytes: 13396
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = Integer.parseInt(sc.next());

		int[] arr = new int[n];
		int total = 0;

		for (int i = 0; i < n; i++) {
			arr[i] = Integer.parseInt(sc.next());
		}

		for (int i = 0; i < n - 1; i++) {
			for (int j = i + 1; j < n; j++) {
				total += arr[i] * arr[j];
			}
		}

		System.out.println(total);

	}

}


Measured memory_bytes: 22740
#include<stdio.h>
int main(){
  char c=0,s[1000];
  int n=0,i;
  scanf("%s",s);
  for(i=0;s[i];i++){
    if(c-s[i])n++;
    c=s[i];
  }//printf("%d\n",n);
  printf("%c\n",n%2?s[0]:'o');
  return 0;
}
  

Measured memory_bytes: 536
import java.util.Arrays;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n =sc.nextInt(),k = sc.nextInt(),result = 0;
		int[] l = new int[n];
		for(int i = 0; i < n; i++) {
			l[i] = sc.nextInt();
		}
		Arrays.sort(l);
		for(int i= n-1; i>n-k-1 ; i--) {
			result +=l[i];
		}
		System.out.print(result);
		

	}

}


Measured memory_bytes: 23764
c = [list(map(int, input().split())) for i in range(3)]
a = [0, 0, 0]
b = [0, 0, 0]
b[0] = c[0][0]-a[0]
b[1] = c[0][1]-a[0]
b[2] = c[0][2]-a[0]
a[1] = c[1][0]-b[0]
a[2] = c[2][0]-b[0]
for i in range(3):
    for j in range(3):
        if c[i][j] == a[i]+b[j]:
            continue
        else:
            print('No')
            exit()
print('Yes')


Measured memory_bytes: 38384
#include <iostream>
using namespace std;
typedef unsigned long long u64;

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b, c;
  cin >> a >> b >> c;
  if (a == b && b == c) cout << 1 << endl;
  else if (a == b || b == c || c == a) cout << 2 << endl;
  else cout << 3 << endl;
  return 0;
}


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

int main(){
 int N; double sum = 0.0;
 cin >> N;
 vector <int> A(N);
 for(int i = 0; i < N; i++) cin >> A.at(i);
 for(int i = 0; i < N; i++){
  sum += 1/(double)A.at(i);
 }
 double result = 1/double(sum);
 cout << result << endl;
 return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <cstring>
#include <queue>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cstdlib>

using namespace std;

//#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

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

//static const ll MOD = 1000000007;
//static const ll INF = 100000000;

int main() {
    ll r=0,answer=0;

    // input
    cin >> r;

    // process
    cout << pow(r,2) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int A = 1;
  int ans = 0;
  while (A <= N) {
    if ((A%10 > 0 && A/10 == 0) || (A%1000 > 99 && A/1000 == 0) || (A%100000 > 9999 && A/1000000 == 0))
      ans++;
    A++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };


// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */


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

    char c; cin >> c;
    ++c;
    cout << c << endl;

    return 0;
}


Measured memory_bytes: 764
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define REEP(i, N) for(ll i = N - 1; i >= 0; --i)
#define FOR(i,m,n) for(ll i = m; i < n; ++i)
#define RFOR(i,m,n) for(ll i = n - 1; i >= m; --i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define PB push_back
#define KIRIAGE(a, b) a += (b - a % b) % b // a を b の倍数値まで増やす
#define CEIL(c, a, b) if(a % b == 0) { c = a / b;} else { c = a / b + 1;} // a / b 以上の最小整数
#define sp(n) setprecision(n)
#define INF 1000000000
#define MOD 1000000007

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dx4[4] = {1, 0, -1, 0};
int dy4[4] = {0, 1, 0, -1};
int dx8[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int dy8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

int main(void) {
	int N;
	cin>>N;
	vector<int> p(N);
	REP(i, N) cin>>p[i];
	vector<int> a(N);
	vector<int> b(N);
	vector<int> imoa(N, 0);
	vector<int>	imob(N, 0);
	REP(i, N) {
		a[i] = i + 1;
		b[i] = N - i;
	}
	REP(i, N) {
		imoa[p[i] - 1] += i + 1;
		imob[0] += i + 1;
		if(p[i] < N) imob[p[i]] -= i + 1;
	}
	REP(i, N - 1) {
		imoa[i + 1] += imoa[i];
		imob[i + 1] += imob[i];
	}
	REP(i, N) {
		a[i] += imoa[i];
		b[i] += imob[i];
	}
	REP(i, N){
		cout<<a[i];
		if(i != N - 1) cout<<" ";
		else cout<<endl;
	}
	REP(i, N){
		cout<<b[i];
		if(i != N - 1) cout<<" ";
		else cout<<endl;
	}
}


Measured memory_bytes: 1024
#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;

char mass[14][14];
int  dx[4]={1,0,-1,0};
int  dy[4]={0,1,0,-1};
int  cnt=0;

int dfs(int x,int y);
int main(){

  int i,j;

  while(scanf("%s",mass[0])!=EOF){

    for(i=1;i<12;i++){
      scanf("%s",mass[i]);
    }


    for(i=0;i<12;i++){
      for(j=0;j<12;j++){
	if(mass[i][j]=='1'){
	  cnt++;
	  dfs(j,i);
	}
      }
    }

    cout<<cnt<<endl;
    cnt=0;
  }

  return 0;
}

int dfs(int x,int y){

  int i;
  mass[y][x]='0';

  for(i=0;i<4;i++){
    int nx=x+dx[i];
    int ny=y+dy[i];

    if(nx>=0 && nx<12 && ny>=0 && ny<12 && mass[ny][nx]=='1'){
      dfs(nx,ny);
    }

  }

  return 0;
}

Measured memory_bytes: 1156
#include <iostream>
#include <vector>
#include <map>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }

map<int, vector<int>> graph;
map<int, bool> visited;
int N = 100001;

pll dfs(int v) {
  ll nx = 0;
  ll ny = 0;
  visited[v] = true;
  for (int v_to : graph[v]) {
    if (visited[v_to]) continue;
    if (v_to >= N) ny += 1;
    else nx += 1;
    pll tmp = dfs(v_to);
    nx += tmp.first;
    ny += tmp.second;
  }
  return make_pair(nx, ny);
}

int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int x, y;
    cin >> x >> y;
    graph[x].push_back(y+N);
    graph[y+N].push_back(x);
    visited[x] = false;
    visited[y+N] = false;
  }
  ll ans = 0;
  for (auto kv : visited) {
    if (kv.second) continue;
    int v = kv.first;
    pll ret = dfs(v);
    ll nx, ny;
    nx = ret.first;
    ny = ret.second;
    if (v >= N) ny += 1;
    else nx += 1;
    ans += nx*ny;
  }
  ans -= n;
  cout << ans << endl;

}


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

int gcd(int a, int b);

int main() {
    int n, ans = 0;
    cin >> n;
    vector<int> a(n), left(n), right(n);
    rep(i, n) cin >> a.at(i);
    left.at(0) = right.at(n - 1) = 0;
    for(int i = 1; i < n; i++) left.at(i) = gcd(max(left.at(i - 1), a.at(i - 1)), min(left.at(i - 1), a.at(i - 1)));
    for(int i = n - 2; i >= 0; i--) right.at(i) = gcd(max(right.at(i + 1), a.at(i + 1)), min(right.at(i + 1), a.at(i + 1)));
    rep(i, n) ans = max(ans, gcd(max(left.at(i), right.at(i)), min(left.at(i), right.at(i))));
    cout << ans << endl;
}

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

Measured memory_bytes: 1408
<?php
	$n = trim(fgets(STDIN));
	$a = explode(" ", trim(fgets(STDIN)));
	insertionSort($a, $n);

	function insertionSort($a, $n) {
		echo implode(" ", $a) . "\n";

		for ($i = 1; $i <= $n - 1; $i++) {
			$v = $a[$i];
			$j = $i - 1;

			while ($j >= 0 && $a[$j] > $v) {
				$a[$j + 1] = $a[$j];
				$j--;
				$a[$j + 1] = $v;
			}
			echo implode(" ", $a) . "\n";
		}
	}

Measured memory_bytes: 6632
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M,C;
  cin >> N >> M >> C;
  int sum=0;
  int B[M],A[M];
  for(int i=0;i<M;i++){
    cin >> B[i];
  }
  for(int i=0;i<N;i++){
    int bab=0;
    for(int j=0;j<M;j++){
      cin >> A[j];
      bab+=A[j]*B[j];
    }
    bab+=C;
    if(bab>0)sum+=1;
  }
  cout << sum <<endl;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define repp(i,n) for(int i=1;i<=n;i++)

const ll mod = 998244353;

int N,M,Q;
vector<int> E[100500];
int v[100500], d[100500], c[100500];
pii ans[100500];

void dfs(int x, int d, int c){
	if( ans[x].Se >= d ) return;

	if( ans[x].Fi == 0 ) ans[x].Fi = c;
	ans[x].Se = d;
	
	for(auto e : E[x]) if(d) dfs(e,d-1,c);
}

int main() {
	scanf("%d%d",&N,&M);
	repp(i,M){
		int a,b; scanf("%d%d",&a,&b);
		E[a].pb(b); E[b].pb(a);
	}
	repp(i,N) ans[i] = {0,-1};
	scanf("%d",&Q);
	repp(q,Q){
		scanf("%d%d%d",v+q,d+q,c+q);
	}

	for(int q=Q;q>=1;q--){
		dfs(v[q], d[q], c[q]);
	}

	for(int i=1;i<=N;i++) printf("%d\n",ans[i].Fi);
}


Measured memory_bytes: 8440
#include<iostream>
using namespace std;
int n,k,q,a,box[100005]={0};
int main(void){
	cin>>n>>k>>q;
	for(int i=0;i<q;i++){cin>>a;box[a]++;}
	for(int i=1;i<=n;i++){
		if(k-q+box[i]>0)cout<<"Yes\n";
		else cout<<"No\n";
	}
	return 0;
}

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

typedef long long LL;

LL A,B,C,D;
int tc;

int main()
{
   scanf("%d",&tc);
   while(tc--)
   {
      scanf("%lld%lld%lld%lld",&A,&B,&C,&D);
      if(A<B || D<B) printf("No\n");
      else if(C>=(B-1)) printf("Yes\n");
      else
      {
         D%=B;
         A%=B;
//         if(D%B==0)
//         {
//            printf("Yes\n");
//            continue;
//         }
         LL le = C+1;
         LL ri = B-1;
//         printf("AAA");
         LL tmp = __gcd(D,B);
//         cout << ">> " << tmp << endl;
         LL ah = B/tmp;
         ah--;
         A%=tmp;
//         if(A!=0) ah--;
         ah*=tmp;
         ah+=A;
//         cout << ah << endl;
         if(ah<=ri && ah>=le) printf("No\n");
         else printf("Yes\n");
      }
   }
 	return 0;
}
/*
1
14 10 8 12
*/

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define inf 10000000000000007
#define vsort(vec) sort(vec.begin(),vec.end())
#define vreverse(vec) reverse(vec.begin(),vec.end())
#define ggr getchar(); getchar();return 0;
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}

int n, m;
char a[50][50], b[50][50];
bool ta;

signed main() {
	cin >> n >> m;
	rep(i, n) {
		rep(j, n) {
			cin >> a[i][j];
		}
	}
	rep(i, m) {
		rep(j, m) {
			cin >> b[i][j];
		}
	}
	for (int i = 0; i <= n - m; i++) {
		for (int j = 0; j <= n - m; j++) {
			ta = true;
			for (int k = 0; k < m; k++) {
				for (int l = 0; l < m; l++) {
					if (a[i + k][j + l] != b[k][l])ta = false;
				}
			}
			if (ta) {
				cout << "Yes" << endl;
				ggr
			}
		}
	}
	cout << "No" << endl;
	ggr
}

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

    int main (){
        int n;
        cin >> n;
        vector<int> d(n);
        rep(i,n){
            cin >> d[i];
        }
        sort(d.begin(),d.end());

        int ans =  d[n/2]-d[n/2-1];

        cout << ans << endl;
        return 0;

    }

Measured memory_bytes: 3772
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
  char str[1024];
  int a[100];
  int len;

  fgets(str, 1024, stdin);
  len = (int)strtol(str, NULL, 10);
  //  printf("len: %d \n", len);

  fgets(str, 1024, stdin);
  int i=0;
  char *tok;
  char *strp = str;

  for (i=0; i<len; i++) {
    if (i != 0) strp = NULL;
    tok = strtok(strp, " ");
    //    printf("tok: %s\n", tok);
    a[i] = strtol(tok, NULL, 10);
  }

  for (i=len-1; i>=0; i--){
    printf("%d", a[i]);
    if (i != 0) printf(" ");
    else  printf("\n");
  }

  return 0;
}

Measured memory_bytes: 536
n, t = map(int, input().split())
ls = list(map(int, input().split()))
ms = []
m = ls[-1]
for x in ls[1:][::-1]:
    m = max(m, x)
    ms.append(m)
ms = ms[::-1]
ds = [m - x for x, m in zip(ls[:-1], ms)]
m = max(ds)
print(sum([1 for d in ds if d == m]))

Measured memory_bytes: 14252
#include "bits/stdc++.h"
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;

using namespace std;

// init {{{
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if (AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


const int NM = 201001;//ここを問題の制約を見ながらいじる．配列の確保に使う．
ll P[NM];//あまり褒められたことではないが関数の外側に配列を確保すると怒られにくい．
ll dp[NM];//あまり褒められたことではないが関数の外側に配列を確保すると怒られにくい．
ll A[NM];//あまり褒められたことではないが関数の外側に配列を確保すると怒られにくい．


ll MOD = 1000000007;
int digit_length(int num)
{
    int count = 0;
    while (num) {
        num = num / 10;
        ++count;
    }
    return count;
}


ll gcd(ll a, ll b) {
    ll v0 = a, v1 = b, v2 = a % b;
    while (v2 != 0) {
        v0 = v1;
        v1 = v2;
        v2 = v0 % v1;
    };
    return v1;
}


// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

//ll lcm(ll a, ll b) {
//    return a / (gcd(a, b) % MOD) * (b % MOD);
//}

ll lcm(ll a, ll b) {
    return( (a % MOD) *modinv(gcd(a, b), MOD) * (b % MOD)) % MOD;
}
       // Main program
void solve() {
    ll  H,A;
    cin >> H;
    cin >> A;

    cout << (int)ceil((double)H/(double)A);

    return;
    //ll  N;
    //cin >> N;
    //ll sum = 0;

    //ll Top = 0;
    //ll Bottom = 0;
    //ll Len = 0;

    //for (ll i = 1; i < N; i++) {
    //    Len = digit_length(i);
    //    Top = i / Len;
    //    Bottom = i %10;

    //    if (i < 10) {
    //        sum++;
    //        for (ll j = 1; j < 6; j++) {
    //            if (i >= Bottom * pow(10,j) + Top) {
    //                sum++;
    //            }
    //        }
    //    }
    //    else if (i < 100) {
    //        //sum++;
    //        for (ll j = 1; j < 6; j++) {
    //            if (i >= Bottom * pow(10, j) + Top) {
    //                sum++;
    //            }
    //        }
    //    }
    //    else if (i < 1000) {
    //        //sum+=10;
    //        for (ll j = 1; j < 6; j++) {
    //            if (i >= Bottom * pow(10, j) + Top) {
    //                sum++;
    //            }
    //        }
    //    }
    //    else if (i < 10000) {
    //        sum += 100;
    //    }
    //    else if (i < 100000) {
    //        sum += 1000;
    //    }
    //    else if (i < 1000000) {
    //        sum += 10000;
    //    }
    //}
    //cout << sum;
    //   
    //return;

}

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







Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#include <set>
#include <math.h>
#define pai 3.14159265358979323846264338327950288;
#define keta(n) cout << fixed << setprecision((n));
#define ll long long;
int main()
{
  int a, b;
  string op;
  while (true) {
    cin >> a >> op >> b;
    if (op == "?")
      break;
    if (op == "+") {
      cout << a + b << endl;
    }
    else if (op == "-") {
      cout << a - b << endl;
    }
    else if (op == "*") {
      cout << a * b << endl;
    }
    else if (op == "/" && b != 0) {
      cout << a / b << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3144
#ifdef LOCAL_BUILD
#include "pch.h"
#define DLOG(msg) cout << "#" << __LINE__ << ":" << msg << endl;
#else
#include <bits/stdc++.h>
#define DLOG(msg)
#endif
using namespace std;

template <typename T>
struct StackProcessor {
  StackProcessor() : m(new T[buffer_len]) {}

  template <typename F>
  void process(F f) {
    assert(index >= 2);
    auto rhs = pop();
    auto lhs = pop();
    put(f(lhs, rhs));
  }

  void put(T t) {
    assert(index < buffer_len);
    m[index++] = t;
  }

  T pop() {
    assert(index > 0);
    return m[--index];
  }

  constexpr static size_t buffer_len = 1024;
  unique_ptr<T[]> m;
  size_t index = 0;
};

int main() {
  string s;
  getline(cin, s);
  stringstream ss(s);

  StackProcessor<int> proc;

  while (ss >> s) {
    if (!s.compare("+")) {
      proc.process([](int lhs, int rhs) { return lhs + rhs; });
    } else if (!s.compare("-")) {
      proc.process([](int lhs, int rhs) { return lhs - rhs; });
    } else if (!s.compare("*")) {
      proc.process([](int lhs, int rhs) { return lhs * rhs; });
    } else {
      proc.put(stoi(s));
    }
  }
  cout << proc.pop() << endl;
}

Measured memory_bytes: 3208
fun main(args: Array<String>) {
    val n= readLine()!!.toInt()
    val a= readLine()!!.split(" ").map { it.toInt() }.sorted()

    val max = a.last()
    val half_r = a.dropLast(1).lowerBound((1+max)/2)
    val half_l = half_r-1
    if(half_l==-1) {
        println("$max ${a[0]}")
        return
    }
    val ans = if( Math.abs(max*0.5-a[half_l]) < Math.abs(max*0.5-a[half_r]) ) a[half_l] else a[half_r]
    println("$max $ans")

}

//ソート済みのListに対して、log(size)回の比較でelementより(真に)小さい要素の個数(element以上の要素が初めて現れるindex)を返す。
fun <T : Comparable<T>> List<T>.lowerBound(element: T, fromIndex: Int = 0, toIndex: Int = size): Int {
    var low = fromIndex
    var high = toIndex-1

    while (low < high) {
        val mid = (low + high).ushr(1)
        val cmp = get(mid).compareTo(element)

        if (cmp < 0)
            low = mid + 1
        else //(cmp >= 0)
            high = mid
    }
    return low
}

Measured memory_bytes: 55940
#include <iostream>
#include <vector>
#include <array>
#include <numeric>
#include <algorithm>
#include <set>
#include <deque>
using namespace std;
using ll = long long;
constexpr double INF{ 1e9 };
constexpr int MAGIC_PRIME{ 1000000000 + 7 };
constexpr array<int, 4> dy{ -1, 1, 0, 0 };
constexpr array<int, 4> dx{ 0, 0, -1, 1 };
constexpr int div_ru(int a, int b)
{
    return (a - b + 1) / b;
}
ll pow_mod(ll b, ll e, ll m)
{ // https://atcoder.jp/contests/atc002/tasks/atc002_b
    ll r = 1;
    for (; e > 0; e >>= 1)
    {
        if (e & 1)
            r = (r * b) % m;
        b = (b * b) % m;
    }
    return r;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<int> d(n);
    for (int& x : d)
        cin >> x;

    int m;
    cin >> m;
    vector<int> t(m);
    for (int& x : t)
        cin >> x;

    multiset<int> s;

    for (int x : t)
        s.insert(x);

    for (int x : d) {
        auto itr = s.find(x);
        if (itr != s.end())
            s.erase(itr);
    }

    if (s.empty())
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
// vector<vector<int>> mm(h, vector<int>(w, -1));


Measured memory_bytes: 11264
#include<iostream>

using namespace std;

int main(){
    int n, m, c;
    cin >> n >> m >> c;
    int b[m];
    int a[n][m];
    for(int i = 0; i < m; i++){
        cin >> b[i];
    }
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            cin >> a[i][j];
        }
    }
    int ans = 0;
    for(int i = 0; i < n; i++){
        int s = 0;
        for(int j = 0; j < m; j++){
            s += a[i][j] * b[j];
        }
        s += c;
        if (s > 0) {
            ans++;
        }
    }
    cout << ans << "\n";
    
}

Measured memory_bytes: 256
n = int(input())
a = []
a = input().split()
a = list(map(int,a))
num = 0
i = 0
flag = 1
while flag == 1:
    flag = 0
    for j in range(n-1, i, -1):
        if a[j] < a[j-1]:
            a[j], a[j-1] = a[j-1], a[j]
            flag = 1
            num = num + 1
    i = i + 1
print(*a)
print(num)




Measured memory_bytes: 5604
N = int(input())

A = list(map(int, input().split()))

def gcd(a,b):
    if b==0:return a
    return gcd(b,a%b)

freq = [0] * 1000005

for i in range(len(A)):
    freq[A[i]] += 1

pairwise = True

for i in range(2, 1000005):
    cnt = 0
    for j in range(i, 1000005, i):
        cnt += freq[j]
    # 2箇所以上に素因数が現れたら、pairwiseではない    
    if cnt > 1:
        pairwise = False

if pairwise:
    print("pairwise coprime")
    exit()

g = A[0]
for i in range(1, len(A)):
    g = gcd(g,A[i])
if g == 1:
    print("setwise coprime")
    exit()
    
print("not coprime")




Measured memory_bytes: 189276
#include<iostream>
using namespace std;
const int MAX_H=100,MAX_W=100;
char field[120][120];
int h,w,cnt;
const int dx[4]={1,-1,0,0},dy[4]={0,0,-1,1};
void dfs(int y,int x,char kind){
    if(y<0 || y>=h || x<0 || x>=w || field[y][x]!=kind)return;
    field[y][x]='.';
    for(int i=0;i<4;i++)dfs(y+dy[i],x+dx[i],kind);
    return;
}
int main(){
    while(cin>>h>>w){
        if(!w && !h)break;
        for(int i=0;i<h;i++)cin>>field[i];
        cnt=0;
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
              if(field[i][j]!='.'){
                cnt++;
                dfs(i,j,field[i][j]);
              }
            }
        }
        cout<<cnt<<endl;
    }
    return 0;
}

Measured memory_bytes: 1644
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vl>;
using vb=vector<bool>;
using vs=vector<string>;
using pll=pair<ll,ll>;
const ll oo =0x3f3f3f3f3f3f3f3fLL;
const double eps=1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define FOR(i,a,b) for(ll i=(a); i<(b); i++)
#define FORD(i,a,b) for(ll i=ll(b)-1;i>=(a);i--)
#define TR(X) ({if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })
int main(){
    cin.sync_with_stdio(0);

    string s, t;
    cin >> s >> t;
    ll minChanged = oo;
    FOR(i, 0, s.size() - t.size() + 1){
        ll changed = 0;
        FOR(j, 0, t.size()){
            if(s[i + j] !=  t[j])
                changed++;
        }
        if(changed < minChanged)
            minChanged = changed;
    }
    cout << minChanged << endl;
}

Measured memory_bytes: 3660
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC_D
{
    class D046
    {
        public static void Main(string[] args)
        {
            string s = Console.ReadLine();

            int numG = 0, numP = 0;
            for(int i = 0; i < s.Length; i++)
            {
                if (s[i] == 'g') numG++;
                else numP++;
            }
            //pの回数         
            int pA = s.Length / 2;
            Console.WriteLine(pA-numP);

        }

    }
}


Measured memory_bytes: 13144
#include <bits/stdc++.h>
using namespace std;
const int MM=3013;
long long dp[MM][MM];
long long s=0;
int main()
{
    ios_base::sync_with_stdio(0);
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)   cin>>dp[i][i];
    for(int i=1;i<=n;i++)
    {
        s+=dp[i][i];
        for(int j=1;j+i<=n;j++)
        {
            dp[j][j+i]=max(dp[j][j]-dp[j+1][j+i],dp[j+i][j+i]-dp[j][j+i-1]);
        }
    }
    cout<<dp[1][n];
    return 0;
}


Measured memory_bytes: 70016
#include <iostream>
#include <algorithm>
#include <string>

int main()
{
	int n;
	std::string s;
	std::cin >> n >> s;

	int maxcnt = 0;
	int maxidx = 0;
	for( int i = 0; i < n - 1; i++ ) {
		std::string a, b;
		a = s.substr( 0, i );
		b = s.substr( i );

		std::sort( a.begin(), a.end() );
		a.erase( std::unique( a.begin(), a.end() ), a.end() );

		std::sort( b.begin(), b.end() );
		b.erase( std::unique( b.begin(), b.end() ), b.end() );

		int cnt = 0;
		for( int j = 0; j < a.size(); j++ ) {
			for( int k = 0; k < b.size(); k++ ) {
				if( a[ j ] == b[ k ] ) {
					cnt += 1;
					break;
				}
			}
		}
		if( cnt > maxcnt ) {
			maxcnt = cnt;
			maxidx = i;
		}
	}

	std::cout << maxcnt << std::endl;
	return 0;
}


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

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;
const ll MOD = 1000000007;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : abs(x); }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : abs(x); }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	int n;
	cin >> n;

	vector<int> a(n);
	for (auto &v : a) {
		cin >> v;
	}

	vector<int> x(n);
	for (int i = n; i >= 1; i--) {
		int ball = 0;
		for (int j = i + i; j <= n; j+=i) {
			ball += x[j - 1];
		}

		x[i - 1] = ball % 2 != a[i - 1];
	}


	vector<int> b;
	for (int i = 0; i < n; i++) {
		if (x[i]) {
			b.push_back(i + 1);
		}
	}

	cout << b.size() << endl;
	for (int i = 0; i < (int)b.size(); i++) {
		if (i) cout << " ";
		cout << b[i];
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 3192
def main():
  s = int(input())
  ppp = pow(10, 9)
  y = (s+ppp-1)//ppp
  x = ppp*y - s
  print("%d %d %d %d %d %d" % (0, 0, ppp, 1, x, y))


if __name__ == '__main__':
  main()


Measured memory_bytes: 2940
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] strArgs) throws Exception {
		BufferedReader br = null;

		try {
			br = new BufferedReader(new InputStreamReader(System.in));

			String[] strValues = readValues(br);


			System.out.println(toInt(strValues[0]) * 2 * Math.PI);

		} finally {
			br.close();
		}
	}

	private static String[] readValues(BufferedReader br) throws IOException {
		return br.readLine().split("\\s");
	}

	private static int toInt(String str) {
		return Integer.parseInt(str);
	}
}


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

bool isOdd(long long x){
  return ((x&1) == 1);
}

bool isEven(long long x){
  return !isOdd(x);
}

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

  if (b - a < 10){
    long long ans = 0;
    while (a <= b){
      ans ^= a++;
    }
    cout << ans << endl;
    return 0;
  }

  long long a0, b0;

  if (isOdd(a)){
    a0 = a;
    a = a + 1;
  } else {
    a0 = 0;
  }

  if (isOdd(b)){
    b0 = 0;
  } else {
    b0 = b;
    b = b-1;
  }

  cerr << "# a0 = " << a0
       << " a = " << a
       << " b = " << b
       << " b0 = " << b0
       << endl;

  long long ans = (((b - a + 1) >> 1) & 1) ^ a0 ^ b0;
  cout << ans << endl;
}


Measured memory_bytes: 256
# your code goes he
#carrot 22 2298
N,K,T,U,V,L=(int(i) for i in input().split())
#r=int(input())
s=0
c=0
h=0
TV=T*V
D=[int(input()) for i in range(N)]
D.append(L)
r=D[0]
for i in range(N):
    h+=1
    if h>K:
        h-=1
        c=TV
    Ds=D[i+1]-D[i]
    if c>0:
        if Ds>c:
            Ds-=c
            s+=c
            c=0
        else:
            c-=Ds
            s+=Ds
            Ds=0
    while Ds>0 and h>0:
        h-=1
        if Ds>TV:
            Ds-=TV
            s+=TV
        else:
            c=TV-Ds
            s+=Ds
            Ds=0
    if Ds>0:
        r+=Ds
r/=U
s/=V
print(r+s)

Measured memory_bytes: 7784
N, M, K = list(map(int, input().split()))
p = [0] * N # p[][0] 友達リスト　p[][1] ブロックリスト p[][2] 所属グループ(-1はなし)
for i in range(N):
    p[i] = [0]*3
    p[i][0] = []
    p[i][1] = []
    p[i][2] = -1
g = [] # グループのサイズ
stack = []
groupNum = 0
fcs = []

for i in range(M):
    a, b = list(map(int, input().split()))
    p[a-1][0].append(b-1)
    p[b-1][0].append(a-1)

def groupmake(person,group):
    groupSize = 0
    stack.append(person)
    p[person][2] = group
    while True:
        num = stack.pop()
        groupSize += 1
        for i in p[num][0]:
            if p[i][2] == -1:
                stack.append(i)
                p[i][2] = group
        if len(stack) == 0:
            return groupSize

for i in range(len(p)):
    if p[i][2] == -1:
        g.append(groupmake(i, groupNum))
        groupNum += 1

for person in p:
    fcs.append(g[person[2]] - len(person[0]) -1)

for i in range(K):
    c, d = list(map(int, input().split()))
    if p[c-1][2] == p[d-1][2]:
        fcs[c-1] -= 1
        fcs[d-1] -= 1

print(" ".join(map(str, fcs)))

Measured memory_bytes: 53956
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()
struct revran {
  const i64 b, e;
  struct iter {
    i64 i;
    constexpr iter(const i64 i) noexcept: i(i) {}
    void operator++() noexcept { --i; }
    constexpr i64 operator*() const noexcept { return i; }
    constexpr bool operator!=(const iter x) const noexcept { return i != x.i; }
  };
  constexpr revran(const i64 e) noexcept: b(0), e(e) {}
  constexpr revran(const i64 b, const i64 e) noexcept: b(b), e(e) {}
  constexpr iter begin() const noexcept { return iter(e - 1); }
  constexpr iter end() const noexcept { return iter(b - 1); }
};

struct ran {
  const i64 b, e;
  struct iter {
    i64 i;
    constexpr iter(const i64 i) noexcept: i(i) {}
    void operator++() noexcept { ++i; }
    constexpr i64 operator*() const noexcept { return i; }
    constexpr bool operator!=(const iter x) const noexcept { return i != x.i; }
  };
  constexpr ran(const i64 e) noexcept: b(0), e(e) {}
  constexpr ran(const i64 b, const i64 e) noexcept: b(b), e(e) {}
  constexpr iter begin() const noexcept { return iter(b); }
  constexpr iter end() const noexcept { return iter(e); }
  constexpr revran rev() const noexcept { return revran(b, e); }
};

constexpr ran rin(const i64 e) noexcept { return ran(1, e + 1); }
constexpr ran rin(const i64 b, const i64 e) noexcept { return ran(b, e + 1); }

i64 cnt(i64 n) {
  i64 c = 0;
  i64 d = 0;
  for(int i = 2;i * i <= n;i++) {
    if(n % i == 0) {
      d++;
      while(n % i == 0) {
        n /= i;
        c++;
      }
    }
  }
  if(n != 1) {
    d++;
    c++;
  }
  if(d <= 1) {
    return c >= 4;
  }
  else {
    return c >= 3;
  }
}

int main() {
  i64 Q;
  cin >> Q;
  vector<i64> sum(101010, 0);
  for(int i = 2;i <= 100000;i++) {
    sum[i] = sum[i - 1] + cnt(i);
  }
  for(int q =0;q < Q;q++) {
    i64 n;
    cin >> n;
    cout << sum[n] << endl;
  }
}



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

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;

typedef tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl "\n"

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) 
{
    os << "{ ";
    for(auto& y : x) 
    {
        os << y << " ";
    }
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) 
{
    return os << "[" << p.ff << ", " << p.ss << "]";
}

const ll L = 1e5+5;

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

    return gcd(b, a%b);
}

ll modexp(ll a, ll b, ll c)
{   
    a%=c;

    ll ans = 1;

    while(b)
    {
        if(b&1)
        {
            ans = (ans*a)%c;
        }

        a = (a*a)%c;
        b >>= 1;
    }

    return ans;
}

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

    ll N;
    cin >> N;

    vector <string> s;

    for(ll i=0; i<N; i++)
    {
        string v;
        cin >> v;

        sort(all(v));

        s.pb(v);
    }

    sort(all(s));

    ll cur = 1;

    ll ans = 0;

    for(ll i=1; i<N; i++)
    {
        if(s[i] != s[i-1])
        {
            ans+=((cur*(cur-1))/2);
            cur = 1;
        }

        else
        {
            cur++;
        }
    }

    ans+=((cur*(cur-1))/2);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 5748
#include <iostream>
#include <fstream>

using namespace std;

#define ll long long
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))

int main()
{
  int a, b, t, sum = 0, current = 0;
  cin >> a >> b >> t;
  while(current + a <= t){
    current += a;
    sum += b;
  }
  cout << sum;

  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define mod 1000000007
#define ll long long
#define cases ll t;cin>>t;while(t--)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)


int main(){
    fast;
    ll i,j,k,n,l,r,m;
    cin>>n>>m;
    l=0;
    for(i=0;i<m;i++){
        cin>>k;
        l+=k;
    }
    cout<<max(-1LL,n-l);

    return 0;
}



Measured memory_bytes: 3652
#include <algorithm>
#include <iostream>

bool is_triangle(int l, int m, int n) {
  int sides[] = { l, m, n };
  std::sort(sides, sides + 3);
  return sides[0] * sides[0] + sides[1] * sides[1] == sides[2] * sides[2];
}

int main() {
  int n;
  std::cin >> n;
  for (int i = 0; i < n; ++i) {
    int l, m, n;
    std::cin >> l >> m >> n;
    std::cout << (is_triangle(l, m, n) ? "YES" : "NO") << std::endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define ll long long
//map<key,value>

int main(){
  int n,ans=0;
  cin >> n;
  vector<int>p(n);
  for(int i=0;i<n;i++) cin >> p[i];
  for(int i=0;i<n-2;i++){
    if((p[i] <= p[i+1] && p[i+1] <= p[i+2]) || (p[i] >= p[i+1] && p[i+1] >= p[i+2])){
      ans++;
  }
}
  cout << ans;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define Clear(a) a = decltype(a)();
typedef long long ll;
typedef pair<int,int> p;
ll max(ll x,ll y){
if(x>y)return x;
else return y;
}
ll min(ll x,ll y){
if(x<y)return x;
else return y;
}
//const ll big=998244353;
const ll big=1000000007;
ll expm(ll x,ll y){
    if(y==0)return 1;//0^0=1
    if(x==1||x==0)return x;
    if(y%2==1)return (expm(x,y-1)*x)%big;
    ll t=expm(x,y/2);
    return (t*t)%big;
}
ll exp(ll x,ll y){
    if(y==0)return 1;//0^0=1
    if(x==1||y==0)return x;
    if(y%2==1)return exp(x,y-1)*x;
    ll t=exp(x,y/2);
    return t*t;
}
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
ll in(ll x){
    return exp(x,big-2);
}


int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(0);
    /*--------------------------------*/
    
    string s;cin >> s;
    string ans="";
    rep(i,s.size()){
        if(s[i]=='0'||s[i]=='1')ans.push_back(s[i]);
        else {
            if((int)ans.size()!=0)ans.pop_back();
            else continue;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3624
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ProblemE
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = long.Parse(Console.ReadLine());
            var As = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList();
            long xorSumA = 0;
            for (int i = 0; i < N; i++)
                xorSumA ^= As[i];
            var Bs = As.Select(a => xorSumA ^ a).ToArray();
            Console.WriteLine(String.Join(" ", Bs));
        }
    }
}


Measured memory_bytes: 68320
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readStr() -> [String] {
  let str:String = readLine()!
  let arr:[String] = str.components(separatedBy: " ")
  return arr
}

let abk=readInts()
let a=abk[0]
var b=abk[1]
let k=abk[2]
let ak=max(0,a-k)
if(a<k) {b=max(0,a+b-k)}
print("\(ak) \(b)")

Measured memory_bytes: 13632
#include <stdio.h>
#include <math.h>

int main(void){
    // Your code here!
    double  x1,x2,y1,y2,distance;
    scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
    
    distance=sqrt((pow(x2-x1, 2))+(pow(y2-y1,2)));
    printf("%lf\n", distance);
    
    return 0;
    
}



Measured memory_bytes: 2144
#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <set>
#include <numeric>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <cstring>
#include <queue>
#include <numeric>
#include <iomanip>
#define ll long long
using namespace std;
int n,m;
string s[505];
int sy,sx,ey,ex;
struct edge{
    int to,cap,rev;
};
vector<edge> adj[505];
int level[505],iter[505];
void bfs(int s){
    memset(level, -1,sizeof(level));
    queue<int> q; q.push(s); level[s]=0;
    while(!q.empty()){
        int here = q.front(); q.pop();
        for(int i=0;i<adj[here].size();i++){
            edge &e =adj[here][i];
            if(e.cap > 0){
                if(level[e.to] == -1){
                    level[e.to] = level[here]+1;
                    q.push(e.to);
                }
            }
        }
    }
}
int dfs(int t,int here,int f){
    if(t == here)return f;
    for(int &i=iter[here];i<adj[here].size();i++){
        edge & e=adj[here][i];
        if(e.cap > 0 && level[e.to] > level[here]){
            int d =dfs(t,e.to,min(f,e.cap));
            if(d>0){
                e.cap-=d; adj[e.to][e.rev].cap+=d;
                return d;
            }
        }
    }
    return 0;
}
int maxFlow(int source,int sink){
    int f=0;
    while(true){
        bfs(source);
        if(level[sink]==-1)return f;
        int r=1;
        memset(iter,0,sizeof(iter));
        while(r){
            r = dfs(sink,source,1e9);
            f+=r;
        }
    }
}
void addEdge(int from,int to,int cap){
    adj[from].push_back({to,cap,(int)adj[to].size()});
    adj[to].push_back({from,cap,(int)adj[from].size()-1});
}
int main(){
    ios::sync_with_stdio(false); cin.tie(0);
    cin>>n>>m;
    for(int i=0;i<n;i++){
        cin>>s[i];
    }
    int source = n+m+5; int sink=source+1;
    for(int i=0;i<n;i++)for(int j=0;j<m;j++){
        if(s[i][j] == 'S'){
            addEdge(source,i,1e9);
            addEdge(i,j+n,1e9);
         //   addEdge(source,j+n,1e9);
        }
        else if(s[i][j]=='T'){
           // addEdge(i,sink,1e9);
            addEdge(j+n,sink,1e9);
            addEdge(i,j+n,1e9);
        }
        else if(s[i][j]=='o'){
            addEdge(i,j+n,1);
        }
    }
    int min_cut = maxFlow(source,sink);
    if(min_cut>=1e9)min_cut=-1;
    cout<<min_cut;
    return 0;
}

Measured memory_bytes: 640
n = int(input())
list = list(map(int, input().split()))

c = 0
ex_o = False
while (True):
    for x in range(n):
        if list[x] % 2 == 1:
            ex_o = True
    
    if ex_o:
        break

    for x in range(n):
        list[x] /= 2

    c += 1

print(c)

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

struct union_find{
	int N;
	vector<int> parent;
	vector<int> siz;

	union_find(int N) : parent(N), siz(N, 1){
		for (int i = 0; i < N; i++) parent[i] = i;
	}

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

	void merge(int x, int y){
		x = root(x), y = root(y);
		if(x == y) return;
		if(siz[x] < siz[y]) swap(x, y);
		parent[y] = x;
		siz[x] += siz[y];
		siz[y] = 0;
	}

	bool are_same(int x, int y){
		return root(x) == root(y);
	}

	int size(int x){
		return siz[root(x)];
	}
};

signed main(){
	int H, W, i, j;
	scanf("%lld%lld", &H, &W);
	vector<string> S(H);
	for(i = 0; i < H; i++){
		cin >> S[i];
	}
	union_find uf(H * W);
	for(i = 0; i < H; i++){
		for(j = 1; j < W; j++){
			if(S[i][j - 1] != S[i][j]){
				uf.merge(i * W + (j - 1), i * W + j);
			}
		}
	}
	for(i = 1; i < H; i++){
		for(j = 0; j < W; j++){
			if(S[i - 1][j] != S[i][j]){
				uf.merge((i - 1) * W + j, i * W + j);
			}
		}
	}
	vector<int> black(H * W, 0), white(H * W, 0);
	for(i = 0; i < H * W; i++){
		if(S[i / W][i % W] == '#'){
			black[uf.root(i)]++;
		}
		else{
			white[uf.root(i)]++;
		}
	}
	int ans = 0;
	for(i = 0; i < H * W; i++){
		ans += black[i] * white[i];
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 5504
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

const int N = 2e3+3;

int n, k, q;
int a[N];
int res = INT_MAX;

#define x first
#define y second

typedef tree<pair<int, int>,null_type,less< pair< int, int > >,rb_tree_tag,tree_order_statistics_node_update> order_set;
 
order_set X;

void dothething(int pos) {
	// cout << '\n';
	int c = 0;
	X.clear();
	multiset<int> tem;
	for (int i = 1; i <= n+1; i++) {
		// cout << tem.size() << " ";
		if (a[i] < a[pos]) {
			while (!tem.empty()) {
				if (tem.size() >= k) {
					c++;
					X.insert({*tem.begin(), c});
				}
				tem.erase(tem.begin());
			}
		}
		else {
			tem.insert(a[i]);
		}
	}	
	if (X.size() >= q) {
		res = min(res, abs(a[pos] - (*X.find_by_order(q-1)).x));
	}
}

signed main() {
	scanf("%d%d%d", &n, &k, &q);
	a[n+1] = -1;
	for (int i = 1; i <= n; i++) {
		scanf("%d", &a[i]);
	}
	for (int i = 1; i <= n; i++) {
		dothething(i);
	}
	cout << res;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
//#include <algorithm>
//#include <vector>
//#include <numeric>
//#include <tuple>
#include <cstdio>

typedef long long ll;
using namespace std;
string s;

int main() {
   cin >> s;
   if (s.size() == 1) {
      cout << 0 << endl;
      return 0;
   }
   
   int bc = 0;
   long long co = 0;
   //cout << s.size() << endl;
   for (int i=(int)s.length()-1;i>=0;i--) {
      if (s[i] == 'B') {
         bc++;
         co += (long long)(s.size() - i-bc);
      }
   }
   cout << co << endl;
}


Measured memory_bytes: 1336