akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
#define PIGRECO 3.141592653589793
#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__) << "] "
///////////////////////////////////////////////////////////////////////////
//////////////////// DO NOT TOUCH BEFORE THIS LINE ////////////////////////
///////////////////////////////////////////////////////////////////////////


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

    double d,t,s;
    cin>>d>>t>>s;

    cout<<((d/s)<=t?"Yes":"No")<<endl;



}


Measured memory_bytes: 3736
#front small ng
def checkFront(start,a):
  global smallest
  nowIndex = start
  if(a[start] > smallest):
      #print("out")
      return 0
  else:
    smallest = a[start]
    return 1

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

smallest = a[0]
ans = 0

for i in range(n):
  ans += checkFront(i,a)
print(ans)

Measured memory_bytes: 24744
import std.stdio, std.string, std.conv;

void main()
{
    while(true)
    {
        int n=readln.chomp.to!int;
        if(n==0) break;
        if(n==1)
        {
           "deficient number".writeln;
           continue;
        }

        int s=1;
        for(int i=2; i*i <= n; ++i)
        {
            if(n/i*i==n)
            {
                if(i*i==n) s+=i;
                else s+=i+n/i;
            }
        }

        if(s<n) "deficient number".writeln;
        else if(s>n) "abundant number".writeln;
        else "perfect number".writeln;
    }
}

Measured memory_bytes: 1048
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <iomanip>
#include <queue>
#include <stack>
#include <deque>
#include <utility>
#include <functional>
#define rep(i,n) for(int i=0;i<n;++i)

using namespace std;
using ll = long long;
const ll INF = 1010101010;
ll n, m, a,b, add, ans=INF, A[101010], B[101010];
void solve() {
	if (B[0] < 0 && 0 <= B[m-1]) ans = min(ans, min(abs(B[0]), B[m-1]) * 2 + max(abs(B[0]), B[m-1]));
	else ans = min(ans, max(abs(B[0]), abs(B[m-1])));
}
int main() {
	cin >> n >> m;
	rep(i, n) cin >> A[i];
	rep(i, n - m + 1) {
		for (int j = 0; j < m; j++) {
			B[j] = A[i + j];
		}
		solve();
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char ch[100010];
    int str[30]={0};
    scanf("%s",ch);
    int xx=strlen(ch);
    for(int i=0;i<xx;i++)
    {
        int yy=ch[i]-'a';
        str[yy]++;
    }
    int flag=1;
    for(int i=0;i<=25;i++)
    {
        char cc='a'+i;
        if(str[i]==0)
            {printf("%c\n",cc);flag=0;break;}
    }
    if(flag==1)
        printf("None\n");
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define FOR(i, k, n) for (int i = (k); i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.begin(), a.end(), greater<int>()
#define ROT(a) a.begin(), a.begin() + 1, a.end()
#define RROT(a) a.begin(), a.end() - 1, a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9 + 7;
const int MAX = 10000000;
template <typename T1, typename T2>
inline bool chmin(T1& a, T2 b)
{
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T1, typename T2>
inline bool chmax(T1& a, T2 b)
{
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
T gcd(T a, T b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
//cout << 'H' << endl;
/*--------------------------------------------*/

map<int64_t, int> prime_factor(int64_t n)
{
    map<int64_t, int> ret;
    for (int64_t i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}
int main()
{
    //cout << fixed << setprecision(10)
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll N;
    cin >> N;

    auto m = prime_factor(N);

    ll ans = 0;

    for (auto [k, v] : m) {
        ll tmp = 0;
        for (ll i = 1; i * (i + 1) <= 2 * v; i++) {
            tmp = i;
        }
        //cout << tmp << endl;
        ans += tmp;
    }

    cout << ans << endl;
}


Measured memory_bytes: 3656
mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    S = input().rstrip('\n')
    T = input().rstrip('\n')
    ans = 0
    for s, t in zip(S, T):
        if s != t:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 74056
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
constexpr ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);

void chmin(ll &a, ll b) {
	a = min(a, b);
}
void chmax(int &a, int b) {
	a = max(a, b);
}
ll mod_pow(ll a, ll n, ll m = mod) {
	a %= m;
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }
const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}

int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };

void solve() {
	ll n; cin >> n;
	rep1(h, 3500)rep1(w, 3500) {
		ll a = (ll)n*h*w;
		ll b = (ll)4 * h*w - (ll)n*h - (ll)n*w;
		if (b > 0) {
			if (a%b == 0) {
				ll r = a / b;
				cout << h << " " << w << " " << r << "\n";
				return;
			}
		}
	}
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init_f();
	//init();
	solve();
	stop
		return 0;
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define ALL(A) (A).begin(),(A).end()
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)

const ll mod = 1e9+7;
const ll INF = -1*((1LL<<63)+1);
const int inf = -1*((1<<31)+1);

using namespace std;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(20);
    int n,m;
    cin >> n >> m;
    vector<ll> x(n),y(m);
    rep(i,n)cin >> x[i];
    rep(i,m)cin >> y[i];
    sort(ALL(x));
    sort(ALL(y));
    ll ans = 0;
    ll H = x[1]-x[0];
    ll W = y[1]-y[0];
    ll dif = x[1]-x[0];
    for(int i=1;i<n-1;i++){
        ll tx = x[i+1] - x[i];
        H += dif + tx * (i+1);
        H%=mod;
        dif = dif + tx * (i+1);
        dif%=mod;
    }
    dif = y[1] - y[0];
    for(int i=1;i<m-1;i++){
        ll ty = y[i+1] - y[i];
        W += dif + ty * (i+1);
        W%= mod;
        dif = dif + ty * (i+1);
        dif %=mod;
    }
    cout << H%mod*W%mod << endl;
}

Measured memory_bytes: 1792
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        int count=0;
        String B;
        for(int i=1; i<=Math.sqrt(N); i++){
            if(N%i==0){
                B = String.valueOf(N/i);
                count = B.length();
            }
        }
          System.out.println(count);
        }
    }


Measured memory_bytes: 35688
#include <iostream>
#include<vector>
#include<string>
#include<math.h>
#include<algorithm>
using namespace std;

int main() {
	int A, B, C, D, a, b;
	cin >> A >> B >> C >> D;

	a = A * B;
	b = C * D;

	if (a >= b) {
		cout << a << endl;
	}
	else {
		cout << b << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=100000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};


int main() {

	int n,m,x,y,ans=0;
	int a[101],b[101];

	cin>>n>>m>>x>>y;

	rep(i,n){
		cin>>a[i];
	}
	rep(j,m){
		cin>>b[j];
	}

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

	for(int k=x+1; k<y+1; ++k){
		if(a[0]<k){
			if(b[0]>=k){
				ans=1;
				break;
			}
		}
	}

	if(ans==1){
		cout<<"No War"<<endl;
	}else{
		cout<<"War"<<endl;
	}

	return 0;
}


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

int main(){
	ll n;
	cin >> n;
	ll ans = 0;
	while(ans * ans <= n){
		ans++;
	}
	ans--;
	cout << ans * ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int max_size = 300001;
		int[] ms = new int[max_size];
		for(int i = 6; i < max_size; i++) {
			if(ms[i] == 0 && (i % 7 == 1 || i % 7 == 6)) {
				ms[i] = 1;/* 月土素数 */
				for(int j = i * 2; j < max_size; j+=i) {
					ms[j] = 2;/* 倍数 */
				}
			}
		}
		
		while(true) {
			int n = sc.nextInt();
			if(n == 1) break;
			
			System.out.print(n + ":");
			for(int i = 6; i < n + 1; i++) {
				if(ms[i] == 1 && n % i == 0) {
					System.out.print(" " + i);
				}
			}
			System.out.println();
		}
	}

}



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

using namespace std;

typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldbl;
typedef pair<int, int> pii;
typedef pair<uint, uint> puu;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<uint> vu;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pii> vpii;
typedef vector<puu> vpuu;
typedef vector<pll> vpll;
typedef vector<pull> vpull;
typedef vector<string> vstr;
typedef vector<double> vdbl;
typedef vector<ldbl> vldbl;
#define pb push_back
#define ppb pop_back
#define pfr push_front
#define ppfr pop_front
#define emp emplace
#define empb emplace_back
#define be begin
#define rbe rbegin
#define all(x) (x).be(), (x).end()
#define rall(x) (x).rbe(), (x).rend()
#define fir first
#define sec second
#define mkp make_pair
#define brif(cond) if (cond) break
#define ctif(cond) if (cond) continue
#define retif(cond) if (cond) return
void canhazfast() {ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);}
template<typename T> T gcd(T a, T b) {return b ? gcd(b, a%b) : a;}
template<typename T> T extgcd(T a, T b, T &x, T &y)
{
    T x0 = 1, y0 = 0, x1 = 0, y1 = 1;
    while (b) {
        T q = a/b; a %= b; swap(a, b);
        x0 -= q*x1; swap(x0, x1);
        y0 -= q*y1; swap(y0, y1);
    }
    x = x0; y = y0; return a;
}
int ctz(uint x) {return __builtin_ctz(x);}
int ctzll(ull x) {return __builtin_ctzll(x);}
int clz(uint x) {return __builtin_clz(x);}
int clzll(ull x) {return __builtin_clzll(x);}
int popcnt(uint x) {return __builtin_popcount(x);}
int popcntll(ull x) {return __builtin_popcountll(x);}
int bsr(uint x) {return 31^clz(x);}
int bsrll(ull x) {return 63^clzll(x);}

int main()
{
    canhazfast();

    string s;

    cin >> s;
    for (int i = 1; i < 4; ++i) retif(s[i] == s[i-1]) cout << "Bad\n", 0;
    cout << "Good\n";

    return 0;
}


Measured memory_bytes: 764
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
long long a,b,c,d;
int main(){
   while(~scanf("%lld%lld%lld%lld",&a,&b,&c,&d)){
       long long s=0,t1,t2;
       t1=b/c-a/c;
       if(a%c==0)
        t1++;
        t2=b/d-a/d;
        if(a%d==0)
            t2++;
        s=t1+t2;
        long long p;
        p=__gcd(c,d);
        p=c*d/p;
        s-=b/p-a/p;
        if(a%p==0)
            s--;
            s=(b-a+1)-s;
        printf("%lld\n",s);
   }
}


Measured memory_bytes: 760
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#define int long long
#define double long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define pii pair<int,int>
#define ff first
#define ss second
#define frr(i,n) for(int i=0;i<n;i++)
#define td(v) v.begin(),v.end()
#define inf 1000000000 // 1e9
#define M   1000000007 // 1e9 + 7
using namespace std;
inline int mod(int n, int m){ int ret = n%m; if(ret < 0) ret += m; return ret; }
int gcd(int a, int b){return (b == 0 ? a : gcd(b, a%b));}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int exp(int a,int b,int m){
    if(b==0) return 1;
    if(b==1) return mod(a,m);
    int k = mod(exp(a,b/2,m),m);
    if(b&1){
        return mod(a*mod(k*k,m),m);
    }
    else return mod(k*k,m);
}
struct FenwickTree {
    vector<int> bit;  // binary indexed tree
    int n;

    FenwickTree(int n) {
        this->n = n;
        bit.assign(n, 0);
    }

    FenwickTree(vector<int> a) : FenwickTree(a.size()) {
        for (size_t i = 0; i < a.size(); i++)
            add(i, a[i]);
    }

    int sum(int r) {
        int ret = 0;
        for (; r >= 0; r = (r & (r + 1)) - 1)
            ret += bit[r];
        return ret;
    }

    int sum(int l, int r) {
        return sum(r) - sum(l - 1);
    }

    void add(int idx, int delta) {
        for (; idx < n; idx = idx | (idx + 1))
            bit[idx] += delta;
    }
};
FenwickTree Tree(200200);
FenwickTree Aparison(200200);
vector<int> a;
int c = 0;
int f(int x){
    int sum = c;
    int posl = lower_bound(td(a),x) - a.begin();
    int posr = upper_bound(td(a),x) - a.begin(); 
    posl--;   
    sum += Aparison.sum(0,posl)*x - Tree.sum(0,posl);
    sum += Tree.sum(posr,a.size()-1) - Aparison.sum(posr,a.size()-1)*x;
    return sum;
}
int32_t main(){
    fastio;
    int t = 0;
    cin >> t;
    vector<pii> query(t);
    for(int i=0;i<t;i++){
        cin >> query[i].ff;
        if(query[i].ff == 1){
            cin >> query[i].ff >> query[i].ss;
            a.pb(query[i].ff);
        }
        else query[i].ff = M;
    }
    sort(td(a));
    for(int i=0;i<t;i++){
        if(query[i].ff == M){
            int lo = -inf - 1, hi = inf;
            while (hi - lo > 1){
                int mid = (hi + lo)>>1;
                if (f(mid) > f(mid + 1)) 
                    lo = mid;
                else 
                    hi = mid; 
            }
            cout << lo + 1  << " " << f(lo+1) << endl;
            continue;
        }
        c+= query[i].ss;
        int pos = lower_bound(td(a),query[i].ff) - a.begin();
        Tree.add(pos,query[i].ff);
        Aparison.add(pos,1);
    }
}

Measured memory_bytes: 10100
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ph push
#define ptc putchar
#define enter putchar('\n')
using namespace std;
typedef pair<int,int> pii;
typedef double db;
typedef long double ldb;
typedef long long ll;
typedef long long lnt;
inline int read(){
	   int x = 0;char c = getchar();
	   while (!isdigit(c)) c = getchar();
	   while (isdigit(c)) x = (x << 1) + (x << 3) + c - '0' , c = getchar();
	   return x;
}
inline void write(int x){
	   if (!x){
          ptc('0');
          return;
	   }
	   int dg[20] , len = 0;
	   while (x) dg[len++] = x % 10 , x /= 10;
	   while (len--) ptc(dg[len]+'0');
}
inline void writeln(int x){
	   write(x);
	   ptc('\n');
}
int n , a , b , c , d;

int main(){
	scanf("%d%d%d%d%d",&n,&a,&b,&c,&d);
	n--;
	
	b = abs(a - b);
	for (int i = 0;i <= n;i++){
		lnt L = 1ll * i * c - 1ll * (n - i) * d  , R = 1ll * i * d - 1ll * (n - i) * c;
		if (L <= b && b <= R){
			return puts("YES") , 0;
		}
	}
	return puts("NO") , 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
const int N = 2e5 + 3;
std::vector<int> map[N];

int w[N],ans[N],n,q;

void dfs(int x,int f)
{
	ans[x] = w[x];
	for(int i : map[x]) if(i != f) {
		w[i] += w[x];
		dfs(i,x);
	}
}

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);std::cout.tie(0);
	std::cin >> n >> q;
	for(int i = 1,u,v;i < n;i++)  {
		std::cin >> u >> v;
		map[u].push_back(v),map[v].push_back(u);
	}
	while(q--) {
		int x,p; std::cin >> p >> x;
		w[p] += x;
	}
	dfs(1,0);
	for(int i = 1;i <= n;i++) std::cout << ans[i] << " ";
	exit(0);
}


Measured memory_bytes: 24320
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int second = sc.nextInt();
		sc.close();

		int h = 0,m = 0,s = 0;

		// 開始
		h = second / (60 * 60);
		m = second % (60 * 60) / 60;
		s =second % (60 * 60) % 60;


		// 終了
		System.out.println(h + ":" + m + ":" + s);
	}
}


Measured memory_bytes: 26236
/**
 *    author:  RM07
 *    created: August 29, 2020 5:48 PM
 *    motto: Knowledge is Power, Strive for Excellence
**/
#include<bits/stdc++.h>
using namespace std;
#define int long long 
set<int> adj[200005];
bool visited[200005];
int cnt = 0;
void dfs(int vertex) {
    visited[vertex] = true;
    cnt++;
    for(auto child: adj[vertex]) {
        if(!visited[child]) {
            dfs(child);
        }
    }
}
signed main(){
    int n,m;
    cin >> n >> m;
    while(m--) {
        int a, b;
        cin >> a >> b;
        adj[a].insert(b);
        adj[b].insert(a);
        // graph build process.
    }
    memset(visited, false, n + 1);
    vector<int> v;
    v.push_back(INT_MIN);
    for(int i = 1; i <= n; i++) {
        if(!visited[i]) {
            cnt = 0;
            dfs(i);
            v.push_back(cnt);
        }
    }
    cout << *max_element(v.begin(), v.end()) << endl;
}

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

#define ll long long
#define vi vector<int>
#define pi pair<int, int>
#define pb push_back
#define ppb pop_back
#define all(a) a.begin(), a.end()
#define sz(a) (int)a.size()

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const int N = 1e2 + 667;
//bool visited[100001];
//vi v[100001];
//vi ans[100001];
//int d[10001];
//queue<int> q;
//int c = 0;

//void dfs(int x){
    //if(visited[x]){
        //c++;
      //  return;
    //}
   // visited[x] = true;
   // for(auto u : v[x]){
    //    dfs(u);
  //  }
//
//}

//void bfs(int x){
   // visited[x] = true;
    //d[x] = 0;
  //  q.push(x);
//    while(!q.empty()){
    //    int s = q.front(); q.pop();
  //      for(auto u : v[s]){
//            //if(visited[u]) continue;
          //  visited[s] = true;
        //    d[u] = d[s] + 1;
      //      q.push(u);
    //    }
  //  }
//}

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

    int h, a;
    cin >> h >> a;
    int ans = h / a;
    if((h > a && h % a != 0) || h < a) ans++;
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Main {

	public static void main(String... args) throws IOException {

		// 標準入力を取得
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		int n = Integer.parseInt(line.split(" ")[0]);
		line = br.readLine();
		int a = Integer.parseInt(line.split(" ")[0]);
		int b = Integer.parseInt(line.split(" ")[1]);
		line = br.readLine();
		List<Integer> is = new ArrayList<Integer>();
		for (String str : Arrays.asList(line.split(" "))) {
			is.add(Integer.parseInt(str));
		}
		br.close();

		// A点以下の数
		int group1 = 0;
		int group2 = 0;
		int group3 = 0;
		for (int i : is) {
			if (i <= a) {
				group1++;
			} else if (i >= b + 1) {
				group3++;
			} else {
				group2++;
			}
		}

		System.out.println(Math.min(Math.min(group1, group2), group3));

	}
}

Measured memory_bytes: 21204
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;

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

void solve() {
    int a,b;
    cin >> a >> b;
    int d = b - a;
    cout << d * (d+1) / 2 - b << endl;
}

int main() {
    solve();
    
    return 0;
}

Measured memory_bytes: 256
import sys

step = 0
n = 0
k = int(input())
l = [0]*k
while True:
  step += 1
  n = (n * 10 + 7) % k
  l[n] += 1
  if n == 0:
    break
  elif l[n] >= 2:
    step = -1
    break
print(step)


Measured memory_bytes: 16592
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.B
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var (a, b) = Read2Longs();
            var ab = long.Parse(a.ToString() + b.ToString());
            for(var i = 0; i < 320; i++)
            {
                if(i*i == ab) { return "Yes"; }
            }
            return "No";
        }

        #region Console.Read

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); }
        public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); }
        public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); }
        public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


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

int nnn(int N, int s){
  int a=1;
  for(int i=0; i<N-s; i++){
    a*=10;
  }
  return a;
}
int main(){
  int N, M;
  cin >> N >> M;
  vector<int > s(M), c(M);
  for(int i=0; i<M; i++){
    cin >> s[i] >> c[i];
  }
  int flag = 0;

  int ans = 0;

  for(int i=0; i<M; i++){
    int a=s[i];
    int b=c[i];
    for(int j=0; j<M ;j++){
      if(j==i)continue;
      if(a==s[j] && b!=c[j]){flag = 1; break;}
      if(a==s[j]&& b==c[j]){s[j]=0;c[j]=0;}
    }
    if(a==1 && b==0 && N>1){flag = 1; break;}
  }
  for(int i=0; i<M; i++){
    int b = nnn(N, s[i]);
    ans += b*c[i];
  }
  if(N!=1 && ans < nnn(N, 1)){
    ans += nnn(N, 1);
  }

  if(flag==0)cout << ans << endl;
  if(flag==1)cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
void printChess(int,int);
int main(void)
{
  int w,h;
  for(;;)
    {
      scanf("%d%d",&h,&w);
      if(h==0&&w==0) break;
      printChess(h,w);
    }
  return 0;
}
void printChess(int h,int w)
{
  int i,j;
  for(i=0;i<h;i++)
    {
      for(j=0;j<w;j++)
        {
          if((i+j)%2==0) printf("#");
          else printf(".");
        }
      printf("\n");
    }
  printf("\n");
}



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

int main(){
	int a,b,r;
	while(cin >> a >> b){
		if(a<b){ r=a; a=b; b=r; }
		r=a%b;
		if(r==0){ cout << b << endl; continue;}
		while(1){
			r=a%b;
			if(r==0){ cout << b << endl; break; }
			a=b;
			b=r;
		}
	}
}

Measured memory_bytes: 0
import java.util.Arrays;
import java.util.Scanner;

class Main {

  private static long INF = Long.MAX_VALUE / 4;
  private static int MAX_V = 100010;

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int N = Integer.parseInt(scanner.next());
    long W = Long.parseLong(scanner.next());
    long[] w = new long[N];
    int[] v = new int[N];
    for (int i = 0; i < N; i++) {
      w[i] = Long.parseLong(scanner.next());
      v[i] = Integer.parseInt(scanner.next());
    }
    scanner.close();
    long[][] dp = new long[N + 1][MAX_V];
    for (long[] ls : dp) {
      Arrays.fill(ls, INF);
      ls[0] = 0;
    }
    for (int i = 0; i < N; i++) {
      for (int sum_v = 1; sum_v < MAX_V; sum_v++) {
        if (v[i] >= sum_v) {
          dp[i + 1][sum_v] = w[i];
        }
        dp[i + 1][sum_v] = Math.min(dp[i + 1][sum_v], dp[i][sum_v]);
        if (sum_v >= v[i]) {
          dp[i + 1][sum_v] = Math.min(dp[i + 1][sum_v], dp[i][sum_v - v[i]] + w[i]);
        }
      }
    }
    long ans = INF;
    for (int sum_v = 0; sum_v < MAX_V; sum_v++) {
      if (dp[N][sum_v] <= W) {
        ans = sum_v;
      }
    }
    System.out.println(ans);
  }

}


Measured memory_bytes: 127572
#include <iostream>
#include <vector>

void solve() {
    int n, m;
    std::cin >> n >> m;

    if (n % 2 == 0) {
        int m2 = m / 2;
        int m1 = m - m2;
        for (int i = 1; i <= m1; ++i) {
            std::cout << i << " " << m1 * 2 + 1 - i << std::endl;
        }

        int d = m1 * 2;
        for (int i = 1; i <= m2; ++i) {
            std::cout << d + i << " " << d + m2 * 2 + 2 - i << std::endl;
        }
    } else {
        for (int i = 1; i <= m; ++i) {
            std::cout << i << " " << m * 2 + 1 - i << std::endl;
        }
    }
}

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

    solve();

    return 0;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
#define ll long long
using namespace std;
struct interval
{
    int begin;
    int end;
};

bool cmp(interval x,interval y)
{
    return x.end < y.end;
}


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

    vector<interval> vec(n);

    for (int i = 0; i < n; i++)
    {
        int x,y;
        cin >> x >> y;
        vec[i].begin=x-y,vec[i].end=x+y;
    }

    sort(vec.begin(),vec.end(),cmp);

    int end = vec[0].end;
    int res = 1;
    for (int i = 1; i < n; i++)
    {
        if (end<=vec[i].begin)
        {
            res++;
            end = vec[i].end;
            //printf("%d\n",end);
        }
    }

    cout << res << endl;

return 0;
}


Measured memory_bytes: 1024
N,H=map(int,input().split())
AB=[list(map(int,input().split())) for i in range(N)]
a=max([i[0] for i in AB])
B=sorted([i[1] for i in AB if i[1]>a],reverse=True)
count=0
for b in B:
    H-=b
    count+=1
    if H<=0:
        break
#print(H)
if H>0:
    count+=H//a + 1* (H%a>0)

print(count)


Measured memory_bytes: 29264
N, M = [int(i) for i in input().split()]

ACSet = set([])
WAList = []
WAcnt = 0

for i in range(M):
    s = input().split()
    # N問と決まっているので、N問分のACが出た時点で判定不要となる
    if len(ACSet) != N:
        if s[1] == 'AC':
            ACSet.add(s[0])
        # WAはまだ正当してない問題についてのみリストに詰める
        elif s[1] == 'WA' and s[0] not in ACSet:
            WAList.append(s[0])

# WAListの内、ACSetに入っている問題の数のみ数える
for i in range(len(WAList)):
    if WAList[i] in ACSet:
        WAcnt += 1

print("{} {}".format(len(ACSet), WAcnt))


Measured memory_bytes: 14004
#include <cmath>
#include <iostream>

long long memo[70][3][2];
const long long mod=1000000007;

long long dfs(long long N, int d, int left, int top){
  if(d < 0) return 1;
  if(memo[d][left][top] >= 0) return memo[d][left][top];
  long long left2 = 2*left;
  long long ans = 0;
  if(N & (1LL<<d)){
    ans += dfs(N, d-1, std::min(2LL, left2+1), 1);
    ans += dfs(N, d-1, std::min(2LL, left2), top);
    if(left) ans += dfs(N, d-1, std::min(2LL, left2-1), 1);
  }else{
    ans += dfs(N, d-1, std::min(2LL, left2), top);
    if(left&&top) ans += dfs(N, d-1, std::min(2LL, left2-1), 1);
    if(left) ans += dfs(N, d-1, std::min(2LL, left2-2), top);
  }
  ans %= mod;
  memo[d][left][top] = ans;
  return ans;
}

int main(){
  long long N;
  std::cin >> N;

  for(int i = 0; i < 70; i++){
    for(int j = 0; j < 3; j++){
      for(int k = 0; k < 2; k++){
        memo[i][j][k] = -1;
      }
    }
  }

  std::cout << dfs(N, 62, 0, 0) << std::endl;

  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  vector<int>A(3);cin >> A[0] >> A[1] >> A[2];
  sort(all(A),greater<int>());
  int count = 0;
  while(A[0]>=A[1]+2){
    A[1]+=2;
    count++;
  }
  while(A[0]>=A[2]+2){
    A[2]+=2;
    count++;
  }
  sort(all(A),greater<int>());
  if(A[0] != A[1] && A[1] == A[2])count++;
  else if(A[0] == A[1] && A[1] != A[2]) count+=2;
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
#define ll  long long 
#define dl long double
#define pb push_back
#define pf push_front
#define mp make_pair
#define f first
#define s second


int main ()
{

     
     int n ,k,sum=0;
     cin >>n>>k;
     int arr[n];
     for (int i = 0 ;i<n;i++)
     	cin >>arr[i];
     sort (arr,arr+n);

     for (int i = 0 ;i<k;i++)
          sum+=arr[i];
      cout<<sum<<endl;


	return 0;

}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long int lld;
typedef pair<int,int> pi;
typedef pair<lld,lld> pl;
#define x first
#define y second
#define all(v) v.begin(), v.end()
#define sz(x) (int)x.size()
#define mk(a,b) make_pair(a,b)
bool isrange(int y,int x,int n,int m){
	 if(0<=y&&y<n&&0<=x&&x<m) return true;
	 return false;
}
int dy[4] = {1,0,-1,0},dx[4]={0,1,0,-1},ddy[8] = {1,0,-1,0,1,1,-1,-1},ddx[8] = {0,1,0,-1,1,-1,1,-1};

int main(void){
	string a;
	cin >> a;
	cout << a.substr(0,3);
	return 0;
}


Measured memory_bytes: 3628
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define SIZE(a) int((a).size();
const int INF=1e9;

int main(){
  ll n,k;cin>>n>>k;
  vll x(n);
  rep(i,0,n){
    cin>>x[i];
  }
  ll ans=INF;
  rep(i,0,n-k+1){
    if(x[i+k-1]<0){
      ans=min(ans,-x[i]);
    }
    else{
      if(x[i]<0){
        ans=min(ans,min(x[i+k-1]-2*x[i],x[i+k-1]*2-x[i]));
      }
      else{ans=min(ans,x[i+k-1]);}
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1024
// input macro 
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main(){
    input!{
        a: i32,
        b: i32,
        k: usize,
    }
    let ans = (1..std::cmp::max(a, b) + 1)
        .rev()
        .filter(|x| a % x == 0 && b % x == 0)
        .nth(k - 1)
        .unwrap();
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a) for(int i=0;i<(a);i++)
const ll MOD=1000000007;

ll dp[1010][1010];
char A[1010][1010];

int main(){
  int H,W; cin>>H>>W;
  rep(i,H) rep(j,W) cin>>A[i][j];
  dp[0][0]=1;
  rep(i,H) rep(j,W){
    if(A[i+1][j]=='.') (dp[i+1][j]+=dp[i][j])%=MOD;
    if(A[i][j+1]=='.') (dp[i][j+1]+=dp[i][j])%=MOD;
  }
  cout<<dp[H-1][W-1]<<endl;
  return 0;
}


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

void solve()
{
    int N; cin >> N;
    map<long long,int> M;
    for (int i = 0; i < N; ++i){
        int a; cin >> a;
        M[a]++;
    }
    long long x = 0,y = 0;
    while(!M.empty()){
        int k = M.rbegin()->first;
        if(M[k] >= 2) {
            x = k; 
            M[k] -= 2;
            break;
        }
        else M.erase(k);
    }
    while(!M.empty()){
        int k = M.rbegin()->first;
        if(M[k] >= 2) {
            y = k; break;
        }
        else M.erase(k);
    }
    cout << x*y << endl;
}

int main()
{
    cin.tie();
    ios::sync_with_stdio(false);
    // int ti = clock();
    // input();
    solve();
    // printf("Execution Time: %.4lf sec\n", 1.0 * (clock() - ti) / CLOCKS_PER_SEC);
    return 0;
}

Measured memory_bytes: 9808
import sys

def check(S):
    even = set()
    odd = set()
    for i in range(len(S)):
        if i % 2 == 0:
            odd.add(S[i])
        else:
            even.add(S[i])

    return len(even) == len(odd) == 1


def can_checkmate(S):
    chrs = set(S)
    if len(chrs) != 3:
        return False

    for c in chrs:
        S_ = S
        S_.remove(c)
        if check(S_):
            return True

    return False


def main():
    input = sys.stdin.readline
    S = [c for c in input().strip()]

    if check(S):
        return 'Second'

    if S[0] == S[-1]:
        if len(S) % 2 == 0 or can_checkmate(S):
            return 'First'

        else:
            return 'Second'
    else:
        if len(S) % 2 == 1:
            return 'First'

        else:
            return 'Second'


if __name__ == '__main__':
    print(main())


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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N,A,B=MI()
    X=LI()
    ans=0
    for i in range(N-1):
        d=X[i+1]-X[i]
        ans+=min(d*A,B)
        
    print(ans)

main()


Measured memory_bytes: 58992
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll LLINF = 1LL<<60;
const int INTINF = 1<<30;
const int MOD = 1000000007;

void add(long long &a, long long b) {
  a += b;
  if (a >= MOD) a -= MOD;
}

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int H, W, N, A[101010];
int ans[1010][1010];

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> H >> W >> N;
    rep(i,N) cin >> A[i];

    int cu = 0;
    rep(y,H) rep(x,W){
      ans[y][x] = cu + 1;
      A[cu]--;
      if(!A[cu]) cu++;
    }
    rep(y,H){
      rep(_x,W){
        int x;
        if(y % 2 == 0) x = _x;
        else x = W - 1 - _x;

        if(_x) printf(" ");
        printf("%d", ans[y][x]);
      }
      printf("\n");
    }
}


Measured memory_bytes: 2816
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
const long long INF = 1LL << 60;
const int MOD = 1000000007;
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; }
//https://www.creativ.xyz/dump-cpp-652/
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
 
// vector
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}

#ifdef DEBUG_
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif

signed main(void) { cin.tie(0); ios::sync_with_stdio(false);
    int n; 
    string s,t; cin>>n; cin>>s>>t;
    string ans = "";
    rep(i,n){
        ans += s[i];
        ans += t[i];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
class Queue:
    '''
    パズルオブジェクトを格納するキュークラス
    '''
    def __init__(self, puzzle):
        self.puzzle_list = []

        self.puzzle_list.append(puzzle)

    def enqueue(self, puzzle):
        self.puzzle_list.append(puzzle)

    def dequeue(self):
        return self.puzzle_list.pop(0)
    def is_empty(self):
        return len(self.puzzle_list) == 0


class _8Puzzle:
    def __init__(self, panel_list, state_list, size):
        self.panel_list = panel_list

        self.state_list = state_list
        self.state_list.append(panel_list)

        self.size = size

    # パネルの0を左右上下に移動させたときのパネル配置を返すジェネレーター
    def gene_next_panel(self, puzzle):
        zero_pos = puzzle.panel_list.index(0)
        col = zero_pos // self.size
        raw = zero_pos % self.size

        def __get_next_panel():
            panel_list = puzzle.panel_list[:]
            n = panel_list[next_pos]
            panel_list[next_pos] = 0
            panel_list[zero_pos] = n
            return panel_list

        if self.size > col + 1:
            next_pos = (col + 1) * self.size + raw
            panel_list = __get_next_panel()
            yield tuple(panel_list)

        if col - 1 >= 0:
            next_pos = (col - 1) * self.size + raw
            panel_list = __get_next_panel()
            yield tuple(panel_list)

        if self.size > raw + 1:
            next_pos = col * self.size + raw + 1
            panel_list = __get_next_panel()
            yield tuple(panel_list)

        if raw - 1 >= 0:
            next_pos = col * self.size + raw - 1
            panel_list = __get_next_panel()
            yield tuple(panel_list)

    def result_print(self):
        i = 0
        for s in self.state_list:
            i += 1

        print(i-1)

def breadth_first(size, goal, panel_list):
    puzzle = _8Puzzle(panel_list, [], size)
    queue = Queue(puzzle)
    checked_dict = {}

    while queue.is_empty() is False:
        puzzle = queue.dequeue()
        num = 0
        for next_panel in puzzle.gene_next_panel(puzzle):
            next_puzzle = _8Puzzle(list(next_panel), puzzle.state_list[:], size)

            if next_panel in checked_dict:
                continue

            if list(next_panel) == goal:

                return next_puzzle

            checked_dict[next_panel] = True
            queue.enqueue(next_puzzle)

if __name__ == '__main__':
    size = 3
    goal = [1, 2, 3, 4, 5, 6, 7, 8, 0]
    input_puzzle = []
    for i in range(3):
        _in1, _in2, _in3 = (int(z) for z in input().split())
        input_puzzle.append(_in1)
        input_puzzle.append(_in2)
        input_puzzle.append(_in3)

    if goal == input_puzzle:
        print(0)
        exit()

    puzzle = breadth_first(size, goal, input_puzzle)

    puzzle.result_print()



Measured memory_bytes: 69472
using System;
using System.IO;
using System.Linq;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            // 入力の取得
            var n = int.Parse(Console.ReadLine());
            var numbers = Console.ReadLine().Split().Select(int.Parse).ToArray();

            // 最大の数字 A と 最小の数字 B を取得
            // その他の数字について、正の値は B - num 、負の値は A - num とする
            // 最後に A' - B' とすれば最大値となりそう?
            var maxNum = numbers.Max();
            var minNum = numbers.Min();

            var maxNumIndex = Array.IndexOf(numbers, maxNum);
            var minNumIndex = Array.LastIndexOf(numbers, minNum);    // maxNum == minNum の可能性があるため後ろから

            var others = numbers.Where((num, i) => i != maxNumIndex && i != minNumIndex).ToArray();

            var maxResult = maxNum - minNum + others.Sum(Math.Abs);

            // 解答の出力
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            Console.WriteLine(maxResult);

            var tmpMin = minNum;
            foreach (var num in others.Where(num => num >= 0))
            {
                Console.WriteLine("{0} {1}", tmpMin, num);
                tmpMin -= num;
            }

            var tmpMax = maxNum;
            foreach (var num in others.Where(num => num < 0))
            {
                Console.WriteLine("{0} {1}", tmpMax, num);
                tmpMax -= num;
            }

            Console.WriteLine("{0} {1}", tmpMax, tmpMin);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 30536
#include<iostream>
#include<queue>
#include<bitset>
#include<algorithm>
#include<climits>
#include<vector>
#include<deque>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define fill(x,y) memset(x,y,sizeof(x))
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define dump(a) rep(i,a.size()){ cout<<a[i]<<" "; } cout<<endl;
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define INF INT_MAX/3
#define EPS 1e-7


int main(){
  ll n,l;
  ll a[100001];
  cin>>n>>l;
  rep(i,n){
    cin>>a[i];
  }

  int k = -1;
  rep(i,n-1){
    if(a[i]+a[i+1]>=l) k = i;
  }

  if(k!=-1) {
    cout<<"Possible"<<endl;
    repl(i,0,k) cout<<i+1<<endl;
    for(int i=n-2; i>=k; i--) cout<<i+1<<endl;
  }
  else cout<<"Impossible"<<endl;
  return 0;
}


Measured memory_bytes: 1536