akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cctype>
using namespace std;
int main(){
        int a,b;
        string s;
        cin>>a>>b>>s;
        for(int i=0;i<a+b+1;i++){
                if(i>s.size()){
                        cout<<"No";
                        return 0;
                }
                if(i<a){
                        if(!isdigit(s[i])){
                                cout<<"No";
                                return 0;
                        }
                }
                if(i==a){
                        if(s[i]!='-'){
                                cout<<"No";
                                return 0;
                        }
                }
                else{
                        if(!isdigit(s[i])){
                                cout<<"No";
                                return 0;
                        }
                }
        }
        cout<<"Yes";
}

Measured memory_bytes: 256
using System;

class A
{
	static void Main()
	{
		var h = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
		var s = (h[0] + h[1]).CompareTo(h[2] + h[3]) switch
		{
			1 => "Left",
			0 => "Balanced",
			-1 => "Right",
		};
		Console.WriteLine(s);
	}
}


Measured memory_bytes: 27428
#include <bits/stdc++.h>
using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define int long long
  #define endl "\n"
  #define all(v) v.begin(),v.end()
  #define double long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<< ": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  const int N = 200005;

int len(int n)
{
  int ans = 0;
  while(n)
  {
    ans++;
    n/=10;
  }
  return ans;
}


int32_t main()
{


    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    IOS



    int n;
    cin >> n;
    int ans = 0;
    int pos = 1;

    for(int i =1; i <= n; i++)
    {
      int k = i;
      int ans1 =0;


      while(k%2 == 0)
      {
        k/=2;
        ans1++;
      }
      if(ans < ans1)
      {
        ans = ans1;
        pos = i;
      }
    }

    cout << pos;
    return 0; 
}


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

namespace ConsoleApp2
{
	class Program
	{
		static void Main(string[] args)
		{
			var temp = Console.ReadLine().Split(' ');
			int x, a, b;
			x = int.Parse(temp[0]);
			a = int.Parse(temp[1]);
			b = int.Parse(temp[2]);
			if (x < b - a)
			{
				Console.WriteLine("dangerous");
			}
			else if (a >= b)
			{
				Console.WriteLine("delicious");
			}
			else 
			{
				Console.WriteLine("safe");
			}
		}
	}
}


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

using namespace std;

template <typename T> T gcd(T x, T y) {
  if (y == 0)
    return x;
  return gcd(y, x % y);
}

template <typename T> T lcm(T x, T y) {
  if (x == 0 || y == 0)
    return 0;
  return x / gcd(x, y) * y;
}

int main() {
  const int M = 55555;
  vector<bool> f(M + 1, true);
  for (int i = 2; i <= sqrt(M); i++) {
    if (f[i]) {
      for (int j = 2; j * i <= M; j++) {
        f[i * j] = false;
      }
    }
  }
  int N;
  cin >> N;
  N--;
  cout << "2";
  for (int i = 3; i < M; i++) {
    if (N == 0)
      break;
    if (i % 5 == 1 && f[i]) {
      if (N != 0)
        cout << ' ';
      cout << i;
      N--;
    }
  }
  cout << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Edge
    {
        internal int from, to, cost;

        public Edge(int from, int to, int cost)
        {
            this.from = from;
            this.to = to;
            this.cost = cost;
        }
    }

    class Union_Find
    {
        internal int[] parents, rank;

        public Union_Find(int n)
        {
            parents = Enumerable.Range(0, n).ToArray();
            rank = new int[n];
        }

        public int Find(int x)
        {
            if (parents[x] == x) return x;
            else return parents[x] = Find(parents[x]);
        }

        public void Unite(int x, int y)
        {
            x = Find(x);
            y = Find(y);

            if (x == y) return;

            if (rank[x] < rank[y])
            {
                parents[x] = y;
            }
            else
            {
                parents[y] = x;
                if (rank[x] == rank[y]) rank[x]++;
            }
        }

        public bool Same(int x, int y)
        {
            return Find(x) == Find(y);
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                int V = int.Parse(Console.ReadLine());

                if (V == 0) break;

                int E = int.Parse(Console.ReadLine());

                Edge[] edges = new Edge[E];

                for (int i = 0; i < E; i++)
                {
                    string[] input = Console.ReadLine().Split(',');
                    int s = int.Parse(input[0]);
                    int t = int.Parse(input[1]);
                    int w = int.Parse(input[2]) / 100 - 1;

                    edges[i] = new Edge(s, t, w);
                }
                Console.WriteLine(Kruskal(edges, V));
            }
        }

        static int Kruskal(Edge[] edges, int V)
        {
            Array.Sort(edges, (a, b) => a.cost - b.cost);

            Union_Find UF = new Union_Find(V);

            int totalCost = 0;

            for (int i = 0; i < edges.Length; i++)
            {
                Edge e = edges[i];

                if (!UF.Same(e.from, e.to))
                {
                    UF.Unite(e.from, e.to);
                    totalCost += e.cost;
                }
            }
            return totalCost;
        }
    }
}

Measured memory_bytes: 9856
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

// ================================================= //

/*
 update : [s,t) に xを加算
 query  : [s,t) の　最大(小)値を出力する
 */

/* [0..N-1] */
const ll INIT = 0; // 問題に合わせる
struct SegTree {
    int N;
    ll init_v;
    vector<ll> node, lazy;
    
    SegTree(int _N):init_v(INIT) {
        N = 1;
        while (N < _N) N *= 2;
        node.resize(2 * N - 1, init_v);
        lazy.resize(2 * N - 1, init_v);
    }
    
    void lazy_evaluate(int l, int r,int k){
        node[k] += lazy[k];
        if(r - l > 1){
            lazy[2 * k + 1] += lazy[k];
            lazy[2 * k + 2] += lazy[k];
        }
        lazy[k] = 0;
    }
    
    /* [a,b) 引数の範囲に注意!! s~tまでを更新→update(s,t+1,~) */
    void update(int a, int b, ll x) { update(a, b, 0, 0, N, x); }
    void update(int a, int b, int k, int l, int r, ll x) {
        lazy_evaluate(l,r,k);
        if (r <= a || b <= l) return;
        if (a <= l && r <= b) {
            lazy[k] += x;
            lazy_evaluate(l,r,k);
        }
        else {
            update(a, b, 2 * k + 1, l, (l + r) / 2, x);
            update(a, b, 2 * k + 2, (l + r) / 2, r, x);
            node[k] = min(node[2 * k + 1],node[2 * k + 2]);
        }
    }
    
    /* [a,b) 引数の範囲に注意!! */
    ll query(int a, int b) { return query(a, b, 0, 0, N); }
    ll query(int a, int b, int k, int l, int r) {
        lazy_evaluate(l, r, k);
        if (r <= a || b <= l) return LLONG_MAX; // min : LLONG_MAX , max : LLONG_MIN
        if (a <= l && r <= b) {
            return node[k];
        }
        else {
            ll vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
            ll vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
            return min(vl, vr);
        }
    }
};

int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    int n,q; cin >> n >> q;
    
    SegTree ST(n);
    while(q--){
        int com; cin >> com;
        if(com == 0){
            int s,t,x; cin >> s >> t >> x;
            ST.update(s,t+1,x);
        }else{
            int s,t; cin >> s >> t;
            cout << ST.query(s,t+1) <<endl;
        }
    }
    
    return 0;
}



Measured memory_bytes: 7056
a,b=(int(x) for x in input().split())
gcc=1
i=2
while True:
    if(a<i or b<i):
        break
    elif (a%i==0 and b%i==0):
        gcc*=i
        a/=i
        b/=i
        i=2
    else:
        i+=1

print(int(a*b*gcc))


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

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

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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

using ll = long long;
#define INF 1e9

int N, M;
vector<int> a, b;
vector<pair<int, int>> pr;
bool cmp(pair<int, int> l, pair<int, int> r){
  if(l.second != r.second){
    return l.second < r.second;
  }
  return l.first < r.first;
}
int main(){
  cin >> N >> M;
  a.resize(M), b.resize(M), pr.resize(M);
  REP(i, M){
    cin >> a[i] >> b[i];
    a[i]--, b[i]--;
    pr[i] = {a[i], b[i]};
  }
  sort(pr.begin(), pr.end(), cmp);
  int cnt = 0, pre = -1;
  REP(i, M){
    if(pre <= pr[i].first){
      cnt++;
      pre = pr[i].second;
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 1792
a,z,x,i,j;main(t){for(scanf("%d",&t);t--;printf("%d %d\n",-z,a))for(a=z=0,scanf("%d%d",&x,&i);--x;i=j)scanf("%d",&j),i-=j,a=i>a?i:a,z=i<z?i:z;exit(0);}

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

#define ll long long
#define pb push_back

const int maxn = 3e3 + 20;

vector<int> adj[maxn];

int a[maxn];

bool dp[maxn];

void dfs(int v , int p = -1)
{
	for(auto u : adj[v])
		if(u != p)
		{
			dfs(u , v);

			if(a[u] < a[v])
				dp[v] |= !dp[u];
		}
}

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

	int n;
	cin >> n;

	for(int i = 0; i < n; i++)
		cin >> a[i];

	for(int i = 0; i < n - 1; i++)
	{
		int a , b;
		cin >> a >> b;
		a-- , b--;

		adj[a].pb(b);
		adj[b].pb(a);
	}

	for(int i = 0; i < n; i++)
	{
		memset(dp , 0 , sizeof dp);
		dfs(i);

		if(dp[i])
			cout << i + 1 << " ";
	}
	cout << endl;

}










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

template<int MOD> struct Fp {
	long long val;
	constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
		if (val < 0) val += MOD;
	}
	constexpr int getmod() { return MOD; }
	constexpr Fp operator - () const noexcept {
		return val ? MOD - val : 0;
	}
	constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
	constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
	constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
	constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
	constexpr Fp& operator += (const Fp& r) noexcept {
		val += r.val;
		if (val >= MOD) val -= MOD;
		return *this;
	}
	constexpr Fp& operator -= (const Fp& r) noexcept {
		val -= r.val;
		if (val < 0) val += MOD;
		return *this;
	}
	constexpr Fp& operator *= (const Fp& r) noexcept {
		val = val * r.val % MOD;
		return *this;
	}
	constexpr Fp& operator /= (const Fp& r) noexcept {
		long long a = r.val, b = MOD, u = 1, v = 0;
		while (b) {
			long long t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		val = val * u % MOD;
		if (val < 0) val += MOD;
		return *this;
	}
	constexpr bool operator == (const Fp& r) const noexcept {
		return this->val == r.val;
	}
	constexpr bool operator != (const Fp& r) const noexcept {
		return this->val != r.val;
	}
	friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
		return os << x.val;
	}
	friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
		if (n == 0) return 1;
		auto t = modpow(a, n / 2);
		t = t * t;
		if (n & 1) t = t * a;
		return t;
	}
};

constexpr int MOD = 998244353;
using mint = Fp<MOD>;

int main() {
	int N, S;
	cin>>N>>S;
	vector<int> A(N);
	for(int i=0; i<N; i++) cin>>A[i];
	
	vector<vector<vector<mint>>> dp(N+1, vector<vector<mint>>(S+1, vector<mint>(3, 0)));
	dp[0][0][0]=1;
	for(int i=0; i<N; i++){
		for(int j=0; j<=S; j++){
			//0:未確定、1:Lのみ確定、2:LR確定
			dp[i+1][j][0]+=dp[i][j][0];

			if(j-A[i]>=0)dp[i+1][j][1]+=dp[i][j-A[i]][0] *(i+1);
			dp[i+1][j][1]+=dp[i][j][1];
			if(j-A[i]>=0)dp[i+1][j][1]+=dp[i][j-A[i]][1];

			if(j-A[i]>=0)dp[i+1][j][2]+=dp[i][j-A[i]][0] *(i+1)*(N-i);
			if(j-A[i]>=0)dp[i+1][j][2]+=dp[i][j-A[i]][1] *(N-i);
			dp[i+1][j][2]+=dp[i][j][2];
		}
	}
	
	cout<<dp[N][S][2]<<endl;
	return 0;
}


Measured memory_bytes: 493056
h,w = map(int,input().split())
array = []
for _ in range(h):
    temp = input()
    if temp.count(".")==w:
        h-=1
        continue
    array.append(temp)

skip = [i for i in range(w)]

for j in range(w):
    flag=0
    for i in range(h):
        if array[i][j]=="#":
            flag=1
            break
    if flag==0:
        skip.remove(j)

for i in range(h):
    for j in skip:
        print(array[i][j], end="")
    print()

Measured memory_bytes: 4468
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
a_f = 10 - a % 10
b_f = 10 - b % 10
c_f = 10 - c % 10
d_f = 10 - d % 10
e_f = 10 - e % 10
# print(a,b,c,d,e)
lis = [a_f, b_f, c_f, d_f, e_f]
lis.sort()
lis
lis2 = []
for i in lis:
    # print(i)
    if i is not 10:
        lis2.append(i)
    else:
        break
lis2 = lis2[:-1]
# print(lis2)
print(a + b + c + d + e + sum(lis2))


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

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

  int ans = 0;
  int n = s.size();
  rep(i,n/2){
    if(s.at(i) != s.at(n-1-i)){
      ans++;
    }
  }

  cout << ans << endl;

}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<algorithm>
using std::cout;
using std::cin;
using std::endl;

int main(void){
    std::string s;
    int K;
    cin >> s;
    cin >> K;
    std::vector< std::string > strlist;
    //cout << "initialize finished" << endl;
    for (int i = 0; i < s.size(); i++)
    {
        
        for (int j = 0; j < 5 && i + j < s.size();j++)
        {
            std::string push_str;
            for (int k = i; k <= i + j;k++)
            {
                push_str += s[k];
            }
            strlist.push_back(push_str);
        }
        
    }
    //cout << "push finished" << endl;
    std::sort(strlist.begin(), strlist.end());
    //cout << "sort finished----" << endl;
    /*for(auto x:strlist){
        cout << x << endl;
    }*/
    //cout << "----" << endl;
    int rank = 0;
    int pos = 0;
    std::string prev_str = "1";
    while (rank < K)
    {
        if(prev_str!=strlist[pos]){
            rank++;
        }
        prev_str = strlist[pos];
        //cout << prev_str << endl;
        pos++;
    }

    cout << prev_str << endl;

    return 0;
}


Measured memory_bytes: 1160
import sys
from itertools import groupby
S = input()
K = int(input())

# 文字列分割
s = [[k, len(list(g))] for k, g in groupby(S)]

# 単一文字の場合は特別処理
if len(s) == 1:
#    print("単一文字")
    print(len(S) * K // 2)
    sys.exit()

# 単位文字列で置換する
s_count = sum(ss[1] // 2 for ss in s)
result = s_count * K

# 最初と最後の文字が同じで、かつ最初か最後の文字列が奇数だった場合の調整
# print(s[0], s[-1])
if s[0][0] == s[-1][0] and (s[0][1] % 2 == 1 and s[-1][1] % 2 == 1):
#    print("調整あり")
    result += K - 1

print(result)


Measured memory_bytes: 3064
using System;
using System.Linq;

namespace ABC104A
{
    class ABC104A
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var k = double.Parse(Console.ReadLine());

            double n = 0;
            foreach (var v in s.Select(x => int.Parse(x.ToString())))
            {
                n += Math.Pow(v, 5000000000000000);

                if (k <= n)
                {
                    Console.WriteLine(v);
                    return;
                }
            }
        }
    }
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  cin >> n;
  
  if(n % 2 == 0) cout << 0.5 << "\n";
  else{
    int a;
    a = n / 2 + 1;
    cout << fixed << setprecision(10) << (double) a / n << "\n";
  }
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

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

    if (n % 2 == 0) {
        int m = n * (n + 1) / 2;
        int d = m / (n / 2);

        cout << n * (n - 2) / 2 << "\n";
        for (int i = 1; i <= n; i++) {
            for (int j = i+1; j <= n; j++) {
                if (i + j != d) {
                    cout << i << " " << j << '\n';
                }
            }
        }
    } else {
        cout << (n * (n - 2) + 1) / 2 << "\n";

        for (int i = 1; i <= n; i++) {
            for (int j = i+1; j <= n; j++) {
                if (i + j != n) {
                    cout << i << " " << j << '\n';
                }
            }
        }
    }

    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int A = scan.nextInt();
        int B = scan.nextInt();
        int C = scan.nextInt();
        boolean answer = C <= A + B ? true : false;
        System.out.println(answer ? "Yes" : "No");
    }
}


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

int N, M, Q;
int sum[555][555];

int main() {
	int N, M, Q;
	cin >> N >> M >> Q;
	for (int i = 0;i < M;i++) {
		int L, R;
		cin >> L >> R;
		sum[L][R]++;
	}
	for (int i = 0;i < N;i++) {
		for (int j = 0;j < N;j++) {
			sum[i + 1][j + 1] += sum[i + 1][j] + sum[i][j + 1] - sum[i][j];
		}
	}
	for (int i = 0;i < Q;i++) {
		int p, q;
		cin >> p >> q;
		cout << sum[q][q] - sum[p - 1][q] - sum[q][p - 1] + sum[p - 1][p - 1] << endl;
	}
}

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

int main() {
	ll n;
	cin >> n;
	vector<ll> a(n);
	ll total = 0;
	rep(i,n) {
		cin >> a[i];
		total += a[i];
	}
	ll total_other = 0;
	for (int i=1; i<n; i+=2) {
		total_other += 2 * a[i];
	}
	vector<ll> water(n,0);
	water[0] = total - total_other;
	for (int i=0;i<n-1;i++) {
		water[i+1] = 2 *a[i] - water[i];
	}
	rep(i, n) {
		cout << water[i] << (i<n-1 ? " ": "\n");
	}

	return 0;
}


Measured memory_bytes: 2816
n = gets.to_i
k = 0
str = []
while true
  if n % (2 ** (k + 1)) != 0
    str[k] = '1'
    n -= (-2) ** k
  else
    str[k] = '0'
  end
  k += 1
  break if n == 0
end

puts str.reverse.join('')

Measured memory_bytes: 3836
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
from collections import defaultdict

N = int(input())  # 偶数
A = list(map(int, input().split()))
xorA = A[0]
for i in range(1, N):
    xorA = xorA ^ A[i]

ans = []
for i in range(N):
    res = xorA ^ A[i]
    res = int(res)
    ans.append(str(res))

print(" ".join(ans))

Measured memory_bytes: 107460
package main

import (
	"bufio"
	"fmt"
	"os"
)

type HW struct {
	H int
	W int
}

func solve() int {
	var H, W int
	fmt.Scan(&H, &W)

	r := bufio.NewReader(os.Stdin)
	dp := make([][]HW, H)

	var l []*HW

	for h := 0; h < H; h++ {
		dp[h] = make([]HW, W)
		for w := 0; w < W; w++ {
			c, _ := r.ReadByte()
			if c == '.' {
				if h > 0 {
					dp[h][w].H += dp[h-1][w].H

				}
				if w > 0 {
					dp[h][w].W += dp[h][w-1].W
				}
				dp[h][w].H++
				dp[h][w].W++

				l = append(l, &dp[h][w])

			} else {
				for i := h - 1; i >= 0; i-- {
					if dp[i][w].H == 0 {
						break
					}
					dp[i][w].H = dp[h-1][w].H
				}
				for i := w - 1; i >= 0; i-- {
					if dp[h][i].W == 0 {
						break
					}
					dp[h][i].W = dp[h][w-1].W
				}
			}
		}
		r.ReadByte()
	}

	for w := 0; w < W; w++ {
		for i := H - 1; i >= 0; i-- {
			if dp[i][w].H == 0 {
				break
			}
			dp[i][w].H = dp[H-1][w].H
		}
	}
	for h := 0; h < H; h++ {
		for i := W - 1; i >= 0; i-- {
			if dp[h][i].W == 0 {
				break
			}
			dp[h][i].W = dp[h][W-1].W
		}
	}

	max := 0
	for _, hw := range l {
		cnt := hw.W + hw.H - 1
		if max < cnt {
			max = cnt
		}
	}
	return max
}

func main() {
	ans := solve()
	fmt.Println(ans)
}


Measured memory_bytes: 159232
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i,n) for(ll i=0;i<n;i++)
#define repp(i,a,b) for(ll i=a;i<=b;i++)
#define reff(i,a,b) for(ll i=a;i>=b;i--)
#define ll long long int
#define pll pair<ll,ll>
#define fill(a,x) memset(a,x,sizeof(a))
#define mb make_pair
#define pb push_back
#define F first
#define S second
#define M 1000000007
#define sc(x) scanf("%d",&x)
#define scc(x1,x2) scanf("%d%d",&x1,&x2)
#define sccc(x1,x2,x3) scanf("%d%d%d",&x1,&x2,&x3)
#define pr(x) printf("%lld ",x)
#define dbg(a)         std::cerr<<#a<<"="<<(a)<<"\n"
#define dbg1(a,b)       std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define dbg2(a,b,c)     std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define dbg3(a,b,c,d)   std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"
#define co cout<<"fuck"<<endl;
#define all(v) v.begin(),v.end()
const int INF = 2034567891;
const ll INF64 = 4234567890123456789ll;
long long nc3(long long v){return (v * (v - 1ll) * (v - 2ll)) / 6ll;}
long long nc2(long long v){return (v * (v - 1ll)) / 2ll;}
ll gcd(ll a, ll b) { return (b == 0 ? a : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return (a * (b / gcd(a, b))); }
const int N = 10+2e6;
bool isprime(ll n) {
    if (n < 2) return 0;
    if (n == 2) return 1;
    if (n % 2 == 0) return 0;
    for (ll i = 3; i*i <= n; i++) if (n%i == 0) return 0;
    return 1;
}
double dist(pll p1, pll p2)
 {
    return (p1. F - p2.F)*(p1.F - p2.F) +
          (p1.S - p2.S)*(p1.S - p2.S);
 }
int main()
{
   ll n,a,b;
   cin>>n>>a>>b;
   if((abs(b-a)-1)&1)
   cout<<"Alice"<<endl;
   else
   cout<<"Borys";
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    long long a, b, k;
    scanf("%lld %lld %lld", &a, &b, &k);
    if (k >= a+b){
        printf("%d %d", 0, 0);
    }
    else{
        if (a>=k){
            printf("%lld %lld", a-k, b);
        }
        else{
            printf("%d %lld", 0, (a+b-k));
        }
    }
    return 0;
}

Measured memory_bytes: 128
x,y,a,b,c = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))

from collections import deque

p = sorted(p)[a-x:]
q = sorted(q)[b-y:]
t = deque(sorted(p+q))
r = deque(reversed(sorted(r)))
# print(t,r)

while r:
    if t[0] < r[0]:
        t.popleft()
        w = r.popleft()
        t.append(w)
    else:
        break

ans = sum(t)
print(ans)

Measured memory_bytes: 106748
#include<bits/stdc++.h>
#define SZ(x) ((int)x.size())
#define pb push_back
#define fi first
#define se second
#define L(i,u) for (int i=head[u]; i!=0; i=nxt[i])
#define rep(i,a,b) for (register int i=a; i<=b; i++)
#define per(i,a,b) for (register int i=a; i>=b; i--)
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
inline void read(int &x) {
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
inline ui R() {
	static ui seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}
const int N = 300005, M = 600005, inf = 0x3f3f3f3f;
int n,h,w,f[N],sz[N];
int find(int x){return f[x]==x?x:f[x]=find(f[x]);}
struct node{
	int r,c,w;
}s[N];
bool cmp(node a, node b){return a.w>b.w;}
int main() {
	read(n);read(h);read(w);
	rep(i,1,n){
		read(s[i].r);read(s[i].c);read(s[i].w);
	}
	sort(s+1,s+n+1,cmp);ll res=0;
	rep(i,1,2e5)f[i]=i;
	rep(i,1,n){
		int u=find(s[i].r),v=find(1e5+s[i].c);
		if(u!=v){
			if(sz[u]+sz[v]<=1)
				res+=s[i].w,f[u]=v,sz[v]+=sz[u];
		}
		else{
			if(sz[u]+1<=1)res+=s[i].w,sz[u]++;
		}
	}
	cout<<res;
	return 0;
}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
#define LL               long long
#define PB               push_back
using namespace std;
int main(){
  int n,c=0; cin>> n;
  int a[n+1];
  for (int i=1;i<=n;i++){
    cin >> a[i];
  }
  for (int i=1;i<=n;i++){
    if ((i%2) && (a[i]%2)) c++ ;
  }
  cout<< c<<endl;
}

Measured memory_bytes: 3588
//24
#include<iostream>

using namespace std;

int main(){
  int n;
  cin>>n;
  int x,m=-1;
  while(n--){
    int a,v;
    cin>>a>>v;
    if(v>m||v==m&&a<x){
      m=v;
      x=a;
    }
  }
  cout<<x<<' '<<m<<endl;
  return 0;
}

Measured memory_bytes: 1164
import java.util.*;

class Reader {
  Scanner sc = new Scanner(System.in);

  public int ini() {
    return sc.nextInt();
  }

  public String ins() {
    return sc.next();
  }

  public String insl() {
    return sc.nextLine();
  }

  public void skip() {
    sc.nextLine();
  }

  public int[] vi(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++) a[i] = sc.nextInt();
    return a;
  }

  public long[] vl(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++) a[i] = sc.nextLong();
    return a;
  }

  public String[] vsl(int n) {
    String[] a = new String[n];
    for (int i = 0; i < n; i++) a[i] = sc.nextLine();
    return a;
  }
}

public class Main extends Reader {
  public static void main(String[] args) {
    Main main = new Main();
    main.show(main.solve());
  }

  String s;
  String t;

  public Main() {
    s = ins();
    t = ins();
  }
  
  int solve() {
    int ans = 1;
    for (int i = 0; i < 3; i++) {
      if (s.charAt(i) != t.charAt(2-i)) ans = 0;
    }
    return ans;
  }

  void show(int ans) {
    System.out.println(ans == 1 ? "YES" : "NO");
  }
}

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

int main (int, char**) {
    int N;
    std::cin >> N;

    int64_t a[N];
    for (int i=0; i<N; i++) {
        std::cin >> a[i];
    }
    int64_t a_copy[N];
    std::memcpy(a_copy, a, sizeof(a));
    std::sort(a, a + N);

    int64_t count[N];
    for (int i=0; i<N; i++) {
        count[i] = 0;
    }



    int64_t prev = a[0];
    count[prev - 1] = 1;

    for (int i=1; i<N; i++) {
        if (prev == a[i]) {
            count[prev - 1]++;
        } else {
            prev = a[i];
            count[prev - 1] = 1;
        }
    }

    int64_t total = 0;

    for (int i=0; i<N; i++) {
        total += count[i] * (count[i] - 1) / 2;
    }

    for (int i=0; i<N; i++) {
        int64_t value = count[a_copy[i] - 1];
        if (value == 0) {
            std::cout << total << std::endl;
        } else {
            std::cout << total - value + 1 << std::endl;
        }

    }
    return 0;
}

Measured memory_bytes: 7804
#include <cstdio>
#include <algorithm>
#include <iostream>

using namespace std;

int amari[2000000]={0};
int main() {
    int x_1,y_1,x_2, y_2;

    scanf("%d %d %d %d",&x_1, &y_1, &x_2, &y_2);

    printf("%d %d %d %d", x_2-(y_2-y_1), y_2+x_2-x_1, x_1-(y_2-y_1), y_1+(x_2-x_1));

    return 0;

}

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

int main(){
  int n;
  cin >> n;
  vector<int> index(n);
  for(int i = 0;i < n;i++){
    int tmp;
    cin >> tmp;
    tmp--;
    index[tmp] = i;
  }
  int ans = n-1;
  int len = 1;
  int p = 1;
  int now = index[0];
  for(int i = 1;i < n;i++){
    if (index[i] > now){
      len = len + 1;
      ans = min(ans, n - len);
    } else {
      len = 1;
    }
    now = index[i];
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;
#define int long long

const int MAX_N = 100010;


void printYes() {
	cout << "Yay!" << endl;
}
void printNo() {
	cout << ":(" << endl;
}
signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int x, y; cin >> x >> y;
	int ans = 0;
	if (x == 1)ans += 300000;
	else if (x == 2)ans += 200000;
	else if (x == 3)ans += 100000;
	if (y == 1)ans += 300000;
	else if (y == 2)ans += 200000;
	else if (y == 3)ans += 100000;
	if (x == 1 && y == 1)ans += 400000;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 384
#include <cstdio>

using namespace std;

int dp[10001];

int main() {
    int n, ans = 0, i, j;
    
    scanf("%d", &n);
    
    dp[0] = 1;
    
    for (i = 0; i < n; i++) {
        int x;
        
        scanf("%d", &x);
        
        for (j = 10000; j >= 0; j--) {
            if (dp[j] == 1) dp[j + x] = 1;
        }
    }
    
    for (i = 10000; i >= 0; i--) {
        if (dp[i] == 1 && i % 10 != 0) {
            ans = i;
            
            break;
        }
    }
    
    printf("%d\n", ans);
    
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define debug(var) std::cout << #var << " : " << var << std::endl;
using ll = long long;
using ull = unsigned long long;
using vint = std::vector<int>;
using vvint = std::vector<std::vector<int>>;
using namespace std;
ll mod = 1e9 + 7;


int main() {


	int a, b; cin >> a >> b;
	int sum = 0;
	for (int i = 1; i < b - a; i++) {
		sum += i;
	}

	cout << sum - a;


	return 0;
}

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

int main() {
  char c;
  cin >> c;

  if (c == 'a'||c == 'i'||c == 'u'||c == 'e'||c == 'o')  cout << "vowel" << endl;
  else cout << "consonant" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll MOD=998244353;
const ll z=0;
ll n,k;
P s[15];
ll ans[200005];
int main(void){
    cin>>n>>k;
    for(int i=0;i<k;i++){
        cin>>s[i].first>>s[i].second;
    }
    sort(s,s+k);
    ans[1]=1;
    for(ll i=2;i<=n;i++){
        for(int j=0;j<k;j++){
            ans[i]=(ans[i]+ans[max(i-s[j].first,z)]-ans[max(i-s[j].second-1,z)])%MOD;
        }
        ans[i]=(ans[i]+ans[i-1])%MOD;
        //cout<<ans[i]-ans[i-1]<<endl;
    }
    ll ANS=(ans[n]-ans[n-1])%MOD;
    if(ANS<0) ANS+=MOD;
    cout<<ANS<<endl;
    
}


Measured memory_bytes: 5176
import java.util.Scanner;

public class Main
{

	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		String str = scan.nextLine();
		String[] substr = str.split(" ", 0);
		int n = Integer.parseInt(substr[0]);
		int kosuu = Integer.parseInt(substr[1]);

		str = scan.nextLine();
		substr = str.split(" ", 0);

		int seikai = 0;
		double kouho = 0.0;
		for (int i= 0; i<kosuu; i++) {
			kouho += kitaichi(Integer.parseInt(substr[i]));
		}
		double ans = kouho;
		for (int i=0; i<n-kosuu;i++) {
			kouho -= kitaichi(Integer.parseInt(substr[i]));
			kouho += kitaichi(Integer.parseInt(substr[i+kosuu]));
			if (ans < kouho) {
				ans = kouho;
				seikai = i;
			}
		}
		/*
		ans = 0;
		for (int i=seikai; i<seikai+kosuu; i++) {
			ans += kitaichi(Integer.parseInt(substr[i]));
		}
		*/

		System.out.printf("%.12f\n", ans);
	}

	public static double kitaichi(int a) {
		double ans = a * 0.5 + 0.5;
		return ans;
	}

}



Measured memory_bytes: 50904
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int A, B, C, D, E; //もともとの肉の温度 ,目的の温度 ,凍った肉を 1 ℃温めるのにかかる時間 ,凍った肉を解凍するのにかかる時間,凍っていない肉を 1 ℃温めるのにかかる時間
    cin >> A >> B >> C >> D >> E;
    int x;
    if(A < 0){
        x = (0 - A) * C + D + B * E;
    }
    else if (A > 0){
        x = (B - A) * E;
    }
    else{
        x = D + B * E;
    }
    cout << x << endl;
}


Measured memory_bytes: 3052
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
 
long long int INF = 3e18;
double Pi = 3.1415926535897932384626;
 
vector<ll> G[550010];
//vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←
 
 
#define p(x) cout<<x<<"\n";
#define el cout<<endl;
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)(); 
 
 
ll mod = 998244353;

ll rui(ll number1,ll number2){

    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
 
    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){
 
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
 
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}

/*
ll fact[800005],rfact[800005];

void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=800000; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[800000] = rui(fact[800000],mod - 2);
    for(ll i=800000; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod ) * rfact[n-r]) % mod;}
*/
 
ll n,m,num,sum,a,b,c,d,e,g,h,w,i,j,q,r,l;
ll k,ans;
ll x[500005],y[500005],z[500005];
char s[500005];

int main(){
    cin >> h >> w >> a >> b;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            num = 0;
            if(i < b){
                num++;
            }
            if(j < a){
                num++;
            }
            pu(num % 2);
        }
        el;
    }
    
    

    return 0;

}


















Measured memory_bytes: 16128
N,M = map(int,input().split())
 
def dist(ab,cd):
  return abs(ab[0]-cd[0]) + abs(ab[1]-cd[1])
 
AB = [[int(x) for x in input().split()] for _ in range(N)]
CD = [[int(x) for x in input().split()] for _ in range(M)]
 
answer = []
for ab in AB:
  min_dist = 10**15
  target = 0
  for j,cd in enumerate(CD,1):
    x = dist(ab,cd)
    if min_dist > x:
      min_dist = x
      target = j
  answer.append(target)
 
print(*answer, sep='\n')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <float.h>
#include <iomanip>
#include <iostream>
using namespace std;

int main()
{
    int N,X[110]={};
    long long ans=100000000000000000000;
    cin >> N;
    for(int i=1;i<=100;i++){
        cin >> X[i];
    }

    for(int j=1;j<=100;j++)
    {
        long long sum =0;
        int temp=0;

        for(int k=1;k<=N;k++){
            temp = X[k]-j;
            temp *=temp;

            sum+=temp;
        }

        if(sum<ans){
            ans = sum;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	S := ReadString()
	parts := []string{"dream", "dreamer", "erase", "eraser"}
	r := len(S)
	for r >= 1 {
		ok := false
		for _, part := range parts {
			if r >= len(part) && S[r-len(part):r] == part {
				r -= len(part)
				ok = true
				break
			}
		}
		if !ok {
			fmt.Println("NO")
			return
		}
	}
	fmt.Println("YES")
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadString() (s string) { Scan(&s); return }


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

import sys
sys.setrecursionlimit(300000)

YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(H: int, N: int, A: "List[int]"):
    if sum(A) >= H:
        ret = YES
    else:
        ret = NO
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(H, N, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 13996
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define F first
#define S second
#define _READ freopen("input.txt", "r", stdin);
#define _FAST                         \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);
int32_t main()
{
    _FAST
    int n;
    cin >> n;
    cout<<n+n*n+n*n*n;
    return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
#define gpf(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
typedef long long ll;
const int N = 110000;

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

int main(){
	scanf("%d", &n);
	rep(i, 1, n) scanf("%d", p + i);
	rep(i, 2, n){
		a[p[i]] += i - 1;
		b[p[i]] += i - 1;
	}
	rep(i, 1, n) a[i] = a[i - 1] + 1 + a[i];
	per(i, n, 1) b[i] = b[i + 1] + 1 + b[i];
	rep(i, 1, n) printf("%d ", a[i]);
	puts("");
	rep(i, 1, n) printf("%d ", b[i]);
	puts("");
	return 0;
}

Measured memory_bytes: 896
#include <stdio.h>

char c[7]={32,32,32,32,32,32,32};
inline void pl(int n){
    int i=5;
    do{ c[i]=n%10+48; n/=10; i--; }while(n>0);
    if(stdout->_IO_write_ptr+7 >= stdout->_IO_write_end){
        fflush_unlocked(stdout);
    }
    for(i++;i<7;i++){
        *stdout->_IO_write_ptr++ = c[i];
        //putchar_unlocked(c[i]);
    }
}

static void solve(const int n, const int a, const int b, int mask, const int common){
    if(n==1){
        pl(common|a);
        pl(common|b);
    }else{
        const int t = a^b;
        const int d = t&(-t);
        mask ^= d;
        const int aa = a & mask, ab = aa ^ (mask&(-mask));
        solve(n-1, aa, ab, mask, common|(a&d));
        solve(n-1, ab, b&mask, mask, common|(b&d));
    }
}

int main(void){
    int n, a, b;
    scanf("%d %d %d", &n, &a, &b);
    if(__builtin_parity(a)==__builtin_parity(b)){
        puts("NO");
    }else{
        puts("YES");
        solve(n, a, b, -1, 0);
    }
    return 0;
}

Measured memory_bytes: 896
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class B
{
	public static void Main() => (new Solver()).Solve();
}

public class Solver
{
	public void Solve()
	{
		int a = GetInt();
		int b = GetInt();
		int c = Min(a, b);
		int d = Max(a, b);
		WriteLine(new String((char)(c + '0'), d));
	}
}

public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => Enumerable.Range(0, (int)N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(long N) => Enumerable.Range(0, (int)N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDouble()).ToArray();
	public static decimal[] GetDecimals(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDecimal()).ToArray();
	public static string[] GetStrings(long N) => Enumerable.Range(0, (int)N).Select(_ => GetString()).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) < 0)
			x = y;
	}

	public static void chmin<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) > 0)
			x = y;
	}

	public static void swap<T>(ref T x, ref T y)
	{
		T tmp = x;
		x = y;
		y = tmp;
	}
}

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

/* -128 ~ 127 */
using i8  = int8_t;
/* 0 ~ 255 */
using u8  = uint8_t;
/* -32,768 ~ 32,767 */
using i16 = int16_t;
/* 0 ~ 65,535 */
using u16 = uint16_t;
/* -2,147,483,648 ~ 2,147,483,647 */
using i32 = int32_t;
/* 0 ~ 4,294,967,295 */
using u32 = uint32_t;
/* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using i64 = int64_t;
/* 0 ~ 18,446,744,073,709,551,615 */
using u64 = uint64_t;
/* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f32 = float;
/* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f64 = double;
using f80 = __float80;

template <class T>
using Vec = vector<T>;

template <typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template <typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }

/* 定数 */
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1000000007;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;

#define ALL(v) v.begin(), v.end()

#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) a / __gcd(a, b) * b /* 最小公倍数 */

void Main() {
    char b;
    cin >> b;
    char r;
    switch (b) {
        case 'A':
            r = 'T';
            break;
        case 'C':
            r = 'G';
            break;
        case 'G':
            r = 'C';
            break;
        case 'T':
            r = 'A';
            break;
    }
    cout << r << endl;
}

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




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fastio()                  \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)
#define pb push_back
#define show(x) cout << (#x) << " : " << x << endl;
#define ll long long
#define ld long double

#define mp make_pair
#define ff first
#define ss second
#define pii pair<ll, ll>
#define sq(x) ((x) * (x))
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
const ll MOD = 1000 * 1000 * 1000 + 7;
using namespace std;



long double dp[4000][4000];


ll N;

long double P[4000];

long double seno(ll idx, ll H)
{



if (idx==1)
{
if (H==0)
return dp[idx][0]=1-P[idx];
else
return dp[idx][1]=P[idx];    
}



if (dp[idx][H]!=4)
return dp[idx][H];    



dp[idx][H]=(long double)(P[idx]*seno(idx-1,H-1))+(long double)((idx-1-H>=0?(1-P[idx])*seno(idx-1,H):0));



return dp[idx][H];
}



int main() 
{ 



fastio();

cin>>N;
   
for(int i=N;i>=1;i--)
cin>>P[i];    


for(int i=1;i<=3000;i++)
{
for(int j=1;j<=3000;j++)
dp[i][j]=4;
}    


dp[1][0]=1-P[1];


for (int i=2;i<=N;i++)
{
    dp[i][0]=(1-P[i])*dp[i-1][0];
}


long double sum=0;

for(int i=(N/2)+1;i<=N;i++)
{

sum+=seno(N,i);
}    

cout<<setprecision(9)<<sum;

return 0;
} 




Measured memory_bytes: 188544
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
class Main {
  public static void main(String[] args) throws IOException {
    int d, r;
    double a, b, f;
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String input = br.readLine();
    String[] strArray = input.split(" ");
    a = Integer.parseInt(strArray[0]);
    b = Integer.parseInt(strArray[1]);
    d = getD(a, b);
    r = getR(a, b);
    f = getF(a, b);
    System.out.printf("%d %d %.5f", d, r, f);
  }
  static int getD(double a, double b) {
    return (int)(a / b);
  }
  static int getR(double a, double b) {
    return (int)(a % b);
  }
  static double getF(double a, double b) {
    return a / b;
  }
}

Measured memory_bytes: 24756
#pragma GCC optimize "03"
#include "bits/stdc++.h"
using namespace std;
 
#define int long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
 
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;
 
signed main() {
    IOS;
    #ifdef LOCAL
        freopen("input.txt","r", stdin);
        freopen("output.txt","w",stdout);
    #endif  
    int n, k;
    cin >> n >> k;
    int ans = (n / k) * (n / k) * (n / k);
    if(k % 2 == 0){
        n += k / 2;
        ans += (n / k) * (n / k) * (n / k);
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256