akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
using ll = long long; using ld = long double; const char nl = '\n';
/* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- */

#include <bits/extc++.h>
namespace pbds =  __gnu_pbds;
template <typename key, typename val=pbds::null_type, typename comp=less<key>>
using ostree=pbds::tree<key,val,comp,pbds::rb_tree_tag,pbds::tree_order_statistics_node_update>;
using vi = vector< int >; using vll = vector< ll >;
#define all(x) std::begin(x), std::end(x)
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename...Args, template<typename...> typename T> string to_string(T<Args...> const&);
string to_string(string const&s){return '"'+s+'"';}
string to_string(char const &c) {return to_string(string(1,c));}
string to_string(char const *c) {return to_string(string(c));}
string to_string(bool const &b) {return (b ? "1" : "0");}
template<typename... Args> string to_string(pair<Args...> const&p)
{return "("+to_string(p.first)+", "+to_string(p.second)+")";}
template <typename...Args, template<typename...> typename T> string to_string(T<Args...> const&S)
{string s = "{"; for(auto const& e: S)s+=" "+to_string(e);s+=" }"; return s;}
template<typename Tail> void debug_out(Tail t) {cerr<<" "<<to_string(t)<<" ]"<<endl;}
template<typename Head, typename... Tail> void debug_out(Head h, Tail... t)
{cerr << " " << to_string(h) << ","; debug_out(t...);}
#define pr(...) cerr<<"["<<(#__VA_ARGS__)<<"] : [", debug_out(__VA_ARGS__)
template <typename T> void dbr(T lb, T ub)
{cerr<<'{';for(auto it=lb; it!=ub; it++)cerr<<' '<<to_string(*it); cerr<<" }"<<endl;}
template<typename T, typename Comp=less<T>> bool smin(T &mem, T const&v, Comp const&cmp=Comp())
{return cmp(v, mem) ? mem = v, true : false;}
template<typename T, typename Comp=less<T>> bool smax(T &mem, T const&v, Comp const&cmp=Comp())
{return cmp(mem, v) ? mem = v, true : false;}
/* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- */



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

  string s; cin >> s;
  sort(all(s));
  cout << (s[0] == s[1] and s[2] == s[3] and s[1] != s[2] ? "Yes" : "No") << endl;

}
/* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- */


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

num_four = 0
num_two = 0
num_odd = 0
for i in range(N):
    if A[i] % 4 == 0:
        num_four += 1
    elif A[i] % 2 == 0:
        num_two += 1
    else:
        num_odd += 1

# print(num_four, num_two, num_odd)

v = num_four * 2
if num_two <= 1:
    v += 1
if num_two >= 2:
    v += num_two
ans = 'Yes' if v >= N else 'No'
print(ans)

# 2 2 2 2 4 o 4 o 4 ... o 4 o
# o 4 o 4 .... o 4 o


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

int main() {
  vector<int> vec; 
   vec = { 1,1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51}; 

 int K;
  cin >> K;
  
 
 
  cout <<vec.at(K)<< endl;
 
 
  
}

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

int main(){
    int block[100];
    int cnt,n;
    int high,low;
    cin >> cnt;
    while(cnt--){
        high = 0;
        low = 0;
        memset(block,0,sizeof(block));
        cin >> n;
        for(int i=0;i<n;i++) cin >> block[i];
        for(int i=0;i<n-1;i++){
            if(block[i] - block[i+1] > 0 && high < block[i] - block[i+1]) high = block[i] - block[i+1];
            else if(block[i] - block[i+1] < 0 && low > block[i] - block[i+1]) low = block[i] - block[i+1];
        }
        cout << low*-1 << " "  << high << endl;
    }
}

Measured memory_bytes: 1160
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#include "boost/multiprecision/cpp_int.hpp"
//typedef boost::multiprecision::cpp_int LL;
typedef long double dd;
//#define i_7 (ll)(1E9+7)
//#define i_7 998244353
ll i_7;
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
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;
}

void mod_print(ll k){
    ll P=1000;
    rep(y,1,P){
        ll x=mod(y*k);
        if(x+P>=i_7){
            x-=i_7;
        }
        if(abs(x)<=P){
            cout<<x<<"/"<<y<<endl;
            return;
        }
    }
    cout<<"nun"<<endl;
}
//////////////////////////

int main(){fastio
    ll n;cin>>n;
    vector<l_l>a(n);
    ll b[n+1];
    rep(i,1,n){
        cin>>a[i-1].fi;
        a[i-1].se=i;
        b[i]=a[i-1].fi;
    }
    SORT(a);
    vector<ll>v[n+1];
    rep(i,1,n-1){
        ll a,b;cin>>a>>b;
        v[a].pb(b);
        v[b].pb(a);
    }
    bool win[n+1];memset(win,false,sizeof(win));
    for(auto k:a){
        ll i=k.se;
        for(auto x:v[i]){
            if(b[x]>=b[i])continue;
            if(win[x]==false)win[i]=true;
        }
    }
    rep(i,1,n)if(win[i])cout<<i<<" ";
    
    
    
    return 0;
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;


void ABC118A()
{
	int A, B;
	cin >> A >> B;
	if (B%A == 0)
		cout << A + B << endl;
	else
		cout << B - A << endl;
}
int main()
{
	ABC118A();
	return 0;
}

Measured memory_bytes: 256
#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;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair <int,int> pii;
typedef pair <ll,ll> pll;

#define si(a)           scanf("%d",&a)
#define sii(a,b)        scanf("%d %d",&a,&b)
#define siii(a,b,c)     scanf("%d %d %d",&a,&b,&c)

#define sl(a)           scanf("%lld",&a)
#define sll(a,b)        scanf("%lld %lld",&a,&b)
#define slll(a,b,c)     scanf("%lld %lld %lld",&a,&b,&c)

#define un(x)           x.erase(unique(all(x)), x.end())
#define xx              first
#define yy              second
#define pb              push_back
#define mp              make_pair
#define all(v)          v.begin(),v.end()
#define D(x)            cerr << #x " = " << x << '\n'
#define DBG             cerr << "Hi!" << '\n'

#define CLR(a)          memset(a,0,sizeof(a))
#define SET(a)          memset(a,-1,sizeof(a))

#define PI              acos(-1.0)

//inline int setBit(int n,int pos) { return n = n | (1 << pos); }
//inline int resetBit(int n,int pos) { return n = n & ~(1 << pos); }
//inline bool checkBit(int n,int pos) { return (bool)(n & (1 << pos)); }
//inline int countBit(int n) { return __builtin_popcount(n); }


//int fx[] = {+0, +0, +1, -1, -1, +1, -1, +1};
//int fy[] = {-1, +1, +0, +0, +1, +1, -1, -1}; //Four & Eight Direction

/******************************************************************************************/

const int MAX = 200010;
//const int INF = 0x3f3f3f3f;
const ll INF = 20000000000000000;
//const double inf = 1.0/0.0;
//const int MOD = 1000000007;


ll ara[MAX];
ll n;

ll calculate(ll val) {
    ll ret = 0;
    for(ll i=1;i<=n;i++) {
        ret += abs(ara[i]-val);
    }
    return ret;
}


int main() {
//    freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);


    sl(n);
    for(ll i=1;i<=n;i++) {
        sl(ara[i]);
        ara[i] -= i;
    }

    sort(ara+1,ara+n+1);

    ll res = INF;
    ll pos;
    pos = (n+1)/2;
    res = min(res,calculate(ara[pos]));
    if(n%2==0) {
        pos++;
        res = min(res,calculate(ara[pos]));
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 1792
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<cstring>
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9')x=x*10+ch-'0',ch=getchar();
	return x*f;
}
int stack[20];
inline void write(int x)
{
	if(x<0){putchar('-');x=-x;}
	if(!x){putchar('0');return;}
	int top=0;
	while(x)stack[++top]=x%10,x/=10;
	while(top)putchar(stack[top--]+'0');
}
inline void pr1(int x){write(x),putchar(' ');}
inline void pr2(int x){write(x),puts("");}
struct node
{
	int x,y,c,next;
}a[400010];int len,last[100010];
inline void ins(int x,int y,int c)
{
	len++;
	a[len].x=x;a[len].y=y;a[len].c=c;
	a[len].next=last[x];last[x]=len;
}
int d[100010],p[100010];
bool cmp(int x,int y){return d[x]<d[y];}
int id[100010],e[200010];
int main()
{
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	int n=read(),m=read();
	for(int i=1;i<=n;i++)d[i]=read(),p[i]=i;
	for(int i=1;i<=m;i++)
	{
		int x=read(),y=read();
		ins(x,y,i),ins(y,x,i);
	}sort(p+1,p+n+1,cmp);
	for(int i=1;i<=n;i++)
	{
		int x=p[i];
		for(int k=last[x];k;k=a[k].next)
		{
			int y=a[k].y;
			if(d[y]==d[x])
			{
				e[a[k].c]=d[x];
				if(!id[y])
				{
					if(id[x])id[y]=3-id[x];
					else id[x]=1,id[y]=2;
				}
				else if(!id[x])id[x]=3-id[y];
			}
			else if(d[y]<d[x])
			{
				if(!id[x])id[x]=id[y],e[a[k].c]=d[x]-d[y];
				else e[a[k].c]=d[x];
			}
		}
	}
	bool bk=true;
	for(int i=1;i<=n;i++)if(!id[i]){bk=false;break;}
	if(bk==false)puts("-1");
	else
	{
		for(int i=1;i<=n;i++)
		{
			if(id[i]==1)putchar('B');
			else putchar('W');
		}puts("");
		for(int i=1;i<=m;i++)pr2(e[i]);
	}
	return 0;
}

Measured memory_bytes: 10752
#pragma region RegionDefs
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,l,r) for(int i=(l),i##_len=(r);i<i##_len;++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define all(x) begin(x),end(x)
using namespace std;
const int INF = 1e9;
template<class T=int> using P  = pair<T, T>;
template<class T=int> using V  = vector<T>;
template<class T=int> using PQ = priority_queue<T>;
template<class T=int> using PQG = priority_queue<T, V<T>, greater<T>>;
typedef long long ll;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail)
{
    cin >> head;
    in(move(tail)...);
}
#define IN(...) ll __VA_ARGS__; in(__VA_ARGS__)
//時間が厳しいとき使う
#define INI(...) int __VA_ARGS__; in(__VA_ARGS__)
#define INS(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
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 (a>b) {a=b; return 1;} return 0;}
#define y0 y__0
#define y1 y__1
#define j0 j__0
#define j1 j__1
#define YN(e) cout << ((e) ? "YES" : "NO") << endl
#define yn(e) cout << ((e) ? "Yes" : "No") << endl
#pragma endregion RegionDefs

void solve()
{
    IN(n, m);
    cout << n * (n - 1) / 2 + (m - 1) * m / 2 << endl;
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

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

using namespace std;

using ll = long long;

constexpr char endl('\n');

#define FOR(i,l,r) for(size_t i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n+1)
#define INF 100000000000ULL

vector<vector<size_t>> g;
vector<size_t> gs;
vector<size_t> gf;
stack<size_t> st;

size_t dfs(size_t i, size_t t) {
	st.push(i);
	while (!st.empty()) {
		auto j = st.top();
		vector<size_t>& l = g.at(j);
		if (gs.at(j) != 0) {
			if (gf.at(j) == 0)
				gf.at(j) = ++t;
			st.pop();
			continue;
		}
		gs.at(j) = ++t;
		for (ll k = l.size() - 1; k >= 0; --k) {
			auto n = l.at(k);
			if (gs.at(n) == 0) {
				st.push(n);
			}
		}
	}
	return t;
}

int main() {
	std::cin.tie(nullptr);
	std::ios::sync_with_stdio(false);

	size_t n;
	cin >> n;
	g.resize(n);
	gs.resize(n);
	gf.resize(n);

	REP(i, n) {
		size_t u, k;
		cin >> u >> k;
		u -= 1; // 0 base
		g.at(u).resize(k);
		REP(j, k) {
			cin >> g.at(u).at(j);
			g.at(u).at(j)--;
		}
	}
	size_t t = 0;
	for (;;) {
		size_t target = INF;
		REP(i, n) {
			if (gs.at(i) == 0) {
				target = i;
				break;
			}
		}
		if (target == INF) break;
		t = dfs(target, t);
	}
	
	REP(i, n) {
		cout << i + 1 << " " << gs.at(i) << " " << gf.at(i) << ::endl;
	}
	return 0;
}


Measured memory_bytes: 3148
#include "bits/stdc++.h"
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long int
#define int ll
//#define slld(t) scanf("%lld",&t)
//#define sd(t) scanf("%d",&t)
//#define pd(t) printf("%d\n",t)
//#define plld(t) printf("%lld\n",t)
#define vec vector < int >
#define vecp vector < pair < int , int > >
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define pii pair < int , int >
#define pll pair < ll , ll > 
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define mod  1000000007
#define N 200005
#define mod1 1000000007
#define mod2 998244353
#define bitcnt __builtin_popcount
#define PI acos(-1)
//#define endl "\n"

const int inf = (int)1e18 + 10;

double  dp[303][303][303] = {{{0}}} , ev[303][303][303] = {{{0}}};
int a[303];
signed main(){
  fast;
  

   int n , x = 0 , y = 0 , z = 0;
   cin >> n;
   for(int i = 0 ; i < n ; i++){
   	   cin >> a[i];
   	   if(a[i] == 1)
   	   	x++;
   	   else if(a[i] == 2)
   	   	y++;
   	   else z++;
   }

   dp[x][y][z] = 1;
   for(int k = n ; k>=0 ; k--){
   	 for(int j = n ; j >= 0 ; j--){
   	 	for(int i = n ; i >= 0 ; i--){
   	 		if(i + j + k > n) continue;;
   	 		if(i == 0 && j == 0 && k == 0) continue;
   	 		double pw = (double)(n - i - j - k) / n;
   	 		double ew = 1 + pw/(1 - pw);
   	 		ev[i][j][k] += ew * dp[i][j][k];
   	 		if(i > 0){
   	 			dp[i-1][j][k] += dp[i][j][k] * ((double)i / (double)(i + j + k));
   	 			ev[i-1][j][k] += ev[i][j][k] * ((double)i / (double)(i + j + k));
   	 		}
   	 		if(j > 0){
   	 			
   	 			dp[i+1][j-1][k] += dp[i][j][k] * ((double)j / (double)(i + j + k));
   	 			ev[i+1][j-1][k] += ev[i][j][k] * ((double)j / (double)(i + j + k));
   	 		}
   	 		if(k > 0)
   	 			dp[i][j+1][k-1] += dp[i][j][k] * ((double)k / (double)(i + j + k));
   	 		    ev[i][j+1][k-1] += ev[i][j][k] * ((double)k / (double)(i + j + k));

   	 	}
   	 }
   }

   cout << fixed << setprecision(12) <<  ev[0][0][0] << endl;
}	

Measured memory_bytes: 434432
module Main (main) where

import qualified Data.ByteString.Char8 as C8
import Data.Bool
import Data.Maybe

main :: IO ()
main =
  readInts >>= print . showAnswer . solve

type Input  = [Int]
type Output = Int

solve :: Input -> Output
solve [a,b,t] = (t `div` a) * b

showAnswer :: Output -> Answer
showAnswer = Number

-- utils
readInts :: IO [Int]
readInts = map (fst . fromJust . C8.readInt) . C8.words <$> C8.getLine

data Answer
  = YesNo Bool
  | YESNO Bool
  | AB Bool
  | Number Int
  | String String
  | Compare Ordering
  | Compare2 Ordering

instance Show Answer where
  show (YesNo b)    = bool "No" "Yes"  b
  show (YESNO b)    = bool "NO" "YES"  b
  show (AB b)       = bool "B"  "A"    b
  show (Number i)   = show i
  show (String s)   = s
  show (Compare o)  = ordering "<" "=" ">" o
  show (Compare2 o) = ordering "Right" "Balanced" "Left" o

ordering :: a -> a -> a -> Ordering -> a
ordering lt eq gt o = case o of
  LT -> lt
  EQ -> eq
  GT -> gt

Measured memory_bytes: 380
#include <cstdio>
#include <utility>
#include <stack>

static const int E = 0;
static const int Q = 1;
static const int P = 2;

void put(int board[8][8], int x, int y){
    board[x][y] = Q;
    for(int i = 0; i < 8; ++i){
        if(i != y){
            board[x][i] +=P;
        }
        if(i != x){
            board[i][y] +=P;
        }
        int xm = x - y + i;
        if(i != y && xm >= 0 && xm < 8) board[xm][i] +=P;
        int xp = x + y - i;
        if(i != y && xp >= 0 && xp < 8) board[xp][i] +=P;
    }
}

void backTrace(int board[8][8], int x, int y){
    board[x][y] = E;
    for(int i = 0; i < 8; ++i){
        if(i != y){
            board[x][i] -=P;
        }
        if(i != x){
            board[i][y] -=P;
        }
        int xm = x - y + i;
        if(i != y && xm >= 0 && xm < 8) board[xm][i] -=P;
        int xp = x + y - i;
        if(i != y && xp >= 0 && xp < 8) board[xp][i] -=P;
    }
}

void solve(int board[8][8], bool checked[8]){
    int i = 0;
    char log[8][8] = {};
    std::stack<std::pair<int, int> > trace;
    while(i != 8){
        if(checked[i]){
            ++i;
            continue;
        }
        int j;
        for(j = 0; j < 8; ++j){
            if(board[i][j] == E && log[i][j] == false){
                put(board, i, j);
                log[i][j] = true;
                trace.push(std::make_pair(i, j));
                break;
            }
        }
        if(j == 8){
            for(j = 0; j < 8; ++j){
                log[i][j] = false;
            }
            std::pair<int, int> p = trace.top();
            trace.pop();
            backTrace(board, p.first, p.second);
            i = p.first;
        } else {
            ++i;
        }
    }
    for(int i = 0; i < 8; ++i){
        for(int j = 0; j < 8; ++j){
            if(board[i][j] == Q) std::printf("Q");
            else std::printf(".");
        }
        printf("\n");
    }
}

int main(){
    int n;
    std::scanf("%d", &n);
    int board[8][8] = {};
    bool checked[8] = {};
    for(int i = 0; i < n; ++i){
        int x;
        int y;
        std::scanf("%d", &x);
        std::scanf("%d", &y);
        checked[x] = true;
        put(board, x, y);
    }
    solve(board, checked);
    return 0;
}



Measured memory_bytes: 2696
import java.util.*;

public class Main {
	static long gcd(long a,long b) {
		if(b == 0)return a;
		return gcd(b,a % b);
	}
	static boolean check(long a,long b,long c,long d) {
		if(a < b || d < b)return false;
		if(c + 1 >= b)return true;
		///如果某天之后  剩下的多于c(不需要增加）  但是却小于b 那么次日肯定不够 
		///实际上就是c < a - bx + dy < b有解的话就是No 
		///移项的a - b < bx - dy < a - c
		///根据欧几里德扩展定理 就是说(a-b,a-c)之间是否有gcd(b,d)的倍数 即是否有解
		long g = gcd(b,d);
		return (a - c - 1) / g - (a - b) / g <= 0;
	}
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int t = in.nextInt();
		for(int i = 0;i < t;i ++) {
			long a = in.nextLong();
			long b = in.nextLong();
			long c = in.nextLong();
			long d = in.nextLong();
			if(check(a,b,c,d))System.out.println("Yes");
			else System.out.println("No");
		}
	}

}


Measured memory_bytes: 23616
/*The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep.*/

//PRABHJOT SINGH A.K.A. PRABHI
//~~~~~conquizztador~~~~~


#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007
const int maxn= 100010;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int h=0,w=0,n=0;
    cin>>n>>h>>w;
    cout<<(n-h+1)*(n-w+1)<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int a,b;
	do{
		scanf("%d %d",&a,&b);
		if(!(a||b)){
			break;
		}
		printf("%d %d\n",a*(a<=b)+b*(a>b),a*(a>=b)+b*(a<b));
	}while(183);
	return 0;
}



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

int main(void)
{
	double a, b, C, S, L, h, Cr;
	scanf("%lf %lf %lf", &a, &b, &C);
	Cr = C * M_PI / 180;
	h = b * sin(Cr);
	L = a + b + sqrt(a * a + b * b - 2.0 * a * b * cos(Cr));
	S = (a * h) / 2.0;
	printf("%.8lf\n%.8lf\n%.8lf\n", S, L, h);
	return 0;
}



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

int main() {
    int A,B,C,D,E,F,x,y,z;
    cin >> A >> B >> C >> D >> E >> F;
 if(A>B) {
 x=B;
}
 else {
 x=A;
}
 if(x>C){
 x=C;
}
 if(x>D){
 x=D;
}
z=A+B+C+D-x;
if(E>F) {
	y=E;
}
	else {
		y=F;
}
cout << z+y << endl;
 
 
		return 0;
	}
	
    
    
    





Measured memory_bytes: 3120
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE ScopedTypeVariables #-}
import Control.Monad
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Unboxed.Mutable as UM
import qualified Data.ByteString.Char8 as BS
import Data.Array.ST
import Control.Monad.ST
import Data.STRef

asSTUArray :: ST s (STUArray s i a) -> ST s (STUArray s i a)
asSTUArray = id

main = do
  [h,w] <- map (read . BS.unpack) . BS.words <$> BS.getLine
  -- 1 <= h <= 1000, 1 <= w <= 1000
  initialState <- V.replicateM h BS.getLine
  -- for all (i, j), ((a ! i) `BS.index` j) `elem` "#."
  let answer :: Int
      answer = runST $ do
        arr <- asSTUArray $ newArray ((0,0),(h-1,w-1)) False
        let initCells :: U.Vector (Int,Int) -- [(Int,Int)]
            initCells = U.fromList [(i,j) | i <- [0..h-1], j <- [0..w-1], (initialState V.! i) `BS.index` j == '#']
        U.forM_ initCells $ \p ->
          writeArray arr p True
        let -- loop :: Int -> [(Int,Int)] -> m Int
            loop !k (xs :: U.Vector (Int,Int)) = do
              lenRef <- UM.replicate 1 0
              vec <- UM.new (4 * U.length xs)
              let push (value :: (Int,Int)) = do
                    len <- UM.read lenRef 0
                    UM.write vec len value
                    UM.write lenRef 0 (len + 1)
              let doCell p@(!i,!j)
                    | 0 <= i && i < h && 0 <= j && j < w = do
                        b <- readArray arr p
                        when (not b) $ do
                          writeArray arr p True
                          push p
                    | otherwise = return ()
              U.forM_ xs $ \(i,j) -> do
                doCell (i-1,j)
                doCell (i+1,j)
                doCell (i,j-1)
                doCell (i,j+1)
              len <- UM.read lenRef 0
              if len == 0
                then return k
                else do ys <- U.take len <$> U.unsafeFreeze vec
                        loop (k+1) ys
        loop 0 initCells
  print answer


Measured memory_bytes: 97020
from array import array   
N = int(input())
A = [int(i) for i in input().split()]
# 何も取りやめないときの総コスト
now = 0
cost = 0
for po in A:
    cost += abs(now - po)
    now = po
cost += abs(now)

dist = array('l',[0]+A+[0,0])
# i番目を取りやめる
for i in range(N):
    ans = cost
    ans += (abs(dist[i]-dist[i+2])) - (abs(dist[i]-dist[i+1])+abs(dist[i+1]-dist[i+2]))
    print(ans)

Measured memory_bytes: 14048
N = int(input())
xu = []
for i in range(N):
    xu.append(input().split())

answer = 0
for i in range(N):
    if xu[i][1] == 'JPY':
        answer += int(xu[i][0])
    else:
        answer += float(xu[i][0]) * 380000.0
print(answer)

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

int main()
{
    long long int l,r,a,b,z,e=0;
    cin>>a>>b;
    for(int i=a;i<=b;i++)
    {
        if(i%2019==0)
        {
            e=1;
            break;
        }
    }
    if(e==1)
        cout<<0<<endl;
    else
    {
        int l=a%2019;
        int r=b%2019;
        int a=2019;
        int mn=min(l,r);
        int mx=max(l,r);
        for(int i=mn;i<=mx-1;i++)
        {
            for(int j=mn+1;j<=mx;j++)
            {
                a=min(a,(i*j)%2019);
            }
        }
        cout<<a%2019<<endl;
    }
    return 0;
}


Measured memory_bytes: 384
#C
x, n = map(int, input().split())
if n ==0:
    print(x)
else:
    p = list(map(int, input().split()))
    num = list(range(-1, 102))

    num_removed=num
    for i in range(len(p)):
        num_removed=[num_removed for num_removed in num_removed if num_removed != p[i]]

    num_list=[]
    for i in num_removed:
        num_list.append(abs(x-i))

    min_index=min([i for i, j in enumerate(num_list) if j == min(num_list)])

    print(num_removed[min_index])

Measured memory_bytes: 9192
A,B,M = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ans = min(a) + min(b)
for i in range(M):
  x,y,c = map(int,input().split())
  s = a[x - 1] + b[y - 1] - c
  if ans > s:
    ans = s
print(ans)

Measured memory_bytes: 24828
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int N;
  cin>>N;
  vector<int> A(N),B(N);
  for(int i=0;i<N;i++)
    cin>>A[i]>>B[i];
  int ans=0;
  for(int i=N-1;i>=0;i--)
    ans+=(A[i]+ans+B[i]-1)/B[i]*B[i]-(A[i]+ans);
  cout<<ans<<endl;
}

Measured memory_bytes: 4840
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
using namespace std;





int main() {

	//cout << fixed << setprecision(10);
	long long int n, c[10000] = {}, s[1000], f[1000], t = 0,res=1;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		t = i;
		for (int j = 2; j*j <= t; j++) {
			while (t%j == 0) {
				c[j]++;
				t /= j;
			}
		}
		c[t]++;
		
	}
	for (int i = 2; i <= n; i++) {
		res *= (c[i] + 1);
		res %= 1000000007;
	}
	cout << res;
}

Measured memory_bytes: 384
#include<stdio.h>
#include<stdlib.h>

typedef long long ll;
#define N_MAX 100000

int cmp(const void *a, const void *b)
{
	const int *pa, *pb;
	pa=a;
	pb=b;
	if(*pa>*pb) return -1;
	return (*pa<*pb);
}

int main(void)
{
	int N, i;
	static int a[N_MAX*3];
	ll sum;

	while(scanf("%d", &N)==1)
	{
		for(i=0;i<3*N;i++)
		{
			scanf("%d", &a[i]);
		}
		qsort(a, 3*N, sizeof(a[0]), cmp);

		sum=0;
		for(i=0;i<N;i++)
		{
			sum+=a[i*2+1];
		}
		printf("%lld\n", sum);
	}

	return 0;
}


Measured memory_bytes: 2556
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
const int INF = 1e10;
const int MOD = 1e9 + 7;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define P pair<int, int>
#define V vector<int>
//#define S set<int>
#define itn int
bool dbg = false;

string s, t;
int dp[3030][3030];

void solve() {
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> s >> t;
    itn S = s.size();
    int T = t.size();

    s += '%';
    t += '&';

    FOR(i, S + 1)
    FOR(j, T + 1) {
        if (s[i] == t[j]) {
            chmax(dp[i + 1][j + 1], dp[i][j] + 1);
        }
        //chmax(dp[i + 1][j + 1], dp[i][j] + (s[i] == t[j]));
        chmax(dp[i + 1][j], dp[i][j]);
        chmax(dp[i][j + 1], dp[i][j]);
    }


    string ans = "";
    int i = S;
    int j = T;
    while (i > 0 && j > 0) {
        if (dp[i][j] == dp[i - 1][j])
            i--;
        else if (dp[i][j] == dp[i][j - 1])
            j--;
        else if (dp[i][j] == dp[i - 1][j - 1] + 1) {
            i--;
            j--;
            ans = s[i] + ans;
        }
        // cerr << i << " " << j << endl;
    }
    cout << ans << endl;

    solve();
    return 0;
}


Measured memory_bytes: 72064
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define rep1(i,n) for(int i=1 ; i<=n ; i++)
#define vi vector<int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())

//const int MOD = 1000000007;
//const int INF = 1<<30;
using namespace std;



int main(){
    
    
    while(true){
        int a,b;
        cin >> a >> b;
        if(a == 0 and b == 0)break;
        
        int ans = 0;
        rep1(i,a-2){
            Rep(j,i+1,a){
                Rep(k,j+1,a+1){
                    if(i+j+k == b)ans++;
                }
            }
        }
        cout << ans << endl;
    }
    
}









Measured memory_bytes: 3088
void main() {
  problem();
}

void problem() {
  auto X = scan!char;

  string solve() {
    return 'A' <= X && X <= 'Z' ? "A" : "a";
  }

  solve().writeln;
}

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

import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons, std.numeric;
T[][] combinations(T)(T[] s, in int m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; }
T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
void deb(T ...)(T t){ debug writeln(t); }
alias Point = Tuple!(long, "x", long, "y");

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


Measured memory_bytes: 2696
#include <bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int K,A,B;
    cin>>K;
    cin>>A>>B;
    if(A%K==0 || B%K==0 || B/K-A/K>0) cout<<"OK\n";
    else cout<<"NG\n";
    return 0;
}


Measured memory_bytes: 3636
// #include "pch.h"
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <climits>
#include <string>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <ctime>
#include <cassert>
#include <fstream>
#include <stack>
#include <random>

typedef long long ll;
typedef std::pair<int, int> Pii;
typedef std::pair<long long, long long> Pll;
typedef std::pair<double, double> Pdd;

#define rip(i, n, s) for (int i = (s);i < (int)( n ); i++)
#define all(a) a.begin(), a.end()
#define MM << " " <<

template<typename T>
using MaxHeap = std::priority_queue<T>;
template<typename T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

template<typename T>
void vdeb(std::vector<T> &da) {
    for (int i = 0;i < da.size();i++) {
        if (i == da.size() - 1) std::cout << da[i];
        else std::cout << da[i] << ' ';
    }
    std::cout << '\n';
}
template<typename T>
void vdeb(std::vector<std::vector<T>> &da) {
    for (int i = 0;i < da.size();i++) {
        std::cout << i << ' ';
        vdeb(da[i]);
    }
    std::cout << '\n';
}

using namespace std;

int main() {
    int n; ll k; cin >> n>> k;
    vector<int> da(n);
    vector<ll> daa(n);
    rip(i,n,0) {
        cin >> da[i];
        --da[i];
    }
    rip(i,n,0) cin >> daa[i];
    vector<vector<ll>> dp(n, vector<ll>(0));
    rip(i,n,0) {
        dp[i].push_back(daa[da[i]]);
        int now = da[i];
        while(now != i) {
            now = da[now];
            dp[i].push_back(daa[now]);
        }
        rip(j, dp[i].size(), 1) dp[i][j] += dp[i][j-1];
    }
    ll ans = LLONG_MIN/2;
    // vdeb(dp);
    rip(i,n,0) {
        ll tmp = dp[i][0];
        if(dp[i].back() > 0) {
            if(k / dp[i].size() > 0){
                tmp = dp[i].back()*(k/dp[i].size());
                ll m = k%ll(dp[i].size());
                ll kk = 0;
                rip(j,m,0) {
                    chmax(kk, dp[i][j]);
                }
                rip(j,dp[i].size(),m) chmax(kk, dp[i][j]-dp[i].back());
            tmp += kk;
            }
            else {
                rip(j, k, 0) {
                    chmax(tmp, dp[i][j]);
                }
            }
        }
        else {
            rip(j,min(k, ll(dp[i].size())), 0) {
                chmax(tmp, dp[i][j]);
            }
        }
        chmax(ans, tmp);
    }
    // vdeb(dp);
    cout << ans << endl;
}


Measured memory_bytes: 218700
#include <bits/stdc++.h>
 
//BIAR MANTAB LAH YA
#define Willy using
#define Indrayana namespace
#define Komara std
 
Willy Indrayana Komara;
 
//TIPE DATA BENTUKAN
typedef long l;
typedef long long ll;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<l,l> pl;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<l> vl;
typedef vector<ll> vll;


bool besarDulu(const int &a, const int &b)
{
    return a > b;
}

bool tupleSort(tuple<int, int, int> &a, tuple<int, int, int> &b)
{
    return get<2>(a) > get<2>(b);
}


int fact(int n)
{
    if (n <= 0) return 1;
    return n * fact(n-1);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    double l;
    cin >> l;
    cout << fixed << setprecision(6) << (l/3) * (l/3) * (l/3) << endl;
    
    return 0;
}
/*
4
1 2 1 = 2
3 1 1 = 3
1.33 1.33 1.33 = 
3.8 0.1 0.1 =
*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define Blue ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i,a,n) for(int i=a;i<n;++i)
typedef vector<int> vi;
typedef long long ll;
const int mod=1e9+7;
 
const int dx[]={1,-1,0,0},dy[]={0,0,1,-1};
vector<ll>q;

ll getAns(ll m){
	ll x=0;
	auto it=upper_bound(all(q),m)-q.begin()-1;
	return it;
}

void solve(){
	ll n;
	cin>>n;
	ll ans=0;
	for(ll i=0;i<=100;i++){
		q.pb(((i+1)*i)/2);
	}
	for(ll i=2;i*i<=n;i++){
		ll cnt=0;
		while(n%i==0){
			cnt++;
			n/=i;
		}
		ans+=getAns(cnt);
	}
	if(n>1)ans++;
	cout<<ans;
 
}
 
 
int main(){
	Blue;
	int test=1;
	//cin>>test;
	while(test--)
		solve();
	return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}
vector<vector<pair<int, int>>> al(100000);
vector<bool> visited(100000, false);
vector<long long> dist(100000, INF * -1);
//深さ優先
bool dfs(int i, int d) {
    if(visited[i] && d != dist[i])
        return false;
    if(visited[i] && d == dist[i])
        return true;
    visited[i] = true;
    dist[i] = d;
    REP(j, al[i].size()) {
        if(!dfs(al[i][j].first, d + al[i][j].second))
            return false;
    }
    return true;
}
int main() {
    int N, M;
    cin >> N >> M;
    vector<int> L(M), R(M), D(M);
    REP(i, M) {
        cin >> L[i] >> R[i] >> D[i];
        L[i]--;
        R[i]--;
        al[L[i]].push_back(make_pair(R[i], D[i]));
        al[R[i]].push_back(make_pair(L[i], -D[i]));
    }
    REP(i, N) {
        if(!visited[i]) {
            //まだ訪れてないので距離が定まっていない
            if(!dfs(i, 0)) {
                // 0にしていいのか？
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 13824
N = int(input())
S = input()
arr = [i for i in S.split(' ')]
arr1 = list(arr[0])
arr2 = list(arr[1])
result = []
for i in range(N):
	result.append(arr1[i])
	result.append(arr2[i])
str1 = ''.join(result)
print(str1)

Measured memory_bytes: 3064
N = int(input())
T,A = map(int,input().split())
H = list(map(int,input().split()))

ans = 0
best = 10**7
for i in range(N):
  temp = T - 0.006*H[i]
  if abs(temp - A) < best:
    best = abs(temp - A)
    ans = i+1
    
print(ans)

Measured memory_bytes: 62648
#include <iostream>
#include <vector>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

long long dp[100][2];

int main() {
    int N;
    long long K;
    cin >> N >> K;
    vector<long long> A(N);
    for (int i = 0; i < N; ++i) cin >> A[i];
    
    for (int i = 0; i < 100; ++i) dp[i][0] = dp[i][1] = -1;
    dp[45][0] = 0;
    for (int d = 44; d >= 0; --d) {
        long long mask = 1LL<<d;
        int num = 0;
        for (int i = 0; i < N; ++i) if (A[i] & mask) ++num;
        
        if (dp[d+1][1] >= 0) chmax(dp[d][1], dp[d+1][1] + mask * max(num, N-num));
        if (dp[d+1][0] >= 0) {
            if (K & (1LL<<d)) {
                chmax(dp[d][1], dp[d+1][0] + mask * num);
                chmax(dp[d][0], dp[d+1][0] + mask * (N-num));
            }
            else {
                chmax(dp[d][0], dp[d+1][0] + mask * num);
            }
        }
    }
    cout << max(dp[0][0], dp[0][1]) << endl;
}

Measured memory_bytes: 1152
import sys
readline = sys.stdin.readline
N, X = map(int, readline().split())
S = list(map(int, readline().split()))
S.sort(reverse = True)
maxS = 10**5 + 1
mod = 10**9+7
dp = [0]*maxS
dp[X] += 1
for i in range(N):
    s = S[i]
    dp2 = [d*(N-1-i)%mod for d in dp]
    for j in range(1, maxS):
        dp2[j%s] = (dp2[j%s] + dp[j])%mod
    dp = dp2[:]
ans = 0
for i in range(maxS):
    ans = (ans + i*dp[i])%mod
print(ans)


Measured memory_bytes: 120200
#
import sys
import math
import numpy as np
import itertools


# ひとつ入力
n = int(input())
q = []
p=0
def hantei(k):
    a = n
    b = 0
    while 1:
#        print(n,k,a)
        if a % k == 0:
            a = a//k
        else:
            a = a % k
        if a == 1:
#            print(k)
            return(1)
        if a < k :
            return(0)

x = []

# https://qiita.com/LorseKudos/items/9eb560494862c8b4eb56
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

x += make_divisors(n)
x += make_divisors(n-1)
x = set(x)
x.remove(1)

for i in x:
    if hantei(i) == 1:
        q.append(i)

#print(x)
#print(p)
#print(q)

print(len(q))


Measured memory_bytes: 21520
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N = 2e5 + 5;

int n, m, k, ans = 0;
int a[N], b[N];

int32_t main()
{
	IOS;
	cin >> n >> m >> k;
	for(int i = 1; i <= n; i++)
	{
		cin >> a[i];
		a[i] += a[i - 1];
	}
	for(int i = 1; i <= m; i++)
	{
		cin >> b[i];
		b[i] += b[i - 1];
	}
	int ans = 0;
	int idx = m;
	for(int i = 0; i <= n; i++)
	{
		if(a[i] > k)
			break;
		while(a[i] + b[idx] > k)
			idx--;
		ans = max(ans, i + idx);
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 6776
#include <iostream>
#include <cstdio>
#include <map>

using namespace std;

typedef long long ll;
ll n;
ll a;
ll ans;
map<ll, ll> mp;

int main()
{
    scanf("%lld", &n);
    mp[0]++;
    for(ll i = 1; i <= n; i++)
    {
        ll t;
        scanf("%lld", &t);
        a += t;
        ans += mp[a];
        mp[a]++;
    }
    printf("%lld", ans);
    return 0;
}


Measured memory_bytes: 12800
/*The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep.*/

//PRABHJOT SINGH A.K.A. PRABHI
//~~~~~conquizztador~~~~~


#include<bits/stdc++.h>
using namespace std;
using lli = long long int;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
const int MOD = 1000000007;
const int MOD1 = 998244353;
const int maxn = 100010;
const int lim = (int)1e9;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int x = 0;
	cin >> x;
	cout << (x >= 30 ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3640
n = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for _ in range(n):
    s = input()
    if s == 'AC':
        ac += 1
    elif s == 'WA':
        wa += 1
    elif s == 'TLE':
        tle += 1
    elif s == 'RE':
        re += 1

print('AC x {}'.format(ac))
print('WA x {}'.format(wa))
print('TLE x {}'.format(tle))
print('RE x {}'.format(re))


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

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " : " << x << '\n'

using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;

const ll Mod = 1000000007LL;
const int N = 1e2 + 10;
const ll Inf = 2242545357980376863LL;
const ll Log = 30;

ll dp[N][N];
str s[N];
int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll h, w;
	cin >> h >> w;
	for(int i = 1; i <= h; i++) cin >> s[i], s[i] = '3' + s[i];
	memset(dp, 31, sizeof dp);
	dp[1][1] = (s[1][1] == '#');
	for(int i = 1; i <= h; i++){
		for(int j = 1; j <= w; j++){
			if(i + j == 2) continue;
			dp[i][j] = min(dp[i - 1][j] + (s[i - 1][j] == '.' && s[i][j] == '#'), dp[i][j - 1] + (s[i][j - 1] == '.' && s[i][j] == '#'));
		}
	}
	cout << dp[h][w];
	return 0;
}


Measured memory_bytes: 384
package main

import (
	"fmt"
)

func main() {
	var N, P int
	fmt.Scan(&N, &P)

	if N == 1 {
		fmt.Println(P)
	} else {
		m := map[int]int{}
		for i := 2; i*i <= P; i++ {
			for P%i == 0 {
				m[i]++
				P /= i
			}
		}

		ans := 1
		for key, value := range m {
			// fmt.Println(key, value)
			q := value / N
			ans *= pow(key, q)
		}
		fmt.Println(ans)
	}
}

func pow(a, b int) int {
	if b == 0 {
		return 1
	} else if b == 1 {
		return a
	} else {
		return a * pow(a, b-1)
	}
}


Measured memory_bytes: 512
N, K = map(int, input().split())
*A, = map(int, input().split())
mod = 10**9+7
v1, v2 = 0, 0

for i in range(N):
    p, q = 0, 0
    for j in range(i+1, N):
        if A[i]>A[j]:
            p += 1
    
    for j in range(N):
        if i==j:continue
        if A[i]>A[j]:
            q += 1
    
    v1 += p
    v2 += q

print((v1*K+v2*(K*(K-1)//2))%mod)

Measured memory_bytes: 42604
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
priority_queue<int>q;
int n,m,a[1111],b[1111];
void END(){
	cout<<0<<endl;
	exit(0);
}
int main(){
	cin>>n>>m;
	r(i,n)cin>>a[i];
	r(i,m){
		cin>>b[i];
		if(b[i])q.push(b[i]);
	}
	r(i,n){
		queue<int>tmp;
		r(j,a[i]){
			if(q.empty())END();
			if(q.top()!=1)tmp.push(q.top()-1);
			q.pop();
		}
		while(!tmp.empty())q.push(tmp.front()) , tmp.pop();
	}
	if(!q.empty())END();
	cout<<1<<endl;
}


Measured memory_bytes: 3160
#include<stdio.h>
int main(void){
  int K,N,i,swap;
  int ans=0;
  int A[200000];
  int Abet[200000];
  scanf("%d",&K);
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);}
  for(i=0;i<N-1;i++){
    Abet[i]=A[i+1]-A[i];}
  Abet[N-1]=K-A[N-1]+A[0];
  for(i=0;i<N-1;i++){
    if(Abet[i]>Abet[i+1]){
      swap=Abet[i];
      Abet[i]=Abet[i+1];
      Abet[i+1]=swap;}}
  for(i=0;i<N-1;i++)
    ans=ans+Abet[i];
  printf("%d",ans);
return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define REP(i, x, y) for (ll i = x; i <= y; i++)
#define BIT(t) ((long long 1) << t)
#define PER(i, y, x) for (ll i = y; i >= x; i--)
#define vll vector<ll>
#define vvll vector<vector<ll>>
using namespace std;
typedef long long ll;

int main() {
  string S;
  cin >> S;
  if (S == "Sunny") {
    cout << "Cloudy" << endl;
  } else if (S == "Cloudy") {
    cout << "Rainy" << endl;
  } else {
    cout << "Sunny" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int A, B, C;
	int K;
	scanf("%d %d %d", &A, &B, &C);
	scanf("%d", &K);
	int i;
	int sum = A + B + C;
	int large;
	if (A >= B&&A >= C)
		large = A;
	else if (B >= A&&B >= C)
		large = B;
	else
		large = C;
	for ( i = 0; i < K; i++)
	{
		sum += large;
		large *= 2;
	}
	printf("%d", sum);
	return 0;
}

Measured memory_bytes: 128
import sys


def I(): return int(sys.stdin.buffer.readline())


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


n = I()
if n == 1:
    print(0)
    sys.exit()

# 素因数分解
facts = factorization(n)
# print(facts)
ans = 0
for prime, e in facts:
    # print(f'{prime=}')
    i = 1
    while e > 0:
        # print(f'while内 {e=}, {i=}, {ans=}')
        if e - i < 0:
            break
        e -= i
        ans += 1
        # print(f'加算{ans=}')
        i += 1
print(ans)


Measured memory_bytes: 63508
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int N, K;
pii P[100010];

signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> N >> K;
	rep(i, 0, N)
	{
		cin >> P[i].first >> P[i].second;
	}

	sort(P, P + N);

	int p = 0;
	rep(i, 0, N)
	{
		if (p + P[i].second >= K)
		{
			cout << P[i].first << endl;
			return 0;
		}
		p += P[i].second;
	}

	return 0;
}

Measured memory_bytes: 1792
#include <cstdio>
using namespace std;

int sum(long long x) {
	int res = 0;
	while (x) {
		res += x % 10;
		x /= 10;
	}
	return res;
}

int main() {
	int k; scanf("%d", &k);
	long long num = 1, add = 1;
	while (k--) {
		printf("%lld\n", num);
		while (double(num + add) / sum(num + add) > double(num + 2 * add) / sum(num + 2 * add)) add *= 10;
		num += add;
	}

	return 0;
}

Measured memory_bytes: 128
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		List<Integer> input = new ArrayList<Integer>();
		while(in.hasNextInt()) {
			input.add(in.nextInt());
		}
		in.close();
		Collections.sort(input);
		boolean b = false;
		for (int i = 0; i < 3; i++) {
			b = b || input.get(i) % 2 == 0;
		}
		long out = b ? 0 : (long)input.get(0)*(long)input.get(1);
		System.out.println(out);
		
	}

}


Measured memory_bytes: 21716