akhauriyash/Code-Regression huggingface dataset:
from collections import Counter

N = int(input())
a = list(map(int,input().split()))

d = Counter(a)
l = []
flag = False
for k,v in list(sorted(d.items()))[::-1]:
  if v >= 4:
    l.append(k)
    l.append(k)
  elif v >= 2:
    l.append(k)
  if len(l) >= 2:
    flag = True
    break

ans = 0
if flag:
  ans = l[0]*l[1]


print(ans)

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

int main(){
  int n,m; cin>>n>>m;
  int a[m],b[m],c[m],dist[n][n];
  for(int i=0;i<m;i++){
    cin>>a[i]>>b[i]>>c[i];
    a[i]--; b[i]--;
  }for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(i==j) dist[i][j]=0;
      else dist[i][j]=1000000000;
    }
  }for(int i=0;i<m;i++){
    dist[a[i]][b[i]]=min(dist[a[i]][b[i]],c[i]);
    dist[b[i]][a[i]]=min(dist[b[i]][a[i]],c[i]);
  }for(int k=0;k<n;k++){
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
        dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);
      }
    }
  }int ans=m;
  for(int i=0;i<m;i++){
    bool shortest=false;
    for(int j=0;j<n;j++){
      if(dist[j][a[i]]+c[i]==dist[j][b[i]]){
         shortest=true;
      }
    }
    if(shortest) ans--;
  }
  cout<<ans<<endl;
}

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



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

    ll ans;
    ll max = 0;

    if(a==b)
    {
        cout << 0 << endl;
    }
    else if(a<b)
    {
        if(b-1<=n)
        {
             cout << (a * (b - 1)) / b << endl;   
        }
        else
        {
            cout << (a * (n)) / b << endl;
        }
        
    }
    else
    {
        if(b-1<=n)
        {
             cout << (a * (b - 1)) / b << endl;   
        }
        else
        {
            cout << (a * (n)) / b << endl;
        }
    }
    

    

    

    return 0;
}

Measured memory_bytes: 3636
a=input()

for bit in range(1<<3):
  f=int(a[0])
  s=a[0]
  for i in range(3):
    if bit&(1<<i):
      f+=int(a[i+1])
      s+='+'+a[i+1]
    else:
      f-=int(a[i+1])
      s+='-'+a[i+1]
  if f==7:
    print(s+'=7')
    exit()

Measured memory_bytes: 38384
#include <stdio.h>
int main(void){
    /* 変数宣言，ちゃんと初期化しよう */
    int N = 0;
    int ans = 0;
    
    /* 変数宣言終わり */
    
    /* 入力を受け付ける部分*/
    
    // %dはdecimalの略．つまり，入力を10進数として扱うよという意味．
    scanf("%d", &N);
    
    /* 入力を受け付ける部分終わり*/
    
    
    /* 何か処理*/
    ans = N;
    if(ans % 111 == 0){
    }else{
    ans = (ans / 111 +1) *111;
    }
    
    for(int i = 0; i < 10; i++){ 
      // i = 0,1,2,3,4,5,6,7,8,9のとき処理される
      
    }
    
    /* 何か処理終わり*/
    
    
    /* 出力する部分*/
 // %dの部分にansの値が表示される
    
    /* 出力する部分*/
    printf("%d",ans);
    
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef  long long   ll;
typedef  long double ld;
#define ceil(n, m) ((n / m) + ( n % m ? 1 : 0))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	//freopen("input.txt", "r", stdin);

	int n, k;
	cin >> n >> k;
	vector<int> a(n), dp(n, 1e9);
	for (auto& i : a)
		cin >> i;
	dp[0] = 0;
	for (int i = 1; i < n; ++i)
		for (int j = 1; j <= k; ++j)
			if (j <= i)
				dp[i] = min(dp[i], dp[i - j] + abs(a[i] - a[i - j]));

	cout << dp[n - 1];
	


}


Measured memory_bytes: 3984
///
// File:  a.go
// Author: ymiyamoto
//
// Created on Sun Jan 21 21:22:07 2018
//
package main

import "fmt"

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	if (a*b)%2 == 0 {
		fmt.Println("Even")
	} else {
		fmt.Println("Odd")
	}
}


Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main()
{
   int a,b,n,p=0,i,j;
   cin>>n;
  for(i=1;i<=9;i++)
  {
  	for(j=1;j<=9;j++)
  	{
  	  if(n==i*j)
  	  {
  	  	p=1;
  	  	break;
  	  }
    }
  }
  if(p==1)
  {
  	cout<<"Yes";
  }
  else
  {
      cout<<"No"<<"\n";
  }
  return 0;
}
    

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define segment_size 65536
#define ROOP() while (true)




int main(){
    int N;
    cin >> N;
    int a1[50],a2[50],h1[50],h2[50],b1[50],b2[50];
    for(int i=0; i<N; i++){
        int h,m;
        cin >> h >> m;
        a1[i] = 60*h + m;
        cin >> h >> m;
        a2[i] = 60*h + m;
        cin >> h >> m;
        h1[i] = 60*h + m;
        cin >> h >> m;
        h2[i] = 60*h + m;
        cin >> h >> m;
        b1[i] = 60*h + m;
        cin >> h >> m;
        b2[i] = 60*h + m;
    }

    int ans = 0;
    for(int i=0; i<1440-2; i++){
        vector<int> n1;
        for(int j=0; j<N; j++){
            if(a1[j] <= i && i <= a2[j]) n1.push_back(j);
        }

        for(int j=i+1; j<1440-1; j++){
            vector<int> n2;
            for(int k=0; k<n1.size(); k++){
                if(h1[n1[k]] <= j && j <= h2[n1[k]]) n2.push_back(n1[k]);
            }

            for(int k=j+1; k<1440; k++){
                int tmp = 0;
                for(int l=0; l<n2.size(); l++){
                    if(b1[n2[l]] <= k && k <= b2[n2[l]]) tmp++;  
                }
                ans = max(ans, tmp);
            }
        }
    }
    cout << ans << endl;

    return 0;
}


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

int a[3], ans = 1e8;

int main() {
	cin >> a[0] >> a[1] >> a[2];
	int ans1 = min(abs(a[1] - a[0]) + abs(a[2] - a[1]), abs(a[2] - a[0]) + abs(a[1] - a[2]));
	int ans2 = min(abs(a[0] - a[1]) + abs(a[2] - a[0]), abs(a[2] - a[1]) + abs(a[0] - a[2]));
	int ans3 = min(abs(a[0] - a[2]) + abs(a[1] - a[0]), abs(a[1] - a[2]) + abs(a[0] - a[1]));
	ans = min(ans1, ans2);
	ans = min(ans, ans3);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
// B - RGB Boxes

using namespace std;

int main() {
    int R,G,B,N,i,j,k,ans;

    scanf("%d%d%d%d",&R,&G,&B,&N);

    ans = 0;
    for (i = 0;i * R <= N;i++) {
        for (j = 0;i * R + j * G <= N;j++) {
            k = (N - i * R - j * G) / B;

            if (i * R + j * G + k * B == N)
                ans++;
        }
    }

    printf("%d\n",ans);

    return 0;
}


Measured memory_bytes: 128
import sys,queue,copy
sys.setrecursionlimit(10**8)
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
INF = float('inf')


N = int(input())
S = input()

ans = 0
i = 0
while i < N:
    if S[i] == "A":
        if i +1 < N:
            i += 1
            if S[i] == "B":
                if i + 1 < N:
                    i += 1
                    if S[i] == "C":
                        ans += 1
                        if i + 1 < N:
                            i+=1
                        else:
                            break
                    else:
                        continue
                else:
                    break
            else:
                continue
        else:
            break
    else:
        i += 1
        continue


print(ans)




Measured memory_bytes: 4336
N, K, *A = map(int, open(0).read().split())

def is_ok(x):
    cnt = 0
    for a in A:
        cnt += -(-a // x) - 1
    return cnt <= K

ng, ok = 0, 10 ** 10
while abs(ok - ng) > 1:
    mid = (ok + ng) // 2
    if is_ok(mid):
        ok = mid
    else:
        ng = mid

print(ok)

Measured memory_bytes: 31708
#include <stdio.h>
#include <utility>
#include <algorithm>
typedef long long ll;
using namespace std;

int main(void) {
  ll n, m, i, cnt = 1;
  scanf("%lld%lld", &n, &m);
  pair<ll, pair<ll, ll> > p[m], ans[m];
  for(i = 0; i < m; ++i) scanf("%lld%lld", &p[i].first, &p[i].second.first), p[i].second.second = i;
  sort(p, p + m);
  for(i = 0; i < m; ++i) {
    ans[i].first = p[i].second.second;
    ans[i].second.first = p[i].first;
    ans[i].second.second = (i ? (p[i].first == p[i - 1].first ? ++cnt : (cnt = 1)) : 1);
  }
  sort(ans, ans + m);
  for(i = 0; i < m; ++i) printf("%06lld%06lld\n", ans[i].second.first, ans[i].second.second); 
  return 0;
}

Measured memory_bytes: 6144
#include <iostream>
#include <vector>
#include <iomanip>
#include <string>
#include <sstream>
#include <queue>
#include <algorithm>
#include <map>
#include <bits/stdc++.h>

using namespace std;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,sta,n) for(long long i=(sta),i##Len_=(n);i<i##Len_;i++)
typedef long long ll;
static const ll MOD = 1000000007;
//static const ll INF = 1000000000000000000LL;
const ll mod = 998244353;
const ll INF = mod * mod;

struct edge{
    int to;
    ll cost;
};

const int em_max = 2500;

vector <edge> G[em_max];
vector <int> rG[em_max];

ll score[em_max];

bool canGoal[em_max];
bool canStart[em_max];

//最短経路問題
//負の辺がでてくる
int main() {
    ll N,M,P;
    cin >> N >> M >> P;
    REP(i,M)
    {
        //edge:a->b; cost:c
        int a,b,c;
        cin >> a >> b >> c;
        --a;
        --b;
        G[a].push_back({b,c});
        rG[b].push_back(a);
    }
    //初期化
    std::fill(score, score + N, -INF);
    score[0] = 0;

    //0 -> N-1
    queue<int> q;
    q.push(N-1);
    canGoal[N-1] = true;
    while(!q.empty())
    {
        int id = q.front();
        q.pop();
        REP(j,rG[id].size())
        {
            int to = rG[id][j];
            //すでにゴールに到達できることがわかっている
            if(canGoal[to])continue;
            canGoal[to] = true;
            q.push(to);
        }
    }

    //q.empty() == true

    q.push(0);
    canStart[0] = true;
    while(!q.empty())
    {
        int id = q.front();
        q.pop();
        REP(j,G[id].size())
        {
            int to = G[id][j].to;
            if(canStart[to])continue;
            canStart[to] = true;
            q.push(to);
        }
    }

    REP(i,N)
    {
        if(canStart[i] == false)
        {
            canGoal[i] = false;
        }
    }

    REP(t,5000)
    {
        REP(i,N)
        {
            if(canGoal[i] == false)continue;
            REP(j,G[i].size())
            {
                int to = G[i][j].to;
                if(canGoal[to] == false)continue;
                //1辺の移動のたびに -P される
                ll ns = score[i] + G[i][j].cost - P;
                if(score[to] < ns)
                {
                    score[to] = ns;
                }
            }
        }
    }

    //まだ最大値が更新されるなら、存在しない
    REP(i,N)
    {
        if(canGoal[i] == false)continue;
        REP(j,G[i].size())
        {
            int to = G[i][j].to;
            if(canGoal[to] == false)continue;
            //1辺の移動のたびに -P される
            ll ns = score[i] + G[i][j].cost - P;
            if(score[to] < ns)
            {
                score[to] = ns;

                cout << -1 << endl;
                return 0;
            }
        }
    }


    if(score[N-1] < 0)score[N-1] = 0;
    cout << score[N-1] << endl;

    return 0;
}

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

def main():
    N,M = map(int, input().split())
    A = []
    for _ in range(M):
        A.append(list(map(int, input().split())))
    p1 = set()
    for a in A:
        if a[0] == 1:
            p1.add(a[1])
    for a in A:
        if a[1] == N and a[0] in p1:
            print("POSSIBLE")
            return
    print("IMPOSSIBLE")

if __name__ == '__main__':
    main()


Measured memory_bytes: 54780
///#pragma GCC optimize("Ofast")
///#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
///#pragma GCC optimize("unroll-loops")

#include<bits/stdc++.h>
///#include<ext/pb_ds/assoc_container.hpp>
///#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
///using namespace __gnu_pbds;
///template<typename T> using orderset = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

typedef long long ll;
typedef vector<int> vii;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vii> vvii;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<bool> vbb;

const ll N = 100001;
const ll MOD = 1000000007;
const ll INF = LLONG_MAX;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rev(a) reverse(all(a))
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define yes cout<<"YES"<<nl
#define no cout<<"NO"<<nl
#define space ' '
#define nl '\n'
#define PI acos(-1)
#define Case(x) cout<<"Case "<<x<<": "
#define strtoint(a) atoi(a.c_str())
#define inttostr(n) to_string(n)

#define coutv(v) for(auto it:v)cout<<it<<space;cout<<nl;
#define cinv(v) for(auto &it:v)cin>>it;


int main()
{
    ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    int tc=1,cs=0;
    //cin>>tc;
    while(tc--)
    {
        ll a,b,n,i;
        cin>>a>>b>>n;
        i=min(n,b-1);
        cout<<((a*i)/b)-(a*(i/b))<<nl;
    }
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int sz=0;
vector<int>g[240001];
bool vis[240001];
void dfs(int u)
{
	vis[u]=true;
	sz++;
	for(auto x: g[u])
	{
		if(!vis[x]){
	    	dfs(x);
		}
	}

}

int main()
{
	int n,m; cin>>n>>m;
	map<pair<int,int>,int>mp;
	for(int i=0;i<m;i++)
	{
		int x,y; cin>>x>>y;
		if(mp[{x,y}] || mp[{y,x}])continue;
		g[x].push_back(y);
		g[y].push_back(x);
		mp[{x,y}]=1;
		mp[{y,x}]=1;
	}
	//for(auto x: g[2])cout<<x<<" ";
	vector<int>res;
	//dfs(1);
	for(int i=1;i<=n;i++)
	{
		if(!vis[i])
		{
			//cout<<"in";
			dfs(i);
			res.push_back(sz);
			sz=0;
		}
	}
	sort(res.begin(),res.end());
	//for(auto x: res)cout<<x<<" ";
	ll ans=0;
	ll fro=(int)res.size();
	ll prev=0;
	for(int i=0;i<res.size();i++)
	{
		res[i]-=prev;
		ans=ans+max(0,res[i]);
		prev+=res[i];
	}
	cout<<ans;
	
	
	
}
	

Measured memory_bytes: 46784
#ifndef LOCAL
#pragma GCC optimize ("O3")
#endif

#include <bits/stdc++.h>

using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return {i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (c it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(x...) " [" #x ": " << (x) << "] "

using ld = long double;
using ll = long long;

constexpr int mod = 1000 * 1000 * 1000 + 7;
constexpr int odw2 = (mod + 1) / 2;

void OdejmijOd(int& a, int b) { a -= b; if (a < 0) a += mod; }
int Odejmij(int a, int b) { OdejmijOd(a, b); return a; }
void DodajDo(int& a, int b) { a += b; if (a >= mod) a -= mod; }
int Dodaj(int a, int b) { DodajDo(a, b); return a; }
int Mnoz(int a, int b) { return (ll) a * b % mod; }
void MnozDo(int& a, int b) { a = Mnoz(a, b); }
int Pot(int a, int b) { int res = 1; while (b) { if (b % 2 == 1) MnozDo(res, a); a = Mnoz(a, a); b /= 2; } return res; }
int Odw(int a) { return Pot(a, mod - 2); }
void PodzielDo(int& a, int b) { MnozDo(a, Odw(b)); }
int Podziel(int a, int b) { return Mnoz(a, Odw(b)); }
int Moduluj(ll x) { x %= mod; if (x < 0) x += mod; return x; }

template <typename T> T Maxi(T& a, T b) { return a = max(a, b); }
template <typename T> T Mini(T& a, T b) { return a = min(a, b); }

int n;
string s;

map<string, pair<int, int>> cnt;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> s;
  for (int i = 0; i < (1 << n); i++) {
    string pref, suf;
    for (int j = 0; j < n; j++) {
      if ((i >> j) & 1) {
        pref.push_back(s[j]);
      } else {
        suf.push_back(s[j]);
      }
    }
    reverse(suf.begin(), suf.end());
    cnt[pref + "|" + suf].first++;

    pref.clear();
    suf.clear();
    for (int j = 0; j < n; j++) {
      if ((i >> j) & 1) {
        pref.push_back(s[n + j]);
      } else {
        suf.push_back(s[n + j]);
      }
    }
    reverse(pref.begin(), pref.end());
    cnt[pref + "|" + suf].second++;
  }

  ll wynik = 0;
  for (auto& it : cnt) {
    wynik += ll(it.second.first) * it.second.second;
  }
  cout << wynik << endl;
  return 0;
}


Measured memory_bytes: 67968
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

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

/*
 * ref. [Union-Find](https://www.slideshare.net/chokudai/union-find-49066733)
 * ref. [AtCoder ABC 157 - AtCoder Live](https://www.youtube.com/watch?v=TdR816rqc3s)
 */
class UnionFind {
    public:
        UnionFind(int n = 0): d(n, -1) {}

        // 0-index, [0, n) in other words
        int find(int x) {
            if (d[x] < 0) return x;
            return d[x] = find(d[x]);
        }

        // Return false if x and y are alreday in the same group, otherwise return true.
        // 0-index, [0, n) in other words
        bool unite(int x, int y) {
            x = find(x);
            y = find(y);
            if (x == y) return false;
            if (d[x] > d[y]) swap(x, y);
            d[x] += d[y];
            d[y] = x;
            return true;
        }

        // 0-index, [0, n) in other words
        bool same(int x, int y) {
            return find(x) == find(y);
        }

        // 0-index, [0, n) in other words
        int size(int x) {
            return -d[find(x)];
        }

    private:
        vector<int> d;
};

vector<vector<int>> friends;
vector<vector<int>> blocks;

// Solution with Union-Find
int main(void) {
    int N, M, K;
    cin >> N >> M >> K;

    UnionFind uf(N);

    friends.resize(N);
    for (int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        uf.unite(a, b);
        friends[a].push_back(b);
        friends[b].push_back(a);
    }

    blocks.resize(N);
    for (int i = 0; i < K; i++) {
        int c, d;
        cin >> c >> d;
        c--;
        d--;
        blocks[c].push_back(d);
        blocks[d].push_back(c);
    }

    for (int i = 0; i < N; i++) {
        int ans = uf.size(i);
        ans--; // remove myself
        ans -= friends[i].size(); // remove friends
        for (auto v : blocks[i]) {
            if (uf.same(i, v)) {
                ans--;
            }
        }
        cout << ans << endl;
    }

    return 0;
}


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

int main()
{
  int N;
  int H[30];
  int count;
  int max;
  cin >> N;
  for(int i=0; i < N; i++){
    cin >> H[i];
  }
  max = H[0];
  count = 1;
  for(int i=1; i < N; i++){
    if (H[i]>=max){
      max = H[i];
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
#define MAX 1000000  
  bool sosu[MAX]={0};
  for(int i=4;i<MAX;i+=2)sosu[i]=true;
  for(int i=3;i<MAX;i+=2){
    if(sosu[i])continue;
    for(int j=3*i;j<MAX;j+=2*i)sosu[j]=true;
  }
  int n;
  while(cin>>n,n){
    int i;
    for(i=n;i>=0;i--){
      if(sosu[i]==false&&sosu[i-2]==false)break;
    }
    cout<<i-2<<" "<<i<<endl;
  }
}

Measured memory_bytes: 2140
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;

namespace atcorder
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            Console.WriteLine(N * N * N);

        }
    }
}

//文字配列の取得
//string[] strArray = Console.ReadLine().Split(' ').ToArray();
//string S = strArray[0];
//string T = strArray[1];

//文字列の取得
//string s = Console.ReadLine();

//数字配列の取得
//int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
//int H = intArray[0];
//int W = intArray[1];

//数字の取得
//int N = int.Parse(Console.ReadLine());

//リスト型(int)の取得
//List<int> A = new List<int>(Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray());

//出力
//Console.WriteLine(ans);
//Console.WriteLine("Yes");
//Console.WriteLine("No");
//Console.WriteLine(cnt);



Measured memory_bytes: 27452
public class Main {

  private static void solve() {
    int n = ni();
    int[] a = na(n);
    int[] b = na(n);
    
    long cnt1 = 0;
    long cnt2 = 0;
    for (int i = 0; i < n; i ++) {
      if (a[i] > b[i]) {
        cnt1 += a[i] - b[i];
      } else {
        cnt2 += (b[i] - a[i]) / 2;
      }
    }
    
    if (cnt1 <= cnt2) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }

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

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

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

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

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

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

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

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

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

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

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

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


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

//{ START
using namespace std;
#define int int64_t
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define reps(i, a, n) for (int i = (a); i > (n); --i)
#define arep(i, x) for (auto &&i : (x))
#define irep(i, x) for (auto i = (x).begin(); i != (x).end(); ++i)
#define rirep(i, x) for (auto i = (x).rbegin(); i != (x).rend(); ++i)
//降順はgreater<T>()
#define all(x) (x).begin(), (x).end()
#define rv(s) reverse((s).begin(), (s).end())
// gcd lcmはそのままok
#define gcd(a, b) __gcd(a, b)
#define bits(n) (1LL << (n))
#define pcnt(x) __builtin_popcountll(x)
//配列内等要素削除
#define unique(x) (x).erase(unique((x).begin(), (x).end()), (x).end())
#define Fixed(n) fixed << setprecision(n)
//総和
#define sowa(n) (((n) * ((n) + 1)) / 2)
#define cauto const auto &
using P = pair<int, int>;
using Graph = vector<vector<P>>;
template <class T>  //昇順
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template <class T>  //降順
using max_heap = priority_queue<T>;
template <class A, class B>
using umap = unordered_map<A, B>;
template <class A>
using uset = unordered_set<A>;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {  //多次元初期化
  std::fill((T *)array, (T *)(array + N), val);
}
template <class A, class B>
bool chmax(A &a, const B &b) {  //最大値更新 返り値はbool
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class A, class B>
bool chmin(A &a, const B &b) {  //最小値更新 返り値はbool
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
constexpr int INF = 0x3f3f3f3f;
constexpr int LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9 + 7;
constexpr int mod2 = 998244353;
constexpr int MOD = 1e9 + 7;
//} END

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

  int h, w, k;
  cin >> h >> w >> k;

  string s[h];

  rep(i, 0, h) cin >> s[i];
  int ans = 0;

  rep(bit, 0, bits(h)) {
    rep(bitt, 0, bits(w)) {
      int cnt = 0;
      rep(i, 0, h) {
        if (bit & bits(i)) {
          rep(j, 0, w) {
            if (bitt & bits(j)) {
              if (s[i][j] == '#') ++cnt;
            }
          }
        }
      }
      if (cnt == k) ++ans;
    }
  }

  cout << ans << '\n';
  return 0;
}

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

int dp[105][105][2][2] = { 0 };
int w, h;

int main() {
	while (true) {
		cin >> w >> h;
		if (w == 0 && h == 0) return 0;
		for (int i = 1; i <= w; i++) dp[i][1][1][1] = 1;
		for (int i = 1; i <= h; i++) dp[1][i][0][1] = 1;
		for (int i = 2; i <= w; i++) {
			for (int j = 2; j <= h; j++) {
				dp[i][j][0][0] = dp[i][j - 1][1][1];
				dp[i][j][0][1] = dp[i][j - 1][0][0] + dp[i][j - 1][0][1];
				dp[i][j][1][0] = dp[i - 1][j][0][1];
				dp[i][j][1][1] = dp[i - 1][j][1][0] + dp[i - 1][j][1][1];
				dp[i][j][0][0] %= 100000;
				dp[i][j][1][0] %= 100000;
				dp[i][j][0][1] %= 100000;
				dp[i][j][1][1] %= 100000;
			}
		}
		//int dp2= dp[2][2][0][0] + dp[2][2][0][1] + dp[2][2][1][0] + dp[2][2][1][1];
		int res = dp[w][h][0][0] + dp[w][h][0][1] + dp[w][h][1][0] + dp[w][h][1][1];
		//cout << dp2 << endl;
		cout << res % 100000 << endl;
	}
	return 0;
}


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

X = [[0]*3 for i in range(N)]
for i in range(N):
    a, b, c = map(int, input().split())
    if i == 0:
        X[i][0] = a
        X[i][1] = b
        X[i][2] = c
    else:
        X[i][0] = max(X[i-1][1], X[i-1][2]) + a
        X[i][1] = max(X[i-1][0], X[i-1][2]) + b
        X[i][2] = max(X[i-1][0], X[i-1][1]) + c

print(max(X[N-1]))

Measured memory_bytes: 22772
/* long long or int */
/* xx 396*/

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

const int MAX_N=1e5+10;
const ll MOD=1e9+7;
const int mod=13;

string s;
int a[MAX_N],n;
ll dp[MAX_N][15];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	a[0]=1;
	for(int i=1;i<MAX_N;i++) a[i]=(a[i-1]*10)%mod;
	cin>>s;
	dp[0][0]=1; n=s.size();
	for(int i=0;i<s.size();i++){
		if(s[i]!='?'){
			int x=s[i]-'0'; x=(x*a[n-i-1])%mod;
			for(int j=0;j<13;j++){
				dp[i+1][(j+x)%mod]=(dp[i+1][(j+x)%mod]+dp[i][j])%MOD;
			}
		}
		else{
			for(int j=0;j<10;j++){
				int x=(j*a[n-i-1])%mod;
				
				for(int k=0;k<13;k++){
				//	if(dp[i][k]) cout<<(k+x)%mod<<" ";
					dp[i+1][(k+x)%mod]=(dp[i+1][(k+x)%mod]+dp[i][k])%MOD;
				}
			//	cout<<endl;
			}
		}
	//	for(int j=0;j<13;j++) cout<<dp[i+1][j]<<" ";
	//	cout<<endl;
	}
	cout<<dp[n][5]<<endl;
	return 0;
}

Measured memory_bytes: 12624
R, G, B, N = map(int, input().split())
ans = 0
for r in range(N // R + 1):
  d = N - R * r
  for g in range(d // G + 1):
    dd = d - G * g
    if dd == 0 or (dd > 0 and dd % B == 0):
      ans += 1
print(ans)

Measured memory_bytes: 3060
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int ans = K;
        for(int i=2;i<=N;i++){
            ans *= K-1;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 25172
#include<bits/stdc++.h>
using namespace std;
int a[200005];
int main()
{
	int n,i,x;
	cin>>n;
	for(i=2;i<=n;i++)
	{
		cin>>x;
		a[x]++;
	}
	for(i=1;i<=n;i++)
	cout<<a[i]<<endl; 
}


Measured memory_bytes: 4368
# -*- coding: utf-8 -*-
import numpy as np

def main():
    N = int(input())
    A = []
    for _ in range(N):
        A.append(int(input()))
    
    # A_ = np.array(A)
    # print(A)
    V = np.argmax(A)
    # print(V)
    MAX = max(A)
    # print(V)
    for _ in range(N):
        if _ == V:
            print(max(A[0:V]+A[V+1:N]))
        else:
            print(MAX)
                

    

if __name__ == '__main__':
    main()

Measured memory_bytes: 24476
def calc_h(cx,cy,xyh_item):
  res=abs(cx-xyh_item[0])+abs(cy-xyh_item[1])+xyh_item[2]
  return res

n=int(input())
xyh=[[int(x) for x in input().split()] for _ in range(n)]


#平地の情報があると結果がバグるので捨てる
xyh0=[]
xyh1=[]
for item in xyh:
  if item[2]==0:
    xyh0.append(item)
  else:
    xyh1.append(item)

xyh=xyh1
#ただしピラミッドの根元の高さ0の地点は重要なので残す（any(~)にtrueがあれば根元の可能性がある）　
for item0 in xyh0:
  if any([calc_h(item1[0],item1[1],item0)==item1[2] for item1 in xyh1]):
    xyh.append(item0)
n=len(xyh)

#全探索
anslist=[]
xyh.sort(key=lambda x:x[0],reverse=True)
for x in range(101):
  for y in range(101):
    c=0
    tmp=calc_h(x,y,xyh[0])
    for i in range(1,n):
      if tmp!=calc_h(x,y,xyh[i]):
        break
      else:
        c+=1
    #if c==n-1:
    #  print(x,y,tmp)
    anslist.append([c,x,y,tmp])


anslist.sort(key=lambda x:x[0])
print(*anslist[-1][1:])


Measured memory_bytes: 4708
def number(x):
  return int((1 + (1 + 8*x)**0.5) / 2)


N = int(input())
d = {}
for i in range(N):
  s = ''.join(sorted(input()))
  if s in d.keys():
    d[s] += number(d[s])
  else:
    d[s] = 0


print(sum(d.values()))

Measured memory_bytes: 17852
n = int(input())
a = list(map(int, input().split()))
a.sort()

count = [0] * 200000

for x in a:
    count[x] += 1

y = 0
for i in range(1, 100000):
    x = count[i - 1] + count[i] + count[i + 1]
    if x > y:
        y = x

print(y)

Measured memory_bytes: 13964
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>
#include <vector>
#include <map>
#include <cstdlib>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    long long N, i, h[100001], dp[100001];

    cin >> N;

    for(i=1; i<=N; i++){
        cin >> h[i];

        dp[i] = INF;
    }

    dp[1] = 0;

    dp[2] = abs(h[1]-h[2]);

    if(N==2){
        cout << dp[2] << endl;
    }

    else{
        for(i=3; i<=N; i++){
            chmin(dp[i], dp[i-2]+abs(h[i-2]-h[i]));

            chmin(dp[i], dp[i-1]+abs(h[i-1]-h[i]));
        }

        cout << dp[N] << endl;
    }

    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
	int N, tmp, i;
	cin >> N;
	string S;
	tmp = N;
	i = 0;
	while (tmp != 0) 
	{
		if (tmp % 2 == 0) {
			S[i] = '0';
			tmp /= -2;
		}
		else {
			S[i] = '1';
			tmp -= 1;
			tmp /= -2;
		}
		i++;
	}
	if (i != 0)
	{
		for (int k = i - 1; k >= 0; k--) {
			cout << S[k];
		}
	}
	if (i == 0) {
		cout << '0';
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string S;
    cin >>S;
    sort(S.begin(),S.end());
    int len=S.size();
    for(int i=0;i+1<len;i++){
        if(S.at(i)==S.at(i+1)){
            cout<<"no";
            return 0;
        }
    }
    cout<<"yes";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <set>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <unordered_map>
#include <vector>
#define task ""
using namespace std;
using ll = long long;
using ld = long double;

const int N = 1e6 + 2;
ll maxn1(-1e18), maxn2(-1e18), minn1(1e18), minn2(1e18);
int n;
void Read()
{
	cin >> n;
	while (n--)
	{
		ll u, v;
		cin >> u >> v;
		maxn1 = max(maxn1, u + v);
		minn1 = min(minn1, u + v);
		maxn2 = max(maxn2, u - v);
		minn2 = min(minn2, u - v);
	}
}

void Solve()
{
	cout << max(maxn1 - minn1, maxn2 - minn2);
}

main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	Read();
	Solve();
}


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

int main(){
    int N;
    cin>>N;
    if(N%2==0){
        cout<<(N/2)-1<<endl;
    }else{
        cout<<N/2<<endl;
    }
return 0;}
/*compile
g++ code.cpp
./a.out
run*/
/*
int f(int x){
    int y=int((x*x+4.0)/8.0);
    return y;
}
*/

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int w,h,n,sa1,sa2,x[1000],y[1000],cnt,i,a;
	scanf("%d %d %d",&w,&h,&n);
	for(i=0;i<n;i++){
		scanf("%d",&x[i]);
		scanf("%d",&y[i]);
	}
	for(i=0;i<n-1;i++){
		sa1=x[i+1]-x[i];
		sa2=y[i+1]-y[i];
		if(sa1>0&&sa2>0){
			if(sa1<sa2){
				cnt+=sa1;
				x[i]=x[i]+sa1;
				y[i]=y[i]+sa1;
			}
			else{
				cnt=cnt+sa2;
				x[i]=x[i]+sa2;
				y[i]=y[i]+sa2;
			}
		}
		if(sa1<0&&sa2<0){
			sa1=-sa1;
			sa2=-sa2;
			if(sa1<sa2){
				cnt=cnt+sa1;
				x[i]=x[i]-sa1;
				y[i]=y[i]-sa1;
			}
			else{
				cnt=cnt+sa2;
				x[i]=x[i]-sa2;
				y[i]=y[i]-sa2;
			}
		}
		sa1=x[i+1]-x[i];
		sa2=y[i+1]-y[i];
		if(sa1<0){
			sa1=-sa1;
		}
		cnt=cnt+sa1;
		if(sa2<0){
			sa2=-sa2;
		}
		cnt=cnt+sa2;
	}
	printf("%d\n",cnt);
	return 0;
}


Measured memory_bytes: 2072
#include <stdio.h>

int main() {
    int n, i, d;
    scanf("%d", &n);
    i = 2;
    d = 1;
    printf("%d:", n);
    while (i*i <= n) {
        while (n%i == 0) {
            printf(" %d", i);
            n /= i;
        }
        i += d;
        d = 2;
    }
    if (n > 1) printf(" %d", n);
    putchar('\n');
    return 0;
}



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

int main() {
    int64_t n, a, b, ans = 0;
    cin >> n >> a >> b;
    vector<int64_t> x(n);
    for (auto i = 0; i < n; i++) {
        cin >> x[i];
        if (i == 0) continue;
        ans += min((x[i] - x[i - 1]) * a, b);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4028
#include <iostream>

int gcd(int a, int b){
    int max = a, min = b, tmp;
    if(max < min){
        max = b;
        min = a;
    }

    while(min > 0){
        tmp = max % min;
        max = min;
        min = tmp;
    }

    return max;
}

int main(){
    int K;
    long ans = 0;
    std::cin >> K;
    for(auto i = 1; i <= K; i++){
        for(auto j = 1; j <= K; j++){
            int tmp = gcd(i, j);
            for(auto k = 1; k <= K; k++){
                ans += gcd(tmp, k);
            }
        }
    }

    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
template <typename T> inline void read (T &x) { bool b = 0; char c; while (!isdigit (c = getchar()) && c != '-');
if (c == '-') c = getchar(), b = 1; x = c - 48; while (isdigit(c = getchar())) x = (x << 3) + (x << 1) + c - 48; if (b) x = -x; }
template <typename T> inline void wrip(T x) { if (x > 9) wrip(x / 10); putchar(x%10 + 48); }
template <typename T> inline void write(T x) { if (x < 0) putchar('-'), x = -x; wrip(x);}
void reads(string &s) { char c; while (!isalpha(c = getchar())); s = c; while (isalpha(c = getchar())) s += c; }
typedef const int csint;

const int N = 4e5 + 11;
int n, Nnode, child[N][26], f[N], Len[N], Links[N];
int ID[N];
string s[100011];
inline void add(string s, int pos) {
    int node = 0;
    for (int i = 0; i < s.size(); i++) {
        if (!child[node][s[i] - 'a']) {
            child[node][s[i] - 'a'] = ++Nnode;
            Len[Nnode] = Len[node] + 1;
        }
        node = child[node][s[i] - 'a'];
    }
    ID[node] = pos;
    f[node]++;
}
inline int Solve(string str, int id) {
    int node = 0, res = 0;
    while(1) {
        if (Links[node] != node)
            node = Links[node];
        res += (ID[node] > 0);
        if (ID[node] == id)
            break;
        int d = s[id][Len[node]];
        for (int j = 0; j <= 25; j++) {
            if (str[j] == d)
                break;
            if (child[node][str[j] - 'a'])
                res += f[child[node][str[j] - 'a']];
        }
        node = child[node][d - 'a'];
    }
    return res;
}
int main() {
    #ifdef makacha
        freopen("m.inp", "r", stdin);
        freopen("m.out", "w", stdout);
    #endif // makacha
    read(n);
    for (int i = 1; i <= n; i++) {
        reads(s[i]);
        add(s[i], i);
    }
    for (int i = Nnode; i >= 0; i--)
        for (int j = 0; j <= 25; j++)
            if (child[i][j])
                f[i] += f[child[i][j]];
    for (int i = Nnode; i >= 0; i--) {
        Links[i] = i;
        for (int j = 0; j <= 25; j++)
            if (child[i][j] && f[i] == f[child[i][j]])
                Links[i] = Links[child[i][j]];
    }
    int nquery;
    read(nquery);
    while (nquery--) {
        int k;
        string str;
        read(k);
        reads(str);
        write(Solve(str, k));
        putchar('\n');
    }
}


Measured memory_bytes: 48640
#include <stdio.h>
int main()
{
    char str[5];
    int i, count = 1;
    scanf("%s", str);

    for(i = 0; str[i] != '\0'; i++)
    {
        if(str[i] == 'R' && str[i+1] == 'R')
        {
            count++;
        }
        else if(str[i] == 'S' && str[i+1] == 'S' && str[i+2] == 'S')
        {
            count = 0;
            break;
        }
        else
        {
            continue;
        }
    }
    printf("%d\n", count);
    return 0;
}

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

int main(){
	int n; cin >> n;
	vector<int> v;
	for(int i = 0; i < n; ++i){
		int a; cin >> a;
		if(i & 1)v.push_back(a);
		else v.insert(v.begin(), a);
	}
	if(!(n & 1)) reverse(v.begin(), v.end());
	for(int i = 0; i < n; ++i){
		cout << v[i] << " ";
	}
	cout << endl;
	return 0;
}

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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<ll,ll> pii;
const int MD = 1e9+7; typedef vector<ll> VL;

void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main()
{
	
	cin.tie(0); ios_base::sync_with_stdio(false);
	ll k; string s;
	cin >>s >>k;
	char ans= '1';
	rep(i, sz(s)){
		if(i >= k){ ans = '1'; break;}
		if(s[i] != '1'){
			ans = s[i]; break;
		}
	}
	cout << ans <<"\n";
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,x,y) for (int i=(x);i<=(y);i++)
#define ll long long
#define inf 1000000001
#define y1 y1___
#define pii pair<int,int>
#define fi first
#define se second
using namespace std;
char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
ll read(){
    char ch=gc();ll x=0;int op=1;
    for (;!isdigit(ch);ch=gc()) if (ch=='-') op=-1;
    for (;isdigit(ch);ch=gc()) x=(x<<1)+(x<<3)+ch-'0';
    return x*op;
}
#define N 105
#define mod 1000000007
int ksm(int x,int p){
    int ret=1;
    for (;p;p>>=1,x=(ll)x*x%mod) if (p&1) ret=(ll)ret*x%mod;
    return ret;
}
int n,h[N];
pii solve(int l,int r,int lim){//区间[l,r]比lim高的部分的方案数
    int mi=inf,cnt=0;pii ret;//first：存在相邻格子颜色相同情况的方案数；second：不存在的方案数（固定第一个格子的颜色）
    rep (i,l,r) if (h[i]<mi) mi=h[i],cnt=1;else if (h[i]==mi) cnt++;
    if (cnt==r-l+1){//矩形
        ret.fi=(ksm(2,r-l+1)+mod-2)%mod;
        ret.se=ksm(2,mi-lim-1);
        return ret;
    }
    int rest=r-l+1,s0=1,s1=1,last=0;//rest：上方没有方格的列数；s0,s1：维护上方有方格的列，当前行存在/不存在的方案数
    rep (i,l,r+1)
        if (!last&&h[i]>mi) last=i;
        else if (last&&(h[i]<=mi||i>r)){
            rest-=i-last;
            pii tmp=solve(last,i-1,mi);//子问题，递归求解
            s0=(ll)s0*(tmp.fi+4ll*tmp.se%mod)%mod;//*4是因为上一行可以取反，当前行亦然，2*2
            s1=(ll)s1*(2ll*tmp.se%mod)%mod;
            last=0;
        }
    s0=(s0+mod-s1)%mod;
    ret.fi=(ll)s0*ksm(2,rest)%mod;//如果上方方格已经存在，剩下的列随意
    ret.fi=(ret.fi+(ll)s1*(ksm(2,rest)+mod-2)%mod)%mod;//否则需要去掉两种不合法的情况
    ret.se=(ll)s1*ksm(2,mi-lim-1)%mod;//固定第一个格子（第一行）颜色
    return ret;
}
int main(){
    n=read();rep (i,1,n) h[i]=read();
    if (n==1){//注意特判
        printf("%d\n",ksm(2,h[1]));
        exit(0);
    }
    int ex=1;
    rep (i,1,n) if (h[i]>h[i-1]&&h[i]>h[i+1]){
        ex=(ll)ex*ksm(2,h[i]-max(h[i-1],h[i+1]))%mod;
        h[i]=max(h[i-1],h[i+1]);
    }
    pii ans=solve(1,n,0);
    printf("%d",(ll)ex*(ans.fi+2ll*ans.se%mod)%mod);
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define Nmax 200010
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define RFOR(i,a,b) for(long long i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<P> Graph;

int main() {
	int H,W;
	char c;
	cin >> H >> W;
	REP(i,W+1) cout << '#';
	cout << '#' << endl;
	REP(i,H){
		cout << '#';
		REP(j,W){
			cin >> c;
			cout << c;
		}
		cout << '#' << endl;
	}
	REP(i,W+1) cout << '#';
	cout << '#' << endl;
	return 0;
}

Measured memory_bytes: 256
lenght = int(input())
 
x = list(map(int,input().split()))
x.sort(reverse=True)
check = False

if x[-1]==0:
  print(0)
else:
  first_value = 1
  for val in x:
    first_value *= val
    if first_value > 1e18:
      check=True
      break
  if check:
    print(-1)
  else:
  	print(first_value)

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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

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

template<typename T>
void print1(T begin, T end) {
  while (begin != end) {
    cout << (*begin) << " ";
    *begin++;
  }
  cout << endl;
}

template<typename T>
void print2(T Array, int height, int width) {
  for (int i = 0; i < height; i++) {
    for (int j = 0; j < width; j++) {
      cout << " " << Array[i][j];
    }
    cout << endl;
  }
}

void print() { std::cerr << endl; }
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  std::cerr << head << " ";
  print(std::forward<Tail>(tail)...);
}

template<class T>
void Add(T &a, const T &b, const T &mod=1000000007) {
  int val = ((a % mod) + (b % mod)) % mod;
  if (val < 0) { val += mod; }
  a = val;
}

template <typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }

// ------------------------------------------------------------------------------------------

string s;

signed main() {
  cin >> s;
  int n = s.size();
  vec<int> v(n);

  int cnt = 0;
  rep (i, n) {
    if (s[i] == '1') {
      cnt++;
    } else {
      cnt--;
    }
  }

  cout << max(0LL, n - abs(cnt)) << endl;

  return 0;
}

Measured memory_bytes: 1280
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <string.h>
#include <math.h>
 
intmax_t get_gcd (intmax_t a, intmax_t b)
{
    if (b == 0) return a;
    else return get_gcd(b, a % b);
}
 
intmax_t get_lcm (intmax_t a, intmax_t b)
{
    intmax_t g = get_gcd(a, b);
    return a / g * b;
}
 
int main (int argc, char const *argv[])
{
    intmax_t A, B, C, D;
    intmax_t lcm, ans = 0;
 
    scanf("%jd%jd%jd%jd", &A, &B, &C, &D);
 
    lcm = get_lcm(C, D);
 
    ans += B / C;
    ans += B / D;
    ans -= B / lcm;
    
    ans -= (A - 1) / C;
    ans -= (A - 1) / D;
    ans += (A - 1) / lcm;
 
    ans = B - A + 1 - ans;
 
    printf("%jd\n", ans);
 
    return 0;
}

Measured memory_bytes: 128
while True:
    
    a, op, b = input().split()
    a = int(a)
    b = int(b)
    if op == "+":
        print(a+b)
    elif op == "-":
        print(a-b)
    elif op == "*":
        print(a*b)
    elif op == "/":
        print(a//b)
    elif op == "?":
        break
    


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

int main() {
    int flag=0;
    string a;
    cin>>a;
    int i = 0;
        if(a[i] == a[i+1] && a[i+2]==a[i+3]){
            flag=1;
        }
        else if(a[i]==a[i+2] && a[i+1]==a[i+3]){
            flag=1;
        }
        else if(a[i]==a[i+3] && a[i+1]==a[i+2]){
            flag=1;
        }
        if (a[i] == a[i + 1] and a[i + 1] == a[i + 2]) {
            flag = 0;
        }
    if(flag==1)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}


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

//問題文より、入力されるデータの最大個数
#define MAXSTUDENT 1000

int main(void)
{
	//student_numは生徒数を、ansは標準偏差を、avgは得点の平均値を、scoreには試験の得点を格納
	int i, student_num;
	double ans, avg;
	double score[MAXSTUDENT];
	
	//生徒数を入力
	scanf("%d", &student_num);

	//生徒数が0なら終了
	while(student_num != 0){
		ans = 0;
		avg = 0;

		//生徒数分の得点を入力し、平均値を求める
		for(i = 0; i < student_num; i++){
			scanf("%lf", &score[i]);
			avg += score[i];
		}
		avg /= (double)student_num;

		/*
		分散 = (Σ[i = 0 → student_num] (score[i] - avg)^2) / student_num
		標準偏差 = sqrt(分散)
		*/
		for(i = 0; i < student_num; i++){
			ans += pow((score[i] - avg), 2.0);
		}
		ans /= (double)student_num;
		ans = sqrt(ans);

		//結果を出力
		printf("%lf\n", ans);

		//生徒数を入力
		scanf("%d", &student_num);
	}

	return 0;
}


Measured memory_bytes: 2052
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Set<String> s = new HashSet<String>();
		for(int i = 0 ; i  < N ; ++i){
			String S = sc.next();
			s.add(S);
		}
		System.out.println(s.size());
	}
}


Measured memory_bytes: 66660
#include<stdio.h>
int main()
{

    char s[200000];
    scanf("%s",s);
    long long int j1,j2,j,i;
    long long int d=strlen(s);
    for( i=0;i<d;i++){
            if(s[i]=='A')
            {
                j1=i;break;
            }
    }
    for(j=0;j<d;j++){
        if(s[j]=='Z')j2=j;
    }
    printf("%lld\n",j2-j1+1);
    return 0;
}

Measured memory_bytes: 1928