akhauriyash/Code-Regression huggingface dataset:
#include"bits/stdc++.h"
using namespace std;

void Main() {
  int n, k;
  cin >> n >> k;
  vector<int> h(n);
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }
  sort(h.begin(), h.end());
  long long int ans = 0;
  for (int i = 0; i < n - k; i++) {
    ans += h[i];
  }
  cout << ans << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<set>
#include<string>
using namespace std;
int main() {
	int N;
	cin >> N;
	set<string> s;
	for (int i = 0; i < N; i++) {
		string st;
		cin >> st;
		s.insert(st);
	}
	cout << s.size() << endl;
}

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

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

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

signed main()
{   
    gearup;
    ll n,k; cin >> n >> k;
    if(k == 0)cout << n*n << endl;
    else{
        ll res = 0;
        rep(i,n+1){
            if(i-1>=k){//k以上のあまりを出す
                res += n/i * (i-k);
                res += max(0LL,n%i - k + 1);
            }
        }
        cout << res << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vec = vector<ll>;
using vecp = vector<P>;
using mat = vector<vec>;
using matp = vector<vecp>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define all(v) v.begin(), v.end()
    

int main(){
  ll N,x=0,t=0;
  cin >> N;
  vec A(N);
  rep(i,N){
    cin >> A.at(i);
    A.at(i)--;
  }
  while(true){
    x=A.at(x);
    t++;
    if(x==1){
      cout << t << endl;
      return 0;
    }
    if(x==0){
      cout << -1 << endl;
      return 0;
    }
    if(t==N-1){
      cout << -1 << endl;
      return 0;
    }
  }
  
}
          
          
       

Measured memory_bytes: 4020
/* 実行時間1s制限の場合
  10^6 1,000,000   : 余裕をもって間に合う
  10^7 10,000,000  : おそらく間に合う
  10^8 100,000,000 : 非常にシンプルな処理でないと厳しい
 */
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#include <bits/stdc++.h>
using namespace std;

typedef long long ll; // long longはデータモデル(LLP64, LP64, ...)によらず64bit.
ll gcd(ll a, ll b) {return b ? gcd(b, a%b) : a;}  // Greatest Common Divisor ユークリッドの互除法（aが長辺）
vector<pair<ll,int>> factorize(ll n) {            // a,bの公約数 = GCD(a, b)の約数
    vector<pair<ll,int>> res;
    for (ll i = 2; i*i <= n; i++) { // √nまで探せばよい
        if (n%i) continue;
        res.emplace_back(i, 0);     // 割り切れたら
        while (n%i == 0) {
            n /= i;
            res.back().second++;
        }
    }
    if (n != 1) res.emplace_back(n, 1); // この時点で1でなかったら、残りは素数.
    return res;
}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}         // Least Commont Multiple オーバーフローしないように先に割る
ll ceil(ll a, ll b) {return (a+b-1)/b;}

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

int main(int argc, char* argv[])
{
#ifdef LOCAL
    // 以降 cin の入力元が 'xxx.txt' になる
    // std::ifstream in(argv[1]);
    //std::cin.rdbuf(in.rdbuf());
    //std::ifstream in(string(argv[0]) + ".txt");
    std::ifstream in("in.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    int a, b, c;
    cin >> a >> b >>c;

    if (a == b) {cout << c; return 0;}
    if (a == c) {cout << b; return 0;}
    if (c == b) {cout << a; return 0;}

    return 0;
}

/*
  - 1e9 : 10^9
  - container一般
    - 合計
      accumulate(a.begin(), a.end(), 0LL)  0LLはオーバーフロー用
  - vector
    vector<int> A(N, 0); // 0で初期化(省略可)
    - loop
      for  (int i = 0; i < A.size(); i++) {}
      for  (int elem : A) {}
    - sort
      std::sort(v.begin(), v.end());  // 昇順
      std::sort(v.begin(), v.end(), std::greater<int>()); //降順
      - vector<vector<int>> cnt(h, vector<int>(w))
    - sort(struct)
        struct st_t {
            string name;
            int p;
            bool operator<(const st_t& another) const {
                if (name == another.name)
                {
                    return p > another.p;
                }
                return name < another.name;
            }
        };
        vector<st_t> st(n);
        sort(st.begin(), st.end());
  - pair
    - pairのソートの定義 : firstが優先的に比較。同じだったらsecond。
    - pair<pair<string,int>,int> p[110];
      std::sort(p,p+a);
        こうすると、first.first -> first.second -> secondの順にソートされる
    - sort
      - sort(a.begin(), cb.end(), greater<pair<int, int>>());
  - map
    - for (auto x : map) {}  // x.first:key  x.second:value.
  - priority_queue<int> q;
    - q.top()に最大値が入っている
  - string
    - loop
      for (char& c : s) {}
 */



Measured memory_bytes: 256
#include <iostream>
#include <tuple>
#include <map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>
using namespace std;
void init();
#define REP(var, num) for(sll var = 0; var < num; var++)
typedef signed long long sll;
typedef unsigned long long ull;
/*
numeric_limits<sll>::max()
*/

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

    sll highest = 0;
    sll sum = 0;
    REP(i, n) {
        sll p;
        cin >> p;
        sum += p;
        highest = max(highest, p);
    }

    cout << sum - highest + (highest / 2) << endl;
    return 0;
}

void init() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    int A, B, K;
    cin >> A >> B >> K;
    for (int i = 0; i < K; i++) {
        if (i % 2 == 0) {
            A /= 2;
            B += A;
        } else {
            B /= 2;
            A += B;
        }
    }
    cout << A << " " << B << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 4000005

ll fact[NUM];

ll extgcd(ll a,ll b,ll &x,ll &y){
	ll d = a;
	if(b != 0){
		d = extgcd(b,a%b,y,x);
		y -= (a/b)*x;
	}else{
		x = 1;
		y = 0;
	}
	return d;
}

ll mod_inverse(ll a,ll m){
    ll x,y;
    extgcd(a,m,x,y);
    return (m+x%m)%m;
}

ll mod_fact(ll n,ll p,ll &e){
	e = 0;
	if(n == 0)return 1;

	int res = mod_fact(n/p,p,e);
	e += n/p;

	if(n/p%2 != 0)return res*(p-fact[n%p])%p;
	return res*fact[n%p]%p;
}

ll nCm(ll n,ll m,ll p){
   if(n < m) return 0;
   ll e1,e2,e3;
    ll a1 = mod_fact(n,p,e1),a2 = mod_fact(m,p,e2),a3 = mod_fact(n-m,p,e3);
    if(e1 > e2+e3)return 0;
    return a1 * mod_inverse(a2*a3%p,p)%p;
}

ll A,B,C,S_X,S_Y;

void func(){

	ll ans = 0,alloc_A,alloc_B,tmp;
	ll S_diff = S_X-S_Y;

	for(ll lead_X = A; lead_X <= S_X; lead_X++){
		ll lead_Y = lead_X-S_diff;
		if(lead_Y < B)continue;

		if(lead_X == 0){
			alloc_A = 1;
		}else{
			alloc_A = nCm(lead_X-1,lead_X-A,MOD);
		}

		if(lead_Y == 0){
			alloc_B = 1;
		}else{
			alloc_B = nCm(lead_Y-1,lead_Y-B,MOD);
		}

		tmp = alloc_A*alloc_B;
		tmp %= MOD;

		tmp *= nCm(S_X-lead_X+(A+B+C)-1,A+B+C-1,MOD);
		tmp %= MOD;

		ans += tmp;
		ans %= MOD;
	}

	ans *= nCm(A+B+C,A,MOD);
	ans %= MOD;
	ans *= nCm(B+C,B,MOD);
	ans %= MOD;

	printf("%lld\n",ans);
}

int main(){

	fact[0] = 1;
	for(ll i = 1;i < NUM; i++){
		fact[i] = fact[i-1]*i%MOD;
	}

	while(true){
		scanf("%lld %lld %lld %lld %lld",&A,&B,&C,&S_X,&S_Y);
		if(A == 0 && B == 0 && C == 0)break;

		func();
	}

	return 0;
}



Measured memory_bytes: 34444
#include<bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;
typedef vector< pii > vii;

#define ll          long long
#define ff          first
#define ss          second
#define pb          push_back
#define mkp         make_pair
#define sz          size()

#define forf(a,b,c)    for(int i=a;i<=b;i+=c)
#define forr(a,b,c)    for(int i=a;i>=b;i-=c)
#define all(a)      a.begin(),a.end()
#define mem(a,b)    memset(a,b,sizeof(a))
#define pi          2*acos(0.0)
#define End         return 0;
#define nl endl

#define scan1(a)    scanf("%d",&a)
#define scan2(a,b)  scanf("%d %d",&a,&b)
#define scan3(a,b,c)  scanf("%d %d %d",&a,&b,&c)
#define scanl(a)    scanf("%lld",&a)
#define scanll(a,b) scanf("%lld %lld",&a,&b)
#define scanlll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)

#define print1(a)    printf("%d",a)
#define print2(a,b)  printf("%d %d",a,b)
#define print3(a,b,c)  printf("%d %d %d",a,b,c)
#define printl(a)    printf("%lld",a)
#define printll(a,b) printf("%lld %lld",a,b)
#define printlll(a,b,c) printf("%lld %lld %lld",a,b,c)

#define MAXN        100000007
#define INF 0x3f3f3f3f
bool mark[100005];vi prime;
void seive(ll N){for(int i=2;i<=N;i++){if(mark[i]==false){prime.pb(i);for(int j=i+i;j<N;j+=i)mark[j]=true;}}}
//freopen("input.txt", "r", stdin);

int main()
{
   ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    cin>>n;
    double yen=0,bt=0;
    while(n--){
        float c;string s;
        cin>>c>>s;
        if(s=="JPY") yen+=c;
        else bt+=c;
    }
    yen+=(bt*380000.0);
    cout<<fixed<<setprecision(5)<<yen<<endl;
    End;
}


Measured memory_bytes: 256
#include<cstdio>
#include<utility>
#include<cmath>
#include<algorithm>

using namespace std;

int main(){
    const int INF = 1000000001;
    int n, k;
    scanf("%d %d", &n, &k);
    long int x[n], y[n];
    for(int i = 0; i < n; i++){
        long int x1, y1;
        scanf("%ld %ld", &x1, &y1);
        x[i] = x1;
        y[i] = y1;
    }
    long int min = 9000000000000000000;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            for(int t = 0; t < n; t++){
                for(int l = 0; l < n; l++){
                    long int x_lst[] = {x[i], x[j]};
                    long int y_lst[] = {y[t], y[l]};
                    int count = 0;
                    long int xmin = INF;
                    long int xmax = -INF;
                    long int ymin = INF;
                    long int ymax = -INF;
                    for(int m = 0; m < 2; m++){
                        if (x_lst[m] > xmax){
                            xmax = x_lst[m];
                        }
                        if (x_lst[m] < xmin){
                            xmin = x_lst[m];                            
                        }
                        if (y_lst[m] > ymax){
                            ymax = y_lst[m];                            
                        }
                        if (y_lst[m] < ymin){
                            ymin = y_lst[m];
                        }
                    }
                    for(int m = 0; m < n; m++){
                        if (xmin <= x[m] && x[m] <= xmax && ymin <= y[m] && y[m] <= ymax) count++;
                    }
                    // printf("%ld %ld %ld %ld\n", xmax, xmin, ymax, ymin);
                    // printf("%d %d\n",count, k);
                    if (count >= k){
                        long int area = (xmax - xmin) * (ymax - ymin);
                        
                        if (min > area) min = area;
                    }
                    
                }
            }
            
        }
        
    }
    printf("%ld\n", min);
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast",3,"inline")
#include<bits/stdc++.h>
using namespace std;
#define fir first
#define sec second
#define m_p make_pair
#define y1 ygftgfgcdtfgxffgx
#define y2 yfdsesgvtyghftfvv
#define x1 xvyr6cf6fgcfgf676
#define x2 xcr6rfc5r66y6r6fr
#define up_bound upper_bound
#define low_bound lower_bound
#define next_per next_permutation
#define pb push_back
#define i_to_s to_string
typedef priority_queue<int> p_queue;
typedef priority_queue<int, vector<int>, greater<int> > min_p_queue;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int mon[20]={31,28,31,30,31,30,31,31,30,31,30,31};
ll gcd(ll x,ll y){return ((y==0)?x:gcd(y,x%y));}
p_queue q;
int n,a[100010],b[100010];
ll sum,res;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i];
	for(int i=0;i<n;i++)cin>>b[i];
	for(int i=0;i<n;i++)
		if(a[i]<b[i])sum+=(b[i]-a[i]),res++;
		else q.push(a[i]-b[i]);
	while(q.size()&&sum>0)sum-=q.top(),q.pop(),res++;
	if(sum>0)cout<<-1;
	else cout<<res;
	return 0;
}


Measured memory_bytes: 1660
#if 0

#endif

#include <bits/stdc++.h>
#define REP(i, n) for(int i=0;i<int(n);++i)
using namespace std;
template<class A>void p(A a){cout << (a) << endl;}
template<class A,class B>void p(A a,B b){cout << a << " "  ;p(b);}
template<class A,class B,class C>void p(A a,B b,C c){cout << a << " " ;p(b,c);}
template<class A,class B,class C,class D>void p(A a,B b,C c,D d){cout << a << " " ;p(b,c,d);}
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
int INF=numeric_limits<int>::max();
// for copy
// for(int i=0;i<N;++i) {
long long combi(long long n, long long k) {
  if (n == k || k == 0)
    return 1;
  else {
    return combi(n - 1, k - 1) + combi(n - 1, k);
  }
}

int main(void) {
  int N,M;cin>>N>>M;
  ll s=0;
  if (N>1) {
    s+=combi(N,2);
  }
  if (M>2) {
    s+=combi(M,2);
  }
  p(s);
  return 0;
}



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

int main(){
   int k,a,b;
   cin >> k >> a>> b;
   for(int i = a; i <= b; ++i){
       if(i % k == 0){
           cout << "OK" << endl;
           return 0;
       }
   }
   cout << "NG" << endl;
       return 0;
}


Measured memory_bytes: 3640
#include <stdio.h>
int s(int);
int main(){
  int n,i,j,count = 0,F = 0;
  scanf("%d",&n);
  int data[n];
  for(i=0; i<n; i++){
    scanf("%d",&data[i]);
  }
  for(i=0; i<n; i ++){
    if(s(data[i]) == 1)count++;
  }  
  printf("%d\n",count);
  return 0;
}

int s(int a){
  int j;
    if(a < 2)     return 0;
    else if(a == 2)  return 1;

    if(a % 2 == 0)  return 0;

  for(j = 3; j <= a / j; j += 2)
   if(a % j == 0)   return 0;
    return 1;
  }

Measured memory_bytes: 628
#include <iostream>

using namespace std;

bool judge(int a)
{
  int x = 1;

  while ( x*x <= a ) {
    if ( x*x == a ) return true;
    ++x;
  }

  return false;
}

int main()
{
  int x,y;
  int cnt = 0;

  cin >> x >> y;

  int tmp = y;
  while ( tmp > 0 ) {
    ++cnt;
    tmp /= 10;
  }

  tmp = 1;
  for (  int i = 0; i < cnt; ++i ) tmp *= 10;
  y += x*tmp;

  if ( judge(y) ) cout << "Yes\n";
  else cout << "No\n";
}


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

using namespace std;

typedef long long ll;

int main() {
  int k,a,b;
  cin >> k >> a >> b;
  if(a%k!=0 & b%k!=0 && b/k == a/k) cout << "NG" << endl;
  else cout << "OK" << endl;
  
  return 0;
}


Measured memory_bytes: 3596
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
using namespace std;
const int mod = 1000000007;
#define ll long long

ll D[200010], T[200010];
int main()
{
	int N, M;
	ll d, t;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> d;
		D[i] = d;
	}
	cin >> M;
	for (int i = 0; i < M; i++) {
		cin >> t;
		T[i] = t;
	}
	sort(D, D + N, greater<ll>());
	sort(T, T + M, greater<ll>());
	int j = 0;
	for (int i = 0; i < M; i++) {
		while (T[i] != D[j]) {
			if (T[i] > D[j]) {
				cout << "NO" << endl;
				return 0;
			}
			j++;
		}
		if (T[i] == D[j]) j++;
	}
	cout << "YES" << endl;
}

Measured memory_bytes: 3328
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize
    };

    let mut count = 0;
    for _ in 0..n {
        input! {
            d1: usize,
            d2: usize,
        }

        if d1 == d2 {
            count += 1;
        } else {
            count = 0;
        }

        if count >= 3 {
            break;
        }
    }

    if count >= 3 {
        println!("Yes")
    } else {
        println!("No")
    }
}


Measured memory_bytes: 2140
import itertools
cnt = 0
N, D= (int(x) for x in input().split())
X = [[] * D for i in range(N)]
def distance(A,B):
  s = 0
  for i in range(len(A)):
    s = s + (A[i] -B[i])**2
  return s**(1/2)
for i in range(N):
  X[i] = [int(x) for x in input().split()]
c = list(itertools.combinations(X, 2))
for i in c:
  if distance(i[0],i[1]).is_integer():
    cnt += 1
print(cnt)
  

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		int N = int.Parse(Console.ReadLine());
		int[,]A = new int[N-1,2];
		var list = new List<int>[N];
		var E = new List<int>[N];
		for(var i=0;i<N;i++){
			list[i] = new List<int>();
			E[i] = new List<int>();
		}
		for(var i=0;i<N-1;i++){
			string[] str = Console.ReadLine().Split();
			A[i,0] = int.Parse(str[0]);
			A[i,1] = int.Parse(str[1]);
			list[A[i,0]-1].Add(A[i,1]);
			list[A[i,1]-1].Add(A[i,0]);
		}
		var list1 = new List<int>();
		var list2 = new List<int>();
		var lista = new List<int>();
		int[]F = new int[N];
		lista.Add(1);
		list2.Add(1);
		var lt = 0;
		F[0] = 1;
		while(lista.Count>0){
			lt++;
			var lista2 = new List<int>(lista);
			lista.Clear();
			foreach(var i in lista2){
				foreach(var j in list[i-1]){
 					if(F[j-1]==0){
						if(lt%2==1){
							list1.Add(j);
						} else {
							list2.Add(j);
						}
						F[j-1] = 1;
						lista.Add(j);
					}
				}
			}
		}
		int a = 3;
		int f = 1;
		int[]ans = new int[N];
		if(list1.Count * 3 < N){
			for(var i=0;i<list1.Count;i++){
				ans[list1[i]-1] = a;
				a += 3;
			}
			for(var i=0;i<list2.Count;i++){
				if(f==1 && a > N){
					f = 2;
					a = 2;
				} else if(f==2 && a > N){
					f = 3;
					a = 1;
				}
				ans[list2[i]-1] = a;
				a += 3;
			}
		} else if(list2.Count * 3 < N){
			for(var i=0;i<list2.Count;i++){
				ans[list2[i]-1] = a;
				a += 3;
			}
			for(var i=0;i<list1.Count;i++){
				if(f==1 && a > N){
					f = 2;
					a = 2;
				} else if(f==2 && a > N){
					f = 3;
					a = 1;
				}
				ans[list1[i]-1] = a;
				a += 3;
			}
		} else {
			int a1 = 1;
			int a2 = 2;
			int a3 = 3;
			for(var i=0;i<list1.Count;i++){
				if(f==1 && a1 > N){
					f = 2;
				}
				if(f==1){
					ans[list1[i]-1] = a1;
					a1 += 3;
				} else {
					ans[list1[i]-1] = a3;
					a3 += 3;
				}
			}
			f = 1;
			for(var i=0;i<list2.Count;i++){
				if(f==1 && a2 > N){
					f = 2;
				}
				if(f==1){
					ans[list2[i]-1] = a2;
					a2 += 3;
				} else {
					ans[list2[i]-1] = a3;
					a3 += 3;
				}
			}
		}
		Console.Write(ans[0]);
		for(var i=1;i<N;i++){
			Console.Write(" "+ans[i]);
		}
	}
}

Measured memory_bytes: 56808
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);

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

  int ans = n/__gcd(2,n)*2;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3584
import sys 
target = list(map(int,input()))

if target[0]+target[1]+target[2]+target[3] == 7:
	print(str(target[0])+'+'+str(target[1])+'+'+str(target[2])+'+'+str(target[3])+'=7')
	sys.exit()
elif target[0]+target[1]+target[2]-target[3] == 7:
	print(str(target[0])+'+'+str(target[1])+'+'+str(target[2])+'-'+str(target[3])+'=7')
	sys.exit()
elif target[0]+target[1]-target[2]+target[3] == 7:
	print(str(target[0])+'+'+str(target[1])+'-'+str(target[2])+'+'+str(target[3])+'=7')
	sys.exit()
elif target[0]+target[1]-target[2]-target[3] == 7:
	print(str(target[0])+'+'+str(target[1])+'-'+str(target[2])+'-'+str(target[3])+'=7')
	sys.exit()
elif target[0]-target[1]+target[2]+target[3] == 7:
	print(str(target[0])+'-'+str(target[1])+'+'+str(target[2])+'+'+str(target[3])+'=7')
	sys.exit()
elif target[0]-target[1]+target[2]-target[3] == 7:
	print(str(target[0])+'-'+str(target[1])+'+'+str(target[2])+'-'+str(target[3])+'=7')
	sys.exit()
elif target[0]-target[1]-target[2]+target[3] == 7:
	print(str(target[0])+'-'+str(target[1])+'-'+str(target[2])+'+'+str(target[3])+'=7')
	sys.exit()
elif target[0]-target[1]-target[2]-target[3] == 7:
	print(str(target[0])+'-'+str(target[1])+'-'+str(target[2])+'-'+str(target[3])+'=7')
	sys.exit()

Measured memory_bytes: 3192
import * as fs from "fs";

let N = Number.parseInt(fs.readFileSync("/dev/stdin", "utf8"));


function solve() {
	for(let x=1; x<50001; x++) {
		if (Math.floor(1.08*x) == N) {
			return x;
		}
	}
	return ':(';
}

console.log(solve())


Measured memory_bytes: 32484
#include <bits/stdc++.h>
#include<limits.h>
using namespace  std;
typedef long long int ll;
typedef long double ld;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define sz(a) a.size()
#define fi first
#define se second
#define rsz(a,n) a.resize(n)
#define test(t) ll t;cin>>t;while(t--)
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define fillv(a,k) memset(a,k,sizeof(a))
#define filla(a,k,n) memset(a,k,sizeof(a[0])*n)
#define leadzero(a) __builtin_clz(a) //count leading zeros
#define trailzero(a) __builtin_ctz(a) //count trailing zeros
#define bitcount(a) __builtin_popcount(a) // count set bits (add ll)
#define ln cout<<"\n"
#define sp cout<<" "
#define spaceprint(a,i,s,n) {forsn(i,s,n) { cout<<a[i]; sp;}}
#define lineprint(a,i,s,n) {forsn(i,s,n) {cout<<a[i]; ln;}}
#define maxe(a) *max_element(a.begin(),a.end())
#define maxi(a) max_element(a.begin(),a.end())-a.begin()
#define mine(a) *min_element(a.begin(),a.end())
#define mini(a) min_element(a.begin(),a.end())-a.begin()
#define all(c) c.begin(),c.end()
#define trav(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define present(container, element) (container.find(element) != container.end())
#define cpresent(container, element)  (find(all(container),element) != container.end())// check the presence of element
//copy(from_begin, from_end, to_begin); copy function
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<string> vs;
typedef vector<int> v32;
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<p64> vp64;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
const int LIM = 1e5+5, MOD = 1e9+7;
#define sumv(v) accumulate(all(v),ll(0))
#define productv(v) accumulate(all(v), ll(1), multiplies< ll >())
ll dp[100003];
ll n,m;
v64 v[100003];
ll solve(ll i)
{
	if(dp[i]!=-1)
		return dp[i];
	ll maxx=0;
	for(ll j=0;j<v[i].size();j++)
	{
		maxx=max(maxx,solve(v[i][j])+1);
	}
	dp[i]=maxx;
	return maxx;
}
int main()
{
	cin>>n>>m;
	for(ll i=0;i<m;i++)
	{
		ll x,y;
		cin>>x>>y;
		v[x].pb(y);
	}
	fillv(dp,-1);
	ll maxx=0;
	for(ll i=1;i<=n;i++)
	{
		if(dp[i]==-1)
			dp[i]=solve(i);
		maxx=max(dp[i],maxx);
	}
	cout<<maxx<<endl;
}

Measured memory_bytes: 8576
#include <bits/stdc++.h>
using namespace std;
const auto start_time = std::chrono::high_resolution_clock::now();
void timecalculater(){
    #ifndef ONLINE_JUDGE
    auto end_time = std::chrono::high_resolution_clock::now();
    std::chrono::duration<double> diff = end_time-start_time;
    cerr<<"Time Taken : "<<diff.count()<<"\n";
    #endif
}
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repA(i, a, n) for(int  i = a; i <= (n); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()
#define fill(a) memset(a, 0, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long int> vll;
typedef vector<pii> vii;
ll p=1e9+7;
const int N=2e5+5;
int main() {
 
    cin.sync_with_stdio(0); cin.tie(0);
    cin.exceptions(cin.failbit);
    int T=1;
    // cin>>T;
    while(T--){
        string s;cin>>s;
        ll n=sz(s);
        ll ans=0;
        map<int,int> m;m[0]=1;
        int r=0;int t=1;
        for(int i=n-1;i>=0;i--){
            r=r+t*(s[i]-'0');r%=2019;
            if(m.find(r)!=m.end()){
                ans+=m[r];
                // dbg(i);
            }
            t=t*10;t%=2019;
            m[r]++;
        }
        cout<<ans;
    }   
    timecalculater();
    return 0;   
} 

Measured memory_bytes: 3792
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

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

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

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

int main(){
  int N, X; cin >> N >> X;
  vector<int> L(N);
  rep(i, N) cin >> L[i];

  vector<int> cord(N + 1);
  cord[0] = 0;
  rep(i, N) cord[i + 1] = cord[i] + L[i];
  int ans = 0;
  rep(i, N){
    if (cord[i] <= X) ans++;
    else break;
  }
  if (cord[N] <= X) ans = N + 1;
  cout << ans << endl;
}


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

int main(){
  ull L, R;
  cin >> L >> R;
  int minv = 3000;
  int D[2020][2020];
  
  for (int i = 0; i < 2020; i++) {
    for (int j = 0; j < 2020; j++) {
      D[i][j] = i * j % 2019;
    }
  }
  
  ull l, r;
  l = L % 2019; r = R % 2019;
  if (R >= L + 2019) r = 2020;
  
  for (int i = l; i < r; i++) {
    for (int j = i + 1; j <= r; j++) {
      minv = min(minv, D[i][j]);
    }
  }
  
  cout << minv;
  
  return 0;
}




Measured memory_bytes: 16128
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>

int sub(int n) {
    int ans = 1;
    for(int i=1;i<=n;i++){
        ans *= i;
    }
    return ans;
}

int main() {
    int N;
    cin >> N;
    vector<int> x(N);
    vector<int> y(N);
    for(int i=0;i<N;i++){
        cin >> x.at(i) >> y.at(i);
    }
    
    double sum=0;
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            sum += sqrt((x.at(i) - x.at(j)) * (x.at(i) - x.at(j)) + (y.at(i) - y.at(j)) * (y.at(i) - y.at(j)));
        }
    }
    double num = 2*sub(N-1) * sum / sub(N);
    printf("%.10lf\n", num);
}


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

int main(){
	int N;
	std::cin >> N;
	
	std::array<int, 20> ans;
	
	for(int i=0; i<N; ++i){
		double xa, ya, ra, xb, yb, rb;
		std::cin >> xa >> ya >> ra >> xb >> yb >> rb;
		
		double d = pow((xa-xb)*(xa-xb) + (ya-yb)*(ya-yb), 0.5);
		
		if(ra > rb && d < ra-rb) ans[i] = 2;
		else if(rb > ra && d < rb-ra) ans[i] = -2;
		else if(d <= ra+rb) ans[i] = 1;
		else if(d > ra+rb) ans[i] = 0;
	}
	
	for(int i=0; i<N; ++i)
		std::cout << ans[i] << std::endl;
	
	return 0;
}

Measured memory_bytes: 1296
N, K = map(int, input().split())
A = list(map(int, input().split()))
MOD = 10 ** 9 + 7


P = []
M = []
zero = 0
for a in A:
    if a >= 0:
        P.append(a)
    elif a < 0:
        M.append(a)

ans = 1
if K == N:
    for a in A:
        ans *= a
        ans %= MOD
    print(ans)
    exit()

ans = 1
if len(P) == 0 and K % 2 == 1:
    M.sort(reverse=True)
    for k in range(K):
        ans *= M[k]
        ans %= MOD
    print(ans)
    exit()

P.sort(reverse=True)
M.sort()
S = 1
LP = len(P)
LM = len(M)
cur_p = 0
cur_m = 0
cnt = 0
ans = 1
while cnt < K:
    if K - cnt == 1 or LM - cur_m <= 1:
        flag = 'p'
    elif LP - cur_p == 1:
        if (K - cnt) % 2 == 1:
            flag = 'p'
        else:
            flag = 'm'
    elif LP - cur_p == 0:
        flag = 'm'
    else:
        p1 = P[cur_p]
        p2 = P[cur_p + 1]
        m1 = M[cur_m]
        m2 = M[cur_m + 1]
        if p1 * p2 >= m1 * m2:
            flag = 'p'
        else:
            flag = 'm'
    
    if flag == 'p':
        ans *= P[cur_p]
        ans %= MOD
        cur_p += 1
        cnt += 1
    else:
        ans *= M[cur_m] * M[cur_m + 1]
        ans %= MOD
        cur_m += 2
        cnt += 2

print(ans)


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

using namespace std;

typedef long long Int;
typedef pair<Int,Int> P;

#define rep(i,x) for(Int i = 0; i < (Int)(x); i++)
#define rrep(i,x) for(Int i = ((Int)(x) - 1); i >= 0; i--)
#define _upgrade ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back


template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

//ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
//ll lcm(ll x, ll y) {return x / gcd(x, y) * y;}

Int dx[4] = {1,0,-1,0};
Int dy[4] = {0,1,0,-1};
const Int INF = 1001002003004005006ll;
const Int mod = 1e9 + 7;
const double PI = 3.14159265358979323846;


// ****************************************CODE***************************************//








int main(){
        Int x = 1;
        Int y = 1;
        Int n;
        cin >> n;
        for(Int i = 0; i < n; i++){
                Int a,b;
                cin >> a >> b;
                Int k = max((x+a-1)/a, (y+b-1)/b);
                x = k * a;
                y = k * b;
        }

        cout << x + y << endl;
        return 0;
}



Measured memory_bytes: 256
#ifdef OJ_MISC_OFFLINE

#include "prolog.h"

#else
#define PRINT
#define LCERR
#endif

#include <algorithm>
#include <array>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>

namespace {

using namespace std;

class Solution {
public:
    vector<int> exception_handling(vector<int>& nums) {
        int max1 = numeric_limits<int>::min();
        int max2 = numeric_limits<int>::min();
        for (size_t i = 0; i < nums.size(); ++i) {
            if (nums[i] >= max1) {
                max2 = max1;
                max1 = nums[i];
            } else if (nums[i] > max2) {
                max2 = nums[i];
            }
        }
        vector<int> result;
        if (max1 == max2) {
            for (size_t i = 0; i < nums.size(); ++i) {
                result.emplace_back(max1);
            }
            return result;
        } else {
            for (size_t i = 0; i < nums.size(); ++i) {
                if (nums[i] == max1) {
                    result.emplace_back(max2);
                } else {
                    result.emplace_back(max1);
                }
            }
            return result;
        }
    }
private:

};

int solve() {
    Solution solution;
    // handle IO here
    int N;
    cin >> N;
    vector<int> nums(N);
    for (int i = 0; i < N; ++i) {
        cin >> nums[i];
    }
    auto result = solution.exception_handling(nums);
    for (auto n : result) {
        cout << n << endl;
    }
    return 0;
}

} // anonymous namespace

#ifdef OJ_MISC_OFFLINE

#include "epilog.h"

#else

int main() {
    return solve();
}

#endif


Measured memory_bytes: 3316
#include <stdio.h>

int main(void)
{
    int n=0,m=0,max=0,book=0,best=0;
    long k=0,A[200010]={},B[200010]={};
    scanf("%d %d %ld",&n,&m,&k);
    for(int i=1;i<=n;i++){
        scanf("%ld",&A[i]);
        A[i]+=A[i-1];
    }
    for(int i=1;i<=m;i++){
        scanf("%ld",&B[i]);
        B[i]+=B[i-1];
    }
    best=m;
    for(int i=0;i<=n;i++){
        if(k<A[i]) break;
        while(B[best]>k-A[i]){
            best-=1;
        }
        book=i+best;
        if(max<book) max=book;
    }
    printf("%d",max);
    return 0;
}


Measured memory_bytes: 4836
#include <iostream>
    #include<string>
    using namespace std;
     
    int main() {
        int k;
        cin>>k;
        if(k%2==1)
        {
            cout<<"No";
            return 0;
        }
    	string s;
    	cin>>s;
    	int a=k/2;
    	bool val=1;
    	for(int i=0;i<a;i++)
    	{
    	    if(s[i]!=s[i+a])
    	    {
    	        val=0;
    	        break;
    	    }
    	}
    	if(val==1)
    	cout<<"Yes";
    	else
    	cout<<"No";
    	
    	return 0;
    	
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bit(n,k) ((n>>k)&1) // nのk bit目
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using vt = vector<T>;
const int mod = 1000000007;
const double EPS = 1e-9;
//const long double EPS = 1e-14;
const int INF = (1<<30)-1;
//const ll INF = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
//template<class T = int> inline T in() { T x; cin >> x; return (x);}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int c[3][3];

int main () {
  rep(i,3)rep(j,3) cin >> c[i][j];
  bool ok = true;
  if (c[1][0]-c[0][0] + c[0][1] != c[1][1]) ok = false;
  if (c[1][0]-c[0][0] + c[0][2] != c[1][2]) ok = false;
  if (c[2][0]-c[0][0] + c[0][1] != c[2][1]) ok = false;
  if (c[2][0]-c[0][0] + c[0][2] != c[2][2]) ok = false;
  if (ok) yn;
  return 0;
}

Measured memory_bytes: 256
<?php
fscanf(STDIN, '%s', $s);
fscanf(STDIN, '%d', $q);
$cnt = 0;
for ($i = 0; $i < $q; $i++) {
    $query[] = explode(' ', trim(fgets(STDIN)));
    if ($query[count($query) - 1][0] === '1') {
        $cnt++;
    }
    $rev_cnt[] = $cnt;
}
//var_dump($rev_cnt);
if ($rev_cnt[$q - 1] % 2 === 0) {
    $ans = $s;
} else {
    $ans = strrev($s);
}
$left = $right = '';
for ($i = 0; $i < $q; $i++) {
    if ($query[$i][0] === '1') {
        continue;
    }
    if (($rev_cnt[$q - 1] - $rev_cnt[$i]) % 2 === 0) {
        $tmp = $query[$i][2];
        if ($query[$i][1] === '1') {
            $left .= $tmp;
        }
        if ($query[$i][1] === '2') {
            $right .= $tmp;
        }
    } else {
        $tmp = strrev($query[$i][2]);
        if ($query[$i][1] === '1') {
            $right .= $tmp;
        }
        if ($query[$i][1] === '2') {
            $left .= $tmp;
        }
    }
}
$ans = strrev($left) . $ans . $right;
echo $ans . PHP_EOL;

Measured memory_bytes: 115564
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	static final PrintStream out = System.out;
	static Scanner sc = new Scanner(System.in);
	static final long Mod = 1000_000_007L;
	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
		System.exit(0);
	}
	void solve() {
		int N = sc.nextInt();
		out.println(3*N*N);
	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)a[i] = nextInt();
		return a;
	}
	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)a[i] = nextLong();
		return a;
	}
	public int nextInt() {
		return Integer.parseInt(next());
	}
	public long nextLong() {
		return Long.parseLong(next());
	}
	public String next() {
		return sc.next();
	}

	long gcd(long m,long n) {
		if (m<n) return gcd(n,m);
		if (n==0)return m;
		return gcd(n,m%n);
	}

}

Measured memory_bytes: 23252
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
table = [0] * (max(a) + 1)
for x in a: table[x] += 1
t = 0
for x in table:
  if x > 1: t += x - 1
print(N + (-t // 2) * 2)

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;

#define ff first
#define ss second
//#define pb push_back
#define mp make_pair
#define sz size()
#define all(a)  A.begin(), A.end()
#define mem(a, b)     memset(a, b, sizeof(a))
#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))


#define forr(i,n) for(i=0; i<n; i++)
#define whilee(i,t) while(i!=t)
#define pb(x) push_back(x);

//sort(A.begin(),A.end());
//binary_search(A.begin(),A.end(),x);
//reverse(A.begin(), A.end());
//cout << *max_element(A.begin(), A.end());
//cout << *min_element(A.begin(), A.end());
//accumulate(A.begin(), A.end(), 0);
//next_permutation(A.begin(), A.end());
//prev_permutation(A.begin(), A.end());


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

    //vector <int> A;
    //deque <int> A;
    //queue <int> A;
    //stack <int> A;
    set <string> A;
    //map <int,int> A;
    //pair <int,int> A ;
    //vector <pair <int,int>> A ;
    //string S, T;
    ll i, j, k, a, b, c, l, m, n, p, q, r, s=0, t, x, y, z, cnt=0;
    cin>>n;
    string ch;
    string S[n];
    forr(i,n)
    {
        cin>>ch;
        S[i]=ch;
        if(i>0)
        {
            if(S[i-1][S[i-1].size()-1]!=S[i][0])
            {
                s=1;
            }
        }
        A.insert(ch);
        cnt++;
        if(A.size()!=cnt && s==0)
        {
            s=1;
        }
    }
    if(s!=1)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    return 0;
}




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

int main() {
  int a,b;
  cin>>a>>b;
  
  if(a<=b){
    for(int i=0;i<b;i++){
      cout<<a;
    }
    cout<<endl;
  }
  else  {
    for(int i=0;i<a;i++){
      cout<<b;
    }
    cout<<endl;
  }
  
}


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

using namespace std;
using ll = long long;
using PII = std::pair<int, int>;
using PLL = std::pair<ll, ll>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

const int mod = 1e9 + 7;

ll pow_mod(int p, int q, int mod)
{
    ll ret, r;
    ret = 1;
    r = p;

    while (q > 0)
    {

        if (q % 2)
        {
            ret *= r;
            ret %= mod;
        }

        r = (r * r) % mod;
        q /= 2;
    }

    return ret % mod;
}

int main()
{

#ifdef DEBUG
    cout << "DEBUG MODE" << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf());    //for debug
#endif

    int n, p;
    ll ans;
    cin >> n;
    ll c[n], d[n];
    ll e[n];
    vector<int> v;
    fill(d, d + n, 0);

    rep(i, n)
    {
        cin >> c[i];
    }
    sort(c, c + n);

    ll a = pow_mod(2, n - 1, mod);
    ll b = pow_mod(2, n - 2, mod);

    rep(i, n)
    {
        v.push_back(a);
        a += b;
        a %= mod;
    }

    reverse(v.begin(), v.end());

    ans = 0;
    rep(i, v.size())
    {
        ans += (c[i] * v[i]) % mod;
        ans %= mod;
    }
    cout << (ans * pow_mod(2, n, mod)) % mod << endl;

    return 0;
}


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

int main(){
    int N, K;
    cin >> N >> K;
    vector<int> h(N);
    for(int i = 0; i < N; i++)
        cin >> h[i];
    
    sort(h.begin(), h.end());
    int ans = h[K-1] - h[0];
    for(int i = 1; i < N-(K-1); i++)
        ans = min(ans, h[i+K-1] - h[i]);

    cout << ans << endl;

    return 0;
}

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


int main()
{
    int n;
    string s,r;

    cin >> n >> s;

    for(int i = 0; i < s.length(); i++)
    {
        if(((int)s.at(i) + n) > 90)
        {
            r =  char(((int)s.at(i) + n) - 26);
        }
        else
        {
            r =  char((int)s.at(i) + n);
        }

        cout << r;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1000000007;
vector<pair<int,int>> hen[100000];
int iro[100000]={};

signed main() {
int n,m;
cin>>n>>m;
string s;
cin>>s;
vector<int> ans;
ans.push_back(n);
int t=0,q=0;
while(t!=n){
    t+=m;q=0;
    while((t-q>n||s[n-(t-q)]=='1')&&q<m)q++;
    if(q==m){
        cout<<-1;
        return 0;
    }
    t-=q;
    ans.push_back(n-t);
}
for(int i=ans.size()-1;i>0;i--){
    cout<<ans[i-1]-ans[i]<<' ';
}



return 0;
}


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

void solv() {
    string str;
    cin >> str;
    // cout << str << endl;
    for (int i = 0; i < str.size(); i++) {
        //      cout << i << endl;
        if (i + 1 < str.size() and str[i] == str[i + 1]) {
            cout << i + 1 << ' ' << i + 2 << endl;
            return;
        }
        if (i + 2 < str.size() and str[i] == str[i + 2]) {
            cout << i + 1 << ' ' << i + 3 << endl;
            return;
        }
    }
    cout << "-1 -1" << endl;
}

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

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


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

  vector<int> ans(N+1);
  for(int x = 1; x*x < N; x++){
    for(int y = 1; y*y < N; y++){
      for(int z = 1; z*z < N; z++){
        int t = x*x+y*y+z*z+x*y+y*z+z*x;
        if(t <= N){
          ans[t]++;
        }
      }
    }
  }

  FOR(i, 1, N+1){
    cout << ans[i] << "\n";
  }

  return 0;
}


Measured memory_bytes: 3696
from collections import Counter

if __name__ == '__main__':
    n = int(input())
    vs = [int(s) for s in input().split()]
    counter0 = list(Counter(vs[0::2]).items()) + [(100001, 0)]
    counter1 = list(Counter(vs[1::2]).items()) + [(100001, 0)]
    v0, c0 = max(counter0, key=lambda t: t[1])
    v1, c1 = max(counter1, key=lambda t: t[1])
    counter0.remove((v0, c0))
    counter1.remove((v1, c1))
    res = 0
    if v0 != v1:
        res = n - c0 - c1
    else:
        _, c02 = max(counter0, key=lambda t: t[1])
        _, c12 = max(counter1, key=lambda t: t[1])
        res = n - (c0 + c12 if c12 > c02 else c1 + c02)
    print(res)


Measured memory_bytes: 20564
import java.util.Scanner;

/**
 * @author kawakami
 *
 */
class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		StringBuilder sb = new StringBuilder();
		Scanner as = new Scanner(System.in);
		
		int x,y,ama;
		int i = 0;
		int big = 0;
		int sma = 0;
		
		x = Integer.parseInt(as.next());
		y = Integer.parseInt(as.next());
		
		if(x > y){
			
			big = x;
			sma = y;
	
		}
		else{
			
			big = y;
			sma = x;
			
		}
		
		ama = big % sma;
		if(ama == 0){
			
			i = sma;
			
		}
		else{
			for(i=ama;i>=1;i--){
				
				if(ama % i == 0 && sma % i == 0){
					
					break;
					
				}
				
			}
		
		}
		if(i != 0){
			
			sb.append(String.valueOf(i));
		
		}
		else{
			
			sb.append(String.valueOf(1));
			
		}
		
		System.out.println(sb.toString());
	}

}

Measured memory_bytes: 26440