akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define BUF_SIZE 30
// more than (20000000)*(VERTEX_MAX)
#define WEIGH_MAX 0x7f7f7f7f
#define VERTEX_MAX 100

int get_int2(int *a1, int *a2) {
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return -1;
  sscanf(line, "%d %d", a1, a2);
#else
#error
#endif
  return 0;
}

int get_int3(int *a1, int *a2, int *a3) {
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return -1;
  sscanf(line, "%d %d %d", a1, a2, a3);
#else
#error
#endif
  return 0;
}

int main(void) {
    int vs, es;
    int graph[VERTEX_MAX][VERTEX_MAX];
    memset(graph, 0x7f, VERTEX_MAX*VERTEX_MAX*sizeof(int));
    get_int2(&vs, &es);
    int i, j, k;
    for(i = 0; i < es; i++) {
        int src, dst, weigh;
        get_int3(&src, &dst, &weigh);
        // directed
        graph[src][dst] = weigh;
    }
    for(i = 0; i < vs; i++) {
        graph[i][i] = 0;
    }

    for(k = 0; k < vs; k++) {
        for(i = 0; i < vs; i++) {
            for(j = 0; j < vs; j++) {
                if(graph[i][k] == WEIGH_MAX) continue;
                if(graph[k][j] == WEIGH_MAX) continue;
                int new = graph[i][k] + graph[k][j];
                if(new < graph[i][j]) {
                    graph[i][j] = new;
                }
            }
        }
    }
    for(i = 0; i < vs; i++) {
        if(graph[i][i] < 0) {
            printf("NEGATIVE CYCLE\n");
            return 0;
        }
    }
    for(i = 0; i < vs; i++) {
        for(j = 0; j < vs; j++) {
            char ch = (j==(vs-1)) ? '\n' : ' ';
            if(graph[i][j] == WEIGH_MAX) {
                printf("INF%c", ch);
            } else {
                printf("%d%c", graph[i][j], ch);
            }
        }
    }

    return 0;
}


Measured memory_bytes: 2112
n,k,q=map(int,input().split())
a = [int(input()) for i in range(q)]
ans=[0]*(n+1)
for i in a:
    ans[i] += 1
for i in range(1,n+1):
    if ans[i] >= 1-k+q:
        print('Yes')
    else:
        print('No')


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

#define fi first
#define se second
#define pb push_back
#define mod(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,a,b) for(int i = a; i < b; i++)
#define forr(i,a,b) for(int i = a; i >= b; i--)
#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

const ll MOD = 1e9+7;
const int MAX = 1000000;
ll fac[MAX],caf[MAX]; //factorial e inverso
ll deg(ll x,ll d){
	d %= MOD - 1;
    	if(d < 0)d += MOD - 1;
    	ll y = 1;
    	while (d) {
        	if (d & 1) y *= x, y %= MOD;
        	x *= x, x %= MOD;
        	d /= 2;
    	}
    	return y;
}
ll coeff(int n,int k){
	return fac[n] * caf[k] % MOD * caf[n - k] % MOD;
}

ll get(ii a,ii b){
	int len1 = b.fi-a.fi;
	int len2 = b.se-a.se;
	return coeff(len1+len2,len1);
}
	
const int maxq = 3000+10;
ll dp[maxq];
ii A[maxq];
int N,M,Q;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	fac[0] = caf[0] = 1;
	forn(i,1,MAX)fac[i] = i * fac[i - 1] % MOD, caf[i] = deg(fac[i], -1);
	cin >> N >> M >> Q;
	forn(i,0,Q)cin >> A[i].fi >> A[i].se;
	A[Q] = {N,M};
	Q++;
	sort(A,A+Q);
	/*forn(i,0,Q){
		cout << A[i].fi << ' ' << A[i].se << "D:\n";
	}*/
	//dp[0] = 1;
	forn(i,0,Q){
		dp[i] = get({1,1},A[i]);
		forn(j,0,Q){
			if(i == j)continue;
			if(A[j].fi <= A[i].fi && A[j].se <= A[i].se){
				//cout << A[i].fi << ' ' << A[i].se << "->" << A[j].fi << ' ' << A[j].se << ":D\n";
				ll quitar = ((dp[j]%MOD)*(get(A[j],A[i])))%MOD;
				dp[i] = ((dp[i]%MOD)-(quitar%MOD))%MOD;
			}
		}
	}
	ll res = dp[Q-1];
	if(res < 0)res += MOD;
	cout << res << '\n';
	return 0;
}
/*
__builtin_mul_overflow(x,y,&x)
-fsplit-stack
*/


Measured memory_bytes: 16000
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner stdin = new Scanner(System.in);
		int n, k, a, b;
		n = stdin.nextInt();
		k = stdin.nextInt();
		int c[] = new int[n];
		for (int i = 0; i < k; i++) {
			a = stdin.nextInt();
			b = stdin.nextInt();
			c[a - 1]++;
			c[b - 1]++;
		}
		for (int j = 0; j < n; j++) {
			System.out.println(c[j]);
		}
	}
}


Measured memory_bytes: 21972
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>

using namespace std;
typedef long long ll;
typedef pair<int,int> Pi;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) x.begin(), x.end()

string s;

void solve(){
	cin >> s;
	while(!s.empty()){
		if(sz(s) >= 5 && s.substr(sz(s)-5) == "dream")rep(i, 5)s.pop_back();
		else if(sz(s) >= 5 && s.substr(sz(s)-5) == "erase")rep(i, 5)s.pop_back();
		else if(sz(s) >= 7 && s.substr(sz(s)-7) == "dreamer")rep(i, 7)s.pop_back();
		else if(sz(s) >= 6 && s.substr(sz(s)-6) == "eraser")rep(i, 6)s.pop_back();
		else break;
	}
	puts(sz(s) ? "NO" : "YES");
}

int main(){
	int Tc = 1; //scanf("%d\n", &Tc);
	for(int tc=1;tc<=Tc;tc++){
		solve();
	}
	return 0;
}

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

#define X first
#define Y second
#define LL long long
#define ULL unsigned long long
#define PB push_back
#define MP make_pair
#define VI vector<int>
#define PII pair<int,int>
#define IOS ios::sync_with_stdio(0);cin.tie(0);
#define IN freopen("in", "r", stdin);
#define OUT freopen("out", "w", stdout);

const int maxn=100010;

LL a[maxn],per[maxn];
char c[maxn];

int main()
{
	IOS;
	int n;
	cin>>n>>a[0];
	per[0]=a[0];
	LL abssum=a[0];
	LL ans=a[0];
	VI sub;
	for (int j=1;j<n;++j)
	{
		cin>>c[j]>>a[j];
		per[j]=per[j-1]+a[j];
		abssum+=a[j];
		if (c[j]=='+') ans+=a[j];
		else
		{
			ans-=a[j];
			sub.PB(j);
		}
	}
	for (int j=0;j<(int)sub.size()-1;++j)
	{
		int p1=sub[j];
		int p2=sub[j+1];
		LL tis=abssum-(per[p2-1]-per[p1-1])*2;
		ans=max(ans,tis);
		abssum-=a[p1]*2;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 2424
a = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
s = set(input())
for i in a:
    if i not in s:
        print(i)
        break
else:
    print('None')

Measured memory_bytes: 3188
#AGC003 A 22:54 - 
'''
問題
座標平面上に家がある
長さNの文字列Sがある
文字列の各文字はNWSEのいずれか
i文字目の示す方向にしたがって任意の距離だけ移動することをNターン繰り返す
うまく移動距離を決めることで，Nターン終了後にふたたび家に戻っていることができるか？
Sの長さは1以上1000以下
各ターンでの移動距離は必ず正にすること

考察
1.NとSのうち両方がSに含まれるか，またはどちらも含まれない
2.WとEのうち両方がSに含まれるか，またはどちらも含まれない
この2つが同時に満たされていればよい

1.は次の条件と同値:
S.count('N')*S.count('S')>0 or
(S.count('N')==0 and S.count('S')==0)
'''

S = str(input())

if ((('N' in S) and ('S' in S)) or (('N' not in S) and ('S' not in S))) and ((('W' in S) and ('E' in S)) or (('W' not in S) and ('E' not in S))):
	print('Yes')
else:
	print('No')

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
using namespace std;

int main()
{
	string s;
    cin>>s;

    if(s=="Sunny")
        cout<<"Cloudy"<<endl;
    else if(s=="Cloudy")
        cout<<"Rainy"<<endl;
    else if(s=="Rainy")
        cout<<"Sunny"<<endl;

	return 0;
}


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

using namespace std;

#define MOD (int)(1e9+7)
#define INF 1e9

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

typedef long long ll;

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

	int H, W; cin >> H >> W;
	int oH, oW;
	oH = H; oW = W;
	//vector<string>A(H);
	//for (int i = 0; i < H; i++)cin >> A[i];

	vector<int>alp(26);
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			char c; cin >> c;
			alp[c - 'a']++;
		}
	}

	priority_queue<int>pq;
	for (int i = 0; i < 26; i++) {
		if (alp[i])pq.push(alp[i]);
	}

	bool flag = true;
	while (flag && H > 1 && W > 1) {
		int a = 4;
		while (flag && a) {
			if (pq.empty()) {
				flag = false;
				break;
			}
			int p = pq.top(); pq.pop();
			p -= 4;
			if (p < 0) {
				flag = false;
				break;
			}
			if (p > 0)pq.push(p);
			a -= 4;
		}
		if (flag == false)break;

		int b = 4 * ((H - 2) / 2);
		while (flag && b) {
			if (pq.empty()) {
				flag = false;
				break;
			}
			int p = pq.top(); pq.pop();
			p -= 4;
			if (p < 0) {
				flag = false;
				break;
			}
			if (p > 0)pq.push(p);
			b -= 4;
		}

		int c = 4 * ((W - 2) / 2);
		while (flag && c) {
			if (pq.empty()) {
				flag = false;
				break;
			}
			int p = pq.top(); pq.pop();
			p -= 4;
			if (p < 0) {
				flag = false;
				break;
			}
			if (p > 0)pq.push(p);
			c -= 4;
		}

		H -= 2; W -= 2;
	}

	H = oH; W = oW;

	int d = 2*(H/2);
	int e = 2*(W/2);
	if (H % 2 && W % 2) {
		int f = d + e;
		while (flag && f) {
			if (pq.empty()) {
				flag = false;
				break;
			}
			int p = pq.top(); pq.pop();
			p -= 2;
			if (p < 0) {
				flag = false;
				break;
			}
			if (p > 0)pq.push(p);
			f -= 2;
		}
	}
	else if (H % 2) {
		while (flag && e) {
			if (pq.empty()) {
				flag = false;
				break;
			}
			int p = pq.top(); pq.pop();
			p -= 2;
			if (p < 0) {
				flag = false;
				break;
			}
			if (p > 0)pq.push(p);
			e -= 2;
		}
	}
	else if (W % 2) {
		while (flag && d) {
			if (pq.empty()) {
				flag = false;
				break;
			}
			int p = pq.top(); pq.pop();
			p -= 2;
			if (p < 0) {
				flag = false;
				break;
			}
			if (p > 0)pq.push(p);
			d -= 2;
		}
	}

	cout << (flag ? "Yes" : "No") << endl;

	return 0;
}



Measured memory_bytes: 256
from operator import itemgetter
N,M=map(int,input().split())
table=[]
for i in range(M):
    a,b=map(int,input().split())
    table.append((a,b))
table=sorted(table, key=itemgetter(1))
ans=0
t=0
for a,b in table:
    if t<a:
        ans+=1
        t=b-1
print(ans)

Measured memory_bytes: 57944
#include <iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
    int n,d,x,ans,i;
    cin>>n>>d>>x;
     ans=x;
    for(i=0;i<n;i++)
    {
        int a;
        cin>>a;
        ans=ans+(d-1)/a+1;
    }
    cout<<ans<<endl;
return 0;
}


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

int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> s;
    s.assign(m, vector<int>());
    vector<int> k(m);
    vector<int> p(m);
    for (int i = 0; i < m; i++) {
        cin >> k[i];
        for (int j = 0; j < k[i]; j++) {
            int s_temp;cin >> s_temp;
            s_temp--;
            s[i].push_back(s_temp);
        }
    }
    for (int i = 0; i < m; i++) cin >> p[i];
    int ans = 0;
    for (int i = 0; i < 1<<n; i++) {
        int i_temp = i;
        vector<int> switch_on(n, false);
        vector<int> bulbs(m);
        bool is_ok = true;
        for (int j = 0; j < n; j++) if (i_temp & 1<<j) switch_on[j] = true;
        for (int j = 0; j < m; j++) {
            int on = 0;
            for (auto a: s[j]) if (switch_on[a]) on++;
            if (on % 2 != p[j]) is_ok = false;
        }
        if (is_ok) ans++;
    }
    cout << ans << endl;
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  ll n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];

  rep(i, n) {
    if (a[i] % 2 == 0) {
      if (a[i] % 3 != 0 && a[i] % 5 != 0) {
        cout << "DENIED" << endl;
        return 0;
      }
    }
  }

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


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
typedef long long LL;
typedef long double LD;
typedef pair<LL, LL> PLL;
typedef pair<LD, LL> PDL;
typedef pair<LD, LD> PDD;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
//typedef boost::multiprecision::cpp_int bigint;

template<class T>
void in(T& x) {
	cin >> x;
}

template<class T1,class T2>
void in(pair<T1, T2>& p) {
	in(p.first);
	in(p.second);
}

template<class T>
void in(vector<T>& v,LL st=-1,LL en=-1) {
	if (st == -1) {
		st = 0;
		en = v.size() - 1;
	}
	for (LL n = st; n <= en; n++) {
		in(v[n]);
	}
}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	string S, T, U;
	LL A, B;
	cin >> S >> T >> A >> B >> U;
	if (S == U) {
		cout << A - 1 << " " << B << "\n";
	}
	else {
		cout << A << " " << B - 1 << "\n";
	}
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

int main() {
    string s;
    cin>>s;

    if (s.size() == 3) 
        swap(s[2],s[0]);

    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <sstream>
#include <string>
#include <vector>
using namespace std;

typedef long long ll, lint;
typedef long double ldouble;

#define sz(v) ((int) (v).size())
#define FOR(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define For(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()

#define mp make_pair
#define pb push_back
#define fst first
#define snd second

template<class T>
string to_string(T arr, int len = 1e9) {
    stringstream ss;
    int i = 0;
    for (auto item : arr) {
        ss << item << ' ';
        if (++i == len)
            break;
    }
    return ss.str();
}

#ifdef LOCAL
    #define dbg(expr) cout << "[line " << __LINE__ << "] " << (#expr) << ": " << (expr) << endl;
#else
    #define dbg(expr) (void) 0;
#endif


int main() {
#ifndef LOCAL
    cin.tie(0);
    ios_base::sync_with_stdio(false);
#endif

    int n;
    cin >> n;
    vector<pair<lint, int>> values;
    For (i, n) {
        int x;
        cin >> x;
        values.emplace_back(x, i);
    }
    auto base = values;
    sort(all(values));

    lint lm = values[n / 2 - 1].first;
    lint rm = values[n / 2].first;
    for (auto e : base) {
        if (e.first <= lm)
            cout << rm << endl;
        else
            cout << lm << endl;
    }
}

Measured memory_bytes: 8684
N = gets.to_i
as = gets.split.map(&:to_i)

sum = 0
sqsum = 0

N.times do |i|
  sum += as[i]
  sqsum += as[i]**2
end

x = (sum.to_f / N).round
puts N * x**2 - 2 * sum * x + sqsum


Measured memory_bytes: 1788
//(UNCOMMENT WHEN SUBMITTING)
//#pragma GCC optimize("O3")

//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)
// #pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN NEEDED)
// #pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>

// clang-format off
#define range(i) for (int _ = 0; _ < i; _++)
#define vprnt(v) for (auto vi : v) cout << vi << " "; cout << endl;
#define fastio() ios::sync_with_stdio(false); cin.tie(0)
#define ll long long
#define all(x) (x).begin(), (x).end()
using namespace ::std;
int nxt() {int x;cin >> x;return x;}
ll nxtll() {ll x;cin >> x;return x;}
// clang-format on

vector<int> fw;

int fwsum(int idx) {
    int ret = 0;
    for (++idx; idx > 0; idx -= idx & -idx)
        ret += fw[idx];
    return ret;
}

int fwsum(int l, int r) {
    return fwsum(r) - fwsum(l - 1);
}

void fwadd(int idx, int delta) {
    for (++idx; idx < fw.size(); idx += idx & -idx)
        fw[idx] += delta;
}

int main() {
    fastio();

    int N = nxt(), Q = nxt();
    vector<int> c(N);
    generate(all(c), nxt);

    vector<array<int, 3>> qs(Q);
    for (int i = 0; i < Q; i++) {
        int lq = nxt(), rq = nxt();
        qs[i] = {lq - 1, rq - 1, i};
    }

    fw.assign(N + 1, 0);

    sort(all(qs), [](const auto &lhs, const auto &rhs) {
        return lhs[1] < rhs[1];
    });

    map<int, int> seen;
    int qi = 0;
    vector<int> ans(Q);
    for (int r = 0; r < N; r++) {
        if (seen.find(c[r]) == seen.end()) {
            fwadd(r, 1);
        } else {
            fwadd(seen[c[r]], -1);
            fwadd(r, 1);
        }
        seen[c[r]] = r;

        while (qi < Q && qs[qi][1] == r) {
            ans[qs[qi][2]] = fwsum(qs[qi][0], qs[qi][1]);
            qi++;
        }
    }

    for (int i = 0; i < Q; i++) {
        cout << ans[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 38904
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

// mt19937 gen_rand_int(chrono::steady_clock::now().time_since_epoch().count());
// mt19937_64 gen_rand_ll(chrono::steady_clock::now().time_since_epoch().count());
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

long long power(long long a, long long b,long long m) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a %m;
        a = a * a %m;
        b >>= 1;
    }
    return res;
}

int pp[50];
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);  
cout.tie(0);   

#ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
#endif  

    pp[0]=1;
    for(int i=1;i<=35;i++)
        pp[i]=(pp[i-1]*2);
    int n,k;
    cin>>n>>k;
    int a[n],b[n];
    for(int i=0;i<n;i++)
        cin>>a[i]>>b[i];
    int mx=0;
    for(int j=0;j<n;j++)
    {
        if((k&a[j])==a[j])
            mx+=b[j];        
    }

    for(int i=0;i<31;i++)
    {
        if(k&(pp[i]))
        {
            int tot=0;
            for(int j=0;j<n;j++)
            {
                int z=(k&a[j]);
                z=a[j]-z;
                if(z<pp[i] && (a[j]&pp[i])==0)
                {
                    tot+=b[j];
                }
            }
            mx=max(mx,tot);
        }
    }
    cout<<mx;
  
} 
    


Measured memory_bytes: 5152
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
using namespace std;

int MOD = 998244353;
// int MOD = 1000000007;

signed main(){

    ll n;
    cin >> n;
    vector<ll> s(n);
    rep(i,n)cin >> s[i];

    ll ans = 0;
    for(int c = 1;c < n;c++){
        ll res = 0;
        ll tmp = 0;
        if((n-1)%c == 0){
            for(int k = 0; k < n-1-k ;k += c){
                tmp += s[n-1-k] + s[k];
                res = max(res,tmp);
            }
        }else{
            for(int k = 0;k < n-1-c;k += c){
                tmp += s[n-1-k] + s[k];
                res = max(res,tmp);
            }
        }
        ans = max(ans,res);
    }
    cout << ans << endl;
     

    return 0;
}

// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://cf17-final-open.contest.atcoder.jp/tasks/cf17_final_a
// rm -r -f test;oj dl http://abc127.contest.atcoder.jp/tasks/abc127_f


Measured memory_bytes: 1024
#include <iostream>

using namespace std;
int ns[1000000];
int main()
{
    int n;
    while(cin>>n)
    {
        fill(ns,ns+1000000,true);
        ns[1]=false;
        int cnt=0;
        for(int i=2;i<=n;++i){
            if(ns[i])cnt++;
            for(int j=0;j*i<=n;++j){
                ns[i*j]=false;
            }
        }
        cout<<cnt<<endl;
    }
    return 0;
}

Measured memory_bytes: 5064
#include<stdio.h>
#pragma GCC optimize("O2")
#define rep(i,N) for(int i=0;i<(int)N;i++)
int IN(void)
{
  int x=0,f=0,c=getchar();while(c<48||c>57){f^=c==45,c=getchar();}
  while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f?-x:x;
}
void OUT(long x){if(x<0)putchar('-'),x=-x;if(x>=10)OUT(x/10);putchar(x%10+48);}
void Radix32(int A[],const int sz)
{
  int temp[200001];const int bit=0b1000,mask=0xff;
  rep(k,0b100)
  {
    int u[256]={0},v[256]={0};
    rep(i,sz)u[A[i]>>bit*k&mask]++;
    rep(i,mask)u[i+1]+=u[i];
    rep(i,sz){temp[--u[A[sz-1-i]>>bit*k&mask]]=A[sz-1-i];}k++;
    rep(i,sz)v[temp[i]>>bit*k&mask]++;
    rep(i,mask)v[i+1]+=v[i];
    rep(i,sz)A[--v[temp[sz-1-i]>>bit*k&mask]]=temp[sz-1-i];
  }
}
int main(void)
{
  int N=IN(),x,p=0,m=0,z=0,minus=0,A[200000];
  long K,count=0,l=-2e18,r=-l,mid;x=scanf("%ld",&K);
  rep(i,N){x=IN();if(x>0)A[m+p++]=x;else if(x<0)A[p+m++]=x;else z++;}
  Radix32(A,m+p);
  rep(i,m)A[p+i]*=-1;
  if(K>1l*m*p&&K<1l*m*p+1l*z*(N-1)/2)return puts("0"),0;
  if(K<=1l*m*p)r=1l;else l=-1l;
  while(l<=r)
  {
    mid=(l+r)/2;count=0;
    if(mid>=0)
    {
      int plus=p-1,minus=m-1;count+=1l*z*(p+m)+1l*z*(z-1)/2+1l*p*m;
      rep(i,plus){while(1l*A[i]*A[plus]>mid){plus--;}if(i>=plus){break;}count+=1l*plus-i;}
      rep(i,minus){while(1l*A[m+p-1-i]*A[m+p-1-minus]>mid){minus--;}if(i>=minus){break;}count+=1l*minus-i;}
    }
    else{mid*=-1l;minus=1;int low=0;rep(i,m){while(1l*A[low]*A[p+i]<mid&&low<p){low++;}count+=1l*p-low;}}
    if(count>=K){if(minus)r=-mid-1l;else r=mid-1l;}else{if(minus)l=-mid+1l;else l=mid+1l;}
  }
  return OUT(l),0;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define MOD 1000000007
#define el endl
#define INF 1e8
typedef long long ll;
typedef long double ld;

int main() {
    ll h;
    cin >> h;
    ll log2 = log(h) / log(2);
    log2++;
    ll ans = -1 * (1 - pow(2, log2));
    cout << ans << endl;
}



Measured memory_bytes: 640
#include<bits/stdc++.h>
#include<string.h>
using namespace std;
int main(){
    char str[150][150]={'\0'};
int i,j,k,l,m,n,arr[10];
    scanf("%d%d",&m,&n);
    //char a=getchar();
    for(i=0;i<m;i++){
       // gets(str[i]);
       scanf("%s",str[i]);
    }
    for(i=0;i<m;i++){k=0;
        for(j=0;j<n;j++){
            if(str[i][j]=='.')
            k++;
        }
        if(k==n)
        for(l=0;l<n;l++) str[i][l]='1';
    }
    for(i=0;i<n;i++){k=0;
        for(j=0;j<m;j++){
            if(str[j][i]=='.'||str[j][i]=='1')
            k++;
        }
        if(k==m)
        for(l=0;l<m;l++) str[l][i]='1';
    }

    for(i=0;i<m;i++){
        for(j=0;j<n;j++){
            if(str[i][j]!='1'&&j!=n-1)
                printf("%c",str[i][j]);
            if(str[i][j]!='1'&&j==n-1)
                printf("%c\n",str[i][j]);
            else if(str[i][j]=='1'&&j==n-1)
             printf("\n");
        }

    }


    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void) {
    double h, max_h = 0, min_h = 1e100;
    while (true) {
        cin >> h;
        if (h > max_h) max_h = h;
        else if (h < min_h) min_h = h;
        if (cin.eof()) break;
    }
    cout << (max_h - min_h) << endl;
    return 0;
}

Measured memory_bytes: 1280
n = int(input())
a = list(map(int, input().split()))

result = []

if n % 2 == 0:
    for i in range(n, 0, -2):
        result.append(a[i - 1])
    for i in range(1, n, 2):
        result.append(a[i - 1])
else:
    for i in range(n, 0, -2):
        result.append(a[i - 1])
    for i in range(2, n, 2):
        result.append(a[i - 1])

print(' '.join(map(str, result)))


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

typedef long long ll;

int N;
vector<vector<int> > A;

struct Edge {
    int u, v, w;
    bool operator <(const Edge &i) const {
        return w < i.w;
    }
};
vector<Edge> edge;

int main() {
    scanf("%d", &N);
    A = vector<vector<int> >(N, vector<int>(N));
    for(int i = 0; i < N; i++) {
        for(int j = 0; j < N; j++) {
            scanf("%d", &A[i][j]);
        }
    }

    for(int i = 0; i < N; i++) {
        for(int j = 0; j < N; j++) {
            for(int k = 0; k < N; k++) {
                if(A[j][k] > A[j][i] + A[i][k]) {
                    printf("-1");
                    return 0;
                }
            }
        }
    }

    for(int i = 0; i < N; i++) {
        for(int j = i + 1; j < N; j++) {
            edge.push_back({i, j, A[i][j]});
        }
    }

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

    ll sum = 0;
    for(int i = 0; i < edge.size(); i++) {
        int u = edge[i].u;
        int v = edge[i].v;
        int w = edge[i].w;

        bool ok = true;
        for(int j = 0; j < N; j++) {
            if(j == u || j == v) continue;
            if(A[u][v] == A[u][j] + A[j][v]) {
                ok = false;
                break;
            }
        }
        if(ok) sum += w;
    }

    printf("%lld", sum);
}


Measured memory_bytes: 1532
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        new Main();
    }

    public Main() {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        String s = sc.next();
        String t = sc.next();
        StringBuilder sb = new StringBuilder(s.length());
        for (int i = 0; i < s.length(); i++) {
            sb.append(s.charAt(i));
            sb.append(t.charAt(i));
        }
        System.out.println(sb.toString());
    }
}


Measured memory_bytes: 23508
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
int main()
{
    int n;
    cin >> n;
    multiset<int> m;
    for(int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        m.insert(a);
    }
    int ans = 0;
    while(m.size() > 0)
    {
        int cand = *m.rbegin();
        m.erase(m.find(cand));
        ll ctwo = 1;
        while(ctwo <= cand)
        {
          ctwo *= 2;
        }
      auto fitr = m.find(ctwo - cand);

        if(fitr != m.end())
        {
            m.erase(fitr);
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
#define norm qwert
int n,T;
vector<pair<long long,long long> > norm;//动态
vector<long long> sta;//静态 
long long a,b;
bool fractal_cmp(pair<long long,long long> x1,pair<long long,long long> y1){
	return ((x1.first*(y1.second+1LL))>((x1.second+1LL)*y1.first));
}
long long dp[40];
int main(){
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>T;
	for(int i=1;i<=n;i++){
		cin>>a>>b;
		if(a!=0){
			norm.push_back(make_pair(a,b));
		}
		else{
			sta.push_back(b);
		}
	}
	sort(sta.begin(),sta.end());
	sort(norm.begin(),norm.end(),fractal_cmp); 
	memset(dp,63,sizeof(dp));
	dp[0]=0LL;
	for(int i=0;i<norm.size();i++){//背包问题 
		for(int j=32;j>=1;j--){
			if(dp[j-1]>=T)
				continue;
			dp[j]=min(dp[j],dp[j-1]+1LL+(dp[j-1]+1)*(norm[i].first)+norm[i].second);
		}
	}
	int ans=0;
	int lim;
	int cand;
	for(int i=0;i<=32;i++){
		if(dp[i]>T)
			continue;
		lim=T-dp[i];
		cand=i;
		for(int j=0;j<sta.size();j++){
			if((1+sta[j])<=lim){
				cand++;
				lim-=sta[j];
				lim--;
			}
		}
		ans=max(ans,cand);
	}
	cout<<ans<<endl;
	return 0;
}


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

void solve(long long N, long long T, std::vector<long long> t) {
  ll water = 0;
  for (size_t i = 1; i < t.size(); i++) {
      water += min(T, t[i]-t[i-1]);
  }
  water+=T;
  cout << water << endl;
}

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

  long long N;
  scanf("%lld", &N);
  long long T;
  scanf("%lld", &T);
  std::vector<long long> t(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &t[i]);
  }
  solve(N, T, std::move(t));
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <cstdlib>
#include <utility>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>

#define rep(i, n) for (int i = 0; i < (int)n; i++)

using namespace std;

int main() {
    int n; cin >> n;
    vector <int> l(n, 0); 
    rep(i, n) cin >> l[i];
    int sum = 0;
    sort(l.begin(), l.end());
    rep(i, n-1) sum += l[i];
    if (sum > l[n-1]) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		new Main().run();
	}

	private void run() {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int n = scanner.nextInt();
			int c = scanner.nextInt();
			if ((n | c) == 0)
				break;
			int[] a = new int[n];
			int[] b = new int[c];
			for (int i = 0; i < n; i++)
				for (int j = 0; j < 16; j++)
					a[i] += (scanner.nextInt() << j);
			for (int i = 0; i < c; i++)
				for (int j = 0; j < 16; j++)
					b[i] += (scanner.nextInt() << j);
			int[][] dp = new int[n + 1][1 << 16];
			for (int i = 0; i <= n; i++)
				Arrays.fill(dp[i], -1);
			dp[0][0] = 0;
			for (int i = 0; i < n; i++) {
				for (int S = 0; S < 1 << 16; S++) {
					if (dp[i][S] == -1)
						continue;
					int light = S | a[i];
					for (int j = 0; j < c; j++) {
						int pushed = light & b[j];
						int point = Integer.bitCount(pushed);
						int nx = light & ~b[j];
						if (dp[i + 1][nx] < point + dp[i][S])
							dp[i + 1][nx] = point + dp[i][S];
					}
				}
			}
			int max = 0;
			for (int i = 0; i < 1 << 16; i++)
				max = Math.max(max, dp[n][i]);
			System.out.println(max);

		}
	}
}

Measured memory_bytes: 64664
N = int(input())
tall = list(map(int, input().split()))
cnt = 0
for i in range(len(tall)-1):
    if tall[i]>tall[i+1]:
        cnt += (tall[i]-tall[i+1])
        tall[i+1] +=  (tall[i]-tall[i+1])
print(cnt)

Measured memory_bytes: 32080
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;

typedef long long ll;
#define print(x) cout<<(x)<<endl


#define INF10 10000000000
#define INF5 100000
#define EPS 1e-10
#define MOD 1000000007

ll dp[26];


// DONT USE "int", USE "ll" !!!!!!!!!!!!
int main() {
	int N, K;
	string S;
	cin >> N >> K;
	cin >> S;
	S[K - 1] += 32;
	print(S);

	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3

a = int(input())
b = int(input())
c = int(input())
x = int(input())

res = 0
for i in range(a + 1):
    for j in range(b + 1):
        for k in range(c + 1):
            if 500 * i + 100 * j + 50 * k == x:
                res += 1

print(res)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define Fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Freed freopen ("0in.txt","r",stdin);
#define Fout freopen ("0out.txt","w",stdout);
#define ll long long int
#define pb push
#define mp make_pair
#define pi acos(-1.0)
#define Mod 10000007
#define limit 1008
using namespace std;
int fx[]={-1,0,1,0};
int fy[]={0,1,0,-1};
int fxx[]={-1,1,1,-1,-2,-2,-2,-1,0,1,2,2,2,2,2,1,0,-1,-2,-2};
int fyy[]={1,1,-1,-1,0,1,2,2,2,2,2,1,0,-1,-2,-2,-2,-2,-2,-1};
int ct[limit][limit];
int n,m,su,sv,du,dv;
queue<pair<int,int> > que;
pair<int,int> z;
void dfs(int u,int v)
{
    int i,x,y;   //cout <<u <<" "<<v<<endl;
    que.pb(mp(u,v));
    for(i=0; i<4; i++)
    {
        x = u+fx[i];
        y = v+fy[i];
        if(x>0 && x<=n && y>0 && y<=m )
        {
            if(ct[x][y]==-1 || ct[x][y]<=ct[u][v] ||(u==du && v==dv)) continue;
            ct[x][y] = min(ct[x][y],ct[u][v]);
            dfs(x,y);
        }
    }
}
void solve(int t)
{
    int i,j,x,y;
    char ch;
    cin >> n >> m;
    for(i=0; i<=n+5; i++)
    {
        for(j=0; j<=m+5; j++)
        {
            ct[i][j]=Mod;
        }
    }
    cin >> su >> sv >> du >> dv;
    for(i=1; i<=n; i++)
    {
        for(j=1; j<=m; j++)
        {
            cin >> ch;
            if(ch=='#')
                ct[i][j]=-1;
        }
    }
    ct[su][sv]=0;
    dfs(su,sv);
    while(!que.empty())
    {
        z = que.front();
        que.pop();
        su = z.first;
        sv = z.second;
        for(i=0; i<20; i++)
        {
            x = su+fxx[i];
            y = sv+fyy[i];
            if(x>0 && x<=n && y>0 && y<=m )
            {
                if(ct[x][y]==-1 || (ct[x][y]-1)<=ct[su][sv] ||(su==du && sv==dv)) continue;
                ct[x][y] = min(ct[x][y],ct[su][sv]+1);
                dfs(x,y);
            }
        }
    }
    if(ct[du][dv]==Mod)
        cout <<-1<<endl;
    else
        cout <<ct[du][dv]<<endl;
    return ;
}
int  main()
{
    Fast
//    Freed
//    Fout
    int t,tt=1;
   // cin >> tt;
    for(t=1; t<=tt; t++)
        solve(t);
  return 0;
}




Measured memory_bytes: 7596
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
using namespace std;
int n;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	int a=n%10;
    if (a==2 || a==4 || a==5 || a==7 || a==9){cout<<'h';}
    else if (a==0 || a==1 || a==6 || a==8){cout<<'p';}
    else{cout<<'b';}
    cout<<"on"<<"\n";
}


Measured memory_bytes: 3584
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while (true) {
			int a = sc.nextInt();
			String op = sc.next();
			int b = sc.nextInt();
			
			if ("+".equals(op)) {
				System.out.println(a + b);
			} else if ("-".equals(op)) {
				System.out.println(a - b);
			} else if ("*".equals(op)) {
				System.out.println(a * b);
			} else if ("/".equals(op)) {
				System.out.println(a / b);
			} else {
				break;
			}
		}
	}
}


Measured memory_bytes: 26184
//2018-5-29
//miaowey
//
#include <bits/stdc++.h>
using namespace std;

#define For(i, a, b) for(int i = (a); i <= (int)(b); ++i)
#define N (200000 + 5)

int n, a[N];

int main(){	
	scanf("%d", &n);
	For(i, 1, n) scanf("%d", &a[i]);
	
	if(a[1]){
		puts("-1"); return 0;
	}

	long long ans = 0;
	int p = 1, L, R;
	
	while(p <= n){
		L = R = p;
		if(a[L] > a[L - 1] + 1){
			puts("-1"); return 0;
		}

		while((R < n) && (a[R + 1] == a[R] || a[R + 1] == a[R] + 1)) ++R;
		p = R + 1;
		
		int now = R;

		while(now >= L){
			ans += a[now]; --now;
			while(now >= L && a[now] == a[now + 1] - 1) --now;
		}
	}

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

	return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
const int INF = 2147483647;

using namespace std;

int main()
{
  int n;
  cin >> n;
  int a[100000];
  REP(i, n)
  {
    cin >> a[i];
  }

  multiset<int> ms;
  REP(i, n)
  {
    if (ms.empty())
    {
      ms.insert(-a[i]);
      continue;
    }

    auto itr = ms.upper_bound(-a[i]);
    if (itr == ms.end())
    {
      ms.insert(-a[i]);
    }
    else
    {
      ms.erase(itr);
      ms.insert(-a[i]);
    }
  }

  cout << ms.size() << endl;
}


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

int main() {
    int N, K, Q;
    cin >> N >> K >> Q;
    vector<int> score(N, K - Q);
    rep(i, 0, Q) {
        int a; cin >> a;
        a--;
        score[a]++;
    }
    for(auto a : score) {
        if(a > 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
int INF = 1000000009;
ll f (ll a,ll b){
    string s = to_string(a);
    return s.size();
}
int main()
{
    ll n;
    cin >> n;
    ll ans = 11;
    for (ll i = 1; i * i <= n; i++)
    {
        if(n%i==0)
            ans = min(ans, f(n/i, i));
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);

const int N = 2e5+5, M = 1e6+6, OO = 0x3f3f3f3f, MOD = 1e9+7;
int tc;
ll power(ll a, ll b, ll m){  // Fast power with mod;
    if(!b)  return 1;
    ll t = power(a, b>>1, m)%m;
    return ((t*t)%m * (b&1 ? a : 1)%m)%m;
}
int main()
{
    FIO
    ll n; cin>>n;
    cout<<( power(10, n, MOD) - (((2 * power(9, n, MOD))%MOD - (power(8, n, MOD) % MOD)) %MOD) + MOD ) %MOD;
    return 0;
}

Measured memory_bytes: 3624
n = int(input())
ans = None
for i in range(1, 3501, 1):
	for j in range(1, 3501, 1):
		dominator = 4 * i * j - n * (i + j)
		if dominator > 0:
			numerator = i * j * n
			if numerator % dominator == 0:
				ans = (i, j, int(numerator / dominator))
				break
	if ans is not None:
		break
print(" ".join(map(str, ans)))

Measured memory_bytes: 3188
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
    
    public static void main(String[] args) {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try {
            
            String strMatrixSize = null;
            
            // 入力の終わりまで読み込みを行う
            while (!"0".equals((strMatrixSize = br.readLine()))) {
                
                int matrixSize = Integer.parseInt(strMatrixSize) + 1;
                int[][] matrix = new int[matrixSize][matrixSize];
                // 行のループ
                for (int row = 0; row < matrixSize - 1; row ++) {

                    String readLine = br.readLine();
                    String[] column = readLine.split(" ");
                    // 列のループ
                    for (int col = 0; col < matrixSize - 1; col ++) {
                        
                        int num = Integer.parseInt(column[col]);
                        // ループの行・列位置に格納
                        matrix[row][col] = num;
                        // 行の右端に加算
                        matrix[row][matrixSize - 1] += num;
                        // 列の下端に加算
                        matrix[matrixSize - 1][col] += num;
                    }
                    matrix[matrixSize - 1][matrixSize - 1] += matrix[row][matrixSize - 1]; 
                }
                // 表示
                for (int row = 0; row < matrixSize; row ++) {
                    for (int col = 0; col < matrixSize; col ++) {
                        System.out.printf("%5d", matrix[row][col]);
                    }
                    System.out.println();
                }
            }
        } catch(Exception e) {
            e.printStackTrace();
        } finally {
        }
    }
    
}

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

int main() {
  string s,a="abcdefghijklmnopqrstuvwxyz";
  cin>>s;
  if(s[0]!='A'){
    cout<<"WA"<<endl;
    return 0;
  }
  int p=0;
  for(int i=2;i<s.size()-1;i++){
    if(s[i]=='C'){
      p++;
    }
  }
  if(p!=1){
    cout<<"WA"<<endl;
    return 0;
  }
  p=0;
  for(int i=0;i<s.size();i++){
    for(int j=0;j<26;j++){
      if(s[i]==a[j]){
        p++;
      }
    }
  }
  if(p!=s.size()-2){
    cout<<"WA"<<endl;
    return 0;
  }
  cout<<"AC"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <utility>

int main() {
  int a, b, c;
  std::cin >> a >> b >> c;
  if (b > c) {
    std::swap(b, c);
  }
  if (a > b) {
    std::swap(a, b);
  }
  if (b > c) {
    std::swap(b, c);
  }
  printf("%d %d %d\n", a, b, c);
}


Measured memory_bytes: 3116
using System;
using System.Collections.Generic;
using System.Linq;

namespace abc163c
{
    class Program
    {
        static void Main(string[] args)
        {
            //==========================================================================================================================
            //1) input
            int n = int.Parse(Console.ReadLine());
            List<int> a = Console.ReadLine().Split(' ').Select(int.Parse).ToList();

            //==========================================================================================================================
            //2) output
            Dictionary<int, int> holder = new Dictionary<int, int>();
 
            for (int index = 0; index < n - 1; index++)
            {
                if (holder.ContainsKey(a[index]))
                {
                    holder[a[index]]++;
                }
                else
                {
                    holder.Add(a[index], 1);
                }
            }


            for (int index = 1; index <= n; index++)
            {
                int count = 0;

                if (holder.ContainsKey(index))
                {
                    count = holder[index];
                }

                Console.WriteLine(count);

            }


        }
    }
}


Measured memory_bytes: 52888
// dile a la jardinera que traigo flores

#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define sz(x) int(x.size())
#define all(v) (v).begin(),(v).end()
#define trace(x) cout << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define FER(i,a,b) for(int i = int(a); i < int(b); ++i)
#define IFR(i,a,b) for(int i = int(a); i >= int(b); i--)
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;

int ls[]={3,5,7};

bool go(ll val){
	bool is3=false,is5=false,is7=false;
	while(val>0){
		if(val%10==3)is3=true;
		if(val%10==5)is5=true;
		if(val%10==7)is7=true;
		val/=10;
	}
	return is3&&is5&&is7;
}


int main(){	
	fastio;
	ll n;cin>>n;
	int c=0;
	FER(i1,0,3){
		ll val=ls[i1];
		FER(i2,0,3){
			ll val2=10*val;
			val2+=ls[i2];
			FER(i3,0,3){
				ll val3=10*val2;
				val3+=ls[i3];
				if(go(val3)&&val3<=n)c++;
				FER(i4,0,3){
					ll val4=10*val3;
					val4+=ls[i4];
					if(go(val4)&&val4<=n)c++;
					FER(i5,0,3){
						ll val5=10*val4;
						val5+=ls[i5];
						if(go(val5)&&val5<=n)c++;
						FER(i6,0,3){
							ll val6=10*val5;
							val6+=ls[i6];
							if(go(val6)&&val6<=n)c++;
							FER(i7,0,3){
								ll val7=10*val6;
								val7+=ls[i7];
								if(go(val7)&&val7<=n)c++;
								FER(i8,0,3){
									ll val8=10*val7;
									val8+=ls[i8];
									if(go(val8)&&val8<=n)c++;
									FER(i9,0,3){
										ll val9=10*val8;
										val9+=ls[i9];
										if(go(val9)&&val9<=n)c++;
									}
								}
							}
						}
					}
				}
			}
		}
	}
	cout<<c<<endl;
	return 0;
}


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

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

#define LL long long;
#define REP(i,s,N) for (int i=s; i<N; i++)

int main() {
	int a, b, h;
	cin >> a >> b >> h;
	cout << (a+b)*h/2 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
using namespace std;

int main(){

    long long int x;
    long long int deposit = 100;
    int count = 0;
    cin >> x;
    while(x>deposit){
        deposit = deposit + deposit * 0.01;
        ++count;    
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
using ll=long long int;
using ld=long double;
using VI=vector<ll>;
using VD=vector<ld>;
using VVI=vector<VI>;
using VC=vector<char>;
using VVC=vector<VC>;
using VS=vector<string>;
using PLL =pair<ll,ll>;
using PLD=pair<ld,ld>;
using VPLL=vector<PLL>;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element((x).begin(),(x).end())
#define MIN(x) *min_element((x).begin(),(x).end())
#define SORTR(x) sort((x).rbegin(),(x).rend())
#define SORT(x) sort((x).begin(),(x).end())
#define SUM(x) accumulate((x).begin(),(x).end(), 0)
#define FILL(x,a) fill(x.begin(),x.end(),a)
#define EACH(i,x) for(typeof((x).begin()) i=(x).begin(); i!=(x).end(); ++i)
#define COUT(x) cout<<x<<"\n"

const ll INF = 1e18;
const ld EPS   = 1e-10;
const int MOD  = int(1e9)+7;
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 (b<a) { a=b; return 1; } return 0; }
template <class BidirectionalIterator>
bool next_partial_permutation(BidirectionalIterator first, BidirectionalIterator middle,BidirectionalIterator last){reverse(middle, last); return next_permutation(first , last);}
ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll GCD(VI v){ll a = v[0]; for (ll i = 1; i<SIZE(v); i++) {a = gcd(a, v[i]);} return a;}
ll LCM(VI v){ll a = v[0]; for (ll i = 1; i<SIZE(v); i++) {a = lcm(a, v[i]);} return a;}


void Main()
{
	ll a,b;
	ll res=0;
	string sres;
	cin>>a>>b;
	res=max((ll)0,a-2*b);

	cout << res << "\n";
	return;
}

int main()
{
	std::cin.tie(0);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}


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

#define MIN(x, y) ((x) < (y) ? (x) : (y))
#define MAX(x, y) ((x) > (y) ? (x) : (y))

#define DIVUP(x, y) (((x) + ((y) - 1)) / (y))
#define DIVOFF(x, y) (((x) + ((y) / 2)) / (y))
#define REMAINDER(x, y) ((x) % (y))

char S[50][50 + 1];

int main() {
  int H, W; scanf("%d%d", &H, &W);
  for (int i{}; i < H; ++i) scanf("%50s", &S[i]);

  for (int x{}; x < H; ++x) {
    for (int y{}; y < W; ++y) {
      if (S[x][y] == '#') continue;
      char count{};
      for (int i{x-1}; i <= x+1; ++i) {
        for (int j{y-1}; j <= y+1; ++j) {
          if (i == x && j == y) continue;
          if (i < 0 || j < 0) continue;
          if (S[i][j] == '#') ++count;
        }
      }
      S[x][y] = '0' + count;
    }
  }

  for (int i{}; i < H; ++i) printf("%s\n", S[i]);

  return 0;
}


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

constexpr ll A = 1e9 + 7;
vector<ll> fac((int)5e5 + 2);
vector<ll> ifac((int)5e5 + 2);

ll mpow(ll x, ll n) {
    ll ans = 1;
    while (n!=0)
    {
        if(n&1) ans = ans*x % A;
        x = x*x % A;
        n = n >> 1;
    }
    return ans % A;
}
inline ll comb(ll n, ll r) {
    if (n==0 && r==0)return 1;
    if (n<r) return 0;
    ll tmp = fac[n] * ifac[r] % A;
    return tmp*ifac[n-r] % A;
}
inline ll h(ll n, ll r) {
    ll tmp = n+r-1 % A;
    return comb(tmp, r);
}
int main(int argc, char const *argv[])
{
    int n, k;
    cin >> n >> k;
    ll ans = 0;
    fac[0] = 1;
    ifac[0] = 1;
    for (int i=1; i<=2 * n + 3; i++) {
        fac[i] = fac[i-1] * i % A;
    }
    for (int i=1; i<=2 * n + 3; i++) {
        ifac[i] = ifac[i-1] * mpow(i, A-2) % A;
    }
    rep(m, min(n, k)+1) {
        ans += comb(n, m) * comb(n-1, m) % A;
        ans %= A;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 8192
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i ++)
#define irep(i,n) for (int i = (int)(n) - 1;i >= 0;--i)
using namespace std;
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;// = 998244353;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;

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

    string s,t; cin >> s >> t;
    int n = s.size(),m = t.size();
    int ans = INF;
    rep(i,n - m + 1) {
        int ret = 0;
        rep(j,m) {
            if (s[i + j] != t[j]) ++ret;
        }
        ans = min(ans,ret);
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3656