akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define printYes() cout << "Yes" << endl;
#define printNo() cout << "No" << endl;
#define printVector(v) rep(i, v.size()) cout << v[i] << endl;

int main()
{
  int H, W;
  cin >> H >> W;
  vector<string> grid(H);
  rep(i, H)
  {
    cin >> grid[i];
  }
  vector<bool> deleteH(H, false), deleteW(W, false);
  rep(h, H)
  {
    bool is_all_white = true;
    rep(w, W)
    {
      if (grid[h][w] == '#')
        is_all_white = false;
    }
    if (is_all_white)
      deleteH[h] = true;
  }
  rep(w, W)
  {
    bool is_all_white = true;
    rep(h, H)
    {
      if (grid[h][w] == '#')
        is_all_white = false;
    }
    if (is_all_white)
      deleteW[w] = true;
  }

  rep(h, H)
  {
    if (deleteH[h])
      continue;
    rep(w, W)
    {
      if (deleteW[w])
        continue;
      cout << grid[h][w];
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

bool v[110000];

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	int s; cin >> s;
	priority_queue<pi> q;
	for(int i = 1; i <= 9; i++) q.emplace(-i, i);
	
	ll ans = 1e18;
	while(!q.empty()){
		int cost, sum; tie(cost, sum) = q.top(); q.pop();
		if(v[sum]) continue;
		v[sum] = 1;
		
		if(sum == 0){
			cout << -cost << endl;
			return 0;
		}
		
		rep(it, 2){
			int ncost, nsum;
			if(it == 0){
				ncost = -cost + 1;
				nsum = (sum + 1) % s;
			}
			else{
				ncost = -cost;
				nsum = (sum * 10) % s;
			}
			
			if(!v[nsum]) q.emplace(-ncost, nsum);
		}
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 1020
#include <iostream>
#include <vector>
#include <map>
#include <utility>
using namespace std;

int main(){
  int N,M; cin >> N >> M;
  int ab[M][2];
  vector<int> one;
  map<int,int> n;
  for(int i=0; i<M; i++){
    cin >> ab[i][0] >> ab[i][1];
    if(ab[i][0]==1){one.push_back(ab[i][1]);}
    if(ab[i][1]==N){n.insert(make_pair(ab[i][0],ab[i][0]));}
  }
  
  for(int i=0; i<one.size(); i++){
    if(n.find(one[i])!=n.end()){
      cout << "POSSIBLE"; break;
    }
    else if(i==one.size()-1){cout << "IMPOSSIBLE";}
  }
  
  return 0;
}

Measured memory_bytes: 6904
#include<stdio.h>
int main()
{
int m,f,r;
for(;;){

scanf("%d %d %d",&m,&f,&r);
if(m==-1 && f==-1 && r==-1)
break;
if(m==-1 || f==-1)
printf("F\n");
else if(m+f>=80)
printf("A\n");
else if(m+f>=65)
printf("B\n");
else if(m+f>=50)
printf("C\n");
else if(m+f>=30){
if(r>=50)
printf("C\n");
else
printf("D\n");}
else
printf("F\n");

}
return 0;
}



Measured memory_bytes: 2052
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = LIST()

ans = 3**N
tmp = 1
for a in A:
	if a % 2 == 0:
		tmp *= 2
print(ans-tmp)


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

// begin fast read template by CYJian (source: https://www.luogu.com.cn/paste/i11c3ppx)

namespace io {
	const int __SIZE = (1 << 21) + 1;
	char ibuf[__SIZE], *iS, *iT, obuf[__SIZE], *oS = obuf, *oT = oS + __SIZE - 1, __c, qu[55]; int __f, qr, _eof;
	#define Gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, __SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	inline void flush () { fwrite (obuf, 1, oS - obuf, stdout), oS = obuf; }
	inline void gc (char &x) { x = Gc(); }
	inline void pc (char x) { *oS ++ = x; if (oS == oT) flush (); }
	inline void pstr (const char *s) { int __len = strlen(s); for (__f = 0; __f < __len; ++__f) pc (s[__f]); }
	inline void gstr (char *s) { for(__c = Gc(); __c < 32 || __c > 126 || __c == ' ';)  __c = Gc();
		for(; __c > 31 && __c < 127 && __c != ' '; ++s, __c = Gc()) *s = __c; *s = 0; }
	template <class I> inline bool gi (I &x) { _eof = 0;
		for (__f = 1, __c = Gc(); (__c < '0' || __c > '9') && !_eof; __c = Gc()) { if (__c == '-') __f = -1; _eof |= __c == EOF; }
		for (x = 0; __c <= '9' && __c >= '0' && !_eof; __c = Gc()) x = x * 10 + (__c & 15), _eof |= __c == EOF; x *= __f; return !_eof; }
	template <class I> inline void print (I x) { if (!x) pc ('0'); if (x < 0) pc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10; while (qr) pc (qu[qr --]); }
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
} using io::pc; using io::gc; using io::pstr; using io::gstr; using io::gi; using io::print;

// end fast read template by CYJian

#define iter(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i, a) iter(i, 0, a)
#define rep1(i, a) iter(i, 1, (a)+1)
#define log(a) cerr<<"\033[32m[DEBUG] "<<#a<<'='<<(a)<<" @ line "<<__LINE__<<"\033[0m"<<endl
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair
 
using ll=long long;
using pii=pair<int, int>;
//#define int ll
const int MOD = 1000000007;

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    char a, b, c;
	gc(a), gc(b), gc(c);
	if(a == '7' || b == '7' || c == '7') pstr("Yes");
	else pstr("No");
}


Measured memory_bytes: 3664
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
bool isprime(ll a){
  if(a==2)return 1;
  if(!(a&1))return 0;
  for(ll i=3;i*i<=a;i+=2)
    if(a%i==0)return 0;
  return 1;
}
ll mpow(ll base,ll exponent,ll modulus){
  if(modulus==1)return 0;
  long long result = 1;
  base=base%modulus;
  while(exponent){
    if(exponent%2 == 1)
    result=(result*base)%modulus;
    exponent=exponent>>1;
    base=(base*base)%modulus;
  }
  return result;
}
ll minv(ll a,ll mod){
  ll _gcd=gcd(a,mod);
  assert(_gcd==1);
  return mpow(a,mod-2,mod);
}


/*
ll ncr(ll N,ll K){
  if(N<K)return 0;
  if(K==0)return 1;
  if(N==0)return 0;

  ll den=1;
  for(ll i=1;i<=K;i++)den*=i;
  ll num=1;
  while(K--){
    num*=N;
    if(num%den==0){
      num/=den;
      den=1;
    }
    N--;
  }

  return num;
}
*/
int x;
int main(){FAST;
cin>>x;
if(x>=30){
  cout<<"Yes";
}
else cout<<"No";
return 0;
}

/*
 WA? check edge cases, N=1,M=1 etc. Read code fully once and check all variables.
 Read the question again and see what you might have missed.
 Consider changing your solution or find more cases.
 */


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main(){
  int q;
  cin >> q;
  list<int> L;
  auto itr = L.begin();
  for (int i = 0; i < q; i++){
    int t;
    cin >> t;
    if (t == 0){
      int x;
      cin >> x;
      L.insert(itr, x);
      itr--;
    }
    if (t == 1){
      int d;
      cin >> d;
      if (d > 0){
        for (int j = 0; j < d; j++){
          itr++;
        }
      }
      if (d < 0){
        for (int j = 0; j < -d; j++){
          itr--;
        }
      }
    }
    if (t == 2){
      itr = L.erase(itr);
    }
  }
  for (itr = L.begin(); itr != L.end(); itr++){
    cout << *itr << endl;
  }
}


Measured memory_bytes: 18612
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int n,m;
int a,b;
vector < int > v[100005];
int dp[100005];
int out[100005];
void dfs(int node ,int prev)
{
	dp[node]=1;
	for(auto it: v[node])
	{
		if(it!=prev)
			{
				dfs(it,node);
				dp[node]=1LL*dp[node]*(dp[it]+1)%m;
			}
	}
}
void dfs2(int node, int prev)
{
	int f=v[node].size();
	vector < int > pref (f) , suf(f);
	pref.resize(f);
	suf.resize(f);
	out[node]=dp[node];
	int last=1;
	for(int i=0;v[node].size()>i;i++)
		{
			pref[i]=1LL*last*(dp[v[node][i]]+1)%m;
			last=pref[i];
		}
	last=1;
	for(int i=v[node].size()-1;i>=0;i--)
	{
		suf[i]=1LL*last*(dp[v[node][i]]+1)%m;
		last=suf[i];
	}
	for(int i=0;v[node].size()>i;i++)
	{
		if(v[node][i]==prev)
			continue;
		int ile=dp[v[node][i]];
		int it=v[node][i];
		int val=1;
		if(i>0)
			val=1LL*val*pref[i-1]%m;
		if(i<v[node].size()-1)
			val=1LL*val*suf[i+1]%m;
		int co=dp[node];
		dp[node]=val;
		dp[it]=(1LL*dp[it]*(val+1))%m;
		dfs2(it,node);
		dp[it]=ile;
		dp[node]=co;
	}
}


int main(){
	scanf("%d%d",&n,&m);
	for(int i=0;n-1>i;i++)
	{
		scanf("%d%d",&a,&b);
		v[a].push_back(b);
		v[b].push_back(a);
	}
	dfs(1,-1);
	dfs2(1,-1);
	for(int i=1;n>=i;i++)
		printf("%d\n",out[i]);
	return 0;
}


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

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

int main(){

  int A,B,C,X,Y;
  cin>>A>>B>>C>>X>>Y;
  int S[3];
  S[0]=A*X+B*Y;
  S[1]=2*C*min(X,Y)+A*(X-min(X,Y))+B*(Y-min(X,Y));
  S[2]=max(X,Y)*2*C;
  sort(S,S+3);
  cout<<S[0]<<endl;
  

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> P3;
const ll MOD = 1000000007;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(1e4 + 5);
const double EPS = 1e-11;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

ll n, m, s[20], d[1005], dp[1<<16], sum[1<<16];

int main() {
    while(cin >> n >> m, n){
        REP(i,n) cin >> s[i];
        REP(i,m) cin >> d[i];

        // init
        fill(sum, sum+(1<<n),0);
        fill(dp,dp+(1<<n),LLINF/3);
        REP(i,(1<<n)){
            REP(j,n){
                if((i>>j)&1) sum[i] += s[j];
            }
        }
        dp[0] = 0;
        REP(i,m) dp[0] += d[i];

        // dp[S] = 使う布団の集合Sとしたときの最小値
        for(int S=1;S<(1<<n);S++){
            REP(i,n){
                if((S>>i)&1){
                    int j = S^(1<<i);  // i番目の布団を除いたとき
                    ll tmp = dp[j];
                    REP(k,m){
                        if(abs(d[k]-sum[S]) < abs(d[k]-sum[j])){
                            tmp -= abs(d[k]-sum[j]);
                            tmp += abs(d[k]-sum[S]);
                        }
                    }
                    dp[S] = min(dp[S], tmp);
                }
            }
        }
        cout << dp[(1<<n)-1] << endl;
    }
    return 0;
}



Measured memory_bytes: 3528
#include<iostream>
 
using namespace std;
 
int main()
{
 
  int a, b, c;
 
  cin >> a >> b >> c;
 
  if ( a < b )
  {
    if ( c < a )
    {
      cout << c << " " << a << " " << b << endl;
    }
    else if ( b < c )
    {
      cout << a << " " << b << " " << c << endl;
    }
    else
    {
      cout << a << " " << c << " " << b << endl;
    }
  }
  else
  {
    if ( c < b )
    {
      cout << c << " " << b << " " << a << endl;
    }
    else if ( a < c )
    {
      cout << b << " " << a << " " << c << endl;
    }
    else
    {
      cout << b << " " << c << " " << a << endl;
    }
  }
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>


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

  int n;
  cin>>n;
  vi a(n);
  rep(i,n){
    cin>>a[i];
  }
  vector<P> b;
  rep(i,n){
    b.PB(P(a[i],i));
  }
  sort(all(b));

  set<P> sr,sl;
  int ans=0;
  rep(i,n){
    auto itr=sr.lower_bound(P(b[i].S,b[i].F));
    auto itl=sl.lower_bound(P(-b[i].S,b[i].F));
    int r,l;
    if(itr==sr.end()) r=n;
    else r=itr->F;
    if(itl==sl.end())
      l=-1;
    else l=-itl->F;
    //cout<<l<<' '<<r<<endl;
    ans+=b[i].F*(b[i].S-l)*(r-b[i].S);
    //cout<<ans<<endl;

    //cout<<r<<' '<<l<<endl;
    sr.insert(P(b[i].S,b[i].F));
    sl.insert(P(-b[i].S,b[i].F));
  }

  cout<<ans<<endl;

}

Measured memory_bytes: 30956
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
   long sum=0;
    cin>>s;
    for(int i=0;i<s.length();++i)
    {
      sum += s[i]-'0';
    }
    if(sum % 9 == 0)
    cout<<"Yes";
    else cout<<"No";

}

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

int x[102];
int main() {
	// your code goes here
	int n; 
	while(scanf("%d",&n)==1){
	
		int sum = 0; 
		for(int i=0;i<n;i++){
			scanf("%d",&x[i]);
			sum+=x[i];
		}
		
		sort(x,x+n);
		//int avg = sum/n;
		int avg = (int)round((sum*1.0)/(n*1.0));
		//int median = (n&1) ? x[n/2] : (x[n/2] + x[n/-1])/2;
		int total_cost = 0;
		for(int i=0;i<n;i++){
			//int cost = x[i]-median;
			int cost = x[i]-avg;
			total_cost+=cost*cost;
		}
		
		printf("%d\n", total_cost);
	}
	return 0;
}

Measured memory_bytes: 3768
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

// const ll MOD = 1e9 + 7;
const ll MOD = 998244353;
const ll INF = 1e16;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)

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; }

void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
//--------------------------------------------------------------------------------//
ll dp[3005][3005];
int main() {
    init();
    ll N,S;
    cin >> N >> S;
    vl A(N);
    rep(i, N) cin >> A[i];

    ll ans = 0;
    dp[0][0] = 1;
    rep(i,N){
        dp[i + 1][0] = dp[i][0] + 1;
        repe(j,1,S+1){
            (dp[i + 1][j] += dp[i][j]) %= MOD;
            if (j >= A[i]) (dp[i + 1][j] += dp[i][j - A[i]]);
     
        }
        (ans += dp[i + 1][S]) %= MOD;
    }

    cout << ans << endl;
}

Measured memory_bytes: 70784
#include<stdio.h>
#include<stdlib.h>

int comp(const void* a, const void* b){
    long int A = *(long int*)a;
    long int B = *(long int*)b;

    if(A > B){return 1;}
    if(A == B){return 0;}
    return -1;
}


int main(void){
    int N, M;
    scanf("%d %d", &N, &M);
    long int a[N][2];
    int i,j;
    for(i = 0; i < N; i++){scanf("%ld %ld", &a[i][0], &a[i][1]);}
    //for(i = 0; i < N; i++){for(j = 0; j < 2; j++){printf("%ld  ", a[i][j]);}}
    //return 0;
    qsort(a, N, sizeof(a[0]), comp);
    //for(i = 0; i < N; i++){printf("値段：%ld 本数:%ld\n", a[i][0], a[i][1]);}

    long int r = M;//買うべき残りの本数
    long int ans = 0;
    i = 0;
    while(r > 0){
        if(a[i][1] > r){
            ans += a[i][0] * r;
            break;
        }else{
            ans += a[i][0] * a[i][1];
            r -= a[i][1];
        }
        i++;
    }
    printf("%ld\n", ans);
    return 0;
}

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

signed main(void)
{
	int a, b;
	cin >> a >> b;
	if (a <= b)
		cout << a << endl;
	else
		cout << a - 1 << endl;
	return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#define ll long long
#define oku7 1000000007
#define MAXN (int)1e+5 * 2+1
using namespace std;

char mapData[100][100];
int costData[100][100];
ll imos[MAXN];
ll input[MAXN];
int dx[4] = { 0, 1, 0,-1 }; // x軸方向への変位
int dy[4] = { 1, 0,-1, 0 }; // y軸方向への変位

ll nC2(ll n) {
	if (n <= 1) return 0;
	return n * (n - 1) / 2;
}

int main() {
	ll N;
	cin >> N;
	for (ll i = 0; i < N; i++) {
		ll a;
		cin >> a;
		input[i] = a;
	}

	//累積和をとる
	imos[0] = input[0];
	for (ll i = 1; i < N; i++) {
		imos[i] = input[i] + imos[i - 1];
	}
	//同じものの個数を数える
	map<ll, ll> m;
	set<ll> s;
	for (ll i = 0; i < N; i++) {
		s.insert(imos[i]);
		if (m[imos[i]] == 0) m[imos[i]] = 1;
		else m[imos[i]]++;
	}

	ll ans = m[0];
	for (ll l : s) {
		ans+= nC2(m[l]);
	}

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

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

int main() {
    long a, b, c, d;
    cin >> a >> b >> c >> d;
    long score[4] = {a * c,
                    a * d,
                    b * c,
                    b * d};
    long max = score[0];
    for (int i = 1; i < 4; i++) {
        if (max < score[i]) { 
            max = score[i];
        }
    }
    cout << max << endl;
}

Measured memory_bytes: 3600
#include <stdio.h>
int main(void){
    int a[1000],i,n;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    for(i=n-1;i>=1;i--) { 
        printf("%d ",a[i]);
        } 
        printf("%d\n",a[0]); 
        return 0; 
}



Measured memory_bytes: 2124
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

#define MAX 301

int dp[3][MAX][MAX];
int N, M, v[MAX][3], w[MAX];

void solve(){
  for(int k = 0 ; k < 3 ; k++){
    for(int i = 0 ; i < N ; i++){
      for(int j = 0 ; j <= M ; j++){
	if(j < w[i]) dp[k][i+1][j] = dp[k][i][j];
	else dp[k][i+1][j] = max(dp[k][i][j], dp[k][i+1][j-w[i]] + v[i][k]);
      }
    }
  }
}

int main(){
  string name;
  int V, D, L;
  
  while(cin >> N >> M){
    memset(dp, 0, sizeof(dp));
    for(int i = 0 ; i < N ; i++){
      cin.ignore();
      getline(cin, name);
      cin >> w[i] >> v[i][0] >> v[i][1] >> v[i][2];
    }
    
    solve();
    
    int ans = 0;
    for(int k = 0 ; k < 3 ; k++){
      ans = max(ans, dp[k][N][M]);
    }
    
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 2272
#include <stdio.h>
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))

int main(){
	int a,b,c,k;
	scanf("%d%d%d%d",&a,&b,&c,&k);
	printf("%d",1*min(a,k)+0*min(b,max(0,k-a))+(-1)*min(c,max(0,k-a-b)));
}

Measured memory_bytes: 1704
#include <iostream>

using namespace std;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  string a, b, c;
  cin >> a >> b >> c;
  if ((a[a.length() - 1] == b[0]) && (b[b.length() - 1] == c[0]))
    cout << "YES\n";
  else
    cout << "NO\n";
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);
	static int[] A = new int[1000000];
	static int[] stack = new int[1000000];

	public static void main(String[] args) throws Exception {
		while (true) {
			int N = sc.nextInt();
			if (N == 0) break;
			int ans = solve(N);
			if (ans == -1) {
				System.out.println("NO COLOR");
			} else {
				System.out.println(ans);
			}
		}
	}

	static int solve(int N) {
		for (int i = 0; i < N; ++i) {
			A[i] = Integer.parseInt(sc.next());
		}
		int pos = 0;
		for (int i = 0; i < N; ++i) {
			if (pos == 0 || stack[pos - 1] == A[i]) {
				stack[pos++] = A[i];
			} else {
				--pos;
			}
		}
		if (pos == 0) return -1;
		int count = 0;
		for (int i = 0; i < N; ++i) {
			if (A[i] == stack[0]) ++count;
		}
		return count > N / 2 ? stack[0] : -1;
	}

}

Measured memory_bytes: 20000
#include <iostream>

using namespace std;
int main(){
  long n, v;
  cin >> n;
  v = n * 100 / 108;
  if(v * 108 / 100 == n){
  	cout << v;
  }else if((v+1) * 108 / 100 == n){
    cout << v+1;
  }else{
    cout << ":(";
  }
  cout << endl;
  return 0;
}

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

#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define mem(x,val) memset((x),(val),sizeof(x))
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define PI acos(-1.0) 
#define N 111111

const int INF = 1 << 30 ;
typedef long long ll ;
typedef pair < int , int > pii ;

int main() {
    int n, i ;
    scanf("%d %d" , &n ,&i) ;
    cout << n-i + 1 << endl ;
   
    return 0 ;
}

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

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int k = sc.nextInt();

		int l[] = new int [n];
		int total =0;

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

		Arrays.sort(l);
		for (int i=0; i<k; i++){
			total += l[n-1-i];
		}
		System.out.println(total);
	}

}


Measured memory_bytes: 23764
import random
import time
import copy
import math
start=time.time()
d=int(input())
c=list(map(int,input().split()))
s=[]
cli=[]
for i in range(d+1):
  ch=[]
  for j in c:
    ch.append(i*j)
  cli.append(ch)
for i in range(d):
  s.append(list(map(int,input().split())))
last=[0]*26
score=0
solution=[]
for day in range(1,d+1):
  co=[]
  dla=[]
  down=0
  for (i,j) in zip(last,c):
    down+=(day-i)*j
  for (i,j) in zip(last,c):
    dla.append(down-(j*(day-i)))
  for con in range(26):
    co.append(s[day-1][con]-dla[con])
  choice=co.index(max(co))
  score+=co[choice]
  last[choice]=day
  #print(choice+1)
  #print(score)
  solution.append(choice)
#print(score)
stemp=4000
etemp=100
def tem():
  return stemp-((stemp-etemp)*(time.time()-start)/1.9)
while time.time()-start<1.9:
  
  sc=0
  sol=copy.deepcopy(solution)
  for x in [random.randrange(d) for i in range(1)]:
    sol[x]=random.randrange(26)
  last=[0]*26
  for (day,i) in zip(range(1,d+1),sol):
    sc+=s[day-1][i]
    last[i]=day
    for (i,j) in zip(last,range(26)):
      sc-=cli[day-i][j]
  try:
    prob = math.exp((sc-score)/tem())
  except:
    prob=0
  #print("{} {}".format(sc,prob))
  if prob>random.random():
    solution=copy.deepcopy(sol)
    score=sc
    #print(score)
for i in solution:
  print(i+1)
#print(sco)


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

int main() {
    int h, w;
    cin >> h >> w;
    vector<vector<char>> a(h, vector<char>(w));
    for (int i = 0; i < h; i++) {
        for(int j = 0; j < w; j++) {
            cin >> a[i][j];
        }
    }
    for (int i = 0; i < h; i++) {
        bool r = true;
        for(int j = 0; j < w; j++) {
            if (a[i][j] == '#') {
                r = false;
                break;
            }
        }
        if (r) {
            for(int j = 0; j < w; j++) {
                a[i][j] = '*';
            }
        }
    }
    for (int i = 0; i < w; i++) {
        bool r = true;
        for(int j = 0; j < h; j++) {
            if (a[j][i] == '#') {
                r = false;
                break;
            }
        }
        if (r) {
            for(int j = 0; j < h; j++) {
                a[j][i] = '*';
            }
        }
    }
    for (int i = 0; i < h; i++) {
        bool o = false;
        for(int j = 0; j < w; j++) {
            if (a[i][j] != '*') {
                o = true;
                cout << a[i][j];
            }
        }
        if (o) {
            cout << endl;
        }
    }
}

Measured memory_bytes: 256
<?php
  
  fgets(STDIN);
$input = explode(" ", trim(fgets(STDIN)));

$l = count($input);

$f = false;

for ($i = 0; $i < $l; ++$i) {
    if ($input[$i] % 2 === 0) {
        if (!($input[$i] % 3 === 0 || $input[$i] % 5 === 0)) {
            $f = true;
        }
    }
}

if ($f) {
    echo 'DENIED';
} else {
    echo 'APPROVED';
}

Measured memory_bytes: 4728
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

int main() {
    fastio();

    int a, b, c;
    cin >> a >> b >> c;

    cout << (b - a == c - b ? "YES\n" : "NO\n");

    return 0;
}

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

int* mallocint(int si)
{
    return (int*) malloc(si * sizeof(int));
}

int* inputint(int n)
{
    int *ans = mallocint(n);
    for( int i = 0; i < n; i++ ) cin >> ans[i];
    return ans;
}

#define _LL long long

int main()
{
    int n;
    cin >> n;
    int *a = inputint(n);
    int q;
    cin >> q;
    int *b = new int[q];
    int *c = new int[q];
    for( int i = 0; i < q; i++ ) cin >> b[i] >> c[i];

    map<int, int> num;
    for( int i = 0; i < n; i++ ) num[i] = 0;
    _LL ans = 0;
    for( int i = 0; i < n; i++ ) 
    {
        ans += (_LL) (a[i]);
        num[a[i]]++;
    }

    for( int j = 0; j < q; j++ )
    {
        _LL n = num[b[j]];
        ans += n * c[j] - n * b[j];
        num[c[j]] += n;
        num[b[j]] = 0;
        cout << ans << endl;
    }

    return 0;    
}

Measured memory_bytes: 9460
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <fstream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    ll n, z = 1ll * mod * mod;
    cin >> n;
    for (ll i = 1; i * i <= n; i++) if (n % i == 0) z = min(z, i + n / i - 2);
    cout << z;
}


Measured memory_bytes: 3572
#include <iostream>
#include <vector>
#include <iomanip>
#include <stack>
#include <array>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <algorithm>
#include <iterator>
#include <string>
#include <cstring>
//#include <fstream>
#include <complex>
#define _USE_MATH_DEFINES
#include <cmath>
#include <math.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n;i>0;i--)
#define arep(a,i,n) for(int i=(a);i<(n);i++)
#define SORT(v) sort((v).begin(),(v).end())
const ll INF = (1LL << 50);
typedef pair<int, int> P;

int main() {

	string s;
	cin >> s;

	int l = s.size();

	int cnt = 0;
	for (int i = 0; i < l / 2; i++) {
		if (s[i] != s[l - i-1]) cnt++;
	}

	cout << cnt << endl;

	return 0;

}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

int m[21][21];

int main() {
	int n,x,y;
	while(n=in()){
		memset(m,0,sizeof(m));
		while(n--){
			cin>>x>>y;
			m[y][x]=1;
		}
		x=10;y=10;
		cin>>n;
		string d;
		int l,i;
		while(n--){
			cin>>d>>l;
			if(d=="N"){
				for(i=0;i<=l;i++){
					m[y+i][x]=0;
				}
				y+=l;
			}
			if(d=="S"){
				for(i=0;i<=l;i++){
					m[y-i][x]=0;
				}
				y-=l;
			}
			if(d=="E"){
				for(i=0;i<=l;i++){
					m[y][x+i]=0;
				}
				x+=l;
			}
			if(d=="W"){
				for(i=0;i<=l;i++){
					m[y][x-i]=0;
				}
				x-=l;
			}
		}
		bool ok=true;
		for(y=0;y<21;y++){
			for(x=0;x<21;x++){
//cout<<m[y][x];
				if(m[y][x])ok=false;
			}
//cout<<endl;
		}
		cout<<(ok?"Yes":"No")<<endl;
	}
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<ll> l(n);
  rep(i, n) cin >> l.at(i);

  int cnt = 0;
  for(int a = 0; a < n-2; a++){
    for(int b = a+1; b < n-1; b++){
      if(l.at(a) == l.at(b))
        continue;
      for(int c = b+1; c < n; c++){
        if(l.at(b) == l.at(c) || l.at(a) == l.at(c))
          continue;
        if((l.at(a) + l.at(b) > l.at(c))&&
           (l.at(b) + l.at(c) > l.at(a)) &&
           (l.at(c) + l.at(a) > l.at(b))){
          //cout << a+1 << " " << b+1 << " " << c+1 << endl;
          cnt++;
        }
      }
    }
  }
  
  cout << cnt << endl;
  return 0;
}



Measured memory_bytes: 3636
#include <iostream>
#include <iosfwd>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cassert>
#include <cctype>
#include <climits>
#include <vector>
#include <bitset>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <deque>
#include <string>
#include <list>
#include <iterator>
#include <sstream>
#include <complex>
#include <fstream>
#include <functional>
#include <numeric>
#include <utility>
#include <algorithm>
#include <assert.h>
#define lli long long int
#define lower(a) transform(a.begin(),a.end(),a.begin(),::tolower);


using namespace std;

const int N = 3e5 + 500;
const long long mod = 1e9 + 7;
const long long INF = 1LL << 57;
const int M = 1e6 + 500;

lli dp[500][N];

void solve()
{
    lli n, w;
    cin>>n>>w;
    vector<pair<lli, lli> > v;
    for(int i = 0; i < n; i ++)
    {
        lli x, y;
        cin>>x>>y;
        v.push_back({x, y});
    }
    for(int i = 0; i < n; i ++)
    {
        for(int j = 0; j <= w; j ++)
        {
            if(i == 0)
            {
                if(v[i].first <= j)
                    dp[i][j] = v[i].second;
                continue ;
            }
            dp[i][j] = dp[i - 1][j];
            if(v[i].first <= j)
            {
                dp[i][j] = max(dp[i][j], dp[i - 1][j - v[i].first] + v[i].second);
            }
        }
    }
    /*
    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j <= w; j ++)
            cout<<dp[i][j]<<' ';
        cout<<endl;
    }
    */
    cout<<dp[n - 1][w];
    return ;
}
/*
10
6
10 3 2 5 7 8
*/
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    lli t;
    t = 1;
//    cin>>t;
    while(t --)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 232448
#include <stdio.h>
int main()
{
int x[10];
int i,j;
int tmp;
for(i=0;i<10;i++)
scanf("%d",&x[i]);
for(i=0;i<10;i++){
for(j=i;j<10;j++){
if(x[i] < x[j]){
tmp = x[i];
x[i] = x[j];
x[j] = tmp;
}
}
}
for(i=0;i<3;i++)
printf("%d\n",x[i]);
return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const ll MOD = 1000000007;
const ll INF = 10000000000000;
#define all(v) v.begin(), v.end()


int main(){
  string S;
  cin >> S;
  rep(i,(ll)S.size()){
    cout << "x";
  }
  cout << endl;
}

Measured memory_bytes: 3564
#include<cstdio>
#include<cstring>
#include<vector>
#include<iostream>
#include<algorithm>
using namespace std;
#define mp make_pair
#define pb push_back
#define sz(x) ((int)(x).size())
#define rep(i,l,r) for(int i=(l);i<(r);++i)
typedef long long ll;
const int N = 1e5 + 7;
//-------head---------
int n;
char S[11];
int main() {
	scanf(" %s", S);
	n = strlen(S) - 1;
	ll ans = 0;
	rep(mask, 0, 1 << n) {		
		ll x = 0;
		rep(i, 0, n + 1) {
			x = x * 10 + (S[i] - '0');
			if ((mask >> i & 1) || i == n) {
				ans += x;
				x = 0;
			}
		}
	}
	printf("%lld", ans);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;
typedef long long ll;
const ll INF=100000000000000LL;
ll a[100001];

ll r[2]={};
int main() {
	int n;
	cin>>n;
	ll t1=0;
	ll t2=0;
	ll s1=0;
	ll s2=0;
	ll a1;
	for(int i=0;i<n;++i){
		cin>>a1;
		t1+=a1;
		t2+=a1;
		if(i%2==0){
			if(t1<=0){
				s1+=-t1+1;
				t1=1;
			}
			if(t2>=0){
				s2+=t2+1;
				t2=-1;
			}
		}else{
			if(t1>=0){
				s1+=t1+1;
				t1=-1;
			}
			if(t2<=0){
				s2+=-t2+1;
				t2=1;
			}
		}
	}
	cout<<min(s1,s2)<<endl;
	return 0;
}


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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
#define print(x) cout<<'>'<<#x<<':'<<x<<endl;
#define mod 1000000007

void solve(){

    int a,b;
    cin>>a>>b;
    if ((a*b)%2==0)cout<<"Even";
    else cout<<"Odd";

}

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

    return 0;
}




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

#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))

typedef long long int ll;

int read_int()
{
    int a;
    scanf("%d", &a);
    return a;
}

int read_lint()
{
    ll a;
    scanf("%lld", &a);
    return a;
}

int read_float()
{
    float a;
    scanf("%f", &a);
    return a;
}

int read_double()
{
    double a;
    scanf("%lf", &a);
    return a;
}

#define N 200001
ll ruiwa_a[N], ruiwa_b[N];

int main()
{
    int n = read_int();
    int m = read_int();
    ll k = read_lint();

    ruiwa_a[0] = 0;
    for (int i = 1; i <= n; i++)
    {
        ruiwa_a[i] = ruiwa_a[i - 1] + read_lint();
    }

    ruiwa_b[0] = 0;
    for (int i = 1; i <= m; i++)
    {
        ruiwa_b[i] = ruiwa_b[i - 1] + read_lint();
    }

    int ans = 0;
    int b_idx = m;
    for (int i = 0; i <= n; i++)
    {
        if (ruiwa_a[i] > k)
        {
            break;
        }

        while (ruiwa_a[i] + ruiwa_b[b_idx] > k)
        {
            b_idx--;
        }
        ans = max(ans, i + b_idx);
    }
    printf("%ld\n", ans);

    return 0;
}

Measured memory_bytes: 4820
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

typedef long long ll;

#define rep(i, a, n) for (ll i = a; i < (ll)n; ++i)
#define INF 10e12
#define MOD 1000000000 + 7
#define MAX 51000
#define all(x) (x).begin(), (x).end()
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))

using namespace std;

int main(void)
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll a, b;
    cin >> a >> b;
    ll ans = a + b;
    if (b % a != 0)
        ans = b - a;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define cout_precision cout.setf(ios::fixed); cout.precision(32);
#define clr(a) memset(a,0,sizeof(a))
#define umap unordered_map
#define uset unordered_set
#define fr first
#define sc second
#define pb push_back
#define M int(1e9+7)


using ll = int64_t; using vll = vector<ll>; using vvll = vector<vll>;
using pll = pair<ll, ll>; using vpll = vector<pll>; using vvpll = vector<vpll>;


int main(){
	fast_io; cout_precision;
	int a,b;	cin >> a >> b;
	int x = max(a+b , max(a*b ,a-b));	cout<<x;
	
	return 0;
}

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

int main(){
	while(true){
		int n;
		cin>>n;
		
		if(n==0)
			break;
		
	int len[40];
	for(int i=0;i<n;i++){
		string w;
		cin>>w;
		
		len[i] = w.size();
	}

	for(int i=0;i<n;i++){
		bool flg=false;
		int sta=0;
		int sum=0;
		
		for(int j=i;j<n;j++){
			sum += len[j];
	
			if(sum==5||sum==12||sum==17||sum==24||sum==31){
				sta++;
			}
			if(sta==5){
				flg=true;
				break;
			}
			else if(sum>=31){
				break;
			}
		}

		if(flg){
			cout<<i+1<<endl;
			break;
		}
	}

	}
	return 0;
	}



Measured memory_bytes: 3152
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define SZ(x) ((ll)(x).size())
typedef long long ll;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}

int main(){
    int k,s;
    cin >> k >> s;
    int res = 0;
    REP(i,k+1){
        REP(j,k+1){
            int t = s-i-j;
            if(0<=t&&t<=k)res++;
        }
    }
    put(res);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
	
	int H, W, i, j;
	
	while(scanf("%d%d",&H, &W))
	{
		if(H == 0 && W == 0)
		{
			break;
		}
	for(i = 1; i <= W; i++)
	{
		printf("#");
	}
	printf("\n");
//-----------------------------
for(i = 1; i <= H - 2; i++){

	printf("#");
	for(j = 1; j <= W - 2; j++)
	{
		printf(".");
	}
	printf("#");
	
	
	
	printf("\n");
	}
//------------------------------------
	for(i = 1; i <= W; i++){
		printf("#");
	}
	printf("\n");
	printf("\n");
}
	
}



Measured memory_bytes: 2600
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <iomanip>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <sstream>
#include <complex>

using namespace std;

using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>;
using iii = pair<int, ii>;
using viii = vector<iii>;

using ll = long long int;
using vc = vector<char>;
using vb = vector<bool>;
using ib = pair<int, bool>;
using vib = vector<ib>;

#define MOD 1000 * 1000 * 1000 + 7
#define INF 1000 * 1000 * 1000
#define EMPTY -10
#define mp(a, b) make_pair(a,b)

ll mcd(ll a, ll b) { //Algoritmo de Euclides 
	if (b == 0) return a;
	else return mcd(b, a % b);
}


bool resuelveCaso() {
	ll n, m;
	cin >> n >> m;
	if (!cin) return false;

	ll longpos = (n * m) / mcd(n, m);

	map<ll, char> biy;

	string s1, s2;
	cin >> s1 >> s2;

	for (int i = 0; i < n; ++i) {
		biy.insert(mp(i * (longpos / n) + 1, s1[i]));
	}
	bool posible = true;
	for (int i = 0; i < m && posible; ++i) {
		if (biy.find(i * (longpos / m) + 1) == biy.end()) {}
		else {
			if (s2[i] == biy[i * (longpos / m) + 1]) {}
			else posible = false;
		}
		//biy.insert(mp(i * (longpos / n) + 1, s1[i]));
	}

	if (posible) cout << longpos << '\n';
	else cout << "-1\n";
	

	return true;
}

int main() {
	while (resuelveCaso()) {}
	return 0;
}

Measured memory_bytes: 6144
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>
#include <complex>

const long INF = (1l << 30);
const long LINF = (1l << 60);

long a, b;

int main(){
    scanf("%ld%ld", &a, &b);
    printf("%ld\n", 6-a-b);
}


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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef double db; 
typedef string str;
 
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
 
#define pb push_back
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define endl '\n'
 
const ll MOD = 1000000007;

int main() {
   str s, t; cin >> s >> t;
   if (s.length() > t.length()) {
      str temp = s;
      s = t;
      t = temp;
   }
   int ans = t.length();
   for (int i = 0; i <= t.length() - s.length(); i++) {
      int cur = 0;
      for (int j = 0; j < s.length(); j++)
         cur += s[j] != t[i + j];
      ans = min(ans, cur);
   }
   cout << ans;
   return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#define endl "\n"
using namespace std;

int main()
{
    int a, b;

    cin >> a >> b;

    if(a >= 13)
    	cout << b << endl;
    else if(a >= 6)
    	cout << b / 2 << endl;
    else
    	cout << "0" << endl;
}

Measured memory_bytes: 256
#include <iostream>
int main(){

int n;

std::cin>>n;
std::cin.get();
int x,min,max;
long long sum=0;
for(int i=0;i<n;i++){
std::cin>>x;
if(i==0){
min=x;
max=x;}
else if(x<min){
min=x;}
else if(x>max){
max=x;}
sum+=x;
}
std::cout<<min<<" "<<max<<" "<<sum<<"\n";


return 0;

}

Measured memory_bytes: 3128
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>

using namespace std;

int main()
{

	unsigned long long int a = 1, b = 0, c = 100, d = 0, e = 0, maxy = 0, max = 0, ans = 1, count = 0;

	int yoko = 0, tate = 0;
	int array[1001] = { 0 };
	std::string output, output2, output3, input = {};
	bool okada = false;


	cin >> d;
	if (d % 11 == 0) {
		cout << d / 11 * 2 << endl;
	}
	else if(d%11>6){
		cout << d / 11 * 2 + 2 << endl;

	}
	else {
		cout << d / 11 * 2 + 1 << endl;
	}
}






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

int main(){
  int i,j,k,n,m;
  while(cin >> n >> m && n && m){
    vector<int> C,x;
    for(i=0;i<m;i++){
      int a;
      cin >> a;
      C.push_back(a);
    }
    for(i=0;i<n;i++){
      int a;
      cin >> a;
      x.push_back(a);
    }

    unsigned long long y[256][2];
    bool f[256][2];
    for(i=0;i<256;i++){
      y[i][0] = y[i][1] = 0;
      f[i][0] = f[i][1] = false;
    }
    f[128][0] = true;

    for(i=0;i<n;i++){
      for(j=0;j<m;j++){
	for(k=0;k<256;k++){
	  if(f[k][0]){
	    int a = k + C[j];
	    if(a < 0) a = 0;
	    else if(a > 255) a = 255;

	    if(y[k][0] >= (unsigned long long)(2*pow(2.0,63))-1) continue;

	    if(!f[a][1]) y[a][1] = y[k][0]+(x[i]-a)*(x[i]-a);
	    else y[a][1] = min(y[a][1],y[k][0]+(x[i]-a)*(x[i]-a));
	    f[a][1] = true;
	  }
	}
      }
      for(j=0;j<256;j++){
	y[j][0] = y[j][1];
	y[j][1] = 0;
	f[j][0] = f[j][1];
	f[j][1] = false;
      }
    }

    unsigned long long ans = 0;
    bool f2 = false;
    for(i=0;i<256;i++){
      if(f[i][0]){
	if(!f2){
	  ans = y[i][0];
	  f2 = true;
	}
	else ans = min(ans,y[i][0]);
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>

using namespace std;

int main(){
  int N;
  cin >> N;
  int h[N], dp[N];
  for(int i=0; i<N; i++) cin >> h[i];
  dp[0] = 0; dp[1] = abs(h[1]-h[0]);
  for(int i=2; i<N; i++){
    dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
  }
  cout << dp[N-1] << endl;
  return 0;
}


Measured memory_bytes: 1024