akhauriyash/Code-Regression huggingface dataset:
using namespace std;
using ll=long long;
#include <string>
#include <vector>
#include <cmath>
#include <iostream>

int main()
{
	string S;
	cin >> S;
	ll cnt = 0;
	char n = S[0];
	for (auto c : S) {
		if (n != c) { cnt++; n = c; }
	}
	cout << (cnt) << endl;
    return 0;
}



Measured memory_bytes: 512
import sys
A = list()
for i in xrange(5):
    A.append(int(raw_input()))

k = int(raw_input())

flag = False
for i in xrange(4):
    for j in range(i+1, 5, 1):
        if A[j] - A[i] > k:
            flag = True

if flag: print ':('
else: print 'Yay!'


Measured memory_bytes: 2568
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
typedef pair<int,int> P;
using ll = long long;
using VI = vector<int>;
int main(){
  int n;cin >> n;
  vector<int> a(n);
  for(auto &i:a){
    cin >> i;
  }
  for(int i=n-1;i>=0;i--){
    if(a[i]>=a[i-1]) continue;
    a[i-1]--;
    if(a[i]<a[i-1]){cout << "No" << endl;return 0;}
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
const int S = 1 << 21;
char p0[S],*p1,*p2;
#ifndef ZXY
#define getchar() (p2 == p1 && (p2 = (p1 = p0) + fread(p0,1,S,stdin)) == p1 ? EOF : *p1++)
#endif
inline int read() {
	static int x,c;x = 0;
	do{c = getchar();}while(!isdigit(c));
	do{x = (x << 3) + (x << 1) + (c & 15);c = getchar();}while(isdigit(c));
	return x;
}
#define int long long
const int N = 85;
int n,a[N];
signed main() {
	scanf("%lld",&n);
	for(int i = 1;i <= n;++i)
		scanf("%lld",a+i);
	long long ans = 1000,now = 0;
	a[0] = 201;a[n+1] = -1;
	for(int i = 1;i <= n;++i) {
		if(a[i] <= a[i-1] && a[i] < a[i+1]) {
			now += ans / a[i];
			ans %= a[i];
		}
		if(a[i] >= a[i-1] && a[i] > a[i+1]) {
			ans += now * a[i];
			now = 0;
		}
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 3820
#include<bits/stdc++.h>
#define ll int
#define ld long double
#define fs first
#define sc second
#define task "tet"
using namespace std;
const ll N = 1e6 + 9;
const ll inf = 1e9 + 7;
typedef pair<ll,ll> LL;
ld PI =  3.14159265358979323846264338327950;
ld a,b,x,y,minute,diff,rad;
void oper(){
    while(minute > 360.00000) minute -= 360.00000;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    if (fopen(task".inp", "r")){
        freopen(task".inp", "r", stdin);
        //freopen(task".out", "w", stdout);
    }
    cin>>a>>b>>x>>y;
    minute = (x*60.0 + y)*5.50;
    oper();
    diff = min(minute,360.0 - minute);
    rad = diff*(PI/180.0);
    cout<<fixed<<setprecision(20)<<sqrt(a*a + b*b - 2.0*a*b*cosl(rad));
}


Measured memory_bytes: 4148
#include <stdio.h>
#include <string.h>

typedef long long ll;
typedef struct {
    int ldata, rdata;
    int left, right;
    int parent;
    int weight;
} BINARY;

BINARY tree[101];

ll gcd(ll a, ll b)
{
    if (a < b){
        a ^= b;
        b ^= a;
        a ^= b;
    }
    return (b == 0 ? a : gcd(b, a % b));
}

int postOrder(int root)
{
    ll l, r, x;
    ll cd;
    
    if (tree[root].left){
        l = postOrder(tree[root].left);
    }
    else {
        l = 1;
    }
    
    if (tree[root].right){
        r = postOrder(tree[root].right);
    }
    else {
        r = 1;
    }
    
    if (tree[root].right + tree[root].left == 0){
        cd = gcd(tree[root].ldata, tree[root].rdata);
        return (tree[root].ldata / cd + tree[root].rdata / cd);
    }
    
    l *= tree[root].ldata;
    r *= tree[root].rdata;
    cd = gcd(l, r);
    x = l / cd * r;
    return (x / tree[root].ldata + x / tree[root].rdata);
}

int main(void)
{
    int i;
    int n;
    int p, q, r, b;
    int root;
    
    while (1){
        
        scanf("%d", &n);
        
        if (n == 0){
            break;
        }
        
        memset(tree, 0, sizeof(tree));
        for (i = 1; i <= n; i++){
            scanf("%d%d%d%d", &p, &q, &r, &b);
            tree[i].ldata = p;
            tree[i].rdata = q;
            tree[i].left = r;
            tree[i].right = b;
            tree[r].parent = tree[b].parent = i;
        }
        
        for (i = 1; i <= n; i++){
            tree[i].weight = 0;
            if (tree[i].parent == 0){
                root = i;
            }
            
        }
        printf("%d\n", postOrder(root));
    }
    
    return (0);
}

Measured memory_bytes: 0
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

ll h,w;
ll l[2010][2010];
ll r[2010][2010];
ll u[2010][2010];
ll d[2010][2010];
char s[2010][2010];
int main(){
	scanf("%lld%lld",&h,&w);
	rep(i,0,h)scanf(" %s",s+i);
	//上,左
	rep(i,0,h)rep(j,0,w){
		if(i==0)u[i][j]=(s[i][j]=='.'?1:0);
		else u[i][j]=(s[i][j]=='.'?u[i-1][j]+1:0);

		if(j==0)l[i][j]=(s[i][j]=='.'?1:0);
		else l[i][j]=(s[i][j]=='.'?l[i][j-1]+1:0);
	}
	//下,右
	for(int i=h-1;i>=0;i--)for(int j=w-1;j>=0;j--){
		if(i==h-1)d[i][j]=(s[i][j]=='.'?1:0);
		else d[i][j]=(s[i][j]=='.'?d[i+1][j]+1:0);

		if(j==w-1)r[i][j]=(s[i][j]=='.'?1:0);
		else r[i][j]=(s[i][j]=='.'?r[i][j+1]+1:0);
	}
	ll ans=0;
	rep(i,0,h)rep(j,0,w){
		ans=max(ans,u[i][j]+d[i][j]+l[i][j]+r[i][j]-3);
	}
	printf("%lld",ans);
}

Measured memory_bytes: 130176
#include <cstdio>
#include <algorithm>
#include <unordered_map>
#include <string>
#include <cstring>
#include <iostream>

using namespace std;

typedef long long int64;

int main() {
  int n; scanf("%d", &n);
  unordered_map<string, int> m;
  for (int i = 0; i < n; i++) {
    char buf[100];
    scanf("%s", buf);
    sort(buf, buf + strlen(buf));
    string str(buf);
    m[str] += 1;
  }
  int64 ans = 0;
  for (auto it = m.begin(); it != m.end(); ++it) {
    int64 tmp = it->second;
    ans += tmp * (tmp - 1) / 2;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 10660
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;

namespace AtCoderWorkspace
{
    public class Solver
    {
        public void Solve()
        {
            var cin = new Scanner();
            var s = cin.next();
            var t = cin.next();
            var m = s.Count();

            for (int i = 0; i < m; i++)
            {
                var ss = "";
                for (int j = i; j < i+m; j++)
                {
                    ss += s[j % m];
                }
                if(ss == t)
                {
                    Console.WriteLine("Yes");
                    return;
                }
            }

            Console.WriteLine("No");
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public int[] DPArrayInt(int N, int ex)
        {
            int[] Array = new int[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt();
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public long[] DPArrayLong(int N, int ex)
        {
            long[] Array = new long[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong();
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }

    class Program
    {
        static void Main(string[] s) => new Solver().Solve();
    }
}


Measured memory_bytes: 13268
#include<iostream>
using namespace std;
  
int main(){
    int N,M,t[21][21],l,a,b,i,j,flg=0;
    int x,y;
    char d;
    for(;;){
        x=10;y=10;
        flg=0;
        cin>>N;
        if(N==0){break;}
        for(i=0;i<=20;i++){
            for(j=0;j<=20;j++){
                t[i][j]=0;
            }
        }
        for(i=0;i<N;i++){
            cin>>a>>b;
            t[a][b]=1;
        }
        cin>>M;
        for(i=0;i<M;i++){
            cin>>d>>l;
            switch(d){
            case 'N':
                for(j=0;j<l;j++){
                    y++;
                    t[x][y]=0;
                }
                break;
            case 'E':
                for(j=0;j<l;j++){
                    x++;
                    t[x][y]=0;
                }
                break;
            case 'S':
                for(j=0;j<l;j++){
                    y--;
                    t[x][y]=0;
                }
                break;
            case 'W':
                for(j=0;j<l;j++){
                    x--;
                    t[x][y]=0;
                }
                break;
            default:
                break;
  
  
            }
        }
        for(i=0;i<21;i++){
            for(j=0;j<21;j++){
                if(t[i][j]==1){
                    flg=1;
                }
            }
        }
        if(flg==0){
            cout<<"Yes"<<endl;
        }else{
            cout<<"No"<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1152
#include "bits/stdc++.h"
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define REPS(i, n) for (int i = 1; i <= (n); i++)
#define RREPS(i, n) for (int i = (n); i > 0; i--)
#define mpa make_pair
#define pb(a) push_back(a)
typedef long long ll;

int main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  REP(i,N) cin >> A[i];
  REPS(i,N-1) A[i] += A[i-1];
  map<ll,ll> mp;
  REP(i,N) mp[A[i]]++;
  mp[0]++;
  ll ans = 0;
  for(auto itr = mp.begin();itr != mp.end();itr++){
      ans += (itr->second)*(itr->second - 1)/2;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 14336
#include<bits/stdc++.h>
using namespace std;
typedef pair<int ,int> P;
int inf = 100000000;

int main(){
    int64_t n;
    cin >> n;
    for(int64_t a = sqrt(n) ; a > 0 ; a--){
        for(int64_t b = n/a ; a*b <= n ; b++){
            if(a*b != n) continue;
            int keta = 0;
            while(b > 0){
                keta++;
                b /= 10;
            }
            cout << keta << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
n, m, x = list(map(int, input().split()))

books=[]
for _ in range(n):
    tmp=list(map(int, input().split()))
    books.append(tmp)

ans=None
# 各参考書を選ぶ、選ばないパターンをすべて試す
for bit in range(2**n):
    # 洗濯した参考書の合計コスト、スキルを格納
    total_skill=[0]*(m)
    total_cost=0
    for shift in range(n):
        # ビットの立っている参考書を買う
        if (bit>>shift)&1:
            book=books[shift]
            for i, data in enumerate(book[1:]):
                total_skill[i]+=data
            total_cost+=book[0]
                
#    print('total_cost=',total_cost ,'total_skill=', total_skill)
    # スキルがx以上かチェック
    if all([s>=x for s in total_skill]):
        if not ans or ans > total_cost:
            ans=total_cost

if ans:
    print(ans)
else:
    print(-1)

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

using namespace std;

typedef long long ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// chmax, chmin
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;
}

long long dp[100010];

void solve(long long X) {
    int XX[6] = {100, 101, 102, 103, 104, 105};
    dp[0] = 1;
    for (auto x : XX) {
        for (int i = 0; i + x <= 100000; i++) {
            dp[i+x] |= dp[i];
        }
    }
    cout << dp[X] << endl;
}

int main() {
    long long X;
    scanf("%lld", &X);
    solve(X);
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
typedef long long int  ll;
const int INF = INT_MAX;
#define pb push_back
#define mp make_pair
#define first X
#define second Y
#define nl cout<<"\n";   
using namespace std;   

int main() {   
    ios::sync_with_stdio(0);   
    cin.tie(0);   
   
    #ifndef ONLINE_JUDGE   
    freopen("input.txt", "r", stdin);   
    freopen("output.txt", "w", stdout);   
    #endif   
    
    int n;cin>>n;
    if(n%1000==0){cout<<"0";}
    else{cout<<1000 - (n%1000);}
	       
}   
        

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

long long p(long long a,long long b){
    if(b==0){
        return 1;
    }else if(b%2==0){
        return p(a*a,b/2);
    }else{
        return a*p(a,b-1);
    }
}

int main(void){
    long long n,k[32],l=1,c[32];
    bool f=false;
    cin>>n>>k[0];
    c[0]=0;
    for(int i=0;i<32;i++){
        if(f&&(1&(k[0]>>i))==1){
            k[l]=k[0]-k[0]%p(2,i)-1;
            c[l]=0;
            l++;
        }else if((1&(k[0]>>i))==0){
            f=true;
        }
    }
    for(int i=0;i<n;i++){
        long long a,b;
        cin>>a>>b;
        for(int j=0;j<l;j++){
            bool f=true;
            for(int m=0;m<32;m++){
                if((k[j]>>m)%2==0&&(a>>m)%2==1){
                    f=false;
                }
            }
            if(f){
                c[j]+=b;
            }
        }
    }
    for(int i=1;i<l;i++){
        c[0]=max(c[0],c[i]);
    }
    cout<<c[0]<<endl;
}


Measured memory_bytes: 256
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define yes(n) cout << ((n) ? "yes" : "no"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define VVi vector<vector<ll>>
#define Vd vector<double>
#define Vb vector<bool>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<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 int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN(s);
  OUT(s.substr(0,s.size()-8));
}

Measured memory_bytes: 256
while True:
    a = input()
    list = a.split()
    [x, y] = list
    x = int(x)
    y = int(y)
    list = [x, y]
    list.sort()
    [x, y] = list
    
    if x == 0 and y == 0:
        break
    else:
        x = str(x)
        y = str(y)
        k = " "
        ans = x + k + y
        print(ans)
        continue


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

int main(){
    int n, d, x;
    cin >> n >> d >> x;
    int cnt = n;
    for(int i=0; i<n; i++){
        int a;
        cin >> a;
        int day = a + 1;
        while(day <= d){
            cnt++;
            day += a;
        }
    }
    cout << cnt + x << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using CompLib.Util;

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        int a = sc.NextInt();
        Console.WriteLine(a + a * a + a * a * a);
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 27484
#include<bits/stdc++.h>
#define IO ios::sync_with_stdio(false), cin.tie(0)
#define INF 0x3f3f3f3f
typedef long long ll;
using namespace std;
double a[105];
int main()
{
	IO;
	int n;
	int m;
	int sum=0;
	cin>>n>>m;
	for(int i=0;i<n;i++){
		cin>>a[i];
		sum+=a[i];
	}
	int cnt=0;
	for(int i=0;i<n;i++){
		if(a[i]*4*m>=sum){
			cnt++;
		}
	}
	if(cnt>=m){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
 	return 0;
}







Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(var,cnt) for(int (var)=0; (var)<(int)(cnt); ++(var))
#define Rep(var,init,cnt) for(int (var)=(init); (var)<(cnt); ++(var))
#define ran(var,vec) for(auto &(var):(vec))
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define SORT(v) sort(all(v))
#define RSORT(v) sort(rall(v))
#define SUM(v) accumulate(all(v),0)
#define tget(tp,idx) get<idx>(tp)
#define TF(flag) (flag)?1:0
#define yn(f) cout<<(f?"yes":"no")<<endl
#define Yn(f) cout<<(f?"Yes":"No")<<endl
#define YN(f) cout<<(f?"YES":"NO")<<endl
#define COUT(x) cout<<(x)<<endl
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pi = pair<int,int>;
using pl = pair<ll,ll>;
using ti = tuple<int,int,int>;
using tl = tuple<ll,ll,ll>;

template<typename T>
using vec = vector<T>;
template<typename T>
using mat = vector<vec<T>>;
template<typename T>
using cub = vector<mat<T>>;
template<typename T>
using val = valarray<T>;

template<typename T>
using pq = priority_queue<T>;
template<typename T>
using rpq = priority_queue<T,vec<T>,greater<T>>;

template<typename T1,typename T2>
ostream &operator<<(ostream &os, const pair<T1,T2> &p){
  os<<"P("<<p.first<<", "<<p.second<<") ";
  return os;
}

template<typename T1,typename T2>
istream &operator>>(istream &is, pair<T1,T2> &p){
  is>>p.first>>p.second;
  return is;
}

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

template<typename T>
istream &operator>>(istream &is, vector<T> &v){
  for(T &in:v) is>>in;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const valarray<T> &v){
  cout<<"V{";
  for(int i=0; i<(int)v.size(); ++i){
    os<<v[i]<<(i+1!=v.size()?" ":"");
  }
  cout<<"}";
  return os;
}

template<typename T>
istream &operator>>(istream &is, valarray<T> &v){
  for(T &in:v) is>>in;
  return is;
}

// Usual Template End ================================================

// Template End ======================================================

constexpr int MOD=1e9+7;

int main(void){
  int a,b; cin>>a>>b; COUT(ceil((double)(a+b)/2.0));
}













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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

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

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a) {
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
    out<<'[';
    for(const T &i: a) out<<i<<',';
    out<<']';
    return out;
}
template<class T>
ostream &operator <<(ostream& out, const set<T>& a) {
    out<<'{';
    for(const T &i: a) out<<i<<',';
    out<<'}';
    return out;
}
template<class T, class S>
ostream &operator <<(ostream& out, const map<T,S>& a) {
    out<<'{';
    for(auto &i: a) out<<i<<',';
    out<<'}';
    return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

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

    ll n, x;
    cin >> n >> x;
    vector<ll> b(n), l(n), u(n);
    REP(i, n) cin >> b[i] >> l[i] >> u[i];

    vector<PII> vp(n);
    vector<ll> s(n), rank(n);
    REP(i, n) vp[i] = {b[i]*l[i] + (x-b[i])*u[i], i};
    sort(ALL(vp), greater<>());
    REP(i, n) s[i] = vp[i].first, rank[vp[i].second] = i;
    ll sumb = 0;
    REP(i, n) sumb += b[i]*l[i];

    auto check = [&](ll k) {
        ll q = k/x, r = k%x;
        if(q == n) return true;
        ll sum1 = 0;
        REP(i, q) sum1 += s[i];
        ll ma = 0;
        REP(i, n) {
            ll score = 0;
            // i番目のテストはr時間
            if(r > b[i]) score += b[i]*l[i] + (r-b[i])*u[i];
            else score += r*l[i];
            // i番目のテストを除いてs[j]が大きい方からq個
            if(rank[i] < q) score += sum1 - (b[i]*l[i] + (x-b[i])*u[i]) + s[q];
            else score += sum1;
            chmax(ma, score);
        }
        return ma >= sumb;
    };

    ll lb=-1, ub=n*x;
    while(ub-lb>1) {
        ll mid = (lb+ub)/2;
        if(check(mid)) ub = mid;
        else lb = mid;
    }
    cout << ub << endl;

    return 0;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
vector<int>kaijo;
void init_fact(int n){
    kaijo.resize(n+1);
    kaijo[0]=1;
    for(int i=1;i<=n;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
int comb(int a,int b){
    //if(!kaijo[0])init_fact();
    return kaijo[a]*modpow(kaijo[a-b],mod-2)%mod*modpow(kaijo[b],mod-2)%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
int n,a[200010],b[200010],dp[2010][4010];
signed main(){
    cin>>n;
    rep(i,n){
        cin>>a[i]>>b[i];
        dp[2000-a[i]][2000-b[i]]++;
    }
    for(int i=0;i<=2000;i++){
        for(int j=0;j<=4000;j++){
            dp[i][j]%=mod;
            dp[i+1][j]+=dp[i][j];
            dp[i][j+1]+=dp[i][j];
        }
    }
    int ans=0;
    for(int i=0;i<=4000;i++){
        ans+=dp[1999][i]*dp[2000][4000-i];
        ans%=mod;
    }
    init_fact(10000);
    rep(i,n){
        a[i]*=2;
        b[i]*=2;
        ans-=comb(a[i]+b[i],a[i]);
        ans+=mod;
        ans%=mod;
    }
    ans*=inv(2);
    ans%=mod;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 66432
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define uu unsigned
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define MOD 1000000007
#define pi pair<int,int>
#define pl pair<ll,ll>
#define mkp make_pair
#define ss second
#define ff first
#define all(x) x.begin(),x.end()
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define pb push_back
#define pf push_front
#define printcas cout<<"Case "<<cas<<": "
#define _ continue;
#define endl '\n'
#define __ cout<<endl;continue;
#define vc4d(nam,type,a,b,c,d,fix) vector<vector<vector<vector<type>>>> nam(a,vector<vector<vector<type>>>(b,vector<vector<type>>(c,vector<type>(d,fix))))
const ll oo=(1ll<<60);

int main()
{
     io;
    int T=1;
    //cin>>T;
    //for(int cas=1;cas<=T;cas++)
    while(T--)
    {
       ll n,i,j,k,l,ans=0;
       cin>>n;
       vl v(n);
       for(ll &x:v)cin>>x;
       for(i=0;i<=n-3;i++)
       {
           for(j=i+1;j<=n-2;j++)
           {
               for(k=j+1;k<=n-1;k++)
               {
                   if(v[i]!=v[j] and v[j]!=v[k] and v[i]!=v[k] and v[i]+v[j]>v[k] and v[i]+v[k]>v[j] and v[j]+v[k]>v[i])ans++;

               }
           }
       }
       cout<<ans;
    }
    return 0;
}


Measured memory_bytes: 3612
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]
#a = [int(input()) for _ in range(n)]

n = int(input())
s = list(map(str, input().split()))

tmp = set(s)

if (len(tmp) == 3):
    print("Three")
else:
    print("Four")








Measured memory_bytes: 9092
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int A = sc.nextInt();
    int B = sc.nextInt();
    
    if(N*A <= B){
		System.out.println(N*A);
    }else{
    	System.out.println(B);
    }
  }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s, t;
    cin >> s >> t;
    int ans = 0;
    for(int i=0; i<s.size(); i++)
    {
        if(s[i] != t[i]) ans++;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3780
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
template <typename T> inline void read(T &x)
{
	x=0;int f=1;char c=getchar();
	for(;c>'9'||c<'0';c=getchar()) if(c=='-') f=-1;
	for(;c>='0'&&c<='9';c=getchar()) x=(x<<1)+(x<<3)+(c^48);
	x*=f;
}
template <typename T> inline void print(T x)
{
	if(x<0) putchar('-'),x=-x;
	if(x>9) print(x/10);
	putchar(x%10+48);
}
LL mod=1e9+7;
LL ppower(LL s)
{
	LL r=1,a=2;
	while(s)
	{
		if(s&1) r=r*a%mod;
			a=a*a%mod;
			s=s>>1;
	}
	return r;
}
int main()
{
	LL a[100005],n,m,resu;
	while(~scanf("%ld",&n))
	{
		memset(a,0,sizeof(a));
		for(LL i=0;i<n;i++)
		{
			read(m);
			a[m]++;
		}
		LL flag=0;
		if(n&1)
		{
			if(a[0]>1)
				flag=1;
			else 
			{
				for(LL i=1;i<n;i++)
				{
					if(a[i]>2||a[i]==1)
						flag=1;
					if(flag) 
						break;
				}		
			}
			if(!flag)
				resu=ppower(n/2) ;
		}
		else
		{
			if(a[0]>0)
				flag=1;
			else 
			{
				for(LL i=1;i<n;i++)
				{
					if(a[i]>2||a[i]==1)
						flag=1;
					if(flag) 
						break;
				}		
			}
			if(!flag)
				resu=ppower(n/2) ;
		}
		if(flag) printf("0\n");
		else printf("%lld\n",resu);
	}
	return 0;
}

Measured memory_bytes: 1024
#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--)
#define ALL(v) v.begin(), v.end()
#define SEG_LEN (1 << 18)
using namespace std;
using P = pair<int, int>;
typedef long long ll;
int seg[2 * SEG_LEN];


//RSQ
void add(int index, int x){
  index += SEG_LEN;
  seg[index] += x;
  while(true){ 
    index /= 2;
    if(index==0)break;
    seg[index] = seg[2*index] + seg[2 * index + 1];
  }
}

int sum(int l, int r){
  l += SEG_LEN;
  r += SEG_LEN;
  int ans = 0;
  while(l < r){ 
    if(l %2 == 1){ 
      ans += seg[l];
      l++;
    }
    l /= 2;
    if(r % 2 == 1){ 
      ans += seg[r-1];
      r--;
    }
    r /= 2;
  }
  return ans;
}


int main() {
  int n, q, com, index, x, l, r;
  cin >> n >> q;
  rep(i,q){
    cin >> com;
    if(com == 0){ 
      cin >> index >> x;
      add(index, x);
    }else{ 
      cin >> l >> r;
      cout << sum(l, r+1) << endl;
    }
  }

}


Measured memory_bytes: 3880
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll a[114514],t[114514];
bool f[114514];
int main(){
	ll n;
	cin>>n;
	for(int i=0;i<n;i++)cin>>t[i];
	for(int i=0;i<n;i++)cin>>a[i];
	ll mod=1e9+7,ans=1;
	if(a[0]!=t[n-1]){
		cout<<0;
		return 0;
	}
	for(int i=1;i<n;i++){
		if(t[i-1]<t[i]){
			f[i]=1;
			if(t[i]>a[i]){
				cout<<0;
				return 0;
			}
		}
	}
	for(int i=n-2;i>=0;i--){
		if(a[i+1]<a[i]){
			f[i]=1;
			if(t[i]<a[i]){
				cout<<0;
				return 0;
			}
		}
	}

	f[0]=f[n-1]=1;
	for(int i=0;i<n;i++){
		//cout<<f[i]<<' ';
		if(f[i])continue;
		ans*=min(a[i],t[i]);
		ans%=mod;
	}
	cout<<ans;
	return 0;
}


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

int main()
{
	char b;
	cin >> b;
	char ans;
	if (b == 'A')
	{
		ans = 'T';
	}
	else if (b == 'T')
	{
		ans = 'A';
	}
	else if (b == 'C')
	{
		ans = 'G';
	}
	else if (b == 'G')
	{
		ans = 'C';
	}

	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i<(n);i++)
#define fore(i,a) for(auto &i:a)
#define debug(a,b) cout << "debug : " << a << " , "<< b << endl
using ll=long long;
const ll INF=1LL<<60;
const ll mod=1E9+7;


int main(){
  int n;
  cin >> n;
  vector<int>a(n);
  rep(i,n)cin >> a[i];
  int sum=0;
  rep(i,n){
    rep(j,n){
      if(i!=j)sum+=a[i]*a[j];
    }
  }
  cout << sum/2;
}


Measured memory_bytes: 256
/*author: hyperion_1724
  date: 
*/

//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define trav(x,A) for(auto &x:A)
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef vector<int> veci;
typedef vector<long long> vecl;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(4e6+1);

//Required Functions

ll power(ll x,ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % MOD; 
    p = (p * p) % MOD; 
  
    return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

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

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

    READV(N);
    READAR(A,N);
    ll sum=0;
    FORI(i,0,N)
    {
        sum+=A[i];
    }
    bitset<INIT> F;
    F.set(0,1);
    FORI(i,0,N)
    {
        F=F|(F<<A[i]);
    }
    sum=(sum+1)/2;
    FORI(i,0,INIT)
    {
        if(i>=sum && F.test(i))
        {
            cout<<i<<endl;
            return 0;
        }
    }

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


   
    return 0;
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n;
  cin >> n;  
  map<string, int> mp;
  for(int i = 0; i < n; i++) {
    string s; int m;
    cin >> s >> m;
    mp[s] += m;
  }
  vector< pair<string, int> > vec;
  for(auto p : mp) {
    vec.push_back(p);
  }
  sort(vec.begin(), vec.end(), [&](pair<string, int> p, pair<string, int> q) ->bool{
      return p.first.size() != q.first.size() ? p.first.size() < q.first.size() : p < q;
    });
  for(auto p : vec) {
    cout << p.first << " " << p.second << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3120
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef  unsigned long long int ull;
typedef pair<ll,ll> P;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int main(){
int n,m,q;
cin>>n>>m>>q;
set<ll> s,t;
s.insert(-inf);s.insert(inf);t.insert(-inf),t.insert(inf);
for(int i=0;i<n;i++){
    ll d;cin>>d;
    s.insert(d);
}
for(int i=0;i<m;i++){
    ll d;cin>>d;
    t.insert(d);
}
while(q--){
    ll x;
    cin>>x;
    ll s1,s2,t1,t2;
    auto its=s.lower_bound(x);
    s1=*its;
    its--;
    s2=*its;
    auto itt=t.lower_bound(x);
    t1=*itt;
    itt--;
    t2=*itt;
    ll a,b,c,d;
    a=max(s1,t1)-x;b=min(s1-x,x-t2)+s1-t2;c=min(x-s2,t1-x)+t1-s2;d=x-min(s2,t2);
    cout<<min({a,b,c,d})<<endl;
}
}

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

#include <ext/pb_ds/assoc_container.hpp> //required
#include <ext/pb_ds/tree_policy.hpp> //required

using namespace __gnu_pbds; 
using namespace std;

template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 
typedef long long  ll;
typedef vector<ll> VL;
typedef vector<int> VI;
typedef pair<ll,ll> PLL;
typedef pair<int,int> PII;
#define pb push_back

#define F first
#define S second
#define SZ(a) int((a).size())
#define ALL(a) a.begin(),a.end()
#define fr(i,x,y) for(ll i=x;i<y;i++)
#define frr(i,x,y) for(ll i=x-1;i>=y;i--)
#define inf 1e18+1
const ll mod=1000000007;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll power(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;}a=a*a;b>>=1;}return ans;}
ll powerm(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;ans%=mod;}a=a*a;a%=mod;b>>=1;}return ans%mod;}
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

void solve()
{
    ll x,n;
    cin>>x>>n;
    map<ll,ll> mp;
    fr(i,0,n)
    {
        ll z;
        cin>>z;
        mp[z]=1;
    }
    ll a=x,b=x;
    fr(i,x,1000)
    {
        if(!mp.count(i))
        {
            a=i;
            break;
        }
    }
    frr(i,x,-1000)
    {
        if(!mp.count(i))
        {
            b=i;
            break;
        }
    }
    if(abs(x-b)==abs(x-a))
    {
        cout<<b<<endl;
    }
    else 
    {
        if(abs(x-b)>abs(x-a))
            cout<<a<<endl;
        else
            cout<<b<<endl;
    }
    return;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}
/* stuff you should look for
        * int overflow, array bounds
        * special cases (n=1?)
        * do smth instead of nothing and stay organized
        * WRITE STUFF DOWN
*/
// BITMASK:
// 1)When some constrall is of the order of 15-20, think of bitmask DP.
// 2)When some constrall is around 40, try out meet in the middle
// 3) See Strings,palindromes,prefix,suffix etc -> KMP,Z algorithm

Measured memory_bytes: 3652
using System;
using System.Linq;
using System.Collections.Generic;
    
class Program
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(' ');

        int N = int.Parse(input[0]);
        int X = int.Parse(input[1]);
        int T = int.Parse(input[2]);

        int answer;

        if(N % X == 0)
        {
            answer = (N / X) * T;
        }
        else
        {
            answer = ((N - (N % X)) / X + 1 ) * T;
        }

        Console.WriteLine(answer);
    }
}

Measured memory_bytes: 27492
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};
 
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; }
 
struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};
 


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

ll lcm(ll a,ll b){
    ll g =gcd(a,b);
    return a/g*b;
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Timer TM;

    ll a,b;
    cin>>a>>b;
    cout<<lcm(a,b)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF (1<<30)-1
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    ll p[3];
    rep(i, 0, 3) cin >> p[i];
    sort(p, p+3);
    rep(i, 0, 3) if (p[i] % 2 == 0) {
        cout << 0 << endl;
        return 0;
    }
    cout << p[0] * p[1] << endl;
    return 0;
}


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

const int INF = 1001001001;

int main() {
    ll N;
    cin >> N;
    string ans = "";
    while (N > 0) {
        --N;
        ll c = N % 26;
        ans += 'a' + c;
        N /= 26;
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
}


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

class D{
    public:
    int f[6];
    D(){}
    void rollx(){
        roll(0,2,5,3);
    }
    void rolly(){
        roll(0,1,5,4);
    }
    void rollz(){
        roll(1,2,4,3);
    }
    void roll(int a,int b,int c,int d){
        int t=f[a];
        f[a]=f[b];
        f[b]=f[c];
        f[c]=f[d];
        f[d]=t;
    }
};

bool same(D c,D d){
    for(int i=0;i<6;i++){
        if(c.f[i]!=d.f[i])return false;
        
    }
    return true;
}

bool same1(D c,D d){
    for(int i=0;i<6;i++){
        for(int j=0;j<4;j++){
            if(same(c,d))return true;
            c.rollz();
        }
        if(i%2==0)c.rolly();
        else c.rollx();
    }
    return false;
}

int main(){
    D c,d;
    for(int j=0;j<6;j++)cin>>c.f[j];
    for(int j=0;j<6;j++)cin>>d.f[j];
    if(same1(c,d))cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3084
import java.util.*;

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

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                A[i][j] = sc.nextInt();
            }
        }

        Boolean[][] Bingo = new Boolean[3][3];
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                Bingo[i][j] = false;
            }
        }

        int N = sc.nextInt();
        int tmp;
        for (int i = 0; i < N; i++) {
            tmp = sc.nextInt();
            for (int j = 0; j < 3; j++) {
                for (int k = 0; k < 3; k++) {
                    if(A[j][k] == tmp){
                        Bingo[j][k] = true;
                    }
                }
            }
        }

        String ans = "No";

        for (int i = 0; i < 3; i++) {
            Boolean flag = true;
            for (int j = 0; j < 3; j++) {
                if(Bingo[i][j] == false){
                    flag = false;
                }
            }
            if(flag == true) ans = "Yes";
        }

        for (int i = 0; i < 3; i++) {
            Boolean flag = true;
            for (int j = 0; j < 3; j++) {
                if(Bingo[j][i] == false){
                    flag = false;
                }
            }
            if(flag == true) ans = "Yes";
        }

        if(Bingo[0][0] && Bingo[1][1] && Bingo[2][2]) ans = "Yes";
        if(Bingo[0][2] && Bingo[1][1] && Bingo[2][0]) ans = "Yes";

        System.out.println(ans);

    }
}


Measured memory_bytes: 21716
#include <iostream>
#include <algorithm>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;

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

	string str;
	cin >> str;
	sort(str.begin(), str.end());
	if (str[0] != str[1] || str[1] == str[2] || str[2] != str[3]) cout << "No\n";
	else cout << "Yes\n";
}


Measured memory_bytes: 256
N=int(input())
a=list(map(int,input().split()))

a.sort()

d=[[0]*N for i in range(max(a)-min(a)+1)]
for i in range(max(a)-min(a)+1):
  for j in range(N):
      d[i][j]=(a[j]-(min(a)+i))**2

print(min([sum(dd) for dd in d]))

Measured memory_bytes: 3700