akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define MAX 5100
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;

vector<ll> fac(MAX), finv(MAX), inv(MAX);

void comInit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(ll 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;
    }
}


ll com(ll n, ll k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

int main(){
    ll x,a,b; cin >> x >> a >> b;
    if(abs(a-x)<abs(b-x)) puts("A");
    else puts("B");
}

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

#define int long long

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, ans = 1e9;
    cin >> n;
    pair <int, int> X[n];
    for(int i = 0; i < n; i++){
        cin >> X[i].first;
    }
    for(int i = 0; i < n; i++){
        cin >> X[i].second;
    }
    for(int mask = 0; mask < (1 << n); mask ++){
        pair <int, int> S[n];
        for(int i = 0; i < n; i++){
            if(mask & (1LL<<i))
                S[i] = {X[i].second, i};
            else
                S[i] = {X[i].first, i};
        }
        int cur_ans = 0;
        sort(S, S + n);
        bool we = 1;

        for(int i = 0; i < n; i++){
            int mini = (*min_element(S + i, S + n)).first;
            int pos = 1e9, swap_ind = 1e9;
            for(int j = i; j < n; j++){
                if(S[j].first == mini){
                    if((abs(S[j].second - i) % 2) == ((mask >> S[j].second) & 1)){
                        if(S[j].second < pos){
                            pos = S[j].second;
                            swap_ind = j;
                        }
                    }
                }
            }
            if(pos != 1e9){
                swap(S[swap_ind], S[i]);
            }
            else{
                we = 0;
                break;
            }
        }

        for(int i = 0; i < n; i++){
            for(int j = i + 1; j < n; j++){
                if(S[i].second > S[j].second){
                    cur_ans++;
                }
            }
        }

        for(int i = 0; i < n; i++){
            if((abs(S[i].second - i) % 2) != ((mask >> S[i].second) & 1))
                we = 0;
        }
        if(we && ans > cur_ans){
            ans = cur_ans;
        }
    }
    if(ans == 1e9)
        ans = -1;
    cout << ans << '\n';
}

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

int main()
{
    string s;
    cin >> s;
    int n = s.size();
    int sum = 0;
    int c = 0;
    rep(i, n)
    {
        if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T')
        {
            c++;
            if (c > sum)
            {
                sum = c;
            }
        }
        else
        {
            c = 0;
        }
    }
    cout << sum << endl;
}

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

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

    if ((a == 2) && (b == 3) || (b == 2) && (a == 3))
    {
        cout << 1;
    }
    else if ((a == 1) && (b == 3) || (b == 1) && (a == 3))
    {
        cout << 2;
    }
    else if ((a == 1) && (b == 2) || (b == 1) && (a == 2))
    {
        cout << 3;
    }

    return 0;
}

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

int main() {
  string s, o;
  cin >> s;
  for(auto c : s) {
    if(c == '0')
      o.push_back('0');
    if(c == '1')
      o.push_back('1');
    if(c == 'B' && o.length())
      o.erase(o.length() - 1);
  }
  cout << o << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <random>
#include <chrono>
 
using namespace std;
using namespace __gnu_pbds;
 
#define endl '\n'
 
typedef long long ll;
typedef pair<ll, ll> pii;
typedef tree<int, null_type,less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
template<typename T>
static T randint(T lo, T hi){
	return uniform_int_distribution<T>(lo, hi)(rng);
}



int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
 
	// freopen("settling.in", "r", stdin);
	// freopen("settling.out", "w", stdout);

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

	vector<int> r, w;

	for(int i = 0; i < n; i++){
		if(s[i] == 'W')
			w.push_back(i);
		else
			r.push_back(i);
	}

	int p1 = 0, p2 = (int)r.size() - 1, ans = 0;
	while(p1 < w.size() && p2 >= 0 && w[p1] < r[p2]){
		ans++;
		p1++;
		p2--;
	}

	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 4852
//自称高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
    int ans = 0;
    int tmp;
    int x, a, b;
    cin >> x >> a >> b;

    cout << (x-a)%b << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"

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

int dfs(vector<vector<vector<int>>>&field, int nowx, int nowy,bitset<9>&used,const vector<vector<int>>&pieces) {
	if (nowy == 3)return 1;
	else {
		int ans = 0;
		for (int i = 0; i < 9; ++i) {
			if (!used[i]) {
				used[i] = true;
				vector<int>v(pieces[i]);
				for (int way = 0; way < 4; ++way) {
					rotate(v.begin(), v.begin() + 1, v.end());
					bool ok = true;
					if (nowx) {
						if (field[nowy][nowx - 1][2] + v[0]) {
							ok = false;
						}
					}
					if (nowy) {
						if (field[nowy - 1][nowx][1] + v[3]) {
							ok = false;
						}
					}
					if (ok) {
						field[nowy][nowx] = v;
						ans += dfs(field, (nowx + 1) % 3, nowx == 2 ? nowy + 1 : nowy, used, pieces);
						field[nowy][nowx].clear();
					}
				}
				used[i] = false;
				
			}
		}
		return ans;
	}
}
int main() {
	int N; cin >> N;
	map<int, int>mp;
	mp['W'] = 1;
	mp['R'] = 2;
	mp['G'] = 3;
	mp['B'] = 4;
	mp['w'] = -1;
	mp['r'] = -2;
	mp['g'] = -3;
	mp['b'] = -4;
	while (N--) {
		vector<vector<int>>pieces(9);
		for (int i = 0; i < 9; ++i) {

			string st; cin >> st;
			for (int j = 0; j < 4; ++j) {
				pieces[i].push_back(mp[st[j]]);
			}
		}
		bitset<9>used;
		vector<vector<vector<int>>>field(3, vector<vector<int>>(3));
		int ans = dfs(field, 0, 0, used, pieces);
		cout << ans << endl;
	}
	return 0;
}

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

const ll inf = 1e9+5;

int main(){
	int n,k;
    cin>>n>>k;
    ll a[n];
    for(int i = 0;i < n;i++) cin>>a[i];
    ll dp[n];
    memset(dp, inf, sizeof dp);
    dp[0] = 0;
    for(int i = 0;i < n;i++) {
        for(int j = i+1;j <= i+k;j++) {
            if(j < n) {
                dp[j] = min(dp[j], dp[i] + abs(a[i] - a[j]));
            }
        }
    }
    cout<<dp[n-1]<<endl;
}


Measured memory_bytes: 1920
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <utility>
using pii = std::pair<int, int>;
const int ha = 1000000007;
using ll = long long;
ll pow_mod(ll a, ll b) {
  ll ans = 1, res = a;
  while(b) {
    if(1LL & b) ans = ans * res % (ll)ha;
    res = res * res % (ll)ha; b >>= 1;
  }
  return ans;
}
ll inv(ll x) {
  return pow_mod(x, ha - 2);
}

ll fac[10005], ifac[10005];
void process() {
  int n = 10000;
  fac[0] = 1;
  for(int i = 1; i <= n; i ++) {
    fac[i] = (fac[i - 1] * (ll(i))) % (ll)ha;
  }
  ifac[n] = inv(fac[n]);
  for(int i = n - 1; i >= 0; i --) {
    ifac[i] = ifac[i + 1] * (ll(i + 1)) % (ll)ha;
  }
}
ll C(int x, int y) {
  ll ret = fac[x];
  ret = ret * ifac[x - y] % (ll)ha;
  ret = ret * ifac[y] % (ll)ha;
  return ret;
}

pii P[200005]; int d[4005][4005];
int n;
int dp() {
#ifdef LOCAL
  puts("11111");
  fflush(stdout);
#endif
  for(int i = 1; i <= n; i ++) {
    int x = P[i].first, y = P[i].second;
    d[2000 - x][2000 - y] ++;
  }
  for(int dis = 1; dis <= 8000; dis ++) {
    for(int i = std::max(0, dis - 4000); i <= std::min(4000, dis); i ++) {
      int j = dis - i;
      if(i > 0) d[i][j] = (d[i][j] + d[i - 1][j]) % ha;
      if(j > 0) d[i][j] = (d[i][j] + d[i][j - 1]) % ha;
    }
  }
#ifdef LOCAL
  puts("Gou!"); fflush(stdout);
#endif
  int ans = 0;
  for(int i = 1; i <= n; i ++) {
    int x = P[i].first, y = P[i].second;
    ans = (ans + d[x + 2000][y + 2000]) % ha;
    ans = (ans - C(2 * x + 2 * y, 2 * x) + ha) % ha;
  }
  static const ll inv_2 = 500000004;
  ans = (((ll(ans)) * inv_2) % (ll)ha);
  return ans;
}

int main() {
  scanf("%d", &n);
  for(int i = 1; i <= n; i ++) {
    scanf("%d%d", &P[i].first, &P[i].second);
  }
  process();
  printf("%d\n", dp());
  return 0;
}

Measured memory_bytes: 64512
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;

struct UnionFind {
    vector<int> par, rank;
    
    UnionFind(int n = 210000) { init(n); }
    void init(int n = 210000) {
        par.resize(n); rank.resize(n);
        for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0;
    }
    
    int root(int x) {
        if (par[x] == x) return x;
        else return par[x] = root(par[x]);
    }
    
    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;
        return true;
    }
};

typedef pair<int,int> pint;
typedef pair<double,pint> Edge;

int main() {
    int N, M; cin >> N >> M;
    vector<double> x(N), y(N); for (int i = 0; i < N; ++i) cin >> x[i] >> y[i];
    vector<Edge> edges;
    double all = 0;
    for (int i = 0; i < M; ++i) {
        int u, v; cin >> u >> v; --u, --v;
        double dis = sqrt((x[u]-x[v])*(x[u]-x[v]) + (y[u]-y[v])*(y[u]-y[v]));
        edges.push_back(Edge(dis, pint(u, v)));
        all += dis;
    }
    sort(edges.rbegin(), edges.rend());
    UnionFind uf(N);
    double hosyu = 0;
    for (auto e : edges) {
        int u = e.second.first, v = e.second.second;
        if (uf.issame(u, v)) continue;
        hosyu += e.first;
        uf.merge(u, v);
    }
    cout << fixed << setprecision(10) << all - hosyu << endl;
}


Measured memory_bytes: 3756
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<string>
#include<cstdlib>
using namespace std;
int a,b,c;
int main(){
	cin>>a>>b>>c;
	cout<<(a-c)/(b+c)<<endl;
 	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define  rep(i,n) for(int i = 0; i < n; i++)
int main(void){
  vector<vector <int>> data(3,vector<int>(3));
  for(int i = 0; i < 3; i++){
    for(int j = 0; j < 3; j++){
     cin >> data.at(i).at(j);
    }
  }
  vector<int> x(3);
  vector<int> y(3);
  rep(i,3){
    y.at(i) = data.at(0).at(i) - x.at(0);
  }
  rep(i,3){
    x.at(i) = data.at(i).at(0) - y.at(0);
  }
  bool ans = true;
  rep(i,3){
    rep(j,3){
      if(data.at(i).at(j) != x.at(i) + y.at(j)){
        ans = false;
      }
    }
  }

  if(ans){
    cout << "Yes" << endl;
  } else{
    cout << "No" << endl;
  }
  return 0;
}


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

int main()
{
    int K, S, ans = 0;
    cin >> K >> S;

    for (int i = 0; i < K + 1; i++)
    {
        for (int j = 0; j < K + 1; j++)
        {
            int z = S - i - j;

            if (0 <= z && z <= K)
            {
                ans++;
            }
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
// ITP1_8_D Ring
import java.io.*;

class Main {

   public static void main(String[] args) {
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

      try {
         String s = br.readLine();
         String p = br.readLine();
         s = s + s;
         if (s.equals("") || p.equals(""))
            System.exit(0);
         if (s.indexOf(p) != -1)
            System.out.println("Yes");
         else
            System.out.println("No");
      }

      catch (Exception e) {
         System.err.println(e);
      }
   }
}

Measured memory_bytes: 17048
#include <bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i, n) for (i = 0; i < n; i++)
#define Fo(i, k, n) for (i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define ll long long
#define si(x) scanf("%d", &x)
#define sl(x) scanf("%lld", &x)
#define ss(s) scanf("%s", s)
#define pi(x) printf("%d\n", x)
#define pl(x) printf("%lld\n", x)
#define ps(s) printf("%s\n", s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for (auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<char> vc;
typedef vector<vc> vcc;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim)
{
    uniform_int_distribution<int> uid(0, lim - 1);
    return uid(rang);
}

int mpow(int base, int exp);
void ipgraph(int n, int m);
void dfs(int u, int par);

const int mod = 1'000'000'007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];

void solve()
{
    ll i, j, n, m;
    cin >> n;
    ll ans = n * (n + 1);
    cout << ans / 2 << endl;
}

int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

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

    return 0;
}

int mpow(int base, int exp)
{
    base %= mod;
    int result = 1;
    while (exp > 0)
    {
        if (exp & 1)
            result = ((ll)result * base) % mod;
        base = ((ll)base * base) % mod;
        exp >>= 1;
    }
    return result;
}

void ipgraph(int n, int m)
{
    int i, u, v;
    while (m--)
    {
        cin >> u >> v;
        u--, v--;
        g[u].pb(v);
        g[v].pb(u);
    }
}

void dfs(int u, int par)
{
    for (int v : g[u])
    {
        if (v == par)
            continue;
        dfs(v, u);
    }
}


Measured memory_bytes: 10644
#include<bits/stdc++.h>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::multiprecision;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define pt pop_front
#define pk pop_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
template<class T> T count_bit(T p){
  if(typeid(p)==typeid(int))return __builtin_popcount(p);
  else if(typeid(p)==typeid(long))return __builtin_popcountl(p);
  else return __builtin_popcountll(p);
}
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;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}

inline void solve(void){
  long N;
  in(N);
  vector<long>A(N+1);
  ins(A);
  vector<long>B(N);
  ins(B);
  long cnt=0;
  rep(i,N){
    if(A[i]<=B[i]){
      cnt+=A[i];
      B[i]-=A[i];
    }else{
      cnt+=B[i];
      B[i]=0;
    }
    if(A[i+1]<=B[i]){
      cnt+=A[i+1];
      B[i]-=A[i+1];
      A[i+1]=0;
    }else{
      cnt+=B[i];
      A[i+1]-=B[i];
      B[i]=0;
    }
  }
  out(cnt);
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 1792
#define LOCAL
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rrep(i, n) for(int i=(n-1); i>=0; --i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define memr(dp, val) memset(dp, val, sizeof(dp))
using namespace std;
typedef long long ll;
static const int INTINF = (INT_MAX >> 1); // 10^9 + 10^7
static const ll LLINF = (LLONG_MAX >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
string to_string(string s) { return '"' + s + '"'; }
string to_string(bool b) { return b ? "true" : "false"; }
template <size_t N> string to_string(bitset<N> bs) {
  string res;
  for (size_t i = 0; i < N; ++i) res += '0' + bs[i];
  return res;
}
string to_string(vector<bool> v) {
  string res = "{";
  for (bool e : v) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p);
template <class C> string to_string(C c) {
  string res = "{";
  for (auto e : c) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug() { cerr << '\n'; }
template <class Head, class... Tail> void debug(Head head, Tail... tail) {
  cerr << '\t' << to_string(head), debug(tail...);
}
#ifdef LOCAL
#define DEBUG(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int main(int argc, const char * argv[]) {
  std::cout << std::fixed << std::setprecision(15);

  ll A, B, C, X, Y;
  cin >>A >> B >> C >>X >> Y;

  ll ans = LLINF;
  rep(i, max(X, Y)+1){
    ll nX = max(0LL, X-i);
    ll nY = max(0LL, Y-i);
    
    ans = min(ans, C * i * 2 + A * nX + B * nY);
  }
  cout << ans << endl;
}  


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

//--------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3

//--------------------------------------------
const double EPS = 1e-14;
const double PI  = acos(-1.0);

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

int n,m;
vector <string> a, b;
string s;

int main() {
  cin >> n >> m;
  REP (i, n) {
    cin >> s;
    a.push_back(s);
  }
  REP (i, m) {
    cin >> s;
    b.push_back(s);
  }

  REP (i, n) {
    int k = 0;
    REP (j, n) {
      if (a.at(j).substr(i, m) == b.at(k)) k++;
      if (k == m) {
        printf("Yes\n");
        exit(0);
      }
    }
  }
  printf("No\n");
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();

        if(n<1000) {
        int iti=n%10;
        
        switch(iti) {
         case 2:
         case 4:
         case 5:
         case 7:
         case 9:
        	 
        	 System.out.println("hon");
        	 
        	 break;
        	 
         case 0:
         case 1:
         case 6:
         case 8:
        	 
        	 System.out.println("pon");
        	 break;
        	 
         default:
        	 System.out.println("bon");
        }
      }
	}
}
	


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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define fi first
#define se second
#define setpre(x) cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl

inline void logger(){ cout << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , ";
    logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 100005;

/* ...o(^-^)o... */

int main(){
    ii3(a,b,c); yn(a+b>=c);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
#define PI 3.14159265358979323846264338327950L
using namespace std;
using P = pair<int,int>;
using ll = long long;
using namespace std;
char in[120];
pair<pair<string,int>,int> p[110];
int main(){
int a;scanf("%d",&a);
int L=a/100;
int R=a%100;
if(1<=L&&L<=12){
if(1<=R&&R<=12)printf("AMBIGUOUS\n");
else printf("MMYY\n");
}else{
if(1<=R&&R<=12)printf("YYMM\n");
else printf("NA\n");
}
}


Measured memory_bytes: 3668
from collections import defaultdict

n, m = map(int, input().split())
a = list(map(int, input().split()))

match = [2, 5, 5, 4, 5, 6, 3, 7, 6]
mat = []
for i in range(m):
    mat.append((match[a[i]-1], a[i]))

d = defaultdict(int)
for ma, num in mat:
    d[ma] = max(d[ma], num)

# dp[i]: マッチをi本使ってできる整数のケタの最大値
INF = float('inf')
dp = [-INF] * (n+10)
dp[0] = 0

for i in range(n):
    if dp[i] == -INF:
        continue
    for ma, num in mat:
        if dp[i] + 1 > dp[i+ma]:
            dp[i+ma] = dp[i] + 1

mat.sort(key=lambda x: x[1], reverse=True)

ans = ""
i = n
while i > 0:
    for ma, num in mat:
        if i - ma < 0:
            continue
        if dp[i] == dp[i-ma] + 1:
            ans += str(num)
            i -= ma
            break

print(ans)


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

int main(){
    int num;

    cin >> num;

    switch(num % 10) {
        case 2:
        case 4:
        case 5:
        case 7:
        case 9:
            cout << "hon" << endl;
        break;
        
        case 0:
        case 1:
        case 6:
        case 8:
            cout << "pon" << endl;
        break;

        case 3:
            cout << "bon" << endl;
        
        break;
    }

    return 0;
}

Measured memory_bytes: 3628
from collections import Counter


n = int(input())
lst_v = list(map(int, input().split()))



if len(set(lst_v)) == 1:
    ans = n // 2
else:
    lst_o = lst_v[::2]
    lst_e = lst_v[1::2]
    cnt_o = sorted(Counter(lst_o).items(), key=lambda x: -x[1])
    cnt_e = sorted(Counter(lst_e).items(), key=lambda x :-x[1])


    if cnt_o[0][0] == cnt_e[0][0]:
        rem_number = max(cnt_o[0][1] + cnt_e[1][1], cnt_o[1][1] + cnt_e[0][1])
    else:
        rem_number = cnt_o[0][1] + cnt_e[0][1]
    ans = n - rem_number


print(ans)


Measured memory_bytes: 21084
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	int n; cin>>n;
	string s; cin>>s;
	int ans=0;
	rep(i,0,n-1){
		if(s[i+1]!=s[i])ans++;
	}
	++ans;
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 3728
// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")

#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;
const int NINF = -1*INF;
const long long LLINF = 1ll << 60;
const long long LLNINF = -1*LLINF;

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ";
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
	return os << "[ " << p.first << ", " << p.second << "]" ;
}

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

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef vector<vector<int>> vvi;
typedef vector<vll> vvll;
typedef vector<vd> vvd;
typedef vector<vld> vvld;
 
#define mp make_pair
#define pb push_back
#define pf push_front
#define all(x) x.begin(), x.end()
#define revAll(x) x.rbegin(), x.rend()
#define gcd(a, b) __gcd(a, b)
#define popcount(x) __builtin_popcount(x)
#define isize(x) (int)(x.size())
#define rep(i,n) for(int i = 0; i < n; i++)
#define exists(x,m) m.find(x) != m.end()
#define umap unordered_map
#define uset unordered_set
#define pq priority_queue

const ll MOD = 1e9 + 7;

template<typename T>
pair<vector<T>, vector<T>> prime_sieve(T lim) {
	vector<T> primes = vector<T>();
	vector<T> lp = vector<T>(lim+1, 0);
	for (int num=2; num <= lim; num++) {
		if (lp[num] == 0) {
			lp[num] = num;
			primes.pb(num);
		}
		for (int i = 0; i < isize(primes) and primes[i] <= lp[num] and num*primes[i] <= lim; i++) {
			lp[num * primes[i]] = primes[i];
		}
	}
	return {primes, lp};
}

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);
	int n; cin >> n;
	vi A = vi();
	int maxx = 0;
	rep(i, n) {
		int x; cin >> x;
		A.pb(x);
		maxx = max(maxx, x);
	}	
	auto [primes, lp] = prime_sieve(maxx);
	umap<int, int> prime_freq = umap<int, int>();
	for (const int& a : A) {
		int b = a;
		uset<int> loc = uset<int>();
		while (b > 1) {
			loc.insert(lp[b]);
			b /= lp[b];
		}
		for (const int& p : loc) prime_freq[p]++;
	}
	int max_freq = 0;
	for (const auto& [p, freq] : prime_freq) {
		max_freq = max(max_freq, freq);
	}
	if (max_freq <= 1) {
		cout << "pairwise coprime";
	} else {
		cout << (max_freq < n ? "setwise coprime" : "not coprime");
	}
}

Measured memory_bytes: 15840
using System;

namespace AizuOnLine
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] data1 = Console.ReadLine().Split(' ');
            int n = int.Parse(data1[0]);
            int m = int.Parse(data1[1]);

            //??????A
            int[,] a = new int[n, m];

            for (int i = 0; i < n; i++)
            {
                string[] data2 = Console.ReadLine().Split(' ');
                for (int j = 0; j < m; j++)
                {
                    a[i, j] = int.Parse(data2[j]);
                }
            }

            //??????B
            int[] b = new int[m];
            for (int i = 0; i < m; i++)
            {
                b[i] = int.Parse(Console.ReadLine());
            }

            //?¨????
            for (int i = 0; i < n; i++)
            {
                int ans = 0;
                for (int ii = 0; ii < m; ii++)
                {
                    ans += a[i, ii] * b[ii];
                }

                Console.WriteLine(ans);
            }
        }
    }
}

Measured memory_bytes: 9344
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/* 
 * File:   main.c
 * Author: kundaikwangwari
 *
 * Created on July 20, 2019, 3:24 PM
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define LIM 121001
/*
 * 
 */

int LCSeq(char *X, char *Y,int n){
                                                    //n here is n/2!
    int Xlen = strlen(X);
    int Ylen = strlen(Y);
    //printf("%d",Ylen);
    int table[Xlen+1][Ylen+1];
   
    for(int i = 0; i < Xlen + 1; i++)table[i][0] = 0;  //Xaxis (+1 because 0 has nothing)
    for(int i = 0; i < Ylen + 1; i++)table[0][i] = 0;   //Yaxis (+1 because 0 has nothing)
    
    for(int i = 1; i < Xlen + 1; i++){
        for(int j = 1; j < Ylen + 1; j++){
            //printf("comparing %c and %c\n",X[i-1],Y[j-1]);
            if(X[i-1] == Y[j-1]){
                table[i][j] = table[i-1][j-1]+1; 
               //printf("table (%d,%d) is %d from table(%d,%d) %d+ 1\n",i,j,table[i][j], i-1, j-1, table[i-1][j-1]);
               //printf("%d) in 1\n",i); 
                continue;
            }
            else if(table[i-1][j]>=table[i][j-1]){
                table[i][j]=table[i-1][j];
                //printf("table(%d,%d) is %d from table(%d,%d) %d\n",i,j,table[i][j],i-1,j,table[i-1][j]);
                //printf("%d) in 2\n",i);
                continue;
            }
            else table[i][j]=table[i][j-1];
            //printf("table (%d,%d) is %d from table(%d,%d) %d\n",i,j,table[i][j],i,j-1,table[i][j-1]);
            //printf("%d) in 3\n",i);
        } 
        
    }
    //printf("%d",Ylen);
    //printf("we are good %d\n",table[Xlen][Ylen]);
    return table[Xlen][Ylen];
    
    
}

int main(int argc, char** argv) {

    int n;
    scanf("%d",&n);
    char X[LIM], Y[LIM];
    int  result[LIM];
    for(int i = 0; i < n; i++){
        scanf("%s",X);
        scanf("%s",Y);
        result[i]=LCSeq(X,Y,i);
        //printf("result is %d\n",result[i]);
        //printf("%s %s\n", X, Y);
        //printf("%c, %c\n", X[1], Y[1]);  
    }
    for(int i = 0; i < n; i++)printf("%d\n",result[i]);
    return (0);
}




Measured memory_bytes: 5712
n, m = map(int, input().split())
A = list(map(int, input().split()))
X = []
for i in range(m):
    b, c = map(int, input().split())
    X.append((c, b))

X.sort(reverse=True)
cnt = 0
for c, b in X:
    A += [c]*b
    cnt += b
    if cnt > n:
        break
A.sort(reverse=True)
A = A[0:n]
print(sum(A))


Measured memory_bytes: 78828
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        int[] NK = ReadLineParseIntArray();
        int N = NK[0];
        int K = NK[1];
        int[] h = ReadLineParseIntArray();
        int[] cost = Enumerable.Repeat(int.MaxValue,N).ToArray();
        cost[0] = 0;
        for(int i = 1; i < N; i++)
        {
            for(int j = i - 1; j >= 0 && j >= i - K; j--)
            {
                int v = cost[j] + Abs(h[i] - h[j]);
                if (cost[i] > v)
                {
                    cost[i] = v;
                }
            }
        }
        WriteLine(cost.Last());
    }

    static int ReadLineParseInt() => int.Parse(ReadLine());
    static int[] ReadLineParseIntArray() => ReadLine().Split(' ').Select(int.Parse).ToArray();
}

Measured memory_bytes: 22752
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(N: int, D: int):
    print(-(-N//(2*D+1)))
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    solve(N, D)


if __name__ == '__main__':
    main()


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

int main() {
	vector<int> a(3);
	for (auto &e : a) {
		cin >> e;
	}
	sort(begin(a), end(a));
	int p = a[2] - a[0], q = a[2] - a[1];
	int n = p / 2 + q / 2;
	if (p % 2 && q % 2) {
		n += 1;
	} else if (p % 2 || q % 2) {
		n += 2;
	}
	cout << n << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 using namespace std;
 using pii = pair<int, int>;
 using ll = long long;
 #define rep(i, j, n) for(int i = j; i < (int)(n); i++)
 const ll MOD = 1000000007;
 const ll INFL = (1LL << 60);
 const int INFI = (1 << 30);

 int main(){
   int H, W, D; cin >> H >> W >> D;
   vector<pii> A(H * W + 1);
   rep(i, 1, H + 1) {
     rep(j, 1, W + 1) {
       int tmp; cin >> tmp;
       A.at(tmp) = {i, j};
     }
   }

   vector<vector<int>> cumsum(D + 1);

   rep(i, 1, D + 1) {
     cumsum.at(i).push_back(0);
     int pos = i + D;
     while(pos <= H * W) {
       int d = abs(A.at(pos - D).first - A.at(pos).first) + abs(A.at(pos - D).second - A.at(pos).second);
       cumsum.at(i).push_back(cumsum.at(i).back() + d);
       pos += D;
     }
   }

   int Q; cin >> Q;

   rep(i, 0, Q) {
     int L, R; cin >> L >> R;
     int l = L / D, r = R / D;
     if (L % D != 0) {
       cout << cumsum.at(L % D).at(r) - cumsum.at(L % D).at(l) << endl;
     }
     else {
       cout << cumsum.at(D).at(r - 1) - cumsum.at(D).at(l - 1) << endl;
     }
   }
 }


Measured memory_bytes: 6016
from sys import stdin
import math
import fractions
from collections import deque
from collections import Counter
import itertools

INF = 10 ** 10

# N <= 2*10^5
# 1以上N以下の任意の整数iについて、iの倍数が書かれた箱に入っている
# ボールの個数の和を2で割った余りがaiである
N = int(stdin.readline().rstrip())
a = [int(x) for x in stdin.readline().rstrip().split()]
a = [None] + a

box = [0 for _ in range(N)]
box = [None] + box

for i in range(N, 0, -1):
    baisu_list = []
    for j in range(1, N+1):
        tmp = i * j
        if tmp > N:
            break
        else:
            baisu_list.append(tmp)

    in_list = []
    not_in_list = []

    for cur in baisu_list:
        if box[cur] == 1:
            in_list.append(cur)
        else:
            not_in_list.append(cur)

    if a[i] == len(in_list)%2:
        pass
    else:
        if not_in_list:
            box[not_in_list[0]] = 1
        else:
            print(-1)
            exit()


b = [i for i in range(1, N+1) if box[i] == 1]

print(len(b))
if b:
    print(*b, sep=" ")


Measured memory_bytes: 127076
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

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

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

        if x == y:
            return

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

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

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

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

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

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

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

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

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

n,m=map(int,input().split())
lang=[[] for _ in range(m)]
ans=UnionFind(n)
for i in range(n):
    k,*l=list(map(int,input().split()))
    for a in l:
        lang[a-1].append(i)
for l in lang:
    if len(l)>=2:
        for i in range(len(l)):
            ans.union(l[0],l[i])
print('YES' if ans.group_count()==1 else 'NO')

Measured memory_bytes: 20632
import math
def isPrime(n):
    if n <= 1:
        return False
    elif n < 4:
        return True
    elif n % 2 == 0:
        return False
    elif n < 9:
        return True
    elif n % 3 == 0:
        return False
    else:
        i = 5
        while i <= math.sqrt(n):
            if n % i == 0:
                return False
            if n % (i + 2) == 0:
                return False
            i+=6
    return True
            
N = int(raw_input())
D = [int(raw_input()) for i in xrange(N)]
count = 0
for i in D:
    if isPrime(i) == True:
        count += 1
print count

Measured memory_bytes: 4692
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  vector<int> N(3);
  for(int i=0;i<3;i++){
    cin>>N[i];
  }
  sort(N.begin(),N.end());
  int ans=N[0]*N[1]/2;
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <ios>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <forward_list>
#include <random>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 100005;

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

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

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

    int h, w;
    int a, b;
    cin >> h >> w >> a >> b;
    int mp[1005][1005] = {};
    for( int i = 0; i < b; ++i ) {
        for( int j = a; j < w; ++j ) {
            mp[i][j] = 1;

        }
    }

    for( int i = b; i < h; ++i ) {
        for( int j = 0; j < a; ++j ) {
            mp[i][j] = 1;

        }
    }

    for( int i = 0; i < h; ++i ) {
        int z = 0, o = 0;
        for( int j = 0; j < w; ++j ) {
            if( mp[i][j] == 0 ) ++z;
            else ++o;

        }
        if( min( z, o ) != a ) {
            cout << "No" << endl;
            return 0;

        }
    }

    for( int i = 0; i < w; ++i ) {
        int z = 0, o = 0;
        for( int j = 0; j < h; ++j ) {
            if( mp[j][i] == 0 ) ++z;
            else ++o;

        }
        if( min( z, o ) != b ) {
            cout << "No" << endl;
            return 0;

        }
    }

    for( int i = 0; i < h; ++i ) {
        for( int j = 0; j < w; ++j ) {
            cout << mp[i][j];

        }
        cout << endl;

    }

    return 0;
}



Measured memory_bytes: 5248
// D - Rain Flows into Dams
#include <bits/stdc++.h>

using namespace std;

int main(int argc, char *argv[])
{
	ios::sync_with_stdio(false); cin.tie(0);

	int n;
	cin >> n;
	vector<long long> a(n), x(n);
	for (int i = 0; i < n; i++) cin >> a[i], a[i] *= 2;
	long long c = a[0], d = -1;
	for (int i = 1; i < n; i++) c = a[i] - c, d *= -1;
	x[0] = c / 2;
	for (int i = 1; i < n; i++) x[i] = a[i - 1] - x[i -1];
	for (int i = 0; i < n; i++) cout << (i ? " " : "") << x[i];
	cout << endl;

	return 0;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c,d; cin>>a>>b>>c>>d;
    cout<<max(a*b,c*d)<<"\n";
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/perl

my ($h,$n) = map { $_ - 0 } split(/\s+/,<STDIN>);
my @a = map { $_ - 0 } split(/\s+/,<STDIN>);

my $t = 0;
for(my $i=0;$i<$n;$i++){
  $t += $a[$i];
}
if( $t >= $h ){
  print "Yes\n";
} else {
  print "No\n";
}


Measured memory_bytes: 18340
// C++ program to count number of triangles that can be
// formed from given array
#include <bits/stdc++.h>
using namespace std;

/* Following function is needed for library function
qsort(). Refer
http://www.cplusplus.com/reference/clibrary/cstdlib/qsort/ */
int comp(const void* a, const void* b)
{ return *(int*)a > *(int*)b ; }

// Function to count all possible triangles with arr[]
// elements
int findNumberOfTriangles(int arr[], int n)
{
    // Sort the array elements in non-decreasing order
    qsort(arr, n, sizeof( arr[0] ), comp);

    // Initialize count of triangles
    int count = 0;

    // Fix the first element. We need to run till n-3
    // as the other two elements are selected from
    // arr[i+1...n-1]
    for (int i = 0; i < n - 2; ++i)
    {
        // Initialize index of the rightmost third
        // element
        int k = i + 2;

        // Fix the second element
        for (int j = i + 1; j < n; ++j)
        {
            // Find the rightmost element which is
            // smaller than the sum of two fixed elements
            // The important thing to note here is, we
            // use the previous value of k. If value of
            // arr[i] + arr[j-1] was greater than arr[k],
            // then arr[i] + arr[j] must be greater than k,
            // because the array is sorted.
            while (k < n && arr[i] + arr[j] > arr[k])
            ++k;

            // Total number of possible triangles that can
            // be formed with the two fixed elements is
            // k - j - 1. The two fixed elements are arr[i]
            // and arr[j]. All elements between arr[j+1]/ to
            // arr[k-1] can form a triangle with arr[i] and arr[j].
            // One is subtracted from k because k is incremented
            // one extra in above while loop.
            // k will always be greater than j. If j becomes equal
            // to k, then above loop will increment k, because arr[k]
            // + arr[i] is always greater than arr[k]
            if(k > j)
            count += k - j - 1;
        }
    }

    return count;
}

// Driver code
int main()
{
    int n;
    cin>>n;
    int arr[n];
    for(int i=0; i<n; i++){
        cin>>arr[i];
    }

   //int arr[] =  {218,786,704,233,645, 728, 389};

    //int arr[] = {10, 21, 22, 100, 101, 200, 300};
    //int size = sizeof( arr ) / sizeof( arr[0] );

    //cout<<"Total number of triangles possible is "<<findNumberOfTriangles( arr, size );
    cout<<findNumberOfTriangles(arr, n)<<endl;

    return 0;
}

// This code is contributed by rathbhupendra


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m,s,t,i,j,x,y,z,zhan[100005],book[100005],flag,ans;
int top,fir[100005],qu[200005],to[200005],nex[200005],iter[100005];
int lj(int u,int v,int w){
	top++;
	nex[top]=fir[u];
	fir[u]=top;
	to[top]=v;
	qu[top]=w;
	top++;
	nex[top]=fir[v];
	fir[v]=top;
	to[top]=u;
	qu[top]=0;
	return 0;
}
int BFS(){
	int head=0,tail=0,v;
	zhan[0]=s;book[s]=1;
	while(head<=tail){
		v=zhan[head];
		for(int top1=fir[v];top1;top1=nex[top1])
			if(book[to[top1]]==0&&qu[top1]){
				tail++;
				zhan[tail]=to[top1];
				book[to[top1]]=book[v]+1;
			}
		head++;
	}
	return 0;
}
int DFS(int v,int w){
	if(v==t){
		flag=w;
		ans+=w;
		return 0;
	}
	for(int &top1=iter[v];top1;top1=nex[top1])
		if(book[to[top1]]==book[v]+1&&qu[top1]){
			DFS(to[top1],min(w,qu[top1]));
			if(flag){
				qu[top1]-=flag;
				if(top1&1)
					qu[top1+1]+=flag;
				else
					qu[top1-1]+=flag;
				return 0;
			}
		}
}
char c[105][105];
int main(){
	//scanf("%d%d%d%d",&n,&m,&s,&t);
	//for(i=1;i<=m;i++){
	//	scanf("%d%d%d",&x,&y,&z);
	//	lj(x,y,z);
	//	lj(y,x,0);
	//}
	scanf("%d%d",&n,&m);
	for(i=0;i<n;i++)
		scanf("%s",c[i]);
	for(i=0;i<n;i++)
		for(j=0;j<m;j++){
			if(c[i][j]=='S')
				s=i*m+j+1+n*m;
			else if(c[i][j]=='T')
				t=i*m+j+1;
			if(c[i][j]!='.'){
				lj(n*m*2+i+1,i*m+j+1,1000000000);
				lj(n*m*2+j+n+1,i*m+j+1,1000000000);
				lj(i*m+j+1+n*m,n*m*2+i+1,1000000000);
				lj(i*m+j+1+n*m,n*m*2+j+n+1,1000000000);
				lj(i*m+j+1,i*m+j+1+n*m,1);
			}
		}
	lj(n*m*2+n+m+1,s,1000000000);
	lj(t,n*m*2+n+m+2,1000000000);
	n=n*m*2+n+m+2;
	s=n-1;
	t=n;
	do{
		for(i=1;i<=n;i++){
			book[i]=0;
			iter[i]=fir[i];
		}
		BFS();
		do{
			flag=0;
			DFS(s,2147483647);
		}while(flag);
	}while(book[t]);
	if(ans==1000000000)
		printf("-1\n");
	else
		printf("%d\n",ans);
	return 0;
}

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

using namespace std;
#define  ll long long
#define ld long double
#define f first
#define s second
const int N = 1e6+5;

int main()
{
    int k;
    string s;
    cin >> k >> s;
    if (s.size() <= k) return cout << s << "\n" , 0;
    else
    {
        for(int i=0; i<k; i++)
            cout << s[i];
        cout << "...\n";
    }


    return 0;
}

Measured memory_bytes: 3624