akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

class Main
{
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int[] a = new int[n+2];
        
        a[0] = 0;
        a[n+1] = 0;
        int sum = 0;
        for(int i=1; i<n+1; i++){
            a[i] = sc.nextInt();
        }     
        for(int i=1; i<n+2; i++){
            sum += ( Math.abs(a[i] - a[i-1]) );
        }

        for(int i=1; i<n+1; i++){
            System.out.println(sum + Math.abs(a[i+1] - a[i-1]) - Math.abs(a[i+1] - a[i]) - Math.abs(a[i] - a[i-1]) );
        }

    }
}

Measured memory_bytes: 63108
#include<bits/stdc++.h>
using namespace std;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
 
	long long a, b, x;
	cin >> a >> b >> x;
 
	cout << b/x+1-(a>0?(a-1)/x+1:0) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
static const int MAX=100000;
ll N,cunt_a,cunt_c;
ll A[MAX],B[MAX],C[MAX];
int main(){
    cin>>N;

    for(ll i=0ll;i<N;i++) cin>>A[i];
    for(ll i=0ll;i<N;i++) cin>>B[i];
    for(ll i=0ll;i<N;i++) cin>>C[i];

    sort(A,A+N);
    sort(C,C+N);

    ll ans=0ll;
    for(ll i=0ll;i<N;i++){
        cunt_a=lower_bound(A,A+N,B[i])-A;
        cunt_c=C+N-upper_bound(C,C+N,B[i]);

        ans+=cunt_a*cunt_c;
    }

    cout<<ans<<"\n";

    return 0;
}


Measured memory_bytes: 2688
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ld long double
#define dd double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
typedef long long ll;
typedef unsigned long long ull;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;
typedef vector<pll> vplll;
ll mod = 1e9+7;
const ld PI = 2 * acos(0.0);
const vector<ll> dx = {1, -1, 0, 0};
const vector<ll> dy = {0, 0, 1, -1};
#define round(x, y) ((x + y - 1) / y)
#define ce(x, y) ((x + y - 1) / y)
#define amax(x, y) \
    if (y > x)     \
        x = y;
#define amin(x, y) \
    if (y < x)     \
        x = y;
#define lcm(x, y) ((x) * (y) / __gcd(x, y))
#define len(x) (ll) x.length()
#define sq(x) ((x) * (x))
#define cb(x) ((x) * (x) * (x))
ll dp[1002][1002];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a,b,c,t,n,m,k,q; 
    t = 1;
    // cin>>t;
    while(t--)
    {
    	cin>>a>>b;
    	string s[a];
    	for(int i=0;i<a;i++)
    	{
    		cin>>s[i];
    		// cout<<s[i]<<endl;
    	}

    	dp[a][b] = 1;
    	for(int i=a-1;i>=0;i--)
    	{
    		for(int j=b-1;j>=0;j--)
    		{
    			if(i+j==a+b-2)
    				continue;
    			if(s[i][j]=='.')
    			{
    				// int l1 = min(i+2,a);
    				// int l2 = min(j+2,b);
    				dp[i+1][j+1] = dp[i+2][j+1] + dp[i+1][j+2];
    				dp[i+1][j+1]%=mod;
    			}
    		}
    	}
    	cout<<dp[1][1]<<endl;
    }
    return 0;
}

Measured memory_bytes: 9216
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ for(auto it : P) { s << "<" << it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ for(auto it : P) { s << "<" << it.first << "->" << it.second << "> "; } return s << endl; }



int main() {
    int N, K;
    cin >> N >> K;
    int res = 0;
    while (N) {
        ++res;
        N /= K;
    }
    cout << res << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int P, Q, R, ab, pq, qr, pr;
    cin >> P >> Q >> R;
    pq = P + Q;
    qr = Q + R;
    pr = P + R;
    if(pq <= pr && pq <= qr) {
        cout << pq << endl;
    } else if(pr <= pq && pr <= qr) {
        cout << pr << endl;
    }else {
        cout << qr << endl;
    }
}

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

using namespace std;

#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define pb emplace_back
#define ll long long
#define ld long double

const int INF = 2e9 + 1;
const ll INFLL = 1e18 + 1;
const int mod = 1e9 + 7;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int x, y, z;
    cin >> x >> y >> z;
    swap(x, y);
    swap(x, z);
    cout << x << " " << y << " " << z;
    return 0;
}


Measured memory_bytes: 3652
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

int32_t nextint(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); bool s=false; if(c=='-'){s=true;c=getchar_unlocked();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); int s=0; if(c=='-'){s=1;c=getchar_unlocked();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; }

void rsort(void *base, const int count){
	uint64_t *a=base;
	uint64_t *b=malloc(count*sizeof(uint64_t));
	int c[0x100];
	for(int k=0; k<8; k++){
		memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i]>>(k<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ b[--c[(a[i]>>(k<<3))&0xFF]]=a[i]; }{void *t=a; a=b; b=t;}
	}
	free(b);
}

int prev1[200001], rank1[200001];
int prev2[200001], rank2[200001];

void init(int n){
	for(int i=1; i<=n; i++){ prev1[i]=i; rank1[i]=1; }
	for(int i=1; i<=n; i++){ prev2[i]=i; rank2[i]=1; }
}
int root1(int x){
	return prev1[x]==x?x:(prev1[x]=root1(prev1[x]));
}
int root2(int x){
	return prev2[x]==x?x:(prev2[x]=root2(prev2[x]));
}
void join1(int x, int y){
	x=root1(x), y=root1(y);
	if(x==y) return;
	if(rank1[x]<rank1[y]){
		prev1[x]=y;
	}else if(rank1[x]>rank1[y]){
		prev1[y]=x;
	}else{
		prev1[x]=y;
		rank1[y]++;
	}
}
void join2(int x, int y){
	x=root2(x), y=root2(y);
	if(x==y) return;
	if(rank2[x]<rank2[y]){
		prev2[x]=y;
	}else if(rank2[x]>rank2[y]){
		prev2[y]=x;
	}else{
		prev2[x]=y;
		rank2[y]++;
	}
}

int n;
long d[200001];
long s[200001];
int bs(long k){
	int l=1, r=n;
	while(l<=r){
		int m=(l+r)/2;
		if(s[m]>=k) r=m-1; else l=m+1;
	}
	return l;
}
int main(void){
	n=nextint();
	int k=nextint();
	int l=nextint();
	init(n);
	for(int i=0; i<k; i++){
		int a=nextint();
		int b=nextint();
		join1(a, b);
	}
	for(int i=0; i<l; i++){
		int a=nextint();
		int b=nextint();
		join2(a, b);
	}
	for(int i=1; i<=n; i++){
		int k1=root1(i);
		int k2=root2(i);
		s[i]=d[i]=(long)k1*n+k2;
	}
	rsort(s+1, n);
	for(int i=1; i<=n; i++){
		int ans=bs(d[i]+1)-bs(d[i]);
		printf("%d ", ans);
	}
	putchar(10);
}


Measured memory_bytes: 7936
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        #[allow(unused_mut)]
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        m: usize,
        d: [(usize1, isize); m]
    }
    let mut v = vec![10; n];
    for (s, c) in d {
        if v[s] == 10 || v[s] == c {
            v[s] = c;
        } else {
            v.clear();
            v.push(-1);
            break;
        }
    }
    v[0] = if v[0] == 10 {
        if n == 1 {
            0
        } else {
            1
        }
    } else {
        v[0]
    };
    let ans = v
        .into_iter()
        .map(|vi| if vi == 10 { 0 } else { vi })
        .fold(0, |ans, vi| ans * 10 + vi);
    println!("{}", if ans == 0 && n >= 2 { -1 } else { ans });
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
// マクロ
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
// 型エイリアス
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vvs = vector<vs>;

int main() {
    int a, b, c;
    cin>> a >> b >> c;
    cout << max({a,b,c}) - min({a,b,c}) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<fstream>
#include<sstream>
#include<cstdio>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<cstdlib>
#include<climits>
#include<utility>
#include<cctype>
using namespace std;

#define ull unsigned long long
#define ll long long
#define rep(i,j) for(int i=0;i<j;++i)
#define loop(i,a,j) for(int i=a;i<j;++i)
#define mpi(it,table,T,E) for(map<T,E>::iterator it = table.begin();it!=table.end();++it)
#define PI 3.141592654
/*
ifstream fin("input.txt");
ofstream fout("output.txt");
#define cin fin
#define cout fout
*/


int main(){
	int a,b,n;
	while(scanf("%d %d %d",&a,&b,&n) != EOF){
		int r = 0;
		double frac = 1.0*a/b;
		rep(i,n){
			a *= 10;
			r += (a/b)%10;
			a = a%b;	
		}
		printf("%d\n",r);
	}	
	return 0;
}

Measured memory_bytes: 1188
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <cmath>
#include <map>
using namespace std;

typedef long long ll;

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

int main() {
  int N;
  int i;
  cin >> N >> i;
  cout << N - i + 1 << endl;

  return 0;
}


Measured memory_bytes: 256
import numpy as np
t1,t2 = map(int, input().split())
a1,a2 = map(int, input().split())
b1,b2 = map(int, input().split())
# まず大きい方にswap
if a1 <= b1:
    a1,b1 = b1,a1
    a2,b2 = b2,a2

# t1での距離
x1 = a1*t1 - b1*t1
# t2での距離
x2 = x1 + a2*t2 - b2*t2
if x2 == 0:
    print("infinity")
elif x2 > 0:
    print(0)
else:
    ans =  int(np.ceil(x1/abs(x2))*2)
    if x1 % abs(x2) != 0:
        ans -= 1
    print(ans)

Measured memory_bytes: 14448
#include <iostream>
#include <iomanip>
#include <math.h>
#include <string>
#include <algorithm>
//#include <ctype.h>
#include <vector>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <bitset>
using namespace std;

#define ll long long int
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repm(i, a, n) for (int i = a; i >= n; i--)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vs vector<string>
#define vii vector<vector<int>>
#define vll vector<ll>
#define vllll vector<vector<ll>>
#define vd vector<double>
#define ALL(a) (a).begin(), (a).end()
#define sort_v(a) sort(a.begin(), a.end())
#define reverse_v(a) reverse(a.begin(), a.end())
#define fi first
#define se second

void print(bool c)
{
    (c) ? (cout << "Yes" << endl) : (cout << "No" << endl);
}

void Print(bool c)
{
    (c) ? (cout << "YES" << endl) : (cout << "NO" << endl);
}

//最小公倍数
template <typename T>
T gcd(T a, T b)
{
    while (1)
    {
        if (a < b)
            swap(a, b);
        if (b == 0)
            break;
        a %= b;
    }
    return a;
}

//最大公約数
template <typename T>
T lcm(T a, T b)
{
    return a * b / gcd(a, b);
}
//セカンドキー->ファーストキーの順ソート
bool cmp(const pii &a, const pii &b)
{
    if (a.second != b.second)
        return a.second < b.second;
    return a.first < b.first;
}

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

int main(void)
{
    ll n, m;
    cin >> n >> m;
    vll path1(n), path2(n);

    ll a, b;
    rep(i, 0, m)
    {
        cin >> a >> b;
        a--, b--;
        if (a == 0)
            path1[b] = 1;
        if (b == n - 1)
            path2[a] = 1;
    }
    bool f = false;
    rep(i, 1, n - 1)
    {
        if (path1[i] && path2[i])
            f = true;
    }
    cout << (f ? "POSSIBLE" : "IMPOSSIBLE") << endl;
}

Measured memory_bytes: 3328
//code by lynmisakura.wish to be accepted!
/****************************/
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<algorithm>
#include<bitset>
#include <climits>
#include<set>
#include<bitset>
using namespace std;
/***************************/
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int, int> pi;
typedef vector<pair<int, int>> vpi;
 
//const long long INF = 1LL << 55;
 
#define itn int
#define endl '\n'
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ss second
#define ff first
#define dup(x,y) ((x) + (y) - 1)/(y)
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define all(x) (x).begin(),(x).end()
#define Rep(n) for(int i = 0;i < n;i++)
#define rep(i,n) for(int i = 0;i < n;i++)
#define rrep(i,n) for(int i = n - 1;i >= 0;i--)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define ioboost cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20)
 
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll qp(ll a, ll b) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; }
ll qp(ll a, ll b, int mo) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }
 
#define _GLIBCXX_DEBUG
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int h,w,d;
vector<pair<int,int>> cost_map(310*310);
vector<int> tour_modd[310*310];
int main(void){
   scanf("%d %d %d",&h,&w,&d);
   for(int i = 0;i < h;i++){
      for(int j = 0;j < w;j++){
         int a;scanf("%d",&a);
         a--;
         cost_map[a] = mp(i,j);
      }
   }
   for(int i = 0;i < d;i++){
      tour_modd[i].pb(0);
      for(int j = 1;i + d*j < h*w;j++){
         int next_x = cost_map[i + d*j].ff;
         int next_y = cost_map[i + d*j].ss;
         int prev_x = cost_map[i + d*(j-1)].ff;
         int prev_y = cost_map[i + d*(j-1)].ss;
         
         tour_modd[i].pb(tour_modd[i].back() + abs(next_x - prev_x) + abs(next_y - prev_y));
      }
   }
   
   int q;scanf("%d",&q);
   rep(i,q){
      int l,r;scanf("%d%d",&l,&r);
      l--,r--;
      int m = l % d;
      int idx_l = (l - m)/d;
      int idx_r = (r - m)/d;
      printf("%d\n",tour_modd[m][idx_r] - tour_modd[m][idx_l]);
   }
   
}

Measured memory_bytes: 6272
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (ll i=0;i<N;i++)
#define loop(i,N,M) for(ll i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

ll A, B, C, T, N, M, Q, X, Y, Z;
string S;
vector<ll> vec;

void solve() {
	cin >> N;
	vec.resize(N);
	rep(i, N) cin >> vec[i];

	ll max0 = 0;
	ll max1 = 0;
	ll max_cnt = 0;

	rep(i, N) {
		if (vec[i] > max0) {
			max1 = max0;
			max0 = vec[i];
			max_cnt=1;
		}
		else if (vec[i] == max0) {
			max_cnt++;
		}
		else if (vec[i] > max1){
			max1 = vec[i];
		}
	}

	if (max_cnt != 1) {
		rep(i, N) {
			cout << max0 << endl;
		}
	}
	else {
		rep(i, N) {
			if (vec[i] == max0) {
				cout << max1 << endl;
			}
			else {
				cout << max0 << endl;
			}
		}
	}


}

int main() {
	solve();
	cout << endl;
	return 0;
}


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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    rep(i, s.size()) {
        cout << 'x';
    }
    cout << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <complex>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <functional>
#include <iterator>

using namespace std;

#define dump(n) cerr<<"# "<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define iter(c) __typeof__((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();++i)
#define all(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	for(string a,b,c;cin>>a>>b>>c;){
		vi isr(128);
		rep(i,a.size()) isr[a[i]]=true;
		
		string res;
		int i=0,j=1;
		char cur=b[0];
		rep(k,c.size()){
			if(!isr[c[k]]){
				while(cur!=c[k]){
					res+=cur;
					cur=b[j++];
				}
			}
			cur=a[i++];
		}
		res+=cur;
		while(j<b.size())
			res+=b[j++];
		cout<<res<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 1188
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

const int nmax = 1e9 + 7;
const long long INF = 1e18;
const double PI = 2 * asin(1);
typedef long long ll;


int main(){
  int X[2]; cin >> X[0] >> X[1];
  int ans = 0;
  for (int i = 0; i < 2; i++){
    if (X[i] == 1){
      ans += 300000;
    }else if(X[i] == 2){
      ans += 200000;
    }else if(X[i] == 3){
      ans += 100000;
    }
  }
  if (X[0] == 1 && X[1] == 1){
    ans += 400000;
  }
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<deque>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<cmath>
#include<cstring>
using namespace std;
int main(){
  int i,j,k;
  int n;
  cin>>n;
  for(i=0;i<n;++i){
    char s[7],t[26];
    cin>>s>>t;
    int sln=strlen(s);
    int tln=strlen(t);
    for(j=sln-1;j>=0;--j){
      if(0){
      }else if(s[j]=='J'){
	char u=t[tln-1];
	for(k=tln-1;k>0;--k)
	  t[k]=t[k-1];
	t[0]=u;
      }else if(s[j]=='C'){
	char u=t[0];
	for(k=1;k<tln;++k)
	  t[k-1]=t[k];
	t[tln-1]=u;
      }else if(s[j]=='E'){
	char u[12];
	memcpy(u,t,tln/2*sizeof(char));
	memcpy(t,t+(tln+1)/2,tln/2*sizeof(char));
	memcpy(t+(tln+1)/2,u,tln/2*sizeof(char));
      }else if(s[j]=='A'){
	char u[26];
	for(k=0;k<tln;++k)
	  u[k]=t[tln-k-1];
	memcpy(t,u,tln*sizeof(char));
      }else if(s[j]=='P'){
	for(k=0;k<tln;++k){
	  if(0){
	  }else if(t[k]=='0'){
	    t[k]='9';
	  }else if('1'<=t[k]&&t[k]<='9'){
	    --t[k];
	  }
	}
      }else if(s[j]=='M'){
	for(k=0;k<tln;++k){
	  if(0){
	  }else if(t[k]=='9'){
	    t[k]='0';
	  }else if('0'<=t[k]&&t[k]<='8'){
	    ++t[k];
	  }
	}
      }
    }
    cout<<t<<endl;
  }
  return 0;
}

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

#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef double ld;

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

int main() {
	int n; scanf("%d", &n);
	int ans = 0;
	for1(j, n) {
		int i = j;
		int total = 1;
		while(i /= 10)
			total++;
		if(total % 2 == 1)
			ans++;
	}
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 256
/*problem C*/

#include <iostream>
using namespace std;

typedef struct{
	double x,y;
}point_obj;

int isClossLine(double x1,double y1,double x2,double y2,double x3,double y3,double x4,double y4){
	return ( (x1-x2)*(y3-y1)+(y1-y2)*(x1-x3))*((x1-x2)*(y4-y1)+(y1-y2)*(x1-x4));
}

int main(){
	point_obj p[5];
	int i,j;
	p[3].x=0;
	p[3].y=0;

	while(cin>>p[0].x){
		cin>>p[0].y;

		p[3].x=p[0].x;
		p[3].y=p[0].y;

		for(int i=1;i<3;i++){
			cin>>p[i].x,cin>>p[i].y;

			p[3].x+=p[i].x;
			p[3].y+=p[i].y;
		}
		cin>>p[4].x;
		cin>>p[4].y;
		p[3].x/=3.0;
		p[3].y/=3.0;

		if(isClossLine(p[0].x,p[0].y,p[1].x,p[1].y,p[3].x,p[3].y,p[4].x,p[4].y) > 0 &&
			isClossLine(p[1].x,p[1].y,p[2].x,p[2].y,p[3].x,p[3].y,p[4].x,p[4].y) >0 &&
			isClossLine(p[0].x,p[0].y,p[2].x,p[2].y,p[3].x,p[3].y,p[4].x,p[4].y) > 0){
			cout<<"YES"<<endl;
		}

		else{
			cout<<"NO"<<endl;
		}
	}
	
	
	return 0;
}

Measured memory_bytes: 1216
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
using namespace std;

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

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		HashSet<Integer> hs = new HashSet<Integer>();
		for(int i = 0; i < n; i++){
		    int a = sc.nextInt();
		    hs.add(a);
		}
		
		// 計算
		int result = 0;
		result = hs.size();
		if(result%2 == 0) result--;
		
		// 出力
		System.out.println(result);
	}
	
	public static class Scanner {
		private BufferedReader br; private StringTokenizer tok;
		public Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is));}
		private void getLine() throws IOException { while(!hasNext()) tok = new StringTokenizer(br.readLine());}
		private boolean hasNext() { return tok != null && tok.hasMoreTokens();}
		public String next() throws IOException { getLine(); return tok.nextToken();}
		public int nextInt() throws IOException { return Integer.parseInt(next());}
		public long nextLong() throws IOException { return Long.parseLong(next());}
		public double nextDouble() throws IOException { return Double.parseDouble(next());}
	}
}


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

typedef unsigned uint;
typedef long long INT;
typedef unsigned long long UINT;
const int INF = 1001001001;
const INT INFLL = 1001001001001001001LL;

 int in() { int x; scanf("%d", &x); return x; }
double fin() { double x; scanf("%lf", &x); return x; }
INT lin() { INT x; scanf("%lld", &x); return x; }


int main(){
    int a, b, c;
    double fa, fb, fc;
    char sa[128], sb[128], sc[128];

    a = in();
    b = in();
    c = in();

    printf("%d %d %d", c, a, b);



    return 0;
}







Measured memory_bytes: 256
<?php
list($a, $b) = ints();
list($s) = strs();
for ($i = 0; $i < $a + $b + 1; $i++) {
    if (($i === $a && $s[$i] !== '-') || ($i !== $a && !is_numeric($s[$i]))) exit('No');
}
echo 'Yes';
function strs()
{
    return explode(' ', trim(fgets(STDIN)));
}
function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}


Measured memory_bytes: 4856
import java.io.*;

class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = 
            new BufferedReader(new InputStreamReader(System.in));
        String[] str = br.readLine().trim().split(" ", 0);
        int a = Integer.parseInt(str[0]);
        int b = Integer.parseInt(str[1]);
        System.out.println((a + b) % 24);
    }
}

Measured memory_bytes: 22484
#include<iostream>
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;

int min(int a,int b){
    return (a<b) ? a : b ;
}

int max(int a,int b){
    return (a<b) ? b : a ;
}


int main() {

    int w,h,n ;
    cin >>w>>h>>n  ;
    int x[n],y[n],a[n] ;
    for(int i=0;i<n;++i) cin >> x[i] >> y[i] >> a[i] ;

    int xmin = 0 ;
    int ymin = 0 ;

    for (int i = 0; i < n; i++)
    {
        if(a[i]==1)
        {
            xmin = max(x[i],xmin) ;
        }
        if(a[i]==2)
        {
            w = min(w,x[i]) ;
        }
        if(a[i]==3)
        {
            ymin = max(y[i],ymin) ;
        }
        if(a[i]==4)
        {
            h = min(y[i],h) ;
        }
        if(xmin>=w || ymin>=h){
            cout << 0 << endl ;
            return 0 ;
        } 
    }
     
    cout << (w-xmin)*(h-ymin) << endl ;

 return 0 ;
}  


Measured memory_bytes: 256
N = int(input())
A_list = [int(item) for item in input().split()]

all_sum = sum(A_list)
F_sum_list = [A_list[0]]

for j in range(1,N):
    F_sum_list.append(F_sum_list[-1] + A_list[j])

delta_list = [abs(all_sum - 2* i) for i in F_sum_list]

print(min(delta_list))

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

// input
int Q;
vector<int> L, R;

const int MAX = 1e5 + 1;


void input() {
    cin >> Q;
    L = R = vector<int>(Q);
    rep(i, Q) cin >> L[i] >> R[i];
}


bool is_prime(int num) {
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
    return true;
}


int main() {
    input();
    vector<int> w(MAX, 0);
    for (int i = 1; i < MAX; i++) {
        w[i] = w[i - 1];
        if (is_prime(i) && is_prime((i + 1) / 2)) w[i]++;
    }
    rep(i, Q) {
        int ans = w[R[i]] - w[L[i] - 1];
        printf("%d\n", ans);
    }
}


Measured memory_bytes: 4536
#include "bits/stdc++.h"
using namespace std;
#define OUT(x)                cout << #x << " = " << x << endl; 
#define rep(i, n)             for (int (i) = 0; (i) < (int)(n); (i)++)
#define rer(i, l, r)          for (int (i) = (int)(l); (i) <= (int)(r); (i)++)
#define reu(i, l, r)          for (int (i) = (int)(l); (i) < (int)(r); (i)++)
#define each(i, v)            for (auto i : v)
#define all(x)                (x).begin(), (x).end()
#define rall(x)               (x).rbegin(), (x).rend()
#define pb(x)                 push_back(x)
#define bp(x)                 __builtin_popcount(x)
#define mp(x, y)              make_pair((x), (y))
#define fi                    first
#define se                    second
#define setp(x)               setprecision(x)
#define mset(m, v)            memset(m, v, sizeof(m))
#define sz(x)                 (int)(x.size())
static const int INF        = 0x3f3f3f3f;
static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
static const int MOD        = 1000000007;
static const double PI      = 3.14159265358979;

#define int                   long long

typedef vector<double>        vd;
typedef vector<string>        vs;
typedef vector<bool>          vb;
typedef vector<int>           vi;
typedef pair<int, int>        pii;
typedef vector<pii>           vpii;

template<typename T> void pv(T a, T b) { for (T i = a; i != b; i ++) cout << *i << " "; cout << endl; }
template<typename T, typename U> inline void amin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if (x < y) x = y; }
int in() { int _x; scanf("%d", &_x); return _x; }
long long lin() {long long _x; scanf("%lld", &_x); return _x; };

int dp[11][101010];

signed main() { 
        int n, m;
        cin >> n >> m;
        vpii g;
        rep(i, m) {
                int a, b;
                cin >> a >> b;
                a --;
                b --;
                g.pb(mp(a, b));
        }
        int q;
        cin >> q;
        vi v(q), d(q), c(q + 1, 0);
        rep(i, q) {
                cin >> v[i] >> d[i] >> c[i + 1];
                v[i] --;
                dp[d[i]][v[i]] = i + 1;
        }
        for (int dd = 10; dd > 0; dd --) {
                rep(i, sz(g)) {
                        amax(dp[dd - 1][g[i].fi], dp[dd][g[i].se]);
                        amax(dp[dd - 1][g[i].se], dp[dd][g[i].fi]);
                }
        }
        rep(i, n) {
                int ans = 0;
                rep(j, 11) amax(ans, dp[j][i]);
                cout << c[ans] << endl;
        }
        return 0;
}               



Measured memory_bytes: 13168
#include <iostream>
#include <vector>
#include <string>
#include <iomanip>

using namespace std;
typedef long long ll;

int main()
{
  cout << setprecision(16);
  int N;
  cin >> N;
  vector <double> p(N);

  for( int i=0;i<N;i++ )
    cin >> p[i];

  vector <vector<double>> pp(N+1, vector<double>(2*N+1));

  pp[0][N] = 1;
  
  for( int i=0;i<N;i++ )
    for( int j=0;j<2*N+1;j++ )
      {
	pp[i+1][j] += p[i]*pp[i][j-1];
	pp[i+1][j] += (1-p[i])*pp[i][j+1];	  
      }
  double ans = 0.0;
  for( int i=N+1;i<2*N+1;i++ )
    ans += pp[N][i];
  cout << ans << endl;
}


Measured memory_bytes: 141056
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int a[100010];
int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	a[n] = 1000000007;
	sort(a, a + n);
	int co = 0, ans = 0;
	for (int j = 0; j < n; j++) {
		if (a[j] != a[j + 1]) {
			co++;
			if (co < a[j]) {
				ans += co;
			}
			else {
				ans += co - a[j];
			}
			co = 0;
		}
		else {
			co++;
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
  int a[100002];
  for(int i=0;i<100002;i++){
    a[i]=0;
  }
  int N;
  cin >>N;
  int x;
  for(int i=0;i<N;i++){
    cin >> x;
    a[x]++;
    a[x+1]++;
    a[x+2]++;
  }
  int ans = 0;
  for(int i=0;i<100002;i++){
    ans = max(ans,a[i]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 768
#include <stdio.h>
#include <stdlib.h>
#define N 100000

typedef struct data{
  char name[10];
  int time;
}Data;

Data Q[N+1];
int head=0,tail=0,n;
int isEmpty(void);
int isFull(void);
void enqueue(Data);
Data dequeue(void);

int main(){
  int n,q,i,T=0;
  scanf("%d%d",&n,&q);
  for(i=0;i<n;i++){
    scanf("%s%d",Q[i].name,&Q[i].time);
    tail=i+1;
  }
  while(isEmpty()!=1){
      if(Q[head].time>q){
	T+=q;
	Q[head].time=Q[head].time-q;
	enqueue(dequeue());
      }
      if(Q[head].time<=q){
	T+=Q[head].time;
	printf("%s %d\n",Q[head].name,T);
	dequeue();
    }
  }
  return 0;
}
void enqueue(Data person){
  if(isFull()==1){
    printf("overflow");
    exit(1);
  }
  Q[tail]=person;
  if(tail+1==N)tail=0;
  else tail++;
}
Data dequeue(void){
  Data person;
  if(isEmpty()==1){
    printf("underflow");
    exit(2);
  }
  person=Q[head];
  if(head+1==N)head=0;
  else head++;
  return person;
}
		
int isEmpty(){
   return head == tail;
    }

int isFull(){
   return head == (tail + 1) % N;
    }



Measured memory_bytes: 3240
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys

def selection_sort(A):
    swap_count = 0
    for i in range(len(A)):
        mini = i
        min_val = min(A[i:])
        min_index = A[i:].index(min_val) + i

        if A[min_index] < A[i]:
            swap_count += 1
            A[min_index], A[i] = A[i], A[min_index]

    return swap_count


n = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))

swap_count = selection_sort(A)
s_list = list(map(str, A))
print(' '.join(s_list))
print(swap_count)



Measured memory_bytes: 5608
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repn(i, j, k) for (int i = (j); i < (k); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;

int main()
{
  int n;
  cin >> n;
  string s, t;
  cin >> s >> t;

  rep(i, s.size()) {
    cout << s[i] << t[i];
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
N, Z, W = map(int, input().split())
A = [W]+list(map(int, input().split()))
X = [0]*N
Y = [1<<30]*N
X[0] = Y[0] = abs(A[-2]-A[-1])
for i in range(1,N):
    X[i] = max(abs(A[-2-i]-A[-1]), max(Y[j] for j in range(i)))
    Y[i] = min(abs(A[-2-i]-A[-1]), min(X[j] for j in range(i)))
print(X[-1])

Measured memory_bytes: 73720
import java.util.Scanner;


public class Main {
	

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		boolean[][] a = new boolean[4][13];
		int n = stdIn.nextInt();
		for(int i = 0; i < n; i++) {
			String p = stdIn.next();
			int v = stdIn.nextInt();
			
			if(p.equals("S")) {
				a[0][v-1] = true;
			}
			else if (p.equals("H")) {	
				a[1][v-1] = true;
			}
			else if (p.equals("C")) {	
				a[2][v-1] = true;
			}
			else {
				a[3][v-1] = true;
			}
		}
		
		for(int i = 0; i < 4; i++) {
			for(int j = 0; j < 13; j++) {
				if(!a[i][j]) {
					switch(i) {
					case 0 : System.out.println("S " + (j + 1)); break;
					case 1 : System.out.println("H " + (j + 1)); break;
					case 2 : System.out.println("C " + (j + 1)); break;
					case 3 : System.out.println("D " + (j + 1)); break;
					}
				}
			}
		}
	}

}

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

using namespace std;

typedef long long ll;
const ll mod = 1e9+7;

template<typename T> ostream& operator << (ostream& os, vector<T> v) {
  for (auto& i : v) os << i << " "; return os; 
}
template<typename T> istream& operator >> (istream& is, vector<T>& v) {
  for (auto& i : v) is >> i; return is;
}
template<typename K, typename V> ostream& operator << (ostream& os, unordered_map<K, V> m) {
  for (auto& i : m) os << i.first << ":" << i.second << endl; return os;
}
template<typename T> inline bool chmin(T& x, T y) {
  if (x > y) {
    x = y;
    return true;
  }
  return false;
}
template<typename T> inline bool chmax(T& x, T y) {
  if (x < y) {
    x = y;
    return true;
  }
  return false;
}

ll dfs(vector<int>& v, int n, int i, ll sum, ll cursor) {
  // cout  << i << ": " << sum << " " << cursor << endl;
  if (i == n) {
    return sum + cursor;
  }
  ll res = 0;
  res += dfs(v, n, i+1, sum, cursor*10+v[i]);
  res += dfs(v, n, i+1, sum+cursor, v[i]);
  return res;
}

int main() {
  string s;
  cin >> s;
  int n = s.size();
  vector<int> v(n);
  for (int i=0; i<n; i++) {
    v[i] = s[i] - '0';
  }
  cout << dfs(v, n, 1, 0, v[0]) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

#define DEBUG

#ifdef DEBUG
#define var_dump(...) fprintf(stdout, __VA_ARGS__)
#define dump(a) cout << a << "\n";
#else
#define var_dump(...) 42
#define dump(a) 42
#endif

typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy4[]={0, 0, 1, -1};
int dx4[]={1, -1, 0, 0};
int dx8[]={0, 0, 1, -1, 1, 1, -1, -1};
int dy8[]={1, -1, 0, 0, 1, -1, -1, 1};

// https://beta.atcoder.jp/contests/abc079/tasks/abc079_b

int main() {
    int N; cin >> N;
    ll arr[100] = {};
    arr[0] = 2;
    arr[1] = 1;

    FOR(i, 2, 100) {
        arr[i] = arr[i-1] + arr[i-2];
    }

    cout << arr[N] << "\n";

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  long long n;
  cin >> n;
  int length=12,i=0;
  vector<char>ans(length,'A');
  while(n>0){
    if(n%26!=0){
      ans.at(i)='a'+(n%26-1);
      i++;
      n=n/26;
    }
    else{
      ans.at(i)='z';
      i++;
      n=n/26-1;
    }

  }
  reverse(ans.begin(),ans.end());
  for(i=0; i<length; i++){
    if(ans.at(i)=='A'){
      continue;
    }
    else{
      cout << ans.at(i);
      if(i==length-1){
        cout << endl;
      }
    }
  }
}


Measured memory_bytes: 3584
import java.util.*;
import java.util.Arrays;


public class Main{
  
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int L = sc.nextInt();
    String [] x = new String[N];
    for(int i=0;i<N;i++){
      x[i] = sc.next();
      
    }
    Arrays.sort(x);
    String ans = "";
    for(int i=0;i<N;i++){
      ans += x[i];
    }

    
    System.out.println(ans);
    
    
  }
}
                          
                         
                    
    
    
    
    
    
    


Measured memory_bytes: 26196
a, b, c, x, y = list(map(int, input().split()))

ab_set = min(a+b, 2*c)

if x > y:
    ans = min(ab_set*x, ab_set*y + a*(x-y))
else:
    ans = min(ab_set*y, ab_set*x + b*(y-x))
print(ans)

Measured memory_bytes: 3060
#include <stdio.h>

int main(void)
{
  int n, k, i;
  char s[n], t;

  scanf("%d",&n);
  scanf("%s",s);
  scanf("%d",&k);

  t = s[k-1];

  for(i=0;i<n;i++){
    if(s[i]!=t){
      s[i]='*';
    }
  }

  printf("%s",s);

  return 0;
}


Measured memory_bytes: 128
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))
n,k = iim()
ans = 0
mod = 1000000007
for i in range(k,n+2):
    ans += n*(n+1)//2 - i*(i-1)//2 - (n-i)*(n-i+1)//2 + 1
    ans = ans%mod

print(ans)

Measured memory_bytes: 9192
#include <bits/stdc++.h>
using namespace std;
vector<long long> A; vector<long long> B;
long long dp[410][410];
long long all[410][410];
long long pw[410][410];

int mod = (int)1e9 + 7;
long long dfs(long long x,long long c){
	if( x == A.size() - 1 ){	
		return all[x][c];
	}
	if( dp[x][c] != -1 ) return dp[x][c];
	long long ans = 0;
	long long v = 1;
	for(int i = 0 ; i <= c ; i++){
		ans += dfs(x+1,c-i) * all[x][i];
		ans %= mod;
	}
	return dp[x][c] = ans % mod;
}
void solve(long long N, long long C, vector<long long> A, vector<long long> B){
	for(int i = 0 ; i <= 400 ; i++){	
		long long p = 1;
		for(int j = 0 ; j <= 400 ; j++){
			pw[i][j] = p;
			p *= i;
			p %= 1000000007;
		}
	}
	memset(dp,-1,sizeof(dp));
	
	::A = A;
	::B = B;
	long long ans = 0;
	for(int i = 0 ; i < N ; i++){
		for(int k = 0 ; k <= 400 ; k++){
			for(int j = A[i] ; j <= B[i] ; j++){
				all[i][k] += pw[j][k];
				all[i][k] %= 1000000007;
			}
		}
	}
	cout << dfs(0,C) << endl;
}

int main(){	
	ios::sync_with_stdio(false);
	long long C;
	long long N;
	cin >> N;
	vector<long long> A(N-1+1);
	vector<long long> B(N-1+1);
	cin >> C;
	for(int i = 0 ; i <= N-1 ; i++){
		cin >> A[i];
	}
	for(int i = 0 ; i <= N-1 ; i++){
		cin >> B[i];
	}
	solve(N, C, A, B);
	return 0;
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;;
#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin >> n;
  string st;cin >> st;
  ll ans = 0;
  rep(i,1000){
    ll f = i/100;
    ll s = (i/10)%10;
    ll t = i%10;
    bool ff = false;
    bool ss = false;
    bool tt = false;
    rep(j,n){
      if(ff&&ss&&st[j]-'0'==t){
        ans++;
        break;
      }
      if(ff && st[j]-'0'==s)ss = true;
      if(st[j]-'0'==f)ff=true;
    }
  }
  cout<< ans << endl;
}

Measured memory_bytes: 384
import sys
input = sys.stdin.readline

n, k = [int(item) for item in input().split()]
a = [0] 
for i in range(n):
    a.append(int(input()) - k)
for i in range(1, n+1):
    a[i] += a[i - 1]
a_set = sorted(list(set(a)))
comp = dict() 
for i, item in enumerate(a_set):
    comp[item] = i
for i, item in enumerate(a):
    a[i] = comp[item]

n = len(a_set) + 5
bit = [0] * (n + 1) 

# Add w to ax 
def bit_add(x, w):
    while x <= n:
        bit[x] += w
        x += x & -x

# Sum a1 to ax 
def bit_sum(x):
    ret = 0
    while x > 0:
        ret += bit[x]
        x -= x & -x
    return ret

ans = 0
for item in a:
    ans += bit_sum(item + 1)
    bit_add(item + 1, 1)
print(ans)

Measured memory_bytes: 77408
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
struct UnionFind { vector<int> par,cnt;
    UnionFind(int NV){par.clear();cnt.resize(NV, 1);rep(i, 0, NV) par.push_back(i); } 
    int operator[](int x) { return par[x] == x ? x : par[x] = operator[](par[x]); }
    void operator()(int x, int y) { x = operator[](x); y = operator[](y);
        if (x != y) par[x] = y, cnt[y] += cnt[x]; }};
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/




int N, A[101010], B[101010];
//---------------------------------------------------------------------------------------------------
bool chk() {
    map<int, int> cnt;
    rep(i, 0, N + 1) cnt[A[i]]++;
    rep(i, 0, N + 1) { if (cnt[B[i]] == 0) return false; cnt[B[i]]--; }
    return true;
}
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    rep(i, 0, N) cin >> A[i];
    rep(i, 0, N) cin >> B[i];

    A[N] = 0;
    rep(i, 0, N) A[N] ^= A[i];

    B[N] = 0;
    rep(i, 0, N) B[N] ^= B[i];

    if (!chk()) { printf("-1\n"); return; }

    UnionFind uf(N + 1);
    int ans = 0;
    map<int, int> leader;
    rep(i, 0, N + 1) if (A[i] != B[i] || i == N) {
        ans++;
        leader[A[i]] = i;
        leader[B[i]] = i;
    }

    rep(i, 0, N + 1) if (A[i] != B[i] || i == N) {
        uf(i, leader[A[i]]);
        uf(i, leader[B[i]]);
    }

    rep(i, 0, N + 1) if (A[i] != B[i] || i == N) {
        if (uf[i] == i) ans++;
    }

    ans -= 2;

    cout << ans << endl;
}

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

using namespace std;

int main(){
    int N, A[100];
    int max_a = 1, min_a = 1e9;
    cin >> N;
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    for (int i = 0; i < N; ++i) {
        max_a = max(max_a, A[i]);
        min_a = min(min_a, A[i]);
    }
    cout << max_a - min_a;
    return 0;
}


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

using namespace std;
#define int int64_t
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define reps(i, a, n) for (int i = (a); i < (n); --i)
#define all(x) (x).begin(), (x).end()
#define gsort(x, n) sort((x), (x + n) greater<int>())
#define rv(s) reverse((s).begin(), (s).end())
#define setout(n, x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10);
#define pb(x, a) (x).push_back(a)
#define fb(x, a) (x).flont_back(a)
#define eb(x, a) (x).emplaes_back(a)
using pii = pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const long long mod = 1e9 + 7;

signed main()
{
   cin.tie(nullptr);
   ios_base::sync_with_stdio(false);

   int n,cnt=LINF,ans=0,west=0,east=0;
   string s;
   cin>>n>>s;

   rep(i,0,n){
      if(s[i] == 'E') ++east;
   }

   rep(i,0,n){
      bool a = false;
      if(s[i] == 'W') ++west,a=true;
      else --east;
      if(a) ans = east + west -1;
      else ans = east + west;
      cnt = min(cnt,ans);
   }

   cout<<cnt<<'\n';
}

Measured memory_bytes: 720
#define	_USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cctype>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
#include <set>
#include <complex>
#include <utility>
#include <numeric>
using namespace std;

typedef complex<int> P;

int b[19][19];


int main(){
	
	int n;
	long long ans=0;
	
	cin>>n;
	
	while(n>0){
		ans+=n;
		n--;
	}
	cout<<ans<<endl;
	
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main(void){
  int r,c,i,j;
  static int s[101][101];
 
  scanf("%d%d",&r,&c);
 
  for(i=0;i<=r;i++){
    for(j=0;j<c;j++){
      scanf("%d", &s[i][j]);
      printf("%d ", s[i][j]);
      s[i][c] += s[i][j];
      s[r][j] += s[i][j];
    }
    printf("%d\n",s[i][c]);
  }
 
  return 0;
}


Measured memory_bytes: 2088
K,N = map(int,input().split())


a = list(map(int,input().split()))	
maxdis = a[0]+K-a[-1]
alldis = a[0]+K-a[-1]
a.sort()
for i in range(1,N):
    alldis += a[i] - a[i-1]
    maxdis = max(maxdis,a[i]-a[i-1])
print(alldis-maxdis)

Measured memory_bytes: 26548