akhauriyash/Code-Regression huggingface dataset:
from bisect import bisect_right
def LIS(l):
    length = [l[0]]
    for i in range(1, len(l)):
        if l[i] >= length[-1]:
            length.append(l[i])
        else:
            pos = bisect_right(length, l[i])
            length[pos] = l[i]
    return len(length)

n = int(input())
a = [int(input()) for i in range(n)]
a = a[::-1]
print(LIS(a))


Measured memory_bytes: 86928
#include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

vector<int> dp; // 頂点 i から始まるパスで最長のものの長さ
multimap<int, int> mp; // 入力値(from, to)

// 一番遠い場所を探す
int rec(int from) {
    if (dp[from] != 0) {
        return dp[from];
    }
    int res = 0;
    // キーを持つ値を列挙する
    auto p = mp.equal_range(from);
    for (auto it = p.first; it != p.second; ++it) {
        res = max(res, rec(it->second) + 1);
    }
    return dp[from] = res;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m, ans = 0;
    cin >> n >> m;
    dp.resize(n + 1, 0);
    for (int i = 1; i <= m; i++) {
        int x, y;
        cin >> x >> y;
        mp.emplace(x, y);
    }
    for (int i = 1; i <= n; i++) {
        ans = rec(i);
    }
    cout << *max_element(dp.begin(), dp.end()) << endl;
    return 0;
}

Measured memory_bytes: 7424
#include<stdio.h>
     
    int main(void) {
        int n,i,j;
        scanf("%d",&n);
        int a[n];
        int b[n];
        for (i = 0; i < n; i++) {
            scanf("%d", &a[i]);
        }
        
        if (n%2 == 0) {
            for (j=0;j<n/2;j++) {
                b[j] = a[n-1-(j*2)];
            }
            for (j=0;j<n/2;j++) {
                b[j+n/2] = a[2*j];
            }
        } else {
            for (j=0;j<n+1/2;j++) {
                b[j] = a[n-1-(j*2)];
            }
            for (j=0;j<n/2;j++) {
                b[j+n/2+1] = a[2*j+1];
            }
        }
        
        for (i = 0; i < n; i++) {
            printf("%d ", b[i]);
        }
        return 0;
    }

Measured memory_bytes: 3712
n=int(input())
#n,k=map(int, input().split())
a=[[0]*n for _ in range(3)]
for i in range(n):
  a[0][i],a[1][i],a[2][i]=map(int,input().split())
dp=[[0]*n for _ in range(3)]
dp[0][0]=a[0][0]
dp[1][0]=a[1][0]
dp[2][0]=a[2][0]
for i in range(1,n):
  dp[0][i]=max(dp[1][i-1],dp[2][i-1])+a[0][i]
  dp[1][i]=max(dp[0][i-1],dp[2][i-1])+a[1][i]
  dp[2][i]=max(dp[1][i-1],dp[0][i-1])+a[2][i]
print(max(dp[0][-1],dp[1][-1],dp[2][-1]))

Measured memory_bytes: 79992
#include <bits/stdc++.h>
using namespace std;
# define PI           3.14159265358979323846  /* pi */


int main(){
    set<long> h = {2, 4, 5, 7, 9};

    set<long> p = {0, 1, 6, 8};
    long n;
    
    cin >> n;
    long l = n % 10;
    if (h.find(l) != h.end())
        cout << "hon";
    else if (p.find(l) != p.end())
        cout << "pon";
    else
        cout << "bon";
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define per(i, a, b) for (int i = a; i >= b; i--)
#define ll long long
#define mset(s, _) memset(s, _, sizeof s)
#define ALL(a) (a).begin(), (a).end()
using namespace std;

int main(void) {
  int n;
  cin >> n;

  if (n % 1000 == 0) {
    cout << 0 << endl;
  } else {
    cout << 1000 - (n % 1000) << endl;
  }
  return 0;
}


Measured memory_bytes: 3628
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(auto i=0;i<n;++i)
#define REPR(i,n) for(auto i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(auto i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(n,v) {int tmp;for(int i=0;i<n;++i){scanf("%d",&tmp);v.push_back(tmp);}}

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

using namespace std;

typedef pair<int,int> pii;

llong solve(llong x){
  llong res = 0;
  while(x != 0){
    if(x % 2 != 0) break;
    res++;
    x /= 2;
  }
  return res;
}

int main(){

  llong n;

  scanf("%lld", &n);
  vector<llong> v(n);

  REP(i,n){
    scanf("%lld", &v[i]);
  }

  llong ans = 0;
  REP(i,n){
    ans += solve(v[i]);
  }
  printf("%lld\n", ans);
  return 0;
}



Measured memory_bytes: 384
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
#define inf 1234567890
using namespace std;
namespace ywy{
	inline int get(){
		int n=0;char c;while((c=getchar())||233333){
			if(c>='0'&&c<='9')break;if(c=='-')goto s;
		}n=c-'0';while((c=getchar())||233333){
			if(c>='0'&&c<='9')n=n*10+c-'0';else return(n);
		}s:while((c=getchar())||23333){
			if(c>='0'&&c<='9')n=n*10-c+'0';else return(n);
		}
	}
	typedef struct _n{
		int a;int b;
		friend bool operator <(const _n &a,const _n &b){
			return(a.a<b.a);
		}
	}node;node memchi[200001];
	void ywymain(){
		int n=get();
		if(n==1){
			cout<<0<<endl;return;
		}
		int mxa=-inf,mxb=-inf,mna=inf,mnb=inf;
		for(register int i=1;i<=n;i++){
			int a=get(),b=get();if(a>b)swap(a,b);memchi[i].a=a;memchi[i].b=b;
			mxa=max(mxa,a);mna=min(mna,a);mxb=max(mxb,b);mnb=min(mnb,b);
		}ll ans=((ll)mxa-(ll)mna)*((ll)mxb-(ll)mnb);mnb=mna;sort(memchi+1,memchi+1+n);
		ll dmn=inf;int mx=-inf,mn=inf;for(register int i=1;i<n;i++){
			mx=max(mx,memchi[i].b);mn=min(mn,memchi[i].b);
			dmn=min(dmn,(ll)max(memchi[n].a,mx)-min(memchi[i+1].a,mn));
		}ans=min(ans,dmn*(mxb-mnb));cout<<ans<<endl;
	}
}
int main(){
	ywy::ywymain();return(0);
}

Measured memory_bytes: 1792
/*
本宝的程序外人别想看！！

name: [夏宝宝]
run time：[] ms
compilation time: [] ms
output memory: [] MiB
where: []
state: []
*/
#include<bits/stdc++.h>
using namespace std;

int main()
{
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	
	cout.sync_with_stdio(false);
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int n;
	
	cin>>n; 
	
	int x[n+1];
	
	for(int i=1; i<=n; i++) 
	{
		cin>>x[i];
	} 
	
	long long int maxx[100]={0};
	
	for(int i=1; i<=100; i++)
	{
		for(int j=1; j<=n; j++)
		{
			maxx[i]+=(x[j]-i)*(x[j]-i);
		}
	}
	
	long long int minv=0xffffffffffff;
	
	for(int i=1; i<=100; i++)
	{
		minv=min(maxx[i], minv);
	}
	
	cout<<minv<<endl;
	
	return 0;
}


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

using namespace std;
#define MOD 1000000007
#define pi 3.1415926535897932384626433832795028841971693993751058209749445923078164062
#define ll long long
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define ub upper_bound
#define lb lower_bound
#define popb pop_back()
#define popf pop_front()
#define ff first
#define ss second
#define vl vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vll vector< pair<ll,ll> >
#define vii vector< pair<int,int> >
#define viii vector< tuple <int,int,int> >
#define vlll vector< tuple <ll,ll,ll> >
#define vvl vector<vector<ll>>
#define vv vector<vector<int>>
#define all(v) v.begin(),v.end()
#define sqrt sqrtl
#define cbrt cbrtl
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mapcl map<char,ll>
#define mapci map<char,int>
#define mapll map<ll,ll>
#define mapii map<int,int>
#define seti set<int>
ifstream fin("input.txt");
ofstream fout("output.txt");
#define FOR(i, l, r) for (int i = int(l); i < int(r); ++i)

ll fast_exp(ll base, ll exp) {ll res=1;while(exp>0) {if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return res%MOD;}
int gcd(int a,int b){while (a&&b)a>b?a%=b:b%=a;return a+b;}
int val(char c){if (c >= '0' && c <= '9')return (int)c - '0';else return (int)c - 'A' + 10;}
ll pows(int a , int b){ll res=1;for(int i=0; i<b; ++i){res*=a;}return res;}
ll logx(ll base, ll num){int cnt=0;while(num!=1){num/=base; ++cnt;}return cnt;}
ll divisibles(ll a, ll b, ll m){if(a%m==0)return (b/m)-(a/m)+1;else return (b/m)-(a/m);}// in [a,b]
string bitstring(int n){string s;while(n){s+=(n%2)+'0';n/=2;}reverse(all(s));return s;} // only sufficient bits
// dsu start

vi root(200001,0);
vi size(200001,1);
int find(int x){while(x!=root[x])x = root[x];return x;}
bool same(int a,int b){return find(a)==find(b);}
void unite(int a, int b){a = find(a);b = find(b);if(size[a]<size[b])swap(a,b);size[a] += size[b];root[b] = a;}

// dsu end
vi vis(200001,0);
vi adj[200001];

int main()
{	
    std::ios::sync_with_stdio(false);
    //string bitstring = std::bitset< 3 >( 7 ).to_string(); <bits> (num)
    //srand(time(0));
    //cin.tie(NULL);
    //cout.tie(NULL);
 	deque<char> deq;
 	int n;
 	cin>>n;
 	string s;
 	cin>>s;
 	if(n%2)
 	{
 		cout<<"No"<<"\n";
 		return 0;
 	}
 	string str1 = s.substr(0,n/2);
 	string str2 = s.substr(n/2,n/2);
 	if(str1==str2)
 		cout<<"Yes"<<"\n";
 	else
 		cout<<"No"<<"\n";


}

Measured memory_bytes: 7424
module Main where

import Data.Functor

main :: IO()
main = do
  { [a,b] <- getInts
  ; putStrLn (hikaku (a,b))
  }

hikaku :: (Int, Int) -> String
hikaku (x,y)
 | x < y  = "a < b"
 | x == y = "a == b"
 | x > y  = "a > b"

getInts :: IO [Int]
getInts = map read . words <$> getLine

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

using ll = long long;
using p = pair<ll, ll>;
constexpr ll INF = 1LL << 62;

int main(void) {
  ll N;
  cin >> N;

  vector<string> S(N);
  for (auto&& s : S) {
    cin >> s;
  }

  map<string, ll> C;
  for (auto s : S) {
    C[s]++;
  }

  cout << "AC x " << C["AC"] << endl;
  cout << "WA x " << C["WA"] << endl;
  cout << "TLE x " << C["TLE"] << endl;
  cout << "RE x " << C["RE"] << endl;
  return 0;
}


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

x=0
y=0

for _ in range(N):
    ti,xi,yi=map(int,input().split())
    if ti - (abs(x-xi) + abs(y-yi))<0 or (ti - (abs(x-xi) + abs(y-yi)))%2==1:
        print('No')
        exit()
print('Yes')


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

class Dice {
public:
	int u, f, r, l, b, d;

	void setDice(int uu, int ff, int rr, int ll, int bb, int dd) {
		u = uu;
		f = ff;
		r = rr;
		l = ll;
		b = bb;
		d = dd;
	}

	void move(char dir) {
		int tmp;

		if (dir == 'N') {
			tmp = u;
			u = f;
			f = d;
			d = b;
			b = tmp;
		}
		else if (dir == 'W') {
			tmp = u;
			u = r;
			r = d;
			d = l;
			l = tmp;
		}
		else if (dir == 'R') {
			tmp = r;
			r = f;
			f = l;
			l = b;
			b = tmp;
		}
	}

	bool isequall(Dice d1, Dice d2) {
		for (int i = 0;i < 6;i++) {
			for (int j = 0;j < 4;j++) {
				if (d1.u == d2.u && d1.f == d2.f && d1.r == d2.r && d1.l == d2.l && d1.b == d2.b && d1.d == d2.d) {
					return true;
				}
				d1.move('R');
			}
			if (i % 2 == 0) {
				d1.move('W');
			}
			else {
				d1.move('N');
			}
		}
		return false;
	}
};


int main()
{
	int n;
	bool flg = true;
	Dice dice[101];
	cin >> n;

	for (int i = 0;i < n;i++) {
		int a, b, c, d, e, f;
		cin >> a >> b >> c >> d >> e >> f;
		dice[i].setDice(a, b, c, d, e, f);

		for (int j = 0;j < i;j++) {
			if (dice[i].isequall(dice[i], dice[j])) {
				cout << "No" << endl;
				flg = false;
				break;
			}
		}
		if (!flg) {
			break;
		}
	}
	if (flg) {
		cout << "Yes" << endl;
	}
    return 0;
}



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

using namespace std;

int n,cnt;
string s;

int main (){
	cin >> n;
	cin >> s;
	for (int i = 0 ; i < s.size(); i++){
		if (s[i] !=  s[i + 1]){
			cnt++;
		}
	}
	cout << cnt;
}

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

int main(){
	int n, k;
	cin >> n >> k;
	string s;
	cin >> s;
	int ans = 0;
	for(int i=1;i<s.length();i++)	if(s[i]==s[i-1])	ans++;
	cout << min(ans + 2*k, n-1) << endl;
	return 0;
}

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

using namespace std;

vector<int> adj[(int)1e5+1];

vector<int> dp;

int l_path(int x){
	
	if(adj[x].size()==0)
		return dp[x]=0;
	else{
		
		int m=0;
		for(auto a:adj[x]){
			
			m=max(m,(dp[a]==-1?l_path(a):dp[a]));
		}
		return dp[x]=m+1;
	}
}

int main(){
	
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++){
		
		int x,y;
		scanf("%d%d",&x,&y);
		adj[--x].push_back(--y);
	}
	dp.resize(n,-1);
	int res=0;
	for(int i=0;i<n;i++){
		
		if(dp[i]==-1){
		l_path(i);	
		}
			
		res=max(res,dp[i]);
	}
	printf("%d",res);
	
}


Measured memory_bytes: 8192
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
 *
 * @author AnandOza
 */
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);
        BTag solver = new BTag();
        solver.solve(1, in, out);
        out.close();
    }

    static class BTag {
        private static final String NO = "NO";
        private static final String YES = "YES";

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long a = in.nextInt(), fast = in.nextInt();
            long b = in.nextInt(), slow = in.nextInt();
            long t = in.nextInt();

            if (fast <= slow) {
                out.println(NO);
                return;
            }

            if ((fast - slow) * t >= Math.abs(a - b)) {
                out.println(YES);
                return;
            }

            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();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 25624
#include<iostream>
using namespace std;
const int maxn = 1e5 + 10;
int n, t,a[maxn];
int main(){
    while(cin>>n){
        for(int i = 1; i <= n;i++){
            cin >> t;
            a[t] = i;
        }
        for(int i = 1; i <= n;i++){
            cout << a[i];
            if(i<n)
                cout << " ";
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define co(a) cout<<a<<endl
#define sz size()
#define bgn begin()
#define en end()
#define pb(a) push_back(a)
#define pop pop_back
#define V vector
#define P pair
#define V2(a,b,c) V<V<int>> a(b,V<int>(c))
#define V2a(a,b,c,d) V<V<int>> a(b,V<int>(c,d))
#define incin(a) int a; cin>>a
//#define min min<int>
//#define max max<int>
template<class T>
 void cou(vector<vector<T>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}
/*template<>
 void cou(vector<vector<char>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}*/
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
struct Union{
  vector<int> par;
  Union(int n){
	par= vector<int>(n, -1);
  }
  int find(int x){
    if(par[x]<0)
      return x;
    else
      return par[x]=find(par[x]);
  }
  bool same(int a,int b){
    return find(a)==find(b);
  }
  int Size(int a){
    return -par[find(a)];
  }
  void unite(int a,int b){
    a=find(a);
    b=find(b);
    if(a==b)
      return;
    if(Size(b)>Size(a))
      swap<int>(a,b);
    par[a]+=par[b];
    par[b]=a;
  }
};
int ketas(int a){
  string b=to_string(a);
  int c=0;
  fo(i,keta(a)){
    c+=b[i]-'0';
  }
  return c;
}
signed main(){
	int a,b;
	cin>>a>>b;
	V<V<int>> e(a,V<int>(b,0));
	int c,d;
	cin>>c>>d;
	fo(i,d){
		fo(j,c){
			e[i][j]=1;
		}
	}
	for(int i=d;i<a;i++){
		for(int j=c;j<b;j++){
			e[i][j]=1;
		}
	}
	fo(i,a){
		fo(j,b){
			cout<<e[i][j];
          if(j==b-1)
            cout<<endl;
		}
	}
}

Measured memory_bytes: 9088
#include <bits/stdc++.h>
#include <iostream>
#include <functional>
#include <vector>
#include <stdio.h>
#include <queue>
#include <string.h>
#include <math.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define rep1(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=a;i>=n;i--)
#define per1(i,a,n) for (int i=a;i>n;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define endl "\n"
#define pi 3.14159265358979323846264338327950288419716939937510
#define IOS cin.sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll mod=1000000007;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
ll qpow(ll a,ll b){ll s=1;while(b>0){if(b%2==1){s=s*a;}a=a*a;b=b>>1;}return s;}
ll qpowmod(ll a, ll b, ll c){ll res, t;res=1;t=a%c;while(b){if(b & 1){res=res*t%c;}t=t*t%c;b>>=1;}return res;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline long long read(){long long k=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){k=k*10+ch-'0';ch=getchar();}return k*f;}
inline void write(long long x){if(x<0)x=-x,putchar('-');if(x>9)write(x/10);putchar(x%10+'0');}
// head
string s;
ll len;
int main()
{
    //IOS;
    cin>>s;
    len=s.length();
    for(int i=0;i<=len-1;i++)
    {
        cout<<'x';
    }
    return 0;
}
/*

*/


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
// -----------------<fast IO>------------------
#define IOS             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FLSH             fflush(stdout)
#define fileIO(name) \
    freopen(name".in", "r", stdin); \
    freopen(name".out", "w", stdout);
#define PRECISION(x)     cout << fixed << setprecision(x);
#define endl             "\n"
// -----------------<Container manipulation / traversal macros>------------------
#define mp                 make_pair
#define pb                 push_back
#define ff                 first
#define ss                 second
#define sz(x)             ((int)((x).size()))
#define all(x)             (x).begin(),(x).end()
#define rep(i,n)         for(ll (i)=0;(i)<(n);(i)++)
#define forn(i,a,b)     for(ll (i)=(a);(i)<=(b);(i)++)
#define fill(l,a)        memset((l) , (a) , sizeof(l))
// -----------------<Some common useful functions>------------------
#define maX(a,b)        ( (a) > (b) ? (a) : (b))
#define miN(a,b)        ( (a) < (b) ? (a) : (b))
#define checkbit(n,b)   ( (n >> b) & 1)
#define INDEX(arr,i)      ( lower_bound(all(arr),i)-arr.begin())
#define in(b,a)         ( (b).find(a) != (b).end())
// -----------------<TypeDef Start>------------------
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector< std::vector<ll> > matrix;
typedef map<ll,ll> mii;
typedef vector<pii> vpii;
// -----------------<Constants>------------------
const int MAXN = 1000005;
const int SQRTN = 1003;
const int LOGN = 22;
const double PI=acos(-1);

const int INF=1e9;

int MOD = 1000000007;
const int FMOD = 998244353;
const double eps = 1e-9;
ll gcd(ll a,ll b)
{
    if(a==0)
    return(b);
    return(gcd(b%a,a));
}
ll lcm(ll a,ll b)
{
    return(a/gcd(a,b)*b);
}
/*ll power(ll a,ll b,ll p)
{
    ll res=1;
    a%=p;
    while(b>0)
    {
        if(b&1)
        res=res*a%p;
        a=a*a%p;
        b>>=1;
    }
    return(res);
}
ll modInverse(ll a, ll m)
{
    ll g = gcd(a, m);
    return(power(a,m-2,m));
}*/
/*ll b_search(ll arr[],ll n,ll s)
{
    ll l=0,r=n-1;
    while(l<=r)
    {
        ll mid=l+(r-l)/2;
        if(arr[mid]==s)
        return(mid);
        if(arr[mid]<s)
        l=mid+1;
        else
        r=mid-1;
    }
    return(-1);
}*/
bool isprime(ll x)
{
    if(x==1)
        return(false);
    for(ll i=2;i*i<=x;i++)
    {
        if(x%i==0)
            return(false);
    }
    return(true);
}
/*vector<ll> v[100005];
bool vis[100005]={false};
long combi(int n,int k)
{
    long ans=1;
    k=k>n-k?n-k:k;
    int j=1;
    for(;j<=k;j++,n--)
    {
        if(n%j==0)
        {
            ans*=n/j;
        }else
        if(ans%j==0)
        {
            ans=ans/j*n;
        }else
        {
            ans=(ans*n)/j;
        }
    }
    return ans;
}*/

void solve()
{
    ll a;
    cin>>a;
    cout<<a+(a*a)+(a*a*a)<<endl;
}


int main()
{
    IOS
    ll t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return(0);
}


Measured memory_bytes: 3640
#!/usr/local/bin/python3
# https://atcoder.jp/contests/abc066/tasks/abc066_b

S = list(input())[:-2]

def check(S):
    half = len(S) // 2
    if S[:half] == S[half:]:
        return True
    else:
        return False

while True:
    if check(S):
        print(len(S))
        break
    S = S[:-2]


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

int main()
{
    int a, b;
    std::cin >> a >> b;
    
    if (((a % 2) == 0 ) || ((b % 2) == 0)){
        std::cout << "Even" << std::endl;
    } else {
        std::cout << "Odd" << std::endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}


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



    rep(i, k) {
        cout << s << " ";
    }
    FOR(i, k, n) {
       if(s!=1) cout << s-1 << " ";
       else cout << s+1 << " ";
    }
    cout << endl;
    
    return 0;
}

Measured memory_bytes: 1280
#include <algorithm>
#include <cmath>
#include <iostream>

using namespace std;

int main() {
    int N;
    double T, A;
    cin >> N >> T >> A;

    // (平均気温とTの差, index)の配列
    pair<double, int> t[N];
    for (int i = 0; i < N; ++i) {
        double H;
        cin >> H;
        // indexは1-indexedで保持
        t[i] = make_pair(abs(A - (T - H * 0.006)), i + 1);
    }

    sort(t, t + N);
    cout << t[0].second << endl;
    return 0;
}


Measured memory_bytes: 256
def judge(lst):
	tmp = lst[0]
	for i in range(1, len(lst)):
		if tmp == lst[i]:
			return 'no'
		tmp = lst[i]
	return 'yes'

s = raw_input()
slist = []
for i in range(0, len(s)):
	slist.append(s[i])
slist.sort()

print judge(slist)

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

int main() {
  long long K;
  cin >> K;
  
  long long result;
  if (K % 2 == 1) {
    result = (K / 2 + 1) * (K / 2);
  } else {
    result = (K / 2) * (K / 2);
  }
  
  cout << result << endl;
  
  return 0;
}

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

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


        int s=sc.nextInt();
        int  w=sc.nextInt();
        if(w>=s){
            System.out.println("unsafe");
        }else{
            System.out.println("safe");
        }

    }
}





Measured memory_bytes: 35640
#include <iostream>
#include <cstring>
using namespace std;

int main() {
    char s[3][3];
    for (int tmp = 0; tmp < 3; tmp++){
        cin >> s[tmp];
    }
    cout << s[0][0] << s[1][1] << s[2][2] << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.NoSuchElementException;
import java.util.Queue;

public class Main implements Runnable{

	public static void main(String[] args) {
		new Thread(null,new Main(), "" ,Runtime.getRuntime().maxMemory()).start();
	}
	
	int gcd(int a,int b) {
		return a==0?b:gcd(b%a,a);
	}
	
	public void run() {
		FastScanner sc=new FastScanner();
		int H=sc.nextInt();
		int W=sc.nextInt();
		char[][] a=new char[H+2][W+2];
		for(int i=0;i<H+2;++i)for(int j=0;j<W+2;++j)a[i][j]='#';
		for(int i=0;i<H;++i) {
			char[] tmp=sc.next().toCharArray();
			for(int j=0;j<W;++j) {
				a[i+1][j+1]=tmp[j];
			}
		}
		for(int i=0;i<H+2;++i) {
			for(int j=0;j<W+2;++j) {
				System.out.print(a[i][j]);
			}
			System.out.println();
		}
	}
	
	void tr(Object...objects) {System.out.println(Arrays.deepToString(objects));}
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    
    public double nextDouble() { return Double.parseDouble(next());}
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using Pt = pair<int, int>;

void ABC123C()
{
	ll N;
	cin >> N;
	vl A(5);
	for (auto& x : A)
		cin >> x;
	sort(A.begin(), A.end());
	ll x = A.front();
	ll y = N / x;
	if (N%x != 0)
		++y;
	cout << y + 4 << endl;
}


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

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
            sb.append("x");
        }
        System.out.println(sb.toString());
    }

}


Measured memory_bytes: 23892
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

const long long MOD = 4294967291LL;
const long long INF = 1e18;

int GCD(int a, int b){return b == 0 ? a : GCD(b, a % b);}
long long fast_exp(long long base, long long exp, long long mod = MOD) {
    long long tot = 1;
    for(;exp > 0;exp >>= 1) {
       if((exp & 1) == 1) tot = tot * base % mod;
       base = base * base % mod;
    }
    return tot;
}
long long mult_mod(long long base, long long exp, long long mod = MOD) {
    long long tot = 0;
    for(;exp > 0;exp >>= 1){
       if((exp & 1) == 1) tot = (tot + base) % mod;
       base = base * 2 % mod;
    }
    return tot;
}

struct chash {
    static uint64_t splitmix64(uint64_t x) {x += 0x8e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf54876d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb; return x ^ (x >> 31);}
    size_t operator()(uint64_t x) const { static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(x + FIXED_RANDOM);}
    size_t operator()(pair<uint64_t,uint64_t> x) const { static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(x.first + FIXED_RANDOM)^(splitmix64(x.second + FIXED_RANDOM) >> 1);}
};

int main(){

    cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n; cin >> n;

    vector<int> arr;

    for(int a, i = 0; i < n; ++i){
        cin >> a; arr.push_back(a);
    }

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

    long double cur = arr[0];

    for(int i = 1; i < n; ++i){
        cur = (cur + arr[i]) / 2;
    }

    cout << setprecision(6) << fixed << cur;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a,b,x;
    input:
    scanf("%d%d",&a,&b);
    if(a>=1&&a<=3&&b>=1&&b<=3){
    x=a*b;
    if(x%2!=0)
    printf("Yes\n");
    else
        printf("No\n");
    }
    else
        goto input;

    return 0;
}

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

int main(){
string S;
  cin>>S;
  int a=0, z=0;
  for(int i=0; i<S.size(); i++){
   if(S[i]=='A'){a=i-1; break;}
  }
  
  for(int i=S.size()-1; i>0; i--){
   if(S[i]=='Z'){z=i; break;}
  }
  
  cout<<z-a;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> P3;
typedef pair<P ,P> PP;
constexpr ll MOD = 998244353;
constexpr int IINF = INT_MAX;
constexpr ll LLINF = LLONG_MAX;
constexpr int MAX_N = int(1e6) + 5;
constexpr double EPS = 1e-8;
constexpr int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()

ll dp[1005][1<<12];

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> a(m), c(m);
    for(int i=0;i<m;i++){
        int b;
        cin >> a[i] >> b;
        for(int j=0;j<b;j++){
            int k;
            cin >> k;
            c[i] |= 1<<(k-1);
        }
    }
    for(int i=0;i<=m;i++){
        fill(dp[i], dp[i]+(1<<n), LLINF/3);
    }
    dp[0][0] = 0;
    for(int i=0;i<m;i++){
        for(int j=0;j<(1<<n);j++){
            dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
            dp[i+1][j|c[i]] = min(dp[i+1][j|c[i]], dp[i][j] + a[i]);
        }
    }
    cout << (dp[m][(1<<n)-1] < LLINF/3 ? dp[m][(1<<n)-1] : -1) << endl;
    return 0;
}

Measured memory_bytes: 32256
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 51;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
vector<ll> cntP(MAX), height(MAX);
/* function */
void init() {
    cntP[0] = height[0] = 1;
    for (int i = 0; i < MAX - 1; i++) {
        cntP[i+1] = cntP[i] * 2 + 1;
        height[i+1] = 1 + height[i] + 1 + height[i] + 1;
    }
}
ll f(int n, ll x) {
    ll harf = height[n] / 2;
    if (x <= 0) return 0;
    if (n <= 0) return 1;
    if (x <= harf) return f(n - 1, x - 1);
    else return f(n - 1, min(x - harf - 1, harf)) + cntP[n - 1] + 1;
}
/* main */
int main(){
    int N;
    ll X;
    cin >> N >> X;
    init();
    cout << f(N, X) << '\n';
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
import bisect

def solve(N: int, A: "List[int]", B: "List[int]", C: "List[int]"):
    A.sort()
    C.sort()
    answer = 0
    for i in range(N):
        A_index = bisect.bisect_left(A,B[i])
        C_index = bisect.bisect_left(C,B[i]+1) 
        answer += (N-C_index)*A_index
    print(answer)

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    B = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    C = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A, B, C)

if __name__ == '__main__':
    main()


Measured memory_bytes: 24188
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define mp make_pair
#define pb(x) push_back(x)
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define mll map<long long, long long>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define flsh fflush(stdout)
#define gcd __gcd
#define clr(x) memset(x, 0, sizeof(x))
#define mod 1000000007LL
#define mod2 998244353LL
#define INF 1000000000007
 

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> o_tree;


void solve()
{
   string s;
   cin>>s;

   ll q;
   cin>>q;
   string l="",r="";
   ll f=0;
   while(q--)
   {
       ll t;
       cin>>t;
       if(t==1)
       {
          f=1-f;
        
       } 
       else{
          ll ff;
          char c;
          cin>>ff>>c;
          if(ff==1)
          {
             if(f==0)
             {
               l+=c;
             }
             else{
                r+=c;
             }
          }
          else{
             if(f==0)
             {
                r+=c;
             }
             else
             {
                l+=c;  
             }
             
          }
       }
   }
   
//    cout<<l<<" -- "<<r<<"\n";
//    cout<<f<<"\n";
   reverse(all(l));
   if(f)
   {
       reverse(all(s));
       reverse(all(l));
       reverse(all(r));
       cout<<(r+s+l)<<"\n";
       return;
   }
   cout<<(l+s+r)<<"\n";
}


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


if (fopen("input.txt","r" ))
  {
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
  }
cout<<setprecision(20);


ll t=1;


// cin>>t;


while(t--)
{
solve();
} 


return 0;
}

Measured memory_bytes: 4264
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
#include<functional>
#include<cstdlib>
#include<queue>
const double PI = acos(-1);
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
using ll =long long;
const int mod = 1000000007;

//map<string>a;
class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% mod + mod) % mod) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint & a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator-=(const mint & a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator*=(const  mint & a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint & a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint & a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint & a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint & a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint & a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream & os, const mint & m) {
		os << m.x;
		return os;
	}
};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
//組み合わせ
void recursive_comb(vector<int> indexes, int s, int rest, std::function<void(vector<int>)> f) {
	if (rest == 0) {
		f(indexes);
	}
	else {
		if (s < 0) return;
		recursive_comb(indexes, s - 1, rest, f);
		indexes[rest - 1] = s;
		recursive_comb(indexes, s - 1, rest - 1, f);
	}
}

// nCkの組み合わせに対して処理を実行する
void foreach_comb(int n, int k, std::function<void(vector<int>)> f) {
	vector<int>indexes(k);
	recursive_comb(indexes, n - 1, k, f);
}

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);
}

int main() {
	ll H, W;
	cin >> H >> W;
	vector<vector<char>>a(H,vector<char>(W));
	ll herex = 1;
	ll check=0;
	ll count=0;
	rep(i, H) {
		rep(j, W) {
			cin >> a[i][j];
			if (a[i][j] == '#') {

				count++;
			}
		}

	}
	if (count != W + H-1) {

		cout << "Impossible";
		return 0;
	}
	/*rep(j, W) {
		check = 0;
		rep(i, H) {
			if (check == 0 && a[i][j] == '#') {
				check = 1;
			}
			if (check == 1 && a[i][j] == '.') {

				check = 2;
			}
			if (check == 2 && a[i][j] == '#') {

				cout << "Impossible";
				return 0;
			}
		}

	}*/
	cout << "Possible";
}





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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
#define MOD (ll)(1e9+7)

char S[101010];
ll Sn;
ll dp[101010][15];
ll i,j,k,ans;
int main(){
    scanf("%s", S);
    dp[0][0] = 1;
    ll a = 1;
    for(Sn = 0; S[Sn];Sn++)
        ;
    

    for (i = 0; i<Sn;i++)
    {
        if(S[Sn-1-i]=='?'){
            fornum(j,0,13){
                fornum(k,0,10){
                    dp[i + 1][(j + k * a) % 13] 
                    = (dp[i + 1][(j + k * a) % 13] + dp[i][j]) % MOD;
                }
            }
        }else{
            fornum(j,0,13){
                ll b = S[Sn-1-i] - '0';
                dp[i + 1][(j +b * a) % 13] = (dp[i + 1][(j + b * a) % 13] + dp[i][j]) % MOD;         
            }
        }
        a = a * 10 % 13;
    }
    printf("%lld", dp[i][5]);
    return 0;
}

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

#define DEBUG 1

int main()
{
  int A;
  int B;
  char op;

  cin >> A >> op >> B;

  int ans = 0;
  if (op == '+') {
    ans = A + B;
  } else if (op == '-') {
    ans = A - B;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
n,m = map(int,input().split())
LR = sorted([list(map(int,input().split())) for i in range(m)])
c_min = 0
c_max = n+1

for i in range(m):
    l = LR[i][0]
    r = LR[i][1]
    
    if c_max < l:
        print(0)
        exit()
    else:
        c_min = max(c_min,l)
        c_max = min(c_max,r)
        
print(c_max - c_min + 1)

Measured memory_bytes: 28540
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 

ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
bool dp1[ohara];
bool dp2[ohara];

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>n>>a>>b>>c>>d>>s;
    a--;b--;c--;d--;
    if(c>d){
        int ok=1;
        rrep(i,a,c){
            if(s[i]=='#'&&s[i+1]=='#')ok=0;
        }
        if(!ok){
            Cout("No");
            return 0;
        }
        ok=0;
        rrep(i,b,d+1){
            if(s[i-1]=='.'&&s[i]=='.'&&s[i+1]=='.')ok=1;
        }
        if(ok)Cout("Yes");
        else Cout("No");
    }
    else{
        int ok=1;
        rrep(i,b,d+1){
            if(s[i]=='#'&&s[i+1]=='#')ok=0;
        }
        rrep(i,a,c+1){
            if(s[i]=='#'&&s[i+1]=='#')ok=0;
        }
        if(ok)Cout("Yes");
        else Cout("No");
    }
    return 0;
}


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

def main():
	W, H, x, y = map(int, (input().strip().split()))
	if W/2 == x and H/2 == y:
		i = 1
	else:
		i = 0
	print("{:.9f} {}".format(W*H/2, i))


if __name__ == '__main__':
	main()


Measured memory_bytes: 38384
N = input()
str_lis = input().split()
num_lis = [int(x) for x in str_lis]
mod2_lis = [x % 2 for x in num_lis]
i = 0

while not sum(mod2_lis):
    num_lis = [x / 2 for x in num_lis]
    mod2_lis = [x % 2 for x in num_lis]
    i += 1

print(i)

Measured memory_bytes: 2940
use utf8;
use warnings;
use strict;
use feature qw/say/;

chomp(my $line = <>);
my ($n, $r) = split(/ /, $line);

my $irate;
if ($n >= 10) {
    $irate = $r;
} else {
    $irate = $r + 100 * (10 - $n);
}
say $irate;

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

using namespace std;

const int N = 305;
const int S = N * N;
const int mod = 998244353;

void add(int &x,int y) {
  x += y;
  if (x >= mod) x -= mod;
}

void sub(int &x,int y) {
  x -= y;
  if (x < 0) x += mod;
}

int mul(int x,int y) {
  return (long long) x * y % mod;
}

int a[N];
int f[S], g[S];
int nf[S], ng[S];

int main() {
  int n;
  scanf("%d", &n);
  f[0] = 1;
  g[0] = 1;
  int sum = 0;
  for (int i = 1; i <= n; ++i) {
    int x;
    scanf("%d", &x);
    for (int j = 0; j <= sum; ++j) {
      add(nf[j], f[j]);
      add(nf[j + x], f[j]);
      add(ng[j], mul(g[j], 2));
      add(ng[j + x], g[j]);
    }
    sum += x;
    for (int j = 0; j <= sum; ++j) {
      f[j] = nf[j], nf[j] = 0;
      g[j] = ng[j], ng[j] = 0;
    }
  }
  int ans = 1;
  for (int i = 1; i <= n; ++i) ans = mul(ans, 3);
  for (int i = 0; i <= sum; ++i) if (i + i >= sum) {
    sub(ans, mul(g[i], 3));
  }
  if (sum % 2 == 0) add(ans, mul(f[sum / 2], 3));
  printf("%d\n", ans);
  return 0;
}


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

int main(){
  int A,B,C,X,Y,answer;
  cin>>A>>B>>C>>X>>Y;
  answer=min(A*X+B*Y,min(2*C*max(X,Y),2*C*min(X,Y)+A*(X-min(X,Y))+B*(Y-min(X,Y))));
  cout<<answer<<endl;
}
    

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


def main():
    n, k = map(int, input().split())
    X, Y = [], []
    for _ in range(n):
        x, y = map(int, input().split())
        X.append(x)
        Y.append(y)
    X_s = sorted(X)
    Y_s = sorted(Y)
    f_inf = float("inf")
    res = f_inf

    for x1 in range(n):
        for x2 in range(x1 + 1, n):
            for y1 in range(n):
                for y2 in range(y1 + 1, n):
                    lx, rx = X_s[x1], X_s[x2]
                    by, uy = Y_s[y1], Y_s[y2]
                    cnt = 0
                    for i in range(n):
                        if lx <= X[i] <= rx and by <= Y[i] <= uy:
                            cnt += 1
                    if cnt >= k:
                        res = min(res, (rx - lx) * (uy - by))
    print(res)


if __name__ == '__main__':
    main()


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

int GCD(int x ,int y){
    return (x ? GCD(y % x, x) : y);
}

using namespace std;

int main(void){
    // Your code here!
    int n,x;
    cin>>n>>x;
    int a[n],b[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
        b[i]= abs(a[i]-x);
    }
    int ans = GCD(b[0],b[1]);
    for(int i=2;i<n;i++){
        ans = GCD(ans,b[i]);
    }

    cout<<ans<<endl;
}


Measured memory_bytes: 1024
import java.util.HashSet;
import java.util.Set;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] line = br.readLine().split(" ");
        int a = Integer.parseInt(line[0])-1;
        int b = Integer.parseInt(line[1])-1;
        System.out.println(a*b);
    }
    
    
}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
using ll=long long;
const ll MOD=1000000007,MOD2=998244353;



int main() {
    int N;
    cin>>N;
    vector<int> H(N);
    rep(i,N){
        cin>>H.at(i);
    }
    int ans=0,now=0;
    rep(i,N-1){
        if(H.at(i+1)<=H.at(i)){
            now++;
        }
        else{ans=max(now,ans);now=0;}
    }
    ans=max(now,ans);
    cout<<ans<<endl;
}

Measured memory_bytes: 764
n, y = gets.split.map(&:to_i)
c = 0
ans = [-1, -1, -1]
(0..n).each do |a|
  (0..n).each do |b|
    if a+b<=n
      c = n-a-b
      if (10000*a)+(5000*b)+(1000*c) == y
        ans = [a, b, c]
        break
      end
    end
  end
end
puts ans.join(" ")

Measured memory_bytes: 1788