akhauriyash/Code-Regression huggingface dataset:
#include "iostream"
#include "vector"
#include "string"
#include "algorithm"
#include "math.h"
#include "cstring"
#include "stack"
#include "queue"

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int INF = 10000;

//行先　容量　逆辺
struct edge { int to, cap, rev; };

int MAX_V = 210;
vector<vector<edge> > G(MAX_V);	//グラフの隣接リスト表現
vector<bool> used(MAX_V);		//DFSですでに調べたかのフラグ


void add_edge(int from, int to, int cap)
{
  G[from].push_back(edge{to, cap, (int)G[to].size()});
  G[to].push_back(edge{from, 0, (int)G[from].size() - 1});
}

int dfs(int v, int t, int f)
{
  if (v == t)
  {
    return f;
  }

  used[v] = true;

  int Gsize = G[v].size();
  for (int i = 0; i < Gsize; i++)
  {
    edge &e = G[v][i];
    if (!used[e.to] && e.cap > 0)
    {
      int d = dfs(e.to, t, min(f, e.cap));
      if (d > 0)
      {
        e.cap -= d;
        G[e.to][e.rev].cap += d;
        return d;
      }
    }
  }
  return 0;
}

//ｓからｔへの最大流を求める
int max_flow(int s, int t)
{
  int flow = 0;
  for (int i = 0; i < MAX_V; i++)
  {
    used[i] = false;
  }
  for (;;)
  {
    int f = dfs(s, t, INF);
    if (f == 0)
    {
      return flow;
    }
    flow += f;
  }
}


int n, k;
bool can[101][101] = {
  {false}
};

void solve()
{
  int s = n + k, t = s + 1;
  int ans = 0;

  for (int i = 0; i < n; i++)
  {
    add_edge(s, i, 1);
  }

  for (int i = 0; i < n; i++)
  {
    add_edge(n + i, t, 1);
  }

  for (int i = 0; i < n; i++)
  {
    for (int j = 0; j < k; j++)
    {
      if (can[i][j])
      {
        add_edge(i, n + j, 1);
      }
    }
	//cout<< max_flow(s, t);
    ans += max_flow(s, t);
  }
  cout << ans;
}

int main()
{

  cin >> n;
  k = n;
  vector<pii> a(n), b(k);
  for (int i = 0; i < n; i++)
  {
    cin >> a[i].first >> a[i].second;
  }
  for (int i = 0; i < k; i++)
  {
    cin >> b[i].first >> b[i].second;
  }
  for (int i = 0; i < n; i++)
  {
    for (int j = 0; j < k; j++)
    {
      if (a[i].first < b[j].first && a[i].second < b[j].second)
      {
        can[i][j] = true;
      }
    }
  }
  solve();
}

Measured memory_bytes: 384
#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 endl                "\n"
#define loop(i,s,e)         for(int i=s;i<e;i++)
#define int                 long long
#define vi                  vector<int> 
#define S(v)                sort(v.begin(),v.end())
#define RS(v)               sort(v.rbegin(),v.rend())
#define R(v)                reverse(v.begin(),v.end())
#define mxpq(T)             priority_queue <T>
#define mnpq(T)             priority_queue<T,vector<T>,greater<T>>
#define prv(v)              for(auto &x : v)cout << x << " ";
#define piirv(v)            for(auto &x : v)cout << x.ff << " " << x.ss << endl;
#define prvv(v)             for(auto &x : v)for(auto &y : x.ss)cout << y << " ";
#define mp                  make_pair
#define pii                 pair<int,int>
#define mset(a,f)           memset(a , f , sizeof(a))
#define pb                  push_back
#define inf                 INT_MAX
#define INF                 LLONG_MAX
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;

const int N = 2e6 + 6;

class var
{
public:
    int ai , bi , ci;
};

var A[N];
int dp[N][3];
int n , k;


void solve()
{
    cin >> n;

    loop(i,1,n+1)cin >> A[i].ai >> A[i].bi >> A[i].ci;

    loop(i,0,n+1)dp[i][0] = 0 , dp[i][1] = 0 ,dp[i][2] = 0;

    // dp[0] = 0;
    dp[1][0] = A[1].ai;
    dp[1][1] = A[1].bi;
    dp[1][2] = A[1].ci;

    loop(i,2,n+1)
    {
        loop(j,0,3)
        {
            if(j == 0)dp[i][j] = max({dp[i-1][1],dp[i-1][2]}) + A[i].ai;
            if(j == 1)dp[i][j] = max({dp[i-1][0],dp[i-1][2]}) + A[i].bi;
            if(j == 2)dp[i][j] = max({dp[i-1][0],dp[i-1][1]}) + A[i].ci;
        }
    }

    int ans = 0;

    loop(i,0,3)ans = max(dp[n][i] , ans);   

    cout << ans;
}
 
int32_t main()
{
 
cout<<fixed<<setprecision(16);

ios_base:: sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
     

     int t = 1;
     // cin >> t;
     while(t--)solve();
  
}

Measured memory_bytes: 10496
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
using namespace std;
#define MAXN 1000100
#define ll long long
int x, y, z;
int main()
{
	scanf("%d%d%d",&x,&y,&z);
	swap(x, y);
	swap(x, z);
	printf("%d %d %d\n",x,y,z);

	return 0;
}

Measured memory_bytes: 256
/*
Competitive programming template
Author: Aswin Sampath

*/


#include<bits/stdc++.h>

using namespace std;


typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef vector<ll>vl;
typedef vector<int>vi;
typedef priority_queue<ll,vl,greater<ll>()> pq_ll_min;
typedef priority_queue<ll> pq_ll_max; 
typedef stack<ll> s;
typedef queue<ll> q;


#define pi 3.141592653589793
#define PI  acos(-1.0)
#define space " "
#define endl '\n'
#define F first
#define S second
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)

#define FAST {ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
#define testcase ll t;cin>>t;while(t--)
#define dbxstl(x){for(auto ele:x)cout<<ele<<space; cout<<endl;}
#define dbxval(x){cout<<x<<endl;}

const ll INF = 1e18+7;
const ll MOD=1e9+7;

void solve(){
    printf("Hello\n");
}

int main(int argc, char const *argv[])
{
    ll n;
    cin>>n;
    vector<ll>dp(3,0);
    for(int days=0;days<n;days++){
        vector<ll>temp(3,0);
        vector<ll>params(3);

        for(int i=0;i<3;i++){
            cin>>params[i];
        }

        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                if(i!=j){
                    temp[j]=max(temp[j],dp[i]+params[j]);
                }
            }
        }
        dp=temp;
    }
    ll ans = max({dp[0],dp[1],dp[2]});
    cout<<ans<<endl;

    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using node = tuple<int,int,int>;
const ll inf = numeric_limits<ll>::max()/3;

int main(void){
  int n,z,w;
  vector< int > cards;
  cin >> n >> z >> w;
  cards.resize(n);
  for(int i = 0;i < n;++i){
    cin >> cards[i];
  }
  if(n == 1)
    cout << (int)abs(w - cards[n-1]) << endl;
  else
    cout << max((int)abs(w - cards[n-1]),
                (int)abs(cards[n-1] - cards[n-2])) << endl;;
  return 0;
}


Measured memory_bytes: 256
# AOJ ITP2_6_C: Lower Bound
# Python3 2018.6.24 bal4u

from bisect import bisect_left
n = int(input())
a = list(map(int, input().split()))
a.append(1000000001)  # > 1,000,000,000
q = int(input())
for i in range(q):
	k = int(input())
	print(bisect_left(a, k))


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

using namespace std;

typedef long long ll;

int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);

  int a, b;
  cin >> a >> b;
  if(a == 1) a = 14;
  if(b == 1) b = 14;

  if(a == b)
    cout << "Draw\n";
  else if(a < b)
    cout << "Bob\n";
  else
    cout << "Alice\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define rep(i,n) for(ll i=0;i<(n);i++)  
#define pii pair<int,int>
#define piii pair<int,pii>
#define mp make_pair
#define pb push_back  
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second  
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-5;
const double PI = M_PI;  
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define SHOWARRAY(ar,i,j) REP(a,i)REP(b,j)cerr<<ar[a][b]<<((b==j-1)?((a==i-1)?("\n\n"):("\n")):(" "))
  
#define DIV 1000000007
typedef vector<ll> Array;
typedef vector<Array> matrix;
typedef tuple<int,int,int> tiii;
#define mt make_tuple

int t_2 = 0; int t_4 = 0; int t_e = 0;

int main(){
  int h,w; cin >> h >> w;
  map<char,int> m;
  rep(i,h){
    string s; cin >> s;
    rep(j,w){
      m[s[j]]++;
      if(m[s[j]] >= 4){t_4++; m[s[j]] -= 4;}
    }
  }
  
  
  for(int i = 'a'; i <= 'z'; i++){
    if(m[i] == 0) continue;
    if(m[i] % 4 == 0) t_4++;
    else if(m[i] % 2 == 0) t_2++;
    else t_e++;
  }
  if(h==1 && w == 1) {cout << "Yes" << endl;return 0;}
  if(h%2){t_2 -= (w)/2;}
  if(w%2){t_2 -= (h)/2;}
  if(h%2 && w%2){t_e--;}
  if(t_e > 0 || t_2 > 0){cout << "No"<<endl;}else{cout <<"Yes"<<endl;}
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define MAX_N 200010
long long inv[MAX_N];
long long factorial[MAX_N];
long long inv_factorial[MAX_N];

void get_inv(){
    for (int i = 1; i < MAX_N; i++) {
        if (i == 1) inv[i] = 1;
        else {
            inv[i] = (mod - (mod / i) * inv[mod % i]) % mod;
            if (inv[i] < 0) inv[i] += mod;
        }
    }
}
void get_factorial(){
    factorial[0] = 1; inv_factorial[0] = 1;
    for (int i = 1; i < MAX_N; i++) {
        factorial[i] = factorial[i-1] * i;
        factorial[i] %= mod;
        inv_factorial[i] = inv_factorial[i-1] * inv[i];
        inv_factorial[i] %= mod;
    }
}

long long combination(int n, int r) {
    long long ret = factorial[n] * inv_factorial[r];
    ret %= mod;
    ret *= inv_factorial[n-r];
    return ret % mod;
}

long long modpow(long long n, long long r) {
    n %= mod, r %= (mod-1);
    long long ret = 1; long long tmp = n;
    while (r != 0) {
        if (r % 2) ret *= tmp;
        tmp *= tmp; tmp %= mod; ret %= mod;
        r /= 2;
    }
    return ret;
}

vector<int> e[200010];
long long dp[200010];
int c[200010];

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    get_inv(); get_factorial();
    int n; cin >> n;
    for (int i = 0; i < n-1; i++) {
        int a, b; cin >> a >> b;
        e[a].emplace_back(b);
        e[b].emplace_back(a);
    }
    auto dfsdp = [&](auto f, int curr, int prev) -> int {
        dp[curr] = 1;
        int cnt = 0;
        for (auto &to: e[curr]) {
            if (to == prev) continue;
            int t = f(f, to, curr);
            cnt += t;
            dp[curr] = dp[curr] * inv_factorial[t] % mod;
            dp[curr] = dp[curr] * dp[to] % mod;
        }
        dp[curr] = dp[curr] * factorial[cnt] % mod;
        return c[curr] = cnt + 1;
    };
    auto calc = [&](auto f, int curr, int prev) -> void {
        if (prev != -1) {
            int rem = n - c[curr];
            dp[curr] = dp[prev] * inv[rem] % mod * c[curr] % mod;
        }
        for (auto &to: e[curr]) {
            if (to == prev) continue;
            f(f, to, curr);
        }
    };
    dfsdp(dfsdp, 1, -1);
    calc(calc, 1, -1);
    for (int i = 0; i < n; i++) {
        cout << dp[i+1] << "\n";
    }
    return 0;
}

Measured memory_bytes: 20980
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String W = br.readLine();
        int count = 0;
        String str;
        while(!(str = br.readLine()).equals("END_OF_TEXT")){
            String str2[] = str.split(" ");
            for(String s:str2){
                if(s.equalsIgnoreCase(W)) count++;
            }
        }
        System.out.println(count);
    }
}

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

int main() {
	int h,w;
	cin>>h>>w;
	vector<vector<char>> a(h,vector<char>(w));
	for (int i=0;i<h;i++) {
		for (int j=0;j<w;j++) {
			cin>>a[i][j];
		}
	}
	vector<int>hc(h),wc(w);
	for (int i=0;i<h;i++) {
		for (int j=0;j<w;j++) {
			if(a[i][j] == '#')break;
			else if(a[i][j] == '.') {
				if (j == w-1) hc[i]++;
			}
		}
	}
	for (int i=0;i<w;i++) {
		for (int j=0;j<h;j++) {
			if(a[j][i] == '#')break;
			else if(a[j][i] == '.') {
				if (j == h-1) wc[i]++;
			}
		}
	}

	for (int i=0;i<h;i++) {
		if (!hc[i]) {
			for (int j=0;j<w;j++) {
				if (!wc[j]) cout << a[i][j];
				if (j == w-1) cout << endl;
			}
		}
	}
	

}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Map;
import java.util.HashMap;
import java.util.List;
import java.util.ArrayList;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static int n, m;
	static Map<String, Integer> costMap;
	static Map<String, List<String>> itemMap;
	
	public static void main(String args[]){
		while (true) {
			n = sc.nextInt();
			if (n == 0) break;
			costMap = new HashMap<String, Integer>();
			itemMap = new HashMap<String, List<String>>();
			
			for (int i = 0; i < n; i++) {
				String item = sc.next();
				int cost = sc.nextInt();
				costMap.put(item, cost);
			}
			m = sc.nextInt();
			for (int j = 0; j < m; j++) {
				String product = sc.next();
				int materialNum = sc.nextInt();
				List<String> al = new ArrayList<String>();
				for (int k = 0; k < materialNum; k++) {
					al.add(sc.next());
				}
				itemMap.put(product, al);
			}
			String target = sc.next();
			int answer = search(target);
			System.out.println(answer);	
		}
	}
	
	static int search(String target){
		if (itemMap.containsKey(target)) {
			int sum = 0;
			for(String item: itemMap.get(target)) {
				sum += search(item);
			}
			return Math.min(costMap.get(target), sum);
		} else {
			return costMap.get(target);
		}
	}
}


Measured memory_bytes: 24828
#include <iostream>
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
const int MOD = 1000000007;
const ll INF = 1LL << 60;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;
    int k;
    cin >> k;
    if (a < b && b < c)
    {
        cout << "Yes\n";
        return 0;
    }
    for (int i = 0; i < k; i++)
    {
        if (a >= b)
        {
            b *= 2;
        }
        else if (b >= c)
        {
            c *= 2;
        }
        else
        {
            cout << "Yes\n";
            return 0;
        }
    }
    if (a < b && b < c)
    {
        cout << "Yes\n";
        return 0;
    }
    cout << "No" << endl;
}

Measured memory_bytes: 3632
#include <cstdio>
#include <algorithm>
int n, x, a[101];
long long s;
int main()
{
    scanf("%d%d", &n, &x);
    for (register int i = 0; i < n; ++i)
    {
        scanf("%d", &a[i]);
        s += a[i];
    }
    if (x >= s) return printf("%d\n", n - (x > s)), 0;
    std::sort(a, a + n);
    int ans = 0;
    while (x >= 0) x -= a[ans++];
    return printf("%d\n", ans - 1), 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll=long long;

int main(){
  ll N,M;
  cin>>N>>M;
  vector<ll> A(N+1,0);
  for(int i=0;i<N;i++){
    cin>>A.at(i);
  }
  sort(A.begin(),A.end());
  reverse(A.begin(),A.end());
  int i=0;
  int j=0;
  vector<ll> B;
  A.at(i)/=2;
  B.push_back(A.at(i));
  i++;
  for(int k=1;k<M;k++){
    if(A.at(i)>B.at(j)&&i<N){
      B.insert(B.begin()+j,A.at(i));
      i++;
    }
    B.at(j)/=2;
    j++;
    j%=i;
  }
  while(i<N){
    B.push_back(A.at(i));
    i++;
  }
  ll ans=0;
  for(int k=0;k<N;k++){
    ans+=B.at(k);
  }
  cout<<ans<<endl;
}


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

struct Marked_Ancestor
{
  vector< int > graph[100000];
  set< int > querys[100000];
  vector< int > marked[100000];
  
  pair< long long, set< int >* > rec(int idx)
  {
    set< int >* curr = &querys[idx]; 
    long long ret = 0;
    for(int to : graph[idx]) {
      auto child = rec(to);
      if(curr -> size() < child.second -> size()) swap(curr, child.second);
      curr -> insert(child.second -> begin(), child.second -> end());
      ret += child.first;
    }
    int now = 0;
    while(now < marked[idx].size()) {
      while(!curr -> empty() && *--curr -> end() > marked[idx][now]) {
        curr -> erase(--curr -> end());
        ret += idx + 1;
      }
      ++now;
    }
    return(make_pair(ret, curr));
  }

  Marked_Ancestor(int N, int Q, int *a, char *c, int* x)
  {
    for(int i = 1; i < N; i++) {
      graph[--a[i]].push_back(i);
    }
    marked[0].push_back(-1);
    for(int i = 0; i < Q; i++) {
      if(c[i] == 'Q') querys[--x[i]].insert(i);
      else marked[--x[i]].push_back(i);
    }
    printf("%lld\n", rec(0).first);
  }
};

int main()
{
  int N, Q, a[100000], x[100000];
  char c[100000];
  while(scanf("%d %d", &N, &Q), N) {
    for(int i = 1; i < N; i++) {
      int x;
      scanf("%d", a + i);
    }
    for(int i = 0; i < Q; i++) {
      scanf(" %c %d", c + i, x + i);
    }
    Marked_Ancestor(N, Q, a, c, x);
  }
}

Measured memory_bytes: 26396
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  ll N;
  ll D;
  cin >> N >> D;
  ll X[N];
  ll Y[N];
  int Sum=0;
  ll k;
  int i=0;
  while(cin >> X[i] >> Y[i]){
    k=(X[i])*(X[i])+(Y[i])*(Y[i]);
    if(k<=D*D){Sum++;}
    i++;
  }
  cout << Sum << endl;
  return 0;
}


Measured memory_bytes: 6732
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
  	int n,p; cin>>n>>p;
  	vector<int> m(n); 
  	rep(i,n)cin>>m[i];
  	p-=accumulate(m.begin(), m.end(),0);
  	cout<<n+p/(*min_element(m.begin(), m.end()))<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
signed main(){
  int n;
  while(cin>>n,n){
    int k;
    cin>>k;
    string s[n];
    for(int i=0;i<n;i++) cin>>s[i];
    set<string> ss;
    function<void(int,int,string)> dfs=[&](int c,int d,string t) {
      if(d==k){
	ss.insert(t);
	return;
      }
      for(int i=0;i<n;i++){
	if((c>>i)&1) continue;
	dfs(c+(1<<i),d+1,t+s[i]);
      }
    };
    dfs(0,0,"");
    cout<<ss.size()<<endl;
  }
  return 0;
}

Measured memory_bytes: 3400
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <tuple>
#include <math.h>
#include <set>
#include <stack>
#include <bitset>
#include <map>
#include <queue>
#include <random>
#include <unordered_set>
#include <unordered_map>
#define DEBUG
#define fi first
#define se second
#define pqueue priority_queue
#define pb(x) push_back(x)
#define endl '\n'
#define all(x) x.begin(), x.end()
#define int long long
#define mk(a, b) make_pair(a, b)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ull> vull;
typedef vector<ll> vll;
// typedef tuple<int, int, int> tiii;
typedef pair<int, int> pii;
typedef vector<pair<int, int> > vpii;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector< vector<int> > vvi;
typedef vector<char> vc;

const int INF = 1e9;
const ll INFLL = 1e16;
const int MOD = 1000000007;
const int MAXN = 3e5;
//const ld eps = 1e-6;
const ld eps2 = 1e-9;
const int MOD2 = 998244353;
const int dosz = 5e5;
const int SZ = (1<<18);
const ld PI = atan2l(0, -1);


void fast_io(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifdef DEBUG
        // freopen("a.in", "r",stdin);
#else
       // freopen("substrcmp.in", "r", stdin);
       // freopen("substrcmp.out", "w", stdout);
#endif
}

void solve(){
    string s, t;
    cin >> s >> t;
    int a, b;
    cin >> a >> b;
    string kek;
    cin >> kek;
    if(kek==s){
        cout << a-1 << " " << b << endl;
    } else if(kek==t){
        cout << a << " " << b-1 << endl;
    } else{
        cout << a << " " << b << endl;
    }
}

signed main() {
    fast_io();
    int q = 1;
    // cout << fixed << setprecision(6);
    // cin >> q;
    // cout << 1 << endl;
    while(q--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
double dp[3000][3000],s[3000];
int vis[3000][3000],n;
double fun(int h=0,int t=0)
{
    if(t>n/2)return 0;
    if(t+h==n)return 1;
    if(vis[h][t])return dp[h][t];
    vis[h][t]=1;
    return dp[h][t]= (fun(h+1,t)*s[h+t]+fun(h,t+1)*(1.0-s[h+t]));


}

int main()
{
    cin>>n;
    for(int i=0;i<n;i++)cin>>s[i];

     cout << setprecision(9) << fixed << fun();

}


Measured memory_bytes: 104704
'use strict';
(function(stdin) {
  var inputs = stdin.toString().trim().split('\n');
  var params = inputs[0].split(' ').map(Number);

  (function(a, b) {
    // ????????????????????????
    console.log(a * b, (a + b)* 2);

  })(params[0], params[1]);

}(require('fs').readFileSync('/dev/stdin', 'utf8')));

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

#define int        long long
// #define mp      make_pair
#define eb         emplace_back
#define pb         push_back
#define ss         second
#define ff         first
#define IOS        ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod        998244353
#define MOD        (1000*1000*1000+7)
#define MN         LLONG_MIN
#define MX         LLONG_MAX
#define v1d        vector<int>
#define v2d        vector<vector<int>>
#define vip        vector<pair<int,int> >
#define v1s        vector<string>
#define pa         pair<int,int>
#define mxpq(T)    priority_queue <T>
#define mnpq(T)    priority_queue<T,vector<T>,greater<T>>
#define print(v)   for(auto i:v)cout<<i<<" ";cout<<"\n";
#define p2d(v)     for(auto a:v){for(auto b:a)cout<<b<<" ";cout<<endl;}
#define p1d(v)     for(auto a:v)cout<<a<<" ";cout<<endl;
#define ppd(v)     for(auto a:v)cout<<a.ff<<" "<<a.ss<<endl;
#define endl       "\n"
#define input(b,n) for(int i=0;i<n;i++)cin>>b[i];
#define Sort(v)    sort(v.begin(),v.end())
#define RSort(v)   sort(v.rbegin(),v.rend())
#define all(v)     v.begin(),v.end()
int gcd(int a,int b){return b?gcd(b,a%b):a;}
//string s = bitset<64>(a).to_string();

void vrikodara(int n=12){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout<<setprecision(n)<<fixed;
    // #ifndef ONLINE_JUDGE
    //      freopen("input.txt",  "r",  stdin);
    //      freopen("output.txt", "w", stdout);
    // #endif
}

//____________________________________________________________________________________

v1d dp(100005,0);

bool fun(v1d &v,int n,int k){
    if(!dp[k])return dp[k];
    for(auto i:v){
        if(i <= k && fun(v,n,k-i))return dp[k] = true;
    }
    dp[k] = -1;
    return false;
}

void solve(){
    int n,k;cin>>n>>k;
    v1d v(n);
    for(int i=0;i<n;i++)cin>>v[i];
    Sort(v);
    for(int i=1;i<=k;i++){
        for(auto j:v){
            if(i >= j){
                if(!dp[i-j]){
                    dp[i] = 1;
                    break;
                }
            }
            else break;
        }
    }
    if(dp[k])cout<<"First";
    else cout<<"Second";
}

int32_t main(){
    vrikodara();
    int t = 1;
    // cin>>t;
    while(t--){
        solve();
    }
    


    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    vector<bool> isp(100000+1), iss(100000+1);
    REP(i,2,100000+1) {
        bool b = true;
        for (int j = 2; j * j <= i; ++j) if (i % j == 0) {
            b = false;
            break;
        }
        if (b) isp[i] = true;
        iss[i] = isp[i] && isp[(i+1)/2];
    }
    VI ru(100000+1);
    for (int i = 3; i < 100000+1; i += 2) ru[i] = ru[i-2] + 1 * iss[i];

    int q;
    cin >> q;
    int l,r;
    REP(i,0,q) {
        cin >> l >> r;
        cout << ru[r] - (l > 1 ? ru[l-2] : 0) << endl;
    }
}

int main() {
    solve();
    
    return 0;
}

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

int main() {
  string w;
  cin >> w;
  map<char, int> counter;
  for(int i=0;i<w.size();i++) {
    counter[w[i]]++;
  }

  bool beautiful = true;

  for(auto it = counter.begin();it != counter.end();it++) {
    if(it -> second % 2 == 1) {
      beautiful = false;
      break;
    }
  }

  if(beautiful) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//2019=3*673
int main() {
  int l,r;
  cin >> l >> r;
  int ans = 2019;
  
  //l~rを0~2018の範囲に変換
  if (l/2019 == r/2019) {
    int newl,newr;
    newl = l % 2019;
    newr = r % 2019;
    for (int i = newl;i < newr; i++){
      for (int j = i+1; j <= newr; j++){
        ans = min((i * j) % 2019,ans);
      }
    }
    printf("%d\n",ans);
  }
  else if (l/2019 + 1 == r/2019 && l%2019 > r%2019) {
    int newl = l% 2019;
    int newr = r % 2019;
    for (int i = newl - 2019;i < newr; i++){
      for (int j = i+1; j <= newr; j++){
        ans = min((i * j) % 2019,ans);
      }
    }
    printf("%d\n",ans);
  }
  else {
    for (int i = 0;i < 2019; i++){
      for (int j = i+1; j <= 2019; j++){
        ans = min((i * j) % 2019,ans);
      }
    }
    printf("%d\n",ans);
  }
}



Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int a,b,c,x,k=0;
  scanf("%d %d %d",&a,&b,&c);
  if(a>b)
    return 0;

  for(x=a;x<=b;x++){
    if(c % x == 0)
      k++;
  }
  printf("%d\n",k);
  return 0;
}

Measured memory_bytes: 596
k = int(input())
i = 0
t = 1
k = k*9

if k%7 == 0 :
    k = k/7
if k%2 == 0 or k%5 == 0:
    i = -1
else:
    while(True):
        t *= 10
        i += 1
        t = t%k
        if t==1:
            break
    
print(i)

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

//const long double PIL = 3.141592653589793238462643383279502884L;
//const double PI = 3.14159265358979323846;

#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define what_is(x) cerr << #x << " is " << x << endl;
#define debug(v) for (auto el : v) { cerr << el << ' '; } cerr << endl;

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vll = vector<long long>;
using vii = vector<pair<int,int>>;

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);
	string s;
	cin >> s;
	int n = s.length();
	int answer = 0;
	for (int i = 0, j = n-1; i < j; i++, j--)
		if (s[i] != s[j]) ++ answer;
	cout << answer << endl;
}


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

using namespace std;

using ll = long long;
using vi = vector<int>;
using db = double;
#define pb push_back

const int mxn = 200006;

int n, m;
int a[mxn];

int s;
int c[mxn];
unordered_map<int,int> h;

void add(int x) {
	++c[x];
	x -= c[x] - 1;
	++h[x];
	if (1 <= x && x <= n && h[x] == 1)
		++s;
}

void rem(int x) {
	--c[x];
	x -= c[x];
	--h[x];
	if (1 <= x && x <= n && h[x] == 0)
		--s;
}

int main() {
	cin >> n >> m;
	for (int i = 1; i <= n; ++i) {
		scanf("%d", &a[i]);
		add(a[i]);
	}
	
	while (m--) {
		int x, y;
		scanf("%d%d", &x, &y);
		rem(a[x]);
		add(a[x] = y);
		printf("%d\n", n - s);
	}
	
	return 0;
}


Measured memory_bytes: 18932
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int main(){
    string str;
    cin >> str;
    vector<string> cnt(1, string(1, str[0]));
    for(int i = 1; i < str.size(); i++){
        for(int j = 1; i + j <= str.size(); j++){
            if(cnt.back() != str.substr(i, j)){
                cnt.push_back(str.substr(i, j));
                i += j - 1;
                break;
            }
        }
    }
    cout << cnt.size() << "\n";
}

Measured memory_bytes: 10996
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long result = 0L;
        for(int i=1; i<1+N; i++) {
            if(i%3==0 || i%5==0) continue;
            result+=i;
        }
        System.out.println(String.format("%d", result));
    }
}


Measured memory_bytes: 35840
s = input()
s = [int(i) for i in s]

if 1 <= s[0]*10+s[1] <= 12:
    if 1 <= s[2]*10+s[3] <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
elif 1 <= s[2]*10+s[3] <= 12:
    if 1 <= s[0]*10+s[1] <= 12:
        print('AMBIGUOUS')
    else:
        print('YYMM')
else:
    print('NA')


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)


int main() {
	int n;
	string s;
	cin >> n >> s;
	int alpha = 'z' - 'a' + 1;
	for (int j = 0; j < s.length(); j++) {
		s[j] = s[j] + n;
		if (s[j] > 'Z') s[j] -= alpha;
	}
	cout << s << endl;
}

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

namespace ConsoleApplication47
{
    class Program
    {
        static void Main()
        {
            while (true)
            {
                string a = Console.ReadLine();
                if (a == null) break;
                double[] b = a.Split(',').Select(double.Parse).ToArray();
                if (b[1] / b[2] / b[2] >= 25) Console.WriteLine(b[0]);
            }
        }
    }
}

Measured memory_bytes: 9544
n, m = map(int,input().split())
h = list(map(int,input().split()))
l = [list(map(int, input().split())) for _ in range(m)]

x = [[] for _ in range(n)]

for i in range(m):
    if l[i][1] not in x[l[i][0]-1]:
        x[l[i][0]-1].append(l[i][1])

for j in range(m):
    if l[j][0] not in x[l[j][1]-1]:
        x[l[j][1]-1].append(l[j][0])

y = 0
for a in range(n):
    for c in range(len(x[a])):
        if h[a] <= h[x[a][c]-1]:
            break
    else:
        y += 1

print(y)


Measured memory_bytes: 112540
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,a,b) for(int i =(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPm(i,n) for(int i=(n)-1;i>=0;i--)
#define REP1(i,n) for(int i=1;i<=(n);i++)
typedef long long ll;
#define MAX_N 100000
struct edge{
    int v;
    int d;
};
vector<edge> G[MAX_N];
bool flag[MAX_N];
ll dis[MAX_N];
void dfs(int n){
    flag[n] = true;
    REP(i,G[n].size()){
        int v = G[n][i].v;
        int d = G[n][i].d;
        if(! flag[v]){
            dis[v] = dis[n] + d;
            dfs(v);
        }
    }
}

int main(){
    int N;
    cin >> N;
    REP(i,N-1){
        int a,b,c;
        cin >> a >> b >> c;
        G[a-1].push_back((edge){b-1,c});
        G[b-1].push_back((edge){a-1,c});
    }
    int Q,K;
    cin >> Q >> K;
    dis[K-1] = 0;
    dfs(K-1);
    REP(i,Q){
        int x,y;
        cin >> x >> y;
        cout << dis[x-1]+dis[y-1] << endl;
    }
    return 0;
}


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

using namespace std;

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

typedef long long ll;

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

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

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<char> c;
    bool ans = true;
    rep(i, 6) {
      char s;  cin >> s;
      c.push_back(s);
    }
    rep(i, 3) {
      if (c[i] != c[5 - i]) {
        ans = false;
        break;
      }
    }
    if (ans) {
      cout << "YES" << '\n';
    } else {
      cout << "NO" << '\n';
    }

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>

using namespace std;

#define mod 1000000007


int main()
{
	int n;
	cin >> n;
	string s[100001];
	for(int i = 0; i < n; i++){
		cin >> s[i];
	}
	string t;
	cin >> t;
	vector<string> mustbefore, mustbehind;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < s[i].length(); j++){
			if(j >= t.length()){
				mustbehind.push_back(s[i]);
				break;
			}
			if(s[i][j] == '?'){
				if(t[j] != 'z' && t[j] != 'a') break;
			} else if(s[i][j] < t[j]){
				mustbefore.push_back(s[i]);
				break;
			} else if(s[i][j] > t[j]){
				mustbehind.push_back(s[i]);
				break;
			} else if(j == s[i].length() - 1 && j < t.length() - 1){
				mustbefore.push_back(s[i]);
				break;
			}
		}
	}
	int tmp = n + 1 - mustbefore.size() - mustbehind.size();
	for(int i = 0; i < tmp; i++){
		cout << mustbefore.size() + i + 1;
		if(i == tmp - 1) cout << endl;
		else cout << " ";
	}
	return 0;
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
int main() {
    int N, M; cin >> N >> M;
    vector<vector<int>> G(N);
    for (int i = 0; i < M; i++) {
        int a, b; cin >> a >> b; a--, b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    vector<int> from(N, -1);
    queue<pair<int, int>> Q;
    Q.emplace(0, 0);
    while (!Q.empty()) {
        auto [node, prev] = Q.front(); Q.pop();
        if (from[node] != -1) continue;
        from[node] = prev;
        for (int n : G[node]) {
            Q.emplace(n, node);
        }
    }
    cout << "Yes\n";
    for (int i = 1; i < N; i++) {
        cout << from[i] + 1 << '\n';
    }
    return 0;
}


Measured memory_bytes: 12288
package main

import (
    "bufio"
    "fmt"
    "sort"
    "os"
    "strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
    sc.Scan()
    i, e := strconv.Atoi(sc.Text())
    if e != nil {
        panic(e)
    }
    return i
}

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readLine() string {
    buf := make([]byte, 0, 1000000)
    for {
        l, p, e := rdr.ReadLine()
        if e != nil {
            panic(e)
        }
        buf = append(buf, l...)
        if !p {
            break
        }
    }
    return string(buf)
}

func nextLine() string {
    sc.Scan()
    return sc.Text()
}

func main(){
	var N,K int
	var res int64
	var H []int
	fmt.Scan(&N)
	fmt.Scan(&K)
	for i:=0;i<N;i++ {
		tmp:=0
		fmt.Scan(&tmp)
		H=append(H,tmp)
	}
	res=0
	sort.Ints(H)
	for i:=0;i<len(H)-K;i++{
		res+=int64(H[i])
	}
	fmt.Println(res)
}


Measured memory_bytes: 8320
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define INF 10e16
#define MOD 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int n;cin>>n;
    vector<int>a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    int i=1;int ans=0;
    for(int j=0;j<n;j++){
        if(a[j]!=i){
            ans++;
        }
        else
            i++;
    }
    if(ans==n)
        ans=-1;
    cout<<ans<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------



Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <set>

using namespace std;

int main() {
	int h, w, k;
	cin >> h >> w >> k;

	vector<string> board(h);
	for (int i = 0; i < h; i++) {
		cin >> board[i];
	}

	vector<vector<int>> ans(h, vector<int>(w, -1));
	int cake = 0;
	for (int i = 0; i < h; i++) {
		vector<int> tmp;
		for (int j = 0; j < w; j++) {
			if (board[i][j] == '#') {
				tmp.emplace_back(j);
			}
		}

		if (tmp.empty()) {
			continue;
		}

		cake++;
		for (int j = 0; j < w; j++) {
			ans[i][j] = cake;
			if (board[i][j] == '#') {
				if (j != tmp.back()) {
					cake++;
				}
			}
		}
	}

	vector<int> head = vector<int>(w, -1);
	vector<int> prev = vector<int>(w, -1);
	for (int i = 0; i < board.size(); i++) {
		if (ans[i][0] == -1) {
			if (prev[0] != -1) {
				ans[i] = prev;
			}
		} else {
			prev = ans[i];
			if (head[0] == -1) {
				head = ans[i];
			}
		}
	}

	for (int i = 0; i < board.size(); i++) {
		if (ans[i][0] == -1) {
			ans[i] = head;
		} else {
			break;
		}
	}

	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			printf("%3d ", ans[i][j]);
		}
		printf("\n");
	}



	return 0;
}


Measured memory_bytes: 1280
n, m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x, y = 0, 0
ans = 1
if len(set(a)) < n or len(set(b)) < m:
    exit(print(0))
for i in range(n * m, 0, -1):
    if i in a and i in b:
        x += 1
        y += 1
    elif i in a:
        ans *= x
        y += 1
    elif i in b:
        ans *= y
        x += 1
    else:
        ans *= x * y - n * m + i
    ans %= 10 ** 9 + 7
print(ans)

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

using namespace std;

typedef long long ll;

int main()
{
	std::ios::sync_with_stdio(false);
    cin.tie(0);
    int a,b;
    cin >> a >> b;
    if(a!=b && a==1) cout << "Alice" << "\n";
    else if(a!=b && b==1) cout << "Bob" << "\n";
    else if(a==b) cout << "Draw" << "\n";
    else if(a>b) cout << "Alice" << "\n";
    else if(a<b) cout << "Bob" << "\n";
    
	return 0;
}


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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,d;cin>>n>>d;
    ll ans=0;
    while(n--)
    {
      ll x,y; cin>>x>>y;
      if(sqrt(x*x +y*y)<=d) ans++;
    }
    cout<<ans;
}

Measured memory_bytes: 3604
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif
#define FILE_IO freopen("input.txt","r",stdin);
#define f first
#define int long long
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
const int MOD=1e9+7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename T>void print(T t){for(auto &it:t)cout<<it<<" ";}
inline int powerexp(int a,int b,int m){int res=1;while(b){if(b&1)res=res*a%m;a=a*a%m,b>>=1;}return res%m;}
inline int modinv(int a){return powerexp(a,MOD-2,MOD);}
inline int lcm(int a,int b){int g=__gcd(a,b);return a/g*b;}
void solve(){
   int w,h,x,y;
   cin>>w>>h>>x>>y;
   double ret=w*h;
   ret/=2.0;
   cout<<ret<<" ";
   if(x*2==w and y*2==h)cout<<1;
   else cout<<0;
}
//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
    IOS;
    solve();
    #ifdef LOCAL_DEFINE
    cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
    #endif
}


Measured memory_bytes: 256
n=int(input())
l=list(map(int,input().split()))
l.insert(0,0)
l.append(0)
sum_total=0
for i in range(n+1):
    sum_total+=abs(l[i+1]-l[i])
for i in range(1,n+1):
    print(sum_total+abs(l[i+1]-l[i-1])-abs(l[i]-l[i-1])-abs(l[i+1]-l[i]))

Measured memory_bytes: 14048
import java.util.Scanner;

//日立製作所 社会システム事業部 プログラミングコンテスト2020
//A - Hitachi String
public class Main {

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

		S = S.replaceAll("hi", "");
		if (S.length() == 0) {
			System.out.print("Yes");
		} else {
			System.out.print("No");
		}
	}

}


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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

const double EPS = 1e-9;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main(void){
    int N; cin >> N;
    VVI ans;

    if(N%2){
        REP(i,N-1)FOR(j,i+1,N){
            if(i+j == N-2) continue;
            VI v{i+1, j+1};
            ans.emplace_back(v);
        }
    }
    else{
        REP(i,N-1)FOR(j,i+1,N){
            if(i+j == N-1) continue;
            VI v{i+1, j+1};
            ans.emplace_back(v);
        }
    }

    cout << ans.size() << endl;
    REP(i,ans.size()) cout << ans[i][0] << " " << ans[i][1] << endl;

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
//-------------
int main() {
    string s;
    cin >>s;
    int Ans=0;
    for(int i=0;i<3;i++){
        if(s.at(i)=='1') Ans++;
    }

    cout << Ans <<endl;
}

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

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

typedef long long ll;
typedef long long int64;

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

  vector<int>oks(n+1, true);
  for(int i=0; i<m; i++){
    int a;
    cin >> a;
    oks[a] = false;
  }

  
  vector<ll>dp(n+1);
  dp[0] = 1;
  for(int now=0; now<n; ++now){
    for(int next=now+1; next<=min(n,now+2); ++next){
      if(oks[next]){
        dp[next] += dp[now];
        dp[next] %= 1000000007;
      }
    }
  }

  cout << dp[n] << endl;

  return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
using namespace std; using ll = long long; using ld = long double;  using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
const ld PI = 3.1415926535897932;
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define rep1(n) for(ll i=0;i<n;++i)
#define rep2(i,n) for(ll i=0;i<n;++i)
#define rep3(i,a,b) for(ll i=a;i<b;++i)
#define rep4(i,a,b,c) for(ll i=a;i<b;i+=c)
#define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__)
#define mp make_pair
#define mt make_tuple
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define LD(...) ld __VA_ARGS__;in(__VA_ARGS__)
void in() {}
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//bitSearch, bitList, nod, gcdlcm, isPrime, primeFactorize, Npow, divisor, modinv, dfs, bfs, eratos//
//dijkstra, WarshallFloyd, BellmanFord, UnionFind, COM, digitDP ,RMQ//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R;
ll MOD = 1000000007; ll INF = 1LL << 62; ll ans = 0; ll z = 0, o = 1;
vl flag, color, D; vll path;
int main() {
	cin >> N >> M;
	vl X(M);
	for (i = 0; i < M; i++) {
		cin >> X[i];
	}
	sort(X.begin(), X.end());
	vl D(M - 1);
	for (i = 0; i < M-1; i++) {
		D[i] = X[i + 1] - X[i];
	}
	sort(D.begin(), D.end());
	for (i = 0; i < M-N; i++) {
		ans += D[i];
	}
	cout << ans;
}

Measured memory_bytes: 1792
#include<stdio.h>
int count(char d[],int p[]);
int sort(int p[]);
int main()
{
    char a[200001];
    int x[26]={0},y[26]={0},i,m=1;

    scanf("%s",a);
    count(a,x);
    scanf("%s",a);
    count(a,y);

    for(i=0;i<26;i++)
    {
        if(x[i]!=y[i])
        {
            m=0;
            break;
        }
    }
    if(m)
        printf("Yes");
    else
        printf("No");

}
int count(char d[],int p[])
{
    int i;
    for(i=0;d[i];i++)
        p[d[i]-97]++;
    sort(p);

}

int sort(int p[])
{
    int i,j;

    for(i=0;i<26;i++)
        for(j=25;j>i;j--)
    {
        if(p[i]<p[j]){
        size_t t=p[i];
        p[i]=p[j];
        p[j]=t;
        }
    }
}


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

using namespace std;

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int N;
	cin >> N;
	int A;
	int X = 1;
	int Y = 1;
	for(int i = 0; i < N; i++) {
		X *= 3;
		cin >> A;
		if(A % 2 == 0) {
			Y *= 2;
		} else {
			Y *= 1;
		}
	}
	cout << X - Y << endl;
	return 0;
}

Measured memory_bytes: 256
#create date: 2020-06-29 22:59

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    n = ni()
    a = na()
    a_xor = 0
    for ai in a:
        a_xor ^= ai
    for ai in a:
        print(a_xor^ai, end=" ")

if __name__ == "__main__":
    main()

Measured memory_bytes: 31300