akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iosfwd>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cassert>
#include <cctype>
#include <climits>
#include <vector>
#include <bitset>
#include <set>
#include <queue>
#include <math.h>
#include <stack>
#include <map>
#include <deque>
#include <string>
#include <list>
#include <iterator>
#include <sstream>
#include <complex>
#include <fstream>
#include <functional>
#include <numeric>
#include <utility>
#include <algorithm>
#include <assert.h>
#include <unordered_map>
#pragma GCC optimize ("-O3")
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cerr.tie(NULL);
#define tolower(s) transform(s.begin(),s.end(),s.begin(),::tolower);
#define toupper(s) transform(s.begin(),s.end(),s.begin(),::toupper);
#define ll long long int
ll max(ll a, ll b) {  return a > b ? a : b; }
ll gcd(ll a, ll b) { if (a == 0) return b; return b == 0 ? a : gcd(b, a % b);}
#define case(i) cout<<"Case #"<<i<<": ";
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cerr << '\n'; }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) { cerr << "[ " << *it << " = " << a << " ]"; err(++it, args...);}
#define pii pair <ll , ll >
#define pb push_back
#define PRECISION 10
const ll inf = 1e16;
const int MAXN = 100001;
const int LOGN = 22;
const int MAXBIT = 61;
const int DIGITSIZE = 19;
ll mod = 1e9 + 7;
ll MOD = 998244353;
int x4[] = {1, -1, 0, 0};
int y4[] = {0, 0, 1, -1};
bool take_test_cases = 0;
bool print_case_no = 0;

void getac(int T) {
    string s,t;
    cin>>s>>t;
  
    int j=0;
    int n=s.length();
    int m=t.length();
    if(m!=n+1){
        cout<<"No\n";
      return;
    }
    int i=0;
    while(i<n&&s[i]==t[i]){
        i++;
    }
    if(i==n){
        cout<<"Yes\n";
    }
    else{
        cout<<"No\n";
    }
}
int  main()
{

    fastio;
    int t = 1;
    if (take_test_cases) cin >> t;
    int t_t = 1;
    while (t--) {
        if (print_case_no)
        case (t_t);
        getac(t_t);
        t_t++;
    }
    return 0;
}

Measured memory_bytes: 3624
def main():
    N=[int(x) for x in list(input())]
    k=int(input())
    digit=len(N)
    if k>digit:
        return 0
    DP=[[[0]*(digit+1) for _ in range(2)] for _ in range(digit+1)] #DP[上からd桁][less][0の個数]
    DP[0][0][0]=1
    for d in range(digit):
        for less in range(2):
            for num in range(digit):
                limit=9 if less else N[d]
                for l in range(limit+1):
                    DP[d+1][less or l<limit][num+(l==0)]+=DP[d][less][num]
    return DP[-1][0][digit-k]+DP[-1][1][digit-k]
    #print(DP)
    
if __name__=='__main__':
    print(main())

Measured memory_bytes: 42460
#include <bits/stdc++.h>
using namespace std;
signed gcd(long long x, long long y) {if (y == 0)return x;return gcd(y, x % y);}
int main(){
  int N,X; cin>>N>>X;
  long long ans;
  vector<int>A(N);
  for(int i=0;i<N;i++){
    cin>>A[i];
    if(i==0)ans=abs(X-A[i]);
    else ans=gcd(ans,A[i]-A[i-1]);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3652
//clear adj and visited vector declared globally after each test case
//check for long long overflow
//while adding and subs check if mod becomes -ve
//while using an integer directly in a builtin function add ll

#include <bits/stdc++.h>
#define int long long
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);cout.precision(dbl::max_digits10);
#define pb push_back
#define mod 1000000007 //998244353
#define lld long double
#define mii map<int, int>
#define mci map<char, int>
#define msi map<string, int>
#define pii pair<int, int>
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=x; i<y; i++)
#define fill(a,b) memset(a, b, sizeof(a))
#define vi vector<int>
#define setbits(x) __builtin_popcountll(x)
#define print2d(dp,n,m) for(int i=0;i<=n;i++){for(int j=0;j<=m;j++)cout<<dp[i][j]<<" ";cout<<"\n";}
typedef std::numeric_limits< double > dbl;
using namespace std;
const long long N=200005, INF=2000000000000000000;
int power(int a, int b, int p)
    {
        if(a==0)
        return 0;
        int res=1;
        a%=p;
        while(b>0)
        {
            if(b&1)
            res=(res*a)%p;
            b>>=1;
            a=(a*a)%p;
        }
        return res;
    }

int32_t main()
{
    IOS;
    int n,lim;
    cin>>n>>lim;
    int m=n*1000;
    int w[n+1],v[n+1];
    for(int i=1;i<=n;i++)
    cin>>w[i]>>v[i];
    int dp[n+1][m+1];
    rep(i,0,n+1)
    rep(j,0,m+1)
    dp[i][j]=INF;
    //cout<<dp[1][5]<<'\n';
    dp[0][0]=0;
    for(int i=1;i<=n;i++)
    {
        //dp[i][0]=0;
        for(int j=0;j<=m;j++)
        {
            if(dp[i-1][j]!=INF)
            {
                dp[i][j]=min(dp[i][j], dp[i-1][j]);
                if((dp[i-1][j]+w[i])<=lim)
                {
                    dp[i][j+v[i]]=min(dp[i-1][j]+w[i], dp[i][j+v[i]]);
                    //cout<<i<<" "<<j<<" "<<j+v[i]<<" "<<dp[i-1][j]<<" "<<w[i]<<"\n";
                }
            }
        }
    }
    int ans=0;
    for(int i=m;i>0;i--)
    {
        if(dp[n][i]!=INF)
        {
            ans=i;
            break;
        }
    }
    //print2d(dp,n,m);
    cout<<ans;
}

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

using ll = long long;
using P = pair<ll, ll>;

const ll MOD = 1e9+7;
// const ll MOD = 998244353;
const ll INF = 1ll<<60;

#define FOR(i,a,b) for (ll i=(a);i<(ll)(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

ll N;
bool isto[210][210];
ll dist[210][210];
ll d[210][210];
vector<vector<ll>> G;

int main(int argc, char **argv)
{
	cin >> N;
	G.resize(N);
	REP(h, N)REP(w, N)
	{
		d[h][w] = INF * (h != w);
		char c; cin >> c;
		isto[h][w] = (c-'0');
		if (c == '1')
		{
			d[h][w] = 1;
			G[h].push_back(w);
		}

	}

	vector<ll> color(N, -1);
	queue<ll> que;
	que.push(0);
	color[0] = 0;
	while (!que.empty())
	{
		ll n = que.front();
		que.pop();
		for (auto &nv : G[n])
		{
			if (color[nv] != -1)
			{
				if (color[n] != color[nv]) continue;

				std::cout << -1 << std::endl;
				return 0;
			}

			color[nv] ^= color[n];
			que.push(nv);
		}
	}

	REP(via, N)REP(s, N)REP(g, N)
		d[s][g] = min(d[s][g], d[s][via]+d[via][g]);

	ll res{-1};
	REP(s, N)REP(t, N)
	{
		if (d[s][t] != INF)
			res = max(res, d[s][t]);
	}

	std::cout << res+1 << std::endl;
}


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

int main(){
    int i,n,max=0,sum=0;
    cin >> n;
    vector<int> l(n);
    for(i=0;i<n;i++){
        cin >> l.at(i);
        sum += l.at(i);
        if(i==0)max=l.at(i);
        if(max<l.at(i))max=l.at(i);
    }
    if(sum-max>max)cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f
const int N=1e5+5,M=N<<2;
int ans,s,t,tot,now,n,m,head[N],nex[M],to[M];
int d[N];
bool vv[N];
void add(int u,int v)
{
    to[++tot]=v;nex[tot]=head[u];head[u]=tot;
}
struct node
{
    int u,x;
    node(int u,int x):u(u),x(x){}
    bool operator<(const node&o)const
    {
        return x>o.x;
    }
};
set<pair<int,int>,int>mp;
int vis[N][3];
priority_queue<node>q;
stack<pair<int,int> >st;
void dfs(int u,int p)
{
    if(p==0)
    {
        if(d[u]>d[now]+1)
        {
            d[u]=d[now]+1;
            vv[u]=false;
            q.push(node(u,d[u]));
        }
        return;
    }
    for(int i=head[u];i;i=nex[i])
    {
        int v=to[i];
        if(vis[v][p-1]) continue;
        vis[v][p-1]=true;
        st.push(make_pair(v,p-1));
        dfs(v,p-1);
    }
}
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++)
    {
        int u,v;
        scanf("%d%d",&u,&v);
        add(u,v);
    }
    memset(d,inf,sizeof(d));
    scanf("%d%d",&s,&t);
    d[s]=0;
    memset(vv,true,sizeof(vv));
    vv[s]=false;
    q.push(node(s,d[s]));
    while(!q.empty())
    {
        now=q.top().u;q.pop();
        if(vv[now]||d[now]>=d[t]) continue;
        while(!st.empty())
        {
            vis[st.top().first][st.top().second]=false;
            st.pop();
        }
        vv[now]=true;
        dfs(now,3);
        if(now==t) break;
    }
    if(d[t]!=d[0]) printf("%d\n",d[t]);
    else printf("-1\n");
}


Measured memory_bytes: 5112
/*
  A - Trapezoids
  Contest 045
  Rakesh Kumar --> 02/08/2020
 */

#include <bits/stdc++.h>

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

    int a = 0, b = 0, h = 0;
    std::cin >> a >> b >> h;
    std::cout << (((a + b) * h) >> 1) << std::endl;

    return 0;
}


Measured memory_bytes: 3536
#include<cstdio>
#include<iostream>
#include<vector>
#include<cstring>
#include<queue>
#include<functional>
#include<cstdio>
#define rep(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define MaxCards 1000
using namespace std;
int	b, r, V;
int blue[MaxCards], red[MaxCards];
vector<int> G[MaxCards];
int match[MaxCards]; // マッチングのペア
bool used[MaxCards]; // DFSですでに調べたかのフラグ


// uからvを結ぶ辺をグラフに追加する
void add_edge(int u, int v) {
	G[u].push_back(v);
	G[v].push_back(u);
}

// 増加パスをDFSで探す
bool dfs(int v) {
	used[v] = true;
	for (int i = 0; i<G[v].size(); i++) {
		int u = G[v][i], w = match[u];
		if (w < 0 || !used[w] && dfs(w)) {
			match[v] = u;
			match[u] = v;
			return true;
		}
	}
	return false;
}

// 二部グラフの最大マッチングを求める
int bipartite_matching() {
	int res = 0;
	memset(match, -1, sizeof(match));
	for (int v = 0; v < V; v++) {
		if (match[v] < 0) {
			memset(used, 0, sizeof(used));
			if (dfs(v)) {
				res++;
			}
		}
	}
	return res;
}
int gcd(int n1, int n2){
	if (n1%n2 == 0) return n2;
	return gcd(n2, n1%n2);
}
int main(){
	while (true){
		memset(blue, 0, sizeof(blue));
		memset(red, 0, sizeof(red));
		for (int i = 0; i<MaxCards; i++){
			G[i].clear();
		}
		cin >> b >> r;
		V = b + r;
		if (b == 0)
			break;
		int idx = 0;
		for (int i = 0; i<b; i++){
			cin >> blue[i];
		}
		for (int i = 0; i<r; i++){
			cin >> red[i];
		}
		for (int i = 0; i<b; i++){
			for (int j = 0; j<r; j++){
				if (blue[i]>red[j]){
					if (gcd(blue[i], red[j]) != 1){
						add_edge(i, b + j);
					}
				}
				else if (gcd(red[j], blue[i]) != 1){
					add_edge(i, b + j);
				}
			}
		}
		cout << bipartite_matching() << endl;
	}
	return 0;
}

Measured memory_bytes: 3380
#include <iostream>

using namespace std;

int main()
{
	int n[3];
	
	for (int i=0; i<3; i++) cin >> n[i];
	
	//並べ替え
	int tmp;
	if (n[0] > n[1])
	{
		tmp = n[0];
		n[0] = n[1];
		n[1] = tmp;
	}
	if (n[1] > n[2])
	{
		tmp = n[1];
		n[1] = n[2];
		n[2] = tmp;
	}
	if (n[0] > n[1])
	{
		tmp = n[0];
		n[0] = n[1];
		n[1] = tmp;
	}
	
	for (int i=0; i<3; i++)
	{
		cout << n[i];
		if (i != 2) cout << " ";
	}
	cout << "\n";
	
	
	return 0;
}

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

int main()
{
	int x;
	cin >> x;
	if (x  == 3 || x == 5 || x == 7)
	{
		cout << "YES";
	}
	else
	{
		cout << "NO";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>
using namespace std;
typedef  long long int lint;
//typedef pair<int, int> IP;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
#define mp make_pair
#define P pair<int,int>
int main() {
	int INF = 10000000;
	int V;
	cin >> V;
	vector<vector<int>>G(V);
	rep(i, V) {
		int v, k;
		cin >> v >> k;
		v--;
		rep(j, k) {
			int tmp;
			cin >> tmp;
			tmp--;
			G[v].push_back(tmp);
		}
	}
	int start = 0;//スタート位置

	vector<int>dist(V, INF);//startからの距離を入れる配列。INF(未訪問)で初期化
	queue<int> que;

	dist[start] = 0;
	que.push(start);

	//BFS
	while (!que.empty()) {
		int v = que.front();
		que.pop();

		for (int nv : G[v]) {
			if (dist[nv] != INF)continue;
			dist[nv] = dist[v] + 1;
			que.push(nv);
		}
	}
	rep(i, V) {
		if (dist[i] == INF) {
			cout << i + 1 << ' ' << -1 << endl;
		}
		else {
			cout << i + 1 << ' ' << dist[i] << endl;
		}
	}
}


Measured memory_bytes: 3120
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<int, pair<int, int>> PP;
typedef pair<P, int> PPi;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

int h, w;
vector<string> s;
vector<vector<int>> dp(55, vector<int>(55, INF));
constexpr int dx[4] = {1, 0, -1, 0};
constexpr int dy[4] = {0, 1, 0, -1};

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

    cin >> h >> w;
    s.resize(h);
    for(int i = 0; i < h; ++i)  cin >> s[i];
    dp[0][0] = 0;
    queue<P> que;
    que.push(P(0, 0));
    while(!que.empty()){
        P p = que.front();
        que.pop();
        int x = p.first, y = p.second;
        for(int i = 0; i < 4; ++i){
            int nx = x + dx[i], ny = y + dy[i];
            if(nx < 0 || nx >= h || ny < 0 || ny >= w)  continue;
            if(s[nx][ny] == '#')    continue;
            if(dp[nx][ny] > dp[x][y] + 1){
                dp[nx][ny] = dp[x][y] + 1;
                que.push(P(nx, ny));
            }
        }
    }
    if(dp[h - 1][w - 1] == INF){
        cout << -1 << endl;
        return 0;
    }
    int cnt = 0;
    for(int i = 0; i < h; ++i){
        for(int j = 0; j < w; ++j){
            if(s[i][j] == '#')  ++cnt;
        }
    }
    int ans = h * w;
    ans -= cnt + dp[h - 1][w - 1] + 1;
    cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define INF 1e9+7
#define rep(i,n) for(ll i=0;i<n;i++)
#define pii pair<int,int>
#define pll pair<ll,ll>
const int maxn = 200000;
ll mod = INF;

ll n;
ll a[maxn];
ll sum=0;
map<ll,ll> m;

int main(){
    cin >> n;
    rep(i,n){
        cin >> a[i];
        m[a[i]]++;
    }

    for(auto ite=m.begin();ite!=m.end();ite++){
        ll k=ite->second;
        sum+=k*(k-1)/2;
    }
    //cout << "sum="<<sum<<endl;
    rep(i,n){
        ll k=a[i];
        if(m[k]==1){
            cout << sum<<endl;
        }else if(m[k]==2){
            cout << sum-1<<endl;
        }else{
            cout << sum-(m[k]-1)<<endl;
        }
    }
    return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++)cin >> a[i];
  int sum=0;
  for(int i=0;i<n;i++){
    sum+=a[i]-2*a[i]*(i%2);
  }
  cout << sum << " ";
  for(int i=1;i<n;i++){
    sum=-sum+2*a[i-1];
    cout << sum << " ";
  }
}

Measured memory_bytes: 1664
import sys


fin = sys.stdin.readline
N = int(fin())
a_list = [int(elem) for elem in fin().split()]
b_list = [int(elem) for elem in fin().split()]
sum_diff = sum(b_list) - sum(a_list)
if sum_diff < 0:
    print("No")
    exit(0)

diffs = [b - a for a, b in zip(a_list, b_list) if b - a > 0]

num_ops = 0
for diff in diffs:
    num_ops += (diff + 1) // 2

if num_ops > sum_diff:
    print("No")
else:
    print("Yes")


Measured memory_bytes: 41200
import sys
input = sys.stdin.readline

import itertools

N = int(input())

A = [1,2,4]
for _ in range(12):
    sum_2 = set(x+y for x,y in itertools.combinations(A,2))
    avoid = set(x-y for x,y in itertools.product(sum_2,A))
    x = min(set(range(1,1000)) - avoid - sum_2 - set(A))
    A.append(x)

L = [[0] * (N-1-i) for i in range(N)]

x = 1
for n in range(N):
    L[n] = [x*a for a in A[:N-1-n]]
    if n < N-2:
        x = L[n][-1] + L[n][-2]

graph = [[0] * N for _ in range(N)]
for i in range(N):
    for j,x in enumerate(L[i]):
        graph[i][i+j+1] = x
        graph[i+j+1][i] = x

for row in graph:
    print(*row)

Measured memory_bytes: 3188
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<stack>
#include<queue>
#include<bitset>

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

using namespace std;

typedef long long int lli;
typedef long long ll;
typedef vector<int> vi;

int n, ax, bx, cx;
vi l;
int INF = pow(10, 9);

int dfs(int cur, int a, int b, int c) {
	int ret0, ret1, ret2, ret3;
	if (cur == n) {
		if (min(min(a, b), c) > 0) {
			return  abs(a - ax) + abs(b - bx) + abs(c - cx) - 30;
		}
		else {
			return INF;
		}
	}
	ret0 = dfs(cur + 1, a, b, c);
	ret1 = dfs(cur + 1, a + l[cur], b, c) + 10;
	ret2 = dfs(cur + 1, a, b + l[cur], c) + 10;
	ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10;

	return min(min(ret0, ret1), min(ret2, ret3));

}

int main() {
	int i, j;

	cin >> n;
	l.resize(n);

	cin >> ax >> bx >> cx;
	rep(i, n) {
		cin >> l[i];
	}

	cout << dfs(0, 0, 0, 0);

	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}

	static class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			int W = in.nextInt();
			int a = in.nextInt();
			int b = in.nextInt();
			if(a <= b && b <= a + W || a <= b + W && b + W <= a) {
				out.println(0);
			} else {
				out.println(a < b ? b - (a + W) : a - (b + W));
			}
		}
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public char nextChar() {
			return next().charAt(0);
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

	}
}


Measured memory_bytes: 23252
//
//  main.cpp
//  Test
//
//  Created by Nag on 2017/08/18.
//  Copyright ?? 2017??´ Nag. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <vector>
#include <sstream>
#include <string>
#include <cstdio>

using namespace std;

int main(void) {
    double a, b, c, x;
    double S, L, h;
    
    cin >> a >> b >> x;
    
    x = x/360 * 2 * M_PI; // ??????rad?????????
    h = b * sin(x);
    c = sqrt( a*a + b*b - 2*a*b*cos(x) );
    L = a + b + c;
    S = a*h/2;
    
    cout << setprecision(5) << fixed << S << endl;
    cout << fixed << setprecision(5) << L << endl;
    cout << fixed << setprecision(5) << h << endl;
    
    return 0;
    
}

Measured memory_bytes: 3668
//#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<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);

	string S;
	cin >> S;

	rep(i, 0, SZ(S))
	{
		cout << 'x';
	}

	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる




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

  queue <pair<string,int>> que;
  auto x=mp("a",1);
  que.push(x);
  while(1){
    string s=que.front().fi;
    int p=que.front().se;
    que.pop();
    if(s.size()==n) cout << s << endl;
    if(s.size()>n) break;
    for(char c='a';c<'a'+p;c++){
      string t=s+c;
      auto z=mp(t,p);
      que.push(z);
    }
    char y='a'+p;
    string t=s+y;
    auto z=mp(t,p+1);
    que.push(z);
  }

}

Measured memory_bytes: 55188
#include <iostream>
#include <string>
#include <vector>
#include <cassert>

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

using namespace std;

void c_3_4() {
	int n;
	int minj;
	int count;

	cin >> n;
	vector<int> a(n);
	REPEAT(i, n) {
		cin >> a[i];
	}

	count = 0;
	FOR(i, 0, n) {
		minj = i;
		FOR(j, i + 1, n) {
			if (a[j] >= a[minj]) {
				continue;
			}
			minj = j;
		}
		if (minj == i) {
			continue;
		}
		swap(a[i], a[minj]);
		++count;
	}

	REPEAT(k, a.size())
	{
		cout << (k ? " " : "") << a[k];
	}
	cout << endl;
	cout << count << endl;
}

int main() {
	ios::sync_with_stdio(false);
	c_3_4();
	return 0;
}



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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
ll P,A[3333];
ll inv[3333];
ll poly[3333];
ll C[3333][3333];
ll i, j, k, ans;


ll moddiv(ll a,ll b){
    a %= P;
    b %= P;
    for(ll m=P-2;m>0;m/=2){
        if(m&1){
            a=a*b%P;
        }
        b=b*b%P;
    }
    return a;
}
int main(){
    scanf("%lld", &P);
    fornum(i,0,P){
        scanf("%lld", &A[i]);
    }
    C[0][0] = 1;
    fornum(i,0,P){
        C[i+1][0] = 1;
        fornum(j,0,P){
            C[i + 1][j + 1] = (C[i][j] + C[i][j + 1]) % P;
        }
    }

    fornum(i,0,P){
        if(A[i]==0)
            continue;
        ll a = 1;
        fornum(j,0,P){
            if(j%2)
                poly[P - 1 - j] = (poly[P - 1 - j] + C[P - 1][j]*a) % P;
            else
                poly[P - 1 - j] = (poly[P - 1 - j] + (P - C[P - 1][j])*a) % P;
            a = (a * i) % P;
        }
        poly[0] = (poly[0] + 1) % P;
    }
    fornum(i,0,P){
            printf("%lld ", poly[i]);
        }
}

Measured memory_bytes: 80256
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

d = {}
for i in range(200002):
	d[i]={}

n,m = readInts()
ab = [readInts() for i in range(m)]
for i in ab:
	d[i[0]][i[1]]=1

for i in d[1]:
	if n in d[i]:
		print("POSSIBLE")
		exit()

print("IMPOSSIBLE")

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

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

    int tmp = b;
    unsigned digit = 0;
    while(tmp!=0){
        tmp /= 10;
        digit += 1;
    }

    int num = (a * pow(10, digit)) + b;
    
    for (int i = 1; i < 400; i++) {
        if((i * i) == num) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

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

int main(){
  int n, k;
  cin >> n >> k;
  int ans = 0, x;
  for ( int i = 0; i < n; i++){
    cin >> x;
    if ( x  >= k){
      ans++;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
import java.io.*
import java.util.*
import java.lang.*
import java.lang.Math.*


fun bitFS(N: Int, X: Int, Y: Int): Int {
    var res = INF

    for (p in 0 until (0b01 shl N)) {
        var ptn = p

        //for (i in 0 until N) {
            var cnt = 0
            var x = X
            var y = Y

            if ((ptn and 0b01) == 1) {
                x *= -1
                cnt++
            }

            /*if (x <= y) {
                cnt += (y - x)
            }*/

            if (((ptn and 0b10) shr 1) == 1) {
                y *= -1
                cnt++
            }

            if (x <= y) {
                cnt += (y - x)
                res = min(res, cnt)
            }

            //ptn = ptn shr 1
        //}
    }

    return res
}

fun solve() {
    val (X, Y) = rd.readIntArray()
    
    val ans = bitFS(4, X, Y)

    println(ans)
}


//val rd = debug.Reader("agc", "008", "a", "sample-1")
val rd = Reader()


fun main(args: Array<String>) {
    try {
        var exception: Throwable? = null
        val sth = Thread(null, SolveThread(), "solveThread", 128 * 1024 * 1024)
        sth.setUncaughtExceptionHandler { _, e -> exception = e }
        sth.start(); sth.join()
        if (exception != null) throw exception!! }
    catch (e: Exception) { throw e }
    finally { rd.close() }
}
const val MOD = 1_000_000_007L; const val INF = Int.MAX_VALUE/2; const val LINF = Long.MAX_VALUE/2
data class IntPair(val first: Int, val second: Int)
val errPrintln: (Any) -> Unit = { msg -> System.err.println(msg) }
fun rAssert(exp: Boolean, lazyMsg: () -> String = {""}) {
    if (!exp) { val msg = lazyMsg(); errPrintln("EAssert Error: $msg"); throw Error(msg) }
}
fun tAssert(exp: Boolean, lazyMsg: () -> String = {""}) {
    if (!exp) { val msg = lazyMsg(); errPrintln("TAssert Error: $msg"); Thread.sleep(3000) }
}
class SolveThread : Runnable {
    override fun run() { solve() }
}
class Reader {
    private val br = BufferedReader(InputStreamReader(System.`in`))
    val readString: () -> String = { br.readLine() }
    val readInt: () -> Int = { br.readLine().toInt() }
    val readLong: () -> Long = { br.readLine().toLong() }
    val readIntArray: () -> IntArray = { br.readLine().split(' ').map { it.toInt() }.toIntArray() }
    val readLongArray: () -> LongArray = { br.readLine().split(' ').map { it.toLong() }.toLongArray() }
    val readListInt: () -> List<Int> = { br.readLine().split(' ').map { it.toInt() } }
    val readListLong: () -> List<Long> = { br.readLine().split(' ').map { it.toLong() } }
    val readListIntCol: (Int) -> List<Int> = { N -> (0 until N).map { readInt() } }
    val readListLongCol: (Int) -> List<Long> = { N -> (0 until N).map { readLong() } }
    val close: () -> Unit = { br.close() }
    protected fun finalize() { close() }
}


Measured memory_bytes: 36784
import java.util.Scanner;

/**
 *
 * @author Masaya Misaizu
 */
public class Main {
    private static int error =-1;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        if(a> Math.pow(10,6))
           {
               System.out.println(error);
               System.exit(0);
           }
        int b = sc.nextInt();
            if(b> Math.pow(10,4))
            {
                System.out.println(error);
                System.exit(0);
            }
        int sum = 0;
        for (int i = 0; i < b ; i++) {
            int c = sc.nextInt();
            if(c> Math.pow(10,4))
               {
                   System.out.println(error);
                   System.exit(0);
               }
            if(a>=sum)
                {
                    sum+=c;
                }
            else
                break;
            }
        if(a < sum){
            System.out.println(error);
        }
        else
            System.out.println(a-sum);
            
    

            }
}


Measured memory_bytes: 46168
h,w=map(int,input().split())
grid=[]
for _ in range(h):
    s=input()
    g=[0 if i=='#' else 1 for i in s]
    grid.append(g)
toL=[]
toR=[]
toU=[]
toD=[]
for i in range(h):
    tmpL=[]
    tmpR=[]
    tmpU=[]
    tmpD=[]
    for j in range(w):
        if grid[i][j]==0:
            tmpU.append(0)
        elif i==0:
            tmpU.append(1)
        else:
            tmpU.append(toU[i-1][j]+1)
        if grid[-i-1][j]==0:
            tmpD.append(0)
        elif i==0:
            tmpD.append(1)
        else:
            tmpD.append(toD[i-1][j]+1)
        if grid[i][j]==0:
            tmpL.append(0)
        elif j==0:
            tmpL.append(1)
        else:
            tmpL.append(tmpL[-1]+1)
        if grid[i][-j-1]==0:
            tmpR.append(0)
        elif j==0:
            tmpR.append(1)
        else:
            tmpR.append(tmpR[-1]+1)
    toL.append(tmpL)
    toR.append(tmpR[::-1])
    toU.append(tmpU)
    toD.append(tmpD)
toD=toD[::-1]
ans=0
for i in range(h):
    for j in range(w):
        ans=max(ans, toU[i][j]+toD[i][j]+toR[i][j]+toL[i][j]-3)
print(ans)

Measured memory_bytes: 203912
#include<stdio.h>
int main(){
	int c,d,m=100000;
	scanf("%d",&d);
	for(c=0;c<d;c++){
		m*=1.05;
		m=(m%1000)?(m/1000+1)*1000:m;
	}
	printf("%d\n",m);
	return 0;
}

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

int main(){
  int n, a;
  cin >> n >> a;
  if((n%500) <= a){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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


Measured memory_bytes: 384
n, w = map(int ,input().split())
items = []
for i in range(n):
    array = list(map(int, input().split()))
    items.append(array)
# dp = np.zeros((n+1, w+1))
dp = [[0 for _ in range(w+1)] for _ in range(n+1)]

for i in range(1, n+1):
    weight = items[i-1][0]
    for j in range(0, w+1):
        if j >= weight:
            dp[i][j] = max((dp[i - 1][j - weight] + items[i - 1][1]), dp[i - 1][j])
        else:
            dp[i][j] = dp[i-1][j]


print(int(dp[i][j]))

Measured memory_bytes: 171656
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e3 + 5, mod = 1e9 + 7;

ll n, dp[N][N];
pair<ll, ll> p[N];

ll solve(int idx, int mn, int mx){
    if(idx == n) return 0;
    if(dp[idx][mn] != -1) return dp[idx][mn];
    ll op1 = solve(idx + 1, mn + 1, mx) + abs(mn - p[idx].second) * p[idx].first;
    ll op2 = solve(idx + 1, mn, mx - 1) + abs(mx - p[idx].second) * p[idx].first;
    return dp[idx][mn] = max(op1, op2);
}

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> p[i].first;
        p[i].second = i + 1;
    }
    sort(p, p + n);
    for(int i = 0; i < n / 2; i++){
        swap(p[i], p[n - 1 - i]);
    }
    memset(dp, -1, sizeof dp);
    cout << solve(0, 1, n);


    return 0;

}




Measured memory_bytes: 35236
#include <stdio.h>

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

  scanf("%d", &n);

  for(i=0; i<n; i++){

    scanf("%d %d %d", &a, &b, &c);

    if((a*a) == (b*b+c*c) || (b*b) == (c*c+a*a) || (c*c) == (a*a+b*b))
      printf("YES\n");
    else
      printf("NO\n");
  }

  return 0;
}

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

int main(){
int x;
cin>>x;
if(x==0){
    cout<<1;
    return 0;
}else{
    cout<<0;
}
}

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

typedef long long ll;
using namespace std;

#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) for(ll i = 0; i < (ll)n; i++)
#define _repi(i, s, n) for(ll i = (ll)(s); i < (ll)n; i++)
#define REP(...) _overload(__VA_ARGS__, _repi, _rep,)(__VA_ARGS__)
#define all(v) (v).begin(),(v).end()
#define UNIQUE(v) (v).erase( unique( all(v) ), (v).end() );
#define MOD 1000000007

ll dp[10001];

int main(){
	ll h, n;	cin >> h >> n;
	pair<ll, ll> magic[n];
	REP(i, n){
		cin >> magic[i].first >> magic[i].second;
	}

	REP(i, h+1)	dp[i] = -1;
	dp[0] = 0;
	REP(i, 1, h+1){
		REP(j, n){
			ll tmp = (i / magic[j].first) * magic[j].second;
			if( i % magic[j].first )	tmp += magic[j].second;
			if( tmp != 0 ){
				if( dp[i] == -1 )	dp[i] = tmp;
				else				dp[i] = min(dp[i], tmp);
			}

			if( i - magic[j].first >= 0 ){
				if( dp[i] == -1 )	dp[i] = dp[i - magic[j].first] + magic[j].second;
				else				dp[i] = min(dp[i], dp[i - magic[j].first] + magic[j].second);
			}
		}
	}

	cout << dp[h] << endl;

	return 0;
}


Measured memory_bytes: 3692
#include <iostream>
#include <math.h>
#include <stdio.h>

using namespace std;

int main() {
    double r;
    cin >> r;

    double circle, area;
    circle = r * 2 * M_PI;
    area = r * r * M_PI;

    printf("%lf %lf\n", area, circle);

    return 0;
}


Measured memory_bytes: 3208
#include <iostream>
#define M_MAX 1000000
using namespace std;

int main(){
  int n,i,k,c[M_MAX+1];
  bool flag=true;
  cin >> n;
  c[0]=n;
  for(i=0;flag;i++){
    if(c[i]%2==0)c[i+1]=c[i]/2;
    else c[i+1]=3*c[i]+1;
    for(k=0;k<i;k++){
      if(c[k]==c[i+1]){
       flag=false; break;
      }
    }
  }
  
  cout << i+1 << endl;
  return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<utility>
#include<map>
#include<set>
#include<string>

using namespace std;
#define ll long long

int main(){
    ll N,M;
    ll res=0;
    cin >> N >> M;
    vector<int>p(M+2);
    vector< vector<int> > s(M);
    for(int i=0; i < M;i++){
        int k;
        cin >> k;
        for(int j=0; j < k; j++){
            int a;
            cin >> a;
            s[i].push_back(a-1);
        }
    }
    for(int i=0; i < M; i++){
        cin >> p[i];
    }
    

    for(int bit = 0; bit < (1<<N); bit++){
        bool ok = true;
        for (int i = 0; i < M; ++i) {
            int con = 0;
            for (auto v : s[i]) {
                if (bit & (1<<v)) ++con;
            }
            if (con % 2 != p[i]) ok = false;
        }
        if (ok) ++res;
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll mod=1e9+7;
int dy[]={1,-1,0,0};
int dx[]={0,0,1,-1};

int main(){
  int N,K;
  cin>>N>>K;
  int a;
  vector<int> cnt(200005);
  for(int i=0;i<N;i++){
    cin>>a;
    cnt[a]++;
  }
  sort(cnt.rbegin(),cnt.rend());
  int ans=0;
  for(int i=K;i<=N;i++){
    ans+=cnt[i];
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
int N, X[50], Y[50], sx, sy; double gx, gy;
int main() {
	scanf("%d", &N);
	for(int i = 0; i < N; i++) {
		scanf("%d%d", &X[i], &Y[i]);
		sx += X[i];
		sy += Y[i];
	}
	gx = 1.0 * sx / N;
	gy = 1.0 * sy / N;
	if(N % 2 == 1) {
		printf("NA\n");
	}
	else {
		bool flag = true;
		for(int i = 0; i < N / 2; i++) {
			flag = flag && ((gx - X[i]) * 2 == (X[N / 2 + i] - X[i]) && (gy - Y[i]) * 2 == (Y[N / 2 + i] - Y[i]));
		}
		if(flag) {
			printf("%.9f %.9f\n", gx, gy);
		}
		else {
			printf("NA\n");
		}
	}
	return 0;
}

Measured memory_bytes: 2752
#include <iostream>
#include <iosfwd>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cassert>
#include <cctype>
#include <climits>
#include <vector>
#include <bitset>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <deque>
#include <string>
#include <list>
#include <iterator>
#include <sstream>
#include <complex>
#include <fstream>
#include <functional>
#include <numeric>
#include <utility>
#include <algorithm>
#include <assert.h>
#include <unordered_map>

using namespace std;
const int N = 6e5 + 500;
const int LN = 21;
const long long mod = 1e9 + 7;
const long long INF = 1LL << 57;

long long n, m, u, v, k, t, q, a, x, d, b, c, p;



bool vis[N];
int P[N];
int depth[N];
int odeg[N];

vector <int> adj[N];

set <pair <int, int> > res;

set <pair <int, int> > sol;

void dfs(int v, int p, int dep) {
   P[v] = p;
   
   depth[v] = dep;
   vis[v] = true;
   
   for (int u: adj[v]) {
      if (u == p) continue;
      if (vis[u]) {
         if (v < u) {
            odeg[u]++;
            sol.insert(make_pair(u, v));
         }
         continue;
      }
      odeg[v]++;
      dfs(u, v, dep + 1);
      sol.insert(make_pair(v, u));
   }
}

int main() {
   ios::sync_with_stdio(false);cin.tie(0);
   cin >> n >> m;
   
   if (m % 2 == 1) {
      cout << -1 << endl;
      return 0;
   }
   
   for (int i = 1; i <= m; ++i) {
      cin >> u >> v;
      adj[u].push_back(v);
      adj[v].push_back(u);
   }
   
   
   dfs(1, 0, 0);
   
   for (int i = 1; i <= n; ++i) {
      res.insert(make_pair(-depth[i], i));
   }
   
   while (res.size() > 0) {
      int v = (*res.begin()).second;
      res.erase(res.begin());
      //cout << v << " " << odeg[v] << endl;
      if (odeg[v] % 2 == 0) continue;
      if (P[v] == 0) {
         cout << -1 << endl; return 0;
      }
      sol.erase(make_pair(P[v], v));
      sol.insert(make_pair(v, P[v]));
      odeg[v]++;
      odeg[P[v]]--;
   }
   
   
   for (auto u: sol) {
      cout << u.first << " " << u.second << '\n';
   }
}







Measured memory_bytes: 43904
from __future__ import print_function
# import numpy as np
# import numpypy as np
import sys
input = sys.stdin.readline

def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd

def lcm(n,m):
    return int(n*m/gcd(n,m))

import re
import array
import copy
import functools
import operator

import collections
import itertools
import bisect
import heapq


from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace

from queue import PriorityQueue as pq

def reduce(p, q):
    common = fractions.gcd(p, q)
    return (p//common , q//common )
# from itertools import accumulate
# from collections import deque

import random


def main():
    H,W = map(int, input().strip().split()) # H行 W列
    G=[]
    for i_row in range(H):
        G.append(input().strip())
    eprint("graph G:")
    eprint(G)

    l_flag_row_all_dot_flag=[ 1 for _ in range(H) ]
    for i_row in range(H):
        for j_col in range(W):
            if G[i_row][j_col]!=".":
                l_flag_row_all_dot_flag[i_row]=0


    l_flag_col_all_dot_flag=[ 1 for _ in range(W) ]
    for j_col in range(W):
        for i_row in range(H):
            if G[i_row][j_col]!=".":
                l_flag_col_all_dot_flag[j_col]=0

    for i_row in range(H):
        if l_flag_row_all_dot_flag[i_row]==1:
            continue
        for j_col in range(W):
            if l_flag_col_all_dot_flag[j_col]==1:
                continue
            print(G[i_row][j_col],end="")
        print()






    # for i_row in range(H):      # H is length of row
    #     if G[i_row] == str(["."* W ]):
    #         G.pop(i_row)

    # all_dot_flag=1
    # for j_col in range(W):      # W は列の長さ
    #     for i_row in range(H):  # H は行の長さ
    #         G[i_row][j_col] != "."
    #         failure_flag=0
    #     if all_dot_flag==1:
    #         for ii in range(H):
    #             G.pop()
    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 70356
import Control.Monad
import qualified Data.ByteString.Char8 as BS
import Data.List
import Data.Maybe
import Data.Ord
import qualified Data.Vector as VC
import qualified Data.Vector.Mutable as VM

readNums = map (read . show . fst . fromJust . BS.readInteger) . BS.words <$> BS.getLine

readNumLists :: Int -> IO [[Integer]]
readNumLists n = replicateM n (map (read . show . fst . fromJust . BS.readInteger) . BS.words <$> BS.getLine)

readStrings :: IO [String]
readStrings = map BS.unpack . BS.words <$> BS.getLine

readStringLists :: Int -> IO [[String]]
readStringLists n = replicateM n (map BS.unpack . BS.words <$> BS.getLine)

toTuple :: [a] -> (a, a)
toTuple (x:y:_) = (x, y)

p s = putStr (show s ++ " ")

main :: IO ()
main = do
  (n:k:s:_) <- readNums
  mapM_ p (solve (fromIntegral n) (fromIntegral k) s)

solve :: Int -> Int -> Integer -> [Integer]
solve n k s
  | s < 10 ^ 9 = take n (replicate k s ++ repeat (s + 1))
  | otherwise = take n (replicate k s ++ repeat 1)

Measured memory_bytes: 2044
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long n,m,mod=1e9+7;
  cin >> n >> m;
  long long a[m],b[n+1]={},dp[n+2]={};
  for(int i=0;i<m;i++){
    cin >> a[i];
    b[a[i]]=-1;
  }
  dp[0]=1;
  for(int i=0;i<n;i++){
    if(b[i+1]!=-1){
      dp[i+1]+=dp[i];
      dp[i+1]%=mod;
    }
    if(b[i+2]!=-1){
      dp[i+2]+=dp[i];
      dp[i+2]%=mod;
    }
  }
  cout << dp[n] << endl;
  return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define re register
inline int read(){
	re int t=0;
	re char v=getchar();
	while(v<'0')v=getchar();
	while(v>='0'){
		t=(t<<3)+(t<<1)+v-48;
		v=getchar();
	}
	return t;
}
using namespace std;
int n,x,y,m,k,a[100002],b[100002],c[100002],l;
long long ans;
signed main(){
	x=read();y=read();
	n=read();	m=read();	k=read();for(re int i=1;i<=n;++i)a[i]=read();sort(a+1,a+n+1);x=n-x+1;
for(re int i=1;i<=m;++i)b[i]=read();sort(b+1,b+m+1);y=m-y+1;
for(re int i=1;i<=k;++i)c[i]=read();sort(c+1,c+k+1);
	l=k;b[m+1]=a[n+1]=1e9;
	while(l){
		if(a[x]<b[y]&&x<=n){
			if(c[l]>a[x])ans+=c[l],--l,++x;
			else break;
		}
		else if(y<=m){
			if(c[l]>b[y])ans+=c[l],--l,++y;
			else break;
		}
		else break;
	}
	for(re int i=x;i<=n;++i)ans+=a[i];
	for(re int i=y;i<=m;++i)ans+=b[i];
	printf("%lld",ans);
}

Measured memory_bytes: 1408
while True:
    re=input()
    if re=="0":
        break
    
    a=0
    b=0
    n=len(re)-1
    
    for i in range(n):
        if re[i+1]=="A":
            a+=1
        else:
            b+=1
    
    if a>b:
        a+=1
    else:
        b+=1
    
    print(a, b)


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

int main() {
	int n, point[100];

	while (cin >> n && n != 0) {
		for (int i = 0; i < n; i++) {
			cin >> point[i];
		}
		sort(&point[0], &point[n]);

		int sum = 0;
		for (int i = 1; i < n - 1; i++) {
			sum += point[i];
		}
		cout << sum / (n - 2) << '\n';
	}

	return 0;
}

Measured memory_bytes: 1176
#include<bits/stdc++.h>
//macros
using namespace std;
typedef long long ll;
typedef pair<int, int > Pii;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
typedef vector<ll> Vll;
#define pb push_back
#define rs resize 
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define repll(i, a, b) for(ll i=(a); i<(b); i++)
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define COUT(a) cout << a << endl
#define ALL(a) (a).begin(),(a).end()
const long long int mod = 1e9 + 7;


int main(){
    string S,Sd,T;
    bool flag;
    int res=-1;
    cin >> Sd >> T;
    S = Sd;
    rep(i,0,Sd.size()-T.size()+1){
        rep(j,0,T.size()){
            if(Sd[i+j] != T[j] && Sd[i+j] != '?') break;
            if(j==T.size()-1) flag=true;
        }
        if(flag){
            res = i;
            flag = false;
        }
    }
    if(res!=-1){
        rep(i,0,Sd.size()){
            if(i<res || res+T.size()<=i){
                if(S[i]=='?') S[i] = 'a';
            }else{
                S[i] = T[i-res];
            }
        }
    }

    if(res!=-1) COUT(S);
    else COUT("UNRESTORABLE");
}

Measured memory_bytes: 256