akhauriyash/Code-Regression huggingface dataset:
// ====================================
//   author: M_sea
//   website: https://m-sea-blog.com/
// ====================================
#include <bits/stdc++.h>
#define file(x) freopen(#x".in","r",stdin); freopen(#x".out","w",stdout)
#define debug(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
typedef long long ll;

int read() {
	int X=0,w=1; char c=getchar();
	while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
	while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
	return X*w;
}

const int N=52+10;
const int mod=1e9+7;

int n; char a[N],b[N];

int main() {
	n=read(); scanf("%s",a+1),scanf("%s",b+1);
	int ans=(a[1]==b[1]?3:6);
	for (int i=(a[1]==b[1]?2:3);i<=n;) {
		if (a[i]==b[i]&&a[i-1]==b[i-1]) ans=2ll*ans%mod,++i;
		if (a[i]==b[i]&&a[i-1]!=b[i-1]) ++i;
		if (a[i]!=b[i]&&a[i-1]==b[i-1]) ans=2ll*ans%mod,i+=2;
		if (a[i]!=b[i]&&a[i-1]!=b[i-1]) ans=3ll*ans%mod,i+=2;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 3804
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <array>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10
#define MAX_N 100100
#define MAX_M 100100

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

int CO = 0;
bool F = 0;
int n;
int field[10][10][10];//zyx
int m1, m2;
int a[100], b[100];
string s;

int search(int z, int y, int x){
	int co = 0;

	for (int i = -1; i <= 1; i++){
		for (int j = -1; j <= 1; j++){
			for (int k = -1; k <= 1; k++){
				if (i == 0 && j == 0 && k == 0)continue;
				int nz = z + k, ny = y + j, nx = x + i;
				if (nz >= 0 && nz < 5 && ny >= 0 && ny < 5 && nx >= 0 && nx < 5){
					if (field[nz][ny][nx])co++;
				}
			}
		}
	}
	return co;
}

bool check(int m, int ar[], int co){
	REP(i, m){
		if (ar[i] == co)return true;
	}
	return false;
}

int main(){
	while (cin >> n&&n){
		CO++;
		REP(i, 5){
			REP(j, 5){
				cin >> s;
				REP(k, 5){
					field[i][j][k] = s[k] - '0';
				}
			}
		}

		cin >> m1;
		REP(i, m1)cin >> a[i];
		cin >> m2;
		REP(i, m2)cin >> b[i];

		REP(l, n){
			int newfield[10][10][10];
			REP(i, 5){
				REP(j, 5){
					REP(k, 5){
						int num = search(i, j, k);
						if (field[i][j][k] == 0){
							if (check(m1, a, num))newfield[i][j][k] = 1;
							else newfield[i][j][k] = 0;
						}
						else{
							if (!check(m2, b, num))newfield[i][j][k] = 0;
							else newfield[i][j][k] = 1;
						}
					}
				}
			}
			REP(i, 5)REP(j, 5)REP(k, 5)field[i][j][k] = newfield[i][j][k];
		}

		if (F)cout << endl;
		cout << "Case " << CO << ":" << endl;
		REP(i, 5){
			REP(j, 5){
				REP(k, 5){
					cout << field[i][j][k];
				}
				cout << endl;
			}
			if (i != 4)cout << endl;
		}
		F = 1;
	}
}

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

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

int n;
string s;

int main() {
    while (true) {
        cin >> n;
        if (n == 0) break;

        Vi w(n);
        REP(i, n) cin >> w[i];

        VVi dp(n+1, Vi(n+1, 0));
        REP2(k, 2, n+1) {
            REP(i, n-k+1) {
                if (abs(w[i]-w[i+k-1]) < 2 && dp[i+1][i+k-1] == k-2) {
                    dp[i][i+k] = k;
                }
                REP2(j, i, i+k) {
                    dp[i][i+k] = max(dp[i][i+k], dp[i][j]+dp[j][i+k]);
                }
            }
        }

        std::cout << dp[0][n] << '\n';
    }

    return 0;
}



Measured memory_bytes: 3340
#include <bits/stdc++.h>
#define dbug(x) cout<<#x<<"="<<x<<endl
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while ('0'>ch||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do {(t*=10)+=ch-'0';ch=getchar();} while ('0'<=ch&&ch<='9'); t*=f;
}
typedef long long ll;
ll n;
int main() {
	//freopen("1.txt","r",stdin);
	read(n);
	printf("%lld\n",n*(n-1)/2);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main() {
  string S;
  cin >> S;
  int ans = 0;
  for(int i = 0; i < S.size(); ++i) {
    for(int j = S.size(); j >= i; --j) {
      int num = 0;
      for (int k = i; k < j; ++k) {
        if (S[k] == 'A' or S[k] == 'C' or S[k] == 'G' or S[k] == 'T') ++num;
        else {
          num = 0;
          continue;
        }
      }
      if (ans < num) ans = num;
    }
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <bitset>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

typedef long long LL;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<LL> VL;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;

string s;

bool check(string str) {
	bool flag = true;
	rep(i, sz(str) - 1) {
		if (str[i] != str[i + 1])flag = false;
	}
	return flag;
}

int cnt(char c) {
	int re = 0; string t = s;

	while (true) {
		if (check(t))break;

		string u;
		rep(i, sz(t) - 1) {
			if (t[i] == c || t[i + 1] == c)u += c;
			else u += t[i];
		}

		re++;
		t = u;
		//cout << u << "(" << re << ")\n";
	}
	return re;
}

int main() {
	cin >> s;
	int ans = INT_MAX;
	for (char c = 'a'; c <= 'z'; c++) {
		ans = min(ans, cnt(c));
	}
	cout << ans << endl;

}

Measured memory_bytes: 256
/*
    In the name of Allah

    MohammadErfan Gooneh

*/
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;

#define endl                        '\n'
#define all(a, n)                   for (int i = 0; i < n; i++) cout << a[i] << " "; cout << endl;
#define IOS                         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);


const ll MAXN = 1e6 + 10;
const ll INF = 8e18;
const ll MOD = 1e9 + 7;
int main() {
    IOS ;
    int n , k ;
    cin >> n >> k ;
    string s ;
    cin >> s ;
    s[k-1] = (s[k-1] < 91)*(s[k-1]+32) ;
    cout << s ;




























return 0 ;
}


Measured memory_bytes: 3592
import math

n,d = map(int,input().split(" "))
x = [list(map(int,input().split(" "))) for i in range(n)]

r = 0
for i in range(n):
  for j in range(i + 1,n):
    a = 0
    if i != j:
      for k in range(d):
        a += (x[i][k] - x[j][k]) ** 2
      a = math.sqrt(a)
      #print("{} {} {}".format(i,j,a))
      if a % 1 == 0:
        r += 1
print(r)

Measured memory_bytes: 3060
N,M=map(int,input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
# 解説動画でもあったが、制約が大きいものから当てはめていくのがよいみたなのでソート
# M日後までにもらえる報酬の最大化なので、日数が短い順でソート 
AB.sort()

import heapq
# heapqを作成 
h=[]
ans=0
j=0
for i in range(1,M+1):
    while j<N: # N件のアルバイトがあるので、すべてを検証するまでループ 
        # i日後に補修がもらえないなら break AB[j][0]は各アルバイトの日数
        if AB[j][0]>i:
            break
        else:
            # i日後にもらえるアルバイトは、heapq h にいれる 
            # -をかけてあるのは、後で使うheappopは、heapqの最小値から取り出すので
            # マイナスをかけることで報酬の高い順にとりだすため
            heapq.heappush(h,-AB[j][1])
            j+=1
    # i日後に報酬をもらえるアルバイトの中で報酬の最大値を加算
    if h!=[]:
        # pushの時にマイナスをかけているので最大値からとりだせる
        # heappushでマイナスをかけているので、
        # 取り出したときに再度マイナスをかけている
        k=-heapq.heappop(h)
        ans+=k
print(ans)

Measured memory_bytes: 31984
/* Simplicity and Goodness */

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

// using namespace __gnu_pbds;
using namespace std;
// typedef tree<int, null_type, less<int>, rb_tree_tag,
//             tree_order_statistics_node_update> indexed_set;

void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B)
{ cout << ' ' << A; my_dbg(B...); }
#define dbg(...)  cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

#define scn(n) scanf("%d", &n)
#define lscn(n) scanf("%lld", &n)
#define pri(n) printf("%d ", (int)(n))
#define prin(n) printf("%d\n", (int)(n))
#define lpri(n) printf("%lld ", n)
#define lprin(n) printf("%lld\n", n)
#define rep(i,a,b) for(int i=(int)(a); i<(int)(b); i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;

const int inf = INT_MAX;
const int ninf = INT_MIN;
const int mod = 1e9+7;
const int N = 2e5+2;


void solve()
{
    int n;
    scn(n);

    int a[n];

    rep(i, 0, n)
    scn(a[i]);

    sort(a, a+n, greater<int>());

    ll sum = a[0]; int cnt = n-2;

    rep(i, 1, n) {
        if(cnt == 0)
            break;
        if(cnt >= 2) {
            sum += 2 * a[i]; cnt -= 2;
        } else {
            sum += a[i]; cnt --;
        }
    }

    lprin(sum);
}

int main()
{
    int t = 1;
    // scn(t);
    
    while(t --) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 4584
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
#define MOD 1'000'000'007
using namespace std;
typedef long long ll;
typedef long double ld;

int N;
int p[100001];

int main(){
    cin>>N;
    repn(i,N) cin>>p[i];

    int ans=0;
    repn(i,N-1){
        if(p[i]==i && p[i+1]==i+1){
            swap(p[i],p[i+1]);
            ans++;
        }
    }
    repn(i,N-1){
        if(p[i]==i || p[i+1]==i+1){
            swap(p[i],p[i+1]);
            ans++;
        }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 4012
//#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include<queue>
using namespace std;

int main(){
  int n,q;
  cin >> n >> q;
  int a,b;
  vector<int> m[n];
  for(int i=0;i<n-1;i++){
    cin >> a >> b;
    m[a-1].push_back(b-1);
    m[b-1].push_back(a-1);
  }
  int c[n];
  int d[n];
  for(int i=0;i<n;i++){
    c[i] = 0;
    d[i] = 0;
  }
  int p,x;
  for(int i=0;i<q;i++){
    cin >> p >> x;
    c[p-1] += x;
  }
  queue<int> qu;
  int r;
  int j;
  qu.push(0);
  d[0] = 1;
  while(!qu.empty()){
    r = qu.front();
    qu.pop();
    for(int i=0;i<m[r].size();i++){
      j = m[r][i];
      if(d[j] != 1){
        qu.push(j);
        d[j] = 1;
        c[j] += c[r];
      }
    }
  }

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

  return 0;
}

Measured memory_bytes: 16244
import java.util.*;
import java.lang.Math;

public class Main {
  public static void main(String[] args) {
    Scanner scn = new Scanner(System.in);
   	int n = scn.nextInt();
    String s = scn.next();
    int asc ;
    char ch[] = new char[s.length()];
    
    for(int i=0; i<s.length();i++){
    	asc = (int)s.charAt(i) + n;
      	if(asc > 90) asc -=26;
      	ch[i] = (char)asc;
    }
     for(int i=0; i<s.length();i++){
    	System.out.print(ch[i]);
    }
  }
}


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

int main() {
  cout << fixed << setprecision(10);
  int n;
  cin >> n;
  ll ans=1;
  for(int i=1; i<=n; i++){
    ans*=i;
    ans%=MOD;
  }
  cout << ans << endl;
}


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

int main() {
    int N;
    cin >> N;
    vector<long long> A(N), B(N);
    long long res = 0;
    vector<long long> AB(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i] >> B[i];
        res += B[i];
        AB[i] = A[i] + B[i];
    }

    sort(AB.begin(), AB.end(), greater<long long>());
    res *= -1;

    for (int i = 0; i < N; i += 2) {
        res += AB[i];
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

ll n,m,ans;
bool r[10][10],ch[9];
void dep(ll now,ll cnt){
	ch[now]=true;
	if(cnt==n){
		ans++;
	}
	for(ll i=0;i<n;i++){
		if(r[now][i]==false){
			continue;
		}
		if(ch[i]){
			continue;
		}
		ch[i]=true;
		dep(i,cnt+1);
		ch[i]=false;
	}
}
int main() {
	cin>>n>>m;
	for(ll i=0;i<m;i++){
		ll x,y;
		cin>>x>>y;
		x--;y--;
		r[x][y]=true;
		r[y][x]=true;
	}
	dep(0,1);
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,m,n) for(i=m;i<=n;i++)
#define vi vector<int>
#define pii pair<int,int>
#define inf 0x3f3f3f3f
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ll long long
const int maxn=2e3+10;
const int dis[4][2]={{0,1},{-1,0},{0,-1},{1,0}};
using namespace std;
using namespace __gnu_cxx;
ll gcd(ll p,ll q){return q==0?p:gcd(q,p%q);}
ll qpow(ll p,ll q){ll f=1;while(q){if(q&1)f=f*p;p=p*p;q>>=1;}return f;}
int n,m,a[maxn][maxn],mi,cnt;
vi p[maxn];
pii q[maxn];
void dfs(int root,int pre,int now,int s)
{
    a[root][now]=s;
	for(ll i=0;i<p[now].size();i++) 
    {
		ll x=p[now][i];
        if(x!=pre)dfs(root,now,x,s+1);
    }
}
int main()
{
    int i,j,k,t;
    mi=inf;
    scanf("%d%d",&n,&k);
    rep(i,1,n-1){
        scanf("%d%d",&j,&t);
        p[j].pb(t),p[t].pb(j);
        q[i].fi=j,q[i].se=t;
    }
    rep(i,1,n)dfs(i,-1,i,0);
    rep(i,1,n)
    {
        cnt=0;
        rep(j,1,n)
            if(2*a[i][j]>k)cnt++;
        mi=min(mi,cnt);
    }
    rep(i,1,n-1)
    {
        cnt=0;
        rep(j,1,n)
            if(2*min(a[j][q[i].fi],a[j][q[i].se])+1>k)
                cnt++;
        mi=min(mi,cnt);
    }
    printf("%d\n",mi);
    //system ("pause");
    return 0;
}

Measured memory_bytes: 16256
if __name__ == '__main__':
    param_seconds = int(raw_input())

    seconds_per_hour = 60 * 60
    h = param_seconds / seconds_per_hour
    rest_seconds = param_seconds - h * seconds_per_hour

    m = rest_seconds / 60
    rest_seconds -= m * 60

    print "%s:%s:%s" % (h, m, rest_seconds)

Measured memory_bytes: 4196
S=input()
s1=int(S[0:2])
s2=int(S[2:])
if 1<=s1<=12 and 1<=s2<=12:
  print("AMBIGUOUS")
elif 1<=s2<=12:
  print("YYMM")
elif 1<=s1<=12:
  print("MMYY")
else:
  print("NA")


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

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

#define loop(i, n) for(int i = 0;i < n;i++)
#define IINF 2e9
#define MOD 1e9+7

int main(void){

    string s;
    cin >> s;

    if(s.back() == 's'){
        cout << s << "es" << endl;
    }else {
        cout << s << "s" << endl;
    }

    return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007;

template<class _T> static void getint(_T& a) {
	std::cin >> a;
}
template<class _T> static void getint(_T& a, _T& b) {
	std::cin >> a >> b;
}
template<class _T> static void getint(_T& a, _T& b, _T& c) {
	std::cin >> a >> b >> c;
}
template <class _T> static _T tp_abs(_T a) {
	if (a < (_T)0) {
		a *= (_T)-1;
	}
	return a;
}

static void exec();

int main()
{
	exec();
	fflush(stdout);
	return 0;
}

template <class _T> static _T tp_gcd(_T first, _T second)
{
	_T num1 = first, num2 = second;
	_T remainder = 0, common = 0;

	if (!num1) return num2;
	if (!num2) return num1;

	while (!common) {
		remainder = num1 % num2;

		if (remainder == 0) {
			common = num2;
		}
		else {
			num1 = num2;
			num2 = remainder;
		}
	}
	return(common);
}
template <class _T> static _T tp_lcm(_T first, _T second) {
	_T gcd = tp_gcd<_T>(first, second);
	return first * second / gcd;
}

static void exec()
{
	int N, K;
	getint(N, K);

	LLONG gcd = 0, maxVal = 0;
	LLONG ai;
	for (int i = 0; i < N; i++) {
		getint(ai);
		gcd = tp_gcd(gcd, ai);
		maxVal = std::max(maxVal, ai);
	}

	if (((K % gcd) == 0) && (maxVal >= K)) {
		printf("POSSIBLE\n");
	}
	else {
		printf("IMPOSSIBLE\n");
	}
}


Measured memory_bytes: 3604
def f(s):
    if s == 2 or s == 1:
        print(4)
        exit()

    a=[s]
    i=0
    while not s==4:
        if a[i]%2==0:
            s//=2
            a+=[s]
        else:
            s=3*s+1
            a+=[s]
        i+=1
    return i+4
print(f(int(input())))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> P;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 1000000000
#define LLINF 1000000000000000ll
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
int N;
int A[1<<18];
P f[1<<18][19];
P merge(P a,int x){
	if(a.fi<x){
		a.sec = a.fi;
		a.fi = x;
	}else if(a.sec < x){
		a.sec = x;
	}
	return a;
}
P merge(P a,P b){
	return merge(merge(a,b.fi),b.sec);
}
int ans[1<<18];
int main(){
	cin >> N;
	for(int i=0;i<(1<<N);i++){
		cin >> A[i];
		f[i][0]=P(A[i],-INF);
	}
	for(int i=0;i<(1<<N);i++){
		for(int j=0;j<N;j++){
			if((i>>j)&1){
				f[i][j+1]=merge(f[i][j],f[i&~(1<<j)][j]);
			}else{
				f[i][j+1]=f[i][j];
			}
		}
	}
	for(int i=1;i<(1<<N);i++){
		ans[i]=f[i][N].fi+f[i][N].sec;
	}
	for(int i=2;i<(1<<N);i++){
		ans[i]=max(ans[i-1],ans[i]);
	}
	for(int i=1;i<(1<<N);i++){
		cout << ans[i] << endl;
	}
}

Measured memory_bytes: 82944
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC154
{
    class Program
    {
        static void Main(string[] args)
        {
            c();
        }

        public static void c()
        {
            long n = long.Parse(Console.ReadLine());
            long[] a = Console.ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray();
            Array.Sort(a);
            bool flg = true;
            for(long i = 0; i < n -1; i++)
            {
                if(a[i] == a[i + 1])
                { flg = false; }
                if(flg == false)
                {
                    Console.WriteLine("NO");
                    return;
                }
            }
            Console.WriteLine("YES");
        }
    }
}


Measured memory_bytes: 35036
import sys
input = sys.stdin.readline

n, m = [int(x) for x in input().split()]
h = [int(x) for x in input().split()]
g = [[] for _ in range(n)]
for _ in range(m):
    a, b = [int(x) for x in input().split()]
    g[a - 1].append(b - 1)
    g[b - 1].append(a - 1)
ans = 0
for i in range(n):
    flag = 1
    for j in g[i]:
        if h[j] >= h[i]:
            flag = 0
            break
    if flag:
        ans += 1
print(ans)


Measured memory_bytes: 90200
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <queue>
#include <cmath>
#include <stack>
#include <numeric>
#include <ctime>
#include <algorithm>
#include <set>
#include <stdio.h>
#include <map>

using namespace std;
typedef long long int lint;

class Mat3i {
	int a[3][3];
public:
	Mat3i(int a00, int a01, int a02, int a10, int a11, int a12, int a20, int a21, int a22){
		a[0][0] = a00, a[0][1] = a01, a[0][2] = a02;
		a[1][0] = a10, a[1][1] = a11, a[1][2] = a12;
		a[2][0] = a20, a[2][1] = a21, a[2][2] = a22;
	}
	int det(){
		return a[0][0] * a[1][1] * a[2][2] + a[0][1] * a[1][2] * a[2][0] + a[0][2] * a[1][0] * a[2][1] - a[0][2] * a[1][1] * a[2][0] - a[0][0] * a[1][2] * a[2][1] - a[0][1] * a[1][0] * a[2][2];
	}
};

int main()
{
	int xu, yu, zu;
	int xe, ye, ze;
	int x1, y1, z1, x2, y2, z2, x3, y3, z3;
	
	cin >> xu >> yu >> zu;
	cin >> xe >> ye >> ze;
	cin >> x1 >> y1 >> z1;
	cin >> x2 >> y2 >> z2;
	cin >> x3 >> y3 >> z3;
	
	int d = Mat3i(x2 - x1, x3 - x1, xu - xe, y2 - y1, y3 - y1, yu - ye, z2 - z1, z3 - z1, zu - ze).det();
	double s = (double)Mat3i(xu - x1, x3 - x1, xu - xe, yu - y1, y3 - y1, yu - ye, zu - z1, z3 - z1, zu - ze).det() / d;
	double t = (double)Mat3i(x2 - x1, xu - x1, xu - xe, y2 - y1, yu - y1, yu - ye, z2 - z1, zu - z1, zu - ze).det() / d;
	double k = (double)Mat3i(x2 - x1, x3 - x1, xu - x1, y2 - y1, y3 - y1, yu - y1, z2 - z1, z3 - z1, zu - z1).det() / d;

	if (0 <= (s + t) && (s + t) <= 1 && 0 <= s && s <= 1 && 0 <= t && t <= 1 && 0 <= k && k <= 1) cout << "MISS" << endl;
	else cout << "HIT" << endl;

	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n))
#define Vec(a,n) vector<string> (a)((n))
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0))
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0))
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a))
#define Reverse(a) reverse(All(a))
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
using namespace std;
int max_int = 1000000007;
void Debug(auto a);
int nibul(auto a,auto b);
int nibuu(auto a,auto b);
class Modulo{
public:
    int val;
    static const int mod = 1e9+7;
    vector<int> factable = {1};
    vector<int> invtable = {1};
    int pro(int x,int y){return ((x%mod)*(y%mod))%mod;}
    int sum(int x,int y){return ((x%mod)+(y%mod))%mod;}
    int dif(int x,int y){int d =((x%mod)-(y%mod))%mod;if(d>=0){return d;}else{return d+mod;}}
    int quo(int x, int y){return pro(x,pow(y,mod-2));}
    int pow(int x,int y){
        if(y<=0){return 1;}
        if(y%2==0){int d = pow(x,y/2);return ((d%mod)*(d%mod))%mod;}
        else{return (x*pow(x,y-1))%mod;}
    }
    void operator=(int n){this->val = n%mod;}
    int operator+(int n){return sum(this->val,n);}
    int operator-(int n){return dif(this->val,n);}
    int operator*(int n){return pro(this->val,n);}
    int operator/(int n){return quo(this->val,n);}
    void operator+=(int n){this->val = sum(this->val,n);}
    void operator-=(int n){this->val = dif(this->val,n);}
    void operator*=(int n){this->val = pro(this->val,n);}
    void operator/=(int n){this->val = quo(this->val,n);}
    int fac(int x){
        //x! mod mod
        if(factable.size()<=x){
            int s = factable.size();
            FOR(i,s,x+1){
                factable.push_back(pro(i,factable.back()));
                invtable.push_back(quo(1,factable.back()));
            }
        }
        if(x<0) return 1;
        else return factable[x];
    }
    int facinv(int x){
        if(invtable.size()<=x){
            int s = invtable.size();
            FOR(i,s,x+1){
                factable.push_back(pro(i,factable.back()));
                invtable.push_back(quo(1,factable.back()));
            }
        }
        if(x<0) return 1;
        else return invtable[x];
    }
    int com(int x,int y){
        //xCy mod mod = x!/((x-y)!*y!) mod mod
        if(x-y<y)return com(x,x-y);
        return pro(fac(x),pro(facinv(x-y),facinv(y)));
    }
};

signed main(){
    int n,a,b,c,d,e;
    cin >> n >> a >> b >> c >> d >> e;
    int x = min({a,b,c,d,e});
    int ans = 4 + n/x;
    if(n%x!=0) ans++;
    cout << ans << endl;


    return 0;
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}
int nibul(auto a,auto b){
    int x = lower_bound(All(a),b) - a.begin();
    //key以上の初めてのitr
    return x;
}
int nibuu(auto a,auto b){
    int x = upper_bound(All(a),b) - a.begin();
    //key以下の最後のitr
    return x-1;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll mod=1e9+7;


int main()
{
    ll h,w;
    cin >> h >> w;
    vector<vector<char>> c(h,vector<char>(w));
    rep(i,h){
        rep(j,w){
            cin >> c[i][j];
        }
    }
    vector<vector<ll>> s(h,vector<ll>(w,-1));
    rep(i,h){
        rep(j,w){
            ll sum=0;
            if(c[i][j]=='#') continue;
            for(ll p=-1;p<=1;p++){
                for(ll q=-1;q<=1;q++){
                    if(p==0 && q==0) continue;
                    if(0<=i+p && i+p<=h-1 && 0<=j+q && j+q<=w-1){
                        if(c[i+p][j+q]=='#') sum++;
                    }
                }
            }
            s[i][j]=sum;
        }
    }
    rep(i,h){
        rep(j,w){
            if(s[i][j]==-1){
                cout << '#';
                continue;
            }
            cout << s[i][j];
        }
        cout << endl;
    }
    return 0;
} 


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

const long long INF = 1e7 + 1;
const long long MOD = 1000000007;
const long double PI = 3.14159265;

#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); ++i)
#define RFOR(i,n,r) for(ll i = (ll)(n-1); i >= r; --i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,n,0)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()

#define cout cout << setprecision(12)

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using vi = vector<ll>;
using vvi = vector<vi>;
using vp = vector<pair<ll, ll>>;
using vs = vector<string>;
using vc = vector<char>;
using lst = list<ll>;
using pq = priority_queue<ll>;

template < typename T >
inline void dbg(T a) { cout << a << ' '; }

ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;

/*--------------------template--------------------*/

int main() {
    cin >> s;
    for (int i=0;i<s.length();++i)
    cout << 'x';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(n); ++i)
#define repr(i, a, b) for (int i=a; i<(b); ++i)
#define reprev(i, n) for (int i=n-1; i>=0; --i)
#define reprrev(i, a, b) for (int i=b-1; i>=(a); --i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    cout << fixed << setprecision(10);
    
    int N; cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];

    vector<vector<int>> c(N, vector<int>(2));

    ll ans = 0;
    rep(i, N) {
        if (i + A[i] < N) {
            ans += c[i + A[i]][1];
            c[i + A[i]][0] += 1;
        }
        if (i - A[i] >= 0) {
            ans += c[i - A[i]][0];
            c[i - A[i]][1] += 1;
        }
    } 
    cout << ans << endl;
    return 0;
}

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

#define all(A) begin(A), end(A)
#define rall(A) rbegin(A), rend(A)
#define sz(A) int(A.size())

using namespace std;

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

int main () {
  ios::sync_with_stdio(false); cin.tie(0);
  int n;
  cin >> n;
  vector <ll> a(n + 1), b(n);
  for (int i = 0; i <= n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  ll pib = 0;
  ll ans = 0;
  for (int i = 0; i < n; i++) {
    ll take1 = min(a[i], pib);
    a[i] -= take1;
    ans += take1;
    ll take = min(a[i], b[i]);
    ans += take;
    b[i] -= take;
    pib = b[i];
  }
  ans += min(a[n], pib);
  cout << ans << endl;
  return (0);
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
const int64_t INF=9999999999999999;
int main() {
 int N;
 string S;
 cin>>N>>S;
 for(int i=0;i<S.size();i++){
  int x=S[i]-'A';
  x=(x+N)%26;
  S[i]=(char)(x+'A');
 }
 cout<<S<<endl;
 return 0;}

Measured memory_bytes: 256
N = int(input())
R = [0]*N
G = [0]*N
B = [0]*N
S = input()
R_sum,G_sum,B_sum = 0,0,0
for i in range(N):
    if(S[i]=="R"):
        R_sum += 1
        R[i] = R_sum
    elif(S[i] == "G"):
        G_sum += 1
        G[i] = G_sum
    else:
        B_sum += 1
        B[i] = B_sum
ans = 0
for i in range(0,N-1):
    for j in range(i+1,N):
        if((S[i] == "R" and S[j] == "G") or (S[i] == "G" and S[j] == "R")):
            ans += B[N-1]-B[j]
            point_index = j+(j-i)
            if(point_index >= N):
                continue
            elif(S[point_index]=="B"):
                    ans -= 1
        elif((S[i] == "G" and S[j] == "B") or (S[i] == "B" and S[j] == "G")):
            ans += R[N-1]-R[j]
            point_index = j+(j-i)
            if(point_index >= N):
                continue
            elif(S[point_index]=="R"):
                    ans -= 1
        elif((S[i] == "R" and S[j] == "B") or (S[i] == "B" and S[j] == "R")):
            ans += G[N-1]-G[j]
            point_index = j+(j-i)
            if(point_index >= N):
                continue
            elif(S[point_index]=="G"):
                    ans -= 1
print(ans)

Measured memory_bytes: 74372
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;

int main() {
    int a, b, h, m;
    cin >> a >> b >> h >> m;
    double theta = ((h + m / 60.0) * 30 - m * 6) * (double)(acos(-1)) / 180.0;
    double ans = sqrt(a * a + b * b - 2 * a * b * cos(theta));
    cout << setprecision(20) << ans << endl;
    return 0;
}

Measured memory_bytes: 4156
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <map>

int main (){
	int r;
	scanf("%d", &r);
	printf("%d\n",r*r);
	return 0;
}

Measured memory_bytes: 256
use proconio::input;

#[proconio::fastout]
fn main() {
    input! {
        H: i128,
        W: usize,
        K: usize
    }
    if W == 1 {
        println!("1");
        return;
    }
    const MOD: i128 = 1_000_000_007;

    let mut positions = vec![0i128; W];
    positions[0] = 1;
    for _y in 0..H {
        let mut row = vec![0i128; W];
        for x in 0usize..(1 << (W - 1)) {
            // 同じ端点を共有してはならない
            if x & (x << 1) != 0  { continue }

            // iビット目が立っているとき、i番目の橋が存在する
            // ここでi番目の橋とは、i番目の線から右に伸びるもの

            for i in 0..W {
                // i番目の橋があるなら
                if x & (1 << i) != 0 {
                    // 右へ
                    row[i + 1] += positions[i];
                    row[i + 1] %= MOD;
                } else if i > 0 && x & (1 << (i - 1)) != 0 {
                    // 左へ
                    row[i - 1] += positions[i];
                    row[i - 1] %= MOD;
                } else {
                    // そのまま下へ
                    row[i]= (row[i] + positions[i]) % MOD;
                }
            }
        }
        positions = row;
    }
    println!("{}", positions[K - 1]);
}


Measured memory_bytes: 2164
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ll              long long
#define pb              push_back
#define ppb             pop_back
#define endl            '\n'
#define mii             map<ll,ll>
#define pii             pair<ll,ll>
#define vi              vector<ll>
#define vs              vector<string>
#define all(a)          (a).begin(),(a).end()
#define F               first
#define S               second
#define sz(x)           ((ll)x.size())
#define hell            (1000000007)
#define inf             ((ll)5e18 + 5)
#define PI              ((double)3.14159265358979323844)
#define DECIMAL(n)      cout << fixed << setprecision(n);
#define rep(i,a,b)      for (ll i=a;i<b;i++)
#define repr(i,a,b)     for (ll i=a-1;i>=b;i--)
#define bitcount(a)     (ll)__builtin_popcount(a)
#define lbnd            lower_bound
#define ubnd            upper_bound
#define mp              make_pair
#define ios             ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ordered_set     tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define trace(...)      __f(#__VA_ARGS__, __VA_ARGS__)

template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}

using namespace std;
using namespace __gnu_pbds;

/*----------------------Graph Moves----------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

//primes for hashing 937,991,1013,1409,1741


bool isTrue(ll a, ll b, ll c) {
    set<ll> s;
    s.insert(a);s.insert(b);s.insert(c);
    if (sz(s)<3) {
        return false;
    }
    auto itr=s.end();
    itr--;
    ll z=*itr;
    ll x=*s.begin();
    itr--;
    ll y=*itr;
    if (x+y<=z)return false;
    return true;
}

void solve() {
    ll n;
    cin>>n;
    ll arr[n];
    rep(i,0,n) {
        cin>>arr[i];
    }
    ll ans=0;
    for (int i=0; i<n-2; i++) {
        for (int j=i+1; j<n-1; j++) {
            for (int k=j+1; k<n; k++) {
                if (isTrue(arr[i],arr[j],arr[k])) {
                    ans++;
                }
            }
        }
    }
    cout<<ans<<endl;
}

signed main() {
    ios
    ll test=1;
    //cin>>test;
    while (test--) solve();
    return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <string>

int main(void)
{
  int n,max,now;
  max=0;
  now=0;

  std::string str;
  std::cin >> n >> str;

  for(char c : str){
    if(c=='I'){
      now++;
      if(max < now)
        max=now;
    }
    else
      now--;
  }
  std::cout << max << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <numeric>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <algorithm>
using namespace std;

using ll = long long;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define REP1(i, n) for (ll i = 1; i <= n; i++)
#define REPR(i, n) for (ll i = n - 1; i >= 0; i--)
#define REPR1(i, n) for (ll i = n; i >= 1; i--)
#define FOR(i, m, n) for (ll i = m; i <= n; i++)

int gcd(int a, int b) { if (a < b) { a ^= b; b ^= a; a ^= b; } return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }

int main() {
    ll H, A;
    cin >> H >> A;
    cout << (H + A - 1) / A << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,nn) for(int i=0;i<nn;i++)
#define MOD 1000000007
typedef long long ll;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}else{return 0;}}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}else{return 0;}}
template <class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <class T> inline T LCM(T a,T b){return a*b/GCD(a,b);}


const ll MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
  if(k==0)return 1;
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll ruijou(ll a,ll b){
  ll s = 1;
  while(b > 0){
    if(b & 1)s=s*a%MOD;
    a=a*a%MOD;
    b >>=1;
  }
  return s;
}

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

  COMinit();
  for(int i=1;i<=k;i++){
    cout << COM(k-1,i-1)*COM(n-k+1,i)%MOD << endl;
    }
}

Measured memory_bytes: 12160
#include <iostream>
using namespace std;
int calc( int x){
  int ret = 0;
  while( x % 100 == 0){
    	x/=100;
    	++ret;
  }
  return ret;
}

int main(){
  int D,N;
  cin >> D >> N;
  int cet =0, val = 0;
  while( cet < N){
    ++ val;
    if (calc(val) == D) ++cet;
  }
  cout << val <<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
string s;
  cin >>s;
  if (s.at(0)=='S'){
  cout <<"Cloudy"<<endl;

    
  }
  else if (s.at(0)=='C'){
    cout<<"Rainy";
  }
  else{
   cout<<"Sunny";
  }

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define For(i,m,n) for(int i=m;i<n;i++)
#define FOR(i,n) for(int i=0;i<n;i++)
#define ll long long
#define ull unsigned long long
#define lli long long int
#define pb push_back
#define all(x) x.begin(),x.end()
ll mob=1000000007;
using namespace std;
int main()
{ 
ll a,b,c,k;
cin>>a>>b>>c>>k;
ll sum=0;
if(a<k) {sum+=a;k-=a;}
else
{
    sum+=k;
    cout<<sum;goto end;
}
if(b<k)
{
    k-=b;
    sum=sum+0;
}
else
{
    cout<<sum;goto end;
}
if(c<k)
{
    sum-=c;
    
}
else
{
    sum-=k;
    cout<<sum;goto end;
    
}

end:;

return 0;
}











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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
  cin >> vec.at(i);
  }
  int k=0;
  for (int i = 0; i < N; i++) {
   if (vec.at(i)==1 || (vec.at(i)%2) != 0) continue;
   else if ((vec.at(i)%6 == 0) && (vec.at(i) >= 6)) continue;
   else if ((vec.at(i)%10 == 0) && (vec.at(i) >= 10)) continue;
   else {k=1; break;}
  } 
  if (k==0) cout << "APPROVED" << endl;
  else cout << "DENIED" << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>

int main() {
    int n;   scanf("%d", &n);
    std::vector<int> vc;
    // int min = INT_MAX;
    // int max = 0;
    for (int i = 0; i < n; i++) {
        int a;
        scanf("%d", &a);
        // min = std::min(min, a);
        // max = std::max(max, a);
        vc.push_back(a);
    }

    long cost = LONG_MAX;
    for (int i = -100; i <= 100; i++) {
        long powed = 0;
        for (auto a: vc) {
            powed += std::pow(a - i, 2);
        }
        cost = std::min(cost, powed);
    }

    std::cout << cost << std::endl;

    return 0;
}

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

const int M = 2e5 + 100;
int h[M];
vector<int> e[M];
bool vis[M];

int bfs(int u) {
	for (int v : e[u]) {
		if (h[v] >= h[u])
			return 0;
	}
	return 1;
}

int main() {
	int n, m; cin >> n >> m;
	for (int i = 1; i <= n; i++) cin >> h[i];
	for (int i = 0; i < m; i++) {
		int u, v; cin >> u >> v;
		e[u].push_back(v);
		e[v].push_back(u);
	}
	int ans = 0;
	for (int i = 1; i <= n; i++) 
		ans += bfs(i);
	cout << ans;
}

Measured memory_bytes: 11504
#include <bits/stdc++.h>
#define f0(i, n) for(int i(0); i < (n); i++)
#define f1(i, n) for(int i(1); i <= n; i++)

using namespace std;
typedef long long ll;

int main(){
    ios_base::sync_with_stdio(0);

    int n; cin >> n;
    bool ok = 0;
    f0(i, 100){
        f0(j, 100){
            ///if(i==1 || j==1) continue;
            int res = i*4 + j*7;
            ok = ok || (res==n);
        }
    }
    cout << (ok ? "Yes":"No");
}



Measured memory_bytes: 384
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define rep(i,n) for(i=0;i<n;i++)
#define PI 3.14159265358979323846264338327950L
int gcd(int a,int b){//Greatest Common Divisor(最大公約数)
    if(a<b){
        int tmp=a;
        a=b;
        b=tmp;
    }
    while (b!=0){
        int r=a%b;
            a=b;
            b=r;
    }
    return a;
}
int main(){
    int a,b,c,k,num,ans=0;
    scanf("%d",&k);
    for(a=1;a<=k;a++){
        for(b=1;b<=k;b++){
            for(c=1;c<=k;c++){
                num=gcd(gcd(a,b),c);
                ans=ans+num;
            }
        }
    }
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
#include <algorithm>
#define ll long long
#define Freopen(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
using namespace std;
void init(),solve();
int k,x;
int main()
{
	init();
	solve();
	return 0;
}
void init()
{
	scanf("%d%d",&k,&x);
	return;
}
void solve()
{
	for(int i=x-k+1;i<=x+k-1;i++)
		printf("%d ",i);
	return;
}

Measured memory_bytes: 256
h, w = map(int, input().split())
s = [list(input()) for i in range(h)]
flag = [[False] * w for i in range(h)]
for i in range(h):
    for j in range(w):
        flag[i][j] = s[i][j] == "."
a = [[0] * w for i in range(h)]
for i in range(h):
    count = 0
    for j in range(w):
        if flag[i][j]:
            count += 1
            a[i][j] = count
        else:
            count = 0
for i in range(h - 1, -1, -1):
    m = 0
    for j in range(w - 1, -1, -1):
        if flag[i][j]:
            if m:
                a[i][j] = m
            else:
                m = a[i][j]
        else:
            m = 0
b = [[0] * w for i in range(h)]
for j in range(w):
    count = 0
    for i in range(h):
        if flag[i][j]:
            count += 1
            b[i][j] = count
        else:
            count = 0
for j in range(w - 1, -1, -1):
    m = 0
    for i in range(h - 1, -1, -1):
        if flag[i][j]:
            if m:
                b[i][j] = m
            else:
                m = b[i][j]
        else:
            m = 0
ans = 0
for i in range(h):
    for j in range(w):
        ans = max(ans, a[i][j] + b[i][j] - 1)
print(ans)

Measured memory_bytes: 276872
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define loop(n) FOR(i,0,n)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {

	while (true) {
		int a, b, c, d; cin >> a >> b >> c >> d;

		if (a == 0 && b == 0 && c == 0 && d == 0) break;

		int ans=(b*c - a+d-1) / d;

		if (ans < 0) {
			ans = 0;
		}
		cout << ans << endl;
	}

	return 0;


}


Measured memory_bytes: 3004
import java.io.*;
import java.util.*;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int N = Integer.parseInt(br.readLine());
		
		for(int i=0;i<N;i++) {
			String str = br.readLine();
			str = str.replace("Hoshino", "Hoshina");
			System.out.println(str);
		}

	}
}

Measured memory_bytes: 24408
#include <bits/stdc++.h>
using i64 = long long;

template <class T = long long int>
class Bit {
    private:
    T len;
    T *arr;

    public:
    Bit(T l, T initialValue = 0) : len(l) {
        arr = new T[l+1];
        for (T i = 0; i < l + 1; i++) {
            arr[i] = initialValue;
        }
    }
    ~Bit() {
        delete[] arr;
    }
    void update(T a, T newval) {
        for (T x = a; x <= len; x += x & -x) arr[x] += newval;
    }
    T query(T a) const {
        T ret = 0;
        for (T x = a; x > 0; x -= x & -x) ret += arr[x];
        return ret;
    }
};

int main() {
    int n, m;
    const i64 mod = 1000000007;
    std::cin >> n >> m;
    std::vector<int> a(n), b(m);
    Bit<> ba(n * m), bb(n * m);
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
        ba.update(a[i], 1);
    }
    for (int j = 0; j < m; j++) {
        std::cin >> b[j];
        bb.update(b[j], 1);
    }

    std::set<int> sa, sb;
    for (auto x : a) sa.insert(x);
    for (auto y : b) sb.insert(y);
    if (sa.size() != n || sb.size() != m) {
        std::cout << 0 << std::endl;
        return 0;
    }

    i64 ret = 1;
    for (int k = n * m; k > 0; k--) {
        auto ait = sa.find(k), bit = sb.find(k);
        if (ait != sa.end() && bit != sb.end()) continue;
        if (ait != sa.end()) {
            auto nb = bb.query(k - 1);
            ret = ret * (m - nb) % mod;
        } else if (bit != sb.end()) {
            auto na = ba.query(k - 1);
            ret = ret * (n - na) % mod;
        } else {
            auto na = n - ba.query(k), nb = m - bb.query(k);
            auto mm = n * m - k;
            ret = ret * (na * nb - mm) % mod;
        }
    }

    std::cout << ret << std::endl;

    return 0;
}

Measured memory_bytes: 16000
#include <iostream>
#include <string>
using std::cin, std::cout, std::endl;

auto main (int argc, char* argv[]) -> int {
  std::string str;
  cin >> str;
  
  for (const auto& s : str) {
    if (s == ',')
      cout << " ";
    else
      cout << s;
  }
  
  cout << endl;
  
  return 0;
}

Measured memory_bytes: 3608