akhauriyash/Code-Regression huggingface dataset:
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<numeric>
#include<string>
using namespace std;

long gcd(long x, long y) { if (x > y) { return gcd(y, x); } long r; while (y != 0) { r = x % y; x = y; y = r; }return x; }
long lcm(long x, long y) { return(x / gcd(x, y)) * y; }
void indexsort(long* first, long* last, long* func) { sort(first, last, [&](long a, long b) {return func[a] < func[b]; }); }
//--------------------

int main() {
	long res = 0;
	long N; cin >> N;
	long a[100009]; for (int i = 1; i <= N; i++) cin >> a[i];
	long conum[100009] = {};
	long alconum[100009] = {};

	for (int i = 1; i <= N; i++) conum[a[i]]++;
	alconum[0] = conum[1] + conum[0];
	alconum[100008] = conum[100008] + conum[100007];
	
	for (int i = 1; i <= 100007; i++) alconum[i] = conum[i - 1] + conum[i] + conum[i + 1];

	sort(alconum, alconum + 100009);

	res = alconum[100008];

	cout << res << endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//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; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(){
    int N,M,K; cin >> N >> M >> K;

    for(int a=0; a<=N; a++){
        for(int b=0; b<=M; b++){

            if(a*M + b*N - 2*a*b == K){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#define int long long
#define endl '\n'
#define INF 1000000000000000000
#define EPS 1e-10
#define PI 3.141592653589793238
#define all(a) a.begin(),a.end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define pb push_back
#define double long double
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
typedef complex<double> com;
template<class T, class S> bool chmax(T &a, const S &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class S> bool chmin(T &a, const S &b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	//modcalc();

	int n;
	cin >> n;
	vector<int> cnt(5);
	rep(i, n) {
		string s;
		cin >> s;
		if (s[0] == 'M') cnt[0]++;
		if (s[0] == 'A') cnt[1]++;
		if (s[0] == 'R') cnt[2]++;
		if (s[0] == 'C') cnt[3]++;
		if (s[0] == 'H') cnt[4]++;
	}
	int ans = 0;
	rep(i, 5) {
		for (int j = i + 1; j < 5; j++) {
			for (int k = j + 1; k < 5; k++) {
				ans += cnt[i] * cnt[j] * cnt[k];
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<climits>
#include<cstring>
#include<queue>
using namespace std;

double EPS = 1e-10;

double add(double a, double b){
	if(abs(a+b) < EPS * (abs(a) + abs(b))) return 0;
	return a+b;
}

struct P{
	double x,y;
	P(){}
	P(double x, double y) : x(x), y(y){
	}
	P operator +(P p){
		return P(add(x,p.x), add(y,p.y));
	}
	P operator -(P p){
		return P(add(x,-p.x), add(y,-p.y));
	}
	P operator *(double d){
		return P(d*x, d*y);
	}
	double dot (P p){
		return add(x*p.x, y*p.y);
	}
	double det (P p){
		return add(x*p.y, -y*p.x);
	}
	void print (){
		cout << x << " " << y <<endl;
		return;
	}
};

void clockWise(P p0, P p1, P p2){
	P q1 = p1-p0;
	P q2 = p2-p0;
	if(!q1.det(q2)){
		double r;
		if(q2.x == 0 && q2.y == 0 ) {
			cout << "ON_SEGMENT" <<endl;
			return ;
		}
		if(q2.x != 0) r =  q1.x/q2.x;
		if(q2.y != 0) r =  q1.y/q2.y;
		if(r<0){
			cout << "ONLINE_BACK"<< endl;
		}else if(r>=1){
			cout << "ON_SEGMENT"<<endl;
		}else{
			cout <<"ONLINE_FRONT" <<endl;
		}
	}else{
		if(q1.det(q2)>0){
			cout << "COUNTER_CLOCKWISE" <<endl;
		}else{
			cout <<"CLOCKWISE"<< endl;
		}

	}
	return;
}

int main(){
	double x, y, q;
	cin >> x >> y ;
	P p0(x,y);
	cin >> x >> y ;
	P p1(x,y);
	cin >> q ;

	for(int i=0;i<q;i++){
		cin >> x >> y ;
		P p2(x,y);
		clockWise(p0, p1, p2);
	}
	return 0;
}

Measured memory_bytes: 1212
N = int(input())
A = list(map(int, input().split()))

s = max(A[0], +1)
ans_p = abs(A[0]-s)
for a in A[1:]:
    if s>0: b=min(a, -s-1)
    if s<0: b=max(a, -s+1)
    s += b
    ans_p += abs(a-b)

s = min(A[0], -1)
ans_n = abs(A[0]-s)
for a in A[1:]:
    if s>0: b=min(a, -s-1)
    if s<0: b=max(a, -s+1)
    s += b
    ans_n += abs(a-b)

print(min(ans_p, ans_n))

Measured memory_bytes: 14468
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cmath>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
ll GCD(ll a, ll b) {
	if (b == 0)return a;
	return GCD(b, a%b);
}
ll LCM(ll a, ll b) {
	return a / GCD(a, b)*b;
}
ll mypow(ll a, ll b) {
	if (b == 0)return 1;
	if (b % 2)return mypow(a, b - 1)*a;
	else return mypow(a, b / 2)*mypow(a, b / 2) ;
}
/*
//Conbination!
ll c[51][51];
void comb(int n) {
	rep(i, 51) {
		rep(j, i + 1) {
			if (j == 0 || j == i)c[i][j] = 1;
			else c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
		}
	}
}
*/
int main() {
	ll n, k;
	cin >> n >> k;
	if (k % 2) {
		cout << mypow(n / k, 3) << endl;
	}
	else cout << mypow(n / k, 3) + mypow((n + k / 2) / k, 3) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
#define INF (1e9)

int main() {
  ll A;
  cin >> A;
  ll B;
  cin >> B;

  ll ans = A * B;
  cout << ans << endl;
}


Measured memory_bytes: 3632
def nck(n, k):
    numer, denom = 1, 1
    for i in range(k):
        numer = numer * (n-i) % MOD
        denom = denom * (k-i) % MOD
    return numer * pow(denom, MOD-2, MOD) % MOD

x, y = map(int, input().split())
MOD = 10 ** 9 + 7

i = 2 * y - x
j = 2 * x - y
if i % 3 != 0 or j % 3 != 0 or i < 0 or j < 0:
    print(0)
else:
    i, j = i // 3, j // 3
    print(nck(i+j, min(i, j)))


Measured memory_bytes: 38512
#include<stdio.h>
#include<math.h>

int main(void){
    
    int n,count=0,i,j,warikireru;
    int A[10000];
    
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&A[i]);
    }
    
    for(i=0;i<n;i++){
        if(A[i]==2){
            count++;
        }
        else if(A[i]<2 || A[i]%2==0){
        }
        else{
            j=3;
            warikireru=0;
            while(j<=sqrt(A[i])){
                if(A[i]%j==0){
                    warikireru++;
                }
                j=j+2;
            }
            if(warikireru==0){
                count++;
            }
        }
    }
    
    printf("%d\n",count);
    
    return 0;
}


Measured memory_bytes: 2044
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stdlib.h>
#include <map>
#define MOD_P 1000000007
#define ll long long
using namespace std;

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

	printf("%d", n * a > b ? b : a * n);

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <random>
#include <queue>

using namespace std;


int main()
{
	long long N, M;
	cin >> N >> M;

	vector<pair<int, int> > list(N);

	long long a, b;
	for (int ni = 0; ni < N; ni++) {
		cin >> a >> b;
		list[ni] = make_pair(a, b);
	}

	sort(list.begin(), list.end());

	long long sum_a = 0;
	long long sum_b = 0;
	for (int ni = 0; ni < N; ni++) {
		a = list[ni].first;
		b = list[ni].second;
		if (b < M - sum_b) {
			sum_a += b * a;
			sum_b += b;
		}
		else {
			sum_a += (M - sum_b) * a;
			break;
		}
	}

	long long ans = sum_a;
	printf("%lld",ans);


	return 0;
}



Measured memory_bytes: 1024
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<deque>
using namespace std;
typedef long long ll;
typedef pair<ll, ll>pii;
typedef pair<pii, ll>pi3;
ll mod = 1000000007;
int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	//cout << min(min(a + b, b + c), c + a) << endl;
	printf(((b*10+c)%4==0) ? "YES\n" : "NO\n");
}

Measured memory_bytes: 256
n = int(input())
A = list(map(int, input().split()))

# n = 4
# A = [i+1 for i in range(n)]

class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)
  
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
  
    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

#print((n*(n+1))//(2*2))

le = -1
ri = max(A) + 1
mid = (le + ri) // 2
while ri - le > 1:
    S = [0] * n
    S[0] = -1 + 2 * int(A[0] >= mid)
    for i in range(n-1):
        S[i+1] = S[i] - 1 + 2 * int(A[i+1] >= mid)
    bit = Bit(n+2)
    ans = 0
    for i in range(n):
        if S[i] >= 0:
            ans += 1

    #print("S OK")

    Smin = min(S)
    S = [S[i] - Smin + 1 for i in range(n)]

    #print("S OK2")
    #print(S)
    for i, p in enumerate(S):
        
        bit.add(p, 1)

        ans += bit.sum(p) - 1  # 「S[i] >= S[i]」をカウントしないように1を引く
        #print(i,ans)


    #print(le, ri, mid, ans)

    if ans >= (n*(n+1))//(2*2):
        le = mid
    else:
        ri = mid
    mid = (le + ri) // 2

print(le)
    


Measured memory_bytes: 122312
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static void Main(string[] args)
    {
        string[] arr = Console.ReadLine().Split(' ');
        Array.Sort(arr);

        int a = int.Parse(arr[0]);
        int b = int.Parse(arr[1]);
        int c = int.Parse(arr[2]);

        string result = "NO";

        if (a == 5 && b == 5 && c == 7)
        {
            result = "YES";
        }

        Console.WriteLine(result);

        Console.ReadLine();


    }
}



Measured memory_bytes: 11360
a,b,m=map(int,input().split())
la=list(map(int,input().split()))
lb=list(map(int,input().split()))
las=sorted(la)
lbs=sorted(lb)
mini=las[0]+lbs[0]
for i in range(m):
  p,q,r=list(map(int,input().split()))
  mini=min(mini,la[p-1]+lb[q-1]-r)
print(mini)

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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = x ; i < n ; ++i)
#define rep(i, n) for(int i = 0 ; i < n ; ++i)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())

const int IINF = 1e9 + 10;
const long long LLINF = (long long)1e18 + 10;
const long long MOD = (long long)1e9 + 7;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

lint fanc(lint b, lint n){
    lint res = 0;
    while(n > 0){
        res += n % b;
        n /= b;
    }
    return res;
}

lint solve(void){
    lint n, s;
    cin >> n >> s;
    lint res = LLINF;
    for(lint b = 2 ; b * b <= n ; ++b){
        if(fanc(b, n) == s){
            res = min(res, b);
        }
    }
    for(lint q = 1 ; q * q <= n ; ++q){
        if((n - s) % q != 0){
            continue;
        }
        lint b = (n - s) / q + 1LL;
        if(b < 2LL){
            continue;
        }
        if(fanc(b, n) == s){
            res = min(res, b);
        }
    }
    if(n == s){
        res = min(res, n + 1);
    }
    if(res < LLINF){
        return res;
    }
    return -1;
}

// √nまでは全探索で間に合う
// √n以降はnのb進は2桁
// qb + r = n, q + r = s
// qb + s - q = n
// qb = n - s + q
// b = (n - s) / q + 1
// b > √nより、q < √n
// 全探索できる

int main(){
    lint ans = solve();
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>
#include <bits/stdc++.h>

using namespace std;

int main()
{
    double L;
    double x, y;
    cin >> L ; 
    
    x = L/3;
     
    y = x*x*x;
    
    cout.precision(12);
    cout << y;
    
}


Measured memory_bytes: 256
//                                                  '-.-'
   //                                         ()      __.'.__
   //                                      .-:--:-.  |_______|
   //                               ()      \____/    \=====/
   //                               /\      {====}     )___(
   //                    (\=,      //\\      )__(     /_____\
   //    __    |'-'-'|  //  .\    (    )    /____\     |   |
   //   /  \   |_____| (( \_  \    )__(      |  |      |   |
   //   \__/    |===|   ))  `\_)  /____\     |  |      |   |
   //  /____\   |   |  (/     \    |  |      |  |      |   |
   //   |  |    |   |   | _.-'|    |  |      |  |      |   |
   //   |__|    )___(    )___(    /____\    /____\    /_____\
   //  (====)  (=====)  (=====)  (======)  (======)  (=======)
   //  }===={  }====={  }====={  }======{  }======{  }======={
   // (______)(_______)(_______)(________)(________)(_________)
   //
   // Credits :- Joan G. Stark
   //|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
   //|                      AUTHOR - KASPAROVIAN                                     |
   //|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define frr(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fr first
#define sc second
#define mk make_pair
#define endl '\n'
#define int long long
#define MOD 1000000007
#define in insert
#define sz(x) (ll)(x).size()
#define mem(a,b) memset(a,b,sizeof(a))
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef long double ld;
typedef pair<ll,ll> pl;
typedef pair<int,int> pi;
typedef vector<vi> graph;
template<class T> void mxi(T & a, const T & b) { a = max(a, b); }
template<class T> void mni(T & a, const T & b) { a = min(a, b); }
ld EPS=1e-9;
int n;
int dp[3100][3100][2];
int arr[3100],suf[3100];
int go(int st,int ed,int par)
{
	if(st==ed)
		return dp[st][ed][par]=arr[st];
	if(dp[st][ed][par]!=-1)
		return dp[st][ed][par];
	int &s=dp[st][ed][par];
	s=max(arr[st]+suf[st+1]-suf[ed+1]-go(st+1,ed,(par+1)%2),arr[ed]+suf[st]-suf[ed]-go(st,ed-1,(par+1)%2));
	return s;
}
void solve()
{
	mem(dp,-1);
	cin>>n;
	int sum=0;
	frr(i,n)
	{
		cin>>arr[i];
		sum+=arr[i];
	}
	suf[n]=0;
	for(int i=n-1;i>=0;i--)
		suf[i]=suf[i+1]+arr[i];
	cout<<2*go(0,n-1,0)-sum<<endl;

}
signed main()
{
  fast;
  int t,tab;
  t=1;
  tab=t;
  while(t--)
  {
    //cout<<"Case #"<<(tab-t)<<": ";
    solve();
  }
}

Measured memory_bytes: 153980
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

int N;
vector<int> color(9, 0);

int main(void){
	
	scanf("%d", &N);
	for(int i = 0; i < N; ++i){
	    int a; scanf("%d", &a);
	    if(a >= 1 && a <= 399) ++color[0];
	    else if(a >= 400 && a <= 799) ++color[1];
	    else if(a >= 800 && a <= 1199) ++color[2];
	    else if(a >= 1200 && a <= 1599) ++color[3];
	    else if(a >= 1600 && a <= 1999) ++color[4];
	    else if(a >= 2000 && a <= 2399) ++color[5];
	    else if(a >= 2400 && a <= 2799) ++color[6];
	    else if(a >= 2800 && a <= 3199) ++color[7];
	    else ++color[8];
	}
	
	int mn = 0, mx = 0;
	for(int i = 0; i < color.size() - 1; ++i) if(color[i] != 0) ++mn;
	mx = mn;
	for(int i = 0; i < color[8]; ++i) ++mx;
	
	if(mn == 0) ++mn;
	printf("%d %d\n", mn, mx);
	
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int ans;
int main () {
    for (int i = 0; i < 3; i++) {
	char ch;
	cin >> ch;
	if (ch == 'o')
	    ans += 100;
    }
    ans += 700;
    cout << ans << endl;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var R int
	fmt.Scan(&R)
	
	ans := ""
	if R < 1200 {
		ans = "ABC"
	} else if R < 2800 {
		ans = "ARC"
	} else {
		ans = "AGC"
	}
	fmt.Println(ans)
}

Measured memory_bytes: 512
using System;
using System.Collections.Generic;

class Program
{
    static void Main () 
    {
        long n = long.Parse(Console.ReadLine().Split(' ')[0]);
        Dictionary<long, char> dic = new Dictionary<long, char>();
        for (int i = 0; i < 26; i++)
        {
            char c = (char) (i + 97);
            dic.Add(i, c);
        }
        String ans = "";
        do
        {
            n = n - 1;
            long b = n % 26;
            n /= 26;
            ans = dic[b] + ans;
        }
        while(n > 0);

        Console.Write(ans + "\n");
    }
}

Measured memory_bytes: 27800
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<set>
#include<map>
#include<queue>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);++i)
#define rrep(i,n) for(int (i)=(n)-1;(i)>=0;--i)
#define rep1(i,n) for(int (i)=1;(i)<=(n);++i)
#define rrep1(i,n) for(int (i)=(n);(i)>=1;--i)
#define las(v) v[v.size()-1]
#define pb push_back
#define fr first
#define sc second
typedef long long ll;
typedef pair<int,int> P;
typedef pair<long long,long long> LP;
typedef double db;
using namespace std;

ll N,Q;
ll s[200000], t[200000], d[200000];
ll tmp[200000];
string st;

bool is_left(ll id){ //ochiru
  rep(i,Q){
    if(t[i]==s[id]){
      id += d[i];
      if(id==-1) return true;
      if(id==N) return false;
    }
  }
  return false;
}

ll solve(){
  ll lb = -1, ub = N;
  ll mid;
  while(ub-lb>1){
    mid = (ub+lb)/2;
    if(is_left(mid)) lb = mid;
    else ub=mid;
  }
  return ub;
}

int main()
{
  cin>>N>>Q;
  cin>>st;
  rep(i, N){
    s[i] = st[i] - 'A';
  }
  rep(i, Q){
    cin>>st;
    t[i] = st[0] - 'A';
    cin>>st;
    d[i] = st == "L" ? -1:1;
  }



  ll ans = solve();
  rep(i,N){
    tmp[i] = s[N-1-i];
  }
  rep(i,N){
    s[i] = tmp[i];
  }
  rep(i,Q){
    d[i] = -d[i];
  }
  ans += solve();
  cout<<N-ans<<endl;
}


Measured memory_bytes: 6788
#include<bits/stdc++.h>
using namespace std;
long long n,a1=1e9,a2=-1e9,b1=1e9,b2=-1e9;
int main()
{
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)
	{
		long long a,b;
		scanf("%lld%lld",&a,&b);
		long long x=a+b,y=a-b;
		a1=min(a1,x);
		a2=max(a2,x);
		b1=min(b1,y);
		b2=max(b2,y);
	}
	printf("%lld\n",max(a2-a1,b2-b1));
	return 0;
}

Measured memory_bytes: 3816
#include<bits/stdc++.h>
using namespace std;
int n, bas, en;

int cal(int x){
  printf("%d\n",x);
  static char s[233];
  cin>>s; if (s[0]=='V') exit(0);
  return s[0]=='F';
}

bool ok(int l,int r,int s,int t){
  return (r-l&1)^s^t;
}

int main(){
  cin>>n;
  bas= cal(0); en=cal(n-1);
  int l=0, r=n-1, mid, t;
  for (;l<=r;){
    mid=l+r>>1; t=cal(mid);
    if (ok(l,mid,bas,t)){
      r=mid; en=t;
    }else{
      l=mid; bas=t;
    }
  }
}

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

#include<cstdio>
#define r(i,n) for(int i=0;i<n;i++)

int main(void){
  int n,x,cnt=0,mini=10000000000;
  
  cin>>n>>x;
  vector<int> m(n);
  r(i,n){
    cin>>m.at(i);
    mini=min(mini,m.at(i));
  }

  r(i,n){
    x=x-m.at(i);
    if(x<0)break;
    cnt++;
  }
  cnt=cnt+x/mini;
  cout<<cnt<<endl;


return 0;}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main{
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String[] cmd=br.readLine().split(" ");
		for(int i=0;i<5;i++)
		{
			if(Integer.valueOf(cmd[i])==0)
			{
				System.out.println(i+1);
				break;
			}
		}
	}

}


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

int n, k, ans;

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

    cin >> n >> k;
    while(n) {
        n /= k;
        ans++;
    }

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


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define rep(i,n) for(int i=0;i<(lint)(n);i++)
#define REP(i,n) for(int i=1;i<=(lint)(n);i++)
#define all(V) V.begin(),V.end()
#define stackReplaceBegin(size)\
	void* p=malloc(size);\
	esp_new=(lint)p+size-1;\
	void * stack_extend_memory_ = malloc(size);\
	void * stack_extend_origin_memory_;\
	char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);\
	*stack_extend_dummy_memory_ = 0;\
	asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
typedef long long lint;
typedef unsigned long long ulint;
typedef std::pair<int, int> P;
constexpr int INF = INT_MAX/2;
constexpr lint LINF = LLONG_MAX/2;
constexpr double eps = DBL_EPSILON;
constexpr double PI = 3.141592653589793238462643383279;
lint esp_new;
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
inline lint gcd(lint a, lint b) {
	while (b) {
		lint c = a;
		a = b; b = c % b;
	}
	return a;
}
inline lint lcm(lint a, lint b) {
	return a / gcd(a, b) * b;
}
bool isprime(lint n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
template<typename T>
T mypow(T a, unsigned int b) {
	T res(1),now(a);
	while(b){
		if(b&1)res*=now;
		b>>=1;
		now*=now;
	}
	return res;
}
lint modpow(lint a,unsigned int b,unsigned int mod){
	lint res(1),now(a%mod);
	while(b){
		if(b&1){
			res*=now;
			res%=mod;
		}
		b>>=1;
		now*=now;
		now%=mod;
	}
	return res;
}
template<typename T>
void printArray(std::vector<T>& vec) {
	rep(i, (int)vec.size() - 1)std::cout << vec[i] << " ";
	if(!vec.empty())std::cout << vec.back() << std::endl;
}
template<typename T>
void printArray(T l, T r) {
	T rprev = r;
	rprev--;
	for (T i = l; i != rprev; i++) {
		std::cout << *i << " ";
	}
	std::cout << *rprev << std::endl;
}
int main(){
	int n,m;
	std::cin>>n>>m;
	std::cout<<mypow(2,m)*(1900*m+100*(n-m))<<std::endl;
	return 0;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n; cin>>n;
	vector<int> l(n);
	for (int i=0; i<n; i++)
		cin>>l[i];
	sort (l.rbegin(),l.rend());
	int cur=0;
	for (int i=1; i<n; i++)
		cur+=l[i];
	cout<<(l[0]<cur?"Yes":"No")<<endl;
	return 0;
}


Measured memory_bytes: 3612
S = input()
k = []
for i in range(4):
    k.append(S[i])
flag = 0
a = k[0]
b = k[1]
c = k[2]
d = k[3]
A = int(a)
B = int(b)
C = int(c)
D = int(d)
if A+B+C+D == 7:
    print(a+"+"+b+"+"+c+"+"+d+"="+"7")
    flag += 1
elif A+B+C-D == 7:
    if flag == 0:
        print(a+"+"+b+"+"+c+"-"+d+"="+"7")
        flag += 1
elif A+B-C+D == 7:
    if flag == 0:
        print(a+"+"+b+"-"+c+"+"+d+"="+"7")
        flag += 1
elif A+B-C-D == 7:
    if flag == 0:
        print(a+"+"+b+"-"+c+"-"+d+"="+"7")
        flag += 1
elif A-B-C+D == 7:
    if flag == 0:
        print(a+"-"+b+"-"+c+"+"+d+"="+"7")
        flag += 1
elif A-B+C-D == 7:
    if flag == 0:
        print(a+"-"+b+"+"+c+"-"+d+"="+"7")
        flag += 1
elif A-B+C+D == 7:
    if flag == 0:
        print(a+"-"+b+"+"+c+"+"+d+"="+"7")
        flag += 1
elif A-B-C-D == 7:
    if flag == 0:
        print(a+"-"+b+"-"+c+"-"+d+"="+"7")
        flag += 1

Measured memory_bytes: 3064
#B
import math
n, d = map(int, input().split())
x = []
for i in range(n):
    x.append(list(map(int, input().split())))
ans=0
for i in range(n):
    for j in range(i + 1, n):
        dif = 0
        for k in range(d):
            dif += abs(x[i][k] - x[j][k])** 2
        if math.sqrt(dif) % 1 == 0:
            ans += 1
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <bitset>
#include <utility>

using namespace std;
typedef pair<int, int> P;

int h, w, n;
int sr, sc;
string s, t;
vector<P> vec, vec2;

bool calc(vector<P> &vec, int s, int n)
{
	int l = 0, r = n+1;
	for(int i = (int)vec.size()-1; i >= 0; i--){
		
		if(vec[i].first == 1){
			if(vec[i].second == 1) r--;
			if(vec[i].second == -1) l++;
		}
		else{
			if(vec[i].second == 1) l--;
			if(vec[i].second == -1) r++;
		}
		if(l+1 >= r) return false;
		l = max(0, l), r = min(n+1, r);
		//cout << l << "  " << r << endl;
	}
	return l < s && s < r;
}

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> h >> w >> n;
	cin >> sr >> sc;
	cin >> s >> t;
	
	for(int i = 0; i < n; i++){
		if(s[i] == 'L') vec.push_back(make_pair(1, -1));
		if(s[i] == 'R') vec.push_back(make_pair(1, 1));
		if(s[i] == 'U') vec2.push_back(make_pair(1, -1));
		if(s[i] == 'D') vec2.push_back(make_pair(1, 1));
		if(t[i] == 'L') vec.push_back(make_pair(2, -1));
		if(t[i] == 'R') vec.push_back(make_pair(2, 1));
		if(t[i] == 'U') vec2.push_back(make_pair(2, -1));
		if(t[i] == 'D') vec2.push_back(make_pair(2, 1));
	}
	
	if(calc(vec, sc, w) && calc(vec2, sr, h)) cout << "YES" << endl;
	else cout << "NO" << endl;
	
	return 0;
}

Measured memory_bytes: 4104
N, *AS = $stdin.read.split.map(&:to_i)

x = AS[0]
y = AS.inject(:+) - x
ans = (x-y).abs
for i in 1..(N-2)
  x += AS[i]
  y -= AS[i]
  diff = (x-y).abs
  ans = diff if diff < ans
end
p ans


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

int n,ans,mx;
int a[6005],curdp[2005][2005],dp[2005][2005],f[2005];
int main()
{
	int i,j,k;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		f[i]=-n*10;
		for(j=i;j<=n;j++)
			dp[i][j]=curdp[i][j]=-n*10;
	}
	for(i=1;i<=n*3;i++)
		scanf("%d",&a[i]);
	dp[min(a[1],a[2])][max(a[1],a[2])]=0;
	f[a[1]]=f[a[2]]=0;
	for(i=5;i<=3*n;i+=3)
	{
		if(a[i]==a[i-1]&&a[i-1]==a[i-2])
		{
			ans++;
			continue;
		}
		int b[3];
		for(k=0;k<3;k++)
			b[k]=a[i-k];
		sort(b,b+3);
		for(k=0;k<3;k++)
		{
			int t=b[k];
			b[k]=-10;
			sort(b,b+3);
			curdp[b[1]][b[2]]=max(curdp[b[1]][b[2]],max(dp[t][t]+1,mx));
			b[0]=t;
			sort(b,b+3);
		}
		for(k=0;k<3;k++)
		{
			int t=b[k];
			b[k]=-10;
			sort(b,b+3);
			if(b[1]==b[2])
			{
				for(j=1;j<=n;j++)
					curdp[min(t,j)][max(t,j)]=max(curdp[min(t,j)][max(t,j)],dp[min(b[1],j)][max(b[1],j)]+1);
			}
			for(j=1;j<=n;j++)
				curdp[min(t,j)][max(t,j)]=max(curdp[min(t,j)][max(t,j)],f[j]);
			b[0]=t;
			sort(b,b+3);
		}
		for(k=0;k<3;k++)
		{
			int t=b[k];
			b[k]=-10;
			sort(b,b+3);
			dp[b[1]][b[2]]=max(dp[b[1]][b[2]],curdp[b[1]][b[2]]);
			mx=max(mx,dp[b[1]][b[2]]);
			f[b[1]]=max(f[b[1]],dp[b[1]][b[2]]);
			f[b[2]]=max(f[b[2]],dp[b[1]][b[2]]);
			curdp[b[1]][b[2]]=-n*10;
			for(j=1;j<=n;j++)
			{
				dp[min(t,j)][max(t,j)]=max(curdp[min(t,j)][max(t,j)],dp[min(t,j)][max(t,j)]);
				mx=max(mx,dp[min(t,j)][max(t,j)]);
				f[t]=max(f[t],dp[min(t,j)][max(t,j)]);
				f[j]=max(f[j],dp[min(t,j)][max(t,j)]);
				curdp[min(t,j)][max(t,j)]=-n*10;
			}
			b[0]=t;
			sort(b,b+3);
		}
	}
	printf("%d\n",ans+max(mx,dp[a[n*3]][a[n*3]]+1));
	return 0;
}


Measured memory_bytes: 31436
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);in(name)
#define vv(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define VV(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__));in(name)
#define vvv(type,name,h,w,...) vector<vector<vector<type>>>name(h,vector<vector<type>>(w,vector<type>(__VA_ARGS__)))
inline int scan(){ return getchar(); }
inline void scan(int &a){ scanf("%d", &a); }
inline void scan(unsigned &a){ scanf("%u", &a); }
inline void scan(long &a){ scanf("%ld", &a); }
inline void scan(long long &a){ scanf("%lld", &a); }
inline void scan(unsigned long long &a){ scanf("%llu", &a); }
inline void scan(char &a){ cin >> a; }
inline void scan(float &a){ scanf("%f", &a); }
inline void scan(double &a){ scanf("%lf", &a); }
inline void scan(long double &a){ scanf("%Lf", &a); }
inline void scan(vector<bool> &vec){ for(unsigned i = 0; i < vec.size(); i++) { int a; scan(a); vec[i] = a; } }
inline void scan(string &a){ cin >> a; }
template<class T> inline void scan(vector<T> &vec);
template<class T, size_t size> inline void scan(array<T, size> &vec);
template<class T, class L> inline void scan(pair<T, L> &p);
template<class T, size_t size> inline void scan(T (&vec)[size]);
template<class T> inline void scan(vector<T> &vec){ for(auto &i : vec) scan(i); }
template<class T, size_t size> inline void scan(array<T, size> &vec){ for(auto &i : vec) scan(i); }
template<class T, class L> inline void scan(pair<T, L> &p){ scan(p.first); scan(p.second); }
template<class T, size_t size> inline void scan(T (&vec)[size]){ for(auto &i : vec) scan(i); }
template<class T> inline void scan(T &a){ cin>>a; }
inline void in(){}
template <class Head, class... Tail> inline void in(Head &head, Tail&... tail){ scan(head); in(tail...); }
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
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; }
using Graph = vector<vector<int>>;
/* 4方向への隣接頂点への移動を表すベクトル */
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

const long long INF = 1LL << 60;
int main(){
    LL(N,M);
    ll maxL = 0LL;
    ll minR = 1LL << 60;
    for(int i = 0; i < M; ++i){
        LL(l,r);
        maxL = max(maxL,l);
        minR = min(minR,r);
    }
    if(minR - maxL + 1 >= 0){
    cout << minR - maxL + 1 << endl;
    } else {
        cout << 0 << endl;
    }
}

Measured memory_bytes: 256
/*
    WRITER:kakitamasziru/OxOmisosiru
*/
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
//#include <unordered_map> // unordered_map
//#include <unordered_set> // unordered_set
#include <bitset> // bitset
//#include <cctype> // isupper, islower, isdigit, toupper, tolower
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

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 INF = 1001001000;
const int MOD = 1000000007;
typedef pair<long,long> P;
//NのM乗を求める(繰り返し二乗法)
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

long long dp[114514];

int main() {
    string S;cin >> S;
    vector<char> A(S.size());
    vector<char> B(S.size());
    for(int i = 0;i<S.size();i++){
        if(i%2 == 0){
            A.at(i) = '0';
            B.at(i) = '1';
        }
        else {
            A.at(i) = '1';
            B.at(i) = '0';
        }
    }
    int ansA = 0,ansB = 0;
    for(int i = 0;i<S.size();i++){
        if(S.at(i) != A.at(i)) ansA++;
        if(S.at(i) != B.at(i)) ansB++;
    }

    cout << min(ansA,ansB) << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
/*** Template Begins ***/
 
typedef long long   ll;
typedef pair<ll,ll> pll;
typedef long double ld; 
#define rep(i,a,b) for(i=a;i<b;i++)
#define pb           push_back
#define F            first
#define S            second
#define ios          ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define hell   1000000007LL
#define all(a)       (a).begin(),(a).end()
ll power(ll x, ll y, ll p){ ll res = 1;x = x % p;while (y > 0) {if (y & 1) res = (res*x) % p;y = y>>1;
  x = (x*x) % p;} return res;} 

const long double PI = acos(-1);
// Debug //
#define trace(x)                 cerr << #x << ": " << x << endl;
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
ll euclid(ll x,ll y,ll a,ll b){
  return (a-x)*(a-x)+(b-y)*(b-y);
}
void solve()
{
  ll x,n;
  set<ll> s;
  cin>>x>>n;
  ll a,i,ans=-1,diff=200;
  rep(i,0,n)
  {
    cin>>a;
    s.insert(a);
  }
  for(i=0;i<=101;i++)
  {
    if(s.find(i)==s.end())
    {
      if(abs(i-x)<diff)
      {
        ans = i;
        diff = abs(i-x);
      }
    }
  }
  cout<<ans;
}
int main()
{ 
  ios;
  // freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
  ll t=1,i=1;
  // cin>>t;
  while(i<=t)
  {
    solve();
    i++;
  }
  return 0;
}


Measured memory_bytes: 3664
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;
string S[110];

void solve() {
	cin >> N;
	for(int i = 0; i < N; i++) {
		cin >> S[i];
	}
	bool ok = true;
	for(int i = 0; i < N; i++) {
		for(int j = 0; j < i; j++) {
			if(S[i] == S[j]) {
				ok = false;
			}
		}
		if(i != 0) {
			if(S[i - 1][S[i - 1].size() - 1] != S[i][0]) {
				ok = false;
			}
		}
	}
	if(ok) cout << "Yes\n";
	else cout << "No\n";
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 256
d,g=[int(_) for _ in input().split()]
l=[0]+[list(map(int,input().split())) for _ in  range(d)]
def f(i,g):
	if i==0:return 10**9
	c=min(g//(100*i),l[i][0])
	s=100*i*c
	if c==l[i][0]:s+=l[i][1]
	if s<g:
		c+=f(i-1,g-s)
	return min(c,f(i-1,g))
print(f(d,g))

Measured memory_bytes: 9132
#include <bits/stdc++.h>
#define  re(i,j,n) for(li i=(j);i<(n);i++)
#define  rep(i,n) re(i,0,(n))
#define  all(a) begin(a),end(a)
using namespace std;
typedef long int li;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<li> vli;
typedef vector<string> vs;

int main()
{
    li a[3];
    cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    if(a[0]%2 && a[1]%2 && a[2]%2) cout<<a[0]*a[1]<<endl;
    else cout<<0<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) "[" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define ull unsigned long long
#define N 100005
#define mod 1000000007
//#define mod 1e18
#define boost ios_base::sync_with_stdio(false);cin.tie(0)
#define prec(n) fixed<<setprecision(n)

#define tr(it,c) for(it = c.begin() ; it!=c.end() ; it++)
int inf = INT_MAX ;
ll modulo(ll num,ll MOD=mod){ return ((num%MOD)+MOD)%MOD;} // for negative integer
ll power(ll b,ll e,ll MOD=mod){ll ans=1; while(e){if(e%2) ans=(ans*b)%MOD; b=(b*b)%MOD; e/=2;} return ans;}
ll inv(ll num,ll MOD=mod){ return power(modulo(num),MOD-2,MOD); }
ll gcd(ll a,ll b){ return ((b==0) ? a:gcd(b,a%b));}
ll fac[2*N];

ll sub(ll a,ll b){
	return (a-b+mod)%mod;
}

ll mul(ll a,ll b){
	return (a*b)%mod;
}

ll binomial(ll a,ll b){
	if(a<0||b<0||b>a)
		return 0;
	
	ll temp = (fac[a]*inv(fac[b]))%mod;
	temp = (temp*inv(fac[a - b]))%mod;
	return temp;
}

ll f(ll a,ll b){
	return binomial(a+b,b);
}

int main(){
	boost;
	fac[0] = 1;
	for(int i = 1;i<2*N;i++){
		fac[i] = (fac[i-1]*i)%mod;
	}
	
	ll h,w,n;
	cin>>h>>w>>n;
	vector<pair<int,int>> v;
	
	for(int i = 0;i<n;i++){
		ll a,b;
		cin>>a>>b;
		v.push_back(make_pair(a,b));
	}
	
	v.push_back(make_pair(h,w));
	sort(v.begin(),v.end(),[&](pair<int,int> a,pair<int,int> b){
		return a.first + a.second < b.first + b.second;
	});
	
	//debug() << imie(v);
	vector<int> dp(n+1);
	
	for(int i = 0;i<n+1;i++){
		ll ans = binomial(v[i].first + v[i].second - 2, v[i].first - 1);
		//debug()<< imie(ans);
		for(int j = i-1;j>=0;j--){
			if(v[j].first<=v[i].first&&v[j].second<=v[i].second)
				ans = sub(ans,mul(dp[j],f(v[i].first - v[j].first, v[i].second - v[j].second)));
		}
		dp[i] = ans;
	}
	//debug() << imie(dp);
	cout<<dp[n]<<endl;
	return 0;
}



Measured memory_bytes: 5284
#include <iostream>
#include <vector>

using namespace std;
int main(int argc, char *argv[]) {
	int n, m, c;
	cin >> n >> m >> c;
	int b[m];
	for (int i = 0; i < m; i++) {
		cin >> b[i];
	}
	int a[n][m];
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cin >> a[i][j];
		}
	}
	
	int ans = 0;
	for (int i = 0; i < n; i++) {
		int sum = c;
		for (int j = 0; j < m; j++) {
			sum += a[i][j] * b[j];
		}
		if (sum > 0) {
			ans++;
		}
	}
	
	cout << ans << endl;
}

Measured memory_bytes: 256
// CODE FESTIVAL 2016 qual C
// D - Friction

#include <cstdio>
#include <cstring>
#include <algorithm>
#define MAX_H 300
#define MAX_W 300
#define INF 100000000
using namespace std;


int H, W;
char c[MAX_H + 1][MAX_W + 3];
int f[MAX_H + 1][MAX_H + 1];
int dp[MAX_H + 1][MAX_H + 1];
int ans = 0;

int main() {

  scanf("%d%d", &H, &W);
  for (int i = H; i > 0; i--) {
    scanf("%s", &c[i][1]);
    c[i][0] = c[i][W + 1] = '*';
    c[i][W + 2] = '\0';
  }

  memset(f, 0, sizeof(f));
  ans = 0;
  for (int x = 0; x <= W; x++) {
    for (int y0 = 1; y0 <= H; y0++) {
      for (int y1 = 1; y1 <= H; y1++) {
        f[y0][y1] = f[y0 - 1][y1 - 1] + (c[H - y0 + 1][x] == c[H - y1 + 1][x + 1] ? 1 : 0);
      }
    }

    for (int y0 = H; y0 >= 0; y0--) {
      for (int y1 = H; y1 >= 0; y1--) {
        if (y0 == H && y1 == H) {
          dp[y0][y1] = 0;
          continue;
        }
        dp[y0][y1] = INF;
        if (y0 + 1 <= H) {
          dp[y0][y1] = min(dp[y0][y1], dp[y0 + 1][y1] + f[y0 + 1][y1]);
        }
        if (y1 + 1 <= H) {
          dp[y0][y1] = min(dp[y0][y1], dp[y0][y1 + 1] + f[y0][y1 + 1]);
        }
      }
    }
    ans += dp[0][0];
  }

  printf("%d\n", ans);

  return 0;

}




Measured memory_bytes: 896
#include <bits/stdc++.h>
 
using namespace std;
 
#define LIMIT 20
 
struct P{
    int y,x;
    P(int y,int x) : y(y),x(x) {}
};
 
int limit;
vector<int> v;
 
P getPos(int x)
{
    if(x == 0) return P(0,2);
    if(1 <= x && x <= 3) return P(1,x);
    if(4 <= x && x <= 8) return P(2,x-4);
    if(9 <= x && x <= 11) return P(3,x-8);
    return P(4,2);
}
 
int getPos(P p)
{
    if(p.y == 0){
	if(p.x == 2) return 0;
	else return -1;
    }
    if(p.y == 1){
	if(1 <= p.x && p.x <= 3){
	    return p.x;
	}else{
	    return -1;
	}
    }
    if(p.y == 2){
	if(0 <= p.x && p.x <= 4){
	    return p.x+4;
	}else{
	    return -1;
	}
    }
    if(p.y == 3){
	if(1 <= p.x && p.x <= 3){
	    return p.x+8;
	}else{
	    return -1;
	}
    }
    if(p.y == 4){
	if(p.x == 2){
	    return 12;
	}else{
	    return -1;
	}
    }
    return -1;
}
 
int getMD()
{
    int sum = 0;
    for(int i = 0 ; i < 13 ; i++){
	if(v[i] == 0) continue;
	P np = getPos(i);
	P tp = getPos(v[i]);
	sum += abs(np.x-tp.x) + abs(np.y-tp.y);
    }
    return sum;
}
 
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
 
bool dfs(int sp1,int sp2,int step)
{
    int md = getMD();
    if(md == 0) return true;
    if(md + step > limit){
	return false;
    }
    P p[2] = {getPos(sp1),getPos(sp2)};
    for(int i = 0 ; i < 2 ; i++){
	int x = p[i].x, y = p[i].y;
	for(int j = 0 ; j < 4 ; j++){
	    int nx = x + dx[j], ny = y + dy[j];
	    P np(ny,nx);
	    int next = getPos(np);
	    if(next == -1) continue;
	    if(i == 0){
		swap(v[sp1],v[next]);
		if(dfs(next,sp2,step+1)){
		    return true;
		}
		swap(v[sp1],v[next]);
	    }else{
		swap(v[sp2],v[next]);
		if(dfs(sp1,next,step+1)){
		    return true;
		}
		swap(v[sp2],v[next]);
	    }
	}
    }
    return false;
}
 
int main()
{
    int x;
    while(cin >> x, x != -1){
	int sp[2];
	v.resize(13); v[0] = x;
	for(int i = 1 ; i < 13 ; i++){
	    cin >> v[i];
	}
	for(int i = 0, j = 0 ; i < 13 ; i++){
	    if(v[i] == 0){
		sp[j++] = i;
	    }
	}
	bool found = false;
	for(limit = 0 ; limit <= LIMIT ; limit++){
	    if(dfs(sp[0],sp[1],0)){
		cout << limit << endl;
		found = true;
		break;
	    }
	}
	if(!found){
	    cout << "NA" << endl;
	}
    }
    return 0;
}

Measured memory_bytes: 3076
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <cmath>
const long double PI = acos(-1);
using namespace std;
int main (){
    int a, b;
    string op;
    for(int i=0; i<20000; i++){
        cin >> a >> op >> b;
    if(op=="?") return 0;
    else if(op=="+") cout << a+b << endl;
    else if(op=="-") cout << a-b << endl;
    else if(op=="*") cout << a*b << endl;
    else cout << a/b << endl;
    }
    return 0;
}


Measured memory_bytes: 3168
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
using namespace std;
//#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i,j) ((i<0 && j<0) || (i>0 && j>0)) ? true : false 
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };

struct MyStruct
{
	int list[13];
};


signed main() {
	int i, j, n, sum = 0, cnt = 0;
	string s, s1, s2;
	bool flag = false;
	vector<int>list(26,0);



	cin >> s;
	cin >> n;


	for (i = 0; i < n; i++) {
		string ss;
		cin >> ss;

		if (ss == "replace") {
			int a, b;
			string s3;
			cin >> a >> b >> s3;
			int p = b - a + 1;
			//s.erase(a, p);
			for (j = 0; j < p; j++) {
				s[a + j] = s3[j];
			}

		}
		else if (ss == "reverse") {
			int a, b;
			cin >> a >> b;

			string s4 = s.substr(a, (b - a) + 1);
			int len = s4.length();
			string s5;

			for (j = len - 1; j >= 0; j--) {
				s5 += s4[j];
			}

			for (j = 0; j < len; j++) {
				s[a + j] = s5[j];
			}

		}
		if (ss == "print") {
			int a, b;
			cin >> a >> b;

			for (j = 0; j < (b - a + 1); j++) {
				cout << s[a + j];
			}
			cout << endl;

		}


	}











	getchar();
	getchar();
	return 0;
}


Measured memory_bytes: 3212
import itertools
N, A, B, C = map(int, input().split())
ln = [int(input()) for _ in range(N)]
bit = itertools.product([0, 1, 2, 3], repeat=N)
ans = 10000
for bi in bit:
    cnt = 0
    a = []
    b = []
    c = []
    for i in range(N):
        if bi[i] == 1:
            a.append(ln[i])
        elif bi[i] == 2:
            b.append(ln[i])
        elif bi[i] == 3:
            c.append(ln[i])
    if len(a) == 0 or len(b) == 0 or len(c) == 0:
        continue
    cnt += 10*(max(len(a)-1, 0)+max(len(b)-1, 0)+max(len(c)-1, 0))
    temp = [sum(a), sum(b), sum(c)]
    temp.sort()
    cnt += abs(temp[0]-C) + abs(temp[1]-B) + abs(temp[2]-A)
    ans = min(ans, cnt)
print(ans)


Measured memory_bytes: 3064