akhauriyash/Code-Regression huggingface dataset:
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
#include <iomanip>
#include <set>

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printim(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0
#define addf(T) [](T a, T b){return (a + b);}
#define minf(T) [](T a, T b){return min(a, b);}
#define maxf(T) [](T a, T b){return max(a, b);}


using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const long double PI = acos(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

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

ll lcm(ll number1, ll number2) {
	return number1 / gcd(number1, number2) * number2;
}

ll LSB(ll n) { return (n & (-n)); }

/*-----------------------------------------ここからコード-----------------------------------------*/


int main() {

	int n;
	scanf("%d", &n);
	vector<ll> a(n), b(n);
	rep(i, n)scanf("%lld%lld", &a[i], &b[i]);
	ll ans = 0;
	reprm(i, n) ans += (b[i] - ((a[i] + ans) % b[i])) % b[i];
	printf("%lld\n", ans);
	
	Please AC;
}


Measured memory_bytes: 2424
#include <stdio.h>

int main(void)
{
  int N,D;

  scanf("%d %d",&N,&D);

if(N%(2*D+1)==0)
{
  printf("%d",N/(2*D+1));
}
else
{
  printf("%d",N/(2*D+1)+1);
}
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <sstream>
#include <set>
#include <queue>
#include <stack>
#include <cctype>
#include <map>
#include <climits>
#include <bitset>
using namespace std;
#define MATH_PI 3.14159265358979323846
int main(){
	string sInput;
	cin >> sInput;
	if (sInput[0] == '9' || sInput[1]=='9')
		cout << "Yes\n";
	else
		cout << "No\n";
	//system("pause > nul");
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <vector>
#include <list>

using namespace std;



int main() {
	long long int n, k;
	cin >> n >> k;
	long long int r = n / k;
	n -= r * k;
	long long int del = abs(n - k);
	if (n >= del)cout << del << endl;
	else cout << n << endl;


	return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
A = list(map(int, input().split()))

dp = [False] * (K + 1)
for i in range(1, K + 1):
    # print (dp)
    for a in A:
        if i - a < 0:
            break
        if dp[i - a] == False:
            dp[i] = True
            break

# print (dp)
if dp[-1]:
    print ('First')
else:
    print ('Second')

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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define popb pop_back()
#define sz size()
#define y1 dfsdsfsdfsd
#define next fdsfsdfjkl
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;
typedef unsigned long long ull;
double pi = acos(-1.0);
const int inf = 1e9+7;
const ll INF = 1e18+7;
/////////////////////////////////////////



int n;

vector< pair<int, pair<int,int> > > vi;
int main(){speed;
    cin>>n;

    for(int i=1;i<=n;i++)
    {
        int x,y,h;

        cin>>x>>y>>h;

        vi.pb(mp(h,mp(x,y)));
    }

    for(int i=0;i<=100;i++)
    {
        for(int j=0;j<=100;j++)
        {

            set<int> s;
            for(int k=0;k<vi.sz;k++)
            {
                int h = vi[k].fi;
                int x = vi[k].se.fi;
                int y = vi[k].se.se;

                if(h==0) continue;

                int ans = h + abs(x-i) + abs(y-j);


                s.insert(ans);
            }
            set<int> neww;
            if(s.sz==1)
            {

                if(*s.begin()<1) continue;

                int q = *s.begin();

                int ok = 0;
                for(int k=0;k<vi.sz;k++)
                {
                    int h = vi[k].fi;
                    int x = vi[k].se.fi;
                    int y = vi[k].se.se;

                    int ans = max(q - abs(x-i) - abs(y-j),0);

                    if(ans!=h) ok = 1;
                }

                if(!ok)
                {
                    cout<<i<<" "<<j<<" "<<q<<endl;
                    return 0;
                }
            }
        }
    }

    for(int i=0;i<=100;i++)
    {
        for(int j=0;j<=100;j++)
        {
            for(int h=1;h<=300;h++)
            {
                set<int> s;

                for(int k=0;k<vi.sz;k++)
                {
                    int h = vi[k].fi;
                    int x = vi[k].se.fi;
                    int y = vi[k].se.se;


                    int ans = max(h - abs(i-x) - abs(j-y),0);

                    s.insert(ans);
                }

                if(s.sz==1)
                {
                    cout<<i<<" "<<j<<" "<<h;
                    return 0;
                }
            }

        }
    }
}


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

int main(void){
   long long N,P;
   cin>>N>>P;
   vector<pair<long long,long long>> result;
   for(long long i=2;i*i<=P;i++){
      if(P%i!=0) continue;
      long long ex=0;
      while(P%i==0){
         ex++;
         P=P/i;
      }
      result.push_back({i,ex});
   }
   if(P!=1) result.push_back({P,1});
   /*for(auto c:result){
      cout<<c.first<<" "<<c.second<<endl;
   }*/
   long long ans=1;
   for(auto c:result){
      if(c.second>=N) ans*=(long long)pow(c.first,c.second/N);
   }
   cout<<ans<<endl;
   return 0;
}


Measured memory_bytes: 3996
import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        int N = in.i();
        int M = in.i() * 2;
        boolean[] b = new boolean[N + 1];
        int c = 0;
        for (int i = 0; i < M; i++) {
            int a = in.i();
            if ((b[a] = !b[a])) c++;
            else c--;
        }
        out.println(c == 0 ? "YES" : "NO");
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[8192];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    int i() {
        char c = next();
        boolean minus = c == '-';
        int n = minus ? 0 : c - '0';
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }
}


Measured memory_bytes: 35496
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef pair<ll, ll> P;

int main(){
    int a, b, k;    cin >> a >> b >> k;
    set<int> s;
    if(k<b-a+1){
        for(int i=a; i<a+k; i++)
            s.insert(i);
        
        for(int i=b-k+1; i<=b; i++)
            s.insert(i);
        for(auto x: s)
            cout << x << endl;
        
    }else{
        for(int i=a; i<=b; i++)
            cout << i << endl;
    }
        
    

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 1e9+7;

int main(void) {

    string S; cin>>S;
    ll K; cin>>K;
    ll Slen = S.size();
    char check = '1';
    for (ll i = 0; i < min(Slen,K); ++i) {
        if(S[i] != '1'){
            check = S[i];
            break;
        }
    }
    cout<<check<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  int n;
  cin>>n;int r=0;
  for(int i=0;i<=n;i++)
  {
    int t=i,c=0;
    while(t!=0)
    {
      t=t/10;
      c++;
    }
    if(c%2==1)
      r++;
  }
  cout<<r;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
int main()
{
	SPEED
	int n, count = 0;
	cin >> n;
	int arr[n];
	for (int i = 0; i < n; ++i)
	{
		cin >> arr[i];
	}
	sort(arr, arr+n);
	for (int i = 0; i < n; ++i)
	{
		for (int j = i + 1; j < n; ++j)
		{
			//bool next_j = false;
			for (int k = j + 1; k < n; ++k)
			{
				if (arr[i] + arr[j] > arr[k])
				{
					count++;
				}
				else
				{
					//next_j = true;
					break;
				}
			}
			/*if (next_j)
			{
				continue;
			}*/
		}
	}
	cout << count;
	return 0;
}

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

public class MainClass
{
	public const long Giri = 1000000007;

	public static void Main(string[] args)
	{
		var s = Console.ReadLine().ToLong();
		
		const long height = (long)1e+9;
		
		if(s <= height)
		{
			Console.WriteLine("0 0 {0} 0 {0} 1", s);
			return;
		}
		
		long x = (height - s % height) % height;
		long y = (s + x) / height;
		Console.WriteLine("0 0 {0} 1 {1} {2}", height, x, y);
		
	}
	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(' '); }
	public static int Clamp(int val, int max, int min = 0) { return Math.Min(max, Math.Max(min, val)); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt();
		return r;
	 }
}


Measured memory_bytes: 13268
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<stdio.h>
#include<vector>
using namespace std;
#define int long long
#define rep(s,i,n) for(int i=s;i<n;i++)
#define c(n) cout<<n<<endl;
#define ic(n) int n;cin>>n;
#define sc(s) string s;cin>>s;
#define mod 1000000007
#define inf 1000000000000000007
#define f first
#define s second
#define mini(c,a,b) *min_element(c+a,c+b)
#define maxi(c,a,b) *max_element(c+a,c+b)
//printf("%.12Lf\n",c);
int keta(int x){
	rep(0,i,30){
		if(x<10){
			return i+1;
		}
		x=x/10;
	}
}
int gcd(int x,int y){
	int aa=x,bb=y;
	rep(0,i,1000){
		aa=aa%bb;
		if(aa==0){
			return bb;
		}	
		bb=bb%aa;
		if(bb==0){
			return aa;
		}
	}
}	
int lcm(int x,int y){
	int aa=x,bb=y;
	rep(0,i,1000){
		aa=aa%bb;
		if(aa==0){
			return x/bb*y;
		}	
		bb=bb%aa;
		if(bb==0){
			return x/aa*y;
		}
	}
}
bool p(int x){
	if(x==1)return false;
	rep(2,i,sqrt(x)+1){
		if(x%i==0&&x!=i){
			return false;
		}
	}	
	return true;
}
int max(int a,int b){
	if(a>=b)return a;
	else return b;
}
int min(int a,int b){
	if(a>=b)return b;
	else return a;
}	
int n2[41];		
int nis[41]; 
int nia[41];
int mody[41];
int nn;
int com(int n,int y){
	int ni=1;
	for(int i=0;i<41;i++){
		n2[i]=ni;
		ni*=2;
	}
	int bunsi=1,bunbo=1;
	rep(0,i,y)bunsi=(bunsi*(n-i))%mod;
	rep(0,i,y)bunbo=(bunbo*(i+1))%mod;
	mody[0]=bunbo;
	rep(1,i,41){
		bunbo=(bunbo*bunbo)%mod;
		mody[i]=bunbo;
	}
	rep(0,i,41)nis[i]=0;
	nn=mod-2;
	for(int i=40;i>=0;i-=1){
		if(nn>n2[i]){
			nis[i]++;
			nn-=n2[i];
		}
	}
	nis[0]++;
	rep(0,i,41){
		if(nis[i]==1){
			bunsi=(bunsi*mody[i])%mod;
		}
	}
	return bunsi;
}
int yakuwa(int n){
	int sum=0;
	rep(1,i,sqrt(n+1)){
		if(n%i==0)sum+=i+n/i;
		if(i*i==n)sum-=i;
	}
	return sum;
}	
bool hei(int n){
	rep(0,i,100){
		if(i*i==n){
			return true;
		}
	}
	return false;
}
int pow(int b,int a){
	int aa=1;
	rep(0,i,a)aa*=b;	
	return aa;
}		
int a[114514],b[114514];
int x[114514],y[114514],c[114514];
signed main(){
	ic(n)
	rep(0,i,n){
		cin>>x[i];
		cin>>y[i];
		cin>>c[i];
	}
	int sum=0;
	rep(0,i,101){
		rep(0,j,101){
			int h=0;
			rep(0,k,n){
				if(c[k]!=0){
					h=abs(i-x[k])+abs(j-y[k])+c[k];
				}
			}	
			rep(0,k,n){
				if(c[k]==0){
					if(h<=abs(i-x[k])+abs(j-y[k])){
						sum++;
					}	
				}	
				else{
					if(abs(i-x[k])+abs(j-y[k])+c[k]==h)sum++;
				}	
			}
			if(sum==n){
				cout<<i<<" "<<j<<" "<<h;
				return 0;
			}
			sum=0;
		}
	}	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=mod*mod*3LL;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n, k;
    cin >> n >> k;
    vector<vector<mint> > dp(n+1, vector<mint> (k+1, 0));
    for(int i=0;i<=k;i++)dp[0][i] = 1;
    for(ll i=1;i<=n;i++){
    	for(ll j=1;j<=k;j++){
    		dp[i][j] = dp[i][j-1] + ((i>=j)?dp[i-j][j]:0LL);
    	}
    }
    cout << ((n>=k)?dp[n - k][k]: 0LL) << endl;
    return 0;
}



Measured memory_bytes: 10620
import math
ans = 0
count = 0
N,D = map(int,input().split())

xy = [map(int, input().split()) for i in range(N)]
x, y = [list(j) for j in zip(*xy)]

for k in range(N):
    ans = math.sqrt(x[k]**2 + y[k]**2)
    if ans <= D:
        count += 1
print(count)

Measured memory_bytes: 146644
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
typedef pair<int,int> pii;
typedef pair <long long,long long> pll;
typedef long long ll; 
typedef long double ld; 
const ll mod = 1e9+7;
int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL); 
    int n,w; cin >> n >> w;
    int maxVal = n*1000;
    vector < vector <ll> > item(n+1, vector <ll> (2,0)), dp(n+1,vector <ll> (maxVal+1,mod));
    for(int i = 1; i<=n; i++)
		cin>>item[i][0]>>item[i][1];
	dp[1][0] = 0;	
	dp[1][item[1][1]] = item[1][0];
	for(int i = 2; i <= n ; i++)
	{	for(int j = 0; j <= maxVal; j++ )
		{	dp[i][j] = dp[i-1][j];
			if(item[i][1] <= j)
				dp[i][j] = min(dp[i][j], dp[i-1][j-item[i][1]] + item[i][0]);
		}
	}
	int ans = INT_MIN;
	for(int x = 0; x <= maxVal ; x++)
	{	if(dp[n][x] <= w)
			ans = max(ans, x);
	}	
	cout<<ans ;
    return 0;
}

Measured memory_bytes: 80256
#include <iostream>
#include <cstdio>

using namespace std;

int main() {
    long long n;
    cin >> n;
    int sum = 0;
    long long tmp = n;
    while(tmp!=0) {
        sum += tmp%10;
        tmp /= 10;
    }
    if(n%sum == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


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

using namespace std;

int main(){
	int n,m,a[1000];
	int i,j,sum,max;
	
	while(scanf("%d %d",&n,&m)){
		if(n==0&&m==0)
		break;
		for(i=0;i<n;i++){
			scanf("%d",&a[i]);
		}
		max=0;
		for(i=0;i<n;i++){
			for(j=i+1;j<n;j++){
				sum=a[i]+a[j];
				if(sum>max&&sum<=m)
				max=sum;
			}
		}
		if(max==0)
		printf("NONE\n");
		else
		printf("%d\n",max);
	}
}

Measured memory_bytes: 3212
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <cmath>
#include <numeric>
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <list>
#include <unordered_map>
#include <tuple>
#include <complex>


#define FOR(i, a, b)		for(int i = (int)(a); i < (int)(b); ++i)
#define FORE(i, a, b)		for(int i = (int)(a); i <= (int)(b); ++i)
#define REP(i, n)			FOR(i, 0, n)
#define REPE(i, n)			FORE(i, 0, n)
#define ALL(x)				(x).begin(),(x).end()
#define DEBUG_DC(x)			cout << #x << ": " << x << endl
#define VEC_TYPE			int
#define INF					1e5+1

using namespace std;
typedef long long ll;
typedef vector<VEC_TYPE> vdef;
typedef vector<vdef> vvdef;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmaxE(T& a, T b) { if (a <= b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> inline bool chminE(T& a, T b) { if (a >= b) { a = b; return 1; } return 0; }
template<typename T> inline T mygcd(T a, T b) { return b ? mygcd(b, a%b) : a; }
template<typename T> inline T mylcm(T a, T b) { return a * b / mygcd(a, b); }

int main()
{
	int n;
	cin >> n;
	vdef d(n, 0);
	for (int i = 0; i < n; ++i) cin >> d[i];

	sort(ALL(d));
	int ans = 0;
	int sp = n / 2;
	int l = d[sp - 1];
	int r = d[sp];

	ans = r - l;

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

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf 1000000000000000
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;

#define MAXN 1000005

ll spf[MAXN];

void sieve() 
{ 
    spf[1] = 1; 
    for (ll i=2; i<MAXN; i++) 
  
        // marking smallest prime factor for every 
        // number to be itself. 
        spf[i] = i; 
  
    // separately marking spf for every even 
    // number as 2 
    for (ll i=4; i<MAXN; i+=2) 
        spf[i] = 2; 
  
    for (ll i=3; i*i<MAXN; i++) 
    { 
        // checking if i is prime 
        if (spf[i] == i) 
        { 
            // marking SPF for all numbers divisible by i 
            for (ll j=i*i; j<MAXN; j+=i) 
  
                // marking spf[j] if it is not  
                // previously marked 
                if (spf[j]==j) 
                    spf[j] = i; 
        } 
    } 
} 

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

int main()
{
   FAST/**/
   sieve();
   ll n;
   cin>>n;
   
   ll arr[n];
   rep(n)
        cin>>arr[i];    
   
   map<ll,ll> ma;
   rep(n)
   {
       ll temp = arr[i];
       map<ll,ll> ma1;
       while(temp>1)
       {
           ma1[spf[temp]]++;
           temp/=spf[temp];
       }
       
       autoit(ma1,it)
            ma[it->ff] = max(ma[it->ff], it->ss);
   }
   
   ll lc = 1;
   autoit(ma,it)
       lc*=powa(it->ff,it->ss,mod), lc%=mod;
   
   ll sum = 0;
   rep(n)   
        sum+=powa(arr[i],mod-2,mod), sum%=mod;
   sum*=lc, sum%=mod;
   cout<<sum;
   
   return 0;        
}  
   

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

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

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

    put(a[a.size()-1] - a[0]);
}

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

using namespace std;

typedef pair<int, int> P_ii;
typedef pair<string, int> P_si;
typedef long long int ll;

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

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

const int MOD = 1000000007;
const ll MAX = 100010;

struct Edge {
    /* Parameters     *
     * (int) to : 辺の行き先
     * (int) weight : 辺の重み
    */

    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w) {}
};

ll x(ll a) {
    if (a % 4 == 0) return a;
    if (a % 4 == 1) return 1;
    if (a % 4 == 2) return a + 1;
    return 0;
}

int main() {
    ll A, B;
    cin >> A >> B;

    cout << (x(A-1) ^ x(B)) << endl;
    return 0;
}



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

#define ALL(container) (container).begin(), (container).end()

typedef long long int ll;

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

using namespace std;

int main()
{
    string s;
    cin >> s;
    bool b = false;
    for (int i = 1; i < s.size(); i++) {
        if (s[i] == s[i-1]) {
            b = true;
            break;
        }
    }

    if (b) {
        cout << "Bad" << endl;
    } else {
        cout << "Good" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxN = 100010;
vector<int> path;
vector<int> e[maxN];
ll a[maxN], ans[maxN];

void dfs(int pre, int cur)
{
    path.push_back(cur);
    for (auto to : e[cur])
    {
        if (to == pre) continue;
        dfs(cur, to);
    }
}
int main()
{
    int n;
    scanf("%d", &n);
    for (int i = 1; i < n; i++)
    {
        int u, v;
        scanf("%d %d", &u, &v);
        e[u].push_back(v);
        e[v].push_back(u);
    }
    dfs(0, 1);
    for (int i = 1; i <= n; i++)
        scanf("%lld", &a[i]);
    sort(a + 1, a + n + 1);
    int cur = 0;
    ll sum = 0;
    for (int i = n; i >= 1; i--)
    {
        ans[path[cur++]] = a[i];
        sum += a[i];
    }
    printf("%lld\n", sum - a[n]);
    for (int i = 1; i <= n; i++)
    {
        printf("%lld", ans[i]);
        if (i == n) puts("");
        else printf(" ");
    }
    return 0;
}


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

#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) rep2(i, 0, n)
#define all(a) a.begin(), a.end()
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using mii = map<int, int>;
using msi = map<string, int>;
using pii = pair<int, int>;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << std::fixed << std::setprecision(10);

    int n, k;
    cin >> n >> k;
    vi a(n);
    rep(i, n) cin >> a[i];

    ll ans = -2e18;
    vi f;
    for(int i = 0; i <= k && i <= n; ++i) {
        if(i != 0) f.push_back(a[i - 1]);
        vi t = f;
        for(int j = 0; j <= k - i && j <= n - i; ++j) {
            if(j != 0) t.push_back(a[n - j]);
            int l = k - i - j;
            sort(all(t));
            int poi = 0;
            ll temp = 0;
            for(auto p : t) {
                if(poi < l && p < 0) poi++;
                else temp += p;
            }
            ans = max(temp,ans);
        }
    }
    cout << ans << endl;

    return 0;
}

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

char A[300][300];
int ans[300][300];
int par[300];

int root(int x){
	if(x == par[x]) return x;
	return par[x] = root(par[x]); 
}

void join(int x, int y){ // x -> y
	int r_x = root(x), r_y = root(y);
	if(r_x == r_y){
		return;
	}
	par[r_x] = r_y;
}

int32_t main(){
	for(int i = 0; i < 300; i++){
		par[i] = i;
	}
	int h, w, k;
	cin >> h >> w >> k;
	for(int i = 0; i < h; i++){
		cin >> A[i];
	}
	int _min = 300, _max = -1;
	for(int i = 0; i < h; i++){
		bool Ex = false;
		for(int j = 0; j < w; j++){
			if(A[i][j] == '#'){
				Ex = true;
			}
		}
		if(Ex){
			_min = min(_min, i);
			_max = max(_max, i);
		}
	}
	int cnt = 1;
	for(int i = 0; i < h; i++){
		vector<int> isValue;
		for(int j = 0; j < w; j++){
			if(A[i][j] == '#')
				isValue.push_back(j);
		}
		if(isValue.size() == 0){
			if(i > _max){
				par[i] = _max;
			}else{
				par[i] = i + 1;
			}
		}else{
			sort(isValue.begin(), isValue.end());
			for(int j = 0; j < w; j++){
				if(A[i][j] == '#'){
					ans[i][j] = cnt++;
				}else if(j < isValue.front()){

					ans[i][j] = cnt;
				}else{
					ans[i][j] = cnt - 1;
				}
			}
		}
	}
	for(int i = 0; i < h; i++){
		int Root = root(i);
		if(Root != i){
			for(int j = 0; j < w; j++){
				ans[i][j] = ans[Root][j];
			}
		}
	}
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			cout << ans[i][j] << ' ';
		}
		cout << endl;
	}
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const int MOD=1e9+7;
const int INF=2e9;
const double PI=acos(-1);


int main() {
    ios_base::sync_with_stdio(false);

    ll n,k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i,n) {
        cin >> a[i];
        --a[i];
    }
    vector<ll> visited(n,-1);
    ll s=0,cnt=0;
    while (visited[s]==-1) {
        visited[s]=cnt;
        s=a[s];
        ++cnt;
    }
    if (k>=cnt) {
        ll c=cnt-visited[s];
        k=(k-visited[s])%c;
        rep(i,n) {
            if (visited[i]==visited[s]+k) {
                cout << i+1 << endl;
                break;
            }
        }
    } else {
        rep(i,n) {
            if (visited[i]==k) {
                cout << i+1 << endl;
                break;
            }
        } 
    }
    
    
    
    
    return 0;   
}

Measured memory_bytes: 6376
#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long n, k;
  cin >> n >> k;
  vector<bool> hasSweet(n);
  for (long i = 0; i < k; i++) {
    long d;
    cin >> d;
    for (long j = 0; j < d; j++) {
      long a;
      cin >> a;
      hasSweet[a - 1] = true;
    }
  }
  long total = 0;
  for (long i = 0; i < n; i++) {
    if (hasSweet[i]) {
      total++;
    }
  }
  cout << n - total << endl;
  return 0;
}


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

using namespace std;

void solve(int R, int G, int B, int N) {
  int ans = 0;
  rep(r, floor(N / R))
    rep(g, floor((N - r * R) / G))
    if ((N - r * R - g * G) % B == 0)
      ans++;
  cout << ans <<endl;
}

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

  int R, G, B, N;
  cin >> R >> G >> B >> N;
  solve(R, G, B, N);
  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(200000)
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def fi(): return float(input())
def mfi(): return map(float, input().rstrip().split())
def lmfi(): return list(map(float, input().rstrip().split()))
def li(): return list(input().rstrip())
def debug(*args, sep=" ", end="\n"): print("debug:", *args, file=sys.stderr, sep=sep, end=end) if not __debug__ else None
def exit(*arg): print(*arg); sys.exit()
# template


def main():
    m1, d1 = mi()
    m2, d2 = mi()
    if(m1 != m2):
        print(1)
    else:
        print(0)
    return


if __name__ == '__main__':
    main()


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

#define REP(i, n)       REPEAT(i, 0, n)
#define REPEAT(i, k, n) for (int i = (k); i < (n); ++i)

int main(){
    int a,b,c;
    while(cin >> a>>b>>c){
        int n = 0;
        REPEAT(i,1,11){
            if(i==a || i == b || i == c || a + b + i > 20) continue;
            n++;
        }
        if(n >= 4){ // >=7*0.5
             cout << "YES" << endl;
        } else {
             cout << "NO" << endl;
        }
    }
    return 0;
}

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

using namespace std;
using ll = long long;

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

  ll a, b;
  cin >> a >> b;
  a -= 2 * b;
  cout << max (0LL, a) << '\n';

  return 0;
}



Measured memory_bytes: 256
a = int(input()) # 500
b = int(input()) # 100
c = int(input()) # 50
x = int(input()) # 50 - 20000
ans = 0
for i in range(a+1):
    current = x - 500*i
    if current < 0:
        break
    elif current == 0:
        ans += 1
        break
    for j in range(b+1):
        current2 = current - 100*j
        if current2 < 0:
            break
        elif current2 == 0:
            ans += 1
            break
        for k in range(c+1):
            current3 = current2 - 50*k
            if current3 < 0:
                break
            elif current3 == 0:
                ans += 1
                break

print(ans)


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

int f(vector<int> v,int n,vector<int> &dp,int k)
{
    dp[1]=0;
    for (int i=2;i<=n;i++)
        for (int j=i-1;j>=max(i-k,1);j--)
            dp[i]=min(dp[j]+abs(v[i]-v[j]),dp[i]);
    return dp[n];
}

int main()
{
    int n,k;
    cin >> n >> k;
    vector<int> v(n+1,0);
    const int g=INT_MAX;
    vector<int> dp(n+1,g);
    for (int i=1;i<=n;i++)
        cin >> v[i];
    cout << f(v,n,dp,k);
}

Measured memory_bytes: 1408
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
const int INF = 10001;

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

class R{
  public:
    double a, b;
    R(int aa, int bb) { a = aa; b = bb; int r; while((r = gcd(a, b)) != 1) { a /= r; b /= r; } }
    bool operator > (const R &r) const { return a / b > r.a / r.b; }
    bool operator < (const R &r) const { return a / b < r.a / r.b; }
};


int main() {
  double P;
  int N;
  while(cin >>P >>N && (P || N)){
    P = sqrt(P);
    R lower = R(-1, 1), upper = R(INF, 1);
    FOR(i, 1, N + 1){
      int l = 0, r = N + 1;
      while(r - l > 1){
        double m = (r + l) / 2;
        if(m / i >= P){
          r = m;
          upper = min(upper, R(r, i));
        }
        else{
          l = m;
          lower = max(lower, R(l, i));
        }
      }
    }
    cout <<upper.a <<"/" <<upper.b <<" " <<lower.a <<"/" <<lower.b <<endl;
  }
  return 0;
}

Measured memory_bytes: 1284
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<math.h>
#include<vector>
#include<set>
using namespace std;
int main()
{
    int n,m,i,j;
    cin>>n>>m;
    long long a[n],b[n],c[m],d[m],r[n],l,l1;
    for(i=0;i<n;i++)
       cin>>a[i]>>b[i];
    for(i=0;i<m;i++)
       cin>>c[i]>>d[i];
    for(i=0;i<n;i++)
       {
           l=abs(a[i]-c[0])+abs(b[i]-d[0]);
           r[i]=1;
           for(j=1;j<m;j++)
              {
                  l1=abs(a[i]-c[j])+abs(b[i]-d[j]);
                  if(l>l1)
                    {
                        l=l1;
                        r[i]=j+1;
                    }
              }
       }
    for(i=0;i<n;i++)
       cout<<r[i]<<'\n';
    return 0;
}

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


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

	int a, b;
	cin >> a >> b;
	string A[2];
	for (int i = 0; i < a; i++)
		A[0] = A[0] + to_string(b);
	for (int i = 0; i < b; i++)
		A[1] = A[1] + to_string(a);
	sort(A, A+2);
	cout << A[0];



	return 0;
}

Measured memory_bytes: 256
#This function merges two sorted arrays and returns inversion count in the arrays.*/ 
def merge(arr, temp, left, mid, right): 
    inv_count = 0
  
    i = left #i is index for left subarray*/ 
    j = mid #i is index for right subarray*/ 
    k = left #i is index for resultant merged subarray*/ 
    while ((i <= mid - 1) and (j <= right)): 
        if (arr[i] <= arr[j]): 
            temp[k] = arr[i] 
            k += 1
            i += 1
        else: 
            temp[k] = arr[j] 
            k += 1
            j += 1
  
            #this is tricky -- see above explanation/ 
            # diagram for merge()*/ 
            inv_count = inv_count + (mid - i) 
  
    #Copy the remaining elements of left subarray 
    # (if there are any) to temp*/ 
    while (i <= mid - 1): 
        temp[k] = arr[i] 
        k += 1
        i += 1
  
    #Copy the remaining elements of right subarray 
    # (if there are any) to temp*/ 
    while (j <= right): 
        temp[k] = arr[j] 
        k += 1
        j += 1
  
    # Copy back the merged elements to original array*/ 
    for i in range(left,right+1,1): 
        arr[i] = temp[i] 
  
    return inv_count 
  
#An auxiliary recursive function that sorts the input 
# array and returns the number of inversions in the 
# array. */ 
def _mergeSort(arr, temp, left, right): 
    inv_count = 0
    if (right > left): 
        # Divide the array into two parts and call 
        #_mergeSortAndCountInv() 
        # for each of the parts */ 
        mid = int((right + left)/2) 
  
        #Inversion count will be sum of inversions in 
        # left-part, right-part and number of inversions 
        # in merging */ 
        inv_count = _mergeSort(arr, temp, left, mid) 
        inv_count += _mergeSort(arr, temp, mid+1, right) 
  
        # Merge the two parts*/ 
        inv_count += merge(arr, temp, left, mid+1, right) 
  
    return inv_count 
  
#This function sorts the input array and returns the 
#number of inversions in the array */ 
def countSwaps(arr, n): 
    temp = [0 for i in range(n)] 
    return _mergeSort(arr, temp, 0, n - 1) 


from itertools import combinations, zip_longest

N = int(input())

A = list(map(int,input().split()))
B = list(map(int,input().split()))

cards = [(a,b) if i % 2 == 0 else (b,a) for i,(a,b) in enumerate(zip(A,B))]

best = float('inf')

for odd_indices in combinations(range(N), N//2):
    odds = sorted((cards[i][1], i) for i in odd_indices)
    evens = sorted((card[0], i) for i,card in enumerate(cards) if i not in odd_indices)


    union = []
    for e,o in zip_longest(evens,odds):
        union.append(e)
        if o is not None:
            union.append(o)
    if all(a <= b for (a,_),(b,_) in zip(union,union[1:])):
        indices = [i for _,i in union]
        best = min(best, countSwaps(indices, N))

if best == float('inf'):
    print(-1)
else:
    print(best)

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

using namespace std;

int N;
long long A, B;
long long H[210000];
 
int main() {
 
  cin >> N >> A >> B;
  
	for (int i = 0; i < N; ++i) 
      cin >> H[i];
  
	sort(H, H+N);
  
	long long lo = 0, hi = 1LL<<30;
  
	while (hi - lo > 1) {
	  long long mid = (lo + hi) / 2;
	  long long need = 0;
      
	  for (int i = 0; i < N; ++i) {
		long long rem = H[i] - mid * B;
        
		if (rem > 0) need += (rem + (A-B-1)) / (A-B);
	  }
      
	  if (need <= mid) hi = mid;
	  else lo = mid;
	}
	cout << hi << endl;
  }



Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
typedef long long ll;
#define MODSIZE 1000000007
// priority_queue<int, vector<int>, greater<int> > PQ; // 昇順PQ
priority_queue<ll> pq;

ll a[200006];
int main(){

  int n;
  ll t;
  int i;

  scanf("%d", &n);

  for(i = 0;i < n;i++) scanf("%lld", &a[i]);

  t = a[0];
  for(i = 1;i < n;i++){
    t = t^a[i];
  }

  for(i = 0;i < n;i++){
    printf("%lld\n", a[i]^t);
  }

  return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
int n, m;
ll A[5100], B[210][5100];
ll psum[5100][5100];

struct RMQ {
    pll tree[17000];
    int key = 8192;
    void init() {
        int i;
        for (i=0;i<key*2;i++) tree[i] = pll(0,0);
    }
    void upd(int idx, pll val) {
        idx+=key;
        while(idx>0) {
            tree[idx] = max(tree[idx],val);
            idx>>=1;
        }
    }
    pll getv(int s, int e) {
        pll res = pll(0,0);
        s+=key;e+=key;
        while(s<=e) {
            if (s&1) res = max(res,tree[s++]);
            if (~e&1) res = max(res,tree[e--]);
            s>>=1;e>>=1;
        }
        return res;
    }
} it;

void dnc(int s, int e, int idx) {
    if (s>e) return;
    int m = it.getv(s,e).second;
    psum[s][m]+=B[idx][m];
    psum[s][e+1]-=B[idx][m];
    psum[m+1][m]-=B[idx][m];
    psum[m+1][e+1]+=B[idx][m];
    dnc(s,m-1,idx); dnc(m+1,e,idx);
}

void calc(int idx) {
    int i;
    it.init();
    for (i=0;i<n;i++) it.upd(i,pll(B[idx][i],i));
    dnc(0,n-1,idx);
}

int main() {
    int i, j;

    scanf("%d%d",&n,&m);
    for (i=1;i<n;i++) scanf("%lld",&A[i]);
    for (i=1;i<n;i++) A[i] += A[i-1];
    for (i=0;i<n;i++) for (j=0;j<m;j++) scanf("%lld",&B[j][i]);
    for (i=0;i<m;i++) calc(i);
    for (i=0;i<=n;i++) for (j=0;j<=n;j++) {
        psum[i][j] += (i?psum[i-1][j]:0)+(j?psum[i][j-1]:0)-(i&&j?psum[i-1][j-1]:0);
    }
    ll maxi = 0;
    for (i=0;i<n;i++) for (j=i;j<n;j++) {
        maxi = max(maxi,psum[i][j]-A[j]+A[i]);
    }
    printf("%lld\n",maxi);

    return 0;
}


Measured memory_bytes: 209664
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>


#define REP(i,N) for(auto i = 0; i <N; i++)
const int MAX = INT_MAX;
using namespace std;
typedef long long ll;


int in(){
    int temp;
    scanf("%d",&temp);
    return temp;
}

ll lin(){
    ll temp;
    scanf("%lld",&temp);
    return temp;
}



int main() {

    int c[3][3];
    
    cin >> c[0][0] >> c[0][1] >> c[0][2];
    cin >> c[1][0] >> c[1][1] >> c[1][2];
    cin >> c[2][0] >> c[2][1] >> c[2][2];
    
    int flag = 0;
    int t1, t2, t3, t4;
    for(auto i = 0;i<3; i++){
        for(auto j = 0;j<3; j++){
            
            t1 = c[i][i];
            t2 = c[i][j];
            t3 = c[j][i];
            t4 = c[j][j];
            
            if (t1 - t2 != t3 - t4){
                flag = 1;
            }
            
            if (t1 - t3 != t2 - t4){
                flag = 1;
            }
            
            if (t1 + t4 != t2 + t3){
                flag = 1;
            }
            
        }
    }
    
    if (flag == 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
    return 0;
}




                          




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

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

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

int n, M[100][100];

int prim(){
    int u, minv, d[100], p[100], c[100];
    
    for(int i = 0; i < n; i++){
        d[i] = (1<<21);
        p[i] = -1;
        c[i] = 0;
    }
    d[0] = 0;
    
    while(true){
        minv = (1<<21);
        u = -1;
        for(int i = 0; i < n; i++){
            if(minv > d[i] && c[i] != 2){
                u = i;
                minv = d[i];
            }
        }
        if(u == -1) break;
        c[u] = 2;
        for(int v = 0; v < n; v++){
            if(c[v] != 2 && M[u][v] != (1<<21)){
                if(d[v] > M[u][v]){
                    d[v] = M[u][v];
                    p[v] = u;
                    c[v] = 1;
                }
            }
        }
    }
    int sum = 0;
    for(int i = 0; i < n; i++){
        if(p[i] != -1) sum = sum + M[i][p[i]];
    }
    return sum;
}

int main(){
    cin >> n;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            int e ;
            cin >> e;
            if(e == -1) M[i][j] = (1<<21);
            else M[i][j] = e;
        }
    }
    cout << prim() << endl;
    return 0;
}


Measured memory_bytes: 3100
/*
 * Author : Sadi
 * Fri 03/07/2020
 * 18:09:36.25
 */
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <cassert>

using namespace std;

#define    watch(x); cout << "\n" <<  #x << " is: " << x << "\n";
#define    all(a) (a).begin(), (a).end()
#define    fi first
#define    se second

template<class A, class B>
ostream& operator << (ostream& output, const pair<A, B>& p) {
    output << "(" << p.first << ", " << p.second << ")";
    return output;
}

template<class A>
ostream& operator << (ostream& output, const vector<A>& a) {
    output << "[";
    for(auto it = a.begin(); it != a.end(); ++it) {
        if(it != a.begin()) {
            output << ", ";
        }
        output << *it;
    }
    output << "]";
    return output;
}

using lld = long long;
using pii = pair<int, int>;
using pll = pair<lld, lld>;

//const int inf = 1e9;
//const int mod = 1e9 + 7;
//const double PI = acos(-1.0);
//const int mx = 1e5 + 5;



int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE

    string str;
    cin >> str;
    vector<int> v;
    int ans = 1e5;
    int len = str.size();
    for(int i = 0; i < len - 3 + 1; ++i) {
        string s = str.substr(i, 3);
        int num = stoi(s);
        int dif = max(753, num) - min(753, num);
        ans = min(ans, dif);
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> C(n + 1);
    for (int i = 0; i < m; i++){
        int a, b;
        cin >> a >> b;
        C[a]++;
        C[b]++;
    }

    for (const auto &c: C){
        if (c & 1){
            puts("NO");
            return 0;
        }
    }

    puts("YES");
}

Measured memory_bytes: 640
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner Hen = new Scanner( System.in);
		int N ,H,W;
            
            N=Hen.nextInt() ;
            H=Hen.nextInt() ;
            W=Hen.nextInt() ;
            
           
        System.out.println((N-H+1)*(N-W+1));
	}
}

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



int main() {
    int h,k;
    cin >> h >> k;
    int d=h/k;
    if (h==d*k) cout << d << endl;
    else cout << d+1 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <numeric>
#include<iostream>
#include<set>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include<algorithm>
#include <sstream>
#include<string.h>
#include <cmath>
#include <iomanip>
#include <string>
using namespace std;
#define inf 1000000007
#define int long long
#define rep(i,j,n) for(int i=j;i<n;i++)
typedef pair<int,int>  P;
struct edge{int from,to,cost;};
double pi = 3.141592653589793;
//使うやつはここから下に置こうな
signed main(){
    int n;cin>>n;
    int tans=0,hans=0;
    rep(i,0,n){
        string t,h;cin>>t>>h;
        if(t>h)tans+=3;
        else if(h>t)hans+=3;
        else {
            hans++;tans++;
        }
    }
    cout<<tans<<" "<<hans<<endl;
    return 0;
}



Measured memory_bytes: 3140
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000.0



int main(){
	
	int N;
	cin>>N;
	
	vector<double> x(N),y(N);
	
	for(int i=0;i<N;i++)cin>>x[i]>>y[i];
	
	vector<pair<int,int>> P;
	for(int j=-1000;j<=1000;j++){
		for(int k=-1000;k<=1000;k++){
			P.emplace_back(j,k);
		}
	}
	
	random_device seed_gen;
	mt19937 engine(seed_gen());
	shuffle(P.begin(),P.end(),engine);
	
	double xx = 500.0,yy = 500.0;
	
	double d = 0.5;
	
	double mini = Inf;
	
	for(int i=0;i<3;i++){
		int nx = 0;
		int ny = 0;
		for(int j=0;j<P.size();j++){
			double X = xx + d*P[j].first;
			double Y = yy + d*P[j].second;
			
			double maxi = 0.0;
			for(int ind=0;ind<N;ind++){
				maxi = max(maxi,sqrt(pow(x[ind]-X,2.0) + pow(y[ind]-Y,2.0)));
				if(maxi>mini)break;
			}
			
			if(mini>maxi){
				mini = maxi;
				nx = P[j].first;
				ny = P[j].second;
			}
			
		}
		//cout<<nx<<','<<ny<<endl;
		//cout<<mini<<endl;
		xx += d*nx;
		yy += d*ny;
		
		d /= 500.0;
		
	}
	
	cout<<fixed<<setprecision(12)<<mini<<endl;
	
	
	
    return 0;
}


Measured memory_bytes: 35044
#include<cstdio>
using namespace std;

int main(){
  char S[10], T[10];

  scanf("%s", &S);
  scanf("%s", &T);

  int ans = 0;

  if (S[0] == T[0]) ans++;
  if (S[1] == T[1]) ans++;
  if (S[2] == T[2]) ans++;

  printf("%d\n", ans);

  return 0;
}

Measured memory_bytes: 128