akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string.h>
using namespace std;
char A[104],B[105],C[105];
int main()
{
    int a,b,c;
    int la,lb,lc;

    while(cin>>A>>B>>C)
    {
        int tmp;
        la=strlen(A);
        lb=strlen(B);
        lc=strlen(C);
        tmp=1;
        a=b=c=-1;
        while(1)
        {
            if(a==la)
            {
                cout<<"A"<<endl;
                break;
            }
            else if(b==lb)
            {
                cout<<"B"<<endl;
                break;
            }
            else if(c==lc)
            {
                cout<<"C"<<endl;
                break;
            }
            if(tmp==1)
            {
                  a++;
                tmp=A[a]-'a'+1;


            }
            else if(tmp==2)
            {
                 b++;
                tmp=B[b]-'a'+1;

            }
            else if(tmp==3)
            {
               c++;
                tmp=C[c]-'a'+1;

            }
        }
        //cout<<(a+b)*h/2<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define SZ(x) ((int)(x).size())
#define rep(i,n) for(int i=0;i<(n);++i)
#define fore(i,a) for(auto &i:a)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define ALL(x) (x).begin(),(x).end()
signed _main(); signed main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> using v = vector<T>;
template<class T> using vv = vector<v<T>>;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
using P=pair<int,int>;

signed _main(){
  double A,B; cin >> A >> B;
  int a=A;
  int b=B*100+0.5;//勝手な小数切り捨てを防ぐ
  //cout << b<< endl;
  cout << a*b/100 << endl;
  return 0;
}


Measured memory_bytes: 3748
# include <bits/stdc++.h>
using namespace std;
int n, ans = ~ 0u >> 2;
int CC(int n) {
	return ! n ? 0 : n % 10 + CC(n / 10);
}
int main() {
	scanf("%d", & n);
	for (int i = 1; i < n; i ++)
		ans = min(ans,	+ CC(i)
						+ CC(n-i)	);
	printf("%d\n", ans);
	return 0;
}

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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n, m;
  cin >> n >> m;
  vint a(n);
  vint sum(n+1, 0);
  rep(i, n) {
    cin >> a[i];
    sum[i+1] = sum[i]+a[i];
  }
  vector<vector<double> > dp(n+1, vector<double>(m+1, -1e9));
  dp[0][0] = 0;
  rep(i, n) {
    rep(j, m) {
      rep(k, i+1) {
	if(dp[k][j] == -1e9) continue;
	chmax(dp[i+1][j+1], dp[k][j]+(double)(sum[i+1]-sum[k])/(i+1-k));
      }
    }
  }
  /*
  rep(i, n+1) {
    rep(j, m+1) cout << dp[i][j] << " ";
    cout << endl;
  }
  */
  double ans = 0;
  rep(i, m+1) chmax(ans, dp[n][i]);
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 4992
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

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

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int H,W;
    cin >> H >> W;
    vector<string> s(H);
    rep(i,H){
      	cin >> s[i];
        rep(t,2){
            cout << s[i] << endl;
        }
    }
}

Measured memory_bytes: 3628
#
import sys
import math
import numpy as np
import itertools

# いくつか入力
n,l = (int(i) for i in input().split())  

if (l+n-1)*l <=0:
    print((2*l+n-1)*n//2)
else:
    if abs(l)<abs(l+n-1):
        print((2*l+n-1)*n//2-l)
    else:
        print((2*l+n-1)*n//2-(l+n-1))



Measured memory_bytes: 20396
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long MOD = 1000000007;
		
		long[] dp = new long[N+1];
		dp[0] = 1;
		dp[1] = MOD-1;
		long cur = 0;
		for(int i=0; i<N; i++) {
			cur = (cur + dp[i])%MOD;
			
			if(i==N-1) {
				dp[N] = (dp[N] + cur*N)%MOD;
			} else {
				dp[i+1] = (dp[i+1] + cur)%MOD;
				dp[i+2] = (dp[i+2] - cur + MOD)%MOD;
				if(i+3<=N) {
					dp[i+3] = (dp[i+3] + cur)%MOD;
					dp[N] = (dp[N] + cur*(i+1))%MOD;
				} else {
					dp[N] = (dp[N] + cur*(N-1))%MOD;
				}
				dp[N] = (dp[N] + cur*((((long)N-1)*(N-1))%MOD))%MOD;
			}
		}
		
		System.out.println((cur + dp[N])%MOD);
		sc.close();
	}
}


Measured memory_bytes: 30292
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <climits>
#include<string>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

#define INF INT_MAX/3
#define REP(i,n) for(int i=0;i<n;i++)

int main(){
	string S;	
	cin>>S;
	int count = 0;
	string match = "CODEFESTIVAL2016";	
	for(int i = 0; i < S.size(); i++){
		if(S[i] != match[i]){
			count++;
		}
	}
	cout<<count<<endl;


	return 0;
}


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

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

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

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

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

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int N, M; cin >> N >> M;
    vec v(N, 0);
    vec wa(N, 0);
    rep(i, M){
        int a; string s; cin >> a >> s;
        a--;
        if(v[a] == 0){
            if(s == "WA"){
                wa[a]++;
            }else{
                v[a] = 1;
            }
        }
    }

    int res1 = count(all(v), 1);
    int res2  = 0;
    rep(i, N){
        if(v[i]) res2 += wa[i];
    }

    cout << res1 << " " << res2 << endl;
}

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


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

unordered_map<string, int> mp;

int getHappyValue(string &s) {
  int size = s.size();
  int happy = 0;
  for(int i = 0; i < size - 1; i++) {
     if(s[i] == s[i+1]) {
       happy++; 
     }
  }
  return happy;
}

void getRotateString(string &s, int l, int r) {
  int size = s.size();
  for(int i = l; i <= r; i++) {
      if(i <= r-i+l) {
        char a = s[i];
        s[i] = (s[r-i+l]=='L') ? 'R' : 'L';
        s[r-i+l] = (a=='L') ? 'R' : 'L';
      }
  }
}

int main(void) {
  int N;
  int K;
  string S;
  
  cin >> N >> K;
  cin >> S;
  
  int size = S.size();
  int l = -1;
  int r = -1;
    
  string tmp = S;
  int k = 0;
  
  for(int i = 0; i < size; i++) {
    if(tmp[i] != tmp[i+1] && l == -1) {
       l = i+1;
    }
    else if(tmp[i] != tmp[i+1] && l != -1) {
       r = i; 
    }
    if(l != -1 && r != -1) {
      getRotateString(tmp, l, r);
      //cout << l << "," << r << ":" << tmp << endl;

      k++;
      i = l;
      l = -1;
      r = -1;
      if(k >= K) break;
    }
  }
  
  cout << getHappyValue(tmp);
  return 0; 
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int MA=1e6+5;

int main(){
	int a,b,x;
	double sum=0;
	double t=0;
	scanf("%d%d%d",&a,&b,&x);
	double sum_mid=0.5*a*a*b;
	if(x>sum_mid){
		//t=2*b-(2*x*1.0)/(a*a);
		t= ((a*a*b-x)*2)*1.0/(a*a);
		sum=atan(t/a)*(180/acos(-1));
	}
	else{
		t=2*x*1.0/(a*b);
		sum=atan(b/t)*180/acos(-1);
	}
	printf("%.10lf\n",sum);
	return 0;
}

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

// マクロ //
#define rep(i,N) for(int i = 0; i < (int)(N); i++)
#define req(i,f,N) for(int i = f; i < (int)(N); i++)
#define all(x) x.begin(), x.end()
#define sort(x) sort(all(x))
#define uniq(x) x.erase(unique(all(x)), x.end())
#define vsum(x) accumulate(all(x), 0)
#define cou(x) cout << x << endl
#define y() cout << "Yes" << endl
#define n() cout << "No" << endl
#define Y() cout << "YES" << endl
#define N() cout << "NO" << endl
#define x2(x) (x) * (x)
#define db(i) cout << #i << " = " << i;

// 型エイリアス //
using lint = long long;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vi = vector<int>;
using vli = vector<lint>;
using vc = vector<char>;
using vs = vector<string>;
using vb = vector<bool>;
using vvi = vector<vi>;
using vvli = vector<vli>;
using vvb = vector<vb>;
using vvc = vector<vc>;
using vvs = vector<vs>;
using mii = map<int, int>;
using mili = map<int, lint>;
using mci = map<char, int>;
using mcli = map<char, lint>;
using msi = map<string, int>;
using msli = map<string, lint>;


// 関数 //
template<class T, class Q> lint gcd_(T a, Q b) {
    int t;
    while (b != 0) {
        t = a % b;
        a = b;
        b = t;
    }
    return a;
}

template<class T, class Q> lint lcm_(T a, Q b) {
    return a * b / gcd(a, b);
}

double distance(pii a, pii b) {
    double dist;
    dist = sqrt(x2(a.first - b.first) + x2(a.second - b.second));
    return dist;
}

lint perm(int a) {
    lint perm = 1;
    for (int i = a; i >= 1; i--) {
        perm *= i;
    }
    return perm;
}

lint combination(int n, int m) {
    long double c = 1;
    for (int i = n, k = 1; i > m; i--, k++) {
        c *= i;
        c /= k;
    }
    return (lint)c;
}

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

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

// 定数 //
const double pi = acos(-1);
const int mod = 1000000007;
const int MOD = 998244353;
const int inf = 1045141919;
const lint linf = ((1LL << 62) - 1);


// キーワード //
#define elif else if

// End of Template //



int main() {

    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
        
    int L, R;
    cin >> L >> R;
    if (R - L + 1 >= 2019) {
        cou(0); exit(0);
    }
    vi mo(R - L + 1);
    for (int i = 0; i < mo.size(); i++) {
        mo[i] = (i + L) % 2019;
    }
    
    int minmod = inf;
    rep(i, mo.size()) {
        rep(j, mo.size()) {
            if (i == j) continue;
            chmin(minmod, mo[i] * mo[j] % 2019);
        }
    }
    cou(minmod);
}

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

using namespace std;

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

    int64_t ans = 0;
    for(int i=1; i<=N; i++) {
        if(i%3 != 0 && i%5 != 0) {
            ans += i;
        }
    }

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


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <cmath>
#include <tuple>
#include <bitset>
#include <utility>
#include <climits>
#include <iomanip>

#define push emplace_back
#define each(i, x) for (auto i=0; i < x; i++)
using ull = unsigned long long;
constexpr auto mod = 1000000007;
constexpr auto INF = ULLONG_MAX;

using namespace std;
template <typename T> inline void dump(const T& x) { cout << "[" << x << "]" << endl; }
template <typename T> inline void dump(const vector<T>& x) { for (const auto v : x) { cout << v << " "; } cout << endl; }
template <typename T> inline void sort_asc(vector<T>& x) { std::sort(x.begin(), x.end()); }
template <typename T> inline void sort_desc(vector<T>& x) { std::sort(x.begin(), x.end(), greater<T>()); }
template <typename T> inline T max_value(vector<T>& x) { return *max_element(x.begin(), x.end()); }
template <typename T> inline T min_value(vector<T>& x) { return *min_element(x.begin(), x.end()); }
template <typename T> inline T sum_value(vector<T>& x) { return accumulate(x.begin(), x.end(), 0ULL); }

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

  unordered_set<ull> r;
  r.emplace(a);
  r.emplace(b);

  if (r.count(1) == 0) {
    cout << 1 << endl;
  } else if (r.count(2) == 0) {
    cout << 2 << endl;
  } else {
    cout << 3 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF=1e9;
const int MOD=1e9+7;
//const int MOD=998244353;
const long long LINF=1e18;
using namespace std;
#define int long long
#define fin {cout<<"No"<<endl;return 0;}
//template

//main
signed main(){
  int N;cin>>N;
  std::vector<int> a(N),b(N);
  for(int i=0;i<N;i++)cin>>a[i]>>b[i];
  int now=0;
  typedef pair<int,int> P;
  std::vector<P> v(N);
  for(int i=0;i<N;i++)v[i]=P(b[i],a[i]);
  sort(v.begin(),v.end());
  for(int i=0;i<N;i++){
    now+=v[i].second;
    if(now>v[i].first)fin;
  }
  cout<<"Yes"<<endl;
}


Measured memory_bytes: 6528
#include<iostream>

using namespace std;
int main() {
	int H, W;
	while (cin >> H >> W && H != 0 || W != 0) {
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				cout << '#';
				
			}
			cout << endl;
		}
		cout << endl;
	}
	return 0;
}



Measured memory_bytes: 3116
"""
python3 a.py < input.txt
"""
import math
import itertools as it
import heapq

N=int(input())
H=list(map(int,input().split()))
n=0
print(len([hi for i,hi in enumerate(H) if i == 0 or (i > 0 and max(H[:i]) <= hi)]))


Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
void postorder(vector<int>& pre, vector<int>& in, vector<int>& ret){
    if(in.size() <= 1){
        for(auto it = in.begin(); it != in.end(); ++it){
            ret.push_back(*it);
        }
        return;
    }
    int root = pre[0];
    int ln = find(in.begin(), in.end(), root) - in.begin();

    vector<int> pre_left {};
    pre_left.insert(pre_left.begin(), pre.begin()+1, pre.begin()+ln+1);
    vector<int>in_left {};
    in_left.insert(in_left.begin(), in.begin(), in.begin()+ln);

    vector<int> pre_right {};
    pre_right.insert(pre_right.begin(), pre.begin()+ln+1, pre.end());
    vector<int> in_right {};
    in_right.insert(in_right.begin(), in.begin()+ln+1, in.end());

    vector<int> pre_mid {root};
    vector<int> in_mid {root};

    postorder(pre_left, in_left, ret);
    postorder(pre_right, in_right, ret);
    postorder(pre_mid, in_mid, ret);
}
int main(){
    int n;
    cin >> n;
    vector<int> pre {};
    vector<int> in {};
    for(int i = 0; i < n; ++i){
        int temp;
        cin >> temp;
        pre.push_back(temp);
    }
    for(int i = 0; i < n; ++i){
        int temp;
        cin >> temp;
        in.push_back(temp);
    }
    vector<int> post {};
    postorder(pre, in, post);
    for(auto it = post.begin(); it != post.end(); ++it){
        if(it == post.begin()){
            cout << *it;
        } else {
            cout << " " << *it;
        }
    }
    cout << endl;
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
using namespace std;
int N, sBA, sA, sB, final_result;
string s[10101];

int main(){
	//freopen("test.in", "r+", stdin);
	cin >> N;
	for(int i = 0; i < N; i++){
		cin >> s[i];
		int n = s[i].size();
		if(s[i][0] == 'B' && s[i][n - 1] == 'A')sBA++;
		else if(s[i][0] == 'B')sB++;
		else if(s[i][n - 1] == 'A')sA++;

		for(int j = 0; j < n - 1; j++){
			if(s[i][j] == 'A' && s[i][j + 1] == 'B')
				final_result++;
		}
	}
	if(sBA > 0){
		final_result += sBA - 1;
		if(sA > 0)final_result++, sA--;
		if(sB > 0)final_result++, sB--;
	}

	final_result += min(sA, sB);
	cout << final_result << '\n';
}


Measured memory_bytes: 896
#include <iostream>
using namespace std;
int main() {
	int number;
	int digit = 0;
	int a, b;
	while (cin >> a >> b) {
		digit=0;
		number = a + b;
		while (number != 0) {
			number = number / 10;
			++digit;
		}
		cout << digit << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
#define all(x) (x).begin(), (x).end()
#define fsp(x) cout << fixed << setprecision(x)
#define endl '\n'
const ll inf = LLONG_MAX;
const long double pi = M_PI;
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
  ll n;
  string a, b, c;
  cin >> n >> a >> b >> c;
  ll ans = 0;
  for (ll i = 0; i < n; i++) {
    if (a[i] == b[i] && b[i] == c[i]) {}
    else if (a[i] == b[i] || b[i] == c[i] || c[i] == a[i]) ans++;
    else ans += 2;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
long long GCD(long long a, long long b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}
ll lcm(ll x, ll y) {
    return x / GCD(x, y) * y;//先に割り算をして掛けられる数を小さくして掛け算を行う
}
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(M), b(M);
  
  map<pair<int, int>, int> s;
  for (int i = 0; i < M; i++)
  {
      cin >> a[i] >> b[i];
      a[i]--; b[i]--;
      s[make_pair(a[i], b[i])] += 1;
  }
  
    bool hantei = false;
  for (int i = 0; i < M; i++)
  {
      if (s[make_pair(0, i)] == 1 && s[make_pair(i, N - 1)] == 1) 
      {
          hantei = true;
      }
      
  }
  
  
    if (hantei)
    {
        cout << "POSSIBLE" << endl;
    }else
    {
        cout << "IMPOSSIBLE" << endl;
    }
    
    

  

    
    return 0;

}

Measured memory_bytes: 29844
// #include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <set>
#include <queue>
using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)
#define irep(i, n) for(int i=n-1;i>=0;i--)
#define lrep(i, n) for(long long i=0;i<n;i++)
typedef long long ll;
typedef vector<long long> llv;
typedef vector<vector<long long> > llvv;

int main(){
    int n;
    cin >> n;
    ll ans = 0;
    rep(i,n){
        ans += i;
    }
    cout <<  ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<climits>
using namespace std;
static const int MAX=100;
static const long long INFTY = (1LL<<32);
typedef long long ll;
ll amari=1000000007;
int n=50;
ll k;

int main()
{
  cin >> k;
  vector<long long> a(50,0);
  if(k==1)
    {
      cout << 2 << endl;
      cout << 0 << ' ' << 2 <<  endl;
      return 0;
    }
  else if(k==0)
    {
      cout << 2 << endl;
      cout << 1 << ' ' << 1 << endl;
      return 0;
    }
  int n= min(50ll,k);
  int r=k%n;
  for(int i=0;i<n;i++)
    {
      a[i]=(k/n)-1+n;
    }
  for(int i=0;i<r;i++)
    {
      a[i]+=1;
    }
  for(int i=r;i<n;i++)
    {
      a[i]-=r;
    }
  cout << n << endl;
  for(int i=0;i<n;i++)
    {
      cout << a[i] << ' ';
    }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define M_PI 3.14159265358979323846
// #define __LOCAL

#ifdef __LOCAL
#define DBG(X) cout << #X << " = " << (X) << endl;
#define SAY(X) cout << (X) << endl;
#else
#define DBG(X)
#define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 0};
int dy[]={0, 1, 0, -1, 0};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
const int NIL = -1;
static mt19937 _g(time(nullptr));
 
std::string pad(int num){ char buffer[4]; std::snprintf(buffer, sizeof(buffer), "%03d", num); return buffer;}
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

std::vector<bool> IsPrime;
vector<int> Prime;

void sieve(int max){
    if(max+1 > IsPrime.size()){     // resizeで要素数が減らないように
        IsPrime.resize(max+1,true); // IsPrimeに必要な要素数を確保
    } 
    IsPrime[0] = false; // 0は素数ではない
    IsPrime[1] = false; // 1は素数ではない

    for(int i=2; i<=max; ++i) // 0からmaxまで調べる
        if(IsPrime[i]) // iが素数ならば
        {
            for(int j=2; i*j<=max; ++j) // (max以下の)iの倍数は
            IsPrime[i*j] = false;      // 素数ではない
            Prime.emplace_back(i);
        }
}


int main()
{
    int X;
    cin >> X;
    sieve(X+100);
    decltype(Prime)::iterator it = std::upper_bound(Prime.begin(), Prime.end(), X-1);
    std::cout << *it << std::endl;    

}


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

using namespace std;

int x[10][10];
int p[10][10];

int main() {

	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);

	int n, d;
	cin >> n >> d;
	int cnt = 0;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < d; ++j) {
			cin >> x[i][j];
		}
	}
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			if (j == i) continue;
			if (p[i][j]) continue;
			double distance = 0;
			for (int k = 0; k < d; ++k) {
				distance += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
			}
			distance = sqrt(distance);
			p[i][j] = p[j][i] = distance;
			if (distance == ceil(distance)) cnt++;
		}
	}
	cout << cnt << '\n';
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cmath>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(int argc,char** argv) {
	int n;
	cin >> n;
	cout << "ABC" << n;
}


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

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<PII> VP;


//REPEAT
//------------------------------------------
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define RFOR(i, m, n) for(int i = m;i > n;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,m)  RFOR(i,m,0)

//container util
//------------------------------------------
#define pb(a) push_back(a)
#define fst first
#define snd second
#define SORT(V) sort((V).begin(),(V).end())
#define REV(V) reverse((V).begin(),(V).end())

//constant
//------------------------------------------
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//grobal variable
//------------------------------------------

//def function, class
//------------------------------------------

//main
//------------------------------------------
signed main(){
  int N, M;
  cin >> N >> M;
  VI broken(N+1); //壊れているブロックのbool表
  REP(i, M){
    int a=0;
    cin >> a;
    broken[a]=1;
  }

  VI dp(N+10);
  dp[N]=1;
  dp[N+1]=0;

  REP(i, N){
    if(broken[N-i-1]) continue;
    dp[N-i-1] = (dp[N-i] + dp[N-i+1]) % MOD;
  }

  cout << dp[0] << endl;

  return 0;
}


Measured memory_bytes: 1792
use std::io::prelude::*;

fn input<T>() -> T
where T: std::str::FromStr {
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

use std::collections::HashSet;

fn main() {
    let n = input::<usize>();

    let mut combi: HashSet<usize> = HashSet::new();

    for i in 1..((n as f64).sqrt() as usize + 1) {
        if n % i == 0 {
            let i_len = digits(i);
            let j_len = digits(n / i);
            let count = std::cmp::max(i_len, j_len);
            combi.insert(count);
        }
    }
    println!("{:?}", combi.iter().min().unwrap());
}

fn digits(i: usize) -> usize {
    format!("{}", i).len()
}

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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

template<int mod>
struct ModInt{
	int x;
	ModInt () : x(0) {}
	ModInt (int64_t x) : x(x >= 0 ? x % mod : (mod - -x % mod) % mod) {}
	ModInt &operator += (const ModInt &p){
		if ((x += p.x) >= mod) x -= mod;
		return *this;
	}
	ModInt &operator -= (const ModInt &p) {
		if ((x += mod - p.x) >= mod) x -= mod;
		return *this;
	}
	ModInt &operator *= (const ModInt &p) {
		x = (int64_t) x * p.x % mod;
		return *this;
	}
	ModInt &operator /= (const ModInt &p) {
		*this *= p.inverse();
		return *this;
	}
	ModInt &operator ^= (int64_t p) {
		ModInt res = 1;
		for (; p; p >>= 1) {
			if (p & 1) res *= *this;
			*this *= *this;
		}
		return *this = res;
	}
	ModInt operator - () const { return ModInt(-x); }
	ModInt operator + (const ModInt &p) const { return ModInt(*this) += p; }
	ModInt operator - (const ModInt &p) const { return ModInt(*this) -= p; }
	ModInt operator * (const ModInt &p) const { return ModInt(*this) *= p; }
	ModInt operator / (const ModInt &p) const { return ModInt(*this) /= p; }
	ModInt operator ^ (int64_t p) const { return ModInt(*this) ^= p; }
	bool operator == (const ModInt &p) const { return x == p.x; }
	bool operator != (const ModInt &p) const { return x != p.x; }
	explicit operator int() const { return x; }
	ModInt &operator = (const int p) { x = p; return *this;}
	ModInt inverse() const {
		int a = x, b = mod, u = 1, v = 0, t;
		while (b > 0) {
			t = a / b;
			a -= t * b;
			std::swap(a, b);
			u -= t * v;
			std::swap(u, v);
		}
		return ModInt(u);
	}
	friend std::ostream & operator << (std::ostream &stream, const ModInt<mod> &p) {
		return stream << p.x;
	}
	friend std::istream & operator >> (std::istream &stream, ModInt<mod> &a) {
		int64_t x;
		stream >> x;
		a = ModInt<mod>(x);
		return stream;
	}
};

template<int mod> struct MComb {
	using mint = ModInt<mod>;
	std::vector<mint> fact;
	std::vector<mint> inv;
	MComb (int n) { // O(n + log(mod))
		fact = std::vector<mint>(n + 1, 1);
		for (int i = 1; i <= n; i++) fact[i] = fact[i - 1] * mint(i);
		inv.resize(n + 1);
		inv[n] = fact[n] ^ (mod - 2);
		for (int i = n; i--; ) inv[i] = inv[i + 1] * mint(i + 1);
	}
	mint ncr(int n, int r) {
		return fact[n] * inv[r] * inv[n - r];
	}
	mint npr(int n, int r) {
		return fact[n] * inv[n - r];
	}
	mint nhr(int n, int r) {
		assert(n + r - 1 < (int) fact.size());
		return ncr(n + r - 1, r);
	}
};

typedef ModInt<1000000007> mint;


int main() {
	int k = ri();
	std::string s;
	std::cin >> s;
	int n = s.size();
	
	MComb<1000000007> com(n + k);
	mint res = 0;
	for (int i = 0; i <= k; i++) res += (mint(25) ^ i) * com.ncr(n + k, i);
	std::cout << res << std::endl;
	return 0;
}


Measured memory_bytes: 20120
#include <algorithm>
#include <bitset>
#include <cassert>
#include <deque>
#include <fstream>
#include <iostream>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <sstream>
#include <stdio.h>
#include <string>
#include <vector>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define POW(n) ((n) * (n))
#define ALL(a) (a).begin(), (a).end()
#define dump(v) (cerr << #v << ": " << v << endl)
#define cerr                                                                   \
  if (true)                                                                    \
  cerr

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<unsigned long long> vull;

// ll n = to_T<ll>("114514")
template <class T> T to_T(const string &s) {
  istringstream is(s);
  T res;
  is >> res;
  return res;
}
template <class T> string to_s(const T &a) {
  ostringstream os;
  os << a;
  return os.str();
}

void solve(long long N, long long M) {
  ll ret = min(N, M / 2);
  M -= ret * 2;
  ret += M / 4;

  cout << ret << endl;
}

int main() {
  ios::sync_with_stdio(false);
  int a;
  int b;
  int c;
  cin >> a;
  cin >> b;
  cin >> c;

  int x;
  int y;

  x = b - a;
  y = c - b;

  if(x == y){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }

  return 0;
}

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

using namespace std;

int main()
{
	int n;
	double sum = 0.0;

	cin >> n;
	vector<int> a(n);

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

	sum = 1.0 / sum;
	
	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 256
/* imports all std modules {{{*/
import
  std.algorithm,
  std.array,
  std.ascii,
  std.base64,
  std.bigint,
  std.bitmanip,
  std.compiler,
  std.complex,
  std.concurrency,
  std.container,
  std.conv,
  std.csv,
  std.datetime,
  std.demangle,
  std.encoding,
  std.exception,
  std.file,
  std.format,
  std.functional,
  std.getopt,
  std.json,
  std.math,
  std.mathspecial,
  std.meta,
  std.mmfile,
  std.net.curl,
  std.net.isemail,
  std.numeric,
  std.parallelism,
  std.path,
  std.process,
  std.random,
  std.range,
  std.regex,
  std.signals,
  std.socket,
  std.stdint,
  std.stdio,
  std.string,
  std.system,
  std.traits,
  std.typecons,
  std.uni,
  std.uri,
  std.utf,
  std.uuid,
  std.variant,
  std.zip,
  std.zlib;
/*}}}*/

/+---test
oder atc
---+/

void main(string[] args) {
  const S = readln.chomp.split.array;
  (S[1] ~ S[0]).writeln;
}


Measured memory_bytes: 256
n = int(input())

tx, ty, now = 0, 0, 0
cant = 0
for i in range(n):
        t, x, y = map(int, input().split())
        a, b = t-now, abs(x-tx) + abs(y-ty)
        if not(a>=b and a%2==b%2): cant = 1
        tx, ty, now = x, y, t
print("YNeos"[cant::2])


Measured memory_bytes: 3060
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <new>

using namespace std;

typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
	
int main(){
    ll a=0,b=0;
    string S,T,U;
    cin >> S >> T;
    cin >> a >> b;
    cin >> U;

    if(S == U){
        cout << a - 1 << endl;
        cout << b << endl;
    }else{
        cout << a << endl;
        cout << b - 1 << endl;
    }

    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#define FPEN freopen("in.txt", "r", stdin);
#define debug(...) \
  { cerr << "# " << __VA_ARGS__ << "\n"; }
#else
#define debug(...)
#define FPEN
#endif
const int maxn = 200009;
typedef long long i64;
typedef pair<i64, i64> pi64;
typedef pair<int, int> pi;
const i64 MOD = 119 << 23 | 1;
class {
 public:
  void solve() {
    i64 n, m;
    cin >> n >> m;
    vector<i64> a(n), sum(n);
    for (int i = 0; i < n; ++i) cin >> a[i];
    sort(a.begin(), a.end());
    for (int i = 0; i < n; ++i)
      if (i)
        sum[i] = sum[i - 1] + a[i];
      else
        sum[i] = a[i];
    i64 ans = 0;
    auto ok = [&](i64 sup) {
      i64 cnt = 0;
      ans = 0;
      for (int i = 0; i < n; ++i) {
        i64 d = a.end() - lower_bound(a.begin(), a.end(), sup - a[i]);
        if (d == n)
          ans += sum[n - 1];
        else
          ans += sum[n - 1] - sum[n - 1 - d];
        ans += d * a[i];
        cnt += d;
      }
      return cnt;
    };
    i64 L = 0, R = 300000;
    while (L < R) {
      i64 mid = (L + R + 1) >> 1;
      if (ok(mid) >= m) {
        L = mid;
      } else {
        R = mid - 1;
      }
    }
    i64 count = ok(L);
    cout << ans - (count - m) * L << '\n';
  }
} NSPACE;
int main() {
  FPEN;
  ios_base::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  NSPACE.solve();
}

Measured memory_bytes: 1792
import Control.Applicative
import Control.Monad
import Data.Array
import Data.Array.ST
import Data.Char
import Data.List
import qualified Data.Map as M
import qualified Data.Set as S
import Text.Printf

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

main :: IO ()
main = do
  void getLine
  xs <- map read . words <$> getLine
  ys <- map read . words <$> getLine
  print $ minkowski 1 xs ys 
  print $ minkowski 2 xs ys 
  print $ minkowski 3 xs ys 
  print $ chebyshev xs ys 

minkowski :: Double -> [Double] -> [Double] -> Double
minkowski p = ((** (1/p)) . sum . map (** p)) `dot` zipWith dist

chebyshev :: [Double] -> [Double] -> Double
chebyshev = maximum `dot` zipWith dist

dist :: Double -> Double -> Double
dist x y = abs $ x - y

dot :: (c -> d) -> (a -> b -> c) -> a -> b -> d
dot = ((.).(.))



Measured memory_bytes: 4424
#include<iostream>
using namespace std; 
int main(){
    int a,b,c,t;
    cin>>a>>b>>c;
    if(a>b){
        t=a;
        a=b;
        b=t;
    }    
    if(b>c){
        t=b;
        b=c;
        c=t;
    }
    if(a>b){
        t=a;
        a=b;
        b=t;
    }
    cout<<a<<" "<<b<<" "<<c<<endl;
    return 0;    
}




Measured memory_bytes: 3092
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
template<class T> ostream& operator<<(ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }

int main() {
    vector<int> ab(2);
    for (auto &abi: ab) cin >> abi;
    int k; cin >> k;
    for (int i = 0; i < k; i++) {
        ab[(i & 1) ^ 1] += ab[i & 1] >>= 1;
    }
    cout << ab << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;

class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		for (; solver.hasNext();) {
			solver.readBody(in.readLine());
		}
		solver.readX(in.readLine());
		solver.solve();
	}
}

class Solver {
	int N;
	int cnt;

	public void init() {
		N = 0;
		cnt = 0;
	}

	public void readHead(String str) {
		String[] strArr = str.split("\\s+");
		N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
		Total = 0;
		Song = new HashMap<String, Integer>();
	}

	public boolean hasNext() {
		return cnt < N;
	}

	int Total;
	HashMap<String, Integer> Song;

	public void readBody(String str) {
		// System.out.println(str);
		String[] strArr = str.split("\\s+");
		Total += Integer.parseInt(strArr[1]);
		Song.put(strArr[0], Total);
		cnt++;
	}

	public void readX(String str) {
		System.out.println(Total - Song.get(str));
	}

	public void solve() {

	}
}


Measured memory_bytes: 20692
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, accumulate, inner_product
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(int)>

#define rep(i,n) for(int i = 0; i < n; i++)
#define ENDL "\n"
#define print(i) std::cout << (i) << "\n"

#define int long long // at least int64 > 9*10^18
#define all(v) v.begin(), v.end()

#define dump1(v) for(auto i:v) std::cout << i.first << ' ' << i.second << "\n"; std::cout << "\n";

signed main() {
	int n,m;
	std::cin >> n >> m;
	std::vector<std::pair<int,int> > alb;
	alb.reserve(n);
	rep(i,n) {
		int a,b;
		std::cin >> a >> b;
		alb.emplace_back(b,a);
	}
	std::vector<int> temp(m);
	std::iota(all(temp),1);
	std::set<int > remaining(all(temp));

	int sum = 0;

	std::sort(all(alb),std::greater<std::pair<int,int> >());

	for(auto i:alb) {
		auto k = remaining.lower_bound(i.second);
		if(k==remaining.end()) continue;
		sum+=i.first;
		remaining.erase(k);
	}

	print(sum);

	return 0;
}


Measured memory_bytes: 7296
x,y=map(int,input().split())
if abs(x)==abs(y):
  print((x*y<0)+0)
elif x*y==0:
    print(abs(x-y)+(x>0 or y<0)*1)
elif x*y<0:
  print(1+abs(abs(x)-abs(y)))
else:
  if x<y:
    print(abs(abs(x)-abs(y)))
  else:
    print(2+abs(abs(x)-abs(y)))


Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <cmath>
#include <map>
#define INF 100000000
#define MAX_C 100
using namespace std;
map<int, int> mp;
int main()
{
	int a, b;
	cin >> a >> b;
	cout << (b - a) * (b - a + 1) / 2 - b << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0; i<n; ++i)
#define rep1(i,n) for(ll i=1; i<=n; ++i)
#define revrep(i,n) for(ll i=n-1; n>=0; --i)
inline constexpr ll Inf = (1ULL << 62) -1;

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

int main() {
    ll ans=0, N, M;
    cin >> N >> M;
    vector<int> H(N);
    vector<int> v(N);
    rep(i,N) cin >> H[i];
    map<int, vector<int>> e;
    rep(i,M) {
        int a,b;
        cin >> a >> b;
        --a;
        --b;
        e[a].push_back(b);
        e[b].push_back(a);
    }
    rep(i,N) {
        if (v[i] == 0) {
            int h = H[i];
            for (int t : e[i]) {
                if (h > H[t]) {
                    v[t] = -1;
                } else if (h < H[t]) {
                    v[i] = -1;
                } else {
                    v[t] = v[i] = -1;
                }
            }
            if (v[i] == 0)
                v[i] = 1;
        }
    }
    rep(i,N) {
        if (v[i] == 1)
            ans++;
    }
    cout << ans << endl;
}


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

int main(){
    int n,k;
    cin >> n >> k;
    int a,b;
    int num = 1;
    for (int i = 0;i < n;i++){
        a = num * 2;
        b = num + k;
        num = min(a,b);
    }
    cout << num << endl;
}

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

int main()
{
  int N, X, L;

  cin >> N >> X;

  int D = 0;
  int ans = 1;

  for (int i = 0; i < N; i++) {
    cin >> L;
    D += L;
    if (D > X) break;
    ans++;
  }

  cout << ans << endl;
}


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

vector<int> G[100001];

bool bipa;
bool visited[100001];
int col[100001];

void dfs(int v){
    int i;
    if(bipa){
        for(i=0; i<G[v].size(); i++){
            if(bipa){
                if(visited[G[v][i]]==0){
                    visited[G[v][i]]=1;
                    col[G[v][i]]=(!col[v]);
                    dfs(G[v][i]);
                }else{
                    if(col[G[v][i]]==col[v]){
                        bipa=0;
                    }
                }
            }
        }
    }
}

int main(){
    //input
    long long N,M;
    cin >> N >> M;
    int A,B;
    int i;
    for(i=0; i<M; i++){
        cin >> A >> B;
        G[A].push_back(B);
        G[B].push_back(A);
    }

    //calc
    bipa=1;
    visited[1]=1;
    col[1]=1;
    dfs(1);
    long long ans;
    if(bipa){
        long long odd=0, even=0;
        for(i=1; i<=N; i++){
            if(col[i]==1){
                odd++;
            }else{
                even++;
            }
        }
        ans=odd*even-M;
    }else{
        ans=(N*(N-1))/2-M;
    }

    //output
    cout << ans << endl;
    system("pause");
    return 0;
}

Measured memory_bytes: 9956
#include <stdio.h>
int main(void) {
	int w,h,x,y,r;
	scanf("%d %d %d %d %d\n",&w,&h,&x,&y,&r);
	0 < w <= 100;
	0 < h <= 100;
	0 < r <= 100; 
	
	if(0<=(x-r) && (x+r)<=w && h>=(y+r) && 0<=(y-r))
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}



Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e15;

#include <math.h>
#define PI 3.14159265358979323846264338327950L
const int mxN = 2e2;

int main() {
    string s;
    cin >> s;
    int n = s.length();
    long long sum = 0;
    for (int i = 0; i < n; i++) {
        sum += stoi(s.substr(i, 1));
    }
    if (sum % 9 == 0) {
        cout << "Yes";
    }
    else {
        cout << "No";
    }
    return 0;
}

Measured memory_bytes: 3760
using System;
using System.Collections.Generic;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            if (str[2] == str[3] && str[4] == str[5]) Console.WriteLine("Yes");
            else Console.WriteLine("No");
           
        }
    }
}

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

int main(){
  int n;
  cin >> n;
  n *= 2;
  int l[n];
  
  for(int i = 0; i < n; i++){
    cin >> l[i];
  }
  sort(l, l+n);
  int ans = 0;
  for(int i = 0; i < n; i += 2){
    ans += l[i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))
m = [0] * n
m[0] = 0
m[1] = abs(h[0] - h[1])
for i in range(2, n):
    m[i] = min(m[i-2] + abs(h[i-2] - h[i]), m[i-1] + abs(h[i-1] - h[i]))
print(m[n-1])


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

int main() {
  int32_t n, k;
  std::cin >> n >> k;

  int32_t index;

  for (int32_t i = 0; i < n; i++) {
    int32_t a;
    std::cin >> a;
    if (a == 1) {
      index = i;
    }
  }

  const auto left =
    static_cast<int32_t>(std::ceil(static_cast<double>(index) / (k - 1)));
  auto extra = index % (k - 1);
  if (extra != 0) {
    extra = k - 1 - extra;
  }
  const auto right =
    static_cast<int32_t>(
      std::ceil(static_cast<double>(n - 1 - index - extra) / (k - 1)));

  std::cout << left + right << std::endl;
  return 0;
}

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

int main(){
  string a,b,c;
  cin>>a>>b>>c;
  
  if(a[a.size()-1]==b[0]&&b[b.size()-1]==c[0]){
    cout<<"YES"<<endl;
  }
  else{
    cout<<"NO"<<endl;
  }
}

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

using namespace std;

typedef long long ll;

ll n;
vector<ll> ans1, ans2;

int main()
{
    cin>>n;
    for(ll i = 1; i <= n; i++)
    {
        for(ll j = i + 1; j <= n; j++)
        {
            if(i + j == n / 2 * 2 + 1) continue;
            ans1.push_back(i), ans2.push_back(j);
        }
    }
    cout<<ans1.size()<<endl;
    for(ll i = 0; i < ans1.size(); i++)
    {
        cout<<ans1[i]<<' '<<ans2[i]<<'\n';
    }
    return 0;
}


Measured memory_bytes: 384
# https://atcoder.jp/contests/arc086/tasks/arc086_a

from collections import Counter

n, k = [int(i) for i in input().split()]
A = Counter([int(i) for i in input().split()])

A = sorted(A.items(), key=lambda x: x[1])

ans = 0
res = len(A) - k
if res < 1:
    print(0)
else:
    for i in range(res):
        _, cnt = A[i]
        ans += cnt
    print(ans)


Measured memory_bytes: 129200
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define all(x) (x).begin(), (x).end()
#define endl '\n'
#define fsp(x) cout << fixed << setprecision(x)
const ll inf = LLONG_MAX;
const long double pi = M_PI;
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
  ll n, x;
  cin >> n >> x;
  vll a(n);
  for (ll i = 0; i < n; i++) cin >> a[i];

  sort(all(a));
  for (ll i = 0; i < n; i++) {
    x -= a[i];
    if (x < 0) {
      cout << i << endl;
      return 0;
    }
  }
  if (x == 0) cout << n << endl;
  else cout << n - 1 << endl;
}

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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define RREP(i,s,n) for(lli i=s;i>=n;i--)
#define MOD 1000000007
#define NUM 2520
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define INF (1LL<<50)


signed main(){

	lli n;
	cin>>n;

	cout<<(n/2)*((n+1)/2)<<endl;
	

	return 0;
}

Measured memory_bytes: 256
from itertools import product

N = int(input())
S = input()

cnt = 0
for i, j, k in product(range(10), repeat=3):
    try:
        x = S.index(str(i))
        y = S.index(str(j), x + 1)
        z = S.index(str(k), y + 1)
    except:
        continue
    cnt += 1

print(cnt)


Measured memory_bytes: 3060