akhauriyash/Code-Regression huggingface dataset:
#ifdef LOCAL111
	#define _GLIBCXX_DEBUG
#else
	#define NDEBUG
#endif
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { cout << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);	
}

int main()
{
	ios_init();
	int n;
	while(cin >> n) {
		LL ans[3];
		FOR(a, 1, 3510) FOR(b, 1, 3510) {
			LL x = LL(n)*LL(a)*LL(b);
			LL y = 4*LL(a)*LL(b)-LL(n)*LL(a)-LL(n)*LL(b);
			if(y != 0 and x%y == 0 and x/y > 0){
				ans[0] = a;
				ans[1] = b;
				ans[2] = x/y;
			}
		}
		cout << ans[0] << ' ' << ans[1] << ' ' << ans[2] << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl

typedef long long ll;
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector<int> p(n);
    for(int i = 0; i < n; i++)
    {
        cin >> p[i];
    }
    if(is_sorted(p.begin(), p.end()))
    {
        cout << "YES";
        return 0;
    }
    for(int i = 0; i < n; i++)
    {
        for(int j = i + 1; j < n; j++)
        {
            int temp = p[j];
            p[j] = p[i];
            p[i] = temp;
            if(is_sorted(p.begin(), p.end()))
            {
                cout << "YES";
                return 0;
            }
            else
            {
                int temp = p[j];
                p[j] = p[i];
                p[i] = temp;
            }
        }
    }
    cout << "NO";

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <bitset>
#define pb push_back 
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define INF (1<<30)
#define MOD 1000000007
using ll = long long;
using namespace std;

int main() {
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a + 3);
    cout << a[2] - a[0];
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <queue>
using namespace std;

int N;
long long T;

int main() {
    while (cin >> N >> T) {
        long long ct = 0;
        cin >> ct;
        long long res = T;
        for (int i = 1; i < N; ++i) {
            long long t;
            cin >> t;
            res += min(t - ct, T);
            ct = t;
        }
        cout << res << endl;
    }
}





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

using namespace std;

typedef struct{int gh,h,gj,j;} coins;

int c2d(const coins c) {
    return c.gh*500 + c.h*100 + c.gj*50 + c.j*10;
}
coins d2c(int d) {
    return {d/500, (d%500)/100, (d%100)/50, (d%50)/10};
}


int main(void) {
    bool flag = false;
    while(true) {
        int sum;
        scanf("%d", &sum);
        if(!sum) break;

        if(flag) printf("\n");
        flag = true;

        coins in;
        pair<coins, coins> res;
        pair<int, int> min;
        min = pair<int,int>(0xFF,0xFF);

        scanf("%d%d%d%d", &in.j, &in.gj, &in.h, &in.gh);
        for(int gh=0; gh<=in.gh; gh++)
            for(int h=0; h<=in.h; h++)
                for(int gj=0; gj<=in.gj; gj++)
                    for(int j=0; j<=in.j; j++) {
                        if(c2d({gh,h,gj,j}) < sum) continue;
                        coins ret = d2c(c2d({gh,h,gj,j})-sum);

                        if(min.first > (in.gh-gh+ret.gh + in.h-h+ret.h + in.gj-gj+ret.gj + in.j-j+ret.j)) {
                            min.first = (in.gh-gh+ret.gh + in.h-h+ret.h + in.gj-gj+ret.gj + in.j-j+ret.j);
                            min.second= (gh + h + gj + j);
                            res.first = {in.gh-gh+ret.gh , in.h-h+ret.h , in.gj-gj+ret.gj , in.j-j+ret.j};
                            res.second= {gh , h , gj , j};
                        }else if(min.first == (in.gh-gh+ret.gh + in.h-h+ret.h + in.gj-gj+ret.gj + in.j-j+ret.j)){
                            if(min.second< (gh + h + gj + j)) continue;

                            min.first = (in.gh-gh+ret.gh + in.h-h+ret.h + in.gj-gj+ret.gj + in.j-j+ret.j);
                            min.second= (gh + h + gj + j);
                            res.first = {in.gh-gh+ret.gh , in.h-h+ret.h , in.gj-gj+ret.gj , in.j-j+ret.j};
                            res.second= {gh , h , gj , j};
                        }
                    }

        if(res.second.j) printf("10 %d\n", res.second.j);
        if(res.second.gj) printf("50 %d\n", res.second.gj);
        if(res.second.h) printf("100 %d\n", res.second.h);
        if(res.second.gh) printf("500 %d\n", res.second.gh);
    }
    return 0;
}

Measured memory_bytes: 1032
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;

int main() {
  int N; cin >> N;
  int D[N+1]; CLR(D);
  FOR(i,1,N+1) cin >> D[i];
  sort(D, D + N + 1);
  FOR(i,0,N+1) if(i%2) D[i] = 24 - D[i];
  int ans = 1e9;
  FOR(i,0,N+1) {
    int j = (i + 1) % (N+1);
    int k = (i + 2) % (N+1);
    ans = min(ans, min(abs(D[i]-D[j]), 24-abs(D[i]-D[j])));
    if(i != k) ans = min(ans, min(abs(D[i]-D[k]), 24-abs(D[i]-D[k])));
  }
  cout << ans << endl;
  return 0;
}

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


typedef long long ll; // -9,223,372,036,854,775,808 から 9,223,372,036,854,775,807

template <class T> using vec = std::vector<T>;
template <class T> using vec2 = vec<vec<T>>;
template <class T> using vec3 = vec<vec<vec<T>>>;

#define DEBUG

void solve(long long A, long long B, long long C){
    ll B100= 100*B + C;
    ll res100 = A*B100;
    cout << res100/100 << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long A;
    scanf("%lld",&A);
    long long B, C;
    scanf("%lld.%lld",&B, &C);
    solve(A, B, C);
    return 0;
}


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

int main()
{
	long long a,v,b,w,t;
	cin>>a>>v>>b>>w>>t;
	if((v-w)*t>=abs(b-a)) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mit map<int,int>::iterator
#define sit set<int>::iterator
#define itrm(g,x) for(mit g=x.begin();g!=x.end();g++)
#define itrs(g,x) for(sit g=x.begin();g!=x.end();g++)
#define ltype int
#define rep(i,j,k) for(ltype(i)=(j);(i)<=(k);(i)++)
#define rap(i,j,k) for(ltype(i)=(j);(i)<(k);(i)++)
#define per(i,j,k) for(ltype(i)=(j);(i)>=(k);(i)--)
#define pii pair<int,int>
#define fi first
#define se second
#define mpr make_pair
#define pb push_back
#define fastio ios::sync_with_stdio(false)
const int inf=0x3f3f3f3f,mod=1000000007;
const double pi=3.1415926535897932,eps=1e-6;
void chmax(int &x,int y){if(x < y) x = y;}
void chmin(int &x,int y){if(x > y) x = y;}
int n;
string cur;
vector<string> v;
void dfs(int x,int y) {
    if(x == n){
        v.pb(cur);
        return;
    }
    rep(i,1,y+1) {
        cur[x] = i + 96;
        dfs(x + 1,max(y,i));
    }
}
int main()
{
    scanf("%d",&n);
    cur.resize(n);
    dfs(0,0);
    rap(i,0,v.size()) cout<<v[i]<<endl;
    return 0;
}

Measured memory_bytes: 7796
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i < (int)(n);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
int main(){
    ll n;
    cin >> n;
    vector<ll>a(n);
    rep(i,n)cin >> a[i];
    vector<ll>data(n);
    rep(i,n){
        ll x = a[i]-1;
        data.at(x) += 1;
    }
    vector<ll>tori(n);
    ll sum = 0;
    rep(i,n){
        if(data[i] < 2)continue;
        tori[i] = data[i]*(data[i]-1)/2;
        sum += tori[i];
    }
    rep(i,n){
        ll x = a[i] - 1;
        ll y = sum - tori[x];
        y += (data[x]-1) * (data[x]-2) /2;
        cout << y << endl;
    }
}

Measured memory_bytes: 7296
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		
		if(a == 1) {
			
			System.out.println("Hello World");
			
		} else {
			
			int b = sc.nextInt();
			int c = sc.nextInt();
			
			System.out.println(b + c);
			
		}
	}
}


Measured memory_bytes: 20820
n,k = map(int,input().split())

xl = list(map(int,input().split()))

ans = float("inf")
for i in range(n - k + 1):
    min_pos = xl[i]
    max_pos = xl[i+k-1]
    if min_pos * max_pos < 0:
        tmp = min(2*abs(min_pos) + abs(max_pos), abs(min_pos) + 2*abs(max_pos))
    else:
        tmp = max(abs(min_pos), abs(max_pos))
    if tmp < ans:
        ans = tmp
        
print(ans)

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

public class Main {
	static int n;

	public static void main(String[] args) throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        n = Integer.parseInt(br.readLine());
        for(int i = 1; i <= n; i++){
        	if(CHECK_NUM(i)) continue;
        	INCLUDE_3(i);
        }
        System.out.println();
	}

	public static boolean CHECK_NUM(int x){
		if ( x % 3 == 0 ){
			System.out.print(" " + x);
			return true;
		}else{
			return false;
		}
	}

	public static void INCLUDE_3(int i){
		int x = i;
		while(x != 0){
			if ( x % 10 == 3 ){
				System.out.print(" " + i);
				break;
			}
			x /= 10;
		}
	}
}

Measured memory_bytes: 29932
#define _CRT_SECURE_NO_WARNINGS
//#define _USE_MATH_DEFINES
#include<stdio.h>
//#include<stdlib.h>
//#include<math.h>
#include<string.h>
//#include<time.h>
#define P(type,x) fprintf(stdout,"%"#type"\n",x)
void vertical(int[2][9][9]);
void parallel(int[2][9][9]);
void square(int[2][9][9],int,int);
int main() {
	int p[2][9][9];
	int n, i, j, f = 0;
	fscanf(stdin, "%d", &n);
	while (n--) {
		if (f) puts("");
		f = 1;
		memset(p, 0, sizeof(p));
		for (i = 0; i < 9; i++) for (j = 0; j < 9; j++) fscanf(stdin, "%d", &p[0][i][j]);
		//vertical
		vertical(p);
		//parallel
		parallel(p);
		//3x3square
		for (i = 0; i < 9; i += 3)
			for (j = 0; j < 9; j += 3)
				square(p, i, j);
		//
		for (i = 0; i < 9; i++,puts(""))
			for (j = 0; j < 9; j++)
				fprintf(stdout, "%c%d", p[1][i][j] == 1 ? '*' : ' ', p[0][i][j]);
	}
	return 0;
}

void vertical(int a[2][9][9]) {
	int i, j, cnt[10], k;
	for (j = 0; j < 9; j++) {
		memset(cnt, 0, sizeof(cnt));
		for (i = 0; i < 9; i++)	cnt[a[0][i][j]]++;
		for (k = 1; k <= 9; k++)
			if (cnt[k] > 1)
				for (i = 0; i < 9; i++) 
					if (k == a[0][i][j]) a[1][i][j] = 1;
	}
}

void parallel(int a[2][9][9]){
	int i, j, cnt[10], k;
	for (i = 0; i < 9; i++) {
		memset(cnt, 0, sizeof(cnt));
		for (j = 0; j < 9; j++)	cnt[a[0][i][j]]++;
		for (k = 1; k <= 9; k++)
			if (cnt[k] > 1)
				for (j = 0; j < 9; j++)
					if (k == a[0][i][j]) a[1][i][j] = 1;
	}
}

void square(int a[2][9][9], int h, int w){
	int i, j, cnt[10] = {}, k;
	for (i = h; i < h + 3; i++)
		for (j = w; j < w + 3; j++)
			cnt[a[0][i][j]]++;
	for (k = 1; k <= 9; k++) {
		if (cnt[k] > 1) {
			for (i = h; i < h + 3; i++)
				for (j = w; j < w + 3; j++)
					if (a[0][i][j] == k) a[1][i][j] = 1;
		}
	}
}

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

#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set
#define pll pair<ll, ll>
#define vll vector<ll>
#define mll map<ll, ll>

using namespace std;

const ll MOD = 1000000007LL;
const ll INF = (1LL << 60LL);

int main() {
  // std::cout << std::fixed << std::setprecision(10);
  ll N;
  scanf("%lld", &N);

  mll m;

  ll sum = 0;
  for (ll i = 0; i < N; i++) {
    ll v;
    scanf("%lld", &v);

    m[v] += 1;
    sum += v;
  }

  ll Q;
  scanf("%lld", &Q);

  for (ll i = 0; i < Q; i++) {
    ll a, b;
    scanf("%lld %lld", &a, &b);

    ll c = m[a];

    ll plus = (b - a) * c;
    sum += plus;
    cout << sum << endl;

    m[a] = 0;
    m[b] += c;
  }
}


Measured memory_bytes: 7132
/**Bismillahir Rahmanir Raheem
    Author:Refatul Fahad**/

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

#define ll long long
#define ull unsigned long long
#define ff first
#define ss second
#define pb push_back
#define vi vector<int>
#define pii pair<int,int>
#define pil pair<int,ll>
#define IOS  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
const int N = 1e5 + 5;
const ll M = (ll)1e9 + 7;
const double pi=2*acos(0.0);
const double esp=1e-9;
int Set(int N,int pos) {
    return N=N | (1<<pos);
}
int reset(int N,int pos) {
    return N= N & ~(1<<pos);
}
bool check(int N,int pos) {
    return (bool)(N & (1<<pos));
}

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

ll ar[2*N];
int main() {

    //IOS;
    /// freopen("input.txt","r",stdin);
    /// freopen("output.txt","w",stdout);

    int test=1;
    //cin>>test;
    for(int cs=1; cs<=test; ++cs) {
        ll n,mx=-1,ans,sum=0ll,k;

        cin>>n>>k;
        for(int i=1; i<=n; ++i) {
            cin>>ar[i];
            sum+=ar[i];
            mx=max(mx,ar[i]);
            //st.insert(x);
        }
        if(sum<=k) {
            cout<<1<<endl;
        } else {
            sort(ar+1,ar+n+1);
            int l=0,r=mx;
            ans=mx;
            while(l<=r&&(l!=0||r!=0)) {
                int mid=(l+r)>>1;
                //if(mid<=0)break;
                int cnt=0;
                for(int i=n; i>=1; --i) {
                    if(ar[i]/mid) {
                        if(ar[i]%mid) {
                            cnt+=(ar[i]/mid);
                        } else {
                            cnt+=((ar[i]/mid)-1);
                        }
                    } else {
                        break;
                    }
                }
                if(cnt<=k) {
                    r=mid-1;
                    ans=mid;
                } else {
                    l=mid+1;
                }
            }
            cout<<ans<<endl;
        }
    }
    return 0;
}



Measured memory_bytes: 5112
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
using namespace std;

using INT = long long;
using UINT = unsigned long long;

int main()
{
	int n;
	string a, b, c;
	cin >> n >> a >> b >> c;

	INT ans = 0;
	for (size_t i = 0; i < n; i++)
	{
		if (a[i] == b[i] && b[i] == c[i])
		{
			continue;
		}
		else if (a[i] == b[i] || b[i] == c[i] || c[i] == a[i])
		{
			ans++;
		}
		else
		{
			ans += 2;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<string>
#include<iostream>
using namespace std;
int main(){
  string text,pattern;
  cin>>text>>pattern;
  int t=text.length();
   int p=pattern.length();
   int max=p,count,temp;
  for(int i=0;i<=t-p;i++){
    temp=i;
    count=0;
    if(text.substr(i,i+p-1)==pattern){
      max=0;
      break;
    }
    else{
      for(int j=0;j<p;j++){
        if(text[temp++]!=pattern[j]){
          count++;
        }
      }
    if(count<=max)
      max=count;
    }
  }
 cout<<max;
  return 0;
}

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

typedef long long ll;
 
using tpl = tuple<int, int, int>;
typedef pair<int,int> pii;

void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}

ll X, Y;

int dp[101][101];
int dfs(int x, int y){
    if(dp[x][y]>=0) return dp[x][y];
    int res = 0;
    if(x <= 1 && y <= 1) {
        res = 0;
    }
    else{
        for(int i = 1; 0 <= x - i * 2; i++){
            res |= !dfs(x - i * 2, i + y);
        }
        for(int i = 1; 0 <= y - i * 2; i++){
            res |= !dfs(x + i, y - i * 2);
        }
    }
    return dp[x][y] = res;
}

int main(){

    cin >> X >> Y;
    // memset(dp, -1, sizeof(dp));
    // for(int x = 0; x <= 13; x++){
    //     for(int y = 0; y<= 13; y++){
    //         cout << x << ", " << y << ", " << dfs(x, y) << endl;
    //     }
    // }

    ll max_v = max(X, Y);
    ll min_v = min(X, Y);
    if(max_v - min_v >= 2){
        cout << "Alice" << endl;
    }
    else{
        cout << "Brown" << endl;
    }


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
using namespace std;
typedef long long lint;
typedef long double llf;
typedef pair<lint, lint> pi;
const int MAXN = 200000;
const int mod = 1e9 + 7;

struct kek{
	char x;
	int p, q, r;
};
vector<kek> v;
lint a[MAXN];

void Do(int A, int B){
	memset(a, 0, sizeof(a));
	a[0] = A;
	a[1] = B;
	for(auto &i : v){
		int p, q, r;
		tie(p, q, r) = make_tuple(i.p, i.q, i.r);
		if(i.x == '<') a[r] = (a[p] < a[q]);
		else a[r] = (a[p] + a[q]);
	}
	if(a[2] != A * B){
		cout << A << " " << B << " " << a[2] << endl;
	}
	assert(a[2] == A * B);
}

void G(int z, int x, int y){
	v.push_back({'<', x, y, z});
}

void A(int z, int x, int y){
	v.push_back({'+', x, y, z});
}


int main(){
	G(3, 2, 1); // ONE is in 3.
	G(42, 2, 1);
	for(int i = 0; i < 30; i++) A(42, 42, 42);
	for(int i = 29; i >= 0; i--){
		G(100 + i, 2, 1);
		for(int j=0; j<i; j++) A(100 + i, 100 + i, 100 + i);
		G(130, 230, 230); // init
		A(130, 0, 130);
		for(int j = i; j <= 29; j++) A(130, 100 + j, 130);
		G(100 + i, 130, 42); // if adding is ok?
		for(int j=0; j<i; j++) A(100 + i, 100 + i, 100 + i);
	}
	A(1, 3, 1);
	for(int i = 29; i >= 0; i--){
		G(200 + i, 2, 1);
		for(int j=0; j<i; j++) A(200 + i, 200 + i, 200 + i);
		G(230, 230, 230); // init
		for(int j = i; j <= 29; j++) A(230, 200 + j, 230);
		G(200 + i, 230, 1); // if adding is ok?
		for(int j=0; j<i; j++) A(200 + i, 200 + i, 200 + i);
	}
	for(int i = 29; i >= 0; i--){
		G(200 + i, 500, 200 + i);
		G(100 + i, 500, 100 + i);
	}
	for(int i = 0; i < 30; i++){
		for(int j = 0; j < 30; j++){
			G(420, 100 + i, 200 + j);
			for(int k = 0; k < i + j; k++) A(420, 420, 420);
			A(2, 420, 2);
		}
	}
	for(int i=0; i<=20; i++){
		for(int j=0; j<=20; j++){
			Do(i, j);
		}
	}
	cout << sz(v) << endl;
	for(auto &i : v){
		printf("%c %d %d %d\n", i.x, i.p, i.q, i.r);
	}
}


Measured memory_bytes: 5348
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T> ostream& operator<<(ostream& s,const multiset<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1'000'000'007;
const ll inf=1'000'000'000'000'000'00;
const int INF=1'000'000'000;
const double EPS=1e-10;
const double PI=acos(-1);

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    ll n,k;
    cin>>n>>k;
    vector<ll> a(n),f(n);
    rep(i,n){
        cin>>a[i];
    }
    rep(i,n){
        cin>>f[i];
    }
    sort(begin(a),end(a));
    sort(begin(f),end(f),greater<ll>());
    auto solve=[&](ll x){
        ll cnt=0;
        rep(i,n){
            if(a[i]*f[i]<=x) continue;
            cnt+=a[i]-x/f[i];
        }
        return cnt<=k;
    };
    ll ok=inf,ng=-1,mid;
    while(ok-ng>1){
        mid=(ok+ng)/2;
        if(solve(mid)) ok=mid;
        else ng=mid;
    }
    cout<<ok<<endl;
}

Measured memory_bytes: 6344
#include<bits/stdc++.h>
using namespace std;
const int MOD=998244353;
int a,b,c,d;
int f[3333][3333];
int main()
{
	ios_base::sync_with_stdio(false);
	cin>>a>>b>>c>>d;
	f[a][b]=1;
	for(int i=a;i<=c;i++)
	{
		for(int j=b;j<=d;j++)
		{
			if(i!=a||j!=b)
			{
				f[i][j]=(1ll*f[i-1][j]*j%MOD+1ll*f[i][j-1]*i%MOD-1ll*f[i-1][j-1]*(i-1)%MOD*(j-1)%MOD+MOD)%MOD;
			}
		}
	}
	cout<<f[c][d]<<endl;
	return 0;
}

Measured memory_bytes: 42536
#include<bits/stdc++.h>
#define debug cout<<"debug "<<++debug_num<<" :"
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
int debug_num=0;

const int maxn=1e5+10;

int a[maxn];
int n;
int b[maxn];//奇数
int c[maxn];

int main()
{
    //freopen("in.txt","r",stdin);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>n;
    for(int i=1;i<=n;++i){
        cin>>a[i];
    }
    int max1=0,maxx1;
    int max2=0,maxx2;
    for(int i=1;i<=n;++i){
        if(i%2==0){
            c[a[i]]++;
        }
        else{
            b[a[i]]++;
        }
    }
    for(int i=1;i<maxn;++i){
        if(b[i]>max1){
            max1=b[i];
            maxx1=i;
        }
        if(c[i]>max2){
            max2=c[i];
            maxx2=i;
        }
    }
    if(maxx1!=maxx2){
        cout<<n-max1-max2<<endl;
    }
    else{
        //cout<<maxx1<<" "<<maxx2<<endl;
        //取b次大
        int ans=n;
        b[maxx1]=0;
        int tp=max1;
        max1=0;
        for(int i=1;i<maxn;++i){
            if(b[i]>max1){
                max1=b[i];
            }
        }
        //cout<<max1<<" "<<max2<<endl;
        ans=min(ans,n-max1-max2);
        //取c次大
        c[maxx2]=0;
        max2=0;
        for(int i=1;i<maxn;++i){
            if(c[i]>max2){
                max2=c[i];
            }
        }
        //cout<<tp<<" "<<max2<<endl;
        ans=min(ans,n-tp-max2);
        cout<<ans<<endl;
    }
    return 0;
}



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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    ll d = 100;
    ll X;
    int ans = 0;
    Scll(X);
    while( d < X ){
        d += d/100;
        ans++;
    }

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

    return 0;
}



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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

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

typedef long long ll;
typedef pair<ll, ll> p;

int n, m;

struct edge{
  int to, cap, rev;
  edge(int t, int c, int r){
    to = t; cap = c; rev = r;
  }
};

vector<vector<edge>> g;
vector<bool> used;

// v start t goal f flow
int dfs(int v, int t, int f){
  if(v == t) return f;
  used[v] = true;
  // cout << v << ' ' << t << ' ' << f << endl;
  for(edge &e : g[v]){
    if(!used[e.to] && e.cap > 0){
      int d = dfs(e.to, t, min(f, e.cap));
      if(d > 0){
        e.cap -= d;
        g[e.to][e.rev].cap += d;
        return d;
      }
    }
  }
  return 0;
}

int maxflow(int s, int t){
  int flow = 0;
  while(true){
    used = vector<bool>(n, false);
    int f = dfs(s, t, INT_MAX);
    if(f == 0) return flow;
    flow += f;
    // cout << flow << endl;
    // cout << "======" << endl;
  }
}

void output(){
  for(auto a : g){
    for(auto b : a){
      cout << b.to << ' ' << b.cap << ' ' << b.rev << endl;
    }
    cout << "=============" << endl;
  }
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  g = vector<vector<edge>>(n);
  used = vector<bool>(n);
  rep(i, m){
    int from, to, cap;
    cin >> from >> to >> cap;
    g[from].push_back({to, cap, int(g[to].size())});
    g[to].push_back({from, 0, int(g[from].size())-1});
  }
  // output();
  // cout << "+================================" << endl;
  cout << maxflow(0, n-1) << endl;
}



Measured memory_bytes: 3272
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <istream>
#include <iterator>
#include <sstream>
#include <list>
#include <map>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iomanip>
#define BR "\n"
#define REP(i,n) for(int (i)=0;(i)<(n);++(i))
#define ALL(cont) begin(cont),end(cont)
#define AS_MOD(a,b) ((((a) % (b) ) + (b)) % (b))
#define FEACH(it,cont) for(auto (it) = begin(cont); it!=end(cont);++it)
#define FEACHR(it,cont) for(auto (it) = rbegin(cont); it!=rend(cont);++it)
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define getll() ([](){ll s;scanf("%lld", &s);return s;})()
#define getld() ([](){ld s;scanf("%Lf", &s);return s;})()
#define prl(P) printf("%lld", P)
#define prd(P) printf("%.10Lf", P)
#define pr(P) printf(P)
#define MAX(V, T) V=max(V,T)

#define DumpArray(cont,from,to) for(int __i=from;__i<to;++__i) {cout<<"(" <<__i<<": " << cont[__i]<<")";} cout<<endl;

using namespace std;
typedef long long ll;
typedef long double ld;
int N;
vector<string> S;
int main() {
    cin >> N;
    S.resize(N);
    int byo=0;
    REP(i,N)
        cin>>S[i];
    REP(i,N)
        REP(j,S[i].size()-1)
            if (S[i][j]=='A'&&S[i][j+1]=='B')
                byo++;
    int x=0,y=0,z=0;
    REP(i,N) {
        if (S[i][0]=='B'&&*S[i].rbegin()=='A') {
            x++;
        } else if (S[i][0]=='B') {
            y++;
        } else if (*S[i].rbegin()=='A') {
            z++;
        }
    }
    if (x>=2) {
        byo+=x-1;
        x=1;
    }
    if (x==1) {
        if (y>0) {
            byo++;
            y--;
        }
        if (z>0) {
            byo++;
            z--;
        }
    }
    byo+=min(y,z);
    cout << byo << endl;

    return 0;
}


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

int main(void) {
	int N;
	cin >> N;
	vector<string> S(N);
	int count = 0;
	for (int i = 0; i < N; i++)
	{
		cin >> S[i];
		for (int j = 0; j < S[i].size()-1; j++)
		{
			string s;
			s.push_back(S[i][j]);
			s.push_back(S[i][j + 1]);
			if ( s == "AB") {
				count++;
			}
		}
	}

	int b_num = 0;
	int a_num = 0;
	int ab_num = 0;
	for (int i = 0; i < N; i++)
	{
		if (S[i].front() == 'B')
		{
			b_num++;
		}

		if (S[i].back() == 'A')
		{
			a_num++;
		}

		if (S[i].front() == 'B' && S[i].back() == 'A')
		{
			ab_num++;
		}
	}
	if (a_num == b_num && b_num == ab_num && ab_num != 0)
	{
		cout << count + min(a_num, b_num) - 1 << endl;
	}
	else
	{
		cout << count + min(a_num, b_num) << endl;
	}
	return 0;
}

Measured memory_bytes: 768
#include <stdio.h>
int main(void) {
	int i, ii, m, n, sum;
	scanf("%d %d", &n, &m);
	int matrixA[n][m], matrixB[m];
	// ????????§for????????????????????????????????¨????????¨, ?¶??¶??????¶???????????????????????????????????§?????????????????????????????????, ????¨??????¨???????????§scanf??§???????????£????????????. 
	for (i = 1; i <= n; i ++) for (ii = 1; ii <= m; ii ++) scanf("%d", &matrixA[i - 1][ii - 1]);
	for (i = 1; i <= m; i ++) scanf("%d", &matrixB[i - 1]);
	for (i = 1; i <= n; i ++) {
		sum = 0;
		for (ii = 1; ii <= m; ii ++) sum += matrixA[i - 1][ii - 1] * matrixB[ii - 1];
		printf("%d\n", sum);
	}
	return 0;
}

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

constexpr int64_t INF = 1'010'000'000'000'000'017LL;
constexpr int64_t MOD = 1'000'000'007LL;
constexpr double EPS = 1e-12;
constexpr double PI = 3.14159265358979323846;

#define FOR(i, start, end) for(int64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

signed main() {
  uint64_t n, k;
  cin >> n >> k;
  
  uint64_t r = 0;
  while(n>0){
    n /= k;
    r++;
  }
  cout << r << endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

const int64_t DMAX = 2'000 * 1e9;

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

    vector<int64_t> dist(n);
    vector<tuple<int, int, int64_t>> edges;

    rep(i, m)
    {
        int a, b;
        int64_t c;
        cin >> a >> b >> c;
        a--;
        b--;
        edges.push_back(make_tuple(a, b, -c));
    }

    fill(dist.begin(), dist.end(), DMAX + 1);
    dist[0] = 0;
    rep(i, n - 1)
    {
        for (const auto& e : edges) {
            int a, b;
            int64_t c;
            tie(a, b, c) = e;
            dist[b] = min(dist[b], dist[a] + c);
        }
    }

    int64_t result = dist[n - 1];
    rep(i, n)
    {
        for (const auto& e : edges) {
            int a, b;
            int64_t c;
            tie(a, b, c) = e;
            dist[b] = min(dist[b], dist[a] + c);
        }
    }

    if (dist[n - 1] < result) {
        cout << "inf" << endl;
    } else {
        cout << -result << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int  s;
    cin >>s;
    set<int> st;
    int x = s;
    while(st.count(x) == 0){
        st.insert(x);
        if(x%2 == 0){
            x/= 2;
        }else{
            x = x*3+1;
        }
    }
    cout <<st.size()+1<<endl;
    return 0;
}

Measured memory_bytes: 256
N,M,X,Y=map(int,input().split())

x=list(map(int,input().split()))
y=list(map(int,input().split()))

x.sort()
y.sort()


if y[0]>x[N-1] and y[0]>X and x[N-1]<Y:
  print('No War')
else:
  print('War')

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <random>

#define _overload(a, b, c, d, ...) d
#define _rep1(X, A, Y) for (int (X) = (A);(X) <= (Y);++(X))
#define _rep2(X, Y) for (int (X) = 0;(X) < (Y);++(X))
#define rep(...) _overload(__VA_ARGS__, _rep1, _rep2)(__VA_ARGS__)
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define all(X) (X).begin(),(X).end()
#define len(X) ((int)(X).size())
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int MAX_N = 100000-1;
int N;
ll A[MAX_N];

ll ans[MAX_N];

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

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

  rep(i, N) {
    ans[0] += (i%2 == 0 ? A[i] : -A[i]);
  }

  for (int i = 1; i < N; ++i) {
    ans[i] = 2*A[i-1] - ans[i-1];
  }

  rep(i, N) {
    cout << ans[i] << (i+1 == N ? '\n' : ' ');
  }

  return 0;
}


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

ll n,ans=0;
ll dt[3]={3,5,7};
vector<ll> number;

void dfs(ll a){
  number.push_back(a);
  rep(i,3) if(a*10+dt[i]<=n) dfs(a*10+dt[i]);
}

int main(){
  cin>>n;
  rep(i,3) dfs(dt[i]);
  rep(i,number.size()){
    bool flag3=false,flag5=false,flag7=false;
    ll tmp=number[i];
    while(tmp>0){
      if(tmp%10==3) flag3=true;
      if(tmp%10==5) flag5=true;
      if(tmp%10==7) flag7=true;
      tmp/=10;
    }
    if(flag3 && flag5 && flag7) ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 640
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

A, B = map(int, input().split())

print(max(A + B, A - B, A * B))


Measured memory_bytes: 8264
#include<iostream>
#include<cstring>

int w,h;

int d[100][100];
char c;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};

int main(){
	while( std::cin>>h>>w , (w || h) ){
		memset(d,-1,sizeof(d));
		for(int i=0;i<h;++i){
			for(int l=0;l<w;++l){
				std::cin>>c;
				if( c=='>' )
					d[l][i]=0;
				else if( c=='v' )
					d[l][i]=1;
				else if( c=='<' )
					d[l][i]=2;
				else if( c=='^' )
					d[l][i]=3;
			}
		}
		int Point[2]={0,0};
		while(1){
			if( d[Point[0]][Point[1]] == -1 ){
				break;
			}else if( d[Point[0]][Point[1]] < 4 ){
				int dnum=d[ Point[0] ][ Point[1] ];
				d[Point[0]][Point[1]]=4;
				Point[0]+=dx[ dnum ];
				Point[1]+=dy[ dnum ];
			}else{
				Point[0] = Point[1] = -1;
				break;
			}
		}
		if( Point[0]==-1 && Point[1]==-1 ){
			std::cout<<"LOOP"<<std::endl;
		}else{
			std::cout<<Point[0]<<" "<<Point[1]<<std::endl;
		}
	}
}

Measured memory_bytes: 1212
#include<bits/stdc++.h>
#define fo(i,a,b) for(int i=(a);i<(b);i++)
#define qi queue<int>
#define vi vector<int>
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define fi first
#define se second
#define prq priority_queue
#define foreach(it,c) for(__typeof((c).begin()) it=c.begin();it!=c.end();it++)
//#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
using namespace std;
inline ll read(){
	ll x=0;
	int f=1;
	char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-')f=-f;
	for(;isdigit(c);c=getchar())x=x*10+(c-'0');
	return x*f;
}
inline void out(int x){
	if(x>=10)out(x/10);
	putchar(x%10+'0');
}
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
int n,m,d[22][22][22][22];
char c[22][22]; 
int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	queue<pii> q;
	cin>>n>>m;
	fo(i,0,n) fo(j,0,m)cin>>c[i][j];
	fo(i1,0,n) fo(j1,0,m) fo(i2,0,n) fo(j2,0,m)d[i1][j1][i2][j2]=1e9;
	fo(i,0,n) fo(j,0,m) if(c[i][j]!='#'){
		q.push(mp(i,j));
		d[i][j][i][j]=0;
		while(!q.empty()){
			int x=q.front().fi,y=q.front().se;
			q.pop();
			fo(k,0,4){
				int nx=x+dx[k],ny=y+dy[k];
				if(nx<0||nx>=n||ny<0||ny>=m||c[nx][ny]=='#')continue;
				if(d[i][j][nx][ny]==1e9){
					d[i][j][nx][ny]=d[i][j][x][y]+1;
					q.push(mp(nx,ny));
				}
			}
		}
	}
	int ans=0;
	fo(i1,0,n) fo(j1,0,m) fo(i2,0,n) fo(j2,0,m) if(d[i1][j1][i2][j2]!=1e9)ans=max(ans,d[i1][j1][i2][j2]);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main(){
    int r, c, sum;
    cin >> r;
    cin >> c;
    int vec[r+1][c+1];

    for ( int row = 0; row < r; row++ ) {
        sum = 0;
        for ( int column = 0; column < c; column++ ) {
            cin >> vec[row][column];
            sum += vec[row][column];
        }
        vec[row][c] = sum; 
    }

    for ( int column = 0; column < c + 1; column++ ) {
        sum = 0;
        for ( int row = 0; row < r; row++ ) {
            sum += vec[row][column];
        }
        vec[r][column] = sum;
    }

    for ( int row = 0; row < r + 1; row++ ) {
        sum = 0;
        for ( int column = 0; column < c; column++ ) {
            cout << vec[row][column] << ' ';
        }
        cout << vec[row][c] << endl;
    }  
    return 0;
}


Measured memory_bytes: 3088
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
const int inf = 1012345678;
int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	int N, E, T;
	cin >> N >> E >> T; --T;
	vector<int> W(N);
	for (int i = 0; i < N; ++i) cin >> W[i];
	vector<int> G(E);
	vector<vector<int> > S(E);
	for (int i = 0; i < E; ++i) {
		int num;
		cin >> G[i] >> num; --G[i];
		S[i].resize(num);
		for (int j = 0; j < num; ++j) {
			cin >> S[i][j]; --S[i][j];
		}
	}
	vector<int> ans(N, inf);
	for (int i = 0; i < N; ++i) {
		if (W[i] == 1) ans[i] = 1;
	}
	while (true) {
		// at most N loops
		vector<int> nxt = ans;
		for (int i = 0; i < E; ++i) {
			vector<int> d;
			for (int j : S[i]) {
				d.push_back(ans[j]);
			}
			sort(d.begin(), d.end(), greater<int>());
			if (d[0] == inf) continue;
			int sub = 0;
			for (int j = 0; j < d.size(); ++j) {
				sub = max(sub, d[j] + j);
			}
			nxt[G[i]] = min(nxt[G[i]], sub);
		}
		if (ans == nxt) break;
		ans = nxt;
	}
	cout << (ans[T] != inf ? ans[T] : -1) << endl;
	return 0;
}


Measured memory_bytes: 3272
#include <iostream>

using namespace std;

int main(){
    
    int n, max, min, diff, diff_temp;
    cin >> n;
    cin >> min;
    for(int i = 0; i < n - 1; i++){
        int val;
        cin >> val;
        if(i == 0){
            diff = val - min;
            diff_temp = diff;
        }
        diff_temp = val - min;
        if(val < min) {
            min = val;
            //cout << "enter if" << min << endl;
        }
        if(diff_temp > diff){
            diff = diff_temp;
        }
    }
    cout << diff << endl;
    
    return 0;
}


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

int main(){

  int n,y,d,m;
  int sum;
  cin >> n;

  for(int j=0; j<n; j++){
    cin >> y >> m >> d;
    sum=0;

    if(m%2==0 && y%3!=0){
      sum += 19-d;
    }
    else{
      sum += 20-d;
    }

    //cout << y << m << d << endl;

    for(int i=m+1; i<=10; i++){
      if(i%2==0 && y%3!=0){
        sum += 19;
      }
      else{
        sum += 20;
      }
    }
  //  cout << "ok2" << endl;

    for(int i=y+1; i<1000; i++){
      sum += 20*10;
      if(i%3!=0){
        sum -= 5;
      }
    }

    cout << sum+1 << endl;

  }


  return 0;
}

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

using namespace std;
typedef long long ll;

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

const int MOD = 1e9 + 7;

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

    cout <<n*n-a << endl;
    return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
 
using namespace std;
 
typedef long long int64;
 
int main()
{
  int64 S, T, D, W[100000];
 
  cin >> S >> T >> D;
  int64 sum = 0, minimum = 0;
  for(int i = 0; i < D; i++) {
    cin >> W[i];
    sum += W[i];
    minimum = min(minimum, sum);
  }
 
  if(sum > 0 && S + minimum > T) {
    cout << -1 << endl;
  } else {
    sum *= -1;
    int64 ret = 0;
 
    if(S + minimum > T) {
      int64 add = (S + minimum - T) / sum;
      ret += add * D;
      S -= add * sum;
    }
    int idx = 0;
    while(S > T) {
      S += W[idx++ % D];
      ++ret;
    }
    cout << ret << endl;
  }
}

Measured memory_bytes: 3872
A,B,C = map(int,input().split())
K = int(input())

count = 0
for i in range(100):
    if A < B:
        break
    B = B*2
    count += 1

for i in range(100):
    if B < C:
        break
    C = C*2
    count += 1

if count <= K:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9180
#include <iostream>
#include <bitset>
using namespace std;
int n, a, s, i;
bitset<4000000> bs;
int main()
{
	bs[0] = 1;
	cin>>n;
	while(n--)
    {
		cin>>a;
        bs|=bs<<a;
        //for(int j=0; j<bs.size(); j++)
      //  {
       //     cout<<bs[j];
       // }
        //cout<<endl;
        s+=a;
	}
	for(i=(s+1)/2; !bs[i]; i++);
	cout<<i;
	return 0;
}
//已有的1代表当前能加到的
//对于新进入的数
//右移x位就能凑出所有新能形成的数


Measured memory_bytes: 1664
#include <cstdio>

int main(int argc, char *argv[]) {
	int rcv;
	fscanf(stdin, "%d", &rcv);
	unsigned long long a = 1ULL;
	for (int i = 2; i <= rcv; i++) {
		a *= i;
	}
	printf("%lld\n", a);
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <utility>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <climits>
using namespace std;
int num(int a, int b, int c) {
	return abs(b - a) + abs(c - b);
}
signed main()
{
	ios::sync_with_stdio(false);
	string s, t;
	cin >> s >> t;
	int judge = 0;
	for (int z = 0; z < s.size()+2; z++) {
		char tmp;
		if (s == t) {
			judge = 1; break;
		}
		tmp = s[s.size() - 1];
		for (int i = s.size()-1; i >=1; i--) {
			s[i] = s[i - 1];
		}
		s[0] = tmp;
	}
	if (judge == 1)cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

public static void main(String args[]) {
	Scanner s = new Scanner(System.in);
	int a =s.nextInt();
	int a1 = a/3600,a2 = a%3600;
	int b1 = a2/60,c1 = a2%60;
	System.out.println(a1+":"+b1+":"+c1);
	s.close();
}


}



Measured memory_bytes: 26132
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    int H, W, A, B;
    cin >> H >> W >> A >> B;
    REP(i, H) {
        REP(j, W) {
            if ((i < B) ^ (j < A))
                cout << 1;
            else
                cout << 0;
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(c) c.begin(),c.end()
#define PB push_back

using namespace std;
typedef long long ll;

int main()
{
  int N; cin >> N;
  ll hist[5] = { };
  REP(i, N) {
    string S;
    cin >> S;
    if (S[0] == 'M') hist[0]++;
    if (S[0] == 'A') hist[1]++;
    if (S[0] == 'R') hist[2]++;
    if (S[0] == 'C') hist[3]++;
    if (S[0] == 'H') hist[4]++;
  }
  ll ans = 0;
  for (int i = 0; i < 5; i++) {
    for (int j = i + 1; j < 5; j++) {
      for (int k = j + 1; k < 5; k++) {
        ans += hist[i] * hist[j] * hist[k];
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <list>
#include <string>
#include <map>
#include <vector>
#include <stack>
#include <queue>
using namespace std;
#define REPD(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) REPD(i, 0, n)
typedef long long ll;
#define fin(ans) cout << (ans) << '\n'
/*

*/
int main()
{
    int S;
    cin >> S;
    int A,B;
    A = S/100;
    B = S%100;
    if(1 <= A && A <= 12){
        if(1 <= B && B <= 12) fin("AMBIGUOUS"); //AもBも範囲内
        else  fin("MMYY"); //Bだけ範囲外
    }else{
        if (1 <= B && B <= 12) fin("YYMM"); //Aだけ範囲外
        else fin("NA"); //両方範囲外
    }
    
    return 0;
}

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

  int distans = abs(b - a) + abs(b - c);

  if ((abs(a - c) <= d) || ((abs(b - a) <= d) && (abs(b - c) <= d))) {
    cout << "Yes" << endl;
  }else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();

        int d = b - a;

        int sum = 0;
        for (int i = 0; i < d; i++) {
            sum += i;
        }

        System.out.println(sum - a);
    }
}

Measured memory_bytes: 21844