akhauriyash/Code-Regression huggingface dataset:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
	return list(map(int,input().split()))
def m(): #複数文字
	return map(int,input().split())
def onem(): #Nとかの取得
	return int(input())
def s(x): #圧縮
	a = []
	if len(x) == 0:
		return []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa != x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): #listをスペースごとに分ける
	return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
	return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
	ll = 0
	rr = r
	while True:
		mid = (ll+rr)//2

	if rr == mid:
		return ll
	if (ここに評価入れる):
		rr = mid
	else:
		ll = mid+1
"""

def make_primes(n): #nまでの素数列挙
    ass = []
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    for i in range(len(is_prime)):
        if is_prime[i]:
            ass.append(i)
    return ass  


def prime_decomposition(n): #素因数分解
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(int(n))
  return table

def make_divisors(n): #約数列挙
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

n = onem()

kkk = prime_decomposition(n)
ppp = make_divisors(n)
k = s(kkk)
ans = 0

for i in range(len(k)):
	no = k[i]
	po = 1
	while True:
		if no[1] - po >= 0:
			no[1] -= po
			ans += 1
			po += 1
		else:
			break 
print(ans)

Measured memory_bytes: 68500
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b;
  cin >> a >> b;
  int k = 1;
  int c = b;
  while(1){
    if(c / 10 == 0) break;
    k++;
    c /= 10;
  }
  for(int i = 0; i < k; i++) a *= 10;
  a += b;
  string ans = "No";
  for(int i = 0; i < a/2; i++){
    if(i*i > a) break;
    if(i*i == a){
      ans = "Yes";
      break;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof x)
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
#define outval(x) cerr<<#x" = "<<x<<endl
#define outtag(x) cerr<<"-----------------"#x"-----------------\n"
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
                    For(_x,L,R) cerr<<a[_x]<<" ";cerr<<endl;
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair <int,int> pii;
LL read(){
    LL x=0,f=0;
    char ch=getchar();
    while (!isdigit(ch))
        f=ch=='-',ch=getchar();
    while (isdigit(ch))
        x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
    return f?-x:x;
}
const int N=250005,mod=998244353;
int Pow(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=(LL)x*x%mod)
		if (y&1)
			ans=(LL)ans*x%mod;
	return ans;
}
void Add(int &x,int y){
	if ((x+=y)>=mod)
		x-=mod;
}
void Del(int &x,int y){
	if ((x-=y)<0)
		x+=mod;
}
int Add(int x){
	return x>=mod?x-mod:x;
}
int Del(int x){
	return x<0?x+mod:x;
}
const int k=10;
vector <int> bas(k),ibas(k);
void prework(){
	srand(1233);
	For(i,0,k-1){
		bas[i]=rand()%10000+1;
		ibas[i]=Pow(bas[i],mod-2);
	}
}
struct cmp{
	bool operator () (vector <int> a,vector <int> b){
		assert((int)a.size()==k&&(int)b.size()==k);
		For(i,0,k-1)
			if (a[i]!=b[i])
				return a[i]<b[i];
		return 0;
	}
};
map <vector <int>,int,cmp> cnt;
void Add(pair <int,int> &a,int b){
	Add(a.se,(LL)b*a.fi%mod);
}
void Del(pair <int,int> &a,int b){
	Del(a.se,(LL)b*a.fi%mod);
}
void Mul(int &a,int b){
	a=(LL)a*b%mod;
}
void Mul(pair <int,int> &a,int b){
	Mul(a.fi,b);
}
template <typename T> vector <T> trans(vector <T> x,int op){
	vector <T> a=x;
	if (op==1||op==-2)
		For(i,0,k-1)
			Add(a[i],1);
	else if (op==2||op==-1)
		For(i,0,k-1)
			Del(a[i],1);
	else if (op==3||op==-4)
		For(i,0,k-1)
			Mul(a[i],bas[i]);
	else if (op==4||op==-3)
		For(i,0,k-1)
			Mul(a[i],ibas[i]);
	return a;
}
int n;
char s[N];
map <char,int> op;
vector <int> all(k,0),zero(k,0);
vector <pair <int,int> > a(k,mp(1,0)),b(k,mp(1,0));
vector <int> Calc(vector <pair <int,int> > a,vector <int> x){
	vector <int> b(k);
	For(i,0,k-1)
		b[i]=((LL)a[i].fi*x[i]+a[i].se)%mod;
	return b;
}
int main(){
	prework();
	op['+']=1,op['-']=2,op['>']=3,op['<']=4;
	n=read();
	cin>>(s+1);
//	outarr(bas,0,k-1);
//	outarr(ibas,0,k-1);
	Fod(i,n,1)
		all=trans(all,op[s[i]]);
//	outarr(all,0,k-1);
	LL ans=0;
	cnt[Calc(a,zero)]++;
	Fod(i,n,1){
		a=trans(a,-op[s[i]]);
		b=trans(b,-op[s[i]]);
		ans+=cnt[Calc(b,all)];
		cnt[Calc(a,zero)]++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 62976
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>

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

int di[4] = {1, 0, -1, 0};
int dj[4] = {0, 1, 0, -1};
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

int main(){
    string str;
    string left = "qwertasdfgzxcvb";
    string right = "yuiophjklnm";

    while(true){
        cin >> str;
        if(str=="#") break;
        int cnt = 0;
        bool on_right = true;
        REP(i,str.size()){
            if(on_right){
                REP(j,left.size()){
                    if(str[i] == left[j]){
                        on_right = false;
                        cnt++;
                        if(i==0) cnt--;
                    }
                }
            }else{
                REP(j,right.size()){
                    if(str[i] == right[j]){
                        on_right = true;
                        cnt++;
                        if(i==0) cnt--;
                    }
                }
            }
        }
        cout << cnt << endl;
    }
    return 0;
}

Measured memory_bytes: 1192
import java.util.Scanner;
import java.util.Arrays;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] d = new int[n];
        for(int i = 0 ; i < n ; i++ ){
            d[i] = sc.nextInt();
        }
        sc.close();
        Arrays.sort(d);
        System.out.println(d[n / 2] - d[n / 2 - 1]);
    }
}

Measured memory_bytes: 59684
import java.util.Scanner;
import java.util.SortedSet;
import java.util.TreeSet;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		SortedSet<Integer> primes = new TreeSet<Integer>();
		primes.add(2);
		primes.add(3);
		int max = 3;
		while (in.hasNext()) {
			int val = in.nextInt();
			if (max < val) {
				label: for (int cVal = max + 2; cVal <= val; cVal = cVal + 2) {
					int pre = 1;
					int canCheckVal = 1;
					max = cVal;
					for (int prime : primes) {
						canCheckVal = pre * prime;
						if (cVal % prime == 0) {
							continue label;
						}
						if (cVal < canCheckVal) {
							break;
						}
						pre = prime;
					}
					primes.add(cVal);
				}
			}
			int count = primes.headSet(val + 1).size();
			System.out.println(count);

		}
	}
}

Measured memory_bytes: 16000
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
#define rep(i,a,b) for(int i=a;i<=b;i++)
const int maxn=1e5+10;
int a[maxn];
int main()
{
//    #ifndef ONLINE_JUDGE
//    freopen("in.txt","r",stdin);
//    #endif //ONLINE_JUDGE
    int n,c,k;
    scanf("%d%d%d",&n,&c,&k);
    rep(i,1,n) scanf("%d",&a[i]);
    sort(a+1,a+1+n);
    int ans=0;
    int now=0;
    int T=0;
    for(int i=1;i<=n;i++){
        if(now==0){
            ans++;
            T=a[i];
            now++;
        }else{
            if(a[i]>T+k||now>=c){
                now=1;
                ans++;
                T=a[i];
            }else{
                now++;
            }
         }
    }
    printf("%d\n",ans);
    return 0;
}




Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
#include <random>
#include <queue>
#include <deque>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin>>N;
  vector<int> X(N);
  for(int i=0;i<N;i++)cin>>X[i];
  vector<int> Y(X);
  sort(ALL(X));
  for(int i=0;i<N;i++){
    if(Y[i]<=X[N/2-1])cout<<X[N/2]<<endl;
    else cout<<X[N/2-1]<<endl;
  }
}


Measured memory_bytes: 3840
using System;
using System.Linq;

namespace ABC178
{
    class Program
    {
        static void Main()
        {
            var num = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();

            var max1 = Math.Max(num[0] * num[2], num[0] * num[3]);
            var max2 = Math.Max(num[1] * num[2], num[1] * num[3]);
            Console.WriteLine(Math.Max(max1, max2));
        }
    }
}


Measured memory_bytes: 28228
#include<iostream>
#include<cstdio>
#include<cstring>
#define re register
using namespace std;
double b,a,t,mn=1e9;
int n,id;
double abs(double a){return a>0?a:-a;}
int main(){
	cin>>n>>t>>a;
	for(int i=1;i<=n;++i){
		cin>>b;
		double tmp=abs(t-b*0.006-a);
		if(tmp<mn) mn=tmp,id=i;
	}cout<<id;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <set>

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

using namespace std;
typedef long long int ll;
const int INF = 1000000000;
const double PI = 3.1415926535;

int main()
{
    int n;
    cin >> n;
    int a = n % 10;
    if (a == 2 || a == 4 || a == 5 | a == 7 || a == 9) {
        cout << "hon" << endl;
        return 0;
    }
    else if (a == 0 || a == 1 || a == 6 || a == 8) {
        cout << "pon" << endl;
        return 0;
    }
    else {
        cout << "bon" << endl;
        return 0;
    }
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
const int INF = 1e9;
const int MOD = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
 
struct Unionfind{
  vector<int> parents;
  int m;
  Unionfind(int n):parents(n,-1){
    m = n;
  }

  int find(int x){
    if(parents.at(x) < 0){
      return x;
    }else{
      parents.at(x) = find(parents.at(x));
      return parents.at(x);
    }
  }

  void unite(int x,int y){
    x = find(x);
    y = find(y);

    if(x==y) return;
    if(parents.at(x) > parents.at(x))swap(x,y);
    parents.at(x) += parents.at(y);
    parents.at(y) = x;
  }

  int size(int x){
    return -parents.at(find(x));
  }

  bool same(int x,int y){
    return find(x) ==find(y);
  }

  vector<int> members(int x){
    int root = find(x);
    vector<int> A;
    for(int i=0;i<m;i++){
      if(find(i) ==root ){
        A.push_back(i);
      }
    }
    return A;
  }
};

int main(){
  int n,m,k;
  cin >> n >> m >> k;
  Unionfind uf(n);
  vector<vector<int>> Graph(n,vector<int>());
  vector<vector<int>> kirai(n,vector<int>());
  rep(i,m){
    int a,b;
    cin >> a >> b;
    --a;--b;
    uf.unite(a,b);
    Graph.at(a).push_back(b);
    Graph.at(b).push_back(a);
  }
  rep(i,k){
    int c,d;
    cin >> c >> d;
    --c;--d;
    kirai.at(c).push_back(d);
    kirai.at(d).push_back(c);
  }
  

  
  rep(i,n){
    int ans = uf.size(i)-1;
    for(int j:Graph.at(i)){
      if(uf.same(i,j)) ans --;
    }
    for(int j:kirai.at(i)){
      if(uf.same(i,j)) ans --;
    }
    cout << ans << " ";
  }
  
  cout << endl;
  return 0;
}
   

Measured memory_bytes: 12920
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;

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

ll ngcd(vector<ll> a){
    ll res;
    res = a[0];
    for(int i = 1; i < a.size() && res != 1; i++) {
        res = gcd(a[i], res);
    }
    return res;
}

int main(){
    int n;
    cin>>n;
    ll x;
    cin>>x;
    vector<ll> v(n);
    rep(i,n) cin>>v[i];
    vector<ll> dis(n);
    rep(i,n){
        dis[i]=abs(v[i]-x);
    }
    sort(dis.begin(),dis.end());
    cout<<ngcd(dis)<<endl;
    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
typedef long long int ll;
#define rep(i,n) for (int i = 0; i< (n); i++)
#define Rep(i,n,m) for (int i = (n); i< (m); i++)
#define Sort(a) sort(a.begin(), a.end())
#define Reverse(a) reverse(a.begin(), a.end())
using namespace std;


int main() {
    ll x, ans=0;
    
    cin>>x;
    
    ans += (x/500) * 1000;
    x = x%500;
    
    ans += (x/5)  * 5;
    
    cout<<ans<<endl;
    return 0;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOREACH(x, a) for(auto x : a)

/* exchange */
#define CHMIN(a, b) (a) = min((ll)(a), (ll)(b))
#define CHMAX(a, b) (a) = max((ll)(a), (ll)(b))

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define LN() cerr << "\n"
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

ll K = 0;
ll t;
ll ret = 0;
ll dp[201][201];

ll gcd(ll a, ll b) {
  ll x = (a>b)?a:b;
  ll y = (a>b)?b:a;
  return y ? gcd(y, x % y) : x;
}

void input() {
  IN(K);
}

void solve() {
  FOR(i, 1, 201) {
    FOR(j, 1, 201) {
      dp[i][j] = gcd(i,j);
    }
  }
  FOR(i, 1, K+1) {
    FOR(j, 1, K+1) {
      FOR(k, 1, K+1) {
        ret += dp[dp[i][j]][k];
      }
    }
  }
  PRINT(ret);
}

int main(void){
  input();
  solve();
}


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

void optimize_cpp_stdio() {
    std::ios::sync_with_stdio(false);
    std::cout.tie(nullptr);
    std::cin.tie(nullptr);
}

int main() {
    optimize_cpp_stdio();
    int n, m;
    std::cin >> n >> m;
    std::vector<int> a(n), b(n), c(n);
    for (int i = 0; i < n; i++) {
        std::cin >> a[i] >> b[i];
        c[i] = std::max(a[i] - b[i], 0);
    }
    std::vector<std::vector<int>> G(n);
    for (int i = 0, u, v; i < m; i++) {
        std::cin >> u >> v;
        G[--u].push_back(--v);
        G[v].push_back(u);
    }
    std::vector<int> parent(n);
    std::iota(parent.begin(), parent.end(), 0);
    std::function<int(int)> find = [&](int x) {
        return x == parent[x] ? x : parent[x] = find(parent[x]);
    };
    std::vector<int> sorted(n);
    std::iota(sorted.begin(), sorted.end(), 0);
    std::sort(sorted.begin(), sorted.end(), [&](int lhs, int rhs) {
        return c[lhs] < c[rhs];
    });
    std::vector<bool> vis(n);
    std::vector<int64_t> dp(c.begin(), c.end());
    std::vector<int64_t> cost(b.begin(), b.end());
    for (int u : sorted) {
        vis[u] = true;
        for (int v : G[u]) {
            v = find(v);
            if (not vis[v] || u == v) continue;
            parent[v] = u;
            cost[u] += cost[v];
            dp[u] = std::min(dp[u], std::max(dp[v], c[u] - cost[v]));
        }
    }
    int root = sorted.back();
    std::cout << dp[root] + cost[root] << "\n";
    return 0;
}


Measured memory_bytes: 9468
#include<iostream>
 
int main(){                                                                                 
  for(int i = 1; i <= 9; ++i){                                                              
    for(int j = 1; j <= 9; ++j){                                                            
      std::cout << i << "x" << j << "=" << i*j << std::endl;                                
    }                                                                                       
  }                                                                                         
  return 0;                                                                                 
}

Measured memory_bytes: 1116
#include <bits/stdc++.h>
using namespace std;
long long dp[401][401][2];
int main(){
    ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    int n;
    cin >> n;
    long long arr[n];
    for (auto &i: arr)
        cin >> i;
    for (int i=0; i<n; i++)
        for (int j=0; j<n; j++)
            dp[i][j][0] = dp[i][j][1] = LLONG_MAX;
    for (int i=0; i<n; i++)
        for (int r=0, c = i; c<n; r++, c++){
            if (i==0)
                dp[r][c][0] = 0, dp[r][c][1] = arr[r];
            else if (i==1)
                dp[r][c][0] = arr[r]+arr[c], dp[r][c][1] = dp[r][c][0];
            else{
                for (int k=r; k<=c; k++){
                    long long csize = dp[r][k][1]+dp[k+1][c][1], cur = dp[r][k][0]+dp[k+1][c][0]+csize;
                    if (cur==dp[r][c][0])
                        dp[r][c][1] = min(dp[r][c][1], csize);
                    else if (cur<dp[r][c][0])
                        dp[r][c][0] = cur, dp[r][c][1] = csize;
                }
            }
        }
    cout << dp[0][n-1][0] << "\n";
}

Measured memory_bytes: 6116
/**
 *   author: sahushivam
 *   created: 23 November 2019 (Saturday)  17:31:03
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,a,b) for(int i = a; i<b; i++)
#define MOD 1000000007
#define INF 1e18
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define int long long

signed main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    int t=1;int x,y;

    cin>>x>>y;
    int sum=0;
    if(x==1)
    {
    	sum+=300000;
    }
    else if(x==2)
    {
    	sum+=200000;
    }
    else if(x==3) 
    {
    	sum+=100000;
    }
    if(y==1)
    {
    	sum+=300000;
    }
    else if(y==2)
    {
    	sum+=200000;
    }
    else if(y==3) 
    {
    	sum+=100000;
    }
    if(x==1 && y==1) sum+=400000;
    cout<<sum;
return 0;
}

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

using namespace std;
typedef long long ll;
typedef double ld;

char a[200010];
char b[200010];
ll len;
ll ans;

int main(void)
{
	scanf("%s", a);
	scanf("%s", b);
	
	len = strlen(a);
	
	for(ll i = 0 ; i < len ; i++)
	{
		if(a[i] != b[i])
			ans++;
	}
	
	printf("%lld", ans);
	return 0;
}

Measured memory_bytes: 4164
#include<bits/stdc++.h>
#define N 2005
using namespace std;
int n,m,a[N][N],ans,up[N],l[N],r[N]; char st[N];
int main()
{
	int i,j,p=0;
	scanf("%d %d\n",&n,&m);
	for(i=1;i<=n;i++){
		scanf("%s",st+1);
		for(j=1;j<=m;j++)
			a[i][j]=(st[j]=='#');
	  }
	ans=max(n,m);
	for(i=1;i<=n;i++)
		for(j=1;j<m;j++)
			a[i][j]^=a[i][j+1];
	for(i=1;i<n;i++)
		for(j=1;j<m;j++)
			a[i][j]^=a[i+1][j];
	for(i=1;i<m;i++) l[i]=r[i]=i;
	for(i=1;i<n;i++){
		for(j=1;j<m;j++)
			if(a[i][j]) up[j]=0;
			else up[j]++;
		p=0;
		for(j=1;j<m;j++)
			if(up[j]==1) l[j]=p+1;
			else if(up[j]) l[j]=max(l[j],p+1);
			else p=j;
		p=m;
		for(j=m-1;j>=1;j--)
			if(up[j]==1) r[j]=p-1;
			else if(up[j]) r[j]=min(r[j],p-1);
			else p=j;
		for(j=1;j<m;j++)
			if(up[j])
				ans=max(ans,(r[j]-l[j]+2)*(up[j]+1));
	  }
	cout<<ans;
	return 0;
}


Measured memory_bytes: 16000
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<ll, II> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 400010;
const int MAXM = 100010;
const int MAXK = 510;
const int MAXQ = 200010;

int n;
string s, pre;
map<string, bool> ma;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n;
  FOR(i,1,n) {
    cin >> s;
    if (i == 1) {
   		ma[s];
	    pre = s;
    }
    else {
      if (ma.count(s)) {
        cout << "No";
        return 0;
      }
      if (s[0] != pre[SZ(pre)-1]) {
        cout << "No";
        return 0;
      }
      ma[s];
      pre = s;
    }
  }
    cout << "Yes";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,j;
    cin>>n;
    set<int>si;
    for(i = 0 ;i<n ;i++)
    {
        cin>>j;
        si.insert(j);
    }
    cout<<si.size()<<endl;
    return 0 ;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll, ll> P;
using VP = vector<P>;
using VVP = vector<VP>;
using VI = vector<ll>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;
const int inf = 1e9 + 7;
const ll INF = 1LL << 61;
const ll mod = 1e9 + 7;

template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int i, j;
    ll n;
    cin >> n;
    ll a[n + 1];
    for (i = 0; i <= n; i++) cin >> a[i];
    ll l[n + 1];
    ll r[n + 1];
    l[n] = 0;
    r[n] = 0;
    for (i = n - 1; i >= 0; i--) {
        r[i] = a[i + 1] + r[i + 1];
        if (r[i] < 0) {
            cout << -1 << endl;
            return 0;
        }
        l[i] = max(0ll, (a[i + 1] + l[i + 1] + 1) / 2);
        // cout << l[i] << " " << r[i] << endl;
    }
    if (a[0] + l[0] > 1 || a[0] + r[0] < 1) {
        cout << -1 << endl;
        return 0;
    }
    ll e[n + 1];
    e[0] = 1 - a[0];
    ll ans = 1;
    for (i = 1; i <= n; i++) {
        e[i] = min(r[i], 2 * e[i - 1] - a[i]);
        ans += a[i] + e[i];
        // cout << i << " " << e[i] << endl;
    }
    cout << ans << endl;
}

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

int n; map <int, int> cnt;

int main(){
	int i, t; long long int ans;
	map <int, int> :: iterator it;
	scanf("%d", &n);
	for(i = 1; i <= n; ++ i){
		scanf("%d", &t);
		++ cnt[t];
	}
	for(-- (it = cnt.end()); it != cnt.begin(); -- it)
		if(it -> second >= 2){
			ans = it -> first;
			it -> second -= 2;
			break;
		}
	if(it == cnt.begin()){
		if(it -> second >= 2){
			ans = it -> first;
			it -> second -= 2;
		}else{
			printf("0\n");
			return 0;
		}
	}
	for(; it != cnt.begin(); -- it)
		if(it -> second >= 2){
			ans *= it -> first;
			break;
		}
	if(it == cnt.begin()){
		if(it -> second >= 2){
			ans *= it -> first;
			it -> second -= 2;
		}else{
			printf("0\n");
			return 0;
		}
	} cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4992
#include<stdio.h>
#include<stdlib.h>
int main()
{
	int n,l;
	int i;
	scanf("%d %d",&n,&l);
	int min=l,sum=0;
	for(i=0;i<n;i++){
		if(abs(l+i)<abs(min)){
			min=l+i;
		}
		sum+=l+i;
	}
	printf("%d\n",sum-min);
}

Measured memory_bytes: 128
#include <stdio.h>
int main(){
  int i, j;
  int n, u, k, v;
  int A[100][100];
  scanf("%d", &n);
  for( i = 0 ; i < n ; i++ ){
    for( j = 0 ; j < n ; j++ ){
      A[i][j]=0;
    }
  }
  for( i = 0 ; i < n ; i++ ){
    scanf("%d%d", &u, &k);
    for( j = 0 ; j < k ; j++ ){
      scanf("%d", &v);
      A[u-1][v-1] = 1;
    }
  }

  for( i = 0 ; i < n ; i++ ){
    for( j = 0 ; j < n ; j++){
      printf("%d", A[i][j]);
      if( j < n - 1 ){
	printf(" ");
      }
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 636
#include<bits/stdc++.h>
using namespace std;
char s[100000+10];
stack<int> S;

int main()
{
	scanf("%s",s+1);
	
	int ans=0;
	for (int i=1;i<=strlen(s+1);i++) 
		if (!S.empty() && S.top()!=s[i]-'0') {
			S.pop(); ans+=2;
		} else S.push(s[i]-'0');
	cout<<ans;	
	return 0;
}

Measured memory_bytes: 768
import numpy as np

def inpl() :
    return list(map(int,input().split()))

N = int(input())
X = np.zeros(N, dtype = int)
Y = np.zeros(N, dtype = int)
H = np.zeros(N, dtype = int)

Q = sorted([inpl() for i in range(N)], key = lambda x:x[2],reverse = True)

for j, q in enumerate(Q) :
    X[j],Y[j],H[j] = q

for cx in range(101) :
    for cy in range(101) :
        cH = H[0]+abs(X[0]-cx)+abs(Y[0]-cy)
        if np.all(H == np.maximum((cH-np.abs(X-cx)-np.abs(Y-cy)),0)) :
                  print(cx,cy,cH)


Measured memory_bytes: 14396
n,m=map(int,input().split())
a=[list(map(int,input().split())) for i in range(n)]
ans=[]
for i in range(8):
  binstr=format(i,"b").zfill(3)
  b=[]
  for j in range(n):
    c=0
    for k in range(3):
      if binstr[k]=="1":
        c+=a[j][k]
      else:
        c+=-a[j][k]
    b.append(c)
  b.sort(reverse=True)
  ans.append(sum(b[:m]))
print(max(ans))

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

const int MAX_N = 1000000;
int prime[MAX_N];
bool isPrime[MAX_N+1];

int main(void) {
    int pos = 0;
    for (int i = 0; i < MAX_N; i++) isPrime[i] = true;
    isPrime[0] = isPrime[1] = false;
    for (int i = 2; i <= MAX_N; i++) {
        if (isPrime[i]) {
            prime[pos++] = i;
            for (int j = 2*i; j <= MAX_N; j += i) isPrime[j] = false;
        }
    }

    int a, d, n;
    while (cin >> a >> d >> n, a) {
        a -= d;

        pos = 0;
        int cnt = 0;
        while (cnt < n) {
            a += d;
            while (a > prime[pos]) pos++;
            if (a == prime[pos]) cnt++;
        }

        cout << a << endl;
    }

    return 0;
}

Measured memory_bytes: 2440
x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p=sorted(p)[a-x:]
q=sorted(q)[b-y:]
p.extend(q)
p.extend(r)
p.sort(reverse=True)
print(sum(p[:x+y]))

Measured memory_bytes: 109804
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

int INF = INT_MAX / 2;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
	int N; cin >> N;
	vector<int> a(N), b(N);
	vector<vector<int> > dp(4002, vector<int>(4002));
	for (int i = 0; i < N; i++) {
		scanf("%d%d", &a[i], &b[i]);
		dp[2000 - a[i]][2000 - b[i]]++;
	}
	for (int y = 0; y <= 4000; y++)
		for (int x = 0; x <= 4000; x++) {
			dp[y + 1][x] = (dp[y + 1][x] + dp[y][x]) % MOD;
			dp[y][x + 1] = (dp[y][x + 1] + dp[y][x]) % MOD;
		}
	int ans = 0;
	for (int i = 0; i < N; i++)
		ans = (ans + dp[2000 + a[i]][2000 + b[i]]) % MOD;
	vector<vector<int> > C(8001, vector<int>(4001));
	for (int i = 0; i <= 8000; i++) {
		C[i][0] = 1;
		for (int j = 1; j <= min(i, 4000); j++)
			C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % MOD;
	}
	for (int i = 0; i < N; i++) {
		int x = C[(a[i] + b[i]) * 2][a[i] * 2];
		ans = (ans - x) % MOD;
	}
	ans = (ll)ans * (MOD/2+1) % MOD;
	cout << (ans + MOD) % MOD << endl;
}


Measured memory_bytes: 189824
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1001001001001001001;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
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; }


void lunlun(ll num, vector<ll>& res){
    if(num > 3234566667) return;
    res.push_back(num);
    ll last = num % 10;
    if(last!=0) lunlun(num*10 + last-1, res);
    lunlun(num * 10 + last, res);
    if(last!=9) lunlun(num*10+last+1, res);
}

int main(){
    int k; cin >> k;
    vector<ll> res;
    rept(i, 1, 10){
        lunlun(i, res);
    }
    sort(all(res));
    cout << res[k-1] << ln;
}

Measured memory_bytes: 4300
#ifndef ___Class_RMQ
#define ___Class_RMQ

#include <limits>
#include <vector>
#include <utility>
#include <algorithm>

using namespace std;

template <typename Type> class RMQ
{
private:

	int size;

	vector<Type> minvalue;
	vector<Type> maxvalue;

	pair<Type, Type> _query(int a, int b, int k, int l, int r)
	{
		if (r <= a || b <= l) { return make_pair(INF, -INF); }
		if (a <= l && r <= b) { return make_pair(minvalue[k], maxvalue[k]); }

		pair<Type, Type> vl = _query(a, b, 2 * k, l, (l + r) / 2);
		pair<Type, Type> vr = _query(a, b, 2 * k + 1, (l + r) / 2, r);

		return make_pair(min(vl.first, vr.first), max(vl.second, vr.second));
	}

public:

	Type INF;

	RMQ(int size_)
	{
		INF = numeric_limits<Type>::max();

		for (size = 1; size < size_;) { size <<= 1; }

		minvalue = vector<Type>(size * 2, INF);
		maxvalue = vector<Type>(size * 2, -INF);
	}

	void update(int i, const Type& x)
	{
		i += size;

		minvalue[i] = x;
		maxvalue[i] = x;

		while (i > 1)
		{
			i = i / 2;

			minvalue[i] = min(minvalue[2 * i], minvalue[2 * i + 1]);
			maxvalue[i] = max(maxvalue[2 * i], maxvalue[2 * i + 1]);
		}
	}

	pair<Type, Type> query(int s, int t)
	{
		return _query(s, t, 1, 0, size);
	}
};

#endif


// ------ main ------ //

#include <cstdio>

using namespace std;

int n, q, com, x, y;

int main()
{
	scanf("%d", &n);
	scanf("%d", &q);

	RMQ<int> r(n);

	for (int i = 0; i < q; i++)
	{
		scanf("%d", &com);
		scanf("%d", &x);
		scanf("%d", &y);

		if (com == 0) 
		{
			r.update(x, y);
		}
		if (com == 1) 
		{
			pair<int, int> p = r.query(x, y + 1);

			printf("%lld\n", p.first);
		}
	}

	return 0;
}

Measured memory_bytes: 4520
input_line = int(input())
#print(input_line)

first=input_line%10
#print(first)

if first == 2 or first == 4 or first == 5 or first == 7 or first == 9:
    print("hon")
elif first == 0 or first == 1 or first == 6 or first == 8:
    print("pon")
elif first == 3:
    print("bon")

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

int main(void){
    string s, ss;
    cin >> s;
    ss = s;
    int n = s.size();
    int cnt1 = 0, cnt2 = 0;
    char prev = '0';
    if(prev!=s[0]) ++cnt1;
    for(int i=1;i<n;++i){
        if(prev==s[i]){
            ++cnt1;
            if(s[i]=='0') s[i] = '1';
            else s[i] = '0';
        }
        prev = s[i];
    }
    s = ss;
    prev = '1';
    if(prev!=s[0]) ++cnt2;
    for(int i=1;i<n;++i){
        if(prev==s[i]){
            ++cnt2;
            if(s[i]=='0') s[i] = '1';
            else s[i] = '0';
        }
        prev = s[i];
    }
    cout << min(cnt1, cnt2) << endl;
}


Measured memory_bytes: 512
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end

n=gets.to_i
a=get_i
a.sort!
flag=true
(n-1).times do|i|
  if a[i]==a[i+1]
    flag=false
    break
  end 
end
puts yn_judge(flag,"YES","NO")

Measured memory_bytes: 19464
/**
 * Created by hiramekun at 20:44 on 2019-12-08.
 */
#include <bits/stdc++.h>
#pragma optimize("", off)
using namespace std;
using ll = long long;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

int main() {
    ll h, w;
    cin >> h >> w;
    vector<bool> v;
    v[0];
    vector<int> v2;
    v2[0];
    int a[h][w], b[h][w];
    rep(i, h) rep(j, w) cin >> a[i][j];
    rep(i, h) rep(j, w) cin >> b[i][j];

    ll max_diff = 2 * 80 * 160;
    bool dp[h][w][max_diff];
    rep(i, h) rep(j, w) rep(l, max_diff) dp[i][j][l] = false;

    ll mid = max_diff / 2;
    dp[0][0][b[0][0] - a[0][0] + mid] = true;
    dp[0][0][-b[0][0] + a[0][0] + mid] = true;

    rep(i, h) {
        rep(j, w) {
            rep(l, max_diff) {
                if(i + 1 <= h - 1) {

                    dp[i + 1][j][l + b[i + 1][j] - a[i + 1][j]] |= dp[i][j][l];
                    dp[i + 1][j][l - b[i + 1][j] + a[i + 1][j]] |= dp[i][j][l];
                }
                if(j + 1 <= w - 1) {
                    dp[i][j + 1][l + b[i][j + 1] - a[i][j + 1]] |= dp[i][j][l];
                    dp[i][j + 1][l - b[i][j + 1] + a[i][j + 1]] |= dp[i][j][l];
                }
            }
        }
    }
    ll ans = 1e18;
    rep(i, max_diff) {
        if(dp[h - 1][w - 1][i])
            ans = min(ans, abs(i - mid));
    }
    cout << ans << '\n';
}


Measured memory_bytes: 160256
#include <bits/stdc++.h>
        using namespace std;
        typedef long long int ll;
        int main(){
            ll n; cin>>n; ll p[n+1][4]; ;
            ll dp[n+1][4];
            for(ll i=1;i<=n;i++) { cin>>p[i][1]>>p[i][2]>>p[i][3]; }
            dp[1][1]=p[1][1]; dp[1][2]=p[1][2]; dp[1][3]=p[1][3];
            for(ll i=2;i<=n;i++) {
                dp[i][1]=p[i][1]+max(dp[i-1][2],dp[i-1][3]);
                dp[i][2]=p[i][2]+max(dp[i-1][1],dp[i-1][3]);
                dp[i][3]=p[i][3]+max(dp[i-1][2],dp[i-1][1]);
            }
            cout<<max(dp[n][1],max(dp[n][2],dp[n][3]));
        }

Measured memory_bytes: 6528
memo = {}
gets.to_i.times do
  b, f, r, v = gets.split.map(&:to_i)
  memo[[b, f, r]] = 0 if memo[[b, f, r]].nil?
  memo[[b, f, r]] += v
  memo[[b, f, r]] = 0 if memo[[b, f, r]] < 0
end
[*1..4].each do |b|
  [*1..3].each do |f|
    [*1..10].each do |r|
    	v = memo[[b, f, r]].nil? ? 0 : memo[[b, f, r]]
      print " #{v}"
    end
    print "\n"
  end
  puts '#' * 20 unless b == 4
end

Measured memory_bytes: 6116
n,d=map(int,input().split())
x=[list(map(int,input().split())) for i in range(n)]
heiho=[]
ans=0

  
for i in range(126):
  heiho.append(i*i)


for i in range(n):
  for j in range(i+1,n):
    dis=0
    for k in range(d):
      dis+=(x[i][k]-x[j][k])**2
    if dis in heiho:
      ans+=1
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  rep(i, N){
    cin >> a[i];
  }
  int cnt = 0;
  rep(i, N){
    //through same diff
    while(i + 1 < N && a[i] == a[i+1]) i++;

    if(a[i] < a[i+1] && i+1 < N){
      //when diff is plus
      while(i + 1 < N && a[i] <= a[i+1]) i++;
    }else if(i + 1 < N && a[i] > a[i+1]){
      //when diff is minus
      while(i + 1 < N && a[i] >= a[i+1]) i++;
    }
    cnt++;
  }
  cout << cnt << endl;
  return 0;
}


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

int main ()
{
    int a[200],i,n,mx=0,sum=0,z;
    cin>>n;
     for(i=0;i<n;i++)
    {
        cin>>a[i];
        sum=sum+a[i];
        if(a[i]>=mx)
            mx=a[i];
    }
    
    z=sum-mx;

    if(z>mx)
        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 FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

typedef long long ll;
typedef long double ld;

const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    int h, a;
    cin >> h >> a;
    cout << (h + a - 1) / a << endl;
    
    return 0;
}



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

result = [0] * (N + 1)
for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            n = x * x + y * y + z * z + x * y + y * z + z * x
            if n > N:
                break
            result[n] += 1

print(*result[1:], sep='\n')


Measured memory_bytes: 9348
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>

#define mid ((l+r)>>1)

using namespace std;

struct node
{
	int x,y;
}point[200009];

int main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d%d",&point[i].x,&point[i].y);
	}
	long long ans=-1;
	for(int i=0;i<(1<<2);i++)//operator status
	{
		long long maxx=-1e10,minn=1e10,tem;
		for(int j=1;j<=n;j++)
		{
			tem=0;
			if(i&1)tem+=point[j].y;
			else tem-=point[j].y;
			if(i&2)tem+=point[j].x;
			else tem-=point[j].x;
			maxx=max(maxx,tem);
			minn=min(minn,tem);
		}
		//printf("%d %lld %lld\n",i,maxx,minn);
		ans=max(ans,maxx-minn);
	}
	printf("%lld",ans);
	return 0;
}

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

int main() {
  
  int a,b,c;
  cin >> a >> b >> c;
  
  if ( c - ( a - b ) < 0 ){
    cout << 0 << endl;
  }else{
    cout << c - ( a - b) << endl;
  }
  
}



Measured memory_bytes: 256
def main():
    s = list(input())
    #s = list(s)
    #print(s)
    res = 0
    lst = []
    count = 1
    sign = 1
    for i in range(1, len(s)):
        if s[i-1] == s[i]:
            count += 1
        else:
            lst.append(count*sign)
            count = 1
            sign *= -1
    lst.append(count*sign)
    #print(lst)
    res = 0
    total = 0
    while True:
        #print(total, lst)
        try:
            curr = lst.pop(0)
        except:
            break
        if (total <= 0 and curr <= 0) or (total > 0 and curr > 0):
            pass
        else:
            res += min(abs(curr), abs(total))
            #print(min(abs(curr), abs(total)))
        total += curr
    print(res*2)
        
        
         
    

main()

Measured memory_bytes: 4648
import java.util.*;
import java.io.*;

class Main{
    public static void main(String args[])throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int sum=0;
        String s = br.readLine();
        int x = Integer.parseInt(s);
        //sum = x * x * x;
        //Math.pow(a, b);
        sum = (int)Math.pow(x, 3.0);
        System.out.println(sum);
    }
}

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

struct st{
	int a;
	int b;
	st(int a_,int b_){
		a = a_;
		b = b_;
	}
	void add(){
		b++;
		if (b == 60){
			a++;
			b = 0;
		}
		if (a == 24){
			a = 0;
		}
	}
};
int a;
int b;
int main(){
	cin >> a >> b;
	st k = st(a, 0);
	b *= 60;
	while (b--){
		k.add();
	}
	cout << k.a  << endl;
	return 0;
}

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

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

    string res = "No";
    if (n % 2 == 0) {
        if (s.substr(0,n/2) == s.substr(n/2,n/2)) res = "Yes";
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 3576
use v5.18;
use warnings;
sub read_line { chomp(my $s = <>); $s }
sub splited_read_line { split / /, read_line }

my ($n, $h, $w) = splited_read_line;
my @boards = map {
  my ($h, $w) = splited_read_line;
  +{
    h => $h,
    w => $w,
  }
} 0 .. $n - 1;

my @greped = grep { $_->{h} >= $h && $_->{w} >= $w } @boards;
say ~~@greped;

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define N 200005
ll mod=998244353;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
ll powermodm(ll x,ll n,ll M){ll result=1;while(n>0){if(n % 2 ==1)result=(result * x)%M;x=(x*x)%M;n=n/2;}return result;}
ll power(ll _a,ll _b){ll _r=1;while(_b){if(_b%2==1)_r=(_r*_a);_b/=2;_a=(_a*_a);}return _r;}
ll gcd(ll a,ll b){while(a&&b)a>b?a%=b:b%=a;return a+b;}
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}
int main()
{
    fast;   
    string s;
    cin>>s;
    ll n=s.length();
    stack<char> st;
    for(int i=0;i<n;i++)
    {
        if(st.empty())
        {
            st.push(s[i]);
        }
        else
        {
            char x=st.top();
            if(x=='0' && s[i]=='1')
            {
                st.pop();
            }
            else if(x=='1' && s[i]=='0')
            {
                st.pop();
            }
            else{
                st.push(s[i]);
            }
        }
    }
    cout<<n-st.size()<<endl;
    return 0;
}


Measured memory_bytes: 512
#include <iostream>

using namespace std;
int N, M;
int a[31][31];
int k[31];
int fcount[31] = {0};
int ans = 0;
int main()
{
    cin >> N >> M;

    for(int i = 0; i < N; i++) {
      cin >> k[i];
      for(int j = 0; j < k[i]; j++) {
        cin >> a[i][j];
        fcount[a[i][j]]++;
      }
    }
    for(int i = 0; i < M + 1; i++) {
        if(fcount[i] == N)
          ans++;
    }

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

Measured memory_bytes: 256
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

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

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def main():
    N, M = map(int, readline().split())

    uf = UnionFind(N)

    for _ in range(M):
        A, B = map(lambda x: int(x) - 1, readline().split())
        uf.union(A, B)

    print(uf.group_count() - 1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 72756
def solve():
    N = int(input())
    S = input()

    def rolling_hash(s, mod, base = 37):
        l = len(s)
        h = [0]*(l + 1)
        v = 0
        for i in range(l):
            h[i+1] = v = (v * base + ord(s[i])) % mod
        pw = [1]*(l + 1)
        v = 1
        for i in range(l):
            pw[i+1] = v = v * base % mod
        return h, pw

    def chk(S, mod, D = [0]*N):
        h, pw = rolling_hash(S, mod)
        left = 0; right = N//2+1
        while left+1 < right:
            l = mid = (left + right) >> 1
            p = pw[l]
            for i in range(min(l, N-2*l+1)):
                D[i] = (h[l+i] - h[i]*p) % mod
            s = set()
            ok = 0
            for i in range(l, N-l+1):
                s.add(D[i-l])
                D[i] = v = (h[l+i] - h[i]*p) % mod
                if v in s:
                    ok = 1
                    break
            if ok:
                left = mid
            else:
                right = mid
        return left

    res1 = chk(S, 10**9 + 9)
    res2 = chk(S, 10**9 + 7)
    print(min(res1, res2))
solve()

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


using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 1 << 30;
const ll INFL = 1LL<<60;
const ll mod =1000000007;



int dp[105][4][4][4];

int main() {

	int n;
	cin >> n;
	REP(k,4)REP(i, 4) {
		REP(j, 4) {
			dp[0][k][i][j] = 1;
		}
	}
	dp[0][1][2][3] = 0;
	dp[0][2][1][3] = 0;
	dp[0][1][3][2] = 0;

	FOR(i, 1, n) {
		REP(j, 4)REP(k, 4)REP(l, 4)REP(m, 4) {
			if (j == 1 && k == 2 && l == 3)continue;
			if (j == 1 && k == 3 && l == 2)continue;
			if (j == 2 && k == 1 && l == 3)continue;
			if (j == 1 && l == 2 && m == 3)continue;
			if (j == 1 && l == 2 && m == 3)continue;
			if (k == 1 && l == 2 && m == 3)continue;
			if (j == 1 && k == 2 && m == 3)continue;
			if (k == 1 && l == 2 && m == 3)continue;
			if (k == 1 && l == 3 && m == 2)continue;
			if (k == 2 && l == 1 && m == 3)continue;
			dp[i][j][k][l] += dp[i - 1][k][l][m];
			dp[i][j][k][l] %= mod;
		}
	}

	ll ans = 0;
	REP(i, 4)REP(j, 4)REP(k, 4) {
		ans += dp[n - 3][i][j][k];
		ans %= mod;
	}
	cout << ans << endl;

}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * 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;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
static class TaskC   {
public void solve(int testNumber, Scanner in, PrintWriter out) {
        int N = in.nextInt();
        int po[][] = new int[2][N];
        int h[] = new int[N];
        for (int i=0; i<N; i++) {
            po[0][i] = in.nextInt();
            po[1][i] = in.nextInt();
            h[i] = in.nextInt();
        }
        for(int cx = 0; cx<=100; cx++){
            loop:for(int cy = 0; cy<=100; cy++){
                int H = 0;
                int maxh = 1<<30;
                for(int i = 0; i<N; i++){
                    if(h[i] == 0) {
                        maxh = Math.min(maxh, Math.abs(po[0][i] - cx) + Math.abs(po[1][i] - cy));
                        continue;
                    }
                    if(H == 0) H = h[i] + Math.abs(po[0][i] - cx) + Math.abs(po[1][i] - cy);
                    if(h[i] + Math.abs(po[0][i] - cx) + Math.abs(po[1][i] - cy) != H) continue loop;
                }
                if(maxh >= H) out.println(cx+" "+cy+" "+H);
            }
        }
        
    }

}
}



Measured memory_bytes: 23508