akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String s = in.next();
            if (s.charAt(2) == s.charAt(3) && s.charAt(4) == s.charAt(5))
                out.println("Yes");
            else
                out.println("No");
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

    }
}



Measured memory_bytes: 21460
public class Main {
  private static void solve() {
    int h = ni();
    int w = ni();
    int[][] c = ntable(10, 10);

    int[] count = new int[10];
    for (int i = 0; i < h; i++) {
      for (int j = 0; j < w; j++) {
        int a = ni();
        if (a >= 0) {
          count[a]++;
        }
      }
    }
    int[][] d = wf(c);
    long ret = 0;
    for (int i = 0; i < 10; i ++) {
      ret += count[i] * d[i][1];
    }
    System.out.println(ret);
  }

  public static int[][] wf(int[][] d)
  {
      int n = d.length;
      for(int k = 0;k < n;k++){
          for(int i = 0;i < n;i++){
              for(int j = 0;j < n;j++){
                  if(d[i][j] > d[i][k] + d[k][j]){
                      d[i][j] = d[i][k] + d[k][j];
                  }
              }
          }
      }
      return d;
  }


  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}




Measured memory_bytes: 29524
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var k = int.Parse(line[0]);
        var s = int.Parse(line[1]);
        var count = 0;
        for (int i = 0; i <= k; i++)
            for (int j = 0; j <= k; j++)
            {
                var w = s - i - j;
                if (w >= 0 && w <= k) count++;
            }
        Console.WriteLine(count);
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define pb push_back

typedef long long int ll;
using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  
  vector<string> v;
  ll n, l;
  cin >> n >> l;
  for (ll i = 0; i < n; i++) {
    string s;
    cin >> s;
    v.pb(s);
  }
  sort(v.begin(), v.end());
  
  for (auto x : v) {
    cout << x;
  }
  
  return 0;
}


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

string s,t;

int main(){
	cin>>s>>t;
	int n=s.size(),m=t.size(),res=inf;
	for(int i=0;i<n-m+1;i++){
		int tmp=0;
		for(int j=0;j<m;j++) if(s[i+j]!=t[j]) tmp++;
		res=min(res,tmp);
	}
	cout<<res<<endl;
}

Measured memory_bytes: 3628
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>

using namespace std;

#define LL long long
#define N 100010

char ch[N];
bool flag = 1;

int main() {
    scanf("%s",ch+1);
    int len = strlen(ch + 1);
    for(int i = 1 ; i <= len ; i++) {
        if(i % 2 == 1) {
            if(ch[i] == 'R' || ch[i] == 'U' || ch[i] == 'D') continue;
            else flag = 0;
        }
        if(i % 2 == 0) {
            if(ch[i] == 'L' || ch[i] == 'U' || ch[i] == 'D') continue;
            else flag = 0;
        }
    }
    if(flag == 1) puts("Yes");
    else puts("No");
    //system("pause");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e18;
const long long int mod = 1e9+7;

typedef pair<ll, ll> pairs;
typedef vector<pairs> p;

struct edge{
    ll to, cost;
};


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

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

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

vector<bool> IsPrime;
void sieve(size_t max){
    if(max+1 > IsPrime.size()){
        IsPrime.resize(max+1,true);
    } 
    IsPrime[0] = false;
    IsPrime[1] = false;

    for(size_t i=2; i*i<=max; ++i){
        if(IsPrime[i]){
            for(size_t j=2; i*j<=max; ++j){
                IsPrime[i*j] = false;
            }
        }
    }
}

// 回文
bool kai(string S){
    bool flag = true;
    for(ll i=0;i<S.size()/2;++i){
        if(S[i] != S[S.size()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}
// ---------------------------------------------

int main(){
    ll l, r, d;
    cin>>l>>r>>d;
    ll ans = 0;
    for(ll i=l;i<=r;++i){
        if(i % d == 0){
            ans ++;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3620
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;
const int M=1e5+5;
int N,K;
ll g[M],ans=int(2e9);
int main(){
	scanf("%d%d",&N,&K);
	for(int i=1;i<=N;i++)scanf("%lld",&g[i]);
	for(int i=1;i+K-1<=N;i++){
		int l=i,r=i+K-1;
		ans=min(ans,g[r]-g[l]+min(abs(g[l]),abs(g[r])));
	}
	printf("%lld",ans);
}

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

const int INF = 1e9 + 5;

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

    cin >> a; 

    // cout << a;
    long long ans = 0;
    long long x= 100;

    while(x < a){
        x = x + x/100;
        ans++;
    }

    cout << ans;



    return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define dfor(i,a,b) for(ll i=(a);i>=(b);i--)
#define mem(u, vis) memset(u, vis, sizeof(u))
#define ll long long
#define ull unsigned long long
#define MOD  1000000007
#define MAX  1e9
#define pb   push_back
#define F    first
#define S    second


int main() {
	int n;
	cin>>n;
	int a[n][3];
	rep(i,n){
		cin>>a[i][0]>>a[i][1]>>a[i][2];
	}
	vector<vector<int>> dp(n, vector<int>(3,0));
	dp[0][0] = a[0][0];
	dp[0][1] = a[0][1];
	dp[0][2] = a[0][2];
	for(int i=1;i<n;++i){
		dp[i][0] = a[i][0] + max(dp[i-1][1],dp[i-1][2]);
		dp[i][1] = a[i][1] + max(dp[i-1][0],dp[i-1][2]);
		dp[i][2] = a[i][2] + max(dp[i-1][1],dp[i-1][0]);
	}
	cout<<max(dp[n-1][0], max(dp[n-1][1],dp[n-1][2]));
}

Measured memory_bytes: 6912
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
typedef pair<int,int> int_pair;
typedef pair<ll,ll> ll_pair;
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
const int N=101;
int x,a,b;


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>x>>a>>b;
	x-=a;
	int ans;
	ans=x%b;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll maxn=3e4+1;
ll dp[maxn][4];	// dp[i][j]: denotes the no. of distinct subsequences of length j till index i
ll N;
string s;
map<char,ll> lastpos;
void solve()
{
	lastpos.clear();
	cin>>N;
	cin>>s;
	dp[0][1]=1;
	dp[0][0]=1;
	dp[0][2]=0;
	dp[0][3]=0;
	lastpos[s[0]]=0;
	for(ll i=1;i<N;i++)
	{
		ll l=-1;
		if(lastpos.find(s[i])!=lastpos.end())
		{
			l=lastpos[s[i]];
		}
		dp[i][0]=1;
		dp[i][1]=dp[i-1][0]+dp[i-1][1];
		dp[i][2]=dp[i-1][1]+dp[i-1][2];
		dp[i][3]=dp[i-1][2]+dp[i-1][3];
		if(l!=-1)
		{
          if(l==0)
          {
            dp[i][1]-=1;
           }
          else
            {
			dp[i][1]-=dp[l-1][0];
			dp[i][2]-=dp[l-1][1];
			dp[i][3]-=dp[l-1][2];
            }
		}
		lastpos[s[i]]=i;
	}
	/*for(ll i=0;i<N;i++)
	{
		cout<<dp[i][1]<<" "<<dp[i][2]<<" "<<dp[i][3]<<"\n";
	}*/
	cout<<dp[N-1][3]<<"\n";
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll T=1,p=0;
	//cin>>T;
	do
	{
		solve();
		p++;
	}while(p<T);
	return 0;
}



Measured memory_bytes: 1280
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <map>
#include <cmath>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;

#define rep(i, o) for (ll i = 0; i < (o);i++)
#define rep_s(i, o) for (int i = 1; i <= (o);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<(int)(b);i++)
#define NUM 1e5

typedef long long ll;
typedef unsigned long long ull;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }


template<class T>
bool chmax(T &a, const T &b) { if (a < b) { return b; } return a; }

template<class T>
bool chmin(T &a, const T &b) { if (a > b) { a = b; return a; } return a; }

const int MOD = 1000000007;
int main() {
    string n; cin >> n;

    ll l = n.length();
    ll res = 0;
    rep(i, l) {
        res += n[i] - '0';
    }
    cout << ((res%9 == 0) ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 3748
#include <iostream>

int main(void)
{
	using namespace std;
	
	int H,W;
	while(1){
		cin >> H;
		cin >> W;

		if((H==0) && (W==0))	break;
		else{
			for(int hy=0; hy<H; ++hy){
				for(int wx=0; wx<W; ++wx){
					cout << "#";
				}
				cout << endl;
			}
		}
		cout << endl;
	}


	return 0;

}

Measured memory_bytes: 3080
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T &a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T &a, const T& b) { if (b > a) a = b; }
/* clang-format on */

int main() {
#ifdef DEBUG
  ifstream ifs("in.txt");
  cin.rdbuf(ifs.rdbuf());
#endif
  int N;
  while (cin >> N) {
    vector<ll> A(N + 1), B(N);
    for (auto& x : A) cin >> x;
    for (auto& x : B) cin >> x;
    ll res = 0;
    int x = 0, y = N - 1;
    auto f = [&](int b, int a) {
      ll got = min(B[b], A[a]);
      res += got;
      B[b] -= got;
      A[a] -= got;
    };
    while (x < y) {
      f(x, x);
      f(x, x + 1);
      f(y, y + 1);
      f(y, y);
      ++x;
      --y;
    }
    if (x == y) {
      f(x, x);
      f(x, x + 1);
    }
    cout << res << endl;
  }
  return 0;
}


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

signed main() 
{
   // haha
    int n,m;
    cin>>n>>m;
    int arr[m];
    int s=0;
    for(int i=0;i<m;i++)
    {
        cin>>arr[i];
        s+=arr[i];
        
    }
    if(s>n)
    cout<<-1;
    else
    cout<<n-s;
   
}




Measured memory_bytes: 3672
#include "iostream"
#include "vector"
#include "algorithm"
#include "map"
#define N_MAX 100005

using namespace std;

typedef long long llint;

llint N, C;
llint x[N_MAX];
int v[N_MAX];
llint A1[N_MAX];
llint A2[N_MAX];
llint B1[N_MAX];
llint B2[N_MAX];
llint g[N_MAX];


int main() {
    
    cin >> N >> C;

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

    llint sum = 0;
    llint m1 = 0;
    llint m2 = 0;
    for (int i = 1; i <= N; i++) {
        sum += v[i - 1];
        m1 = max(m1, sum - x[i - 1]);
        m2 = max(m2, sum - 2 * x[i - 1]);
        A1[i] = m1;
        A2[i] = m2;
    }
    sum = 0;    
    m1 = 0;
    m2 = 0;
    for (int i = N - 1; i >= 0; i--) {
       sum += v[i];
       m1 = max(m1, sum - (C - x[i]));
       m2 = max(m2, sum - 2 * (C - x[i]));
       B1[i] = m1;
       B2[i] = m2; 
    }

    llint ans = 0;
    for (int i = 0; i <= N; i++) {
        ans = max(ans, max(A2[i] + B1[i], A1[i] + B2[i]));
    }

    cout << ans << endl;
}

Measured memory_bytes: 4608
#include <cstdio>
#include <cctype>
#include <algorithm>

const int N = 1e5 + 7;

inline int read() {
	char ch = getchar(); int r = 0, w = 1;
	while(!isdigit(ch)) {if(ch == '-') w = -1; ch = getchar();}
	while(isdigit(ch)) {r = r * 10 + ch - '0', ch = getchar();}
	return r * w;
}

int n;
int tot, w[N], cnt[32], p[20], dp[1 << 16], ans;

inline int calc(int x) {
	int now = 0, res = 0, sz = 0;
	while(x) {
		if(x & 1) res ^= p[now], sz++;
		x >>= 1;
		now++;
	}
	return res ? sz : sz - 1;
}

int main() {
	n = read();
	for(register int i = 1; i < n; i++) {
		int x = read() + 1, y = read() + 1, z = read();
		w[x] ^= z, w[y] ^= z;
	}
	for(register int i = 1; i <= n; i++)
		cnt[w[i]]++;
	for(register int i = 1; i <= 31; i++) {
		ans += cnt[i] / 2;
		if(cnt[i] & 1)
			p[tot++] = i;
	}
	for(register int S = 1; S < 1 << tot; S++) {
		dp[S] = calc(S);
		for(register int T = S; T; T = (T - 1) & S) {
			dp[S] = std::min(dp[S], dp[T] + dp[S ^ T]);
		}
	}
	if(tot > 1) printf("%d\n", ans + dp[(1 << (tot - 1)) - 1]);
	else printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;


int main(void) {
    
    

    
    int n,k,x,y;
    cin>>n>>k>>x>>y;
    cout<<min(n,k)*x+max(n-k,0)*y<<endl;
}


Measured memory_bytes: 256
/*#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int long long
#define rep(i,a,b) for(int i=a;i<b;i++)
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define mod 1000000007
int max3(int a, int b, int c){if(a>b){if(a>c) return a; else return c;}else{if(b>c)return b;else return c;}}
int power(int a,int b){int res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int32_t main()
{
	IOS;
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	int t;
	cin>>t;
	while(t--)
	{
		string s;
		cin>>s;
		int f1=0;
		int l1=0;
		rep(i,0,s.size())
		{

			if(s[i]=='1')
			{
				f1=i;
				break;
			}
		}
		for(int i=s.size()-1;i>=f1;i--)
		{
			if(s[i]=='1')
			{
				l1=i;
				break;
			}
		}
		int cnt=0;
		rep(i,f1,l1)
		if(s[i]=='0')
			cnt++;
		cout<<cnt<<endl;
	}
	return 0;
}*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a;
	cin>>a;
	set<int> s;
	for(int i=0;pow(i,2)<=1000;i++)
		s.insert(pow(i,2));
	for(int i=0;pow(i,3)<=1000;i++)
		s.insert(pow(i,3));
	for(int i=0;pow(i,4)<=1000;i++)
		s.insert(pow(i,4));
	for(int i=0;pow(i,5)<=1000;i++)
		s.insert(pow(i,5));
	for(int i=0;pow(i,6)<=1000;i++)
		s.insert(pow(i,6));
	for(int i=0;pow(i,7)<=1000;i++)
		s.insert(pow(i,7));
	for(int i=0;pow(i,8)<=1000;i++)
		s.insert(pow(i,8));
	for(int i=0;pow(i,9)<=1000;i++)
		s.insert(pow(i,9));
	vector<int> v;
	for(auto it:s)
		v.push_back(it);
	sort(v.begin(),v.end());
	int ans=1;
	for(int i=0;i<v.size();i++)
	{
		if(v[i]<=a)
			ans=v[i];
		else break;
	}
	cout<<ans;

}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
//小さい順にソート
long long c[90002][3];
void merge(int i,int j,long long s[][3]){
  if(i!=j){
    merge(i,(i+j)/2,s);
    merge((i+j)/2+1,j,s);
    int a=i,b=(i+j)/2+1;
    int d;
    for(d=i;d<=j;d++){
      if((i+j)/2<a){
        c[d][0]=s[b][0];
        c[d][1]=s[b][1];
        c[d][2]=s[b][2];
        b++;
      }
      else if(j<b){
        c[d][0]=s[a][0];
        c[d][1]=s[a][1];
        c[d][2]=s[a][2];
        a++;
      }
      else if(s[a][2]<s[b][2]){
        c[d][0]=s[a][0];
        c[d][1]=s[a][1];
        c[d][2]=s[a][2];
        a++;
      }
      else{
        c[d][0]=s[b][0];
        c[d][1]=s[b][1];
        c[d][2]=s[b][2];
        b++;
      }
    }
    for(d=i;d<=j;d++){
      s[d][0]=c[d][0];
      s[d][1]=c[d][1];
      s[d][2]=c[d][2];
    }
  }
}

int main(){
  int h,w,d,q,i,j;
  scanf("%d%d%d",&h,&w,&d);
  long long a[h*w+1][3];
  for(i=0;i<h*w;i++){
    a[i+1][0]=i/w+1;
    a[i+1][1]=i%w+1;
    scanf("%lld",&a[i+1][2]);
  }
  merge(1,h*w,a);
  scanf("%d",&q);
  long long mass[h*w+1];
  for(i=1;i<=d;i++)
    mass[i]=0;
  for(i=d+1;i<=h*w;i++)
    mass[i]=mass[i-d]+abs(a[i][0]-a[i-d][0])+abs(a[i][1]-a[i-d][1]);
  int l[q+1],r[q+1];
  for(i=1;i<=q;i++)
    scanf("%d%d",&l[i],&r[i]);
  for(i=1;i<=q;i++)
    printf("%lld\n",mass[r[i]]-mass[l[i]]);
  return 0;
}


Measured memory_bytes: 6784
import java.util.*;
public class Main{
    static Scanner kbd = new Scanner(System.in);
    public static void main(String[] args){
	while(kbd.hasNext()){
	    solve();
	}
    }

    static void solve(){
	boolean[] m = new boolean[31];
	int i;
	for(i=0; i<28; i++){
	    int x = kbd.nextInt();
	    m[x] = true;
	}
	for(i=1; i<m.length; i++){
	    if(!m[i])
		System.out.println(i);
	}
    }
}

Measured memory_bytes: 17180
#include <iostream>
#include <vector>
#include <queue>
#define llint long long
#define inf 1e9

using namespace std;
typedef pair<llint, llint> P;

struct edge{
	llint to, cap, rev;
	edge(llint a, llint b, llint c){
		to = a, cap = b, rev = c;
	}
};

llint n;
vector<edge> G[200005];
int S, T;
llint level[200005], iter[200005];

vector<llint> revG[200005];
llint pred[200005], succ[200005];
bool used[200005];
vector<P> avec;

void bfs(llint s)
{
	for(int i = 1; i <= T; i++) level[i] = inf;
	level[s] = 0;
	
	queue<int> Q;
	Q.push(s);
	while(Q.size()){
		int v = Q.front();
		Q.pop();
		for(int i = 0; i < G[v].size(); i++){
			int u = G[v][i].to;
			if(G[v][i].cap <= 0 || level[u] < inf) continue;
			level[u] = level[v] + 1;
			Q.push(u);
		}
	}
}

llint dfs(int v, llint f)
{
	if(v == T) return f;
	
	llint ret;
	for(llint &i = iter[v]; i < G[v].size(); i++){
		if(level[v] >= level[G[v][i].to] || G[v][i].cap <= 0) continue;
		ret = dfs(G[v][i].to, min(f, G[v][i].cap));
		if(ret > 0){
			G[v][i].cap -= ret;
			G[G[v][i].to][G[v][i].rev].cap += ret;
			return ret;
		}
	}
	return 0;
}

void add_edge(int s, int t, llint cap)
{
	G[s].push_back(edge(t, cap, G[t].size()));
	G[t].push_back(edge(s, 0, G[s].size()-1));
}

void dfs2(int v)
{
	for(int i = 0; i < revG[v].size(); i++){
		if(used[revG[v][i]]) continue;
		pred[revG[v][i]] = v;
		used[revG[v][i]] = true;
		dfs2(succ[revG[v][i]]);
	}
}

int main(void)
{
	cin >> n;
	llint c, w;
	for(int i = 1; i <= n-1; i++){
		cin >> c;
		for(int j = 0; j < c; j++){
			cin >> w;
			add_edge(i, n+w, 1);
			revG[w].push_back(i);
		}
	}
	S = 2*n+1, T = 2*n+2;
	
	for(int i = 1; i <= n-1; i++) add_edge(S, i, 1);
	for(int i = 1; i <= n; i++) add_edge(n+i, T, 1);
	
	llint ans = 0, flow;
	while(1){
		bfs(S);
		if(level[T] >= inf) break;
		for(int i = 1; i <= T; i++) iter[i] = 0;
		while(1){
			flow = dfs(S, inf);
			if(flow <= 0) break;
			ans += flow;
		}
	}
	if(ans < n-1){
		cout << -1 << endl;
		return 0;
	}
	
	for(int i = 1; i <= n-1; i++){
		for(int j = 0; j < G[i].size(); j++){
			if(G[i][j].to == S) continue;
			if(G[i][j].cap == 0) succ[i] = G[i][j].to-n;
		}
	}
	int r;
	for(int i = 0; i < G[T].size(); i++){
		if(G[T][i].cap == 0){
			r = G[T][i].to-n;
			break;
		}
	}
	
	dfs2(r);
	
	for(int i = 1; i <= n-1; i++){
		if(pred[i] == 0 || succ[i] == 0){
			cout << -1 << endl;
			return 0;
		}
	}
	for(int i = 1; i <= n-1; i++){
		cout << pred[i] << " " << succ[i] << endl;
	}
	
	return 0;
}

Measured memory_bytes: 56112
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define mset(x, y) memset(x, y, sizeof x)
#define mcpy(x, y) memcpy(x, y, sizeof x)
using namespace std;

typedef long long LL;
typedef pair <int, int> pii;

inline int Read()
{
	int x = 0, f = 1, c = getchar();
	for (; !isdigit(c); c = getchar())
		if (c == '-')
			f = -1;
	for (;  isdigit(c); c = getchar())
		x = x * 10 + c - '0';
	return x * f;
}

const int MAXN = 305;
const int mod = 1e9 + 7;

int n, a[MAXN], fac[MAXN], inv[MAXN], f[MAXN][MAXN][2];

int main()
{
#ifdef wxh010910
	freopen("data.in", "r", stdin);
#endif
	n = Read(), fac[0] = fac[1] = inv[0] = inv[1] = 1;
	for (int i = 2; i <= n; i ++)
		fac[i] = 1LL * fac[i - 1] * i % mod, inv[i] = 1LL * (mod - mod / i) * inv[mod % i] % mod;
	bool sam = true;
	for (int i = 1; i <= n; i ++)
		inv[i] = 1LL * inv[i - 1] * inv[i] % mod, a[i] = Read(), sam &= a[i] == 2;
	if (sam)
		return printf("%d\n", 1LL * fac[n - 1] * inv[2] % mod), 0;
	f[0][0][0] = 1;
	for (int i = 0; i < n; i ++)
		for (int j = 0; j <= i; j ++)
			for (int k = 0; k < 2; k ++)
				if (f[i][j][k])
				{
					f[i + 1][j][k] = (f[i + 1][j][k] + f[i][j][k]) % mod;
					if (a[i + 1] >= 2)
						f[i + 1][j + 1][k] = (1LL * f[i][j][k] * (a[i + 1] - 1) + f[i + 1][j + 1][k]) % mod;
					if (a[i + 1] >= 3 && !k)
						f[i + 1][j + 1][1] = (1LL * f[i][j][k] * (a[i + 1] - 1) * (a[i + 1] - 2) + f[i + 1][j + 1][1]) % mod;
				}
	int ans = 0, cur = 1;
	for (int i = 1; i <= n; i ++)
		cur = 1LL * cur * inv[a[i] - 1] % mod;
	for (int i = 3; i < n; i ++)
		if (f[n][i][1])
			ans = (1LL * fac[i - 1] % mod * f[n][i][1] % mod * fac[n - i - 1] % mod * inv[2] + ans) % mod;
	return printf("%d\n", 1LL * ans * cur % mod), 0;
}


Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<set>
#include<vector>


using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
const long long int INF=1001001001001001001;
int N,L;

class TST{
	public:
	bool operator()(const string& left, const string& right) const {
		return (bool)(strcmp(left.c_str(), right.c_str())<0) ;
  }
};
int main(){
	vector<string> S;
	scanf("%d %d",&N,&L);
	rep(i,N){
		char a[102];
		string s;
		scanf("%s",a);
		s.insert(0,a);
		S.push_back(s);
	}
	sort(S.begin(),S.end(),TST());
	rep(i,N){
		printf("%s",S[i].c_str());
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> struct edge { int from, to; T cost;};
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}
void hey(){ cout <<"hey" <<endl; }


int main() {
  string s;
  getline(cin, s);
  rep(i, s.size()){
    char c = s[i];
    if ('a' <= c && c <= 'z') cout <<(char)(c + 'A' - 'a');
    else if ('A' <= c && c <= 'Z') cout <<(char)(c - 'A' + 'a');
    else cout <<c;
  }
  cout <<endl;
}



Measured memory_bytes: 3160
a,b = map(int,input().split())
def gcd(x,y):
  while y != 0:
    cur = x
    x = y
    y = cur%y
  return x
t = gcd(a,b)
L = []
for i in range(2,int(t**0.5)+1):
  while t%i == 0:
    t = t//i
    if i not in L:
      L.append(i)
if t != 1:
  L.append(t)
print(len(L)+1)

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

typedef long long ll;
// const int INF = 1e8;
const ll INF = 1LL << 60;
typedef pair<int, int> P;

long double a, b, c;

int main() {
    cin >> a >> b >> c;

    long double eps = 1.0e-14;
    if (sqrtl(a) + sqrtl(b) + eps < sqrtl(c)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


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

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MIN(a, b) ((a) > (b) ? (b) : (a))
#define MAX(a, b) ((a) < (b) ? (b) : (a))

const long long INF = 1LL << 60;
typedef unsigned long long ll;
const unsigned long long MOD = 998244353;

int main()
{
    int n;
    cin >> n;
    vector<int> edge(n, 0);
    int max_length = 0;
    rep(i, n)
    {
        int tmp;
        cin >> tmp;
        if (i == 0 && tmp != 0)
        {
            cout << 0 << endl;
            return 0;
        }
        else if (i != 0 && tmp == 0)
        {
            cout << 0 << endl;
            return 0;
        }
        edge[tmp]++;
        max_length = max(max_length, tmp);
    }
    if (edge[0] != 1)
    {
        cout << 0 << endl;
        return 0;
    }
    ll out = 1;
    for (int i = 1; i <= max_length; i++)
    {
        rep(j, edge[i])
        {
            out = out * edge[i - 1] % MOD;
        }
    }
    cout << out << endl;

    return 0;
}

Measured memory_bytes: 3784
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll = long long;
int main(void){
   string n;
   cin>>n;
   rep(i,3){
       if(n[i]=='1'){
           n[i]='9';
       }
       else if(n[i]=='9'){
           n[i]='1';
       }
       cout<<n[i];
   }
    cout<<endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priotity_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ll LINF=1e18;
const ld PI=abs(acos(-1));
int li[5];
string s;

int main(){
	cin >> s;
	REP(i,0,s.size()) li[s[i]-'a']++;
	sort(li,li+3);
	
	bool f=(max(li[1]-li[0], max(li[2]-li[1], li[2]-li[0]))<=1);
	cout << (f?"YES":"NO") << endl;
	return 0;
}


Measured memory_bytes: 512
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>

using namespace std;
typedef long long int ll;

int n,r;
string s,t,q,b;

int main(){
    scanf("%d",&n);
    cin>>s;
    cin>>t;
    for(int i=0;i<=n;i++){
        q="";
        b="";
        for(int j=0;j<i;j++)q+=s[j];
        q+=t;
        for(int j=0;j<n;j++){
            b+=q[j];
        }
        if(b==s){
            r=i+n;
            break;
        }
    }
    printf("%d\n",r);
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define len(s) s.length()
#define forp(i,a,b) for( i=a;i<=b;i++)
#define rep(i,n)    for( i=0;i<n;i++)
#define ren(i,n)    for( i=n-1;i>=0;i--)
#define forn(i,a,b) for( i=a;i>=b;i--)
#define all(v) v.begin(),v.end()
#define b(v) v.begin()
#define e(v) v.end()
#define mem(n,m) memset(n,m,sizeof(n))
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define pll pair<long long,long long>
#define vii vector<int>
#define vll vector<long long>
#define gl(cin,s)  getline(cin,s);
#define bitc(n) __builtin_popcountll(n)
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)

#define boost ios_base::sync_with_stdio(0)
#define MOD 1000000007
#define EPSILON 1e-9
#define PI 3.14159265358979323846
#define SIZE 200010

typedef long long  ll;
typedef unsigned long long ull;
typedef long double  ldo;
typedef double  db ;
using namespace std;
long long dp[101][100001];
int N,W;
int weight[101];
int value[101];
int main()
{
    /* #ifndef ONLINE_JUDGE
    freopen(fi, "r", stdin);
    #endif */
    //freopen("route.in","r",stdin);
    //freopen("route.out","w",stdout);
    //cin.ignore();
    //cin.clear();
    boost;
    //cin.tie(0);
    //cout<<"Case "<<tt<<": ";
    cin>>N>>W;
    for(int i=1;i<=N;i++){
      cin>>weight[i]>>value[i];
    }
    for(int i=0;i<=N;i++){
      for(int j=0;j<100001;j++){
        dp[i][j] = INT_MAX;
      }
    }
    dp[0][0] = 0;
    for(int i=1;i<=N;i++){
      for(int j=0;j<100001;j++){
        dp[i][j] = min(dp[i][j],dp[i-1][j]);
        if(j >= value[i]){
          dp[i][j] = min(dp[i][j],weight[i]+dp[i-1][j-value[i]]);
        }
      }
    }
    int fans = 0;
    for(int i=100000;i>=0;i--){
      if(dp[N][i] <= W){
        fans = i;
        break;
      }
    }
    cout<<fans<<endl;
    return 0;
}


Measured memory_bytes: 79232
#include<bits/stdc++.h>
#define ll long long int
#define f first
#define s second
#define pb push_back
#define PII pair<ll,ll>
ll const MOD = 998244353;
ll const N = 1000005;
ll const LN = 20;
ll const inf = 8e18;
using namespace std;

ll n, m, a[N];
ll ans[N];
ll dp[N];


ll p (ll x, ll n, ll m)
{
	ll r = 1;
	while (n)
	{
		if (n % 2) { r = (r * x) % m; }
		x = (x * x) % m;
		n = n / 2;
	}
	return r;
}


int main()
{
	ios::sync_with_stdio (false);
	cin.tie (NULL);
	ll n;
	cin >> n;
	ll ans = 0;
	for (ll i = 1; i <= n; i++)
	{
		ll d;
		cin >> d;
		a[d]++;
		ans -= d;
		ans %= MOD;
		if (ans < 0) { ans += MOD; }
	}
	for (ll i = N - 1; i > 0; i--)
	{
		ll p1 = 0;
		ll p2 = 0;
		for (ll j = i; j < N; j += i)
		{
			p1 += a[j] * j;
			p1 %= MOD;
			p2 += dp[j];
			p2 %= MOD;
		}
		dp[i] = (p1 * p1) % MOD;
		dp[i] -= p2;
		dp[i] %= MOD;
		if (dp[i] < 0) { dp[i] += MOD; }
		ans += (dp[i] * p (i, MOD - 2, MOD)) % MOD;
		ans %= MOD;
	}
	ans *= p (2, MOD - 2, MOD);
	ans %= MOD;
	cout << ans;
	return 0;
}


Measured memory_bytes: 17536
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
typedef long long ll;
 
int main(){
	int n;
	cin>>n;
	int a=n/100;
	if(a*111>=n) cout<<a*111<<endl;
	else cout<<(a+1)*111<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>

#include<cmath>
#include<map>
#include<string>
#include<vector>
#include<algorithm> 

using namespace std;

# define p(s) std::cout << s << endl;
# define printIf(j,s1,s2) std::cout << (j ? s1 : s2) << endl;
# define YES(j) std::cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define rep(n,i) for(i = 0 ; i < n ; i++)

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

    int res=0;
    for(int i=0;i<n;i++){
        int x;cin >> x;
        res += min(x*2,abs(k-x)*2);
    }
    p(res)
}

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

int main() {
  int64_t N,Q=1000000007,Z=0;
  cin>>N;
  vector<int64_t> p(N);
for (int i=0;i<N;i++) {
  cin>>p.at(i);
}
  sort(p.begin(), p.end());
  int64_t i=2;
  int64_t M=(N-1)*2; //ここから
       int64_t a=1,b=0,c=1;
       while(M>0){
         a*=2;
         if(M%a!=0){
           M-=a/2;
           int64_t d=i;
           for(int j=0;j<b;j++){
            d=d*d;
             d=d%Q;
          }
           c=c*d;
          c=c%Q;
         }
        b++;
      } //ここまで
  
    for(int i=0;i<N;i++){
      Z=(Z+(((p.at(i)*(N+1-i))%Q)*c)%Q)%Q;
    }
    cout<<Z<<endl;
  
}

Measured memory_bytes: 1792
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())
a=[int(input()) for i in range(n)]
ki,gu={},{}
for i in range(n):
    if i%2==0:
        ki[a[i]]=1
    else:
        gu[a[i]]=1

so=sorted(a)
# print(ki,gu)
# print(so)
ans=0
for i in range(n):
    if i%2==0:
        if so[i] in ki:
            pass
        else:
            ans+=1
    else:
        if so[i] in gu:
            pass
        else:
            ans+=1
print(ans//2)

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

int main()
{
    ll a[4];
    for(int i=0; i<4; ++i)cin >> a[i];
    ll ans=-1e18;
    for(int i=0; i<2; ++i){
        for(int j=2; j<4; ++j){
            if(ans < a[i] * a[j]){
                ans = a[i] * a[j];
            }
        }
    }
    cout << ans;
    return 0;
}


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

#define SIZE 100

int n;
int s[SIZE];
int res;

int main() {
    std::cin >> n;
    for (int i=0; i<n; ++i) {
        std::cin >> s[i];
        res += s[i];
    }
    std::sort(s, s+n);
    if (res % 10 == 0) {
        for (int i=0; i<n; ++i) {
            int tmp = res - s[i];
            if (tmp % 10 != 0) {
                res = tmp;
                break;
            }
        }
        if (res % 10 == 0) res = 0;
    }
    std::cout << res << std::endl;

    return 0;
}

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

using namespace std;

int main()
{
    long long int a,b,c,d,m1,m2,m3,m4,mx;
    cin>>a>>b>>c>>d;
    m1=a*c;
    m2=a*d;
    m4=b*c;
    m3=b*d;
    mx=max((max(m1,max(m3,m4))),m2);
    
    cout<<mx;
    
    
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

void yes() {
  cout << "Yes" << endl;
  exit(0);
}

void no() {
  cout << "No" << endl;
  exit(0);
}

int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (i % 2 == 0 && s[i] == 'L') {
      no();
    }
    if (i % 2 == 1 && s[i] == 'R') {
      no();
    }
  }
  yes();
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<string.h>
int rotation(int Dice1[],int Dice2[])
{
  int i,tmp,flag=0,count,loop=1,plus=0;
  while(1)
  {
    for(i=0;i<4;i++)
    {
      if((Dice1[0]==Dice2[0])&&(Dice1[5]==Dice2[5])) {flag++; break;}
      tmp=Dice1[0];
      Dice1[0]=Dice1[1];
      Dice1[1]=Dice1[5];
      Dice1[5]=Dice1[4];
      Dice1[4]=tmp;
    }
    if(flag==1) break;
    for(i=0;i<4;i++)
    {
      if((Dice1[0]==Dice2[0])&&(Dice1[5]==Dice2[5])) {flag++;break;}
      tmp=Dice1[0];
      Dice1[0]=Dice1[3];
      Dice1[3]=Dice1[5];
      Dice1[5]=Dice1[2];
      Dice1[2]=tmp;
    }
    if(flag==1) break;
    break;
  }
//上面と下面合わせ終了
//  printf("%d\n",flag);

  while(1)
  {
    count=0;
    for(i=1;i<=4;i++)
    {
      if(Dice1[i]==Dice2[i]) count++;
      if(count==4) {flag++; break;}
    }
    tmp=Dice1[1];
    Dice1[1]=Dice1[3];
    Dice1[3]=Dice1[4];
    Dice1[4]=Dice1[2];
    Dice1[2]=tmp;
    if(loop==4) break;
    loop++;
  }
  //側面合わせ終了
//  printf("%d\n",flag);
  if(flag>=2) { plus=1; return plus;}
  else return plus;
}


int main(void)
{
  int i,j,n,sum=0;
  scanf("%d",&n);
  int Dice[n][6];
  for(i=0;i<n;i++)
  {
    for(j=0;j<6;j++)
    {
      scanf("%d",&Dice[i][j]);
    }
  }

  for(i=0;i<n-1;i++)
  {
    //printf("0:%d=",i+1);
    sum=sum+rotation(Dice[0],Dice[i+1]);
  //  printf(" %d\n",sum);
  }
  //printf("%d\n",sum);
  if(sum==0) printf("Yes\n");
  else printf("No\n");
  return 0;
}



Measured memory_bytes: 2100
#include<iostream>
#include<cstdio>
#include<vector>
using namespace std;
int n,m;
int f[200010],val[200010],u[200010],v[200010];
vector<int>vec[200010];
inline int read(){
	int ans=0,k=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')k=-1;c=getchar();}
	while(c>='0'&&c<='9'){ans=(ans<<3)+(ans<<1)+(c-'0');c=getchar();}
	return ans*k;
}
int find(int x){
	return f[x]==x?x:f[x]=find(f[x]);
}
bool dfs(int u,int fa){
	int siz=vec[u].size();
	for(register int i=0;i<siz;i++){
		if(vec[u][i]==fa)continue;
		if(dfs(vec[u][i],u))val[u]^=1;
	}
	if(u!=1){
		if(val[u]&1){
			printf("%d %d\n",u,fa);
			return false;
		}
		else{
			printf("%d %d\n",fa,u);
			return true;
		}
	}
}
int main(){
	n=read();m=read();
	if(m&1){
		printf("-1");
		return 0;
	}
	for(register int i=1;i<=n;i++)f[i]=i;
	for(register int i=1;i<=m;i++){
		u[i]=read();v[i]=read();
		if(find(u[i])!=find(v[i])){
			vec[u[i]].push_back(v[i]);
			vec[v[i]].push_back(u[i]);
			f[f[u[i]]]=f[v[i]];
		}
		else{
			val[u[i]]^=1;
			printf("%d %d\n",u[i],v[i]);
		}
	}
	dfs(1,0);
	return 0;
} 

Measured memory_bytes: 16768
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce
import pprint
sys.setrecursionlimit(10 ** 9)


INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


class UnionFind:
    def __init__(self, n):
        # 負  : 根であることを示す。絶対値はランクを示す
        # 非負: 根でないことを示す。値は親を示す
        self.table = [-1] * n
        self.size = [1] * n
        self.group_num = n

    def root(self, x):
        if self.table[x] < 0:
            return x
        else:
            self.table[x] = self.root(self.table[x])
            return self.table[x]

    def get_size(self, x):
        r = self.root(x)
        return self.size[r]

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

    def union(self, x, y):
        r1 = self.root(x)
        r2 = self.root(y)
        if r1 == r2:
            return
        # ランクの取得
        d1 = self.table[r1]
        d2 = self.table[r2]
        if d1 <= d2:
            self.table[r2] = r1
            self.size[r1] += self.size[r2]
            if d1 == d2:
                self.table[r1] -= 1
        else:
            self.table[r1] = r2
            self.size[r2] += self.size[r1]
        self.group_num -= 1

n, m, k = LI()
G = [set() for _ in range(n)]
G2 = [set() for _ in range(n)]
U = UnionFind(n)
for _ in range(m):
    a, b = LI()
    U.union(a - 1, b - 1)
    G2[a - 1].add(b - 1)
    G2[b - 1].add(a - 1)

for _ in range(k):
    a, b = LI()
    G[a - 1].add(b - 1)
    G[b - 1].add(a - 1)


D = defaultdict(lambda:set())
for i in range(n):
    D[U.root(i)].add(i)

for i in range(n):
    i_set = D[U.root(i)]
    ret = len(i_set) - 1
    for j in G2[i]:
        if j in i_set:
            ret -= 1
    for k in G[i]:
        if k in i_set:
            ret -= 1
    print(ret, end='\t')








Measured memory_bytes: 127392
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    int ans = 0;
    vector <pair<int,int>> v(n);

    for(int i = 0 ; i < n; ++i)
    {
        int x, y;
        cin >> x >> y;
        v[i] = make_pair(x,y);
    }
    bool flag = false;
    for(auto i : v)
    {
        if(i.first == i.second) ans++;
        else ans = 0;
        if(ans == 3)
        flag = true;
    }
    if(flag) cout << "Yes" << '\n';
    else cout << "No" << '\n';
    return 0;
}

Measured memory_bytes: 3652
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}


	public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		String ans = "";
		while(n != 0) {
			if(n % 2 != 0) {
				n--;
				ans = "1"+ans;
			} else {
				ans = "0"+ans;
			}
			n /= -2;
		}
		if(ans.equals("")) {
			System.out.println("0");
		}else {
			System.out.println(ans);
		}
		sc.close();
	}


}


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

int main()
{   
    int n, a;
    int bitsum = 0;
    int count = 0;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a;
        bitsum |= a;
    }
    while (!(bitsum & 1))
    {
        count++;
        bitsum >>= 1;
    }
    cout << count << endl;
}

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

const int64_t MOD = 1e9+7;
void add(int64_t& a, int64_t b){
    a = (a+b) % MOD;
}
void mul(int64_t& a, int64_t b){
    a = a*b % MOD;
}

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> A(N), B(M);
    for(int i=0; i<N; i++) cin >> A[i];
    for(int i=0; i<M; i++) cin >> B[i];
    sort(A.rbegin(), A.rend());
    sort(B.rbegin(), B.rend());
    A.push_back(-1);
    B.push_back(-1);

    int apt = 0, bpt = 0, num = N*M;
    int64_t ans = 1;
    while(num > 0){
        if(A[apt] == num && B[bpt] == num){
            apt++;
            bpt++;
        }else if(A[apt] == num){
            apt++;
            mul(ans, bpt);
        }else if(B[bpt] == num){
            bpt++;
            mul(ans, apt);
        }else{
            mul(ans, apt*bpt - (N*M-num));
        }
        num--;
    }

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

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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  string s, t;
  cin >> s >> t;
  reverse(all(t));
  cout << (s == t ? "YES" : "NO") << endl;

  return 0;
}


Measured memory_bytes: 256