akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;

int main(){
    int N,M;
    cin >> N >> M;
    int a[M];
    
    int ans[N+2];
    for(int i = 0; i < N+2; i++)
        ans[i] = 0;
    ans[0] = 1;
    
    for(int i = 0; i < M; i++){
        cin >> a[i];
        ans[a[i]] = -1;
    }

        
    for(int i = 0; i < N+1; i++){
        if(ans[i] < 0) continue;
        if(ans[i+1] > -1){
            ans[i+1] += ans[i];
            ans[i+1] %= MOD;
        }
        if(ans[i+2] > -1){
            ans[i+2] += ans[i];
            ans[i+2] %= MOD;
        }
    }

    cout << ans[N] << "\n";
    return 0;
} 


Measured memory_bytes: 1024
#include<stdio.h>
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
int main(){
	int n,m;
	while(scanf("%d%d",&n,&m),n+m){
		for(int i=0;i<n;i++){
			for(int j=0;j<m;j++)putchar(i==0||i==n-1||j==0||j==m-1?'#':'.');
			puts("");
		}
		puts("");
	}
}


Measured memory_bytes: 2108
#https://atcoder.jp/contests/abc158/tasks/abc158_b

n,a,b=map(int,input().split())

cycle=a+b
cycle_cnt=n//cycle
rest=n-cycle*cycle_cnt
if rest<=a:
    print(cycle_cnt*a+rest)
else:
    print(cycle_cnt*a+a)

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

p=[]
for k in range(2,n+1):
  flag = True
  for i in p:
    if k%i == 0:
      flag = False
      break
  if flag:
    p += [k]

a = 1
for i in p:
  s = 1
  x = n//i
  while x>0:
    s += x
    x = x//i
  a = a*s%1000000007
print(a)
    

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>; // グラフ型
typedef long long ll;
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (n); ++i)



int main() {
  string S;
  cin >> S;
  //vector<ll> a(N);
  //vector<vector<int>> data(3, vector<int>(4));
  char temp = S.at(S.size()-1);
  if (temp == 's') cout << S << "es" << endl;
  else cout << S << "s" << endl;

  return 0;
}


Measured memory_bytes: 3628
#include<vector>
#include<string>
#include<algorithm>
#include<iostream>
using namespace std;
int main() {
	int h, w; int yobi = 0; int ans = 0;
	cin >> h >> w;
	vector<vector<int> > a(h, vector<int>(w));
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> a[i][j];
		}
	}
	for (int i = 0; i < h; i ++) {
		for (int j = 0; j < w; j++) {
			yobi = 0;
			for (int k = 0; k < h; k++) {
				for (int l = 0; l < w; l++) {
					yobi = yobi + (a[k][l]*min(abs(k - i), abs(l - j)));
				}
			}
			if (i == 0 and j == 0) {
				ans = yobi;
			}
			else {
				ans = min(ans, yobi);
			}
		}
	}
	cout << ans<<endl;
	return 0;
}


Measured memory_bytes: 3152
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int h, n;
    cin >> h >> n;
    int arr[n];
    for(int i=0; i<n; i++)
    {
        cin >> arr[i];
        h = h-arr[i];
    }
    if(h>0)
        cout << "No";
    else
        cout << "Yes";
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main(){
	string S, T;
  	cin >> S >> T;
  	
  	int ans = T.size();
  	for(int i = 0; i <= S.size() - T.size(); i++){
    	int a = 0;
      for(int j = 0; j < T.size(); j++){
      	if(T.at(j) != S.at(i + j)) a++;
      }
      ans = min(ans, a);
    }
  cout << ans << endl;
}

Measured memory_bytes: 3596
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<long long> vll, vLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b,c;
    cin >> a >> b >> c;
    int ans=b;
    if(a+b<c){
        ans+=a+b+1;
    }else{
        ans+=c;
    }
    cout << ans<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

signed main(){  
  cin.tie(0);
  ios::sync_with_stdio(0);
  Int n;
  string a,b;
  cin>>n>>a>>b;
  if(a.size()<b.size()) a=string(b.size()-a.size(),'0')+a;
  if(a.size()>b.size()) b=string(a.size()-b.size(),'0')+b;

  const Int l=a.size();

  
  const Int BS = 600;
  vector<Int> cnt(l/BS+1,0),sft(l/BS+1,0);
  auto calc=[&](Int x){
    Int y=x*BS;
    cnt[x]=0;
    sft[x]=-l*2;
    for(Int i=0;i<BS;i++){
      if(y+i>=l) break;
      if(b[y+i]=='1') chmax(sft[x],cnt[x]+(a[y+i]=='1')+l-(y+i+1));
      cnt[x]+=a[y+i]=='1'||b[y+i]=='1';
    }
    //cout<<x<<":"<<cnt[x]<<" "<<sft[x]<<endl;
  };
  
  for(Int i=0;i<l;i+=BS) calc(i/BS);
  
  Int ans=0;
  auto recalc=[&](){
    ans=0;
    Int tmp=0;
    for(Int i=0;i<l;i+=BS){
      Int x=i/BS;
      chmax(ans,tmp+sft[x]);
      tmp+=cnt[x];
    }
  };
  
  for(Int i=0;i<n;i++){
    char c;
    cin>>c;
    if(c=='Q'){
      recalc();
      cout<<ans<<endl;
      continue;
    }
    Int p;
    cin>>p;
    p++;
    if(c=='A') a[l-p]=!(a[l-p]-'0')+'0';
    if(c=='B') b[l-p]=!(b[l-p]-'0')+'0';

    calc((l-p)/BS);
  }
  
  return 0;
}




Measured memory_bytes: 3936
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))


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

    int n;
    cin >> n;

    cout << CEIL(n, 1000) * 1000 - n << "\n";

    return 0;
}



Measured memory_bytes: 3644
#include <iostream>
#include <queue>
#include <vector>

static const long MOD = 1000000007;

using namespace std;


int main() {
  long n, k;
  cin >> n >> k;
  vector<vector<long> > G(n);
  for (long i = 0; i < n - 1; i++) {
    long ai, bi;
    cin >> ai >> bi;
    ai--;
    bi--;
    G[ai].push_back(bi);
    G[bi].push_back(ai);
  }

  long ans = k;
  vector<bool> visited(n);
  queue<long> q;
  q.push(0);
  visited[0] = true;
  while (!q.empty()) {
    long i = q.front();
    q.pop();
    long ki = i == 0 ? k - 1 : k - 2;
    for (long j : G[i]) {
      if (visited[j]) {
        continue;
      }
      visited[j] = true;
      ans = ans * ki % MOD;
      ki--;
      q.push(j);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 7284
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<cassert>
#include<iomanip>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define inf (1<<29)
#define eps (1e-8)
#define equals(a,b) (fabs((a)-(b)) < eps)
#define MAX 2000000
#define all(n) (n).begin(),(n).end()
using namespace std;
struct Circle
{
  double x,y,r;
  Circle(double x=inf,double y=inf,double r=inf):x(x),y(y),r(r){}
  bool operator < (const Circle& c)const
  {
    if(!equals(x,c.x))return x < c.x;
    return y < c.y;
  }
};

bool compare_y(Circle a,Circle b)
{
  return a.y < b.y;
}

int N;
Circle A[MAX];

double compute(Circle *a,int n)
{
  if(n <= 1)return inf;
  int m = n/2;
  double x = a[m].x;
  double y = a[m].y;
  double r = a[m].r;
  double d = min(compute(a,m),compute(a+m,n-m));
  inplace_merge(a,a+m,a+n,compare_y);

  vector<Circle> b;

  rep(i,n)
    {
      double nx = a[i].x - x;
      double ny = a[i].y - y;
      double ndist = sqrt(nx*nx + ny*ny) - a[i].r - r;
      //if(equals(ndist,d) || ndist > d)continue;
      //if(nx >= d)continue;
     
      rep(j,(int)min((int)b.size(),3))
	{
	  int last = b.size()-j-1;
	  double dx = a[i].x - b[last].x;
	  double dy = a[i].y - b[last].y;
	  double dist = sqrt(dx*dx + dy*dy) - a[i].r - b[last].r;

	  if(equals(dist,d) || dist > d)continue;
	  d = min(d,sqrt(dx*dx + dy*dy) - a[i].r - b[last].r);
	}
      b.push_back(a[i]);
    }
  return d;
}



int main()
{
  while(cin >> N,N)
    {
      assert(N < MAX);
      rep(i,N)cin >> A[i].r >> A[i].x >> A[i].y;
      sort(A,A+N);


      cout << setiosflags(ios::fixed) << setprecision(8) << compute(A,N) << endl;
    }
  return 0;
}

Measured memory_bytes: 54080
#include<iostream>
#include<cmath>
#include<algorithm>

using namespace std;

long long euclid(long long c, long long d) {
    return d ? euclid(d, c%d) : c;
}

long long multiple_number(long long b, long long c, long long d) {
    
    long long g = euclid(c,d);
    long long product_set = c * d / g;

    return b - b / c - b / d + b / product_set;
}

int main() {
    long long a, b, c, d; cin >> a >> b >> c >> d;

    cout << multiple_number(b, c, d) - multiple_number(a - 1, c, d);

    return 0;
} 


Measured memory_bytes: 256
import java.util.*;

class Main{
  static int gcd(int c,int d){
    while(true){
      int f=c%d;
      if(f==0){
        return d;
      }
      c=d;
      d=f;
    }
  }
  static ArrayList<Integer> divList(int n){
    ArrayList<Integer> div=new ArrayList<Integer>();
    for(int i=1;i*i<=n;i++){
      if(n%i==0){
        div.add(i);
        if(i*i!=n){
          div.add((int)(n/i));
        }
      }
    }
    return div;
  }
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int a=sc.nextInt();
    int b=sc.nextInt();
    int c=gcd(a,b);
    List<Integer> l=divList(c);
    Collections.sort(l);
    System.out.println(l.get(l.size()-sc.nextInt()));
  }
}

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

int FactorialII(int n)
{
  int res = 0;
  while (n) {
    res += n/5;
    n /= 5;
  }
  return res;
}

int main(int argc, char **argv)
{
  int n;
  while (cin >> n) {
    if (!n)
      break;
    cout << FactorialII(n) << endl;
  }
  return 0;
}

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

#define rep(i,n) for( (i)=0;(i)<(n);++(i) )
#define repr(i,n) for( (i)=(n);(i)>0;==(i) )
#define FOR(i,j,n) for( (i)=(j);(i)<(n);++(i) )
#define forr(i,j,n) for( (i)=(j);(i)>(n);--(i) )
#define debg(a) cout<<(a)<<endl;
#define INF 9999999
#define Int long long 
int i,j,k;
int dx,dy;
int a,b,c;
string s,t;

int main(){ 
  long long n,k;
  cin>>n>>k;
  long long h[n];
  rep(i,n)cin>>h[i];
  sort(h,h+n);
  long long min=99999999999999999999;
  rep(i,n-k+1){
    if(min>(h[i+k-1]-h[i]))min=h[i+k-1]-h[i];
  }
  cout<<min;
  cout<<endl;
  return 0;
}


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

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

    string S;
    cin >> S;
    map<char, int> mp;
    for (auto &c : S) mp[c]++;
    if (mp.size() == 1) {
        cout << 0 << endl;
        exit(0);
    }
    int ans = INT_MAX;
    for (char c = 'a'; c <= 'z'; ++c) {
        if (!mp[c]) continue;
        int N = S.size();
        string T = S;
        while (N--) {
            bool allSame = true;
            for (int i = 0; i < N; ++i) {
                if (T.at(i) == c || T.at(i + 1) == c) {
                    T.at(i) = c;
                } else {
                    allSame = false;
                }
            }
            if (allSame) {
                ans = min(ans, (int)S.size() - N);
                break;
            }
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
object Main extends App {
    val in = io.Source.stdin.getLines.map(_.trim.split(" ").map(_.toInt))
    val n = in.next.head
    val t = (0 to n-1).toArray
    val d = in.toSeq
    val es = (for (i <- (0 to n-2); j <- (i+1 to n-1) if d(i)(j) != -1) yield (i, j, d(i)(j))).sortBy(_._3)
    var cost = 0

    def find(m: Int): Int = if(t(m) == m) m else {t(m) = find(t(m)); t(m)}
 
    def unite(x: Int, y: Int) = {
        val _x = find(x)
        val _y = find(y)
        if(_x != _y) t(_x) = _y
    }
 
    es.foreach(e => if (find(e._1) != find(e._2)) {unite(e._1, e._2); cost += e._3})
    println(cost)
}

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

int main(){
    string s;cin>>s;
    int sum=0;
    for(int i=0;i<s.length();++i){
        sum+=s[i]-48;
    }
    if(sum%9==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

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

#define int long long



signed main(){
	
	
	string a="CODEFESTIVAL2016";
	string s;
	int ans=0;
	cin>>s;
	for(int i=0;i<16;i++)if(a[i]!=s[i])ans++;
	cout<<ans<<endl;
	
	return 0;
}


Measured memory_bytes: 256
/*  
    |\_/|
    |* *|
    \_+_/
*/
#include<bits/stdc++.h>

#define endl '\n'

using namespace std;

int main(){

  cin.tie(0);     // cout と cin の同期を切る
  ios::sync_with_stdio(false);  /* cの stdioストリーム (printfとか)と*/

  int a,b;

  cin>>a>>b;

  if(a+b>=10){
    cout<<"error"<<endl;
  }else{
    cout<<a+b<<endl;
  }
  
  return 0;

}




Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <queue>

typedef long long ll;
const ll LL_MAX (1LL<<60);

#define rep(i,s,e) for(ll i=(s); i<(e); i++) 

using namespace std;

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

    ll n;
    cin >> n;
    vector<ll> h(n);
    rep(i,0,n) cin >> h[i];

    ll _max(-LL_MAX), cnt(0);

    rep(i,0,n)
        if (h[i]>=_max) cnt++, _max = h[i];

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
  
using namespace std;
 
int main(){
  int n,temp,*dp;
  vector<int> arr;
  scanf("%d",&n);
 	
  dp=(int*)malloc((n+1)*sizeof(int));
  
  arr.push_back(-1);
  
  for(int i=0;i<n;i++){
  	scanf("%d",&temp);
    arr.push_back(temp);
  }
  
  if(n==1){
    printf("0\n");
    return 0;
  }
  
  if(n==2){
    printf("%d\n",abs(arr[2]-arr[1]));
    return 0;
  }
  
  dp[0]=-1;
  dp[1]=0;
  dp[2]=abs(arr[2]-arr[1]);
  
  for(int i=3;i<=n;i++){
  	dp[i]=min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2]+abs(arr[i]-arr[i-2]));
  } 
  
  printf("%d\n",dp[n]);
  
  return 0; 
}

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

int main() {
  int A = 0, B = 0, C = 0, D = 0;
  cin >> A >> B >> C >> D;
  
  int start = 0, end = 0, count = 0;
  if (A >= C) start = C;
  else start  = A;
  if (B >= D) end = B;
  else end = D;
  
  vector<bool> alice(end);
  vector<bool> bob(end);
  
  for (int i = A; i < B; i++) alice[i] = true;
  for (int i = C; i < D; i++) bob[i] = true;
  
  for (int i = start; i < end; i++) {
    if (alice[i] and bob[i]) count++;
  }
  
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 256
def InputToInt():
    A = input().split()
    for i in range(len(A)):
        A[i] = int(A[i])
    return A
    
if __name__ == '__main__':
    N = int(input())
    A = InputToInt()
    c = A[0]+A[N-2]
    for i in range(N-2):
        c += min(A[i], A[i+1])
    print(c)




Measured memory_bytes: 3060
N,K = list(map(int,input().split()))
h = list(map(int,input().split()))
 
dp = [0]+[float('inf')]*(N-1)
for i in range(1,N):
    for j in range(max(0,i-K),i):
        dp[i] = min(dp[i],dp[j]+abs(h[i]-h[j]))
 
print(dp[-1])

Measured memory_bytes: 55648
import numpy as np
ans = 0
N, D = list(map(int, input().split()))
x = [np.array(list(map(int, input().split()))) for _ in range(N)]

for i in range(N):
    a = x[i]
    for b in x[i + 1 : N]:
        c = a - b
        d = np.linalg.norm(c)
        if d.is_integer():
            ans += 1
print(ans)

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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define FOR(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define FORR(i,a,b) for(ll (i)=(b)-1;(i)>=(a);(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/
int main() {
  int i;
  ll n,ans;
  vi p;
  cin >> n;
  REP(i,n){
		int x;
		cin >> x;
		p.push_back(x);
	}
  ans = 0;
  for(i=0;i<n-2;i++){
    if(p[i]<p[i+1] && p[i+1]<=p[i+2]||p[i]>=p[i+1] && p[i+1]>p[i+2]){
      ans = ans+1;
    }
  }
  cout << ans<< endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
int n;
vector<int>vi;
int check(vector<int>vec){
	ll sum = 0; int cnt = 0;
	rep(i,vec.size()){
		sum+=vec[i]-1;
		cnt+=vec[i]%2;
	}//cout<<sum<<cnt<<endl;
	if(sum%2 == 1) return 1;
	if(cnt >= 2) return 0;
	assert(cnt);//cout<<"N"<<endl;
	ll div = 0;
	rep(i,vec.size()){
		if(vec[i]%2==1) if(vec[i]>=3) vec[i]--; else return 0;
		div = __gcd(div,1LL*vec[i]);
	}
	rep(i,vec.size()) vec[i]/=div;
	return 1-check(vec);
}
int main(){
	cin>>n;
	rep(i,n){
		int a;cin>>a;vi.pb(a);
	}
	puts(check(vi)?"First":"Second");
}

Measured memory_bytes: 10104
//#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<list>
using namespace std;

#define INF 1000000007

int main(){
  long long n,m;
  cin >> n >> m;
  vector<long long> graph[3*n+1];
  long long u,v;
  for(int i=0;i<m;i++){
    cin >> u >> v;
    graph[u].push_back(v+n);
    graph[u+n].push_back(v+2*n);
    graph[u+2*n].push_back(v);
  }
  long long S,T;
  cin >> S >> T;
  long long num = 3*n+1;
  long long dist[num];
  for(int i=0;i<num;i++){
    dist[i] = INF;
  }
  priority_queue<pair<long long,long long>,vector<pair<long long,long long> >,greater<pair<long long,long long> > > q;
  q.push(make_pair(0,S));
  while(!q.empty()){
    pair<long long,long long> now = q.top();
    q.pop();
    if(dist[now.second] != INF) continue;
    dist[now.second] = now.first;
    for(int i=0;i<graph[now.second].size();i++){
      if(dist[graph[now.second][i]] == INF){
        q.push(make_pair(dist[now.second]+1,graph[now.second][i]));
      }
    }
  }
  if(dist[T] == INF) cout << -1 << endl;
  else cout << dist[T]/3 << endl;

  return 0;
}

Measured memory_bytes: 18944
#define rep(i,n) REP(i,0,n)
#define REP(i, a, b) for(int i = a; i < (int)(b); i++)
#include <bits/stdc++.h>

typedef long long ll;
using namespace std;


int main(void) {
   ll r;
   cin>>r;
   cout<<3*r*r<<endl;






   return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#pragma GCC optimize("unroll-loops")
//#pragma warning(disable : 4996)

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

#include <limits.h>
#include <math.h>
#include <time.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m - 1; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v, n) reverse(v, v + n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout << (x) << '\n'
#define pe(x) cout << (x) << " "
#define DEBUG(x) cout << #x << ": " << x << endl
#define lb(v, n) lower_bound(v.begin(), v.end(), (n))
#define ub(v, n) upper_bound(v.begin(), v.end(), (n))
#define int long long
#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i, v.size()) cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template <typename T1, typename T2> inline void chmin(T1& a, T2 b) {
	if (a > b) a = b;
}
template <typename T1, typename T2> inline void chmax(T1& a, T2 b) {
	if (a < b) a = b;
}
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef array<int, 3> arr3;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 998244353;
constexpr int MAX = 500050;
const double pi = acos(-1);
constexpr double EPS = 1e-8;
constexpr ll LINF = 1e18 + 1;
constexpr int INF = 1e9 + 1;



void solve() {
	int X, Y; cin >> X >> Y;
	REP(i, X + 1) {
		int j = X - i;
		if (i * 2 + j * 4 == Y) {
			print("Yes"); return;
		}
	}
	print("No");
}



signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//mt.seed((int)(time(0)));
	//REP(_, 10000)test();
	//int q;
	//cin >> q;
	//while (q--)
	solve();
}



Measured memory_bytes: 3660
//
// Created by iceleo on 2018/4/6.
//
#include <iostream>
#include <vector>
#include <map>
#include <numeric>

using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int> v;
    v.push_back(0);
    for(int i=1;i<=n;++i){
        int t;
        cin>>t;
        v.push_back(t);
    }
    v.push_back(0);
    int sum=0;
    for(int i=0;i<(int)v.size()-1;++i){
        sum+=abs(v[i]-v[i+1]);
    }
    //cout<<" "<<sum<<endl;
    for(int i=1;i<v.size()-1;++i){
        int d=sum-abs(v[i]-v[i-1])-abs(v[i+1]-v[i])+abs(v[i+1]-v[i-1]);
        cout<<d<<"\n";
    }
    return 0;
}


Measured memory_bytes: 1784
N = int(input())
di = []

for i in range(N):
    s, p = input().rstrip().split()
    di.append([s, -int(p), i+1])

di = sorted(di, key=lambda x:x[1])
di = sorted(di, key=lambda x:x[0])

for j in di:
    print(j[2])

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
using namespace std;
using ll = long long;

int main(){
        ll n,i,ans=0;
        string s;
        map<string, ll> m;
        cin >> n;
        for(i=0;i<n;++i){
                cin >> s;
                sort(s.begin(),s.end());
                ++m[s];
        }
        for(auto e : m) ans += e.second*(e.second-1)/2;
        cout << ans << endl;
        return 0;
}

Measured memory_bytes: 11380
#include <bits/stdc++.h>
using namespace std;
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;

vector<pair<int64, int>> factor(int64 n){
    vector<pair<int64, int>> vPN;
    for(int64 p=2; p*p<=n; ++p){
        if(n % p != 0){ continue; }
        
        int num=1; n/=p;
        while(n % p == 0){ ++num; n/=p; }
        vPN.push_back( make_pair(p, num) );
    }
    if(n != 1ll){ vPN.push_back( make_pair(n, 1) ); }
    return vPN;
}

int numDivs(int64 N){
    vector<pair<int64, int>> vPN = factor(N);
    
    uint divs=1;
    for(uint i=0; i<vPN.size(); ++i){
        divs *= (vPN[i].second + 1);
    }
    return divs;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    uint N; cin >> N;
    uint num=0;
    for(uint i=1; i<=N; i+=2){
        if(numDivs(i)==8){ ++num; }
    }
    cout << num << endl;
    
    return 0;
}


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

int main(){
  int a,b;
  cin >> a >> b;
  if (a < b){
    cout << "a < b" << endl;
  }
  else if (a > b){
    cout << "a > b" << endl;
  }
  else{
    cout << "a == b" << endl;
  }
}



Measured memory_bytes: 3088
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <functional>
#include <algorithm>
#include <cmath>
#include <iomanip>

using namespace std;

#define in(x) cin >> x
#define out(x) cout << x << endl

#define PI acos(-1)
#define pp push_back

#define Yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define No cout << "No" << endl
#define NO cout << "NO" << endl

#define vec2(type) vector<vector<type>>
#define vec3(type) vector<vector<vector<type>>>

#define For(i, n) for(int i = 0; i < n; i++)

#define Tcmp(X, Y) (abs(aryvec[i]->x) == X && abs(aryvec[i]->y) == Y)

template<typename T> void input(T *data, int n){
	For(i, n){
		cin >> data[i];
	}
}

template<typename T> void sort(vector<T> &ary){
	sort(ary.begin(), ary.end());
}

template<typename T> void rsort(vector<T> &ary){
	sort(ary.rbegin(), ary.rend());
}

void rstring(string &str){
	string temp = str;

	For(i, (int)str.size()){
		str[i] = temp[(str.size() - 1) - i];
	}
}

struct Vec{
	int x, y;
	Vec():
	x(0), y(0){}
};

int main(){

	int n;
	int h[20];

	in(n);
	input<int>(h, n);

	int count = 1;
	int maxH = h[0];

	for(int i = 1; i < n; i++){
		if(h[i] >= maxH){
			count++;
			maxH = h[i];
		}
	}

	out(count);

	return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define sqr(x) ((x)*(x))
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define ld long double
#define vi vector<int>
#define all(a) a.begin(),a.end()
#define HEAP(...) priority_queue<__VA_ARGS__ >
#define heap(...) priority_queue<__VA_ARGS__,vector<__VA_ARGS__ >,greater<__VA_ARGS__ > > 
#define pii pair<int,int> 
#define pb push_back
#define mp make_pair
#define debuge cerr<<"isok"<<endl
#define debug(x) cerr<<#x<<"="<<x<<endl
#define dprintf(...) fprintf(stderr,__VA_ARGS__)
#define SS second
#define FF first
#define ls (k<<1)
#define rs (k<<1|1)
#define clr(a,x) memset(a,x,sizeof(a))
#define cpy(a,x) memcpy(a,x,sizeof(a))
#define file(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout)
#define SZ(x) ((int)x.size())
using namespace std;
template<class T> inline void gmin(T &x,const T &y){x=x>y?y:x;}
template<class T> inline void gmax(T &x,const T &y){x=x<y?y:x;}
template<class T> inline bool Gmin(T &x,const T &y){return x>y?x=y,1:0;}
template<class T> inline bool Gmax(T &x,const T &y){return x<y?x=y,1:0;}
const int BufferSize=1<<16;
char buffer[BufferSize],*Bufferhead,*Buffertail;
bool Terminal;
inline char Getchar(){
	if(Bufferhead==Buffertail){
		int l=fread(buffer,1,BufferSize,stdin);
		if(!l){Terminal=1;return 0;}
		Buffertail=(Bufferhead=buffer)+l;
	}
	return *Bufferhead++;
}
template<class T>inline bool read(T &x){
	x=0;char c=Getchar(),rev=0;
	while(c<'0'||c>'9'){rev|=c=='-';c=Getchar();if(Terminal)return 0;}
	while(c>='0'&&c<='9') x=x*10+c-'0',c=Getchar();
	if(c=='.'){
		c=Getchar();double t=0.1;
		while(c>='0'&&c<='9') x=x+(c-'0')*t,c=Getchar(),t=t/10;
	}
	x=rev?-x:x;
	return 1;
}
template<class T1,class T2> inline bool read(T1 &x,T2 &y){return read(x)&read(y);}
template<class T1,class T2,class T3> inline bool read(T1 &x,T2 &y,T3 &z){return read(x)&read(y)&read(z);}
template<class T1,class T2,class T3,class T4> inline bool read(T1 &x,T2 &y,T3 &z,T4 &w){return read(x)&read(y)&read(z)&read(w);}
inline bool reads(char *x){
	char c=Getchar();
	while(c<33||c>126){c=Getchar();if(Terminal)return 0;}
	while(c>=33&&c<=126) (*x++)=c,c=Getchar();
	*x=0;return 1;
}
template<class T>inline void print(T x,const char c='\n'){
	if(!x){putchar('0');putchar(c);return;}
	if(x<0) putchar('-'),x=-x;
	int m=0,a[20];
	while(x) a[m++]=x%10,x/=10;
	while(m--) putchar(a[m]+'0');
	putchar(c);
}
//--------------------------------head---------------------------------------------

const int inf=0x3f3f3f3f;
const int N=200005,M=100005,mod=1e9+7;
template<class T,class S> inline void ch(T &x,const S y){x=(x+y)%mod;}
inline int exp(int x,int y,const int mod=::mod){
	int ans=1;
	while(y){
		if(y&1) ans=(ll)ans*x%mod;
		x=(ll)x*x%mod;y>>=1;
	}return ans;
}

ll n;

int main(){
#ifdef rqgao2014
	assert(freopen("input.txt","r",stdin));
#endif
	scanf("%lld",&n);
	ll t=n,d=0,isok=1;
	while(t>=10){
		if(t%10!=9) isok=0;
		t/=10,d++;
	}
		
	ll ans=t-1+d*9+isok;
	cout<<ans<<endl;
	return 0;
}

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

int main(){
    int a=0, b=0;
    scanf("%d %d",&a, &b);
    
    
    if ( a >= b && a-b > 1){

      printf(":(\n");
    }
    else if( b > a && b-a > 1){
      printf(":(\n");

    }
    else{printf("Yay!\n");}


return 0;}

Measured memory_bytes: 128
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn mat_chars(&mut self, row: usize) -> Vec<Vec<char>> {
        (0..row).map(|_| self.chars()).collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let N: usize = sc.get();
    let mut s = vec![false; N];
    let ss = sc.chars();
    for i in 0..N {
        s[i] = ss[i] == 'o';
    }
    for &t0 in &[false, true] {
        for &t1 in &[false, true] {
            let mut t = vec![false; N];
            t[0] = t0;
            t[1] = t1;
            for i in 2..N {
                t[i] = t[i-2] ^ t[i-1] ^ s[i-1];
            }
            if t[0] == t[N-2] ^ t[N-1] ^ s[N-1] && t[1] == t[N-1] ^ t[0] ^ s[0] {
                for &ti in &t {
                    print!("{}", if ti { 'S' } else { 'W' });
                }
                println!();
                return;
            }
        }
    }
    println!("-1");
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef int int__;
#define int long long
#define pb push_back
#define pi pair<int,int>
#define vpi vector<pi>
#define vi vector<int>
#define vvi vector<vi>
#define fi first
#define se second
#define forn(i, n)for(int i=0;i<int__(n);i++) 
#define sz(a)int__(a.size())
template <class A, class B> ostream& operator << (ostream& out, const pair<A, B> &a){return out << "(" << a.first << ", " << a.second << ")";}
template<class A>ostream& operator<<(ostream& out,const vector<A>&v){out<<"[";forn(i,sz(v)){if(i)out<<", ";out<<v[i];}return out<<"]";}
const int MAX = 1e9 + 100;
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
int Mod(int x){const int mm=1e9 + 7;x%=mm;if(x<0)x+=mm;return x;}
int Pow(int x,int n){if(n==0)return 1;int t=Pow(x,n/2);t=Mod(t*t);if(n&1)t=Mod(t*x);return t;}
#define watch(x) cout << #x << " : " << x << endl;
int gcd(int a,int b){if(b==0)return a;return gcd(b,a%b);}

double dp[305][305][305]={0};

int__ main() {
	fast;
	int n,k; cin >> n >> k;

	int dp[k+1] = {0};
	int a[n];
	for(int i=0;i<n;i++) cin >> a[i];

	dp[0] = 0;

	for(int i=1;i<=k;i++) {
		int ok = 0;
		for(int j=0;j<n;j++) {
			if(i - a[j] >= 0) {
				if(dp[i-a[j]] == 0) {
					ok = 1;
				}
			}
		}
		if(ok) dp[i] = 1;	
	}

	if(dp[k]) cout << "First" ; else cout << "Second";
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijoMOD(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=yakusu[i];
  }
  return num;
}

int H,W;
vs s(50);
vi dv ={-1,0,1,0};vi du={0,-1,0,1};
int cnt=1;
int dfs(int u,int v){
  s[u][v]='.';
  
  rep(i,4){
   
      int nu =u +du[i],nv=v+dv[i];
      if(nu<0||nu>=H||nv<0||nv>=W)continue;
      if(s[nu][nv]=='.')continue;
      cnt ++;
      dfs(nu,nv);
    
  }
  return cnt;

}
int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}

//vc alp ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//vc Alp ={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
//cout<<""<<endl;
int main(){
 int N,M;
  cin>>N>>M;
  vs A(N),B(M);
  rep(i,N)cin>>A[i];
  rep(i,M)cin>>B[i];
  bool ans=false;
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){//Aの始点を決める。
      bool ok=true;
      for(int k=0;k<M;k++){//Bが一致するか。
        for(int l=0;l<M;l++){
          if(i+k>=N||j+l>=N){
            ok=false;
            continue;
          }
          if(A[i+k][j+l]!=B[k][l]){
            ok=false;
            break;
          }
        } 
      }
      if(ok){
        ans =true;
        break;
      }
    }
  }
  if(ans)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  
}   





Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll	    long long
#define vi      vector <ll>
#define vii     vector <pair<int,int>>
#define ii      pair<int,int>
#define loop(n)	for(int i=0;i<n;i++)
#define pb      push_back
const ll mod=1e9+7;
void fast();
vector<int>inc(20,1);
int grid[20][200005]={};
int curBit,y;
int b_s(int beg,int end){
    if(beg>end)
        return 0;
    int mid=(beg+end)/2;
    if(grid[curBit][mid]<=inc[curBit]){
        y=max(y,mid);
        return b_s(mid+1,end);
    }
    else return b_s(beg,mid-1);
}
int main()
{
    fast();
    int n;
    cin>>n;
    int a[n];
    loop(n){
        cin>>a[i];
        for(int j=0;j<20;j++){
            if(a[i]&(1<<j))
                grid[j][i]++;
        }
    }
    for(int j=0;j<20;j++){
        for(int i=1;i<n;i++){
            grid[j][i]+=grid[j][i-1];
        }
    }
    ll res=0;
    for(int i=0;i<n;i++){
        int mx=n+1;
        for(int j=0;j<20;j++){
            curBit=j;
            y=i;
            b_s(i,n-1);
            mx=min(mx,y);
            inc[j]=grid[j][i]+1;
        }
        res+=mx-i+1;
    }
    cout<<res;
}
void fast(){
std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
/*

*/


Measured memory_bytes: 16640
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <memory.h>
#include <cassert>
#include <iomanip>

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;


int main() {
	for (double a; cin >> a; ) {
		double sum = a;
		double p = a;
		rep(i, 9) {
			if (!(i & 1)) p *= 2;
			else p /= 3;
			sum += p;
		}
		cout << setprecision(10) << sum << endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
use std::io;
use std::collections::HashSet;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let v:Vec<i32> = procon_read();
	let n = v[0];
	let mut d:Vec<i32> = Vec::new();
	for i in 0..n {
		let v:Vec<i32> = procon_read();
		d.push(v[0]);
	}
	d.sort();
	let mut set = HashSet::new();
	for i in d {
		set.insert(i);
	}
	println!("{}", set.len());
}

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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = 1e18;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
//#define mp make_pair



int main() {
  int n;
  cin >> n;
  int a, b;
  cin >> a >> b;
  vi p(n);
  int n1 = 0, n2 = 0, n3 = 0;
  rep (i, n) {
    cin >> p[i];
    if (p[i] <= a) {
      n1++;
    }
    else if (p[i] >= b + 1) {
      n3++;
    }
    else {
      n2++;
    }
  }
  cout << min({n1, n2, n3}) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long n,ans;
  cin>>n;
  vector<long> vec(n);
  vector<long> veca(n);
  for(long i=0; i<n; i++){
    cin>>vec.at(i);
    cin>>veca.at(i);
  }
  sort(vec.begin(),vec.end());
  sort(veca.begin(),veca.end());
  if(n%2==0){
    ans=veca.at(n/2)+veca.at(n/2-1)-vec.at(n/2)-vec.at(n/2-1)+1;
  }
  else{
    ans=veca.at((n-1)/2)-vec.at((n-1)/2)+1;
  }
  cout<<ans;
}

Measured memory_bytes: 6372
#include<stdio.h>

int main(void){
    int r,d,x;
    scanf("%d",&r);
    scanf("%d",&d);
    scanf("%d",&x);

    for(int i=0;i<10;i++)
    {
        printf("%d\n",r*x-d);
        x=r*x-d;
    }



    return 0;}

Measured memory_bytes: 128
import java.math.BigInteger;
import java.util.*;

class Main {
	Scanner sc = new Scanner(System.in);

	public void run() {
		double X=0,Y=0,t=90;
		while(true){
			String str=sc.next();
			String[] s=str.split(",");
			int r=Integer.parseInt(s[0]);
			int th=Integer.parseInt(s[1]);
			if(r==0 && th==0){
				break;
			}
			X+=r*Math.cos(t*Math.PI/180);
			Y+=r*Math.sin(t*Math.PI/180);
			t-=th;
		}
		ln((int)X);ln((int)Y);
	}

	public static String join(double[] array, String separator) {
		StringBuilder str = new StringBuilder(array[0] + "");
		for (int i = 1; i < array.length; i++) {
			str.append(separator).append(array[i] + "");
		}
		return str.toString();
	}

	public static void main(String[] args) {
		new Main().run();
	}

	public static void pr(Object o) {
		System.out.print(o);
	}

	public static void ln(Object o) {
		System.out.println(o);
	}

	public static void ln() {
		System.out.println();
	}
}

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

int main(){
        int e;
        while(cin >> e && e > 0){
                unsigned int m = e;
                for(int z=0;z*z*z<=e;z++){
                        for(int y=0;y*y+z*z*z<=e;y++){
                                int x = e - y * y - z * z * z;
                                if(x >= 0){
                                        unsigned int sum = x + y + z;
                                        m = min(m,sum);
                                }
                        }
                }
                cout << m << endl;
        }
}

Measured memory_bytes: 1156
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000001
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
	int N,M,S,T;
	int vis[101010];
	template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

	void dikstra(int s, vector<vector<pair<int, int>>> &E, VI &D) {

		REP(i, N)D[i] = LLINF;
		REP(i, N) vis[i] = 0;

		min_priority_queue<pair<int, int>> que;

		D[s] = 0;
		que.push({ 0,s });

		while (!que.empty()) {
			auto q = que.top();
			que.pop();

			int cst = q.first;
			int cu = q.second;

			if (vis[cu])continue;
			vis[cu] = 1;

			fore(p, E[cu]) {
				int cst2 = cst + p.second;
				int to = p.first;

				if (chmin(D[to], cst2)) que.push({ D[to], to });
			}

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


	cin >> N>>M>>S>>T;
	S--;
	T--;

	vector<vector<pair<int, int>>> c(N), d(N);

	VI da(N), db(N);

	REP(i, M) {
		int u, v, a, b;
		cin >> u >> v >> a >> b;
		u--;
		v--;

		c[u].push_back({ v,a });
		c[v].push_back({ u,a });
		d[u].push_back({ v,b });
		d[v].push_back({ u,b });
	}

	dikstra(S, c, da);
	dikstra(T, d, db);

	VI ans(N);

	REP(i, N)ans[i] = da[i] + db[i];

	for (int i = N - 2; i >= 0; i--) {
		ans[i] = min(ans[i], ans[i + 1]);
	}
	REP(i, N) {
		cout << 1000000000000000 - ans[i] << endl;
	}
	return 0;
}



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

bool isPrime(unsigned int n);

int main(void){
  int n;
  while(cin>>n && n){
    unsigned int count=0;
    if(n==4) count=1;
    for(unsigned int i=3;i<=n/2;i+=2) if(isPrime(i) && isPrime(n-i)) count++;
    cout<<count<<endl;
  }
}

bool isPrime(unsigned int n){
  for(unsigned int i=3;i*i<=n;i+=2) if(n%i==0) return false;
  return true;
}

Measured memory_bytes: 864