akhauriyash/Code-Regression huggingface dataset:
/**
*    author:  yuya1234
*    created: 01.07.2020 15:24:38
**/

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)

#define ALL(v) (s).begin(), (s).end()
#define SORT(s) sort((s).begin(), (s).end())
#define SORTD(s) sort((s).rbegin(), (s).rend())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());

#define SZ(x) ((int)(x).size())
#define MEMSET(v, h) memset((v), h, sizeof(v))
template <typename T>
struct Combination
{
  vector<T> _fact, _rfact, _inv;

  Combination(int sz) : _fact(sz + 1), _rfact(sz + 1), _inv(sz + 1)
  {
    _fact[0] = _rfact[sz] = _inv[0] = 1;
    for (int i = 1; i <= sz; i++)
      _fact[i] = _fact[i - 1] * i;
    _rfact[sz] /= _fact[sz];
    for (int i = sz - 1; i >= 0; i--)
      _rfact[i] = _rfact[i + 1] * (i + 1);
    for (int i = 1; i <= sz; i++)
      _inv[i] = _rfact[i] * _fact[i - 1];
  }

  inline T fact(int k) const { return _fact[k]; }

  inline T rfact(int k) const { return _rfact[k]; }

  inline T inv(int k) const { return _inv[k]; }

  T P(int n, int r) const
  {
    if (r < 0 || n < r)
      return 0;
    return fact(n) * rfact(n - r);
  }

  T C(int p, int q) const
  {
    if (q < 0 || p < q)
      return 0;
    return fact(p) * rfact(q) * rfact(p - q);
  }

  T H(int n, int r) const
  {
    if (n < 0 || r < 0)
      return (0);
    return r == 0 ? 1 : C(n + r - 1, r);
  }
};

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

  int n, p;
  cin >> n >> p;

  ll cnt0=0, cnt1=0, tmp;
  REP(i, n)
  {
    cin >> tmp;
    if (tmp % 2 == 0)
      cnt0++;
    else
      cnt1++;
  }

  ll ans = 0;
  Combination<double> a(50);
  if (p == 0)
  {
    ans += pow(2, cnt0);
    tmp = 0;
    for (int i = 0; i <= cnt1; i += 2)
    {
      tmp += a.C(cnt1, i);
    }
    cout << ans * tmp << endl;
  }
  else
  {
    tmp = 0;
    for (int i = 1; i <= cnt1; i += 2)
    {
      tmp += a.C(cnt1, i);
    }
    ans=tmp;
    tmp = 0;
    for (int i = 0; i <= cnt0; i++)
    {
      tmp += a.C(cnt0, i);
    }
    cout << ans * tmp << endl;
  }

  return 0;
}

Measured memory_bytes: 4064
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process);
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var s     = input.ReadLine();
        var spl   = s.Split(' ');
        int a     = int.Parse(spl[0]);
        int b     = int.Parse(spl[1]);

        int ans = a + b;
        if (a - b > ans) ans = a - b;
        if (a * b > ans) ans = a * b;
        return ans;
    }
}

Measured memory_bytes: 13140
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define PI 3.14159265358979323846264338327950L

#define YESNO(T) if(T){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}

#define int long long

template<typename A, size_t N, typename T>

void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//ここにグローバル変数宣言

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//ここに関数宣言
int ctoi(char c) {
	switch (c) {
		case '0': return 0;
		case '1': return 1;
		case '2': return 2;
		case '3': return 3;
		case '4': return 4;
		case '5': return 5;
		case '6': return 6;
		case '7': return 7;
		case '8': return 8;
		case '9': return 9;
		default: return 0;
	}
}



//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
signed main(){
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
string S;
cin>>S;

char mark[3];

REP(bit,1<<3){
	int sum=ctoi(S[0]);
	REP(i,3){
		if ( bit >> i & 1){sum +=ctoi(S[i+1]); mark[i]='+';}
		else {sum -= ctoi(S[i+1]); mark[i]='-';}
		//cout<<"S:  "<<S[i]<<endl;
	}

	if (sum==7)
	{
		cout<<S[0]<<mark[0]<<S[1]<<mark[1]<<S[2]<<mark[2]<<S[3]<<"=7"<<endl;
		break;
	}
	

}


return 0;

}


Measured memory_bytes: 3660
import java.io.*;
import java.util.*;
public class Main{
    public static void main(String[] args) throws IOException{
        Reader r = new Reader();
        int N = r.i();
        int[] A = r.ii();
        Arrays.sort(A);
        long[] side = new long[2];
        for(int i = N-1, j = 0; i >= 0 && j < 2;){
            long a = A[i];
            int count = 0;
            while(i >= 0 && A[i] == a){
                count++;
                i--;
            }
            if(j==0 && count > 3){
                println(a*a);
                return;
            }
            if(count > 1){
                side[j] = a;
                j++;
            }
        }
        println(side[0]*side[1]);
    }
    static void print(Object o){
        System.out.print(o.toString());
    }
    static void println(Object o){
        System.out.println(o.toString());
    }
    static int Int(String s){
        return Integer.parseInt(s);
    }
    static long Long(String s){
        return Long.parseLong(s);
    }
    static class Reader extends BufferedReader{
        Reader(){
            super(new InputStreamReader(System.in));
        }
        String s() throws IOException{
            return readLine();
        }
        String[] ss() throws IOException{
            return s().split(" ");
        }
        int i() throws IOException{
            return Int(s());
        }
        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Int(ss[j]);
            return ii;
        }
        long l() throws IOException{
            return Long(s());
        }
        long[] ll() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            long[] ll = new long[size];
            for(int j = 0; j < size; j++) ll[j] = Long(ss[j]);            
            return ll;
        }
    }
}

Measured memory_bytes: 38056
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
    return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

int main() {
    int n; cin >> n;
    vector<int> a(3 * n);

    REP(i, 3 * n) cin >> a[i];

    priority_queue<ll, vector<ll>, greater<ll>> pq1;
    priority_queue<ll> pq2;

    ll s1 = 0, s2 = 0;
    vector<ll> t1(n + 1, 0), t2(n + 1, 0);

    REP(i, 2 * n) {
        if (i < n) {
            s1 += a[i];
            pq1.push(a[i]);

            s2 += a[3 * n - 1 - i];
            pq2.push(a[3 * n - 1 - i]);
        } else {
            t1[i - n] = s1;
            pq1.push(a[i]);
            int tp1 = pq1.top(); pq1.pop();
            s1 = s1 - tp1 + a[i];

            t2[i - n] = s2;
            pq2.push(a[3 * n - 1 - i]);
            int tp2 = pq2.top(); pq2.pop();
            s2 = s2 - tp2 + a[3 * n - 1 - i];
        }
    }

    t1[n] = s1; t2[n] = s2;

    ll ans = numeric_limits<ll>::min();
    REP(i, n + 1) {
        ll now = t1[i] - t2[n - i];
        ans = max(ans, now);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4724
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
const int INF = 0x3f3f3f3f, N = 1e5 + 5;
const ll LINF = 1e18 + 5;
constexpr int mod = 1e9 + 7;
int n;
char s[N];
ll dp[N][2][2][2];
ll dfs(int pos, int lim1, int lim2, bool equal)
{
	if(pos==-1) return 1;
	if(~dp[pos][lim1][lim2][equal]) return dp[pos][lim1][lim2][equal];
	int up1 = lim1 ? s[pos]-'0' : 1;
	int up2 = lim2 ? s[pos]-'0' : 1;
	ll ans = 0;
	for(int i=0; i<=up1; i++)
		for(int j=0; j<=up2; j++)
			if(!(i&j)) 
				if(!equal || (i+j)<=s[pos]-'0')ans = (ans + dfs(pos-1, lim1&&i==up1, lim2&&j==up2, equal&&(i+j==s[pos]-'0')))%mod;
	ans = (ans + mod)%mod;
	return dp[pos][lim1][lim2][equal] = ans;
}
ll solve()
{
	memset(dp, -1, sizeof(dp));
	return dfs(n-1, 1, 1, 1);
}
int main()
{
 	ios::sync_with_stdio(false);
 	cin.tie(0);
 	cin >> s;
 	n = strlen(s);
 	reverse(s, s+n);
 	ll res = solve();
 	res = (res + mod)%mod;
 	cout << res;
	return 0;
}


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

class dice{
private:
    int face[6];
    
public:
    dice(int *a){
        int i;
        for(i=0;i<6;i++){
            face[i]=a[i];
        }
    }
    
    void n(){
        int temp;
        temp=face[0];
        face[0]=face[1];
        face[1]=face[5];
        face[5]=face[4];
        face[4]=temp;
    }
    
    void e(){
        int temp;
        temp=face[0];
        face[0]=face[3];
        face[3]=face[5];
        face[5]=face[2];
        face[2]=temp;
    }
    
    void s(){
        int temp;
        temp=face[0];
        face[0]=face[4];
        face[4]=face[5];
        face[5]=face[1];
        face[1]=temp;
    }
    
    void w(){
        int temp;
        temp=face[0];
        face[0]=face[2];
        face[2]=face[5];
        face[5]=face[3];
        face[3]=temp;
    }
    
    int print(int num){
        return face[num];
    }
};

int main(int argc, const char * argv[]) {
    int face[6];
    int i;
    string str;
    
    for(i=0;i<6;i++){
        cin >> face[i];
    }
    
    dice d(face);
    
    cin >> str;
    
    for(i=0;i<str.size();i++){
        if(str[i]=='N'){
            d.n();
        }else if(str[i]=='E'){
            d.e();
        }else if(str[i]=='S'){
            d.s();
        }else if(str[i]=='W'){
            d.w();
        }
    }
    
    face[0]=d.print(0);
    
    cout << face[0] << endl;
    
    return 0;
}


Measured memory_bytes: 3204
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

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

const ll INF = 1LL << 50;

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

  string swox = "";
  ll n = (ll)s.size();
  vll xs;
  ll cnt = 0;
  rep(i, n) {
    if (s[i] != 'x') {
      swox += s[i];
      xs.push_back(cnt);
      cnt = 0;
    } else {
      cnt++;
    }
  }
  xs.push_back(cnt);

  ll n2 = (ll)swox.size();
  rep(i, n2 / 2) {
    if (swox[i] != swox[n2 - 1 - i]) {
      puts("-1");
      return 0;
    }
  }

  ll n3 = (ll)xs.size();
  ll ans = 0;
  rep(i, n3 / 2) ans += abs(xs[i] - xs[n3-1-i]);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1656
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;++i)


ll lmin(ll x ,ll y){
  if(x<y) return x;
  return y;
}

ll labs(ll x, ll y){
  if(y>x) return y-x;
  return x-y;
}

int main(){
  ll n;
  cin >>n;
  ll a[n],b[n];
  ll c,sum=0,ans=1000000000000;
  rep(i,n){
    cin >> a[i];
    sum+=a[i];
  }
  //sort(a,a+n);
  b[0]=a[0];
  c=sum-b[0];
  ans=lmin(labs(b[0],c),ans);
  rep(i,n-2){
    b[i+1]=b[i]+a[i+1];
    c=sum-b[i+1];
    ans=lmin(labs(b[i+1],c),ans);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3328
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
struct Edge
{
	int to;
	int nxt;
}e[200005];
int n,m,edgenum,head[100005],dep[100005],pa[100005],d[100005],a[100005],top;
int f[100005],g[100005];
void add(int u,int v)
{
	e[++edgenum].to=v;
	e[edgenum].nxt=head[u];
	head[u]=edgenum;
}
void dfs(int node)
{
	dep[node]=dep[pa[node]]+1;
	for(int hd=head[node];hd;hd=e[hd].nxt)
	{
		int to=e[hd].to;
		if(to==pa[node])continue;
		pa[to]=node;
		dfs(to);
	}
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		add(u,v);
		add(v,u);
		d[u]++,d[v]++;
	}
	dfs(1);
	int u=0,v=0;
	for(int i=1;i<=n;i++)
	{
		if(dep[i]>dep[u])
		  u=i;
	}
	pa[u]=0;
	dfs(u);
	for(int i=1;i<=n;i++)
	{
		if(dep[i]>dep[v])
		  v=i;
	}
	while(v!=u)
	{
		a[++top]=d[v];
		v=pa[v];
	}
	top++;
	int now=0;
	for(int i=1;i<=top;i++)
	{
		int pre=now;
		for(int j=1;j<=a[i]-1-(i!=1);j++)
		{
			now++;
			f[now]=now+1;
		}
		f[++now]=pre+1;
	}
	if(now!=n)
	{
		printf("-1\n");
		return 0;
	}
	now=0;
	for(int i=top;i>=1;i--)
	{
		int pre=now;
		for(int j=1;j<=a[i]-1-(i!=1);j++)
		{
			now++;
			g[now]=now+1;
		}
		g[++now]=pre+1;
	}
	for(int i=1;i<=n;i++)
	{
		if(f[i]<g[i])
		{
			for(int j=1;j<=n;j++)printf("%d ",f[j]);
			printf("\n");
			return 0;
		}
		if(f[i]>g[i])
		{
			for(int j=1;j<=n;j++)printf("%d ",g[j]);
			printf("\n");
			return 0;
		}
	}
	for(int i=1;i<=n;i++)printf("%d ",f[i]);
	printf("\n");
	return 0;
}

Measured memory_bytes: 8192
#include <iostream>

int main() {

	int x[2] = { 0,0 };
	int money = 0;

	std::cin >> x[0];
	std::cin >> x[1];

	for (int i = 0; i < 2; i++) {
		if (x[i] == 1) {
			money += 300000;
		}
		else if (x[i] == 2) {
			money += 200000;
		}
		else if (x[i] == 3) {
			money += 100000;
		}
	}
	if (money == 600000) {
		money = 1000000;
	}
	std::cout << money;


}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(){
  char a[102],b[102];
  scanf("%s%s",a,b);
  int al=strlen(a);
  int bl=strlen(b);
  if(al>bl){
    printf("GREATER");
    return 0;
  }else if(al<bl){
    printf("LESS");
    return 0;
  }else{
    if(strcmp(a,b)>0){
      printf("GREATER");
      return 0;
    }
    else if(strcmp(a,b)<0){
      printf("LESS");
      return 0;
    }else{
      printf("EQUAL");
      return 0;
    }
  }
}

Measured memory_bytes: 128
def main():
    h, w = map(int, input().split())
    grid = ["#"*(w+2)]+["#"+input()+"#" for _ in [0]*h]+["#"*(w+2)]
    grid = [[i == "." for i in j] for j in grid]
    ans_list = []
    for i in range(1, h+1):
        for j in range(1, w+1):
            if grid[i][j]:
                ans_list.append((i, j))
    m = 0
    for i, j in ans_list:
        q = [(i, j)]
        dist = [[-1]*(w+2) for _ in [0]*(h+2)]
        cnt = 0
        dist[i][j] = 0
        while q:
            qq = []
            cnt += 1
            while q:
                x, y = q.pop()
                if dist[x-1][y] == -1:
                    if grid[x-1][y]:
                        dist[x-1][y] = cnt
                        qq.append((x-1, y))
                if dist[x+1][y] == -1:
                    if grid[x+1][y]:
                        dist[x+1][y] = cnt
                        qq.append((x+1, y))
                if dist[x][y-1] == -1:
                    if grid[x][y-1]:
                        dist[x][y-1] = cnt
                        qq.append((x, y-1))
                if dist[x][y+1] == -1:
                    if grid[x][y+1]:
                        dist[x][y+1] = cnt
                        qq.append((x, y+1))
            q = qq
        m = max(m, max([max([l for l in k]) for k in dist]))
    print(m)


main()

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int S;
  cin >> S;
  
  int L;
  L = S / 100;
  int R;
  R = S % 100;
  
  if(L > 12 || L == 0){
    if(R >12 || R == 0){
      cout << "NA" << endl;
    }
    else{
      cout << "YYMM" << endl;
    }
  }
  else if (L <= 12 && L != 0){
    if(R > 12 || R == 0){
      cout << "MMYY" << endl;
    }
    else{
      cout << "AMBIGUOUS" << endl;
    }
  }
}

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

using namespace std;

#define vi vector<int>
#define all(v) v.begin(),v.end()
#define ll long long int
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define D1(x) {cerr<<" [" <<#x<<": "<<x<<"]";cout << endl;}
#define D2(x) {cerr<<" [" <<#x<<": ";for(auto it:x)cerr<<it<< " ";cerr<<"] ";cout << endl;}

const ll MOD = 1e9 + 7;
const ll maxn = 2e5 + 5;

void solve(){
    int n,k;
    ll ans=1e18;
    cin >> n >> k;
    vector<ll> pos(0),neg(0);
    for(int i=0;i<n;i++){
	int a;
	cin >>a;
	if(a<0)neg.push_back(a);
	else pos.push_back(a);
    }
    reverse(all(neg));
    
    for(int i=0;i<=k;i++){
	 int len=0;
	 int ok1=0,ok2=0;
	 if(i<=(int)neg.size()){
		if(i-1>=0)
		len +=i,ok1=1;
	 }
	 if(k-i<=(int)pos.size()){
		if(k-i-1>=0)
		len+=k-i,ok2=1;
	 }
	 if(len==k){
		if(ok1 && ok2){
			ans = min({ans,2*(-neg[i-1])+pos[k-i-1],2*pos[k-i-1]-neg[i-1]});
		}
		else if(ok1){
			ans = min({ans,-neg[i-1]});
		}
		else if(ok2){
			ans = min({ans,pos[k-i-1]});
		}
	 }
    }
    cout << ans;
	
}

int main() {
    IOS
	
        solve();
    cerr << endl << "[ Time : " << (float) clock() / CLOCKS_PER_SEC << " secs ]" << endl;

}
// integer overflow
// remember to clear visited array
// take input as vector<string> while using grid
// don't assign after modifying


Measured memory_bytes: 4532
use io::*;
use std::cmp::{max, min};

fn main() {
    let con = read_string();
    let mut sc = Scanner::new(&con);

    let s: Vec<char> = sc.next::<String>().chars().collect();
    let w: usize = sc.next();

    for i in 0..s.len() {
        if (i % w == 0) {
            print!("{}", s[i]);
        }
    }
    println!();
}

//-----

pub mod io {
    use std;
    use std::str::FromStr;

    pub struct Scanner<'a> {
        iter: std::str::SplitWhitespace<'a>,
    }

    impl<'a> Scanner<'a> {
        pub fn new(s: &'a str) -> Scanner<'a> {
            Scanner {
                iter: s.split_whitespace(),
            }
        }

        pub fn next<T: FromStr>(&mut self) -> T {
            let s = self.iter.next().unwrap();
            if let Ok(v) = s.parse::<T>() {
                v
            } else {
                panic!("Parse error")
            }
        }

        pub fn next_vec_len<T: FromStr>(&mut self) -> Vec<T> {
            let n: usize = self.next();
            self.next_vec(n)
        }

        pub fn next_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.next()).collect()
        }
    }

    pub fn read_string() -> String {
        use std::io::Read;

        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }

    pub fn read_line() -> String {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    }
}


Measured memory_bytes: 4352
import numpy as np


def calc(xyz, m):
    srt = sorted(sum(cake) for cake in xyz)
    return sum(srt[-m:])


def solve(xyz, m):
    if m == 0:
        return 0
    xyzT = xyz.T
    ans = calc(xyz, m)
    xyzT[2] *= -1
    ans = max(ans, calc(xyzT.T, m))
    xyzT[2] *= -1
    xyzT[1] *= -1
    ans = max(ans, calc(xyzT.T, m))
    xyzT[2] *= -1
    ans = max(ans, calc(xyzT.T, m))
    xyzT[2] *= -1
    xyzT[1] *= -1
    xyzT[0] *= -1
    ans = max(ans, calc(xyzT.T, m))
    xyzT[2] *= -1
    ans = max(ans, calc(xyzT.T, m))
    xyzT[2] *= -1
    xyzT[1] *= -1
    ans = max(ans, calc(xyzT.T, m))
    xyzT[2] *= -1
    ans = max(ans, calc(xyzT.T, m))
    return ans


n, m = map(int, input().split())
xyz = np.array([list(map(int, input().split())) for n in range(n)])
print(solve(xyz, m))


Measured memory_bytes: 21552
N, K = [int(_) for _ in input().split()]
A = [int(_) for _ in input().split()]

def solve(N, K, A):
    result = 0
    cs = [-1] * N
    rs = []
    i = 0
    while i < K:
        if cs[result] != -1:
            l = i - cs[result]
            m = (K - (i + (K - i) // l * l)) 
            result = rs[-l + m]
            break
        cs[result] = i
        rs.append(result)
        result = A[result] - 1
        i += 1

    return result + 1

print(solve(N, K, A))    


Measured memory_bytes: 32324
def main():
    M=10**9+7
    n,k,*a=map(int,open(0).read().split())
    x,y=[],[]
    for i in a:
        if i>0:x+=i,
        if i<0:y+=i,
    if len(x)+len(y)<k or k%2 and not x and len(y)<n:
        print(0)
        return
    if n==k or k%2 and not x:
        c=1
        for i in sorted(x+y)[-k:]:
            c=c*i%M
        print(c)
        return
    x=sorted(x)[::-1][:k]
    i=len(x)
    y.sort()
    m=len(y)
    j=k-i
    if j%2:
        x=x[:-1]
        i-=1
        j+=1
    x+=y[:j]
    while i>1 and j+1<m and x[i-1]*x[i-2]<y[j]*y[j+1]:
        x[i-1],x[i-2]=y[j],y[j+1]
        i-=2
        j+=2
    c=1
    for i in x:
        c=c*i%M
    print(c)
main()

Measured memory_bytes: 31056
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>

using namespace std;
using ll = long long;
using vi = vector<int>;

#define in(v) v; cin >> v;
void ins() {}
template<class T,class... Rest>void ins(T& v,Rest&... rest){cin>>v;ins(rest...);}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rrep(i,n) for(long long i=(n);i>=0;--i)
#define all(f,c,...) (([&](decltype((c)) cccc) { return (f)(begin(cccc), end(cccc), ## __VA_ARGS__); })(c))

// ========== debug ==========
template<class T>ostream& operator<<(ostream& os,const vector<T>& vec){os<<"{";for(size_t i=0;i<vec.size();++i)os<<(i?", ":"")<<vec[i];os<<"}";return os;}
ostream& operator<<(ostream& os,const vector<char>&v){for(size_t i=0;i<v.size();++i)os<<v[i];return os;}
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>& rhs){os<<"("<<rhs.first<<", "<<rhs.second<<")";return os;}

#ifdef LOCAL
void debug() {cerr << "\n";}
template<class First> void debug(const First& first) {cerr<<first<<"\n";}
template<class First, class... Rest> void debug(const First& first, const Rest&... rest) {cerr<<first<<",";debug(rest...);}
void debug2() {cerr << "\n";}
template<class First> void debug2(const First& first) {cerr<<first<<" ";}
template<class First, class... Rest> void debug2(const First& first, const Rest&... rest) {cerr<<first<<" ";debug2(rest...);}
#else
#define debug(...) 42
#define debug2(...) 42
#endif
// ===========================

int main() {
  ll N;
  ins(N);

  vector<char> ans;
  while (N > 0) {
    ans.push_back('a' + (N % 26));
    --N;
    N /= 26;
  }
  rep(i, ans.size()) {
    int n = ans[i] - 'a';
    n = (n+25) % 26;
    ans[i] = 'a' + n;
  }
  all(reverse, ans);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3620
import copy

N = int(input())
A = list(map(int, input().split()))
A2 = copy.copy(A)
B = [A[0]]

for i in range(N-1):
  if A[i+1] < A[i]:
    B.append(A[i])
    A[i+1] = A[i]
  else:
    B.append(A[i+1])
ans = 0
for i in range(N):
  ans += B[i] -A2[i]
print(ans)

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

int	main()
{
	int	cnt[100][100];
	int	n;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j)
			cnt[i][j] = -1;
		cnt[i][i] = 0;
	}
	vector<int>	r_vec(n), c_vec(n);
	for (int i = 0; i < n; ++i)
		cin >> r_vec.at(i) >> c_vec.at(i);
	for (int i = 1; i < n; ++i) {
		int	k;
		for (int j = 0; (k = i + j) < n; ++j) {
			for (int l = j; l < k; ++l) {
				int	tmp_cnt = cnt[j][l] + cnt[l + 1][k];
				tmp_cnt += r_vec.at(j) * c_vec.at(l) * c_vec.at(k);
				if (cnt[j][k] == -1 || cnt[j][k] > tmp_cnt)
					cnt[j][k] = tmp_cnt;
			}
		}
	}
	cout << cnt[0][n - 1] << endl;
}





Measured memory_bytes: 3148
#include<bits/stdc++.h>
using namespace std;
#define m 5000005
typedef long long ll;
vector <ll> prime;
bool sieve[m+2];
map<ll,ll>mp;
vector<ll>factor;
 
void primeSieve () {
    memset(sieve, true, sizeof(sieve));
 
    sieve[0]=sieve[1]=false;
 
    prime.push_back(2);
    for (int i = 4; i <=m; i += 2 ) sieve[i]=false;
 
    int sqrtn = sqrt (m);
    for ( int i = 3; i <= sqrtn; i += 2 ) {
        if (sieve[i]) {
            for (ll j = i * i; j <=m; j += 2 * i ) sieve[j]=false;
        }
    }
 
    for ( int i = 3; i <=m; i += 2 ) if (sieve[i]) prime.push_back(i);
}
 
void find(ll n)
{
    ll idx=0,pf=prime[idx];
 
    while(pf*pf<=n)
    {
        if(n%pf==0)
        {
            factor.push_back(pf);
            while(n%pf==0)
            {
                n/=pf;
                mp[pf]++;
            }
        }
        pf=prime[++idx];
    }
    if(n!=1){mp[n]++;factor.push_back(n);}
}
 
int main()
{
    primeSieve();
    ll n, i, ans, res=0, k, j=1;
 
    cin>>n;
    find(n);
 
    for(i=0; i<factor.size(); i++)
    {
        j=1;
        ans=mp[factor[i]];
       while(ans>=j)
       {
        ans-=j;
        res++;
        j++;
       }
    }
    cout<<res<<endl;
}

Measured memory_bytes: 12188
#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

void solve() {
    ll a,b,h,m;
    cin>>a>>b>>h>>m;
    DECIMAL(15);
    ll minutes=60*h+m;
    double deg=(5.5)*minutes;
    while (deg>360){
    	deg-=(360.0);
    }
    if (deg>180.0)deg=360.0-deg;
    double ans=a*a+b*b-(2*a*b*cos(deg*PI/180));
    cout<<sqrt(ans)<<endl;
}

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

Measured memory_bytes: 4204
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const int M{200001};
char s[M];
int b,i,h[1<<26],dp[M];
int main(){
    scanf("%s",s);
    fill_n(dp,M,M);
    fill_n(h,1<<26,M);
    for(dp[0]=h[0]=0;s[i];++i){
        b^=1<<(s[i]-'a');
        dp[i+1]=min(dp[i+1],h[b]+1);
        for(int j{};j<26;++j)
            dp[i+1]=min(dp[i+1],h[b^(1<<j)]+1);
        h[b]=min(h[b],dp[i+1]);
    }
    printf("%d\n",dp[i]);
}


Measured memory_bytes: 263424
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>
#include <random>
#include <chrono>
#include <iomanip>
#define lint long long int
#define FOR(x, to) for(int x=0; x<(int)(to); x++)
#define DUMP(ar) for(int loop_dump=0; loop_dump<(int)ar.size(); loop_dump++) cout << "[" << loop_dump << "]:" << ar[loop_dump] << endl
#define DUMPL(ar) for(int loop_dump=0; loop_dump<(int)ar.size(); loop_dump++) { cout << ar[loop_dump]; if(loop_dump<(int)ar.size()-1) cout << ' '; } cout << endl;
#define COUT(x) cout << x << endl
#define ALL(ar) ar.begin(), ar.end()
#define LOOPD(i) cout << "ループ[" << i << "]回目---------------" << endl
using namespace std;

struct point{
    int x;
    int y;
};

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

    int w, h, n;
    cin >> w >> h >> n;

    vector<point> points(n);
    vector<int> a(n);
    for(int i=0; i<n; i++){
        cin >> points[i].x >> points[i].y >> a[i];
    }

    int x_left = 0, y_up = h, x_right = w, y_down = 0;
    for(int i=0; i<n; i++){
        switch(a[i]){
        case 1:
            if(points[i].x > x_left) x_left = points[i].x;
            break;
        case 2:
            if(points[i].x < x_right) x_right = points[i].x;
            break;
        case 3:
            if(points[i].y > y_down) y_down = points[i].y;
            break;
        case 4:
            if(points[i].y < y_up) y_up = points[i].y;
            break;
        }
    }

    if(x_left >= x_right || y_down >= y_up){
        COUT("0");
        return 0;
    }

    cout << (x_right - x_left) * (y_up - y_down);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 29;
 
int n, h[100001];
int main() {
	cin >> n;
	rep(i, n) cin >> h[i];
	int ans = 0, last = 0;
	rep(i, n-1) {
		if (h[i] >= h[i+1]) {
			last++;
			ans = max(ans, last);
		} else {
			ans = max(ans, last);
			last = 0;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
s = input()
x, y = map(int, input().split())

S = list(map(len, s.split("T")))
Sx = []
Sy = []

for i in range(len(S)):
  if i % 2 == 0:
    Sx.append(S[i])
  else:
    Sy.append(S[i])

maxX = sum(Sx)
maxY = sum(Sy)

setX = set([maxX])
flg = True
for i in Sx:
  if flg:
    #初手だけはXの正方向にしかすすめない
    flg = False
    continue
  li = list(setX)
  for a in li:
    setX.add(a - 2*i)
    
setY = set([maxY])
for i in Sy:
  li = list(setY)
  for a in li:
    setY.add(a - 2*i)
    
if x in setX and y in setY:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3572
#include <iostream>
#include <iomanip>
#include <vector>

int main() {
    int n, k;
    std::cin >> n >> k;
    std::vector<int> p(n);
    for (int i = 0; i < n; i++) {
        std::cin >> p[i];
    }

    int sum = 0;
    for (int i = 0; i < k; i++) {
        sum += p[i];
    }
    int max = sum;

    for (int i = k; i < n; i++) {
        sum = sum - p[i - k] + p[i];
        max = std::max(max, sum);
    }

    std::cout << std::fixed << std::setprecision(8);
    std::cout << (double)(max + k) / 2 << std::endl;
    return 0;
}


Measured memory_bytes: 1024
L = int(input())
def divideBin(n):
    d = 1
    ans=[]
    while n > 0:
        r,q=divmod(n,2)
        ans.append(q*d)
        d *= 2
        n = r
    return(ans)
divided = divideBin(L)
N = len(divided)
M = 2*(N-1) + len([x for x in divided if x!=0]) - 1
print(N,M)
for i in range(1,N):
    print(i,i+1,0)
    print(i,i+1,pow(2,i-1))
node = N-1
value = divided[N-1]
while node > 0:
    if divided[node-1] != 0:
        print(node,N,value)
        value += divided[node-1]
    node -= 1

Measured memory_bytes: 3064
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const Ld pi = M_PI;
const Int MOD = 1000000007;

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

    string s, ans;
    cin >> s;

    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'B') {
            if (!ans.empty()) {
                ans.pop_back();
            }
        } else {
            ans.push_back(s[i]);
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
//teja349
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >

//std::ios::sync_with_stdio(false);   
int a[12][1233],dp[12][1234];
int main(){
    std::ios::sync_with_stdio(false);
    int n;
    cin>>n;
    int i,j;
    rep(i,2){
    	rep(j,n){
    		cin>>a[i][j];
    	}
    }
    dp[1][n-1]=a[1][n-1];
    dp[0][n-1]=dp[1][n-1]+a[0][n-1];
    //maxi=dp[0][n-1];
    fd(i,n-2,0){
    	dp[1][i]=dp[1][i+1]+a[1][i];
    	dp[0][i]=max(dp[1][i],dp[0][i+1])+a[0][i];
    }
    cout<<dp[0][0]<<endl;
    return 0;  
    
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int qtd, char* nome[])
{
    ios::sync_with_stdio(false);

    int x;
    cin >> x;
    if (x == 7|| x == 5|| x == 3)
        cout << "YES\n";
    else
        cout << "NO\n";

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>

using namespace std;

int main() {
  int a,b,c,d,e,f;
  scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
  int ans1=0,ans2=0;double rate=0.0;
  for(int i=0;i*100*a<=f;++i){
    for(int j=0;j*100*b+i*100*a<=f;++j){
      if(i+j==0)continue;
      int sum=j*100*b+i*100*a;
      int lim=min(sum/100*e,f-sum);
      for(int k=0;k*c<=lim;++k){
    int l=(lim-k*c)/d;
    int sugar=l*d+k*c;
    if(double(sugar)/sum>rate){
      rate=double(sugar)/sum;
      ans1=sum+sugar;ans2=sugar;
    }
      }
    }
  }
  if(rate==0)printf("%d %d\n",100*a,0);
  else printf("%d %d\n",ans1,ans2);
  return 0;
}

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

int main() {
	char res[300010] = {};
	int q;
	deque<char> d;
	string s;
	cin >> s >> q;
	for(char& c: s) {
		d.push_back(c);
	}
	int rflag = 0;
	for(int i = 0; i < q; i++) {
		int t, f;
		char c;
		cin >> t;
		if (t == 1) {
			rflag ^= 1;
			continue;
		}
		cin >> f >> c;
		if (rflag == 0 && f == 1) {
			d.push_front(c);
		} else if (rflag == 0 && f == 2) {
			d.push_back(c);
		} else if (rflag == 1 && f == 1) {
			d.push_back(c);
		} else if (rflag == 1 && f == 2) {
			d.push_front(c);
		}
	}
	int i = 0;
	if (rflag) {
		for(auto di = d.rbegin(); di != d.rend(); ++di) {
			res[i++] = *di;
		}
	} else {
		for(auto di = d.begin(); di != d.end(); ++di) {
			res[i++] = *di;
		}
	}
	cout << res << endl;
}
			



Measured memory_bytes: 1280
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	Scanner sc = new Scanner(System.in);
	public void run() {
		while(sc.hasNext()){
			w = sc.nextInt();
			h = sc.nextInt();
			if(w == 0 && h == 0)break;
			else calc();
			
		}
	}
	public void calc(){
		map = new int[h][w];
		goal = new int[2];
		start = new int[2];
		ans = 11;
		
		for(int i = 0; i < h; i++){
			for(int j = 0; j < w; j++){
				int k = sc.nextInt();
				map[i][j] = k;
				if(k == 2) {
					start[0] = i; 
					start[1] = j;
				}
				else if(k == 3) {
					goal[0] = i; 
					goal[1] = j;
				}
			}
		}
		
		iter(start[0], start[1], 1);
		if(ans == 11) System.out.println(-1);
		else System.out.println(ans);
	}
	
	int[][] map;
	int[] goal;
	int[] start;
	int ans;
	int w;
	int h;
	
	public void iter(int nh, int nw, int count){
		if(count > 10) return;
		else if(ans < count) return;
		else{
			int[] x = { 0, 1, 0, -1};
			int[] y = { 1, 0, -1, 0};
			
			for(int i = 0; i < 4; i++){
				int xx = x[i];
				int yy = y[i];
				
				int nx = nh;
				int ny = nw;
				
				int sh = -1;
				int sw = -1;
				
				int t = 0;
				while(true){
					int nextX = nx + xx;
					int nextY = ny + yy;
					
					if(nextX < 0 || nextX >= h || nextY < 0 || nextY >= w){
						t = -1;
						break;
					}
					if(map[nextX][nextY] == 1){
						sh = nextX;
						sw = nextY;
						map[sh][sw] = 0;
						break;
					}
					else if(map[nextX][nextY] == 3){
						nx = nextX;
						ny = nextY;
						break;
					}
					else{
						nx = nextX;
						ny = nextY;
					}
				}
				
				if(map[nx][ny] == 3){
					if(count < ans)	ans = count;
				}
				else if(t == 0 && !(nx == nh && ny == nw)){
					iter(nx, ny, count+ 1);
				}
				
				if(sh != -1){
					map[sh][sw] = 1;
				}
			}
		}
	}
	
	
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 45184
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#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++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
#define ll long long int
using namespace std;

int main(void){
    int r;

    cin >> r;
    cout << r*r << endl;

    return 0;
}

Measured memory_bytes: 256
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>
#include <iomanip>

using namespace std;

#define FOR(i, a, b) for(int (i)=(a);(i)<(b);(i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)
#define REP(i, n) FOR((i), 0, (n))

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class T>
void print_container(T &container, string delim=" ") {
    bool first = true;
    for(auto &t: container){
        if(!first){
            cout << delim;
        }
        first = false;
        cout << t;
    }
    cout << endl;
}

int main() {
    int n, a;
    cin >> n >> a;
    vector<int> x(n);
    REP(i, n){
        cin >> x[i];
        x[i] -= a;
    }

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

    vector<vector<ll>> dp(n+1, vector<ll>(5001, 0));

    dp[0][2500] = 1;
    IFOR(i, 1, n){
        RFOR(j, 5000, 0){
            dp[i][j] = dp[i-1][j] + dp[i-1][j-x[i-1]];
        }
    }

    cout << dp[n][2500] - 1 << endl;

    return 0;
}

Measured memory_bytes: 2304
#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
#include <iomanip>
#include <utility>
#include <stack>
#include <queue>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <numeric>
#include <stack>
#include <map> // pair
#include <cstdlib>  // abs() for integer
#include <cmath>    // abs() for float, and fabs()
typedef std::stack<int> IntStack;
typedef std::stack<char> charStack;

using namespace std;
using ll = long long;
typedef pair <ll, ll > pll;

int main()
{
	ll a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, ans = 0;
	ll n, m, K;
	ll memo[1003][1003] = { {} };
	ll memox[1003] = {};
	ll memoy[1003] = {};
	ll x[1000006] = {};
	ll y[200005] = {};
	ll z[200005] = {};
	string s;

	//IntStack yStack;
	//charStack Stack;

	cin >> a;
	for (int i = 1; i <= a; i++)
	{
		cin >> x[i];
	}
	if (a%2==0)
	{
		for (int i = a; i >= 2; i-=2)
		{
			cout << x[i] << endl;
		}
		for (int i = 1; i <= a-1; i+=2)
		{
			cout << x[i] << endl;
		}
	}
	else
	{
		for (int i = a; i >= 1; i -= 2)
		{
			cout << x[i] << endl;
		}
		for (int i = 2; i <= a-1; i += 2)
		{
			cout << x[i] << endl;
		}
	}

	//cout << ans << endl;


	////std::cout << std::fixed;
	//cout << std::setprecision(20) << << endl;
	//cout << d+1 << endl;
	//cout << "" << endl;

	return 0;
}
//char型の文字数字は、-'0'で数値に変換できる
//accumulate(x, x + a, 0);//int型までの配列の合計
//memcpy(x, visited, sizeof(ll)*n);
//void kansuu(ll num, ll visited[10]) {}
//kansuu(1, zz);
//cout << setprecision(15) << v << endl;
//cout << char(z - 'a');
//log10(i) + 1 //10進数の桁数を取得

//int temp;
//for (int i = 0; i < n - 1; i++) {
//	for (int j = n - 1; j > i; j--) {
//		if (w[j - 1] < w[j]) {  /* 前の要素の方が大きかったら */
//			temp = w[j];        /* 交換する */
//			w[j] = w[j - 1];
//			w[j - 1] = temp;
//		}
//	}
//}

//最小公倍数
//ll x = a * b;
//ll tmp;
///* 自然数 a > b を確認・入替 */
//if (a<b) {
//	tmp = a;
//	a = b;
//	b = tmp;
//}
///* ユークリッドの互除法 */
//ll r = a % b;
//while (r != 0) {
//	a = b;
//	b = r;
//	r = a % b;
//}
//a = x / b;//答え

Measured memory_bytes: 9984
string = input()
# print(string)
# string = string[0]
# num = int(string[1])

num = int(input())
# num = int(l[1])
# print(string)
if num == 0:
    out = string
    print(out)
else:
    out=string[0]
    for i in [i for i in range(len(string))]:
        if i != 0:
            if i%num == 0:
                out=out+string[i]
    print(out)


Measured memory_bytes: 3060
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author yassin
 */

#include <bits/stdc++.h>

using namespace std;

class abc088_d {
public:
    void solve(istream& in, ostream& out) {
        int H, W;
        in >> H >> W;
        vector<string> grid(H);
        for (int i = 0; i < H; ++i) {
            in >> grid[i];
        }
        queue<pair<int, int>> q;
        q.emplace(0, 0);
        vector<vector<int>> dist(H, vector<int>(W, -1));
        dist[0][0] = 1;
        int dirx[4]{1, -1, 0, 0}, diry[4]{0, 0, 1, -1};
        while (!q.empty()) {
            int x = q.front().first, y = q.front().second;
            q.pop();
            for (int i = 0; i < 4; ++i) {
                int nx = x + dirx[i], ny = y + diry[i];
                if (nx >= 0 && nx < H && ny >= 0 && ny < W && dist[nx][ny] == -1
                        && grid[nx][ny] == '.')
                {
                    dist[nx][ny] = dist[x][y] + 1;
                    q.emplace(nx, ny);
                }
            }
        }
        if (dist[H - 1][W - 1] == -1) {
            out << -1 << "\n";
        } else {
            int num_white = 0;
            for (int i = 0; i < H; ++i) {
                num_white += count(begin(grid[i]), end(grid[i]), '.');
            }
            assert(num_white >= dist[H - 1][W - 1]);
            out << num_white - dist[H - 1][W - 1] << "\n";
        }
    }
};

int main() {
	std::ios::sync_with_stdio(false); cin.tie(nullptr);
	abc088_d solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair <int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int mod = 1e9 + 7;
const char nl = '\n';

void solve() {
    string s;
    cin >> s;
    bool a = false, b = false;
    if(s.length() % 2 == 0){
        a = true;
    }
    if(s[0] == s[s.length() - 1]){
        b = true;
    }
    if(a ^ b){
        cout << "Second";
    }
    else{
        cout << "First";
    }
}

int main() {
#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    solve();
    return 0;
}

Measured memory_bytes: 512