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

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

    int N = 11;
    vector<vector<int>> dp(N, vector<int>(10, 0));
    for (int i = 0; i < 10; i++)
    {
        dp[0][i] = 1;
    }

    int digit = 0;
    for (int i = 0; i < N; i++)
    {
        int sum = 0;
        for (int j = 0; j < 10; j++)
        {
            if (j > 0)
            {
                sum += dp[i][j];
            }
            dp[i + 1][j] += dp[i][j];
            if (j - 1 >= 0)
            {
                dp[i + 1][j - 1] += dp[i][j];
            }
            if (j + 1 < 10)
            {
                dp[i + 1][j + 1] += dp[i][j];
            }
        }
        if (sum >= K)
        {
            digit = i + 1;
            break;
        }
        else
        {
            K -= sum;
        }
    }
    dp[digit - 1][0] = 0;

    int from = 0;
    int to = 9;
    for (int i = digit - 1; i >= 0; i--)
    {
        int tmp = 0;
        for (int j = from; j <= to; j++)
        {
            if (tmp + dp[i][j] >= K)
            {
                cout << j;
                from = max(0, j - 1);
                to = min(9, j + 1);
                K -= tmp;
                break;
            }
            else
            {
                tmp += dp[i][j];
            }
        }
    }
    cout << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>

#define PB push_back
#define ALL(a)  (a).begin(),(a).end()
#define DWN(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)

#define mod 1000000007

using namespace std;

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

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int INF = (int)1e9;

int main() { 
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	string a[4] = { "maerd", "remaerd", "esare", "resare" };
	int b[4] = { 5, 7, 5, 6 };
	reverse(ALL(s));
	int x = 0;
	while (s.size() > x) {
		if (s.substr(x, 7) == a[1]) {
			x += b[1];
		}
		else if (s.substr(x, 6) == a[3]) {
			x += b[3];
		}
		else if (s.substr(x, 5) == a[0] || s.substr(x, 5) == a[2]) {
			x += b[0];
		}
		else {
			cout << "NO" << "\n";
			return 0;
		}
	}
	cout << "YES" << "\n";
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
signed main(){
  int a,b;
  string s;
  cin>>s;
  a = 0, b = 0;
  for(int i=0;i<s.size();i++){
    if(s[i] == '1'){
      a++;
    } else {
      b++;
    }
  }

  cout<<min(a,b)*2<<endl;
  return(0);
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define all(in) in.begin(), in.end()
constexpr int INF = (numeric_limits<int>::max() == INT_MAX ? (int)1e9 : (long long)1e18);
constexpr long double eps = 1e-6;
const string el = "\n";
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
using ld  = long double;using pii = pair<int,int>;using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
void fast_io(){ios::sync_with_stdio(false); cin.tie(nullptr);}
int out(int a){cout << a << el; return 0;}
int out(string s = "NO"){cout << s << el; return 0;}
template <class T>
inline int out(vector<T>&v,string c = " "){
    for(int i = 0; i < v.size(); ++i){
        if(i) cout << c; cout << v[i];
    } cout << el;return 0;
}
signed main(){
    fast_io();
    int N; cin >> N;
    int ans = 0;
    int a,b; cin >> a >> b;
    for(int i = 1; i <= N; ++i){
        int tmp = 0;
        for(auto c : to_string(i))
            tmp += c - '0';
        if(a <= tmp && tmp <= b) ans += i;
    }
    cout << ans << endl;
    
}




Measured memory_bytes: 256
X = int(input())

flag = False
for x in range(X):
    for i in range(2, X-x+1):
        n = X - x
        m = 0
        while True:
            if m == 0:
                m = i
            if n % i == 0:
                n = n / i
                if n == 1 and m != X - x:
                    flag = True
                if flag:
                    break
            else:
                break
        if flag:
            break
    if flag:
        break
if flag:
    print(X - x)
else:
    print(1)


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

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define RREP(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i <= (int)(b); i++)
#define RFOR(i, a, b) for (int i = a; i >= (int)(b); i--)
#define ALL(x) (x).begin(), (x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "[ ";
    for (auto a : v) os << a << " ";
    os << "]";
    return os;
}

vector<ll> divisor(ll n) {
    vector<ll> ret;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(begin(ret), end(ret));
    return (ret);
}

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    REP(i, N) cin >> A[i];

    vector<int> num(1e6 + 1);
    sort(ALL(A));
    REP(i, N) {
        if (num[A[i]] == 0)
            num[A[i]] = i + 1;
        else
            num[A[i]] = 1e9;
    }

    int ans = 0;
    REP(i, N) {
        if (num[A[i]] == 1e9) continue;
        vector<ll> div = divisor(A[i]);
        // cout << "A[i]=" << A[i] << endl;
        // cout << "d: " << div << endl;
        bool check = true;
        for (auto d : div) {
            if (num[d] > 0 && num[d] != i + 1) {
                check = false;
                break;
            }
        }
        if (check) ans++;
    }

    // cout << "num:" << num << endl;
    cout << ans << endl;

    return 0;
}

// 3 8 11 16 24

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

#define pb push_back
#define mk make_pair
#define lob lower_bound
#define upb upper_bound
#define fst first
#define scd second

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

inline int read(){
	int f=1,x=0;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
inline ll readll(){
	ll f=1,x=0;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

const int MOD=998244353;
map<string,int>f,g;
int F(string s);
int G(string s){
	if(g.count(s))return g[s];
	if((int)s.length()==1)return (g[s]=(s[0]=='0'?1:2));
	for(int i=1;i<(int)s.length();++i)if((int)s.length()%i==0){
		string t="";
		for(int j=0;j<i;++j){
			bool flag=1;
			for(int k=0;k<(int)s.length()/i;++k){
				if(s[i*k+j]=='0'){flag=0;break;}
			}
			if(flag)t+="1";
			else t+="0";
		}
		g[s]=(g[s]+F(t))%MOD;
	}
	return g[s];
}
int F(string s){
	if(f.count(s))return f[s];
	for(int i=1;i<=(int)s.length();++i){
		f[s]=(f[s]+(ll)G(s.substr(0,i))*F(s.substr(i,s.length()-i))%MOD)%MOD;
	}
	return f[s];
}
int main() {
	string s;cin>>s;f[""]=1;cout<<F(s)<<endl;
	return 0;
}

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

int main()
{
	int a, b;
	cin>>a>>b;
	string s;
	cin>>s;
	int l = s.length();
	bool flag = true;
	for(int i=0;i<l&&flag;i++)
	{
		if(i == a)
		{
			if(s[i] != '-')
				flag = false;
		}
		else 
		{
			if(s[i] < '0' || s[i] > '9')
				flag = false;
		}
	}
	if(flag) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5 + 5, INF = 0x3f3f3f3f, M = N << 1;

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int a, b;
  cin >> a >> b;
  cout << max(0, a - b * 2) << '\n';
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long k = sc.nextLong();
        if (k == 0) {
            System.out.println(n * n);
            return;
        }
        long ans = 0;
        for (long i = k + 1; i <= n; i++) {
            ans += (i - k) * (n / i);
            ans += Math.max(0, n % i - k + 1);
        }
        System.out.println(ans);
    }

}


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

int main()
{
    int n = 0;
    int m = 0;

    // input
    std::cin >> n;
    std::cin >> m;

    if (n < 1 || n > 100 || m < 1 || m > 100)
    {
        std::cout << "Error : out of range!" << std::endl;
        return -1;
    }

    std::vector< std::vector<int> > a(n, std::vector<int>(m));
    std::vector<int> b(m);

    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < m; ++j)
        {
            std::cin >> a.at(i).at(j);
            if (a.at(i).at(j) < 0 || a.at(i).at(j) > 1000)
            {
                std::cout << "Error : out of range!" << std::endl;
                return -2;
            }
        }
    }

    for (int i = 0; i < m; ++i)
    {
        std::cin >> b.at(i);
        if (b.at(i) < 0 || b.at(i) > 1000)
        {
            std::cout << "Error : out of range!" << std::endl;
            return -3;
        }
    }

    std::vector<int> c;
    int tmp = 0;

    // output
    for (int i = 0; i < n; ++i)
    {
        tmp = 0;

        for (int j = 0; j < m; ++j)
        {
            tmp += a.at(i).at(j) * b.at(j);
        }

        c.push_back(tmp);
    }

    for (int i = 0; i < n; ++i)
    {
        std::cout << c.at(i) << std::endl;
    }

    return 0;
}


Measured memory_bytes: 3152
#include<stdio.h>
int main()
{
    int AB,BC,CA,A;
    scanf("%d%d%d",&AB,&BC,&CA);
    int a,b,c;
    a=AB*AB;
    b=BC*BC;
    c=CA*CA;
    if(a==(b+c))
    {
        A=.5*BC*CA;
        printf("%d\n",A);

    }
    if(c==(a+b))
    {
        A=.5*BC*AB;
        printf("%d\n",A);
    }
    if(b==(a+c))
    {
        A=.5*AB*CA;
        printf("%d\n",A);
    }
}


Measured memory_bytes: 2144
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int v[n],c[n];
    for(int i=0;i<n;i++) cin>>v[i];
    for(int i=0;i<n;i++) cin>>c[i];
    
    int ans=0;
    for(int i=0;i<n;i++){
        if((v[i]-c[i])>0) ans+=v[i]-c[i];
    }
    cout << ans << endl;
    
}


Measured memory_bytes: 764
using System;
using System.Collections.Generic;
using System.Linq;
using static Atcoder;
using System.Threading.Tasks;
using System.ComponentModel;

public class Hello
{

    public static void Main()
    {
        int[] n = SpIntRead(' ');
        int H = n[0];
        int W = n[1];
        string[] s = new string[H];
        bool[] h = new bool[H];
        bool[] w = new bool[W];
        for (int i = 0; i < H; i++) s[i] = Console.ReadLine();
        for (int i = 0; i < H; i++)
        {
            if (s[i].Count(c => c == s[i][0]) == W && s[i][0] == '.') h[i] = false;
            else h[i] = true;
        }
        bool f = false;
        for (int i = 0; i < W; i++)
        {
            for (int j = 0; j < H; j++)
            {
                if ('.' == s[j][i]) f = true;
                else { f = false; break; }
            }
            if (f) w[i] = false;
            else w[i] = true;
        }
        bool write = false;
        for (int i = 0; i < H; i++) {
            if (!h[i]) continue;
            write = false;
            for (int j = 0; j < W; j++) {
                if (h[i] && w[j]) { Console.Write(s[i][j]); write = true; }
            }
            if (write) Console.WriteLine();
        }
    }
}


public class Atcoder
{
    static void Swap<T>(ref T a, ref T b)
    {
        var t = a;
        a = b;
        b = t;
    }
    public static long LCM(long a, long b)
    {
        long c = a * b;
        if (a < b) Swap(ref a, ref b);
        long d = a % b;
        while (d != 0)
        {
            a = b;
            b = d;
            d = a % b;
        }
        return c / b;
    }
    public static string strReverce(string s)
    {
        return new string(s.Reverse().ToArray());
    }
    public static int intRead()
    {
        return int.Parse(Console.ReadLine());
    }
    public static bool IsPrime(int n)
    {
        if (n < 2) return false;
        if (n == 2) return true;
        if (n % 2 == 0) return false;

        //double sqrtNum = Math.Sqrt(n);
        for (int i = 3; i < n; i += 2)
        {
            if (n % i == 0) return false;
        }
        return true;
    }
    public static string[] SpRead(char c)
    {
        return Console.ReadLine().Split(c);
    }
    public static int[] SpIntRead(char c)
    {
        return Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
    }
    public static string ToConvertBit(int N, int e)
    {
        string ret = "";
        int r = 0;
        while (N != 0)
        {
            r = N % e;
            ret += r.ToString();
            N -= r;
            N /= e;
        }
        ret = strReverce(ret);
        return ret;
    }

}


Measured memory_bytes: 13396
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<string>
using namespace std;
int trs(double a){
	int w=(int)a;
	double s=a-w;
	if (s>0.5)
	{
		w=w+1;
	}
	return w;
}
int main(int argc, char const *argv[])
{
	int a,b;
	cin>>a>>b;
	for (int i = 0; i < 100*a*b; i++)
	{
		if (floor(i*0.08)==a&&floor(i*0.1)==b)
		{
			cout<<i;
			return 0;
			/* code */
		}
		
	}
	cout<<"-1";
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) begin(x),end(x)
#define F(i,n) for (int i = 0; i < n; ++i)
#define F1(i,n) for (int i = 1; i <= n; ++i)
#define dbg(x) cerr << #x << " = " << x << endl
#define dbgg(x) cerr << #x << " = " << x << ' '
#define T(x) x[pool]
#define mineq(x,y) { if ((x) > (y)) (x) = (y); }
#define maxeq(x,y) { if ((x) < (y)) (x) = (y); }
#define MEOW cout << "meowwwww" << '\n'; system("pause");
#define int long long
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;

template<typename T>
ostream& operator <<(ostream &s, const vector<T> &c)
{
	s << "[ "; for (auto it : c) s << it << " "; s << "\b]\n";
	return s;
}

template<typename T>
ostream& operator <<(ostream &s, const pair<int, T> &c)
{
	s << "[ "; cout << c.fi << " , " << c.se << " ] ";
	return s;
}

const int maxn = 5678, mod = 998244353;
int k, n;
int frac[maxn], rfrac[maxn], p2[maxn];

void input()
{
	ios::sync_with_stdio(false); cin.tie(0);
	cin >> k >> n;
}

int power(int a, int b)
{
	if (b == 0) return 1;
	if (b == 1) return a;
	int ret = power(a * a % mod, b / 2);
	if (b & 1) ret = (ret * a) % mod;
	return ret;
}

int c(int x, int y)
{
	return (((frac[x] * rfrac[y]) % mod) * rfrac[x - y]) % mod;
}

int f(int x, int y)
{
	// (x + y - 1, y - 1)
	return c(x + y - 1, y - 1);
}

void solve()
{
	frac[0] = 1;
	for (int i = 1; i < maxn; ++i) frac[i] = (frac[i - 1] * i) % mod;
	for (int i = 0; i < maxn; ++i) rfrac[i] = power(frac[i], mod - 2);
	p2[0] = 1;
	for (int i = 1; i < maxn; ++i) p2[i] = (p2[i - 1] * 2) % mod;
	for (int i = 2; i <= k + k; ++i)
	{
		int e = 0;
		for (int j = 1; j <= k; ++j)
		{
			if (1 <= i - j && i - j <= k) ++e;
		}
		int x = e / 2, y; y = k - x - x;
		int ans = 0;
		if (i % 2 == 0)
		{
			// choose i / 2
			for (int j = 0; j <= min(x, n - 1); ++j)
			{
				if (y == 0 && j == 0) continue;
				ans = (ans + ((p2[j] * c(x, j) % mod) * f(n - 1 - j, j + y - 1) % mod)) % mod;
			}
			// not
			for (int j = 0; j <= min(x, n); ++j)
			{
				if (y == 0 && j == 0) continue;
				ans = (ans + ((p2[j] * c(x, j) % mod) * f(n - j, j + y - 1) % mod)) % mod;
			}
		} else
		{
			for (int j = 0; j <= min(x, n); ++j)
			{
				if (y == 0 && j == 0) continue;
				ans = (ans + ((p2[j] * c(x, j) % mod) * f(n - j, j + y) % mod)) % mod;
			}
		}
		cout << ans << '\n';
	}
}

main()
{
	input();
	solve();
}


Measured memory_bytes: 384
import itertools

H,W,K = [int(i) for i in input().split()]
c = []
for _ in range(H):
    a = list(input())
    a = [1 if i == "#" else 0 for i in a ]
    c.append(a)
ans = 0
for i in range(H+1):
    for j in range(W+1):
        for A in itertools.combinations(range(H), i):
            for B in itertools.combinations(range(W),j):
                s = 0
                for k in A:
                    for l in B:
                        s += c[k][l]
                if s == K:
                    ans += 1
print(ans)

Measured memory_bytes: 68428
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    if(a<=b)

    {
        for(int i=0;i<b;i++)
        {
            cout<<a;
        }
    }
    else
    {
         for(int i=0;i<a;i++)
        {
            cout<<b;
        }
    }
    cout<<"\n";
return 0;}


Measured memory_bytes: 3592
import java.util.Scanner;

class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int H = sc.nextInt();
		int W = sc.nextInt();
		int h = sc.nextInt();
		int w = sc.nextInt();
		System.out.print(H*W-(W*h+H*w)+h*w);
		
		
	}
	
	
}



Measured memory_bytes: 22868
/************************************************
*Author        :  lrj124
*Created Time  :  2019.11.07.21:12
*Mail          :  1584634848@qq.com
*Problem       :  at2165
************************************************/
#include <cstdio>
const int maxn = 200000 + 10;
int n,l,r(maxn),x[maxn];
inline bool check(int mid) {
	for (int i = 1;i < n;i++) {
		if ((x[n-i] > mid && x[n-i+1] > mid) || (x[n-i] <= mid && x[n-i+1] <= mid)) return x[n-i] <= mid;
		if ((x[n+i] > mid && x[n+i-1] > mid) || (x[n+i] <= mid && x[n+i-1] <= mid)) return x[n+i] <= mid;
	}
	return x[1] <= mid;
}
int main() {
// 	freopen("at2165.in","r",stdin);
// 	freopen("at2165.out","w",stdout);
	scanf("%d",&n);
	for (int i = 1;i < (n<<1);i++) scanf("%d",&x[i]);
	for (int mid;l < r;mid = l+r>>1,check(mid) ? r = mid : l = mid+1);
	printf("%d",l);
	return 0;
}

Measured memory_bytes: 1024
#include<algorithm>
#include <iostream>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<string>
using namespace std;
int main(){
  
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    
    int s[3]={a,b,c};
    
    sort(s,s+3);
   
    for(int i=0;i<k;i++){
        s[2]=2*s[2];
    }
    
    cout<<s[0]+s[1]+s[2]<<endl;
    
    return 0;
}







Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;


const int MAX_N = 100010;

int cnt[100010];
signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	VE a(n); rep(i, n)cin >> a[i];
	rep(i, n)cnt[a[i]]++;
	if (cnt[0] == 0 || cnt[0] % 2 == 1) {
	
	}
	else {
		cout << 0 << endl; return 0;
	}
	int now = 0;
	rep(i, 100010) {
		if (i == 0)continue;
		if (cnt[i] % 2 != 0) {
			cout << 0 << endl; return 0;
		}
		if (cnt[i] != 0) {
			now++;
		}
	}
	int ans = 1;
	rep(i, now) {
		ans *= 2; ans %= MOD;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include<algorithm>
#include <stdio.h>
#include <string>
#include <map>
//#include <bits/stdc++.h>
using namespace std;
/*inline int read(){
    int s=0,w=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
    while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
    return s*w;
}*/
typedef long long ll;
int gcd(int a,int b)
{
    return b?gcd(b,a%b):a;
}
int a[100004],b[100004],k[1000001];
int main() {
    int n;
    while (cin >> n) {
        for (int i = 1; i <= n; i++)
            cin >> k[i];
        a[1] = 0, b[n] = 0;
        for (int i = 2; i <= n; i++)
            a[i] = gcd(a[i - 1], k[i - 1]);
        for (int i = n - 1; i >= 1; i--)
            b[i] = gcd(b[i + 1], k[i + 1]);
        int ans = -999;
        for (int i = 1; i <= n; i++)
          ans=max(ans,gcd(a[i],b[i]));
    cout<<ans<<endl;
}
    return 0;
}

Measured memory_bytes: 3328
import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 1000000007
sys.setrecursionlimit(1000000)

N, K = rl()
V = rl()
dp = [[[-float('inf')]*(K+1) for _ in range(N+1)] for _ in range(N+1)]
dp[0][0][0] = 0

for i in range(N):
	for j in range(N):
		for k in range(K):
			dp[i][j][k+1] = max(dp[i][j][k+1], dp[i][j][k])
			# if i+j >= K or i+j >= N:
			# 	print('?', i,j,k,dp[i][j][k+1], dp[i][j][k])
			# 	dp[i][j][k+1] = max(dp[i][j][k+1], dp[i][j][k])
			# 	continue
			ni, nj, nk = i+1, j, k+1
			if ni+nj <= N:
				dp[ni][nj][nk] = max(dp[ni][nj][nk], dp[i][j][k]+V[i])
				if V[i] < 0 and nk+1 <= K:
					dp[ni][nj][nk+1] = max(dp[ni][nj][nk+1], dp[i][j][k])
			ni, nj, nk = i, j+1, k+1
			if ni+nj <= N:
				dp[ni][nj][nk] = max(dp[ni][nj][nk], dp[i][j][k]+V[N-j-1])
				if V[N-j-1] < 0 and nk+1 <= K:
					dp[ni][nj][nk+1] = max(dp[ni][nj][nk+1], dp[i][j][k])

ans = 0
for i in range(N+1):
	for j in range(N+1):
		ans = max(ans, dp[i][j][K])
print(ans)


Measured memory_bytes: 81960
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int main(){
        int a;
        while(cin>>a){
           LL c=0;
           REP(i,10){
               REP(j,10){
                   REP(k,10){
                       REP(l,10){
                           if(i+j+k+l==a)c++;
                       }
                   }
               }
           }
           cout<<c<<endl;
        }
	return(0);
}

Measured memory_bytes: 3076
s_in=input()
t_in=input()

dicword_s={}
dicword_t={}
for s,t in zip(s_in,t_in):
    if s in dicword_s:
        if t != dicword_s[s]:
            print("No")
            exit()
    else:
        dicword_s[s] = t

    if t in dicword_t:
        if s != dicword_t[t]:
            print("No")
            exit()
    else:
        dicword_t[t] = s
print("Yes")

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

int main(){
    int n, p;
    cin >> n >> p;
    int a[n];
    rep(i,n) cin >> a[i];
    vector<vector<ll>> dp(n+1,vector<ll>(2,0));
    dp[0][0] = 1;
    rep(i,n){
        if(a[i] % 2) {
            dp[i+1][0] = dp[i][1] + dp[i][0];
            dp[i+1][1] = dp[i][0] + dp[i][1];
        } else {
            dp[i+1][0] = dp[i][0]*2;
            dp[i+1][1] = dp[i][1]*2;
        }  
    }
    cout << dp[n][p] << endl;
    return 0;
}

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

typedef long long ll;

int n,mod;

int qpow(ll a,int t){
    ll res=1;
    while(t){
        if(t&1){
            res=res*a%mod;
        }
        a=a*a%mod;
        t>>=1;
    }
    return res;
}

vector<int> g[100005];
ll dpin[100005];
ll dpout[100005];

ll dfsin(int x,int p){
    dpin[x]=1;
    for(int i=0;i<g[x].size();i++){
        int &y=g[x][i];
        if(y!=p){
            dpin[x]=dpin[x]*(dfsin(y,x)+1)%mod;
        }
    }
    return dpin[x];
}

void dfsout(int x,int p){
    vector<ll> pre(g[x].size()),suf(g[x].size());
    ll cur=1;
    pre[0]=1;
    for(int i=0;i+1<g[x].size();i++){
        int &y=g[x][i];
        if(y!=p){
            pre[i+1]=pre[i]*(dpin[y]+1)%mod;
        }else{
            pre[i+1]=pre[i];
        }
    }
    suf[g[x].size()-1]=1;
    for(int i=g[x].size()-1;i>0;i--){
        int &y=g[x][i];
        if(y!=p){
            suf[i-1]=suf[i]*(dpin[y]+1)%mod;
        }else{
            suf[i-1]=suf[i];
        }
    }
    for(int i=0;i<g[x].size();i++){
        int &y=g[x][i];
        if(y!=p){
            dpout[y]=(dpout[x]*pre[i]%mod*suf[i]+1)%mod;
            dfsout(y,x);
        }
    }
}

int main(){

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

    cin>>n>>mod;
    if(n==1){
        cout<<1<<endl;
        return 0;
    }
    for(int i=1;i<n;i++){
        int a,b;
        cin>>a>>b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    dfsin(1,-1);
    dpout[1]=1;
    dfsout(1,-1);
    for(int i=1;i<=n;i++){
        cout<<dpin[i]*dpout[i]%mod<<endl;
    }

    return 0;
}

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

int main() {
    int n;
    cin >> n;
    int p[n];
    for(int i = 0; i < n; i++) cin >> p[i];
    int ans = 0;
    for(int i = 1; i < n - 1; i++) {
        if((p[i - 1] < p[i]) && (p[i] < p[i + 1])) ans++;
        else if((p[i - 1] > p[i]) && (p[i] > p[i + 1])) ans++;
    }
    cout << ans << endl;
	return 0;
}

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

//#include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
// using cint = cpp_int;
//#pragma GCC optimize("", on)
//#pragma GCC optimization_level 3

// Define
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const ll MOD = 1e9 + 7;
const ll INF = LONG_MAX;
const ull MAX = ULONG_MAX;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define x first
#define y second
#define endl '\n'
#define space ' '
#define def inline auto
#define func inline constexpr ll
#define run __attribute__((constructor)) def _
#define all(v) begin(v), end(v)
#define input(a) scanf("%lld", &(a))
#define print(a) printf("%lld\n", (a))

// Debug
#define debug(...)                                                             \
    {                                                                          \
        cerr << __LINE__ << ": " << #__VA_ARGS__ << " = ";                     \
        for (auto &&X : {__VA_ARGS__}) cerr << "[" << X << "] ";               \
        cerr << endl;                                                          \
    }

#define dump(a, h, w)                                                          \
    {                                                                          \
        cerr << __LINE__ << ": " << #a << " = [" << endl;                      \
        rep(i, h) {                                                            \
            rep(j, w) cerr << a[i][j] << space;                                \
            cerr << endl;                                                      \
        }                                                                      \
        cerr << "]" << endl;                                                   \
    }

#define lldump(a, n) dump(vector<vector<ll>>{a}, 1, n)

// Loop
#define inc(i, a, n) for (ll i = (a), _##i = (n); i <= _##i; ++i)
#define dec(i, a, n) for (ll i = (a), _##i = (n); i >= _##i; --i)
#define each(i, a) for (auto &&i : a)
#define rep(i, n) inc(i, 0, n - 1)
#define loop() for (;;)

// Stream
#define fout(n) cout << fixed << setprecision(n)
#define fasten cin.tie(0), ios::sync_with_stdio(0)

// Speed
run() { fasten, fout(10); }
#pragma GCC optimize("O3")
#pragma GCC target("avx")

// Math
func gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
func lcm(ll a, ll b) { return a * b / gcd(a, b); }
func sign(ll a) { return a ? abs(a) / a : 0; }

def in() {
    ll A;
    cin >> A;
    return A;
}

signed main() {
    ll a, b, c;
    cin >> a >> b >> c, cout << a + b + c - max({a, b, c}) << endl;
}

// for compilation: g++ -Ofast -march=native -o _ _.cpp -std=c++17

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

int N,M;

int dfs(int i, int cnt,
    bitset<500> cur, vector<bitset<500>> &bs){
    if(N == i) return cur.count() == 0 ? cnt : 0;
    return max(dfs(i+1,cnt,cur,bs), dfs(i+1,cnt+1,cur^bs[i],bs));
}

int main(void){
    while(cin>>N>>M, N|M){
        vector<bitset<500>> bs(N);
        rep(i,N) cin>>bs[i];
        if(N <= 23){
            cout<<dfs(0,0,bitset<500>(""),bs)<<endl;
        }else{
            vector<int> cur(1<<M),nxt(1<<M);
            rep(i,N){
                int bit = bs[i].to_ullong();
                nxt[bit] = max(cur[bit],cur[0]+1);
                rep(mask,1<<M)if(cur[mask]){
                    nxt[bit^mask] = max(nxt[bit^mask],cur[mask]+1);
                }
                cur = nxt;
            }
            cout<<cur[0]<<endl;
        }
    }
    return 0;
}



Measured memory_bytes: 11196
#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<n;++i)
#define RREP(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<n;++i)
#define RFOR(i,m,n) for(ll i=n-1;i>=m;--i)
#define ALL(v) (v).begin(),(v).end()
#define PB(a) push_back(a)
#define UNIQUE(v) v.erase(unique(ALL(v),v.end()));
#define DUMP(v) REP(i, (v).size()) { cout << v[i]; if (i != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
///(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)///
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vi v(n);
	REP(i, n)cin >> v[i];
	int ans = INF;
	FOR(i, -100, 101) {
		int tmp = 0;
		REP(j, n) {
			tmp += (i - v[j])*(i - v[j]);
		}
		ans = min(ans, tmp);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
n, data = int(input()), list(map(int, input().split()))
idx, t = 0, 0
for i in range(n-1):
    for j in range(i, n):
        if j == i:
            idx = j
        elif data[idx] > data[j]:
            idx = j
    if data[i] > data[idx]:
        data[i], data[idx] = data[idx], data[i]
        t += 1
print(" ".join(map(str, data)))
print(t)



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

int main(){
  int X,N;
  cin >> X >> N;
  vector<int> P(N);
  for(int i=0;i<N;i++){
    cin >> P.at(i);
  }
  int i=0;
  while(true){
    int A=X-i,B=X+i;
    bool a=true,b=true;
    for(int j=0;j<N;j++){
      if(A==P.at(j)){
        a=false;
      }
    }
    if(a){
      cout << A << endl;
      return 0;
    }
    for(int j=0;j<N;j++){
      if(B==P.at(j)){
        b=false;
      }
    }
    if(b){
      cout << B << endl;
      return 0;
    }
    i++;
  }
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define ll long long
#define vl vector<ll>
#define pl pair<ll,ll>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,b) for(ll i=0;i<b;i++)
#define RFOR(i,a,b) for(ll i=b-1;i>=a;i--)
#define rsort(v) sort((v).rbegin(), (v).rend())
#define all(v) (v).begin(),(v).end()
using namespace std;
ll mod=1000000007;

signed main(){
    string s;
    while (getline(cin, s)) {
        for(int j=0 ; j<26 ; j++){
            for(int i=0 ; i<s.size() ; i++){
                if(s[i]>='a' && s[i]<='z' ) s[i] = (s[i]=='z')? 'a' : s[i] + 1;
            }
            if( s.find( "the" ) != string::npos || s.find( "this" ) != string::npos || s.find( "that" ) != string::npos){
                cout << s << endl;
            }
        }
    }
}



Measured memory_bytes: 2996
A, B, C = map(int, input().split())
count = 0
while A % 2 == B % 2 == C % 2 == 0:
    A, B, C = (B+C)//2, (A+C)//2, (C+A)//2
    count += 1
    if A == B == C:
        print(-1)
        break
else: print(count)

Measured memory_bytes: 3060
// https://atcoder.jp/contests/abc159/tasks/abc159_e
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;

int main()
{
    int H, W, K;
    cin >> H >> W >> K;
    vector<string> S;
    for (int i = 0; i < H; ++i)
    {
        string str;
        cin >> str;
        S.push_back(str);
    }

    int ans = H * W; // 分割回数の最小値
    // 横方向の割り方 2^(H - 1) 通りを全探索(bit探索)
    for (int bit = 0; bit < (1 << (H - 1)); ++bit)
    {
        // bit の各桁に応じてグループ分け
        vector<int> groupid(H, 0);
        int totalgroup = 1; // グループの総数
        for (int i = 0; i < H - 1; ++i)
        {
            if (!(bit & (1 << i)))
            {
                // 1 の場合: 分割線を入れるので別グループとして通し番号を入れる
                groupid[i + 1] = groupid[i] + 1;
                ++totalgroup;
            }
            else
            {
                // 0 の場合: 同じグループに属しているので通し番号も同じ
                groupid[i + 1] = groupid[i];
            }
            
        }

        int totalline = totalgroup - 1; // 現在の試行における分割回数
        bool update = true; // 最小値の候補かどうか
        vector<int> whitenum(totalgroup, 0);
        // 縦方向の分割をなるべく少なくする
        // すなわち、 K を超える手前で線を入れる
        int add = 0;
        for (int x = 0; x < W; ++x)
        {
            bool nextstep = true;
            vector<int> cur(totalgroup, 0);
            for (int y = 0; y < H; ++y)
            {
                cur[groupid[y]] += S[y][x] - '0';
                whitenum[groupid[y]] += S[y][x] - '0';
                if (cur[groupid[y]] > K)
                {
                    // 試行している横方向の分割ではそもそも K を超えてしまうので不可
                    update = false;
                }

                if (whitenum[groupid[y]] > K)
                {
                    // これ以上分割を考える必要がない
                    nextstep = false;
                }

            }

            if (!nextstep)
            {
                ++totalline;
                whitenum = std::move(cur);
            }
        }
        if (update) ans = std::min(ans, totalline);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.InputStreamReader;
import java.io.LineNumberReader;

/**
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_6_D
 * 
 * @author eitatsuro
 * 
 */
public class Main {
    private final static String SPACE = " ";
    
    public static void main(String[] args) {
        try {
            LineNumberReader stdReader = new LineNumberReader(
                    new InputStreamReader(System.in));
            
            String sStr;
            int n = 0;
            int m = 0;
            int[][] a = null;
            int[] b = null;
            while ((sStr = stdReader.readLine()) != null) {
                
                // ????????????????????????
                if (stdReader.getLineNumber() == 1) {
                    String[] inputs = sStr.split(" ");
                    n = Integer.valueOf(inputs[0]);
                    m = Integer.valueOf(inputs[1]);
                    // ??????????´???¨??????
                    a = new int[n][];
                    b = new int[m];
                } else if (stdReader.getLineNumber() <= 1 + n) {
                    // 2????????\??????????????????
                    // ??????????????°(0,1,2,...)
                    int i = stdReader.getLineNumber() - 2;
                    String[] inputs = sStr.split(" ");
                    int j = 0;
                    a[i] = new int[m];
                    for (String input : inputs) {
                        a[i][j] = Integer.parseInt(input);
                        j++;
                    }
                } else if (stdReader.getLineNumber() <= 1 + n + m) {
                    String[] inputsVector = sStr.split(SPACE);
                    int k = stdReader.getLineNumber() - (2+n);
                    b[k] = Integer.parseInt(inputsVector[0]);

                    if (stdReader.getLineNumber() == 1+n+m) break;
                }
            }
            
            int c[] = new int[n];

            // ?????? x ?????????????????????
            for (int i =0; i<n; i++) {
                int temp = 0;
                for (int j = 0; j<m; j++){
                    temp += a[i][j] * b[j];
                }
                c[i] = temp;
            }
            
            // ??¢???????????????
            for (int ci: c){
                System.out.println(ci);
            }

            stdReader.close();
        } catch (Exception e) {
            System.exit(-1);
        }
        
    }
}

Measured memory_bytes: 28112
import java.util.*;

public class Main {
    public static void main(String[] args) {
        try(Scanner scn = new Scanner(System.in)) {
            String row;
            while(!(row = scn.nextLine()).equals(".")) {
                row = row.replaceAll("[^\\(\\)\\[\\]]", "");
                while(row.indexOf("()") >= 0 || row.indexOf("[]") >= 0) {
                    row = row.replaceAll("\\(\\)|\\[\\]", "");
                }
                System.out.println(row.length() > 0 ? "no" : "yes");
            }
        }
    }
}

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

int main()
{
	ll n;
	cin>>n;
	ll count = 0;
	
	for(int i=1; i<n; i++)
	{
		if(n%i == 0)
		count += (n/i)-1;
		else
		count += n/i;
	}
	cout<<count<<endl;
	
	return 0;
}

Measured memory_bytes: 3632
s = list(input())
n = int(input())
op_l = list(input().split() for _ in range(n))

for op in op_l:
    a = int(op[1])
    b = int(op[2])
    if op[0] == 'print':
        print(*s[a:b+1], sep='')
    elif op[0] == 'reverse':
        tmp = list(s[a:b+1])
        cnt = 0
        for i in range(a, b+1):
            cnt += 1
            s[i] = tmp[-cnt]
    elif op[0] == 'replace':
        xx = list(op[3])
        cnt = 0
        for i in range(a, b+1):
            s[i] = xx[cnt]
            cnt += 1


Measured memory_bytes: 6940
#include <bits/stdc++.h>
#include <cassert>
typedef long long int ll;
using namespace std;


int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  int n; cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a.at(i);

  auto solve = [&](int sign) -> ll {
    ll s = 0;
    ll op = 0;
    for (int i = 0; i < n; i++) {
      s += a.at(i);
      if (sign > 0 && s <= 0) {
	op += 1 - s;
	s = 1;
      }else if (sign < 0 && s >= 0) {
	op += s + 1;
	s = -1;
      }
      sign = -sign;
    }
    return op;
  };

  cout << min(solve(1), solve(-1)) << endl;

  return 0;
}



Measured memory_bytes: 640
<?php
 fscanf(STDIN,"%d",$n);
 $mod = 10**9+7;

 function P($a,$n){
   global $mod;
   $re = 1;
   for($i=1;$i<=$n;$i++){
     $re = $re*$a%$mod;
   }
   return $re;
 }
 
 $ans = (P(10,$n)-(2*P(9,$n)-P(8,$n)));
 $ans %= $mod;
 $ans = ($ans+$mod)%$mod;
 echo $ans;

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



int main(){
    int N,M,X;
    cin >> N >> M >> X;
    vector<int> ryoukinzyo(M);
    for(int i = 0;i<M;i++){
        cin >> ryoukinzyo.at(i);
    }

    int F = 0;
    int S = 0;

    for(int j = 0;j<M;j++){
        if(ryoukinzyo.at(j) < X){
            F++;
        }
        else{
            S++;
        }
    }

    cout << min(F,S) << endl;
}

Measured memory_bytes: 256
/*
* @Author: 王文宇
* @Date:   2018-03-11 19:59:33
* @Last Modified by:   王文宇
* @Last Modified time: 2018-03-11 20:01:13
*/
#include <bits/stdc++.h>
using namespace std;
#define _for(i,a,b) for(int i=a;i<=b;i++)
char a[4][4];
int main(int argc, char const *argv[])
{
	_for(i,1,3)
	{
		_for(j,1,3)cin>>a[i][j];
	}
	cout<<a[1][1]<<a[2][2]<<a[3][3]<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 100

void inputData(int *R, int *N)
{
	scanf("%d", N);
	for (int i = 0; i < *N; i++)
	{
		scanf("%d", &R[i]);
	}
}

void traceData(int *R, int N)
{
	int i;
	for (i = 0; i < (N - 1); i++)
	{
		printf("%d ", R[i]);
	}
	printf("%d\n", R[i]);
}

int bubbleSort(int *R, int N)
{
	int isSwapping = 1;
	int swappingCount = 0;
	while (isSwapping)
	{
		isSwapping = 0;
		for (int i = N - 1; i > 0; i--)
		{
			if (R[i - 1] > R[i])
			{
				int temp = R[i];
				R[i] = R[i - 1];
				R[i - 1] = temp;
				isSwapping = 1;
				swappingCount++;
			}
		}

	}
	return swappingCount;
}

int main(void)
{
	int R[MAX], N;
	inputData(R, &N);
	int t = bubbleSort(R, N);
	traceData(R, N);
	printf("%d\n", t);
	return 0;
}

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

int main() {
	vector<char> S(4);
	int count=0;
	int count2=0;
	char data;

	for (int i = 0; i < 4; i++) {
		cin >> S.at(i);
	}

	for (int i = 0; i < 4; i++) {
		if (S.at(0) == S.at(i)) {
			count++;
		}
		else {
			data = S.at(i);
		}
		//if (S.at() == S.at(i))count++;
	}

	for (int i = 0; i < 4; i++) {
		if (data == S.at(i))count2++;
	}

	if (count ==2 &&count2==2) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
n,x,y,z=map(int,input().split())
l=[]
cmin=1000000000
for i in range(n):
  l.append(int(input()))
for i in range(4**n):
  l1=[]
  for j in range(n):
    if i>=4:
      l1.append(i%4)
      i=(i//4)
    elif i!=0:
      l1.append(i)
      i=0
    else:
      l1.append(i)
  c1=0
  c2=0
  c3=0
  d1=0
  d2=0
  d3=0
  l1=l1[::-1]
  for j in range(n):
    if l1[j]==0:
      pass
    elif l1[j]==1:
      c1+=l[j]
      d1+=1
    elif l1[j]==2:
      c2+=l[j]
      d2+=1
    else:
      c3+=l[j]
      d3+=1
  if c1*c2*c3!=0:
    c=abs(c1-x)+abs(c2-y)+abs(c3-z)+(d1+d2+d3-3)*10
    if c<=cmin:
      cmin=c
print(cmin)
    
    
  

Measured memory_bytes: 3188
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
typedef long long ll;
typedef unsigned long long ull;

int A[2][100];
int dp[2][100];

int main()
{
	int N;

	cin >> N;
	rep(i, 2) rep(j, N) cin >> A[i][j];

	rep(i, 2) rep(j, N) {
		if (i == 0 && j == 0) dp[i][j] = A[i][j];
		else if (i == 0) {
			dp[i][j] = dp[i][j - 1] + A[i][j];
		}
		else if (j == 0) {
			dp[i][j] = dp[i - 1][j] + A[i][j];
		}
		else {
			dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]) + A[i][j];
		}
	}

	cout << dp[1][N - 1] << endl;

	return 0;
}


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

// macros
#define pb emplace_back
#define mk make_pair
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define irep(itr, st) for(auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for(auto itr = (st).rbegin(); itr != (st).rend(); ++itr)
#define whole(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define bit(n) (1LL<<(n))
// functions
template <class T>bool chmax(T &a, const T &b){if(a < b){a = b; return 1;} return 0;}
template <class T>bool chmin(T &a, const T &b){if(a > b){a = b; return 1;} return 0;}
template <typename T> istream &operator>>(istream &is, vector<T> &vec){for(auto &v: vec)is >> v; return is;}
template <typename T> ostream &operator<<(ostream &os, const vector<T>& vec){for(int i = 0; i < vec.size(); i++){ os << vec[i]; if(i + 1 != vec.size())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p){os << p.first << " " << p.second; return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << itr->first << ":" << itr->second; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const unordered_map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << itr->first << ":" << itr->second; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
//  types
using ll = long long int;
using P = pair<int, int>;
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1000000007;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
// io
struct fast_io{
  fast_io(){ios_base::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(20);}
} fast_io_;


int main(int argc, char const* argv[])
{
  ll k, x; cin >> k >> x;
  if(500 * k >= x)cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
n,a,b,c,d=map(int, input().split())

if n%a==0:
    x=n//a
else:
    x=n//a+1

if n%c==0:
    y=n//c
else:
    y=n//c+1

s1=x*b
s2=y*d

if s1 < s2:
    print(s1)
else:
    print(s2)
    


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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;

const ll big = 1000000007;
const ll mod = 998244353;

ll n,m,k;



int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("autput.txt","w",stdout);
    ll a,b,c,e;

    cin >> n;
    vl A;
    vl A2;
    for(int c1 = 0; c1 < n; c1++){
        cin >> a;
        A.push_back(a);
        A2.push_back(a);
    }
    sort(all(A2));
    for(int c1 = 0; c1 < n; c1++){
        if(A[c1] <= A2[n/2-1]){
            cout << A2[n/2]<< "\n";
        }
        else{
            cout << A2[n/2-1] << "\n";
        }
    }

    return 0;
}


Measured memory_bytes: 5604