akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int long long 
#define pb push_back
#define ins insert
#define rs resize
#define br break;
#define cont continue;
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vector<int>>
#define si set<ll>
#define sll set<long long>
#define pii pair<ll,ll>
#define pll pair<long long, long long>
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);
#define vec vector
#define cend cout<<endl;
#define sc second
#define fr first
#define retz return 0;
#define ll_MAX (ll)(1e9*1e9)
#define ll_MIN (ll)(-1e9*1e9)
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b)  for(int i=a; i<=b; i++)
#define repd(i,a,b) for(int i=a; i>=b; i--)
#define ps(arr, n) for(int i=1; i<n; i++)arr[i]+=arr[i-1];
#define inp(arr, n)for(int i=0; i<n; i++)cin>>arr[i];
#define out(arr, n)for(int i=0; i<n; i++)cout<<arr[i];
#define inp1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define out1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define loop(q) for(auto it:q)
#define loop1(q) for(auto&it:q)
#define db1 cout << "*" << endl
#define db2 cout << "YES" << endl
using namespace std;
using namespace __gnu_pbds; 
#define oset(X) tree<X,null_type,less<X>, rb_tree_tag, tree_order_statistics_node_update> 
#define roset(X) tree<X,null_type,greater<X>, rb_tree_tag, tree_order_statistics_node_update>  
#define okey order_of_key //lower_bound_set
#define ofind find_by_order
#define cyes cout << "Yes" << endl; 
#define cno cout << "No" << endl;
#define mod (long long)1000000007
#define mod2 (long long)998244353
#define INT_MAX1 900000000
#define MAXN 2000000
#define INF INT_MAX


void solve()
{
    int w, h, x, y;
    cin >> w >> h >> x >> y;
    cout << setprecision(23);
    cout << ((double)w*h)/2 << " ";
    if(2*x==w and 2*y==h)
        cout << 1 << endl;
    else
        cout << 0 << endl;
}


signed main()
{
    speed;
    int t = 1;
    //cin >> t;
    while(t--)
        solve();
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace Main
{
    public static class Program
    {
        public static List<int> list = new List<int>();
 
        static void Main(string[] arg)
        {
            var input = GetIntList(Console.ReadLine());
            var answer = 0;

            for(int i = input[0];i<=input[2];i += input[0]){
                answer += input[1];
            }
 
 
            Console.WriteLine(answer);
            Console.ReadLine();
 
        }
        
        #region libraries
        private static int[] GetIntList(string line)
        {
            return line.Split(' ').Select(x => int.Parse(x)).ToArray();
 
        }
        private static double[] GetDoubleList(string line)
        {
            return line.Split(' ').Select(x => double.Parse(x)).ToArray();
 
        }
        private static ulong[] GetUlongList(string line)
        {
            return line.Split(' ').Select(x => ulong.Parse(x)).ToArray();
        }
        private static long[] GetLongList(string line)
        {
            return line.Split(' ').Select(x => long.Parse(x)).ToArray();
        }
        private static int SearchNearest(this IEnumerable<int> list, int target)
        {
            var min = list.Min(c => Math.Abs(c - target));
            return list.First(c => Math.Abs(c - target) == min);
        }
        public static bool IsOdd(int i)
        {
            return i % 2 == 1 ? true : false;
        }
        public static int Gcd(int a,int b)
        {
            if(a < b)
            {
                Gcd(b, a);
            }
            while (b != 0)
            {
                var rm = a % b;
                a = b;
                b = rm;
            }
            return a;
        }
        #endregion
    }
}

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

#define int long long

struct node {
	int a, b, c, d;
	
	node() {
		a = b = c = d = 0;
	}
	
	node(int _a, int _b, int _c, int _d) {
		a = _a;
		b = _b;
		c = _c;
		d = _d;
	}
};

const int N = 60;
int a, b, c, dis[N][N][N];
queue <node> que;

int32_t main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	for (int i = 0; i < N; i++)
		for (int j = 0; j < N; j++)
			for (int k = 0; k < N; k++)
				dis[i][j][k] = (int)1e9;
	
	cin >> a >> b >> c;
	dis[a][b][c] = 0;
	que.push(node(a, b, c, 0));
	
	while (que.size()) {
		node v = que.front();
		que.pop();
		int x = v.a, y = v.b, z = v.c, d = v.d;
		if (dis[x][y][z] < d)
			continue;
		dis[x][y][z] = d;
		
		if (x + 2 < N && d + 1 < dis[x + 2][y][z]) {
			dis[x + 2][y][z] = d + 1;
			que.push(node(x + 2, y, z, d + 1));
		}
		if (y + 2 < N && d + 1 < dis[x][y + 2][z]) {
			dis[x][y + 2][z] = d + 1;
			que.push(node(x, y + 2, z, d + 1));
		}
		if (z + 2 < N && d + 1 < dis[x][y][z + 2]) {
			dis[x][y][z + 2] = d + 1;
			que.push(node(x, y, z + 2, d + 1));
		}
		
		if (x + 1 < N && y + 1 < N && d + 1 < dis[x + 1][y + 1][z]) {
			dis[x + 1][y + 1][z] = d + 1;
			que.push(node(x + 1, y + 1, z, d + 1));
		}
		if (x + 1 < N && z + 1 < N && d + 1 < dis[x + 1][y][z + 1]) {
			dis[x + 1][y][z + 1] = d + 1;
			que.push(node(x + 1, y, z + 1, d + 1));
		}
		if (y + 1 < N && z + 1 < N && d + 1 < dis[x][y + 1][z + 1]) {
			dis[x][y + 1][z + 1] = d + 1;
			que.push(node(x, y + 1, z + 1, d + 1));
		}
	}
	
	int mn = dis[0][0][0];
	for (int i = 1; i < N; i++)
		mn = min(mn, dis[i][i][i]);
	cout << mn << endl;
}

Measured memory_bytes: 2048
// 1_1_C
#include <stdio.h>
#include <math.h>

int IsPrime(int n){
    if(n == 2) return 1;
    if(n % 2 == 0) return 0;

    int limit = (int)ceil(sqrt((double)n)), divisor;
    for(divisor = 3; divisor <= limit; divisor += 2){
        if(n % divisor == 0) return 0;
    }

    return 1;
}

int main(){
    int n, i, num, cnt = 0;

    scanf("%d", &n);
    for(i = 0; i < n; i++){
        scanf("%d", &num);
        cnt += IsPrime(num);
    }
    printf("%d\n", cnt);
    return 0;
}

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

#include <iostream>

std::unordered_map<long, int> mp;

int main(void) {
  long n;
  long a[200010] = {0};
  int flg = 0;
  int cnt = 0;
  long b[200010] = {0};

  scanf("%ld", &n);

  for (long i = 0; i < n; i++) {
    scanf("%ld", &a[i]);
  }

  std::sort(a, a + n);

  for (long i = 0; i < n; i++) {
    mp[a[i]]++;
  //  printf("%ld ", a[i]);
  }

  for (long i = 0; i < n - 1; i++) {
    if(mp[a[i]]==0) continue;
    if(mp[a[i]]>1){
      mp[a[i]]=0;
    }
    for(long j=2;;j++){
      if(a[i]*j>a[n-1]) break;
      mp[a[i]*j]=0;
    }
  }

  for(long j = 0; j < n; j++){
    if (mp[a[j]]!=0) {
      cnt++;
    }
  }

  printf("%d", cnt);

  return 0;
}


Measured memory_bytes: 44272
#include <iostream>

using namespace std;

int main()
{
    int A,B;
    cin >> A >> B;
    int ans;
    
    int m1,M1,m2,M2;

    if(A%2==0){
        m1 = 25*A/2;
        M1 = 25*A/2+11;
    }else{
        m1 = 25*(A+1)/2-12;
        M1 = 25*(A+1)/2-1;
    }

    m2 = 10*B;
    M2= 10*B+9;

    if(M1<m2 || M2<m1){
        cout << -1 << endl;
    }else{
        cout << max(m1,m2) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
def swapPrintMin(pair):
	if pair[0] < pair[1]:
		print(pair[0],pair[1])
	else:
		print(pair[1],pair[0])

def main():
	pairList = []
	while True:
		try:
			pairList.append(list(map(int,input().split())))

		except:
			break;

	for i in pairList:
		if i == [0,0]:
			continue
		
		swapPrintMin(i)

if __name__ == '__main__':
	main()


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

typedef long long ll;

const int N = 1 << 19;
const ll inf = 0x3f3f3f3f3f3f3f3f;

struct SegT {
	ll mx[N << 1], add[N << 1];
	void init() {
		for (int i = 1; i < (N << 1); ++ i)
			mx[i] = -inf, add[i] = 0;
	}
	void pushadd(int i, ll a) {
		mx[i] += a; add[i] += a;
	}
	void pushdown(int i) {
		if (add[i]) {
			if (i < N) {
				pushadd(i << 1, add[i]);
				pushadd(i << 1 | 1, add[i]);
			}
			add[i] = 0;
		}
	}
	void upd(int l, int r, ll v, int i = 1, int a = 0, int b = N) {
		if (l <= a && b <= r) {pushadd(i, v); return ;}
		if (r <= a || b <= l) return ; pushdown(i);
		int m = (a + b) >> 1;
		if (l < m) upd(l, r, v, i << 1, a, m);
		if (r > m) upd(l, r, v, i << 1 | 1, m, b);
		mx[i] = max(mx[i << 1], mx[i << 1 | 1]);
	}
	ll qry(int l, int r, int i = 1, int a = 0, int b = N) {
		if (l <= a && b <= r) return mx[i];
		if (r <= a || b <= l) return -inf; pushdown(i);
		int m = (a + b) >> 1;
		ll ans = -inf;
		if (l < m) ans = max(ans, qry(l, r, i << 1, a, m));
		if (r > m) ans = max(ans, qry(l, r, i << 1 | 1, m, b));
		return ans;
	}
} segt;

#define pii pair <int, int>
#define fir first
#define sec second

int w, h, n;
int x[N], y[N];
vector <pair <int, pii> > v;
int stk_min[N], tp_min;
int stk_max[N], tp_max;

int main() {
	// freopen("in", "r", stdin);
	ios :: sync_with_stdio(0);
	cin >> w >> h >> n;
	for (int i = 0; i < n; ++ i)
		cin >> x[i] >> y[i];
	ll ans = 0;
	for (int t = 0; t < 2; ++ t) {
		segt.init();
		v.clear();
		v.push_back(make_pair(0, make_pair(0, h)));
		v.push_back(make_pair(w, make_pair(0, h)));
		for (int i = 0; i < n; ++ i)
			v.push_back(make_pair(x[i], make_pair(0, h)));
		sort(v.begin(), v.end());
		v.erase(unique(v.begin(), v.end()), v.end());
		for (int i = 0; i < n; ++ i) {
			int p = lower_bound(v.begin(), v.end(), make_pair(x[i], make_pair(0, 0))) - v.begin();
			if (y[i] * 2 >= h) v[p].sec.sec = min(v[p].sec.sec, y[i]);
			else v[p].sec.fir = max(v[p].sec.fir, y[i]);
		}
		tp_min = 0; tp_max = 0;
		for (int i = 0; i < v.size(); ++ i) {
			if (i) {
				// cerr << segt.qry(0, i) << " " << v[i].fir << " " << v[i].sec.fir << " " << v[i].sec.sec << endl;
				ans = max(ans, segt.qry(0, i) + v[i].fir);
			}
			while (tp_min && v[stk_min[tp_min - 1]].sec.sec >= v[i].sec.sec) {
				int lst = tp_min >= 2 ? stk_min[tp_min - 2] : 0;
				segt.upd(lst, stk_min[tp_min - 1], v[i].sec.sec - v[stk_min[tp_min - 1]].sec.sec);
				-- tp_min;
			}
			stk_min[tp_min ++] = i;
			while (tp_max && v[stk_max[tp_max - 1]].sec.fir <= v[i].sec.fir) {
				int lst = tp_max >= 2 ? stk_max[tp_max - 2] : 0;
				segt.upd(lst, stk_max[tp_max - 1], v[stk_max[tp_max - 1]].sec.fir - v[i].sec.fir);
				-- tp_max;
			}
			stk_max[tp_max ++] = i;
			segt.upd(i - 1, i, -h + v[i].sec.sec - v[i].sec.fir);
			segt.upd(i, i + 1, inf - v[i].fir + h);
			// for (int j = 0; j <= i; ++ j) cerr << segt.qry(j, j + 1) << " "; cerr << endl;
		}
		swap(w, h);
		for (int i = 0; i < n; ++ i)
			swap(x[i], y[i]);
	}
	cout << ans * 2 << endl;
	return 0;
}


Measured memory_bytes: 28912
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()

int main()
{
  int M, D;
  cin >> M >> D;
  int ans = 0;
  for(int m = 1 ; m <= M ; m++){
    for(int d = 1 ; d <= D ; d++){
      int i = d % 10;
      int j = d / 10;
      if(i * j == m && i >= 2 && j >= 2)
        ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
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 gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

map<ll, ll> prime_factor(ll n) {
  map<ll, ll> ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

int main()
{
    cout << fixed << setprecision(15);
    ll N;
    cin >> N;
    // N = 30;

    ll ans = 0;
    for(auto p : prime_factor(N)) {
        // cout << p.first << ":" << p.second << endl;
        ll k = p.second;
        ll i = 1;
        ll count = 0;
        while(k-i>=0){
            k = k-i;
            i++;
            count++;
        }
        ans += count;
    }
    cout << ans << endl;
    return 0;
}

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

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

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

int H,W;
vector<string> A;

int tansaku( int i, int j )
{
    A[i][j] = '.';
    if( i != 0 )
    {
        if(A[i-1][j] == '#') return -INF;
    }
    if( j!= 0 )
    {
        if(A[i][j-1] == '#' ) return -INF;
    }

    if( i+1 != H && j+1 != W )
    {
        if( A[i][j+1] == '#' && A[i+1][j] == '#' ) return -INF;
        if( A[i][j+1] == '#' ) return tansaku(i, j+1)+1;
        else if( A[i+1][j] == '#' ) return tansaku(i+1, j)+1;
        else return 0;
    }
    else if( i+1 != H )
    {
        if( A[i+1][j] == '#' ) return tansaku(i+1, j)+1;
        else return 0;
    }
    else if( j+1 != W )
    {
        if( A[i][j+1] == '#' ) return tansaku(i, j+1)+1;
        else return 0;
    }
    else return 0;
}

int main()
{
    cin >> H >> W;
    
    int shape_cnt = 0;

    rep(i,H)
    {
        string tmp;
        cin >> tmp;
        A.push_back(tmp);
        rep(j,W)
        {
            if(A[i][j] == '#')shape_cnt++;
        }
    }
    
    rep(i,H)
    {
        rep(j,W)
        {
            if(A[i][j] == '#')
            {
                int tmp = tansaku( i, j ) + 1;
                //cout << tmp << " " << shape_cnt << endl;
                if( tmp < 0 )
                {
                    cout << "Impossible" << endl;
                    return 0;
                }
                if( tmp != shape_cnt ) cout << "Impossible" << endl;
                else cout << "Possible" << endl;
                return 0;
            }
        }
    }
    cout << "Possible" << endl;
}


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

int main() {
  int A, B;
  cin >> A >> B;
  int C = A + B;
  if (C < 24) {
    cout << C << endl;
  }
  if (C >= 24) {
    cout << C - 24 << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define PI acos(-1.0)
const long long MAX=200005;
typedef long long ll;
const int INF=0x3f3f3f3f;
//int d[8][2]={-1,0,0,-1,0,1,1,0,1,1,-1,-1,-1,1,1,-1};
int main()
{
   int n;
   scanf("%d",&n);
   int num=n;
   int sum=0;
   while(n)
   {
       int t=n%10;
       sum+=t;
       n/=10;
   }
   if(num%sum==0) printf("Yes\n");
   else printf("No\n");
}


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

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/detail/standard_policies.hpp>

using namespace std;
// using namespace __gnu_pbds;

#define int ll
#define endl "\n"
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(c) c.begin(), c.end()
#define vi vector<int>
#define pii pair<int,int>
#define For(i,s,e) for (ll i=(s); i<(e); i++)
#define MAX 500005
#define initialize(arr,elem) memset(arr,elem,sizeof(arr))

typedef long long ll;
// typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
int get_min(int a, int b){
	if (a == -1) return b;
	if (b == -1) return a;
	else return min(a,b);
}
int n,w;
int arr[101][2], dp[101][100001];
void solve(){
	For(i,1,101){
		if (i==1) dp[i][arr[i][1]] = arr[i][0];
		else{
			dp[i][arr[i][1]] = get_min(dp[i][arr[i][1]],arr[i][0]);
			For(j,1,100001){
				if (dp[i-1][j] != -1){
					dp[i][j] = get_min(dp[i-1][j],dp[i][j]);
					dp[i][j+arr[i][1]] = get_min(dp[i][arr[i][1]+j],dp[i-1][j] + arr[i][0]);
				}
			}
		}
	}	

}

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

	cin>>n>>w;
	For(i,1,n+1) cin>>arr[i][0]>>arr[i][1];
	initialize(dp,-1);
	solve();
	for(int i=100000;i>0;i--){
		if (dp[n][i]<=w && dp[n][i] != -1){
			cout<<i;
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 79232
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {                     
    
    public static void main(String[] args) {		        
        Scanner sc = new Scanner(System.in);                                                                     
                                                                       
        int N = sc.nextInt();
        int x = sc.nextInt();
        int[] arr = new int[N];
	for (int i = 0; i < N; i++) {
	      arr[i] = sc.nextInt();
        }
        long count = 0; 
        for (int i = 0; i < N; i++) {
		if (arr[i] > x) {
			count += arr[i] - x;
			arr[i] = x;
		}
	}
	for (int i = 1; i < N; i++) {
		if (arr[i] + arr[i - 1] > x) {
                        count += arr[i] + arr[i - 1] - x;
			arr[i] = x - arr[i - 1];
		}
	}
	System.out.println(count);

        
  }
}

Measured memory_bytes: 50404
#include<stdio.h>
#include<stdlib.h>
#define  MAXN 10000000
#define  min(a,b) (a)<(b)?(a):(b)

int main(void)
{

	int a, b, c, x, y;
	int sum = 0;
	while (scanf("%d%d%d%d%d", &a, &b, &c, &x, &y) != EOF)
	{
		if (a + b >= 2 * c)
		{
			if (x <= y)
			{
				sum += 2 * x*(c);
				if (b > 2 * c)
					sum += (y - x) * 2 * c;
				else
					sum += (y - x)*b;
			}
			else
			{
				sum += 2 * y*(c);
				if (a > 2 * c)
					sum += (x - y) * 2 * c;
				else
					sum += (x - y)*a;
			}
		}
		else
		{
			if (x <= y)
			{
				sum += x * (a + b);
				if (b > 2 * c)
					sum += (y - x) * 2 * c;
				else
					sum += (y - x)*b;
			}
			else
			{
				sum += y * (a + b);
				if (a > 2 * c)
					sum += (x - y) * 2 * c;
				else
					sum += (x - y)*a;
			}
		}

		printf("%d\n", sum);
		sum = 0;
	}

	return 0;
}

Measured memory_bytes: 128
def Streamline(n, m, xl):

    xl.sort()
    count = []
    for i in range(m-1):
        count.append(xl[i+1]-xl[i])

    count.sort(reverse=True)
    ans = xl[-1]-xl[0] - sum(count[:n-1])

    return ans

def main():
    n, m = map(int, input().split())
    xl = list(map(int, input().split()))
    print(Streamline(n, m, xl))

if __name__ == '__main__':
    main()

Measured memory_bytes: 13968
#include<iostream>
#include<numeric>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std ; 


int main() {
  
  vector<int> vec(3) ; cin >> vec[0] >> vec[1] >> vec[2] ; 
  int k ; cin >> k ;
  int m = *max_element(vec.begin(),vec.end()) * pow(2,k);
  
  
  int sum = accumulate(vec.begin(),vec.end(),0) - *max_element(vec.begin(),vec.end()) + m;
  cout << sum ; 


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define sc second
#define int long long
using namespace std;

int n, k;
int a[200000] = {};

int searc(int l, int r)
{
    if (l == r)
        return l;
    int m = (l + r) / 2;
    int sum = 0;
    for (int i = 0; i < n; i++)
    {
        sum += (a[i] - 1) / m;
    }
    //cout << " " << l << " " << r << " " << sum << endl;
    if (sum > k)
    {
        return searc(m + 1, r);
    }
    else
    {
        return searc(l, m);
    }
}

int32_t main()
{
    cin >> n >> k;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    cout << searc(1, 1e9);
}


Measured memory_bytes: 5176
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define pb push_back
#define debug(x) cerr << #x << ": " << x << endl
#define debug_vec(v) cerr << #v << ":"; rep(i, v.size()) cerr << " " << v[i]; cerr<<endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void solve() {
    int n;
    cin >> n;
    vector<int> A(n);
    for(auto &a : A) cin >> a;
    int z = 0;
    rep(i, n) z ^= A[i];
    rep(i, n) cout << int(z ^ A[i]) << " \n"[i == n - 1];
}

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


Measured memory_bytes: 3968
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <fstream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int p[100005];

int root(int x) {return p[x] < 0 ? x : p[x] = root(p[x]);}

void mer(int x, int y) {
    if ((x = root(x)) == (y = root(y))) return;
    if (p[x] > p[y]) swap(x, y);
    p[x] += p[y];
    p[y] = x;
}

int main() {
    ios::sync_with_stdio(false);
    int a[3][3] = {}, n, b[3][3] = {}, c;
    for (int i = 0; i <3; i++) for (int j = 0; j <3; j++) cin >> a[i][j];
    cin >> n;
    while (n--) {
        cin >> c;
        for (int i = 0; i <3; i++) for (int j = 0; j <3; j++) if (c == a[i][j]) b[i][j] = 1;
    }
    if (b[0][0] && b[0][1] && b[0][2]) cout << "Yes";
    else if (b[1][0] && b[1][1] && b[1][2]) cout << "Yes";
    else if (b[2][0] && b[2][1] && b[2][2]) cout << "Yes";
    else if (b[0][0] && b[1][0] && b[2][0]) cout << "Yes";
    else if (b[0][1] && b[1][1] && b[2][1]) cout << "Yes";
    else if (b[0][2] && b[1][2] && b[2][2]) cout << "Yes";
    else if (b[0][0] && b[1][1] && b[2][2]) cout << "Yes";
    else if (b[2][0] && b[1][1] && b[0][2]) cout << "Yes";
    else cout << "No";
}


Measured memory_bytes: 3504
#include <iostream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <string>
#include <set>
#define rep(i, a, n) for(int i = a;i < n;++i)
#define repe(i, a, n) for(int i = a;i <= n;++i)
#define repr(i, a, n) for(int i = a;i > n;--i)
#define reper(i, a, n) for(int i = a;i >= n;--i)
#define size(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define EPS (1e-20)
#define INF 999999999
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using namespace std;


int n[3];


int parity(){
	if(n[0]%2 == n[1]%2 && n[0]%2 == n[2]%2) return 0;
	if(n[0]%2 == n[1]%2){ n[0]++, n[1]++; return 1; }
	if(n[0]%2 == n[2]%2){ n[0]++, n[2]++; return 1; }
	if(n[1]%2 == n[2]%2){ n[1]++, n[2]++; return 1; }
	return -1;
}


int solve(){
	int ans = 0;
	sort(&n[0], &n[3]);
	ans += parity();
	ans += ((n[2]-n[0])/2);
	ans += ((n[2]-n[1])/2);
	return ans;
}


int main(){
	cin >> n[0] >> n[1] >> n[2];

	cout << solve() << endl;

	return 0;
}

Measured memory_bytes: 256
K, N = map(int, input().split())
A = list(map(int, input().split()))

dlist = []
for i in range(N):
    if i == 0:
        dlist.append(A[i]+K - A[i-1])
    else:
        dlist.append(A[i] - A[i-1])

ans = K - max(dlist)
print(ans)


Measured memory_bytes: 87244
n,y = map(int,input().split())
ans = None

for a in range((y//10000)+1):
    for b in range((y//5000)+1):
        c = n - (a+b)
        if c < 0:
            break
        elif y == 10000*a + 5000*b + 1000*c:
            ans = [a,b,c]
    if ans is not None:
        break

if ans is not None:
    print(ans[0],ans[1],ans[2])
else:
    print("-1 -1 -1")


Measured memory_bytes: 3060
#include<stdio.h>
#define N 44
 
int main(){
  int s,i,n[N]={1,1};
 
  scanf("%d",&s);
 
  for(i=2; i<=s; i++){
    n[i] = n[i-1] + n[i-2];
  }
   
  printf("%d\n",n[s]);
 
  return 0;
}


Measured memory_bytes: 2108
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.container;
import std.array;
import std.math;
import std.range;
import std.typecons;
import std.ascii;

void main()
{
  writeln = readln.chomp.split.join.to!int % 4 ? "NO" : "YES";
}


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

using namespace std;

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

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

#define loop1(i,n) for(int i=1; i<=n; i++)

#define ll long long

#define ld long double

#define pii pair<int,int>

#define pll pair<ll,ll>

#define pld pair<ld,ld>

#define pb push_back
int main(){
	ll x; cin>>x;
	cout << (x/500LL)*1000LL + 5*((x%500LL)/5LL) << endl;
}

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

#define pb push_back
#define fi first
#define SZ(x) (int((x).size()))
#define se second
#define ll long long
#define pq priority_queue
#define MP make_pair
#define pii pair<int,int>
#define mod 998244353
#define inf 0x3f3f3f3f
#define debug(x) cerr<<#x<<"="<<x<<'\n'
#define rep(i, a, b) for (int i=a; i<(b); i++)

const int maxn=3e5+10;

int n,m,K; 
ll fact[maxn],invf[maxn];

ll p0w(ll base,int p) {
	ll res=1;
	while (p) {
		if (p%2==1) (res*=base)%=mod;
		(base*=base)%=mod;
		p/=2;
	}
	return res;
}

ll C(int x,int y) {
	if (y==0||x==y) return 1;
	return fact[x]*invf[y]%mod*invf[x-y]%mod;
}

int main(){
    std::ios::sync_with_stdio(false);
	invf[0]=fact[0]=1;
	for (int i=1;i<maxn;i++) {
		fact[i]=fact[i-1]*(ll)i%mod;
		invf[i]=p0w(fact[i],mod-2);
	}
    cin>>n>>m>>K;
    n--;
    int ans=0;
    rep(i,0,K+1) {
    	(ans+=C(n,i)*p0w(m-1,n-i)%mod)%=mod;
    }
    ans=(ll)ans*(ll)m%mod;
	cout<<ans;
	return 0;
}


Measured memory_bytes: 8340
// #include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
typedef long long ll;

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

int main() {
    int x, n;
    cin >> x >> n;

    vector<int> p(200, 0);

    int input;
    rep(i, n) {
        cin >> input;
        p[input] = 1;
    }

    int cnt = 0;
    int ans = -1;
    while (ans == -1) {
        if (p[x-cnt] == 0) ans = x-cnt;
        else if (p[x+cnt] == 0) ans = x+cnt;
        cnt++;
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3628
h,w=map(int,input().split())
n=int(input())
a=list(map(int,input().split()))
s=[]
for i in range(1,n+1):
  for j in range(a[i-1]):
    s.append(str(i))
b=[]
for i in range(h):
  if i%2==0:
    b.append(s[:w])
  else:
    t=s[:w]
    b.append(t[::-1])
  s=s[w:]
for i in range(h):
  print(*b[i])

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

struct Point {double x,y;};

void koch(int n,Point a,Point b){
    if(n==0)return ;
    Point s,t,u;
    double th =M_PI*60.0/180.0;
    
    s.x=(2.0*a.x+1.0*b.x)/3.0;
    s.y=(2.0*a.y+1.0*b.y)/3.0;
    t.x=(1.0*a.x+2.0*b.x)/3.0;
    t.y=(1.0*a.y+2.0*b.y)/3.0;
    u.x=(t.x-s.x)*cos(th)-(t.y-s.y)*sin(th)+s.x;
    u.y=(t.x-s.x)*sin(th)+(t.y-s.y)*cos(th)+s.y;
    
    koch(n-1,a,s);
    printf("%.8f %8f\n",s.x,s.y);
     koch(n-1,s,u);
    printf("%.8f %8f\n",u.x,u.y);
     koch(n-1,u,t);
    printf("%.8f %8f\n",t.x,t.y);
    koch(n-1,t,b);
}    

int main(){
    Point a,b;
    int n;
    
    scanf("%d",&n);
    
    a.x=0;
    a.y=0;
    b.x=100;
    b.y=0;
    
    printf("%8f %8f\n",a.x,a.y);
    koch(n,a,b);
    printf("%8f %8f\n",b.x,b.y);
    
    return 0;
}


Measured memory_bytes: 2732
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().solve();
	}
	
	void solve(){
		Scanner sc=new Scanner(System.in);
		int []a=new int[3];
		for(int i=0;i<3;i++){
			a[i]=sc.nextInt();
		}
		Arrays.sort(a);
		
		if(a[0]==5 && a[1]==5 && a[2]==7)System.out.println("YES");
		else System.out.println("NO");
	}
}

Measured memory_bytes: 21716
#include<stdio.h>

int main()
{
	int n,m;
	scanf("%d %d", &n, &m);
	float item[n];
	float total=0;
	for(int i = 0; i<n;i++)
	{
		scanf("%f", &item[i]);
		total += item[i];
	}
	float min = total/(4*m);
	int sudah = 0;
	for(int j = 0; j<n;j++)
	{
		if(sudah>=m) break;
		if(item[j] >= min) sudah++;
	}
	
	if(sudah >= m) printf("Yes\n");
	else printf("No\n");
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
using namespace std;
int main()
{
  int a,b,x;
  string ans;
  cin>>a>>b>>x;
  (x>=a && x<=(a+b)) ? ans="YES" :ans="NO";
  cout<<ans<<endl;
}


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

using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    int K;
    cin >> s >> K;
    int n = s.length();
    for (int i = 0; i < n; i++) {
        int tmp = (26 - (s[i] - 'a')) % 26;
        if (tmp <= K) {
            K -= tmp;
            s[i] = 'a';
        }
        if (K == 0) break;
    }
    s[n - 1] = 'a' + (s[n - 1] - 'a' + K) % 26;
    cout << s << "\n";
    return 0;
}

Measured memory_bytes: 592
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

# nCr(mod) -- START --
class ComMod():
  def __init__(self,n,mod):
    self.n=n
    self.mod=mod
    self.fact=[0]*(n+1)
    self.ifact=[0]*(n+1)
    self.fact[0]=1  
    for i in range(1,n+1):
      self.fact[i]=self.fact[i-1]*i
      self.fact[i]%=self.mod
    self.ifact[n]=pow(self.fact[n],self.mod-2,self.mod)
    for i in range(n,0,-1):
      self.ifact[i-1]=self.ifact[i]*i
      self.ifact[i-1]%=self.mod
  def com(self,n,k):
    if n<0 or k<0 or n<k:
      return 0
    return self.fact[n]*(self.ifact[k]*self.ifact[n-k]%self.mod)%self.mod
# nCr(mod) --- END ---

# n^p(mod m) -- START --
def powMod(n,p,m):
  if p==0:
    return 1
  if p%2==0:
    t=powMod(n,p//2,m)
    return t*t%m
  return n*powMod(n,p-1,m)%m
# n^p(mod m) --- END ---

def main():
  n,m,k=LI()
  mod=998244353
  c=ComMod(200005,mod)

  ans=0
  for i in range(k+1):
    # print(m,c.com(n-1,i),powMod(m-1,n-1-k,mod))
    ans=(ans+m*c.com(n-1,i)*powMod(m-1,n-1-i,mod))%mod

  return ans

# main()
print(main())


Measured memory_bytes: 80536
import java.util.*;
import java.util.Arrays;
public class Main
{
  public static void main (String[]args)
  {
    Scanner k=new Scanner (System.in);
    int[]x=new int[10];
    for(int i=0;i<x.length;i++)    {
      x[i]=k.nextInt();
    }
    Arrays.sort(x);
    for(int i=x.length-1;i>6;i--)
    {
      System.out.println(x[i]);
    }
  }
}
    

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

int main(){
  int n,s;
  while(cin >> n >> s, n+s){
    bool arr[10];
    for(int i=0; i<n; i++)
      arr[9-i] = 1;
    for(int i=n; i<10; i++)
      arr[9-i] = 0;
    int c = 0;
    do{
      int S = 0;
      for(int i=0; i<10; i++){
	if(arr[i]) S+= i;
      }
      if(S == s) c++;
    }while(next_permutation(arr,arr+10));
    cout << c << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define REP(i,k,n) for(int i=k;i<n;i++)
 
#define INF 1844674407370955161

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





int lcm(int a,int b){
	return a/__gcd(a,b) * b;
}

void clear( std::queue<pair<int,int> > &q )
{
   std::queue<pair<int,int> > empty;
   std::swap( q, empty );
}
bool IsPrime(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;
}
template<typename T>
std::vector<T> enum_div(T n)//nの約数を列挙
{
	std::vector<T> ret;
	for(T i=1 ; i*i<=n ; ++i)
	{
		if(n%i == 0)
		{
			ret.push_back(i);
			if(i!=1 && i*i!=n)
			{
				ret.push_back(n/i);
			}
		}
	}
	return ret;
}


map< int, int > prime_factor(int n) {
  map< int, int > ret;
  for(int i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}
class DisjointSet{
    public:
        vector<int> rank, p;

        DisjointSet(){
        }

        DisjointSet(int size){
            rank.resize(size, 0);
            p.resize(size, 0);
            for (int i = 0; i < size;i++){
                makeSet(i);
            }
        }
        void makeSet(int x){
            p[x] = x;
            rank[x] = 0;
        }

        bool same(int x,int y){
            return findSet(x) == findSet(y);
        }
        void unite(int x,int y){
            link(findSet(x), findSet(y));
        }
        void link(int x,int y){
            if(rank[x]>rank[y]){
                p[y] = x;
            }else{
                p[x] = y;
                if(rank[x]==rank[y]){
                    rank[y]++;
                }
            }
        }
        int findSet(int x){
            if(x!=p[x]){
                p[x] = findSet(p[x]);
            }
            return p[x];
        }
};



signed main()
{
  int N,M;
  cin>>N>>M;
  DisjointSet ds(N+M);
  REP(i,0,N){
    int K;
    cin>>K;
    REP(j,0,K){
      int L;
      cin>>L;
      ds.unite(i,L+N-1);
    }
  }
  int pos=ds.findSet(0);

  REP(i,1,N){

    if(pos!=ds.findSet(i)){
      cout<<"NO"<<endl;
      return 0;
    }
  }
  cout<<"YES"<<endl;

}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
using namespace std;

using ll = long long;

int main() {

    ll n, k;

    cin >> n >> k;

    vector<ll> plusNum;
    vector<ll> minusNum;

    for(ll i = 0; i < n; ++i) {
        ll num;
        cin >> num;

        if(num > 0)
            plusNum.push_back(num);
        else
            minusNum.push_back(-num);

    }

    reverse(minusNum.begin(), minusNum.end());

    ll ans = LLONG_MAX;

    for(ll i = 0; i <= k; ++i) {

        if(i > plusNum.size() || k - i > minusNum.size())
            continue;

        ll p = 0;
        if(i > 0)
            p = plusNum[i - 1];

        ll m = 0;
        if(k - i > 0)
            m = minusNum[k - i - 1];

        if(p < m)
            swap(p, m);
        
        ans = min(ans, p + 2*m);

    }


    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 4432
def union(x, y)
  xset = find(x)
  yset = find(y)
  if xset != yset
    if xset > yset
      xset, yset = yset, xset
    end
    $parent[xset] = yset
    $rank[yset] += $rank[xset]
  end
end

def find(i)
  if $parent[i] == -1
    return i
  else
    return find($parent[i])
  end
end

def rank(set)
  $rank[set]
end

$n, $m = gets.split.map(&:to_i)

bridges = $m.times.map { gets.split.map(&:to_i) }
$parent = Array.new($n + 1, -1)
$rank = Array.new($n + 1, 1)

ans = []
inconv = ($n - 1) * $n / 2
bridges.reverse_each do |x, y|
  ans << inconv
  xset = find(x)
  yset = find(y)
  if xset != yset
    inconv -= rank(xset) * rank(yset)
  end
  union(x,y)
end

puts ans.reverse


Measured memory_bytes: 15156
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <deque>
#include <set>
#include <numeric>
using namespace std;
using ll = long long;

#define next '\n'
#define sp " "
#define print(x) cout << (x)
#define println(x) cout << (x) << next
#define stop return(0)
#define rep(i, n) for(int (i) = (0); (i) < (n); (++i))
#define FOR(i, start, end) for(int (i) = (start); (i) < (end); (++i))
#define foreach(elem, _list) for(auto& (elem) : (_list))
#define view(_list) foreach(e, _list){ cout << e << sp; } cout << next
#define FAST ios::sync_with_stdio(false); cin.tie(nullptr)
#define size(s) (s).size()
#define ALL(vec) (vec).begin(), (vec).end()
#define pb(e) push_back(e)
#define INF 1e+8
#define PI acos(-1)
#define TAU PI * 2
const ll MOD = 1000000007;

int main(){
    string s;
    cin >> s;
    int len = size(s);
    vector<ll> v(2020, 0);
    v[0]++;
    reverse(ALL(s));

    ll ans = 0, digit = 1, sum = 0;
    rep(i, len){
        ll tmp = (s[i] - '0');
        sum += tmp * digit;
        sum %= 2019;
        v[sum]++;

        digit *= 10;
        digit %= 2019;
    }

    rep(i, size(v)){
        ans += v[i] * (v[i] - 1) / 2;
    }

    println(ans);
}

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

int max_n = 1000000;
vector< int > IsPrime(max_n, true);
void init()
{
    IsPrime[0] = IsPrime[1] = false;
    for (int i = 2; i < max_n; i++) {
        if (IsPrime[i]) {
            for (int j = 2; i * j < max_n; j++) {
                IsPrime[i * j] = false;
            }
        }
    }
}

int main()
{
    init();
    int x;
    cin >> x;
    for (int i = x; i < max_n; i++) {
        if (IsPrime[i]) {
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 4096
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;

int main() {
	const string tmp = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	const int mod = 52;
	for(int n; cin >> n, n;) {
		vector<int> k(n);
		for(int i = 0; i < n; ++i)
			cin >> k[i];

		string s;
		cin >> s;

		for(int i = 0; i < (int)s.size(); ++i) {
			int pos = tmp.find(s[i]);
			pos = (pos - k[i % n] + mod) % mod;
			s[i] = tmp[pos];
		}

		cout << s << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1216
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
string cal(lint a){
	if(a==0LL) return "0";
	string ret="";
	while(a!=0){
		if(a%2!=0){
			ret+='1';a--;
		}
		else ret+='0';
		a/=-2;
	}
	reverse(All(ret));
	return ret;
}
int main()
{
	int n;cin>>n;cout<<cal(n)<<endl;
}


Measured memory_bytes: 256
import sys

def solve():
    # dp[i][j] = LCS(s[:i+1],t[:j+1])
    sLen, tLen = len(s),len(t),
    dp = [ [( 0 , -1 )]*(tLen+1)  for _ in range(sLen+1) ]
    for i in range(1,sLen+1):
        for j in range(1,tLen+1):
            comp = [ dp[i][j-1][0],dp[i-1][j-1][0]+int(s[i-1]==t[j-1]),dp[i-1][j][0]]
            argmax = comp.index(max(comp))
            dp[i][j] = ( comp[argmax] , argmax )

    ans = ""
    i,j = sLen, tLen
    for _ in range(sLen+tLen):
        if dp[i][j][1] == 0:
            j -= 1
        elif dp[i][j][1] == 1:
            ans += s[i-1]
            i -= 1
            j -= 1
        elif dp[i][j][1] == 2:
            i -= 1
        else:
            break
    return ans[::-1]

if __name__ == '__main__':
    s = sys.stdin.readline()
    t = sys.stdin.readline()
    print(solve())

Measured memory_bytes: 308360
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define N 800005
#define ll long long
int tar[N], nex[N], fir[N], cnt = 1;
int n, rt1, rt2, deg[N], ans[N], vis[N];
void Read(int &p)
{
	p = 0;
	int f = 0;
	char c = getchar();
	for (; c < '0' || c > '9'; c = getchar())f |= (c == '-');
	for (; c >= '0' && c <= '9'; c = getchar())p = p * 10 + c - '0';
	if (f)p = -p;
}
void Add(int a, int b)
{
	++cnt;
	tar[cnt] = b;
	nex[cnt] = fir[a];
	fir[a] = cnt;
}
void Dfs(int r)
{
	for (int &t = fir[r]; t; t = nex[t])
	{
		if (vis[t])continue;
		int v = tar[t];
		vis[t] = vis[t ^ 1] = 1;
		Dfs(v);
		if (r > 2 * n || v > 2 * n)
			continue;
		if (r + n == v)
			ans[r] = 1;
		if (v + n == r)
			ans[v] = -1;
	}
}
int main()
{
	Read(n);
	for (int i = 1; i <= n; i++)
	{
		int x;
		Read(x);
		deg[i] ^= 1;
		if (x != -1)
		{
			Add(x, i), Add(i, x);
			deg[x] ^= 1;
		}
		else
			Add(2 * n + 1, i), Add(i, 2 * n + 1);
	}
	for (int i = 1; i <= n; i++)
	{
		int x;
		Read(x);
		deg[n + i] ^= 1;
		if (x != -1)
		{
			Add(n + x, n + i), Add(n + i, n + x);
			deg[n + x] ^= 1;
		}
		else
			Add(2 * n + 1, n + i), Add(n + i, 2 * n + 1);
	}
	for (int i = 1; i <= n; i++)
	{
		if (deg[i] != deg[n + i])
		{
			puts("IMPOSSIBLE");
			return 0;
		}
	}
	puts("POSSIBLE");
	for (int i = 1; i <= n; i++)
		if (deg[i])
			Add(i, n + i), Add(n + i, i);
	Dfs(2 * n + 1);
	for (int i = 1; i <= n; i++)
		printf("%d%c", ans[i], i == n ? 10 : 32);
}


Measured memory_bytes: 24192
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

using PII = pair<int, int>;

int main() {
	int n, a;
	cin >> n;

	vector<PII> order;

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

		auto p = make_pair(a, i + 1);
		order.emplace_back(p);
	}

	sort(order.begin(), order.end());

	for (auto p: order) {
		cout << p.second << " ";
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 1780
#include<bits/stdc++.h>
#define ll long long
#define inf 1000000007
using namespace std;
ll maxcost;
int n,S,T,cnt=-1;
int rx[1005],ry[1005],bx[1005],by[1005];
int numr[1005],numb[1005];
int fir[2105],nxt[3000005],to[3000005],flow[3000005];
ll dis[3000005],Dis[2105];
int Flow[2105],vis[2105],pre[2105],last[2105];

void add(int u,int v,int F,ll D){
	to[++cnt]=v,nxt[cnt]=fir[u],fir[u]=cnt;
	dis[cnt]=D,flow[cnt]=F;
}

int spfa(){
	memset(vis,0,sizeof(vis));
	for(int i=S;i<=T;i++) Dis[i]=-1e18,Flow[i]=inf;
	queue<int> q;
	q.push(S),Dis[S]=0,vis[S]=1,pre[T]=-1;
	while(!q.empty()){
		int now=q.front();
		q.pop();
		vis[now]=0;
		for(int i=fir[now];i!=-1;i=nxt[i]){
			if(flow[i]>0&&Dis[to[i]]<Dis[now]+dis[i]){
				Dis[to[i]]=Dis[now]+dis[i];
				pre[to[i]]=now;last[to[i]]=i;
				Flow[to[i]]=min(Flow[now],flow[i]);
				if(!vis[to[i]]) vis[to[i]]=1,q.push(to[i]);
			}
		}
	}
	return pre[T]!=-1;
}

void MCMF(){
	while(spfa()){
		int now=T;
		maxcost+=1ll*Flow[T]*Dis[T];
		while(now!=S){
			flow[last[now]]-=Flow[T];
			flow[last[now]^1]+=Flow[T];
			now=pre[now];
		}
	}
}

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d %d %d",&rx[i],&ry[i],&numr[i]);
	for(int i=1;i<=n;i++) scanf("%d %d %d",&bx[i],&by[i],&numb[i]);
	S=0,T=2*n+9;
	memset(fir,-1,sizeof(fir));
	for(int i=1;i<=n;i++) add(S,i,numr[i],0),add(i,S,0,0);
	for(int i=1;i<=n;i++) add(n+i,T,numb[i],0),add(T,n+i,0,0);
	for(int i=1;i<=n;i++){
		add(i,2*n+1,inf,-rx[i]-ry[i]),add(2*n+1,i,0,rx[i]+ry[i]);
		add(i,2*n+2,inf,-rx[i]+ry[i]),add(2*n+2,i,0,rx[i]-ry[i]);
		add(i,2*n+3,inf,rx[i]-ry[i]),add(2*n+3,i,0,-rx[i]+ry[i]);
		add(i,2*n+4,inf,rx[i]+ry[i]),add(2*n+4,i,0,-rx[i]-ry[i]);
	}
	for(int i=1;i<=n;i++){
		add(2*n+5,n+i,inf,bx[i]+by[i]),add(n+i,2*n+5,0,-bx[i]-by[i]);
		add(2*n+6,n+i,inf,bx[i]-by[i]),add(n+i,2*n+6,0,-bx[i]+by[i]);
		add(2*n+7,n+i,inf,-bx[i]+by[i]),add(n+i,2*n+7,0,bx[i]-by[i]);
		add(2*n+8,n+i,inf,-bx[i]-by[i]),add(n+i,2*n+8,0,bx[i]+by[i]);
	}
	for(int i=1;i<=4;i++) add(2*n+i,2*n+i+4,inf,0),add(2*n+i+4,2*n+i,0,0);
	MCMF();
	printf("%lld\n",maxcost);
	
	return 0;
}

Measured memory_bytes: 6656
s = input()

def check(s):
    length = len(s)
    if(length % 2 == 1):
        return False
    for i in range(int(length / 2)):
        if(s[i] != s[i + int(length / 2)]):
            return False
    return True

count = 0
while(True):
    count += 1
    if(check(s[0:len(s) - count - 1])):
        print(len(s[0:len(s) - count - 1]))
        break


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

int main(int argc, char **argv)
{
	int n; cin >> n;
	vector<int> b(n-1, 0);
	for (int i = 0; i < n-1; ++i)
		cin >> b[i];

	ll res = b[0] + b.back();
	for (int i = 0; i < n-1; ++i)
		res += min(b[i], b[i-1]);
	
	std::cout << res<< std::endl;
}

Measured memory_bytes: 256
#include <math.h>
#include <stdio.h>
#include <string.h>

#include <algorithm>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

constexpr long long INFLL = 1e18;
constexpr long long aPN = 1e9 + 7;

using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  int temp;
  double sq;
  int ans = 0;
  double ze = 0.0;

  for (int c = 1; c < n; c++) {
    temp = n - c;
    sq = sqrt(temp);

    if (floor(sq) == sq) {
      ans++;
      for (int a = 1; a < sq / 1; a++) {
        if (temp % a == 0) {
          ans += 2;
        }
      }
    } else {
      for (int a = 1; a <= sq / 1; a++) {
        if (temp % a == 0) {
          ans += 2;
        }
      }
    }
  }

  cout << ans << endl;
  return 0;
}

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

using namespace std;

int main()
{
   // freopen("input.txt","r", stdin);
    //freopen("output.txt","w",stdout);
    long long a[87]={};
    a[0]=2;
    a[1]=1;
    for(int i=2;i<87;i++) a[i] = a[i-1]+a[i-2];

    int n; cin>>n; cout<<a[n];
}

Measured memory_bytes: 3636
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
#include <climits>
#include <queue>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)



int main(){
	int n,m,x;
	cin >> n >> m >> x;
	vector<vector<int>>in;
	REP(i,n){
		vector<int> tmp(m+1);
		REP(j,m+1){
			
			cin >> tmp[j];
			
		}
		in.push_back(tmp);
	}
	
	int nedan = (int)1e+7;
	for(int bit=0; bit<(1<<n); ++bit){
		vector<int> takahashi(m,0);
		int tmp_nedan=0;
		REP(i,n){
			if(bit & (1<<i)){
				tmp_nedan += in[i][0];
				REP(j,m){
					takahashi[j] += in[i][j+1];
				}
			}
		}
		
		int tassei = 1;
		REP(j,m){
			if(takahashi[j] < x){
				tassei = 0;
			}
		}
		if(tassei){
			nedan = min(tmp_nedan,nedan);
		}
	}
	
	if(nedan==(int)1e+7){
		cout << "-1\n";
	}else{
		cout << nedan << endl;
	}
	
	return 0;
	
}

Measured memory_bytes: 3524
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
 
int main(){
  int N;
  cin>>N;
  vector<int> H(N);
  rep(i,N) cin>>H[i];
  int ans=0;
  int cnt=0;
  for(int i=1;i<N;i++){
    if(H[i]-H[i-1]<=0){
      cnt++;
    }
    if(H[i]-H[i-1]>0){
      ans=max(ans,cnt);
      cnt=0;
    }
  }
  ans=max(ans,cnt);
  cout<<ans<<endl;
}   

Measured memory_bytes: 3764
//To include everything you need
#include <bits/stdc++.h>
using namespace std;
typedef std::vector<int>  vi;
typedef std::vector<std::pair<int,int> > vpi;
typedef std::vector<string>  vs;
typedef std::vector<char>  vc;


int main(){

    int  n;
    cin>>n;
    string s;
    cin>>s;
    int count = 0;
    

    for(int i=0;i<n-2;i++){
        string comp = s.substr(i,3);
        if(comp == "ABC")
            count++;
    }

    cout<<count;
}

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

int main(){
 int a;
cin>>a;
  string b;
  vector<long long>c(5);
   long long ans=0;
  for(int i=0;i<a;i++){
    cin>>b;
    if(b[0]=='M'){
      c[0]++;
    }
        if(b[0]=='A'){
      c[1]++;
    }
        if(b[0]=='R'){
      c[2]++;
    }
        if(b[0]=='C'){
      c[4]++;
    }
        if(b[0]=='H'){
      c[3]++;
    }
  }
    for(int i=0;i<5;i++){
      for(int u=i+1;u<5;u++){
        for(int j=u+1;j<5;j++){
          ans+=c[i]*c[j]*c[u];
        }
      }
  }
   
    cout<<ans<<endl;

}


Measured memory_bytes: 256