akhauriyash/Code-Regression huggingface dataset:
// tsukasa_diary's programing contest code template
#include <bits/stdc++.h>
using namespace std;
#define TSUKASA_DIARY_S_TEMPLATE
// define
#define for_(i,a,b) for(int i=(a);i<(b);++i)
#define for_rev(i,a,b) for(int i=(a);i>=(b);--i)
#define allof(a) (a).begin(),(a).end()
#define minit(a,b) memset(a,b,sizeof(a))
#define size_of(a) int((a).size())
#define cauto const auto
// typedef
typedef long long lint;
typedef double Double;
typedef pair< int, int > pii;
template< typename T > using Vec = vector< T >;
template< typename T > using Matrix = Vec< Vec< T > >;
template< typename T > using USet = unordered_set< T >;
template< typename T, class C > using MyUSet = unordered_set< T, C >;
template< typename T, typename F > using UMap = unordered_map< T, F >;
template< typename T, typename F, class C > using MyUMap = unordered_map< T, F, C >;
// hash
class PiiHash { public: size_t operator () (const pii& p) const { return (p.first << 16) | p.second; } };
// popcount
inline int POPCNT(int x) { return __builtin_popcount(x); }
inline int POPCNT(lint x) { return __builtin_popcount(x); }
// inf
const int iINF = 1L << 30;
const lint lINF = 1LL << 60;
// eps
const Double EPS = 1e-9;
const Double PI = acos(-1);
// inrange
template< typename T >
inline bool in_range(T v, T mi, T mx) { return mi <= v && v < mx; }
template< typename T >
inline bool in_range(T x, T y, T W, T H) { return in_range(x,0,W) && in_range(y,0,H); }
// neighbor clockwise
const int DX[4] = {0,1,0,-1}, DY[4] = {-1,0,1,0};
const int DX_[8] = {0,1,1,1,0,-1,-1,-1}, DY_[8] = {-1,-1,0,1,1,1,0,-1};
// variable update
template< typename T > inline void modAdd(T& a, T b, T mod) { a = (a + b) % mod; }
template< typename T > inline void modMul(T& a, T b, T mod) { a = (a * b) % mod; }
template< typename T > inline void minUpdate(T& a, T b) { a = min(a, b); }
template< typename T > inline void maxUpdate(T& a, T b) { a = max(a, b); }
// converter
template< typename F, typename T >
inline void convert(F& from, T& to) {
	stringstream ss;
	ss << from; ss >> to;
}


int n;
lint a[100000];

lint calc(bool dig) {
	lint sum = 0, ans = 0;
	
	for_(i,0,n) {
		sum += a[i];
	
		if (dig && sum <= 0) {
			ans += abs(sum) + 1;
			sum = 1;
		}
		
		if (!dig && sum >= 0) {
			ans += abs(sum) + 1;
			sum = -1;
		}
		
		dig = !dig;
	}
	
	return ans;
}

int main() {
	cin >> n;
	for_(i,0,n) cin >> a[i];
	cout << min(calc(false), calc(true)) << endl;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <queue>
#include <set>
#include <vector>
#include <stack>
#include <map>
#include <bitset>
#define ri register
#define inf 0x7fffffff
#define E (1)
#define mk make_pair
#define int long long
//#define double long double
using namespace std; const int N=2000010, Mod=1e9+7;
inline int read()
{
    int s=0, w=1; ri char ch=getchar();
    while(ch<'0'||ch>'9') {if(ch=='-') w=-1; ch=getchar(); }
    while(ch>='0'&&ch<='9') s=(s<<3)+(s<<1)+(ch-'0'), ch=getchar();
    return s*w;
}
void print(int x) { if(x<0) x=-x, putchar('-'); if(x>9) print(x/10); putchar(x%10+'0'); }
int K,fac[N+10],inv[N+10],res; char s[N];
inline int ksc(int x,int p) { int res=1; for(;p;p>>=1, x=x*x%Mod) if(p&1ll) res=res*x%Mod; return res; }
inline int C(int x,int y) { if(x<y) return 0; return fac[x]*inv[x-y]%Mod*inv[y]%Mod; }
signed main()
{
    K=read();
    scanf("%s",s+1);
    int qwq=strlen(s+1)+K;
    fac[0]=1;
    for(ri int i=1;i<=N;i++) fac[i]=fac[i-1]*i%Mod;
    inv[N]=ksc(fac[N],Mod-2);
    for(ri int i=N;i;i--) inv[i-1]=inv[i]*i%Mod;
    for(ri int i=strlen(s+1);i<qwq;i++) res=(res+ksc(25,qwq-i)*C(qwq,i)%Mod)%Mod;
    printf("%lld\n",(res+1)%Mod);
    return 0;
}

Measured memory_bytes: 35964
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;
 
int main() {
  int n;
  cin >> n;
  bool ok = true;
  int prev_t = 0, prev_x = 0, prev_y = 0;
  while (n--) {
    int t, x, y;
    cin >> t >> x >> y;
    int dif_t = t - prev_t, dif_x = abs(x - prev_x), dif_y = abs(y - prev_y);
    ok &= ( (dif_t >= dif_x + dif_y) && (dif_t % 2 == (dif_x + dif_y) % 2));
  }
  cout << (ok ? "Yes" : "No") << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int int64_t
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define REPP(i, n) for (int i = 1; (i) < (int)(n+1); ++ (i))
#define REPR(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i=(m)-1; i>=(n); i--)
#define ALL(v) v.begin(), v.end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define SORTR(c) sort((c).begin(),(c).end(),greater<int>());
#define BIT(n) (1LL<<(n))
#define PCNT(x) __builtin_popcountll(x)
#define GCD(x,y) __gcd(x,y)
#define LCM(x,y) x/__gcd(x,y)*y
#define PB push_back
#define MP make_pair
#define endl "\n"
#define pa cout << ans << endl
#define p(x) cout << x << endl
#define pall(x) for(auto iter : x) p(iter)
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
#define yn(x) cout << (x ? "Yes" : "No") << endl
using namespace std;
using Graph = vector<vector<int> >;
using WeightedGraph = vector<vector<pair<int, int> > >;
typedef long double LD;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
const int INF = 2000000000;
const long double PI = acosl(-1);
const int MOD = 1000000007;
void print() {cout << endl;}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head; if (sizeof...(tail) != 0) cout << " ";print(forward<Tail>(tail)...);}
template <class T> void print(vector<T> &vec) {for (auto& a : vec) {cout << a; if (&a != &vec.back()) cout << " ";} cout << endl;}
template <class T> void print(vector<vector<T>> &df) { for (auto& vec : df) { print(vec);}}


signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int ans = 0;
    
    int N;
    cin >> N;
    vector<string> S(N);
    map<string,int> mp;
    REP (i, N) {
        cin >> S[i];
        mp[S[i]]++;
    }
    for (auto i : mp) {
        ans++;
    }
    cout << ans << endl;
    
    
    
    return 0;
}

/*
cd ~/Desktop/Programming/AtCoder/contest/abc164/abc164_c && sh shellscripts/test_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/abc164/abc164_c && sh shellscripts/etest_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/abc164/abc164_c && sh shellscripts/submit_cpp.sh
*/


Measured memory_bytes: 25024
#include <iostream>
using namespace std;
int data[220],N;
unsigned long long dp[220][21];
int main(){
	cin>>N;
	for(int i=1;i<=N;i++){
		cin>>data[i];
	}
	dp[0][0]=1;
	for(int i=0;i<=N;i++){
		for(int j=0;j<21;j++){
		if(dp[i][j]>0){
			if(j+data[i+1]<21){
				dp[i+1][j+data[i+1]]+=dp[i][j];
			}
			if(i!=0 && j-data[i+1]>=0){
				dp[i+1][j-data[i+1]]+=dp[i][j];
			}
		}
		}
	}
	cout<<dp[N-1][data[N]]<<endl;
	return 0;
}

Measured memory_bytes: 1176
#include <iostream>
#include <string>

using namespace std;

int main() {
    char c; cin >> c;
    switch (c)
    {
        case 'A': cout << 'T' << endl; break;
        case 'C': cout << 'G' << endl; break;
        case 'G': cout << 'C' << endl; break;
        case 'T': cout << 'A' << endl; break;
    }
}

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
const int INF = (1LL<<30);
const ll LLINF = (1LL<<60);
const double PI = 3.14159265359;
const double EPS = 1e-12;
const int MOD = 1000000007;
//#define int ll

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); }

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

int t[10010], dp[2][10010][2];
signed main(void)
{
  int n;
  cin >> n;
  REP(i, n-1) cin >> t[i];

  memset(dp, 0x3f, sizeof(dp));
  dp[0][1][0] = dp[0][0][1] = t[0];
  // REP(ii, 2) {
  //   REP(jj, n+1) {
  //     cout << dp[0][jj][ii] << " ";
  //   }
  //   cout << endl;
  // }
  // k=0??????A???k=1??????B
  int cur = 0, nxt = 1;
  FOR(i, 1, n) {
    REP(j, n) REP(k, 2) dp[nxt][j][k] = 0x3f3f3f3f;
    REP(j, n+1) {
      REP(k, 2) {
        if(dp[cur][j][k] == 0x3f3f3f3f) continue;
        if(k == 0) {
          // A????????¶
          chmin(dp[nxt][j+1][0], dp[cur][j][k] - t[i-1] + t[i]);
          // B????????¶
          chmin(dp[nxt][j][1], dp[cur][j][k] + t[i]);
        } else {
          chmin(dp[nxt][j+1][0], dp[cur][j][k] + t[i]);
          chmin(dp[nxt][j][1], dp[cur][j][k] - t[i-1] + t[i]);
        }
        // cout << "i:" << i << " j:" << j << " k:" << k << " cur:" << cur << " nxt:" << nxt << endl;
        // cout << "dp[" << cur << "][" << j << "][" << k << "]:" << dp[cur][j][k] << " ";
        // cout << "dp[" << nxt << "][" << j+1 << "][" << 0 << "]:" << dp[nxt][j+1][0] << " ";
        // cout << "dp[" << nxt << "][" << j << "][" << 1 << "]:" << dp[nxt][j][1] << endl;
        // REP(ii, 2) {
        //   REP(jj, n+1) {
        //     cout << dp[nxt][jj][ii] << " ";
        //   }
        //   cout << endl;
        // }
      }
    }
    cur = !cur, nxt = !nxt;
  }

  cout << min(dp[cur][n/2][0], dp[cur][n/2][1]) << endl;

  return 0;
}

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
int main() {
	vector<int> a(3);
	vector<int> b(3);
	vector<int> cnt(5);
	bool flag = true;
	for (int i = 0; i < 3; i++) {
		cin >> a[i] >> b[i];
		cnt[a[i]]++;
		cnt[b[i]]++;
	}
	for (int i = 0; i < 5; i++) {
		if (cnt[i] >= 3) flag = false;
	}
	if (flag) cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 256
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    from itertools import accumulate

    n = int(readline())
    a = list(map(int, readline().split()))
    ans = 0

    sum_cur = 0
    xor_cur = 0
    idx = 0

    for i, x in enumerate(a):
        sum_cur += x
        xor_cur ^= x

        while idx <= i:
            if sum_cur == xor_cur:
                ans += (i + 1) - idx
                break
            else:
                sum_cur -= a[idx]
                xor_cur ^= a[idx]
                idx += 1

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 72268
I=input
N,M=map(int,I().split())
X,G,d,C=list(map(int,I().split())),[set()for _ in range(N)],[0]*M,[0]*N
for i in range(M):
    u,v=sorted(map(int,I().split()),key=lambda x:[X[x-1],-x])
    G[v-1].add(u-1)
    d[i]=str(X[v-1])
for u in sorted(range(N),key=lambda i:X[i]):
    if C[u]:continue
    if not G[u]:break
    C[u],S=-1 if sum(C[c]+1 for c in G[u])else 1,[u]
    while S:
        q = S.pop()
        for c in G[q]:
            if C[c]:continue
            S+=[c]
            C[c]=-C[q]
print("".join(" BW"[i] for i in C)+"\n"+"\n".join(d)if C[u]else -1)

Measured memory_bytes: 140888
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
using namespace std;
int main(){
    int a,b,c,d,e,k;
    cin>>a>>b>>c>>d>>e>>k;
    int MIN = min(a,min(b,min(c,min(d,e))));
    int MAX = max(a,max(b,max(c,max(d,e))));
    MAX - MIN <= k ? cout << "Yay!" : cout << ":(";
    cout << endl;
}

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

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

typedef long long ll;

int main(void) {

	ll N,M;
	cin >> N >> M;

	vector<ll> a(M), b(M), c(M);
	REP(i, M) {
		cin >> a[i] >> b[i] >> c[i];
	}

	ll d[1010];
	d[0] = 0;
	FOR(i, 1, 1010) d[i] = -(1e17);

	ll count = 0;
	ll temp;

	while (count < N*2+1) {

		if (count == N) {
			temp = d[N - 1];
		}

		FOR(i, 0, M){
			// それぞれのiは辺を表すので、現在の最大距離と比べて、重みづけした辺を足したら大きくなるなら更新する
			d[b[i]-1] = max(d[b[i]-1], d[a[i]-1]+c[i]);
		}

		if (count == (N*2)) {
			break;
		}
		count++;
	}

	if (d[N - 1] > temp) {
		cout << "inf" << endl;
	}
	else {
		cout << d[N - 1] << endl;
	}


	return 0;
}

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

int main() {
//味玉、チャーシュー、ネギをoxで判断
//ラーメン700円でトッピング1つ100円
	int p=700;
	int t = 0;
	string s;
	cin >> s;
	for (int i = 0; i < 3; i++) {
		if (s[i] == 'o') {
			t += 100;
		}
	}
	p += t;
	cout << p << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string t;
  cin>>t;
  int s,e;
  for(int j=0;j<t.size();j++)
  {

    if(t.at(j)=='A')
    {
      s=j;
      break;
    }
  }
  for(int i=t.size()-1;i>=0;i--)
  {

    if(t.at(i)=='Z') 
    {
      e=i;
      break;
    }
  }
  cout<<e-s+1<<endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>

using namespace std;
int main(){
    int K = 0;
    string S,count;
    
    cin >> K >> S;

    int l = S.size();

    if(K >= l)
    {
        cout << S << endl;
    }
    else if(K < l)
    {
        for(int i=0;i<K;i++)
        {
            count.push_back(S[i]);
        }

        cout << count << "..." << endl;
    }
    return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) do {cout << (A) << '\n'; exit(0);} while (false)

ll N;
vector<ll> P;
vector<bool> B;

ll fac(ll N)
{
  ll ret = 1;
  for (ll i = 1; i <= N; i++)
  {
    ret *= i;
  }
  return ret;
}

ll f()
{
  B = vector<bool>(N, false);

  ll ret = 0;
  for (ll i = 0; i < N; i++)
  {
    B.at(P.at(i)) = true;
    ll cnt = 0;
    for (ll j = 0; j < P.at(i); j++)
    {
      if (!B.at(j))
        cnt++;
    }
    ret += cnt * fac(N - i - 1);
    cerr << i << " " << ret << endl;
  }
  return ret;
}

int main()
{
  cin >> N;
  P.resize(N);
  for (ll i = 0; i < N; i++)
  {
    cin >> P.at(i);
    P.at(i)--;
  }
  ll a = f();
  for (ll i = 0; i < N; i++)
  {
    cin >> P.at(i);
    P.at(i)--;
  }
  ll b = f();

  ll ans = abs(a - b);
  cout << ans << endl;
  cerr << a << " " << b << endl;
}

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

#define rep(i, n) REP(i, 0, n)
#define REP(i,k,n) for(int i = k; i < n; i++)
#define mmax(start, end) *max_element(start, end)
#define mmin(start, end) *min_element(start, end)
#define argmax max_element
#define argmin min_element
#define push push_back
#define pop pop_back
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef string str;

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

template<class T = ll> T in() {
    T _in;
    cin >> _in;
    return _in;
}

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

    ll A=in(), B=in(), C=in();

    string ans;
    if(A+B >= C) {
        ans = "Yes";
    } else {
        ans = "No";
    }
    
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
ll a,b,c,d,k;
cin >> a >> b >> c >> d >> k;
ll maxminite = (c - a) * 60 + (d - b);
cout << maxminite - k << endl;
}

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

int main(){
  	int n,a[100],ans = 0;
  	double memo = 0;
  	cin >> n;
  
  	rep(i,0,n){
		cin >> a[i];
     	memo += a[i]; 
    }
  
  	memo /= (double) n;
  	memo = round(memo);
  
  	rep(i,0,n){
      ans += pow(a[i]-memo,2);
    }
  
  	cout << ans << endl;
  
  	
  
	return 0; 
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<string.h>
#include<complex>
#include<math.h>
using namespace std;
typedef long long int llint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

bool check(int a, int b) {
	return a > b;
}

int main() {
	int n;
	cin >> n;
	int x;
	int cnt = 0;
	rep(i, n) {
		cin >> x;
		cnt += x % 2;
	}
	YES(cnt % 2 == 0);
	return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx")
//#undef LOCAL
#include <bits/stdc++.h>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;

#ifdef LOCAL
#define show(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define show(x) true
#endif

template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    return os << "P(" << p.first << ", " << p.second << ")";
}

template <class T> ostream& operator<<(ostream& os, const V<T>& v) {
    os << "[";
    for (auto d : v) os << d << ", ";
    return os << "]";
}

const int MN = 2020; //6;
using B = bitset<MN>;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int n;
    cin >> n;
    V<B> win(n); 
    for (int j = 1; j < n; j++) {
        string s;
        cin >> s;
        for (int i = 0; i < j; i++) {
            if (s[i] == '0') {
                // i -> j
                win[i].set(j);
            } else {
                // j -> i
                win[j].set(i);
            }
        }
    }

    V<B> okL(n), okR(n);
    for (int i = 0; i < n; i++) {
        okL[i][i] = true;
        okR[i][i] = true;
    }
    for (int di = 1; di <= n; di++) {
        for (int l = 0; l + di <= n - 1; l++) {
            int r = l + di;

            okL[r][l] = (okR[l + 1] & okL[r] & win[l]).any();
            okR[l][r] = (okR[l] & okL[r - 1] & win[r]).any();
        }
    }

    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (okR[0][i] && okL[n - 1][i]) {
            show(i);
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

vector<i64> a;
int main() {
  read_n(a, 3);
  sort(begin(a), end(a));
  cout << a[0] + a[1] << endl;
  return 0;
}


Measured memory_bytes: 256
import Control.Applicative
import Control.Monad

main :: IO ()
main = do
  str <- getLine
  q <- readLn
  cmds <- map words <$> replicateM q getLine
  cmdLoop str cmds

cmdLoop :: String -> [[String]] -> IO ()
cmdLoop _ [] = return ()
cmdLoop str ((c : a : b : s) : cmds)
  | c == "replace" = cmdLoop (s1 ++ head s ++ s4) cmds
  | c == "reverse" = cmdLoop (s1 ++ reverse s3 ++ s4) cmds
  | c == "print"   = do
      putStrLn s3
      cmdLoop str cmds
      where
        [a', b'] = map read [a, b]
        (s1, s2) = splitAt a' str
        (s3, s4) = splitAt (b' - a' + 1) s2



Measured memory_bytes: 5672
nim =int(input())
mike = list(map(int,input().split()))

S = [0]
X = [0]
for a in mike:
    S.append(S[-1]+a)
    X.append(X[-1]^a)

l,r = 1,1
result = 0
p = 1
while r <= nim:
    if S[r]-S[l-1] == X[r]^X[l-1]:
        if p==0:
            result -= (r-l)*(r-l+1)//2
        r += 1
        p = 1
    else:
        if p ==1:
            result += (r-l)*(r-l+1)//2
        l += 1
        p = 0
result += (r-l)*(r-l+1)//2
print(result)

Measured memory_bytes: 30600
#include<bits/stdc++.h>
using namespace std;
const int N=55;
int n,k,tot,id,a[N][N];
bool judge(int x)
{
    for(int i=2;i*i<=x;i++)
        if(x%i==0) return false;
    return true;
}
vector<int>v[N*N];
int vv[N*N];
int main()
{
    for(int i=2;;i++)
        if(i*(i-1)+1>=1000&&i*(i-1)+1<=2000&&judge(i-1))
        {
            k=i;break;
        }
    n=k*(k-1)+1;
    printf("%d %d\n",n,k);
    for(int j=1;j<=k;j++)
    {
        ++tot;
        v[n].push_back(tot);
        for(int i=1;i<k;i++)
        {
            a[i][j]=++id;v[id].push_back(tot);
        }
    }
    for(int i=1,d=0;i<k;i++,d++)
    {
        for(int j=1;j<k;j++)
        {
            tot++;
            v[a[i][k]].push_back(tot);
            int x=j,y=k-1;
            while(y)
            {
                v[a[x][y]].push_back(tot);
                x+=d;y--;
                if(x>=k) x-=k-1;
            }
        }
    }
    for(int i=1;i<=tot;i++)
    {
        assert(v[i].size()==k);
        for(int j=0;j<k;j++)
            printf(j==k-1?"%d\n":"%d ",v[i][j]);
    }
}


Measured memory_bytes: 896
n, s = map(int, input().split())
a = list(map(int, input().split()))
mod = 998244353

lst = [0 for i in range(s+1)]
dp = [lst]
for i in range(n):
    new = [0 for i in range(s+1)]
    new[0] = 1
    if a[i]<=s: new[a[i]] = 1
    for j in range(s+1):
        if j-a[i] >= 0:
            new[j] += dp[-1][j] + dp[-1][j-a[i]]
            new[j] %= mod
        else:
            new[j] += dp[-1][j]
            new[j] %= mod
    dp.append(new)

ans = 0
for i in range(n+1):
    ans += dp[i][-1]
    ans %= mod
print(ans)

Measured memory_bytes: 121308
#include <bits/stdc++.h>
using longlong=long long;

int main(){
    std::cin.tie(nullptr);std::cin.sync_with_stdio(false);
    int n;std::cin>>n;
    int ans=0;
    for(int i=0;i<n;i++){
        int l,r;std::cin>>l>>r;
        ans+=r-l+1;
    }
    std::cout<<ans<<std::endl;
}

Measured memory_bytes: 256
INF = 10**9 + 7

n = int(input())
a = list(map(int, input().split()))
if n%2==0:
    p = [0]*(n//2)
    for i in range(n):
        x = (a[i]-1)//2
        p[x]+=1
    m = len(p)
    for i in range(m):
        if p[i]!=2:
            print(0)
            exit()
    ans = (2**m)%INF
    print(ans)
else:
    p = [0]*(((n-1)//2)+1)
    for i in range(n):
        x = a[i]//2
        p[x]+=1
    m = len(p)
    if p[0]!=1:
        print(0)
        exit()
    for i in range(1,m):
        if p[i]!=2:
            print(0)
            exit()
    m -=1
    ans = (2**m)%INF
    print(ans)



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

int main() {
    long x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;

    long len;
    long x3, y3, x4, y4;

    x3 = x2 - (y2 - y1);
    y3 = y2 + (x2 - x1);
    x4 = x1 - (y2 - y1);
    y4 = y1 + (x2 - x1);

    cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

#define ll long long int


class Mod {

public:
    ll MOD_;

    Mod(ll mod) { MOD_ = mod; }

    ll add(ll a, ll b) { return (a + b) % MOD_; }
    ll sub(ll a, ll b) { return (a - b + MOD_) % MOD_; }
    ll mul(ll a, ll b) { return (a * b) % MOD_; }
    
    ll pow(ll a, ll b) {
        ll res = 1;
        while (b > 0) {
            if (b & 1) res = mul(res, a);
            a = mul(a, a);
            b >>= 1;
        }
        return res;
    }

    ll inv(ll a) {
        ll b = MOD_;
        ll u = 1, v = 0;
        while (b > 0) {
            ll t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        u %= MOD_;
        if (u < 0) u += MOD_;

        return u;
    }


    ll *fac_, *fac_inv_, *inv_;
    int MAX_;

    void bc_init(int max) {
        MAX_ = max;
        fac_ = new ll[MAX_ + 1];
        fac_inv_ = new ll[MAX_ + 1];
        inv_ = new ll[MAX_ + 1];

        fac_[0] = 1;
        fac_[1] = 1;
        fac_inv_[0] = 1;
        fac_inv_[1] = 1;
        inv_[0] = 0;
        inv_[1] = 1;
        for (int i = 2; i <= MAX_; i++) {
            fac_[i] = mul(fac_[i-1], i);
            inv_[i] = MOD_ - (inv_[MOD_ % i] * (MOD_ / i)) % MOD_;
            fac_inv_[i] = fac_inv_[i - 1] * inv_[i] % MOD_;
        }
    }

    ll bc(ll n, ll k) {
        if (n < k) return 0;
        if (n < 0 || k < 0) return 0;
        return mul(fac_[n], mul(fac_inv_[k], fac_inv_[n-k]));
    }
};


int main()
{
    Mod mod(1000000007);
    mod.bc_init(200000);

    ll h, w, a, b;
    cin >> h >> w >> a >> b;

    ll res = 0;
    int k = min(h - a, w - b);

    for (int i = 0; i < k; i++) {
        // cout << mod.bc(h - a + b - 1, b + i) << ", " << mod.bc(a + w - b - 1, w - b - i - 1) << endl;
        res += mod.mul(mod.bc(h - a + b - 1, b + i), mod.bc(a + w - b - 1, w - b - i - 1));
        res %= 1000000007;
    }


    cout << res << endl;

    return 0;
}


Measured memory_bytes: 8296
# B
N, T = list(map(int, input().split()))
min_cost = 9999

for i in range(N):
    c, t = list(map(int, input().split()))
    if t <= T and c < min_cost:
        min_cost = c
        
if min_cost == 9999:
    min_cost = 'TLE'
    
print(min_cost)

Measured memory_bytes: 2940
// writer: w33z8kqrqk8zzzx33
#include <bits/stdc++.h>
using namespace std;
 
#define iter(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i, a) iter(i, 0, a)
#define rep1(i, a) iter(i, 1, (a)+1)
#define log(a) cerr<<"\033[32m[DEBUG] "<<#a<<'='<<(a)<<" @ line "<<__LINE__<<"\033[0m"<<endl
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair
 
using ll=long long;
using pii=pair<int, int>;
//#define int ll
const int MOD = 1000000007;

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int N, K; cin >> N >> K;
	vector<int> v;
	rep(i, N) { int t; cin >> t; v.pb(t); }
	sort(all(v));
	ll ans = 0;
	rep(i, N-K) ans += v[i];
	cout << ans << endl;
}



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

struct node{
	int val;
	node*l,*r;
}dat[4000000];
node*root=&dat[0];
int p=1;

inline void update(node*t,int k,int x,int l,int r){
	if(r-l==1){
		t->val+=x;return;
	}
	if(k<(l+r)/2){
		if(t->l==NULL)t->l=&dat[p++];
		update(t->l,k,x,l,(l+r)/2);
		t->val=t->l->val+(t->r?t->r->val:0);
	}
	else{
		if(t->r==NULL)t->r=&dat[p++];
		update(t->r,k,x,(l+r)/2,r);
		t->val=(t->l?t->l->val:0)+t->r->val;
	}
}
inline int query(node*t,int a,int l,int r){
	if(r-l==1)return l;
	if(t->l&&t->l->val>=a)return query(t->l,a,l,(l+r)/2);
	else return query(t->r,a-(t->l?t->l->val:0),(l+r)/2,r);
}
int N=1<<30;
int a[400000];

int main(){
	int n;scanf("%d",&n);
	rep(i,n){
		scanf("%d",&a[i]);
		update(root,a[i],1,0,N);
	}
	rep(i,n){
		update(root,a[i],-1,0,N);
		int A=n/2;
		printf("%d\n",query(root,A,0,N));
		update(root,a[i],1,0,N);
	}
}

Measured memory_bytes: 66944
#include <iostream>
#include <queue>

using namespace std;

int main()
{
	int a, b;
	cin >> a >> b;
	priority_queue<int> q;

	q.push(a);
	q.push(a - 1);
	q.push(b);
	q.push(b - 1);

	int x1 = q.top();
	q.pop();
	int x2 = q.top();
	
	cout << x1 + x2 << endl;
}


Measured memory_bytes: 256
import math
def main():
    x, n = map(int, input().split())
    if n==0:
        out = x
    else:
        p_l = [int(_) for _ in input().split()]

        c_l = []
        for i in range(-101, 105):
            c_l.append(i)
        
        for p in p_l:
            if p in c_l:
                c_l[c_l.index(p)]=1000
        
        abs_c_l = []
        for i in range(-101, 105):
            abs_c_l.append(i)

        for i, c in enumerate(c_l):
            abs_c_l[i] = abs(c_l[i] - x)
        
        m = min(abs_c_l)
        out = c_l[abs_c_l.index(m)]
        
    print(out)

main()

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

int main() {
  int n;
  while (cin >> n) {
    if (n == 0) {
      break;
    }
    int p[110][110];
    for (int i = 0; i < 110; i++) {
      for (int j = 0; j < 110; j++) {
        p[i][j] = 0;
      }
    }
    for (int i = 0; i < n; i++) {
      int m;
      cin >> m;
      for (int j = 0; j < m; j++) {
        int x;
        cin >> x;
        p[i][x] = 1;
      }
    }
    int k;
    cin >> k;
    vector<int> list(k);
    for (int i = 0; i < k; i++) {
      cin >> list[i];
    }
    int cnt = 0, ans = -1;
    for (int i = 0; i < n; i++) {
      bool flag = true;
      for (int j = 0; j < k; j++) {
        if (p[i][list[j]] == 0) {
          flag = false;
        }
      }
      if (flag) {
        cnt++;
        ans = i + 1;
      }
    }
    if (cnt == 1) {
      cout << ans << endl;
    }
    else {
      cout << -1 << endl;
    }
  }
  return 0;
}


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

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

  string ans = "Yes";
  vector<int> h(n);
  cin >> h.at(0);
  for (int i = 1; i < n; i++){
    cin >> h.at(i);
    if (h.at(i) == h.at(i - 1)){
      continue;
    }else if (h.at(i) > h.at(i - 1)){
      h.at(i) -= 1;
    }else {
      ans = "No";
      break;
    }
  }

  cout << ans << endl;

  return 0;
}


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

typedef long long ll;
using namespace std;

# define MOD 1000000007

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n);
    ll ans = 1;
    vector<int> count(3);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        int c = 0;
        int index = -1;
        for (int k = 0; k < 3; k++) {
            if (count[k] == a[i]) {
                c++;
                if (index < 0) {
                    index = k;
                }
            }
        }
        if (index < 0) {
            cout << 0 << endl;
            return 0;
        }
        count[index]++;
        ans *= c;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>

using namespace std;
const int MAXN = 350;
string s1[MAXN];
int arr[MAXN][MAXN];
int cnt;
bool filledrow[MAXN];
int main(){
    int h,w,k;
    cin>>h>>w>>k;
    for(int i=1;i<=h;i++){
        cin>>s1[i];
        s1[i] = '.'+s1[i];
        for(int j=1;j<=w;j++){

            if(s1[i][j] == '#'){
                filledrow[i] =true;
                cnt++;
                arr[i][j] = cnt;
                for(int x=j-1;x>=1;x--){
                    if(arr[i][x]){
                        break;
                    }
                    arr[i][x] = cnt;
                }
                for(int x=j+1;x<=w;x++){
                    if(s1[i][x] == '#'){
                        break;
                    }
                    arr[i][x] = cnt;
                }

            }
        }
        if(!filledrow[i]){
            for(int j=1;j<=w;j++){
                arr[i][j] = arr[i-1][j];
            }
        }
    }

        if(!filledrow[1]){
                int ptr = 1;
                while(!filledrow[ptr]){
                    ptr++;
                }
                for(int i=ptr-1;i>=0;i--){
                    for(int j=1;j<=w;j++){
                        arr[i][j] = arr[i+1][j];
                    }
                }
            }

    for(int i=1;i<=h;i++){

        for(int j=1;j<=w;j++){
            cout<<arr[i][j]<<" ";
        }
        cout<<endl;
    }

}


Measured memory_bytes: 1280
from math import floor


def main():
    a, b, n = map(float, input().split())

    if n < b:
        x = n
    else:
        x = b - 1
    ans = floor(a * x/b) - a * floor(x/b)
    print(int(ans))


if __name__ == "__main__":
    main()


Measured memory_bytes: 9056
import math
a,b=map(int,input().split())
x=max(a,b)
y=min(a,b)
p=abs(x-y)

if (x+y)%3!=0:
    print(0)
elif x>y*2:
    print(0)
else:
    n=(x+y)//3
    q=(2*x-y)//3
    r=(2*y-x)//3
    
    #print(math.factorial(q+r)//math.factorial(q)//math.factorial(r)%(10**9+7))
    ans=1
    qq=1
    rr=1
    P = 10**9 + 7
    N = max(q,r)+2
    inv_t = [0]+[1]
    for i in range(2,N):
        inv_t += [inv_t[P % i] * (P - int(P / i)) % P]
    for i in range(1,q+r+1):
        ans*=i
        ans%=10**9+7
    for i in range(1,q+1):
        ans*=inv_t[i]
        ans%=10**9+7
    for i in range(1,r+1):
        ans*=inv_t[i]
        ans%=10**9+7
            
            
    print(ans)


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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), x = sc.nextInt();//,c=sc.nextInt(),k=sc.nextInt();
		int sum=0,count=0,flag=0,max=-999999,min=99999;
		int[] array=new int[n];
		//String[] array = new String[n];
		//String s=sc.next();//,t=sc.next();
		for(int i=0;i<n;i++) {
			array[i]=sc.nextInt();
			sum+=array[i];
			count++;
		}
		Arrays.sort(array);
		while(x-sum>0) {
			sum+=array[0];
			if(x-sum<0)break;
			count++;
		}

		System.out.println(count);
	}
	public static int sample(int n) {
		return n;
	}

}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
 
using namespace std;
 
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define pvec(v) rep(i,v.size()){cout << v[i] << " ";};cout<<endl;
#define pb push_back
#define pf push_front
#define mod 1e9+7
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;

const double pi = acos(-1.0);
 
ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

int main()
{
	string a,b,c;
	char x;
	cin >> a >> b >> c;
	x=a[0];
	while(1){
		if(x=='a'){
			if(a.size()==0){
				cout << "A\n";
				return 0;
			}
			x=a[0];
			a.erase(a.begin(),a.begin()+1);
		}
		else if(x=='b'){
			if(b.size()==0){
				cout << "B\n";
				return 0;
			}
			x=b[0];
			b.erase(b.begin(),b.begin()+1);
		}
		else{
			if(c.size()==0){
				cout << "C\n";
				return 0;
			}
			x=c[0];
			c.erase(c.begin(),c.begin()+1);
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <string>
#include <vector>
#include <cmath>
#include <random>
#include <climits>

#define mod 1000000007
#define REP(i,n) for(int i=0; i<n; i++)

using namespace std;
using ll = long long;

void solve() {
    int a, b, c;
    cin >> a >> b >> c;
    if(a == b){
        cout << c << endl;
    }else if(b == c){
        cout << a << endl;
    }else if(a == c){
        cout << b << endl;
    }
}

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

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <list> 
#include<algorithm>
#include<cmath>
#include<map>
#include<vector>
#include<string>
#include<fstream>
#include<set>
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define forl(i,a,n) for(int i=a;i<n;i++)
#define rfor(i,n,a) for(int i=n;i>=a;i--)
#define ll long long
#define ld long double
#define pb push_back
#define ld long double
#define vi vector<int>
#define vll vector<long long>
#define pi pair<int,int>
#define pll pair<long long,long long>
#define mp make_pair
#define B begin()
#define E end()
#define S size()
#define m9 1000000007
using namespace std;


 
/*
string fs(string str1, string str2)
{    if (str1.length() > str2.length())
        swap(str1, str2);
      string str = "";
    int n1 = str1.length(), n2 = str2.length();
    int diff = n2 - n1;
      int carry = 0;
      for (int i=n1-1; i>=0; i--)
    {
 
        int sum = ((str1[i]-'0') +
                   (str2[i+diff]-'0') +
                   carry);
        str.push_back(sum%10 + '0');
        carry = sum/10;
    }
      for (int i=n2-n1-1; i>=0; i--)
    {
        int sum = ((str2[i]-'0')+carry);
        str.push_back(sum%10 + '0');
        carry = sum/10;
    }
      if (carry)
        str.push_back(carry+'0');
      reverse(str.begin(), str.end());
 
    return str;
}*/
 
ll gcd(ll x,ll y)
{
    if(x==0) return y;
    return gcd(y%x,x);
}
 
/*
ll gcdextended(ll a, ll b, ll *x, ll *y) 
{ 
    if (a == 0) 
    { 
        *x = 0, *y = 1; 
        return b; 
    } 
  
    ll x1, y1; 
    int gcd = gcdextended(b%a, a, &x1, &y1); 
   
    *x = y1 - (b/a) * x1; 
    *y = x1; 
  
    return gcd; 
}
 
 
///RELATIVE COPRIME
ll modinverse(ll a, ll m) 
{ 
    ll x, y; 
   ll g = gcdextended(a, m, &x, &y); 
    if (g != 1) 
return -1;
    else
    { 
        ll res = (x%m + m) % m; 
        return res;  
    } 
} 
  */
ll powmod(ll x, ll y, ll m) 
{ 
    if (y == 0) 
        return 1; 
    ll p = powmod(x, y/2, m) % m; 
    p = (p * p) % m; 
    return (y%2 == 0)? p : (x * p) % m; 
} 
///M IS PRIME
ll modif(ll x,ll m){
return(powmod(x,m-2,m));
 
}
 
bool fa(vll &x,vll &y){return x[0]<y[0];}
bool fa1(vll &x,vll &y){return x[1]<y[1];}
bool f1(pll &x,pll &y){return x.second<y.second;}
bool f2(pll &x,pll &y){return x.first>y.first;}
bool f3(ll &x,ll &y){
    return x>y; 
    }

#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
#define pin(a) for(auto x:a)cout<<x<<" ";cout<<endl
#define fck(a) cout<<a;exit(0)
#define vvll vector<vector<ll> >
#define A(b) b.begin(),b.end()


//include<bits/stdc++.h>


int main()
{ fastio;
//freopen("input.txt", "r", stdin); 
//freopen("output.txt", "w", stdout);
 int x,y,z;cin>>x>>y>>z;
 cout<<z<<" "<<x<<" "<<y;


return 0;
}




Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define intl long long
void fastio()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
#endif
ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
}
int main()
{
	intl n;
	cin>>n;
	intl a[n+1][4];
	for(intl i=1;i<=n;i++)
	{
		for(intl j=1;j<=3;j++)
		{
			cin>>a[i][j];
		}
	}
	intl dp[n+1][4];
	dp[1][1]=a[1][1];
	dp[1][2]=a[1][2];
	dp[1][3]=a[1][3];
    if(n>1){
	for(intl i=2;i<=n;i++)
	{
		for(intl j=1;j<=3;j++)
		{
			if(j==1)
			{
				dp[i][j]=a[i][j]+max(dp[i-1][j+1],dp[i-1][j+2]);
			}
			if(j==2)
			{
				dp[i][j]=a[i][j]+max(dp[i-1][j-1],dp[i-1][j+1]);
			}
			if(j==3)
			{
				dp[i][j]=a[i][j]+max(dp[i-1][j-1],dp[i-1][j-2]);
			}

		}
        
        
	}
        cout<<max(dp[n][3],max(dp[n][2],dp[n][1]));
    }else{
    
         cout<<max(dp[n][3],max(dp[n][2],dp[n][1]));
	
    }
    // for(intl i=1;i<=n;i++)
    // {
    //     for(intl j=1;j<=3;j++)
    //     {
    //         cout<<dp[i][j]<<" ";
    //     }
    //     cout<<endl;
    // }

}

Measured memory_bytes: 9820
class Combination:
    """階乗とその逆元のテーブルをO(N)で事前作成し、組み合わせの計算をO(1)で行う"""
    def __init__(self, n, MOD):
        self.fact = [1]
        for i in range(1, n + 1):
            self.fact.append(self.fact[-1] * i % MOD)
        self.inv_fact = [0] * (n + 1)
        self.inv_fact[n] = pow(self.fact[n], MOD - 2, MOD)
        for i in reversed(range(n)):
            self.inv_fact[i] = self.inv_fact[i + 1] * (i + 1) % MOD
        self.MOD = MOD

    def inverse(self, k):
        """kの逆元を求める O(1)"""
        return (self.inv_fact[k] * self.fact[k - 1]) % self.MOD

    def factorial(self, k):
        """k!を求める O(1)"""
        return self.fact[k]

    def inverse_factorial(self, k):
        """k!の逆元を求める O(1)"""
        return self.inv_fact[k]

    def permutation(self, k, r):
        """kPrを求める O(1)"""
        if k < r:
            return 0
        return (self.fact[k] * self.inv_fact[k - r]) % self.MOD

    def combination(self, k, r):
        """kCrを求める O(1)"""
        if k < r:
            return 0
        return (self.fact[k] * self.inv_fact[k - r] * self.inv_fact[r]) % self.MOD

    def combination2(self, k, r):
        """kCrを求める O(r)
        kが大きいが、r <= nを満たしているときに使用
        """
        if k < r:
            return 0
        res = 1
        for l in range(r):
            res *= (k - l)
            res %= self.MOD
        return (res * self.inv_fact[r]) % self.MOD

n = int(input())
MOD = 10 ** 9 + 7
comb = Combination(10 ** 7, MOD)

all_ = pow(10, n, MOD)
not09 = pow(8, n, MOD)

only0 = 0
for i in range(1, n + 1):
    only0 += comb.combination(n, i) * pow(8, n - i, MOD)
    only0 %= MOD
print((all_ - not09 - 2 * only0) % MOD)

Measured memory_bytes: 241536
#include<stdio.h>
#include<string.h>

char stack[10000];
int top;

void push(char);
void pop(void);
int empty(void);

int main(void){
char str[101];
 int i,flag;
  while(1){
    scanf("%[^\n]%*c",str);
    if(str[0]=='.'&&strlen(str)==1)break;

    top=0;
    flag=1;
    for(i=0;i<strlen(str);i++){
      if(str[i]=='('||str[i]=='[')push(str[i]);
      else if((str[i]==')'&&stack[top-1]=='(')||(str[i]==']'&&stack[top-1]=='['))pop();
      else if((str[i]==')'||str[i]==']')&&empty()){flag=0;break;}
      else if(str[i]==']'&&stack[top-1]=='('){flag=0;break;}
      else if(str[i]==')'&&stack[top-1]=='['){flag=0;break;}
    }
    printf((flag && empty())?"yes\n":"no\n");
  }
  return 0;
}

void push(char x){
  stack[top]=x;
  top++;
}

void pop(void){
  top--;
}

int empty(void){
  return (top==0)?1:0;
}

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

using namespace std;

template<class T, class U>
void ckmin(T &a, U b)
{
	if (a > b) a = b;
}
template<class T, class U>
void ckmax(T &a, U b)
{
	if (a < b) a = b;
}

#define MP make_pair
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define FORD(i, a, b) for (auto i = (a) - 1; i >= (b); i--)
#define SZ(x) ((int) ((x).size()))
#define ALL(x) (x).begin(), (x).end()
#define INF 1000000007
#define LLINF 2696969696969696969ll
#define MAXN 100013

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;

int N, W;
ll dp[MAXN];
ll ans;

int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> N >> W;
	FOR(i, 0, N)
	{
		int x, y; cin >> x >> y;
		FORD(j, W + 1, 0)
		{
			if (j + x > W) continue;
			ckmax(dp[j + x], dp[j] + y);
		}
	}
	FORD(j, W + 1, 0)
	{
		ckmax(ans, dp[j]);
	}
	cout << ans << '\n';
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>>
using namespace std;
int main()
{
    int a,i,n,cnt=0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a;

    while(a%2==0){

        a/=2;
        cnt++;
    }
    }
    cout<<cnt;
    return 0;
}


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

using namespace std;


int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
    string s1, s2;
    cin >> s1;
    cin >> s2;
     for(int i = 0; i < (int)s1.size(); i++) {
     	if(s1[i] != s2[i]) {
     		cout << "No" << "\n";
          return 0;
     	}
     }
      cout << "Yes" << "\n";


   
   return 0;
}



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

# define pb push_back
# define fr first
# define sc second
# define mk make_pair

using namespace std;

const int inf = 1000000000 + 7;
const int N = 1e6 + 5;

typedef long long ll;

ll a, b;

int main()
{
    cin >> a >> b;

    if(abs(a - b) <= 1)
        cout << "Brown" << endl;
    else
        cout << "Alice" << endl;
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main {
	
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	long A = sc.nextLong();
    	long B = sc.nextLong();
    	long C = sc.nextLong();
    	if (0 < C-A-B && 4*A*B < (C-A-B)*(C-A-B)) {
    		System.out.println("Yes");
    	} else {
    		System.out.println("No");
    	}
    }
}

Measured memory_bytes: 23252
#include <cstdio>
#include <cstring>
const int N = 2e5 + 5;
char s[N];
int len, pre, cnt;
int main() {
	scanf("%s", s + 1), len = strlen(s + 1);
	for (int i = 1; s[i]; ++i) 
		if (s[i] == 'S') ++pre;
		else if (pre) --pre, ++cnt;
		
	printf("%d\n", len - cnt * 2);
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <vector>
#include <tuple>

using namespace std;

template <class T>
void print_vec(const vector<T>& v) {
  for (auto t = begin(v); t != end(v);) {
    cout << *t;
    if (++t != end(v)) {
      cout << " ";
    }
  }
  cout << endl;
}

struct Card {
  char type;
  int value;
  Card(char a, int b) : type(a), value(b) {}
  bool operator==(const Card& c) const {
    return c.type == type && c.value == value;
  }
};

ostream& operator<<(ostream& os, const Card& c) {
    os << c.type << c.value;
    return os;
}

vector<Card> bubbleSort(const vector<Card>& a, const int& n) {
  vector<Card> ret = a;
  bool flag = true;
  int count = 0;
  while (flag) {
    flag = false;
    for (int j = n-1; j > 0; j--) {
      if (ret[j].value < ret[j-1].value) {
        swap(ret[j], ret[j-1]);
        count++;
        flag = true;
      }
    }
  }
  return ret;
}

vector<Card> selectionSort(const vector<Card>& a, const int& n) {
  vector<Card> ret = a;
  int count = 0;
  int ms;
  for (int i = 0; i < n; i++) {
    ms = i;
    for (int j = i; j < n; j++) {
      if (ret[j].value < ret[ms].value) {
        ms = j;
      }
    }
    swap(ret[i], ret[ms]);
    if (ret[i].value != ret[ms].value) {
      count++;
    }
  }
  return ret;
}

int main(int ac, char **av) {
  int n;
  while (cin >> n, n) {
    vector<Card> a;
    for (int i = 0; i < n; i++) {
      char type;
      int x;
      cin >> type >> x;
      a.push_back(Card(type, x));
    }
    auto ret_b = bubbleSort(a, n);
    auto ret_s = selectionSort(a, n);
    print_vec(ret_b);
    cout << "Stable" << endl;
    print_vec(ret_s);
    if (ret_b.size() == ret_s.size() && ret_b == ret_s) {
      cout << "Stable" << endl;
    } else {
      cout << "Not stable" << endl;
    }
    n = 0;
  }
  return 0;
}

Measured memory_bytes: 3072