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

#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection"
#pragma ide diagnostic ignored "OCUnusedMacroInspection"
using namespace std;

#define sqr(a) ((a)*(a))
#define forn(i, n) for(int i = 0; i < (int)n; ++i)
#define nrof(i, n) for(int i = (int)n - 1; i >= 0; --i)
#define rep(i, k, n) for(int i = (int)k; i < (int)n; ++i)
#define per(i, k, n) for(int i = (int)k - 1; i >= (int)n; --i)
#define x first
#define y second
#define mp make_pair
#define sz(a) (int)(a.size())
#define pb push_back
#define eb emplace_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

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

const int N = 1e6 + 9;
const int M = 2e3 + 9;
const int INFINT = 1e9 + 9;
const ll INFLL = 1e18 + 9;
const ll MOD = (ll) (1000000007);

vector<int> dx = {-1, 0, 1, 0};
vector<int> dy = {0, -1, 0, 1};

void solve() {
    string s, t;
    cin >> s >> t;
    int ans = INFINT;
    forn(i, sz(s)) {
        int tans = sz(t);
        if (i + sz(t) > sz(s)) break;
        for(int j = i, ind = 0; j < sz(s) && ind < sz(t); j++, ind++) {
            if (s[j] == t[ind]) --tans;
        }
        ans = min(ans, tans);
    }
    cout << ans << endl;
}

int main() {
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

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

    int t = 1;
//    cin >> t;
    while (t--) {
        solve();
    }

    return 0;
}


Measured memory_bytes: 3660
x,y = gets.split.map{|num|num.to_i}
g1 = [1,3,5,7,8,10,12]
g2 = [4,6,9,11]
g3 = [2]
if g1.include?(x) && g1.include?(y)
    puts "Yes"
elsif g2.include?(x) && g2.include?(y)
    puts "Yes"
elsif g3.include?(x) && g3.include?(y)
    puts "Yes"
else
    puts "No"
end

Measured memory_bytes: 1788
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vector<ll>> mat;

int main(){
    int N,W;cin>>N>>W;
    int w[110],v[110];
    for(int i=1;i<=N;i++)cin>>w[i]>>v[i];

    mat dp(110,vec(100010));

    //初期化
    for(int j=1;j<=100010;j++)dp[0][j]=(ll)pow(10,18);
    for(int i=0;i<=N;i++)dp[i][0]=0;
    //漸化式
    for(int i=1;i<=N-1;i++){
        for(int j=1;j<=100005;j++){
            if(v[i]>j) dp[i][j]=(ll)min((ll)w[i],dp[i-1][j]);
            else       dp[i][j]=(ll)min(dp[i-1][j],(ll)w[i]+dp[i-1][j-v[i]]);
        }  
    }
    int j=1;
    while(true){
        if(v[N]>j) dp[N][j]=(ll)min((ll)w[N],dp[N-1][j]);
        else       dp[N][j]=(ll)min(dp[N-1][j],(ll)w[N]+dp[N-1][j-v[N]]);

        if(dp[N][j]<=W)j++;
        else {
            j--;break;
        }
    }

    cout<<j<<endl;
    return 0;
}

Measured memory_bytes: 87296
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define Ans(f, y, n) if(f) cout << y << endl; else cout << n << endl;
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i, v.size()){ cout << v[i] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

template<typename T> void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }

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

const int mod = 1000000007;
//const int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int N; cin >> N;

    int ans = 0;
    int M = 1000000;
    map<int, bool> used;
    FOR(m, 1, M + 1){
        if(N / m == N % m){
            ans += m;
            used[m] = true;
        }
    }
    FOR(r, 1, M + 1) if(N % r == 0) {
        int m = N / r - 1;
        if(m > 0 && N / m == N % m && !used[m]){
            ans += m;
            used[m] = true;
        }
    }
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 512
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>
using namespace std;

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using ull = unsigned long long;
using Complex = complex<ld>;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
// default_random_engine generator;
// mt19937 rnd(1);

const ld PI = acosl(-1);

int main() {
#ifdef LOCAL
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);  
#endif 
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0); 
    cout.precision(12);
    cout << fixed; 

    int n, l;
    cin >> n >> l;

    vector<ld> angle(n); 
    vector<Complex> a(n);

    for (int i = 0; i < n; ++i) {
        ld alpha;
        cin >> alpha;
        alpha /= l;
        alpha *= 2 * PI;
        angle[i] = alpha;
        a[i] = {cosl(alpha), sinl(alpha)};
    }

    Complex res = 0;

    for (int i = 0; i < n; ++i) {
        Complex sum = 0;
        ld k = 0;
        for (int j = (i + 1 == n ? 0 : i + 1); j != i; j = (j + 1 == n ? 0 : j + 1)) {
            ld alpha = (angle[i] + angle[j]) / 2;
            if (i < j) {
                alpha += PI;
            }
            Complex v = {cosl(alpha), sinl(alpha)};
            ld len = sqrtl(2 - 2 * cosl(alpha - angle[i]));
            ld len2 = 2 - 2 * cosl(alpha - angle[i]);

            Complex cur = sum * len;
            cur *= (a[i] - v) / len;
            cur += v * (k / (n - 2));
            
            res += cur;

            sum += (a[j] - v) * conj(a[i] - v) / len2 / ld(n - 2); 
            k += 1;

        }
    }

    res /= n * (n - 1) / 2;

    cout << res.real() << " " << res.imag() << endl;

#ifdef LOCAL
    cerr << "Time: " << double(clock()) / CLOCKS_PER_SEC << endl;
#endif
}


Measured memory_bytes: 384
#include <bits/stdc++.h>  // ver2.2.2
#define int long long
#define endl "\n"
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define VVi vector<Vi>
#define Vs vector<string>
#define Pii pair<int,int>
#define VPii vector<Pii>
#define Tiii tuple<int,int,int>
#define PQi priority_queue<int>
#define PQir priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define itos to_string
#define stoi stoll
#define FI first
#define SE second
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define sortr(v) sort(v,greater<>())
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define dem(a,b) ((a+b-1)/(b))
#define Vin(a) rep(iI,0,a.size())cin>>a[iI]
#define Vout(a) rep(lZ,0,a.size()-1)cout<<a[lZ]<<' ';cout<<a.back()<<endl
#define VVout(a) rep(lY,0,a.size()){Vout(a[lY]);}
#define VPout(a) rep(lX,0,a.size())cout<<a[lX].FI<<' '<<a[lX].SE<<endl
#define INF 3000000000000000000  //  3.0*10^18(MAXの1/3くらい)
#define MAX LLONG_MAX
#define MOD 1000000007  //  10^9 + 7
using namespace std;
int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm
void uniq(Vi &v){sort(ALL(v)); v.erase(unique(ALL(v)),v.end());}  //  uniqのやつ
int mypow(int x, int n, int m){  //  累乗x^n(mod m)  O(log(n))
if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}
int digisum(int n){int s=0;while(n!=0){s+=n%10;n/=10;}return s;}  //  桁和
int stpow(int n){if(n==0)return 1;int a=1;rep(i,1,n+1)a=a*i%MOD;return a;}
Vi stpowV(){Vi a(100001);a[0]=1;repeq(i,1,100000)a[i]=a[i-1]*i%MOD;return a;}
vector<int> divisor(int n){  //  約数列挙 O(√n)
Vi r;for(int i=1;i*i<=n;i++){if(n%i==0){r.pb(i);if(i*i!=n)r.pb(n/i);}}sort(ALL(r));
return r;}
vector<pair<int,int>> fac(int n) {  //  素因数分解
vector<Pii>r;for(int i=2;i*i<=n;++i){if(n%i)continue;r.emplace_back(i,0);while(n%i==0){
n/=i;r.back().second++;}}if(n!=1)r.emplace_back(n,1);return r;}
bool prime(int n){  //  素数判定
if(n<2)return false;else if(n==2)return true;else if(n%2==0)return false;
double s=sqrt(n);for(int i=3;i<=s;i+=2){if(n%i==0){return false;}}return true;}
Vi primevec(){  //  素数配列
int N=1000000;int l[N];Vi a(0);for(int i=0;i<N;i++){l[i]=1;}for(int i=2;i<sqrt(N);i++){
if(l[i]){for(int j=0;i*(j+2)<N;j++){l[i*(j+2)]=0;}}}for(int i=2;i<N;i++){if(l[i]){
a.pb(i);}}return a;}
int comb(int n, int r){  //  nCr (MOD環境下)
int a=1;for(int i=n;i>n-r;--i){a=a*i%MOD;}for(int i=1;
i<r+1;++i){a=a*mypow(i,MOD-2,MOD)%MOD;}return a%MOD;}



signed main() {
  cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(12);
  int n,m;
  cin >> n >> m;
  int ans = n-2*m;
  cout<< max(0LL,ans) <<endl;
  return 0;
}

Measured memory_bytes: 256
#include<map>
#include<set>
#include<bitset>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<chrono>
#include<stack>
#include<fstream>
#include<list>
#define REP(i,x,y) for(ll i=x;i<=y;i++)
#define SIZE(a) ll(a.size())
#define vll vector<ll> 
#define MEMSET(a, n, m) for(ll i=0;i<=n;i++) a[i] = m
#define BIT(n) (ll(1)<<n)
#define UNIQUE(v) v.erase(unique(v.begin(),v.end()),v.end()) 
#define UNIQUE_ARRAY(a,x) unique(a + 1, a + x + 1) - a - 1
#define SORT(a,n) sort(a+1,a+n+1)
#define SORT_O(a,n,order) sort(a+1,a+n+1,order)
#define PER(i,y,x) for(ll i=y;i>=x;i--)
typedef long long ll;
using namespace std;


struct edge
{
	long long to; long long len;
	bool operator<(const edge& rhs) const {
		return len > rhs.len;
	}
};
ll const MAX = 1e3 + 5;
ll x[MAX];
ll y[MAX];
ll len[MAX];
ll mx[MAX][MAX], my[MAX][MAX];

ll const ARMS = 36;
void f(ll z[], ll mz[MAX][MAX], ll k) {
	ll val = z[k];
	//cout << z[k] << endl;
	PER(i,  ARMS-1, 0) {
		if (val > 0) {
			mz[k][i] = -1;
			val -= len[i];
		}
		else {
			mz[k][i] = 1;
			val += len[i];
		}
	//	cout << val << endl;
	}
	//cout << "?" << endl;
}

char g(ll i, ll j) {
	ll u = mx[i][j] * 2 + my[i][j] * 1;
	if (u == 3) {
		return 'L';
	}
	else if (u == 1) {
		return 'U';
	}
	else if (u == -1) {
		return 'D';
	}
	else {
		return 'R';
	}
}

int main() {
	cin.tie(0);
	ll n; cin >> n;
	REP(i, 1, n) {
		ll a,b;
		cin >> a >> b;
		x[i] = a - b;
		y[i] = a + b;
		if ((x[i] + x[1]) % 2 == 1) {
			cout << -1 << endl;
			return 0;
		}
	}
	REP(i, 0,  ARMS-1) {
		len[i] = BIT(i);
	}
	bool eve = 0;
	if (x[1] % 2 == 0) {
		eve = 1;
		REP(i, 1, n) {
			x[i]++;
			y[i]++;
		}
	}
	REP(i, 1, n) {
		f(x, mx, i);
		f(y, my, i);
	}
	cout << ARMS + eve << endl;
	REP(i, 0,  ARMS-1) {
		cout << len[i];
		if (i <  ARMS-1) {
			cout << " ";
		}
	}
	if (eve) {
		cout << " " << 1;
	}
	cout << endl;
	REP(i, 1, n) {
		REP(j, 0,  ARMS-1) {
			cout << g(i, j);
		}
		if (eve) {
			cout << "L";
		}
		cout << endl;
	}
}

Measured memory_bytes: 14464
/********************************************
 *Author*        :ZZZZone
 *Created Time*  : 六  9/23 20:33:37 2017
 * Ended  Time*  : 六  9/23 21:00:24 2017
*********************************************/

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <stack>
using namespace std;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;
const int MaxN = 100;
int cnt[30];
int n, m;

int main()
{
	while(~scanf("%d %d", &n, &m)){
		for(int i = 1; i <= n; i++){
			for(int j = 1; j <= m; j++){
				char c;
				scanf(" %c", &c);
				cnt[c - 'a']++;
			}
		}
		int num1 = 0, num2 = 0, num4 = 0;
		for(int i = 0; i < 26; i++){
			int temp = cnt[i] / 4;
			num4 += temp;
			cnt[i] -= 4 * temp;
			temp = cnt[i] / 2;
			num2 += temp;
			cnt[i] -= 2 * temp;
			temp = cnt[i];
			num1 += temp;
		}
		bool flag = true;
		int ok1 = n & 1, ok2 = m & 1;
		if(ok1 + ok2 == 2){
			int ned2 = (n + m - 2) / 2;
			int ned4 = (n * m - ned2 * 2 - 1) / 4;
			num4 -= ned4;
			num2 += max(0, num4) * 2;
			num4 -= max(0, num4);
			num2 -= ned2;
			if(num2  != 0 || num4 != 0 || num1 != 1) flag = false;
		}
		else if(ok1 + ok2 == 1){
			if(n & 1) swap(n, m);
			int ned2 = n / 2;
			int ned4 = (n * m - n) / 4;
			num4 -= ned4;
			num2 += max(0, num4) * 2;
			num4 -= max(0, num4);
			num2 -= ned2;
			if(num2 != 0 || num4 != 0 || num1 != 0) flag = false;
		}
		else if(ok1 + ok2 == 0){
			int ned4 = n * m / 4;
			num4 -= ned4;
			if(num4 != 0 || num2 != 0 || num1 != 0) flag = false;
		}
		if(flag) printf("Yes\n");
		else printf("No\n");
	}
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#include <iomanip>
#define ll long long int
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};
int mx2[] = {1,0};
int my2[] = {0,1};

class ARGBCards {
public:
	void solve(istream& in, ostream& out) {
        int a,b,c; in >> a >> b >> c;
        int d = a * 100 + b * 10 + c;
        if(d % 4 == 0) out << "YES" << endl;
        else out << "NO" << endl;
	}
};

int main() {
	ARGBCards solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func readInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func readString() string {
	sc.Scan()
	return sc.Text()
}

func readInt64() int64 {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return int64(i)
}

func readfloat64() float64 {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return float64(i)
}

func abs(a int) int {
	if a < 0 {
		return a * -1
	}
	return a
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	sc.Split(bufio.ScanWords)

	n := readInt()
	l := make([]int, n)
	for i := 0; i < n; i++ {
		l[i] = readInt()
	}

	sort.Sort(sort.IntSlice(l))

	ans := 0
	for i := 0; i < n-2; i++ {
		for j := i + 1; j < n-1; j++ {
			right := n
			left := j
			for right-left > 1 {
				middle := (right + left) / 2
				a, b, c := l[i], l[j], l[middle]
				if check(a, b, c) && check(b, c, a) && check(c, a, b) {
					left = middle
				} else {
					right = middle
				}
			}
			if left != j {
				ans += left - j
			}
		}
	}
	fmt.Println(ans)
}

func check(a, b, c int) bool {
	return a < b+c
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int a[106];
int main()
{
    int n;
    cin>>n;
    int ans=0;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        if(i%2&&a[i]%2){
            ans++;
        }
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 3756
#include <iostream>
#include<iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
#define P pair<int,int>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

int main(){
    
    int a,b;
    bool bre = false;
    char g[200][200];
    cin >> a>>b;
    a--;b--;
    rep(i,50){
        rep(j,100){
            g[i][j]='#';
            g[i+50][j]='.';
        }
    }
    
    for(int h = 1;h<49;h+=2){
        for(int w = 1;w<99;w+=2){
            if(a==0){
                bre = true;
                break;
            }
            g[h][w] = '.';
            a--;
        }
        if(bre)break;
    }
    
    bre = false;
    
    for(int h = 51;h<100;h+=2){
        for(int w = 1;w<99;w+=2){
            if(b==0){
                bre = true;
                break;
            }
            g[h][w] = '#';
            b--;
        }
        if(bre)break;
    }
    
    cout << 100<<' '<<100<<endl;
    
    rep(i,100){
        rep(j,100){
            cout << g[i][j];
        }
        cout << endl;
    }
    
    return 0;
}


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

#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)

using namespace std;

using ll = long long;
using P = pair<int, int>;

int main() {
  int h, w, k;
  cin >> h >> w >> k;
  vector<vector<char>> c(h, vector<char>(w));
  rep(i, h) {
    rep(j, w) {
      char cc;
      cin >> cc;
      c.at(i).at(j) = cc;
    }
  }
  int res = 0;
  int n = h + w;
  for (int bit = 0; bit < (1 << n); bit++) {
    vector<vector<char>> tmpC(c);
    for (int i = 0; i < n; i++) {
      if (bit & (1 << i)) {
        if (i < h) {
          // height
          rep(j, w) {
            if (tmpC.at(i).at(j) == '#') {
              tmpC.at(i).at(j) = '.';
            }
          }
        } else {
          // width
          rep(j, h) {
            if (tmpC.at(j).at(i - h) == '#') {
              tmpC.at(j).at(i - h) = '.';
            }
          }
        }
      }
    }
    int tmpTotal = 0;
    rep(i, h) {
      rep(j, w) {
        char cc = tmpC.at(i).at(j);
        if (cc == '#') {
          tmpTotal++;
        }
      }
    }
    if (tmpTotal == k) {
      res++;
    }
  }
  cout << res << endl;
  return 0;
}


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

typedef long long ll;
const ll INF = 1e9, MOD = 1e9 + 7;
const double EPS = 1e-9, PI = 3.141592653589793;
#define Cin(x) cin >> x
#define Cin2(x,y) cin >> x >> y
#define Cin3(x,y,z) cin >> x >> y >> z
#define Cin4(w,x,y,z) cin >> w >> x >> y >> z
#define Cout(x) cout << x << "\n"
#define Cout2(x,y) cout << x << y << "\n"
#define Cout3(x,y,z) cout << x << y << z << "\n"
#define Cout4(w,x,y,z) cout << w << x << y << z << "\n"
#define Kaigyou cout << "\n"
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define REPR(i,a,b) for(ll i=b;i>=a;i--)
#define repr(i,n) REPR(i,0,n)
#define Size(n) (n).size()
#define All(v) (v).begin(), (v).end()

ll gcd(ll x,ll y){
    return y ? gcd(y,x%y) : x;
}

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

    ll n,a[100001],ans;
    Cin(n);
    rep(i,n) Cin(a[i]);
    ans = gcd(a[0],a[1]);
    if(n>=3){
        REP(i,2,n){
            ans = gcd(ans,a[i]);
        }
    }
    Cout(ans);
    return 0;
}

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

int main(){
  string s;
  cin>>s;
  int n=s.size();
  int count=0;
  for(int i=0; i<(n/2); i++){
    if(s.at(i)!=s.at(n-i-1)) count++;
  }
  cout<<count<<endl;
  
}

Measured memory_bytes: 384
open Scanf
open Printf

let flip f x y = f y x

let rec range a b = if a >= b then [] else a :: range (a+1) b

let read_int () = scanf " %d" (fun x -> x)
let rec read_ints n = if n = 0 then [] else let i = read_int () in i :: read_ints (n-1)

let rec for_iter a b f = if a >= b then [] else let x = f a in x :: for_iter (a+1) b f
let rec for_iter_ a b f = if a >= b then () else f a; for_iter_ (a+1) b f

let list_of_string str =
  let len = String.length str in
  let rec f i = if i >= len then [] else str.[i] :: f (i+1) in
  f 0

let () = read_line ()
  |> list_of_string
  |> List.filter ((==) '1')
  |> List.length
  |> printf "%d\n"


Measured memory_bytes: 384
w,h,x,y = map(int, input().split())


if w == 0 or h == 0:
    print(0,0)

if x == 0 or y == 0:
    print(h*w/2, 0)
else:
    if y/x == h/w:
        if x != w and y != h:
            num = 1
        else:
            num = 0
    else:
        num = 0

    print(h*w/2, num)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pb emplace_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define F first
#define S second
#define vll vector<ll>
#define fast ios:: sync_with_stdio(false),cin.tie(0);
#define COUT cout<<fixed<<setprecision(12)
#define CIN getline(cin,s)
#define SET set<ll,greater<ll>>gquiz
#define ITERATOR set<ll,greater<ll>> :: iterator itr
#define V vector<ll>vector
#define sz size()
#define A vector<pair<ll,ll>>vect
ll N=100000,M=100000;
#define B vect.push_back(make_pair(N,M));
ll MOD=1000000007;
unordered_map<ll,bool>check;

void solve()
{
	ll n;
	cin>>n;
	if(n>=30)
	cout<<"Yes\n";
	else
	cout<<"No\n";
}

int main()
{
	ll t=1;
	//cin>>t;
	while(t--)
	solve();
}

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


double r(string s){
	if( s == "north" ) return 0;
	if( s == "west" ) return 90;
	int n = count(s.begin(),s.end(),'w') + count(s.begin(),s.end(),'n') - 1;
	if( s[0] == 'n' ){
		return r(s.substr(5)) - 90. / (1<<n);
	}else{
		return r(s.substr(4)) + 90. / (1<<n);
	}
}

char to(int x){
	if( x < 10 ) return x + '0';
	else return x + 'A' - 10;
}
int prob[1000][36];
int main(){
	int n,m,q;
	while(cin >> n >> m >> q && n){

		for(int i = 0 ; i < m ; i++)
			for(int j = 0 ; j < n ; j++)
				prob[i][j] = true;
		string prev = string(m,'0');
		for(int _ = 0 ; _ < q ; _++){
			string a,b;
			cin >> a >> b;
			string tmp = b;
			for(int i = 0 ; i < m ; i++){
				b[i] = (b[i]!=prev[i]?'1':'0');
			}
			for(int i = 0 ; i < a.size() ; i++){
				for(int j = 0 ; j < b.size() ; j++){
					if( a[i] != b[j] ){
						prob[j][i] = 0;
					}
				}
			}
			prev = tmp;
		}
		for(int i = 0 ; i < m ; i++){
			int c = count(prob[i],prob[i]+n,1);
			
			if( c == 1 ) cout << to(find(prob[i],prob[i]+n,1) - prob[i]);
			else cout << '?';
			
		}
		cout << endl;
	}
}

Measured memory_bytes: 1360
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
typedef vector<vector<ll>> mat;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<60;
double pi=3.141592653589793238462643383279L;
double eps=1e-14;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define mrep(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll c=gcd(a,b);
    return a*b/c;
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
    now%=md;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll popcount(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}


int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    string s;cin>>s;
    reverse(s.begin(),s.end());
    string u[4]={"maerd","remaerd","esare","resare"};
    string t="";
    int num=0;
    int n=s.size();
    for(;;){
        if(num==s.size()){
            cout<<"YES"<<endl;
            return 0;
        }
        if(n-num<5){
            cout<<"NO"<<endl;
            return 0;
        }
        string now=s.substr(num,5);
        if(now==u[0]){
            t+=now;
            num+=5;
            continue;
        }
        else if(now==u[2]){
            t+=now;
            num+=5;
            continue;
        }
        if(n-num<6){
            cout<<"NO"<<endl;
            return 0;
        }
        now=s.substr(num,6);
        if(now==u[3]){
            t+=now;
            num+=6;
            continue;
        }
        if(n-num<7){
            cout<<"NO"<<endl;
            return 0;
        }
        now=s.substr(num,7);
        if(now==u[1]){
            t+=now;
            num+=7;
            continue;
        }
        cout<<"NO"<<endl;
        return 0;
    }
}





Measured memory_bytes: 592
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,s,n) for (int i = (s); i < (n); ++i)
#define rrep(i,n,g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define len(x) (int)(x).size()
#define dup(x,y) (((x)+(y)-1)/(y))
#define append push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  string s;
  cin >> s;
  rep(i,0,3) {
    if (s[i] == '1') cout << 9;
    else cout << 1;
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 3564
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

#define _USE_MATH_DEFINES

#include <stdio.h>
#include <iostream>
#include <vector>
#include <unordered_map>
#include <stack>
#include <list>
#include <math.h>
#include <map>
#include <iomanip>
#include <functional>
#include <string>
#include <algorithm>
#include <queue>
#include <set>

using namespace std;

template<class T> ostream& operator<<(ostream& os, const vector<T>& v) {
	for (auto i = begin(v); i != end(v); i++) os << *i << (i == end(v) - 1 ? "" : " "); return os;
}
template<class T> istream& operator>>(istream& is, vector<T>& v) {
	for (auto i = begin(v); i != end(v); i++) is >> *i; return is;
}

int dsu[101000];

int find(int x)
{
	if (dsu[x] == x)
		return x;
	return dsu[x] = find(dsu[x]);
}

void unite(int x, int y)
{
	dsu[find(x)] = find(y);
}

int main()
{
#if defined(_DEBUG) 
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	cin.tie(NULL);
	ios_base::sync_with_stdio(false);
	cout.tie(NULL);

	int n, m;
	cin >> n >> m;
	vector<int> vec(n);
	for (int i = 0; i < n; i++)
		cin >> vec[i];

	for (int i = 0; i < n; i++)
		dsu[i] = i;
	for (int j = 0; j < m; j++)
	{
		int a, b;
		cin >> a >> b;
		a--, b--;
		unite(a, b);
	}

	map<int, set<int>> pos;
	for (int i = 0; i < n; i++)
		pos[find(i)].insert(i);

	int ans = 0;
	for (auto it : pos)
	{
		for (int u : it.second)
		{
			if (it.second.find(vec[u] - 1) != it.second.end())
				ans++;
		}
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 15104
#include <iostream>
#include <string>
#include <algorithm>
#include <ctime>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cassert>
#include <bitset>
#include <list>
#include <cstdio>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <cmath>
#include <tuple>
#include <cassert>
#include <array>
#include <iomanip>

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using ti = tuple<int, int, int>;

#define REP(i,m,n) for(int i=(m); i<(n); i++)
#define RREP(i,n,m) for(int i=(n);i>=(m); i--)
#define pb push_back
#define mp make_pair
#define debug(x) cerr << #x << ": " << x << endl
// #define int long long 

const double eps=1e-14;
const int mod = 1e9 + 7;
const int inf = ((1<<30)-1);
const ll linf = (1LL<<60);
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    int ans = 0;
    REP(i,a,b+1)
    {
        string s;
        s = to_string(i);
        bool ok = true;
        int si = s.size();
        REP(i,0,si)
        {
            if(s[i] != s[si-1-i]) ok = false;
        }
        if(ok) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e9;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
int main(){
	bool m[300][300]={0};
	m['i']['i']=true;
	m['w']['w']=true;
	m[')']['(']=true;
	m['('][')']=true;
	m[']']['[']=true;
	m['['][']']=true;
	m['}']['{']=true;
	m['{']['}']=true;
	string s;
	cin>>s;
	int n=s.size();
	int out=0;
	loop(i,1,1<<n){
		string t="";
		rep(j,n)if(i&(1<<j))t+=s[j];
		if(t.size()%2==0)continue;
		bool h=true;
		rep(j,t.size()/2)if(m[t[j]][t[t.size()-1-j]]==0)h=false;
		if(t[t.size()/2]!='w')h=false;
		if(h&&out<t.size())out=t.size();
	}
	cout<<out<<endl;
}
 

Measured memory_bytes: 1292
#include<bits/stdc++.h>
using namespace std;
main(){
	string s;
	cin>>s;
	if(s=="SUN")cout<<"7\n";
	else{
		if(s[0]=='S')cout<<"1\n";
		else if(s[0]=='M')cout<<"6\n";
		else if(s[0]=='T'){
			if(s[1]=='U')cout<<"5\n";
			else cout<<"3\n";
		}
		else if(s[0]=='W')cout<<"4\n";
		else cout<<"2\n";
 	}
}

Measured memory_bytes: 256
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <utility>
#include <vector>

using namespace std;

int main()
{
    int h,n,a;
    long long b;
    cin >> h >> n;
    
    int aa[n], bb[n];
    long long dp[n+1][h+1];
    
    //initialization
    for(int i=0;i<n+1;i++){
        dp[i][0]=0;
    }
    for(int i=0;i<h+1;i++){
        dp[0][i]=100000000000000;
    }  
    
    for(int i=0;i<n;i++){
        cin >> a >> b;
        aa[i] = a;
        bb[i] = b;
    }
    
    for(int i=1;i<n+1;i++){
        a = aa[i-1];
        b = bb[i-1];
        for(int j=1; j<h+1; j++){
            if(j<a){
                dp[i][j]=min(dp[i-1][j], 0+b);
            }else{
                dp[i][j]=min(dp[i-1][j], dp[i][j-a]+b);
            }
        }
    }
/*
    for(int i=0;i<n+1;i++){
        for(int j=0;j<h+1; j++){
            cout << dp[i][j] <<" ";
        }
        cout << endl;
    }
*/  
    std::cout << dp[n][h] << std::endl;
}

// GCC reference:
//   https://gcc.gnu.org/

// C++ language references:
//   https://cppreference.com/
//   https://isocpp.org/
//   http://www.open-std.org/jtc1/sc22/wg21/

// Boost libraries references:
//   https://www.boost.org/doc/


Measured memory_bytes: 78464
/*
「pivotを中間に、大きいものと小さいものを交換していく」
という感じではなく、
「pivotより小さいものを探して、前の方に詰めていく（添え字iのとこ）」
という感じである。

*/

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
	int i,j;
    int n;
    int buf;
    int p,q,r,pivot;
    vector<int> A;
    
    cin >> n;
    for(i=0;i<n;i++){
        cin >> buf;
        A.push_back(buf);
    }
    
	p=0;
	r=n-1;
	//Partition(A, p, r);
    pivot = A[r];
	i=p-1;
	for(j=p; j<r; j++){
		if(A[j]<=pivot) {
			i++;
			swap(A[i],A[j]);
		}
	}
	swap(A[i+1],A[r]);
	q=i+1; //return i+1;

    
    //出力
    for(i=0;i<n;i++){
        if(i==q) cout << "[" << A[i] << "]" ;
        else cout << A[i];
        
        if(i==n-1) cout << endl;
        else cout << " ";
    }
    
	return 0;
}

Measured memory_bytes: 1676
#include<iostream>
using namespace std;
int main(){
	long long k,d=0;string s;char c;
	cin>>s>>k;
	for(int i=0;i<k;i++){
		if(s[i]=='1')d++;
		else {
		c=s[i];
		break;
		}
	}
	if(d==k)cout<<"1"<<endl;
	else cout<<c<<endl;
}

Measured memory_bytes: 256
long a,b,c,n;
main()
{
	scanf("%ld",&n);
	for(a=1;a<=3500;a++)for(b=a;b<=3500;b++)
	{
		long u=n*a*b,p=4*a*b-n*a-n*b;
		if(p>0&&u%p==0)
		{
			printf("%ld %ld %ld\n",a,b,u/p);
			return 0;
		}
	}
}

Measured memory_bytes: 128
import java.util.ArrayList;
import java.util.Scanner;

class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int playerNum = sc.nextInt();
        int firstPoint = sc.nextInt();

        ArrayList<Integer> playerPoint = new ArrayList<>();

        for(int i = 0 ; i < playerNum; i++){
            playerPoint.add(0);
        }

        int cnt = sc.nextInt();
        for(int i = 0 ; i < cnt; i++){
            int p = sc.nextInt();
            playerPoint.set(p - 1, playerPoint.get(p - 1) + 1);
        }

        for(int i = 0; i < playerNum; i++){
            System.out.println(firstPoint - cnt + playerPoint.get(i) > 0 ? "Yes" : "No");
        }
    }
}

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

using namespace std;
const long long MOD = 1000000007LL;

int main() {
    long long n, k; cin >> n >> k;
    vector<long long> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    long long ans = 0;
    for (int i = 0; i < n; ++i) {
        long long num = 0;
        for (int j = i+1; j < n; ++j) {
            if (a[i] > a[j]) {
                ++num;
            }
        }
        ans = (ans + num * k) % MOD;
    }
    const long long p = (k-1) * k / 2 % MOD;
    for (int i = 0; i < n; ++i) {
        long long num = 0;
        for (int j = 0; j < n; ++j) {
            if (a[i] > a[j]) {
                ++num;
            }
        }
        ans = (ans + num * p) % MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P std::pair<int,int>
#define PiP std::pair<int,std::pair<int,int>>
#define all(v) v.begin(),v.end()
#define mkp std::make_pair
#define prique(T) std::priority_queue<T,vector<T>,greater<T>>
using namespace std;
template<class T> inline void chmax(T& a, T b) { a = std::max(a, b); }
template<class T> inline void chmin(T& a, T b) { a = std::min(a, b); }

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
int get_rand(int MIN, int MAX) {
	std::random_device rnd;
	std::mt19937_64 mt64(rnd());
	std::uniform_int_distribution<int>engine(MIN, MAX);
	return engine(mt64);
}
/*--------Library Zone!--------*/

int n;
map<int, int>mp;
int shuru[333333];
signed main() {
	cin >> n;
	rep(i, n) {
		int a; cin >> a; mp[a]++;
	}
	int ma = 0;
	for (auto p : mp) {
		shuru[p.second]++;
		chmax(ma, p.second);
	}
	int siz = mp.size();
	REP(i, n + 1) {
		if (siz < i)cout << 0 << endl;
		else {
			int s[333333];
			s[0] = 0;
			REP(j, ma + 1)s[j] = shuru[j];
			int mab = ma;
			int ans = 0;
			bool flag;
			while (mab) {
				flag = false;
				if (s[mab] > i) {
					int plus = s[mab] / i;
					s[mab - 1] += plus * i;
					s[mab] -= plus * i;
					ans += plus;
					flag = true;
				}
				else {
					int cnt = 0;
					int memo = 0;
					for (int j = mab; j > 0; j--) {
						if (cnt + s[j] >= i) {
							s[j] += memo;
							s[j] -= i - cnt;
							s[j - 1] += i - cnt;
							mab--;
							ans++;
							flag = true;
							break;
						}
						int memo2 = s[j];
						s[j] = 0;
						s[j] += memo;
						memo = memo2;
						cnt += memo2;
					}
				}
				if (!flag)break;
			}
			cout << ans << endl;
		}
	}
}


Measured memory_bytes: 18944
import java.util.ArrayList;
import java.util.Scanner;


public class Main
{
	static ArrayList<Integer> prime = new ArrayList<>();
	
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		
		create();
		
		for(; ;)
		{
			int count = 0;
			int n = scanner.nextInt();
			if(n == 0)
			{
				break;
			}			
            for(int i=0; i<prime.size(); i++)
            {
            	int num = n-prime.get(i);
            	if(num == prime.get(i))
            	{
            		count ++;
            	}
            	else if (num > prime.get(i)) 
            	{				
            		if(isPrime(num))
            		{
            			count ++;
            		}
            	}
            	else
            	{
            		break;
            	}
            }
            System.out.println(count);
		}
	}
	
	static void create()
	{
		for(int i=2; i<=50000; i+=(i==2)?1:2)
		{
			if(isPrime(i))
			{
				prime.add(i);
			}	
		}
	}
	
	static boolean isPrime(int n)
	{
		int p = (int)Math.sqrt(n);
		boolean is_prime = true;
		for(int i=2; i<=p; i+=(i==2)?1:2)
		{
			if(n % i == 0)
			{
				is_prime = false;
				break;
			}
		}
		return is_prime;
	}
}

Measured memory_bytes: 42648
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int r,c;
    cin>>r>>c;
    int numbers[r][c];
    for(int i=0;i<r;i++){
        for(int j=0;j<c;j++){
            cin>>numbers[i][j];
        }
    }
    for(int i=0;i<r;i++){
        int sum=0;
        for(int j=0;j<c;j++){
            if(j==c-1){
                cout<<numbers[i][j]<<" "<<numbers[i][j]+sum<<endl;
            }
            else{
                cout<<numbers[i][j]<<" ";
                sum+=numbers[i][j];
            }
        }
    }
    int file=0;
    for(int j=0;j<c;j++){
        int filesum=0;
        for(int i=0;i<r;i++){
            filesum+=numbers[i][j];
            file+=numbers[i][j];
        }
        cout<<filesum<<" ";
    }
    
    cout<<file<<endl;
}



Measured memory_bytes: 3112
#include "bits/stdc++.h"
using namespace std;

int main() {
	long long N, X[41];
	cin >> N;
	X[0] = 2;
	for (int i = 1; i <= N; i++) {
		X[i] = X[i - 1] * 2 + 2;
	}
	cout << X[N];
}

Measured memory_bytes: 256
N,K = map(int,input().split())
a = list(map(int,input().split()))

b = [0] * N

for i in range(N):
    b[a[i]-1] += 1

b.sort(reverse = True)

count = 0
for i in range(K):
    count += b[i]

print(N-count)


Measured memory_bytes: 25748
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main
{
	public static void main(String[] args)
	{
		try
		{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			int num = Integer.parseInt(br.readLine());

			int[][][] dom = new int[4][3][10];
			String[] bfrv = new String[4];
			int b=0, f=0, r=0, v=0;
			for(int i=0; i<num; i++)
			{
				bfrv = br.readLine().split(" ");
				b=Integer.parseInt(bfrv[0]);
				f=Integer.parseInt(bfrv[1]);
				r=Integer.parseInt(bfrv[2]);
				v=Integer.parseInt(bfrv[3]);
				dom[b-1][f-1][r-1] += v;
			}
			for(int b1=0; b1<4; b1++)
			{
				for(int f1=0; f1<3; f1++)
				{
					for(int r1=0; r1<10; r1++)
					{
						System.out.print(" " + dom[b1][f1][r1]);
					}
					System.out.println();
				}
				if(b1!=3)	System.out.println("####################");
			}
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 24648
#include<bits/stdc++.h>
#define pi acos(-1)
#define ll long long
#define pii pair<ll,ll>
#define debug(a) cout<<a<<'\n'
#define maxn 100009 /// I wanna be the wind
#define MOD 1000000007
#define F first
#define S second
#define rep(i, a, b) for(ll i = a; i < (b); ++i)
#define per(i, b, a) for(ll i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define all(x) begin(x), end(x)
#define sz(x) (ll)(x).size()
using namespace std;
const ll INF = 1e17 + 9;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    cin>>n;
    ll vet[n+2];
    rep(i,0,n){
        cin>>vet[i];
    }
    sort(vet,vet+n);
    ll ans =0;
    ll cont=n;
    per(i,n,0){
        if(i==n-1){
            ans+=vet[i];
            cont-=2;
        }    
        else{
            ans+=vet[i]*min(cont,2LL);
            cont-=min(cont,2LL);
        }
        // cout<<cont<<'\n'
        if(cont==0)break;
    }
    cout<<ans<<"\n";
    return 0;  
}

Measured memory_bytes: 5204
#include<stdio.h>
#include<string.h>
int main(void){
    int A,B,C;
    scanf("%d %d %d",&A,&B,&C);
    if((A>=B)&&(A>=C)){
        if(B>C){
            printf("%d",A-C);
        }else{
            printf("%d",A-B);
        }
    }else if((B>=A)&&(B>=C)){
        if(A>C){
            printf("%d",B-C);
        }else{
            printf("%d",B-A);
        }
    }else if((C>=B)&&(C>=A)){
        if(B>A){
            printf("%d",C-A);
        }else{
            printf("%d",C-B);
        }
    }
    return 0;
}

Measured memory_bytes: 128
n,a,b = map(int,input().split())
s=0
sums=0
for i in range(1,n+1):
    global sums
    global s
    i=str(i)
    for j in range(len(i)):
        s+=int(i[j])
    if a<=s<=b:
        sums+=int(i)
    s=0
print(sums)

Measured memory_bytes: 3060
# if true

# include <iostream>
# include <string>
# include <vector>

int main()
{

    int H, W;
    std::cin >> H >> W;

    std::vector<std::string> data(H);
    for (auto& val : data) std::cin >> val;

    std::vector<std::string> result{};
    for (auto& val : data)
    {
        bool empty{true};
        for (auto& c : val)
            if (c != '.') empty = false;

        if (!empty)
            result.emplace_back(val);
    }

    if(!result.empty())
        for (bool noloop{}; !noloop;)
        {
            noloop = true;

            for (int x{}; x < result.front().size(); ++x)
            {
                bool empty{ true };
                for (int i{}; i < result.size(); ++i)
                {
                    if (result[i][x] != '.') empty = false;
                }

                if (empty)
                {
                    for (auto& str : result)
                        str.erase(str.begin() + x);
                    
                    noloop = false;
                    break;
                }
            }
        
        }


    for (auto& str : result)
        std::cout << str << std::endl;



    return 0;
}

# endif

Measured memory_bytes: 256
#include<bits/stdc++.h>
int main()
{
    char str[101],ans[101];
    gets(str);
    int i,lena=0;
    for(i=0;i<strlen(str);i++)
        switch(str[i])
        {
            case '0':
				ans[lena]='0';
				lena++;
				break;
            case '1':
				ans[lena]='1';
				lena++;
				break;
            case 'B':
				if(lena!=0) lena--;
				break;
        }
    for(i=0;i<lena;i++)
        printf("%c",ans[i]);
    printf("\n");
    return 0;
}

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

int main(){
  string s;
  ll k;
  cin >>s >>k;
  for(int i = 0; i<min((ll)s.size(), k); i++){
    if(s[i]>='2') {
      cout << s[i] << endl;
      return 0;
    }
  }
  cout << 1 << endl;
  return 0; 
}

Measured memory_bytes: 3564
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
 
 
void swap (int *x, int *y) {
  int temp;    
 
  temp = *x;
  *x = *y;
  *y = temp;
}
 
int gcd(int a,int b){
  if(a<b){
    swap(&a,&b);
  }
 
  if(b==0){
    return a;
  }
 
  int r=a%b;
  while(r!=0){
    a = b;
    b = r;
    r = (a%b);
  }
 
  return b;
}
 
/* クイックソート */
int dn(const void*a,const void*b){return*(int*)b-*(int*)a;}
 
 
int modpow(int a,int n,int mod){
  int ans=1;
  while(n>0){
    if(n & 1){
      ans=ans*a%mod;
    }
    a=a*a%mod;
    n/=2;
  }
  return ans;
}
 
int max(int a,int b){
  if(a<b){
    return b;
  }
  else{
    return a;
  }
}
 
int min(int a,int b){
  if(a<b){
    return a;
  }
  else{
    return b;
  }
}
 
void chmax(int *a,int b){
  if(*a < b){
    *a = b;
  }
 
  return;
}
 
void chmin(int *a,int b){
  if(*a > b){
    *a =b;
  }
 
  return;
}
 

int main(void){
  char n[200010];
  int sum=0;
  scanf("%s",n);
  int l=strlen(n);
  for(int i=0;i<l;i++){
    int m=n[i]-48;
    sum+=m;
  }
  if(sum%9==0){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 1772
//  ____            _                  _                       _       _
// |  _ \ _   _ ___| |_    ___ _ __   | |_ ___ _ __ ___  _ __ | | __ _| |_ ___
// | |_) | | | / __| __|  / __| '_ \  | __/ _ \ '_ ` _ \| '_ \| |/ _` | __/ _ \
// |  _ <| |_| \__ \ |_  | (__| |_) | | ||  __/ | | | | | |_) | | (_| | ||  __/
// |_| \_\\__,_|___/\__|  \___| .__/___\__\___|_| |_| |_| .__/|_|\__,_|\__\___|
//                            |_| |_____|               |_|

//https://github.com/manta1130/Competitive_Programming_Template_Rust

#[macro_use]
mod input {

    use std;
    use std::io;

    const SPLIT_DELIMITER: char = ' ';

    #[macro_export]
    #[allow(unused_macros)]
    macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

    #[allow(dead_code)]
    pub fn input_line_str() -> String {
        let mut s = String::new();
        io::stdin().read_line(&mut s).unwrap();
        s.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn p<T>(t: T)
    where
        T: std::fmt::Display,
    {
        println!("{}", t);
    }

    #[allow(dead_code)]
    pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
    where
        T: std::str::FromStr,
    {
        let mut v: Vec<Vec<T>> = Vec::new();

        for _ in 0..line {
            let vec_line = input_vector();
            v.push(vec_line);
        }
        v
    }

    #[allow(dead_code)]
    pub fn input_vector<T>() -> Vec<T>
    where
        T: std::str::FromStr,
    {
        let mut v: Vec<T> = Vec::new();

        let s = input_line_str();
        let split_result = s.split(SPLIT_DELIMITER);
        for z in split_result {
            let buf = match z.parse() {
                Ok(r) => r,
                Err(_) => panic!("Parse Error"),
            };
            v.push(buf);
        }
        v
    }

    #[allow(dead_code)]
    pub fn input_vector_row<T>(n: usize) -> Vec<T>
    where
        T: std::str::FromStr,
    {
        let mut v = Vec::with_capacity(n);
        for _ in 0..n {
            let buf = match input_line_str().parse() {
                Ok(r) => r,
                Err(_) => panic!("Parse Error"),
            };
            v.push(buf);
        }
        v
    }

    pub trait ToCharVec {
        fn to_charvec(&self) -> Vec<char>;
    }

    impl ToCharVec for String {
        fn to_charvec(&self) -> Vec<char> {
            self.to_string().chars().collect::<Vec<_>>()
        }
    }
}

use input::*;

fn main() {
    let mut a = input_vector_row::<usize>(2);
    a.sort();
    if a[0] == 1 && a[1] == 2 {
        p(3);
    } else if a[0] == 1 && a[1] == 3 {
        p(2);
    } else {
        p(1);
    }
}


Measured memory_bytes: 4352