akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <cmath>
#include <numeric>

#define rep(i,n) for(int i = 0;i < (n);i++)
#define repp(i,j, n) for(int i = (j);i < (n);i++)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define INF 1e9

using namespace std;

typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<int, int> > vpi;
typedef vector<pair<ll, ll> > vpl;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int h, w;
  cin >> h >> w;
  int alpha[26]={0};
  rep(i, h){
    string a;
    cin >> a;
    rep(j, w) alpha[(int)a[j]-'a']++;
  }
  int count = 0, odd = 0;
  rep(i, 26){
    if(alpha[i] >= 4){
      count+=alpha[i]/4;
    }
    if(alpha[i]%2!=0) odd++;
  }

  if((h%2==0?h:h-1)*(w%2==0?w:w-1)/4 <= count
     && odd == ((h%2!=0&&w%2!=0)?1:0)){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
    int n,k;
    scanf("%d\n%d",&n,&k);
    long long int ans=1;
    for(int p=1;p<n+1;p++)
    {
        if(ans>k)
        {
            ans+=k;
        }
        else
        {
            ans*=2;
        }
    }
    printf("%lld",ans);
}


Measured memory_bytes: 128
fun main(args: Array<String>) {
    var N = readLine()!!.toInt()
    var A = readLine()!!.split(" ").map { it.toInt() }
    when {
    // 非負だけ
        A.filter { it >= 0 }.size == N -> {
            println("${N-1}")
            for (i in 1..N - 1) {
                println("$i ${i + 1}")
            }
        }
    // 非正だけ
        A.filter { it <= 0 }.size == N -> {
            println("${N-1}")
            for (i in N - 1 downTo 1) {
                println("${i + 1} $i")
            }
        }
    // 混在
        else -> {
            val max = A.withIndex().maxBy { it.value }!!
            val min = A.withIndex().minBy { it.value }!!
            when {
                Math.abs(max.value) >= Math.abs(min.value) -> {
                    println("${2*N-1}")
                    for (i in 1..N) {
                        println("${max.index + 1} $i")
                    }
                    for (i in 1..N - 1) {
                        println("$i ${i + 1}")
                    }
                }
                else -> {
                    println("${2*N-1}")
                    for (i in 1..N) {
                        println("${min.index + 1} $i")
                    }
                    for (i in N - 1 downTo 1) {
                        println("${i + 1} $i")
                    }
                }
            }
        }
    }
}


Measured memory_bytes: 37872
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <climits>
#include <cfloat>

using namespace std;
using ll = long long int;

const ll MOD = 1000000007;

template <typename T>
int cin_vec(vector<T> &vec) {
    for (auto &i : vec) {
        cin >> i;
    }
    return 0;
}

template <typename T>
int cout_vec(vector<T> vec, bool insertNewLine = true) {
    if (insertNewLine) {
        for (const auto &i : vec) {
            cout << i << endl;
        }
    } else {
        for (const auto &i : vec) {
            cout << i << flush;
        }
    }
    return 0;
}

template <typename T>
ll min_vec(std::vector<T> vec) {
    auto iter = min_element(vec.begin(), vec.end());
    ll index = distance(vec.begin(), iter);
    return index;
}

template <typename T>
ll max_vec(std::vector<T> vec) {
    auto iter = max_element(vec.begin(), vec.end());
    ll index = distance(vec.begin(), iter);
    return index;
}

int main() {
    string s;
    cin >> s;
    vector<int> len(1);
    for (int i = 0; i < s.size(); ++i) {
        if (s.at(i) == 'A' || s.at(i) == 'C' || s.at(i) == 'G' || s.at(i) == 'T') {
            ++len.at(len.size() - 1);
        } else {
            len.push_back(0);
        }
    }
    cout << len.at(max_vec(len)) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,K,Q;
  cin>>N>>K>>Q;
  vector<int>point(N);
  for(int i=0;i<N;i++){
    point.at(i)=K-Q;
  }
  vector<int>tr(Q);
  for(int i=0;i<Q;i++){
    cin>>tr.at(i);
    point.at(tr.at(i)-1)++;
  }
  for(int i=0;i<N;i++){
  if(point.at(i)>0)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  }
}

Measured memory_bytes: 1408
#include<stdio.h>
  
int main(){
  int N, M, K, A, check[30] = {0}, i, j, count = 0;
  
  scanf("%d %d", &N, &M);
  
  for (i = 0; i < N; i++){
    scanf("%d", &K);
    for (j = 0; j < K; j++){
      scanf("%d", &A);
      check[A - 1]++;
    }
  }
  
  for (i = 0; i < M; i++){
    if(check[i] == N){
      count++;
    }
  }
  
  printf("%d\n", count);
  
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <algorithm>
#include <vector>
#include <math.h>
#include <bitset>
#include <cmath>
#include <set>

#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 rep_r(i,s,n)for(int i = n-1;i>=s;i--)
#define rep_re(i,s,n)for(int i = n;i>=s;i--)
using namespace std;
typedef long long ll;
static const ll MOD = 1e9 + 7;
static const ll INF = 1e25;
static const ll MAX_N = 100001;

int main() {
	string s; cin >> s;
	ll ans = 0;
	ll i = 0;
	ll j = s.size() - 1;
	while (i < j) {
		if (s[i] == 'x' && s[j] != 'x') {
			ans++;
			s = s.substr(i + 1, s.size() - 1);
		}
		else if (s[i] != 'x' && s[j] == 'x') {
			ans++;
			s = s.substr(0, s.size() - 1);
		}
		else if (s[i] == 'x' && s[j] == 'x') {
			s = s.substr(i + 1, s.size() - 2);
		}
		else if (s[i] == s[j]) {
			s = s.substr(i + 1, s.size() - 2);
		}
		else {
			cout << -1 << endl;
			return 0;
		}
		i = 0;
		j = s.size() - 1;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <string.h>
int main()
{
    int l;
    char s[1001];
    scanf("%[^\n]",s);
    l = strlen(s);
    if(s[l-1]=='s'){
        printf("%ses\n",s);
    }
    else{
        printf("%ss\n",s);
    }
    return 0;
}


Measured memory_bytes: 1668
#include <iostream>
#include <vector>
#include <set>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
int n, m, q;
int a[51], b[51], c[51], d[51];
int v[11];
 
int main() {
    int N, K;
    cin >> N >> K;
    int* D = new int[N];
    rep(i, 0, K) {
        cin >> D[i];
    }
    
    while (true){
        int tmpN = N;
        bool isOK = true;
        while (tmpN) {
            int t = tmpN%10;
            rep(j, 0, K){
                if( D[j] == t){
                    isOK = false;
                }
            }
            tmpN /= 10;
        }
        if (isOK){
            cout << N << endl;
            return 0;
        }
        N++;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i = (int)j;i <= (int)k;i ++)
#define debug(x) cerr<<#x<<":"<<x<<endl
#define pb push_back

typedef long long ll;
typedef pair<int,int> pi;
const int MAXN = (int)1e6+7;

int N;
bool isc[20],isun[20];
vector<pi> sto[20];

bool OK(int stu) {
    memset(isc,0,sizeof(isc));
    memset(isun,0,sizeof(isun));
    rep(i,1,N) {
        if (((stu>>(i-1))&1) == 1) isc[i] = 1;
        else isun[i] = 1;
    }

    rep(i,1,N) {
        if (((stu>>(i-1))&1) == 1) {
            for(pi tmp:sto[i]) {
                if (tmp.second == 0) {
                    isun[tmp.first] = 1;
                }else {
                    isc[tmp.first] = 1;
                }
            }
        }
    }
    rep(i,1,N) if (isun[i]&&isc[i]) return false;
    return true;
}

int numof(int x) {
    int cnt = 0;
    while (x) {
        cnt += x%2;
        x >>=1;
    }
    return cnt;
}

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

    cin >> N;
    rep(i,1,N) {
        int num;
        cin >> num;
        rep(j,1,num) {
            int x,y;
            cin >> x >> y;
            sto[i].pb(make_pair(x,y));
        }
    }

    int ans = 0;
    rep(i,0,(1<<N)-1) {
        if (OK(i)) {
            ans = max(ans,numof(i));
        }
    }
    cout << ans << endl;
}




Measured memory_bytes: 256
#include<iostream>
using namespace std;
int a,b,c,x,y,z;
int main()
{
    cin>>a>>b>>c;
    int x=max(a,max(b,c)),y=min(a,min(b,c)),z=a+b+c-x-y;
    if(x-z==z-y) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 256
/*  -*- coding: utf-8 -*-
 *
 * a.cc: A: Grouping
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int mdays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  int x, y;
  cin >> x >> y;

  if (mdays[x - 1] == mdays[y - 1]) puts("Yes");
  else puts("No");

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define Rep(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) Rep(i,0,n)
#define stop char nyaa;cin>>nyaa;
using ll = long long;
const int inf = 1e9 + 7;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;

using P = pair<int, int>;

void solve() {
	string s; cin >> s;
	int len = s.size();
	int ans = 0;
	rep(i, len / 2) {
		if (s[i] != s[len - 1 - i])ans++;
	}
	cout << ans << endl;
}


signed main() {
	solve();
	stop
	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <functional>
#include <stdexcept>
#include <streambuf>
#include <exception>
#include <algorithm>
#include <iostream>
#include <iterator>
#include <typeinfo>
#include <utility>
#include <complex>
#include <numeric>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <sstream>
#include <cassert>
#include <iomanip>
#include <cstring>
#include <locale>
#include <memory>
#include <iosfwd>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <ios>
#include <new>
#include <set>
 
//#define int long long
#define ll long long 
#define F first
#define S second
#define make make_pair
#define pb push_back
#define sz(x) (ll)(x.size()) 
#define all(x) x.begin (), x.end ()

using namespace std;

typedef long double ld;

const int MOD = (int)1e9 + 7;
const int N = (int)1e5 * 5 + 22;
const ll INF = (ll)1e18;
const double eps = (double)1e-6;

double n;

int main () {
    #ifdef Maga
        freopen("input.txt", "r", stdin);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cin >> n;
    double x = ceil(n / 2);
    cout << setprecision(9) << fixed << x / n;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD @
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

i64 X, Y;

int main()
{
	scanf("%lld%lld", &X, &Y);
	i64 ret = 1LL << 60LL;
	for (int i = 0; i < 4; ++i) {
		i64 cnt = 0;
		i64 st = X, ed = Y;
		if (i & 1) {
			st *= -1;
			++cnt;
		}
		if (i & 2) {
			ed *= -1;
			++cnt;
		}
		if (st <= ed) {
			cnt += ed - st;
			ret = min(ret, cnt);
		}
	}
	printf("%lld\n", ret);
	return 0;
}


Measured memory_bytes: 256
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.InputStreamReader;
import java.io.InputStream;

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

    static class KnotPuzzle {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int N = in.nextInt();
            int L = in.nextInt();
            int A[] = new int[N];
            for (int i = 0; i < N; i++) {
                A[i] = in.nextInt();
            }
            int core = -1;
            for (int i = 1; i < N; i++) {
                if (A[i] + A[i - 1] >= L) {
                    core = i;
                }
            }

            if (core == -1) {
                out.println("Impossible");
            } else {
                out.println("Possible");
                for (int i = 1; i < core; i++) {
                    out.println(i);
                }
                for (int i = N - 1; i > core; i--) {
                    out.println(i);
                }
                out.println(core);
            }
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}


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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

int x[5010],a[5010];
int dp[5010][5010];

const int mod=1000000007;

int main(void){
	int n,l;
	cin >> n >> l;
	rep(i,n) cin >> x[i];
	rep(i,n) cin >> a[i];

	dp[n][l]=1;
	for(int i=n-1;i>=0;--i){
		ll sum=0;
		for(int j=l;j>=x[i];--j) sum=(sum+dp[i+1][j])%mod;
		for(int j=x[i];j<=l;++j){
			sum=(sum-dp[i+1][j]+mod)%mod;
			if(a[i]!=0){
				if((j-x[i])%a[i]==0) dp[i][j]=sum%mod;
			}else{
				if((j-x[i])==0) dp[i][j]=sum%mod;
			}
		}
	}
	ll ans=0;
	rep(i,l) ans=(ans+dp[0][i])%mod;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 97764
import java.util.Scanner;

public class Main {

	public static String Y = "Yes";
	public static String N = "No";
	public static long MOD = (long) (Math.pow(10, 9) + 7);
	public static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {

		out(48 - ni());

	}

	/*
	 * 以下メソッド集
	 */

	public static void permutation(String q, String ans) {
		// Base Case
		if (q.length() <= 1) {
			System.out.println(ans + q);
		}
		// General Case
		else {
			for (int i = 0; i < q.length(); i++) {
				permutation(q.substring(0, i) + q.substring(i + 1),
						ans + q.charAt(i));
			}
		}
	}

	static char[][] same(char[][] c, int h, int w) {

		char[][] a = new char[h][w];
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				a[i][j] = c[i][j];
			}
		}
		return a;

	}

	static int countkuro(char[][] c) {

		int count = 0;
		for (char[] cc : c) {
			for (char ccc : cc) {
				if ('#' == ccc) {
					count++;
				}
			}
		}
		return count;
	}

	static void debug() {

		out("---");
	}

	static void debug(Object a) {

		out("-------");
		out(a);
		out("-------");
	}

	static int ketasuu(int n) {

		String str = "" + n;
		return str.length();
	}

	static int account(String str) {

		String target = "AC";
		int count = 0;
		int len = str.length();
		for (int i = 0; i < len - 1; i++) {
			if (target.equals(str.substring(i, i + target.length()))) {
				count++;
			}
		}
		return count;
	}

	static int ni() {

		return sc.nextInt();
	}

	static long nl() {

		return sc.nextLong();
	}

	static double nd() {

		return sc.nextDouble();
	}

	static String n() {

		return sc.next();
	}

	static char[] nc() {

		return sc.next().toCharArray();
	}

	static int kaijo(int n) {

		if (n == 0 || n == 1) {
			return 1;
		} else {
			return n * kaijo(n - 1);
		}
	}

	static int fib(int n) {

		return (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);
	}

	static long lcm(long m, long n) {

		return m * n / gcd(m, n);
	}

	static int lcm(int m, int n) {

		return m * n / gcd(m, n);
	}

	static long gcd(long a, long b) {

		return (b == 0) ? a : gcd(b, a % b);
	}

	static int gcd(int a, int b) {

		return (b == 0) ? a : gcd(b, a % b);
	}

	static void out(Object obj) {
		System.out.println(obj);
	}

	static void outn(Object obj) {
		System.out.print(obj);
	}

	static double max(double d, double e) {

		return Math.max(d, e);
	}

	static long max(long a, long b) {

		return Math.max(a, b);
	}

	static long min(long d, long e) {

		return Math.min(d, e);
	}

	static int min(int a, int b) {

		return Math.min(a, b);
	}
}

class XY {

	int h;
	int w;
	int d;

	XY(int h, int w, int d) {
		this.h = h;
		this.w = w;
		this.d = d;
	}
}


Measured memory_bytes: 35696
#include<cstdio>

int N;
char S[101];

int main(){
	scanf("%d", &N);
	scanf("%s", S);

	int alone_right_parenthesis = 0, alone_left_parenthesis = 0;
	for(int i = 0; i < N; i++){
		if(S[i] == '(') alone_right_parenthesis++;
		if(S[i] == ')' && alone_right_parenthesis != 0) alone_right_parenthesis--;
		else if(S[i] == ')' && alone_right_parenthesis == 0) alone_left_parenthesis++;
	}

	for(int i = 1; i <= alone_left_parenthesis; i++) printf("%c", '(');
	printf("%s", S);
	for(int i = 1; i <= alone_right_parenthesis; i++) printf("%c", ')');
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<ll, ll>;
using vi = vector<ll>;
using vvi = vector<vi>;
using vb = vector<bool>;
using vs = vector<string>;
using vp = vector<pii>;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(x) (ll)((x).size())
#define all(x) (x).begin(), (x).end()
#define each(a, x) for (auto&& a : (x))
#define _overload3(_1,_2,_3,name,...) name
#define rep1(n) rep2(_, n)
#define rep2(i, n) rep3(i, 0, n)
#define rep3(i, a, n) for (ll i=(a); i<(n); ++i)
#define rep(...) _overload3(__VA_ARGS__,rep3,rep2,rep1)(__VA_ARGS__)
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
template<class T> inline void print(const T& x) {cout << x << "\n";}
template<class T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template<class T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
struct Init {Init() {cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(10);}} init;

int main() {
    ll n, m;
    cin >> n >> m;
    map<ll, ll, greater<ll>> d;
    rep(i, n) {ll a; cin >> a; ++d[a];}
    rep(i, m) {ll b, c; cin >> b >> c; d[c] += b;}
    ll ans = 0, cnt = 0;
    each(e, d) {
        ll f = min(e.se, max(n - cnt, 0LL));
        cnt += f;
        ans += e.fi * f;
    }
    print(ans);
}

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

int main(){
    
    while(1){
        double n,var = 0.0,ave = 0.0,sd,num[1000];
        cin >> n;
        if(n == 0) break;
        
        for(int i = 0; i < n; ++i){
            cin >> num[i];
            ave += num[i];
        }
        ave = ave / n;
        for(int i = 0; i < n; ++i){
            var += (num[i] - ave) * (num[i] - ave);
        }
        var = var / n;
        sd = sqrt(var);
        cout << sd << endl;    
    }
    
    return 0;
}

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

using namespace std;

void one()
{
	cout << 1;
	exit(0);
}

void zero()
{
	cout << 0;
	exit(0);
}

main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	int n;
	cin >> n;
	
	int l = 1;
	int r = n;
	
	int res = 0;
	
	while(l <= r)
	{
		int mid = (l + r) / 2;
		
		int p = (mid * 1.0 * 1.08);
		
		if(p < n)
		{
			l = mid + 1;
		}
		else
		{
			r = mid - 1;
			res = mid;
		}
	}
	
	int p = (res * 1.0 * 1.08);
	
	if(p == n)
		cout << res << '\n';
	else
		cout << ":(";
}

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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define rep(i, n, m) for (int (i) = (n); (i) < (m); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debugB(x, y) cerr<<#x<<": "<<bitset<y>(x) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const int INF = 1e8;

int N, W;
int value[110], weight[110];
int dp[110][10010];

void print(int cnt, bool ok) {
   printf("---------- (%d, %c) ----------\n", cnt, (ok?'T':'F'));
   rep (i, 0, N+1) {
      rep (j, 0, W+1) {
         printf("%3d", dp[i][j]);
      }
      puts("");
   }
}

int main() {
   cin >> N >> W;
   for (int i = 0; i < N; i++) {
      cin >> value[i] >> weight[i];
   }

   for (int i = 0; i < W+1; i++) {
      dp[0][i] = 0;
   }

   for (int qty = 1; qty <= N; qty++) { // qty個の品物を入れる
      for (int weightLim = 0; weightLim <= W; weightLim++) { // 重さの上限
         if (weight[qty-1] <= weightLim) { // qty個目の品物が重さ上限よりも軽い
            dp[qty][weightLim] = max(dp[qty-1][weightLim-weight[qty-1]] + value[qty-1], 
                                 dp[qty-1][weightLim]);
         } else {
            dp[qty][weightLim] = dp[qty-1][weightLim]; // 繰り下げ
         }
      }
   }

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

   return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> VI;
typedef vector<VI> VVI;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;

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

  int n;
  while(true){
    cin >> n;
    if(n==0) break;
    std::vector<int> v;
    for(int i=0;i<n;i++){
      int a;cin >> a;v.push_back(a);
    }
    sort(v.begin(),v.end());
    int res=INF;
    for(int i=0;i<n-1;i++) res=min(res,v[i+1]-v[i]);
    cout << res << endl;
  }
}

Measured memory_bytes: 3148
#include<cstdio>
using namespace std;
void func(int,int);
int h,w,cnt;
char a[100][101],c;
int main(void)
{
	int i,j;
	while(1)	{
		scanf("%d %d",&h,&w);
		if(h==0 && w==0)	break;
		for(i=0;i<h;i++)	scanf("%s",a[i]);
		cnt=0;
		for(i=0;i<h;i++)	{
			for(j=0;j<w;j++)	{
				if(a[i][j]=='@' || a[i][j]=='#' || a[i][j]=='*')	{
					c=a[i][j];
					a[i][j]='.';
					cnt++;
					func(i,j);
				}
			}
		}
		printf("%d\n",cnt);
	}
	return 0;
}
void func(int y,int x)
{
	int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
	int i,j,xx,yy;
	for(i=0;i<4;i++)	{
		xx=x+dx[i];	yy=y+dy[i];
		if(xx>=0 && xx<w && yy>=0 && yy<h && a[yy][xx]==c)	{
			a[yy][xx]='.';
			func(yy,xx);
		}
	}
}


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

int main(){
  int N, M;
  cin>> N >> M;
  
vector<int> a(M),b(M);
  for(int i=0; i<M; i++)
    cin >> a[i] >> b[i];
   
  vector<int> c(N);
 for(int j=0; j<N; j++){
   c[j]=0;
   
   for(int i=0; i<M; i++){
    if(a[i]==j+1||b[i]==j+1){
    c[j]++;
  }
   }
   
   cout << c[j] << endl;
   
 } 
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <set>
#include <map>
#include <deque>
#define WMAX 10000
#define HMAX 10000

//コメントアウトするとdebug()を実行しない
#define DEBUG

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

typedef pair<int ,int > P;
typedef long long ll;

int A,B,C,K,S,ans = 0,dp[HMAX][WMAX];
static const int dx[8] = {0,1,1,1,0,-1,-1,-1},
					dy[8] = {1,1,0,-1,-1,-1,0,1};

void solve(){
	for (int x = 0; x <= K; ++x)
	{
		for (int y = 0; y <= K; ++y)
		{
			if((S-x-y >= 0) && (S-x-y <= K)){
				ans++;
			}
		}
	}
}

void answer(){
	cout << ans << "\n";
}

int main(){
	cin >> K >> S;
	solve();
	answer();
	return 0;
}

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

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

using namespace std;


int inputValue() {
  int a;
  cin >> a;
  return a;
};
void inputVector(vector<int>* v) {
  //cin.tie(0);
  //ios::sync_with_stdio(false);
  int a;
  while (cin >> a) {
    if (a == -1)break;
    v->push_back(a);
  }
};

void inputVector(vector<int> * p, int a) {
  rep(i, a) {
    int input;
    cin >> input;
    p->push_back(input);
  }
}

void inputVector2(vector<vector<int>>& v, int r, int c) {
  int temp;
  for (size_t i = 0; i < r; i++)
  {
    for (size_t j = 0; j < c; j++)
    {
      scanf("%d", &temp);
      v[i][j] = temp;
    }
  }
}
void inputVector3(vector<int>* v0, vector<int>* v1) {
  int a;
  unsigned short count = 0b0;
  while (cin >> a) {
    if (a == -1)break;
    if (count)v0->push_back(a); else v1->push_back(a);
    count = count ^ 1;
  }
};

template <typename T>
void output(T a, int precision) {
  if (precision > 0) {
    cout << setprecision(precision) << a << "\n";
  }
  else {
    cout << a << "\n";
  }
}

string to_binString(unsigned int val, unsigned int& keta, unsigned int& ones)
{
  keta = 0;
  ones = 0;
  if (!val)
    return std::string("0");
  std::string str;
  while (val != 0) {
    keta++;
    if ((val & 1) == 0)  // val は偶数か？
      str.insert(str.begin(), '0');  //  偶数の場合
    else {
      str.insert(str.begin(), '1');  //  奇数の場合
      ones++;
    }
    val >>= 1;
  }
  return str;
}

void outputLines(const unsigned int& from, const unsigned int& to, const unsigned int& length){
  cout << from << " " << to << " " << length << endl;
}

void findOne(vector<map<string, unsigned int>>& one, unsigned int L, unsigned int& keta) {
  int imamade = (int)pow(2, keta - 1);
  int count = 0;
  for (int i = keta - 2; i >= 0; i--) {
    if ((L >> i) % 2) {
      one.emplace_back();
      one[count]["length"] = imamade;
      one[count]["to"] = keta - i;
      count++;
      imamade += (int)pow(2, i);
    }
  }
}


int main(int argc, const char * argv[]) {
  unsigned int L;
  unsigned int N;
  unsigned int M;
  unsigned int ones;
  vector<map<string, unsigned int>> one;
  scanf("%d", &L);
  unsigned int keta;
  string bits = to_binString(L, keta, ones);
  findOne(one, L, keta);

  N = keta;
  M = keta * 2 + ones - 3;
  if (L == 1) {
    N = 2;
    M = 1;
    cout << N << " " << M << endl;
    outputLines(1, 2, 0);
    return 0;
  }
  cout << N << " " << M << endl;
  for (size_t i = 1; i < keta; i++)
  {
    outputLines(i, i+1, 0);
    outputLines(i , i+1, (int)pow(2, keta-i-1));
  }
  for (auto& map1 : one) {
    outputLines(1, map1["to"], map1["length"]);
  }
}

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

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

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

    cout << a * b - (a + b - 1) << endl;

    return 0;
}


Measured memory_bytes: 256
# coding: utf-8
import math

def distance(X1, X2):
    square_sum = 0
    for x1, x2 in zip(X1, X2):
        square_sum = square_sum + (x1 - x2) ** 2
    return math.sqrt(square_sum)


N, D = list(map(int, input().split()))
X = [list(map(int, input().split())) for i in range(N)]

res = 0
for i in range(N-1):
    for j in range(i+1, N):
        res = res + (1 if distance(X[i], X[j]).is_integer() else 0)
        
print(res)


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


using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD (ll)1000000007
#define P pair<ll, ll>


struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

UnionFind uni(110000);
ll n, a[110000], b[110000], sa[110000], sb[110000], ans, a1;
vector<ll> xl[110000], yl[110000];
set<ll> xs[110000], ys[110000];
bool ok[110000];

int main() {
	cin >> n;
	REP(i, n) {
		cin >> sa[i] >> sb[i];
		a[sa[i]]++;
		b[sb[i]]++;
		xl[sa[i]].push_back(i);
		yl[sb[i]].push_back(i);
	}
	REP(i, 110000) {
		REP(j, (ll)xl[i].size() - 1) uni.unionSet(xl[i][j], xl[i][j + 1]);
		REP(j, (ll)yl[i].size() - 1) uni.unionSet(yl[i][j], yl[i][j + 1]);
	}
	REP(i, n) if (a[sa[i]] >= 2 and b[sb[i]] >= 2) ok[uni.root(i)] = true;
	REP(i, n) {
		if (ok[uni.root(i)]) {
			ans++;
			xs[uni.root(i)].insert(sa[i]);
			ys[uni.root(i)].insert(sb[i]);
		}
	}
	REP(i, n) if (ok[uni.root(i)] and uni.root(i) == i) a1 += xs[i].size() * ys[i].size();
	if (!ok) {
		cout << 0 << endl;
		return 0;
	}
	cout << a1 - ans << endl;
}	


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


int main() {
  int a,b; cin >> a >> b;
  int x = (a+b+1)/2;
  cout << x << endl;
}

Measured memory_bytes: 256
N = int(input())
p = list(map(lambda x: int(x) - 1, input().split()))
r = {}
for i in range(N):
    r[p[i]] = i + 1

A = [30000 * i for i in range(1, N + 1)]
B = [30000 * (N - i) + r[i - 1] for i in range(1, N + 1)]
print(*A)
print(*B)


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

int h,w; char maze[50][50]; int d[50][50];
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

int bfs(){
    queue<P> que;
    for (int i = 0; i < h; i++){
        for (int j = 0; j < w; j++) d[i][j]=-1;
    }
    que.push(P(0,0)); d[0][0]=0;

    while(que.size()){
        P p=que.front(); que.pop(); int py=p.first,px=p.second;
        if(py==h-1&&px==w-1)break;
        for (int i = 0; i < 4; i++){
            int ny=py+dy[i],nx=px+dx[i];
            if(ny>=0&&ny<h&&nx>=0&&nx<w&&maze[ny][nx]!='#'&&d[ny][nx]==-1){
                que.push(P(ny,nx)); d[ny][nx]=d[py][px]+1;
            }
        }
    }
    return d[h-1][w-1];
}

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
   
    cin>>h>>w; int bla=0;
    for (int i = 0; i < h; i++){
        for (int j = 0; j < w; j++){
            cin>>maze[i][j];
            if(maze[i][j]=='#')bla++;
        }
    }
    int ans=bfs();
    cout<<((ans!=-1)?h*w-ans-1-bla:-1)<<'\n';
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int dx[] = {0, 0, 1, -1};
constexpr int dy[] = {1, -1, 0, 0};

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

    int N, C, D[31][31], c[510][510];
    ll arr[31][3];

    cin >> N >> C;
    REP(i, C)
    REP(j, C)
    cin >> D[i + 1][j + 1];
    REP(i, N)
    REP(j, N)
    cin >> c[i + 1][j + 1];

    for (int k = 1; k <= C; k++)
    {
        ll sum[3] = {0};

        for (int i = 1; i <= N; i++)
            for (int j = 1; j <= N; j++)
            {
                sum[(i + j) % 3] += D[c[i][j]][k];
            }

        REP(i, 3)
        arr[k][i] = sum[i];
    }

    ll res = LLONG_MAX;

    for (int i = 1; i <= C; i++)
    {
        for (int j = 1; j <= C; j++)
        {
            if (i == j)
                continue;
            for (int k = 1; k <= C; k++)
            {
                if (i == k || j == k)
                    continue;

                ll sum = 0;
                sum += arr[i][0];
                sum += arr[j][1];
                sum += arr[k][2];

                res = min(res, sum);
            }
        }
    }

    cout << res << endl;

    return 0;
}

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

#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i,n) for(int i = 0; i < n; i++)
#define for1(i,n) for(int i = 1; i <= n; i++)
#define ford(i,n) for(int i = n-1; i >= 0; i--)
#define fore(i,a,b) for(int i = a; i <= b; i++)

using namespace std;

typedef long long ll;
typedef double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;


const  int MAXn= 3e5+5;
const  long long INF= 1e18;
const long long mod= 1e9+7;

vector<int> adj[MAXn];
int value[MAXn];

void dfs(int v, int p){
	 for(int &t: adj[v]){
		 if(t==p) continue;
			value[t]+=value[v];
			dfs(t,v);
	}
}


int main(){
	int n;
	cin>>n;
	int q; cin>>q;
	int x;
	x=n-1;
	while(x--){
		int a,b;
		cin>>a>>b;
		adj[a].push_back(b);
		adj[b].push_back(a);
        
    }

	while(q--){
		int a,b;
		cin>>a>>b;
		value[a] += b;
	}
	dfs(1,-1);
	
	for(int i=1;i<=n;i++) cout<<value[i]<<" ";
	
}
















Measured memory_bytes: 25856
N = int(input())
csf = [list(map(int, input().split())) for _ in range(N-1)]

for i in range(N-1):
    t = csf[i][1]
    t += csf[i][0]
    for j in range(i+1, N-1):
        st = csf[j][1]
        f = csf[j][2]
        t = max(st, ((t-1)//f+1)*f)
        t += csf[j][0]

    print(t)
print(0)




Measured memory_bytes: 74088
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[]]*num
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

N,Z,W = II()
a = III()

if N==1:
    print(abs(a[0]-W))
else:
    x = abs(a[N-2]-a[N-1])
    y = abs(a[N-1]-W)
    print(max(x,y))

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

template <typename T>
T BinarySearch(T ok, T ng, std::function<bool(T)> pred) {
  while (abs(ok - ng) > 1) {
    T mid = (ok + ng) / 2;
    (pred(mid) ? ok : ng) = mid;
  }
  return ok;
}

#if DEBUG
template <typename T>
void debug(const T& value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(const T& value, const Ts&... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                        \
  do {                                  \
    cerr << #__VA_ARGS__ << ": ";       \
    debug(__VA_ARGS__);                 \
    cerr << " (L" << __LINE__ << ")\n"; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define rd(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << '\n';
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define wt(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

template <typename T>
using V = std::vector<T>;
template <typename T>
using VV = V<V<T>>;

using namespace std;

int main() {
#define int ll
  // {a, b} -> a * b
  // 12
  // 1 2 *3 4 5 6 7
  // 1 2 3 4 *5 6 7
  // 1 2 4 5 6 7
  // 7 6 4 3 2 1
  // 7 12 16 15 12 7
  // 1 *2
  // *1 2
  // (1 1) (1 2) (1 3)
  rd(int, q);
  while (q--) {
    rd(int, a, b);
    if (a * b <= 2) {
      wt(0);
      continue;
    }
    // (x / 2) ^ 2 < 10^18
    // x / 2 < 10^9
    wt(BinarySearch<int>(1, 10000000000LL, [&](int x) {
      if (x & 1) {
        // 3 -> 2
        int m1 = (x + 1) / 2;
        if (a <= m1) ++m1;
        int m2 = (x + 1) / 2;
        if (b <= m2) ++m2;
        return m1 * m2 < a * b;
      }
      // 4 -> 2, 3
      int l1 = x / 2, r1 = x / 2 + 1;
      if (a <= l1)
        ++l1, ++r1;
      else if (a <= r1)
        ++r1;
      int l2 = x / 2, r2 = x / 2 + 1;
      if (b <= l2)
        ++l2, ++r2;
      else if (b <= r2)
        ++r2;
      return max(l1 * r2, r1 * l2) < a * b;
    }));
  }
#undef int
}


Measured memory_bytes: 3628
while 1:
    val = input().split()
    h = int(val[0])
    w = int(val[1])
    if h == 0 and w == 0:
        break
    for cnt in range(h):
        if cnt % 2 == 1:
            for i in range(w):
                if i % 2 == 1:
                    print('#', end='')
                else:
                    print('.', end='')
        else:
            for i in range(w):
                if i % 2 == 1:
                    print('.', end='')
                else:
                    print('#', end='')
        print()

    print()


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


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

     ll *graph=new ll[n];
     for(int i=0;i<n;i++)
     {
          cin>>graph[i];
     }
     bool *visited=new bool[n+1];
     for(int i=1;i<=n;i++)
          visited[i]=false;
     ll node=1;
     ll count=0;
     while(!visited[node])
     {
          visited[node]=true;
          node=graph[node-1];
          count++;
     }
     node=graph[node-1];
     // cout<<"Cycle Found at "<<node<<endl;
     count++;
     vector<int>cycle;
     for(int i=1;i<=n;i++)
          visited[i]=false;
     while(!visited[node])
     {
          cycle.push_back(node);
          visited[node]=true;

          node=graph[node-1];
     }
     ll ans;
     // cout<<"Count "<<count<<endl;
     if(m>count)
     {
          m=m-count;
          ll steps=m%cycle.size();
          ans=cycle[steps];
          // cout<<"Cycle size "<<cycle.size()<<endl;
          cout<<ans<<endl;
     }
     else
     {
          node=1;
          for(int i=0;i<m;i++)
          {
               node=graph[node-1];
          }
          cout<<node<<endl;
     }
}


Measured memory_bytes: 5972
#include <iostream>
using namespace std;
int main()
{
    int N, R;
    cin >> N >> R;
    if (N >= 10)
    {
        cout << R << endl;
        return 0;
    }
    else
    {
        cout << R + 100 * (10 - N) << endl;
        return 0;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

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

    if(N == 1 && M == 1)
    {
        cout << 1 << endl;
    }
    else if(N == 1 && M != 1)
    {
        cout << M - 2 << endl;
    }
    else if(N != 1 && M == 1)
    {
        cout << N - 2 << endl;
    }
    else
    {
        cout << (N - 2) * (M - 2) << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

  if (a < b) {
    cout << "a < b" << endl;
  } else if (a > b) {
    cout << "a > b" << endl;
  } else {
    cout << "a == b" << endl;
  }
}


Measured memory_bytes: 3092
def binarize(txt):
    xs = txt.split(' ')
    xs = [int(x) for x in xs]
    b = 0
    for i in range(10):
        b += xs[i] * (2 ** i)
    return b


def count1(b):
    b = b[2:]
    count = 0
    for i in range(len(b)):
        if b[i] == '1':
            count += 1
    return count


N = input()
N = int(N)

F = [0 for i in range(N)]

for i in range(N):
    txt = input()
    F[i] = binarize(txt)


P = [[] for i in range(N)]

for i in range(N):
    xs = input().split(' ')
    P[i] = [int(x) for x in xs]


m = - 10 ** 11

for i in range(1, 2**10):

    score = 0

    for j in range(N):
        b = bin(i & F[j])
        count = count1(b)
        score += P[j][count]

    if score > m:
        m = score

print(m)


Measured memory_bytes: 3064
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define dump(o) { cerr << #o << " " << o << endl; }
#define dumpc(o) { cerr << #o; for (auto &e : (o)) cerr << " " << e; cerr << endl; }
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL

int main() {
	int N; cin >> N;
	vector<int> L(N * 2);
	for (int i = 0; i < N * 2; i++)cin >> L[i];
	sort(L.begin(), L.end());
	int ans = 0;
	for (int i = 0; i < N * 2; i += 2)ans += L[i];
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
struct M{
    string s;
    string::iterator it;
 
    void init(const string &str){
	s = str;
	it = s.begin();
    }
 
    int fact(){
	int res = 0;
	while(isdigit(*it)){
	    res *= 10;
	    res += *it-'0';
	    ++it;
	}
	return res;
    }  
 
    int exp(){
	int res = term();
	while(*it == '+'){
	    ++it;
	    res += term();
 
	}
	return res;
    }
 
    int term(){
	int res = fact();
	while(*it == '*'){
	    ++it;
	    res *= fact();
	}
	return res;
    }
};
 
struct L{
    string s;
    string::iterator it;
 
    void init(const string &str){
	s = str;
	it = s.begin();
    }
 
    int fact(){
	int res = 0;
	while(isdigit(*it)){
	    res *= 10;
	    res += *it-'0';
	    ++it;
	}
	return res;
    }  
 
    int calc(){
	int res = fact();
	while(*it == '+' || *it == '*'){
	    if(*it == '+'){
		++it;
		res += exp();
	    }else{
		++it;
		res *= term();
	    }
	}
	return res;
    }
 
    int exp(){
	int res = fact();
	while(*it == '+'){
	    ++it;
	    res += fact();
	}
	return res;
    }
 
    int term(){
	int res = fact();
	while(*it == '*'){
	    ++it;
	    res *= fact();
	}
	return res;
    }
};
 
int main(){
    int ans;
    string s;
    cin >> s >> ans; 
    M m; m.init(s); 
    L l; l.init(s);
    int Mres = m.exp(), Lres = l.calc();
 
    if(Mres == ans && Lres != ans){
	cout << 'M' << endl;
    }else if(Mres != ans && Lres == ans){
	cout << 'L' << endl;
    }else if(Mres == ans && Lres == ans){
	cout << 'U' << endl;
    }else{
	cout << 'I' << endl;
    }
    return 0;
}

Measured memory_bytes: 3160
#include <iostream>
#include <map>
#include <queue>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;
#pragma warning (disable: 4996)

int main() {
	long long X, Y;
	cin >> X >> Y;
	if (X % Y == 0) cout << "-1" << endl;
	else cout << X << endl;
	return 0;
}

Measured memory_bytes: 3644
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 6)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"
AL = al.upper()

a,b,c =I()
ans = min(a+b,b+c)
print(min(ans,a+c))


Measured memory_bytes: 10504
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int a = scn.nextInt();
		int b = scn.nextInt();
      	int k = scn.nextInt();
      	if(k%2==1){
          for(int i=1; i<=(k-1)/2; ++i){
            if(a%2==1){
              a = a - 1;
            }
            a = a/2;
            b = b + a;
            if(b%2==1){
              b = b - 1;
            }
            b = b/2;
            a = a + b;
          }
          if(a%2==1){
              a = a - 1;
            }
            a = a/2;
            b = b + a;
        }else{
          for(int i=1; i<=k/2; ++i){
            if(a%2==1){
              a = a - 1;
            }
            a = a/2;
            b = b + a;
            if(b%2==1){
              b = b - 1;
          	}
            b = b/2;
            a = a + b;
         }
        }
      System.out.print(a);
      System.out.print(" ");
      System.out.print(b);
	}
}


Measured memory_bytes: 35720