akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long
static const ll MAX = 1000000;
static const ll INFTY = 1e12;

struct edge {
    ll to, cost;
};

using Graph = vector<vector<int>>;
using _Graph = vector<vector<edge>>;


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

// 深さ優先探索
vector<bool> seen;
vector<int> colors;

int H, W, N;
int sx, sy, gx, gy; 
vector<vector<char>> field;
vector<vector<int>> dist;
//vector<pair<int, int>> gx, gy;
deque<pair<int, int>> que;

typedef vector<vector<int> > Matrix;

const int INF = 100000000;



int main() {

    // ll N;
    // cin >> N;
    // vector<ll> a(N);
    // REP(i, N){
    //     cin >> a[i];
    // }
    int X, Y, Z;
    cin >> X >> Y >> Z;

    swap(X, Y);
    swap(X, Z);
    cout << X << " " << Y << " " << Z;
 

}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/


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

using namespace std;

int main(void)
{
    int n,m;
    cin >>n >>m;

    vector<int> a;
    int sum = 0;
    for(int i = 0; i < n; i++){
        int tmp;
        cin >>tmp;
        sum += tmp;
        a.push_back(tmp);
    }
    int ct = 0;
    for(int i = 0; i < n; i++){
        if(a[i] >= (double)sum / 4 / m){
            ct++;
        }
    }
    if(ct >= m){
        printf("Yes\n");
    }else{
        printf("No\n");
    }

    return 0;
}

Measured memory_bytes: 256
# https://atcoder.jp/contests/abc140/tasks/abc140_b
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
satisfaction = 0
i0 = -2
for i in a:
    if i - i0 == 1:
        satisfaction += c[i - 2]
    satisfaction += b[i-1]
    i0 = i
print(satisfaction)


Measured memory_bytes: 3060
def main():
    A = [[int(i) for i in input().split()] for j in range(3)]
    from itertools import product
    for a1, a2, a3 in product(range(101), repeat=3):
        c1 = A[0][0] - a1 == A[1][0] - a2 == A[2][0] - a3
        c2 = A[0][1] - a1 == A[1][1] - a2 == A[2][1] - a3
        c3 = A[0][2] - a1 == A[1][2] - a2 == A[2][2] - a3
        if c1 and c2 and c3:
            return print("Yes")
    print("No")


if __name__ == '__main__':
    main()


Measured memory_bytes: 39880
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include <cmath>
#include <limits>
#include <utility>
#include <map>
#include <iomanip>
#include <queue>
#include <cctype>
#include <stack>
#include <random>
#include <list>
#include <numeric>
#include <chrono>
#include <set>


#define rep(i,p,q) for(ll i = p;i < q;i++)
#define ll long long

using namespace std;


const long long MAX_N = 1 << 17;

long long dat[2 * MAX_N - 1];

ll ecd(ll a, ll b) {
	if (a < b) swap(a, b);
	if (b == 0) return a;
	else {
		return ecd(b, a % b);
	}
}

ll pow(ll a, ll b) {
	vector<ll> d = vector<ll>((ll)(log(b)) + 2);
	d[0] = a;
	rep(i, 1, d.size()) d[i] = d[i - 1] * d[i - 1];
	ll ret = 1;
	rep(i, 0, log(b) + 1) {
		if (b & 1 << i) ret *= d[i];
	}
	return ret;
}

//L
vector<ll> a;
ll N;
vector<vector<vector<ll>>> dp;
vector<vector<vector<ll>>> vis;

//status == 0 なら太郎君,1なら次郎くん
ll rec(ll i, ll j, ll status) {
	if (i > j) return 0;

	if (vis[i][j][status] == 1) return dp[i][j][status];


	vis[i][j][status] = 1;

	if (status) {
		return dp[i][j][status] = min(rec(i, j - 1, !status) - a[j], rec(i + 1, j, !status) - a[i]);
	}
	else {
		return dp[i][j][status] = max(rec(i, j - 1, !status) + a[j], rec(i + 1, j, !status) + a[i]);
	}
}

int main(void) {
	cin >> N;
	a = vector<ll>(N);
	rep(i, 0, N) cin >> a[i];
	dp = vector<vector<vector<ll>>>(N, vector<vector<ll>>(N, vector<ll>(2,0)));
	vis = vector<vector<vector<ll>>>(N, vector<vector<ll>>(N, vector<ll>(2,0)));

	ll sum = 0;
	cout << rec(0,N-1,0) << endl;
}

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define rep(i,N) for(int i=0;i<N;i++)

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

  int N;
  cin>>N;
  string s;
  cout<<0<<endl;
  cout<<flush;
  cin>>s;
  int a;
  if(s=="Male")a=1;
  else if(s=="Female")a=0;
  else return 0;
  int l=0,r=N,m;
  for(int i=0;i<19;i++){
    m=(l+r)/2;
    cout<<m<<endl;
    cout<<flush;
    string S;
    cin>>S;
    int c;
    if(S=="Male")c=1;
    else if(S=="Female")c=0;
    else return 0;
    if(m%2){
      if(c==a)r=m;
      else l=m;
    }
    else{
      if(c==a)l=m;
      else r=m;
    }
  }
  return 0;
}


Measured memory_bytes: 852
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <cctype>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <complex>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cwchar>
#include <cwctype>
#include <exception>
#include <locale>
#include <numeric>
#include <new>
#include <stdexcept>
#include <limits>
#include <valarray>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <list>
#include <utility>
#include <bitset>
#include <algorithm>
#include <functional>
#define rep(i, n) for(int i = 0; i < (int)(n); i ++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i ++)
#define MP make_pair
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int INF = 1e9 + 7;

int main()
{
	LL a, b, c, k;
	scanf("%lld%lld%lld%lld", &a, &b, &c, &k);
	if(k & 1) printf("%lld\n", b - a);
	else printf("%lld\n", a - b);
	return 0;
}

Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
    // 1行目がinput[0], 2行目がinput[1], …に入る
    input = input.split("\n");
    tmp0 = input[0].split(" ");
    n = Number(tmp0[0]);

    if(n==1){console.log('Hello World');
             }
    else{tmp1 = input[1].split(" ");
         a = Number(tmp1[0]);
         tmp2 = input[2].split(" ");   
         b = Number(tmp2[0]);
         console.log(a+b);}
}
       
    
  //*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
  Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7496
#include<cstdio>
#include<algorithm>
#include<list>
#include<iterator>
#include<cmath>
using namespace std;

long long a[211111];
long long b[211111];
long long c = 0;

long long p1 = 0;
long long p2 = 0;

list<long long>old;

list<long long>ans;

int main()
{
	long long n;
	scanf("%lld", &n);

	for (long long i = 0; i < n; i++)
	{
		scanf("%lld", &a[i]);
	}

	sort(a, a + n);
	
	for (long long i = 0; i < n; i++)
	{
		old.push_back(a[i]);
	}

	//放入最小
	ans.push_back(old.front());
	old.pop_front();
	n--;

	bool turn = true;//回头 大  ，否则 小
	while (n >= 2)
	{
		if (turn)
		{
			turn = false;
			ans.push_front(old.back());
			old.pop_back();
			n--;

			ans.push_back(old.back());
			old.pop_back();
			n--;
		}

		else
		{
			turn = true;
			ans.push_front(old.front());
			old.pop_front();
			n--;

			ans.push_back(old.front());
			old.pop_front();
			n--;
		}

	}

	if (n == 1)
	{
		ans.push_front(old.front());
	}

	for (auto it = ans.begin(); it != ans.end(); it++)
	{
		b[c++] = (*it);
	}

	for (long long i = 0; i < c - 1; i++)
	{
		long long k = b[i] - b[i + 1];

		if (k > 0)
			p1 += k;
		else
			p1 -= k;
	}


	while (!ans.empty())
		ans.pop_back();

	while (!old.empty())
		old.pop_back();


	n = c;
	c = 0;

	for (long long i = 0; i < n; i++)
	{
		old.push_back(a[i]);
	}

	//放入最大
	ans.push_back(old.back());
	old.pop_back();
	n--;

	turn = true;//回头 小  ，否则 大
	while (n >= 2)
	{
		if (turn)
		{
			turn = false;
			ans.push_front(old.front());
			old.pop_front();
			n--;

			ans.push_back(old.front());
			old.pop_front();
			n--;
		}

		else
		{
			turn = true;
			ans.push_front(old.back());
			old.pop_back();
			n--;

			ans.push_back(old.back());
			old.pop_back();
			n--;
		}

	}

	if (n == 1)
	{
		ans.push_front(old.front());
	}

	for (auto it = ans.begin(); it != ans.end(); it++)
	{
		b[c++] = (*it);
	}

	for (long long i = 0; i < c - 1; i++)
	{
		long long k = b[i] - b[i + 1];

		if (k > 0)
			p2 += k;
		else
			p2 -= k;
	}


	printf("%lld\n", max(p1, p2));

	return 0;
}


Measured memory_bytes: 4992
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;

//---

template <typename T>
inline void print(const T& rhs){ std::cout<<" = "<<rhs<<std::endl; }
template <typename T>
inline void print(const std::vector<T>& rhs){
    std::cout<<" = [ ";
    for(uint i=0; i<rhs.size(); ++i){ std::cout<<rhs[i]<<' '; }
    std::cout<<"]"<<std::endl;
}
template <typename T>
inline void print(const std::vector<std::vector<T>>& rhs){
    std::cout<<" = "<<std::endl;
    std::cout<<"[[ ";
    for(uint p=0; p<rhs.size(); ++p){
        if(p!=0){ std::cout<<" [ "; }
        for(uint q=0; q<rhs[p].size(); ++q){
            std::cout<<rhs[p][q]<<' ';
        }
        if(p!=rhs.size()-1){ std::cout<<"]"<<std::endl; }
    }
    std::cout<<"]]"<<std::endl;
}
#define printn(var) {printf("%s", #var);print(var);}
#define printn_all(var) {printf("%s(%d): ", __func__, __LINE__);printf("%s", #var);print(var);}

//---

template<typename T>
vector<pair<int, T>> continuousLen(const vector<T>& v){
    
    vector<pair<int, T>> vRet; vRet.push_back(make_pair(1, v[0]));
    T prev = v[0];
    for(uint i=1; i<v.size(); ++i){
        if(prev!=v[i]){ vRet.push_back(make_pair(1, v[i])); prev=v[i]; continue; }
        ++(vRet[vRet.size()-1].first);
    }
    sort(vRet.begin(), vRet.end(), greater<pair<int,T>>());
    return vRet;
}

int main(){
//    ios_base::sync_with_stdio(false);
//    cin.tie(NULL);
    
    int n; cin >> n;
    int nd2 = n/2; // n div 2
    
    vector<int> vO(nd2); // odd
    vector<int> vE(nd2); // even
    for(int i=0; i<nd2; ++i){
        cin >> vO[i];
        cin >> vE[i];
    }
    sort(vO.begin(), vO.end());
    sort(vE.begin(), vE.end());
    
    vector<pair<int, int>> vCL_o = continuousLen(vO);
    vector<pair<int, int>> vCL_e = continuousLen(vE);
    
    int len_o = vCL_o[0].first;
    int len_e = vCL_e[0].first;
    int len_o1 = vCL_o[1].first;
    int len_e1 = vCL_e[1].first;
    int val_o = vCL_o[0].second;
    int val_e = vCL_e[0].second;
    int ans;
    if(val_o != val_e){
        ans = n - len_o - len_e;
    }else{
        int ans1 = n - len_o1 - len_e;
        int ans2 = n - len_o  - len_e1;
        ans = min(ans1, ans2);
    }
    cout << ans << endl;
    
    return 0;
}

/*
6
1 1 1 2 2 2
2
*/

Measured memory_bytes: 1784
#!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase


#a=[int(x) for x in input().split()]
#n=int(input())

def main():
    s=input()
    t=input()
    print("Yes" if s==t[:-1] else "No")


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()

Measured memory_bytes: 62528
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string a,b,c;
    cin >> a >> b >> c;
    int count_a,count_b,count_c;
    count_a=a.size();
    count_b=b.size();
    count_c=c.size();
    int point_a=0;
    int point_b=0;
    int point_c=0;
    char judge=a.at(0);
    while(1){
        if(judge=='a'){
            if(count_a==0){
                cout << "A" << endl;
                break;
            }
            count_a--;
            judge=a.at(point_a);
            point_a++;
            continue;
        }
        if(judge=='b'){
            if(count_b==0){
                cout << "B" << endl;
                break;
            }
            count_b--;
            judge=b.at(point_b);
            point_b++;
            continue;
        }
        if(judge=='c'){
            if(count_c==0){
                cout << "C" << endl;
                break;
            }
            count_c--;
            judge=c.at(point_c);
            point_c++;
            continue;
        }
    }
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e16+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define eb(x) emplace_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

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

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);

    ll n,x;
    cin>>n>>x;
    Vec v(n);
    rep(i,n){
        ll tmp;
        cin>>tmp;
        v[i] = abs(tmp-x);
    }

    ll ans = v[0];
    rep(i,n){
        if(i==0)continue;
        ans = __gcd(ans,v[i]);
    }

    cout<<ans<<endl;
    return  0;
}


Measured memory_bytes: 1024
N = int(raw_input())
a = map(int, raw_input().split())

sum1 = a[0]
sum2 = sum(a[1:])
diff = [abs(sum1-sum2)]
for i in range(1,N-1):
  sum1 += a[i]
  sum2 -= a[i]
  diff.append(abs(sum1-sum2))

# diff = [abs(sum(a[select:])-sum(a[:select])) for select in range(1,N)]
print min(diff)

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

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    cout << (a*b % 2 == 0 ? "No" : "Yes") << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;

#define F first
#define S second
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define sz size()
#define all(A)    A.begin(), A.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define f0(i,b)   for(int i=0;i<(b);i++)
#define f1(i,b)   for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))
#define mod 1000000007

#define forr(i,n)    for(i=0; i<n; i++)
#define whilee(i,t)  while(i!=t)
#define  sl(a)  scanf("%lld",&a)
#define  pl(a)  printf("%lld",a)

//for(auto it =A.begin(); it!=A.end(); it++)
//sort(A.begin(),A.end());
//binary_search(A.begin(),A.end(),x);
//reverse(A.begin(), A.end());
//cout << *max_element(A.begin(), A.end());
//cout << *min_element(A.begin(), A.end());
//count(A.begin(), A.end(), X); //counts the occurrences of X
//distance(A.begin(),A.end());  //distance between first to last element
//accumulate(A.begin(), A.end(), 0); //add
//next_permutation(A.begin(), A.end());
//prev_permutation(A.begin(), A.end());
//swap(S[0], T[0]);
//scanf("%d",&x);
//printf("%d\n",x);

//vector <int> A;
//deque <int> A;
//queue <int> A;
//stack <int> A;
//set <int> A;
//map <int,int> A;
//pair <int,int> A ;
//vector <pair <int,int>> A ;
//char ch;
string S, T, U;
ll i, j, k, a, b, c, d, f, g, h, l, m, n, p, q, r, s, t, w, x, y, z, maxx=INT_MIN, minn=INT_MAX, ans=0, sum=0, cnt=0;

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

    cin>>t;
    int A[3];
    forr(i,t)
    {
        cin>>A[0]>>A[1]>>A[2];
        sort(A,A+3);
        if((A[2]*A[2])==(A[0]*A[0]+A[1]*A[1]))
        {
           cout<<"YES"<<endl;
        }
        else
        {
            cout<<"NO"<<endl;
        }
    }

    return 0;
}



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

int main() {
  char c;
  cin >> c;

  if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o' ) {
    cout << "vowel" << endl;
  } else {
    cout << "consonant" << endl;
  }
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
int A[200005]={0};
int main(){long n;cin>>n;int ans=1;int z=1;
  for(int i=1;i<=n;i++){int p;cin>>p; A[p]=i;}
  int r=A[1];
  for(int i=2;i<=n;i++){if(A[i]>r){z++;if(ans<z)ans=z;}else{if(ans<z){ans=z;}z=1;}r=A[i];}
  cout<<n-ans<<endl;}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define downque(que) priority_queue<ll> que;
#define upque(que) priority_queue<ll, vector<int>, greater<int>> que;
typedef long long ll;
typedef vector<vector<int>> Matrix;
const int MOD = 1e9 + 7;
const int MAX = 1e7;
const int INF = numeric_limits<int>::max();


int main(){
  ll n, k;
  cin >> n >> k;
  vector<ll> h(n);
  REP(i, n)
      cin >> h[i];
  
  sort(ALL(h));
  reverse(ALL(h));

  ll res = 0;

  FOR(i, k, n){
    res += h[i];
  }
  cout << res << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(int)(a); i!=(int)(b); i++)
#define RFOR(i, a, b) for(int i=(int)(a); i!=(int)(b); i--)
#define REP(i, n) FOR(i, 0, n)
using namespace std;
using ll = long long;

int dis(int a, int b){
  return min(abs(a-b), 24-abs(a-b));
}

int main(){
  int n; cin >> n;
  int d[n], ci[13]{}, cl[24]{};
  ci[0] = 1;
  REP(i, n){
    cin >> d[i];
    ci[d[i]]++;
  }

  int ans = 0;
  REP(i, 1<<13){
    bitset<13> b(i);

    //2^11のパターンを構築
    memset(cl, 0, sizeof(cl));
    REP(j, 13){
      if(ci[j] == 1){
        if(b[j]) cl[j] = 1;
        else cl[(24-j)%24] = 1;
      }
      else if(ci[j] == 2){
        if(j == 0 || j == 12){
          cout << 0 << endl;
          return 0;
        }
        cl[j] = cl[(24-j)%24] = 1;
      }
      else if(ci[j] > 2){
        cout << 0 << endl;
        return 0;
      }
    }

    //実際に最小値を計算
    int t = 24;
    REP(j, 24)REP(k, 24){
      if(j != k && cl[j] && cl[k]){
        t = min(t, dis(j, k));
      }
    }

    ans = max(t, ans);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
	
	
		if(a > b){
			System.out.println("a > b");
		}else if(a < b){
			System.out.println("a < b");
		}else{
			System.out.println("a == b");
		}
	}
}

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

#define pb push_back
#define fi first
#define se second
#define eb emplace_back

using namespace std;

typedef pair<int, int> ii;
typedef long long ll;
const int N = 1000007, inf = 0x3f3f3f3f;

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

	vector<ll> fact;
	ll n; cin >> n;
	ll aux = n;

	for(ll i = 2; i * i <= aux; i++) {
		while(n%i == 0) {
			fact.pb(i);
			n /= i;
		}
	}

	if(n > 1) fact.pb(n);

	n = aux;

	sort(fact.begin(), fact.end());
	fact.erase(unique(fact.begin(), fact.end()), fact.end());

	ll ans = 0;
	for(ll x : fact) {
		ll cur = x;
		while(n%cur == 0) {
			ans++;
			n/=cur;
			cur *= x;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 3660
#include<stdio.h>
int main()
{
	int n,a[100000],b,i,cnt;
	b=0;
	cnt=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	for(i=0;i<n-1;i++){
		if(a[i]>=a[i+1]){
			cnt++;
			if(b<=cnt) b=cnt;
		}
		else{ 
		cnt=0;
		}
	}
	printf("%d\n",b);
	return 0;
}

Measured memory_bytes: 2080
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
int n,arr[200001],ans;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    for (int x=1;x<=100;x++){
        for (int y=1;y<=100;y++){
            for (int z=1;z<=100;z++){
                long long cur=x*x;
                cur+=y*y;
                cur+=z*z;
                cur+=x*y;
                cur+=y*z;
                cur+=x*z;
                arr[cur]++;
            }
        }
    }
    for (int i=1;i<=n;i++){
        cout<<arr[i]<<'\n';
    }
}

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

using namespace std;
typedef pair<int,int> pii;
typedef long long int ll;

#define INF 1 << 30
#define REP(i,n) for(ll i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(ll i=(k);i<(int)(n);i++)



vector<bool> gen_sosuu(vector<bool> sosuu){
  int size = sosuu.size();
  REP(i,size){
    sosuu[i] = true;
  }
  sosuu[0] = false;
  sosuu[1] = false;
  sosuu[2] = true;
  FOR(i,2,sqrt(size)+1){
    if(sosuu[i] == false) continue;
    for(int j = 2; i*j<size;j++){
      sosuu[i*j] =false;
    }
  }
  return sosuu;
}

int n;
ll a[100000];
ll cnt = 0;

int main(){
  cin >> n;
  REP(i,n) cin >>a[i];
  cnt += a[0]/2;
  a[0] = a[0]%2;
  FOR(i,1,n){
    cnt += (a[i]+a[i-1])/2;
    if(a[i]!=0) a[i] = (a[i]+a[i-1])%2;
    else a[i] = 0;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int sig(ll x) {
    if(x > 0) return 0;
    else if(x == 0) return 1;
    return 2;
}

int main(){
    int N, M;
    cin >> N >> M;
    vl x(N), y(N), z(N);
    rep(i, N) cin >> x[i] >> y[i] >> z[i];
    
    ll ans = 0LL;
    rep(mask, 1<<3) {
        priority_queue<ll> q;
        rep(i, N) {
            ll tmp = 0LL;
            if(mask & 1) tmp += x[i]; else tmp -= x[i];
            if(mask & 2) tmp += y[i]; else tmp -= y[i];
            if(mask & 4) tmp += z[i]; else tmp -= z[i];
            q.push(tmp);
        }
        ll tmp = 0LL;
        rep(i, M) {
            tmp += q.top();
            q.pop();
        }
        ans = max(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long LL;
template <typename F, typename S> std::ostream& operator<<(ostream& os, const pair<F,S>& p) {
    os << "(" << p.first << "," << p.second << ")"; return os; }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "["; for(const T& a: v){ os << a << ", "; } os << "]"; return os; }
template <typename K, typename V> ostream& operator<<(ostream& os, const map<K,V>& m) {
    os << "{"; for(const auto& p: m){ os << p.first <<":"<< p.second << ", "; } os << "}"; return os; }


// 剰余演算クラス
struct ModInt{
    static const LL MOD = 998244353;
    LL v;
    ModInt():v(0){}
    ModInt(LL op):v(op){}
    ModInt operator+(ModInt op) const{ return (v + op) % MOD; }
    ModInt operator-(ModInt op) const{ return (v - op + MOD) % MOD; }
    ModInt operator*(ModInt op) const{ return (v * op) % MOD; }
    ModInt operator/(ModInt op) const{ return (v * op.inverse()) % MOD; }
    ModInt operator%(LL op) = delete;
    ModInt operator+=(ModInt op){ return v = (v + op) % MOD; }
    ModInt operator-=(ModInt op){ return v = (v - op + MOD) % MOD; }
    ModInt operator*=(ModInt op){ return v = (v * op) % MOD; }
    ModInt operator/=(ModInt op){ return v = (v * op.inverse()) % MOD; }
    ModInt operator-() const{ return MOD - v; }
    bool operator==(ModInt op) const{ return v == op.v; }
    bool operator!=(ModInt op) const{ return v != op.v; }
    ModInt inverse() const{ return pow(MOD-2); }
    ModInt pow(LL n) const{
        if(n < 0) return pow(MOD-1 + n);
        if(n == 0) return 1;
        ModInt res = pow(n/2);
        return res * res * ((n&1)?ModInt(v): ModInt(1));
    }
    LL get() const{ return v; }
private:
    operator LL() const{ return v; }
};
istream& operator>>(istream& st, ModInt& m){ st>>m.v; return st; }
ostream& operator<<(ostream& st, const ModInt& m){ st<<m.v; return st; }

ModInt solve(LL n, vector<pair<LL,LL>>& robot){
    sort(robot.begin(), robot.end(), greater<pair<LL,LL>>());
    multimap<LL,ModInt> rest;
    for(auto r: robot){
        LL x = r.first;
        LL d = r.second;
        auto end = rest.lower_bound(x+d);
        ModInt cnt = 1;
        for(auto it = rest.lower_bound(x); it != end;){
            cnt *= it->second;
            it = rest.erase(it);
        }
        cnt += ModInt(1);
        rest.insert(pair<LL,ModInt>(x, cnt));
    }
    ModInt ans = 1;
    for(auto p: rest){
        ans *= p.second;
    }
    return ans;
}

int main(){
    LL n;
    cin >> n;
    vector<pair<LL,LL>> robot(n);
    for(LL i = 0; i < n; ++i){
        cin >> robot[i].first >> robot[i].second;
    }
    cout << solve(n, robot) << endl;
    return 0;
}



Measured memory_bytes: 9600
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            int n;
            List<List<int>> s = new List<List<int>>();

            while ((n = int.Parse(Console.ReadLine())) != 0)
            {
                List<int> score = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
                s.Add(score);         
            }

            for (int i = 0; i < s.Count(); i++)
            {
                double m = s[i].Average();
                double alpha_2 = 0;
                for (int j = 0; j < s[i].Count(); j++)
                {
                     alpha_2 += Math.Pow(s[i][j]-m,2); 
                }
                double v = Math.Sqrt(alpha_2 / s[i].Count());
                Console.WriteLine(v);
            }
        }
    }
}


Measured memory_bytes: 20352
#include<stdio.h>

#define MAX 100
#define INFTY 9999999
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n,M[MAX][MAX];
int i,v,j;

void dijkstra() {
  int minv;
  int d[MAX],color[MAX];

  for(i=0;i<n;i++){
    d[i] = INFTY;
    color[i] = WHITE;
  }

  d[0] = 0;
  color[0] = GRAY;
  while(1){
    minv = INFTY;
    int u = -1;
    for(i=0;i<n;i++){
      if(minv>d[i] && color[i] != BLACK){
	u = i;
	minv = d[i];
      }
    }
    if(u == -1) break;
    color[u] = BLACK;
    for(v=0;v<n;v++){
      if(color[v]!=BLACK&&M[u][v]!=INFTY){
	if(d[v]>d[u] + M[u][v]){
	  d[v] = d[u] + M[u][v];
	  color[v] = GRAY;
	}
      }
    }
  }

  for(i=0;i<n;i++){
    printf("%d %d\n",i,d[i] == INFTY ? -1 : d[i]);
  }
}

int main(){
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      M[i][j] = INFTY;
    }
  }

  int k,c,u,v;
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d%d",&v,&c);
      M[u][v]=c;
    }
  }

  dijkstra();

  return 0;
}



Measured memory_bytes: 2104
import qualified Data.Array.IArray as IA
import Data.Array.ST
import Control.Monad
import Control.Applicative
import Control.Monad.ST

type Graph = IA.Array Int [Int]
type Result = IA.Array Int Int
type STResult s = STArray s Int Int

main :: IO ()
main = do
  n <- readLn :: IO Int
  ns <- replicateM n $ do
    (n:_:ns') <- getInts
    return (n, ns')
  let g = makeGraph n ns
  mapM_ putStrLn $ res2str $ solve n g

getInts :: IO [Int]
getInts = map read . words <$> getLine

makeGraph :: Int -> [(Int, [Int])] -> Graph
makeGraph n = IA.accumArray (++) [] (1, n)  

res2str :: Result -> [String]
res2str res = map (\i ->
                     show i
                     ++ " "
                     ++ show (let r = res IA.! i in
                                 if r == n+1
                                 then (-1)
                                 else r))
              [1..n]
              where
                n = snd (IA.bounds res)

solve :: Int -> Graph -> Result
solve n graph = runSTArray $ do
  res <- newArray (1, n) (n+1) 
  bfs 1 0 res
  return res
  where
    bfs :: Int -> Int -> STResult s -> ST s Int
    bfs current depth res
      | depth == (n+1) = return current
      | otherwise = do
          writeArray res current depth
          cs <- filterM
                (\i -> do
                    s <- readArray res i
                    return (s > depth)) $ graph IA.! current
          if null cs
            then return current
            else do
            mapM_ (\i -> bfs i (depth+1) res) cs
            return current

Measured memory_bytes: 5580
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define MOD 1000000007
#define ll long long int
#define pair <ll, ll> pi
#define vector <ll> vi
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define SQ(a) (a) * (a)
#define ordered_set tree<ll, null_type, greater_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> //greater_equal<ll> or less<ll>
// find_by_key()   order_of_key()
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
/*bool comp(string a, string b) {
if (a.size() != b.size()) return a.size() < b.size();
return a < b;
}*/

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    //freopen('input.txt', 'r', stdin);
    //freopen('output.txt', 'w', stdout);
    ll i, j, k=-1, n, m, b, d, t, ans = 0,x,y;
    cin>>t;
    ll a[t];
    rep(i,0,t-1){
        cin>>n;
        ans+=n;
        a[i]=n;
    }
    sort(a,a+t);
    rep(i,0,t-1){
        if(a[i]%10!=0){
            k=a[i];
            break;
        }
    }
    if(ans%10!=0){
        cout<<ans<<endl;
    }
    else{
        if(k!=-1){
            cout<<ans-k<<endl;
        }
        else{
            cout<<0<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define l long
#define pb push_back
#define mp make_pair
#define mt make_tuple
int main() {
	// your code goes here
	//ifstream cin("input.txt");
	//ofstream cout("output.txt");
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
	string s; cin>>s;
	int a[4];
	for(int i=0;i<4;i++) a[i]=s[i];
	sort(a,a+4);
	if(a[0]==a[1] && a[2]==a[3] && a[1]!=a[2]) cout<<"Yes";
	else cout<<"No";
	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(N: int):
    if (N % 2 == 0):
        print(0.5)
    else :
        print((N + 1)/2/N)
    return 




# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include<cstdio>
#include<iostream>
using namespace std;
const int maxn=1000+10;
int main(){
	char a[4];
	cin>>a;
	int ok1=0,ok2=0;
	for(int i=0;i<3;i++){
		if(a[i]=='A'){
			ok1=1;
		}
		if(a[i]=='B'){
			ok2=1;	
		}
	}
	if(ok1&&ok2){
		cout<<"Yes";
	}
	else cout<<"No";
	return 0;
}

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

int main(){
    double a, b, c, h, m;
    cin >> a >> b >> h >> m;
    const double pi = 3.141592653589793;

    double theta, theta_h, theta_m;
    theta_h = (30.0 * h + 0.5 * m) * 2.0 * pi /360.0 ;
    theta_m = (6.0 * m) * 2.0 * pi / 360.0;
    theta = abs(theta_h - theta_m);

    double a_pow, b_pow, cos_theta, term_3;
    a_pow = pow(a, 2.0);
    b_pow = pow(b, 2.0);
    cos_theta = cos(theta);
    term_3 = 2.0 * a * b * cos_theta;
    c = sqrt(a_pow + b_pow - term_3);
    cout << fixed << setprecision(10) << c << endl;
    return 0;
}

Measured memory_bytes: 4228
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1000000007;

void extended_euclid(ll x,ll y,ll *c,ll *a,ll *b){
  ll a0,a1,a2,b0,b1,b2,r0,r1,r2,q;r0=x;r1=y;a0=1;a1=0;b0=0;b1=1;
  while(r1>0){q=r0/r1;r2=r0%r1;a2=a0-q*a1;b2=b0-q*b1;r0=r1;r1=r2;a0=a1;a1=a2;b0=b1;b1=b2;}
  *c=r0;*a=a0;*b=b0;
}

ll get_inv(ll n, ll p){
  ll a,b,c;
  extended_euclid(n,p,&c,&a,&b);
  if(a<p) a+=p;
  return a%p;
}

int main() {
  ll n;
  cin >> n;
  ll a[n];
  for(int i=0; i<n; i++) cin >> a[i];
  ll ans=0,d=1,sum=0;
  for(int i=1; i<n; i++) {
    d*=i;
    d%=mod;
  }
  for(int i=1; i<n; i++) {
    sum+=d*get_inv(i,mod);
    sum%=mod;
    ans+=sum*(a[i]-a[i-1]);
    ans%=mod;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef double db;
#define go(u) for(int i = head[u], v = e[i].to; i; i=e[i].lst, v=e[i].to)
#define rep(i, a, b) for(int i = a; i <= b; ++i)
#define pb push_back
#define re(x) memset(x, 0, sizeof x)
inline int gi() {
    int x = 0,f = 1;
    char ch = getchar();
    while(!isdigit(ch)) { if(ch == '-') f = -1; ch = getchar();}
    while(isdigit(ch)) { x = (x << 3) + (x << 1) + ch - 48; ch = getchar();}
    return x * f;
}
template <typename T> inline bool Max(T &a, T b){return a < b ? a = b, 1 : 0;}
template <typename T> inline bool Min(T &a, T b){return a > b ? a = b, 1 : 0;}
const int N = 1e5 + 7;
int A, B, C;
LL f[N], g[N], sum;
struct data {
	int a, b, c;
	bool operator <(const data &rhs) const {
		return a - b > rhs.a - rhs.b;
	}
}d[N];
priority_queue<int, vector<int>, greater<int> > S;
int main() {
#ifndef ONLINE_JUDGE
//	freopen("data.in", "r", stdin);
#endif
	A = gi(), B = gi(), C = gi();
	rep(i, 1, A + B + C) d[i].a = gi(), d[i].b = gi(), d[i].c = gi();
	sort(d + 1, d + 1 + A + B + C);
	rep(i, 1, A) S.push(d[i].a - d[i].c), sum += d[i].a;
	f[A] = sum;
	rep(i, A + 1, A + C) {
		sum += d[i].c;
		if(S.top() < d[i].a - d[i].c) {
			sum += d[i].a - d[i].c - S.top();
			S.pop();
			S.push(d[i].a - d[i].c);
		}
		f[i] = sum;
	}
	sum = 0;
	while(!S.empty()) S.pop();
	
	for(int i = A + B + C; i > A + C; --i) S.push(d[i].b - d[i].c), sum += d[i].b;
	g[A + C + 1] = sum;
	for(int i = A + C; i > A; --i) {
		sum += d[i].c;
		if(S.top() < d[i].b - d[i].c) {
			sum += d[i].b - d[i].c - S.top();
			S.pop();
			S.push(d[i].b - d[i].c);	
		}
		g[i] = sum;
	}
	LL ans = 0;
	rep(i, A, A + C) {
		Max(ans, f[i] + g[i + 1]);
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
#define MAX 1000004
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
#define fin ios_base::sync_with_stdio(false); cin.tie(NULL);
int main()
{fin;

  int n,i;
  cin>>n;
  int a[n],b[n],c[n],dpa[n],dpb[n],dpc[n];
  for(i=0;i<n;i++)
    cin>>a[i]>>b[i]>>c[i];
  dpa[0]=a[0];
  dpb[0]=b[0];
  dpc[0]=c[0];
  for(i=1;i<n;i++)
  {
    dpa[i]=a[i]+max(dpb[i-1],dpc[i-1]);
    dpb[i]=b[i]+max(dpa[i-1],dpc[i-1]);
    dpc[i]=c[i]+max(dpb[i-1],dpa[i-1]);
  }
  int val=max(dpa[n-1],max(dpb[n-1],dpc[n-1]));
  cout<<val;
}


Measured memory_bytes: 2560
#include<iostream>
#include<vector>
#define MAX 10
using namespace std;

struct Point{
	int x,y;
	Point():x(0),y(0){}
	bool operator==(const Point &p){
		return (x == p.x && y == p.y);
	}
};

inline Point Rotate90(const Point &p){
	Point ret;
	ret.x = -p.y;
	ret.y = p.x;
	return ret;
}


struct Polygon{
	int maxv;
	Point vertex[MAX];
	Polygon(){}
	Polygon(int m):maxv(m){}
	Polygon Rotate90(){
		Polygon ret(maxv);
		for(int i = 0; i < maxv; ++i){
			ret.vertex[i] = ::Rotate90(vertex[i]);
		}
		return ret;
	}
	Polygon Translation(int from_vertex, const Polygon &target, int to_vertex){
		Polygon ret = *this;
		int dx = target.vertex[to_vertex].x - vertex[from_vertex].x;
		int dy = target.vertex[to_vertex].y - vertex[from_vertex].y;

		for(int i = 0; i < maxv; ++i){
			ret.vertex[i].x += dx;
			ret.vertex[i].y += dy;
		}
		return ret;
	}
	bool operator==(const Polygon &p){
		Polygon t = p;

		if( maxv != t.maxv )
			return false;
		
		for(int r = 0; r < 4; ++r){
			for(int i = 0; i < maxv; ++i){
				for(int j = 0; j < maxv; ++j){
					bool bSame = true;
					Polygon s = t.Translation( j, *this, i );
					for(int k = 0; k < maxv; ++k){
						if( !(s.vertex[k] == this->vertex[k]) ){
							bSame = false;
							break;
						}
					}
					if( bSame )
						return true;

					// reverse order
					bSame = true;
					for(int k = 0; k < maxv; ++k){
						if( !(s.vertex[maxv-1-k] == this->vertex[k]) ){
							bSame = false;
							break;
						}
					}
					if( bSame )
						return true;
				}
			}
			t = t.Rotate90();
		}
		return false;
	}
};

int main(){
	while(true){
		int n;
		scanf("%d", &n);
		
		if(n==0)break;

		vector< int > vAnss(n+1,0);
		vector< Polygon > vPols;
		vPols.reserve( n+1 );

		for(int i = 0; i <= n; ++i){
			int m;
			scanf("%d", &m);
			
			Polygon pol(m);
			for(int j = 0; j < m; ++j){
				scanf("%d%d", &pol.vertex[j].x, &pol.vertex[j].y);
			}
			vPols.push_back( pol );
		}

		for(int i = 1; i <= n; ++i){
			if( vPols[0] == vPols[i] ){
				vAnss[i] = 1;
			}
		}

		for(int i = 1; i <= n; ++i){
			if( vAnss[i] ){
				printf("%d\n", i);
			}
		}
		
		printf("+++++\n");
	}
	return 0;
}

Measured memory_bytes: 0
import sys


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

for i in range(n - 1, 0, -1):
    if h[i - 1] > h[i]:
        h[i - 1] -= 1
    if h[i - 1] > h[i]:
        print('No')
        sys.exit()
print('Yes')


Measured memory_bytes: 14396
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        
        for(int i = 0; i < 3; i++){
            if(n.charAt(i) == '1'){
                System.out.print(9);
            }else{
                System.out.print(1);
            }
        }
    }
}


Measured memory_bytes: 22608
module Main where
import Control.Monad
import Control.Applicative
import Data.Maybe
import Data.List
import qualified Text.Printf
import qualified Data.ByteString.Char8 as BC
import qualified Data.ByteString as BC

------------------------------------------

main :: IO ()
main = do
  [k, s] <- readInts
  let twoSums = [max 0 $ min (x+1) (2*k+1-x) | x <- [0..s]]
  print $ sum $ drop (s-k) twoSums

------------------------------------------

{- Int input -}

parseInt :: BC.ByteString -> Int
parseInt = fst . fromJust . BC.readInt

parseInts :: BC.ByteString -> [Int]
parseInts = map parseInt <$> BC.words

readInt :: IO Int
readInt = parseInt <$> BC.getLine

readInts :: IO [Int]
readInts = parseInts <$> BC.getLine

{- Double Formatting -}

doubleFmt :: Double -> String
doubleFmt = Text.Printf.printf "%.12f"


Measured memory_bytes: 892
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
from pprint import pprint
from copy import deepcopy
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce
from pprint import pprint


sys.setrecursionlimit(2147483647)
INF = 10 ** 15
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


class Dinic():
    def __init__(self, G, source, sink):
        self.G = G
        self.sink = sink
        self.source = source

    def add_edge(self, u, v, cap):
        self.G[u][v] = cap
        self.G[v][u] = 0

    def bfs(self):
        level = defaultdict(int)
        q = [self.source]
        level[self.source] = 1
        d = 1
        while q:
            if level[self.sink]:
                break
            qq = []
            d += 1
            for u in q:
                for v, cap in self.G[u].items():
                    if cap == 0:
                        continue
                    if level[v]:
                        continue
                    level[v] = d
                    qq += [v]
            q = qq
        self.level = level

    def dfs(self, u, f):
        if u == self.sink:
            return f
        for v, cap in self.iter[u]:
            if cap == 0 or self.level[v] != self.level[u] + 1:
                continue
            d = self.dfs(v, min(f, cap))
            if d:
                self.G[u][v] -= d
                self.G[v][u] += d
                return d
        return 0

    def max_flow(self):
        flow = 0
        while True:
            self.bfs()
            if self.level[self.sink] == 0:
                break
            self.iter = {u: iter(self.G[u].items()) for u in self.G}
            while True:
                f = self.dfs(self.source, INF)
                if f == 0:
                    break
                flow += f
        return flow

h, w = LI()
s = SR(h)
G = defaultdict(lambda:defaultdict(int))
for i in range(h):
    for j in range(w):
        if s[i][j] == 'o':
            G[i][h + j] = 1
            G[h + j][i] = 1
        elif s[i][j] == 'S':
            G[h + w][i] = INF
            G[h + w][h + j] = INF
        elif s[i][j] == 'T':
            G[i][h + w + 1] = INF
            G[h + j][h + w + 1] = INF

ans = Dinic(G, h + w, h + w + 1).max_flow()
print(ans if ans < INF else -1)


Measured memory_bytes: 49884
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define int ll
typedef pair<int,int> pii;
#define fi first
#define se second
#define Sort(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/4
#define INTINF INT_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
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;}
/*----------------------------------------------------------------*/
const int MOD = 998244353;
// const int MOD = 1000000007;

/*----------------------------------------------------------------*/
signed main(){

	
	string s;
	cin >> s;
	int n = s.size();
	int a;
	rep(i,n){
		if(s[i] == 'A'){
			a = i;
			break;
		}
	}
	int z;
	rep(i,n){
		if(s[n-1-i] == 'Z'){
			z = n-1-i;
			break;
		}
	}
	cout << z-a+1 << endl;
	

	return 0;
}
/*----------------------------------------------------------------*/

// g++ -std=gnu++17 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2018-quala.contest.atcoder.jp/tasks/code_festival_2018_quala_c
// rm -r -f test;oj dl https://abc053.contest.atcoder.jp/tasks/abc053_b

Measured memory_bytes: 3764
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B = MAP()
print(max(A+B, A-B, A*B))


Measured memory_bytes: 5460