akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

import java.lang.*;

import java.math.*;



public class Main {

	Scanner sc = new Scanner(System.in);



	void exp(int map[][], int x, int y) {

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

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

		for (int i = 0; i < dx.length; i++) {

			if (map[x + dx[i]][y + dy[i]] == 1) {

				map[x + dx[i]][y + dy[i]] = 0;

				exp(map, x + dx[i], y + dy[i]);

			}

		}

	}



	void run() {

		int n = sc.nextInt();

		for (int c = 1; c <= n; c++) {

			int[][] map = new int[14][14];

			for (int i = 0; i < 8; i++) {

				String buffer = sc.nextLine();

				for (; buffer.length() == 0;)

					buffer = sc.nextLine();

				for (int j = 0; j < 8; j++) {

					map[i + 3][j + 3] = buffer.charAt(j) - '0';

				}

			}

			int y = sc.nextInt();

			int x = sc.nextInt();

			if (map[x + 2][y + 2] == 1) {

				map[x + 2][y + 2] = 0;

				exp(map, x + 2, y + 2);

			}

			System.out.println("Data " + c + ":");

			for (int i = 0; i < 8; i++) {

				for (int j = 0; j < 8; j++) {

					System.out.print(map[i + 3][j + 3]);

				}

				System.out.println();

			}

		}



	}



	public static void main(String[] args) {

		Main m = new Main();

		m.run();

	}

}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll k,a,b;
  cin >> k >> a >> b;
  if(b-a<=2){
    cout << 1+k << endl;
  }
  else{
    cout << (k-a+1)/2*(b-a)+a+(k-a+1)%2 << endl;
  }
}

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

ll GCD(ll a, ll b) {
    if (b==0) return a;
    else return GCD(b, a%b);
}

ll LCM(ll a, ll b) {
    ll g = GCD(a, b);
    return a / g * b;
}

int main(){
    int n;
    cin >> n;
    vector<ll> t(n);
    rep(i, n) cin >> t[i];
    sort(all(t));
    ll ans = t[0];
    rep(i, n-1) {
        ans = LCM(t[i+1], ans);
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
	int x;cin>>x;
	int ans=1;
	for(int i=2;i<x;i++){
		int num=i;
		for(int j=2;j>=0;j++){
			num*=i;
			if(num>x)break;
			if(ans<num)ans=num;
		}
	}
	cout<<ans<<endl;
	return 0;
}


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

int main() {

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

    vector<pair<ll, int>> D;
    ll p, q, r;
    for (int i = 0; i < A; ++i) {
        cin >> p;
        D.push_back(make_pair(p, 0));
    }
    for (int i = 0; i < B; ++i) {
        cin >> q;
        D.push_back(make_pair(q, 1));
    }
    for (int i = 0; i < C; ++i) {
        cin >> r;
        D.push_back(make_pair(r, 2));
    }

    sort(D.begin(), D.end(), greater<pair<ll, int>>());

    int R = 0;
    int G = 0;
    int N = 0;
    int itr = 0;
    ll ans = 0;
    while (R+G+N < X+Y) {
        if (D[itr].second == 0) {
            if (R < X) {
                R++;
                ans += D[itr].first;
            }
        }
        else if (D[itr].second == 1) {
            if (G < Y) {
                G++;
                ans += D[itr].first;
            }
        }
        else {
            N++;
            ans += D[itr].first;
        }
        itr++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 10476
import java.io.PrintWriter
val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val ss = next().toList().sorted().joinToString(separator = "")
    val tt = next().toList().sortedDescending().joinToString(separator = "")
    println(if (ss < tt) "Yes" else "No")
}

fun next() = readLine()!!

fun println(value : Any) {
    pw.println(value)
}

Measured memory_bytes: 38360
#include <iostream>
#include <vector>
#include <utility>
#include <string>
#include <map>
#include <algorithm>
#include <stdio.h>
#include <set>
#include <cmath>

typedef long long ll;

using namespace std;

int main(){
    int n;
    cin >> n;
    static int ans[4];
    for(int i = 0; i < n; i++){
        string s;
        cin >> s;
        if(s == "AC"){
            ans[0]++;
        }
        else if(s == "WA"){
            ans[1]++;
        }
        else if(s == "TLE"){
            ans[2]++;
        }
        else {
            ans[3]++;
        }  
    }
    cout << "AC" << " " << "x" << " " << ans[0] << endl;
    cout << "WA" << " " << "x" << " " << ans[1] << endl;
    cout << "TLE" << " " << "x" << " " << ans[2] << endl;
    cout << "RE" << " " << "x" << " " << ans[3] << endl;
}

Measured memory_bytes: 3624
#include<stdio.h>

int main() {

	int i, a, b, count;

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

	if (a == 0 || b == 0) {
		printf("Zero\n");
		return 0;
	}
	if (a <= 0 && b >= 0) {
		printf("Zero\n");
		return 0;
	}
	if (a > 0 && b > 0) {
		printf("Positive\n");
		return 0;
	}
	if (a < 0 && b < 0) {
		for (i = a, count = 0; i <= b; i++, count++);
		if ((count % 2) == 0) printf("Positive\n");
		else printf("Negative\n");
		return 0;
	}

	return 0;
}

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

using namespace std;

#define int long long 
#define INF 21000000000

signed main(){
		int n,x;
		cin >> n >> x;
		vector<int> a;
		for(int i=0;i<n;i++){
				int tmp;
				cin >> tmp;
				a.push_back(tmp);
		}
		x -= accumulate(a.begin(),a.end(),0);
		int ans = n;
		ans += x / *min_element(a.begin(),a.end());
		cout << ans << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <math.h>
using namespace std;

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

    double f = M_PI * r * r;
    double g = 2 * M_PI * r;
    cout << fixed << setprecision(6) << f << " ";
    cout << fixed << setprecision(6) << g << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int main(){
  int n,x;
  cin>>n>>x;
  vi m(n);
  REP(i,n)cin>>m[i];
  int ans = n;
  REP(i,n)x -= m[i];
  int z = *min_element(ALL(m));
  ans += x/z;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}void pr(){ln;}
template<class A,class...B>void pr(const A &a,const B&...b){cout<<a<<(sizeof...(b)?" ":"");pr(b...);}
template<class A>void PR(A a,ll n){rep(i,n)cout<<(i?" ":"")<<a[i];ln;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[8]={-1,0,1,0,-1,-1,1,1},dy[8]={0,1,0,-1,-1,1,1,-1};
typedef pair<ll,ll> P;

int N=1<<18;
class StarrySkyTree{
public:
  ll Mi[555555],A[555555];
  void init(){memset(Mi,0,sizeof(Mi)),memset(A,0,sizeof(A));}
  void add(int a,int b,ll x,int k=0,int l=0,int r=N) {
    if(r<=a||b<=l) return;
    if(a<=l&&r<=b){
      A[k]+=x;
      while(k){
        k=(k-1)/2;
        Mi[k]=min(Mi[k*2+1]+A[k*2+1],Mi[k*2+2]+A[k*2+2]);
      }
      return;
    }
    add(a,b,x,k*2+1,l,(l+r)/2);
    add(a,b,x,k*2+2,(l+r)/2,r);
  }
  ll getMin(int a,int b,int k=0,int l=0,int r=N) {
    if(r<=a||b<=l)return MAXL;if(a<=l&&r<=b)return Mi[k]+A[k];
    ll left=getMin(a,b,k*2+1,l,(l+r)/2),right=getMin(a,b,k*2+2,(l+r)/2,r);
    return min(left,right)+A[k];
  }
};

StarrySkyTree t;

void Main() {
  ll n,m;
  cin >> n >> m;
  P a[n];
  rep(i,n) {
    cin >> a[i].F >> a[i].S;
    a[i].F--,a[i].S--;
  }
  t.init();
  set<ll> s;
  rep(i,m) s.in(i);
  rep(i,n) {
    iter(s) it=s.lower_bound(a[i].F);
    ll M=MAX;
    vector<ll> v;
    while(it!=s.end()) {
      if(*it>a[i].S) break;
      ll k=*it;
      M=min(M,t.getMin(k,k+1)+abs(a[i].S+1-k));
      v.pb(k);
      it++;
    }
    rep(k,v.size()) {
      s.erase(v[k]);
      t.add(v[k],v[k]+1,MAX);
    }
    if(a[i].S+1<m) {
      ll k=a[i].S+1;
      s.in(k);
      ll d=t.getMin(k,k+1);
      t.add(k,k+1,-d);
      t.add(k,k+1,min(M,d));
    }
    t.add(0,m,1);
    ll ans=t.getMin(0,m);
    if(ans>=3000000) ans=-1;
    pr(ans);
  }
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


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

#define ARRAY_LENGTH (100010)

// Infinity value
const long long INF = 1LL << 60;

long long dp[110][ARRAY_LENGTH];
long long w[110];
long long v[110];

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

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

int main(void)
{
  int N, W;

  std::cin >> N >> W;

  // Input costs
  for(int i = 0;i < N;i++){
    std::cin >> w[i] >> v[i];
  }

  // Initialize DP
  for(int i = 0;i < N;i++){
    for(int j = 0;j < ARRAY_LENGTH;j++){
      dp[i][j] = 0;
    }
  }

  // Loop
  for(int i = 1;i <= N;i++){
    for(int sum_w = 0;sum_w <= W;sum_w++){
      dp[i][sum_w] = dp[i-1][sum_w];
    }

    for(int sum_w = 0;sum_w <= W;sum_w++){
      chmax(dp[i][sum_w+w[i-1]], dp[i-1][sum_w] + v[i-1]);
    }
  }

  std::cout << dp[N][W] << std::endl;

  return 0;
}


Measured memory_bytes: 80128
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <iostream>
#include <fstream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = int64_t;
using pii = pair<int, int>;
using pll = pair<int64_t, int64_t>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
// variadic template
template<typename T> inline void chmin(T &a, T b) {if (a > b) a = b; return;}
template<typename T> inline void chmax(T &a, T b) {if (a < b) a = b; return;}

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

  int n, k; cin >> n >> k;
  vector<int64> v(n);
  for (int i = 0; i < n; ++i) cin >> v[i];

  int64 ans = 0;
  
  for (int left = 0; left <= n; ++left) {
    for (int right = 0; right <= n; ++right) {
      if (left + right > k || left + right > n) continue;
      priority_queue<int64, vector<int64>, greater<int64>> pq;
      for (int i = 0; i < left; ++i) {
        //if (i > n - 1)
        pq.push(v[i]);
      }
      for (int j = 0; j < right; ++j) {
        //if (j > n - 1)
        pq.push(v[n - 1 - j]);
      }
      int cnt = k - (left + right);
      
      for (int l = 0; l < cnt; ++l) {
        if (pq.empty()) break;
        if (pq.top() < 0) {
          pq.pop();
        }
      }
      
      int64 tmp = 0;
      
      while (!pq.empty()) {
        tmp += pq.top(); pq.pop();
      }
      
      chmax(ans, tmp);
    }
  }
  
  print(ans);

  return 0;
}

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


int main(){

  int N,K,tmp,sum;
  cin >> N >> K;
  vector<int> l;
  for(int i=0; i<N; i++){
    cin >> tmp;
    l.push_back(tmp);
  }

  sort(l.begin(),l.end());
  reverse(l.begin(),l.end());

  sum=0;
  for(int i=0; i<K; i++){
    sum += l.at(i);
  }

  cout << sum << endl;


}


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

#define SZ(v) ((int)(v).size())
using ll = long long;

int N, M, Q;
vector<tuple<int,int,int,int> > queries;
vector<int> cur;

ll ans(0);

void gen(void)
{
	if (SZ(cur) == N)
	{
		ll score(0);
		for (auto [a, b, c, d] : queries)
			if (cur[b-1] - cur[a-1] == c)
				score += d;
		ans = max(ans, score);
		return ;
	}
	int start = (SZ(cur) ? cur.back() : 1);
	for (int i(start); i <= M; ++i)
	{
		cur.push_back(i);
		gen();
		cur.pop_back();
	}
}

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

	cin >> N >> M >> Q;
	queries.resize(Q);
	for (auto &[a,b,c,d] :queries)
		cin >> a >> b >> c >> d;	
	gen();
	cout << ans << endl;
}


Measured memory_bytes: 3644
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<utility>

#define lli long long
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define rep0(i,j) for(int i=0;i<j;i++)
#define rep1(i,j) for(int i=1;i<=j;i++)
#define rep0d(i,j) for(int i=j-1;i>=0;i--)
#define MAX 1000000007

using namespace std;


int main() {
	double n,m,a,b;
	cin >> n>>m>>a>>b;
	if(!(a==n/2||b==m/2)){
		cout<<n*m/2<<' ';
	}else{
		cout<<max(min(n-a,a)*m,min(m-b,b)*n)<<' ';
	}
	if(n/2==a&&m/2==b){
		cout<<1;
	}else{
		cout<<0;
	}
}


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

int main() {
  int n,t,a;cin>>n>>t>>a;
  double ans=1e9;
  int cnt;
  for(int i=1;i<=n;i++){
    int h;cin>>h;
    if(abs(a-(t-h*0.006))<ans){
      ans=abs(a-(t-h*0.006));
      cnt=i;
    }
  }
    cout<<cnt<<endl;
  }

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll ans=0;
void Main(){
    ll a;cin>>a;
    ll b;cin>>b;
    ll c;cin>>c;
    if(4*a*b<(c-a-b)*(c-a-b)&&c-a-b>0){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}

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

const int maxn=5e3+10;

typedef long long ll;

const ll inf=1e18+10;

ll c[maxn];
int n,k,p[maxn];
ll ans=-inf;

int main(){
	cin>>n>>k;
	for(int i=1;i<=n;i++) cin>>p[i];
	for(int i=1;i<=n;i++) cin>>c[i];
	
	for(int i=1;i<=n;i++){
		ll sum=0; int now=-1;
		int tot=0;
		for(;now!=i;now=p[now]){
			if(now==-1) now=i;
			sum+=c[p[now]];
			tot++;
		}
		if(k<tot||sum<0){
			ll maxval=-inf; ll nowval=0; now=-1;
			int t=0;
			for(;now!=i;now=p[now]){
				if(now==-1) now=i;
				t++;
				if(t>k) continue;
				nowval+=c[p[now]];
				maxval=max(nowval,maxval);
			}
			ans=max(ans,maxval);
		//	cout<<maxval<<endl;
		}
		else{
			ll maxval=-inf; ll nowval=0; now=-1;
			int t=0;
			for(;now!=i;now=p[now]){
				if(now==-1) now=i;
				nowval+=c[p[now]];
				maxval=max(nowval,maxval);
			}
			ans=max(ans,maxval+ll(k/tot-1)*sum);
		//	cout<<((k/tot)-1)*sum+maxval<<endl;
			maxval=-inf; nowval=0; now=-1;
			t=0;
			for(;now!=i;now=p[now]){
				if(now==-1) now=i;
				t++;
				if(t>k%tot) continue;
				nowval+=c[p[now]];
				maxval=max(nowval,maxval);
			}
			ans=max(ans,maxval+ll(k/tot)*sum);
		//	cout<<(k/tot)*sum+maxval<<endl;
		}
	}
	
	cout<<ans<<endl;
	
}

Measured memory_bytes: 3688
n = gets.to_i
words = Array.new(n){ gets.chomp.bytes.sort.join }

h = Hash.new
ans = 0
words.each do |s|
  
  if h.has_key?(s)
    h[s] += 1
    ans += h[s]
    p 
  else
    h[s] = 0
  end
end

puts ans

Measured memory_bytes: 38524
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define X first
#define Y second
#define REP(i,a) for(int i=0;i<a;++i)
#define REPP(i,a,b) for(int i=a;i<b;++i)
#define FILL(a,x) memset(a,x,sizeof(a))
#define foreach( gg,itit )  for( typeof(gg.begin()) itit=gg.begin();itit!=gg.end();itit++ )
#define mp make_pair
#define pb push_back
#define all(s) s.begin(),s.end()
#define present(c,x) ((c).find(x) != (c).end())
const double EPS = 1e-8;
const int mod = 1e9+7;
const int N = 1e6+10;
const ll INF = 1e18;

//#define DEBUG
ll power(ll x,ll y){
  ll t=1;
  while(y>0){
    if(y%2) y-=1,t=t*x%mod;
    else y/=2,x=x*x%mod;
  }
  return t;
}
#ifdef DEBUG
#define dprintf(fmt,...) fprintf(stderr,fmt,__VA_ARGS__)
#else
#define dprintf(fmt,...)
#endif

vector<pii> a;
int fac[N];

int main(){
  int n; 
  scanf("%d",&n);
  
  REP(i,n){
    int x; scanf("%d",&x);
    a.pb(mp(x,1));
  }
  REP(i,n){
    int x; scanf("%d",&x);
    a.pb(mp(x,-1));
  }
  int crr=0;
  sort(all(a));
  ll ans=1;
  REP(i,a.size()){
    int lst = abs(crr);
    crr+=a[i].Y;
    int nw = abs(crr);
//    printf("%d %d %d\n",crr,lst,nw);
    if(nw<lst) ans=ans*lst%mod;
  }

  printf("%lld\n",ans);
  return 0;

}

Measured memory_bytes: 2420
#define _CRT_SECURE_NO_WARNINGS

#include <bits/stdc++.h>
#include <random>
using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef map<int, int> mii;
typedef pair<int, ii> edge;


#define sc(x)  scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mem(arr,val) memset(arr,val,sizeof arr)
#define sz(v) (int)v.size()
#define rsz(v) v.resize
#define clr(v) v.clear()
#define rev(v) reverse(all(v))
#define lop(i,end) for(int i=0; i<end; i++)
#define rlop(i,start) for(int i=start-1; i>=0; i--)
#define loop(i,start,end) for(int i=start; i<end; i++)
#define rloop(i,start,end) for(int i=start-1; i>=end; i--)
#define PB push_back
#define pb pop_back
#define mP make_pair
#define f first
#define s second

const ll OO = (ll)(4e18) + 9;
const int MOD = (int)(1e9) + 7;
const int oo = 2147483647;
const double EPS = 1e-8;
const double PI = acos(-1.0);

//enum dir { D, R, U, L , dr, ur, dl, ul };
int dx[] = { 1, 0, -1, 0, 1, -1, 1, -1 };
int dy[] = { 0, 1, 0, -1, 1, 1, -1, -1 };

string abc = "abcdefghijklmnopqrstuvwxyz";
string vowels = "aeiouy"; //and sometimes "aeiouy"

template<typename X, typename Y> bool ckmin(X& a, Y b) { return a > b ? a = b, true : false; }
template<typename X, typename Y> bool ckmax(X& a, Y b) { return a < b ? a = b, true : false; }
bool cklex(string &a, string b) {
	if (b == "") return false;
	if (a == "") return a = b, true;
	if (sz(a) < sz(b)) return false;
	if (sz(b) < sz(a)) return a = b, true;
	if (a < b) return false;
	return a = b, true;
}

int dcmp(ld d1, ld d2) { return fabs(d1 - d2) <= EPS ? 0 : d1 > d2 ? 1 : -1; } //Compare Double Numbers
ll gcd(ll x, ll y) { return !y ? x : gcd(y, x%y); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
int conv_2_1(int r, int c, int nCol) { return (nCol*r) + c + 1; } //convert index from 2D array to 1D array. (Zero-indexed)
ii conv_1_2(int n, int nCol) { return{ n / nCol, n % nCol }; } //convert index from 1D array to 2D array (row, col). (Zero-indexed)
template<typename T> void inter(T X) { cout << X << endl; fflush(stdout); }


ll dp[670][2000];
ll solve(int idx, int rem) {
	if (not rem) return 1;
	ll& ret = dp[idx][rem];
	if (~ret) return ret;
	ret = 0;
	for (int i = 3; i <= rem; i++) {
		ret = (ret + solve(idx + 1, rem - i)%MOD)%MOD;
	}
	return ret;
}

void _solve_() {
	int sum;
	cin >> sum;
	mem(dp, -1);
	cout << solve(0, sum) << endl;
}

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int t = 1, tt = 0;
	//cin >> t;
	while (tt++ != t) {
		_solve_();
	}


	return 0;
}


Measured memory_bytes: 14104
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip	;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
vi col,in;
int dfs(int a){
	if(col[a])return a;
	else return dfs(in[a]);
}
int main(){
	int n,m;
	while(cin>>n>>m,n+m){
		col=vi(n);
		col[0]=1;
		in=vi(n);
		rep(i,n-1){
			int a;cin>>a;
			in[i+1]=a-1;
		}
		ll out=0;
		rep(i,m){
			char c;int a;
			cin>>c>>a;
			if(c=='M')col[a-1]=true;
			else{
				out+=1+dfs(a-1);
			}
		}
		cout<<out<<endl;
	}
}

Measured memory_bytes: 2316
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("Ofast")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int , int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
#define mod 1000000007
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define repc(i, a, b, c) for (ll i = a; (c > 0 ? i < b : i > b) and c != 0; i += c)
// #define mp make_pair
#define fi first
#define si second
#define pb push_back
#define all(name) name.begin(), name.end()
#define ral(name) name.rbegin(), name.rend()
#define fact(n) rep(i, 1, n+1)ft.pb((ft[i-1]*i)%mod)
#define mod_in(a) power(a, mod - 2)
#define ncr(n, r) (n>=r?((ft[n]*mod_in((ft[r]*ft[(n)-(r)])%mod))%mod):0LL)
#define deb(x) cerr << "[" << #x << " " << x << "]" << endl;
#define endl '\n'
#define int ll
vector<ll> ft(1, 1LL);

/*======================================================================*/
// ll power(ll x, ll y) {
//     ll res = 1;x %= mod;
//     while (y > 0) {
//         if (y & 1)res = (res*x) % mod;
//         y = y>>1;
//         x = (x*x) % mod;
//     }
//     return res%mod;
// }
const int faxsize = 1e6+5;
vector<int>fax[faxsize];
// bool cmp(pair<int, int> a, pair<int, int> b){
//     return (a.fi+a.si) > (b.fi+b.si);
// }
// void solve(){
//     int n, s = 0;
//     cin >> n;
//     vector<pair<int, int> > v(n) ;
//     rep(i, 0, n)cin >> v[i].fi >> v[i].si, s += v[i].fi;
//     sort(all(v), cmp);
//     rep(i, 0, n){
//         if(v[i].fi+v[i].si <= s){
//             cout << "INDEFINITELY\n";
//             return;
//         }
//         else s -= v[i].fi;
//     }
//     int mi, ans = s;
//     rep(i,0,n){
//         if()
//     }
// }

void solve() {
    int arr[faxsize] = {0};
    int n; cin >> n;
    int g = 0;
    rep(i, 0, n){
        int a;
        cin >> a;
        g = __gcd(a, g);
        for(auto i : fax[a])arr[i]++;
    }
    if(g != 1)cout << "not coprime\n";
    else {
        rep(i, 0, faxsize)if(arr[i] > 1){cout <<"setwise coprime\n";return ;}
        cout << "pairwise coprime\n";
    }
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    // fact((2e6+10));
    // //declare  and  global
    rep(i, 2, faxsize)if(fax[i].size() == 0)repc(j, i, faxsize, i)fax[j].push_back(i);
    int t = 1;
    // cin >> t;
    rep(i, 0, t){
        solve();
    }
}

Measured memory_bytes: 81476
def gcd_of_two(a, b)
  small, large = [a, b].sort
  if small == 0
    return large
  else
    gcd_of_two(small, large % small)
  end
end

def gcd_of_many(array)
  current = array.shift
  until array.empty?
    following = array.shift
    current = gcd_of_two(current, following)
  end
  return current
end

def lcm_of_two(a, b)
  gcd = gcd_of_two(a, b)
  return a * b / gcd
end

def lcm_of_many(array)
  current = array.shift
  until array.empty?
    following = array.shift
    current = lcm_of_two(current, following)
  end
  return current
end

_n = gets.to_i
ts = readlines.map(&:to_i)
puts lcm_of_many(ts)


Measured memory_bytes: 1788
import java.util.Scanner;

public class Main {

	public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next(), t = sc.next();
		int r = s.length();
		for (int i=0;i<=s.length()-t.length();i++) {
			String a = s.substring(i, t.length()+i);
			int tmp = 0;
			for (int j=0;j<a.length();j++) {
				if (a.charAt(j) != t.charAt(j)) {
					tmp++;
				}
			}
			r = Math.min(tmp, r);
		}
		System.out.println(r);
	}
}


Measured memory_bytes: 36848
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 10000000000000009
//#define INF 9223372036854775807
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define ZREP(i,n) for(int i=1;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define rollcall cout<<"I'm Sucu."<<endl;
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl

signed main(){
    int N,M,R;
    int r[10]={};
    REP(i,10){
        r[i]=200+i;
    }
    int Ans=INF;
    int A[40000],B[40000],C[40000];
    cin >> N >> M >> R;
    REP(i,R){
        cin >> r[i];
        r[i]--;
    }
    REP(i,M){
        cin >> A[i] >> B[i] >> C[i];
        A[i]--;B[i]--;
    }
    sort(r,r+R);
    int d[216][216];
    REP(i,216){
        REP(j,216){
            d[i][j]=INF;
        }
        d[i][i]=0;
    }
    REP(i,M){
        d[A[i]][B[i]]=C[i];
        d[B[i]][A[i]]=C[i];
    }
    REP(k,N){
        REP(i,N){
            REP(j,N){
                d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
            }
        }
    }
    int y;
    //REP(i,8){cout << r[i] << " ";}cout << Endl;
    while(std::next_permutation(r,r+8)){
        y=0;
        REP(i,R-1){
            y+=d[r[i]][r[i+1]];
        }
        Ans=min(Ans,y);
    }
    
    cout << Ans << endl;
    return 0;
}   


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define lp(i, n) for(int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()
#define ll long long
#define mod 1000000007

int n;
long double v[100001], dp[3001][3001];

long double calc(int idx, int h) {
        if (idx == n) {
                if (h > (n - h)) return 1;
                else return 0;
        }
        long double &ret = dp[idx][h];
        if (ret != -1) return ret;
        ret = 0;
        ret += calc(idx + 1, h + 1) * v[idx];
        ret += calc(idx + 1, h) * (1 - v[idx]);
        return ret;
}
int main(){
ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
        cin >> n;
        lp(i, n) cin >> v[i];
        lp(i, n) lp(j, n) dp[i][j] = -1;
        cout <<std::setprecision(10) <<calc(0, 0);
return 0;
}


Measured memory_bytes: 141696
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<complex>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<algorithm>
#include<list>
#include<functional>
#include<cassert>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define y0 y12
#define y1 y22
#define INF 987654321987654321
#define PI 3.141592653589793238462643383279502884
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset((a),0,sizeof(a));
#define MEM_1(a) memset((a),-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
#define SYNC ios_base::sync_with_stdio(false);cin.tie(0)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef double db;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<ld, ld> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<int,int,int,int> iiii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
const ll MOD = 16769023;
ll POW(ll a, ll b, ll MMM = MOD) {ll ret=1; for(;b;b>>=1,a=(a*a)%MMM)if(b&1)ret=(ret*a)% MMM; return ret; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { if (a == 0 || b == 0)return a + b; return a*(b / gcd(a, b)); }
int dx[] = { 0,1,0,-1,1,1,-1,-1 }, dy[] = { 1,0,-1,0,1,-1,1,-1 };
int ddx[]={2,2,-2,-2,1,1,-1,-1},ddy[]={1,-1,1,-1,2,-2,2,-2};

char s[123];
int main(){
	ll ans=0,k;
	scanf("%s%lld",s,&k);
	int n=strlen(s);
	int tmp=1;
	char c=s[0];
	fup(i,1,n-1,1)
	{
		if(s[i]!=c)
		{
			ans+=k*(tmp/2);
			tmp=1;
			c=s[i];
		}
		else tmp++;
	}
	if(tmp==n)return !printf("%lld",(k*n)/2);
	ans+=k*(tmp/2);
	if(s[0]==s[n-1])
	{
		int tt=0;
		fup(i,0,n-1,1)
		{
			if(s[i]==s[0])tt++;
			else break;
		}
		ans-=(k-1)*(tt/2);
		ans-=(k-1)*(tmp/2);
		ans+=(k-1)*((tt+tmp)/2);
	}
	printf("%lld",ans);
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int H,W;
char fld[55][55];


signed main(){
    cin>>H>>W;
    rep(i,H)cin>>fld[i];

    rep(i,H){
        rep(j,W){
            if(fld[i][j]=='#'){
                cout<<'#';
                continue;
            }
            int cnt=0;
            for(int dy=-1;dy<=1;dy++){
                for(int dx=-1;dx<=1;dx++){
                    if(dy==0&&dx==0)continue;
                    int ny=i+dy;
                    int nx=j+dx;
                    if(ny<0||ny>=H||nx<0||nx>=W||fld[ny][nx]!='#')continue;
                    cnt++;
                }
            }
            cout<<cnt;
        }cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int n,i,num;
	long max,min,sum;
	
    scanf("%d\n %d", &n, &num);
    
    i = 1;
	max = num;
	min = num;
	sum = num;

while(i < n){  
    scanf("%d", &num);

	if( max < num){
	max = num;
	}
	if(min > num){
	min = num;
	
	}
	
	sum = num + sum;
    i++;
    }
 	
	printf("%ld %ld %ld\n",min,max,sum);
	     
    return 0;
} 

Measured memory_bytes: 1028
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int[] a = new int[n];
        for(int i=0;i<n;i++){
            a[i] = sc.nextInt();
        }
        for(int i=n-1;i>=0;i--){
            if(i==0){ System.out.print(a[i]); }
            else{ System.out.print(a[i] + " "); }
        }
        System.out.println();
    }
}


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

int main() {
  int N, K, ans = 1000000007;
  cin >> N >> K;

  int h[N + 5];
  for (int i = 0; i < N; i++) {
    cin >> h[i];
  }
  sort(h, h + N);

  for (int i = 0; i <= N - K; i++) {
    ans = min(ans, h[i + K - 1] - h[i]);
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;

int main(){

  int n;
  string s;
  ll m=0, a=0, r=0, c=0, h=0;
  ll d[5];
  int P[10]={0,0,0,0,0,0,1,1,1,2};
  int Q[10]={1,1,1,2,2,3,2,2,3,3};
  int R[10]={2,3,4,3,4,4,3,4,4,4};
  cin >> n;

  for(int i=0; i<n; i++){
    cin >> s;
    if(s[0]=='M')m++;
    if(s[0]=='A')a++;
    if(s[0]=='R')r++;
    if(s[0]=='C')c++;
    if(s[0]=='H')h++;
  }
  d[0]=m, d[1]=a, d[2]=r, d[3]=c, d[4]=h;
  ll ans=0;
  for(int i=0; i<10; i++){
    ans+=d[P[i]]*d[Q[i]]*d[R[i]];
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int p[3],j[2],ans,minp,minj,i;

  scanf("%d", &p[0]);
  minp=p[0];
  for(i=1;i<3;i++){
    scanf("%d", &p[i]);
    if(p[i]<minp) minp=p[i];
  }
  scanf("%d", &j[0]);
  minj=j[0];
  scanf("%d", &j[1]);
  if(j[1]<minj) minj=j[1];

  printf("%d\n", minp+minj-50);

  return 0;
}


Measured memory_bytes: 592
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  long x, y; readV(x, y);
  writeln((x-y).abs <= 1 ? "Brown" : "Alice");
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(void){    
    int n,i,p;    
    double D;    
    scanf("%d",&n);    
    int x[n],y[n];    
    for(i=0;i<n;i++){       
        scanf("%d",&x[i]); 
    }
    for(i=0;i<n;i++){
        scanf("%d",&y[i]);    
    }    
    for(p=1;p<4;p++){        
        D=0;        
        for(i=0;i<n;i++){            
            D+=pow(fabs(x[i]-y[i]),p);        
        }        D=pow(D,1.0/p);        
        printf("%lf\n",D);    
    }    D=0;    
    for(i=0;i<n;i++){        
        double tmp=fabs(x[i]-y[i]);        
        D=D<tmp?tmp:D;    
    }    
    printf("%lf\n",D);    
    return 0;
}


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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORd(i, a, b) for (int i = (a) ; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define sp system("pause")
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
const int N = (int) 1e5 + 10;
void TimeExecution() {
    cout << "\n\n===>> Time Execution: " << clock() / (double)1000 << " sec(s).";
}
ll sqr(ll a)
{
    return ((a % MOD) * (a % MOD)) % MOD;
}
ll msub(ll a, ll b)
{
    return ((a - b) % MOD + MOD) % MOD;
}
ll madd(ll a, ll b)
{
    return (a + b) % MOD;
}
ll mmul(ll a, ll b)
{
    return ((a % MOD) * (b % MOD)) % MOD;
}
int t;
int cnt[1000];
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    /*
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    */
    int n, k;
    cin >> n >> k;
    FOR(i, 1, k)
    {
        int d;
        cin >> d;
        FOR(j, 1, d)
        {
            int x;
            cin >> x;
            cnt[x]++;
        }
    }
    int res = 0;
    FOR(i, 1, n) if(cnt[i] == 0) res++;
    cout << res;
    return 0;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,k;
  cin>>a>>b>>c>>k;
  int m=max({a,b,c});
  int t=m;
  for(int i=1;i<=k;i++) m*=2;
  cout<<a+b+c+m-t;
}


Measured memory_bytes: 256
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    H, W = map(int, readline().split())
    S = [readline().strip() for _ in range(H)]

    def check(i, j):
        if (
            i - 1 >= 0
            and S[i - 1][j] == '#'
            or i + 1 < H
            and S[i + 1][j] == '#'
            or j - 1 >= 0
            and S[i][j - 1] == '#'
            or j + 1 < W
            and S[i][j + 1] == '#'
        ):
            return True
        else:
            return False

    for i in range(H):
        for j in range(W):
            if S[i][j] == '#':
                ok = check(i, j)
                if not ok:
                    print('No')
                    return

    print('Yes')
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9156
# -*- coding: utf-8 -*-
from collections import defaultdict
from itertools import combinations
N = int(input())
C = [0, 0, 0, 0, 0, 0]
D = defaultdict(int)
for i, m in enumerate("MARCH", start=1):
    D[m] = i

for _ in range(N):
    C[D[input()[0]]] += 1

ans = 0
for a, b, c in combinations(range(1, 6), r=3):
    ans += C[a]*C[b]*C[c]
print(ans)

Measured memory_bytes: 3316
#include <iostream>

using namespace std;

int main(){

     long long n;
     cin>>n;

     if( n==1){
          cout<<1;
          return 0;
     }

     long long l0 = 2, l1 = 1, lc;

     if( n>=2 )
          while( (n-1) ){

               lc = l0+l1;
               l0 = l1;
               l1 = lc;
               n--;

          }

     cout<<lc;

     return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using ll = long long;

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define reps(i,x) for(ll i=1;i<=(ll)(x);i++)
#define rrep(i,x) for(ll i=((ll)(x)-1);i>=0;i--)
#define rreps(i,x) for(ll i=(ll)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007 
using namespace std;
ll x[1000];
ll y[1000];
ll z[1000];
ll tmp[1000];
ll a[8];
int main() {
  int n;
  cin >> n;
  if(n%2)cout << n*2 << endl;
  else cout << n << endl;
  return 0;
}



Measured memory_bytes: 256
import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.next();
        String s2 = sc.next();

        if(s1.length()>s2.length()) {
            System.out.println("GREATER");
            return;
        }

        if(s1.length()<s2.length()) {
            System.out.println("LESS");
            return;
        }


        if(s1.compareTo(s2)>0) {
            System.out.println("GREATER");
        }
        else if(s1.compareTo(s2)<0){
            System.out.println("LESS");
        }else {
            System.out.println("EQUAL");
        }
    }
}

Measured memory_bytes: 23252
#include <stdio.h>
#define INF (1<<21)
 
int main(void)
{
 int i,j,n,m,ans=0,min,a[101][101],b[101],c[101];
 
 scanf("%d",&n);
 
 for(i=0;i<n;i++){
  for(j=0;j<n;j++){
 
   scanf("%d",&a[i][j]);
   if(a[i][j]==-1) a[i][j]=INF;
 
  }
 }
 
 for(i=0;i<101;i++){
    b[i]=0;
    c[i]=INF;
 }
 
 c[0]=0;
 
 while(1){
 
  min=INF;
  m=-1;
 
  for(i=0;i<n;i++){
     if(b[i]) continue;
     if(c[i]<min){
       min=c[i];
       m=i;
     }
  }
 
  if(m==-1) break;
 
  b[m]=1;
  ans+=c[m];
 
  for(i=0;i<n;i++){
   if(b[i]) continue;
   if(a[m][i]<c[i]){
      c[i]=a[m][i];
   }
  }
 }
 
 printf("%d\n",ans);
 
 return 0;
}


Measured memory_bytes: 2072
import sys
 
sys.setrecursionlimit(10 ** 6)

def input():
    return sys.stdin.readline().strip()


N,Q = map(int,input().split())
K = [[] for _ in range(N+1)]
nums = [0 for _ in range(N+1)]

for _ in range(N-1):
    a,b = map(int,input().split())
    K[a].append(b)
    K[b].append(a)

for _ in range(Q):
    p, x = map(int, input().split())
    nums[p] += x

def dfs(now,parent):
    for i in K[now]:
        if i != parent:
            nums[i] += nums[now]
            dfs(i,now)

dfs(1,0)
print(*nums[1:])

Measured memory_bytes: 230912
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;


int main(){
    ll n, a, b;
    cin >> n >> a >> b;
    
    if ((b - a)%2 == 0) cout << (b - a) / 2 << endl;
    else cout << min((b+a-1)/2, (2*n-b-a+1)/2) << endl;

    return 0;
}


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

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF             2e9
#define INF_LL          1LL<<60
#define ll              long long
#define Ceil(x, n)      (((((x))+((n)-1))/n))
#define CeilN(x, n)     (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)    ((x)-(x)%(n))
#define ALL(x)          (x).begin(),(x).end()

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

    int muri = max(0, c - a - b - 1);

    cout << b + c - muri << endl;

    return 0;
}

Measured memory_bytes: 256
N = int(input())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))
L = [i+1 for i in range(N)]
R = [i+1 for i in range(N)]
A,B = 0,0
for i in range(N-1):
    A *= N-i
    B *= N-i
    A += L.index(P[i])
    B += R.index(Q[i])
    L[L.index(P[i])] = 100
    R[R.index(Q[i])] = 100
    L.sort()
    R.sort()
print(abs(A-B))

Measured memory_bytes: 3064
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<ll, ll> PL;
typedef vector<PL> vpl;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e17;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back
#define ALL(X) (X).begin(),(X).end()

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    sort(ALL(vec));
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

inline ll popcnt(ll x){return __builtin_popcountll((unsigned long long)x);};
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
//friend bool operator<(const stc& lhs, const stc& rhs){
//    return std::tie(lhs.l, lhs.r) < std::tie(rhs.l, rhs.r);
//}



int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N; cin >> N;
    vd X(N), Y(N);
    rep(i, N){
        cin >> X[i] >> Y[i];
    }
    
    double ans = 0.0;
    ll size = 5*1e6;
    rep(i, size){
        auto uc = cos(2*pi/size*i), us = sin(2*pi/size*i);
        double res = 0.0;
        rep(k, N){
            double tmp = uc*X[k] + us*Y[k];
            if(tmp > 0.0){
                res += tmp;
            }
        }
        chmax(ans, res);
    }
    cout << fixed << setprecision(20) << ans << endstr;
    return 0;
}


Measured memory_bytes: 384
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <queue>
#include <list>
#include <stack>
#include <math.h>
#include <map>
#include <unordered_map>
#include <set>
using namespace std;

#define ll long long
#define ull unsigned long long

#define	max	(ll)(1e9 + 7)

ll gcd(ll a, ll b) {
	if (a < b)
		swap(a, b);
	while (ll r = a % b)
		a = b, b = r;
	return b;
}

class mod
{
public:
	ll val;

	mod(ll v)
	{
		val = v % max;
	}

	mod()
	{
		val = 0;
	}

	void operator -=(const mod &v)
	{
		val -= v.val;

		if (val < 0)
			val += max;
	}

	void operator +=(const mod &v)
	{
		if (val + v.val >= max)
			val -= max;
		val += v.val;
	}

	void operator +=(ll &v)
	{
		if (val + v >= max)
			val -= max;
		val += v;
	}

	void operator *=(const mod &v)
	{
		val *= v.val;
		val %= max;
	}

	void operator *=(ll &v)
	{
		val *= v;
		val %= max;
	}

	ll modinv(ll a)
	{
		ll b = max, u = 1, v = 0;
		while (b)
		{
			ll t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		u %= max;
		if (u < 0)
			u += max;
		return u;
	}

	void operator /=(const mod &v)
	{
		val *= modinv(v.val);
		val %= max;
	}

	void operator /=(ll &v)
	{
		val *= modinv(v);
		val %= max;
	}
};

struct UnionFind
{
	vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
	vector<int> childN;
	ll r = 0;

	UnionFind(int N) : par(N), childN(N)
	{
		//最初は全てが根であるとして初期化
		for (int i = 0; i < N; i++)
			par[i] = i, childN[i] = 1;
	}

	int root(int x)
	{
		// データxが属する木の根を再帰で得る：root(x) = {xの木の根}
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}

	void unite(int x, int y)
	{
		// xとyの木を併合
		int rx = root(x); //xの根をrx
		int ry = root(y); //yの根をry
		if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
		par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
		r -= childN[rx] * (childN[rx] - 1) / 2;
		r -= childN[ry] * (childN[ry] - 1) / 2;
		childN[ry] += childN[rx];
		childN[rx] = 0;
		r += childN[ry] * (childN[ry] - 1) / 2;
	}

	bool same(int x, int y)
	{
		// 2つのデータx, yが属する木が同じならtrueを返す
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};

//	for priority queue
//	priority_queue<ipair, vector<ipair>, greater<ipair>>
using ipair = pair<int, pair<int, int>>;
bool operator>(const ipair a, const ipair b) { return a.first > b.first; };
bool operator<(const ipair a, const ipair b) { return a.first < b.first; };

using xpair = pair<int, int>;
bool operator>(const xpair &a, const xpair &b) { return a.second > b.second || (a.second == b.second && a.first > b.first); };
bool operator<(const xpair &a, const xpair &b) { return a.second < b.second || (a.second == b.second && a.first > b.first); };
bool operator==(const xpair &a, const xpair &b) { return a.first == b.first; };

int main()
{
	string s, t;
	cin >> s >> t;

	int r = 0;
	for (int i = 0; i < s.length(); i++)
		if (s[i] != t[i])
			r++;
	printf("%d", r);
	return 0;
}


Measured memory_bytes: 3352