akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long int
#define ll long long int
#define ld long double
#define pb push_back 
#define ff first 
#define ss second
#define all(c) c.begin(), c.end()
#define sz(z) (int)z.size()
#define rep(i,a,b) for(int i=a; i<b; ++i)
#define rev(i,a,b) for(int i=a; i>=b; i--)
//Debugging tools 
#define debug(v) cout<<#v<<endl;for(ll i=0; i<v.size(); i++) cout<<v[i]<<" "; cout<<endl;
#define debugn(v,n) cout<<#v<<endl;for(ll i=0; i<n; i++) cout<<v[i]<<" "; cout<<endl;
#define deb(sum) cout<<#sum<<" = "<<sum<<endl;
//Predefined values
#define INF (ll)1e18
#define endl "\n"
#define pi 3.142857142857143

const ll MOD = 1e9 + 7;

int main() { 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.in","r",stdin);
        freopen("output.in","w",stdout);
    #endif
    int t=1;    
    //cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector<int>a(n);
        rep(i,0,n) cin>>a[i];
        sort(all(a));
        vector<int> d(1005);
        for(int i=2; i*i<1005; i++){
            if(!d[i]){
                for(int j=i*i; j<1005; j+=i){
                    d[j] = 1;
                }
            }
        }
        vector<int> prime;
        rep(i,2,1005){
            if(!d[i])
                prime.push_back(i);
        }
        //rep(i,0,10) cout<<prime[i]<<' '; cout<<endl;
        //deb(sz(prime)); 
        int ok=1;
        int g = a[0];
        map<int, int> cnt;
        rep(i,0,n){
            g = __gcd(g,a[i]);
            
            rep(j,0,sz(prime)){
                if(a[i]%prime[j]==0){
                    cnt[prime[j]]++;
                    while(a[i]%prime[j]==0){
                        a[i] /= prime[j];
                    }
                }
            }
            if(a[i]>1)
                cnt[a[i]]++;
            
        }
        for(auto x : cnt)
            if(x.ss>1) ok = 0;
        if(ok)
            cout<<"pairwise coprime"<<endl;
        else{
            if(g==1)
                cout<<"setwise coprime"<<endl;
            else
                cout<<"not coprime"<<endl;
        }
    }
  return 0;
 }

















Measured memory_bytes: 10748
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  char A;
  cin >> A;
  if('A' <= A && A <= 'Z') cout << 'A' << endl;
  else cout << 'a' << endl;
  return 0;
}


Measured memory_bytes: 3648
N, K = map(long, raw_input().split())
A = map(long, raw_input().split())
p = 45
X = 0
while p >= 0:
  mask = 2 ** p
  count0 = sum([0 if mask & a > 0 else 1 for a in A])
  count1 = N - count0
  if X+mask <= K and count1 < count0:
    X += mask
  p -= 1
ans = 0
for a in A:
  ans += X^a
print ans



Measured memory_bytes: 12912
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <list>
#include <tuple>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
    int i, j, k;
    int a, b, m;
    vector<int> as, bs;
    int sum;

    int a_min = 1001001001;
    int b_min = 1001001001;

    cin >> a >> b >> m;

    for (i = 0; i < a; i++) {
        int ai;
        cin >> ai;
        as.push_back(ai);
        if (ai < a_min) {
            a_min = ai;
        }
    }
    for (i = 0; i < b; i++) {
        int bi;
        cin >> bi;
        bs.push_back(bi);
        if (bi < b_min) {
            b_min = bi;
        }
    }
    sum = a_min + b_min;

    for (i = 0; i < m; i++) {
        int xi, yi, ci;
        cin >> xi >> yi >> ci;
        if (as[xi-1] + bs[yi-1] - ci < sum) sum = as[xi-1] + bs[yi-1] - ci;
    }

    cout << sum << endl;

    return 0;
}


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

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int

int main(){
int n,m;
cin>>n>>m;
int count=1900*m+100*(n-m);
//cout<<count<<endl;
cout<<count*pow(2,m)<<endl;


  return 0;
}


Measured memory_bytes: 256
def main():
    mod = 1000000007
    N = int(input())
    prime = [1] * (N+1)
    prime[0] = 0
    prime[1] = 0
    for i in range(2,N+1):
        if prime[i] == 1:
            p = i
            j = 2
            while p*j <= N:
                prime[p*j] = 0
                j += 1

    res = 1
    for i in range(2,N+1):
        if prime[i] == 1:
            p = i
            j = 1
            num = 0
            while p**j <= N:
                num += N // (p**j)
                j += 1
            res *= (num+1)
            res %= mod

    print(res)

if __name__ == "__main__":
    main()

Measured memory_bytes: 9224
# coding: utf-8
import sys
# from operator import itemgetter
sysread = sys.stdin.readline
read = sys.stdin.read
sys.setrecursionlimit(10 ** 7)
#from heapq import heappop, heappush
#from collections import defaultdict
# import math
# from itertools import product, accumulate, combinations, product
# import bisect# lower_bound etc
#import numpy as np
# from copy import deepcopy
#from collections import deque
#import numba

def run():
    H = int(input())
    ret = 0
    current = 1
    while H:
        ret += current
        H = H // 2
        current *= 2
    print(ret)

if __name__ == "__main__":
    run()

Measured memory_bytes: 3068
#include <bits/stdc++.h>
#define int long long
#define moder (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x > 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % moder;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)* mod_pow(kai(x - y), moder - 2, moder) % moder * mod_pow(kai(y), moder - 2, moder) % moder;
}
/*--------Library Zone!--------*/

int n, a[114514], b[114514];
signed main() {
	cin >> n;
	int suma = 0, sumb = 0;
	rep(i, n) {
		cin >> a[i];
		suma += a[i];
	}
	int yo = 0, ans = 0;
	priority_queue<int>que;
	rep(i, n) {
		cin >> b[i];
		sumb += b[i];
		if (b[i] > a[i]) {
			yo += b[i] - a[i];
			ans++;
		}
		else que.push(a[i] - b[i]);
	}
	if (suma < sumb) {
		cout << -1 << endl;
		return 0;
	}
	while (que.size()) {
		if (yo <= 0)break;
		int p = que.top(); que.pop();
		ans++;
		yo -= p;
	}
	cout << ans << endl;
}

Measured memory_bytes: 2680
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = (a), i##ed = (b); i <= i##ed; i++)
#define per(i, a, b) for(int i = (a), i##ed = (b); i >= i##ed; i--)
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 998244353;
const int N = 600010;
int n; ll m;
int a[N], nxt[N], pos[N], ed[N], sta[N], top;
bool vis[N];

template<typename T> void gi(T &x) {
	x = 0; register char c = getchar(), pre = 0;
	for(; c < '0' || c > '9'; pre = c, c = getchar());
	for(; c >= '0' && c <= '9'; c = getchar()) x = x * 10ll + (c ^ 48);
	if(pre == '-') x = -x;
}
inline int add(const int &x, const int &y) {
	return x + y < mod ? x + y : x + y - mod;
}
inline int sub(const int &x, const int &y) {
	return x - y < 0 ? x - y + mod : x - y;
}
inline int mul(const int &x, const int &y) { return (int)((ll)x * y % mod); }
int ksm(int x, int y = mod - 2) {
	int ss = 1; for(; y; y >>= 1, x = mul(x, x)) if(y & 1) ss = mul(ss, x);
	return ss;
}
int main() {
	scanf("%d%lld", &n, &m);
	rep(i, 1, n) scanf("%d", &a[i]), a[n + i] = a[i];
	per(i, n + n, n + 1) {
		nxt[i] = pos[a[i]], pos[a[i]] = i;
		if(!nxt[i]) ed[i] = i;
		else ed[i] = ed[nxt[i] + 1];
	}
	per(i, n, 1) {
		nxt[i] = pos[a[i]], pos[a[i]] = i;
//		printf(">>> %d -> %d\n", i, nxt[i]);
//		if(nxt[i] <= n) { ed[i] = ed[n + i] - n; continue; }
		ed[i] = (ed[nxt[i] + 1] - 1) % n + 1;
	}
	top = 0;
	rep(i, 1, n) {
		if(!vis[a[i]]) {
			sta[++top] = i, vis[a[i]] = 1;
		}
		else {
			for(; a[sta[top]] != a[i]; --top) vis[a[sta[top]]] = 0;
			--top, vis[a[i]] = 0;
		}
	}
	if(!top) {
		return 0;
	}
	ed[0] = sta[1], top = 0;
//	for(int i = 1; i <= n + n; i++) printf("%d : %d\n", i, ed[i]);
	int u = ed[ed[0]]; sta[top = 1] = ed[0];
	for(; u != sta[1]; u = ed[u]) sta[++top] = u;
//	for(int i = 1; i <= top; i++) printf("%d\n", sta[i]);
	u = sta[(int)((m - 1) % top + 1)];
	top = 0;
	rep(i, 1, n) vis[a[i]] = 0;
	rep(i, u, n) {
		if(!vis[a[i]]) {
			sta[++top] = a[i], vis[a[i]] = 1;
		}
		else {
			for(; sta[top] != a[i]; --top) vis[sta[top]] = 0;
			--top, vis[a[i]] = 0;
		}
	}
	rep(i, 1, top) printf("%d ", sta[i]);
	return 0;
}

Measured memory_bytes: 12672
def main(s):
	if s == ".":
		return False
	ss = input()
	diffc = 0
	sl = s.split("\"")
	ssl = ss.split("\"")
	if len(sl) != len(ssl):
		print("DIFFERENT")
		return True
	for i in range(len(sl)):
		if i % 2 == 0:
			if sl[i] != ssl[i]:
				print("DIFFERENT")
				return True
		else:
			if sl[i] != ssl[i]:
				diffc += 1
	if diffc == 0:
		print("IDENTICAL")
	elif diffc == 1:
		print("CLOSE")
	else:
		print("DIFFERENT")
	return True


while main(input()):
	pass


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

int main()
{
        long long MOD = 1000000007;

        long long N, M;
        cin >> N >> M;
        int diff = abs(N-M);
        if (diff > 1) {
                cout << 0 << endl;
                exit(0);
        }
        if (N == M) {
                long long ans = 1;
                for (int i = 0; i < N; ++i) {
                        ans = ans * (i+1) % MOD;
                }
                ans = ans * ans % MOD;
                ans = ans * 2 % MOD;
                cout <<  ans << endl;
        }
        else {
                long long ans1 = 1;
                for (int i = 0; i < N; ++i) {
                        ans1 = ans1 * (i+1) % MOD;
                }
                long long ans2 = 1;
                for (int i = 0; i < M; ++i) {
                        ans2 = ans2 * (i+1) % MOD;
                }
                ans1 = ans1 * ans2 % MOD;
                cout << ans1 << endl;
        }

}


Measured memory_bytes: 256
=begin
－－－－－－－－－－－－－－
  A, B = 入力値
  min = AとBの小さい方
  ans = AとBを割り切れる正整数の配列
  K = ansのindex
－－－－－－－－－－－－－－
  1: 1 ~ (AとBの小さい方の値)までループする(i)
    i が AとB を...
    割り切れる場合: ans に 挿入
    割り切れない場合: 次の i へ
  2: ans の K 番目に"大きな"要素を出力
=end

A, B, K = gets.split.map(&:to_i);
min = [A,B].min;
ans = [];

for i in 1..A do
  if A % i == 0 && B % i == 0
    ans << i
  end
end

puts ans[-K];


Measured memory_bytes: 1788
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#define MAX_N 100
#define MOD 1000000007LL

char ch[2][MAX_N];
bool p[MAX_N];
const int mut[4] = {2,1,2,3};

int main(void)
{
    int n;
    scanf("%d", &n);
    for (int i = 0; i < 2; i++)
        scanf("%s", ch[i]);
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        if (ch[0][i] == ch[0][i + 1]) {
            p[cnt] = true;
            i++;
        }
        cnt++;
    }
    int64_t ans = p[0]? 6: 3;
    for (int i = 1; i < cnt; i++) {
        int num = p[i] * 2 + p[i - 1];
        ans *= mut[num];
        ans %= MOD;
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
//typedef pair<int,int> P;
//priority_queue<int> pque;
//priority_queue<int, vector<int>, greater<int>> pque;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 2000000000;//10^9
ll MOD  = 1000000007;
int main(void){
    int N;
    cin >> N;
    vector<ll> A(N);
    for(int i = 0; i < N; i++){
        cin >> A.at(i);
    }
    vector<int> B(N-1);
    
    for(int i = 0; i < N-1; i++){
        if(A.at(i) < A.at(i+1)){
            B.at(i) = 1;
        }else if(A.at(i) == A.at(i+1)){
            B.at(i) = 0;
        }else{
            B.at(i) = -1;
        }
    }
    if(N == 1){
        cout << 1 << endl;
    }else{
        int a = B.at(0);
        int cnt = 1;
        for(int i = 1; i < N-1; i++){
            if(a == 0){
                a = B.at(i);
                continue;
            }
            if(B.at(i) != 0){
                if(B.at(i) != a){
                    cnt++;
                    a = 0;
                }
            }
        }
        cout << cnt << endl;
    }
}


Measured memory_bytes: 1408
#include<bits/stdc++.h> 
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rel register ll
#define rec register char
#define gc getchar
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
template <typename mitsuha>
inline bool read(mitsuha &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return 0&pc(48);
  if (x<0) pc('-'),x=-x;
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  return 0;
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
const int yuzu=1e5;
vector<int> lj[yuzu|10];

int main(){
int i,j,n,m,q;
cin>>n>>m>>q;
for (i=1;i<=m;++i) {
  int l=read(),r=read();
  lj[l].push_back(r);
  }
for (i=1;i<=500;++i) sort(lj[i].begin(),lj[i].end());
for (i=1;i<=q;++i){
  int l=read(),r=read(),ans=0;
  for (j=l;j<=r;++j){
    ans+=upper_bound(lj[j].begin(),lj[j].end(),r)-lj[j].begin();
    }
  write(ans),pl;
  }
}

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

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

  if(n<1000)
    cout << "ABC";
  else
  {
    cout << "ABD";
  }

}


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

const int N=100100;
int n;
vector<int>g[N];
int dfs(int x,int fa=-1){
	int ret=0;
	for(int i:g[x])if(i!=fa)ret^=dfs(i,x)+1;
	return ret;
}

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n;
	for(int i=1;i<n;++i){
		int x,y;cin>>x>>y;
		g[x].push_back(y);
		g[y].push_back(x);
	}
	cout<<(dfs(1)?"Alice\n":"Bob\n");
	return 0;
}


Measured memory_bytes: 10368
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)

	arr := make([]float64, n)
	for i := range arr {
		fmt.Scan(&arr[i])
	}
	sort.Float64s(arr)

	sum := arr[0]
	for i := 1; i < n; i++ {
		sum = (sum + arr[i]) / 2
	}

	fmt.Println(sum)
}


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

using ll = long long; using ld = long double; using ull = unsigned long long; using uint = unsigned int;
using vi  = vector<int>; using vb  = vector<bool>; using vd  = vector<double>; using vl  = vector<ll>;
using vvi = vector<vi>;  using vvb = vector<vb>;   using vvd = vector<vd>;     using vvl = vector<vl>;

#define REP(i,n) for(ll i=0; i<(n); ++i)
#define FOR(i,b,n) for(ll i=(b); i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define TEN(x) ((ll)1e##x)

template<typename T> inline string join(const vector<T>& vec, string sep = " ") { stringstream ss; REP(i, vec.size()) ss << vec[i] << ( i+1 == vec.size() ? "" : sep ); return ss.str(); }


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

#define EPS (1e-10)
#define NEXT(x, i) (x[(i + 1) % x.size()])

template<class T> using CR = const T &;
using P = complex<ld>;
using G = vector<P>;

ld dot(P a, P b) { return real(conj(a)*b); }
ld cross(P a, P b) { return imag(conj(a)*b); }

ld area2(CR<G> g) {
	ld s = 0;
	REP(i, g.size()) s += cross(g[i], NEXT(g, i));
	return s;
}

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

int main() {
#ifdef INPUT_FROM_FILE
	ifstream cin("sample.in");
	ofstream cout("sample.out");
#endif
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(30);
	ll n;
	cin >> n;


	G g;
	REP(i, n) {
		ld x, y; cin >> x >> y;
		g.push_back({ x, y });
	}
	cout << fixed << setprecision(1);
	cout << abs(area2(g)) / 2 << endl;

	return 0;
}

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

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

    ll size = n.size();
    ll sum = 0;
    rep (i, size) {
        sum += (n[i] - '0');
    }

    if ((sum % 9) == 0) cout << "Yes" << endl;
    else cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 3756
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int n;
	int f = 0;
	int g = 0;
	int h = 0;
	long long int a[100001];
	cin >> n;
	a[n] = 1000000001;
	for(int i=0;i < n;i++)
	{
		cin >> a[i];
	}
	sort(a, a + n);
	while(h < n)
	{
		for(int i=1;a[h + i] == a[h];i++)
		{
			f++;
		}
		g+=(f + 1) % 2;
		h+=f;
		f = 0;
		h++;
	}
	cout << g << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
    string b ; cin >> b ;
    if (b == "A"){
        cout << "T" << endl ;
    }
    else if (b == "T"){
        cout << "A" << endl ;
    }
    else if (b == "C"){
        cout << "G" << endl ;
    }
    else if (b == "G"){
        cout << "C" << endl ;
    }
}

Measured memory_bytes: 256
//  Copyright © 2020 Diego Garcia Rodriguez del Campo. All rights reserved.
#include<bits/stdc++.h>
#define MAX 200005
#define optimiza_io cin.tie(0); ios_base::sync_with_stdio(0);
using namespace std;
typedef long long i64;

int main()
{
    optimiza_io
    i64 A, B, K;
    cin >> A >> B >> K;
    A -= K, K = 0;
    if( A < 0 ) {
        K = A * -1;
        A = 0;
    }
    B -= K;
    if( B < 0 )
        B = 0;
    
    cout << A << " " << B << "\n";
    return 0;
}

// CHECAR LIMITES 

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

int main() {
  int n;
  cin >> n;
  int a[n];
  int b = 1;
  for(int i=0;i<n;i++) {
    cin >> a[i];
    if(a[i] % 2 == 0) b *= 2;
  }

  cout << pow(3, n) - b << endl;
}

Measured memory_bytes: 384
use std::io;

fn main() {
    let mut s = String::new();
    io::stdin().read_line(&mut s).ok();

    let xs: Vec<char> = s.trim().chars().collect();

    let mut res = 0;

    for i in 0..(xs.len() - 1) {
        if xs[i] != xs[i + 1] {
            res += 1;
        }
    }

    println!("{}", res);
}


Measured memory_bytes: 892
H, W, D = map(int, input().split())
A = [[int(i) for i in input().split()] for _ in range(H)]
Q = int(input())
query = [(int(i) for i in input().split()) for _ in range(Q)]

x = [-1]*H*W
y = [-1]*H*W

for i in range(H):
    for j in range(W):
        x[A[i][j]-1] = i
        y[A[i][j]-1] = j

X = [0]*H*W
Y = [0]*H*W
# 累積和行列化
for k in range(D, H*W):
    X[k] = X[k-D]+abs(x[k]-x[k-D])
    Y[k] = Y[k-D]+abs(y[k]-y[k-D])

for L, R in query:
    L -= 1  # 0-indexed
    R -= 1  # 0-indexed
    print(X[R]-X[L]+Y[R]-Y[L])


Measured memory_bytes: 114908
while True:
  n =int(input())
  A=[]
  if n==0:
    break
  for i in range(n):
    num =int(input())
    A.append(num)
  cnt=0  
  for i in range(n):
    for j in range(n-1, 0, -1):
      if A[j]<A[j-1]:
        A[j], A[j-1]=A[j-1],A[j]
        cnt+=1
  print(cnt)     


Measured memory_bytes: 5604
#include<bits/stdc++.h>
using namespace std;
int main(){
    int v,e;scanf("%d%d",&v,&e);
    vector<vector<int>> a(v,vector<int>(v,1e9));
    for(int i=0;i<e;i++){
        int s,t,d;scanf("%d%d%d",&s,&t,&d);
        a[s][t]=d;
    }
    vector<vector<int>> dist(1<<v,vector<int>(v,1e9));
    dist[1][0]=0;
    for(int i=2;i<(1<<v);i++){
        for(int j=0;j<v;j++){
            if((i>>j)&1==0)continue;
            for(int k=0;k<v;k++){
                if(j==k)continue;
                int tmp=dist[i^(1<<j)][k]+a[k][j];
                dist[i][j]=min(dist[i][j],tmp);
            }
        }
    }
    int ans=1e9;
    for(int i=0;i<v;i++)ans=min(ans,dist[(1<<v)-1][i]+a[i][0]);
    if(ans==1e9)puts("-1");
    else printf("%d\n",ans);
    return 0;
}


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

from collections import defaultdict
from heapq import heappush, heappop
import sys
import numpy as np
import numba

sys.setrecursionlimit(10**6)
input = sys.stdin.buffer.readline
INF = 10 ** 9 + 1  # sys.maxsize # float("inf")


def debug(*x):
    print(*x)


@numba.njit(cache=True)
def get_longest(start, values, next, head, longest):
    ret = longest[start]
    if ret != -1:
        return ret

    ret = 0
    p = head[start]
    while p:
        v = values[p]
        x = get_longest(v, values, next, head, longest) + 1
        if x > ret:
            ret = x
        p = next[p]

    longest[start] = ret
    return ret


@numba.njit(cache=True)
def solve(N, M, data):
    longest = np.repeat(-1, N + 1)

    values = np.zeros(M + 1, np.int32)
    next = np.zeros(M + 1, np.int32)
    head = np.zeros(N + 1, np.int32)
    p = 1
    for i in range(0, 2 * M, 2):
        v1 = data[i]
        v2 = data[i + 1]
        values[p] = v2
        next[p] = head[v1]
        head[v1] = p
        p += 1

    for i in range(N + 1):
        if head[i] == 0:
            longest[i] = 0

    ret = 0
    for v in range(N + 1):
        x = get_longest(v, values, next, head, longest)
        if x > ret:
            ret = x
    return ret


def main():
    N, M = map(int, input().split())
    data = np.int32(read().split())
    print(solve(N, M, data))


T1 = """
4 5
1 2
1 3
3 2
2 4
3 4
"""

T2 = """
6 3
2 3
4 5
5 6
"""

T3 = """
5 8
5 3
2 3
2 4
5 2
5 1
1 4
4 3
1 3
"""


def _test():
    """
    # >>> as_input(T1)
    # >>> main()
    # 3

    # >>> as_input(T2)
    # >>> main()
    # 2

    >>> as_input(T3)
    >>> main()
    3
    """
    import doctest
    doctest.testmod()


def as_input(s):
    "use in test, use given string as input file"
    import io
    global read, input
    f = io.StringIO(s.strip())
    input = f.readline
    read = f.read


USE_NUMBA = False
if (USE_NUMBA and sys.argv[-1] == 'ONLINE_JUDGE') or sys.argv[-1] == '-c':
    print("compiling")
    # from numba.pycc import CC
    # cc = CC('my_module')
    # cc.export(
    #     'solve',
    #     "i4(i4,i4,i4[:])")(solve)
    # cc.export(
    #     'get_longest',
    #     "i4(i4,i4[:],i4[:],i4[:],i4[:])")(get_longest)
    # cc.compile()
    import numba
    numba.njit(cache=True)(get_longest)
    numba.njit(cache=True)(solve)
    exit()
else:
    input = sys.stdin.buffer.readline
    read = sys.stdin.buffer.read

    if (USE_NUMBA and sys.argv[-1] != '-p') or sys.argv[-1] == "--numba":
        # -p: pure python mode
        # if not -p, import compiled module
        from my_module import solve  # pylint: disable=all

    elif sys.argv[-1] == "-t":
        _test()
        sys.exit()
    elif sys.argv[-1] != '-p' and len(sys.argv) == 2:
        # input given as file
        input_as_file = open(sys.argv[1])
        input = input_as_file.buffer.readline
        read = input_as_file.buffer.read

    main()


Measured memory_bytes: 134092
#include <iostream>
#include <iomanip>
#include <vector>

using namespace std;

int main(){

	const int N_MAX = 14;
	int n,number;
	char suit;
	int S[N_MAX], H[ N_MAX ], C[ N_MAX ], D[ N_MAX ];

	for (int i = 0; i < N_MAX; i++){
		S[i] = 0;
		H[i] = 0;
		C[i] = 0;
		D[i] = 0;
	}

	cin >> n;

	for (int i = 0; i < n; i++){
		cin >> suit >> number;
		switch (suit){
		case 'S':
			S[number] = 1;
			break;
		case 'H':
			H[number] = 1;
			break;
		case 'C':
			C[number] = 1;
			break;
		case 'D':
			D[number] = 1;
			break;
		default:
			break;
		}
	}

	for (int i = 1; i < N_MAX; i++){
		if (S[i] == 0){
			cout << "S " << i << endl;
		}
	}
	for (int i = 1; i < N_MAX; i++){
		if (H[i] == 0){
			cout << "H " << i << endl;
		}
	}
	for (int i = 1; i < N_MAX; i++){
		if (C[i] == 0){
			cout << "C " << i << endl;
		}
	}
	for (int i = 1; i < N_MAX; i++){
		if (D[i] == 0){
			cout << "D " << i << endl;
		}
	}


	return 0;
}

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

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

void func(){
	char table[110][110] ;
	
	for( int i=0 ; i<102 ; i++ ){
		for( int j=0 ; j<102 ; j++ ){
			if( i>=100-N+1 && i<=100 && j>=1 && j<=N ) table[i][j] = '#' ;
			else table[i][j] = ' ' ;
		}
	}
	
	int x = 1   ;
	int y = 100 ;
	int k = 0 ;
	bool f = true ;
	
	while(1){
		if( table[y+dy[k%4]][x+dx[k%4]] == ' ' ) break ;
		bool b = false ;
		while( table[y+dy[k%4]][x+dx[k%4]] != ' ' ){
			if( f || b ) table[y+dy[(k+1)%4]][x+dx[(k+1)%4]] = ' ' ;
			if( !b ) b = true  ;
			if(  f ) f = false ;
			x += dx[k%4] ;
			y += dy[k%4] ;
		}
		k++ ;
	}
	
	for( int i=100-N+1 ; i<=100 ; i++ ){
		for( int j=1 ; j<=N ; j++ ){
			cout << table[i][j] ;
		}
		cout << endl ;
	}
}

int main(){
	
	cin >> d ;
	while( d-- ){
		cin >> N ;
		func() ;
		if( d ) cout << endl ;
	}
	
return 0;
}

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

int main()
{
	int a = {};
	int b = {};
	cin >> a>>b;
	if (a + b >= a - b) {
		if (a + b >= a*b) {
			cout << a + b << endl;

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

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace abc088a
{
    class Program
    {
        static void Main(string[] args) {
            var n = int.Parse(Console.ReadLine());
            var a = int.Parse(Console.ReadLine());

            if (n % 500 <= a)
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");
        }
    }
}


Measured memory_bytes: 11092
fun str() = readLine()!!
fun int() = str().toInt()
fun long() = str().toLong()

fun read(d: String = " ") = str().split(d)
fun <T> list(d: String = " ", f: String.() -> T) = read(d).map { f(it) }
fun list() = list { toInt() }

fun <T> MutableList<T>.removeLast() = this.removeAt(this.lastIndex)

//const val mod = 998244353L

fun main() {
    abc000X()
}

fun abc000X() {
    val (n, x, mod) = list { toLong() }


    var v = x
    var r = x

    val a = Array(mod.toInt()) { -1L to -1L }

    var i = 1L
    var f = true
    while (i < n) {
        ++i

        v = v * v % mod
        r += v

        if (f) {
            val (b, c) = a[v.toInt()]
            if (b < 0L) {
                a[v.toInt()] = i to r
            } else {
                f = false
                val l = (n - i) / (i - b)
                val m = r - c
                System.err.println(l to m)
                r += l * m
                i += l * (i - b)
            }
        }
    }
    println(r)
}


Measured memory_bytes: 43392
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define m 1000000007

/*ll binpow(ll a,ll b,ll mod) 
{
    ll res=1;
    a%=mod;
    while (b > 0) 
    {
        if(b & 1)
        {
            res = (res * a)%mod;
        }
        a=(a*a)%mod;
        b >>= 1;
     
    }
    return res;
}*/


int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll p=max((a*c),(b*d));
    ll q=max((a*d),(b*c));
    ll ans=max(p,q);
    if(ans<0)
    {
        if(((a*b)<=0)||((c*d)<=0))
        {
            ans=0;
        }
    }
    cout<<ans<<endl;
  
	return 0;
}

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

#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()

typedef long long ll;
typedef array<int, 3> tri;
typedef long double ld;

template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}



void _main() {
        int r, d, x; cin >> r >> d >> x;
        for (int i = 1; i <= 10; i++) {
                cout << (x = r * x - d) << '\n';
        }
}



signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}


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

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

typedef long long ll;

int main(int argc, char const *argv[])
{
    int N, i; cin >> N >> i;
    cout << (N + 1) - i << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=100005;
int n,a[N],v[N];
signed main(){
	scanf("%lld",&n);
	for (int i=0;i<=n;i++)scanf("%lld",&a[i]);
	if (n==0){
		if (a[0]==1){
			puts("1");
			return 0;
		}
		else {
			puts("-1");
			return 0;
		}
	}
	if (a[0]){
		puts("-1");
		return 0;
	}
	int Max=1,s=0;
	for (int i=1;i<=n;i++)
		if (a[i]>Max*2){
			puts("-1");
			return 0;
		}
		else v[i-1]=Max,Max=min(1000000000000000ll,Max*2-a[i]);
	int ans=0;
	for (int i=0;i<=n;i++)ans+=a[i];
	for (int i=n-1;i>=0;i--)v[i]=min(v[i],v[i+1]+a[i+1]),ans+=v[i];
	printf("%lld\n",ans+s);
}


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

#define ipr pair<int, int>
#define pb push_back
#define ff first
#define ss second
#define fr(i, j, k) for (int i = j; i < k; i++)
#define rf(i, j, k) for (int i = j; i >= k; i--)
#define ll unsigned long long
#define int long long
#define ld long double
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define mp make_pair
#define cnt_ones(x) __builtin_popcountll(x)

#define IOS                           \
    std::ios::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);

const int Maxn = (int)1e5 + 1;
const ld pi = acos(-1);
const int mod = (int)1e9 + 7;
const int inf = (int)1e18;

template <class T>
ostream &operator<<(ostream &out, vector<T> &A) {
    fr(i, 0, (int)A.size()) out << A[i] << " ";
    return out;
}

int equate(string s, string t){
    int ans = 0;
    for(int i=0;i<(int)s.size();i++){
        if(s[i] != t[i])    ans++;
    }
    return ans;
}

int32_t main() {
    IOS string s,t; cin>>s>>t;
    int n=s.size(), m = t.size(), ans = inf;

    for(int i=0;i<=n-m;i++){
        string temp = s.substr(i,m);
        ans = min(ans, equate(temp, t));
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
    int n;
    cin >> n;
    int t[n+1];
    t[0]=0;
    int x[n+1];
    x[0]=0;
    int y[n+1];
    y[0]=0;
    for(int i=1;i<=n;i++){
        cin >> t[i] >> x[i] >> y[i];
        int di=abs(x[i]-x[i-1])+abs(y[i]-y[i-1]);
        int ti=t[i]-t[i-1];
        if(di>ti||(di%2!=ti%2)){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 1408
/*
 * @Author: Sky Dreamer 
 * @Date: 2020-02-16 20:04:31 
 * @Last Modified by: Sky Dreamer
 * @Last Modified time: 2020-02-16 20:09:50
 * @Problem Url: https://atcoder.jp/contests/abc155/tasks/abc155_a
 * @Status: 
 */
#include <cstdio>

int a,b,c;

inline int read() {
#define gc c = getchar()
    int d = 0,f = 0,gc;
    while(c < 48 || c > 57) f |= (c == '-'),gc;
    while(c > 47 && c < 58) d = (d << 1) + (d << 3) + (c ^ 48),gc;
#undef gc
    return f ? -d : d;
}

int main() {
#ifndef ONLINE_JUDGE
#define register
#endif
    a = read(),b = read(),c = read();
    if(a == b && a == c) puts("No");
    else if(a != c && a != b && b != c) puts("No");
    else puts("Yes");
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main(){
   int W,H,x,y,r;
   cin>> W>>H>>x>>y>>r;
   if(x+r<=W){
       if(x-r>=0){
           if(y+r<=H){
               if(y-r>=0){
                   cout<<"Yes"<<endl;
               }else{
                   cout<<"No"<<endl;
               }
           }else{
                   cout<<"No"<<endl;
               
           }
           
       }else{
               cout<<"No"<<endl;
           
       }
       
   }else{
               cout<<"No"<<endl;
       
   }
   return 0;
   }


Measured memory_bytes: 3120
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0

for i in range(A+1):
  for t in range(B+1):
    for z in range(C+1):
      if X == 500*i + 100*t + 50*z:
        count = count + 1
print(count)


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

int main() {
  int N;
  cin >> N;
  int odd = 0;
  int even = 0;
  int MulOfFour = 0;

  for(int i=0;i<N;i++) {
    int a;
    cin >> a;
    if(a%2==1) odd++;
    else if(a%4==0) MulOfFour++;
    else even++;
  }

  if(odd > MulOfFour + 1) {
    cout << "No" << endl;
  } else if (odd == MulOfFour + 1) {
    if(even == 0) cout << "Yes" << endl;
    else cout << "No" << endl; 
  } else cout << "Yes" << endl;
}

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	const int MOD = 998244353;
	
	int N;
	int V[30], C[30];
	cin >> N;
	rep(i, 0, N)
	{
		cin >> V[i];
	}
	rep(i, 0, N)
	{
		cin >> C[i];
	}

	int ans = 0;
	rep(i, 0, 1 << N)
	{
		int X = 0;
		int Y = 0;
		rep(j, 0, N)
		{
			if (i&(1 << j))
			{
				X += V[j];
				Y += C[j];
			}
		}
		chmax(ans, X - Y);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,a,b,c,i,j,d[100];
string s;
char x;
int main()
{
for(cin>>n;i<n;i++){
  cin>>x;
  if(x=='Y')return cout<<"Four"<<endl, 0;
}
cout<<"Three"<<endl;
}

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

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

    vector<int> A(N);
    rep(i,N) {
        if(i==0) {
            continue;
        } else {
            cin >> A.at(i);
        }
    }

    map<int,long int> buka;

    rep(i,N) {
        if(i==0) {
            continue;
        } else if(buka.count(A.at(i)-1)) {
            buka.at(A.at(i)-1)++;
        } else {
            buka[A.at(i)-1] = 1;
        }
    }

    rep(i,N) {
        if(buka.count(i)) {
            cout << buka.at(i) << endl;
        } else {
            cout << 0 << endl;
        }
    }
    
}

Measured memory_bytes: 16380
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 int x,a,b; cin>>x>>a>>b;
 int xxx=b-a;
 if(xxx<=0)cout<<"delicious"<<endl;
 else{
 
   if(xxx>x)cout<<"dangerous"<<endl;
   else cout<<"safe"<<endl;
 
 
 
 
 
 
 }
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int buttonA=0,buttonB=0;
	int total=0;
	scanf("%d%d",&buttonA,&buttonB);
	for(int i=0;i<2;i++)
	{
		if(buttonA>=buttonB&&buttonA>=3)
		{
			total+=buttonA;
			buttonA--;
		}
		else if(buttonB<=20)
		{
			total+=buttonB;
			buttonB--;
		}
	}
	printf("%d\n",total);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define FOR(I,X,Y) for(int (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(int (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define INF 1000000007
#define LINF 1000000000000000007
typedef long long ll;
using namespace std;

int main(){
  string s;
  cin >> s;
  if(s.size() == 2){
    if(s[0] == s[1]){
      cout << "1 2" << endl;
      return 0;
    }
    cout << "-1 -1" << endl;
    return 0;
  }
  FOR(i,0,s.size()-2){
    string ssub = s.substr(i,3);
    if(ssub[0] == ssub[1] || ssub[1] == ssub[2] || ssub[2] == ssub[0]){
      cout << i+1 << " " << i+3 << endl;
      return 0;
    }
  }
  cout << "-1 -1" << endl;
}


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

int main (){
    int A,B,C,D;
    cin >> A >> B >> C >> D;
    if ((A + B) == (C + D)){
        cout << "Balanced" << endl;
    }
    else if ((A + B) < (C + D)){
        cout << "Right" << endl;
    }
    else{
        cout << "Left" << endl;
    }
}

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

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

    int n, k;
    cin >> n >> k;
    n--;
    int ans = 2*k;
    char c, d;
    cin >> c;
    for (int i = 0; i < n; i++){
        cin >> d;
        if (d == c) ans++;
        else c = d;
    }
    cout << min(ans, n) << '\n';
}


Measured memory_bytes: 256
<?php
$N = intval(fgets(STDIN));
$S = trim(fgets(STDIN));
check("SS");
check("SW");
check("WS");
check("WW");
echo -1,"\n";
function check($ans){
    global $S, $N;
    for($i = 1; $i < $N+1; $i++){
        switch($ans[$i-1].$ans[$i]){
            case "SS":if($S[$i%$N]=="o")$ans.='S';else $ans.="W";break;
            case "SW":if($S[$i%$N]=="o")$ans.='W';else $ans.="S";break;
            case "WS":if($S[$i%$N]=="o")$ans.='W';else $ans.="S";break;
            case "WW":if($S[$i%$N]=="o")$ans.='S';else $ans.="W";break;
        }
    }
    if($ans[0] == $ans[$N] && $ans[1] == $ans[$N+1]){
        echo substr($ans, 0, $N),"\n";exit;
    }
}


Measured memory_bytes: 4856
#![allow(non_snake_case, unused)]
use std::collections::*;

////////// missing functions in 1.15.1 //////////
macro_rules! eprint {
	($($t:tt)*) => {{
		use ::std::io::Write;
		let _ = write!(::std::io::stderr(), $($t)*);
	}};
}
macro_rules! eprintln {
	() => { eprintln!(""); };
	($($t:tt)*) => {{
		use ::std::io::Write;
		let _ = writeln!(::std::io::stderr(), $($t)*);
	}};
}
macro_rules! dbg {
	($v:expr) => {{
		let val = $v;
		eprintln!("[{}:{}] {} = {:?}", file!(), line!(), stringify!($v), val);
		val
	}}
}
/////////////////////////////////////////////////
pub trait SetMinMax {
	fn setmin(&mut self, v: Self) -> bool;
	fn setmax(&mut self, v: Self) -> bool;
}
impl<T> SetMinMax for T where T: PartialOrd {
	fn setmin(&mut self, v: T) -> bool {
		*self > v && { *self = v; true }
	}
	fn setmax(&mut self, v: T) -> bool {
		*self < v && { *self = v; true }
	}
}

macro_rules! mat {
	($($e:expr),*) => { Vec::from(vec![$($e),*]) };
	($($e:expr,)*) => { Vec::from(vec![$($e),*]) };
	($e:expr; $d:expr) => { Vec::from(vec![$e; $d]) };
	($e:expr; $d:expr $(; $ds:expr)+) => { Vec::from(vec![mat![$e $(; $ds)*]; $d]) };
}

#[macro_export]
macro_rules! ok {
	($a:ident$([$i:expr])*.$f:ident()$(@$t:ident)*) => {
		$a$([$i])*.$f($($t),*)
	};
	($a:ident$([$i:expr])*.$f:ident($e:expr$(,$es:expr)*)$(@$t:ident)*) => { {
		let t = $e;
		ok!($a$([$i])*.$f($($es),*)$(@$t)*@t)
	} };
}

pub fn readln() -> String {
	let mut line = String::new();
	::std::io::stdin().read_line(&mut line).unwrap_or_else(|e| panic!("{}", e));
	line
}

macro_rules! read {
	($($t:tt),*; $n:expr) => {{
		let stdin = ::std::io::stdin();
		let ret = ::std::io::BufRead::lines(stdin.lock()).take($n).map(|line| {
			let line = line.unwrap();
			let mut it = line.split_whitespace();
			_read!(it; $($t),*)
		}).collect::<Vec<_>>();
		ret
	}};
	($($t:tt),*) => {{
		let line = readln();
		let mut it = line.split_whitespace();
		_read!(it; $($t),*)
	}};
}

macro_rules! _read {
	($it:ident; [char]) => {
		_read!($it; String).chars().collect::<Vec<_>>()
	};
	($it:ident; [u8]) => {
		Vec::from(_read!($it; String).into_bytes())
	};
	($it:ident; usize1) => {
		$it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1
	};
	($it:ident; [usize1]) => {
		$it.map(|s| s.parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1).collect::<Vec<_>>()
	};
	($it:ident; [$t:ty]) => {
		$it.map(|s| s.parse::<$t>().unwrap_or_else(|e| panic!("{}", e))).collect::<Vec<_>>()
	};
	($it:ident; $t:ty) => {
		$it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<$t>().unwrap_or_else(|e| panic!("{}", e))
	};
	($it:ident; $($t:tt),+) => {
		($(_read!($it; $t)),*)
	};
}

pub fn main() {
	let _ = ::std::thread::Builder::new().name("run".to_string()).stack_size(32 * 1024 * 1024).spawn(run).unwrap().join();
}

fn run() {
	let (N, K) = read!(usize, usize);
	let a = read!([usize]);
	let mut dp = vec![false; K + 1];
	for i in 1..K+1 {
		for &j in &a {
			if j <= i && !dp[i - j] {
				dp[i] = true;
				break;
			}
		}
	}
	println!("{}", if !dp[K] { "Second" } else { "First" });
}


Measured memory_bytes: 8572
N, K = map(int, input().split())
S = list(input())
X = []
cnt = 1
for i in range(1, N):
    if S[i] != S[i-1]:
        X.append(cnt)
        cnt = 0
    cnt += 1
    if i == N-1:
        X.append(cnt)
l = len(X)

if S[0] == '0' and (l+1)//2 <= K:
    print(N)
    exit()
if S[0] ==  '1' and l//2 <= K:
    print(N)
    exit()

ans = 0
result = 0
if S[0] == '0':
    for j in range(2*K):
        result += X[j]
    ans = result
    for j in range(2*K, l):
        if j == 2*K:
            result -= X[0]
        elif j%2 == 0:
            result = result - X[j-2*K] - X[j-2*K-1]
        result += X[j]
        ans = max(ans,result)
else:
    for j in range(2*K+1):
        result += X[j]
    ans = result
    for j in range(2*K+1, l):
        if j%2 == 1:
            result = result - X[j-2*K-1] - X[j -2*K]
        result += X[j]
        ans = max(ans, result)
print(ans)

Measured memory_bytes: 4816
N=int(input())
s=[0]*4
for i in range(N):
  A=str(input())
  if A=='AC':
    s[0]+=1
  elif A=='WA':
    s[1]+=1
  elif A=='TLE':
    s[2]+=1
  elif A=='RE':
    s[3]+=1
print('AC','x',s[0])
print('WA','x',s[1])
print('TLE','x',s[2])
print('RE','x',s[3])


Measured memory_bytes: 74620
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>

using namespace std;

typedef  long long int lint;

#define rep(i, n) for (lint i = 0; i < n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define mp make_pair
#define enld endl

int main() {
	lint A, B, C;
	cin >> A >> B >> C;
	lint now = 0;
	lint cnt = 0;
	while (1) {
		now += A;
		if (cnt % 7 == 6) {
			now += B;
		}
		if (now >= C) {
			cout << cnt+1 << endl;
			break;
		}
		cnt++;
	}
}


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

int main() {
  while(1) {
    int m,d;
    cin >> m >> d;
    if(m==0 && d==0) break;

    for(int i=1; i<m; i++) {
      switch(i){
      case 2:
	d+=29;
	break;
      case 4:
      case 6:
      case 9:
      case 11:
	d+=30;
	break;
      default :
	d+=31;
	break;
      }
    }
    switch(d%7){
    case 1:
      cout << "Thursday" << endl;
      break;
    case 2:
      cout << "Friday" << endl;
      break;
    case 3:
      cout << "Saturday" << endl;
      break;
    case 4:
      cout << "Sunday" << endl;
      break;
    case 5:
      cout << "Monday" << endl;
      break;
    case 6:
      cout << "Tuesday" << endl;
      break;
    case 0:
      cout << "Wednesday" << endl;
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 1152
#!/usr/bin/env python3
import sys
import math
input = sys.stdin.readline

n = int(input())
town = []
for i in range(n):
    x, y = [int(item) for item in input().split()]
    town.append((x, y))

dist_sum = 0
for i in range(n):
    for j in range(i+1, n):
        x1, y1 = town[i]
        x2, y2 = town[j]
        dist_sum += math.hypot(x1 - x2, y1 - y2) / n
print(dist_sum * 2.0)

Measured memory_bytes: 38256
#include<iostream>
using namespace std;
int main(){
  int n,cnt=0;
  string s;
  cin>>n>>s;
  for(int i=0;i<(n-2);i++){
    if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C')	cnt++;
  }
  cout<<cnt<<endl;
  return 0;
}

Measured memory_bytes: 256
if __name__ == '__main__':
    N = int(input())
    T = input()
    middle = int(N / 2)
    target_str = T[0:(middle)] + T[0:(middle)]
    if (N % 2) == 0 :
        if (T == target_str):
            print('Yes')
            exit(0)
    print('No')
    exit(0)

Measured memory_bytes: 3060
import sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *
from math import *

sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()

A, P = map(int, input().split())
print((P + A * 3) // 2)



Measured memory_bytes: 38256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>

using namespace std;

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

	if (A <= C && C <= B) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 3624
#include <stdio.h>
#include <string.h>
int main(void){
  char s[11],t[11]="";
  int i;
  scanf("%s",s);
  for(i=0;i<strlen(s);i++){
    if(s[i]=='B') t[strlen(t)-1]='\0';
    else t[strlen(t)]=s[i];
  }
  printf("%s",t);
  return 0;
}


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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

ll cal(vector<ll>& A, int N, int start)
{
  ll ret = 0;
  ll diff = 0;
  for (int i = 1, sign = start; i <= N; ++i, sign *= -1) {
    ll val = A[i] + diff;
    if (sign > 0 and val <= 0) {
      ret += abs(val) + 1;
      diff += abs(val) + 1;
    }
    else if (sign < 0 and val >= 0) {
      ret += val + 1;
      diff -= val + 1;
    }
  }
  return ret;
}

int main()
{
  int N; scanf("%d", &N);
  vector<ll> A(N + 5, 0);
  for (int i = 1; i <= N; ++i) {
    scanf("%lld", &A[i]);
    A[i] += A[i - 1];
  }

  ll ans = min(cal(A, N, 1), cal(A, N, -1));
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 1024
a,b,c = map(int,input().split())
if a > b:
    x = a
    a = b
    b = x
if b > c:
    x = b
    b = c
    c = x
    if a > b:
        x = a
        a = b
        b = x

print(a,b,c,sep = " ")
    
    
    
    



Measured memory_bytes: 5596