akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
int rd()
{
	int rx=0,fx=1;char c=getchar();
	while(c<48||c>57)
	{
		if(c=='-') fx=-1;
		c=getchar();
	}
	while(c>=48&&c<=57)
	{
		rx=rx*10+c-48;
		c=getchar();
	}
	return rx*fx;
}
const int N=2050;
int n,m,ans=0,cur;
int L[N],R[N];
vector<int> e[N];
namespace NS
{
	vector<int> e[N];
	void insert(int x,int y);
	struct Tree
	{
		int id;
		int tag[N],fa[N];
		bool ch[N]; 
		void dfs(int x)
		{
			int i,vsi,v;
			vsi=e[x].size();
			for(i=0;i<vsi;i++)
			{
				v=e[x][i];
				if(v==fa[x]) continue;
				fa[v]=x;dfs(v);
			}
		}
		void mcol(int x,int w)
		{
			if(ch[x])
			{
				insert(w,x);
				return ;
			}
			int i,vsi,v;
			if(x==w) ch[x]=1;
			else tag[x]=w;
			vsi=e[x].size();
			for(i=0;i<vsi;i++)
			{
				v=e[x][i];
				if(v==fa[x]) continue;
				mcol(v,w);
			}
		}
		void gedge(int x)
		{
			if(ch[x])
			{
				//printf("edge%d %d\n",id,x);
				::e[id].pb(x);
				return ;
			}
			int vsi,i,v;
			vsi=e[x].size();
			for(i=0;i<vsi;i++)
			{
				v=e[x][i];
				if(v==fa[x]) continue;
				gedge(v);
			}
		}
	}tr[N];
	void insert(int x,int y)
	{
		if(x==y) return ;
		if(tr[x].tag[y]) insert(tr[x].tag[y],y);
		else if(tr[y].tag[x]) insert(tr[y].tag[x],x);
		else tr[x].mcol(y,y),tr[y].mcol(x,x);
	}
	void Init()
	{
		int i,x,y;
		for(i=1;i<n;i++)
		{
			x=rd();y=rd();
			e[x].pb(y);e[y].pb(x);
		}
		for(i=1;i<=n;i++) 
		{
			tr[i].id=i;tr[i].dfs(i);
		}
	}
	void dfs(int x,int nf)
	{
		int vsi,i,v;
		L[x]=++cur;
		vsi=e[x].size();
		for(i=0;i<vsi;i++)
		{
			v=e[x][i];
			if(v==nf) continue;
			dfs(v,x);
		}
		R[x]=cur;
	}
}
void dfs(int x)
{
	int vsi,i,v;
	vsi=e[x].size();
	for(i=0;i<vsi;i++)
	{
		v=e[x][i];
		if(L[v]>=L[x]&&R[v]<=R[x]) 
		{
			//printf("S%d %d\n",x,v);
			ans++;dfs(v);
		}
	}
}
int main()
{
	int i,a,b;
	n=rd();m=rd();
	NS::Init();
	for(i=1;i<=m;i++)
	{
		a=rd();b=rd();
		NS::insert(a,b);
	}
	for(i=1;i<=n;i++) NS::tr[i].gedge(i);
	for(i=1;i<=n;i++) 
	{
		cur=0;NS::dfs(i,0);
		dfs(i);
	}
	ans>>=1;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 37504
result1 = 0
result2 = 0
S = input()
for i in range(len(S)):
  if i % 2 == 0:
    if S[i] == "0":
      result1 += 1
    else:
      result2 += 1
  else:
    if S[i] == "1":
      result1 += 1
    else:
      result2 += 1
print(min(result1,result2))
    
      

Measured memory_bytes: 3188
#!/usr/bin/env python
# -*- coding: utf-8 -*-

while True:
    N,K = map(int,raw_input().split())
    A = sorted([int(raw_input()) for i in range(0,K)])

    if (N,K) == (0,0):
        break

    if A[0] == 0:
        flag = True
        A = A[1:]
        K -= 1
    else:
        flag = False

    ans = 0
    count = 0
    diff_list = []
    s = 0
    for i in range(1,K):
        if A[i] - A[i-1] == 2:
            diff_list.append(A[i-1] - A[s])
            s = i
            count = 0
        elif A[i] - A[i-1] > 2:
            diff_list.append(A[i-1] - A[s])
            diff_list.append(0)
            s = i
            count = 0
        else:
            count += 1
            ans = max(ans,count)
    else:
        diff_list.append(A[i] - A[s])

    if flag is True:
        ans = 0
        for i in range(1,len(diff_list)):
            ans = max(ans,diff_list[i] + diff_list[i-1] + 2)

    print(ans + 1)

Measured memory_bytes: 9528
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
int main() {
	string s;
	cin>>s;
	int len=s.size();
	
	if(len==1||len==0) {cout<<0<<endl;return 0;}
	int cont=0;
	char current;
	char last;
	
	for (int i=0;i<len-1;++i){
		current=s[i+1];
		last=s[i];
	
		//cout<<last<<" "<<current<<endl;
		if (current!=last) {
			cont++;
			
		}
		
	}
	
	cout<<cont<<endl;
	
	return 0;
}



Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int a[100],n,k,sum;
bool cmp(int c,int d)
{
	return c>d;
}
int main()
{
	cin>>n>>k;
	for(int i=1;i<=n;i++)
	cin>>a[i];
	sort(a+1,a+1+n,cmp);
	for(int i=1;i<=k;i++)
	sum+=a[i];
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
/** Author : Parth Prajapati
 * 	Institute : Pandit Deendayal Petroleum University
**/
#include<bits/stdc++.h>

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n,m;
    cin>>n>>m;
    if(n == m)  cout<<"Yes";
    else    cout<<"No";
	return 0;
}

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

using namespace std;

// Repetitions
#define FOR(i,a,n) for(ll i = ((ll) a); i < ((ll) n); ++i)
#define FORR(i, s, g) for(ll i = ((ll)s - 1); i >= ((ll) g); --i)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) FORR(i, n, 0)

// Container Utils
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define SORTALL(v) sort(ALL(v))
#define SZ(a) int((a).size())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())

// For Debug
#define DMP(x)  cerr << #x << " = " << (x) << endl;
#define DBG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

// Aliases
#define PB push_back
#define MP make_pair
#define FST first
#define SND second
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<string> vs;

// I/O Asynchronizing
struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
}aaaaaaa;

int main() {
    int n, l;
    cin >> n >> l;
    int lmin = INT_MAX, sum = 0;
    REP(i, n) {
        int al = abs(l + i);
        lmin = al <= abs(lmin) ? l + i : lmin;
        sum += l + i;
    }

    cout << sum - lmin << "\n";

    return 0;
}


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

int main(){
	int h, w;
	cin >> h >> w;
	string s[h][w];
	for(int i = 0; i < h; i++) for(int j = 0; j < w; j++) cin >> s[i][j];
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			if(s[i][j] == "snuke"){
				char b = 'A';
				b += j;
				cout << (char)b;
				cout << i + 1 << endl;
				return 0;
			}
		}
	}
}


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


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

  if (b == 'A') cout << 'T' << endl;
  else if (b == 'C') cout << 'G' << endl;
  else if (b == 'T') cout << 'A' << endl;
  else if (b == 'G') cout << 'C' << endl;
}


Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
	char c=getchar();bool f=0;x=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return x;
}
template<class t> inline void write(t x){
	if(x<0) putchar('-'),write(-x);
	else{if(x>9) write(x/10);putchar('0'+x%10);}
}




int n,r;

signed main(){
	read(n);read(r);
	if(n<10) write(100*(10-n)+r);
	else write(r);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
inline int lowbit(const int & x) { return x & (-x);}
struct Node
{
	int x, y;
}a[maxn];
int id[maxn], ans[maxn], siz[maxn], fa[maxn];
int getfa(int x) { return fa[x] == x ? x : fa[x] = getfa(fa[x]);}
int main()
{
	int n;
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i)
	{
		scanf("%d%d", &a[i].x, &a[i].y);
		id[a[i].x] = i; fa[i] = i;
	}
	stack<int> s;
	for(int i = 1; i <= n; ++i)
	{
		siz[i] = 1;
		if(!s.empty() && a[id[s.top()]].y < a[id[i]].y)
		{
			int cur = s.top();
			while(!s.empty() && a[id[s.top()]].y < a[id[i]].y)
			{
				siz[i] += siz[getfa(s.top())];
				fa[getfa(s.top())] = i;
				s.pop();
			}
			s.push(cur);
		}
		else
			s.push(i);
	}
	for(int i = 1; i <= n; ++i) ans[id[i]] = siz[getfa(i)];
	for(int i = 1; i <= n; ++i) printf("%d\n", ans[i]);
	return 0;
}

Measured memory_bytes: 14564
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=1e5+10;
int n,cnt,e,f[N],a[N],id[N],w[N],siz[N],res[N],head[N],link[N],to[N];
bool vis[111111];
bool cmp(int x,int y){return a[x]<a[y];}
void add(int u,int v){to[++e]=v,link[e]=head[u],head[u]=e;}
void dfs1(int u,int dep){
	siz[u]=1,res[id[1]]+=dep;
	for(int i=head[u];i;i=link[i])if(to[i]!=f[u])dfs1(to[i],dep+1),siz[u]+=siz[to[i]];
}
void dfs2(int u){for(int i=head[u];i;i=link[i])if(to[i]!=f[u])res[to[i]]=res[u]+n-2*siz[to[i]],dfs2(to[i]);}
signed main(){
	scanf("%lld",&n),w[0]=-LLONG_MAX;
	for(int i=1;i<=n;i++)scanf("%lld",&a[i]),id[i]=i,w[i]=a[i],siz[i]=1;
	sort(id+1,id+n+1,cmp),sort(w+1,w+n+1);
	for(int i=n;i>1;i--){
		int x=2*siz[id[i]]-n+a[id[i]],pos=lower_bound(w+1,w+n+1,x)-w;
		if(w[pos]!=x||n-2*siz[id[i]]<=0){printf("-1");return 0;}
		add(id[pos],id[i]),siz[id[pos]]+=siz[id[i]],f[id[i]]=id[pos];
	}
	dfs1(id[1],0),dfs2(id[1]);
	for(int i=1;i<=n;i++)if(a[i]!=res[i]){printf("-1");return 0;}
	for(int i=2;i<=n;i++)printf("%lld %lld\n",f[id[i]],id[i]);
}

Measured memory_bytes: 9984
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int sum=0,a,b,c,d;
	cin>>a>>b>>c>>d;
	if(a<=b)
	sum+=a;
	else sum+=b;
	if(c<=d)
	sum+=c;
	else sum+=d;
	cout<<sum;
	
	return 0;
} 

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <iomanip>

using namespace std;

#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL); 
#define endl "\n"

typedef long long int  ll;


int main()
{
	FAST;
	string a,b;
	cin >> a >> b;
	if(a == b)
		cout << "EQUAL";
	else if(a.size() == b.size())
	{
	    if(a < b)
		    cout << "LESS";
	    else
		    cout << "GREATER";
	}
	else
	{
	    if(a.size() > b.size())
	        cout << "GREATER";
	    else
	        cout << "LESS";
	}
	return 0;
}

Measured memory_bytes: 256
<?php

fscanf(STDIN, "%d", $n);

$min = floor($n/1.08);
$max = ceil($n/1.08);

if(floor($min * 1.08) == $n){
    echo $min;
}elseif(floor($max*1.08) == $n){
    echo $max;
}else{
    echo ":(";
}



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

int a, b;
char mp[110][110];
int main() {
  cin >> a >> b;
  a--, b--;
  for (int i = 0; i < 50; i++) {
    for (int j = 0; j < 100; j++) {
      mp[i][j] = '.';
    }
  }
  for (int i = 50; i < 100; i++) {
    for (int j = 0; j < 100; j++) {
      mp[i][j] = '#';
    }
  }
  for (int i = 0; i < 50 && b; i += 2) {
    for (int j = 0; j < 100 && b; j += 2) {
      mp[i][j] = '#', b--;
    }
  }
  for (int i = 100 - 1; i >= 50 && a; i -= 2) {
    for (int j = 0; j < 100 && a; j += 2) {
      mp[i][j] = '.', a--;
    }
  }
  cout << 100 << " " << 100 << endl;
  for (int i = 0; i < 100; i++) {
    for (int j = 0; j < 100; j++) {
      cout << mp[i][j];
    }
    cout << endl;
  }
}


Measured memory_bytes: 3648
#include<iostream>
using namespace std;
int main(){
  int e,y;
  cin>>e>>y;
  if(!e){
    if(y<1912)cout<<'M'<<y-1867<<endl;
    else if(y<1926)cout<<'T'<<y-1911<<endl;
    else if(y<1989)cout<<'S'<<y-1925<<endl;
    else cout<<'H'<<y-1988<<endl;
  }
  if(e==1)cout<<y+1867<<endl;
  if(e==2)cout<<y+1911<<endl;
  if(e==3)cout<<y+1925<<endl;
  if(e==4)cout<<y+1988<<endl;
}

Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define NUM 1000000007
#define MAX 100001
#define INF LLONG_MAX
vector<vector<ll>> dp;
vector<vector<ll>> v;
ll solve(ll men, ll women, ll mncnt, ll wmcnt, ll n){
    if(mncnt==n && wmcnt==n)
        return 1;
    if(mncnt==n || wmcnt==n)
        return 0;
    if(dp[men][women]!=-1)
        return dp[men][women];
    dp[men][women]=0;
    for(int i=0;i<n;i++){
        if(v[men][i]==1 && (women&(1<<i))==0){
            dp[men][women]+=solve(men+1,(women|(1<<i)),mncnt+1,wmcnt+1,n);
            dp[men][women]%=NUM;
        }
    }
    dp[men][women]%=NUM;
    return dp[men][women];
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;
    cin>>n;
    v.assign(n+1,vector<ll>(n+1));
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cin>>v[i][j];
        }
    }
    ll tot_mask = (1<<n)-1;
    dp.assign(n+1,vector<ll>(tot_mask+1,-1));
    cout<<solve(0,0,0,0,n)<<endl;
    return 0;
}


Measured memory_bytes: 380180
#include <algorithm>
#include <bitset>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, f, n) for (ll i = (f); i < (n); i++)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
ll const INF = 1LL << 60;
ll const MAX_N = 510000;
ll const MOD = 1000000007;

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

    ll o_cnt = 0;
    ll x_cnt = 0;
    rep(i, S.length()) {
        if (S[i] == 'o')
            o_cnt++;
        else if (S[i] == 'x')
            x_cnt++;
    }

    ll res = 15 - S.length();

    if (res + o_cnt >= 8) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}


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

// マクロ //
#define rep(i,N) for(int i = 0; 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 N, M;
    cin >> N >> M;
    vi A(M);
    rep(i, M) cin >> A[i];
    int sum = vsum(A);
    cou(max(-1, N - sum));
}

Measured memory_bytes: 3672
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min

val br = BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use { out.use {
        solve()
        out.flush()
    } }
}

fun solve() {
    // baa
    // b 1
    // a 2
    val n = readInteger()
    val s = br.readLine()!!.toList()
    val eCount = elementCountMap(s.toList())
    val mod = 1000000007
    var ans = 1L
    for (v in eCount.values) {
        ans = (ans * (v + 1)) % mod
    }
    out.println(ans - 1)
}

/** O(n) */
fun <T>elementCountMap(list: List<T>): Map<T, Int> {
    val countMap = mutableMapOf<T, Int>()
    for (e in list) {
        countMap.merge(e, 1) { oldValue, value -> oldValue + value }
    }
    return countMap
}

fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)


Measured memory_bytes: 41008
s = input()

def pal(s):
  if len(s) == 1:
    return True
  for i in range(int(len(s)/2)):
    if s[i] != s[-i-1]:
      return False
  return True

n = len(s)
if pal(s) and pal(s[:(n-1)//2]) and pal(s[((n+3)//2) - 1:]):
  print('Yes')
else:
  print('No')

Measured memory_bytes: 38384
#include "bits/stdc++.h"
using namespace std;
int INF = numeric_limits<int>::max() / 2;
using ll = long long;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k;
    cin >> n >> k;
    vector<int> x(n), y(n);
    vector<int> xary, yary;
    for(int i = 0; i < n; i++){
        cin >> x[i] >> y[i];
        xary.push_back(x[i]);
        yary.push_back(y[i]);
    }
    sort(xary.begin(), xary.end());
    sort(yary.begin(), yary.end());

    ll ans = numeric_limits<ll>::max();

    for(int xi = 0; xi < n; xi++){
        for(int xj = xi+1; xj < n; xj++){
            for(int yi = 0; yi < n; yi++){
                for(int yj = yi+1; yj < n; yj++){
                    int num = 0;
                    ll lx = xary[xi];
                    ll ly = yary[yi];
                    ll rx = xary[xj];
                    ll ry = yary[yj];
                    for(int i = 0; i < n; i++) if(lx <= x[i] && ly <= y[i] && rx >= x[i] && ry >= y[i]) num++;
                    if(num >= k) ans = min(ans, (rx-lx) * (ry-ly));
                }
            }
        }
    }

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

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#define findmax(a,b) (a)>(b)?(a):(b)
#define findmin(a,b) (a)<(b)?(a):(b)
#define inout freopen("in.txt","r",stdin);freopen("out.txt","w",stdout)
#define swap(a,b) (a)+=(b);(b)=(a)-(b);(a)-=(b)
#define quicksort(a,n) qsort(a,n,sizeof(a[0]),cmp)
#define inputarr(a,n) for(int i=0;i<n;i++){scanf("%d",&a[i]);}
#define printarr(a,n) for(int i=0;i<n;i++){printf("%d ",a[i]);}puts("");
int cmp(const void *a,const void *b){return *(int *)a - *(int *)b;}


int main() {
    
	//inout;

	int x, y, res;

	scanf("%d%d", &x, &y);

	for(int i = 0; i <= x; i++){
		res = i * 2 + ((x - i) * 4);
		if(res == y){
			puts("Yes");
			return 0;
		}
	}
	puts("No");

}

Measured memory_bytes: 1664
#include "bits/stdc++.h"
using namespace std;
using i64 = long long;
const i64 MOD = 1e9+7;
const i64 INF = 1e18+7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}


bool solve(){
    int n, m, p, a, b;
    cin >> p >> n >> m >> a >> b;
    --a, --b;
    if(!n)
        return false;
    vector<int> t(p);
    for(auto& x : t)
        cin >> x;
    vector<vector<pair<int,int>>> edges(n);
    for(int i = 0; i < m; ++i){
        int u, v, q;
        cin >> u >> v >> q;
        edges[--u].emplace_back(--v, q);
        edges[v].emplace_back(u, q);
    }
    vector<vector<double>> range(n, vector<double>(1 << p, INF));
    range[a][0] = 0;
    priority_queue<tuple<double,int,int>, vector<tuple<double,int,int>>, greater<tuple<double,int,int>>> que;
    que.emplace(0, a, 0);
    while(!que.empty()){
        int pos, flag;
        double dist;
        tie(dist, pos, flag) = que.top();
        que.pop();
        if(dist != range[pos][flag])
            continue;
        for(auto& ed : edges[pos]){
            for(int i = 0; i < p; ++i){
                if(flag & (1 << i))
                    continue;
                if(chmin(range[ed.first][flag | (1 << i)], dist + 1.0 * ed.second / t[i]))
                    que.emplace(range[ed.first][flag | (1 << i)], ed.first, flag | (1 << i));
            }
        }
    }
    double res = *min_element(range[b].begin(), range[b].end());
    if(res >= 1e15){
        cout << "Impossible" << endl;
    }
    else
        printf("%.20lf\n", res);
    return true;
}


signed main(){
    while(solve());
}



Measured memory_bytes: 4660
a, b = [int(x) for x in input().split()]
won = 0
if a in range(1, 4):
  won  += [0,300000,200000,100000][a]
if b in range(1, 4):
  won  += [0,300000,200000,100000][b]
if a == 1 and b == 1:won += 400000  
 
print(won)

Measured memory_bytes: 3060
// abc136_c
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int N;
    cin >> N;
    vector<int> H(N);
    REP(i, N) cin >> H[i];

    bool flag = true;
    int mx = -1;
    REP(i, N-1){
        if (H[i] >= H[i+1] + 2){
            print("No");
            return 0;
        } else if (H[i] >= H[i+1] + 1){
            if (flag){
                mx = H[i+1];
                flag = false;
            } else {
                if (H[i+1] == mx){
                    ;
                } else {
                    print("No");
                    return 0;
                }
            }
        } else if (H[i] < H[i+1]){
            flag = true;
        }
    }
    print("Yes");

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define INF LLONG_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(int i=0; i<n; ++i)
#define MOD 1000000007
using namespace std;
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;}

int main() {
  int N; cin >> N;
  vector<ull> A(5, 0);
  rep(i, N) {
    string s; cin >> s;
    if(s[0] == 'M') A[0]++;
    else if(s[0] == 'A') A[1]++;
    else if(s[0] == 'R') A[2]++;
    else if(s[0] == 'C') A[3]++;
    else if(s[0] == 'H') A[4]++;
  }
  ull ans = 0;
  ans += A[0]*A[1]*A[2];
  ans += A[0]*A[1]*A[3];
  ans += A[0]*A[1]*A[4];
  ans += A[0]*A[2]*A[3];
  ans += A[0]*A[2]*A[4];
  ans += A[0]*A[3]*A[4];
  ans += A[1]*A[2]*A[3];
  ans += A[1]*A[2]*A[4];
  ans += A[1]*A[3]*A[4];
  ans += A[2]*A[3]*A[4];
  cout << ans << endl;
}


Measured memory_bytes: 256
#if 0

#endif

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

int D;

int main() {
  while (cin >> D) {
    ll area = 0;
    int x = 0;
    for (int i = 0; i < 600/D; i++) {
      area += (D*i)*(D*i)*D;
    }
    cout << area << endl;
  }
}



Measured memory_bytes: 3024
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(), a.end()
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define pb push_back
#define sz(x) (int)(x).size()
#define PQ(T) priority_queue<T, v(T), greater<T>>
#define bn(x) ((1 << x) - 1)
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int mod = 1000000007;

int main(){
    int n;
    cin >> n;
    vector<ll> a(n), b(n), c(n);
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];
    rep(i, n) cin >> c[i];

    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());

    vector<ll> cnt_ab(n,0), cnt_bc(n,0);
    vector<ll> cum(n+1, 0);
    ll ans = 0;

    rep(i, n){
        auto iter = upper_bound(rng(c), b[i]);
        cnt_bc[i] = c.end() - iter;
    }

    drep(i, n){
        cum[i] = cum[i+1] + cnt_bc[i];
    }

    rep(i, n){
        auto iter = upper_bound(rng(b), a[i]);
        //printf("%d: %d\n", i, cum[iter - b.begin()]);
        ans += cum[iter - b.begin()];
    }

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 4992
/*
   D
*/

#include <bits/stdc++.h>
#define MAX 100005

using namespace std;

int cur_ans;
int N, K, intval;
char s[MAX];

int main() {
	ios::sync_with_stdio(0);
	cin >> N >> K;
	cin >> (s + 1);
	for(int i = 1; i <= N; ++i) {
		if(s[i] == 'R') {
			if(s[i - 1] != 'R') ++intval;
			if(s[i + 1] == 'R') ++cur_ans;
		} else {
			if(s[i - 1] == 'L') ++cur_ans;
		}
	}
	if(s[1] == 'R' && s[N] == 'R') {
		--intval;
		if(K < intval) cur_ans += K * 2;
		else cur_ans = N - 1;
	} else {
		if(K < intval) cur_ans += K * 2;
		else cur_ans = N - 1;
	}
	cout << cur_ans << endl;
	return 0;
}

Measured memory_bytes: 384
require 'bigdecimal'

n = gets.to_i

n.times do
  x1, y1, x2, y2, x3, y3, x4, y4 = gets.split.map(&method(:BigDecimal))

  ab_slope = (y2 - y1) / (x2 - x1)
  cd_slope = (y4 - y3) / (x4 - x3)

  if ab_slope == cd_slope
    puts 'YES'
  else
    puts 'NO'
  end
end

Measured memory_bytes: 8860
#include<iostream>
#include<cstdio>
using namespace std;
typedef long long ll;
int main()
{
	ll x,y;
	scanf("%lld%lld",&x,&y);
	if(x%y==0)puts("-1");
	else 
	{
		for(ll i=x+x;i<=1e18;i+=x)
		{
			if(i%y!=0)
			{
			 printf("%d\n",i);
			 break;
		    }
		}
	}
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep_lr(i,l,r) for(int i=(l);i<(r);i++)
#define rep_sn(i,s,n) for(int i=(s);i<(s)+(n);i++)
#define all(x) (x).begin(),(x).end()
#define V vector
typedef V<int> vi;
typedef V<vi> vvi;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
constexpr int INF = INT_MAX >> 1;
constexpr ll LINF = 5000000000000000LL;
constexpr int MOD = 1000000007;

int main() {
	
	int w, h, x, y;
	cin >> w >> h >> x >> y;
	cout << fixed << setprecision(10);
	cout << (long double)h * w / 2 << " ";
	bool center = false;
	if (2 * x == w && 2 * y == h)center = true;
	cout << (center ? 1 : 0) << endl;

}

Measured memory_bytes: 256
N, X = map(int, raw_input().split())

def f(a, b):
  if a == 0:
    return -b
  elif b == 0:
    return -a
  elif a < b:
    return f(a, b % a) + (b / a) * 2 * a
  else:
    return f(a % b, b) + (a / b) * 2 * b

print N + f(X, N - X)



Measured memory_bytes: 2568
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PI 4*atan(1.0)
typedef long long ll;
typedef long double ld;
using namespace std;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};

int main(){
	char s[101];
	cin>>s;
	int alpha[26]={};
	for(int i=0;i<strlen(s);i++)
		alpha[s[i]-'a']++;
	for(int i=0;i<26;i++){
		if(alpha[i]%2){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 888
#include <cstdio>
#include <cmath>

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define inc( i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec( i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

template<typename T> void swap(T & x, T & y) { T t = x; x = y; y = t; return; }
template<typename T> T abs(T x) { return (0 <= x ? x : -x); }
template<typename T> T max(T a, T b) { return (b <= a ? a : b); }
template<typename T> T min(T a, T b) { return (a <= b ? a : b); }
template<typename T> bool setmin(T & a, T b) { if(a <= b) { return false; } else { a = b; return true; } }
template<typename T> bool setmax(T & a, T b) { if(b <= a) { return false; } else { a = b; return true; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int h, w;
char s[200][201];
const int MOD = 1000000007;
LL ans = 1;
bool ii[100], jj[100];

void calc(int i, int j) {
	char a = s[        i][        j];
	char b = s[        i][w - 1 - j];
	char c = s[h - 1 - i][        j];
	char d = s[h - 1 - i][w - 1 - j];
	
	int eq = 0;
	if(a == b) { eq++; }
	if(a == c) { eq++; }
	if(a == d) { eq++; }
	if(b == c) { eq++; }
	if(b == d) { eq++; }
	if(c == d) { eq++; }
	
	if(eq == 0) {
		ii[i] = true;
		jj[j] = true;
	}
	
	int map[] = { 12, 12, 6, 4, 0, 0, 1 };
	(ans *= map[eq]) %= MOD;
}

int main() {
	scanf("%d%d", &h, &w);
	inc(i, h) { scanf("%s", s[i]); }
	
	if(h % 2 == 1) {
		bool flag = true;
		inc(i, w / 2) { if(s[h / 2][i] != s[h / 2][w - 1 - i]) { flag = false; break; } }
		if(! flag) { ans *= 2; }
	}
	if(w % 2 == 1) {
		bool flag = true;
		inc(i, h / 2) { if(s[i][w / 2] != s[h - 1 - i][w / 2]) { flag = false; break; } }
		if(! flag) { ans *= 2; }
	}
	
	inc(i, h / 2) {
	inc(j, w / 2) {
		calc(i, j);
	}
	}
	
	bool one = false;
	inc(i, h / 2) { if(ii[i]) { if(one) { (ans *= 2) %= MOD; } else { one = true; } } }
	inc(j, w / 2) { if(jj[j]) { if(one) { (ans *= 2) %= MOD; } else { one = true; } } }
	
	printf("%lld\n", ans);
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>
#include <cstring>

#define rep(i,n) for(int i=0;i<int(n);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back

using namespace std;
using ll = long long;

const ll mod = 1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

int main(){
  ll N, M;
  cin >> N >> M;
  vector<pair<ll, ll>> data;
  for(int i = 0; i < N; i++){
    ll A, B;
    cin >> A >> B;
    data.push_back({A, B});
  }
  sort(all(data));

  ll ans = 0;
  for(int i = 0; i < N; i++){
    ll cnt = min(data[i].second, M);
    M -= cnt;
    ans += data[i].first * cnt;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2420
#include<iostream>
#include<sstream>
#include<algorithm>
#include<vector>
#include<string>

using namespace std;

int main(){
  long long N,K,Q;
  cin>>N>>K>>Q;
  vector<long long> A(Q);
  for(int i=0; i<Q; i++) cin>>A[i];
  vector<long long> point(N,0);
  
  for(int i=0; i<A.size(); i++){
    point[(A[i]-1)]++;
  }
  for(int i=0; i<point.size(); i++){
    if(K-Q+point[i] > 0){
      
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
  }
  return 0;
}


Measured memory_bytes: 2176
#include <iostream>
using namespace std;
int main() {
    int n, m, l;
    cin >> n >> m >> l;
    int a[101][101], b[101][101];
    long long int c[101][101];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> a[i][j];
        }
    }
    for (int i = 0; i < m; i++) {
        for (int j = 0; j < l; j++) {
            cin >> b[i][j];
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < l; j++) {
            c[i][j] = 0;
            for (int k = 0; k < m; k++) {
                c[i][j] += a[i][k] * b[k][j];
            }
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < l - 1; j++) {
            cout << c[i][j] << " ";
        }
        cout << c[i][l - 1] << endl;
    }
    return 0;
}


Measured memory_bytes: 3232
#include<bits/stdc++.h>
using namespace std;
#define pfi(a) printf("%d",a);
#define pfl(a) printf("%lld",a);
#define pfin(a) printf("%d\n",a);
#define pfln(a) printf("%lld\n",a);
#define sfi(a) scanf("%d",&a);
#define sfl(a) scanf("%lld",&a);
#define pb push_back
#define f(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define endl "\n"
const int MAXN=3e5+5;
const int M= 1e9;

int main(){	
	
	long double pi=acos(-1);
	long double r;
	cin>>r;
	cout<<fixed<<setprecision(6);
	cout<<2*pi*r<<endl;
	
	
	return 0;	
}

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

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

#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define rrep(i,a) for(ll i=a-1;i>=0;i--)
#define MOD 1000000007

//debug
#define debug(arr) cerr<<#arr<<"(l"<<__LINE__<<") : ";for(auto x:arr)cerr<<x<<" ";cerr<<endl;

ll calc(ll v, ll K, vector<vector<ll>> &edges, bool* visited, ll cnt){
  // cout << cnt << endl;
  ll val = K - cnt;
  cnt = (cnt > 0) + 1;
  for(ll nxt : edges[v]){
    if(!visited[nxt]){
      visited[nxt] = true;
      val = (val * calc(nxt, K, edges, visited, cnt++)) % MOD;
    }
  }
  return val;
}

int main(){
  ll N, K; cin >> N >> K;
  vector<vector<ll>> edges(N);
  bool visited[N] = {true};

  rep(_, N-1){
    ll a, b;
    cin >> a >> b;
    edges[a-1].push_back(b-1);
    edges[b-1].push_back(a-1);
  }
  cout << calc(0, K, edges, visited, 0) << endl;
  return 0;
}


Measured memory_bytes: 11648
#include <iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<math.h>
#include<bits/stdc++.h>
#include<cmath>
#include<iomanip>
#include<queue>
#include<string>
using namespace std;

const double PI  =3.141592653589793238463;
#define pb push_back
#define pf push_front
#define sz(v)  ((int)(v).size());
#define all(v) ((v).begin()),((v).end())
typedef unsigned long long ull;
typedef long long ll;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<ull> vul;

typedef pair<int,int> pi;
//2 7 3 4 9

void printVec(vul v1)
{
    for(int i=0; i<v1.size(); i++)
        cout<<v1[i]<<" ";
    cout<<endl;
}
ll rec(ll r,ll c){

if(r<=1 || c<=1){
    return 1;
}


return rec(r-1,c)+rec(r,c-1);
}

bool bin_search(ull  target, vul V){

ll low=0;
ll high=V.size()-1;
while(low<=high){
    ll mid=(low+high)/2;
    if(target==V[mid]){
        return true;
    }
    if(target <V[mid]){
        high=mid-1;
    }else{
    low=mid+1;
    }
}
return false;
}
int main()
{
    ios::sync_with_stdio(false);
    cout.tie(NULL);
    cin.tie(NULL);
ll n,m,k;cin>>n>>m>>k;
vul a(n,0);
vul b(m,0);

for(ll i=0;i<n;i++){
cin>>a[i];
}
for(ll i=0;i<m;i++){
cin>>b[i];
}

vul A(n+1,0);
vul B(m+1,0);

for(ll i=0;i<n;i++){
A[i+1]=A[i]+a[i];
}
for(ll i=0;i<m;i++){
B[i+1]=B[i]+b[i];
}

ll books=0,A_books=0,B_books=0;
ull sum=0;

 vector<ull>::iterator lower,upper;
for(ull i=0;i<=n;i++){

ll t=k-A[i];
if(t < 0){
    continue;
}
 lower = lower_bound(B.begin(),B.end(),k-A[i]);
B_books=lower-B.begin();
if(B[B_books] >k-A[i] ||B_books>m){
    B_books--;
}
//B_books--;
sum=max(sum,B_books+i);

}
cout<<sum<<endl;
  return 0;
}


Measured memory_bytes: 9468
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int h=sc.nextInt(),w=sc.nextInt();
    int[][] a=new int[h][w];
    boolean flag=true;
    for(int i=0;i<h;i++) {
    	String buff=sc.next();
    	for(int j=0;j<w;j++) {
    		if(buff.substring(j, j+1).equals("#"))a[i][j]=1;
    		else a[i][j]=0;
    	}
    }
    for(int i=0;i<h;i++) {
    	for(int j=0;j<w;j++) {
    		if(i==h-1&&j==w-1)break;
    		if(a[i][j]==1) {
	    		if(i==h-1 || j==w-1) {
	    			if(i==h-1) {
	    				if(a[i][j+1]==0)flag=false;
	    				if(j!=0) {
		    				if(a[i][j-1]==0&&a[i-1][j]==0)flag=false;
		    			}
	    			}
	    			if(j==w-1) {
		    			if(a[i+1][j]==0)flag=false;
		    			if(i!=0) {
		    				if(a[i][j-1]==0&&a[i-1][j]==0)flag=false;
		    			}
	    			}
	    		}else {
	    			if(a[i+1][j]==0 && a[i][j+1]==0)flag=false;
	    			if(a[i+1][j]==1 && a[i][j+1]==1)flag=false;
	    		}
    		}
    	}
    }
    if(flag) {
    	System.out.println("Possible");
    }else {
    	System.out.println("Impossible");
    }
  }
}


Measured memory_bytes: 21972
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
#define ll long long
#define PL pair<long long, long long>
#define P pair<int,int>
#define mk make_pair
#define en endl;
#define WHITE 0
#define BLACK 2
#define GRAY 1
#define repi(start,end) for(int i=start; i<end; i++)
#define repj(start,end) for(int j=start; j<end; j++)
#define repk(start,end) for(int k=start; k<end; k++)
#define repl(start,end) for(int l=start; l<end; l++)
#define RE return 0;

struct edge{int to,cap,rev;};

int n,k;
bool can[1000][1000];
int used[2000000];

vector<edge> G[2000000];

void add_edge(int from,int to,int cap){
  G[from].push_back((edge){to,cap,(int)G[to].size()});
  G[to].push_back((edge){from,0,(int)G[from].size()-1});
}

int dfs(int v,int t,int f){
  //cout<<"  v = "<<v<<en
  if(v==t) return f;
  used[v]=true;
  repi(0, G[v].size()){
    edge &e=G[v][i];
    if(!used[e.to]&&e.cap>0){
      int d=dfs(e.to,t,min(f,e.cap));
      if(d>0){
        e.cap-=d;
        G[e.to][e.rev].cap+=d;
        return d;
      }
    }
  }
  return 0;
}

int max_flow(int s,int t){
  int i=0;
  int flow=0;
  for(;;){
    memset(used, 0, sizeof(used));
    //cout<<"         "<<i++<<en
    int f=dfs(s, t, INF);
    if(f==0) return flow;
    flow+=f;
  }
}

void solve(){
  int s=n+k,t=s+1;
  
  repi(0, n){
    add_edge(s,i,1);
  }
  repi(0, k){
    add_edge(n+i, t, 1);
  }
  
  repi(0, n){
    repj(0, k){
      if(can[i][j]){
        add_edge(i, n+j, 1);
      }
    }
  }
  
  cout<<max_flow(s, t)<<en
}






int main(){
  
  repi(0, 1000){
    repj(0, 1000){
      can[i][j]=false;
    }
  }
  
  int e,a,b;
  cin>>n>>k>>e;
  repi(0, e){
    cin>>a>>b;
    can[a][b]=true;
  }
  
  solve();
  RE
}



Measured memory_bytes: 58964
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}

V(V(P)) con(100050);
vi res(100050, 0);
V(bool) visited(100050, false);

void dfs(int now, int cost) {
    res[now] = cost%2;
    rep(i, con[now].size()) {
        if(!visited[con[now][i].fi]) {
            visited[con[now][i].fi] = true;
            dfs(con[now][i].fi, cost+con[now][i].se);
        }
    }
}

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

    rep(i, N-1) {
        int u, v, w;
        cin >> u >> v >> w;
        u--; v--;
        con[u].pb(P(v, w));
        con[v].pb(P(u, w));
    }

    visited[0] = true;
    dfs(0, 0);

    rep(i, N) {
        cout << res[i] << endl;
    }
    
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  if (N % 10 == 3) {
    cout << "bon" << endl;
  }
  else if (N % 10 == 0 || N % 10 == 1 || N % 10 == 6 || N % 10 == 8) {
    cout << "pon" << endl;
  }
  else { cout << "hon" << endl;
   }
}
  


Measured memory_bytes: 3556
(n,k),p,c,*a=[[*map(int,t.split())]for t in open(0)]
while n:
 n-=1;s,x,*l=0,n;f=j=k
 while f:x=p[x]-1;s+=c[x];l+=s,;f=x!=n
 for t in l[:k]:j-=1;a+=[t+j//len(l)*s*(s>0)]
print(max(a))

Measured memory_bytes: 459580
n = gets.to_i
s = n.times.map { gets.chomp }

result = {
  'AC' => 0,
  'WA' => 0,
  'TLE' => 0,
  'RE' => 0
}

s.each do |si|
  result[si] += 1
end

[ 'AC', 'WA', 'TLE', 'RE' ].each do |k|
  puts "#{k} x #{result[k]}"
end



Measured memory_bytes: 20700
from bisect import bisect_right
N,M=map(int,input().split())
PY=[]
record=[[] for i in range(N+1)]
for i in range(M):
    P,Y=map(int,input().split())
    PY.append([P,Y])
    record[P].append(Y)
for i in range(1,N+1):
    record[i].sort()
for i in range(M):
    p,y=PY[i][0],PY[i][1]
    order=bisect_right(record[p],y)
    print(str(p).zfill(6)+str(order).zfill(6))

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

int main(){
  int n;
  int a[200000];
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  int ans=1,count=0;
  for(int i=0;i<n;i++){
    if(a[i]==ans){
      ans++;
    }
    else{
      count++;
    }
  }
    if(n==count){
    count=-1;
  }
  cout<<count<<endl;
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
using namespace std;
#define rep(i,n) for(int i = 0;i < n;i++)
#define INF 0x3f //plus infinite

int a[52],b[52];
vector<int> ans(52,0);

int main(){
  int n,m;
  cin >> n >> m;
  
  for(int i = 1;i <=m;i++){
    cin >> a[i] >> b[i];
    ++ans.at(a[i]);
    ++ans.at(b[i]);
  }
  
  for(int i = 1;i <=n;i++){
    cout << ans[i] << endl;
  }




}

/*文字列の辞書順について
 *C++の順序では'0'～'9'→'A'～'Z'→'a'～'z'の順に
 *                       なっていることに注意しましょう。
 */

/*行単位での入力
 * getline(cin,文字列変数);
 */


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

//定数
const long long MOD1=1000000007;
const long long MOD2=998244353;
const long double PI=3.1415926535897932;
const long long MAXLL=9223372036854775807;
const long long INF=2305843009213693951;
const long long dx[]={0,1,0,-1,1,-1,1,-1};
const long long dy[]={1,0,-1,0,1,1,-1,-1};

//型名省略
#define ll long long
#define ull unsigned long long
#define ld long double
#define uld unsigned long double
#define pll pair<long long,long long>
#define tll(n) array<long long,(int)(n)>
#define pcc pair<char,char>
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vp vector<pair<long long,long long>>
#define vt(n) vector<array<long long,(int)(n)>>
#define umap unordered_map
#define uset unordered_set
#define Lqueue priority_queue<long long>
#define Squeue priority_queue<long long,vector<long long>,greater<long long>>
#define Fi first
#define Se second
#define mp make_pair
#define eb emplace_back

//マクロ
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rbf(a,x) for(auto& a:x)
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s);i<(long long)(n);i++)
#define bitrep(i,s,n) for(long long i=(s);i<(1LL<<(n));i++)
#define Maxe(x) *max_element((x).begin(),(x).end())
#define Mine(x) *min_element((x).begin(),(x).end())
#define Size(x) ((long long)(x).size())
#define lin(s) getline(cin,(s))

//Yes,No
void Yes(bool a){cout<<(a?"Yes":"No")<<endl;}
//YES.NO
void YES(bool a){cout<<(a?"YES":"NO")<<endl;}

//MAX,MIN
template<class T,class U> auto max(T a,U b){return a>b?a:b;}
template<class T,class U> auto min(T a,U b){return a<b?a:b;}

//最大公約数,最小公倍数
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a,long long b){return a/gcd(a,b)*b;}

//累乗
template<typename t>
constexpr t mypow(t a,long long b){
    if(b==0)return 1;
    if(a==0)return 0;
    t x=1;
    while(b>0){
        if(b&1LL)x*=a;
        a*=a;
        b>>=1LL;
        }
    return x;
}
#define pow mypow

//chmin,chmax
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;}

//組み合わせ O(r)
template<typename t>
constexpr t nCr(t n,long long r){
    if(r==0)return 1;
    if(n==0)return 0;
    if(n<r)return 0;
    t x=1;
    for(long long i=1;i<=r;i++){
        x*=n-i+1;
        x/=i;
    }
    return x;
}

//main関数
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll h,w;
    cin>>h>>w;
    ll cnt=0;
    rep(i,h*w){
        char a;
        cin>>a;
        if(a=='#')cnt++;
    }
    if(cnt==h+w-1)cout<<"Possible"<<endl;
    else cout<<"Impossible"<<endl;
}

Measured memory_bytes: 3624
eval"_,M,*A="+`dd`.split*?,;
(1..2**30).bsearch{|i|
d=M;
k=0;
A.map{|a|
(a/=2;d-=1)until i>a;
k+=a
};
d>=0&&X=k-i/2*d;-d
};
p X

Measured memory_bytes: 34308
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<(int)n; i++)
#define REPR(i, n) for(int i=(int)n-1; i>=0; i--)
#define FOR(i, m, n) for(int i=(int)m; i<(int)n; i++)
#define FORR(i, m, n) for(int i=(int)m-1; i>=(int)n; i--)
#define ASC(v) sort(v.begin(), v.end());
#define DESC(v) sort(v.begin(), v.end(), greater<int>());
#define REVERSE(v) reverse(v.begin(), v.end());
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
typedef long long ll;
struct nya{ nya(){ cin.tie(0); ios::sync_with_stdio(false); } }nyan;

int main() {
	ll N;
	cin >> N;
	vector<ll> X(N);
	REP(i, N) cin >> X[i];

	ll res = 99999999;

	REP(i, 100) {
		ll sum = 0;
		REP(j, N) {
			sum += pow(X[j]-i+1, 2);
		}
		if (min(res, sum) == sum) res = sum;
	}

	cout << res << "\n";
}


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

using namespace std;

int main(){
	string s, t;
	cin >> s >> t;
	int x = s.size(), y = t.size();
	int d[x+1][y+1];
	for (int i = 0; i <= x; ++i)
	{
		for (int j = 0; j <= y; ++j)
		{
			d[i][j] = 0;
		}
	}
	for(int i = 1; i <= x; ++i){
		for (int j = 1; j <= y; ++j)
		{
			if(s[i-1] == t[j-1]){
				d[i][j] = 1+d[i-1][j-1];
			}
			else{
				d[i][j]=max(d[i][j-1], d[i-1][j]);
			}
		}
	}
	vector <char> v;
	while(x != 0 && y != 0){
		if(s[x-1] == t[y-1]){
			v.push_back(s[x-1]);
			--x;--y;
		}
		else{
			if(d[x][y] == d[x-1][y]) --x;
			else --y;
		}
	}
	for(int i = v.size()-1; i > -1; --i){
		cout << v[i];
	}
}

Measured memory_bytes: 38744