akhauriyash/Code-Regression huggingface dataset:
#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
  out << "(" << a.first << "," << a.second << ")";
  return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
  return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  int ret = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    if (i % 2 == 0 && a[i] % 2) ++ret;
  }
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 3196
#include<iostream>
#include<vector>
#include<map>
#include<cmath>
#include<algorithm>
#include<string>
#include<set>
#include<deque>
#include<bits/stdc++.h>

using namespace std;

#define pb push_back
#define ld long double
#define int long long

mt19937 rnd(51);

const int MOD = 1e9 + 7;

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    for (int i = 0; i < n; i++){
        cin >> a[i];
    }
    for (int i = 0; i < n; i++){
        cin >> b[i];
    }
    int l = 0, r = n - 1;
    reverse(b.begin(), b.end());
    for (int i = 0; i < n; i++){
        if (a[i] == b[i]){
            if (b[l] != a[i] && a[l] != b[i]){
                swap(b[l++], b[i]);
            }
            else{
                swap(b[r--], b[i]);
            }
        }
    }
    bool x = 1;
    for (int i = 0; i < n; i++){
        if (a[i] == b[i]) x = 0;
    }
    if (x){
        cout << "Yes\n";
        for (auto to : b){
            cout << to << " ";
        }
    }
    else{
        cout << "No";
    }
    return 0;
}


Measured memory_bytes: 6368
#include<stdio.h>
struct time {
	int hour, minu;
};
int main(void) {
	struct time data[1000],cha;
	int N, M,i,j;
	scanf("%d", &N);
	for ( i = 0; i < N; i++) {
		scanf("%d%d", &data[i].hour, &data[i].minu);
	}
	scanf("%d", &M);
	for ( ; i < M+N; i++) {
		scanf("%d%d", &data[i].hour, &data[i].minu);
	}
	for (i = 0; i < N + M; i++) {
		for (j = i + 1; j < N + M; j++) {
			if (data[i].hour != data[j].hour) {
				if (data[i].hour > data[j].hour) {
					cha = data[i];
					data[i] = data[j];
					data[j] = cha;
				}
			}
			else {
				if (data[i].minu > data[j].minu) {
					cha = data[i];
					data[i] = data[j];
					data[j] = cha;
				}
			}
		}
	}
	for (int k = 0; k < N + M; k++) {
		printf("%d:", data[k].hour);
		if (data[k].minu < 10) printf("0%d",data[k].minu);
		else printf("%d", data[k].minu);
		if (k + 1 < N + M) {
			if (data[k].hour == data[k + 1].hour)
				if (data[k].minu == data[k + 1].minu)k++;
		}
		if (k < N + M-1)printf(" ");
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 2104
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
using namespace std;
typedef long long ll;
const int N=200005;
ll lmx[N],lmn[N],rmx[N],rmn[N];
ll a[N];
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%lld",&a[i]),a[i]+=a[i-1];
	int now=1;
	for(int i=2;i<=n;i++) 
	{
		while(now+1<i&&abs(a[i]-2*a[now])>abs(a[i]-2*a[now+1])) now++;
		lmn[i]=min(a[now],a[i]-a[now]); lmx[i]=max(a[now],a[i]-a[now]);
	}
	now=n;
	for(int i=n-1;i>=1;i--)
	{
		while(now-1>i&&abs(a[n]-2*a[now-1]+a[i-1])>abs(a[n]-2*a[now-2]+a[i-1])) now--;
		rmn[i]=min(a[n]-a[now-1],a[now-1]-a[i-1]); rmx[i]=max(a[n]-a[now-1],a[now-1]-a[i-1]);
	}
	ll ans=1e16;
	for(int i=2;i<n-1;i++) ans=min(ans,max(lmx[i],rmx[i+1])-min(lmn[i],rmn[i+1]));
	printf("%lld\n",ans);
	

	return 0;
}


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

#define MAXK 75

int N;
string S;
int Q;
int k[MAXK];

int main()
{
	cin >> N;
	cin >> S;
	cin >> Q;
	for( int i = 0; i < Q; i++ ) {
		cin >> k[i];
	}


	for( int j = 0; j < Q; j++ ) {
		long long ans = 0, a = 0, b = 0, ab = 0;
		for( int i = 0; i < N; i++ ) {
			if( i >= k[j] - 1 ) {
				if( S[ i - k[j] ] == 'D' ) {
					a--;
					ab -= b;
				}
				if( S[ i - k[j] ] == 'M' ) {
					b--;
				}
			}
			if( S[i] == 'D' ) {
				a++;
			}
			else if( S[i] == 'M' ) {
				ab += a;
				b++;
			}
			else if( S[i] == 'C' ) {
				ans += ab;
			}
		}
		cout << ans << endl;
	}

	return 0;
}


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

using namespace std;
typedef long long ll;
const int MAXN = 1e5 + 5;

int n, a[MAXN];
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin >> n;
	for(int i = 0; i < n; i ++) cin >> a[i];
	sort(a, a + n, greater< int >());
	int cnt = 0;
	for(int i = 0; i < n; i++){
		if( a[i] <= cnt) break;
		cnt ++;
	}
	int x = 0;
	for(int i = cnt; i < n; i ++)
		if( a[i] >= cnt) x ++;
		
	if( x % 2 || (a[cnt - 1] - cnt) % 2 )
		cout << "First" << endl;
	else cout << "Second" << endl;
	return 0;
}



Measured memory_bytes: 4060
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <cstring>
#include <climits>
#include <cmath>
#include <cfloat>

#define FOR(i,b,n) for(int i=b;i<n;i++)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define INF 1<<25
#define LIM 1000000

using namespace std;

int bar[30];
int w, n;

int main()
{
	cin >> w >> n;
	
	FOR(i,0,w)
	{
		bar[i] = i+1;
	}
	
	FOR(i,0,n)
	{
		int a,b; char c;
		cin >> a >> c >> b;
		
		swap(bar[a-1], bar[b-1]);
	}
	
	FOR(i,0,w)
	{
		cout<<bar[i]<<endl;
	}
	
	
	return 0;
}

Measured memory_bytes: 0
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using namespace std;

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

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "YES"; }
  string_type do_falsename() const { return "NO"; }
};

using P = pair<int,int>;

void solve(ll N, ll M, vector<ll> L, vector<ll> R) {
  vector<tuple<int,int,int>> vec;
  REP(i,N) vec.emplace_back(R[i], L[i], i);
  sort(ALL(vec));
  priority_queue<P, vector<P>, greater<P> > que;
  int piv = 0;
  int left = 0;
  int res = 0;
  for (int i = 1; i <= M; ++i) {
    while (piv < N && get<0>(vec[piv]) <= i) {
      que.emplace(get<1>(vec[piv]), get<2>(vec[piv]));
      ++piv;
    }
    if (que.empty()) ++left;
    else { que.pop(); ++res; }
  }
  while (piv < N) {
   que.emplace(get<1>(vec[piv]), get<2>(vec[piv]));
   ++piv;
  }
  // cout << left << endl;
  for (int i = 1; i <= left; ++i) {
    while (!que.empty() && que.top().first < i) que.pop();
    if (!que.empty()) { que.pop(); ++res; }
  }
  cout << N - res << endl;
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	ll M;
	ll N;
	scanf("%lld", &N);
	vector<ll> L(N-1+1);
	vector<ll> R(N-1+1);
	scanf("%lld", &M);
	for (int i = 0 ; i <= N-1 ; i++) {
	  scanf("%lld", &L[i]);
	  scanf("%lld", &R[i]);
	}
	solve(N, M, L, R);
	return 0;
}


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

int main(){
    //freopen("input", "r", stdin);
    string a,b,c;
    cin>>a>>b>>c;
    if(a.back()==b[0]&&b.back()==c[0])cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

bool check(int a, int b, double target, double water)
{
    target = target * M_PI / 180.0;
    double theta = atan2(b, a);
    if (target < theta)
    {
        double cap = (2.0 * (double)b - (double)a * tan(target)) * (double)a / 2.0 * (double)a;
        if (cap < water)
            return false;
    }
    else
    {
        double cap = (double)b * ((double)b * tan(M_PI_2 - target)) / 2.0 * (double)a;
        if (cap < water)
            return false;
    }
    return true;
}

int main(void)
{
    int a, b, x;
    cin >> a >> b >> x;
    double left = 0.0, right = 90.0;
    while (abs(right - left) > 0.00000001)
    {
        double mid = (left + right) / 2.0;
        if (check(a, b, mid, (double)x))
        {
            left = mid;
        }
        else
        {
            right = mid;
        }
    }
    cout.precision(7);
    cout << fixed << left << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <math.h>

#define MAX 1000000
#define SQRT_MAX (int)sqrt((double)MAX)

int main(void)
{
	char isprime[MAX];
	int in, ans, prime[MAX] = {};
	register int i, j;

	/* isprimeの初期化 */
	memset(isprime, 1, sizeof(isprime));
	isprime[0] = isprime[1] = 0;

	/* 素数判定(エラトステネスの篩) */
	for (i = 2; i < SQRT_MAX; i++) {
		if (isprime[i])
			/* 素数ならばその倍数は合成数 */
			for (j = i + i; j < MAX; j += i)
				isprime[j] = 0;
	}

	for (i = 1; i < MAX; i++)
		prime[i] = prime[i - 1] + isprime[i];
	while(scanf("%d", &in) != EOF)
		printf("%d\n", prime[in]);

	return 0;
}

Measured memory_bytes: 5488
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1<<30;
int gcd(int a,int b){
	return (b==0?a:gcd(b,a%b));
}
int main(){
	int a,b;
	cin>>a>>b;
	b/=gcd(a,b);
	int out=1;
	for(int t=2;t*t<=b;t++)if(b%t==0){
		out*=t;
		while(b%t==0)b/=t;
	}
	cout<<out*b<<endl;
}

Measured memory_bytes: 1164
#include<cstdio>
#include<cstring>
#include<algorithm>
#define MAXN 2000
#define INF 1000000000000000000LL
using namespace std;
typedef long long LL;
int N;
LL b[MAXN+5],a[MAXN+5],x;
int main()
{
	scanf("%d %lld",&N,&x);
	for(int i=0;i<N;i++)
		scanf("%lld",&a[i]);
	fill(b,b+N,INF);
	LL ans=INF;
	for(int mv=0;mv<N;mv++)
	{
		LL ansn=0;
		for(int i=0;i<N;i++)
			b[i]=min(b[i],a[(i-mv+N)%N]);
		for(int i=0;i<N;i++)
			ansn+=b[i];
		ansn+=mv*x;
		ans=min(ans,ansn);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 128
import heapq

N,M = map(int,input().split())
xyz=[[],[],[],[],[],[],[],[]]
for i in range(N):
    X,Y,Z=map(int,input().split())
    heapq.heappush(xyz[0],X+Y+Z)
    heapq.heappush(xyz[1],X+Y-Z)
    heapq.heappush(xyz[2],X-Y+Z)
    heapq.heappush(xyz[3],X-Y-Z)
    heapq.heappush(xyz[4],-X+Y+Z)
    heapq.heappush(xyz[5],-X+Y-Z)
    heapq.heappush(xyz[6],-X-Y+Z)
    heapq.heappush(xyz[7],-X-Y-Z)
s=[0,0,0,0,0,0,0,0]
for i in range(M):
    for j in range(8):
        s[j]+= heapq.heappop(xyz[j])
s2=map(abs, s)
print(sorted(s2)[7])


Measured memory_bytes: 46044
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=1e9;
const ll INF=1e18;
typedef pair<int,int> P;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  ll h,w,a[205][205]={},c[10][10]={},ans=0;;
  cin >> h >> w;
  for(int i=0; i<10; i++) {
    for(int j=0; j<10; j++) {
      cin >> c[i][j];
    }
  }
  for(int i=0; i<h; i++) {
    for(int j=0; j<w; j++) {
      cin >> a[i][j];
    }
  }
  for(int i=0; i<10; i++) {
    for(int j=0; j<10; j++) {
      for(int k=0; k<10; k++) {
        if(i!=j&&i!=k&&j!=k) {
          c[j][k]=min(c[j][k],c[j][i]+c[i][k]);
        }
      }
    }
  }
  for(int i=0; i<h; i++) {
    for(int j=0; j<w; j++) {
      if(a[i][j]!=1&&a[i][j]!=-1) {
        ans+=c[a[i][j]][1];
      }
    }
  }
  cout << ans << endl;
}



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

#define F first 
#define S second

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 200010, M = 110;

int n, a[N], cnt[N];
LL b[N], c[N];
LL sum;

LL get(int x)
{
	return (LL)x * (x - 1) / 2;
}

int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n; i ++ )
	{
		scanf("%d", &a[i]);
		cnt[a[i]] ++ ;
	}
	
	for (int i = 1; i <= n; i ++ )
		if (cnt[i])
		{
			b[i] = get(cnt[i]);
			c[i] = get(cnt[i] - 1);
			sum += b[i];
		}
	
	for (int i = 1; i <= n; i ++ )
		cout << sum - b[a[i]] + c[a[i]] << endl;
    return 0;
}

Measured memory_bytes: 6272
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

#define YYDBG

int main(void) {
    int N, D;
    int max;
    int i = 1;

    scanf("%d %d\n", &N, &D);

    max = (2*D)+1;

    while(1) {
        if ((max * i) >= N ) {
            break;
        }
        i++;
    }

    printf("%d\n", i);
    return 0;
}



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

using namespace std;

typedef long long ll;

struct Node
{
    int x,y;
};

Node a[200010];

inline bool cmp(const Node &p,const Node &q)
{
    return p.x<q.x;
}

int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d%d",&a[i].x,&a[i].y);
    sort(a+1,a+n+1,cmp);

    ll mx1=-1e18,mx2=-1e18;
    ll ans=-1e18;
    for(int i=1;i<=n;i++)
    {
        ans=max(ans,a[i].x+a[i].y+mx1);
        ans=max(ans,a[i].x-a[i].y+mx2);

        mx1=max(mx1,(ll)-a[i].x-a[i].y);
        mx2=max(mx2,(ll)-a[i].x+a[i].y);
    }

    printf("%lld",ans);

    return 0;
}

Measured memory_bytes: 5324
<?php
while($stdin=trim(fgets(STDIN))){
    //???????????´??°?????\???????????????
    $list=array();
    //??\????????????????????§??????
    $list[]=explode(" ", $stdin);
    //?¨?????????????
    $ans=(int)$list[0][0]+(int)$list[0][1];

    //????????????
    echo strlen((string)$ans)."\n";
}

Measured memory_bytes: 15496
//   //  /////       ///      
//  //   //  //     // //     
// //    //   //   //   //    
////     //   //  //     //   
// //    //   //  /////////    
//  //   //  //   //     //    
//   //  /////    //     //    

#include <bits/stdc++.h>
using namespace std;
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define iter(it,a,b) for(a::iterator it=b.begin(); it!=b.end();++it)
#define clz(a) __builtin_clz(a) // count leading zeroes
#define ctz(a) __builtin_ctz(a) // count trailing zeroes
#define popc(a) __builtin_popcount(a) // count set bits (binary me 1 kitne hai) (if longlong popcount ll)
#define ln "\n"
#define dbg(x) cerr<<#x<<" = "<<x<<endl
#define dbg2(x,y) cerr<<#x<<" = "<<x<<" & "<<#y<<" = "<<y<<endl;
#define dbgstl32(v) cerr<<#v<<" = \n"; { int c=0; forstl(it,v) \
cerr<<"    Term "<< ++c <<" = "<<it<<ln;} cerr<<endl
#define dbgstlp32(v) cerr<<#v<<" = \n"; { int c=0; forstl(it,v) \
cerr<<"    Term "<< ++c <<" = "<<it.fi<<" , "<<it.se<<ln;} cerr<<endl
#define dbgarr(v,s,e) cerr<<#v<<" = "; forsn(i,s,e) cerr<<v[i]<<", "; cerr<<endl
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define all(n) n.begin() , n.end() 
#define tfi first.first
#define tse first.second
#define tth second
typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32; 
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
typedef map<int,int> m32;
typedef pair< pair<int,int> , int> tri;
typedef vector<bool> vbool;
typedef priority_queue<p32> pq32;
typedef priority_queue<p32, vector<p32>, greater<p32> > pq32l;

#pragma GCC optimize ("-O2")
const ll LIM = 2e5+5;
const ll MOD = 1e9+7;
const ll inf = 1e10;



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

	int n, k;
	cin >> n >> k;

	bool dp[k+1];
	forn(i,k+1) dp[i] = 0;

	int a[n];
	forn(i,n) cin >> a[i];

	forn(j,k){
		forn(i,n){
			if(j+1 >= a[i]) if(!dp[j+1 - a[i]]) dp[j+1] = 1;
		}
	}

	if(dp[k]) cout << "First";
	else cout << "Second";


}


Measured memory_bytes: 384
#[allow(unused_imports)]
use std::{cmp::Reverse, collections::*};

#[allow(unused_imports)]
use proconio::{
    fastout, input,
    marker::{Chars, Usize1},
};

#[allow(unused_imports)]
use itertools::Itertools;

#[allow(unused_imports)]
use num::Integer;

#[fastout]
pub fn main() {
    input! {
        n: usize,
        x: [i32; n],
    }

    let sum: i32 = x.iter().sum();
    let n1 = (sum as f32 / n as f32) as i32;
    let n2 = (sum as f32 / n as f32).ceil() as i32;
    let h1 = x.iter().fold(0, |acc, x| acc + (x - n1) * (x - n1));
    let h2 = x.iter().fold(0, |acc, x| acc + (x - n2) * (x - n2));
    println!("{}", h1.min(h2));
}


Measured memory_bytes: 2696
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

const int mod = 1e9 + 7;

int n, x, y, z;
int f[50][1 << 17], ans = 1;

int main()
{
    cin >> n >> x >> y >> z;
    for (int i = 1; i <= n; i++) ans = 1ll * ans * 10 % mod;

    int tmp = (1 << x - 1) | (1 << x + y - 1) | (1 << x + y + z - 1);

    int  s = (1 << x + y + z) - 1;

    f[0][0] = 1;
    for (int i = 1; i <= n; i++)
    {
        for (int j = 0; j <= s; j++)
        {
            for (int k = 1; k <= 10; k++)
            {
                int t = (j << k) | (1 << k - 1);
                t &= s;
                if ((t & tmp) != tmp)  f[i][t] = (f[i][t] + f[i - 1][j]) % mod;
            }
        }
    }
    
    for (int i = 0; i <= s; i++)
    {
        ans = (ans - f[n][i] + mod) % mod;
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 24072
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

struct Graph {
    struct Vertex { int n, c; };
    struct Edge { int i, n; };
    Graph(int n, int m) : v(n, { -1, -1 }), e(m), c(n, 0), r(n, (ll)n * (n + 1) / 2), n(n), m(0) {}
    void add_edge(int i, int j) {
        e[m] = { j, v[i].n };
        v[i].n = m;
        m++;
    }
    int dfs(int i, int p) {
        int k = 1;
        int x = v[i].c;
        for (int j = v[i].n; j >= 0; j = e[j].n) {
            Edge& o = e[j];
            if (o.i == p) continue;

            int c0 = c[x];
            int l = dfs(o.i, i);
            k += l;
            int t = l - (c[x] - c0);
            r[x] -= (ll)t * (t + 1) / 2;
            c[x] += t;
        }
        c[x]++;
        return k;
    }
    void solve() {
        dfs(0, -1);
        for (int x = 0; x < n; x++) {
            int t = n - c[x];
            r[x] -= (ll)t * (t + 1) / 2;
            cout << r[x] << '\n';
        }
    }
    vector<Vertex> v;
    vector<Edge> e;
    vector<int> c;
    vector<ll> r;
    int n, m;
};

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

    int n;
    cin >> n;

    Graph g(n, (n - 1) * 2);
    for (int i = 0; i < n; i++) {
        int c;
        cin >> c;
        c--;

        g.v[i].c = c;
    }
    for (int i = 0; i < n - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;

        g.add_edge(a, b);
        g.add_edge(b, a);
    }
    g.solve();

    return 0;
}

Measured memory_bytes: 25904
#include <bits/stdc++.h>
using namespace std;
int a[100010];
int main()
{
int n,sum=0;
cin>>n;
for(int i=0;i<n;i++)
{
    cin>>a[i];
}
vector<long long int>v;
for(int i=1;i<=100;i++)
{sum=0;
    for(int j=0;j<n;j++)
    {
       sum+=(a[j]-i)*(a[j]-i);
    }
    v.push_back(sum);
}
sort(v.begin(),v.end());
cout<<v[0];
return 0;
}


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

int main()
{
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    
    int R;
    cin >> R;

    cout << setprecision(20) << 2.0 * R * M_PI << endl;
}


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

class Keyword{
	String str1;
	int count = 0;

	Keyword(String str1){
		this.str1 = str1;
	}
}

class Words{
	String str2;
	static List<Words> sentence = new ArrayList<Words>();

	Words(String str2){
		this.str2 = str2;
	}
}

public class Main{
	public static void main(String[] args) throws IOException{
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	Keyword x = new Keyword(br.readLine());
	
		while(true){
			String str = br.readLine();
				if(str.equals("END_OF_TEXT")){
					break;
				}
			String[] arr = str.split(" ");

			for(int i = 0; i < arr.length; i++){
				Words.sentence.add(new Words(arr[i]));
			}
		}
		
		for(Words y : Words.sentence){
			if(y.str2.equalsIgnoreCase(x.str1)){
				x.count++;
			}
		}
		System.out.println(x.count);
	}
}

Measured memory_bytes: 17120
import sys
sys.setrecursionlimit(100000) 

def intinput(): return map(int,input().split())

def ab(i):
    global c,l,x
    while len(l[i])>0:
        x[l[i][0]] = c.pop(0)
        l[l[i][0]].remove(i)
        ab(l[i][0])
        l[i].pop(0)
    return

n=int(input())
l = [[] for _ in range(n+1)]
for i in range(n-1):
    a,b=intinput()
    l[a].append(b)
    l[b].append(a)
c = list(intinput())
c.sort(reverse=1)
x = [0 for _ in range(n+1)]
x[1]=c.pop(0)
for i in range(1,n+1):
    ab(i)
print(sum(x[2:]))
f = ""
q= len(x[1:])
for i in range(q):
    if i != q-1:
        f += str(x[i+1])+" "
    else:
        f += str(x[i+1])
print(f)

Measured memory_bytes: 12920
#include <iostream>
using namespace std;
int bub(char c[][2],int n){
    for (int i=0; i<n; i++) {
        for (int j=n-1; j>i; j--) {
            if (c[j][1]<c[j-1][1]) {
                swap(c[j],c[j-1]);
            }
        }
    }
    return 0;
}

int sel(char k[][2],int n){
    for (int i=0; i<n; i++) {
        int minj=i;
        for (int j=i; j<n; j++) {
            if (k[j][1]<k[minj][1]) {
                minj=j;
            }
        }
        swap(k[minj],k[i]);
    }
    return 0;
}

int main() {
    char C[36][2];
    char K[36][2];
    int N;
    cin>>N;
    for (int i=0; i<N; i++) {
        cin>>C[i];
        K[i][0]=C[i][0];
        K[i][1]=C[i][1];
    }
    
    bub(C,N);
    for (int i=0; i<N-1; i++) {
        cout<<C[i][0]<<C[i][1]<<" ";
    }
    cout<<C[N-1][0]<<C[N-1][1]<<endl<<"Stable"<<endl;
    
    sel(K,N);
    bool flag=false;
    for (int i=0; i<N; i++) {
        if (C[i][0]!=K[i][0]) {
            flag=true;
            break;
        }
    }
    if(flag){
        for (int i=0; i<N-1; i++) {
            cout<<K[i][0]<<K[i][1]<<" ";
        }
        cout<<K[N-1][0]<<K[N-1][1]<<endl<<"Not stable"<<endl;
    }else{
        for (int i=0; i<N-1; i++) {
            cout<<K[i][0]<<K[i][1]<<" ";
        }
        cout<<K[N-1][0]<<K[N-1][1]<<endl<<"Stable"<<endl;
    }
}

Measured memory_bytes: 3104
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long int
#define INF 100000000
#define INFLL 100000000000
#define MOD 1000000007
#define PI 3.14159265359
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll, ll>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

struct Edge {
  int to;     
  ll weight; 
  Edge(int t, ll w) : to(t), weight(w) { }
};



int N;
ll C;
ll x[110000], y[110000];
ll r[110000], l[110000];
ll right_max[110000];
ll right_max_sub[110000];
ll left_max[110000];
ll left_max_sub[110000];

int main () {
  cin >> N >> C;

  ll tmp = 0;
  rep(i, N) {
    ll k, v;
    cin >> k >> v;
    tmp += v;

    x[i] = k;
    r[i] = tmp;
  }

  rep(i, N) {
    y[i] = C - x[N+1-i];
    l[i] = r[N] - r[N-i];
  }

//  rep(i, N) {
//    cout << x[i] << r[i] << "\n";
//  }
//  rep(i, N) {
//    cout << y[i] << l[i] << "\n";
//  }

  rep(i, N) {
    right_max[i] = max(right_max[i-1], r[i] - x[i]);
  }
  rep(i, N) {
    right_max_sub[i] = max(right_max_sub[i-1], l[i] - y[i] * 2);
  }

  rep(i, N) {
    left_max[i] = max(left_max[i-1], l[i] - y[i]);
  }
  rep(i, N) {
    left_max_sub[i] = max(left_max_sub[i-1], r[i] - x[i] * 2);
  }

  ll ans = 0;

  for (int i=0;i<=N;++i) {
    //cout << right_max[i] + right_max_sub[N-i] << "\n";
    //cout << left_max[i] + left_max_sub[N-i] << "\n";

    ans = max(ans, right_max[i] + right_max_sub[N-i]);
    ans = max(ans, left_max[i] + left_max_sub[N-i]);
  }

  cout << ans << "\n";


}

Measured memory_bytes: 6912
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main {

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

        try {
            String[] tmp = br.readLine().split(" ");
            int N = Integer.valueOf(tmp[0]), W = Integer.valueOf(tmp[1]);
            int[] w = new int[N];
            int[] v = new int[N];
            for (int i = 0; i < N; i++) {
                tmp = br.readLine().split(" ");
                w[i] = Integer.valueOf(tmp[0]);
                v[i] = Integer.valueOf(tmp[1]);
            }

            long[][] dp = new long[N + 1][W + 1];

            for (int i = 1; i <= N; i++) {
                for (int j = 1; j <= W; j++) {
                    if (j < w[i - 1]) {
                        dp[i][j] = dp[i - 1][j];
                    } else {
                        dp[i][j] = Math.max(dp[i - 1][j], v[i - 1] + dp[i - 1][j - w[i - 1]]);
                    }
                }
            }
            System.out.println(dp[N][W]);
        } catch (Exception ex) {
            System.out.println(ex.getMessage());
        }
    }
}

Measured memory_bytes: 127828
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#solve
def solve():
    n, m = LI()
    h = LI()
    ab = LIR_(m)
    ans = [1] * n
    for a, b in ab:
        if h[a] < h[b]:
            ans[a] = 0
        if h[b] < h[a]:
            ans[b] = 0
        if h[b] == h[a]:
            ans[a] = 0
            ans[b] = 0
    print(sum(ans))
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 105840
#include <fstream>
#include <vector>
#include  <map>
#include <algorithm>
#include <iostream>

// BE CAREFUL WITH HASH TABLE & UNORDERED MAP
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
using namespace std;

#define MOD 998244353
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = (b-1); i >= (a); i--)
#define RF0(i,b) RFO(i,0,b)
#define ll long long
#define pii pair<int,int>
#define add(a,b) ((int) (((ll) (a) + (b))%MOD))
#define mul(a,b) ((int) (((ll) (a) * (b))%MOD))
#define PB emplace_back
#define MP make_pair
#define F first
#define S second

// ifstream cin ("cinput.in");
// ofstream cout ("coutput.out");

int ct = 0;
int N, a, b;
int vals [200000];
int ans [200000];
vector<int> graph [200000];
map<int,int> dp;
pii insd [200000];
pii deld [200000];

// ins. if same val exists, should already be optimal

int ins(int node) { // insert and delete suboptimal
    auto it = dp.lower_bound(vals[node]);
    if (it->F != vals[node]) {
        if (it == dp.begin()) {
            insd[node] = MP(vals[node], 1);
            dp[vals[node]] = 1;
        } else if (prev(it)->S < vals[node]) {
            int asdf = prev(it)->S + 1;
            insd[node] = MP(vals[node], asdf);
            dp[vals[node]] = asdf;
        }
        // cout << it->S << '\n';
        if (it != dp.end() && it->S <= prev(it)->S) {
            int sd = it->F;
            int df = it->S;
            deld[node] = MP(sd, df);
            dp.erase(it);
        }
    }
    int sdf = prev(dp.end())->S;
    return sdf;
}

void dfs(int node, int par) {
    ans[node] = ins(node);
    ct++;
    for (int ne: graph[node]) {
        if (ne == par) continue;
        dfs(ne, node);
    }
    if (deld[node].F != -1) dp[deld[node].F] = deld[node].S;
    if (insd[node].F != -1) dp.erase(dp.find(insd[node].F));
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> N;
    F0R(i,N) {
        insd[i] = MP(-1,-1);
        deld[i] = MP(-1,-1);
    }
    F0R(i,N) cin >> vals[i];
    F0R(i,N-1) {
        cin >> a >> b;
        a--; b--;
        graph[a].PB(b);
        graph[b].PB(a);
    }
    dfs(0,-1);
    F0R(i,N) cout << ans[i] << '\n';
}

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

int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    while(1){
        c-=b;
        if(c<=0){
            cout<<"Yes"<<endl;
            break;
        }
        a-=d;
        if(a<=0){
            cout<<"No"<<endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 3596
A, B = map(int, input().split())
max_num = 10**12
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

r = gcd(A, B)
ans = len(set(prime_factorize(r)))+1
print(ans)

Measured memory_bytes: 3064
#!/usr/bin/env python3
# atcoder 
# Türkler var mı?
# Herkese memnün oldum
import sys

iimr = lambda: map(int, sys.stdin.readline().rstrip().split())
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
MOD = (10 ** 9) + 7  # operować sobie na typie int32_t


def 関数(n, a):
    res = 0
    for i, num in enumerate(a):
        index = i + 1 
        if index % 2 and num % 2:
            res += 1
    return res

def çözmek():
    N = input()
    a = list(iimr())
    res = []
    res.append(関数(N,a))
    print(*res, sep="\n")

if __name__ == "__main__":
    çözmek()


Measured memory_bytes: 9260
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>
#include<stack>


using namespace std;

#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPL(i,a,n) for(ll i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define SRTVG(v) sort(v.begin(),v.end(),greater<>())
#define SRTV(v) sort(v.begin(),v.end())
#define SRTAG(a,n) sort(a,a+n,greater<>())
#define MOD 1000000007
#define int long long

typedef long long ll;
typedef tuple<int,int,bool> Tb;
typedef pair<int,int> Pii;
typedef vector<int> Vi;

template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}
template<class T> void YesNo(T& a) {if(a){cout << "Yes" << ENT;}else{cout << "No" << ENT;}}
template<class T> void YESNO(T& a) {if(a){cout << "YES" << ENT;}else{cout << "NO" << ENT;}}


int atcoder() {
    ll a,b,q;
    cin >> a >> b >> q;
    vector<ll> s(a+2),t(b+2),x(q),ans(q);
    s[0]=t[0]=-100000000000;
    REP(i,1,a+1) cin>>s[i];
    REP(i,1,b+1) cin>>t[i];
    s[a+1]=t[b+1]=100000000000;
    REP(i,0,q) cin>>x[i];
    
    REP(i,0,q){
        ll sw = abs(*(upper_bound(s.begin(),s.end(),x[i])-1)-x[i]);
        ll tw = abs(*(upper_bound(t.begin(),t.end(),x[i])-1)-x[i]);
        ll se = abs(*(lower_bound(s.begin(),s.end(),x[i]))-x[i]);
        ll te = abs(*(lower_bound(t.begin(),t.end(),x[i]))-x[i]);
        ll ret = min({max(sw,tw),max(se,te),2*sw+te,2*te+sw,2*tw+se,2*se+tw});
        cout << ret << ENT;
    }
    
    return 0;
}

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    atcoder();
    return 0;
}


Measured memory_bytes: 4480
#include<bits/stdc++.h>
#define re register
#define max(a,b) ((a)>(b)?(a):(b))
const int maxn=305;
char S[maxn];
int dp[2][maxn][maxn],n,m,o,ans;
int main() {
	scanf("%s",S+1);n=strlen(S+1);scanf("%d",&m);
	for(re int p=0;p<=m;++p,o^=1) {
		for(re int i=1;i<=n;i++) dp[o^1][i][i]=1;
		for(re int l=2;l<=n;++l) 
			for(re int i=1,j=i+l-1;j<=n;++i,++j) {
				dp[o^1][i][j]=max(dp[o^1][i][j-1],dp[o^1][i+1][j]);
				if(S[i]==S[j]) dp[o^1][i][j]=(dp[o^1][i][j],dp[o^1][i+1][j-1]+2);
				if(p) dp[o^1][i][j]=max(dp[o^1][i][j],dp[o][i+1][j-1]+2);
			}
		ans=max(ans,dp[o^1][1][n]);
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 1536
import sys
# s = sys.stdin.readlines()
inputs = sys.stdin.readline()
A = sys.stdin.readline()
inputs = inputs.split()
H, N = int(inputs[0]), int(inputs[1])
A = A.split()

A_sum = 0
for i in range(len(A)):
    A_sum += int(A[i])

if A_sum < H:
    print('No')
else:
    print('Yes')

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

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const ll mod = 1000000007;
const ll INF = mod * mod;
#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++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
typedef vector<int> vec;
typedef vector<string> svec;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
//#define int long long

void solve() {
    int N; cin >> N;
    int a[100100];
    map<int, int> mp;
    rep(i, N) {
        cin >> a[i];
        mp[a[i]] ++;
    }
    int res = 0;
    rep(i, N) {
        int cnt = mp[a[i] - 1] + mp[a[i]] + mp[a[i] + 1];
        res = max(res, cnt);
    }
    cout << res << endl;
}

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

Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
pair<int,int> par[3010][3010];
int dp[3010][3010];
string a,b,ansi;

int ans(int curr1 , int curr2){
    if(dp[curr1][curr2] != -1){
        return dp[curr1][curr2];
    }
    int ret = 0;
    pair<int,int> g = {curr1-1,curr2};
    if(a[curr1] == b[curr2]){
        g = {curr1-1,curr2-1};
        if(curr1-1 >= 0 && curr2-1 >= 0){
            ret = 1 + ans(curr1-1,curr2-1);
        }else{
            ret = 1;
        }
    }else{
        if(curr1 - 1 >= 0){
            ret = max(ret , ans(curr1-1,curr2));
        }
        if(curr2 - 1 >= 0){
            int val = ans(curr1,curr2-1);
            if(val > ret){
                ret = val;
                g = {curr1,curr2-1};
            }
        }
    }
    dp[curr1][curr2] = ret;
    par[curr1][curr2] = g;
    return ret;
}

int main()
{
    cin >> a >> b;
    for(int i = 0 ; i <= 3000 ; i += 1){
        for(int j = 0 ; j <= 3000 ; j += 1){
            dp[i][j] = -1;
        }
    }
    ans(a.size()-1,b.size()-1);
    int p1 = a.size()-1,p2 = b.size()-1;
    while(p1 >= 0 && p2 >= 0){
        if(a[p1] == b[p2]){
            ansi += a[p1];
        }
        pair<int,int> g = par[p1][p2];
        p1 = g.first;
        p2 = g.second;
    }
    for(int i = ansi.size() - 1 ; i >= 0 ; i -= 1){
        cout << ansi[i];
    }
}

Measured memory_bytes: 106624
#include <algorithm>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

unsigned long long int N;

int main() {
  cin >> N;

  string s;
  do {
    N -= 1;
    s.push_back(N % 26 + 'a');
    N /= 26;
  } while (N != 0);
  reverse(s.begin(), s.end());
  cout << s << endl;
  return 0;
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int const N = 80;
  int const S = (N + N) * (N + N + 1);
  
  using bt = bitset<S>;
  
  int n, m;
  cin >> n >> m;
  vector<vector<int>> a(n, vector<int>(m));
  for (auto& r : a) for (auto& c : r) cin >> c;
  for (auto& r : a) {
    for (auto& c : r) {
      int x;
      cin >> x;
      c -= x;
      if (c < 0) {
        c = -c;
      }
      //cerr << c << ' ';
    };
    //cerr << '\n';
  }
  vector<vector<bt>> can(n, vector<bt>(m));
  auto const ZERO = (N + N) * N;
  can[0][0][ZERO] = true;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      for (int d : {0, 1}) {
        auto ii = i + d;
        auto jj = j + !d;
        if (ii >= n || jj >= m) {
          continue;
        }
        can[ii][jj] |= (can[i][j] << a[i][j]);
        can[ii][jj] |= (can[i][j] >> a[i][j]);
      }
    }
  }
  auto& b = can.back().back();
  b = (b << a.back().back()) | (b >> a.back().back());
  int ans = (int) 1e9;
  for (int i = 0; i < S; ++i) {
    auto real_s = i - ZERO;
    if (can.back().back()[i]) {
      ans = min(ans, abs(real_s));
    }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 20736
import java.util.*;

public class Main {

	private static int[] d;
	private static int[] prev;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		List<int[]>[] g = new ArrayList[n];
		for (int i = 0; i < n; i++) {
			g[i] = new ArrayList<>();
		}
		for (int i = 0; i < m; i++) {
			int a = sc.nextInt() - 1;
			int b = sc.nextInt() - 1;
			int c = sc.nextInt();

			g[a].add(new int[]{b, c});
			g[b].add(new int[]{a, c});
		}

		Set<Integer>[] es = new HashSet[n];
		for (int i = 0; i < n; i++) {
			es[i] = new HashSet<>();
		}

		d = new int[n];
		prev = new int[n];

		for (int v = 1; v < n; v++) {
			PriorityQueue<Integer[]> pq = new PriorityQueue<>((x, y) -> Integer.compare(y[0], x[0]));
			Arrays.fill(d, Integer.MAX_VALUE);
			Arrays.fill(prev, -1);
			pq.offer(new Integer[]{0, v, v});

			while (!pq.isEmpty()) {
				Integer[] a = pq.poll();
				if (d[a[1]] < a[0]) continue;
				d[a[1]] = a[0];
				prev[a[1]] = a[2];

				for (int i = 0; i < g[a[1]].size(); i++) {
					if (g[a[1]].get(i)[0] == a[2]) continue;
					if (d[g[a[1]].get(i)[0]] > g[a[1]].get(i)[1] + d[a[1]]) {
						pq.offer(new Integer[]{g[a[1]].get(i)[1] + d[a[1]], g[a[1]].get(i)[0], a[1]});
					}
				}
			}

			for (int i = 0; i < prev.length; i++) {
				if (prev[i] == -1 || prev[i] == i) continue;
				es[prev[i]].add(i);
				es[i].add(prev[i]);
			}
		}

		int count = 0;
		for (int i = 0; i < n; i++) {
			count += es[i].size();
		}

		System.out.println(m - count / 2);
	}
}


Measured memory_bytes: 87092
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10
#define ll long long int
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define endl '\n'
#define mod 1000000007
#define PI 3.14159265359
#define CODE_START  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll n,a[100005],x,y,m;
vector<ll>v[100005];
int32_t main(){
CODE_START;
cin>>n>>m;
for(ll i=1;i<=n;i++)
{
    cin>>a[i];
}
for(ll i=0;i<m;i++)
{
    cin>>x>>y;
    v[x].pb(y);
    v[y].pb(x);
}
ll ans=0;
for(ll i=1;i<=n;i++)
{
    ll s1=-1;
    for(ll j=0;j<v[i].size();j++)
    {
        if(a[v[i][j]]>=a[i]){
            s1=1;
            break;
        }
    }
    if(s1==-1){
        ans++;
    }
}
cout<<ans<<endl;
}



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

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

int main()
{
  string S, T;
  cin >> S >> T;
  int n = S.size();
  bool check = true;
  REP(i, n) {
    check = true;
    REP(j, n) {
      if( S[(j+i)%n] != T[j] ) {
        check = false;
        break;
      }
    }
    if(check) {
      cout << "Yes" << endl;
      break;
    }
  }
  if(!check)
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++) 
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

void comb(vector<vector <ll>> &v){
  for(int i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(int k = 1;k <v.size();k++){
    for(int j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j])%mod;
    }
  }
}

int main() {
    ll N; cin >> N;
    //ll N,M; cin >> N >> M;
    //string S; cin >> S;
    //ll H,W; cin >> H >> W;
    ll K; cin >> K;
    ll M=max(N-K+1,K-1);
    vector<vector<ll>> vec(M+100,vector<ll> (M+100,0));
    comb(vec);
    rep(i,K){
        cout << vec[N-K+1][i+1]*vec[K-1][i]%mod << endl;
    }


}

/*



 */



Measured memory_bytes: 34688
n, k = map(int, input().split())
a = list(map(int, input().split()))

cnt = 0
for i in range(n-1):
    for j in range(i+1, n):
        if a[i] > a[j]:
            cnt += 1

cnt_2 = 0
for i in range(n):
    for j in range(n):
        if a[i] > a[j]:
            cnt_2 += 1

res = cnt*k + cnt_2*k*(k-1)//2
res %= 10**9 + 7
print(res)

Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>
#include <string>
#define flush fflush(stdout)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pl;
const int mod = (int)1e9 + 7, INF = (int)1e9;
const int di[4] = { 1,0,-1,0 }, dj[4] = { 0,1,0,-1 };


#define N 2000007
ll fac[N], inv[N], finv[N];

void cominit(int n) {
    int i;
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (i = 2; i < n + 2; i++) {
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
    return;
}

ll com(int n, int r) {
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    if (r == 0 || r == n) return 1;
    return (fac[n] * finv[r]) % mod * finv[n - r] % mod;
}

int main(void) {
    int n, k, i, ans;
    ll pow1[2000003], pow2[2000003];
    string s;

    scanf("%d", &k);
    cin >> s;

    n = s.size();

    cominit(n + k);

    pow1[0] = pow2[0] = 1;
    for (i = 1; i <= n + k; i++) {
        pow1[i] = pow1[i - 1] * 25 % mod;
        pow2[i] = pow2[i - 1] * 26 % mod;
    }

    ans = 0;
    for (i = n; i <= n + k; i++) {
        ans = (ans + com(i - 1, n - 1) * pow1[i - n] % mod * pow2[n + k - i] % mod) % mod;
    }

    printf("%d\n", ans);

    return 0;
}

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

int main() {
	int k, n;
	static int a[200010];

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

	static int distance[200010];
	for (int i = 0; i < n - 1; i++) {
		distance[i] = a[i + 1] - a[i];
	}
	distance[n - 1] = a[0] + k - a[n - 1];

	int max = distance[0];
	for (int i = 0; i < n; i++) {
		if (distance[i] > max) {
			max = distance[i];
		}
	}

	cout << k - max << "\n";

	return 0;
}

Measured memory_bytes: 1792
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


N = I()
S = [''] + LS2()

R = [0]*(N+1)
G = [0]*(N+1)
B = [0]*(N+1)
for i in range(1,N+1):
    s = S[i]
    R[i] = R[i-1]
    G[i] = G[i-1]
    B[i] = B[i-1]
    if s == 'R':
        R[i] += 1
    elif s == 'G':
        G[i] += 1
    else:
        B[i] += 1

ans = 0
for i in range(2,N):
    if S[i] == 'R':
        ans += G[i-1]*(B[-1]-B[i])
        ans += B[i-1]*(G[-1]-G[i])
        for j in range(1,N+1):
            if 1 <= i-j <= N and 1 <= i+j <= N:
                if (S[i-j] == 'G' and S[i+j] == 'B') or (S[i-j] == 'B' and S[i+j] == 'G'):
                    ans -= 1

    elif S[i] == 'G':
        ans += R[i-1]*(B[-1]-B[i])
        ans += B[i-1]*(R[-1]-R[i])
        for j in range(1,N+1):
            if 1 <= i-j <= N and 1 <= i+j <= N:
                if (S[i-j] == 'R' and S[i+j] == 'B') or (S[i-j] == 'B' and S[i+j] == 'R'):
                    ans -= 1
    else:
        ans += G[i-1]*(R[-1]-R[i])
        ans += R[i-1]*(G[-1]-G[i])
        for j in range(1,N+1):
            if 1 <= i-j <= N and 1 <= i+j <= N:
                if (S[i-j] == 'R' and S[i+j] == 'G') or (S[i-j] == 'G' and S[i+j] == 'R'):
                    ans -= 1

print(ans)


Measured memory_bytes: 74440