akhauriyash/Code-Regression huggingface dataset:
/* C++14 (Clang 3.8.0) for AtCoder */

#include <iostream>
#include <vector>
#include <string>
// #include <cmath>
// #include <math.h>
// #include <map>
// #include <algorithm>

namespace AtCoder {
	using Str = std::vector<std::string>;
	using Num = std::vector<int>;
	using BigNum = std::vector<long long>;

	class InputData {
	public:
		void getInput(void);
		void skipInput(void);
		Str getStr(void);
		Num getNum(void);
		BigNum getBigNum(void);
	private:
		Str str;
		Num num;
		BigNum bNum;
	};
	Str AtCoder::InputData::getStr(void) {
		return this->str;
	}
	Num AtCoder::InputData::getNum(void) {
		return this->num;
	}
	BigNum AtCoder::InputData::getBigNum(void) {
		return this->bNum;
	}
	void AtCoder::InputData::skipInput(void) {
		std::string buf = "";
		std::getline(std::cin, buf);
	}
	void AtCoder::InputData::getInput(void) {
		this->str.clear();
		this->num.clear();
		this->bNum.clear();

		std::string buf = "", row = "";
		std::getline(std::cin, buf);
		for (unsigned int i = 0; i < buf.size(); i++) {
			if (' ' == buf[i]) {
				this->str.push_back(row);
				this->num.push_back(std::atoi(row.c_str()));
				this->bNum.push_back(std::atoll(row.c_str()));
				row = "";
			} else {
				row += buf[i];
			}
		}
		this->str.push_back(row);
		this->num.push_back(std::atoi(row.c_str()));
		this->bNum.push_back(std::atoll(row.c_str()));
	}

	class Ans {
	public:
		void showResult(void);
		void increment(void);
		void increment(long long);
		void decrement(void);
		void decrement(long long);
		long long getResult(void);
	private:
		long long result;
	};
	void Ans::showResult(void) {
		printf("%lld\n", this->result);
	}
	void AtCoder::Ans::increment(void) {
		this->result++;
	}
	void AtCoder::Ans::increment(long long value) {
		this->result += value;
	}
	void AtCoder::Ans::decrement(void) {
		this->result--;
	}
	void AtCoder::Ans::decrement(long long value) {
		this->result -= value;
	}
	long long AtCoder::Ans::getResult(void) {
		return this->result;
	}

	void exp(std::string* str,  Str* newStr) {
		std::string pre = *str;
		newStr->clear();
		for (unsigned int i = 0; i < pre.length(); i++) {
			newStr->push_back(pre.substr(i, 1));
		}
	}
}

int main(void) {

	AtCoder::InputData* data = new AtCoder::InputData();
	data->getInput();

	AtCoder::Str str = data->getStr();
	AtCoder::exp(&str[0], &str);

	const int max = str.size();
	bool ans = false;
	if (0 == max % 2) {
		for (int i = 0; i < max; i++) {
			if (0 == i % 2) {
				if ("h" == str[i]) {
					ans = true;
				} else {
					ans = false;
					break;
				}
			} else {
				if ("i" == str[i]) {
					ans = true;
				} else {
					ans = false;
					break;
				}
			}
		}
	}

	if (ans) {
		printf("Yes\n");
	} else {
		printf("No\n");
	}

	delete(data);

	return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
  int h, w, k;
  cin >> h >> w >> k;
  vector<string> s(h);
  for (int i = 0; i < h; ++i) {
    cin >> s.at(i);
  }

  vector<vector<int>> ans(h, vector<int>(w));

  int no_st = 0;
  for (int i = 0; i < h; ++i) {
    if (find(s.at(i).begin(), s.at(i).end(), '#') == s.at(i).end()) {
      no_st++;
    } else {
      bool f = false;
      for (int j = 0; j < w; ++j) {
        if (s.at(i).at(j) == '#' and f) {
          --k;
        } else if (s.at(i).at(j) == '#') {
          f = true;
        }
        for (int l = 0; l <= no_st; ++l) {
          ans.at(i - l).at(j) = k;
        }
      }
      no_st = 0;
    }
    if (no_st == 0) --k;
  }
  for (int l = 0; l < no_st; ++l) {
    ans.at(h - 1 - l) = ans.at(h-1 - no_st);
  }


  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      cout << ans.at(i).at(j) << " ";
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

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

	int N, M;
	cin >> N >> M;
	P d[M];
	rep(i, 0, M) {
		int a, b;
		cin >> a >> b;
		d[i].first = b - 1;
		d[i].second = a - 1;
	}
	
	sort(d, d + M);
	
	int ans = 0;
	int prev = -1;
	rep(i, 0, M) {
		if(d[i].second >= prev) {
			prev = d[i].first;
			ans++;
		}
	}

	cout << ans << endl;

}


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

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

#define INF (1<<(4*4-1))
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

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

   int N,A,B;
   cin>>N>>A>>B;
   ll ans2;
   if(N>A+B)ans2 = 0;
   else if(N==A&&N==B)ans2 = N;
   else ans2 = A+B-N;

   cout<<min(A,B)<<" "<<ans2; 
   return 0;
}


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

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

using namespace std;

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

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

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

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

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

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

	int N;
	cin>>N;
	vector<vector<double>> DP(N+1,vector<double>(N+1,0.0));
	DP[0][0]=1.0;

	vector<double> P(N);
	rep(i,0,N)cin>>P[i];

	rep(i,0,N)rep(j,0,N)
	{
		DP[i+1][j]+=(1.0-P[i])*DP[i][j];
		DP[i+1][j+1]+=P[i]*DP[i][j];
	}

	double ans=0.0;
	rep(i,N/2+1,N+1)
	{
		ans+=DP[N][i];
	}

	cout<<fixed<<setprecision(12)<<ans<<endl;
	
	return 0;
}

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

typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define ALL(obj) (obj).begin(), (obj).end()
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 (b<a) { a=b; return 1; } return 0; }

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


int main() {
    cout<<fixed<<setprecision(10);

    ll n; cin>>n;
    vvint edges(n);
    ll ans = 0;
    rep(i,n){
        ll x = i+1;
        ll y = n - i;
        ans += x*y;
    }
    rep(i,n-1){
        ll u,v; cin>>u>>v;
        u--;v--;
        if(u>v)swap(u,v);
        ll x = u+1;
        ll y = n - v;
        ans -= x*y;
    }
    cout<<ans<<endl;




    return 0;

}

Measured memory_bytes: 8004
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

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

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

struct UnionFind
{
    vector<int> par;

    UnionFind(int n) : par(n, -1) {}
    void init(int n) { par.assign(n, -1); }

    int root(int x)
    {
        if (par[x] < 0)
            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 (par[x] > par[y])
            swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

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

int kruskal(vector<edge> &graph, int V)
{
    sort(ALL(graph), [](const edge &a, const edge &b) { return a.cost < b.cost; });
    UnionFind uf(V);

    int res = 0;
    for (int v = 0; v < (int)graph.size(); v++)
    {
        edge e = graph[v];
        if (!uf.issame(e.from, e.to))
        {
            uf.merge(e.from, e.to);
            res += e.cost;
        }
    }
    return res;
}

int calcCost(pair<int, int> a, pair<int, int> b)
{
    int aa = abs(a.first - b.first);
    int bb = abs(a.second - b.second);
    return min(aa, bb);
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<pair<int, pair<int, int>>> pos_x(n);
    vector<pair<int, pair<int, int>>> pos_y(n);
    for (int i = 0; i < n; i++)
    {
        pos_x[i].first = i;
        cin >> pos_x[i].second.first >> pos_x[i].second.second;
        pos_y[i] = pos_x[i];
    }
    sort(ALL(pos_x), [](const auto &a, const auto &b) { return a.second.first < b.second.first; });
    sort(ALL(pos_y), [](const auto &a, const auto &b) { return a.second.second < b.second.second; });
    vector<edge> graph;

    // for (int i = 0; i < n; i++)
    // {
    //     cout << pos_y[i].first << " dbg" << endl;
    // }

    for (int i = 0; i < n - 1; i++)
    {
        graph.push_back(edge{pos_x[i].first, pos_x[i + 1].first, calcCost(pos_x[i].second, pos_x[i + 1].second)});
        graph.push_back(edge{pos_y[i].first, pos_y[i + 1].first, calcCost(pos_y[i].second, pos_y[i + 1].second)});
    }

    int ans = kruskal(graph, n);
    cout << ans << endl;
}

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

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<long long> h(N);
  for (int i = 0; i < N; i++) cin >> h.at(i);
  long long INF = 1LL << 60;
  vector<long long> dp(N, INF);
  dp.at(0) = 0;
  for (int i = 1; i < N; i++) {
    for (int j = 1; j <= K; j++) {
      if (i-j >= 0) {
        chmin(dp.at(i), dp.at(i-j) + abs(h.at(i) - h.at(i-j)));
      }
    }
  }
  cout << dp.at(N-1) << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
vector <int> a[200010];
int dis[200010];
int main(){
    int n, m;
    while(cin>>n>>m){
        ll ans=0;
        for(int i=1; i<=n; ++i){
        	dis[i]=n+10;
        }
        int x, y;
        for(int i=0; i<m; ++i){
            scanf("%d%d",&x, &y);
            a[x].push_back(y);
            a[y].push_back(x);
        }
        queue<pair<int, int>>q;
        q.push(mk(0, 1));
        pair<int, int> tmp;
        while(!q.empty()){
        	tmp=q.front();
        	q.pop();
        	if(dis[tmp.sc]<=tmp.fs){
        		continue;
        	}
        	dis[tmp.sc]=tmp.fs;
        	for(auto it:a[tmp.sc]){
        		q.push(mk(tmp.fs+1, it));
        	}
        }
        // for(int i=1; i<=n; ++i){
        // 	b[dis[i]].push_back(i);
        // }
        printf("Yes\n");
        for(int i=1; i<=n; ++i){
        	for(auto it:a[i]){
        		if(dis[it]<dis[i]){
        			printf("%d\n",it);
        			break;
        		}
        	}
        }
    }
  return 0;
}




Measured memory_bytes: 14740
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using vst=vector<string>;
using P = pair<ll,ll>;
const int inf=1e9+7;
const ll INF=9e18;
template <typename T> bool chmin(T &a, const T& b){if(a > b){a = b;return true;}return false;}
template <typename T> bool chmax(T &a, const T& b){if(a < b){a = b;return true;}return false;}
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

ll dp[110][4][4][4];//dp[i][j][k][l]=i文字　2つ前からjk  i文字目がlの文字列の個数
//0 A  1 C  2 G  3 T
//021 012 201 02X1  0x21 が不適
char q[4]={'A','C','G','T'};

int main(){cout<<fixed<<setprecision(20);
		   //dp
           ll n;
           cin>>n;
           rep(j,0,4)rep(k,0,4)rep(l,0,4){
             if(j==0&&k==2&&l==1)continue;
             if(j==2&&k==0&&l==1)continue;
             if(j==0&&k==1&&l==2)continue;
            dp[3][j][k][l]=1;
           }
           rep(i,4,n+1){
            rep(j,0,4)rep(k,0,4){
              //0
              rep(x,0,4)dp[i][j][k][0]+=dp[i-1][x][j][k];
              //1
              rep(x,0,4){
               if(x==0&&j==2)continue;
                if(j==0&&k==2)break;
                if(j==2&&k==0)break;
                if(x==0&&k==2)continue;
               dp[i][j][k][1]+=dp[i-1][x][j][k]; 
              }
              //2
                rep(x,0,4){
                  if(j==0&&k==1)break;
                  dp[i][j][k][2]+=dp[i-1][x][j][k]; 
                }
              //3
              rep(x,0,4)dp[i][j][k][3]+=dp[i-1][x][j][k]; 
              //
              rep(x,0,4)dp[i][j][k][x]%=inf;
              //cout<<dp[i][j][k][0]<<" ";
            }
             //cout<<endl;
           }
           
           ll ans=0;
           rep(j,0,4)rep(k,0,4)rep(l,0,4){
             ans+=dp[n][j][k][l];
             //cout<<q[j]<<" "<<q[k]<<" "<<q[l]<<" "<<dp[n][j][k][l]<<endl;
           }
           cout<<ans%inf<<endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define endl "\n"
const int MAX= 100005 ;
const long long mod = 1.0e9+7;
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,m,i,j;
    cin>>n>>m;
    int x,y;
    vector<pair<int,int> > v;
    for(i=0;i<n;i++)
    {
        cin>>x>>y;
        v.push_back({y,x});
    }
    sort(v.rbegin(),v.rend());
    set<int> arr;
    for(i=0;i<m;i++)
    {
        arr.insert(i);
    }
    int sum=0;
    for(i=0;i<n;i++)
    {
        if((v[i].second)<=m && arr.find(m-v[i].second)!=arr.end())
        {
            arr.erase(*(arr.find(m-v[i].second)));
            sum+=v[i].first;
        }
        else if((v[i].second)<=m)
        {
            auto pos=arr.lower_bound(m-v[i].second);
            if(pos!=arr.begin())
                pos--;
            else
                continue;
            if(arr.find(*pos)!=arr.end())
            {
                sum+=v[i].first;
                arr.erase(*(arr.find(*(pos))));
            }
        }
    }
    cout<<sum<<endl;
}

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

//#define int long long
#define ll long long
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    char c; cin >> c;
    printf("%c\n",c+1);
}


Measured memory_bytes: 256
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
long long Comb(int a,int b){
 	if(a<b||b<0)return 0;
 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
}
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
long long pw(long long a,long long b){
	if(a<0LL)return 0;
	if(b<0LL)return 0;
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ret;
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
// ここから編集しろ
string str[11000];
char in[21];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++){
		scanf("%s",in);
		str[i]=in;
	}
	scanf("%s",in);
	int L=0;
	int R=0;
	for(int i=0;i<a;i++){
		bool ok=true;
		for(int j=0;in[j];j++){
			if(str[i].size()==j){
				ok=false;break;
			}
			if(str[i][j]=='?'&&in[j]<'z'){
				break;
			}
			if(str[i][j]!='?'&&in[j]<str[i][j]){
				break;
			}
			if(str[i][j]!='?'&&in[j]>str[i][j]){
				ok=false;break;
			}
		}
		if(!ok)L++;
		ok=true;
		for(int j=0;in[j];j++){
			if(str[i][j]=='?'&&in[j]>'a'){
				break;
			}
			if(str[i][j]!='?'&&in[j]<str[i][j]){
				ok=false;break;
			}
			if(str[i][j]!='?'&&in[j]>str[i][j]){
				break;
			}
			if(in[j+1]==0&&str[i].size()>j+1){
				ok=false;break;
			}
		}

		if(ok)R++;
	}
	for(int i=L;i<=R;i++){
		if(i>L)printf(" ");
		printf("%d",i+1);
	}printf("\n");
}

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  ll h,w,n;
  cin>>n>>h>>w;
  
  ll ans = (n-h+1)*(n-w+1);
  cout<<ans<<endl;

}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class A { public static void Main() => (new Solver()).Solve(); }

public class Solver
{
	public void Solve()
	{
		var S = GetString();
		var x = DateTime.Parse(S);
		var y = DateTime.Parse("2019/04/30");
		WriteLine(x.CompareTo(y) <= 0 ? "Heisei" : "TBD");
	}
}

public static class MyIO
{
	private static string[] args = new string[0];
	private static int cnt = 0;
	private static IEnumerable<string> getArgs(long N) => Range(0, N).Select(_ => getArg());
	private static string getArg()
	{
		if(cnt == args.Length) { args = Console.ReadLine().Split(); cnt = 0; }
		return args[cnt++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => getArgs(N).Select(int.Parse).ToArray();
	public static long[] GetLongs(long N) => getArgs(N).Select(long.Parse).ToArray();
	public static double[] GetDoubles(long N) => getArgs(N).Select(double.Parse).ToArray();
	public static decimal[] GetDecimals(long N) => getArgs(N).Select(decimal.Parse).ToArray();
	public static string[] GetStrings(long N) => getArgs(N).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) < 0) x = y; }
	public static void chmin<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) > 0)	x = y; }
	public static void swap<T>(ref T x, ref T y) { T tmp = x; x = y; y = tmp; }
	public static long rightShift(long x, long y) => (x >> (int)y);
	public static long leftShift(long x, long y) => (x << (int)y);
	public static bool contains(long s, long x) => (rightShift(s, x) & 1L) == 1L;
	public static long gcd(long x, long y) => (y == 0) ? x : gcd(y, x % y);
	public static long lcm(long x, long y) => (x / gcd(x,y)) * y;	
	public static IEnumerable<int> Range(long start, long count) => Enumerable.Range((int)start, (int)count);
	public static void Sort(this List<string> source) => source.Sort(StringComparer.Ordinal);
}


Measured memory_bytes: 29052
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	int a,b; cin>>a>>b;
	if(abs(a-b)%2==1){cout<<"IMPOSSIBLE"<<endl; return 0;}
	else cout<<abs(a+b)/2<<endl;
	return 0;
}

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

int asc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

int main(void) {
    int n, m, total;
    scanf("%d%d", &n, &m);
    int x[m], d[m-1];
    for(int i = 0; i < m; i++) {
        scanf("%d", &x[i]);
    }
    qsort(x, m, sizeof(int), asc);
    for(int i = 0; i < m-1; i++) {
        d[i] = x[i] - x[i+1];
    }
    qsort(d, m-1, sizeof(int), asc);
    total = x[0] - x[m-1];
    if(m <= n) {
        printf("%d\n", 0);
        return 0;
    }
    for(int i = 0; i < n-1; i++) {
        total -= d[i];
    }
    printf("%d\n", total);
    return 0;
}

Measured memory_bytes: 1268
import math
sum_x,sum_y,dig=0,0,0
while True:
    d,a = map(int,raw_input().split(","))
    if d ==0 and a ==0:
        break
    else:
        x = d * math.sin(dig)
        y = d * math.cos(dig)
        sum_x += x
        sum_y += y
        dig = dig + math.radians(a)

print int(sum_x)
print int(sum_y)


Measured memory_bytes: 4780
#include<stdio.h>
int i,j,k,l,count,b,d=0,n=0,num[2000000];
void output(void);
void F(void);
void L(void);
void calc(void);
int main(void){
  scanf("%d",&n);
  char order[12];
  for(i=0;i<n;i++){
    scanf("%s %d",order,&b);
    switch(order[0]){
        case 'i':
            num[i]=b;
        break;
        case 'd':
            if(order[6]=='F'){
                F();
            }else if(order[6]=='L') {
                L();
            }else {
                calc();
            }
        break;
    }
  }
  output();
  return 0;
}
void F(void){
    i-=2;
    n-=2;
}
void L(void){
    i--;
    n--;
    d++;
}
void calc(void){
    i--;
    n--;
    l=0;
    for(j=i;j>=0;j--){
        if(l>0)break;
        if(b==num[j]){
            k=i-j;
            count=0;
            l++;
            while(k!=count++){
                num[j+count-l]=num[j+count];
            }
            i--;
            n--;
        }
    }
}
void output(void){
   for(i=0;i<n-d;i++){
    if(i==n-d-1){
      printf("%d\n",num[n-1-i]);
    }else{
      printf("%d ",num[n-1-i]);
    }
  } 
}


Measured memory_bytes: 5632
import copy


def m():
    N, M = map(int, input().split())
    graph = [[] for _ in range(N + 1)]
    E = []
    visited = []
    for i in range(M):
        a, b = map(int, input().split())
        E.append((a, b))

    for m in range(M):
        a, b = E[m]
        graph[a].append(b)
        graph[b].append(a)

    def dfs(v, g):
        if visited[v] == True:
            return
        visited[v] = True
        for i in g[v]:
            dfs(i, g)

    def is_all_visited(v):
        for i in range(1, N + 1):
            if v[i]:
                pass
            else:
                return False
        return True

    ans = 0
    for j in range(M):
        y, z = E[j]
        visited = [False] * (N + 1)
        tmp = copy.deepcopy(graph)
        tmp[y].remove(z)
        tmp[z].remove(y)
        dfs(1, tmp)
        if is_all_visited(visited):
            pass
        else:
            ans += 1

    return ans


print(m())


Measured memory_bytes: 3556
#include <bits/stdc++.h>
#include <chrono>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define rep2l(i, s, n) for (ll i = (ll)(s); i < (ll)n; i++)

int main() {
    int A, B;
    cin >> A >> B;
    cout << A*B << endl;
}

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

int main(){
 
 int H,W,N;
 cin >> H >> W >> N;
   
 if(H >= W){

  if(N % H > 0){

   cout << N / H + 1 << endl;
  }
    
  else{
     
   cout << N / H << endl;
  }
 }
  
 else{

  if(N % W > 0){

   cout << N / W + 1 << endl;
  }
   
  else{

   cout << N / W << endl;
  }
 }
}
 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,a,cnt=0;
vector<int> v;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=2*n;i++){
		scanf("%d",&a);
		v.push_back(a);
	}
	sort(v.begin(),v.end());
	for(int i=1;i<=n;i++){
		cnt+=v[2*(i-1)];
	}
	printf("%d",cnt);
}

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

using namespace std;

int main()
{
  int A, B;
  cin >> A >> B;

  if(A > 2*B){
    cout << A - 2*B << endl;
  }else{
    cout << 0 << endl;
  }

  return 0;
}


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

// @@ !! LIM()

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  vector<ll> vec({
      1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51});
  ll K; cin >> K; K--;
  cout << vec.at(K) << endl;
  

  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vs = vector<string>;
using vd = vector<double>;
using ul = unsigned long;
 
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
 
const int mod=1e9+7;
 
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
};
 
mint c[4005][4005];
void init() {
  c[0][0] = 1;
  for (int i = 0; i <= 4000; i++) {
    for (int j = 0; j <= i; j++) {
      c[i+1][j] += c[i][j];
      c[i+1][j+1] += c[i][j];
    }
  }
}
mint comb(int n, int k) {
  return c[n][k];
}
 
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
 
    return true;
}
 
map<ll, ll> primeFact(ll n) {
  map<ll, ll> res;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      res[i]++;
      n /= i;
    }
  }
  if (n != 1) res[n]++;
  return res;
}
 
void printv(vi& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
void printv(vll& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
int vtotal(vi& v){
  int total=0;
  rep(i,v.size()) total+=v[i];
  return total;
}
 
int main()
{
  //init(); // mint初期化
  cin.tie( 0 );
  ios::sync_with_stdio( false );
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  int ans=0;
  if(a>b)ans=b;
  else ans=a;
  if(c>d)ans+=d;
  else ans+=c;
  cout(ans);
  return 0;
}

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

int main(){
  int H,W;
  cin >> H >> W;
  string board[H];
  for(int i = 0; i < H;i++) cin >> board[i];

  for(int i = 0; i < W+2; i++) cout << '#' ;
  cout << endl;
  for(int i = 0; i < H;i++) cout << "#" << board[i] << "#" << endl;
  for(int i = 0; i < W+2; i++) cout << '#' ;
  cout << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  string S;
  cin >> N >> S;
  int ans = 0;
  for (int i = 1; i < N; i++){
    if(!(S.at(i) == S.at(i-1))){
      ans++;
    }
  }
  ans++;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String num = sc.next();
        char[] charStr = new char[3];
        boolean judge = false;
        for(int i = 0; i<3; i++){
            charStr[i] = num.charAt(i);
            if(charStr[i] == '7'){
                judge = true;
            }  
        }
        System.out.println(judge ? "Yes" : "No");
    }
}

Measured memory_bytes: 35764
n, k = map(int, input().split())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7

mia = sorted([i for i in a if i < 0], reverse=True)
pla = sorted([i for i in a if i >= 0])
ans, num = 1, []

if len(pla) == 0 and k % 2 == 1:
    for i in mia[:k]:
        ans = ans * i % mod
    print(ans); exit()

for _ in range(k):
    if len(mia) > 0 and len(pla) > 0:
        if abs(mia[-1]) <= pla[-1]:
            tmp = pla.pop()
        elif abs(mia[-1]) > pla[-1]:
            tmp = mia.pop()
    elif len(mia) == 0:
        tmp = pla.pop()
    elif len(pla) == 0:
        tmp = mia.pop()
    num.append(tmp)

cnt = sum(i < 0 for i in num)
for i in num:
    ans = ans * i % mod

if cnt % 2 == 1:
    p, q, r, s = 1, 0, -1, 0
    if len(mia) > 0 and cnt != k:
        for i in num[::-1]:
            if i >= 0:
                p, q = i, mia[-1]; break
    if len(pla) > 0:
        for i in num[::-1]:
            if i < 0:
                r, s = i, pla[-1]; break
    if len(mia) > 0 or (len(pla) > 0 and cnt != k):
        if q * r >= p * s:
            ans *= q * pow(p, mod - 2, mod)
        if q * r < p * s:
            ans *= s * pow(r, mod - 2, mod)
    ans %= mod
print(ans)


Measured memory_bytes: 31748
N,K = map(int,input().split())

A = list(map(int,input().split()))

check = [0]*N

jump = 0

count = 0

while check[A[jump]-1] == 0 and count < K:
    n_jump = A[jump]-1
    check[n_jump] = check[jump]+1
    count += 1
    jump = n_jump

if count == K:
    key = max(check)
    ans = check.index(key)+1
else:
    count2 = 0
    key = max(check)
    jump = check.index(key)
    check2 = [0]*N
    while check2[A[jump]-1] == 0:
        n_jump = A[jump]-1
        check2[n_jump] = check2[jump]+1
        count2 += 1
        jump = n_jump
    amari = (K-count)%count2
    if amari == 0:
        key = max(check2)
        ans = check2.index(key)+1
    else:
        ans = check2.index(amari)+1
print(ans)
    

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

// Shrotening
#define fst first
#define snd second
#define pb push_back

// Loop
#define FOR(i,a,b) for(long i=(a);i<(b);++i)
#define RFOR(i,a,b) for(long i=(a);i>=(b);--i)

#define REP(i,a) for(long i=0;i<(a);++i)
#define RREP(i,a) for(long i=(a);i>=0;--i)

#define EACH(i,a) for(auto (i)=(a).begin(),_END=(a).end();i!=_END;++i)
#define REACH(i,a) for(auto (i)=(a).rbegin(),_END=(a).rend();i!=_END;++i)

//Algorithm
#define ALL(a) (a).begin(), a.end()
#define RALL(a) (a).rbegin(), a.rend()
#define EXIST(a,x) ((a).find(x)!=(a).end())
#define SORT(a) std::sort((a).begin(), (a).end())
#define UNIQUE(a) std::sort((a).begin(), a.end()), a.erase(std::unique((a).begin(), a.end()), a.end());
#define SUM(a) std::accumulate((a).begin(), (a).end(), 0);

//Setting
#define OPT std::cin.tie(0);std::ios::sync_with_stdio(false);

//debug message
bool debug = true;
#define MSG(s)   if(debug){std::cout << s << std::endl;}
#define DEBUG(x) if(debug){std::cout << "debug(" << #x << "): " << x << std::endl;}

//alias
typedef long long LL;
typedef std::vector<char> VC;
typedef std::vector<int>  VI;
typedef std::vector<long> VL;
typedef std::vector<long long> VLL;

typedef std::vector< VC > VC2;
typedef std::vector< VI > VI2;
typedef std::vector< VL > VL2;
typedef std::vector< VLL > VLL2;

typedef std::pair<int,int> PII;

std::string S;
int len;
int hlen;
int main(){
    std::cin >> S;
    len = S.length();
    hlen = len/2;

    int left = 0, right = len - 1;
    int ans = 0;
    while(left < right) {
        if(S[left] == S[right]) {
            left++, right--;
        } else {
            if(S[left] == 'x') {
                ans++;
                left++;
            } else if(S[right] == 'x') {
                ans++;
                right--;
            } else {
                std::cout << -1 << std::endl;
                return 0;
            }
        }
    }
    std::cout << ans << std::endl;
}

Measured memory_bytes: 512
#include <iostream>
//#include <vector>
//#include <string>
#define ll long long
using namespace std;

int main() 
{
    ll a, b, x, ans = 0, hugou = 0;
    cin >> x;
    for(a = 1; 1; a++) {
        ll t = a*a*a*a*a;
        for(b = 0; b < a; b++) {
            ll k = b*b*b*b*b;
            if(t - k == x) {
                ans = 1;
                hugou = 0;break;
            }

            if(t + k == x){
                ans = 1;
                hugou = 1;break;
            }
        }

        if(ans)
            break;
    }

    if(hugou)
        cout << a << " " << -b << endl;
    else {
        
            cout << a << " " << b << endl;}
    
}

Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<cstdlib>
#include<cstdio>
#include<utility>
#include<list>
using namespace std;
int main(){
	int k,s,cnt=0,l=0;
	cin>>k>>s;
	for(int i=0;i<=k;i++){
		for(int j=0;j<=k;j++){
			l = s-i-j;
			if(0<=l && l<=k) cnt++;
		}
	}

	cout<< cnt <<endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<functional>
#include<utility>
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
string s;
int temp[100] = {};
int main() {
	cin >> s;
	for (int i = 0; i < s.size(); i++)
	{
		if (s[i] == 'A' || s[i] == 'G' || s[i] == 'C' || s[i] == 'T') {
			temp[i + 1] = temp[i] + 1;
		}else temp[i + 1] = 0;
	}
	int ans = -1;
	for (int i = 0; i < s.size(); i++)
	{
		ans = max(temp[i+1], ans);
	}

	cout <<ans<< endl;
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

MOD = 10 ** 9 + 7

N = int(input())
A = list(map(int, input().split()))

S = 0
for a in A:
    S += a
    S %= MOD

ans = 0

for a in A:
    t = (S - a) * a
    t %= MOD
    ans += t
    ans %= MOD

fact = [1]
fact_inv = [1]  # numpyなし
for i in range(10):
    new_fact = fact[-1] * (i + 1) % MOD
    fact.append(new_fact)
    fact_inv.append(pow(new_fact, MOD - 2, MOD))

ans *= fact_inv[2]
ans %= MOD

print(ans)



Measured memory_bytes: 30992
// lcmとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF 1001001001
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define double long double
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n+1)
using namespace std;
bool my_compare(pair<ll, ll> a, pair<ll , ll> b) {
    // 基本はfirstで比較
    if(a.first != b.first){
         return a.first < b.first; // 昇順
        //return a.first > b.first; // 降順
    }

    // それ以外はsecondで比較
    if(a.second != b.second){
        return a.second > b.second;
    }else{
        // どちらも同じ
        return true;
    }
}

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

    ll a,b,c,m,n,maxi=0,f=0,mini=INF,sum=0;
    string str;
    cin>>a>>b>>c;
    if(a%2&&b%2&&c%2) {
        mini=min(a*b,b*c);
        mini=min(mini,a*c);
        cout<<mini<<endl;
    }
    else cout<<0<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
#define LL long long
int N, Q;
LL inf = 1 << 30;
vector<LL> A(100010);
LL sum1[100010];
LL sum2[100010];

bool judge(LL X, int l, int r){
    int dl = abs(X - A[l]);
    int dr = abs(X - A[r]);
    if(dr < dl) return true;
    if(dr == dl) return false;
    return false;
}
LL solve(LL X) {
    LL ub = N + 1, lb = 0;
    while(ub - lb > 1){
        LL mid = (ub + lb) / 2;
        int t = (mid + 1) / 2;
        int r = N - t - 1;
        int l = N - mid;
        if(judge(X, l, r + 1)){
            ub = mid;
        }else{
            lb = mid;
        }
    }
    int l = N - (lb + 1) / 2;
    if(lb % 2) lb++;
    LL ans = sum1[N - 1] - sum1[l - 1];
    if(N - lb > 0) ans += sum2[N - lb - 1];
    return ans;
}

int main(){
    cin >> N >> Q;
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    for(int i = 0; i < N; i++){
        sum1[i] += A[i];
        sum1[i + 1] += sum1[i];
    }
    for(int i = 0; i < N; i++){
        sum2[i] += A[i];
        sum2[i + 2] += sum2[i];
    }
    for(int i = 1; i <= Q; i++){
        LL X;
        cin >> X;
        cout << solve(X) << endl;
    }
    return 0;
}

Measured memory_bytes: 4096
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;

int main()
{
    int n;

    while (1) {
        int sum = 0;
        double m, disp = 0;
        cin >> n;
        if (!n)
            break;
        int s[n];
        for (int i = 0; i < n; i++) {
            cin >> s[i];
            sum += s[i];
        }
        m = 1.0 * sum / n;
        for (int i = 0; i < n; i++)
            disp += (m - s[i]) * (m - s[i]);
        printf("%.8f\n", sqrt(disp / n));
    }
}


Measured memory_bytes: 3132
#include<iostream>
#include<vector>
using namespace std;
int main(){
    int n,k;
    cin>>n>>k;
    vector<int>v(n);
    for(int i=0;i<n;i++)
    {
        cin>>v[i];
    }
    int result=0;
    for(int i=0;i<n;i++)
    {
        result+=2*(min(abs(0-v[i]),abs(k-v[i])));
    }
    cout<<result;
}

Measured memory_bytes: 3616
N = int(input())
L = list(map(int, input().split()))

ans = 0
for i in range(N):
  for j in range(N):
    for k in range(N):
        if L[i] != L[j] and L[j] != L[k] and L[i] != L[k]:
            if (L[i] + L[j] > L[k]) and (L[j] + L[k] > L[i]) and (L[k] + L[i] > L[j]):
                ans += 1

print(ans // 6)


Measured memory_bytes: 9184
#include <bits/stdc++.h>
 
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for (ll i = (ll)(n) - 1; i >= 0; i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e18)

#define PI (acos(-1))
#define print(x) cout << x << endl
 
ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second > b.second;
    }
}

template <typename T> 
ostream& operator<<(ostream& os, const vector<T>& v) 
{ 
    for (int i = 0; i < (int)v.size(); ++i) { 
        os << v[i]; 
        if (i != (int)v.size() - 1) 
            os << " "; 
    } 
    return os; 
} 

int main()
{
    ll N;
    cin >> N;
    string S;
    cin >> S;
    rep(i, S.size()) {
        if (S[i] == '(') {
            ll tmp = i+1;
            ll lcnt = 1;
            ll rcnt = 0;
            bool flag = false;
            while(tmp < (ll)S.size()) {
                if (S[tmp] == '(') {
                    lcnt++;
                } else {
                    rcnt++;
                }
                if (lcnt == rcnt) {
                    flag = true;
                    break;
                }
                tmp++;
            }
            if (!flag) {
                S += ")";
                i--;
            }
        } else {
            ll tmp = i-1;
            ll lcnt = 0;
            ll rcnt = 1;
            bool flag = false;
            while(tmp >= 0) {
                if (S[tmp] == '(') {
                    lcnt++;
                } else {
                    rcnt++;
                }
                if (lcnt == rcnt) {
                    flag = true;
                    break;
                }
                tmp--;
            }
            if (!flag) {
                S = "(" + S;
            }
        }
    }
    print(S);
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>

struct Point{
	long double X,Y;
	inline void read(){scanf("%Lf%LF",&X,&Y);}
	inline long double plength(){return X*X+Y*Y;}
	inline long double length(){return sqrtl(plength());}
	Point(){X=Y=0;}
	Point(long double X_,long double Y_){X=X_,Y=Y_;}
};
struct Line{
	Point A,B;
	inline void read(){A.read(),B.read();}
	Line(){}
	Line(const Point &A_,const Point &B_){A=A_,B=B_;}
};
typedef Point Vector;
inline Vector operator - (const Point &A,const Point &B){return Vector(A.X-B.X,A.Y-B.Y);}
inline long double operator ^ (const Point &A,const Point &B){return A.X*B.X+A.Y*B.Y;}
inline long double operator * (const Point &A,const Point &B){return A.X*B.Y-A.Y*B.X;}
inline Point operator + (const Point &A,const Vector &B){return Point(A.X+B.X,A.Y+B.Y);}
inline Vector operator * (const Vector &A,long double k){return Vector(A.X*k,A.Y*k);}

Line L;
Point P;

int Q;

inline long double sqr(long double k){return k*k;}

Point Projection(const Line &L,const Point &P){
	long double len=((P-L.A)^(L.B-L.A))/(L.B-L.A).plength();
	return L.A*(1-len)+L.B*len;
}

int main(){
	L.read();
	scanf("%d",&Q);
	while (Q--){
		P.read();
		Point Ans=Projection(L,P);
		printf("%.10Lf %.10Lf\n",Ans.X,Ans.Y);
	}
}



Measured memory_bytes: 3208
#include <bits/stdc++.h>
#include <iostream>
#include <utility> // pair
#include <string>
#include <vector>
#define MAX_N 100001
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define FOR(i, a, b) for(ll i=a; i<b; i++)
#define REP(i, n) for(ll i=0; i<n; i++)
#define REV(i, n) for(ll i=n-1; i>=0; i--)
#define ALL(v) v.begin() v.end()
#define pb push_back
ll n, a, b;
char op;

signed main(){
	cin >> a >> op >> b;
	if(op == '+') cout << a + b << endl;
	else cout << a - b << endl;
    return 0;
}

Measured memory_bytes: 256
import Data.List
import Data.Ord
main = do
    [n,t] <- input <$> getLine
    a <- input <$> getContents 
    putStrLn $ show $ answer a

input :: String -> [Int]
input = map read . words

answer :: [Int] -> Int
answer (c:cities) = let (_,_,cost) = foldl foldfunc (c,0,0) cities in cost

foldfunc (smallest,maxbene,cost) a
    | a - smallest >  maxbene = (min smallest a, a - smallest, 1)
    | a - smallest == maxbene = (min smallest a, maxbene, cost+1)
    | a - smallest <  maxbene = (min smallest a, maxbene, cost)


Measured memory_bytes: 2428
s = input()
t = input()

s = sorted([s.count(i) for i in set(s)])
t = sorted([t.count(i) for i in set(t)])

if s==t:
    print("Yes")
else:
    print("No")
#aab
#bba
#が通ってしまうので　嘘回答

#そもそも、chokudai から redcoder も、
#k to x , d to x , x to d を行えれば、"Yes"になるため、
#説明不足感がある

#再び変換出来ないという条件を追加で成り立つような気がした

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int N;
  cin >> N;
  vector<int> button(N);
  int next = 1, count = 0;
  bool flag = false;
  
  for (int i = 0; i < N; i++) {
    cin >> button.at(i);
  }

  while (true) {
        
    int i = next;
    next = button.at(next - 1);
    button.at(i - 1) = 0;
    count++;
    if(next == 2) {
      cout << count << endl;
      break;
    }
   	else if (next == 0) {
      cout << "-1" << endl;
      break;
    }
  }
}

Measured memory_bytes: 640
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<algorithm>
#include<math.h>
#define maxn 100005
const double INF=0xfffff;
using namespace std;
long long num[maxn];
int main()
{
  int n;
  long long flag1,flag2,flag3;
  int flag;
  while(scanf("%d",&n)!=EOF)
  {
  	flag1=-1;
  	flag2=-1;
  	flag=0;
    for(int i=0;i<n;i++)
    scanf("%d",&num[i]);
    sort(num,num+n);
    for(int i=n-2;i>=0;i--)
    {
    	if(num[i]==num[i+1]&&flag1==-1)
    		{
    			flag1=num[i];
    			flag2=i;
    		}
    	else if(num[i]==num[i+1]&&i<flag2-1)
    		{
    			flag=1;
    			flag3=num[i];
    			break;
    		}
    		
    }
    if(flag==0)
    	printf("0\n");
    	else
    		printf("%lld\n",flag1*flag3);
  }
   return 0;
}

Measured memory_bytes: 896