akhauriyash/Code-Regression huggingface dataset:
#include <iomanip>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int64_t a, b, c, d;
  cin >> a >> b >> c >> d;
  int64_t answer = max(max(a * c, a * d), max(b * c, b * d));
  cout << answer << endl;
  return 0;
}


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

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

    if (a + b > c + d)
        cout << "Left\n";
    else if (a + b < c + d)
        cout << "Right\n";
    else
        cout << "Balanced\n";
}

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

const int N = 1e5 + 10;

char s[N];

int main(){
	scanf("%s" , s + 1);
	int n = strlen(s + 1);
	puts((s[1] == s[n]) ^ (n & 1) ? "First" : "Second");
	return 0;
} 

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

int main(){

    ll x,y;

    cin >> x >> y;

    if(x-y>0) cout << x-y<< endl;
    else cout << 0 << endl;

    return 0;
}

Measured memory_bytes: 256
public class Main
{
	public static void main(String[] args)
	{
		for (int x = 1; x <= 9; x++)
		{
			for (int y = 1; y <= 9; y++)
			{
				System.out.printf("%dx%d=%d\n", x, y, x * y);
			}
		}
	}
}

Measured memory_bytes: 12000
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DEBUG) write(t, " "), log(a); } bool DEBUG = 0; 
string rstring(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T rtype(T)(){ return rstring.to!T; } alias rint = rtype!int, rlong = rtype!long, rreal = rtype!real;
T[] rtypes(T)(int n){ return n.iota.map!(i => rtype!T()).array; } alias rint = rtypes!int, rlong = rtypes!long, rreal = rtypes!real;
T[][] rtypess(T)(int n, int m){ return n.iota.map!(i => rtypes!T(m)).array; } alias rint = rtypess!int, rlong = rtypess!long, rreal = rtypess!real;
T chmin(T)(ref T x, T y){ if(x > y) x = y; return x; } T chmax(T)(ref T x, T y){ if(x < y) x = y; return x; }

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

void solve(){
	int a = rint, b = rint, c = rint, d = rint;
	if(a == c) "0".writeln;
	else "1".writeln;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <utility>
#include <iomanip>
#include <chrono>
#include <random>
#include <bitset>

using namespace std;

#define sz(x) (int) x.size()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x)) 
#define y1 aksjdaskdjksjfksdjf
#define left kdnvldvoiwejifejg
#define right lkdsjflksdjfdjfk
#define prev asdasfsadjkjsdfjs
#define tm aklsjdasjdasjdkdjjf
#define lcm hddalkwjeidjjhasda
#define random_shuffle asdasdd

const int MAXN = 2 * 105000;

int n;
int a[MAXN];

long long f(long long b) {
  long long res = 0;
  for (int i = 0; i < n; i++) {
    res += abs(a[i] - (b + i + 1));
  }
  return res;
}

int main() { 

  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }

  // for (int i = -10; i <= 10; i++) {
  //   cerr << f(i) << endl;
  // }
  // return 0;

  long long l = -1e9, r = 1e9;
  while (r - l > 10) {
    long long m1 = l + (r - l) / 3;
    long long m2 = r - (r - l) / 3;
    if (f(m1) > f(m2)) {
      l = m1;
    } else {
      r = m2;
    }
  }

  long long ans = f(l);
  for (long long i = l; i <= r; i++) {
    ans = min(ans, f(i));
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
package main

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

func main() {
	mountHeightList := make([]int64, 10)
	scanner := bufio.NewScanner(os.Stdin)
	for i := 0; i < 10; i++ {
		scanner.Scan()
		mountHeightList[i], _ = strconv.ParseInt(scanner.Text(), 10, 64)
	}

	sort.Slice(mountHeightList, func(i, j int) bool { return mountHeightList[i] > mountHeightList[j] })

	for i := 0; i < 3; i++ {
		fmt.Printf("%d\n", mountHeightList[i])
	}
}



Measured memory_bytes: 1096
#include<iostream>
using namespace std;
int main(){
	int a,b,c;
  	cin>>a>>b>>c;
  	if(a==b&&a!=c){cout<<"Yes"<<endl;return 0;}
  if(a==c&&a!=b){cout<<"Yes"<<endl;return 0;}
  if(c==b&&a!=c){cout<<"Yes"<<endl;return 0;}
  cout<<"No"<<endl;
}

Measured memory_bytes: 256
//  Created by conan1024hao on 2019/11/24.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll>P;
#define INF 10e16
#define MOD 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define PI acos(-1.0)
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
ll cmp(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //------------------------------
    int n;
    cin>>n;
    vector<vector<int>>a(n);
    vector<pair<int,int>>vp;
    
    for(int i=0;i<n-1;i++){
        int c,d;
        cin>>c>>d;
        c--;d--;
        a[c].push_back(d);
        a[d].push_back(c);
        vp.emplace_back(c,d);
    }
    int cnt=0;
    map<pair<int,int>,int> I;
    vector<int> color(n,0);
    vector<int> used(n,0);
    queue<int> que;
    used[0]=1;
    que.emplace(0);
    for(int i=0;i<n;i++){
        chmax(cnt,a[i].size());
    }
    while(!que.empty()){
        int v=que.front();que.pop();
        int now=1;
        for(auto it=a[v].begin();it!=a[v].end();it++){
            int i=*it;
            if(used[i])
                continue;
            if(now==color[v])
                now++;
            color[i]=I[make_pair(i,v)]=I[make_pair(v,i)]=now++;
            used[i]=1;
            que.emplace(i);
        }
    }
    cout<<cnt<<endl;
    for(auto p:vp)cout<<I[p]<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------


Measured memory_bytes: 20088
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
      ArrayList<Integer> one = nextIntArray();
      int A = one.get(0);
      int B = one.get(1);
      myout(Math.max(0, A - (B * 2)));
	}
	//Method addition frame start



	//Method addition frame end
}


Measured memory_bytes: 33036
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(int i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int n,m;
int d[110],v[110];
vector<int> pro[110];

int main(){
	while(1){
		cin>>n>>m;
		if(n==0&&m==0)break;
		REP(i,110)pro[i].clear();
		REP(i,n){
			cin>>d[i]>>v[i];
			pro[d[i]].push_back(v[i]);
		}
		int ans=0;
		for(int i=1;i<=m;i++){
			sort(pro[i].begin(),pro[i].end(),greater<int>());
			ans+=*(pro[i].begin());
		}
		cout<<ans<<endl;
	}
	return 0;
}


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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define MOD9 998244353
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

using II = pair<int, int>;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

signed main()
{
  int X, A;
  cin >> X >> A;
  cout << (X < A ? 0 : 10) << endl;
  return 0;
}

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

using namespace std;

int main(){
    int n;
    cin >> n;
    vector <int> a(n+2,-1);
    for(int i=1;i<=n;i++){
        cin >> a[i];
    }
    int la=0,ans=0;
    for(int i=1;i<=n+1;i++){
        if(a[i]!=i){
            ans+=(la+1)>>1;
            la=0;
        }
        else{
            la++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef unsigned long long int ll;
#define INF LLONG_MAX

int main(){

    fastio ;

    ll n;
    vector<vector<ll>> dp(405 , vector<ll>(405));
    vector<ll> a(405);
    vector<ll> prefix(405);

    cin >> n;
    for(ll i = 1; i <= n; i++) {
        cin >> a[i];
        if(i != 1) prefix[i] = prefix[i-1]+a[i];
        else prefix[i] = a[i];
    }
    // OPTIMAL SUB-PROBLEM :

    // dp[i][j] = minimum cost required to change from i...j

    // BASE CASE :

    for(ll i = 0 ; i <= n; i++) dp[i][i] = 0;
    for(ll i = 1; i <= n-1; i++) dp[i][i+1]  = a[i]+a[i+1];

    // RECURSIVE RELATION :

    for(ll s = 2; s <= n-1; s++){
        for(ll i = 1; i <= n-s; i++){
            ll j = i+s;
            dp[i][j] = INF;

            for(ll l = i; l <= j-1; l++){
                dp[i][j] = min(dp[i][j] , dp[i][l] + dp[l+1][j] + prefix[j]-prefix[i-1]);
            }
        }
    }

    // OPTIMAL SOLUTION :

     cout << dp[1][n];

}

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

#define PI 3.141592653589
#define ll long long int
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define ii pair<int,int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pll pair<ll,ll>
#define vv vector
int MOD=1e9+7;
ll power(ll a, ll b){//a^b
    ll res=1;
    a=a%MOD;
    while(b>0){
        if(b&1){res=(res*a)%MOD;b--;}
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
ll min(ll a,ll b){return (a>b)?b:a;}
ll max(ll a,ll b){return (a>b)?a:b;}
bool prime[1000001];
vi primes;
void SieveOfEratosthenes(int n) 
{ 
    memset(prime, true, sizeof(prime)); 
    for (int p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
    for(int p=2;p<1000001;p++)
        if(prime[p])
            primes.pb(p);
}
ll fact[1001];
void factorial(int n){
    fact[0]=1;
    for(int i=1;i<=n;i++)
        fact[i]=fact[i-1]*i,fact[i]%=MOD;
}
ll ncr(ll n,ll r)
{
    if(n<r)
        return -1;
    else{
        ll x=fact[r]*fact[n-r]%MOD;
        return fact[n]*fermat_inv(x)%MOD;
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    int t=1;
    //cin>>t;
    //SieveOfEratosthenes(1000000);
    //factorial(1000);
    while(t--){
        int n,m,k;
        cin>>n>>m>>k;
        ii a[k];
        map<ii,int>pts;
        map<int,int>r,c;
        for(int i=0;i<k;i++){
            cin>>a[i].ff>>a[i].ss;
            pts[a[i]]++;
            r[a[i].ff]++;
            c[a[i].ss]++;
        }
        ll ans=0;
        int mx=0,my=0,ri,ci;
        for(auto a:r){
            if(a.ss>mx)
                mx=a.ss,ri=a.ff;
        }
        for(auto a:c){
            if(a.ss>my)
                my=a.ss,ci=a.ff;
        }
        bool b=false;
        for(auto a:c){
            if(a.ss!=my)
                continue;
            if(!pts[{ri,a.ff}])
                b=true;
        }
        for(auto a:r){
            if(a.ss!=mx)
                continue;
            if(!pts[{a.ff,ci}])
                b=true;
        }
        if(b)
            cout<<mx+my;
        else
            cout<<mx+my-1;
    }
}

Measured memory_bytes: 90324
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int ll
#define pb push_back
#define setbits(x)          __builtin_popcountll(x)
#define endl "\n"
typedef long long ll;
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin>>n;
string str;
cin>>str;
string ans="";
int i=0;
while(i<n)
{ans+=str[i];
  while(i<n-1&&str[i]==str[i+1])
  {
      i++;
  }
  i++;
}
cout<<ans.size()<<endl;
















    return 0;
}


Measured memory_bytes: 592
w = input()
w_list = 'abcdefghijklmnopqrstuvwxyz'
a = 0
for i in w_list:
    if w.count(i) % 2 == 0:
        a += 0
    else:
        a += 1
if a == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 2940
while True:

    m, f, r = map(int, input().split())
    if m==f==r== -1:
        break
    result = ""
    sum = m + f
    
    if (m==-1)or(f==-1):
        result = "F"
    elif sum >= 80:
        result = 'A'
    elif sum>= 65:
        result = "B"
    elif sum>=50:
        result = "C"
    elif sum>= 30:
        result="D"
        if r>=50:
            result = 'C'
    else:
        result = 'F'

    print("{}".format(result))

Measured memory_bytes: 7656
#include<iostream>
using namespace std;
int sumfun(int a[],int n){
	int i,sum=0;
	for(i=0;i<n;i++)
		sum+=a[i];
	return sum;
}

int max(int a[],int n){
	int f=a[0];
	for(int i=1;i<n;i++)
		if(a[i]>f)
			f=a[i];
	return f;
}

int main(){
	int N;
	cin>>N;
	int a[10]={0};
	for(int i=0;i<N;i++){
		cin>>a[i];
	}
	int sum=sumfun(a,N),Max=max(a,N);
	if(Max<sum-Max)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 3536
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int inf=1e9+7;
bool arr[100004];
signed main(){
    arr[0]=arr[1]=0;
    for(int i=2;i<=100003;i++)
        arr[i]=1;
    for(int i=2;i*i<=100003;i++)
        if(arr[i])
            for(int j=i;i*j<=100003;j++)
                arr[i*j]=0;
    int x;
    cin>>x;
    for(int i=x;;i++)
        if(arr[i])
            cout<<i<<endl,exit(0);
}


Measured memory_bytes: 384
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;

// 先にマージ
// [s-0.5, t)でごちゃ混ぜソート

int n;
int c;

struct K {
  int s, t, c;
};
K ks[100000+10];

bool cmp1(const K& k1, const K& k2) {
  if(k1.c != k2.c) return k1.c < k2.c;
  return k1.s < k2.s;
}

pair<int,int> ps[300000+10];

int main(void) {
  scanf("%d%d", &n, &c);
  REP(i, n) {
    scanf("%d%d%d", &ks[i].s, &ks[i].t, &ks[i].c);
  }
  sort(ks, ks + n, cmp1);
  {
    int i1 = 0;
    K cur = {-1, -1, -1};
    REP(i2, n) {
      if(ks[i2].c != cur.c) {
        if(cur.c != -1) {
          ks[i1++] = cur;
        }
        cur = ks[i2];
      } else if(cur.t == ks[i2].s) {
        cur.t = ks[i2].t;
      } else {
        ks[i1++] = cur;
        cur = ks[i2];
      }
    }
    // last
    ks[i1++] = cur;
    n = i1;
  }
  REP(i, n) {
    ps[i*2] = make_pair(ks[i].s*2-1, 0);
    ps[i*2+1] = make_pair(ks[i].t*2, 1);
  }
  sort(ps, ps+2*n);
  int res = 0;
  int cur = 0;
  REP(i, 2*n) {
    if(ps[i].second == 0) {
      res = max(res, ++cur);
    } else {
      --cur;
    }
  }
  printf("%d\n", res);
  
  return 0;
}


Measured memory_bytes: 2944
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author ShekharN
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        private final int LIM = 100002;
        boolean[] prime = new boolean[LIM];
        int[] cnt = new int[LIM];

        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            for (int i = 0; i < LIM; i++) {
                prime[i] = true;
            }
            prime[0] = prime[1] = false;
            for (int i = 2; i * i < LIM; i++) {
                if (prime[i]) {
                    for (int j = i + i; j < LIM; j += i) {
                        prime[j] = false;
                    }
                }
            }
            cnt[0] = 0;
            for (int i = 1; i < LIM; i++) {
                cnt[i] = cnt[i - 1];
                if (prime[i] && prime[(i + 1) / 2])
                    cnt[i]++;
            }
            int q = in.nextInt();
            for (int i = 0; i < q; i++) {
                int l = in.nextInt(), r = in.nextInt();
                out.println(cnt[r] - cnt[l - 1]);
            }
        }

    }

    static class FastScanner {
        private BufferedReader br;
        private StringTokenizer st;

        public FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

        public String nextString() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

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

    }
}



Measured memory_bytes: 41996
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1000000000;

int main() {
    int N;
    cin >> N;
    vector<int>A(N);
    for (int i=0; i<N; i++)cin >> A[i];
    ll ans = 0;
    sort(all(A));
    reverse(all(A));
    int cr = 0;
    for (int i=0; i<N-1; i++){
        if (i%2 == 1){
            cr++;
        }
        //cout << A[cr] << endl;
        ans += A[cr];
    }
    cout << ans << endl;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define fast ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define int long long
#define vll vector<long long>
#define pii pair<long long ,long long >
#define vvi vector< vector<long long > >
#define vpii vector<pair<int,int>>
#define pll  pair<long long ,long long >
#define pb  push_back
#define ff  first
#define sec second
#define SORT(a) sort(a.begin(),a.end())
#define SORTR(a) sort(a.rbegin(),a.rend())
#define m_p make_pair
#define all(x) (x.begin(),x.end())
#define sz(v) ((int)(v.size()))
#define endl '\n'
typedef vector< long long > vi ;
const int MOD = 1e9 + 7 ;
int size = 10000000;


void solve() {

	int a, b; cin >> a >> b;
	cout << a*b << endl;













}


int32_t main() {
	fast;
	/*#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	*/
	int T = 1; //cin>>T;
	while (T--) {
		solve();
	}

	return 0;
}



Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(x) (x).begin(),(x).end()
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define irp(i,s,e) for(int i=(s);i>(e);--i)
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;}
// #define NMAX 1000000000
ll N,K;

ll solve(){
	ll ans = 0;
	ans = N%K;
	ans = min(ans, K-ans);
	return ans;
}

int main(){
	cin>>N>>K;
	cout<< solve() <<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (rint i = 1; i <= (n); i ++)
#define re0(i, n) for (rint i = 0; i < (int) n; i ++)
#define travel(i, u) for (rint i = head[u]; i; i = e[i].nxt)
#define rint register int
using namespace std;
 
typedef long long lo;
 
template<typename tp> inline void read(tp &x) {
    x = 0; char c = getchar(); int f = 0;
    for (; c < '0' || c > '9'; f |= c == '-', c = getchar());
    for (; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
    if (f) x = -x;
}

const int N = 222;
int S[N], X, Y, top, ban[N], dep[N], dd[N];
int n, d[N][N], maxdep;
vector <int> G[N];

inline void dfs(int u, int fat, int to) {
	S[++top] = u;
	if (u == to) {
		top & 1 ? X = Y = S[top / 2 + 1] : X = S[top / 2], Y = S[top / 2 + 1];
		// cout << u << " " << to << "\n";
		// rep (i, top) cout<< S[i] << " \n"[i == top];
		// cout << X << " " << Y << "\n";
	}
	for (int v : G[u])
		if (v != fat) dfs(v, u, to);
	--top;
}

inline void gao(int u, int fat) {
	maxdep = max(maxdep, dep[u] = dep[fat] + 1);
	int son = 0;
	for (int v : G[u]) {
		if (v != fat && !ban[v]) gao(v, u), ++son;
	}
	dd[dep[u]] = max(dd[dep[u]], son);
}

pair <int, lo> doit(int X, int Y) {
	maxdep = 0;
	rep (i, n) dd[i] = 1, ban[i] = 0;
	ban[X] = ban[Y] = true;
	gao(X, 0); if (Y != X) gao(Y, 0);
	lo ans = 1;
	rep (i, n) ans *= dd[i];
	// cout << maxdep << " " << 2 * ans << "\n";
	return {maxdep, (X != Y ? 2 : 1) * ans};
}

int main(void) {
	read(n);
	rep (i, n) rep (j, n) d[i][j] = i == j ? 0 : 1e9;
	rep (i, n - 1) {
		int x, y; read(x); read(y);
		d[x][y] = d[y][x] = 1;
		G[x].push_back(y); G[y].push_back(x);
	}
	rep (k, n) rep (i, n) rep (j, n) d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
	int x = -1, y = -1, mx = 0;
	rep (i, n) rep (j, n) if (d[i][j] > mx) {
		mx = d[i][j]; x = i; y = j;
	}
	pair <int, lo> ans = {1e9, 0};
	rep (i, n) rep (j, i) if (d[i][j] == 1 || i == j) {
		pair <int, lo> t = doit(i, j);
		// cout << i << " " << j << " " << t.first<< " " << t.second << "\n";
		if (ans > t) ans = t;
	}
	cout << ans.first << " " << ans.second << "\n";
}


Measured memory_bytes: 384
package main

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

var N, M int

func main() {
	fmt.Scan(&N, &M)
	reader := bufio.NewScanner(os.Stdin)
	reader.Split(bufio.ScanWords)

	xxx := make([]LR, M)

	for i := 0; i < M; i++ {
		reader.Scan()
		xxx[i].L, _ = strconv.Atoi(reader.Text())

		reader.Scan()
		xxx[i].R, _ = strconv.Atoi(reader.Text())
	}
	L_max := 0
	R_min := 999999999

	for i := 0; i < M; i++ {
		L_max = max(L_max, xxx[i].L)
		R_min = min(R_min, xxx[i].R)
	}
	fmt.Println(max(R_min-L_max+1, 0))
}

/*  ----------------------------------------  */

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}
func pow(x, y int) int { return int(math.Pow(float64(x), float64(y))) }
func abs(x int) int    { return int(math.Abs(float64(x))) }
func floor(x int) int  { return int(math.Floor(float64(x))) }

type LR struct {
	L int
	R int
}

// type LR []int

// func (a SortBy) Len() int           { return len(a) }
// func (a SortBy) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
// func (a SortBy) Less(i, j int) bool { return a[i] < a[j] }


Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <algorithm>
#include <cfenv>
#include <cmath>
#include <cstdlib>
using namespace std;
#define rep(i,n) for(int i = 0;i < n;i++)
#define INF 0x3f //plus infinite

typedef struct item{
  string name;
  int number;
  int money;
}item;

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

  long long int sum = 0;
  for(int i = 1;i <= n;i++){
    if(i % 3 != 0 && i % 5 !=0){
      sum += i;
    }
  }
  cout << sum << endl;
  

  return 0;

}

/*文字列の辞書順について
 *C++の順序では'0'～'9'→'A'～'Z'→'a'～'z'の順に
 *                       なっていることに注意しましょう。
 */

/*行単位での入力
 * getline(cin,文字列変数);
 */


Measured memory_bytes: 3596
// #define _GLIBCXX_DEBUG
// #pragma GCC optimize("Ofast")
#pragma GCC diagnostic ignored "-Wsign-compare"
#include <bits/stdc++.h>
// #include <atcoder/all>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define reps(i, s, n) for (int i = s; i < (int)(n); ++i)
#define rreps(i, s, n) for (int i = n - 1; (int)(s) <= i; --i)
// reps(s,n)[::-1]
using namespace std;
using ll = long long;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
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;
}
constexpr int INF = 1e9 + 7;
constexpr ll LINF = 1LL << 60;
class Prints {
private:
    class __Prints {
    public:
        __Prints(const char* _sep, const char* _term) : sep(_sep), term(_term) {}
        template <class... Args> void operator()(const Args&... args) const { print(args...); }
        template <typename T> void pvec(const T& vec, size_t sz) const {
            for (size_t i = 0; i < sz; i++) std::cout << vec[i] << (i == sz - 1 ? term : sep);
        }
        template <typename T> void pmat(const T& mat, size_t h, size_t w) {
            for (size_t i = 0; i < h; i++)
                for (size_t j = 0; j < w; j++) std::cout << mat[i][j] << (j == w - 1 ? term : sep);
        }

    private:
        const char *sep, *term;
        void print() const { std::cout << term; }
        void print_rest() const { std::cout << term; }
        template <class T, class... Tail> void print(const T& head, const Tail&... tail) const {
            std::cout << head, print_rest(tail...);
        }
        template <class T, class... Tail> void print_rest(const T& head, const Tail&... tail) const {
            std::cout << sep << head, print_rest(tail...);
        }
    };

public:
    Prints() {}
    __Prints operator()(const char* sep = " ", const char* term = "\n") const { return __Prints(sep, term); }
};

Prints print;

void solve() {
    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    rep(i, 1000) {
        string t = to_string(i);
        if (t.size() == 1)
            t = "00" + t;
        else if (t.size() == 2)
            t = "0" + t;
        int k = 0;
        rep(j, n) {
            if (j < n and k < 3 and s[j] == t[k]) {
                k++;
            }
        }
        if (k == 3) ans++;
    }
    print()(ans);
}
int main() {
    cin.tie(nullptr);
    // ios_base::sync_with_stdio(false);
    // cout << fixed << setprecision(15);
    solve();
}

Measured memory_bytes: 3728
#include <iostream>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <utility>
#include <string.h>
#include <map>
#include <stack>
#include <iomanip>
#include <chrono>
#include <random>
#include <math.h>
#include <time.h>
#include <bitset>
#include <assert.h>
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define all(x) x.begin(),x.end()
#define PII pair <ll,ll>
#define N 100007
#define MOD 1000000007
#define INF 1000000000000000000
using namespace std;

int dp[3001][3001];

int main() {
    string s, t, r = "";
    cin >> s >> t;
    for(int i = 0; i <= s.size(); i++) {
        for(int j = 0; j <= t.size(); j++) {
            if(i == 0 || j == 0) {
                dp[i][j] = 0;
            }
            else if(s[i-1] == t[j-1]) {
                dp[i][j] = 1 + dp[i-1][j-1];
            }
            else {
                dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
            }
        }
    }
    int i = s.size(), j = t.size();
    while(i > 0 && j > 0) {
        if(s[i-1] == t[j-1] && dp[i][j] == 1 + dp[i-1][j-1]) {
           r += s[i-1];
           i -= 1;
           j -= 1;
        }
        else if(dp[i][j] == dp[i-1][j]) {
            i -= 1;
        }
        else {
            j -= 1;
        }
    }
    reverse(all(r));
    cout << r;
    return 0;
}

Measured memory_bytes: 35456
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll to;
	ll d;
};


///////////////////////////


int main() {

	ll a, b, c;
	cin >> a >> b >> c;

	if (a <= c && c <= b) { cout << "Yes"; }
	else { cout << "No"; }
	
	system("PAUSE");
}


Measured memory_bytes: 504
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using static System.Math;

class MainClass
{
    static void Main()
    {
        SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        Solve();
        Out.Flush();
        Read();
    }
    //ここにプログラムを入力
    static void Solve()
    {
        var r = Console.ReadLine().Split().Select(int.Parse).ToArray();
        WriteLine(r[0]*r[1]);
    }
}


Measured memory_bytes: 27892
#include<stdio.h>
#include<string.h>
#include<math.h>
int main(){
  char a[100000],b[100000];
  scanf("%s",a);
  scanf("%s",b);
  int l=strlen(a);
  for(int j=0;j<l;j++){
    char t=a[0];
    for(int i=1;i<l;i++){
	  a[i-1]=a[i];
	}
	a[l-1]=t;
	//printf("%s\n",a);
	if(strcmp(a,b)==0){
	  puts("Yes");
	  return 0;
	}
  }
  puts("No");
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
using namespace std;

// 位置
typedef pair<int,int> P;
// ( コスト , (向き,位置) )
typedef pair<int, pair<int,P> > state;

const int INF = 1e+8;
const int MAX_N = 35;
int w, h;
int m[MAX_N][MAX_N];
int C[4];

// 初期状態の向きは 0 (右向き)
// 0:→, 1:↓, 2:←, 3:↑
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1}; 

// 向きdir, 命令c の時の次の向きを返す
int command(int dir, int c){
	if( c == 0 ){ // 直進
		return dir;
	}else if( c == 1 ){ // 右折
		int f[4] = {1,2,3,0};
		return f[dir];
	}else if( c == 2 ){ // 反転
		return (dir + 2) % 4;
	}else if( c == 3 ){ // 左折
		int f[4] = {3,0,1,2};
		return f[dir];
	}
	return -1;
}

int bfs(){
	// 答え
	int ans = INF;
	// 初期位置 : (向き,位置)
	pair<int,P> start( 0 , P(0,0) );
	// p =(向き,位置), memo[p] := 最小コスト
	map< pair<int,P> , int > memo;
	// 初期化
	for(int y=0 ; y < h ; y++ ){
		for(int x=0 ; x < w ; x++ ){
			for(int d=0 ; d < 4 ; d++ ){
				pair<int,P> p( d , P(x,y) );
				memo[p] = INF;
			}
		}
	}
	
	// 優先度付きキュー
	// state : ( コスト , (向き,位置) )
	priority_queue< state , vector<state> , greater<state> > q;
	state s( 0 , start );
	q.push( s );
	memo[start] = 0;
	
	while( !q.empty() ){
		int now_cost = q.top().first;
		int now_d = q.top().second.first;
		int px = q.top().second.second.first;
		int py = q.top().second.second.second;
		pair<int,P> now( now_d , P(px,py) );
		q.pop();
		
		if( px == w-1 && py == h-1 ){
			ans = min( ans , now_cost );
			continue;
		}
		
		for(int c=0 ; c < 4 ; c++ ){
			// コストを払わず移動するとき
			if( m[py][px] == c ){
				int d = command( now_d , c );
				int mx = px + dx[d];
				int my = py + dy[d];
				if( mx < 0 || my < 0 || mx >= w || my >= h ) continue;
				pair<int,P> next( d , P(mx,my) );
				if( now_cost + 0 < memo[next] ){
					memo[next] = now_cost;
					q.push( state(now_cost,next) );
				}
			}else{ // コストを払うとき
				int d = command( now_d , c );
				int mx = px + dx[d];
				int my = py + dy[d];
				if( mx < 0 || my < 0 || mx >= w || my >= h ) continue;
				pair<int,P> next( d , P(mx,my) );
				if( now_cost + C[c] < memo[next] ){
					memo[next] = now_cost + C[c];
					q.push( state(memo[next],next) );
				}
			}
		}
	}
	return ans;
}

int main(){
	while( cin >> w >> h, w || h ){
		
		for(int y = 0 ; y < h ; y++ ){
			for(int x = 0 ; x < w ; x++ ){
				cin >> m[y][x];
			}
		}
		for(int i=0 ; i < 4 ; i++ ){
			cin >> C[i];
		}
		int ans = bfs();
		cout << ans << endl;
	}
}

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

int main() {
    int a, b; cin >> a >> b;
    if(a % 3 == 0 || b % 3 == 0 || (a+b) % 3 == 0) {
        cout << "Possible" << endl;
    } else {
        cout << "Impossible" << endl;
    }
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ll mod2 = 998244353;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

#define MAX_N 200005

class UnionFind
{
public:
  int par[MAX_N];
  int depth[MAX_N];
  int nGroup[MAX_N];

  UnionFind(int n) {
    init(n);
  }

  void init(int n) {
    for(int i=0; i<n; i++) {
      par[i] = i;
      depth[i] = 0;
      nGroup[i] = 1;
    }
  }

  int root(int x) {
    if(par[x] == x) {
      return x;
    } else {
      return par[x] = root(par[x]);
    }
  }

  bool same(int x, int y) {
    return root(x) == root(y);
  }

  void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if(x == y) return;

    if(depth[x] < depth[y]) {
      par[x] = y;
      nGroup[y] += nGroup[x];
      nGroup[x] = 0;
    } else {
      par[y] = x;
      nGroup[x] += nGroup[y];
      nGroup[y] = 0;
      if(depth[x] == depth[y])
        depth[x]++;
    }
  }
};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m; cin >> n >> m;
  UnionFind uf(n);
  rep(i, m) {
    int a, b; cin >> a >> b;
    a--; b--;
    uf.unite(a, b);
  }
  int ans = 0;
  rep(i, n) {
    chmax(ans, uf.nGroup[uf.root(i)]);
  }
  cout << ans << endk;
  return 0;
}


Measured memory_bytes: 6000
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 99999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(150) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main(){
  lli A,B,C,D,E,F,N,M,K,L,R,X,Y,H,W,sum=0,num=0,flag=0;string S,T;
  cin >> N >> K;
  Vec(P,lli,N,0);rep(i,0,N)cin >> P[i];
  X=0;
  rrep(i,50,0){
    sum=0;
    rep(j,0,N)if(P[j]&(1LL<<i))sum++;
    if(sum*2<N)X|=(1LL<<i);
    if(X>K){
      X&=~(1LL<<i);
    }
  }
  sum=0;
  rep(i,0,N)sum+=P[i]^X;
  Out(sum);
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <functional>
#include <deque>
typedef long long ll;
using namespace std;
const int MOD = 1000000007;

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

    int n = s.size();

    string a = "";
    string b = "";
    for(int i = 0;i < n;i++){
        if(i <= (n-1) / 2 - 1)a+= s[i];
        else if(i >= (n+3) / 2 - 1)b += s[i];
    }

    string aa = a;
    string bb = b;
    string ss = s;

    reverse(aa.begin(),aa.end());
    reverse(bb.begin(),bb.end());
    reverse(ss.begin(),ss.end());

    if(s == ss && a == aa && b == bb)cout << "Yes" << endl;
    else cout << "No" << endl;
}


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


int main() {
        ios::sync_with_stdio(0);
    string s;
	cin >> s;
	if(s=="SUN")cout<<"7";
	else if(s=="SAT")cout<<"1";
	else if(s=="FRI")cout<<"2";
	else if(s=="THU")cout<<"3";
	else if(s=="WED")cout<<"4";
	else if(s=="TUE")cout<<"5";
	else
        cout<<"6";

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <math.h>
using namespace std;

#define debug(x) cout<<#x<<": "<<x<<endl
#define rep(i,a,b) for(int i=a;i<b;i++)
#define PB push_back
#define putn(x,n) cout<< fixed<< setprecision(n)<< x << endl;
typedef long long ll;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b;
	cin >> a>>b;
	int c=a+b,c2=a-b,c3=a*b;
	if(c > c2){
		if(c3 > c)cout<<c3;
		else cout<<c;
	}else{
		if(c2>c3)cout << c2;
		else cout<<c3;
	}
	cout <<endl;

	return 0;
}


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

int main(){
	int N;
	string S;
	cin >> N >> S;
	string T = S.substr(0, N/2);
	string U = S.substr(N/2, N/2);
	if(T == U && N % 2 == 0) cout << "Yes" << endl;
	else cout << "No" << endl;

}


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

int main(){
    int n, q;
    string s;
    cin >> n >> q >> s;

    vector<char> t(q), d(q);
    for(int i=0; i<q; i++){
        cin >> t[i] >> d[i];
    }

    int upper = n+1, lower = 0, mid;
    while(upper - lower > 1){
        mid = (upper + lower) / 2;

        int current = mid;
        for(int i=0; i<q; i++){
            if(s[current-1] == t[i]){
                if(d[i] == 'L') current -= 1;
                if(d[i] == 'R') current += 1;
            }
            if(current == 0 || current == n+1) break;
        }
        if(current == 0) lower = mid;
        else upper = mid;
    }
    
    int ans = lower;
    upper = n+1, lower = 0;
    while(upper - lower > 1){
        mid = (upper + lower) / 2;

        int current = mid;
        for(int i=0; i<q; i++){
            if(s[current-1] == t[i]){
                if(d[i] == 'L') current -= 1;
                if(d[i] == 'R') current += 1;
            }
            if(current == 0 || current == n+1) break;
        }
        if(current == n+1) upper = mid;
        else lower = mid;
    }

    ans = (upper - 1) - ans;
    cout << ans << endl;
    return 0;
}

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

int main(){
    int M,D;
    cin >> M >> D;
    int count = 0;
    int m,n;
    for(int i=1;i<M+1;i++){
        for(int j=1;j<D+1 ;j++){
            if(j>=11){
                m = j%10;
                n = j/10;
                if((m>1)&&(n>1)){
                    if(i==m*n){
                        count++;
                        // cout << n << "と"<< m << endl;
                        // cout << m*n << endl;
                        // cout << M << endl;
                    }
                }
            }
        }
    }
    cout << count << endl;

}

Measured memory_bytes: 256
import numpy as np

n,k,q=list(map(int,input().split()))

a=np.zeros(n)

for i in range(q):
  tmp = int(input())
  a[tmp-1] += 1

for j in range(n):
  if a[j]-q+k > 0:
    print("Yes")
  else:
    print("No")
      

Measured memory_bytes: 15904
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

template <int MOD = 1000000007>
struct Mint {
    int x;

    Mint() : x(0) {}
    Mint(long long t) {
        x = t % MOD;
        if (x < 0) x += MOD;
    }

    Mint pow(int n) {
        Mint res(1), t(x);
        while (n > 0) {
            if (n & 1) res *= t;
            t *= t;
            n >>= 1;
        }
        return res;
    }

    Mint inv() const {
        int a = x, b = MOD, u = 1, v = 0, t;
        while (b > 0) {
            t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        return Mint(u);
    }

    Mint &operator+=(Mint a) {
        x += a.x;
        if (x >= MOD) x -= MOD;
        return *this;
    }

    Mint &operator-=(Mint a) {
        x += MOD - a.x;
        if (x >= MOD) x -= MOD;
        return *this;
    }

    Mint &operator*=(Mint a) {
        x = int(1LL * x * a.x % MOD);
        return *this;
    }

    Mint &operator/=(Mint a) {
        return (*this) *= a.inv();
    }

    Mint operator+(Mint a) const {
        return Mint(x) += a;
    }
    Mint operator-(Mint a) const {
        return Mint(x) -= a;
    }
    Mint operator*(Mint a) const {
        return Mint(x) *= a;
    }
    Mint operator/(Mint a) const {
        return Mint(x) /= a;
    }

    Mint operator-() const {
        return Mint(-x);
    }

    bool operator==(const Mint a) {
        return x == a.x;
    }
    bool operator!=(const Mint a) {
        return x != a.x;
    }
    bool operator<(const Mint a) {
        return x < a.x;
    }

    friend ostream &operator<<(ostream &os, const Mint &a) {
        return os << a.x;
    }

    friend istream &operator>>(istream &is, Mint &a) {
        int t;
        is >> t;
        a = Mint<MOD>(t);
        return (is);
    }
};

signed main() {
    int n, c;
    cin >> n >> c;
    int a[n], b[n];
    rep(i, n) {
        cin >> a[i];
    }
    rep(i, n) {
        cin >> b[i];
    }
    Mint<> dp[n + 1][c + 1];
    dp[0][0] = 1;
    for (int i = 0; i < n; i++) {
        Mint<> sum[c + 1];
        for (int j = 0; j <= c; j++) {
            for (int k = a[i]; k <= b[i]; k++){
                sum[j] += Mint<>(k).pow(j);
            }
        }
        for (int j = 0; j <= c; j++) {
            for (int k = 0; j + k <= c; k++) {
                dp[i + 1][j + k] += sum[k] * dp[i][j];
            }
        }
    }
    cout << dp[n][c] << endl;
    return 0;
}

Measured memory_bytes: 4232