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

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

const int N = 1e5 + 10;
// const int N = 3;

int get_first(const bitset<N>& x) {
  for (int i = N - 1; i >= 0; --i) {
    if (x[i]) return i;
  }
  return -1;
}

int main() {
  int n;
  scanf("%d", &n);
  vector<bitset<60>> a(n);
  vector<int> cnt(60);
  for (int i = 0; i < n; ++i) {
    int64 x;
    scanf("%lld", &x);
    a[i] = x;
    for (int k = 0; k < 60; ++k) {
      cnt[k] += a[i][k];
    }
  }
  int64 ret = 0;
  vector<bitset<N>> row;
  vector<int> B;
  for (int k = 59; k >= 0; --k) {
  // for (int k = 2; k >= 0; --k) {
    if (cnt[k] > 0 && cnt[k] % 2 == 0) {
      bitset<N> cur = 0;
      for (int i = 0; i < n; ++i) {
        if (a[i][k]) cur.set(i);
      }
      row.push_back(cur);
      B.push_back(1);
      for (int i = 0; i < row.size() - 1; ++i) {
        int pre_first = get_first(row[i]);
        int cur_first = get_first(row.back());
        if (pre_first < cur_first) {
          swap(row[i], row.back());
          swap(B[i], B.back());
        } else if (pre_first == cur_first) {
          row.back() ^= row[i];
          B.back() ^= B[i];
        }
      }
      if (row.back() == 0) {
        if (B.back() == 0) {
          ret += 1LL << (k + 1);
        }
        row.pop_back();
        B.pop_back();
      } else {
        ret += 1LL << (k + 1);
      }
      // for (int i = 0; i < row.size(); ++i) {
      //   cout << row[i] << " " << B[i] << endl;
      // }
      // trace(ret);
    } else {
      int64 x = cnt[k] % 2;
      ret += x << k;
    }
  }
  printf("%lld\n", ret);
  return 0;
}


Measured memory_bytes: 2052
n = int(input())
p = list(map(int,input().split()))

ans = 0
for i in range(1,len(p)-1):
    if p[i-1] < p[i] and p[i] < p[i+1]:
        ans += 1
    elif p[i-1] > p[i] and p[i] > p[i+1]:
        ans += 1
    else:
        pass

print(ans)

Measured memory_bytes: 3060
char s[9];x,l,i;P(a){
	for(sprintf(s,"%d",a),l=strlen(s),x=0;x<l&s[x]==s[l-x-1];x++);
	return x==l;
}
main(n){for(scanf("%d",&n);;i++){
	if(P(n-i))printf("%d\n",n-i),exit(0);
	if(P(n+i))printf("%d\n",n+i),exit(0);
}}

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

char a[ 101 ];
char b[ 101 ];
bool cmp(char x,char y){
	return x > y;
}
int main()
{
	gets(a);
	gets(b);
	int la = strlen(a), lb = strlen( b );
	sort( b , b + lb, cmp);
	sort( a , a + la);
	if(strcmp(a , b ) < 0)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

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


Measured memory_bytes: 13928
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define f first
#define s second
typedef pair<int,int> pi;
#define FAST ios_base::sync_with_stdio(0);
const int maxn = 100010;

int n,k;
deque <int> dq;

void fail() {
	cout << "-1";
	exit(0);
}

int32_t main() {
	cin >> n >> k;
	if (k > (1<<n)-1) fail();
	
	if (n == 1) {
		if (k == 0) cout << "0 0 1 1";
		else fail();
		return 0;
	}
	
	dq.push_back(k);
	for (int i =0;i<=(1<<n)-1;i++) {
		if (i == k) continue;
		dq.push_front(i);
		dq.push_back(i);
	}
	dq.push_back(k);
	for (auto i: dq) {
		cout << i << " ";
	}
}





Measured memory_bytes: 3968
H,W,N=map(int,input().split())
p=[list(map(int,input().split())) for i in range(N)]
from collections import defaultdict
d=defaultdict(int)
from itertools import product
r=[0]*10
for x,y in p:
    x-=1
    y-=1
    for i,j in product(range(3),repeat=2):
        if 0<=x-2+i and x+i<H and 0<=y-2+j and y+j<W:
            d[(x-2+i,y-2+j)]+=1
from collections import Counter
c=Counter(d.values())
for i in range(len(c)):
    r[c.most_common()[i][0]]=c.most_common()[i][1]
r[0]=(H-2)*(W-2)-sum(r[1:])
print(*r,sep='\n')

Measured memory_bytes: 191196
n = int(input())
a = list(map(int, input().split()))
a.sort()
b = {}
for i in range(len(a)):
    if a[i] in b:
        b[a[i]] += 1
    else:
        b[a[i]] = 1
twins = []
now = 1
while now <= a[-1]:
    now *= 2
    twins.append(now)
for i in range(len(a) - 1, -1, -1):
    tmpa = 0
    if  b[a[i]] == 0:
        continue
    for j in range(len(twins) - 1, -1, -1):
        if twins[j] <= a[i]:
            break
        tmpa = twins[j] - a[i]
    if tmpa == a[i]:
        if b[tmpa] >= 2:
            b[tmpa] -= 2
    elif tmpa in b and b[tmpa] != 0:
        b[tmpa] -= 1
        b[a[i]] -= 1
countb = 0
for i in b:
    countb += b[i]
print((n - countb) // 2)



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

int main(){
  string A,B;
  cin >>A>>B;
  
  string ans;
  if(A.size()>B.size()) ans = "GREATER";
  else if(A.size()<B.size()) ans = "LESS";
  else{
    repeat(i,0,A.size()){
      if(A[i]-B[i]>0){
        ans = "GREATER";
        break;
      }else if(A[i]-B[i]<0){
        ans = "LESS";
        break;
      }else if(A[i]==B[i] and i==A.size()-1){
        ans = "EQUAL";
      }
    }
  }
  cout <<ans<< endl;
}


Measured memory_bytes: 256
n = input()
if n[-1] == '2' or n[-1] == '4' or n[-1] == '5' or n[-1] == '7' or n[-1] == '9':
    print('hon')
elif n[-1] == '0' or n[-1] == '1' or n[-1] == '6' or n[-1] == '8':
    print('pon')
else:
    print('bon')

Measured memory_bytes: 9120
#include <bits/stdc++.h>
using namespace std;
using ll=long long;

int main() {
	int N;
	cin>>N;
	
	map<string,int> zisyo;
	for(int i=0;i<N;i++){
		string s;
		cin>>s;
		if(zisyo.count(s))zisyo[s]++;
		else zisyo[s]=1;
	}
	
	int saihin=0;
	for(auto z:zisyo){
		saihin=max(saihin,z.second);
	}
	
	vector<string> ans;
	for(auto z:zisyo){
		if (z.second==saihin)ans.push_back(z.first);
	}
	
	sort(ans.begin(),ans.end());
	for(auto i:ans)cout<<i<<endl;
	
}


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

int N,i,p[10],mx=0,sum,c=0;

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

	cin >> N;

	for (i = 0; i < N; i++) {
		cin >> p[i];
		if (p[i] > mx) {
			mx = p[i];
		}

	}
	
	for (i = 0; i < N; i++) {
		if (c == 0) {
			if (p[i] == mx) {
				p[i] = 0;
				c += 1;
			}
		}

		sum += p[i];
	}

	mx /= 2;
	sum += mx;

	cout << sum << endl;

	return 0;

}

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

namespace AtCoder
{
    class Program
    {

        static void Main()
        {
            //ここから

            int[] str = ReadLineToIntArray();
            double ans = (double)str[0] / str[1];


            //ここまで

            Console.WriteLine(ans);
            Console.ReadKey();
        }


        static public void Swap<T>(ref T a,ref T b) { T temp = a;a = b;b = temp; }
        static public long GCD(int a, int b){ return b != 0 ? GCD(b, a % b) : a;}
        static public long LCM(int a, int b){ return (long)a * b / GCD(a, b); }



        
        static public string ReadLineToString(){return Console.ReadLine();}
        static public int ReadLineToInt(){return int.Parse(Console.ReadLine());}
        static public long ReadLineToLong() { return long.Parse(Console.ReadLine()); }
        static public string[] ReadLineToStringArray(){return Console.ReadLine().Split(' ').ToArray();}
        static public int[] ReadLineToIntArray(){return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();}
        static public long[] ReadLineToLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public List<string> ReadLineToStringList(){return Console.ReadLine().Split(' ').ToList();}
        static public List<int> ReadLineToIntList(){return Console.ReadLine().Split(' ').Select(int.Parse).ToList();}
        static public List<long> ReadLineToLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }
    }
    
}


Measured memory_bytes: 13396
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        int k = scan.nextInt();
        int even,odd;
        even=odd=k/2;
        if(k%2==1){
            odd+=1;
        }
        System.out.println(even*odd);
    }
}


Measured memory_bytes: 20948
//---------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
//---------------------------------------------------------------
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define SIZE 100005
#define INF 1000000000000000LL
#define all(x) x.begin(),x.end()
using pint = pair<int,int>;
using vec = vector<int>;
using ll=long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
//---------------------------------------------------------------
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; }
//---------------------------------------------------------------

//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓


//素数pair(特定の素因数,特定の素因数を含む個数)
vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0;
        while (N % a == 0) {
            ++ex;
            N /= a;
        }
        res.push_back({a, ex});
    }
    if (N != 1) res.push_back({N, 1});
    return res;
}

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

    ll a,b; cin>>a>>b;
    ll g = __gcd(a,b);
    const auto num = prime_factorize(g);
    ll ans= num.size() + 1;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,i,a[50000],m;
	while(cin>>n,n){
		m=1000000;
		for(i=0;i<n;i++)cin>>a[i];
		sort(a,a+n);
	    for(i=1;i<n;i++)m=min(m,a[i]-a[i-1]);
	    cout<<m<<endl;
	}
}

Measured memory_bytes: 3092
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 1000000010;
constexpr ll INF= 1000000000000000000;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<ll,ll> P;

template<typename T>
T Pow(T a,T b) {
    T ret = 1;
    for(int i = 0;i < b;i++) {
        ret *= a;
    }
    return ret;
}

ll mod(ll val) {
    ll res = val % MOD;
    if(res < 0) {
        res += MOD;
    }
    return res;
}

ll RS(ll N, ll P, ll M){
    if(P==0) return 1;
    if(P < 0) {
        return 0;
    }
    if(P%2==0){
        ll t = RS(N, P/2, M);
        return t*t % M;
    }
    return N * RS(N, P-1, M) % M;
}

ll fac[2000010], finv[2000010], inv[2000010];

// テーブルを作る前処理
void COMinit()
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < 2000010; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    ll K;
    cin >> K;
    string S;
    cin >> S;
    ll N = S.size();
    ll ret = 0;
    COMinit();
    for(int i = 0;i <= K;i++) {
        ret += COM(N + (K - i) - 1,(K - i)) * (RS(25,K - i,MOD) * RS(26,i,MOD) % MOD) % MOD;
        ret %= MOD;
    }
    cout << ret << endl;
}

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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

const int N = 1e5 + 5;
const ll MOD = 1e9 + 7;

int n;
map<int, int> m;

ll fac[N], inv[N], ans[N];

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

void comp() {
    fac[0] = fac[1] = 1;
    rep(i, 2, N)
        fac[i] = i * fac[i - 1] % MOD;

    rep(i, 0, N) 
        inv[i] = bpow(fac[i], MOD - 2);
}

ll combo(ll n, ll k) {
    ll res = 1;
    res = res * fac[n] % MOD;
    res = res * inv[k] % MOD;
    res = res * inv[n - k] % MOD;
    return res;
}

int main() {
	cin.tie(0)->sync_with_stdio(0);
    comp();
    int bi, ei;
    cin >> n;
    rep(i, 0, n + 1) {
        int a;
        cin >> a;
        if (m.count(a)) {
            bi = m[a];
            ei = i;
            // cout << "DUPE IS " << a << '\n';
            break;
        } else m[a] = i;
    }

    rep(i, 1, n + 2) 
        ans[i] = combo(n + 1, i);

    // Get rid of dupes
    // cout << bi << ' ' << ei << '\n';
    ei = n - ei;
    // Now bi & ei are how many after the dupes 

    // How many taken from possible dupes
    rep(i, 0, ei + bi + 1) {
        ans[i + 1] -= combo(bi + ei, i);
        ans[i + 1] += MOD;
        ans[i + 1] %= MOD;
    }

    rep(i, 1, n + 2) {
        cout << ans[i] << '\n';
    }
}


Measured memory_bytes: 10632
#include<stdio.h>
int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	if(a>b)
	{
		printf("a > b\n");
	}
	else if(a<b)
	{
		printf("a < b\n");
	}
	else if(a==b)
	{
		printf("a == b\n");
	}
	return 0;
	
	
}

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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}
int n, m;
std::vector<std::vector<int> > hen;
std::vector<std::vector<int> > rev;

std::vector<bool> used;
std::vector<int> ord;
void dfs1(int i) {
	for (auto j : hen[i]) {
		if (used[j]) continue;
		used[j] = true;
		dfs1(j);
	}
	ord.push_back(i);
}
int cnt = 0;
std::vector<int> grp;
void dfs2(int i) {
	for (auto j : rev[i]) {
		if (used[j]) continue;
		used[j] = true;
		dfs2(j);
	}
	grp[i] = cnt;
}

int main() {
	n = ri(), m = ri();
	hen.resize(n);
	rev.resize(n);
	int ss[m], tt[m];
	for (int i = 0; i < m; i++) {
		int s = ri(), t = ri();
		hen[s].push_back(t);
		rev[t].push_back(s);
		ss[i] = s;
		tt[i] = t;
	}
	used.resize(n);
	for (int i = 0; i < n; i++) {
		if (!used[i]) {
			used[i] = true;
			dfs1(i);
		}
	}
	used.assign(n, false);
	grp.resize(n);
	std::reverse(ord.begin(), ord.end());
	assert((int) ord.size() == n);
	for (auto i : ord) {
		if (!used[i]) {
			used[i] = true;
			dfs2(i);
			cnt++;
		}
	}
	std::vector<bool> isha(cnt, 1);
	std::vector<bool> ishha(cnt, 1);
	if (cnt == 1) {
		std::cout << 0 << std::endl;
		return 0;
	}
	for (int i = 0; i < m; i++) {
		if (grp[ss[i]] == grp[tt[i]]) continue;
		isha[grp[ss[i]]] = 0;
		ishha[grp[tt[i]]] = 0;
	}
	std::cout << std::max(std::accumulate(isha.begin(), isha.end(), 0), std::accumulate(ishha.begin(), ishha.end(), 0)) << std::endl;
	
	return 0;
}



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

int dp[2][2300][3300];

 
int main(){
    int n,m,s;
    while(cin>>n>>m>>s){
        if(n==0&&m==0&&s==0)break;
         
         
        rep(i,2)rep(j,2300)rep(k,3300)dp[i][j][k]=0;
        dp[0][0][0] = 1;
         
        for(int i=1;i<=n*n;i++){
            for(int j=0;j<2300;j++)
                for(int k=0;k<3300;k++)
                    dp[i%2][j][k] = 0;
            for(int j=1;j<=m;j++){
                for(int k=1;k<=s;k++){
                    if(k-j>=0){
                        dp[i%2][j][k] += dp[i%2][j-1][k-1] + dp[(i-1)%2][j-1][k-j];
                        dp[i%2][j][k] %= 100000;
                    }
                }
            }
        }
         
 
        ll ans = 0;
        for(int i=0;i<=m;i++){
            ans+=dp[(n*n)%2][i][s];
            ans%=100000;
        }
        cout<<ans<<endl;   
    }
}

Measured memory_bytes: 60452
n,y=(int(i) for i in input().split())
ass=False
for i in range(n+1):
  for j in range(n+1-i):
    yy=y-10000*i-5000*j
    a=n-i-j
    if yy==1000*a:
      ass=True
      p=i;q=j;r=a
      break
if ass:
  print(p,q,r)
else:
  print(-1,-1,-1)

Measured memory_bytes: 3064
program mp2
  implicit none
  integer(16) :: N, i
  integer(16),allocatable :: a(:)
  integer(16) :: r

  read(*,*) N
  allocate(a(N))
  read(*,*) a

  do i = 1, N
     if (a(i) == 0) then
        write(*,*) 0
        stop
     end if
  end do

  r = 1_16
  do i = 1, N
     r = r * a(i)
     if (r > 10_16**18_16) then
        write(*,*) -1
        stop
     end if
  end do
  write(*,*) r
  deallocate(a)
  stop
end program mp2


Measured memory_bytes: 4612
#include <bits/stdc++.h>
using namespace std;
//define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define fi first
#define se second
// 許容する誤差ε
#define EPS (1e-10)
// 2つのスカラーが等しいかどうか
#define EQ(a,b) (abs((a)-(b)) < EPS)
// 2つのベクトルが等しいかどうか
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
//template
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p){
  os << "(" << p.first << "," << p.second << ")";return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  for (auto it = v.begin();it != v.end();++it){
    if(it != v.begin())os << " ";os << *it;
      }return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &mp){
  for(auto x: mp)os << "(" << x.first << "," << x.second << ")" << endl;
  return os;
}
template<typename T, int SIZE>
int array_length(const T (&)[SIZE]){return SIZE;}
template<typename T, int N>
void PRINTF(const T (&a)[N], int s = N, int t = -1, bool f = true){
	if(t == -1){rep(i,s){if(i)cout << " ";cout << a[i];}}
	else repi(i,s,t){if(i!=s)cout << " ";cout << a[i];}
	if(f)cout << "\n";
}
template<typename T, int N1, int N2>
void PRINTF(const T (&a)[N1][N2], int h = N1, int w = N2){
	rep(i,h){rep(j,w){cout << a[i][j] << " \n"[j==w-1];}}
}
//typedef
typedef complex<double> Point;
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;


double dot(Point a, Point b) {
  return (a.real() * b.real() + a.imag() * b.imag());
}
double cross(Point a, Point b) {
  return (a.real() * b.imag() - a.imag() * b.real());
}

Point mid(Point a, Point b){
  double x = (a.real()+b.real())/2.0;
  double y = (a.imag()+b.imag())/2.0;
  // cout << a << " " << b << endl;
  return Point(x, y);
}

Point intersection_l(Point a1, Point a2, Point b1, Point b2) {
  Point a = a2 - a1; Point b = b2 - b1;
  return a1 + a * cross(b, b1-a1) / cross(b, a);
}


signed main(){
  int n;
  scanf("%lld", &n);
  rep(i,n){
    vector<Point> vec(3);
    rep(j,3){
      double x, y;
      scanf("%lf%lf", &x, &y);
      vec[j] = Point(x, y);
    }
    
    Point v1 = (vec[1]-vec[0])*Point(0, 1);
    Point v2 = (vec[2]-vec[1])*Point(0, 1);
    Point mid1 = mid(vec[0], vec[1]);
    Point mid2 = mid(vec[1], vec[2]);
    Point p1 = mid1+v1;
    Point p2 = mid2+v2;
    Point p = intersection_l(mid1, p1, mid2, p2);
    printf("%.3lf %.3lf %.3lf\n", p.real(), p.imag(), abs(p-vec[0]));
  }
	return 0;
}











Measured memory_bytes: 3132
n = int(input())
a = list(map(int,input().split()))
b = {}
for x in a:
  try:
    if b[x] != -1:
      b[x] += 1
  except:
    b[x] = 1
q = int(input())
ans = sum(a)
for _ in range(q):
  x,y = map(int,input().split())
  try:
    if b[x] != -1:
      bx = b[x]
      b[x] = 0
  except:
    print(ans)
    continue
  try:
    if b[y] != -1:
      b[y] += bx
  except:
    b[y] = bx
  ans += bx * (y-x)
  print(ans)

Measured memory_bytes: 85236
import sys,queue,math,copy,itertools,bisect,collections,heapq
from fractions import gcd

def main():
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())

    N = NI()
    A = LI()
    dp = [[0,0] for _ in range(N-1)]
    dp[0] = [A[0],A[1]]
    for i in range(1,N-1):
        dp[i][0] = gcd(dp[i-1][0],A[i])
        dp[i][1] = max(gcd(dp[i-1][0],A[i+1]),gcd(dp[i-1][1],A[i+1]))
    print(max(dp[-1]))

if __name__ == '__main__':
    main()

Measured memory_bytes: 91616
FAST_IO = 1
if FAST_IO:
    import io, sys, atexit
    rr = iter(sys.stdin.read().splitlines()).next
    sys.stdout = _OUTPUT_BUFFER = io.BytesIO()

    @atexit.register
    def write():
        sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
else:
    rr = raw_input
rri = lambda: int(rr())
rrm = lambda: map(int, rr().split())
rrmm = lambda n: [rrm() for _ in xrange(n)]

L, R, D = rrm()
L = (L/D+int(L%D!=0))*D
R = R/D*D
n = R/D-L/D+1
print(n)


Measured memory_bytes: 64588
#include <bits/stdc++.h>
using namespace std;
#define fl(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define endl '\n'
#define pb push_back
#define ff first
#define ss second
#define mod 1000000007
#define mx 100001
#define inf 2e9
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int main()
{
	fast;
	int n,k;
	cin>>n>>k;
	int h[n+1]={0};
	for(int i=0;i<n;i++)
		cin>>h[i];
	std::vector<int> dp(n,inf);
	dp[0]=0;
	for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<=i+k;j++)
        {
            if(j<n)
                dp[j]=min(dp[j],dp[i]+abs(h[j]-h[i]));
        }
    }
    cout<<dp[n-1]<<endl;;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
typedef long long i64;
using std::cout;
using std::endl;
using std::cin;

int main() {
	i64 n, m, t; cin >> n >> m >> t; std::vector<i64> a(n);
	for(int i = 0; i < n; i++) cin >> a[i];
	sort(begin(a), end(a));
	
	std::vector<std::vector<i64>> dp(20, std::vector<i64>(t, -(1LL << 60))); dp[0][0] = 0;
	for(int i = 0; i < n; i++) {
		dp[0][a[i] % t] = std::max(dp[0][a[i] % t], a[i]);
	}
	
	for(int k = 0; m >> (k + 1); k++) {
		for(int i = 0; i < t; i++) {
			for(int j = 0; j < t; j++) {
				dp[k + 1][(i + j) % t] = std::max(dp[k + 1][(i + j) % t], dp[k][i] + dp[k][j]);
			}
		}
	}
	
	int c = 0;
	std::vector<std::vector<i64>> dp2(2, std::vector<i64>(t, -(1LL << 60))); dp2[0][0] = 0;
	for(int k = 0; m >> k; k++) {
		if((m >> k & 1) == 0) continue;
		
		int cur = c % 2, to = 1 - c % 2; c++;
		dp2[to] = std::vector<i64>(t, -(1LL << 60)); dp2[0][0] = 0;
		for(int i = 0; i < t; i++) {
			for(int j = 0; j < t; j++) {
				dp2[to][(i + j) % t] = std::max(dp2[to][(i + j) % t], dp2[cur][i] + dp[k][j]);
			}
		}
	}
	
	int q; cin >> q;
	while(q--) {
		int a, b; cin >> a >> b;
		
		bool f = false;
		for(int i = a; i < t; i++) f |= b <= dp2[c % 2][i] / t;
		if(f) cout << "yes" << endl;
		else cout << "no" << endl;
	}
	return 0;
}



Measured memory_bytes: 3696
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(long long i=0; i<(n); i++)
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; }

ll cnt = 0;
vector<pair<ll,ll>> res;
vector<ll> ord(100005, -1), pre(100005, -1);
vector<vector<ll>> edge(100005);

void dfs(ll i, ll j){
    ord[i] = cnt;
    pre[i] = cnt;
    cnt++;
    for(ll x : edge[i]){
        if(x == j) continue;
        if(ord[x] > -1) chmin(pre[i], pre[x]);
        else dfs(x, i);
    }
    if(j > -1) chmin(pre[j], pre[i]);
    if(j > -1 && pre[i] > ord[j]) res.push_back({min(i, j), max(i, j)});
    return;
}

int main(){
    ll v,e; cin>>v>>e;
    rep(i, e){
        ll s,t; 
        cin>>s>>t;
        edge[s].push_back(t);
        edge[t].push_back(s);
    }
    vector<ll> ord(v, -1), pre(v, -1);
    dfs(0, -1);
    sort(res.begin(), res.end());
    for(pair<ll,ll> p : res){
        cout<<p.first<<' '<<p.second<<endl;
    }

    return 0;
}


Measured memory_bytes: 9032
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>

using namespace std;

bool less_second(pair<int, int> a, pair<int, int> b){
    if (a.second != b.second){
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

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

    vector<pair<int, int>> red(n), blue(n);
    for (int i = 0; i < n; i++){
        cin >> red[i].first;
        cin >> red[i].second;
    }
    for (int i = 0; i < n; i++){
        cin >> blue[i].first;
        cin >> blue[i].second;
    }

    sort(red.begin(), red.end(), greater<pair<int, int>>());
    sort(blue.begin(), blue.end(), less_second); 

    int ans = 0;
    for (int i = 0; i < n; i++){
        for (int j = 0; j < blue.size(); j++){
            if (red[i].first < blue[j].first && red[i].second < blue[j].second){
                ans++;
                blue.erase(blue.begin() + j);
                break;
            }
        }
    }

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

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

using namespace std;

const int MAXN = 100 * 1000 + 10;

int cl[MAXN];
vector<int> edges[MAXN];

bool dfs(int v)
{	
	for (int i = 0; i < edges[v].size(); i++)
	{
		int u = edges[v][i];
		if (cl[u] == -1)
		{
			cl[u] = cl[v] ^ 1;
			if (!dfs(u))
				return false;
		}
		else if (cl[u] == cl[v])
			return false;

	}
	return true;
}

int main()
{
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < m; i++)
	{
		int a, b;
		cin >> a >> b;
		a--, b--;
		edges[a].push_back(b);
		edges[b].push_back(a);
	}
	for (int i = 0; i < n; i++)
		cl[i] = -1;
	cl[0] = 0;
	bool pos = dfs(0);
	if (pos)
	{	

		int sz = 0;
		for (int i = 0; i < n; i++)
			if (cl[i])
				sz++;
		cout << (long long)sz * (n - sz) - m << endl;
	}
	else
		cout << (long long)n * (n - 1) / 2 - m << endl;

}

Measured memory_bytes: 6528
#include<bits/stdc++.h>
long long n,ans;
long long gcd(long long x,long long y)
{
   if(y==0) 
		return x;
   else 
   		return gcd(y,x%y);
}
long long  lcm(long long x,long long  y){
   return x/gcd(x,y)*y;
}
using namespace std;
int main(){ 
   cin>>n;
   ans=lcm(n,2);
   cout<<ans;
   return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(){

    int N;
    cin >> N;
    vector<long long> A(N);
    for(int i=0;i<N;i++)
        cin >> A[i];

    for(int i=0;i<N;i++){
        if(A[i] == 0){
            cout << 0;
            return 0;
        }
    }

    long long MAX = pow(10,18);
    int keta1=0,keta2=0;
    long long res = 1;
    for(int i=0;i<N;i++){
        keta1 = log10(res);
        keta2 = log10(A[i]);
        res *= A[i];
        if(((keta1 + keta2 >= 18) && (res != MAX)) || (res > MAX)){
            res = -1;
            break;
        }
    }

    cout << res;
    return 0; 
}

Measured memory_bytes: 4116
#include <bits/stdc++.h>
using namespace std;
int N,K,d,x;
bool arr[101];
int main(){
	cin>>N;
	cin>>K;
	memset(arr,0,sizeof arr);
	for(int u=0; u<K; u++){
		cin>>d;
		for(int i=0; i<d; i++){
			cin>>x;
			arr[x]=true;
		}
	}
	int total=0;
	for(int i=1; i<=N; i++){
		if(!arr[i]){
			total++;
		}
	}
	cout<<total<<'\n';
}

Measured memory_bytes: 3632
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int D = sc.nextInt();
        int X = sc.nextInt();
        int count=0;
 
        for(int i=0;i<N;i++) {
        	int A = sc.nextInt();
        	int x=0;
        	while(x*A+1<=D){
        		count++;
        		x++;
        	}
        	}
        System.out.println(X+count);
        }
}

Measured memory_bytes: 23252
#include<bits/stdc++.h>
using namespace std;
#define ar array
#define endl '\n'
#define ll long long
#define in insert
#define pb push_back
#define vt vector
#define P_Q(x) priority_queue<x>
#define p_q(x) priority_queue<x, vector<x>, greater<x>>
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define Rev(i,a,b) for(ll i=a;i>=b;i--)
#define FOR(m) Rep(i,1,m)
#define For(m) Rep(i,0,m-1)
#define Rbl(x,a) for(auto &x : a)
#define FIO ios::sync_with_stdio(0);   cin.tie(0);
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define vpii vector<pii>
#define vpll vector<pll>
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()
const ll INF = 0x3f3f3f3f3f3f3f3fll;
#define mod 1000000007
 
const int mxN = 400 + 1;
vt<ll> a;
ll dp[mxN][mxN];
ll n;
 
 
int main()
{
FIO
 
    cin >> n;
    a = vt<ll>(n);
    For(n) 
    {
        cin >> a[i];
    }

    Rev(i,n-1,0)
    {
        dp[i][i] = 0;
        ll sum = a[i];
        Rep(j,i+1,n-1)
        {
            sum += a[j];
            dp[i][j] = INF;
            Rep(k,i,j-1)
            {
                dp[i][j] = min(dp[i][j], dp[i][k] + dp[k+1][j] + sum);
            }
        }
    }

    cout << dp[0][n-1] << endl;

    return 0;
}

Measured memory_bytes: 4916
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP2(i, x, n) for(int i = x; i < (int)(n); i++)
#define ALL(n) begin(n), end(n)
//struct cww{cww(){ios::sync_with_stdio(false);cin.tie(nullptr);}}star;
const long long INF = numeric_limits<long long>::max();

int main() {
  const int array[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  int k;
  scanf("%d", &k);


  printf("%d\n", array[k - 1]);
  return 0;
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
cnt=0
f=True
while f:
	for i in range(n):
		if a[i]>2 and a[i]%2==0:
			a[i]=a[i]//2
			cnt+=1
		else:
			a[i]=3*a[i]
			
	for ai in a:
		if ai%2==0:
			break
	else:
		f=False
			
print(cnt)

Measured memory_bytes: 9948
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
#define inf 1e9


int main(){
	int n;
	cin>>n;
	int x,y,z;
	set<int> a,b,c;
	cin>>x;
	for(int i=0;i<x;i++){
		int tmp;
		cin>>tmp;
		a.insert(tmp);
	}
	cin>>y;
	for(int i=0;i<y;i++){
		int tmp;
		cin>>tmp;
		b.insert(tmp);
	}

	cin>>z;
	for(int i=0;i<z;i++){
		int tmp;
		cin>>tmp;
		c.insert(tmp);
	}
	int cnt = 0;
	for(int i=1;i<=n;i++){
		if(c.find(i) != c.end()){
			if( a.find(i) == a.end() || b.find(i) != b.end() ) cnt++;
		}
	}
	cout<<cnt<<endl;


	return 0;
}



Measured memory_bytes: 3104
#include <iostream>
#include <cmath>
#include<iomanip>
using namespace std;
typedef long long ll;


int main(){
    double a, b, x;
    double PI=3.14159265358979323846;
    cin >> a >> b >> x;

    double tanX;
    if (a*a*b <= 2*x) {
        tanX = 2.0*(a*a*b-x) / (a*a*a);
    }else{
        tanX = (a*b*b) / (2.0*x);
    }
    cout << fixed << setprecision(10);
    cout << atan(tanX) * 180.0 / PI << endl;
    return 0;
}

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

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

    int n;
    cin >> n;

    vector<vector<ll>> F(n,vector<ll>(10));
    vector<vector<ll>> P(n,vector<ll>(11));

    for(int i = 0; i < n; i++){
        for(int j = 0; j < 10; j++){
            cin >> F[i][j];
        }
    }
    for(int i = 0; i < n; i++){
        for(int j = 0; j < 11; j++){
            cin >> P[i][j];
        }
    }

    ll ans = -1000000000;
    for(ll bit = 1; bit < (1 << 10); bit++){
        ll sum = 0;
        for(int i = 0; i < n; i++){
            ll cnt = 0;
            for(int j = 0; j < 10; j++){
                if((bit>>j&1) && F[i][9-j] == 1) cnt++;
            }
            sum += P[i][cnt];
        }
        ans = max(ans,sum);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);++i)
#define fi first
#define se second
#define INF 1000000009
#define lINF 1000000000000000009
typedef long long ll;

int main(){
  int k,x;
  cin>>k>>x;
  if(500*k>=x){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
  return(0);
}


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

int gcd(int x, int y){
    int r;

    while((r = x % y) != 0){
        x = y;
        y = r;
    }
    return y;
}

int main(void){
	int k;
	int i,j,l;
	long int ans=0;

	scanf("%d",&k);
	for(i=1;i<=k;i++){
		for(j=1;j<=k;j++){
			for(l=1;l<=k;l++){
				ans=ans+gcd(l,gcd(i,j));
			}
		}
	}
	printf("%ld",ans);
	return 0;
}

Measured memory_bytes: 1728
#include<iostream>
using namespace std;
int main() {
	int a,b,c;
	cin>>a>>b>>c;
	if(((a==b)&&(a!=c))||((a==c)&&(a!=b))||((b==c)&&(a!=c)))
		cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

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

int main(){
   int rest;
   int sum = 0;
   int sum_rest = 0;
   int max_rest =0;
  for(int i = 0; i < 5; i++){
   int a;
   cin >> a;
   sum += a;
   rest = 10 - a % 10;
   if(rest != 10){
    sum_rest += rest;
    max_rest = max(max_rest, rest);
   }

  }
  
   cout << sum + sum_rest - max_rest << endl;                   
}

Measured memory_bytes: 256
/*
Cerberus97
Hanit Banga
*/

#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false)

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 2e5 + 5;
const ll inf = 1e18;

ll a[N];

int main()
{
	int n;
	cin >> n;
	ll sum = 0;
	for (int i = 1; i <= n; ++i)
	{
		cin >> a[i];
		sum += a[i];
	}

	ll x = 0, y = sum, ans = inf;
	for (int i = 1; i < n; ++i)
	{
		x += a[i];
		y -= a[i];
		ans = min(ans, abs(x - y));
	}

	cout << ans << endl;
}

Measured memory_bytes: 1792
import numpy as np
N, M, X = map(int,input().split())
C = []
A = []
for i in range(N):
    c = 0
    a = []
    c, *a = map(int,input().split())
    C.append(c)
    A.append(a)
A = np.array(A)
inf = float("inf")
res = inf
for bit in range(1 << N):
    Cost = 0
    Wise = np.zeros(M)
    for i in range(N):
        if (bit >> i) & 1:# i冊目を買うときの処理
            Cost += C[i]
            Wise += A[i]
            Wise = Wise.tolist()
            #else:# i冊目を買わないときの処理（今回は何もしないので省略）
    if min(Wise) >= X and Cost <= res:
        res = Cost
if res == inf:
    print("-1")
else:
    print(res)







"""
n,m,x = map(int,input().split())
c=[]
a=[]
INF = float("inf")
stock = INF
for _  in range(n):
    c_temp,*a_temp = list(map(int,input().split()))
    c.append(c_temp)
    a.append(a_temp)

#すべての組み合わせを計算

for bit in range(1 << n):
    cost_total = 0
    smart_total = [0]*m
    #１セットごとの処理
    for i in range(n):
        #一冊ごとの処理
        if (bit >> i) & 1:
            # i冊目を買うときの処理
            smart = []
            cost_total += c[i]
            smart = a[i]
            for j , sm in enumerate(smart):
                smart_total[j] += sm
        #else:
            # i冊目を買わないときの処理（今回は何もしないので省略）
    judege = True
    for i in range(m):
        if smart_total[i] < x:
            judege = False
    if judege:
        stock = min(cost_total,stock)
if stock == INF:
    print("-1")
else:
    print(stock)"""

Measured memory_bytes: 27104
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define debug(x) cerr << "[debug] " << #x << ": " << x << endl;
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << endl;
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

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

signed main() {
  init();
  ll N;
  cin >> N;
  vll X(N);
  rep(i, N) {
    cin >> X[i];
  }
  vll XX = X;
  SORT(XX);

  ll a = XX[N / 2 - 1];
  ll b = XX[N / 2];
  // debug(a);
  // debug(b);

  rep(i, N) {
    // debug(X[i]);
    if (X[i] <= a) {
      COUT(b);
    } else {
      COUT(a);
    }
  }

  return 0;
}

Measured memory_bytes: 6296
/*
sonu_verma1
*/
#include <bits/stdc++.h>
// For policy based data structure
/*#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> */
using namespace std;
/*using namespace __gnu_pbds; 
typedef tree<int, null_type, less<int>, rb_tree_tag, 
             tree_order_statistics_node_update> 
    new_data_set;*/
 
#define MD 1000000007
#define X first
#define Y second
#define pb push_back
#define debug(val, ch) cout <<val <<ch
#define FOR(i, st, en, ch) for(register int i = (st); i <= (en) ; i += (ch))
#define RFOR(i, st, en, ch) for(register int i = (st); i >= (en) ; i -= (ch))
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
 
typedef long long int ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<int, bool> pib;
typedef pair<bool, int> pbi;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
/*********************************************************************/

void test(int r)
{
	int n,m;
	cin>>n>>m;
	vector<int>h(n+1);
	int i,j,k;
	map<pair<int,int>,vector<int>>mp;
	for(i=1;i<=n;i++)
	{
		cin>>h[i];
		pii a1;
		a1.X=h[i];
		a1.Y=i;
		mp[a1].pb(-1);
	}
	for(i=0;i<m;i++)
	{
		int u,v;
		cin>>u>>v;
		pii a1,a2;
		a1.X=h[u];a2.X=h[v];
		a1.Y=u;
		a2.Y=v;
		mp[a1].pb(h[v]);
		mp[a2].pb(h[u]);
	}
	int ans=0;
	for(auto it:mp)
	{
		sort(it.second.begin(),it.second.end(),greater<int>());
		if(it.first.first>it.second[0])
			ans++;
	}
	cout<<ans;
	
}
/***********************************************************************/
int main()
{
	fast();
    int t=1,r;
    // cin>>t;
    for(r=1;r<=t;r++)
        test(r);
    return 0;
}

Measured memory_bytes: 15292
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
int main(){
  int n;
  std::cin >> n;
  std::vector<ll> a(n);
  rep(i,n){
    std::cin >> a[i];
  }
  sort(a.begin(),a.end());
  a.erase(std::unique(a.begin(), a.end()), a.end());

  if(a.size()!=n)std::cout << "NO" << '\n';
  else std::cout << "YES" << '\n';


}


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

signed main() {
  int N;
  cin >> N;
  
  set<int> ans;
  int A;
  for( int i = 0; i < N; i++ ){
    cin >> A;
    if( ans.count(A) ){ //存在したら消す
      ans.erase(A);
    }else{
      ans.insert(A);
    }
  }
  
  cout << ans.size() << endl;
}



Measured memory_bytes: 4864
def main():
    input = sys.stdin.readline
    try:
        a,b = map(int,input().split())
        cnt = 0
        if a > b:
            cnt += a
            a -= 1
        else:
            cnt += b
            b -= 1
        if a > b:
            cnt += a
            a -= 1
        else:
            cnt += b
            b -= 1
        
        print(cnt)
        
    finally:
        input = None

import sys; sys.setrecursionlimit(50000)
if __name__ == "__main__":
    main()


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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
using ll = long long;
using ld = long double;
const int MOD = 1e9+7;
const ll INF = 1LL << 60;


int main() {
    int a, b; cin >> a >> b;
    if(a == b || a - 1 == b || a == b - 1) cout << "Yay!" << endl;
    else cout << ":(" << endl;

    return 0;
}


Measured memory_bytes: 3584
#include <stdio.h>

int main(){

    int x,y;
    
    while (1)
    {
        scanf("%d%d",&x,&y);
        if (x==0&&y==0)
            break;
        if (x>y)
        {
            printf("%d %d\n",y,x);
        }
        else
        {
            printf("%d %d\n",x,y);
        }
    }

    return 0;
}

Measured memory_bytes: 600
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
#define fst first
#define snd second
using ll = long long;
using I = pair<int, int>;

int main() {
  int D, N;
  while (cin >> D >> N) {
    int ans = 1;
    for (int i = 0; i < D; i++) ans *= 100;
    if (N < 100) {
      ans *= N;
    } else {
      ans *= 101;
    }
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
#define ll long long                                    // long long省略
#define pb push_back                                    // push_back省略
#define mp make_pair                                    // make_pair省略
#define fi first                                        // first省略
#define se second                                       // second省略
#define itn int                                         // int誤字保険
#define count cout                                      // cout誤字保険
#define vecotr vector                                   // vector誤字保険
#define ednl endl                                       // endl誤字保険
#define opt() cin.tie(0); ios::sync_with_stdio(false)   // 入出力速度改善

#define rep(i,l,r) for(ll i=(l);i<(r);i++)               // 範囲[l, r)で刻み1のfor文(順方向)
#define repp(i,l,r,k) for(ll i=(l);i<(r);i+=(k))         // 範囲[l, r)で刻みkのfor文(順方向)
#define rrep(i,l,r) for(ll i=(r-1);i>=(l);i--)           // 範囲[l, r)で刻み1のfor文(逆方向)
#define rrepp(i,l,r,k) for(ll i=(r-1);i>=(l);i-=(k))     // 範囲[l, r)で刻みkのfor文(逆方向)
#define all(x) (x).begin(), (x).end()                   // vectorのポインタ位置指定用
#define max(p,q)((p)>(q)?(p):(q))                       // max拡張
#define min(p,q)((p)<(q)?(p):(q))                       // min拡張
#define bit(n,m)(((n)>>(m))&1)                          // 変数nのm番目のbitを取り出す

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

int dy[]={0, 1, 0, -1};                                 // 4方向近傍
int dx[]={1, 0, -1, 0};                                 // 4方向近傍

int main(){
    ll a,b,c;cin>>a>>b>>c;
  	vector<ll> v={a,b,c};
  	sort(all(v));
  	cout << v[0]+v[1] << ednl;
}


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

#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

using namespace std;

typedef long long LL;

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "[ ";
    REP(i, vec.size()) {
        os << vec[i] << " ";
    }
    os << "]";

    return os;
}

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    int N;
    long long K;
    cin >> N >> K;

    long long B[int(pow(10, 5))];
    REP(i, pow(10, 5)) B[i] = 0;

    REP(i, N) {
        int a, b;
        cin >> a >> b;
        B[a - 1] += b;
    }

    REP(i, pow(10, 5)) {
        K -= B[i];
        if(K <= 0) {
            cout << i + 1 << endl;
            break;
        }
    }

}


Measured memory_bytes: 1024
using System;

class Program{
  static void Main(){
    var days = int.Parse(Console.ReadLine());
    var mpage = int.Parse(Console.ReadLine());
    var jpage = int.Parse(Console.ReadLine());
    var msolve = int.Parse(Console.ReadLine());
    var jsolve = int.Parse(Console.ReadLine());
    Console.WriteLine(days - Math.Max((mpage-1)/msolve,(jpage-1)/jsolve)-1);
  }
}

Measured memory_bytes: 9152
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define mod 1000000007
#define MAX 1000000000000000
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(i=(ll)a;i<(ll)b;i++)
#define revrep(i,a,b) for(i=(ll)a;i>=(ll)b;i--)
#define ii pair<ll,ll>
#define MP make_pair
#define pb push_back
#define f first
#define se second
#define ll long long int
#define vi vector<ll>
ll modexp(ll a,ll b){ ll res = 1; while(b > 0){  if(b & 1) res = (res * a);  a = (a * a);  b/=2;  }  return res; }
#define rs resize
typedef tree< ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update > OST;
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

const ll N = 1005;
ll n,k,g;
int main()
{
    std::ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin>>n>>k;
    g = n / 2;
    if(n & 1)
        g += 1;
    cout<<(g < k ? "NO" : "YES"); 
    return 0;
}

Measured memory_bytes: 256