akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define int unsigned
#define fastio ios::sync_with_stdio(); cin.tie(0); cout.tie(0);
#define pb push_back
#define ll long long
#define fi first
#define se second
#define maxn 5002
 
const int mod = 1e9+7 ;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vii;
 
int dp[maxn][maxn];
 
signed main()
{
	fastio;
	int n;	cin >> n;
	string str;	cin >> str;
	int m = str.length();
	dp[0][0] = 1;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 0; j <= i; j++)
		{
			if (j == 0 && i == 1)
			{
				dp[i][j] = 1;
			}
			else if (j == 0 && i > 1)
			{
				dp[i][j] = (dp[i-1][j] + (2*dp[i-1][1]) % mod) % mod;
			}
			else
			{
				dp[i][j] = ((2*dp[i-1][j+1])%mod + dp[i-1][j-1]) % mod;
			}
		}
	}
	cout << dp[n][m];
}

Measured memory_bytes: 70336
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0


int main() {

    static char t[333333];
    Scs(t);
    int N = strlen(t);

    vi s(N+1);

    Rep(i,N){
        s[i+1] ^= s[i] ^ (1<<(t[i]-'a'));
    }

    auto popn = []( int b ){
        int p = 0;
        while(b) p++, b -= (-b)&b;
        return p;
    };
    vi dp(N+1,INF);
    vi tmp(1<<26,INF);
    dp[0] = 0;
    tmp[0] = 0;

    Repe(i,N+1,1){
        dp[i] = min( tmp[s[i]]+1, dp[i] );
        Rep(j,'z'-'a'+1){
            dp[i] = min( tmp[s[i]^(1<<j)]+1, dp[i] );
        }
        tmp[s[i]] = min( tmp[s[i]], dp[i] );
    }

    // Rep(i,N){
    //     printf ("%d\n", dp[i] );
    // }
    printf ("%d\n", dp[N] );

    return 0;
}



Measured memory_bytes: 264192
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef ll Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
string s;
ll a,t;
char out;
int cnt=0;
string f(int a){
	string w="";
	while(t<s.size()){
		if(out!='0')return "";
		if(isalpha(s[t])){
			w+=s[t];
			t++;cnt++;
			if(a<w.size()){
				if(out=='0')out=w[a];return "";
			}
		}else if(s[t]==')'){
			return w;
		}else{
			int co=0;
			while(isdigit(s[t])){
				co*=10;
				co+=s[t]-'0';
				t++;
			}
			string tmp;
			if(isalpha(s[t])){
				tmp=s[t];
			}else{
				t++;
				tmp=f(a-w.size());
			}
//			cout<<co<<" "<<tmp.size()<<endl;
//			cout<<w<<endl;
			if(a<w.size()+tmp.size()*co){
				if(a<w.size()){if(out=='0')out=w[a];}
				else if(out=='0')out=tmp[(a-w.size())%tmp.size()];
				return "";
			}
			rep(i,co)w+=tmp;
			cnt+=tmp.size()*(co-1);
			t++;
		}
	}
	return w;
}
int main(){
	while(cin>>s>>a,s!="0"){
		out='0';
		t=cnt=0;
		f(a);
		cout<<out<<endl;
	}
}








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

class ContestReader {
  private BufferedReader reader;
  private StringTokenizer tokenizer;
  
  ContestReader(InputStream in) {
    reader = new BufferedReader(new InputStreamReader(in));
  }
  
  public 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();
  }
  
  public int nextInt() {
    return Integer.parseInt(next());
  }
  
  public long nextLong() {
    return Long.parseLong(next());
  }
  
  public double nextDouble() {
    return Double.parseDouble(next());
  }
}

public class Main {
  private static String solve(int a, int b) {
    if (a <= 0 && 0 <= b) {
      return "Zero";
    }
    if (0 < a) {
      return "Positive";
    }
    if ((b - a) % 2 == 0) {
      return "Negative";
    }
    return "Positive";
  }
  
  private static void execute(ContestReader reader, PrintWriter out) {
    int a = reader.nextInt();
    int b = reader.nextInt();
    System.out.println(solve(a, b));
  }
  
  public static void main(String[] args) {
    ContestReader reader = new ContestReader(System.in);
    PrintWriter out = new PrintWriter(System.out);
    execute(reader, out);
    out.flush();
  }
}



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

#define int long long
#define x first
#define y second
#define x1 X1 
#define x2 X2
#define y1 Y1
#define y2 Y2
#define mp make_pair
#define pb push_back

using namespace std;

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

template <typename T> inline int Chkmax (T &a, T b) {return a < b ? a = b, 1 : 0;}
template <typename T> inline int Chkmin (T &a, T b) {return a > b ? a = b, 1 : 0;}
inline int read ()
{
	int sum = 0, fl = 1; char ch = getchar();
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') fl = -1;
	for (; isdigit(ch); ch = getchar()) sum = (sum << 3) + (sum << 1) + ch - '0';
	return sum * fl;
}

const int Maxn = 1e5 + 100;

int N, M, QQ;
int S[Maxn], top, Cnt[Maxn], Ans[Maxn];
queue <pii> Q;

main()
{
	N = QQ = read(), M = read();
	S[++top] = N;
	while (M--)
	{
		int x = read();
		while (top && S[top] >= x) --top;
		S[++top] = x;
	}
	N = S[1], M = top; Cnt[M] = 1;
	for (int i = M; i >= 1; --i)
	{
		if (Cnt[i]) Q.push(mp(S[i], Cnt[i]));
		while (!Q.empty())
		{
			pii x = Q.front(); Q.pop();
			if (x.x <= N) { Ans[x.x] += x.y; continue; }
			int pos = lower_bound(S + 1, S + M + 1, x.x) - S - 1;
			Cnt[pos] += (x.x / S[pos]) * x.y;
			if (x.x % S[pos]) Q.push(mp(x.x % S[pos], x.y));
		}
	}
	for (int i = N - 1; i >= 1; --i) Ans[i] += Ans[i + 1];
	for (int i = 1; i <= QQ; ++i)
		printf("%lld\n", Ans[i]);
	return 0;
}


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

int		main(void)
{
	int x, y, z;

	cin >> x >> y >> z;
	int ans = 0;

	x -= z;
	while (x >= 0)
	{
		x -= (y + z);
		ans++;
	}
	cout << ans - 1 << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
#define PI 3.141592653589793
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
int gcd(int a, int b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}
const int INF = 1<<30;
const int MOD = 1000000007;
int dx[4] = {0,0,-1,1};
int dy[4] = {-1,1,0,0};

int main(){

  int n; cin >> n;
  vector<int> a(n),idx(n);
  rep(i,n) cin >> a[i],a[i]--;
  rep(i,n) idx[a[i]] = i;
  set<int> s = {-1,n};
  
  ll ans = 0;
  rep(i,n){
    s.insert(idx[i]); //数字iの位置をsetに入れる
    auto itr = s.find(idx[i]); //iの位置を示したイテレータを取得
    int l,r;
    //右にある小さい数
    itr++;
    r = *itr - idx[i];
    
    //左にある小さい数
    itr = s.find(idx[i]);
    itr--;
    l = idx[i] - *itr;
    
    ans += (ll)l*r*(i+1);
    //printf("r=%d,l=%d,ans=%d\n",r,l,ans);
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 11136
from collections import Counter
n = int(input())
ss =  Counter(list(input())) 
##Counterだが元の文字列と別に変更できる
for i in range(n-1):
    si = Counter(list(input()))
    for c in si :
        if c in ss:
            ss[c] = min(ss[c],si[c])
    for c in ss:
        if c not in si:
            ss[c] = 0
ans = []            
for c in ss:
    for k in range(ss[c]):
        ans.append(c)
ans.sort()

print(''.join(ans))

Measured memory_bytes: 39408
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <fstream>
#include <map>
#include <vector>
//#include <unordered_map>
//#include <unordered_set>
#include <stack>
#include <set>
#include <queue>
#include <list>
#define LL long long
#define N 100100
#define M 110
#define MOD 1000000007
#define FOR(i,l,r) for (int i = (l); i <= (r); i ++)
#define CLR(a,x) memset(a,x,sizeof(a))
#define INF 0x3f3f3f3f
#define ALL(x) x.begin(),x.end()
#define pb push_back
#define X first
#define Y second
using namespace std;
set<int>ans;
int k[1010];
int main()
{
    int a,b,c,d,e,f;
    scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
    a*=100;
    b*=100;
    double ma=0;
    int x,y;
    for(int i=0;i<30;++i)
    {
        for(int j=0;j<30;++j)
        {
            if(a*i+b*j<=f)
            {
                ans.insert(a*i+b*j);
            }
        }
    }
    int g=0;
    for(set<int>::iterator it=ans.begin();it!=ans.end();++it)
        k[g++]=*it;
    k[g++]=23333333;
    for(int i=0;i<3000;++i)
    {
        for(int j=0;j<3000;++j)
        {
            if(c*i+d*j<=f)
            {
                int z=c*i+d*j;
                int res=*lower_bound(k+1,k+g,(z+e-1)/e*100);
                if(res+z<=f)
                {
                    if(z*1.0/(res+z)>=ma)
                    {
                //cout<<z<<' '<<res<<endl;
                        ma=z*1.0/(z+res);
                        x=z+res;
                        y=z;
                    }
                }
            }else break;
        }
    }
    cout<<x<<' '<<y<<endl;
	return 0;
}


Measured memory_bytes: 256
#ifdef __GNUC__ 
#include <bits/stdc++.h>
auto & in = std::cin;
#else
std::istringstream in;
#endif
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/dynamic_bitset.hpp>
using namespace std;
#define ALL(v) std::begin(v),std::end(v)
using u6 = std::uint64_t;

struct Calc {
	u6 N;
	u6 result;
	Calc() {
		in >> N;
		result = 0;
	}
	void addK(u6 k) {
		if (k>0 && N%k==N/k)result +=k;
	}
	u6 calc() {
		u6 sqrtN = sqrt(N);
		for (u6 i = 1; i <= sqrtN; ++i) {
			if (N%i == 0) {
				addK(i - 1);
				addK(N / i - 1);
			}
		}
		return result;
	}
};

int main() {
#ifndef __GNUC__ 
	in.str("8");
#endif
	Calc calc;

	cout << calc.calc() << endl;
}


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

// #undef LOCAL
#ifdef LOCAL
#include "../lib/dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (1LL << 60);

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("template.1", "r", stdin);

  int N, K;
  cin >> N >> K;
  vector<int> h(N + K + 1, 0);
  for (int i = 0; i < N; i++) {
    cin >> h[i];
  }
  vector<ll> dp(N + K + 1, INF);
  dp[0] = 0;
  for (int i = 0; i < N; i++) {
    dumpv(dp);
    // if (i > 0) {
    //   dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
    // }
    // if (i > 1) {
    //   dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
    // }
    for (int k = 1; k <= K; k++) {
      dp[i + k] = min(dp[i + k], dp[i] + abs(h[i] - h[i + k]));
    }
  }
  dumpv(dp);
  cout << dp[N - 1] << endl;
  return 0;
}

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

int main(){
    int a,b,c,x,ans=0;
    cin >> a >> b >> c >> x;
    for(int i=0;i<=a;i++){
        for(int j=0;j<=b;j++){
            int total=x-(500*i+100*j);
            if(total>=0&&total%50==0){
                if(total/50<=c) ans++;
            }
        }
    }
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

void solve(){
    int n,a,b;
    cin >> n >> a >> b;
    print(min(a*n,b));
    return;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    solve();
    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef vector<PII> VPII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define FOR( v, c ) for ( auto &v : c )
#define EACH( it, c ) for ( auto it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()
#define DRANGE( c, p ) (c).begin(), (c).begin() + p, (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

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

	for ( int n, k, m; cin >> n >> k >> m, n | k | m; )
	{
		VI stones;
		REP( i, 0, n )
		{
			stones.PB( i + 1 );
		}

		int pos = m - 1;
		while ( 1 < stones.size() )
		{
			stones.erase( stones.begin() + pos );
			pos = ( pos + k - 1 + stones.size() ) % stones.size();
		}

		cout << stones.front() << endl;
	}

	return 0;
}

Measured memory_bytes: 1320
#include<iostream>
#include<string>
#include<queue>

using namespace std;

int main(){
  int N, q, t;
  string name;
  queue<pair<string, int> > Q;

  cin >> N >> q;

  for(int i = 0; i < N; i++){
    cin >> name >> t;
    Q.push(make_pair(name, t));
  }

  pair<string, int> u;
  int elaps = 0;

  while (!Q.empty()) {
    u = Q.front(); Q.pop();
    if(u.second <= q){
      elaps += u.second;
      cout<< u.first << ' ' << elaps << endl;
    }else{
      elaps += q;
      u.second -= q;
      Q.push(u);
    }
  }

  return 0;
}


Measured memory_bytes: 6296
package main

import "fmt"
import "os"

func main() {
	var N, Y int

	fmt.Scanf("%d %d", &N, &Y)

	for x := 0; x <= N && 10000*x <= Y; x++ {
		for y := 0; y <= N-x && 10000*x+5000*y <= Y; y++ {
			r := Y - 10000*x - 5000*y
			if (N-x-y)*1000 == r {
				fmt.Printf("%d %d %d\n", x, y, N-x-y)
				os.Exit(0)
			}
		}
	}
	fmt.Printf("%d %d %d\n", -1, -1, -1)
}


Measured memory_bytes: 512
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>
using ll = long long;
using itn = int;
using namespace std;
int GCD(int a, int b){
    return b ? GCD(b, a%b) : a;
}
int main(){
    int n,k;
    string s;
    cin >> n >> k;
    cin >> s;
    for(int i=0; i<n; i++){
        if(i+1==k){
            char c=s[i]+0x20;
            cout << c;
        }else{
            cout << s[i];
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    ll n,a,b;
    cin>>n>>a>>b;
    cout<<n/(a+b)*a+min(a,n%(a+b));
}

Measured memory_bytes: 256
#!/usr/bin/env python

def kaibun(s):
    n = len(s)
    ret = 1
    for i in range(n // 2):
        if s[i] != s[n - i - 1]:
            ret *= 0

    return(ret)

def main():
    s = input()
    n = len(s)

    ans = kaibun(s)
    ans *= kaibun(s[:(n - 1) // 2])
    ans *= kaibun(s[(n + 1) // 2:])

    if ans == 1:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#ifdef _DEBUG_
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl
#else
#define dump(val)
#endif

using namespace std;

typedef long long int ll;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}
template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;
    cout << min({a + b, b + c, c + a}) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>

#include <bitset>
#include <cassert>
#include <queue>
#include <random>
#include <stack>
#include <iomanip>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define repf(i, a, b) for (int i = (int)a; i < (int)b; i++)
#define repv(x, arr) for (auto &x : arr)
#define all(v) (v).begin(), (v).end()
#define vec(name, num) vector<ll> name((num), 0);
#define mp(a, b) make_pair(a, b)
#define op(i) cout << (i) << endl;
#define F first
#define S second

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

const ll mod = 1e9 + 7;
const ll infl = 1e17;

typedef unsigned long long ull;


int main()
{
    string s;
    cin >> s;
    ll n = s.size();
    if (n&1){
        if (s[0]==s.back()){
            cout << "Second" << endl;
        }
        else{
            cout << "First" << endl;
        }
    }
    else{
        if (s[0]==s.back()){
            cout << "First" << endl;
        }
        else {
            cout << "Second" << endl;
        }
    }
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
#define INF      (int)1e9
#define EPS      (double)1e-9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
typedef pair<int,int> pii;
template<class Type> void line(const Type &a){int cnt=0;for(const auto &elem:a){if(cnt++)cerr<<' ';cerr<<elem;}cerr<<endl;}

/*Binary Indexed Tree*/
template<typename Type>
struct BIT{
	int n;
	vector<Type> dat;//i:=[1,n].
	
	BIT(int n_):n(n_),dat(n_+1,0){}
	
	void init(){dat.assign(n+1,0);}
	void add(int i,Type x){//i番目の要素にxを足す.
		for(;i<=n;i+=i&-i) dat[i]+=x;
	}
	Type sum(int i){//[1,i]間の和を求める.
		Type res=0;
		for(;i>0;i-=i&-i) res+=dat[i];
		return res;
	}
	Type rangesum(int l,int r){return sum(r)-sum(l-1);}//[l,r]間の和を求める.
};

int main(){//解説参考.
	int n,q;
	cin>>n>>q;
	
	vi c(n+1);
	for(int i=1;i<=n;++i) cin>>c[i];
	
	vvi ql(n+1),qid(n+1);
	REP(i,q){
		int l,r;
		cin>>l>>r;
		ql[r].push_back(l);
		qid[r].push_back(i);
	}
	
	BIT<int> tree(n);
	vi p(n+1,0);
	vi ans(q);
	for(int i=1;i<=n;++i){
		if(p[c[i]]>0) tree.add(p[c[i]],-1);
		tree.add(i,1);
		p[c[i]]=i;
		REP(j,ql[i].size()) ans[qid[i][j]]=tree.rangesum(ql[i][j],i);
	}
	
	for(auto elem:ans) cout<<elem<<endl;
}

Measured memory_bytes: 52944
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const float pi = 3.1415926535;
unsigned GetDigit(unsigned num){
    return to_string(num).length();
}

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

  vector<int>a(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  int x=1,cnt=0;
  while(x!= 2) {
    x = a.at(x-1);
    cnt++;
    if (cnt > n) {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 3764
#include <stdio.h>
#include <algorithm>
 
using namespace std;
 
void print(char str[],int a,int b){
    for(int i = a; i <= b; i++)  printf("%c",str[i]);
    printf("\n");
}
 
void replace(char str[],char p[],int a,int b){
    int p_length = b-a+1;
    for(int i = 0; i < p_length;i++) str[a+i] = p[i];
}
 
void reverse(char str[],int a,int b){
    int left = a,right = b;
    while(left < right){
        swap(str[left++],str[right--]);
    }
}
 
int main(){
    char str[1001],p[1001],order[8];
    int q,a,b;
    scanf("%s",str);
    scanf("%d",&q);
    for(int i = 0; i < q; i++){
        scanf("%s %d %d",order,&a,&b);
        switch(order[2]){
        case 'i':
            print(str,a,b);
            break;
        case 'v':
            reverse(str,a,b);
            break;
        case 'p':
            scanf("%s",p);
            replace(str,p,a,b);
            break;
        }
    }
}


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

int absmi(int a, int b) {
	if (a - b < 0)return b - a;
	else return a - b;
}

int main() {
	int n, i,H=0,ckh= 2000000000;
	int cx, cy;
	cin >> n;
	vector<int>x(n), y(n), h(n);

	for (i = 0;i < n;i++)  cin >> x[i] >> y[i] >> h[i]; 
		for (cx = 0;cx <= 100;cx++) {
			for (cy = 0;cy <= 100;cy++) {
				for (i = 0;i < n;i++) {
					if (h[i] == 0) { if (ckh > absmi(x[i], cx) + absmi(y[i], cy))ckh = absmi(x[i], cx) + absmi(y[i], cy); }
					else if (H == 0)H = h[i] + absmi(x[i], cx) + absmi(y[i], cy);
					else {
						if (H != h[i] + absmi(x[i], cx) + absmi(y[i], cy))break;
					}
				}
				if (i == n&&H<=ckh) { 
					cout << cx << " " << cy << " " << H; 
					return 0;
				}
				H = 0;ckh = 2000000000;

			}
		}

		return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <map>
#include <cmath>
#include <iomanip> 
//#include <bits/stdc++.h>
using namespace std;
double pi=3.14159265358979323846264338;

const int dx[4]={0,-1,1,0};
const int dy[4]={-1,0,0,1};
int ty[4];
int tx[4];
bool ok[4];
long long ans,ans2,ind,ind2;
int n,m;
const int ad='A'-'a';
bool issqt(int k){
	if(k==1)return true;
	int s=(int)(sqrt(k)+0.00001);
	if(s*s==k)return true;
	return false;
}
string s;

int arr[61];

int cnt;
void dfs(int cur){
	for(int i=0;i<n;i++){
		if(arr[i]==0){
			arr[i]=cur;
			
			dfs(cur+1);
			arr[i]=0;
			return;
		}
		if(issqt(arr[i]+cur)){
			int l=arr[i];
			arr[i]=cur;
			
			
			dfs(cur+1);
			arr[i]=l;
		}
	}
	cnt=max(cnt,cur-1);
	return;
}
int main() {
	int l,r,d;
	cin>>l>>r>>d;
	if(l==r){
		if(l%d==0)cout<<"1"<<endl;
		else cout<<"0"<<endl;
		return 0;
	}
	int sl=l/d;
	int sr=r/d;
	if(l%d==0)cout<<sr-sl+1<<endl;
	else cout<<sr-sl<<endl;
	
  return 0;
}




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

using namespace std;

using ll = long long;

const ll MOD = 1000000007;

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

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    ll n, m;
    cin >> n >> m;
    if (n % 2 == 0)
    {
        for (ll i = 1; i <= (m / 2); i++)
        {
            // even
            cout << i << " " << 2 * m + 2 - i << endl;
        }
        for (ll i = (m / 2) + 2; i <= m + 1; i++)
        {
            // odd
            cout << i << " " << 2 * m + 3 - i << endl;
        }
    }
    else
    {
        for (ll i = 1; i <= m; i++)
        {
            cout << i << " " << 2 * m + 1 - i << endl;
        }
    }
}


Measured memory_bytes: 3600
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
using namespace std;

#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(ll (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(name,num) vector<ll> name((num),0);
#define op(i) cout<<(i)<<endl;
#define opf(i) cout<<fixed<<setprecision(10)<<(i)<<endl;
#define ip(i) cin>>(i);
#define opN cout<<"No"<<endl;
#define opY cout<<"Yes"<<endl;
#define opP cout<<"Possible"<<endl;
#define opI cout<<"Impossible"<<endl;
#define mat(name,fnum,snum); vector<vector<ll>> name((fnum),vector<ll>((snum),0));
#define matC(name,fnum,snum); vector<vector<char>> name((fnum),vector<char>((snum),0));
#define debugP int debug_point; cin>>debug_point;
#define FI first
#define SE second
const ll MOD= 1e9 + 7;

//


ll mpow(ll x, ll n){
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % MOD;
        x = x*x % MOD;
        n = n >> 1;
    }
    return ans;
}

void solve(long long Q, long long H, long long S, long long D, long long N){

}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    vector<pair<ll,ll>> val(4);
    rep(i,4){
      cin>>val[i].FI;
      val[i].FI*=mpow(2,3-i);
      val[i].SE=1*mpow(2,i);
    }
    sort(all(val));
   
    ll ans=0;
    ll n;
    cin>>n;
    n*=4;
    rep(i,4){
      ans+=(n/val[i].SE)*val[i].FI/(8/val[i].SE);
      n%=val[i].SE;
    }
    op(ans)
    return 0;
}


Measured memory_bytes: 256
def solve():
    n = int(input())
    XL = [list(map(int, input().split())) for _ in range(n)]
    ps = sorted((x + l, x - l) for x, l in XL)
    ans = 1
    last = ps[0][0]
    for s, t in ps[1:]:
        if last <= t:
            ans += 1
            last = s
    print(ans)
solve()


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

int main()
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  char a, b;
  cin >> a >> b;
  
  if(a == 'H')
    cout << b << endl;
  else
    cout << ((b == 'H')? 'D': 'H')<< endl;
  
  return 0;
}
  

Measured memory_bytes: 384
from collections import deque
K = int(input())
d = deque(["1","2","3","4","5","6","7","8","9"])
ans = 0
for i in range(K):
    now = d.popleft()
    num = int(now[-1])
    if num == 0:
        d.append(now+"0")
        d.append(now+"1")
    elif num == 9:
        d.append(now+"8")
        d.append(now+"9")
    else:
        d.append(now+str(num-1))
        d.append(now+str(num))
        d.append(now+str(num+1))
print(now)

Measured memory_bytes: 22804
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	// your code goes here
string s,t; int f =0;
cin>>s;
cin>>t;
int x = s.length();
int y = t.length();


 
for(int i =0; i<x ;i++)
{ 
if(s[i]==t[i])
f ++;
}
if (f== x )
cout<<"Yes";
else
cout<<"No";
 
 
	return 0;
}


Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[] s = sc.next().toCharArray();
		char[] t = sc.next().toCharArray();
		sc.close();
		
		int pos = n;
		for(int i= 0; i<n; i++){
			pos = n;
			boolean c = true;
			for(int j=i; j<n; j++){
				if(s[j] != t[j-i]){
					c = false;
					break;
				}
			}
			if(c){
				pos = i;
				break;
			}
		}
		
		System.out.println(pos+n);
	}

}

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

string s,t;

int main(){
    cin >> s;
    cin >> t;

    bool flag=false;

    for(int i=0;i<(int)s.length();i++){
        rotate(s.rbegin(),s.rbegin()+1,s.rend());
        if(s==t){
            flag=true;
            break;
        }
    }

    if(flag)    cout << "Yes\n";
    else    cout << "No\n";

    return 0;
}



Measured memory_bytes: 256
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

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

def main():
    n = ri()
    la = rli()
    la.sort()
    h = (n-1)//2
    print(la[h+1]-la[h])



if __name__ == '__main__':
    main()


Measured memory_bytes: 14428
#include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(), (v).end()
#define lp(i, n) for (int i = 0; i < (n) ; ++i)
#define sz(v) (ll)(v).size()
#define int long long
#define mod 1000000007

void solve() {
        int a, b, c; cin >> a>> b>> c;
        cout << (b/ c)- (a- 1)/ c<< "\n";
}

int32_t main(){
ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
        int t = 1;
        //cin >> t;
        while ( t-- ) {
                solve();
        }
return 0;
}


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

using namespace std;

ifstream f("input.in");
ofstream g("output.out");
/*
int findcube(string str, int mov)
{
    if(str.size() < 2 || str == "00" || str == "11")
        return mov;

    int max_mov = mov;
    for(int i = 0; i < str.size() - 1; ++i)
    {
        if(str[i] == '0' && str[i+1] == '1' || str[i] == '1' && str[i+1] == '0')
        {
            string cp = str;
            cp.erase(i, 2);
            max_mov = max(max_mov, findcube(cp, mov+1));
        }
    }
    return max_mov;
}
*/
int main(int argc, char **argv)
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    //cout<<fixed<<setprecision(10)<<;
    //cout.unsetf(ios::fixed);

    int a, b, c;
    string str;
    stack<char> s;
    //f>>n>>ws;
    getline(cin, str);
    int mov = 0;

    char t;

    for(int i = 0; i < str.size(); ++i)
    {
        if(s.empty())
            t = 'c';
        else
            t = s.top();

        if(t == '0' && str[i] == '1' || t == '1' && str[i] == '0')
        {
            ++mov;
            s.pop();
        }
        else
        {
            s.push(str[i]);
        }
    }

    cout<< 2*mov;

    //cout<<2 * findcube(str, 0);

    return 0;
}



Measured memory_bytes: 512
def solve():
    K = int(input())
    S = input()
    N = len(S)

    MOD = 10**9+7
    n = N+K
    fac = [1]*(n+1)
    rev = [1]*(n+1)
    
    for i in range(1,n+1):
        fac[i] = i*fac[i-1]%MOD
        rev[i] = pow(fac[i], MOD-2, MOD)
    
    comb = lambda a,b:(fac[a]*rev[a-b]*rev[b])%MOD

    ans = 0
    for i in range(K+1):
        ans += pow(26, K-i, MOD) * pow(25, i, MOD) * comb(N+i-1, i)
        ans %= MOD
    print(ans)


solve()


Measured memory_bytes: 102152
#include <bits/stdc++.h>
#define FOR(i, k, n) for(int i = (k); i < (n); i++)
#define FORe(i, k, n) for(int i = (k); i <= (n); i++)
#define FORr(i, k, n) for(int i = (k); i > (n); i--)
#define FORre(i, k, n) for(int i = (k); i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using ll = long long;

const int INF = 1001001001;
const int mod = 1000000007;

int main(void){
  string s;
  cin >> s;
  string ans = "Good";
  REP(i, 3){
    if(s[i] == s[i+1]) ans = "Bad";
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
using namespace std;
typedef long long ll;

int main(){
    map<char,int> x;
    for(int i = 0; i < 3; i++)  x["RGB"[i]] = i;

    int n;
    string s;
    cin >> n >> s;

    vector<int> v(n);
    for(int i = 0; i < n; i++)  v[i] = x[s[i]];
    
    vector<int> r(3, 0), l(3, 0);
    for(int i = 0; i < n; i++)  r[x[s[i]]]++;
    r[x[s[0]]]--;
    l[x[s[0]]]++;
    ll ret = 0;
    for(int i = 1; i+1 < n; i++){
        for(int j = 0; j < 3; j++){
            if(j == v[i])   continue;
            for(int k = 0; k < 3; k++){
                if(k == j || k == v[i]) continue;
                ret += (ll)l[j]*r[k];
            }
        }
        for(int j = 1; j < n; j++){
            if(i-j < 0 || i+j > n-1)    break;
            ret -= (v[i-j]!=v[i]&&v[i]!=v[i+j]&&v[i+j]!=v[i-j]);
        }
        r[x[s[i]]]--;
        l[x[s[i]]]++;
    }
    cout << ret << endl;
    return 0;
}

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

#define FOR(i, j, k) for(int i = j; i < k; i++)
#define REP(i, j) FOR(i, 0, j)
#define fst first
#define snd second
#define pb push_back
#define eb emplace_back
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int n, m;
    cin >> n >> m;

    vvi s(m);
    REP(i, m) {
        int k;
        cin >> k;

        vi ss(k);
        REP(j, k) cin >> ss[j];
        s[i] = ss;
    }

    vi p(m);
    REP(i, m) cin >> p[i];

    ll ans = 0;
    REP(i, (1 << n)) {

        bool isok = true;
        REP(j, m) {
            int sum = 0;
            REP(k, s[j].size()) {
                if((i >> s[j][k] - 1) & 1)
                    sum++;
            }

            if(sum % 2 != p[j]) {
                isok = false;
                break;
            }
        }

        if(isok)
            ans++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
 
using namespace std;
 
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) r.begin(),r.end()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
 
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;


const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-7;


int main(){
	int t, n, m, p, q, v;
	cin>>t;
	double sum = 0, msum = 0, r, rsum;
	rep(i, t){
		cin>>n>>m;
		sum = rsum = 0;
		rep(j, m){
			cin>>v>>r;
			sum += r * v;
			rsum += r;
		}
		sum /= rsum;
		msum = max(msum, sum);
	}
	cin>>p>>q;
	sum = 0;
	rsum = 0;
	rep(i, q){
		cin>>v>>r;
		sum += r * v;
		rsum += r;
	}
	sum /= rsum;
	if(msum-sum > EPS){
		cout<<"YES"<<endl;
	}
	else cout<<"NO"<<endl;

	//cout<<msum<<" "<<sum<<endl;
}

Measured memory_bytes: 1232
# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
# list(map(int, list(input()))) # スペースがない数字リストを読み込み
import math
import fractions
import sys
import bisect
import heapq  # 優先度付きキュー(最小値取り出し)
import collections
from collections import Counter
from collections import deque
import pprint
import itertools

sr = lambda: input()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""


def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    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


# a^n
def power(a, n, mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod


# n*(n-1)*...*(l+1)*l
def kaijo(n, l, mod):
    if n == 0:
        return 1
    a = n
    tmp = n - 1
    while (tmp >= l):
        a = a * tmp % mod
        tmp -= 1
    return a

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

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

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

        if x == y:
            return

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

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

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

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

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

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

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

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

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

# 約数生成
def 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

inf = 10 ** 18
mod = 10 ** 9 + 7

n = ir()
print((power(10,n,mod) - 2*power(9,n,mod) + power(8,n,mod))%mod)

Measured memory_bytes: 72696
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

template <typename T>
void printlnVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << endl;
  }
}

template <typename T>
void printVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << " ";
  }
  cout << endl;
}

int main()
{
  long long A, B, C;
  cin >> A >> B >> C;
  if (A % 2 == 0 || B % 2 == 0 || C % 2 == 0)
    cout << 0 << endl;
  else
    cout << min({A * B, B * C, C * A}) << endl;

  return 0;
}

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

int N;
int ans;

void solve()
{
    if(N%2==0)
    {
        ans = N;
    }
    else
    {   
        ans = N*2; 
    }
}
int main()
{
    cin >> N;
    solve();
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
//#define DEBUG 3

#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <functional>
#include <vector>
#include <queue>
#include <string>
#include <complex>
#include <stack>
#include <set>
#include <map>
#include <list>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <regex>
#include <fstream>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define FOR(i,s,n) for (int i = (s); i < (n); i++)
using namespace std;

void run() {
	int x; cin >> x;

	cout << (x < 1200 ? "ABC" : "ARC") << endl;
}

int main() {
#ifdef DEBUG
	ifstream in("input.txt");
	cin.rdbuf(in.rdbuf());
	for(int i = 0; i < DEBUG; i++) {
		cout << "cnt:" << i << " ------------" << endl;
		run();
	}
#else
	run();
#endif
	return 0;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
const int mod = 1000000007;
ll k,n,t=1,test,testi;
double ans=0,s=0;
std::vector<double> p;
int main(){
  cin >> n >> k;
  p.resize(n);
  for (size_t x = 0; x < n; x++) {
    double temp;
    cin >> temp;
    p[x] = (0.5*temp*(1+temp))/temp;
  }
  for (size_t i = 0; i < k; i++) {
    s += p[i];
  }
  for (size_t i = k; i < n+1; i++) {
    ans = max(s,ans);
    s -= p[i-k];
    s += p[i];
  }
  printf("%.12lf\n", ans);

}


Measured memory_bytes: 1792
using System;
using System.Linq;
using System.Text.RegularExpressions;

namespace B
{
	internal class Program
	{
		public static void Main(string[] args)
		{
			var line = Console.ReadLine().Split().Select(int.Parse).ToArray();
			var s = Console.ReadLine();

			var regex = new Regex(@"^(\d+)-(\d+)$");
			var match = regex.Match(s);
			if (!match.Success)
			{
				Console.WriteLine("No");
				return;
			}

			for (var i = 0; i < 2; i++)
			{
				if (match.Groups[i + 1].ToString().Length != line[i])
				{
					Console.WriteLine("No");
					return;
				}
			}

			Console.WriteLine("Yes");
		}
	}
}

Measured memory_bytes: 16076
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args) {
#if DEBUG
        //MyDebugger.MakeTestCase("../TextFile2.txt"); return;
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }
    
    static object process(TextReader input) {
        var n = int.Parse(input.ReadLine());

        double x = n / 1.08;

        int ix = (int)x;
        if ((int)(ix * 1.08) == n) return ix;
        if ((int)((ix+1)*1.08) == n) return ix+1;
        
        return ":(";
    }
}


Measured memory_bytes: 13140
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#define ll long long
using namespace std;
const int N=101101;
int a[N];
int n,m;
int main(){
	scanf("%d%d",&n,&m);
	printf("%lld\n",1ll*n*(n-1)/2+1ll*m*(m-1)/2);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", x);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;

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

	if (n[n.size()-1] == '0' || n[n.size()-1] == '1' || n[n.size()-1] == '6' || n[n.size()-1] == '8') {
		cout << "pon" << endl;
	}
	else if (n[n.size()-1] == '3') {
		cout << "bon" << endl;
	}
	else cout << "hon" << endl;

	return 0;
}

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


int main() {
  int N; cin >> N;
  vector<vector<int>> A(2, vector<int>(N));
  for(int i=0; i<2; i++){
    for(int j=0; j<N; j++){
      cin >> A[i][j];
    }
  }

  int cum = 0;
  int max_cum = 0;
  int p = 0;
  for(int i=0; i<N-1; i++){
    cum += A[0][i+1] - A[1][i];
    if(cum > max_cum){
      max_cum = cum;
      p = i+1;
    }
  }

  int ans = 0;
  for(int i=0; i<p+1; i++){
    ans += A[0][i];
  }
  for(int i=p; i<N; i++){
    ans += A[1][i];
  }

  cout << ans << endl;

  return 0;
}


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

#define rep(i,n) for(ll i=0;i<(n);++i)
#define reps(i,n) for(ll i=1;i<=(n);++i)
using ll = long long;
using str = string;
constexpr long long INF = (1LL<<60);
constexpr long long MOD = (1e9+7);
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T>inline bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
inline void dump(){cout<<endl;}
template<class Head,class... Tail>inline void dump(Head&& head, Tail&&... tail){cout<<head<<", ";dump(forward<Tail>(tail)...);}
template<typename T>inline istream &operator>>(istream&input,vector<T>&v){for(auto &elemnt:v)input>>elemnt;return input;}

main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout<<fixed<<setprecision(10);
  
  ll N;
  cin>>N;
  ll n=pow(2,N);
  vector<ll> a(n);
  cin>>a;
  
  //multiset<ll> s;
  multiset<ll,greater<>> s,t;
  for(const auto& x:a)s.insert(x);
  t.insert(*s.begin());
  s.erase(s.begin());
  while(!s.empty()){
    queue<ll> que;
    for(const auto& x:t){
      auto itr=s.upper_bound(x);
      if(itr==s.end()){
        cout<<("No")<<endl;
        return 0;
      }
      que.push(*itr);
      s.erase(itr);
    }
    while(!que.empty()){
      t.insert(que.front());
      que.pop();
    }
  }
  cout<<("Yes")<<endl;


  
  

}


Measured memory_bytes: 15800