akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<string.h>
#include<queue>
using namespace std;
struct s
{
    int x,y;
} st,tmp,tmp1;
queue
q;
char a[205][205];
int vis[205][205];
int dx[10]= {0,0,1,-1};
int dy[10]= {1,-1,0,0};
int main()
{
    int aa,b,xx,yy;
    while(scanf("%d %d",&aa,&b)!=EOF)
    {
        int i,j;
        for(i=0; i<aa; i++)
        {
            scanf("%s",a[i]);
            for(j=0; j<b; j++)
            {
                if(a[i][j]=='%')
                {
                    st.x=i;
                    st.y=j;
                }
            }
        }
        while(!q.empty())
            q.pop();
        memset(vis,0,sizeof(vis));
        vis[st.x][st.y]=1;
        q.push(st);
        int z=0,zz=0;
        while(!q.empty())
        {
            tmp=q.front();

            q.pop();
            for(i=0; i<4; i++)
            {
                xx=dx[i]+tmp.x;
                yy=dy[i]+tmp.y;
                if(vis[xx][yy]==0&&xx>=0&&xx<aa&&yy>=0&&yy<b&&a[xx][yy]!='#')
                {
                    tmp1.x=xx;
                    tmp1.y=yy;
                    vis[xx][yy]=vis[tmp.x][tmp.y]+1;
                    if(z==0&&a[xx][yy]=='@')
                        z=vis[xx][yy];
                    if(zz==0&&a[xx][yy]=='$')
                        zz=vis[xx][yy];
                    q.push(tmp1);
                }
            }
        }
        if((z>0&&z<zz)||(zz==0))
        {
            printf("Yes\n");
        }
        else
            printf("No\n");
    }
}

Measured memory_bytes: 2872
package main

import (
	"fmt"
	"sort"
)

type r struct {
	i int
	s string
	po int
}

type rs []r

func (r rs) Len()int {
	return len(r)
}
func (r rs) Less(i, j int) bool {
	if r[i].s == r[j].s {
		return r[i].po > r[j].po
	} else {
		return r[i].s < r[j].s
	}
}

func (r rs) Swap(i, j int) {
	r[i], r[j] = r[j], r[i]
}

func main(){
	var n int
	fmt.Scan(&n)
	a := make(rs, n)
	for i := range a {
		fmt.Scan(&a[i].s,&a[i].po)
		a[i].i = i + 1
	}
	sort.Sort(a)
	for i:= range a {
		fmt.Println(a[i].i)
	}
}

Measured memory_bytes: 512
#include <stdio.h>
#include <string.h>

typedef struct {
  char name[10];
  int t;
} P;


void enqueue(P);
P dequeue(void);

P Q[100000];
int head = 0;
int tail = 0;
int n,q,i,c=0,t=0,s;
P _Q;


int main(){

  scanf("%d %d",&n,&q);
  for(i=0;i<n;i++){
    scanf("%s%d",Q[i].name,&Q[i].t);
  }

  while(c!=n){
    _Q=dequeue();
    if(_Q.t<=q){
      t += _Q.t;
      c++;
      printf("%s %d\n",_Q.name,t);
    }else{
      t+=q;
      _Q.t-=q;
      enqueue(_Q);
    }
  }
  return 0;
}

void enqueue(P x){
  if(tail == n){
    tail = 0;
  }
  Q[tail++]=x;
}

P dequeue(void){
  if(head == n){
    head = 0;
  }
  return Q[head++];
}

Measured memory_bytes: 3348
n = int(input())
l_10 = []
l_else = []
for i in range(n):
  s = int(input())
  if s % 10 == 0:
    l_10.append(s)
  else:
    l_else.append(s)

if len(l_else) > 0:
  if sum(l_else) % 10 == 0:
    print(sum(l_else)-min(l_else)+sum(l_10))
  else:
    print(sum(l_else)+sum(l_10))
else:
  print(0)

Measured memory_bytes: 9148
import java.text.ChoiceFormat;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner s = new Scanner(System.in);
        System.out.println("a " + new ChoiceFormat("-1#'<'|0#==|1#'>'").format(s.nextInt() - s.nextInt()) + " b");
    }
}

Measured memory_bytes: 26172
#include<bits/stdc++.h>
using namespace std;
#define M ((ll)(1e9)+7)
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
typedef long long ll;

void solve()
{
   int n,k;
   cin>>n>>k;
   vector<int> v;int a;
   for(int i=0;i<n;i++)
   {
       cin>>a;
       v.pb(a);
   }
   if(n<=k)
   {
       cout<<0<<endl;return;
   }
   sort(v.rbegin(),v.rend());
   ll ans=0;
   for(int i=k;i<n;i++)
   {
       ans+=(ll)v[i];
   }
   cout<<ans<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}

Measured memory_bytes: 1400
#include<iostream>
using namespace std;
int main()
{
  int ans=1,n;
  cin>>n;
  while(1){
    if(n<=3)break;
    if(n%3){
      n/=3;
      n++;
    }else{
      n/=3;
    }
    ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 0
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF ((long long)1e18)
#define MOD ((int)1e9+7)
#define endl "\n"

#define yn(f) ((f)?"Yes":"No")
#define YN(f) ((f)?"YES":"NO")

#define MAX 110000

int pn[MAX];
vector<int> p;

void soe(){
	pn[0] = pn[1] = true;
	
	for(int i = 2; i*i < MAX; i++)
		if(!pn[i])for(int j = i*i; j < MAX; j += i) pn[j] = true;
	
	for(int i = 2; i < MAX; i++)
		if(!pn[i]) p.push_back(i);
}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int m, a, b;
	
	soe();
	
	while(true){
		int c = 2, d = 2, max_ = 0;
		
		cin>>m>>a>>b;
		
		if(!m && !a && !b) break;
		
		for(int i = 0; i < p.size() && p[i]*p[i] <= m; i++){
			for(int j = i; j < p.size(); j++){
				int area = p[i]*p[j];
				if(area > m)break;
				if(area > max_ && a*p[j] <= b*p[i]){
					max_ = area;
					c = p[i], d = p[j];
				}
			}
		}
		
		cout<<c<<" "<<d<<endl;
	}
	
	return 0;
}


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


Measured memory_bytes: 3096
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cstring>
#include <functional>
#include <cmath>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
#define fs first
#define sc second
#define pb push_back
#define show(x) cout << #x << " " << x << endl
struct state{
	int a[4][8];
};
inline bool operator<(const state &l,const state &r){
	rep(i,4) rep(j,8) if(l.a[i][j]!=r.a[i][j]) return l.a[i][j]<r.a[i][j];
	return false;
}
map<state,int> msi;
state goal;
int bfs(state s){
	msi.clear();
	queue<state> que;
	que.push(s);
	msi[s]=0;
	while(!que.empty()){
		state st=que.front();
		que.pop();
		bool ok=true;
		rep(i,4) rep(j,7) if(st.a[i][j]!=(i+1)*10+j+1){
			ok=false;
			break;
		}
		if(ok){
			return msi[st];
		}
		rep(i,4) rep(j,8){
			if(st.a[i][j]==0){
				state nst=st;
				int x=i,y=j-1;
				if(y==-1) continue;
				if(st.a[x][y]==0) continue;
				int s=st.a[x][y];
				if(s%10==7) continue;
				s++;
				int k,h;
				rep(kk,4) rep(hh,8) if(st.a[kk][hh]==s) k=kk,h=hh;
				nst.a[k][h]=0;
				nst.a[i][j]=s;
				if(!msi.count(nst)){
					msi[nst]=msi[st]+1;
					que.push(nst);
				}
			}
		}
	}
	return -1;
}
int main(){
	rep(i,4) rep(j,7){
		goal.a[i][j]=(i+1)*10+j+1;
	}
	rep(i,4) goal.a[i][7]=0;
	int t;
	cin>>t;
	rep(tt,t){
		state st;
		rep(i,4) rep(j,8) st.a[i][j]=0;
		rep(i,4) rep1(j,7){
			int aa;
			cin>>aa;
			if(aa%10!=1) st.a[i][j]=aa;
		}
		rep(i,4) st.a[i][0]=i*10+11;
		cout<<bfs(st)<<endl;
	}
}

Measured memory_bytes: 12504
#include <bits/stdc++.h>  // clang-format off
using namespace std;
using Int = long long;
#define REP2(i, n) for (Int i = 0, max_i = (n); i < max_i; i++)
#define REP3(i, a, b) for (Int i = (a), max_i = (b); i < max_i; i++)
#define OVERLOAD2(_1, _2, _3, name, ...) name
#define REP(...) OVERLOAD2(__VA_ARGS__, REP3, REP2)(__VA_ARGS__)
struct in {
    int n; in() {} in(int n_) : n(n_){}
    template <class T> operator T() { T ret; cin >> ret; return ret; }
    template <class T> operator vector<T>() { vector<T> ret(n); for (int i = 0; i < n; i++) cin >> ret[i]; return ret; }
};
struct SetupIO { SetupIO() { cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(20); } } setup_io;
#ifndef _MY_DEBUG
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sat Jan 11 19:56:25 JST 2020
 **/

signed main() {
    Int K = in(), X = in();
    bool ok = 500 * K >= X;
    cout << (ok ? "Yes" : "No") << endl;
}


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

using namespace std;

typedef pair<int, int> pii;

int mat[502][502];

int main() {
	int H, W;
	cin >> H >> W;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> mat[i][j];
		}
	}
	vector< pii > dirs = {pii(0, 1), pii(1, 0), pii(0, -1), pii(-1, 0)};
	vector< pair<pii, pii> > res;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (mat[i][j] % 2 == 0) continue;
			if (j-1 >= 0 && mat[i][j-1] % 2 == 1) {
				// cout << i+1 << " " << j+1 << " " << i+1 << " " << j << endl;
				res.push_back(make_pair(pii(i+1, j+1), pii(i+1, j)));
				mat[i][j]--;
				mat[i][j-1]++;
				continue;	
			}
			if (i-1 >= 0 && mat[i-1][j] % 2 == 1) {
				mat[i][j]--;
				mat[i-1][j]++;
				// cout << i+1 << " " << j+1 << " " << i << " " << j+1 << endl;
				res.push_back(make_pair(pii(i+1, j+1), pii(i, j+1)));
				continue;	
			}
			if (j + 1 < W) {
				mat[i][j]--;
				mat[i][j+1]++;
				// cout << i+1 << " " << j+1 << " " << i+1 << " " << j+2 << endl;
				res.push_back(make_pair(pii(i+1, j+1), pii(i+1, j+2)));
				continue;
			}
			if (i + 1 < H) {
				mat[i][j]--;
				mat[i+1][j]++;
				// cout << i+1 << " " << j+1 << " " << i+2 << " " << j+1 << endl;
				res.push_back(make_pair(pii(i+1, j+1), pii(i+2, j+1)));
			}
		}
	}
	cout << res.size() << endl;
	for (auto p : res) {
		cout << p.first.first << " " << p.first.second << " " << p.second.first << " " << p.second.second << endl;
	}

}

Measured memory_bytes: 5232
from collections import deque

q = int(input())
data_list = list()
for i in range(q):
    data = input()
    data_list.append(data)

a = deque()
for data in data_list:
    if data[0] == "0":
        if data.split()[1] == "1":
            a.append(data.split()[2])
        else:
            x = data.split()[2]
            a.appendleft(x)
        # print(a)
    elif data[0] == "1":
        print(a[int(data.split()[1])])
        # print(a)
    else:
        if data.split()[1] == "1":
            a.pop()
        else:
            a.popleft()
        # print(a)



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

int main() {
  int n;
  string s;
  cin>>n>>s;
  
  vector<int> a(n+1),b(n+1);
  rep(i,n){
    if(s[i]=='.'){
      a[i+1]=a[i]+1;
      b[i+1]=b[i];
    }else{
      a[i+1]=a[i];
      b[i+1]=b[i]+1;
    }
  }
  int ans = n+1;
  rep(i,n+1){
    ans = min(ans,a[n]-a[i]+b[i]);
  }
  cout << ans << endl;
}



Measured memory_bytes: 2180
let () =
  let n = Scanf.sscanf (input_line stdin) "%d" (fun a -> a) in
  let odds = if n mod 2 = 0 then n / 2 else n / 2 + 1 in
  print_float ((float_of_int odds) /. (float_of_int n));
  print_newline ()

Measured memory_bytes: 384
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define Go_ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long int
#define llu long long unsigned int
#define pf printf
#define sf scanf
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define pii pair<int ,int>
#define PII pair<ll ,ll>
 
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
 
typedef tree<pair<int,int>,null_type,less<pair<int,int> >,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
int Set(int N,int pos){return N=N | (1<<pos);}
int reset(int N,int pos){return N= N & ~(1<<pos);}
bool check(int N,int pos){return (bool)(N & (1<<pos));}
const int Max=1e9+100;
const ll  MAX=1e18+500;
const int sz=2e5+100;
 
int main()
{
    Go_
    int a,b,c,i,j,k,q,p,x,y,ct,ct1,m,l,r,x1,y1,mn,h,sum1,in,z,mid,n,mx;
    char ch;
    double d;
    string str1,str2,str;
    bool bl,bl1;
    int t,cs=1;

    cin>>n;
    pii ara[n];

    for(i=0;i<n;i++){
        cin>>ara[i].first>>ara[i].second;
    }

    for(i=0;i+2<n;i++){
        if(ara[i].first==ara[i].second && ara[i+1].first==ara[i+1].second && ara[i+2].first==ara[i+2].second){
            cout<<"Yes\n";
            return 0;
        }
    }
    
    cout<<"No\n";
   

}

Measured memory_bytes: 3640
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	int k;
	cin>>k;
	cout<<a+b+c+max({a,b,c})*((1<<k)-1)<<endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
   int n,flag=0;
   cin>>n;
   int a[3];
   a[0]=n/100;
   a[1]=n/10%10;
   a[2]=n%10;
   for(int i=0;i<3;i++){
   	if(a[i]==7){flag=1;break;}
   }
   if(flag==1)cout<<"Yes"<<endl;
   else cout<<"No"<<endl;
} 

Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
#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;i>=0;i--)
#define MAX 200004
#define B 100
#define dpb push_back
#define fi first
#define se second
typedef pair<int, int> P;
typedef long long ll;
const int inf = 1e9;
const ll INF = 1e16;
//__gcd(a,b), __builtin_popcount(a);

ll a[MAX], total;

int solve(ll m, int n){
	int r = -1;
	ll s1, s2;
	
	while(r+1 < n){
		r++;
		s1 = *lower_bound(a, a+MAX, a[r]+m);
		if(s1 == INF)continue;
		s2 = *lower_bound(a, a+MAX, s1+m);
		if(s2 == INF)continue;
		if(total-(s2-a[r]) >= m)return 0;
	}
	
	return 1;
}

int main(){
	int n;
	scanf("%d", &n);
	fill(a, a+MAX, INF);
	rrep(i,n){
		scanf("%lld", &a[i]);
		a[n+i] = a[i];
	}
	for(int i = 2;i <= 2*n;i++){
		a[i] += a[i-1];
	}
	a[0] = 0;
	total = a[n];
	
	ll vl = 0, vr = INF;
	while(vr-vl > 1){
		ll mid = (vr+vl)/2;
		int f = solve(mid, n);
		if(f)vr = mid;
		else vl = mid;
	}
	printf("%lld\n", vl);
	return 0;
}

Measured memory_bytes: 4780
import java.util.*;

class Main {

    static int gcd(int a, int b) {
        return b > 0 ? gcd(b, a % b) : a;
    }

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

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();

        long res = 0;
        for (int i = 1; i <= k; i++) {
            for (int j = 1; j <= k; j++) {
                for (int l = 1; l <= k; l++) {
                    res += gcd(i, gcd(j, l));
                    // System.out.println("i:" + i + ",j:" + j + ",l:" + l + "," + res);
                }
            }
        }

        System.out.println(res);
        sc.close();
    }
}


Measured memory_bytes: 35564
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf = 1012345678;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

int gcd(int a, int b)
{
  if (a%b==0){
    return(b);
  }
  else{
    return(gcd(b,a%b));
  }
}

int main(){
  int N, M;
  cin >> N >> M;
  priority_queue<int> que;
  vector<vector<int> > day(M+1);
  rep(i,N){
    int a, b;
    cin >> a >> b;
    if(a <= M) day[a].push_back(b);
  }
  int ans =0 ;
  priority_queue<int> q;
  for(int i = 1; i <= M; i++){
    for(auto j : day[i]) q.push(j);
    if(!q.empty()){
      ans += q.top();
      q.pop();
    }
  }
  cout << ans << endl;
  // for(auto& a : day[4]){
  //   cout << a << endl;
  // }
  
}




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

template<typename T>
vector<pair<T, int>> factorize(T n) {
  vector<pair<T, int>> res;
  for (T i = 2; i * i <= n; ++i) {
    if (n % i) continue;
    res.emplace_back(i, 0);
    while (n % i == 0) {
      n /= i;
      res.back().second++;
    }
  }
  if (n != 1) res.emplace_back(n, 1);
  return res;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << setprecision(20);

  int n;
  cin >> n;

  int ans = 0;
  for (int i = 3; i <= n; i += 2) {
    auto res = factorize(i);
    int num_of_divisor = 1;
    for (auto& e : res) {
      num_of_divisor *= (e.second + 1);
    }
    if (num_of_divisor == 8) ans++;
  }
  cout << ans << endl;
  return 0;
}


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

long long l,g;
string s[100005];

int binserch(int ok,int ng,int d)
{
	if (ng-ok<2)
	{
		return ok;
	}
	int mid=(ok+ng)/2;
	if (s[mid][d]=='0')
	{
		return binserch(mid,ng,d);
	}
	else
	{
		return binserch(ok,mid,d);
	}
}

void dfs(int x,int y,long long d)
{
	if (x==y)
	{
		long long z=l-d,now=2LL;
		while (z%now==0LL)
		{
			now*=2LL;
		}
		now/=2LL;
		g^=now;
		return;
	}
	else if (x+1==y&&s[x].size()==d+1)
	{
		return;
	}
	int z=binserch(x-1,y,d+1);
	dfs(x,z+1,d+1);
	dfs(z+1,y,d+1);
}

int main(int argc, char const *argv[])
{
	int n;
	cin>>n>>l;
	for (int i = 0; i < n; ++i)
	{
		cin>>s[i];
	}
	sort(s,s+n);
	int tmp=binserch(-1,n,0);
	g=0LL;
	dfs(0,tmp+1,0);
	dfs(tmp+1,n,0);
	if (g==0LL)
	{
		cout<<"Bob\n";
	}
	else
	{
		cout<<"Alice\n";
	}
	return 0;
}


Measured memory_bytes: 4352
#include <stdio.h>

#define PLAYERS 5

int main (void) {
    int p[PLAYERS];
    int hands, i;
    int winner[] = {0,0,0,1,0,3,2};

    while (scanf("%d", &p[0]) != EOF && p[0]) {
        hands = 1 << (p[0]-1);
        for (i = 1; i < PLAYERS; i++) {
            scanf("%d", &p[i]);
            hands |= 1 << (p[i]-1);
        }
        switch (hands) {
            case 3:
            case 5:
            case 6:
                for (i = 0; i < PLAYERS; i++) {
                    printf("%d\n", p[i]==winner[hands] ? 1: 2);
                }
                break;
            default:
                for (i = 0; i < PLAYERS; i++) {
                    printf("3\n");
                }
                break;
        }
    }
    return 0;
}

Measured memory_bytes: 612
#include<stdio.h>
int main()
{
  int a[4];
  int i,j=0;
  for(i=0;i<4;i++)
       scanf("%d",&a[i]);
  if(a[1]<=a[2]||a[3]<=a[0])
       printf("%d",j);
 else{
    for(i=0;i<4;i++)
          for(j=0;j<3;j++)
                 if(a[j]>a[j+1])
                     {
        int temp=a[j];   a[j]=a[j+1],a[j+1]=temp; 
              }
         printf("%d",a[2]-a[1]);
}
   return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <climits>
using namespace std;

void solve(vector<int>& point)
{
	int total = point[0];
	int maxPoint = point[0];
	int minPoint = point[0];
	for(unsigned i=1; i<point.size(); ++i){
		total += point[i];
		maxPoint = max(maxPoint, point[i]);
		minPoint = min(minPoint, point[i]);
	}
	cout << ((total-maxPoint-minPoint)/(point.size()-2)) << endl;
}

int main()
{
	int number = 0;
	for(;;){
		int n;
		cin >> n;
		if(n == 0)
			break;

		vector<int> point(n);
		for(int i=0; i<n; ++i)
			cin >> point[i];

		solve(point);
	}

	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intput(i) cout << i << endl
#define ll long long
#define stringput(s) cout << (string)(s) << endl

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  int fir = max({a, b, c});
  int thr = min({a, b, c});
  int sec = a + b + c - fir- thr;
  int cnt = 0;
  cnt += sec - thr;
  cnt += fir - sec;
  cout << cnt  << endl;





}


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

using namespace std;

int main()
{
    int n,c=0;
    string s;
    cin>>n>>s;
    for(int i=0;i<n-2;++i)
    {
        if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')
        {
            ++c;
            i=i+2;
        }
    }
    cout<<c;


    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define INF 10000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>

using namespace std;

typedef long long ll;
typedef pair<int,string> P;

static const double eps = 1e-8;

int main(){
	int q1;
	while(~scanf("%d",&q1)){
		if(q1==0) break;
		int b,c1,c2,q2;
		//1:aize chiken 2:normal chiken
		scanf("%d %d %d %d",&b,&c1,&c2,&q2);
		for(int i=q2;i>=1;i--){
			int cost = i*c1;

			int ub = 1000000;
			int lb = 0;

			for(int j=0;j<20;j++){
				int md = (ub+lb)/2;
				if(cost + md*c2 <=b) lb = md;
				else ub = md;
			}

			if(lb+i >= q1 && cost + lb*c2 <=b){
				printf("%d %d\n",i,lb);
				goto next;
			}
		}
		printf("NA\n");
next:;
	}
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const int MOD = 1000000007;

int main() {
  string S, T;
  cin >> S >> T;
  vector<int> f(26, -1), t(26, -1);
  rep(i, S.size()) {
    int from = S[i] - 'a';
    int to = T[i] - 'a';
    if ((t[to] != -1 && t[to] != from) || (f[from] != -1 && f[from] != to)) {
      cout << "No" << endl;
      return 0;
    }
    f[from] = to;
    t[to] = from;
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 776
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<ll,ll>;
#define For(i,a,b)  for(int i=a;i<=b;i++)
#define Forr(i,a,b) for(int i=a;i>=b;i--)
#define F first
#define S second
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define bpc __builtin_popcount
#define MOD (ll)(1e9+7)
#define INF (2e9)
#define EPS (1e-6)
#define NATHANLEE_IS_EVIL_AND_ELECTRIC true
#define int ll
#ifdef LOCAL_TEST
#define debug(...) do{\
	cerr<<__PRETTY_FUNCTION__<<" - "<<__LINE__<<\
	" : ("#__VA_ARGS__<<") = ";\
	_OUT(__VA_ARGS__);\
}while(0)
template<typename T>void _OUT(T x){cerr<<x<<"\n";}
template<typename T,typename...I>void _OUT(T x,I ...tail){cerr<<x<<", ";_OUT(tail...);}
#else
#define debug(...)
#endif
void INIT(){
#ifdef LOCAL_TEST
	freopen("D:\\input.in","r",stdin);
	freopen("D:\\output.out","w",stdout);
	freopen("D:\\error.out","w",stderr);
#endif
	ios::sync_with_stdio(!NATHANLEE_IS_EVIL_AND_ELECTRIC);
	cin.tie(0);
}

ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }
ll lcm(ll a,ll b) { return a/gcd(a,b)*b; }
ll fpow(ll b,ll p){
	b%=MOD;
	ll ans=1;
	while(p>0){
		if(p&1) ans=(ans*b)%MOD;
		p/=2;
		b=(b*b)%MOD;
	}
	return ans;
}

char g[1010][1010];
int dp[1010][1010];

int32_t main() {
	INIT();
	//code...
	int n,m; cin>>n>>m;
	For(i,0,n) For(j,0,m){
		if(i==0 || j==0) g[i][j]='#';
		else cin>>g[i][j];
	}
	For(i,0,n) For(j,0,m){
		if(g[i][j]=='#') dp[i][j]=0;
		else if(i==1 && j==1) dp[i][j]=1;
		else dp[i][j]=dp[i-1][j]+dp[i][j-1];
		dp[i][j]%=MOD;
	}
	cout<<dp[n][m];
	return 0;
}

Measured memory_bytes: 12484
X = int(input())

def is_prime(x):
	if x == 2:
		return True
	if x % 2 == 0:
		return False
	else:
		for i in range(3, x, 2):
			if x % i == 0:
				return False
		return True

a = X
if (X % 2 == 0) & (X > 2):
	a += 1
while 1:	
	if is_prime(a):
		print(a)
		break
	else:
		a += 2
			

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
const long long mod = pow(10, 9) + 7;
const long long MOD = 998244353;
const long long INF = 1LL << 60;
const int inf = pow(10, 9) + 7;
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, int B) {return (A + (B - 1)) / B;}
long long divCeil(int A, long long B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, long long B) {return (A + (B - 1)) / B;}

int main()
{
  int N;
  cin >> N;
  vector<int> L(2 * N);
  for (int i = 0; i < 2 * N; i++)
  {
    cin >> L.at(i);
  }
  
  sort(L.begin(), L.end());

  int ans = 0;
  for (int i = 0; i < 2 * N; i += 2)
  {
    ans += L.at(i);
  }
  
  cout << ans << endl;
  
  //for (int i = 0; i < 2 * N; i++) cout << L.at(i) << endl;
}

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

using namespace std;

#define ll long long

int main(){
	ll x,k,d;
	cin>>x>>k>>d;
	x=abs(x);
	ll tempAns = x/(2*d);
	tempAns+=k/2;
	tempAns=min(tempAns,k);
	ll ans=1e18;
	ll mi=0;
	ll low=max(tempAns-4,mi);
	for(ll i=low;i<=k&&i<=low+10;i++){
		ans=min(ans,abs(x+(k-2*i)*d));
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 3656
import java.util.Scanner;
public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int Ans = 0;
        String str[];
        str = new String[3];
        int num[];
        num = new int[3];
        for(int i=0; i<=2; i++)
            {
            str[i] = in.next();
            num[i] = Integer.parseInt(str[i]);
            }
        if (num[0]<=num[1])
            {
            for(int i=num[0]; i<=num[1];i++)
                {
                if(num[2]%i==0){Ans++;}    
                }
            }
        System.out.println(Ans);
    }
    
}

Measured memory_bytes: 26296
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<iomanip>
#include<map>
#include<utility>
#include<string>
#include<unordered_map>
#include <queue>

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

using namespace std;

#define min_3(a, b, c) min(a, min(b, c))
#define max_3(a, b, c) max(a, max(b, c))
typedef long long ll;

int main(){
    int n; cin >> n;
    for(int i = 1; i <= 9; i++){
        for(int j = 1; j <= 9; j++){
            if(i*j == n){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Int = long long int;
template<typename T> void swap(T *t1, T *t2){ T* tmp=t1; t1=t2; t2=tmp;}
Int tmpi = 0;
double tmpd = 0.0;


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

    Int n, d;
    double x[10][10];
    cin >> n >> d;
    for(Int i=0; i<n; i++){
        for(Int j=0; j<d; j++){
            cin >> x[i][j];
        }
    }

    Int sum = 0;
    for(Int i=0; i<n-1; i++){
        for(Int k=i+1; k<n; k++){
            double dis = 0.0;
            for(Int j=0; j<d; j++){
                dis += pow((x[i][j]-x[k][j]), 2);
            }
            dis = sqrt(dis);
            if(floor(dis) == dis){
                sum++;
            }
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		
		while(scan.hasNext()){
			int a = scan.nextInt();
			int b = scan.nextInt();
			int keta = String.valueOf(a+b).length();
			System.out.println(keta);
		}
	}
}

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

int main(void)
{
	string s;
	cin >> s;
	if (s[2] == s[3] && s[4] == s[5]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

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

int main() {
  int N;
  cin >> N;
  string S,T;
  cin>>S>>T;
  for (int i = 0; i < N; i++) {
    cout << S.at(i)<<T.at(i) ;
  }
 
  cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main() 
{
    int N; cin >> N;
    vector<int> A(N); for (auto &a : A) cin >> a;
    vector<int> L(N), R(N);
    L[0] = A[0];
    R[N-1] = A[N-1];
    for (int i = 1; i < N; i++) {
        L[i] = __gcd(L[i-1], A[i]);
    }
    for (int i = N-2; i >= 0; i--) {
        R[i] = __gcd(R[i+1], A[i]);
    }
    int ans = 0;
    for (int i = 0; i < N; i++) {
        int left = i == 0 ? 0 : L[i-1];
        int right = i == N-1 ? 0 : R[i+1];
        ans = max(ans, __gcd(left, right));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1408
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<string>
#include<queue>
#include<map>
#include<vector>
#include<ctime>

#define ll long long
#define R register
#define IL inline
#define Rf(a,b,c) for(R int (a)=(b);(a)<=(c);++(a))
#define Tf(a,b,c) for(R int (a)=(b);(a)>=(c);--(a))
#define MP make_pair
#define PA pair<int,int>
#define MES(a,b) memset((a),(b),sizeof((a)))
#define MEC(a,b) memcpy((a),(b),sizeof((b)))
#define D double

using namespace std;

int n;
char s[10];

IL int read() {
    int x=0,f=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x*=10;x+=(ch-'0');ch=getchar();}
    return x*f;
}
IL void write(int x) {
    if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar(x%10+'0');
}

signed main()
{
	n=read();s[0]=n%10+'0';
	if(s[0]=='2'||s[0]=='4'||s[0]=='5'||s[0]=='7'||s[0]=='9')
		puts("hon");
	if(s[0]=='0'||s[0]=='1'||s[0]=='6'||s[0]=='8')
		puts("pon");
	if(s[0]=='3') puts("bon");

    return 0;
}


Measured memory_bytes: 3624
#include<stdio.h>
int digit(int a)
{
    int i,sum;
    sum=0;
    for(;;)
    {
        sum=sum+a%10;
        a=a/10;
        if(a==0)
        {
            break;
        }
    }
    return sum;
}
int main()
{
    int a,b,n,c,sum=0,i;
    scanf("%d %d %d",&n,&a,&b);
    for(i=1;i<=n;i++)
    {
        c=digit(i);
        if(c>=a&&c<=b)
        {
            sum=sum+i;
        }
    }
    printf("%d\n",sum);
  return 0;
}


Measured memory_bytes: 128
package main
import(
  "fmt"
)
func main(){
  var(
    n,a int
    v,c []int
  )
  fmt.Scan(&n)
  v=make([]int,n)
  c=make([]int,n)
  for i:=0;i<n;i++{
    fmt.Scan(&v[i])
  }
  for i:=0;i<n;i++{
    fmt.Scan(&c[i])
    if v[i]-c[i]>0{
      a+=v[i]-c[i]
    }
  }
  fmt.Println(a)
}

Measured memory_bytes: 512
#include<string>
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<map>
using namespace std;
typedef long long int llint;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
const int mod=1000000007;
const llint big=1e18+10;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-9;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
int gcd(int a,int b){if(a%b==0){return b;}else return gcd(b,a%b);}//a>b
class in_t{public:
	int a;in_t(){cin>>a;}
	operator int() {return a;}
};
class lin_t{public:
	llint a;lin_t(){cin>>a;}
	operator llint() {return a;}
};
class ld_t{public:
	long double a;ld_t(){cin>>a;}
	operator long double() {return a;}
};
int main(void){
	in_t n;
	int i,j;
	vector<int> num(n,-mod);
	vector<int>zyo(n,-1);
	priority_queue<pair<int,int>> que;
	vector<vector<int>>ko(n);
	for(i=0;i<n-1;i++){
		int a,b;cin>>a>>b;a--;b--;
		ko[a].pub(b);
		ko[b].pub(a);
	}
	in_t k;
	for(i=0;i<k;i++){
		int v,p;cin>>v>>p;v--;
		zyo[v]=p;
		que.push(mp(p,v));
	}
	while(!que.empty()){
		int p=que.top().fir,v=que.top().sec;
		que.pop();
		if(num[v]>=p){continue;}
		num[v]=p;
		for(i=0;i<ko[v].size();i++){
			que.push(mp(p-1,ko[v][i]));
		}
	}
	for(i=0;i<n;i++){
		if(zyo[i]!=-1&&zyo[i]!=num[i]){cout<<"No"<<endl;return 0;}
		for(j=0;j<ko[i].size();j++){
			if(abs(num[i]-num[ko[i][j]])!=1){cout<<"No"<<endl;return 0;}
		}
	}
	cout<<"Yes"<<endl;
	for(i=0;i<n;i++){cout<<num[i]<<endl;}
	return 0;
}

Measured memory_bytes: 9076
# https://atcoder.jp/contests/abc129/tasks/abc129_c
# 典型的なDP

MOD = 10**9 + 7

# dp[i]をi段目までの通りの数とする。
N, M = list(map(int, input().split()))
to_zero = [False] * (N + 1)
for _ in range(M):
    to_zero[int(input())] = True  # 床が抜けているところ

# dpテーブルの用意
dp = [-1] * (N + 1)
dp[0] = 1
dp[1] = 0 if to_zero[1] else 1
for i in range(2, N + 1):
    dp[i] = dp[i - 1] + dp[i - 2]
    if to_zero[i]:
        dp[i] = 0

    if dp[i] > MOD:
        dp[i] %= MOD

print(dp[-1])


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

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

    std::string s, t;
    std::cin >> s >> t;

    for (int i = 0; i < n; i++) {
        if (s.substr(i, n - i) == t.substr(0, n - i)) {
            std::cout << n * 2 - (n - i) << std::endl;
            return 0;
        }
    }
    std::cout << n * 2 << std::endl;
}


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

using namespace std;

const int N = 2e5 + 5;

int bit[N];

int get(int x) {
  int r = 0;
  for (++x; x; x -= x&-x)
    r += bit[x];
  return r;
}

void upd(int x, int v) {
  for (++x; x < N; x += x&-x)
    bit[x] += v;
}

int a[N];

int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; ++i)
    scanf("%d", a+i);
  while (k--) {
    bool changed = false;
    fill(bit, bit+n+2, 0);
    for (int i = 0; i < n; ++i) {
      int d = a[i];
      upd(max(i - d, 0), +1);
      upd(min(i + d + 1, n+1), -1);
    }
    for (int i = 0; i < n; ++i) {
      int res = get(i);
      if (a[i] != res) {
        changed = true;
        a[i] = res;
      }
    }
    if (!changed)
      break;
  }
  for (int i = 0; i < n; ++i) {
    printf("%d%c", a[i], i+1 == n ? '\n' : ' ');
  }
  return 0;
}


Measured memory_bytes: 5344
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
    class Program
    {
        private const int MODULO = 1000000007;
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        static IEnumerable<int> Solve(int H, int W, int D, Tuple<int, int>[] points, Tuple<int, int>[] queries)
        {
            int[] memo = new int[H * W + 1];
            for (int i = D + 1; i <= H * W; ++i)
            {
                var a = points[i - D];
                var b = points[i];
                memo[i] = memo[i - D] + Math.Abs(b.Item1 - a.Item1) + Math.Abs(b.Item2 - a.Item2);
            }
            return queries.Select(q => memo[q.Item2] - memo[q.Item1]);
        }
        static void Main(string[] args)
        {
            int[] v1 = ReadInts();
            int H = v1[0];
            int W = v1[1];
            int D = v1[2];
            var points = new Tuple<int, int>[H * W + 1];
            for (int i = 0; i < H; ++i)
            {
                int[] v2 = ReadInts();
                for (int j = 0; j < W; ++j)
                {
                    points[v2[j]] = new Tuple<int, int>(i, j);
                }
            }
            int Q = ReadInt();
            var queries = new Tuple<int, int>[Q];
            for (int i = 0; i < Q; ++i)
            {
                int[] v2 = ReadInts();
                queries[i] = new Tuple<int, int>(v2[0], v2[1]);
            }
            foreach (int sum in Solve(H, W, D, points, queries))
            {
                Console.WriteLine(sum);
            }
        }
    }
}


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


int main()
{
    int N;
    cin >> N;
    vector<int> A(N), B(N), C(N);
    for( int i = 0; i < N; ++i ) cin >> A[i];
    for( int i = 0; i < N; ++i ) cin >> B[i];
    for( int i = 0; i < N; ++i ) cin >> C[i];

    sort( A.begin(), A.end() );
    sort( B.begin(), B.end() );
    sort( C.begin(), C.end() );

    
    int Bleft = 0, Cleft = 0;
    vector<long> num_upper_bound(N+1);  // C のうち B[i] より大きい要素の数

    for( int i = 0; i < N; ++i ){
        while( B[i] >= C[Cleft] && Cleft < N ) Cleft++;
        num_upper_bound[i] = N - Cleft;
    }
    for( int i = N-1; i >= 1; --i ){
        num_upper_bound[i-1] += num_upper_bound[i];
    }

    long ans = 0;
    for( int i = 0; i < N; ++i ){
        while( A[i] >= B[Bleft] && Bleft < N ) Bleft++;
            ans += num_upper_bound[Bleft];
    }

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

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

int main() {
  int n;
  vector<int> p;
  cin>>n;
  int count=0;
  
  for(int i=0;i<n;i++){
    int b;
    cin>>b;
    p.push_back(b);
  }
  
  for(int i=1;i<n-1;i++){
    vector<int> p_sub;
    for(int j=i-1;j<i+2;j++){
      p_sub.push_back(p.at(j));
    }
    sort(p_sub.begin(),p_sub.end());
    if(p.at(i)==p_sub.at(1)) count++;
  }
  cout<<count<<endl;
  
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

class BipartiteMatching {
public:
	int n;
	vector<vector<int>> g;
	vector<int> match;
	BipartiteMatching(int n) : n(n), g(n), match(n), used(n) {}
	void add_edge(int u, int v) {
		g[u].emplace_back(v);
		g[v].emplace_back(u);
	}
	//?????§??????????????°
	int maximum_matching() {
		int ret = 0;
		fill(match.begin(), match.end(), -1);
		for (int v = 0; v < n; v++) {
			if (match[v] == -1) {
				fill(used.begin(), used.end(), false);
				if (dfs(v)) ret++;
			}
		}
		return ret;
	}
private:
	vector<int> used;
	bool dfs(int v) {
		used[v] = true;
		for (int u : g[v]) {
			int w = match[u];
			if (w == -1 || (!used[w] && dfs(w))) {
				match[v] = u;
				match[u] = v;
				return true;
			}
		}
		return false;
	}
};

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int X, Y, E; cin >> X >> Y >> E;
	BipartiteMatching bm(X + Y);
	rep(i, 0, E) {
		int x, y; cin >> x >> y;
		bm.add_edge(x, X + y);
	}
	cout << bm.maximum_matching() << endl;
	return 0;
}

Measured memory_bytes: 3308
// 006 AGC A - Prefix and Suffix 2016/10/29

#include <bits/stdc++.h>
#define rep(i ,n) for(int i=0;i<(int)(n);++i)
using namespace std;
typedef long long int int64;
typedef unsigned long long uint64;

int main(int argc , char* argv[]){
        int n; cin >> n;
        string s , t;
        cin >> s >> t;
        rep(i ,n){
            string s1=s.substr(i,n-i);
            string t1=t.substr(0,n-i);
            if ( s1 == t1 ) { cout << 2 * n - ( n - i ) << endl; return 0;}
        }
        cout << 2 * n << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

int a, b, c;

int main(){
	//IO("input.txt", "output.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> a >> b >> c;
	cout << ((b - a == c - b) ? "YES\n" : "NO\n");
	return 0;
}

Measured memory_bytes: 256
from itertools import combinations, chain

H, W, K = map(int, input().split())
Sss = []
for _ in range(H):
    Sss.append(list(map(int, input())))


def h_divide(Sss, div_is):
    result = []
    for s, e in zip(chain([0], div_is), chain(div_is, [len(Sss)])):
        result.append(Sss[s:e])
    return result


def _v_end(Sss, start, K):
    count = 0
    for i in range(start, len(Sss[0])):
        s = sum(map(lambda Ss: Ss[i], Sss))
        if count + s > K:
            return i - 1
        count += s
    return len(Sss[0]) - 1


def v_end(Ssss, start, K):
    result = -1
    for Sss in Ssss:
        end = _v_end(Sss, start, K)
        if end < start:
            return -1
        if result < 0 or result > end:
            result = end
    return result


def v_div_count(Ssss, K):
    start, result = 0, 0
    while True:
        end = v_end(Ssss, start, K)
        if end < 0:
            return -1
        if end == len(Ssss[0][0]) - 1:
            break
        result += 1
        start = end + 1
    return result


h_cands = list(range(1, len(Sss)))
ans = -1
for n in range(len(h_cands) + 1):
    for comb in combinations(h_cands, n):
        if ans > 0 and n >= ans:
            continue
        Ssss = h_divide(Sss, list(comb))
        cnt = v_div_count(Ssss, K)
        if cnt < 0:
            continue
        if ans < 0 or ans > n + cnt:
            ans = n + cnt
print(ans)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)  
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int gcd(int a,int b){return b?gcd(b,a%b):a;}

ll modpow(ll n,ll k){
  if(k == 1){
    return n;
  }else if(k == 0){
    return 1;
  }else if(k%2==0){
    ll memo = modpow(n,k/2)%MOD;
    return memo*memo%MOD;
  }else{
    return n * modpow(n,k-1)%MOD;
  }
}

int main(){

  int a,b,c;
  cin>>a>>b>>c;
  for(int i=1;i<=10;i++){
    c = a*c-b;
    cout<<c<<endl;
  }

 

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
int main() {
    double r;
    std::cin >> r;
    std::cout << std::setprecision(8) << std::fixed
              << r * r * M_PI << ' '
              << 2.0 * r * M_PI << ' '
              << std::endl;
    return 0;
}


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

using namespace std;

int main ()
{
  
  int N, D; cin >> N >> D;
  int ans = 0;
  vector<vector<int> > vv;

  for (int i=0; i < N; i++) {
    vector<int> v;
    for (int j=0; j < D; j++) {
      int X; cin >> X;
      v.push_back(X);
    }
    vv.push_back(v);
  }
  
  //N * (N-1)
  for (int i=0; i < N; i++) {
    for (int j=0; j < N; j++) {
      if (i == j) continue;
      float a = 0.0f;
      for (int n=0; n < D; n++) {
        a += pow(static_cast<float>(vv[i][n] - vv[j][n]), 2.0f);
      }
      a = sqrt(a);
      if (ceil(a) == floor(a)) ans++;
    }
  }
  
  cout << ans / 2 << endl;
}

Measured memory_bytes: 256
N, Y = map(int, input().split())
ans = 0
a = 0
b = 0
c = 0
for a in range(N+1):
    for b in range(N-a+1):
        c = N - a - b
        if (a*10000 + b*5000 + c*1000) == Y:
            ans = 1
            x = a
            y = b
            z = c
            break
    else:
        continue
    break
if ans == 1:
    print(x,y,z)
else:
    print( '-1 -1 -1')

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

using namespace std;

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

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n;
    cin >> n;
    vector<vector<int>> g(n);
    for(int i = 0; i < n - 1; i++) {
        int u, v;
        cin >> u >> v;
        u--, v--;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    ll ans = 0, sum = 0;
    for(int r = 0; r < n; r++) {
        sum += 1;
        vector<int> adj;
        for(auto v: g[r]) {
            if(v < r) {
                adj.push_back(v);
            }
        }
        sort(adj.begin(), adj.end());
        sum += r;
        if(adj.size()) {
            for(int i = 0; i < adj.size(); i++) {
                sum -= 1ll * (adj.size() - i) * (i ? adj[i] - adj[i - 1]: adj[i] + 1);
            }
        }
        //cerr << r << ' ' << sum << '\n';
        ans += sum;
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 16432
sx, sy, tx, ty = map(int,input().split())
dx = tx - sx
dy = ty - sy

ans = "R" * dx + "U" * dy + "L" * dx + "D" * dy
ans += "DR" + "R" * dx + "U" * dy + "UL" + "UL" + "L" * dx + "D" * dy + "DR"
print(ans)

Measured memory_bytes: 3060
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		int c=sc.nextInt();

		if(a+b>=c) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
	}
}

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

using namespace std;

#define fore(i, s, e) for(int i = s; i < e; i++)
#define pb push_back

const int N = 1e5;

typedef long long ll;

int n, m;
ll dp[N];

vector<int> g[N];
int visited[N];

int dfs(int x) {
    int r = 0;
    if(visited[x]) return visited[x];
    for(int v : g[x]) {
       r = max(r, 1 + dfs(v));
    }
    return visited[x] = r;
}

int main() {
    cin >> n >> m;
    fore(i, 0, m) {
        int x, y; cin >> x >> y; x--, y--;
        g[x].pb(y);
    }
    int res = 0;
    fore(i, 0, n) {
        if(!visited[i]) res = max(res, dfs(i));
    }
    cout << res << endl;
}

Measured memory_bytes: 8192
#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 998244353
#define MAX 10000000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
map<lli,lli>mp;
map<string,lli>mps;
map<char,lli>mpc;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli A,B,C,D,E,F,N,M,K,L,X,Y,Z,H,W,sum=0,num=0,flag=0;string S,T;
  cin >> K >> A >> B;
  rep(i,A,B+1)if(i%K==0)flag=1;
  if(flag)Out("OK");
  else Out("NG");
}


Measured memory_bytes: 3652