akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed << setprecision(15);

  int s;
  cin >> s;

  // unordered_map<int, int> ai;

  // int i;
  // for (i = 1; !ai.count(s); ++i) {
  //   ai[s];
  //   if (s % 2) {
  //     s = s * 3 + 1;
  //   } else {
  //     s /= 2;
  //   }
  // }

  int i;
  for (i = 4; s != 1 && s != 2 && s != 4; ++i) {
    if (s % 2) {
      s = s * 3 + 1;
    } else {
      s /= 2;
    }
  }

  cout << i << '\n';

  return 0;
}


Measured memory_bytes: 256
// dfmt off
T lread(T=long)(){return readln.chomp.to!T;}T[] lreads(T=long)(long n){return iota(n).map!((_)=>lread!T).array;}
T[] aryread(T=long)(){return readln.split.to!(T[]);}void arywrite(T)(T a){a.map!text.join(' ').writeln;}
void scan(L...)(ref L A){auto l=readln.split;foreach(i,T;L){A[i]=l[i].to!T;}}alias sread=()=>readln.chomp();
void dprint(L...)(lazy L A){debug{auto l=new string[](L.length);static foreach(i,a;A)l[i]=a.text;arywrite(l);}}
alias PQueue(T,alias l="b<a")=BinaryHeap!(Array!T,l);import std, core.bitop;
// dfmt on
immutable string YES = "Yes";
immutable string NO = "No";
void main()
{
    auto input = stdin.byLine.map!split.joiner;

    long N;
    N = input.front.to!long;
    input.popFront;

    long[] A = new long[](cast(size_t)(N));
    foreach (i; 0 .. cast(size_t)(N))
    {
        A[i] = input.front.to!long;
        input.popFront;
    }

    long[] B = new long[](cast(size_t)(N));
    foreach (i; 0 .. cast(size_t)(N))
    {
        B[i] = input.front.to!long;
        input.popFront;
    }

    solve(N, A, B);
}

void solve(long N, long[] A, long[] B)
{
    auto cntA = new long[](N + 1);
    auto cntB = new long[](N + 1);

    foreach (a; A)
        cntA[a]++;
    foreach (b; B)
        cntB[b]++;
    foreach (i; 0 .. N + 1)
        if (N < cntA[i] + cntB[i])
        {
            writeln("No");
            return;
        }
    auto sumA = new long[](N + 2);
    auto sumB = new long[](N + 2);
    sumA[0 .. $ - 1] = cntA[];
    sumB[0 .. $ - 1] = cntB[];
    foreach (i; 0 .. N + 1)
    {
        sumA[i + 1] += sumA[i];
        sumB[i + 1] += sumB[i];
    }
    long diff;
    foreach (i; 1 .. N + 1)
    {
        diff = diff.max(sumA[i] - sumB[i - 1]);
    }
    dprint(diff);
    auto ans = B[$ - diff .. $] ~ B[0 .. $ - diff];
    writeln("Yes");
    arywrite(ans);
}


Measured memory_bytes: 32292
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
#include <random>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <functional>
#include <random>
#include <time.h>
#include <chrono>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <iostream>
#include <limits>
#include <numeric>
#include <type_traits>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define MOD 1000000007
#define SORT(s) sort(s.begin(), s.end());
#define REVERSE(s) reverse(s.begin(), s.end());
#define SUM(s) accumulate(s.begin(), s.end(), 0LL);
#define P pair<int,int>
#define mp make_pair
#define valid(x,y,h,w) (0<=x&&x<h&&0<=y&&y<w)
//#define int ll
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int ndx[8] = { 0,1,0,-1, 1,1,-1,-1 };
int ndy[8] = { 1,0,-1,0, 1,-1,-1,1 };
using namespace std;
int POW(int x, int y) { return int(pow(double(x), double(y))); }
double log(double a, double b) { return log(b) / log(a); }


int main() {
	int n, m, x;
	cin >> n >> m >> x;
	vector<int> c(n);
	vector<vector<int>> a(n);
	rep(i, n) {
		cin >> c[i];
		a[i].resize(m);
		rep(j, m) {
			cin >> a[i][j];
		}
	}

	int ans = INF;
	rep(nnn, POW(2, n)) {
		int nn = nnn;
		vector<int> ri(m);
		int p = 0;
		rep(i, n) {
			int bo = nn % 2;
			nn /= 2;

			if (bo == 1) {
				rep(j, m) {
					ri[j] += a[i][j];
				}
				p += c[i];
			}
		}

		int flg = 1;
		rep(j, m) {
			if (ri[j] < x) {
				flg = 0;
			}
		}
		if (flg == 1) {
			ans = min(ans, p);
		}
	}
	if (ans >= INF) ans = -1;
	cout << ans << endl;
}




Measured memory_bytes: 4004
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(v) v.begin(),v.end()

using namespace std;
typedef long long ll;



int main(){
    
    int N;
    cin >> N;
    
    vector<int> dp(N+1, 1000000000);
    dp[0] = 0;
    for (int i = 0; i < N; i++) {
        dp[i+1] = min(dp[i]+1, dp[i+1]);
        for (int j = 9; i + j <= N; j = j*9) {
            dp[i+j] = min(dp[i]+1, dp[i+j]);
        }
        for (int j = 6; i + j <= N; j = j*6) {
            dp[i+j] = min(dp[i]+1, dp[i+j]);
        }
    }
    
    cout << dp[N] << endl;
    
    
    return 0;
}





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

int main()
{
	int a,b;
	cin>>a>>b;
	
	char mp1[a][a],mp2[b][b];

	for(int i=0;i<a;i++)
		for(int j=0;j<a;j++)
			cin>>mp1[i][j];
	for(int i=0;i<b;i++)
		for(int j=0;j<b;j++)
			cin>>mp2[i][j];

	for(int i=0;i<=a-b;i++)
		for(int j=0;j<=a-b;j++)
		{
			bool f=1;

			for(int k=0;k<b;k++)
			{
				for(int l=0;l<b;l++)
					if(mp1[k+i][l+j]!=mp2[k][l]) {f=0;break;}
				if(f==0) break;
			}

			if(f==1) {cout<<"Yes";return 0;}
		}

	cout<<"No";
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ull unsigned long long 
#define int long long 
#define pb push_back 
#define mp make_pair
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define MAX 1e18
#define PI 3.14159265
const int mod = 1e9 + 7;

int power(int x, int y) 
{ 
   int res = 1;      
  
   
    while (y > 0) 
    { 
       
        if (y & 1) 
            res = (long long)(res*x); 
  
 
        y = y>>1; 
 
        if (x<=100000000)
        x = (long long)(x*x);
 
        //cout<<x<<'\n'; 
    } 
    return res; 
} 


bool check(int mid,int x){
    if(mid*x%360==0)
        return true;
   else
    return false;
}


void solve()
{
    int x;
    cin>>x;

 int k=1;
 while(k*x%360!=0){
    k++;
 }
 cout<<k<<endl;
 return;
}


int32_t main()
{
    solve();
    return 0;
}

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

public class Main {
	static int[] a;
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		int n = sc.nextInt();
		int m = sc.nextInt();
		
		out.println( (n - 1) * (m - 1));
		
		out.close();
	}


static class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}
}



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

int main(){
    string o, e;
    cin >> o >> e;
    for(int i = 0; i < o.size() + e.size(); i++){
        if(i%2 == 0) cout << o[i/2];
        else cout << e[i/2];
    }
    cout << endl;
}

Measured memory_bytes: 3568
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector< vector<int> > VVI;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()

int main(){
  int N;
  cin>>N;
  vector<ll> A(N);
  rep(i,N) cin>>A[i];
  ll mod=1000000007;
  ll ans=0;
  ll X=1;
  rep(i,65){
    ll cnt=0;
    rep(j,N){
      cnt+=A[j]%2;
      A[j]/=2;
    }
    ll ans2=(cnt*(N-cnt))%mod;
    ans2=(ans2*X)%mod;
    ans=(ans+ans2)%mod;
    X=X*2%mod;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 2560
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<iomanip>
#include<cstring>
#define initdp(a,b) for(int i=0;i<=a;i++)for(int j=0;j<=b;j++)dp[i][j]=-1;
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ppi pair<pii,int>
#define pip pair<int,pii>
#define ll long long
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++)
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define inf 1000000001
#define inf1 1000000000000000001
#define mod 1000000007
#define pie 3.14159265358979323846
#define N 1000005
#define mid(l,r) l+(r-l)/2
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
void mad(ll &a,ll b){a=(a+b)%mod;if(a<0)a+=mod;}
ll gcd(ll a,ll b){ if(!a)return b;return gcd(b%a,a);}
int mk[100005];
void solve(){
	int n,m;
	cin>>n>>m;
	int i=1;
	while(m--){
		int j=n-i+1;
		if(n%2==0&&i>n/4)j--;
		cout<<i<<" "<<j<<"\n";
		i++;
	}
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
}

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

const int MAX = 32770;//1<<15
const int SQRT = 182;

int dp[MAX][5][SQRT];

int main(){

    dp[0][0][1] = 1;
    for(int i = 0; i < MAX; i++){
        for(int j = 0; j < 5; j++){
            for(int k = 1; k < SQRT; k++) if(dp[i][j][k] > 0){
                for(int l = k; l < SQRT; l++){ // l*lを加算
                    if(i+l*l >= MAX || j + 1 >= 5)break;
                    dp[i+l*l][j+1][l] += dp[i][j][k];
                }
            }
        }
    }

    int n;
    while(cin >> n, n){
        int ans = 0;
        for(int i = 1; i < 5; i++){
            for(int j = 1; j < SQRT; j++) ans += dp[n][i][j];
        }
        cout << ans << endl;
    }
}



Measured memory_bytes: 119576
/*************************************************************************
	> File Name: 1.cpp
	> Author: Knowledge_llz
	> Mail: 925538513@qq.com 
	> Blog: https://blog.csdn.net/Pig_cfbsl 
	> Created Time: 2020/5/10 20:00:32
 ************************************************************************/

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
#define For(i,a,b) for(register int i=(a);i<=(b);++i)
#define LL long long
using namespace std;
int read(){
	char x=getchar(); int u=0,fg=0;
	while(!isdigit(x)){ if(x=='-') fg=1; x=getchar(); }
	while(isdigit(x)){ u=(u<<3)+(u<<1)+(x^48); x=getchar(); }
	return fg?-u:u;
}
char s[10000],t[10000];
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.in", "r", stdin);
	freopen("output.out", "w", stdout);
#endif
	scanf("%s%s",s,t);
	int n=strlen(s);
	bool flag=1;
	For(i,0,n-1)
		if(s[i]!=t[i]){
			flag=0;
			break;
		}
	if(flag) printf("Yes\n");
	else printf("No\n"); 
	return 0;
}


Measured memory_bytes: 3692
/*
* Note: This template uses some c++11 functions , so you have to compile it with c++11 flag.
*       Example:-   $ g++ -std=c++11 c++Template.cpp
*
* Author : Akshay Pratap Singh
* Handle: code_crack_01
*
*/
 
/********   All Required Header Files ********/
#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;

/*******  All Required define Pre-Processors and typedef Constants *******/
#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) scanf("%f",&t)
#define SCLF(t) scanf("%lf",&t)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define FOR(i, j, k, in) for(int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for(int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
typedef long long int ll;
typedef unsigned long long int  ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<ll> vll;
typedef vector<vi> vvi;

int main(){

    int y = 700;
    string s; cin >> s;
    REP(i, 3){
        if( s[i] == 'o' ) y += 100;
    }

    cout << y << endl;


    return 0;
}


Measured memory_bytes: 256
N, M, k = gets.split.map &:to_i
A = gets.split.map &:to_i
B = gets.split.map &:to_i
ans = 0
current = 0
idx_a = 0
idx_b = 0

while A[idx_a] && k >= A[idx_a]
    k -= A[idx_a]
    current += 1
    idx_a += 1
end
ans = current

while B[idx_b]
    k -= B[idx_b]
    current += 1
    while k < 0 && idx_a >= 1
        idx_a -= 1
        k += A[idx_a]
        current -= 1
    end
    break if k < 0
    ans = current if current > ans
    idx_b += 1
end

p ans

Measured memory_bytes: 41604
#pragma GCC optimize(2)
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

const ll mod = 1e9 + 7;
const int N = 1e5 + 10, M = 1e2 + 30;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const double eps = 1e-8;

#define pi aaos(-1)
#define mk make_pair

int main()
{
    int n, m;
    cin >> n >> m;
    int ans = 0;
    if (n >= 2)
    {
        ans += (n - 1) * n / 2;
    }
    if (m >= 2)
    {
        ans += (m - 1) * m / 2;
    }
    cout << ans << endl;
    return 0;
}

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

const int nmax = 8;
bool graph[nmax][nmax];

int dfs(int v, int N, vector<bool>& visited){

    bool all_visited = true;

    for(int i = 0; i < N; i++){
        if(visited[i] == false) all_visited = false;
    }

    if(all_visited) return 1;

    int ret = 0;

    for(int i = 0; i < N; i++){
        if(graph[v][i] == false) continue;
        if(visited[i]) continue;

        visited[i] = true;
        ret += dfs(i, N, visited);
        visited[i] = false;
    }

    return ret;
}

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

    for(int i = 0; i < M; i++){
        int A, B; cin >> A >> B;
        graph[A-1][B-1] = graph[B-1][A-1] = true;
    }

    vector<bool> visited(nmax);
    for(int i = 0; i < N; i++){
        visited[i] = false;
    }

    visited[0] = true;
    cout << dfs(0, N, visited) << endl;
    return 0;
}




Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <string.h>

double max(double x, double y){
	if(x > y)
		return x;
	else
		return y;
}
double min(double x, double y){
	if(x < y)
		return x;
	else
		return y;
}

struct sphere{
	double x;
	double y;
	double z;
	double r;
};

double dist(double x,double y,double z){
	return sqrt(x * x + y * y + z * z);
}

int main(void){
	int n, i, j, f[100], v;
	struct sphere s[100];
	double mincost[100], ans;
	while(1){
		scanf("%d",&n);
		if(!n) break;
		for(i = 0;i < n;i++)
			scanf("%lf%lf%lf%lf",&s[i].x,&s[i].y,&s[i].z,&s[i].r);
		for(i = 0;i < n;i++)
			mincost[i] = 0x3FFFFFFF;
		mincost[0] = 0;
		ans = 0;
		memset(f,0,sizeof(f));
		while(1){
			v = -1;
			for(i = 0;i < n;i++)
				if(!f[i] && (v == -1 || mincost[i] < mincost[v])) v = i;
			if(v == -1) break;
			ans += mincost[v];
			f[v] = 1;
			for(i = 0;i < n;i++)
				mincost[i] = min(mincost[i],(max(dist(s[v].x - s[i].x,s[v].y - s[i].y,s[v].z - s[i].z) - (s[v].r + s[i].r),0)));
		}
		printf("%.3f\n",ans);
	}
	return 0;
}

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

int main()
{
  int sum=0,N;
  
  cin >> N;
  vector<int> oishisa(N);
  for(int i=0;i<N;i++){
    cin >> oishisa.at(i);
  }
  
  for(int i=0;i<N-1;i++){
    for(int j=i+1;j<N;j++){
      sum += oishisa.at(i)*oishisa.at(j);
    }
  }
  
  cout << sum << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T> void assign(V<T>& v, int n, const T& a = T()) { v.assign(n, a); }
template<class T, class... U> void assign(V<T>& v, int n, const U&... u) { v.resize(n); for (auto&& i : v) assign(i, u...); }

const double eps = 1e-10;
const double inf = 1e+10;
const double pi = acos(-1.0);
int sgn(double a) { return a < -eps ? -1 : a > eps; }
using P = complex<double>;
namespace std {
  istream& operator>>(istream& i, P& p) { double x, y; i >> x >> y; p = P(x, y); return i; }
  ostream& operator<<(ostream& o, const P& p) { o << real(p) << ' ' << imag(p); return o; }
  bool operator<(const P& p, const P& q) { return sgn(real(p) - real(q)) ? sgn(real(p) - real(q)) < 0 : sgn(imag(p) - imag(q)) < 0; }
  bool operator>(const P& p, const P& q) { return q < p; }
  bool operator<=(const P& p, const P& q) { return !(p > q); }
  bool operator>=(const P& p, const P& q) { return !(p < q); }
}
bool eq(const P& p, const P& q) { return !(p < q) and !(p > q); }
double dot(const P& p, const P& q) { return real(conj(p) * q); }
double cross(const P& p, const P& q) { return imag(conj(p) * q); }

int ccw(P p0, P p1, P p2) {
  p1 -= p0, p2 -= p0;                         //             (1)
  if (sgn(cross(p1, p2)) > 0) return 1;       //
  if (sgn(cross(p1, p2)) < 0) return -1;      // (-2)---p0---(0)---p1---(2)
  if (sgn(dot(p1, p2) < 0)) return -2;        //
  if (sgn(norm(p1) - norm(p2)) < 0) return 2; //             (-1)
  return 0;
}

bool intLP(const P& p1, const P& p2, const P& p) {
  return !(ccw(p1, p2, p) & 1);
}

const lint mod = 998244353;
inline lint emod(lint a, lint p = mod) { return (a % p + p) % p; }
inline lint powm(lint a, lint n, lint p = mod) { return !n ? 1 : powm(a * a % p, n >> 1, p) * (n & 1 ? a : 1) % p; }
inline lint invm(lint a, lint p = mod) { a %= p; return a == 1 ? 1 : -p / a * invm(p % a) % p; }

V<lint> fact, ifact;
void init_table(int n) {
  fact.assign(n + 1, 1), ifact.assign(n + 1, 1);
  for (int i = 2; i < n + 1; i++) fact[i] = i * fact[i - 1] % mod;
  ifact[n] = invm(fact[n]);
  for (int i = n; i > 2; i--) ifact[i - 1] = i * ifact[i] % mod;
}

lint comb(lint n, lint r) {
  if (n < 0 or r < 0 or r > n) return 0;
  return fact[n] * ifact[r] % mod * ifact[n - r] % mod;
}

int main() {
  cin.tie(NULL); ios::sync_with_stdio(false);
  int n; cin >> n;
  V<P> a(n); for (int i = 0; i < n; i++) cin >> a[i];
  VV<> ls;
  for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) {
    int c = 0;
    for (int k = 0; k < n; k++) c += intLP(a[i], a[j], a[k]);
    if (c >= 3) {
      V<> l;
      for (int k = 0; k < n; k++) if (intLP(a[i], a[j], a[k])) l.push_back(k);
      ls.push_back(l);
    }
  }
  sort(ls.begin(), ls.end()); ls.erase(unique(ls.begin(), ls.end()), ls.end());

  init_table(n);
  lint res = powm(2, n) - (1 + n + comb(n, 2));
  for (auto&& l : ls) {
    int m = l.size();
    for (int i = 3; i < m + 1; i++) (res -= comb(m, i)) %= mod;
  }
  cout << emod(res) << '\n';
}

Measured memory_bytes: 16568
n=int(input())
v=list(map(int,input().split()))
a=sorted(v[::2])
b=sorted(v[1::2])
import itertools,heapq
ha=[]
hb=[]
ga = itertools.groupby(a)
gb = itertools.groupby(b)
for key,group in ga:
  heapq.heappush(ha, [-len(list(group)),key])
for key,group in gb:
  heapq.heappush(hb, [-len(list(group)),key])
A=heapq.heappop(ha)
B=heapq.heappop(hb)
if A[1]==B[1]:
  A2=heapq.heappop(ha) if len(ha)>0 else [0,0]
  B2=heapq.heappop(hb) if len(hb)>0 else [0,0]
  print(n+min(A[0]+B2[0],A2[0]+B[0]))
else:
  print(n+A[0]+B[0])

Measured memory_bytes: 19072
#include <iostream>
#include<vector>
#include <math.h>
#include<stdio.h>
#include <climits>
#include<algorithm>
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int i, ans = 0, n,x;

	vector<int> a;

	cin >> n;

	while (cin >> x) {
		a.push_back(x);
	}
	for (i = 0; i < n; i++) {
		while (a[i] % 2 == 0) {
			a[i] = a[i] / 2;
			ans++;
		}
	}

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


Measured memory_bytes: 384
/// @file

#include <iostream>

namespace {

bool run(std::istream& is, std::ostream& os);
}  // unnamed namespace

/// @brief エントリポイント
#ifdef _TEST
static int run()
#else
int main()
#endif
{
  try {
    if (run(std::cin, std::cout) == false) {
      std::cerr << "main funciton error.\n";
      return EXIT_FAILURE;
    }
  } catch (const std::exception& e) {
    std::cerr << "catch exception\n";
    std::cerr << e.what() << "\n";
    return EXIT_FAILURE;
  }

  return EXIT_SUCCESS;
}

namespace {

/// @brief 実行処理
bool run(std::istream& is, std::ostream& os)
{
  int H;
  int W;
  int h;
  int w;
  is >> H >> W;
  is >> h >> w;

  const int restH = H - h;
  const int restW = W - w;
  const int restCell = restH * restW;

  os << restCell << "\n";

  return true;
}
}  // unnamed namespace


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

int N;
vector<double> p;
vector<vector<double>> memo;

double dp(int i, int j) {
    if (i == N) return j > i - j;
    if (memo[i][j] != -1) return memo[i][j];
    double head = dp(i + 1, j + 1) * p[i];
    double tail = dp(i + 1, j) * (1 - p[i]);
    return memo[i][j] = head + tail;
}

#include <iomanip>
int main() {
    cin >> N;
    p.resize(N);
    for (int i = 0; i < N; i++) cin >> p[i];
    memo.assign(N, vector<double>(N, -1));
    cout << fixed << setprecision(10) << dp(0, 0) << endl;
    return 0;
}

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

namespace Main
{
    class Program
    {
        static void Main(string[] args)
        {
            var inputs = ReadLine().Split(' ').Select(int.Parse).ToArray();
            int N = inputs[0];
            int X = inputs[1];
            int Y = inputs[2];
            int[] D = new int[N];
            for(int i = 0; i < N; i ++)
            {
                D[i] = 0;
            }
            int tmp;

            for(int i = 1; i <= N; i ++)
            {
                for(int j = i; j <= N; j ++)
                {
                    tmp = Min(Min(Abs( j - i ) ,Abs( X - i ) +1 + Abs( j - Y )), Abs( Y - i) +1 + Abs( j - X ));
                    D[tmp] += 1;
                }
            }

            for (int i = 1; i < N; i++)
            {
                WriteLine(D[i]);
            }
        }
    }
}

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

using namespace std;
int main(){
    int n,m,c,s=0,t=0;
    cin>>n>>m>>c;
    int a[m],b[m];
    for(int i=0;i<m;i++)
        cin>>b[i];
    while(n--){
            s=0;
        for(int i=0;i<m;i++){
            cin>>a[i];
            s=s+a[i]*b[i];
        }
        s=s+c;
        if(s>0) t++;
    }
    cout<<t<<endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define ALL(a)    a.begin(), a.end()
using namespace std;

int main() {
int A, B, C, D;cin>> A>> B >> C >> D;
int count = 1;
while(1){
if(count%2 == 1)C -= B;
else A -= D;
if(A <= 0){cout << "No";break;}
if(C <= 0){cout << "Yes";break;}
count++;


}
}

Measured memory_bytes: 3600
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	int x, y;
	cin >> x >> y;
	int answer = 2000000000;
	if(x <= y){ answer = min(answer, y - x); }
	if(-x <= y){ answer = min(answer, y + x + 1); }
	if(x <= -y){ answer = min(answer, (-y) - x + 1); }
	if(-x <= -y){ answer = min(answer, (-y) - (-x) + 2); }
	cout << answer << endl;
	return 0;
}



Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
inline int rd(char c[]){
  int i, sz=0;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c[sz++] = i;
  for(;;){
    i = getchar_unlocked();
    if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF){
      break;
    }
    c[sz++] = i;
  }
  c[sz]='\0';
  return sz;
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
char S[200002];
int N;
int main(){
  int i, res;
  N = rd(S);
  res = N;
  for(i=0;;i++){
    if(S[i]=='A'){
      break;
    }
  }
  res -= i;
  for(i=0;;i++){
    if(S[N-1-i]=='Z'){
      break;
    }
  }
  res -= i;
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20190721-1

// --- original code ---
// char S[200002];
// int N;
// {
//   int i, res;
//   rd(S@N);
// 
//   res = N;
//   for(i=0;;i++) if(S[i]=='A') break;
//   res -= i;
//   for(i=0;;i++) if(S[N-1-i]=='Z') break;
//   res -= i;
// 
//   wt(res);
// }


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

int main()
{
  int count1 = 0, count2 = 0;
  char sing[1000];
  scanf("%s",sing);
  for(int i = 0;i<strlen(sing);i++)
  {
    if(sing[i] == '+')
      count1++;
    else if(sing[i] == '-')
      count2++;
  }
  printf("%d\n",count1-count2);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef pair<int, int> P;
typedef pair<ll,ll> LP;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

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; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

void solve(){
    int N;
    cin >> N;
    set<string> s;
    REP(i,N){
        string S;
        cin >> S;
        s.insert(S);
    }
    cout << size(s) << endl;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    // int T; cin >> T; REP(t,T) solve();
}


Measured memory_bytes: 19204
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
using namespace std;
using Int = long long;
using ll = long long;
using Double = long double;
const Int INF = 1LL<<55;
const Int mod = (1e9)+7;
using P = pair<Int,Int>;
using T = tuple<Int,Int,Int>;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
ostream& operator<<(ostream& o,P p){return o<<"("<<p.first<<","<<p.second<<")";}
ostream& operator<<(ostream& o,T t){return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
istream& operator>>(istream& i,P &p){return i>>p.first>>p.second;}
ostream& operator<<(ostream& o,vector<auto> &a){Int i=0;for(auto t:a)o<<(i++?" ":"")<<t;return o;}
istream& operator>>(istream& i,vector<auto> &a){for(auto &t:a)i>>t;return i;}
void prArr(auto a,string s=" "){Int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;}

class CumulativeSum{
public:
  vector<Int> sum;
  CumulativeSum(){}
  CumulativeSum(vector<Int> A){
    Int n = A.size();
    sum.resize(n+1,0);
    for(Int i=1;i<=n;i++) sum[i] += sum[i-1] + A[i-1];
  }
  Int get(Int l,Int r){assert(l<=r && l>=0 && r<=(Int)sum.size());return sum[r] - sum[l];} //[l,r)
};

class CumulativeXor{
public:
  vector<Int> sum;
  CumulativeXor(){}
  CumulativeXor(vector<Int> A){
    Int n = A.size();
    sum.resize(n+1,0);
    for(Int i=1;i<=n;i++) sum[i] = sum[i-1] ^ A[i-1];
  }
  Int get(Int l,Int r){
    assert(l<=r && l>=0 && r<=(Int)sum.size());
    return sum[r] ^ sum[l];} //[l,r)
};


signed main(){
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);
  
  Int n;
  cin>>n;
  vector<Int> A(n);
  cin>>A;

  CumulativeSum Sum(A);
  CumulativeXor Xor(A);
  //pr(Xor.get(0, 2));
  //pr(Sum.get(0, 2));
  
  auto search = [&](Int l){
    Int L = 1, R = (n-l)+1;
    while(L+1<R){
      Int M = (L+R) / 2;
      Int a = Sum.get(l, l + M);
      Int b = Xor.get(l, l + M);
      //pr(l,L, R, M, a, b);
      (a == b)? L = M:R = M;
    }
    ///    pr(l , L, R);
    return L;
  };
  
  Int ans = 0;
  for(Int i=0;i<n;i++){
    ans += search(i);
  }
  
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 6500
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		//たて a cm よこ b cm の長方形の面積と周の長さを求めるプログラムを作成して下さい。
		Scanner sc = new Scanner(System.in);
		String[] array = sc.nextLine().split(" "); //array[0]=たて,array[1]=よこ
		//面積
		System.out.print(Integer.parseInt(array[0])*Integer.parseInt(array[1]) +" ");
		//周の長さ=array[0]*2+array[1]*2
		System.out.println(Integer.parseInt(array[0])*2+Integer.parseInt(array[1])*2);
	}
}

Measured memory_bytes: 17140
#include <iostream>
//#include <iomanip>
//#include <string>
//#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;
//#define all(v) v.begin(),v.end()
//ll mod = 1000000007 ;
//long double pie = acos(-1) ;
//ll INF = 1000000000000 ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}
//void fix_cout(){cout << fixed << setprecision(20) ;}

int main(){
	ll n,m ;
	cin >> n >> m ;
	ll sum = 0 ;
	for(int i=0;i<m;i++){
		ll a ; cin >> a ;
		sum += a ;
	}
	cout << (sum<=n?n-sum:-1) << endl ;
}


Measured memory_bytes: 3624
#include <stdio.h>

int main() {

int al[30] = {0};
char b[2000]= {0};
int i,j,n;

i=0;

while( scanf("%c",&b[i]) != EOF) {

if (b[i] >= 'A' && 'Z' >= b[i] ) {
n = b[i] - 'A';
al[n] += 1;

} else if(b[i] >=  'a' && b[i] <= 'z' ) {
n = b[i] - 'a';
al[n] += 1;
}
i=i+1;
}

for(j=97; j<=122; j++) {
n = j - 'a';
printf("%c : %d\n",j,al[n]);
}

return 0;

}



Measured memory_bytes: 2140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;
double pi=3.1415926535;

int main(){
  int n,m;
  cin>>n>>m;
  vector<int> path[n];
  rep(i,0,m){
    int a,b;
    cin>>a>>b;
    path[a-1].push_back(b-1);
    path[b-1].push_back(a-1);
  }
  int ans[n];
  rep(i,0,n) ans[i]=-1;
  ans[0]=0;
  queue<int> q;
  q.push(0);
  while(q.size()){
    int r=q.front();
    q.pop();
    rep(i,0,path[r].size()){
      if(ans[path[r][i]]==-1){
        ans[path[r][i]]=r;
        q.push(path[r][i]);
      }
    }
  }
  cout<<"Yes"<<endl;
  rep(i,1,n){
    cout<<ans[i]+1<<endl;
  }
}

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

using namespace std;


void solve() {
    int A, B, Q;
    cin >> A >> B >> Q;
    vector<long long> s(A+2);
    vector<long long> t(B+2);
    const long long INF = 1ll<<60;
    s[0] = t[0] = -INF;
    s[A+1] = t[B+1] = INF;
    for (int i = 1; i <= A; i++) {
        cin >> s[i];
    }
    for (int i = 1; i <= B; i++) {
        cin >> t[i];
    }
    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    while (Q--) {
        long long x;
        cin >> x;
        auto it = lower_bound(s.begin(), s.end(), x);
        long long sr = *it; it--;
        long long sl = *it;
        it = lower_bound(t.begin(), t.end(), x);
        long long tr = *it; it--;
        long long tl = *it;
        long long a = x - min(sl, tl);
        long long b = max(sr, tr) - x;
        long long c = sr - tl + min(sr-x, x-tl);
        long long d = tr - sl + min(tr-x, x-sl);
        long long res = min({a, b, c, d});
        cout << res << "\n";
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


Measured memory_bytes: 2944
// 標準入力
var fs = require('fs'),
length = fs.fstatSync(process.stdin.fd).size,
buffer = new Buffer(length),
bytesRead = fs.readSync(process.stdin.fd, buffer, 0, length, 0),
input = buffer.toString('utf8', 0, bytesRead).split('\n');
main();
    
// ここから
function main(){
  var primeNumbers = calcPrimeNumbers();
  for(var i = 0, len = input.length - 1; i < len; i++){
    console.log(primeNumbers[input[i] - 0]);
  }
   
     
}
   
function calcPrimeNumbers(){
  var max = 999999;
  var primeNumbers = new Int32Array(max + 1);
   
  // 除外
  primeNumbers[0] = primeNumbers[1] = 0;// あえて0,1を素数とみなす
  for(var i = 2, maxI = ~~Math.sqrt(max); i <= maxI; i++){
    if(primeNumbers[i]){
      continue;
    }
       
    for(var j = (i<<1); j <= max; j+=i){
      primeNumbers[j] = 1;
    }
  }
   
   for(var i = 2; i <= max; i++){
     // と、ここがこうなる
     primeNumbers[i] = primeNumbers[i-1] - primeNumbers[i] + 1;
  }
     
  return primeNumbers;
}

Measured memory_bytes: 12592
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
using namespace std; using ll = long long; using ld = long double;  using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
const ld PI = 3.1415926535897932;
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define rep1(n) for(ll i=0;i<n;++i)
#define rep2(i,n) for(ll i=0;i<n;++i)
#define rep3(i,a,b) for(ll i=a;i<b;++i)
#define rep4(i,a,b,c) for(ll i=a;i<b;i+=c)
#define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__)
#define mp make_pair
#define mt make_tuple
#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 LD(...) ld __VA_ARGS__;in(__VA_ARGS__)
void in() {}
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//bitSearch, bitList, nod, gcdlcm, isPrime, primeFactorize, Npow, divisor, modinv, dfs, bfs, eratos//
//dijkstra, WarshallFloyd, BellmanFord, UnionFind, COM, digitDP ,RMQ//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R;
ll MOD = 1000000007; ll INF = 1LL << 62; ll ans = 0; ll z = 0, o = 1;
vl flag, color, D; vll path;
int main() {
	cin >> N;
	vl A(N);
	for (i = 0; i < N; i++) cin >> A[i];
	for (i = 0; i < N-1; i++) {
		for (j = i+1; j < N; j++) {
			ans = max(ans, abs(A[j] - A[i]));
		}
	}
	cout << ans;
}

Measured memory_bytes: 256
package main

import (
  "fmt"
)

func main() {
  var n int
  var a float32
  var anser float32

  fmt.Scan(&n)

  for i := 1; i <= n; i++ {
    fmt.Scan(&a)

    anser += 1 / a
  }

  fmt.Println( 1 / anser)
}

Measured memory_bytes: 512
while True:
    H, W = [int(x) for x in input().split() if x.isdigit()]
    if H ==0 and W == 0:
        break
    for i in range(H):
        for j in range(W):
            if j < W-1 and (i + j) % 2 == 0:
                print("#", end='')
            elif j < W-1 and (i + j) % 2 != 0:
                print(".", end='')
            elif j == W-1 and (i + j) % 2 == 0:
                print("#")
            elif j == W-1 and (i + j) % 2 != 0:
                print(".")
    print("")

Measured memory_bytes: 9136
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m,sum=0,x;scanf("%d%d",&m,&n);
	for(int i=0;i<n;i++)scanf("%d",&x),sum+=x;
	printf("%d",max(-1,m-sum));
	return 0;
}

Measured memory_bytes: 3816
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N,K;
  cin >> N>>K;
  int S=1;
  for (int i = 0; i < N; i++) {
 
if(K >= S){
 S *=2;
}
    else{
      S+=K;
    }
  }
  cout << S <<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int high, width;
    int i, j;
    while (1)
    {
        scanf("%d %d", &high, &width);
        if(high == 0 && width == 0){
            break;
        }
        for (i = 0; i < high;i++){
            for (j = 0; j < width;j++){
                if(i == 0 || i == high - 1 || j==0 || j==width-1){
                    printf("#");
                }else{
                    printf(".");
                }
                if(j == width - 1){
                    printf("\n");
                }
                
            }
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2108
import std.stdio;
import std.algorithm;
import std.string;
import std.conv;
import std.math;

void main(){

    while(true){
	auto s1 = readln();
	if(stdin.eof()) break;
	auto s = split(s1);
	int a = to!int(s[0]);
	int b = to!int(s[1]);
	int oth = to!int(s[2]);
	int[11] cards;
	cards = 0;
	cards[a]--;
	cards[b]--;
	cards[oth]--;
	int r = 20 - a - b;
	int ans = 0;
	int ini = min(10,r);
	for(int i=ini;i>=0;i--){
	    if(cards[i]==0) ans++;
	}
	if(ans>=5) writeln("YES");
	else writeln("NO");
    }
}

Measured memory_bytes: 2460
/******Old_school_@20******/
#include<bits/stdc++.h>
using namespace std;
#define lld               long long int
#define ld                long double
#define pb                push_back
#define ppb               pop_back 
#define mp                make_pair
#define F                 first
#define S                 second
#define nl                '\n'
#define all(c)            (c).begin(),(c).end()
#define rall(c)           (c).rbegin(),(c).rend()
#define sz(c)             (c).size()
#define tr(x,a)           for(auto &a : x)
#define psnt(x,a)         (x).find(a)!=(x).end()
#define vpsnt(x,a)        find(all(x),a)!=(x).end()
#define lexichar(x,y)     lexicographical_compare(x,x+strlen(x),y,y+strlen(y)) //modify the ranges
#define lexistr(x,y)      lexicographical_compare(x.begin(),x.end(),y.begin(),y.end()) 
#define MOD               1000000007
#define pi                3.1415926536
#define tod               1
#define itr(i,a,b)        for(lld i=a;i<=b;i++)
#define itrn(i,a,b)       for(lld i=a;i>=b;i--)
#define iot(n)            for(lld i=0;i<n;i++)
#define pls(n,arr)        lld arr[n]; iot(n)  cin>>arr[i];
#define bye               fflush(stdout)

typedef pair<lld,lld>     pii;
typedef pair<string,lld>  psi;
template <typename T>
bool mycomp(T x,T y){ 
   return (x==y);  //give your condition here
}
bool paircomp(const pair<lld,lld> &x,const pair<lld,lld> &y){ 
return x.second<y.second;
}

int main(){
       ios_base::sync_with_stdio(false);
             cin.tie(0);
            cout.tie(0);
       lld x,k,d; cin>>x>>k>>d;
       if(x<0) x=-x;
       if(x==0){
           if(k%2)  cout<<d;
           else cout<<0;return 0;
       }
       
           lld dist=x/d;
           if(k>dist){
               if((k-dist)%2==0){
                   cout<<x-d*(dist);
               }
               else{
                   cout<<abs(x-d*dist-d);
               }
           }
           else if(k<=dist){
               cout<<x-d*k;
           }
           
       
       
     
}


Measured memory_bytes: 3644
import java.util.Scanner;

public class Main{
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int n=scanner.nextInt();
    int l=scanner.nextInt();
    int aji[]=new int[n];
    int num[]=new int[n];
    int max=0;
    int ans=100000;
    int a=0;

    for(int i=0;i<n;i++){
      aji[i]=l+i;
    }

    for(int i=0;i<n;i++){
      max+=aji[i];
    }

    for(int i=0;i<n;i++){
      num[i]=max-aji[i];
    }

    for(int i=0;i<n;i++){
      if(ans>Math.abs(max-num[i])){
        a=num[i];
        ans=Math.abs(max-num[i]);
      }
    }


    System.out.println(a);
  }
}


Measured memory_bytes: 21844
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;


class Program {

	static long mod = 998244353;
	static void Main(string[] args) {

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

		//int n = int.Parse(Console.ReadLine());
		//int val = int.Parse(Console.ReadLine());
		//int[] vals = parseAry(Console.ReadLine().Split(cs));
		//string str = Console.ReadLine();
		//string[] strs = Console.ReadLine().Split(cs);

		//string res="";
		//int res = 0;
		
		int res = 0;

		int[] vals = parseAry(Console.ReadLine().Split(cs));

		res = 0;
		int n=vals[3];
		int now = 0;
		for ( int r = 0; r <= n; r++ ) {
			now = r * vals[0];
			if ( n < now ) { continue; }
			for ( int g = 0; g <= n; g++ ) {
				int pre = now;
				now += g * vals[1];
				if ( n < now ) { now = pre; break; }

				if ( ( n - now ) % vals[2]==0 ) {
					res++;
				}
				now = pre;

			}
			int t = 0;
		}



		Console.WriteLine(res);


		return;

	}

	//	文字列strをindex番目からdで上書き
	static string strOverWrite(string str, int i, string s) {
		return str.Remove(i, s.Length).Insert(i, s);
	}

	//　String[]  ----->  int[]
	static int[] parseAry(string[] str) {
		int[] nums = new int[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = int.Parse(str[i]); }
		return nums;
	}
	//　String[]  ----->  long[]
	static long[] parseAryL(string[] str) {
		long[] nums = new long[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = long.Parse(str[i]); }
		return nums;
	}

	//文字列を1文字ずつString[]に入れる
	static string[] strAry(String str) {
		string[] re = new string[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { re[i] = str[i].ToString(); }
		return re;
	}

}

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

using namespace std; 
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>; 
#define INF INT_MAX/2 //(1<<(4*4-1))
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

bool ok(ull K,ull A,ull B,ull md){
   ull K_=K;
   ll res=0;
   if(K+1>=md)return true;

   if(K>=A+1){
      K-=A+1;
      res=B;
      if(B>A) {
         if(K%2==0)res+=(K/2*B-K/2*A);
         else res+=(K/2*B-K/2*A+1);
         if(res>=md)return true;
      }
   }
//48518828981938099
//53513332169120811


   return false;

}

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

   ull K,A,B;
   cin>>K>>A>>B;

   ull l=0;
   ull r=1000000000000000000;
   ull md;
   while(r-l>1){
      md=(r+l)/2;
      if(ok(K,A,B,md))l=md;
      else r=md;
   }
   cout<<l<<endl;
   return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define endl "\n"
#define F first
#define S second
#define mod 1000000007
#define pb push_back
#define FOR(i,a,n) for(int i=a;i<n;i++)
#define REV(i,a,n) for(int i=a;i>=n;i--)
#define all(a) a.begin(),a.end()
#define UB upper_bound
#define LB lower_bound
const int NUM = 2e5 + 5;
int dp[100005];

int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int num_tests=1; 
    //cin >> num_tests;
    while(num_tests-->0){
        int n,k; cin >> n >> k;
        vector<int> a(n);
        FOR(i,0,n) cin >> a[i];
        dp[0] = 0; // Losing state
        FOR(i,1,k+1){
            dp[i] = 0; // Initialised as Losing state
            for(auto x:a)
                if(i >= x and dp[i-x] == 0)
                    dp[i] = 1; // Winning state if we can reach the losing state
        }
        if(dp[k]) cout << "First";
        else cout << "Second";
    }   
}

Measured memory_bytes: 4440
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>

typedef long long ll;
using namespace std;

ll fact(ll n)
{
	return n<=1 ? 1 : n*fact(n-1);
}

int main()
{
	ll n;
	scanf("%lld",&n);
	cout << fact(n) << endl;
}

Measured memory_bytes: 0
#include <algorithm>
#include <cstdio>
using namespace std;
int f[10],a[10],A[10][331],i,n,s;
main(){
	for(f[0]=1,i=1;i<10;i++)f[i]=f[i-1]*i,a[i]=i;
	do{for(s=i=0;i<10;i++)s+=(i+1)*a[i],A[i][s]++;}while(next_permutation(a,a+10));
	for(;~scanf("%d%d",&n,&s);)printf("%d\n",s>330?0:A[n-1][s]/f[10-n]);
}

Measured memory_bytes: 1040