akhauriyash/Code-Regression huggingface dataset:
bool debug=false;
#include <stdio.h>
#include <vector>
#include <bitset>
#include <utility>
using namespace std;
#define PB push_back
#define F first
#define S second
const int N=6e2+10;
const int S=2e5+10;
int myabs(int n){return n>0?n:-n;}
short min(short a,short b){return a>b?b:a;}
short max(short a,short b){return a>b?a:b;}
short dp[2][N][S],from[2][N][S],x[N];
int main(){
    bitset<N> bs;
    short n,k,nxt;
    int apos=0,pos,ans=0,dis=-1,temp,npos=0,a,b,tot=0;
    pair<short,pair<short,int>> now;
    vector<int> v;
    scanf("%hd%hd%d%d",&n,&k,&a,&b);    
    for(int i=1;i<=n;i++)scanf("%hd",&x[i]);
    for(int i=1;i<=k;i++)tot+=x[i];
    for(int i=0;i<=n;i++)for(int j=0;j<S;j++)dp[0][i][j]=dp[1][i][j]=k+1;
    dp[0][k][tot]=0;
    if(debug)printf("before dp\n");
    for(int i=k;i<=n;i++){
        for(int j=0;j<S;j++)if(dp[1][i][j]<=k)for(int p=dp[1][i][j]+1;p<=min(dp[1][i-1][j],k);p++)if(dp[0][i][j-x[p]]>p){
                from[0][i][j-x[p]]=i+2000;
                dp[0][i][j-x[p]]=p;
                if(debug)printf("dp[0][%d][%d]=%d (from dp[%d][%d][%d])\n",i,j-x[p],p,1,i,j);
        }
        for(int j=0;j<S;j++)if(dp[0][i][j]<=k){
            if(dp[0][i+1][j]>dp[0][i][j]){
                dp[0][i+1][j]=dp[0][i][j];
                from[0][i+1][j]=i+1000;
                if(debug)printf("dp[0][%d][%d]=%d (from dp[%d][%d][%d])\n",i+1,j,dp[0][i+1][j],0,i,j);
            }
            if(dp[1][i+1][j+x[i+1]]>dp[0][i][j]){
                dp[1][i+1][j+x[i+1]]=dp[0][i][j];
                from[1][i+1][j+x[i+1]]=i;
                if(debug)printf("dp[1][%d][%d]=%d (from dp[%d][%d][%d])\n",i+1,j+x[i+1],dp[1][i+1][j+x[i+1]],0,i,j);
            }
        }
    }
    if(debug)printf("after dp\n");
    for(int i=0;i<S;i++)if(dp[0][n][i]<=k)v.PB(i);
    if(debug){
        printf("%d",v[0]);
        for(int i=1;i<v.size();i++)printf(" %d",v[i]);
        printf("\n");
    }
    for(int i=a;i<=b;i++){
        temp=S;
        while(npos<v.size()){
            if(v[npos]<i)npos++;
            else break;
        }
        if(npos>=v.size())pos=v.back();
        else if(npos==0)pos=v[npos];
        else if(v[npos]-i>i-v[npos-1])pos=v[npos-1];
        else pos=v[npos];
        if(dis<myabs(i-pos)){
            dis=myabs(i-pos);
            ans=i;
            apos=pos;
        }
    }
    printf("%d\n",ans);
    now={0,{n,apos}};
    bs.reset();
    for(int i=1;i<=k;i++)bs[i]=true;
    while(now.S.F>k){
        if(debug)printf("now=(%hd,%hd,%d)\n",now.F,now.S.F,now.S.S);
        nxt=from[now.F][now.S.F][now.S.S];
        if(nxt>=2000){
			nxt-=2000;
            bs[dp[now.F][now.S.F][now.S.S]]=false;
            now={1,{nxt,now.S.S+x[dp[now.F][now.S.F][now.S.S]]}};
        }
        else if(nxt>=1000)now={0,{nxt-1000,now.S.S}};
        else {
            bs[now.S.F]=true;
            now={0,{now.S.F-1,now.S.S-x[now.S.F]}};
        }
    }
    v.clear();
    for(int i=1;i<=n;i++)if(bs[i])v.PB(i);
    printf("%d",v[0]);
    for(int i=1;i<k;i++)printf(" %d",v[i]);
    printf("\n");
}



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

def construct_gs(n):
    gs = []
    g = 1
    while g <= n:
        gs.append(g)
        g = 3 * g + 1
    return gs[::-1]


def shell_sort(xs, n):
    global cnt
    cnt = 0
    gs = construct_gs(n)
    m = len(gs)
    def insertion_sort(g):
        global cnt
        for i in range(g, n):
            v = xs[i]
            j = i - g
            while j >= 0 and xs[j] > v:
                xs[j + g] = xs[j]
                j = j - g
                cnt += 1
            xs[j + g] = v
    for g in gs:
        insertion_sort(g)
    return m, gs, cnt, xs


def main():
    n = int(input())
    xs = [int(input()) for _ in range(n)]
    m, gs, cnt, xs = shell_sort(xs, n)
    print(m)
    print(" ".join(map(str, gs)))
    print(cnt)
    for x in xs:
        print(x)


if __name__ == '__main__':
    main()

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

#define pb push_back
#define S second
#define F first
typedef long long ll;

using namespace std;

const ll maxn = 5e5 + 10;
const ll inf = 1e18;
const ll mod = 1e9 + 7;

ll n, p, a[maxn], ans, k;

int main(){

//	freopen("input.txt", "r", stdin);
	
	cin >> n;
	for(int i=0;i < n;i++){
		cin >> a[i];
	}
	p = 2;
	ans = a[0] - 1;
	for(int i=1;i < n;i++){
		ans += a[i] / p;
		if(!(a[i] % p)){
			ans--;
		}
		if(a[i] == p){
			p++;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 4400
/**
 *      ///----- My Info -----///
 *      Code by: Unk
 *      Codeforces User: Ernest0_0Abreu
 *      Country: Cuba
 *      E-mail: ernestoabreup@gmail.com
 *      CopyRight
**/
#include <bits/stdc++.h>
#ifdef Ernest0_0Abreu 
#include <debug/to_string.h>
#endif
#pragma GCC optimize("Ofast")
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
using namespace std;
    	///----- My Template -----///
///===================================================================================================================================
/// Debug
#define _end cout << "\n"
#ifndef Ernest0_0Abreu
#define db(x) ;
#define dbrange(x,begin,end) ;
#define dbname(x) ;
#define dbnamerange(x,begin,end) ;
#define dbmat(x,begin_n,end_n,begin_m,end_m) ;
#define dbST(x,end) ;
#define db_end ;
#endif
///Function
#define pi (acos(-1))
#define lg2(x) 31-__builtin_clz(x)
#define lgx(x,b) log(b)/log(x)
/// Macros
#define fst first
#define scd second
#define left (node<<1)
#define right ((node<<1)+1)
#define sz(x) (int)(x.size())
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
/// Typedef
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
/// Constant
const ll MAXN = 2e5+7;
const int MOD = 1e9+7;
const ull BASE = 311;
const ld EPS = 1e-9;
const int INF = ((1<<30)-1);
const ll INFLL = ((1ll<<62ll)-1ll);
const ll oo = 2e18;
/// Hash Prime Numbers: 2, 277, 293, 307, 331, 337, 1009, 2027;
/// Module Prime Numbers: 3,1000033, 998244353, 1000000007, 1000000009, 1000000021;
///===================================================================================================================================
#define int long long
		///----- My code -----///

int ar[MAXN], dp[MAXN];
bool mk[MAXN];

int32_t main(){
	
	ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);

	int N, K;
	cin >> N >> K;
	for(int i = 1; i <= N; ++i){
		cin >> ar[i];
	}
	int x = 1;
	int cycle = oo;
	while(!mk[x]){
		mk[x] = true;
		if(!mk[ar[x]]) {dp[ar[x]] = dp[x]+1; K--; x = ar[x];}
		if(mk[ar[x]]){
			cycle = dp[x] - dp[ar[x]] + 1;
		}
		if(K == 0) break;
	}
	db(K); db(x); db(cycle);

	K%=cycle;
	while(K > 0){
		x = ar[x];
		K--;
	}

	cout << x;
	
	return 0;
}


Measured memory_bytes: 6908
#include <iostream>
#include <bitset>
#include <algorithm>

using namespace std;

int main()
{
    ios::sync_with_stdio(0);
	cin.tie(NULL);
	const int MAX_VALUES = 101;
	bitset<MAX_VALUES> bits;
	bitset<MAX_VALUES> reversed;
	int x, n, t;
	cin >> x >> n;
    if (n == 0) {
        cout << x;
        exit(0);
    }
	for (int i = 0; i < n; i++) {
		cin >> t;
		bits.set(t);
		reversed.set(MAX_VALUES - 1 - t);
	}
    if (!bits[x]) {
        cout << x;
        exit(0);
    }
	bits.flip();
	reversed.flip();
	int rV = bits._Find_next(x);
	int lV = MAX_VALUES - 1 - reversed._Find_next(MAX_VALUES - 1 - x);
	int d1 = abs(rV - x);
	int d2 = abs(lV - x);
	if (d1 < d2) {
		cout << rV;
	}
	else if (d2 < d1) {
		cout << lV;
	}
	else {
		cout << min(rV, lV);
	}
	return 0;
}

Measured memory_bytes: 3652
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
void push(int);
int pop();
int top=0,stc[200];
void push(int x){
    top++;
    stc[top]=x;
    return;
}
int pop(){
    top--;
    return stc[top+1];
}
int main(void){
    char x[100];
    int a,b;
    while(scanf("%s",x)!=EOF){
        if(x[0]=='+'){
            b=pop();
            a=pop();
            push(a+b);
        }else if(x[0]=='-'){
            b=pop();
            a=pop();
            push(a-b);
        }else if(x[0]=='*'){
            b=pop();
            a=pop();
            push(a*b);
        }else{
            push(atoi(x));
        }
    }
    printf("%d\n",pop());
    return 0;
}


Measured memory_bytes: 2048
/*
--------------              |   /
      |                     |  /
      |                     | /
      |             *       |/          |    |         ------            *
      |                     |           |    |        /      \
      |             |       |\          |    |       |       |\          |
   \  |             |       | \         |    |       |       | \         |
    \ |             |       |  \        |    |        \     /   \        |
     V              |       |   \        \__/|         -----     \       |
*/
#include <bits/stdc++.h>
using namespace std;

#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(NULL);
#define mem(i,j) memset(i,j,sizeof (i));
using ll = int64_t;
using ull = uint64_t;
using ld = long double;
using uint = uint32_t;
const double EPS  = 1e-8;
const int INF     = 0x3F3F3F3F;
const ll LINF     = 4611686018427387903;
const int MOD     = 1e9+7;
/*-----------------------------------------------------------------------------------------------------*/

signed main() {
	EmiliaMyWife
	
	string s;
	cin >> s;
	s += 'A';
	int ans = 0;
	for(int i = 1, cnt = (s[0]=='R'); i <= 3; cnt+=(s[i]=='R'), i++)
		if(s[i] != 'R')
			ans = max(ans, cnt), cnt = 0;
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 3592
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1LL << 60;
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)

ll MOD = 998244353;
ll modpow(ll a, ll n) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % MOD;
		a = a * a % MOD;
		n >>= 1;
	}
	return res;
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);


	int N;
	cin >> N;
	map<ll, ll>mp;
	for (int i = 0; i < N; i++) {
		int D;
		cin >> D;
		if (i == 0) {
			if (D != 0) {
				puts(0);
				return 0;
			}
		}
		else {
			mp[D]++;
		}
	}

	if (N == 1) {
		puts(1);
		return 0;
	}
	if (!mp.count(1)) {
		puts(0);
		return 0;
	}

	ll ans = 1;
	fore(x,mp){
		if (x.first == 1)continue;
		ans *= modpow(mp[x.first - 1],x.second);
		ans %= MOD;
	}
	puts(ans);


	return 0;
}

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

int main(){
	int r, c;
	int data[101][101];
	int i, j;

	scanf("%d %d", &r, &c);

	for(i=0; i<r+1; i++){
		for(j=0; j<c+1; j++){
			data[i][j] = 0;
		}
	}

	for(i=0; i<r; i++){
		for(j=0; j<c; j++){
			scanf("%d", &data[i][j]);
		}
	}

	for(i=0; i<r; i++){
		for(j=0; j<c; j++){
			data[i][c] = data[i][c] + data[i][j];
			data[r][j] = data[r][j] + data[i][j];
			data[r][c] = data[r][c] + data[i][j];
		}
	}

	for(i=0; i<r+1; i++){
		for(j=0; j<c+1; j++){
			if(j>0)
				printf(" ");

			printf("%d", data[i][j]);
		}

		printf("\n");
	}	

	return 0;

}


Measured memory_bytes: 2040
void main()
{
    long n, m;
    rdVals(n, m);
    long[] a = rdRow;

    a.sort!"a > b";
    long[] b = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6];
    long[] dp = new long[n+1];
    dp[] = -inf;
    dp[0] = 0;
    foreach (i; 0 .. n)
    {
        foreach (x; a)
        {
            if (i + b[x] > n) continue;
            dp[i+b[x]] = max(dp[i+b[x]], dp[i]+1);
        }
    }

    string result;
    while (n)
    {
        foreach (x; a)
        {
            if (n - b[x] >= 0 && dp[n] == dp[n-b[x]] + 1)
            {
                result ~= x.to!string;
                n -= b[x];
                break;
            }
        }
    }

    result.writeln;
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;
enum double eps = 1.0e-9;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.mathspecial;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;
import core.bitop;

Measured memory_bytes: 2428
using namespace std;
#include <bits/stdc++.h>
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
void solve()
{
string s1,s2;
cin>>s1>>s2;
int d=0;
for (int i = 0; i < s1.length(); i++)
{
    if(s1[i]!=s2[i])
    d++;
}

cout<<d<<endl;
}
int main()
{
//      #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin);
//     freopen("output.txt", "w", stdout);
// #endif
FASTIO
 long long int t;
 t=1;
 while(t--)
  solve();
  return 0;
}


Measured memory_bytes: 3812
L = list(map(int, input().split()))
L.extend(list(map(int, input().split())))
L.extend( list(map(int, input().split())))
num1 = L.count(1)
num2 = L.count(2)
num3 = L.count(3)
num4 = L.count(4)
LIST = [num1 %2,num2 %2,num3 %2,num4 %2]
if num1 / 2==0 and num2 / 2==0 and num3 /2==0 and num4 /2 == 0:
   print("YES")
elif  LIST.count(1)==2:
   print("YES")
else:
   print("NO")

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef bitset<50011> b100;

b100 a[55555];
ii E[111111];
int b[123456];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n,m,t; cin>>n>>m>>t;
	for(int i=0;i<m;i++)
	{
		int u,v; cin>>u>>v; u--; v--;
		E[i]=mp(u,v);
	}
	vi F,G;
	for(int i=0;i<n;i++) F.pb(i),G.pb(i);
	random_shuffle(F.begin(),F.end());
	random_shuffle(G.begin(),G.end());
	if(t==1)
	{
		for(int i=0;i<n;i++) a[i].set(i,1);
		for(int i=m-1;i>=0;i--)
		{
			int u=E[i].fi; int v=E[i].se;
			a[u]|=a[v]; a[v]=a[u]; 
		}
		for(int i:F)
		{
			int cnt=1;
			for(int j:G)
			{
				cnt&=a[j][i];
				if(cnt==0) break;
			}
			if(cnt==1)
			{
				b100 tmp;
				tmp.set(i,1);
				string ans(m,'^');
				for(int i=m-1;i>=0;i--)
				{
					int u=E[i].fi; int v=E[i].se;
					if(!tmp[u])
					{
						ans[i]='v';
					}
					int tt = tmp[u]|tmp[v];
					tmp[u]=tt; tmp[v]=tt;
				}
				cout<<ans<<'\n'; return 0;
			}
		}
		cout<<-1<<'\n'; return 0;
	}
	else
	{
		if(n==2)
		{
			cout<<-1<<'\n'; return 0;
		}
		vi cnt(n,1);
		for(int i=0;i<n;i++)
		{
			b[i]=i;
			cnt[i]++;
		}
		string ans(m,'^');
		for(int i=m-1;i>=0;i--)
		{
			int u=E[i].fi; int v=E[i].se;
			if(cnt[b[u]]>cnt[b[v]])
			{
				cnt[b[u]]--; cnt[b[v]]--;
				ans[i]='v';
				b[u]=b[v]; cnt[b[u]]++; cnt[b[v]]++;
			}
			else
			{
				cnt[b[u]]--; cnt[b[v]]--;
				b[v]=b[u]; cnt[b[u]]++; cnt[b[v]]++;
			}
		}
		cout<<ans<<'\n';
	}
}


Measured memory_bytes: 307580
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
int syu, era, A, B;
B=0;
cin >> syu >> era;
vector<int> nedan(syu);
for(int i=0;i<syu;i++){
    cin >> A;
    nedan.at(i)=A;
}
sort(nedan.begin(), nedan.end());
for(int i=0;i<era;i++){
    B+=nedan.at(i);
}
cout << B << endl;
}


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

int main() {
  // ここにプログラムを追記
  string S;
  int x=7;
  cin>> S;
  if(S.at(0)=='o') x++;
  if(S.at(1)=='o') x++;
  if(S.at(2)=='o') x++;
  cout<<x*100<<endl;
 
}


Measured memory_bytes: 256
#include <iostream>
#include <stdlib.h>
#include <vector> //vector
#include <algorithm> //sort()
#include <numeric>

#define rep(i, n) for(int i=0; i<(int)(n);i++)
#define all(x) (x).begin(), (x).end()
#define debug(a) cout << "debug (" #a "):" << endl << (a) << endl;

typedef uint64_t ulint;
typedef int64_t lint;

using namespace std;

template<class T> inline bool chmin(T& a, T b);
template<class T> inline bool chmax(T& a, T b);
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v);

template<class T> lint sum(vector<T> a);
template<class T> double ave(vector<T> a);

//uint64_t a, b, c, d;
//uint64_t i, j;
lint n, x,l;

int main(){
//////////////////////////////////////////////////////

    cin >> n >> x;


    lint d=0;
    lint sum = 1;
    rep(i,n)
    {
        cin >> l;
        d+=l;
        if(d<=x)
        {
            sum++;
        }
        else
        {
            break;
        }
        
        
    }



    //昇順ソート
    //sort(all(a));


    //デバッグ出力
    //debug(a);
    //debug(b);
    //debug(c);


    cout << sum << endl;

    

   

    // sort(input.begin() , input.end());

    // uint64_t max = numeric_limits<uint64_t>::max();


    //////////////////////////////////////////////////////
    // DP

//     // 無限大の値
//     const uint64_t INF = (uint64_t)1 << 60;
//     //const int64_t NINF = -1 * ((int64_t)1 << 60 );
 
//     // DP テーブル
//     uint64_t dp[100010];

//     //DPテーブル初期化（最小化用）
//     for (int i = 0; i < 100010; ++i)
//     {
//         //dp[i] = INF;
//         dp[i] = 0;
//     } 

//     // 初期条件
//     dp[0] = 0;

//     // ループ
//     for (int i = 1; i <= n; ++i) {
//         //chmin( dp[i], dp[i - 1] + abs( input[i] - input[i - 1] ));
//         //if (i < 2)continue;
//         //chmin( dp[i], dp[i - 2] + abs( input[i] - input[i - 2] ));



//         // chmax ( dp [i] , dp[i - 1]);
//         // chmax ( dp [i] , dp[i - 1] + input[i]);
//         // cout << "dp[" << i <<"] = " << dp[i] << endl;

//     }



// //////////////////////////////////////////////////////

//     cout << dp[n] << endl;

//////////////////////////////////////////////////////
// Ctrl + Opt + N to make
    return 0;
}


//最小化用関数
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;
}


// vectorprint用
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
	int len = v.size();
	for (int i = 0; i < len; ++i) {
		s << v[i]; if (i < len - 1) s << "\t";
	}
	return s;
}

// //合計
// template<class T> lint sum(vector<T> a)
// {
//     return std::accumulate(a.begin(), a.end(), 0);
// }


// //平均
// template<class T> double ave(vector<T> a)
// {
//     return std::accumulate(a.begin(), a.end(), 0.0) / a.size();
// }


Measured memory_bytes: 384
#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;

int main(){
   int H,W;
   cin >> H >> W;
   while(!(H==0 && W==0)){
      for(int i=1; i<=H; i++){
         for(int j=1; j<=W; j++){
            if((i+j)%2 == 1){
               printf(".");
            }
            else{
               printf("#");
            }
         }
         printf("\n");
      }
   printf("\n");
   cin >> H >> W;
   }

   return 0;
}



Measured memory_bytes: 3088
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<cstdio>
#include<queue>
#include<deque>
#include<map>
#include<stack>
#include<set>
#include<utility>
using namespace std;
typedef pair<int,int> ii;
typedef long long ll;
typedef pair<ll,ll> p;
typedef unsigned long long int ull;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
const int MAXN=100000;
const int MAXE=100000;
const int MAXV=10000;
const ll INF=2e18;
ll MOD=1e9+7;

ll power(ll a,ll x){
    ll res=1;
    while(x>0){
        if(x&1) res=res*a%13;
        a=a*a%13;
        x>>=1;
    }
    return res;
}

int main(){
    int n,k;cin>>n>>k;
    vector<ll> x(n);
    for(int i=0;i<n;i++) cin>>x[i];
    ll ans=INF;
    for(int i=0;i+k-1<n;i++){
        ans=min(ans,x[i+k-1]-x[i]+min(abs(x[i]),abs(x[i+k-1])));
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3972
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

using namespace std;
using ll = long long;
using ull = unsigned long long;

#ifndef __MACRO_H__
#define __MACRO_H__

#define all(collection)  (collection).begin(), (collection).end()		// begin to end
#define rep(i, begin, end) for (ll i = begin; i < end; i++)					// repeat
#define repr(i, begin, end) for (ll i = begin - 1; end <= i; i--)		// repeat reverse

std::chrono::system_clock::time_point  start;

void TimeStart(void)
{
	start = std::chrono::system_clock::now();
}

void TimeEnd(void)
{
	auto time = std::chrono::system_clock::now() - start;
	auto msec = std::chrono::duration_cast<std::chrono::milliseconds>(time).count();
	cerr << endl << msec << " msec " << endl;
}

#endif


int main(void)
{
	ll r; cin >> r;
	ll d; cin >> d;
	ll x; cin >> x;

	rep(i, 0, 10)
	{
		x = r * x - d;
		cout << x << endl;
	}

	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++)
typedef long long ll;
int main() {
  ll n; cin>>n;
  ll a[n];
  rep(i, n) cin >> a[i];
  ll cnt=0;
  rep(i, n) {
    if(a[i]!=i+1) cnt++;
  }
  if(cnt<=2) cout << "YES";
  else cout << "NO";
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
using namespace std;
int main() {
  int n,m;
  cin >> n >> m;
  vector<int>h(n);
  rep(i,n) cin >> h[i];
  vector<int>p(n,0);
  rep(i,m) {
    int a,b;
    cin >> a >> b;
    if(h[a-1]>h[b-1]) p[b-1]=-1;
    else if(h[a-1]==h[b-1]) {
      p[a-1]=-1;
      p[b-1]=-1;}
    else if(h[a-1]<h[b-1]) p[a-1]=-1;
  }
  int ans=0;
  rep(i,n) {
    if(p[i]==0) ans++;}
  cout << ans << endl;
  return 0;
}


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

template<typename T, typename F, typename G> struct SegmentTree {
    //using F = function<T(T, T)>;
private :
    int n;
    T id;
    vector<T> node;
    F f;
    G g;
public :

    SegmentTree () { }

    SegmentTree (int sz, F f, G g, T id) : n(1), f(f), g(g), id(id) {
        while (n < sz) n *= 2;
        node = vector<T>(2*n-1, id);
    }

    SegmentTree (vector<T> v, F f, G g, T id) : n(1), f(f), g(g), id(id) {
        while (n < (int)v.size()) n *= 2;
        node = vector<T>(2*n-1, id);
        for (int i = 0; i < (int)v.size(); i++) node[i+n-1] = v[i];
        for (int i = n-2; i >=0; i--) node[i] = f(node[i*2+1], node[i*2+2]);
    }

    void update (int i, T x) {
        i += n - 1;
        assert(i < node.size());
        node[i] = g(node[i], x);
        while (i > 0) {
            i = (i-1)/2;
            node[i] = f(node[2*i+1], node[2*i+2]);
        }
    }

    T query (int a, int b, int k, int l, int r) {
        if (r <= a || b <= l) return id;
        if (a <= l && r <= b) return node[k];
        T vl = query(a, b, 2*k+1, l, (l+r)/2);
        T vr = query(a, b, 2*k+2, (l+r)/2, r);
        return f(vl, vr);
    }

    T query (int a, int b) { return query(a, b, 0, 0, n); }

    const T &operator[] (int i) const { return node[i+n-1]; } 

};

template<typename T> inline T GCD(T a, T b) {
    if (b == 0) return a;
    if (a % b == 0) return b;
    return (GCD(b, a % b));
}

int main() {
    int n;
    cin >> n;
    vector<long long> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    
    auto f = [](long long a, long long b) { return GCD(a, b); };
    auto g = [](long long a, long long b) { return b; };
    SegmentTree<long long, decltype(f), decltype(g)> seg(a, f, g, 0LL);
    
    long long ans = 0;
    for (int i = 0; i < n; i++) {
        long long res = GCD(seg.query(0, i), seg.query(i+1, n));
        ans = max(ans, res);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3840
"""
    Template written to be used by Python Programmers.
    Use at your own risk!!!!
    Owned by enraged(rating - 5 star at CodeChef and Specialist at Codeforces).
"""
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nlargest, nsmallest, _heapify_max, _heapreplace_max
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque, Counter as c
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from fractions import Fraction
# sys.setrecursionlimit(2*pow(10, 6))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
mod = pow(10, 9) + 7
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(var): sys.stdout.write(str(var))
def outln(var): sys.stdout.write(str(var)+"\n")
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]


a, b, z, d = sp()
par = 1
while a > 0 and z > 0:
    if par:
        z -= b
    else:
        a -= d
    par = 1-par
if not par:
    outln('Yes')
    exit()
outln('No')


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

int main() {
  int n,k;
  cin>>n>>k;
  vector<int> a[n];
  rep(i,n-1){
    int f,t;
    cin>>f>>t;
    a[f-1].push_back(t-1);
    a[t-1].push_back(f-1);
  }
  ll ans=k;
  queue<int> q;
  bool used[n];
  rep(i,n) used[i]=false;
  used[0]=true;
  rep(i,a[0].size()){
    ans=ans*(k-1-i)%mod;
    used[a[0][i]]=true;
    q.push(a[0][i]);
  }
  
  while(q.size()){
    int p=q.front();
    q.pop();
    int cur=k-2;
    rep(i,a[p].size()){
      if(used[a[p][i]]==false){
        ans=ans*cur%mod;
        used[a[p][i]]=true;
        q.push(a[p][i]);
        cur--;
      }
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 6648
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 300010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

int N, K;

void solve() {
	cin >> N >> K;
	if(N < 2) {
		vector<int> vec;
		rep(i, 0, (1 << N)) {
			vec.pb(i);
			vec.pb(i);
		}
		do {
			bool ok = true;
			rep(i, 0, (1 << N) * 2) {
				rep(j, 0, (1 << N) * 2) {
					if(vec[i] != vec[j]) continue;
					int tmp = 0;
					for(int k = i + 1; k < j; k++) {
						tmp ^= vec[k];
					}
					if(tmp != K) ok = false;
				}
			}
			if(ok) {
				rep(i, 0, sz(vec)) {
					cout << vec[i] << " ";
				}
				cout << "\n";
				return;
			}
		} while(next_permutation(all(vec)));
		cout << -1 << "\n";
	}
	else {
		if(K >= (1 << N)) {
			cout << -1 << "\n"; return;
		}
		vector<int> vec;
		rep(i, 0, (1 << N)) {
			if(i == K) continue;
			vec.pb(i);
		}
		vector<int> ans;
		rep(i, 0, sz(vec)) ans.pb(vec[i]);
		ans.pb(K);
		rer(i, sz(vec), 0) ans.pb(vec[i]);
		ans.pb(K);
		rep(i, 0, sz(ans)) {
			cout << ans[i] << " ";
		}
		cout << "\n";
	}
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



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

using namespace std;
using ll = long long;
ll n,k, a[300005],f[300005];
bool check(ll time){
    ll need=0;
    for(int i=0;i<n;i++){
        if(a[i]*f[i] > time){
                need = need + (a[i] - (time/f[i]));
        }
    }
    if(need<=k)
        return true;
    else    return false;
}
int main() {
    
    cin>>n>>k;
    for(int i=0;i<n;i++)    cin>>a[i];
    for(int i=0;i<n;i++)    cin>>f[i];
    sort(a,a+n);
    sort(f,f+n,greater<ll>());
    ll l=0,h=1e18,mid,ans;
    while(l<=h){
        mid=(l+h)/2;
        if(check(mid)){
            ans=mid;
            h=mid-1;
        }
        else{
            l=mid+1;
        }
    }
    cout<<ans;
    
}

Measured memory_bytes: 3840
n=int(input())
reds=list()
blues=list()
cnt=0
for i in range(n):
	reds.append(list(map(int,input().split())))
for i in range(n):
	blues.append(list(map(int,input().split())))
blues=sorted(blues,key=lambda x:x[0])
reds=sorted(reds,key=lambda x:x[1],reverse=True)

for blue in blues:
	for red in reds:
		if red[0]<blue[0] and red[1]<blue[1]:
			cnt+=1
			red[0]=201
			break
print(cnt)



Measured memory_bytes: 3064
#ifndef LOCAL
#pragma GCC optimize ("Ofast")
#endif

#include "bits/stdc++.h"

using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;
using ld = long double;

constexpr int nax = 1000 * 1000 + 105;
constexpr int infty = 1000 * 1000 * 1000 + 5;
constexpr int mod = 1000 * 1000 * 1000 + 7;

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

  int n, a, b;
  cin >> n >> a >> b;
  if ((b - a) & 1) cout << "Borys" << endl;
  else cout << "Alice" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MAX 1000000007
#define ll long long int
#define fo(i,a,n) for(int i=a;i<n;i++)
#define ull unsigned long long int
#define pb push_back
#define eb emplace_back
using namespace std;


int main(){

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

    // int t;
    // cin>>t;
    // while(t--){
        ll n;
        cin>>n;
        ll ans =0;
        
        for(ll i=1;i<=n;i++){
            for(ll j=i;j<=n, j*i < n; j++){
                if(i==j)
                    ans++;
                else
                    ans += 2;
            }
        }

        cout<<ans<<endl;


    // }
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    int P, Q, R;
    cin >> P >> Q >> R;
    cout << min(P + Q, min(Q + R, R + P)) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int a, b, c;

    scanf("%d %d %d", &a, &b, &c);

    if(c >= a && c <= b)
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }

    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

#include<list>

// size, push_back, pop_back, insert, erase

const int MAX_N = 3000000;
char cmd[MAX_N];
int arg[MAX_N];

int main() {

	int N;
	cin >> N;

	rep(i, N){

		// string command;
		// cin >> command;
		char command[20];
		scanf("%s", command);

		if (command[0] == 'i') {
			cmd[i] = 'I';
			cin >> arg[i];
		}
		else if (command[6] == 'F') {
			cmd[i] = 'F';
		}
		else if (command[6] == 'L') {
			cmd[i] = 'L';
		}
		else {
			cmd[i] = 'D';
			cin >> arg[i];
		}
	}
	
	list<int> lst;
	rep(i, N){
		if (cmd[i] == 'I'){ lst.push_front(arg[i]); }
		if (cmd[i] == 'D'){
			for (list<int>::iterator it = lst.begin(); it != lst.end(); it++){
				if (*it == arg[i])
				{
					lst.erase(it);
					break;
				}
			}
		}
		if (cmd[i] == 'F'){ lst.pop_front(); }
		if (cmd[i] == 'L'){ lst.pop_back(); }
	}

	for (list<int>::iterator it = lst.begin(); it != lst.end(); it++){
		if (it != lst.begin()) { cout << ' '; }
			cout << *it;
	}
	cout << endl;

}

Measured memory_bytes: 40616
from sys import stdin, stdout
import heapq
import cProfile
from collections import Counter, defaultdict, deque
from functools import reduce
import math


def get_int():
    return int(stdin.readline().strip())


def get_tuple():
    return map(int, stdin.readline().split())


def get_list():
    return list(map(int, stdin.readline().split()))

x,y = get_tuple()
if y%2!=0: print("No")
elif x*2<=y<=x*4: print("Yes")
else: print("No")


Measured memory_bytes: 9652
import collections


n = int(input())
a = list(map(int, input().split()))

a.sort()

aSet = set(a)

c = collections.Counter(a)

count = 0

for i in aSet:
    if c[i] > i:
        count = count + c[i] - i
    elif c[i] < i:
        count = count + c[i]


print(count)

Measured memory_bytes: 24300
//BISMILLAHIR RAHMANIR RAHIM
#include <bits/stdc++.h>
#define mem(a, b) (memset(a, b, sizeof(a)))
#define pb push_back
#define mk make_pair
#define ff first
#define ss second
#define PI acos(-1)
#define INF 2147483647
#define MOD 1000000007
#define MAX 100005
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<int, ii> pii;
typedef vector<ii> vii;
typedef priority_queue<int,vector<int>,greater<int> > PQ;

int Set(int mask, int pos){return mask = mask | (1<<pos);}
bool check(int mask, int pos){return (bool)(mask & (1<<pos));}

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

    int n, m;

    cin>>n>>m;

    int ans = n * (n - 1) / 2;
    ans += m * (m - 1) / 2;

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <deque>
#include <string>
#include <stack>
#include <unordered_set>
#include <cmath>
#define endl '\n'
#define ll long long
#define mod 1000000007

using namespace std;

bool check(string str)
{
	for (int i = 0; i < str.size() / 2; i++)
	{
		if (str[i] != str[i + str.size() / 2])
			return false;
	}

	return true;
}

int main(void)
{
	cin.tie(NULL); ios_base::sync_with_stdio(false);
	string str;  cin >> str;

	while(str.size() != 0)
	{
		str.pop_back();
		str.pop_back();
		if (check(str))
		{
			cout << str.length();
			break;
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
 
#define FOR(i, x, n) for(ll i = x; i < n; i++) 
#define pb push_back
#define pf push_front
#define ll long long
#define hii cout << "hii" << endl
#define pii pair<int, int>
#define pll pair<ll, ll>
#define int ll
#define mpp make_pair
#define endl '\n'
#define ff first 
#define ss second
#define vi vector<int>
#define all(s) s.begin(), s.end()
#define si size()
 
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; } 
 
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE
 
 
const int N = 5e5 + 5;
const int MAXN = 1e5 + 5;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const int INF = 1e15;
const int LG = 21;
 
int arr[N];
int posn[N];
int prime[N];
 
void solve() 
{
	int a, b, c;
	cin >> a >> b >> c;
	swap(a, b);
	swap(a, c);
	cout << a << " " << b << " " << c << endl;
}
 
 
int32_t main() 
{	
    ios_base:: sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	    int t = 1;
	    // cin >> t;
	while(t--)solve();
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

var h, w, n int
var blocks map[int]int

func main() {
	fmt.Scan(&h, &w, &n)
	blocks = make(map[int]int)

	for i := 0; i < n; i++ {
		var x, y int
		fmt.Scan(&x, &y)
		if yy, e := blocks[x]; e {
			if y < yy {
				blocks[x] = y
			}
		} else {
			blocks[x] = y
		}
	}

	right := 1
	for i := 1; i <= h; i++ {
		if v, e := blocks[i+1]; e {
			if v <= right {
				fmt.Println(i)
				return
			}
			if right+1 < v {
				right++
			}
		} else {
			right++
		}
	}
	fmt.Println(h)
}


Measured memory_bytes: 13824
#include <bits/stdc++.h>
#include <cmath>
#include <iostream>
#include <iomanip>

using namespace std;
int main(){
  long double pi =3.14159265358979323846;
  long long int A,B,H,M;
  long double x;
  cin>>A>>B>>H>>M;
  
  x=A*A+B*B-2.0*A*B*cos(abs(H*2*pi/12.0+pi*M/360.0-M*pi/30.0));
  cout<<fixed<<setprecision(12)<<sqrt(x)<<endl;
}





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

using namespace std;

int main() {
    int A, B, C, D, E, F;
    
    cin >> A >> B >> C >> D >> E >> F;

    int best_solution = 100 * A, best_solute = 0;

    int solution, solute, solvent;

    for (int i = 0; i * 100 * A <= F; i++) {
        for (int j = 0; i * 100 * A + j * 100 * B <= F; j++) {
            solvent = i * 100 * A + j * 100 * B;
            for (int k = 0; solvent + k * C <= F; k++) {
                for (int l = (F - solvent - k * C) / D; l >= 0; l--) {
                    solute = k * C + l * D;
                    solution = solute + solvent;
                    if (100 * solute > solvent * E) continue;
                    if (solute * best_solution > best_solute * solution) {
                        best_solution = solution;
                        best_solute = solute;
                    }
                    break;
                }
            }

        }
    }

    cout << best_solution << " " << best_solute << endl;
    return 0;
}

Measured memory_bytes: 256
h, w = map(int, input().split())
S = [str(input()) for _ in range(h)]

#g = [[] for _ in range(h*w)]

n = h*w

def Find(x, par):
    if par[x] < 0:
        return x
    else:
        par[x] = Find(par[x], par)
        return par[x]

def Unite(x, y, par, rank):
    x = Find(x, par)
    y = Find(y, par)

    if x != y:
        if rank[x] < rank[y]:
            par[y] += par[x]
            par[x] = y
        else:
            par[x] += par[y]
            par[y] = x
            if rank[x] == rank[y]:
                rank[x] += 1

def Same(x, y, par):
    return Find(x, par) == Find(y, par)

def Size(x, par):
    return -par[Find(x, par)]

par = [-1]* n
rank = [0]*n

for y in range(h):
    for x in range(w):
        idx1 = y*w+x
        for dy, dx in (-1, 0), (1, 0), (0, -1), (0, 1):
            ny, nx = y+dy, x+dx
            if 0 <= ny < h and 0 <= nx < w:
                idx2 = ny*w+nx
                if S[y][x] != S[ny][nx]:
                    Unite(idx1, idx2, par, rank)

ans = 0
#print(par)
X = [[0, 0] for _ in range(n)]
K = []

for i in range(n):
    y, x = divmod(i, w)
    if par[i] < 0:
        K.append(i)
        if S[y][x] == '#':
            X[i][0] += 1
        else:
            X[i][1] += 1
    else:
        if S[y][x] == '#':
            X[Find(i, par)][0] += 1
        else:
            X[Find(i, par)][1] += 1

ans = 0
for k in K:
    ans += X[k][0]*X[k][1]
print(ans)

Measured memory_bytes: 29028
#include <iostream>
#include <string>
#include <iomanip>
#include <algorithm>

using namespace std;
typedef long long ll;

int main()
{

    ll n;
    cin >> n;

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

    ll b[n - 1];
    for (int i = 0; i < (n - 1); i++)
    {
        cin >> b[i];
    }

    int sum = b[0];
    for (int i = 0; i < (n - 2); i++)
    {
        sum += min(b[i], b[i + 1]);
    }
    sum += b[n - 2];
           // ll c[n - 1];
           // for (int i = 0; i < (n - 1); i++)
           // {
           //     cin >> c[i];
           // }

           // int sum = 0;
           // int previous = 100;
           // for (int i = 0; i < n; i++)
           // {
           //     sum += b[a[i] - 1];

           //     if (a[i] - previous == 1)
           //     {
           //         sum += c[a[i] - 2];
           //     }

           //     previous = a[i];
           // }

           // sort(b, b + a);

           // for (int i = 0; i < (a - 1); i++)
           // {
           //     b[i + 1] = (b[i] + b[i + 1]) / 2;
           // }

           // // cout << fixed;
           // // cout << setprecision(14);
           cout
           << sum << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
typedef long long int L;
const L mod = 1000000007;

L CountPathsDP(L grid[][1005], L h, L w){
    
    vector<vector<L>> f(h + 1, vector<L> (w + 1, 0));
    
    f[h][w] = 1;
    //f[i][j] denotes the answer for starting from i, j;
    
    for(L i = h; i>=1; i--){
        for(L j = w; j>=1; j--){
            if(i==h && j==w){
                continue;
            }
            bool right, down;
            right = down = true;
            
            if(i == h || grid[i+1][j] == 1){
                down = false;
            }
            
            if(j == w || grid[i][j+1] == 1){
                right = false;
            }
            
            L ans;
            
            if(right && down){
                ans = (f[i+1][j]%mod) + (f[i][j+1]%mod);
                ans %= mod;
            }else if(right){
                ans = f[i][j+1]%mod;
                ans %= mod;
            }else if(down){
                ans = f[i+1][j]%mod;
                ans %= mod;
            }else{
                ans = 0;
            }
            
            f[i][j] = ans;
            f[i][j] %= mod;
        }
    }
    
    return f[1][1];
}
int main(){
    L h, w;
    scanf("%d%d", &h, &w);
    
    L grid[1005][1005];
    
    for(L i = 1; i<=h; i++){
        for(L j = 1; j<=w; j++){
            char x; cin >> x;
            if(x == '#'){
                grid[i][j] = 1;
            }else{
                grid[i][j] = 0;
            }
        }
    }
    cout << CountPathsDP(grid, h, w) << "\n";
    
}
    
    
    
    
    









Measured memory_bytes: 16000
import std.stdio;
import std.conv, std.array, std.algorithm, std.string;
import std.math, std.random, std.range, std.datetime;
import std.bigint;

void main(){
	string s = readln.chomp;
	
	string ans;
	if(s.length % 2){
		if(s[0] == s[$ - 1]) ans = "Second"; // like "aba"
		else ans = "First"; // like "acb"
		}
	else{
		if(s[0] == s[$ - 1]) ans = "First"; // like "acba"
		else ans = "Second"; // like "acab"
		}
	
	ans.writeln;
	}

Measured memory_bytes: 508