akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
using namespace std;
 
typedef tree<pair<long long,int>, null_type, less<pair<long long,int>>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;
 
#define f first
#define se second
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define pi pair<int, int>
#define all(num) num.begin(), num.end()
#define lp(i, nodess) for (int i = 0; i < nodess; i++)
#define mem(u, vis) memset(u, vis, sizeof(u))
#define X real()
#define Y imag()
#define angle(u) (atan2(u.Y, u.X))
#define vec(u, v) ((v) - (u))
//#define length(u) (hypot(u.Y , u.X))
#define normalize(u) (u) / length(u)
#define dotP(u, v) ((conj(u) * v).X)
#define crossP(u, v) ((conj(u) * v).Y)
#define same(p1, p2) (dotP(vec(p1, p2), vec(p1, p2)) < EPS)
#define lengthSqr(u) dotP(u, u)
#define rotate0(p, ang) ((p)*exp(point(0, ang)))
#define rotateA(p, ang, about) (rotate0(vec(about, p), ang) + about)
#define reflect0(vis, m) conj(vis / m) * m
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
const double PI = acos(-1.0);
const double EPS = (1e-10);
const long long int INF = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
typedef long long int ll;
typedef unsigned long long ull;
typedef complex<double> point;
long long fastpow(ll nodess, ll num, ll m) {
  if (!num)
    return 1;
  if (num % 2)
    return nodess * fastpow(nodess, num - 1, m)%m;
  ll p = fastpow(nodess, num / 2, m);
  p %= m;
  p *= p;
  p %= m;
  return p;
}
 
ll my_mod(ll num, ll mod) {
  ll reto = num % mod;
  while (reto < 0)
    reto += mod;
  return reto;
}
 
ll gcd(ll u, ll v) { return !u ? v : gcd(v % u, u); }
/*long long dist(pair<ll, ll> u, pair<ll, ll> v) {
  return 
      abs(u.f - v.f)  + abs(u.se - v.se);
}*/
long long getDist(pair<ll, ll> &u, pair<ll, ll> &v) {
  return 
     (u.f - v.f)*(u.f - v.f)  + (u.se - v.se)*(u.se-v.se);
}
 
 
 
/*vector<int> ap;
int np[MX+5];
void s(){
    mem(np , 1);
    np[1] = np[0] = 0;
    for(ll i = 2 ; i*i<= MX ;i++){
        if(np[i]){
            for(ll j= i*i ; j <=MX; j+=i) np[j] = 0;
        }
    }
    int idx = 1;
    for(ll i = 2 ; i<= MX ; i++){
		if(np[i]){
			np[i] = idx;
			idx++; 
			ap.pb(i);
		}
	}
	//cout<<idx;
}*/

#define int ll
const int MX = 1e3 +9;

int32_t main(){
    IO;
	string s;
	cin>>s;
	if(s.size()%2) return cout<<"No\n",0;
	for(int i = 0; i < s.size(); i+=2){
		if(s[i] != 'h' || s[i+1] != 'i') return cout<<"No\n",0;
	}
	cout<<"Yes\n";
	return 0;
}


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

using namespace std;
using ll=long long;

void solve() {
    int n; cin >> n;
    vector<int> a(n);
    for (auto& x: a) {
        cin >> x;
    }
    sort(a.begin(), a.end(), greater<int>());

    if (n&1) {
        int k = n/2;
        ll sum = 0;
        for (int i = 0; i < k; i++) {
            sum += a[i]<<1;
        }
        for (int i = k; i < n; i++) {
            sum -= a[i]<<1;
        }
        sum += a[k] + a[k+1];
        
        ll sum2 = 0;
        for (int i = 0; i <= k; i++) {
            sum2 += a[i]<<1;
        }
        for (int i = k+1; i < n; i++) {
            sum2 -= a[i]<<1;
        }
        sum2 -= a[k-1] + a[k];
        cout << max(sum, sum2);
    } else {
        int k = n/2;
        ll sum = 0;
        for (int i = 0; i < k; i++) {
            sum += a[i]<<1;
        }
        for (int i = k; i < n; i++) {
            sum -= a[i]<<1;
        }
        sum -= a[k-1];
        sum += a[k];
        cout << sum;
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


Measured memory_bytes: 640
#include<stdio.h>
int main(void){
	int N,i,j,cnt=0,max,a[101];
	scanf("%d",&N);
	for(i=0;i<N;i++){scanf("%d",&a[i]);}
	for(i=0;i<N;i++){
		for(max=0,j=0;j<N;j++){if(a[max]<a[j]){max=j;}}
		cnt+=i%2==0?a[max]:-a[max];
		a[max]=0;
	}
	printf("%d",cnt);
	return 0;
}

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

int main(){
  string S;
  cin >> S;
  int64_t ans=0;
  int count=0;
  for(int i=0;i<S.size();i++){
    if(S.at(i)=='B'){
      count++;
    }else{
      ans+=count;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main() {
    cin.tie(nullptr); ios::sync_with_stdio(false);
    string N; cin >> N;
    int K; cin >> K;
    Int ans = 0;
    if (K == 1) {
        for (int i = 0; i < N.size(); i++) {
            if (i == 0) ans += N[i] - '0';
            else ans += 9;
        }
    } else if (K == 2) {
        for (int i = 0; i < N.size(); i++) {
            bool z = true;
            for (int j = i + 1; j < N.size(); j++) {
                if (i == 0 && z) {
                    ans += 1 * (N[j] - '0');
                    ans += (N[i] - '0' - 1) * 9;
                } else if (i == 0) {
                    ans += (N[i] - '0') * 9;
                } else {
                    ans += 9 * 9;
                }
                if (N[j] != '0') z = false;
            }
        }
    } else if (K == 3) {
        for (int i = 0; i < N.size(); i++) {
            bool z0 = true;
            for (int j = i + 1; j < N.size(); j++) {
                bool z1 = true;
                for (int k = j + 1; k < N.size(); k++) {
                    if (i == 0 && z0 && z1) {
                        ans += 1 * (N[j] != '0') * (N[k] - '0');
                        ans += 1 * (N[j] != '0' ? N[j] - '0' - 1 : 0) * 9;
                        ans += (N[i] - '0' - 1) * 9 * 9;
                    } else if (i == 0 && z0) {
                        ans += 1 * (N[j] != '0') * 9;
                        ans += 1 * (N[j] != '0' ? N[j] - '0' - 1 : 0) * 9;
                        ans += (N[i] - '0' - 1) * 9 * 9;
                    } else if (i == 0) {
                        ans += (N[i] - '0') * 9 * 9;
                    } else {
                        ans += 9 * 9 * 9;
                    }
                    if (N[k] != '0') z1 = false;
                }
                if (N[j] != '0') z0 = false;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
/* In the name of Allah */
#include<bits/stdc++.h>
using namespace std;

int main() {
	long n;
	cin >> n;
	deque<int> dq;
	int mn = 1, mx = 100;
	for (n++; n > 1; n >>= 1) {
		if (n & 1)
			dq.push_back(mx--);
		dq.push_back(mn++);
	}
	for (int i = 100; i; i--)
		if (i > mx || i < mn)
			dq.push_front(i);
	cout << dq.size() << endl;
	for (auto x: dq)
		cout << x << ' ';
}


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

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        List<Integer> R = new ArrayList<Integer>();
        List<Integer> B = new ArrayList<Integer>();
        for(int i = 0; i < N; i++){
            int x = sc.nextInt();
            int y = sc.nextInt();
            R.add(x * 1000 + y);
        }
        for(int i = 0; i < N; i++){
            int x = sc.nextInt();
            int y = sc.nextInt();
            B.add(x * 1000 + y);
        }
        Collections.sort(R);
        Collections.sort(B);
        int ans = 0;
        Integer tmp;
        for(Integer b : B){
            tmp = -1;
            for(Integer r : R){
                if(r/1000 < b/1000 && r%1000 < b%1000 && tmp%1000 < r%1000) tmp = r;
            }
            if(R.contains(tmp)){
                ans++;
                R.remove(tmp);
            }
        }
        System.out.println(ans);
        sc.close();

    }

}


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

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> s(h);
  for(int i = 0; i < h; i++) cin >> s.at(i);
  
  int l[2010][2010], r[2010][2010], u[2010][2010], d[2010][2010];
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      if(s.at(i).at(j) == '.'){
        if(j == 0) l[i][j] = 1;
        else l[i][j] = l[i][j-1] + 1;
        if(i == 0) u[i][j] = 1;
        else u[i][j] = u[i-1][j] + 1;
      }
      int x = w - 1 - j, y = h - 1 - i;
      if(s.at(y).at(x) == '.'){
        if(y == h-1) d[y][x] = 1;
        else d[y][x] = d[y+1][x] + 1;
        if(x == w-1) r[y][x] = 1;
        else r[y][x] = r[y][x+1] + 1;
      }
    }
  }
  
  int ans = 0;
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      int now = l[i][j] + r[i][j] + u[i][j] + d[i][j] - 3;
      ans = max(ans, now);
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 74016
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <cmath>
#define ll long long
#define MOD_P 1000000007
using namespace std;

int c(int x, int y)
{
	int z = 1;
	for (int i = 1; i <= y; i++) {
		z *= x;
		x--;
	}
	for (int i = 1; i <= y; i++) {
		z /= i;
	}

	return z;
}


int main()
{
	int n, m;
	cin >> n >> m;
	int ans = 0;

	if (n > 1) {
		ans += c(n, 2);
	}
	if (m > 1) {
		ans += c(m, 2);
	}

	printf("%d", ans);
	
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
#define rep(i,n) for(int i=1;i<=(int)n;i++)
#define Rep(i,n) for(int i=0;i<=(int)(n-1);i++)
typedef long long ll;


string s;
int k;
vector<string> t;

int main(){
    cin>>s>>k;
    Rep(i,s.size()){
        Rep(j,5){
            t.push_back(s.substr(i,j+1));
        }
    }
        sort(t.begin(),t.end());
        unique(t.begin(),t.end());
    cout<<t[k-1]<<endl;

    return 0;
}

Measured memory_bytes: 1660
#define USE_MATH_DEFINES 1
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define MOD 998244353ll
#define INF 1000000000000000000ll
#define EPS 1e-9

#define getchar_unlocked _getchar_nolock
#define putchar_unlocked _putchar_nolock

typedef long long         ll;
typedef long double       ld;
typedef pair <ll,ll>      pl;
typedef tuple <ll,ll,ll>  tl;

ll N, A[300005], C;
map <ll,ll> yeet;

void add (ll x) {
	if (yeet.find(x) == yeet.end()) yeet[x] = 1;
	else yeet[x]++;
}

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	cin >> N;
	for (ll i = 1; i <= N; i++) cin >> A[i];
	
	add(-A[1]-1);
	C = 0;
	for (ll i = 2; i <= N; i++) {
		if (yeet.find(A[i]-i) != yeet.end()) C += yeet[A[i]-i];
		add(-A[i]-i);
	}
	
	cout << C;
	
    return 0;
}

Measured memory_bytes: 17600
#include <iostream>

using namespace std;
const int MAXN = 1 << 18 , p = 1e9 + 7;
int H , L;
int inv[MAXN];
int f1[MAXN] , f2[MAXN];
int ans = 0;
int pos[MAXN];
int tot[MAXN];
void insert(int x , int v){
	while(x > 1){
		v = 1ll * x * v % p;
		tot[x] = (tot[x] + v) % p;
		x >>= 1;
	}
}

void find(int x , int v){
	while(x > 1){
		v = 1ll * x * v % p;
		ans = (ans + 1ll * tot[x ^ 1] * v % p * (x >> 1)) % p;
		x >>= 1;
	}
}

int main(){
	scanf("%d" , &H);
	L = (1 << (H - 1));
	inv[0] = inv[1] = 1;
	for(int i = 2 ; i < MAXN ; ++ i)
		inv[i] = p - 1ll * (p / i) * inv[p % i] % p;
	f1[0] = f1[1] = f2[0] = f2[1] = 1;
	for(int i = 2 ; i < MAXN ; ++ i){
		f1[i] = 1ll * f1[i / 2] * i % p;
		f2[i] = 1ll * f2[i / 2] * inv[i] % p;
	}
	for(int i = 0 ; i < L ; ++ i){
		scanf("%d" , &pos[i]);
		pos[i] --;
	}
	for(int i = 1 ; i < H ; ++ i)
		for(int j = 0 ; j < L ; j += (1 << i)){
			int u = ((j + L) >> i);
			for(int k = j ; k < j + (1 << (i - 1)) ; ++ k)
				insert(pos[k] + L , 1ll * f1[k + L] * f2[u >> 1] % p);
			for(int k = j + (1 << (i - 1)) ; k < j + (1 << i) ; ++ k)
				find(pos[k] + L , 1ll * f1[k + L] * f2[u] % p);
			for(int k = j ; k < j + (1 << (i - 1)) ; ++ k)
				insert(pos[k] + L , p - 1ll * f1[k + L] * f2[u >> 1] % p);
		}
	printf("%d\n" , ans);
	return 0;
}

Measured memory_bytes: 8376
import java.util.*;
public class Main {
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        int n = sc.nextInt();
        int res = 1000 - n % 1000;
        if(res == 1000)
            res = 0;
        System.out.println(res);
    }
}

Measured memory_bytes: 35620
#include <bits/stdc++.h>
#define INF 1e9
#define INFLL 1ull<<60u
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

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

void solve() {
    int N;
    cin >> N;
    vector<ll> v(N);
    REP(i,N) {
        cin >> v[i];
    }

    if(v.size() < 3) {
        cout << 0 << endl;
        return;
    }

    int cnt = 0;
    REP(i,v.size()-2)FOR(j,i+1,v.size()-1)FOR(k,j+1,v.size()) {
        if (v[i] == v[j] || v[j] == v[k] || v[k] == v[i]) continue;
        bool op1 = ( v[i] + v[j] ) > v[k];
        bool op2 = ( v[j] + v[k] ) > v[i];
        bool op3 = ( v[i] + v[k] ) > v[j];
        cnt += (op1 && op2 && op3);
    }
    cout << cnt << endl;
}

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

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define mp make_pair
#define pb push_back
#define pll pair<ll,ll>

ll INF = 1000000007;


//-----------------//
  #define amin main
//-----------------//


int amin()
{
	 	// freopen("input.txt", "r", stdin);
   //   	freopen("output.txt", "w", stdout);
		ios_base::sync_with_stdio(false);
		cin.tie(NULL);
		ll t,i,j;
		
		ll n;
		cin>>n;
		
		for(i=0;i<n;i++)
		{
			cout<<"ACL";
		}
		cout<<endl;

	
	
	


	
	return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
#define fs first
#define se second

using namespace std;
typedef long long llong;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<llong, llong> pll;
typedef pair<ld, ld> pdd;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    set<int> sp;
    vector<int> v;
    cin >> n;
    while (n--) {
        int x;
        cin >> x;
        if (sp.count(x)) {
            v.push_back(x);
            sp.erase(x);
        }
        else sp.insert(x);
    }
    sort(v.begin(), v.end(), greater<int>());
    if (v.size() < 2) {
        printf("0\n");
    }
    else {
        printf("%lld\n", (llong)v[0] * v[1]);
    }
    return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
 
using namespace std;
typedef long long ll;
 
 
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする
 
vector<ll> G[100005];
vector<P> tree[100010];
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
 
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,a,b) for(i=a;i<=b;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
 
ll rui(ll abc,ll bed){
	//aのb乗を計算する
	if(bed==0){return 1;}
	else{
		ll ced = rui(abc,bed/2);
		ced *= ced;
		ced %= mod;
		if(bed%2==1){ced*=abc; ced%=mod;}
		return ced;
	}
}

ll i,j,k,ii,jj;
ll n,m,sum,num;
ll c,d,e,ans;
ll u[500005],v[500005],a[500005],b[500005];
ll en[500005],snu[500005];
ll s,t;
vector<P> treeen[100010];
vector<P> treesnu[100010];

int main(){
	priority_queue<P,vector<P>,greater<P>> qen;
	priority_queue<P,vector<P>,greater<P>> qsnu;
	cin>>n>>m>>s>>t;
	for(i=1;i<=m;i++){
		cin>>u[i]>>v[i]>>a[i]>>b[i];
		treeen[u[i]].pb(P(v[i],a[i]));
		treeen[v[i]].pb(P(u[i],a[i]));
		treesnu[u[i]].pb(P(v[i],b[i]));
		treesnu[v[i]].pb(P(u[i],b[i]));
	}
	for(i=1;i<=n;i++){
		en[i]=INF;
		snu[i]=INF;
	}
	en[s]=0;
	snu[t]=0;
	qen.push(P(s,0));
	qsnu.push(P(t,0));
	while(!qen.empty()){
		P p=qen.top();
		qen.pop();
		ll v =p.first;
		if(en[v]<p.second)continue;
		for(int i=0;i<treeen[v].size();i++){
			P x=treeen[v][i];
			if(en[x.first]>en[v]+x.second){
				en[x.first]=en[v]+x.second;
				qen.push(P(x.first,en[x.first]));
			}
		}
	}
	while(!qsnu.empty()){
		P p=qsnu.top();
		qsnu.pop();
		ll v =p.first;
		if(snu[v]<p.second)continue;
		for(int i=0;i<treesnu[v].size();i++){
			P x=treesnu[v][i];
			if(snu[x.first]>snu[v]+x.second){
				snu[x.first]=snu[v]+x.second;
				qsnu.push(P(x.first,snu[x.first]));
			}
		}
	}
	/*for(i=1;i<=n;i++){
		pe(en[i]);
	}
	el;
	for(i=1;i<=n;i++){
		pe(snu[i]);
	}
	el;*/
	ll ans[100005];
	for(i=n;i>=1;i--){
		ans[i] = 1e15-en[i]-snu[i];
		if(i<=n-1)ans[i]=max(ans[i],ans[i+1]);
	}
	for(i=1;i<=n;i++)p(ans[i]);

	return 0;
}

Measured memory_bytes: 49008
#include <iostream>

using namespace std;

int main() {
  // input
  int d;
  cin >> d;
  string ans;

  if (d == 25){
    ans = "Christmas";
  }else if (d == 24){
    ans = "Christmas Eve";
  }else if (d == 23){
    ans = "Christmas Eve Eve";
  }else if (d == 22){
    ans = "Christmas Eve Eve Eve";
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#define scanf_s scanf
#include <stdio.h>
#include<iostream>
using namespace std;
int main()
{
	int pp = 4, qq = 9, rr = 4;
	while (1) {
		int n, P, Q, R, C, cou = 0;
		int okasi[1000][4];
		bool b;
		scanf_s("%d", &n);
		if (n == 0) break;
		for (int i = 0; i<n; ++i) {
			scanf_s("%d %d %d %d", &okasi[i][0], &okasi[i][1], &okasi[i][2], &okasi[i][3]);
		}
		scanf_s("%d %d %d %d", &P, &Q, &R, &C);
		cou = 0;
		for (int i = 0; i<n; ++i) {
			b = true;
			if (okasi[i][1] > P) b = false;
			if (okasi[i][2] > Q) b = false;
			if (okasi[i][3] > R) b = false;
			if (okasi[i][1] * pp + okasi[i][2] * qq + okasi[i][3] * rr > C) b = false;
			if (b == true) {
				printf("%d\n", okasi[i][0]); 
				++cou;
			}
		}
		if (cou == 0) printf("NA\n");
	}
}

Measured memory_bytes: 1212
s = input()
t = input()
flag = False
for i in range(len(s)):
    flagi = True
    for j in range(len(s)):
        if(s[j] != t[(i+j) % len(s)]):
            flagi = False

    if(flagi):
        flag = True
if(flag):
    print("Yes")
else:
    print("No")

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

struct Pos
{
	int i;
	int j;
	int len;
};

class Grid
{
private:
	int height, width;
	int white = 0;
	int black = 0;
	vector<vector<char>> s;
	vector<vector<bool>> v;

public:
	void init ()
	{
		cin >> height >> width;
		s.resize(height);
		v.resize(height);

		for (int i=0; i<height; ++i)
		{
			s[i].resize(width);
			v[i].resize(width, false);

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

				++('.' == s[i][j] ? white : black);
			}
		}
	}

	int solve ()
	{
		queue<Pos> q;
		q.push(Pos{0, 0, 1});
		while (!q.empty())
		{
			Pos p = q.front();
			q.pop();

			if (height-1 == p.i && width-1 == p.j)
			{
				return white - p.len;
			}

			v[p.i][p.j] = true;

			if (0 < p.i			&& '.' == s[p.i - 1][p.j]	&& !v[p.i - 1][p.j]) q.push(Pos{p.i - 1,	p.j,		p.len + 1}), v[p.i - 1][p.j] = true;
			if (height-1 > p.i	&& '.' == s[p.i + 1][p.j]	&& !v[p.i + 1][p.j]) q.push(Pos{p.i + 1,	p.j,		p.len + 1}), v[p.i + 1][p.j] = true;
			if (0 < p.j			&& '.' == s[p.i][p.j - 1]	&& !v[p.i][p.j - 1]) q.push(Pos{p.i,		p.j - 1,	p.len + 1}), v[p.i][p.j - 1] = true;
			if (width-1 > p.j	&& '.' == s[p.i][p.j + 1]	&& !v[p.i][p.j + 1]) q.push(Pos{p.i,		p.j + 1,	p.len + 1}), v[p.i][p.j + 1] = true;
		}

		return -1;
	}
};

int main ()
{
	Grid grid;
	grid.init();
	cout << grid.solve() << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (long long i = 0; i < (long long)n; i++)
//#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Vl = vector<ll>;
using vi = vector<int>;
using Graph = vector<vi>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);  //"for float-base problem"
  double W, H, x, y;
  cin >> W >> H >> x >> y;
  if (x == W / 2.0 && y == H / 2.0) {
    cout << (W * H / 2.0) << " " << 1 << endl;
  } else {
    cout << (W * H / 2.0) << " " << 0 << endl;
  }
  return 0;
}

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

typedef long long ll;

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

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

    vector<int> A(N);

    int max = 0;
    int max2 = 0;
    for(int i=0; i<N; i++){
        cin >> A[i];
        if(A[i] >= max){
            max2 = max;
            max = A[i];
        }
        else if(A[i] >= max2){
                max2 = A[i];
        }
    }

    if(max == max2){
        for(int i=0; i<N; i++){
            cout << max << endl;
        }
    }
    else{
        for(int i=0; i<N; i++){
            if(A[i] == max){
                cout << max2 << endl;
            }
            else{
                cout << max << endl;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
//define
#define itn int //for int typo error
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto&a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define pb  push_back
#define mb  make_pair
#define fi  first
#define se  second
//typedef
typedef vector<int> vi;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<vector<ll>> matrix;
typedef pair<int, int> pii;
inline int rint(){int x; scanf("%d", &x); return x;}
//can modify here
const ll mod = 1000000007;
//don't ever modify here, a^b % mod function, extended euclid algo, gcd
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll eea(ll a, ll b, ll &x, ll &y){if(!b){x=1,y=0;return a;} ll x1,y1; ll d = eea(b,a%b,x1,y1);x=y1;y=x1-(ll)(a/b)*y1;return d;}
ll gcd(ll a, ll b){ll x; ll y; return eea(a,b,x,y);}


//code here
void solve()
{
    string s1;
    cin >> s1;
    int i = 0;
    while(s1[i++])
        cout<<'x';
}


int main() {
    //For faster IO, comment out for interative problems
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

	solve();
	return 0;
}


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

using ll = int64_t;
using vl = vector<ll>;
#define MOD 1000000007
#define madd(a,b) (((a)+(b))%MOD)
#define mmul(a,b) (((a)*(b))%MOD)
vl fac{1,1}, inv{0,1}, finv{1,1};

// n 個の配列に、mod p で前処理する
void finv_init(int n){
	for(int i=2; i<=n; ++i){
		fac.push_back(mmul(fac.back(), i));
		inv.push_back(madd(MOD, -mmul(inv[MOD%i], MOD/i)));
		finv.push_back(mmul(finv.back(), inv.back()));
	}
}

// 組み合わせ nCr(mod m)
ll nCr(int n, int r){
	int m = MOD;
	if(n<r || n<0 || r<0) return 0;
	return fac[n] * (finv[n-r] * finv[r] % m) % m;
}

// 重複組合せ nHr(mod m)
#define nHr(n,r) nCr((n)+(r)-1,(r))

int main(){
	ll S; cin>>S;
	finv_init(S);
	ll ans = 0;
	for(int n=1; n<=S; ++n){
		if(S < 3*n) break;
		ans += nHr(n, S - 3*n);
		ans %= MOD;
	}
	cout<< (ans + MOD) % MOD <<endl;
}


Measured memory_bytes: 3692
object Main extends App {
  val in = scala.io.Source.stdin.getLines.toSeq
  val H = in.map(_.split(' ').map(_.toInt)).tail.head

  var ret = 0
  H.foldLeft(0){ (a,e) =>
    if(a<=e) ret+=1
    Math.max(a,e)
  }
  println(ret)
}


Measured memory_bytes: 25536
/*for better*/
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define f(i,a,b) for(i=a;i<b;i++)
#define fr(i,a,b) for(i=a;i>=b;i--)
#define endl '\n'
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define mod 1000000007
#define M 998244353
using namespace std;

double dp[3000][2][3000],p[3000];
int n;

double fun(int i, int k, int num)
{
	if(dp[i][k][num]!=-1)
		return dp[i][k][num];
	if(i==n-1)
	{
		if(num>n/2)
		{
			if(k==0)
				return dp[i][k][num]=p[i];
			else return dp[i][k][num]=1-p[i];
		}
		else return dp[i][k][num]=0;
	}
	if(k==0)
		return dp[i][k][num]=p[i]*(fun(i+1,0,num+1)+fun(i+1,1,num));
	else return dp[i][k][num]=(1-p[i])*(fun(i+1,0,num+1)+fun(i+1,1,num));
}

int main()
{
    fast; 
    int i,j,k;
    cin>>n;
    f(i,0,n)
    	cin>>p[i];
    f(i,0,n)
    	f(j,0,2)
    		f(k,0,n+1)
    			dp[i][j][k]=-1;

    cout << fixed << setprecision(10); 
    cout<<(fun(0,0,1)+fun(0,1,0));
}


Measured memory_bytes: 141056
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int top,S[1000];

void push(int x){
  S[++top] = x;
}

int pop(){
  top--;
  return S[top+1];
}

int main(){
  int a,b;
  top = 0;
  char s[100];
  while(scanf("%s",s) !=EOF){
    if(s[0] == '+'){
      a=pop();
      b=pop();
      push(a + b);
    }
    else if(s[0] == '-'){
      b = pop();
      a = pop();
      push(a - b);
    }
    else if(s[0] == '*'){
      a = pop();
      b = pop();
      push(a * b);
    }
    else {
      push(atoi(s));
    }
  }
  printf("%d\n",pop());
  return 0;
}



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

int main(){
	int a[ 4 ], b[ 4 ];

	while ( cin >> a[ 0 ] >> a[ 1 ] >> a[ 2 ] >> a[ 3 ] ){
		cin >> b[ 0 ] >> b[ 1 ] >> b[ 2 ] >> b[ 3 ];

		int hit = 0, blow = 0;
		for ( int i = 0; i < 4; ++i ){
			for ( int j = 0; j < 4; ++j ){
				if ( a[ i ] == b[ j ] ){
					if ( i == j ) ++hit;
					else ++blow;
				}
			}
		}
		cout << hit << " " << blow << endl;
	}
	return 0;
}

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


int main() {
  int n ;
  cin >> n ;
  
  vector<int> a(n);
  vector<int> b(n);
  
  for(int i=0;i<n;i++){
    cin >> a.at(i);
  }
  for(int i=0;i<n;i++){
    int c=0;
    for(int j=1;j<n-i;j++){
      if(a.at(i+j-1)>=a.at(i+j)){
        c++;
      }
      else{
        break;
      }
    }
 
    b.at(i)=c;
    if(c>n/2){
      break;
    }
  }
  
  sort(b.begin(),b.end());
  reverse(b.begin(),b.end());
  
  cout << b.at(0) << endl;
}

Measured memory_bytes: 1024
#include<stdio.h>
int main(){
int a,b;
char s[12];
scanf("%d %d\n%s",&a,&b,s);
s[11] = '\0';
int n;
int tf = 0;
   for(n=0;n <= a+b;n++){
      if(n == a){
         if(s[n] != '-'){
            tf=1; 
            break;
         } else { }
       } else {
          if(s[n] == '-'){
       tf=1;
       break;
         } else { }
       }
   }
if(tf == 0){
printf("Yes\n");
} else {
printf("No\n");
}
return 0;
}

Measured memory_bytes: 128
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

pub fn read_n<T: FromStr>(n: usize) -> Vec<T> {
    read_n_logic::<T>(n, vec![])
}

pub fn read_n_logic<T: FromStr>(n: usize, mut a: Vec<T>) -> Vec<T> {
    match n {
        0 => a,
        _ => {
            a.push(read::<T>());
            read_n_logic(n - 1, a)
        }
    }
}
use std::cmp::{max, min};
use std::collections::HashMap;

fn main() {
    let n: usize = read();
    let s: Vec<String> = read_n(n);

    let mut map: HashMap<String, i64> = HashMap::new();
    for i in 0..s.len() {
        let si: &str = &s[i];
        if map.contains_key(&(si.to_string())) {
            let current = map.get_mut(&(si.to_string())).unwrap();
            *current += 1;
        } else {
            map.insert(si.to_string(), 1);
        }
    }


    // what is max
    let mut maxv = 0;
    for (k,v) in map.iter() {
        if maxv < *v {
            maxv = *v;
        }
    }

    // get max values strings
    let mut anss: Vec<&str> = vec![];
    for (k, v) in map.iter() {
        if *v == maxv {
            anss.push(k);
        }
    }

    anss.sort();
    for i in 0..anss.len() {
        println!("{}", anss[i]);
    }

}


Measured memory_bytes: 88624
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
  ll x, k, d;
  cin >> x >> k >> d;
  x = abs(x);
  if(x / k >= d) cout << x - k * d << endl;
  else {
    ll n = x / d;
    x = x - n * d;
    if((k - n) % 2 == 0) cout << x << endl;
    else cout << d - x << endl;
  }
}


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

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define sz size()
#define pb push_back
#define mp make_pair
#define ALL(X) (X).begin(),(X).end()

using namespace std;

const int INF = 1000000000;
const double eps = 1e-8;

int main(void) {
  string l = "qwertasdfgzxcvb";
  while(1){
    string s;cin>>s;
    if(s=="#")break;
    int cnt=0;
    REP(i,s.size()-1){
      bool o=l.find(s[i])==string::npos;
      bool n=l.find(s[i+1])==string::npos;
      if(o!=n)
        cnt++;
    }
    cout<<cnt<<endl;
  }
  return 0;
}

Measured memory_bytes: 1192
import math

def main():
  s = input()
  
  s = s.replace(s[0], "")
  if len(s) != 2:
    print("No")
    return
  
  s = s.replace(s[0], "")
  
  if len(s ) != 0 :
    print("No")
    return
  
  print("Yes")
  
main()

Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>
#include<set>
#include<cstdio>

using namespace std;

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

typedef vector<int> vec;
typedef vector<vec> mat;

int main(){
    ll k;
    cin >> k;
    ll l;
    if(k % 2 == 0 || k % 5 == 0){
        cout << -1 << endl;
        return 0;
    }else if (k % 7 == 0){
        l = (9 * k) / 7;
    }else{
        l = 9 * k;
    }
    ll mod = 10;
    ll ans = 0;
    // cout << l << endl;
    while(true){
        ans++;
        if(mod % l == 1) break;
        mod %= l;
        mod *= 10;
        // cout << mod << endl;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl
#define INF 1000000;
#include <map>
#include <math.h>
 
using ll = long long;
using namespace std;

ll n, k;
const ll mod = 1000000007;


int main(){
   int a, b, c;
   cin >> a >> b >> c;
   if(a==b&&b==c&&c==a) out("No");
   else if(a!=b&&b!=c&&c!=a) out("No");
   else out("Yes");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long a[55],b[55],c[55],d[55],n,m,q,ans1,ans,dl[15];
int dg(int tms,int lst)
{
//	cout<<tms<<endl;
	ans1=0;
	if(tms==n)
	{
	//	for(int i=0;i<n;i++)
		//cout<<dl[i]<<" ";
		//cout<<endl;
		for(int i=0;i<q;i++)
		{
			if(dl[b[i]-1]-dl[a[i]-1]==c[i])
			ans1+=d[i];
		}
		ans=max(ans,ans1);
		return 0;
	}
	for(int i=lst;i<=m;i++)
	{
		dl[tms]=i;
		dg(tms+1,i);
		dl[tms]=0;
	}
	return 0;
}
int main()
{
	cin>>n>>m>>q;
	for(int i=0;i<q;i++)
	cin>>a[i]>>b[i]>>c[i]>>d[i];
	dg(0,1);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3560
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
using namespace std;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (int i=0; i < (int)(n); i++)  // 0 ~ n-1
#define REPN(i, n) for (int i=1; i <= (int)(n); i++)  // 1 ~ n
#define MIN(vec) min_element(ALL((vec)))  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
typedef long long ll;

const int MOD = 1000000007;  // 1 000 000 007


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

    // input
    int N;
    cin >> N;
    
    // calculation
    cout << N*800 - (N/15)*200 << "\n";
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <complex>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <stack>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <cassert>

using namespace std;

typedef long long ll;
typedef ll li;
typedef pair<int,int> PI;
#define EPS (1e-10L)
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define F first
#define S second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define SZ(a) (int)((a).size())
#define ALL(a) a.begin(),a.end()
#define FOR(it,a) for(__typeof(a.begin())it=a.begin();it!=a.end();++it)
void pkuassert(bool t){t=1/t;};
int dx[]={0,1,0,-1,1,1,-1,-1};
int dy[]={1,0,-1,0,-1,1,1,-1};

bool hima[50][40];
int co[50][50];
int n;

void solve(){
  memset(hima,0,sizeof(hima));
  memset(co,-1,sizeof(co));

  rep(i,n){
    int fi;
    cin >> fi;
    rep(j,fi){
      int t;
      cin >> t;
      hima[i][t]=1;
    }
  }
  rep(i,n)rep(j,n) co[i][j]=100;
  rep(i,n) co[i][i]=0;
  
  rep(i,n){
    rep(j,33){
      rep(k,n) rep(l,n)
        if(hima[k][j] && hima[l][j] && co[i][k]<j)
          co[i][l]=min(co[i][l],j);
    }
  }

  int ans=100;
  rep(i,n){
    int ma=0;
    bool ok=true;
    rep(j,n){
      if(co[j][i]==100){
        ok=false;
        break;
      }
      ma=max(co[j][i],ma);
    }
    if(ok) ans=min(ma,ans);
  }
  
  if(ans!=100) cout << ans << endl;
  else cout << -1 << endl;
}

int main(int argc, char *argv[])
{
  while(cin >> n && n) solve();
  return 0;
}

Measured memory_bytes: 1180
using System;
using System.Linq;
using System.Collections.Generic;


static class NagataKanaIsAGenius {
    public static void Main() {
        int[]nmc=Console.ReadLine().Split().Select(int.Parse).ToArray();
        int[]b=Console.ReadLine().Split().Select(int.Parse).ToArray();
        int n=nmc[0];
        int m=nmc[1];
        int c=nmc[2];
        int ans=0;
        for(int i=0;i<n;i++){
            int now=0;
            int j=0;
            foreach(int x in Console.ReadLine().Split().Select(int.Parse)){
                now+=x*b[j++];
            }
            if(0<now+c)ans++;
        }
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 13396
import java.util.*;
import java.io.*;
import java.lang.*;

public class Main {
    static final int INF = 1000000000;     
    
    public static void main(String[] args) throws Exception {                
        Scanner input = new Scanner(System.in);
        int x, y;
        while (input.hasNextInt()) {
            x = input.nextInt();
            y = input.nextInt();
            if (x == 0 && y == 0) break;
            if (x <= y) System.out.println(x + " " + y);
            else System.out.println(y + " " + x);
        }
    }         
}

Measured memory_bytes: 27116
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define FIR first
#define SEC second
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;

typedef int Flow;
struct Edge{
  int src;int dst;int rev;
  Flow cap;
  Edge(int s=0,int d=0,Flow c=0,int r=0):
  src(s),dst(d),cap(c),rev(r){}
};

using Graph = vector<vector<Edge>>;
Graph g;
int m,n;
bool used[10005];

void add(int src,int dst,int cap){
  g[src].emplace_back(src,dst,cap,g[dst].size());
  g[dst].emplace_back(dst,src,0,g[src].size()-1);
}

int dfs(int v,int t,int f){
  if(v==t)return f;
  used[v]=true;
  REP(i,g[v].size()){
    Edge &e=g[v][i];
    if(!used[e.dst]&&e.cap>0){
      int d=dfs(e.dst,t,min(f,e.cap));
      if(d>0){
        e.cap-=d;
        g[e.dst][e.rev].cap+=d;
        return d;
      }
    }
  }
  return 0;
}


int maximum_flow(int s,int t){
  int flow=0;
  for(;;){
    fill(used,used+n+m+10,0);
    int f=dfs(s,t,INF);
    if(!f) return flow;
    flow+=f;
  }
}
int gcd(int a,int b){
  if(a<b)swap(a,b);
  if(b==0)return a;
  return gcd(b,a%b);
}

signed main(){
  while(cin>>m>>n,m){
    int b,r;
    g=Graph(m+n+10);
    vector<pair<int,int>> B,R;
    REP(i,m){
      cin>>b;
      B.PB(MP(i+1,b));
    }
    REP(i,n){
      cin>>r;
      R.PB(MP(i+1+m,r));
    }
    REP(i,m)add(0,i+1,1);
    REP(i,n)add(m+i+1,n+m+1,1);
    REP(i,m)REP(j,n){
      if(gcd(B[i].SEC,R[j].SEC)>1){
        add(B[i].FIR,R[j].FIR,1);
      }
    }
    printf("%d\n",maximum_flow(0,n+m+1));
  }
  return 0;
}

Measured memory_bytes: 14348
#include<iostream>
using namespace std;
int n; 

int gcd(int x, int y) {
  int r;
  if ( x < y ) swap (x, y);

  while (y > 0) {
    r = x % y;
    x = y;
    y = r;
  }
  return x;
}

int main()
{
  int a, b;
  cin >> a >> b;
  cout << gcd(a, b) << endl;
  return 0;
}
 
 

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 

int main() {
	ll r,d,x;
	cin>>r>>d>>x;
	for(ll i=0;i<10;i++){
		x=r*x-d;
		cout <<x<<endl;
	}
	return 0;
}

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

int main() {
  string s, t; cin >> s >> t;
  int a, b; cin >> a >> b;
  string u; cin >> u;
  if(s==u){
    a--;
  }else{
    b--;
  }
  cout << a << " " << b;
}


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

using namespace std;

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

    vector<int> A(N + 1, 0);

    for (int i = 2; i <= N; i++) {
        cin >> A.at(i);
    }

    vector<int> bucket(N + 1, 0);
    for (int i = 1; i <= N; i++) {
        bucket.at(A.at(i))++;
    }

    for (int i = 1; i <= N; i++) {
        cout << bucket.at(i) << endl;
    }

    return 0;
}

Measured memory_bytes: 4840
#include <iostream>
#include <stdio.h>

using namespace std;
double r;
int n= 0;
double pi = 3.141592653589;


void solve(){

    return;
}

int main(){
    cin >> r;

    double circle = 2 * pi * r;
    double area = r * r * pi;

    printf("%.5f ",area);
    printf("%.5f\n", circle);


    return 0;
}


Measured memory_bytes: 3212
#include<iostream>
#include<vector>
#include<list>
#include<string>
#include<algorithm>
#include<map>
#include<cmath>
using namespace std;
int main() {
	int u, n, m;
	cin >> u;
	for (int z = 0; z < u; z++) {
		if (z != 0) cout << endl;
		cin >> n >> m;
		char a[20][20];
		int b[2];
		string t;
		for (int i = 0; i < n; i++) {
			cin >> t;
			for (int j = 0; j < m; j++) {
				a[i][j] = t[j];
				if (a[i][j] == '>' || a[i][j] == '<' || a[i][j] == '^' || a[i][j] == 'v') {
					b[0] = i;
					b[1] = j;
				}
			}
		}
		int s;
		cin >> s;
		cin >> t;
		for (int i = 0; i < s; i++) {
			char d;
			d=t[i];
			switch (d)
			{
			case 'U':
				a[b[0]][b[1]] = '^';
				if (b[0] - 1 >= 0 && a[b[0] - 1][b[1]] == '.') {
					a[b[0]][b[1]] = '.';
					b[0]--;
					a[b[0]][b[1]] = '^';
				}
				break;
			case 'D':
				a[b[0]][b[1]] = 'v';
				if (b[0] + 1 < n && a[b[0] + 1][b[1]] == '.') {
					a[b[0]][b[1]] = '.';
					b[0]++;
					a[b[0]][b[1]] = 'v';
				}
				break;
			case 'L':
				a[b[0]][b[1]] = '<';
				if (b[1] - 1 >= 0 && a[b[0]][b[1] - 1] == '.') {
					a[b[0]][b[1]] = '.';
					b[1]--;
					a[b[0]][b[1]] = '<';
				}
				break;
			case 'R':
				a[b[0]][b[1]] = '>';
				if (b[1] + 1 < m && a[b[0]][b[1] + 1] == '.') {
					a[b[0]][b[1]] = '.';
					b[1]++;
					a[b[0]][b[1]] = '>';
				}
				break;
			case 'S':
				int x=0, y=0;
				if (a[b[0]][b[1]] == '^') {
					x = -1;
				}
				else if (a[b[0]][b[1]] == 'v') {
					x = 1;
				}
				else if (a[b[0]][b[1]] == '>') {
					y = 1;
				}
				else if (a[b[0]][b[1]] == '<') {
					y = -1;
				}
				int k = b[0], l = b[1];
				while (k < n&&k >= 0 && l < m&&l >= 0) {
					if (a[k][l] == '*') {
						a[k][l] = '.';
						break;
					}
					else if (a[k][l] == '#') {
						break;
					}
					k += x;
				    l += y;
				}
				break;
			}
		}
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				cout << a[i][j];
			}
			cout << endl;
		}
	}
} 

Measured memory_bytes: 3192
n=int(input())
ar=[]
for i in range (n):
	temp=list(map(int,input().split()))
	ar.append(temp)
for i in range (1,n):
	ar[i][0]=ar[i][0]+max(ar[i-1][1],ar[i-1][2])
	ar[i][1]=ar[i][1]+max(ar[i-1][0],ar[i-1][2])
	ar[i][2]=ar[i][2]+max(ar[i-1][0],ar[i-1][1])
print(max(ar[-1]))
	


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

int main(){
    ll a,b; cin >> a >> b;
    ll ans = max(a+b,a-b);
    ans = max(ans,a*b);
    cout << ans << endl;
}

Measured memory_bytes: 256
package main

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

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	aa := make([]map[int]int, n+1)
	aa[0] = map[int]int{}
	for i := 0; i < n; i++ {
		aa[i+1] = map[int]int{}
		a := getNextInt(scanner)
		aa[i+1][a]++
	}
	for i := 0; i < n; i++ {
		for a, c := range aa[i] {
			aa[i+1][a] += c
		}
	}

	q := getNextInt(scanner)
	for i := 0; i < q; i++ {
		b := getNextInt(scanner)
		e := getNextInt(scanner)
		k := getNextInt(scanner)
		fmt.Fprintln(writer, aa[e][k]-aa[b][k])
	}
}



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

const int N = 100005;

int n, cnt;
int f[N];
int sum[N];
bool flag;
vector<int> G[N];

void dfs(int u, int p, int x) {
	vector<int> go;
	for (auto v : G[u]) {
		if (v == p) continue;
		dfs(v, u, x), go.push_back(f[v] + 1);
	}
	int sz = go.size();
	bool even = 0;
	cnt += sz / 2;
	if (sz % 2 == 0) go.push_back(0), sz++, even = 1;
	else if (u == 1) cnt++;
	sort(go.begin(), go.end());
	// bubbletea prevoi 2017
	for (int i = 0; i < sz; ++i) sum[i] = 0;
	for (int i = 0; i <= sz / 2; ++i) {
        if (i < sz - i - 2 && sz - i - 2 < sz) {
            if (go[i] + go[sz - i - 2] > x) sum[sz - i - 1]++;
        }
        if (i < sz - i - 1 && sz - i - 1 < sz) {
            if (go[i] + go[sz - i - 1] > x) sum[i + 1]++, sum[sz - i - 1]--;
        }
        if (i < sz - i && sz - i < sz) {
            if (go[i] + go[sz - i] > x) sum[0]++, sum[i]--;
        }
	}
	for (int i = 1; i < sz; ++i) sum[i] += sum[i - 1];
	for (int i = 0; i < sz; ++i) {
		if (u == 1 && even && go[i]) continue;
		if (!sum[i] && go[i] <= x) { f[u] = go[i]; return; }
	}
	flag = 1;
}

int check(int x) {
	flag = cnt = 0, dfs(1, 1, x); 
	return (!flag) ? cnt : 0;
}

int main() {
	ios::sync_with_stdio(false);
	cin >> n;
	for (int i = 1; i < n; ++i) {
		int u, v; cin >> u >> v;
		G[u].push_back(v), G[v].push_back(u);
	}
	int l = 1, r = n;
	while (l < r) {
		int mid = (l + r) >> 1;
		if (check(mid)) r = mid; else l = mid + 1;
	}
	cout << check(l) << ' ' << l;
}

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

typedef pair<int, int> P;

int main() {
    int a, b, M;
    cin >> a >> b >> M;
    vector<int> A(a), B(b);
    int min_a = INT32_MAX, min_b = INT32_MAX;
    for (int i = 0; i < a; i++) {
        cin >> A[i];
        min_a = min(min_a, A[i]);
    }
    for (int i = 0; i < b; i++) {
        cin >> B[i];
        min_b = min(min_b, B[i]);
    }
    vector<pair<int, P>> pairs(M);
    for (int i = 0; i < M; i++) {
        int x, y, c;
        cin >> x >> y >> c;
        pairs[i] = pair<int, P>(c, P(x, y));
    }

    sort(pairs.begin(), pairs.end(), greater<pair<int, P>>());

    int res = min_a + min_b;
    for (int i = 0; i < M; i++) {
        int c = pairs[i].first;
        P p = pairs[i].second;
        int index_a = p.first - 1;
        int index_b = p.second - 1;
        int price = A[index_a] + B[index_b] - c;
        res = min(res, price);
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 2176
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)


def main():
    n = int(input())
    s = input()
    cnt = s.count('E')
    m = cnt
    for i in s:
        if i == 'E':
            cnt -= 1
        else:
            cnt += 1
        m = min(m, cnt)
    print(m)


if __name__ == '__main__':
    main()


Measured memory_bytes: 41708
#include <cstdio>
using namespace std;
typedef unsigned int uint;

uint solve(uint *a, uint b) {
  uint carry = 0;
  uint res = 0;
  for (int i=0; i<32; ++i) {
    int tmp = 0;
    for (int j=0; j<8; ++j) {
      carry += (a[j]>>i&1);
      tmp += (a[j]>>i&1);
      //   printf("%d ", carry);
    }
    //printf("\n%d %d\n", i, carry);
    if (carry%2 ^ (b>>i)&1) {
      carry = carry-tmp+8-tmp;
      res |= 1<<i;
      //printf("HOGE %d\n", res);
    }
    carry /= 2;
  }
  return res;
}

int main() {
  int n;
  scanf("%d", &n);
  while(n--) {
    uint a[9];
    for (int i=0; i<9; ++i) {
      scanf("%x", a+i);
    }
    printf("%x\n", solve(a, a[8]));
  }
}

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

int main(void)
{
	int A, B, C;
	std::cin >> A >> B >> C;

	bool flag = false;

	if (A == B) {
		if (B != C) {
			flag = true;
		}
	}
	else {
		if (B == C) {
			flag = true;
		}
		else if (A == C) {
			flag = true;
		}
	}

	if (flag)
		std::cout << "Yes" << std::endl;
	else 
		std::cout << "No" << std::endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
// Begin Header {{{
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i,n) for(ll i=0; i<n; i++)
#define loop(i, j, n) for(ll i=j; i<n; i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
const long double PI = acos(-1);
// }}} End Header

int main() {
	ll n;
	cin >> n;
	for(ll i=1;; i++){
		if(i*i>n){
			cout << (i-1)*(i-1) << endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
char s[105],t[105];
int n;
int main(){
	int i,j,ans;
	bool f=1;
	scanf("%d",&n);
	scanf("%s",s);
	scanf("%s",t);
	for(int l=n;l>=1;l--){
		f=1;
		i=n-l;
		j=0;
		for(int k=1;k<=l;k++){
			if(s[i]==t[j]){
				i++;
				j++;
			}
			else{
				f=0;
				break;
			}
		}
		if(f==1){
			ans=2*n-l;
			break;
		}
		if(l==1)
			ans=2*n;
	}
	printf("%d",ans);
}

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

int main()
{
	int N;
	cin >> N;
	int a[100];
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	int b[100] = { 0 };
	for (int i = 0; i < N; i++) {
		b[a[i]]++;
	}
	int sum = 0;
	for (int i = 0; i < 101; i++) {
		if (b[i] > 0) {
			sum++;
		}
	}
	cout << sum << endl;
}

Measured memory_bytes: 256
#include <stdlib.h>
#include<iostream>
#include<bits/stdc++.h>
#include<cmath>
#define ll long long
const int INF=0x3f3f3f3f;
#define mod 1000000007
using namespace std;
//priority_queue
int s[300];
int main()
{

ll a,b,c,d;cin>>a>>b>>c>>d;
ll lc = c / __gcd(c, d) * d;
    cout << b - a + 1 - (b / c - (a - 1) / c + b / d - (a - 1) / d - (b / lc - (a - 1) / lc)) << endl;

}



Measured memory_bytes: 256