akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ok() puts(ok?"Yes":"No");
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
typedef map<string, int> msi;
typedef greater<int> gt;
typedef priority_queue<int, vector<int>, gt> minq;
typedef long long ll;
typedef pair<ll,ll> pll;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
//clang++ -std=c++11 -stdlib=libc++ 

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int main() {
  ll a,b; cin >> a >>b;
  ll cd = gcd(a,b);
  auto factorize = [](ll n) {
    vector<pair<ll,int>> res;
    for (ll i=2; i*i<=n; i++) {
      if (n%i) continue;
      res.push_back(make_pair(i, 0));
      while (n%i==0) {
        n/=i;
        res.back().second++;
      }
    }
    if (n!=1) res.push_back(make_pair(n,1));
    return res;
  };
  int ans = factorize(cd).size(); 
  ans++;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;

int main(){	
	string S;
	long long N;
	scanf("%lld",&N);
	cin >> S;
	ll res = 1;
	ll l = 0;
	rep(i, 2*N) {
		if ((l%2 == 0 && S[i] == 'B') || (l%2 == 1 && S[i] == 'W')) {
			l++;
		} else {
			if (l == 0) {
				cout << "0\n";
				return 0;
			}
			res = res*l%mod;
			l--;
		}
	}
	if (l != 0) {
		cout << "0\n";
		return 0;
	}
	repn(i, N) {
		res = res*i%mod;
	}
	cout << res << endl;
	return 0;
}



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

class Main {
    static int[] memo;

    public static int rec(int n) {
        if (n == 0) { return 0; }
        if (memo[n] != 0) { return memo[n]; }

        int[] coins = {
            1,
            6,
            6 * 6,
            6 * 6 * 6,
            6 * 6 * 6 * 6,
            6 * 6 * 6 * 6 * 6,
            6 * 6 * 6 * 6 * 6 * 6,
            9,
            9 * 9,
            9 * 9 * 9,
            9 * 9 * 9 * 9,
            9 * 9 * 9 * 9 * 9
        };

        List<Integer> answers = new ArrayList<>();
        for (int coin : coins) {
            if (n - coin >= 0) {
                answers.add(rec(n - coin) + 1);
            }
        }

        memo[n] = Collections.min(answers);
        return memo[n];
    }

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

        final int N = sc.nextInt();

        memo = new int[100001];

        System.out.println(rec(N));
    }
}

Measured memory_bytes: 52896
#include <algorithm>
#include <utility>
#include <cstdio>
#include <vector>
#define pb push_back
using ll = long long;
using data = std::vector<std::pair<ll, ll> >;
data vec[200005], adj[200005];
int que[200005], n;
inline void merge(data &res, const data &vec_a, const data &vec_b, ll w_a, ll w_b, ll lim)
{
	data tmp;
	int cur = 0;
	for (auto &it : vec_a)
	{
		while (cur < vec_b.size() && vec_b[cur].first <= lim - w_a - w_b - it.second)
			cur++;
		if (cur)
		{
			tmp.pb({it.first + w_a, vec_b[cur - 1].second + w_b});
			tmp.pb({vec_b[cur - 1].second + w_b, it.first + w_a});
		}
	}
	std::sort(tmp.begin(), tmp.end());
	res.clear();
	for (auto &it : tmp)
	{
		if (res.empty() || it.second < res.back().second)
			res.pb(it);
	}
}
inline bool chk(ll lim)
{
	for (int i = n - 1; i >= 0; i--)
	{
		int u = que[i];
		if (adj[u].empty())
			vec[u] = {{0, 0}};
		else
			merge(vec[u], vec[adj[u][0].first], vec[adj[u][1].first],
				  adj[u][0].second, adj[u][1].second, lim);
		if (vec[u].empty())
			return false;
	}
	return true;
}
int main()
{
	// freopen("AGC007-E.in", "r", stdin);
	scanf("%d", &n);
	for (int i = 1; i < n; i++)
	{
		int u, w;
		scanf("%d%d", &u, &w);
		adj[--u].pb({i, w});
	}
	int he = 0, ta = 0;
	que[ta++] = 0;
	while (he < ta)
	{
		int u = que[he++];
		for (auto &e : adj[u])
			que[ta++] = e.first;
	}
	ll l = 0, r = 1e18, ans = -1;
	while (l <= r)
	{
		ll m = l + r >> 1;
		if (chk(m))
		{
			ans = m;
			r = m - 1;
		}
		else
			l = m + 1;
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 35084
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#include<map>
#include<string>
#define all(x) (x).begin(),(x).end()
#define print(x) cout << (x) << endl
typedef long long ll;
typedef long double ld;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
 
using namespace std;

int main(){
    int N, M, X;    cin >> N >> M >> X;
    int l = 0, r = 0;
    for(int i=0; i<M; i++){
        int a;  cin >> a;
        if(a < X)   l++;
        else    r++;
    }
    print(min(l,r));
}

Measured memory_bytes: 3564
#include<iostream>
#include<queue>
using namespace std;
string s[50];
int h,w;
int d[5]={0,1,0,-1};
int dis[50][50];
main()
{
	cin>>h>>w;
	for(int i=0;i<h;i++)cin>>s[i];
	for(int i=0;i<h;i++)for(int j=0;j<w;j++)dis[i][j]=1e9;
	dis[0][0]=1;
	queue<pair<int,int> >P;
	P.push(make_pair(0,0));
	while(!P.empty())
	{
		int x=P.front().first,y=P.front().second;P.pop();
		for(int r=0;r<4;r++)
		{
			int tx=x+d[r],ty=y+d[r+1];
			if(tx<0||ty<0||tx>=h||ty>=w||dis[tx][ty]<=dis[x][y]+1||s[tx][ty]=='#')continue;
			dis[tx][ty]=dis[x][y]+1;
			P.push(make_pair(tx,ty));
		}
	}
	if(dis[h-1][w-1]<1e9)
	{
		int cnt=0;
		for(int i=0;i<h;i++)for(int j=0;j<w;j++)cnt+=s[i][j]=='.';
		cnt-=dis[h-1][w-1];
		cout<<cnt<<endl;
	}
	else cout<<-1<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INT long long
#define P 998244353
using namespace std;
INT n, m, a, b, dp[100010];
vector<INT> v, w;
int main()
{
    ios::sync_with_stdio(false);
    cin>>n;
    v.push_back(1);
    for(int i = 0, p = 6 ; p <= n ; i++, p*=6 ) v.push_back(p);
    for(int i = 0, p = 9 ; p <= n ; i++, p*=9 ) v.push_back(p);
    for(int i = 1 ; i <= n ; i++ )
    {
        dp[i] = P;
        for(int j : v )
        {
            if( i-j >= 0 ) dp[i] = min(dp[i], dp[i-j]+1);
        }
    }
    cout<<dp[n]<<endl;
    return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(),v.end()
#define pii pair< ll,ll>
#define pb push_back
#define F first
#define S second
#define mp make_pair
#define ll long long int
#define mod 1000000006
#define mxn 100002

#define loop(v,i)  for(auto it=v[i].begin();it!=v[i].end();it++)
#define rep(i,a,b) for (int i = a; i < b; i++)
ll arr[mxn],n,vis[mxn]={0};
vector<vector<ll> > v(mxn);
ll dfs(ll i,ll ind)
{
  vis[i]=ind;
  ll j;
  for(j=0;j<v[i].size();j++)
  {
    if(vis[v[i][j]]==0)
      dfs(v[i][j],ind);
  }
}
int main()
{
     ios::sync_with_stdio(0);
     cout.tie(0);
     cin.tie(0);
     ll m;
     cin>>n>>m;
     ll i;
     for(i=1;i<=n;i++)
     {
      cin>>arr[i];
     }
     for(i=0;i<m;i++)
     {
      ll o , p;
      cin>>o>>p;
      v[o].pb(p);
      v[p].pb(o);
     }
     ll ind=1;
     for(i=1;i<=n;i++)
     {
      if(vis[i]==0)
        {
          dfs(i,ind);
           ind++;
        }
     }
     ll ans=0;
     for(i=1;i<=n;i++)
     {
      if(vis[i]==vis[arr[i]]) ans++;
     }
     cout<<ans;
}

Measured memory_bytes: 9344
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
 
using namespace std;
 
#define PB push_back
#define MP make_pair
#define REP(i,n) for(int i=0;i<(n);i++)
int main() {
    string s;
    cin>>s;
    int cnt=0;
    for(int i=0;i<s.size()/2;i++){
        // cout<<s[i]<<" "<<s[s.size()-i-1]<<endl;
        if(s[i]!=s[s.size()-1-i])cnt++;
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long i,j,k,n,m,x=0,y,z;
    string s,ss;
    cin>>s;
    ss=s;
    reverse(ss.begin(),ss.end());
    for(i=0;i<s.size();i++){
        if(s[i]!=ss[i]){
            x++;
        }
    }
    cout<<x/2<<endl;
}


Measured memory_bytes: 256
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, d, tmp, m, h, w, x, y, sum, k, q;
ld a, b, c;

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

  cin >> n;
  a = (ld)n / 3.0;
  b = (ld)n / 3.0;
  c = (ld)n / 3.0;
  ld anss = a * b * c;
  doublecout(anss);
  return 0;
}

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

m = 1000000007

A.sort()
if N % 2 == 0:
    B = list(range(1, N, 2)) * 2
else:
    B = [0] + list(range(2, N, 2)) * 2
B.sort()

if A != B:
    print(0)
else:
    result = 1
    for i in range(N // 2):
        result *= 2
        result %= m
    print(result)


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

int n;
int cnt;

int main() {
    cin >> n;
    int A[n];
    for(int i=0;i<n;++i) cin >> A[i];
    sort(A, A + n);
    cnt=1;
    for(int i=0;i<n-1;++i){
        if (A[i]<A[i+1]) ++cnt;
    } 
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<functional>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
LL N,K;
string s[3];
int main(){
    cin>>s[0]>>s[1]>>s[2];

    int now=0;
    int in[3]={};
    int ans=0;
    for(int i=0;i<s[0].length()+s[1].length()+s[2].length();i++){
        in[now]++;
        if(s[now].length()+1==in[now]){
            ans=now;
            break;
        }
        if(s[now][in[now]-1]=='a'){
            now=0;
           // cout<<"toA";
            
        }
        else if(s[now][in[now]-1]=='b'){
            now=1;
        }
        else if(s[now][in[now]-1]=='c'){
            now=2;
           // cout<<"toC";
        }
    }
    if(ans==0){
        cout<<"A"<<endl;
    }
    if(ans==1){
        cout<<"B"<<endl;
    }
    if(ans==2){
        cout<<"C"<<endl;
    }


        
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include <bits/stdc++.h>
#include <utility>
#include <iomanip>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)

using namespace std;

#define ld long double
#define ll long long

map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int N;
  cin >> N;
  int n=(N+1)/2;
  int N_MAX=3010;
  double p[3010];
  for(int i=0;i<N;i++){
    cin >> p[i];
  }

  double dp[N_MAX][N_MAX]={0};
  /*for(int i=0;i<N_MAX;i++){
    dp[i][0];
  }*/
  dp[0][0]=1.0;

  for(int i=0;i<N;i++){
    for(int j=0;j<=i;j++){
      dp[i+1][j+1]+=dp[i][j]*p[i];
      dp[i+1][j]+=dp[i][j]*(1.0-p[i]);
    }
  }
  double ans=0.0;
  for(int i=n;i<=N;i++){
    ans+=dp[N][i];
  }
  cout << fixed << setprecision(10) << ans << endl;
  return 0;
}

Measured memory_bytes: 71040
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define popb pop_back
#define popf pop_front
#define all(v) v.begin(), v.end()
#define fori(i, j, k) for (int i = (j); i < (int)(k); i++)
#define forb(i, j, k) for (int i = (j); i >= (int)k; i--)
#define lchild(ind) 2 * ind + 1
#define rchild(ind) 2 * ind + 2
#define bug(val) cout << "# " << val << endl;
#define bugs(val) cout << '_' << val;
#define bugl(val) cout << "## " << val << endl;

template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef pair<int, pll> pip;
typedef pair<ll, pll> plp;
typedef pair<pll, int> ppi;
typedef pair<pll, ll> ppl;
typedef pair<pll, pll> ppp;
typedef vector<int> vi;
typedef vector<ll> vll;

const int maxn = 1e5 + 1;
const ll inf = 2e18, mod = 1e9 + 7;

int n, a[maxn];

bool solve()
{
	int o = 0;
	fori (i, 0, n)
		if (a[i] & 1)
			o++;
	int e = n - o;
	if (e & 1)
		return true;
	else
	{
		if (o == 1)
		{
			int val = -1;
			fori (i, 0, n)
				if (a[i] & 1)
					val = a[i];
			if (val == 1)
				return false;
			val--;
			fori (i, 0, n)
				if (!(a[i] & 1))
					val = __gcd(val, a[i]);
			fori (i, 0, n)
				a[i] /= val;
			return !solve();
		}
		else if (o > 1)
			return false;
	}
	return false;
}

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

	cin >> n;
	fori (i, 0, n)
		cin >> a[i];
	bool ans = solve();
	cout << (ans ? "First" : "Second") << endl;
}



















Measured memory_bytes: 640
#include <bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(0)
#define ii pair<int, int>

using namespace std;
int n, k;

main() {
//    freopen("in.txt", "r", stdin);
    IOS;
    cin >> n >> k;
    if(k > (n-2)*(n-1)/2) {
        cout << -1;
        exit(0);
    }
    vector<ii> E;
    int r = (n-2)*(n-1)/2 - k;
    for(int i=2; i<=n; i++) E.push_back({1, i});
    for(int i=2; r>0 && i<=n; i++) {
        for(int j=i+1; r>0 && j<=n; j++) {
            E.push_back({i, j});
            r--;
        }
    }
    cout << E.size() << "\n";
    for(ii p : E)   cout << p.first << " " << p.second << "\n";
}


Measured memory_bytes: 3708
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,k,zero,a,s=-1e18,g=1e18+1,m,l,L,L1;
vector<ll> mi,pl;
int main(void){
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>a;
        if(a>0)pl.push_back(a);
        else if(a<0)mi.push_back(-a);
        else if(a==0)zero++;
    }
    sort(pl.begin(),pl.end());
    sort(mi.begin(),mi.end());
    while(g-s>1){
        m=(g+s)/2;
        if(m==0){
            L=mi.size()*pl.size();
        }
        else if(m>0){
            L=zero*(n-1)-((zero)*(zero-1))/2+mi.size()*pl.size();
            //cout<<L<<endl;
            L1=0;
            for(auto x:pl){
                l=(m-1)/x;
                L1+=upper_bound(pl.begin(),pl.end(),l)-pl.begin();
            }
            //cout<<L1<<endl;
            for(auto x:pl){
                if(x*x<m)L1--;
                else break;
            }
            //cout<<L1<<endl;
            L+=L1/2;
            L1=0;
            for(auto x:mi){
                l=(m-1)/x;
                L1+=upper_bound(mi.begin(),mi.end(),l)-mi.begin();
            }
            for(auto x:mi){
                if(x*x<m)L1--;
                else break;
            }
            L+=L1/2;
        }
        else{
            L=mi.size()*pl.size();
            for(auto x:pl){
                l=-m/x;
                L-=upper_bound(mi.begin(),mi.end(),l)-mi.begin();
            }
        }
        //cout<<m<<" "<<L<<endl;
        if(k>L)s=m;
        else if(k<=L)g=m;
    }
    cout<<s<<endl;
}


Measured memory_bytes: 2420
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e6+5;
int tot,p[maxn],vis[maxn],tag[maxn];
void init(int n)
{
	for(int i=2;i<=n;i++)
	{
		if(!vis[i]) p[++tot]=i;
		for(int j=1;i*p[j]<=n;j++)
		{
			vis[i*p[j]]=1;
			if(i%p[j]==0) break;
		}
	}
}
int gcd(int a,int b)
{	return !b?a:gcd(b,a%b); }
int main()
{
	init(1e6);
	int n,d,x,ok=1;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&x);
		d=i==1?x:gcd(d,x);
		for(int i=2;ok&&i*i<=x;i++) if(x%i==0)
		{
			if(tag[i]) ok=0;
			while(x%i==0) x/=i;
			tag[i]=1;
		}
		if(x>1) vis[x]?ok=0:vis[x]=1;
	}
	if(ok) puts("pairwise coprime");
	else if(d==1) puts("setwise coprime");
	else puts("not coprime");
}

Measured memory_bytes: 7912
#include <iostream>

using namespace std;

#define INPUT_MIN 0
#define INPUT_MAX 100

void swap(int *num1, int *num2);

int main()
{
	int a = 0, b = 0, c = 0;
	
	cin >> a;
	cin >> b;
	cin >> c;
/*	
	if( (INPUT_MIN > a) || (INPUT_MAX < a) )
	{
		return 1;
	}
	
	if( (INPUT_MIN > b) || (INPUT_MAX < b) )
	{
		return 1;
	}
	
	if( (INPUT_MIN > c) || (INPUT_MAX < c) )
	{
		return 1;
	}
*/	
	if(a > b)
	{
		swap(&a, &b);
	}
	
	if(b > c)
	{
		swap(&b, &c);
	}
	
	if(a > b)
	{
		swap(&a, &b);
	}
	
	cout << a << " " << b << " " << c << endl;
	
	return 0;
}

void swap(int *num1, int *num2)
{
	int tmp;
	
	tmp   = *num1;
	*num1 = *num2;
	*num2 = tmp;
}


Measured memory_bytes: 3092
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main() {
	string t,b;
	cin >> t >> b;
	vector<vector<int>> dp(t.length()+1,vector<int>(b.length()+1,0));
	int i,j;
	for(i=0;i<=t.length();i++)dp[i][0] = 1;
	for(i=0;i<t.length();i++) {
		for(j=0;j<b.length();j++) {
			dp[i+1][j+1] = dp[i][j+1];
			if(t[i] == b[j])dp[i+1][j+1] = (dp[i+1][j+1]+dp[i][j])%1000000007;
		}
	}
	cout << dp[t.length()][b.length()] << endl;
}


Measured memory_bytes: 6852
#include<iostream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define int4(v, x, y, z) int v, x, y, z; scanf("%d%d%d%d", &v, &x, &y, &z)
#define int5(v, w, x, y, z) int v, w, x, y, z; scanf("%d%d%d%d%d", &v, &w, &x, &y, &z)
#define ll2(x, y) ll x, y; cin >> x >> y;
#define scn(n, a) rep(i, n)cin >> a[i]
#define sc2n(n, a, b) rep(i, n)cin >> a[i] >> b[i]
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define endl "\n"
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << (x) << "\n"
#define debug2(x, y) cout << " --- " << (x) << " " << (y) << "\n"
#define debug3(x, y, z) cout << " --- " << (x) << " " << (y) << " " << (z) << "\n"
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)

string s;
int sp = 0;

int nxt(void){
  int res = 0;
  for(;;){
    res = res * 10 + (int)(s[sp] - '0');
    ++sp;
    if('0' > s[sp] || s[sp] > '9')break;
  }
  return res;
}

int cal(void){
  int res = nxt();
  for(;;){
    if(s[sp] == '+'){
      ++sp;
      res += nxt();
    }else if(s[sp] == '-'){
      ++sp;
      res -= nxt();
    }else if(s[sp] == '*'){
      ++sp;
      res *= nxt();
    }else if(s[sp] == '/'){
      ++sp;
      res /= nxt();
    }else break;
  }
  return res;
}

signed main(void){
  int i, j;
  for(int testcase = 0;testcase >= 0;testcase++){
    for(string x;;){
      cin >> x;
      s += x;
      if(x[0] == '=')break;
    }
    pri(cal());

/*/

//*/ break;
  }
  return 0;
}

Measured memory_bytes: 3136
#include<stdio.h>
int main(){
	int i,n,x,ans;
	scanf("%d",&n);
	scanf("%d",&ans);
	for(i=2;i<=n;i++){
		scanf("%d",&x);
		ans=(x-ans)/i+ans;
		//printf("%d\n",ans);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>



int main(int argc, char *arv[])
{
  int n;
  scanf("%d", &n);
  int array[10010];

  int i;
  for(i=0; i < n; i++)
    {
      scanf("%d", &array[i]);
      
    }

  int small = 1000000;
  int big = -1000000;
  long long sum = 0;
  for(i=0; i < n; i++)
    {
      if (array[i] < small) small = array[i];
      if (array[i] > big) big = array[i];
      sum += array[i];
    }

  printf("%d %d %lld\n", small, big, sum);
  return 0;
}

  

  

Measured memory_bytes: 636
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>		//UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>		//do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;

const int MOD = 1e9+7;

int main()
{
	int N, res = 1, sub = 0, akt = -1;
	scanf("%d", &N);
	FORQ(i,1,N)
	{
		int x;
		scanf("%d", &x);

		akt += 2;

		res = (res *(LL)(i-sub)) % MOD;

		if(akt > x)
		{
			akt -= 2;
			sub++;
		}
	}

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

	return 0;
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    int n;
    cin >> n;
    int m[n][n];
    rep(i, n) rep(j, n) m[i][j] = (i == j ? 0 : 1e8);
    rep(i, n)
    {
        int u, k;
        cin >> u >> k;
        rep(i, k)
        {
            int v, c;
            cin >> v >> c;
            m[u][v] = c;
        }
    }

    rep(k, n) rep(i, n) rep(j, n) m[i][j] = min(m[i][j], m[i][k] + m[k][j]);

    rep(i, n) cout << i << " " << m[0][i] << endl;

    return 0;
}


Measured memory_bytes: 3128
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
#define dump(x) cerr << "LINE" << __LINE__ << " : " << #x << " = {";  \
	for(auto v: x) cerr << v << ","; cerr << "}" << endl;
#else
#define show(x) true
#define dump(x) true
#endif

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);
	
	int a;string s;
	cin >> a >> s;
	if(a >= 3200) cout << s << endl;
	else cout << "red" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <limits.h>
#include <bitset>
#include <math.h>
#define int long long
using namespace std;
using P = pair<int, int>;
using ll = long long;
using prique = priority_queue<int>;
const int MOD = 1000000007;
const int INF = LLONG_MAX/3;
const int MAX = 710000;

/*-----Library-----*/

struct UnionFind {
    vector<int> par; // 親ノード
    vector<int> rank; // ランク
    vector<int> sizeuf; //要素数
    UnionFind(int n = 1) {
        init(n);
    }

    void init(int n = 1) {
        par.resize(n); rank.resize(n); sizeuf.resize(n);
        for (int i = 0; i < n; ++i) {
            par[i] = i;
            rank[i] = 0;
            sizeuf[i]=1;
        }
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            return par[x] = r;
        }
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        sizeuf[x]+=sizeuf[y];
        return true;
    }

    int size(int x){
        return sizeuf[root(x)];
    }
};

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

long long lcm(long long i,long long j){
    return i*(j/gcd(i,j));
}

long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*-----Library-----*/
signed main(){
    int n,m;
    cin>>n>>m;
    int sumx=0,sumy=0;
    int a;
    cin>>a;
    for(int i=1;i<n;i++){
        int b;
        cin>>b;
        sumx+=(i*(n-i))*(b-a);
        sumx%=MOD;
        a=b;
    }
    cin>>a;
    for(int i=1;i<m;i++){
        int b;
        cin>>b;
        sumy+=(i*(m-i))*(b-a);
        sumy%=MOD;
        a=b;
    }
    cout<<sumx*sumy%MOD<<endl;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(){
    long n;
    cin>>n;
    unsigned long ft=0,fa=0,sum=0;
    for(int i=0; i<n; i++){
        unsigned long t,a;
        cin>>t>>a;
        if(i>0){
            int j=0;
            while((ft+j)%t!=0)
                j++;
            sum+=j;
            ft+=j;
            j=0;
            while((fa+j)%a!=0)
                j++;
            sum+=j;
            fa+=j;
            if(ft/t*a>=fa){
                sum+=ft/t*a-fa;
                fa=ft/t*a;
            }
            else{
                sum+=fa/a*t-ft;
                ft=fa/a*t;
            }
        }
        else{
            ft=t;
            fa=a;
            sum+=t+a;
        }
    }
    cout<<sum;
}

Measured memory_bytes: 256
import math
n = input()
a = map(int, raw_input().split())
b = map(int, raw_input().split())
c = 0
for i, j in zip(a, b):
    if i < j:
        c += math.ceil(1.0*(j-i)/2)
if c > sum(b)-sum(a):
    print "No"
else:
    print "Yes"


Measured memory_bytes: 3956
#include <cstdlib>
#include <iostream>
#include <sstream>
using namespace std;

inline int stoi(const string& str) {
	int res;
	istringstream is(str);
	is >> res;
	return res;
}

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

	string a, b;
	int k;
	cin >> a >> b >> k;

	b = string(a.size() - b.size(), '0') + b;
	for(int i = 0; i < (int)a.size(); ++i) {
		a[i] -= b[i] - '0';
		if(a[i] < '0') {
			a[i] += 10;
			int j = i - 1;
			while(a[j] == '0')
				--j;

			while(true) {
				if(k)
					--k;
				else
					a[j] -= 1;

				if(++j < i)
					a[j] += 9;
				else
					break;
			}
		}
	}

	cout << stoi(a) << endl;

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[]={1,0,-1,0,1,1,-1,-1};

int main() {
	int k, a, b; cin >> k >> a >> b;
	for(int i = a; i <= b; ++i) {
		if(i % k == 0) {
			cout << "OK" << '\n';
			return 0;
		}
	}
	cout << "NG" << '\n';
	return 0;
}

Measured memory_bytes: 3624
import sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *
from math import *
from fractions import *

sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()


def main():
    N = int(input())
    if N == 1:
        print('Hello World')
    else:
        print(int(input()) + int(input()))


main()


Measured memory_bytes: 63980
import java.util.*;
public class Main {
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                Map hs = new HashMap();
                int n = sc.nextInt();
                int k = sc.nextInt();
                sc.close();
                int[] q = new int[n + 1];
                q[0] = 1;
                for(int i = 1 ; i <= n ; i++){
                        q[i] = Math.min(q[i - 1] + k , q[i - 1] * 2);
                }
                System.out.println(q[n]);
        }
}

Measured memory_bytes: 35588
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	wa := make([]string, n)
	wm := make(map[string]int)
	for i := range wa {
		fmt.Scan(&wa[i])
		wm[wa[i]] = 0
	}
	if len(wa) != len(wm) {
		fmt.Println("No")
		return
	}
	for i := 0; i < n-1; i++ {
		w1, w2 := wa[i], wa[i+1]
		if w1[len(w1)-1] != w2[0] {
			fmt.Println("No")
			return
		}
	}
	fmt.Println("Yes")
}


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

using namespace std;

int main()
{
    string s,t;
    cin>>s>>t;
    int n=s.size();
    if(t.size()!=n+1){
        cout<<"No"<<endl;
        return 0;
    }
    for(int i=0;i<n;i++){
        if(s[i]!=t[i]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
}


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

signed main(){
	int w,h,n,field[100][100] = {};
	cin >> w >> h >> n;
	for(int i = 0;i < n;i++){
		int x,y,a;
		cin >> x >> y >> a;
		if(a == 1){
			for(int j = 0;j < x;j++){
				for(int k = 0;k < h;k++) field[j][k] = 1;
			}
		}else if(a == 2){
			for(int j = x;j < w;j++){
				for(int k = 0;k < h;k++) field[j][k] = 1;
			}
		}else if(a == 3){
			for(int j = 0;j < w;j++){
				for(int k = 0;k < y;k++) field[j][k] = 1;
			}
		}else{
			for(int j = 0;j < w;j++){
				for(int k = y;k < h;k++) field[j][k] = 1;
			}
		}
	}
	int ans = 0;
	for(int i = 0;i < h;i++){
		for(int j = 0;j < w;j++) {
			if(!field[j][i]) ans++;
		}
	}
	cout << ans << endl;
}

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

int main () {
  int N, M, C;
  cin >> N >> M >> C;
  
  vector<int> B(M, 0);
  vector<vector<int>> A(N, vector<int>(M, 0));
  int judge = 0;
  int ans = 0;

  rep(i, M) cin >> B[i];
  rep(i, N) {
    rep(j, M) {
      cin >> A[i][j];
    }
  }

  rep(i, N) {
    judge = 0;
    rep(j, M) {
      judge += A[i][j] * B[j];
    }
    judge += C;
    if (judge > 0) ans++;
  }
  cout << ans;
}

Measured memory_bytes: 3608
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt(); //支払いたい金額
		int a = stdIn.nextInt(); //1円の枚数
		
		int ans = n % 500;
		
		if(ans <= a) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
		
		
		
	}

}


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

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

    vector<long> a(3*n);
    for(auto &x: a) cin >> x;

    vector<long> l(n+1);
    {
        long sum = 0;
        priority_queue<long> q;
        for(int i=0; i<n; i++) sum += a[i], q.push(-a[i]);

        l[0] = sum;
        for(int i=0; i<n; i++) {
            long aa = a[i+n];
            long t = -q.top();
            if(aa > t) {
                sum += aa - t;
                q.pop();
                q.push(-a[i+n]);
            }
            l[i+1] = sum;
        }
    }

    vector<long> r(n+1);
    {
        long sum = 0;
        priority_queue<long> q;
        for(int i=0; i<n; i++) sum += a[3*n-1-i], q.push(a[3*n-1-i]);

        r[n] = sum;
        for(int i=0; i<n; i++) {
            long aa = a[3*n-1-(i+n)];
            long t = q.top();
            if(aa < t) {
                sum += aa - t;
                q.pop();
                q.push(a[3*n-1-(i+n)]);
            }
            r[n-1-i] = sum;
        }
    }

    /* for(auto &x: l) cout << x << ' '; */
    /* cout << endl; */

    /* for(auto &x: r) cout << x << ' '; */
    /* cout << endl; */

    long res = -1e18;
    for(int i=0; i<=n; i++)
        res = max(l[i] - r[i], res);

    cout << res << endl;
}


Measured memory_bytes: 5992
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

using namespace std;

typedef pair<long long int, long long int> P;

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

int n, F[100], A[100];
int px[15], py[15];

bool func(int pos, int cnt, int num){
	if(cnt > n){
		return false;
	}
	if(pos == 100){
		return cnt == n;
	}
	if(A[pos] < 0){
		return false;
	}
	if(A[pos] == 0){
		return func(pos + 1, cnt, num);
	}
	int x = pos % 10, y = pos / 10;
	if(num % 3 == 0){
		if(x == 0 || x == 9 || y >= 8){
			return false;
		}
		A[y * 10 + x] -= 1;
		A[(y + 1) * 10 + x - 1] -= 1;
		A[(y + 1) * 10 + x] -= 1;
		A[(y + 1) * 10 + x + 1] -= 1;
		A[(y + 2) * 10 + x] -= 1;
		px[cnt] = x;
		py[cnt] = y + 1;
	}else if(num % 3 == 1){
		if(x >= 8 || y >= 8){
			return false;
		}
		A[y * 10 + x] -= 1;
		A[y * 10 + x + 1] -= 1;
		A[y * 10 + x + 2] -= 1;
		A[(y + 1) * 10 + x] -= 1;
		A[(y + 1) * 10 + x + 1] -= 1;
		A[(y + 1) * 10 + x + 2] -= 1;
		A[(y + 2) * 10 + x] -= 1;
		A[(y + 2) * 10 + x + 1] -= 1;
		A[(y + 2) * 10 + x + 2] -= 1;
		px[cnt] = x + 1;
		py[cnt] = y + 1;
	}else{
		if(x <= 1 || x >= 8 || y >= 6){
			return false;
		}
		A[y * 10 + x] -= 1;
		A[(y + 1) * 10 + x - 1] -= 1;
		A[(y + 1) * 10 + x] -= 1;
		A[(y + 1) * 10 + x + 1] -= 1;
		A[(y + 2) * 10 + x - 2] -= 1;
		A[(y + 2) * 10 + x - 1] -= 1;
		A[(y + 2) * 10 + x] -= 1;
		A[(y + 2) * 10 + x + 1] -= 1;
		A[(y + 2) * 10 + x + 2] -= 1;
		A[(y + 3) * 10 + x - 1] -= 1;
		A[(y + 3) * 10 + x] -= 1;
		A[(y + 3) * 10 + x + 1] -= 1;
		A[(y + 4) * 10 + x] -= 1;
		px[cnt] = x;
		py[cnt] = y + 2;
	}
	return func(pos, cnt + 1, num / 3);
}

int main(){
	cin >> n;
	for(int i = 0; i < 100; i++){
		cin >> F[i];
	}
	int lim = 1;
	for(int i = 0; i < n; i++){
		lim *= 3;
	}
	int ans = 0;
	for(int i = 0; i < lim; i++){
		copy(F, F + 100, A);
		if(func(0, 0, i)){
			ans = i;
			break;
		}
	}
	for(int i = 0; i < n; i++){
		cout << px[i] << " " << py[i] << " " << ans % 3 + 1 << endl;
		ans /= 3;
	}
	return 0;
}


Measured memory_bytes: 3108
// ※※※ 解答不能 ※※※
// sigma425氏.
// https://atcoder.jp/contests/abc130/submissions/6894895
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define pb push_back
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;

int main(){
    int N;
    scanf("%d", &N);
    V<LL> x(N), y(N), dx(N), dy(N);
    rep(i, N){
        char d[2];
        scanf("%lld %lld %s", &x[i], &y[i], d);
        if(d[0] == 'L') dx[i] = -1;
        if(d[0] == 'R') dx[i] = 1;
        if(d[0] == 'D') dy[i] = -1;
        if(d[0] == 'U') dy[i] = 1;
    }
    rep(i, N) x[i] *= 2, y[i] *= 2;
    LL inf = 1e9;
    V<LL> ts;
    rep(_, 4){
        LL A = -inf, B = -inf, C = -inf;
        rep(i, N){
            if(dx[i] == -1)     chmax(A, x[i]);
            else if(dx[i] == 1) chmax(C, x[i]);
            else                chmax(B, x[i]);
        }
        ts.pb(A - B);
        ts.pb(B - C);
        ts.pb((A - C) / 2);
        rep(i, N){
            swap(x[i], y[i]);
            x[i] = -x[i];
            swap(dx[i], dy[i]);
            dx[i] = -dx[i];
        }
    }
    ts.pb(0);
    LL ans = 1e18;
    for(LL t : ts){
        if(t >= 0){
            LL mxx = -inf, mxy = -inf, mnx = inf, mny = inf;
            rep(i, N){
                LL X = x[i] + dx[i] * t, Y = y[i] + dy[i] * t;
                chmax(mxx, X);
                chmin(mnx, X);
                chmax(mxy, Y);
                chmin(mny, Y);
            }
            chmin(ans, (mxx - mnx) * (mxy - mny));
        }
    }
    printf("%.10f\n", (double)ans / 4);
    return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <cmath>
#include <cstdio>

int main(){
    int a, b, c;

    std::cin >> a >> b >> c;

    if (a + b == c || a + c == b || b + c == a) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.BitSet;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	/** 終了となるボタン */
	private static final int STOP_BUTTON = 1;

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			int[] a = new int[n];
			int count = (int) IntStream.range(0, n).map(i -> a[i] = scanner.nextInt() - 1).filter(i -> i == STOP_BUTTON)
					.count();
			if (count == 0) {
				// 終了するボタンに通じるボタンがない場合
				System.out.println(-1);
				return;
			}
			int now = 0, result = 0;
			// 押したことのあるボタンを表す
			BitSet visited = new BitSet(n);
			visited.set(now);
			while (true) {
				result++;
				if (visited.get(a[now])) {
					result = -1;
					break;
				} else {
					if (a[now] == STOP_BUTTON) {
						break;
					}
					visited.set(a[now]);
					now = a[now];
				}
			}
			System.out.println(result);
		}
	}
}


Measured memory_bytes: 58636
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <cassert>

using namespace std;
using ll = long long;

int main()
{
    ll x;
    cin >> x;
    if(x < 7){
        cout << 1 << endl;
    }else if(x < 11){
        cout << 2 << endl;
    }else{
        if(x % 11 == 0){
            cout << x/11 * 2 << endl;
        }else if(x % 11 < 7){
            cout << x/11 * 2 + 1 << endl;
        }else{
            cout << x/11 * 2 + 2 << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <string>
#include <queue>
#include <map>

using namespace std;

typedef pair<int, string> P;

string worm;

bool chkColor(int len){
  for(int i = 0; i < len - 1; ++i) if(worm[i] != worm[i + 1]) return false;
  return true;
}

int bfs(){

  int cnt, len = worm.length();
  queue<P> q; q.push(P(0, worm));
  map<string, bool> mpworm; mpworm[worm] = true;

  while(!q.empty()){

    P p = q.front(); q.pop();
    cnt = p.first;
    worm = p.second;

    if(chkColor(len)) return cnt;

    for(int i = 0; i < len - 1; ++i){

      char ncolor;
      string nworm = worm;

      if(worm[i] != worm[i + 1]){
        if(worm[i] == 'r' && worm[i + 1] == 'g' || worm[i] == 'g' && worm[i + 1] == 'r') ncolor = 'b';
  	    else if(worm[i] == 'g' && worm[i + 1] == 'b' || worm[i] == 'b' && worm[i + 1] == 'g') ncolor = 'r';
        else if(worm[i] == 'b' && worm[i + 1] == 'r' || worm[i] == 'r' && worm[i + 1] == 'b') ncolor = 'g';
        nworm[i] = ncolor;
        nworm[i + 1] = ncolor;
        if(mpworm[nworm] != true){
          mpworm[nworm] = true;
          q.push(P(cnt + 1, nworm));
        }
      }

    }

  }
  return -1;
}


int main(){

  int ans;

  while(1){

    cin >> worm;
    if(worm == "0")break;
    ans = bfs();
    if(ans == -1)cout << "NA" << endl;
    else cout << ans << endl;

  }

  return 0;
}

Measured memory_bytes: 2920
while i = gets
  x = i.to_i
  count = 0
  while x != 0
    0.upto(x) do |i|
      a = i
      0.upto(x) do |j|
        b = j
        0.upto(x) do |k|
          c = k
          d = x - (a + b + c)
          count += 1 if ((a >= 0) && (a <= 9)) && ((b >= 0) && (b <= 9)) && ((c >= 0) && (c <= 9)) && ((d >= 0) && (d <= 9))
        end
      end
    end
    puts count
    x = 0
  end
end

Measured memory_bytes: 8528
#include <iostream>
#include <algorithm>

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

using namespace std;

int A[6];
int main() {
    rep(i, 6) cin >> A[i];
    sort(A, A + 4);
    sort(A + 4, A + 6);
    int ans = 0;
    rep(i, 3) ans += A[i + 1];
    ans += A[5];
    cout << ans << endl;
    return 0;
}

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

ope_count = 0
while True:
    even_count = len([a for a in A if a % 2 == 0])

    if even_count != N:
        print(ope_count)
        break

    A = [a / 2 for a in A]
    ope_count += 1


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

int solv(std::vector<int> const& A,
         std::vector<int> const& B) {
  std::vector<int> diff(A.size());
  long long int det = 0;

  for (size_t i=0; i<A.size(); i++) {
    diff[i] = A[i] - B[i];
    det += diff[i];
  }

  if (det < 0) return -1;

  std::sort(diff.begin(), diff.end());

  int ans = 0;
  long long int sum = 0;

  for (size_t i=0; diff[i] < 0; i++) {
    ans++;
    sum += diff[i];
    // std::cerr << ans << ':' << diff[i] << ',' << sum << std::endl;
  }

  for (size_t i=diff.size()-1; sum < 0; i--) {
    ans++;
    sum += diff[i];
    // std::cerr << ans << ':' << diff[i] << ',' << sum << std::endl;
  }

  return ans;
}

int main() {
  size_t N;

  std::cin >> N;

  std::vector<int> A(N);

  for (size_t i=0; i<N; i++) std::cin >> A[i];

  std::vector<int> B(N);

  for (size_t i=0; i<N; i++) std::cin >> B[i];

  std::cout << solv(A, B) << std::endl;

  return 0;
}


Measured memory_bytes: 1408
#include<iostream>
#include<stdio.h>
#include<algorithm>
using namespace std;

int main(){
	int n;
	while(cin >> n,n){
		int m[86400]={};
		for(int i=0;i<n;i++){
			int bh,bm,bs,eh,em,es;
			scanf("%d:%d:%d %d:%d:%d",&bh,&bm,&bs,&eh,&em,&es);
			m[(bh*60*60)+(bm*60)+bs]+=1;
			m[(eh*60*60)+(em*60)+es]+=-1;
		}
		int count=0,ans=0;
		for(int i=0;i<86400;i++){
			count+=m[i];
			ans=max(ans,count);
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 3564
function Main(input){
	inputs = input.split(' ');
    X = inputs.map(inputs=>parseInt(inputs,10));
    A = X[0];
    B = X[1];
    T = X[2];
    multiple = Math.floor(T / A);
    ans = multiple * B;
    console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin","utf8"));

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

#define ll long long
#define ull unsigned long long

const ll MOD = 1000000007;

using namespace std;

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

	ll dp[N+1][4][4][4];

	for (int ii = 0; ii <= N; ++ii){
		for (int a = 0; a < 4; ++a){
			for (int b = 0; b < 4; ++b){
				for (int c = 0; c < 4; ++c){
					dp[ii][a][b][c] = 0;
				}
			}
		}
	}
	dp[0][0][0][0] = 1;

	for (int ii = 0; ii < N; ++ii){
		for (int z = 0; z < 4; ++z){
			for (int a = 0; a < 4; ++a){
				for (int b = 0; b < 4; ++b){
					for (int c = 0; c < 4; ++c){
						bool cond1 = (b==1)&&(c==2)&&(z==3);
						bool cond2 = (b==2)&&(c==1)&&(z==3);
						bool cond3 = (b==1)&&(c==3)&&(z==2);
						bool cond4 = (a==1)&&(c==2)&&(z==3);
						bool cond5 = (a==1)&&(b==2)&&(z==3);
						if (cond1||cond2||cond3||cond4||cond5) continue;
						dp[ii+1][b][c][z] = (dp[ii+1][b][c][z] + dp[ii][a][b][c]) % MOD;
					}
				}
			}		
		}
	}

	ll ans = 0;
	for (int a = 0; a < 4; ++a){
		for (int b = 0; b < 4; ++b){
			for (int c = 0; c < 4; ++c){
				ans = (ans + dp[N][a][b][c]) % MOD;
			}
		}
	}


	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 3600
function Main(s) {
  var s = s.split("\n").map(e => e*1);
  var b = new Map();
  var cnt = 0;
  for (var i = 1; i <= s[0]; i++) {
    if (!b.has(s[i])) {
      b.set(s[i], 1);
    } else {
      b.set(s[i], b.get(s[i]) + 1);
    }
  }
  cnt = 0;
  for (var i of b.values()) {
    if (i&1) cnt++;
  }
  console.log(cnt);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 35500
#include <iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<queue>
#include<set>
#include<map>
#include<stack>
#include<cmath>
#include<vector>
#define maxn 1000009
#define cle(n) memset(n,0,sizeof(n))
typedef long long  ll;
typedef unsigned long long ull;
const int inf=100000000;
using namespace std;
int a,b,c;
int temp[3];
int main()
{
  cin>>a>>b>>c;
    if(a==b&&b==c)
    {
        if(a%2==0)
        return cout<<-1<<endl,0;
        else
            return cout<<0<<endl,0;
    }
    if(a%2||b%2||c%2)
        return cout<<0<<endl,0;
  int ans=0;
  int flag=0;
  int aa=a,bb=b,cc=c;
  int sum=a+b+c;
  aa=min(a,min(b,c));
  cc=max(a,max(b,c));
  bb=sum-aa-cc;
    while(1)
    {
        int t1,t2,t3;
        t1=(b+c)/2;
        t2=(a+c)/2;
        t3=(a+b)/2;
         a=min(t1,min(t2,t3));
  c=max(t1,max(t2,t3));
   b=sum-a-c;

ans++;

        if(a%2||b%2||c%2)
            break;

    }

 if(flag)return cout<<-1<<endl,0;
 else
    cout<<ans<<endl;

    return 0;
}


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

int main(){
  vector<int> a(3);
  for(int i = 0; i < 3; i++){
    cin >> a.at(i);
  }
  sort(a.begin(), a.end());
  cout << a.at(2) - a.at(0) << endl;
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp11
{
    class Class20
    {
        static void Main()
        {
            var N = Console.ReadLine().Split().Select(long.Parse).OrderByDescending(x=>x).ToList();
            long R = 0;
            if (N.Exists(x => x % 2 == 0))
            {
                Console.WriteLine(R = 0);
            }
            else
            {
                N.RemoveAt(0);
                R = N[0] * N[1];
                Console.WriteLine(R);
            }
        }
    }
}


Measured memory_bytes: 13396