akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
#include <stack>
#include <climits>
#include <chrono>
#include <fstream>
using namespace std;

#pragma region

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define revrepr(i, s, n) for (int i = (n) - 1; i >= s; i--)
#define debug(x) cerr << #x << ": " << x << "\n"
#define popcnt(x) __builtin_popcount(x)

const double PI = acos(-1.0);

using ll = long long;
using P = pair<int, int>;

template<class T> inline bool chmax(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>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

template<class T, class U>
ostream& operator <<(ostream &os, pair<T, U> p) {
    cout << '(' << p.first << ", " << p.second << ')';
    return os;
}

template<class T>
void print(const vector<T> &v, const string &delimiter = " ") { rep(i, v.size()) cout << (0 < i ? delimiter : "") << v.at(i); cout << endl; }

template<class T>
void print(const vector<vector<T>> &vv, const string &delimiter) { for (const auto &v: vv) print(v, delimiter); }

#pragma endregion


int main() {
    int h, w, m;
    cin >> h >> w >> m;
    vector<int> hol(h), ver(w);
    map<int, vector<int>> mp;
    set<P> st;
    rep(i, m) {
        int y, x;
        cin >> y >> x;
        y--; x--;
        hol[y]++;
        ver[x]++;
        st.insert(P(y, x));
        mp[x].push_back(y);
    }

    vector<P> memo(h);
    rep(i, h) {
        memo[i] = P(hol[i], i);
    }
    sort(memo.rbegin(), memo.rend());

    int ans = 0;
    rep(j, w) {
        // int res1 = memo[0].first + ver[j];
        // if (st.count(P(memo[0].second, j))) res1--;
        // chmax(ans, res1);

        // if (h == 1) continue;
        // int res2 = memo[1].first + ver[j];
        // if (st.count(P(memo[1].second, j))) res2--;
        // chmax(ans, res2);

        // if (h == 2) continue;
        // int res3 = memo[2].first + ver[j];
        // if (st.count(P(memo[2].second, j))) res3--;
        // chmax(ans, res3);

        // if (h == 3) continue;
        // int res4 = memo[3].first + ver[j];
        // if (st.count(P(memo[3].second, j))) res4--;
        // chmax(ans, res4);

        // if (h == 4) continue;
        // int res5 = memo[4].first + ver[j];
        // if (st.count(P(memo[4].second, j))) res5--;
        // chmax(ans, res5);

        rep(ite, min(h, (int)mp[j].size() + 1)) {
            int res1 = memo[ite].first + ver[j];
            if (st.count(P(memo[ite].second, j))) res1--;
            chmax(ans, res1);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 54720
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] array = new int[n][3];
		for(int i=0;i<n;i++) {
			array[i][0] = sc.nextInt();
			array[i][1] = sc.nextInt();
			array[i][2] = sc.nextInt();
		}
		int x=0,y=0,t=0,i;
		for(i=0;i<n;i++) {
			int sub = array[i][0]-t;
			if((x+y)%2==0 ) {
				if(sub%2==0) {
					if((array[i][1]+array[i][2])%2!=0) break;
				}else {
					if((array[i][1]+array[i][2])%2==0) break;
				}
			}else {
				if(sub%2==0) {
					if((array[i][1]+array[i][2])%2==0) break;
				}else {
					if((array[i][1]+array[i][2])%2!=0) break;
				}
			}
			if(MHD(x,y,array[i][1],array[i][2])>sub) break;
			x=array[i][1];
			y=array[i][2];
			t=array[i][0];
		}
		if(i==n) System.out.println("Yes");
		else System.out.println("No");
	}

	public static int MHD(int x, int y, int a, int b) {
		return Math.abs(x-a)+Math.abs(y-b);
	}
}

Measured memory_bytes: 93856
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<cmath>
#define LL long long
using namespace std;
const int N=55;
const int inf=0x3f3f3f3f;
int n,f,idmx,idmn,mx=-inf,mn=inf,a[N];
int read()
{
	int x=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}
int main()
{
	n=read();printf("%d\n",n*2-2);
	for(int i=1;i<=n;i++)
	{
		a[i]=read();
		if(a[i]>mx)mx=a[i],idmx=i;
		if(a[i]<mn)mn=a[i],idmn=i;
	}
	if(abs(mx)>=abs(mn))
	{
		for(int i=1;i<=n;i++)
			if(i!=idmx)printf("%d %d\n",idmx,i);
		for(int i=1;i<n;i++)printf("%d %d\n",i,i+1);
	}
	else
	{
		for(int i=1;i<=n;i++)
			if(i!=idmn)printf("%d %d\n",idmn,i);
		for(int i=n;i>1;i--)printf("%d %d\n",i,i-1);
	}
	return 0;
}

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

#define rep(i, s, t) for (int i = s; i < int(t); ++i)

#define sc	scanf
#define pr	printf
#define ff	first
#define ss	second
#define mp	make_pair
#define pb	push_back
#define eb	emplace_back
#define range(c)	c.begin(), c.end()
#define const_range(c)	c.cbegin(), c.cend()
#define lowbit(x)	((x) & -(x))
#define pop_count	__builin_popcount
#define pop_count64	__builtin_popcountll
#define tail_count	__builtin_ctz
#define tail_count64	__builtin_ctzll
#define lead_count	__builtin_clz
#define lead_count64	__builtin_clzll

#define temp_name template<typename

temp_name T1, typename T2> ostream& operator<< (ostream& os, const pair<T1, T2>& p) { return os << "<" << p.ff << "," << p.ss << ">"; }
#define container_ostream(container)						\
temp_name... T> ostream& operator<< (ostream& os, const container<T...>& c) {	\
	if (c.empty()) return os << "{ }";					\
	auto iter = c.cbegin();							\
	os << "{ " << *iter;							\
	while (++iter != c.cend()) os << ", " << *iter;				\
	return os << " }";							\
}
container_ostream(vector);
container_ostream(set);
container_ostream(map);

void dbg() { cerr << endl;}
temp_name Head, typename... Tail> void dbg(Head h, Tail... t) { cerr << " " << h; dbg(t...); }

#ifdef LOCAL
#define debug(...) cerr << "[ "#__VA_ARGS__" ] :", dbg(__VA_ARGS__)
#else
#define debug(...) 0
#endif

typedef long long i64;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<i64> vl;

temp_name T> T& minn(T& x, const T& y) { return x = min(x, y); }
temp_name T> T& maxx(T& x, const T& y) { return x = max(x, y); }

constexpr const int mod = 1000000007;
constexpr int add(int a, int b) { return a + b < mod ? a + b : a + b - mod; }
constexpr int sub(int a, int b) { return a < b ? mod + a - b : a - b; }
constexpr int mul(int a, int b) { return 1LL * a * b % mod; }
#define more_para(type, func) temp_name... T> constexpr type func(type a, type b, T... c) { return func(func(a, b), c...); }
more_para(int, add);
more_para(int, sub);
more_para(int, mul);
constexpr int square(int a) { return mul(a, a); }
constexpr int fpow(int a, int b) { return b ? mul(b & 1 ? a : 1, square(fpow(a, b >> 1))) : 1; }

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n;
	cin >> n;
	vector<string> s(n);
	vi t(n);
	rep(i, 0, n) cin >> s[i] >> t[i];
	reverse(range(s));
	reverse(range(t));
	string x;
	cin >> x;
	int ans = 0;
	rep(i, 0, n) {
		if (x == s[i]) break;
		ans += t[i];
	}
	cout << ans << endl;
}


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

using namespace std;

typedef pair<int, int> P;
typedef pair<int, P> Q;

int main() {
	int w, h;
	while (cin >> w >> h) {
		if (w == 0 && h == 0) {
			break;
		}
		vector< vector<int> > hyou(2*h+1, vector<int>(2*w+1, 0));
		for (int i = 0; i < 2*w+1; i++) {
			hyou[0][i] = hyou[2*h][i] = 1;
		}
		for (int i = 0; i < 2*h+1; i++) {
			hyou[i][0] = hyou[i][2*w] = 1;
		}
		for (int i = 1; i < 2*h; i++) {
			if (i % 2 == 1) {
				for (int j = 2; j < 2*w; j+=2) {
					cin >> hyou[i][j];
				}
			} else {
				for (int j = 1; j < 2*w+1; j+=2) {
					cin >> hyou[i][j];
				}
			}
		}
		priority_queue< Q, vector<Q>, greater<Q> > pq;
		pq.push(Q(1, P(1, 1)));
		int dx[4] = {1, 0, -1, 0};
		int dy[4] = {0, 1, 0, -1};
		bool hantei = false;
		while (!pq.empty()) {
			Q q = pq.top();
			int x = (q.second).first;
			int y = (q.second).second;
			int k = q.first;
			k++;
			pq.pop();
			for (int i = 0; i < 4; i++) {
				if (hyou[x+dx[i]][y+dy[i]] == 0 && hyou[x+dx[i]*2][y+dy[i]*2] == 0) {
					if (x+dx[i]*2 == 2*h-1 && y+dy[i]*2 == 2*w-1) {
						hantei = true;
						cout << k << endl;
						break;
					}
					hyou[x+dx[i]*2][y+dy[i]*2] = 1;
					pq.push(Q(k, P(x+dx[i]*2, y+dy[i]*2)));
				}
			}
			if (hantei) {
				break;
			}
		}
		if (!hantei) {
			cout << 0 << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1232
#include <iostream>
#include <algorithm>
using namespace std;
//x + y, x - y, x * yの中で最大値を求めよ
int main(){
	int x, y, all[3];
	cin >> x >> y;
	all[0] = x + y;
	all[1] = x - y;
	all[2] = x * y;
	cout << (int) *max_element(begin(all), end(all)) << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        int N = sc.nextInt();
        int M = sc.nextInt();
        char [][] A = new char [N][N];
        char [][] B = new char [M][M];
        input(A,N);
        input(B,M);
        for(int i=0; i<=N-M; i++){
            for(int j=0; j<=N-M; j++){
                if(A[i][j]==B[0][0]){
                    if(check(A,B,M,i,j)){
                        System.out.println("Yes");
                        System.exit(0);
                    }
                }
            }
        }
        System.out.println("No");
    }
    static boolean check(char[][]A, char[][]B, int M, int y, int x){
        for(int i=0; i<M; i++){
            for(int j=0; j<M; j++){
                if(A[y+i][x+j]!=B[i][j])return false;
            }
        }
        return true;
    }
    static void input(char[][]N, int X){
        for(int i=0; i<X; i++){
            String s = sc.next();
            for(int j=0; j<X; j++){
                N[i][j] = s.charAt(j);
            }
        }
    }
}


Measured memory_bytes: 22100
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
// Welcome to my source code!

int main() {
    int a1, a2, a3;
    cin >> a1 >> a2 >> a3;
    if (a1+a2+a3 >= 22) cout << "bust" << endl;
    else cout << "win" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long int n,d,count=0;
    cin>>n>>d;
  
    while(n--){
        int a,b;
        cin>>a>>b;
       double p= sqrt(pow(a, 2) +  
                pow(b, 2) );
                if(p<=d)count++;
    }
    cout<<count;
}

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

#define MAX_N 100010
using namespace std;
int n;
int h[MAX_N];

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) {
        scanf("%d", &h[i]);
    }

    vector<int> dp(n + 1, 0);

    // dp[i] := minimum total cost to reach i

    dp[2] = abs(h[2] - h[1]);
    for (int i = 3; i <= n; ++i) {
        dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]),
                    dp[i - 2] + abs(h[i] - h[i - 2]));
    }
    printf("%d\n", dp[n]);

    return 0;
}


Measured memory_bytes: 4120
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

int main()
{
        string S;
        cin >> S;
        S[3] = '8';
        cout << S << endl;

        return 0;
}


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

string S;

bool check(int l, int r) {
//	cout << S.substr(l, r) << endl;
	for(int i = l; i < r; i++) 
		if(S[i] != S[r + l - 1 - i])
			return false;
	return true;
}

int main() {
	cin >> S;
	int n = S.size();
	cout << (check(0, n) && check(0, n / 2) && check(n / 2 + 1, n) ? "Yes": "No");
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <stdio.h>
#include <cmath>
using namespace std;
const int N=1e5+5;
int n,oo,h[N];
int memo[N];
int dp(int i)
{
    if(i>n)
        return oo;
    if(i==n)
        return 0;
    int &ret=memo[i];
    if(ret!=oo)
        return ret;
    return ret=min(dp(i+1)+abs(h[i]-h[i+1]),dp(i+2)+abs(h[i]-h[i+2]));
}
int main()
{
    memset(memo,'?',sizeof memo);
    oo=memo[0];

    scanf("%d",&n);
    for(int i=1;i<=n;++i)
    {
         scanf("%d",h+i);
    }
    printf("%d\n",dp(1));
    return 0;
}


Measured memory_bytes: 6908
#include<bits/stdc++.h>
int i,j,k,n,m,P,f[303][303][303];main(){std::cin>>n>>m>>P;for(f[i=0][1][0]=1;i<=n;i++)for(j=0;m/++j;)for(k=i;~k;k--)((k?f[i][j][k-1]:f[i][j+1][i])+=f[i][j][k])%=P,(f[i+1][j][k]+=f[i][j][k]*(1ll+k)%P)%=P;std::cout<<f[n][m][0];}


Measured memory_bytes: 108800
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pii;
typedef vector<pii> vii;
typedef vector<ll> vi;
typedef queue<ll> qi;
typedef queue<char> qc;
typedef queue<string> qs;
typedef vector<char> vc;
typedef vector<string> vs;
typedef map<char,ll> mpci;
typedef map<ll,ll> mpii;
typedef map<string,ll> mpsi;
typedef set<ll> sei;
typedef set<char> sec;
typedef set<string> ses;
typedef stack<ll> si;
typedef stack<char> sc;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
typedef vector<pll> vpll;
typedef vector<pdd> vdd;
typedef unsigned int uint;
typedef long double ld;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vii> vvii;
/*=====================================================================*/
#define pb push_back
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define sz(a) (int)(a.size())
#define len(a) (int)(a.length())
#define all(s) (s).begin(),(s).end()
#define fi first
#define se second
#define be begin
#define en end
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define forn(i,p,n) for(int i=p;i<=n;i++)
#define ford(i,p,n) for(int i=n-1;i>=p;i--)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();++i)
#define zero(a) memset(a,0,sizeof(a))
#define number(a,num) memeset(a,num,sizeof(a))

/*=====================================================================*/

inline void read(int &x)
{
	short negative=1;
    x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
		if(c=='-')
			negative=-1;
		c=getchar();
	}
    while(c>='0' && c<='9')
        x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=negative;
}
inline void write(long long x) {
  static long long sta[35];
  long long top = 0;
  do {
    sta[top++] = x % 10, x /= 10;
  } while (x);
  while (top) putchar(sta[--top] + 48);
  puts("");
}
/*======================================================================*/
bool prime(int n)
{
	if(n==0||n==1)
	  return false;
	for(int i=2;i*i<=n;i++)
	  if(n%i==0)
	    return false;
	return true;
}
/*======================================================================*/
const int dx[]={-1,0,1,0};
const int dy[]={0,-1,0,1};
/*======================================================================*/
int main()
{
  /*
	ios_base::sync_with_stdio(0);
	cin(tie);
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
  */
  /*====================================================================*/
  int n;
  cin>>n;
  for(int i=1;i<=9;i++)
    for(int j=1;j<=9;j++)
    {
    	if(n==i*j)
    	{
    		cout<<"Yes";
    		return 0;
		}
	}
  cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
def main():
    n = input()
    seq = [int(a) for a in input().split(" ")]
    q = int(input())

    for _ in range(q):
        b, e = map(int, input().split(" "))
        tmp = seq[b:e]
        tmp = tmp[::-1]
        seq[b:e] = tmp[:]
    print(*seq)
main()



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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

#define REP(k, n) for (ll k = 0; k < (ll)(n); ++k)
#define REPREV(k, n) for (ll k = (ll)(n)-1; k >= 0; --k)
#define FOR(k, a, b) for (ll k = (ll)(a); k < (ll)(b); ++k)
#define FORREV(k, a, b) for (ll k = (ll)(b)-1; k >= (ll)(a); --k)
#define FOREACH(e, v) for (auto& e : v)

#define TGET(t, i) get<i>(t)
#define TSET(t, i, a) get<i>(t) = a
// MinHeap - priority_queue<ll, vll, greater<ll>> pq;

#define EVEN(n) ((n)&1) == 0
#define ODD(n) ((n)&1) == 1

#define SORT(v) sort(v.begin(), v.end())
#define SORTREV(v) sort(v.rbegin(), v.rend())
#define SHUFFLE(v) random_shuffle(v.begin(), v.end())
//srand(unsigned(time(0)));

#define REMOVEAT(v, i) v.erase(v.begin() + i)
#define REVERSE(v) reverse(v.begin(), v.end())
#define UNIQUE(v) \
    SORT(v);      \
    v.resize(distance(v.begin(), unique(v.begin(), v.end())))

ostream& operator<<(ostream& str, const pll& p) {
    str << p.first << " " << p.second;
    return str;
}

template <typename T>
void join(T& arr, string sep) {
    bool first = true;
    for (auto t : arr) {
        if (first) {
            first = false;
            cout << t;
        } else {
            cout << sep << t;
        }
    }
    cout << "\n";
}

const ll md = 1e9 + 7;
ll MOD(ll x) {
    ll r = x % md;
    if (r < 0) {
        r += md;
    }
    return r;
}

#define POS "POSSIBLE"
#define IMPOS "IMPOSSIBLE"

// #define INF DBL_MAX
// #define INF LLONG_MAX
// #define MINF LLONG_MIN
#define INF 1e18
#define MINF -INF

void add_self(ll& x, ll d) {
    x = MOD(x + d);
}

void mul_self(ll &x, ll d) {
    x = MOD(x * d);
}


ll power(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1) {
            mul_self(res, a);
        }
        mul_self(a, a);
        b >>= 1;
    }
    return res;
}
ll mod_inverse(ll a) {
    return power(a, md-2); // only when md is prime
}
vll factorial;
void computeFactorials(ll n) {
    factorial.resize(n + 1);
    factorial[0] = 1;
    for (ll i = 1; i <= n; i++) {
        factorial[i] = MOD(factorial[i - 1] * i);
    }
}

ll choose(ll n, ll k) {
    ll a = mod_inverse(factorial[k]);
    ll b = mod_inverse(factorial[n - k]);
    ll ab = MOD(a * b);
    return MOD(factorial[n] * ab);
}

void solve() {
    ll n;
    cin >> n;
    ll res = 0;
    computeFactorials(n);
    ll cur = 1;
    for (int k = 2; k <= n; k++) {
        mul_self(cur, 2);
        if (k > 2)
            add_self(cur, 2);
        ll pos = choose(n, k);
        ll curRes = pos;
        mul_self(curRes, cur);
        ll rr = power(8, n - k);
        mul_self(curRes, rr);
        add_self(res, curRes);
    }

    // cout << fixed << setprecision(6);
    cout << res << "\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int tt = 1;
    // cin >> tt;
    for (int t = 1; t <= tt; t++) {
        // cout << "Case #" << t << ": ";
        solve();
    }
    //cin.rdbuf()->in_avail()
    return 0;
}

Measured memory_bytes: 10988
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;

int N,K,dist[2001],ans=MOD;
vi adj[2001];

void genDist(vi v) {
    queue<int> q; 
    FOR(i,1,N+1) dist[i] = MOD;
    for (int i: v) {
        dist[i] = 0;
        q.push(i);
    }
    while (sz(q)) {
        int x = q.front(); q.pop();
        for (int i: adj[x]) if (dist[i] == MOD) {
            dist[i] = dist[x]+1;
            q.push(i);
        }
    }
}

void triVert() {
    FOR(i,1,N+1) {
        genDist({i});
        int z = 0;
        FOR(j,1,N+1) if (dist[j] > K/2) z ++;
        ans = min(ans,z);
    }
}

void triEdge() {
    FOR(i,1,N+1) for (int j: adj[i]) {
        genDist({i,j});
        int z = 0;
        FOR(k,1,N+1) if (dist[k] > (K-1)/2) z ++;
        ans = min(ans,z);
    }
    
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> N >> K;
    F0R(i,N-1) {
        int a,b; cin >> a >> b;
        adj[a].pb(b), adj[b].pb(a);
    }
    triVert();
    triEdge();
    cout << ans;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
  int a,b,c;
  cin>>a>>b>>c;
  int max;
  if(a<b&&c<b) max=b;
  else if(a<c&&b<c) max=c;
  else max=a;
  if(max==a+b+c-max) cout<<"Yes";
  else cout<<"No";
  return 0;
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N;

int main(){
	int A,B,C;
	cin>>A>>B>>C;
	cout<<C<<" "<<A<<" "<<B<<endl;
}

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

int main(void)
{
	int sum;
	int i;
	int n;
	
	sum = 0;
	for (i = 0; i < 5; i++){
		scanf("%d", &n);
		
		sum += (n > 40) ? n / 5 : 8;
	}
	
	printf("%d\n", sum);
	
	return (0);
}

Measured memory_bytes: 600
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main{

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int heights[] = new int[10];
		for (int i = 0; i < 10; i++) {
			heights[i] = Integer.parseInt(br.readLine());
		}
		
		Arrays.sort(heights);
		
		for (int i = 9; i >= 7; i--) {
			System.out.println(heights[i]);
		}
	}

}

Measured memory_bytes: 24340
object Main {
  def main(args: Array[String]): Unit = {
    val s = new Main()
    s.solve()
    s.out.flush()
  }
}

class Main {
  import java.io._
  import java.util.StringTokenizer

  import scala.collection.mutable
  import scala.util.Sorting
  import math.{abs, max, min}
  import mutable.{ArrayBuffer, ListBuffer}
  import scala.reflect.ClassTag

  val MOD = 1000000007
  val out = new PrintWriter(System.out)

  def solve(): Unit = {
    val N, M = ni()
    val (from, to) = na2(M, -1)
    val deg = Array.ofDim[Int](N)
    REP(M) { i =>
      deg(from(i)) += 1
      deg(to(i)) += 1
    }

    val ok = deg.forall(_ % 2 == 0)
    if (ok) out.println("YES")
    else out.println("NO")
  }


  def debug(as: Array[Boolean]): Unit = {
    System.err.println(as.map(x => if(x) "1" else "0").mkString)
  }

  def debug(as: Array[Int]): Unit = {
    System.err.println(as.mkString(" "))
  }

  def debug(as: Array[Long]): Unit = {
    System.err.println(as.mkString(" "))
  }

  def debug(s: String): Unit = {
    System.err.println(s)
  }

  def debug(num: Long): Unit = {
    System.err.println(num)
  }

  class InputReader(val stream: InputStream) {
    private val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer = _

    def next(): String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens)
        tokenizer = new StringTokenizer(reader.readLine)
      tokenizer.nextToken
    }

    def nextInt(): Int = next().toInt
    def nextLong(): Long = next().toLong
    def nextChar(): Char = next().charAt(0)
  }
  val sc = new InputReader(System.in)
  def ni(): Int = sc.nextInt()
  def nl(): Long = sc.nextLong()
  def nc(): Char = sc.nextChar()
  def ns(): String = sc.next()
  def ns(n: Int): Array[Char] = ns().toCharArray
  def na(n: Int, offset: Int = 0): Array[Int] = map(n)(_ => ni() + offset)
  def na2(n: Int, offset: Int = 0): (Array[Int], Array[Int]) = {
    val A1, A2 = Array.ofDim[Int](n)
    REP(n) { i =>
      A1(i) = ni() + offset
      A2(i) = ni() + offset
    }
    (A1, A2)
  }
  def nm(n: Int, m: Int): Array[Array[Int]] = {
    val A = Array.ofDim[Int](n, m)
    REP(n) { i =>
      REP(m) { j =>
        A(i)(j) = ni()
      }
    }
    A
  }
  def nal(n: Int): Array[Long] = map(n)(_ => nl())
  def nm_c(n: Int, m: Int): Array[Array[Char]] = map(n) (_ => ns(m))
  def REP(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = offset
    val N = n + offset
    while(i < N) { f(i); i += 1 }
  }
  def REP_r(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = n - 1 + offset
    while(i >= offset) { f(i); i -= 1 }
  }

  def map[@specialized A: ClassTag](n: Int, offset: Int = 0)(f: Int => A): Array[A] = {
    val res = Array.ofDim[A](n)
    REP(n)(i => res(i) = f(i + offset))
    res
  }


  def sumL(as: Array[Int]): Long = {
    var s = 0L
    REP(as.length)(i => s += as(i))
    s
  }

  def cumSum(as: Array[Int]) = {
    val cum = Array.ofDim[Long](as.length + 1)
    REP(as.length) { i =>
      cum(i + 1) = cum(i) + as(i)
    }
    cum
  }
}


Measured memory_bytes: 41200
#include <iostream>
#include <queue>

using namespace std;

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.precision(10);

  int K, N;
  cin >> N >> K;

  queue<int> vals;
  for (int i = 0; i < K; i++) {
    vals.emplace(0);
  }

  long long S = 0;
  long long best_s = 0;
  for (int i = 0, x; i < N; i++) {
    cin >> x;

    S -= vals.front();
    vals.pop();

    S += x;
    vals.emplace(x);

    best_s = max(best_s, S);
  }

  cout << ((float)best_s + K)/2 << endl;
}

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

int main(){
    int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
    int dx = x2-x1, dy = y2-y1;
    cout << x2-dy << ' ' <<  y2+dx << ' '<< x1-dy << ' ' << y1+dx << endl;
}

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

using namespace std;

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define int long long
#define all(c) (c).begin(),(c).end()
#define M 1000000007
#define INF LLONG_MAX
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {int idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ", "; dbs(str.substr(idx + 1), s...);}
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}
template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}
// Use pr(a,b,c,d,e) or cerr<<anything or prc(v.begin(),v.end()) or prc(v,v+n)
//  


int32_t main()
{
    fastio;
    int n;
    cin >> n;
    vector<pair<int, int>> a[n];
    for(int i=0;i<n;i++)
    {
        int num;
        cin >> num;
        for(int j=0;j<num;j++)
        {
            int x, y;
            cin >> x >> y;
            a[i].pb({x-1, y});
        }
    }
    int ans = 0;
    for(int mask=0;mask<(1<<n);mask++)
    {
        bool possible = true;
        for(int i=0;i<n;i++)
        {
            if(mask&(1<<i))
            {
                for(int j=0;j<a[i].size();j++)
                {
                    int x = a[i][j].first, y = a[i][j].second;
                    if((y && !(mask&(1<<x)))||(!y && (mask&(1<<x))))
                    {
                        possible = false;
                        break;
                    }
                }
            }
        }
        if(possible)
        {
            int count = __builtin_popcount(mask);
            ans = max(ans, count);
        }
    }

    cout << ans << "\n";



    
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
# define ll long long
# define pi 3.14159265359
# define str string
# define vll vector<ll>
# define vstr vector<str>
# define vpll vector<pair<ll,ll> >
//assign() assignes new value
//emplace(position,x) inserting
//erase(position) to remove an element
//swap() for swapping
//reverse(position,position) for reversing
# define pb push_back
# define popb pop_back
# define pf push_front
# define popf pop_front
# define sll set<ll>
//find()
//erase(x) removes element x
//erase(position,position)
# define qll queue<ll>
# define qstr queue<str>
//front(),back()
# define stll stack<ll>
# define ststr stack<str>
//top()
# define dll deque<ll>
//at()
# define mll map<ll,ll>
# define msl map<str,ll>
# define mls map<str,ll>
# define mstr map<str,str>
# define mcl map<char,ll>
# define pll pair<ll,ll>
# define f(x,y) for(int x=0;x<y;x++)
# define r(x,y) for(int x=y;x>=0;x--)
# define fr(x,y,z) for(int x=y;x<z;x++)
# define rr(x,y,z) for(int x=y;x>z;x--)
ll gcd(ll a, ll b){
    if(b == 0)
        return a;
    return gcd(b, a % b);
}
ll lcm(ll a, ll b){
    return (a*b)/gcd(a, b);
}
void print(vll a){
    for(int i=0;i<a.size();i++){
        cout<<a[i]<<' ';
    }
    cout<<endl;
}
vll inp(int n){
    vll a;
    ll x;
    f(i,n){
        cin>>x;
        a.pb(x);
    }
    return a;
}
ll knapsack(vll w,vll v,ll t){
    ll n=w.size();
    vll a[n+1];
    for(ll i=0;i<=n;i++){
        for(ll j=0;j<=t;j++){
            a[i].pb(0);
        }
    }   
    for(ll i=0;i<=n;i++){
        for(ll j=0;j<=t;j++){
            if(i==0 || j==0){
                continue;
            }
            else if(j-w[i-1]>=0){
                a[i][j]=max(a[i-1][j],a[i-1][j-w[i-1]]+v[i-1]);
            }
            else{
                a[i][j]=a[i-1][j];
            }
        }
    }
    return a[n][t];
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t,n,i,j,k,l,c,c1,cnt,flag,m1,m,m2,maxi,mini,x,y,z;
    str s,s1,s2;
    ll w;
    vpll a;
    pll p;
    vll q,r;
    cin>>n>>w;
    f(i,n){
        cin>>p.first>>p.second;
        a.pb(p);
    }
    sort(a.begin(),a.end());
    f(i,n){
        q.pb(a[i].first);
        r.pb(a[i].second);
    }
    k=knapsack(q,r,w);
    cout<<k<<endl;



}

Measured memory_bytes: 80244
#include <stdio.h>
#include <iostream>

using namespace std;



int main(void){
  int N = 0,ans = 0;
  cin >> N;
    char S[N] = {0};
    for(int i = 0; i < N; i++){
        cin >> S[i];
    }
    for(int i =0;i < (N - 1);i ++){
        if(S[i] == S[i + 1]){
            ans += 1;
        }
    }
    N -= ans;
    cout << N;
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define l first
#define r second	
using namespace std;
typedef pair<int,int> pii;
bool cmp(pii a,pii b){
	return a.first<b.first;
}
pii p[100100];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		int a,b;
		scanf("%d%d",&a,&b);
		p[i].l = a - b;
		p[i].r = a + b;
	}
	sort(p, p + n, cmp);
	int R = -1008610086;
	int ans = 0;
	for(int i = 0; i < n; i ++){
		if(p[i].l >= R) R = p[i].r, ans ++;
		else if(p[i].r < R) R = p[i].r;
	}
	printf("%d\n",ans);
	return 0;
}

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

using namespace std;

int main()
{
    int n;
    cin>>n;
    if(n % 2 == 1)
    {
        float d = (float) n;
        printf("%0.10f\n",((d + 1)/2)/d);
    }
    else
    {
        float d = (float) n;
        printf("%0.10f\n",(d/2)/d);
    }

}


Measured memory_bytes: 256
<?php
$S = fgets(STDIN);
$K = (int)fgets(STDIN);

for ($i=0; $i < $K; $i++) {
    if (substr($S, $i, 1) !== "1") {
        echo substr($S, $i, 1)."\n";
        return;
    }
}
echo "1\n";


Measured memory_bytes: 4856
#include <iostream> 
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 

using namespace std;

int main() {
	int n, k;
	long long t = 0;
	cin >> n >> k;
	vector<long long>vec(n);
	for (int i = 0; i < n; i++) {
		cin >> vec[i];
	}
	sort(vec.begin(), vec.end());
	for (int i = 0; i < n - k; i++) {
		t += vec[i];
	}
	cout << t << endl;
}

Measured memory_bytes: 1792
#include <stdio.h>

using namespace std;

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

int main() {
    int H, W;
    scanf("%d %d", &H, &W);

    // 1 つの数字を i から j に書き変えるには魔力 cij が必要
    int c[10][10];
    REP(i, 10) {
        REP(j, 10) {
            scanf("%d", &c[i][j]);
        }
    }

    REP(k, 10) {
        REP(i, 10) {
            REP(j, 10) {
                if (c[i][j] > c[i][k] + c[k][j]) {
                    c[i][j] = c[i][k] + c[k][j];
                }
            }
        }
    }

    int ans = 0;
    REP(i, H) {
        REP(j, W) {
            int aij = 0;
            scanf("%d", &aij);

            if (aij == -1) continue;

            ans += c[aij][1];
        }
    }

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

    return 0;
}


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

using namespace std;

typedef long long ll;

const int INF = 1000000000;

int main()
{
  int N; scanf("%d", &N);
  vector<int> A(N);
  map<int, int> m;
  for (int i = 0; i < N; ++i) {
    int val; scanf("%d", &val);
    ++m[val];
  }
  int ans = 0;
  for (map<int, int>::iterator iter = m.begin(); iter != m.end(); ++iter) {
    ans += (iter->second % 2);
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 5376
#include <iostream>
#include <cstdlib>
#include <cstring>
using namespace std;

int n;
int memo[5000][5];


int dp(int s,int now)
{
	if(s>n)return 0;
	if(now==5)return 0;
	if(memo[s][now]!=-1)return memo[s][now];
	if(s==n&&now==4)return 1;
	int ans=0;
	for(int i=0;i<=1000;i++)
	{
		ans+=dp(s+i,now+1);
	}
	
	return memo[s][now]=ans;
}



int main()
{
	
	while(cin>>n)
	{
		memset(memo,-1,sizeof(memo));
		cout<<dp(0,0)<<endl;
	}
	
	
	
}

Measured memory_bytes: 1264
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    if(a > b) {
      System.out.println(a - 1);
    } else {
      System.out.println(a);
    }
  }
}

Measured memory_bytes: 20820
#include<cstdio>
#include<algorithm>
#include<utility>
using namespace std;

int main(){
    int n,m;
    long long ans=0;
    pair<long long ,int> p[100000];
    scanf("%d %d",&n,&m);
    for(int i=0;i<n;i++){
        scanf("%lld %d",&p[i].first,&p[i].second);
    }
    sort(p,p+n);
    for(int i=0;i<n;i++){
        if(m>p[i].second){
            ans+=(long long)p[i].second*p[i].first;
            m-=p[i].second;
        }
        else{
            ans+=(long long)m*p[i].first;
            m=0;
        }
    }
    printf("%lld\n",ans);
}

Measured memory_bytes: 1664
#include <iostream>
#include <cstdio>
#include <queue>
#include <cmath>
#include <random>
#include <fstream>
#include <string>
#include <tuple>
#include <deque>
#include <set>
#include <map>

#define REP(i, N) for(int i = 0; i< N; i++)
using namespace std;
#define ll long long
const int INF = 1 << 29;
const ll llINF = 10000000000000000;

const int MOD = 1000000007;


int main(){
    int N, K;
  cin >> N >> K;
  if(N % K == 0)printf("0\n");
  else printf("1\n");
}


Measured memory_bytes: 888
def hoge(K, A, B):
    ans = 0
    for n in range(A, B+1):
        if n%K == 0:
            ans = 1
            return ans
    return ans

K = int(input())
A, B = map(int, input().split())
if hoge(K, A, B):
    print('OK')
else:
    print('NG')

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

int main(){
    int A,B,M,Min_a=100000,Min_b=100000,ans;
    cin>>A>>B>>M;
    vector<int> a(A),b(B),x(M),y(M),c(M);
    for(int i=0;i<A;i++){
        cin>>a.at(i);
        if(Min_a>a.at(i)){
            Min_a=a.at(i);
        }
    }
    for(int i=0;i<B;i++){
        cin>>b.at(i);
        if(Min_b>b.at(i)){
            Min_b=b.at(i);
        }
    }
    
    ans = Min_a + Min_b;

    for(int i=0;i<M;i++){
        cin>>x.at(i)>>y.at(i)>>c.at(i);
        if(a.at(x.at(i)-1)+b.at(y.at(i)-1)-c.at(i)<ans){
            ans = a.at(x.at(i)-1)+b.at(y.at(i)-1)-c.at(i);
        }
    }
    cout<<ans<<endl;
}


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

int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i=0; i<n; i++) cin >> a[i];
	sort(a.begin(), a.end());
	reverse(a.begin(), a.end());
	int ans=0;
	for(int i=0; i<n; i++){
		if(a[i] >= i+1) ans = i+1;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3140
#include<stdio.h>
#include<stdlib.h>
#define M 2000000

void heapIncreaseKey(int [],int,int);

//int heap[M];
int n=0;

int parent(int i){
    return i/2;
}
int left(int i){
    return 2*i;
}
int right(int i){
    return 2*i+1;
}

void maxHeapify(int A[], int i){
    int largest;
    int l,r;
    int tmp;
    l = left(i);
    r = right(i);
    
    if(l<=n && A[l] > A[i])largest=l;
    else largest=i;
    
    if(r<=n && A[r]>A[largest])largest=r;
    
    if(largest != i){
        tmp=A[i];
        A[i]=A[largest];
        A[largest]=tmp;
        maxHeapify(A,largest);
    }
    
}

void buildMaxHeap(int A[]){
    int i;
    for(i=n/2;i>=1;i--){
        maxHeapify(A, i);
    }
}

void maxHeapInsert(int A[],int key){
    n=n+1;
    A[n]=-2147483647;
    heapIncreaseKey(A,n,key);
    
}


void heapIncreaseKey(int A[],int i,int key){
    int tmp;
    if(key < A[i])exit(1);
    A[i]=key;
    while(i>1 && A[parent(i)]<A[i]){
        tmp=A[i];
        A[i]=A[parent(i)];
        A[parent(i)]=tmp;
        i=parent(i);
    }
}

int heapExtractMax(int A[]){
    int max;
    if(n<1)exit(5);
    max=A[1];
    A[1]=A[n];
    n=n-1;
    maxHeapify(A,1);
    return max;
}




int main(void){
    //int i=0;
    int heap[M];
    int key;
    char com[20];
    

  while(1){
      scanf("%s",com);
        if( com[0] == 'i'){
            scanf("%d",&key);
            maxHeapInsert(heap, key);
          //  i++;
        }else if( com[0] == 'e' && com[1] == 'x'){
            printf("%d\n",heapExtractMax(heap));
        }else break;
            
  }
    return 0;
}

        

Measured memory_bytes: 4696
// Problem : A - Beginner
// Contest : AtCoder - AtCoder Beginner Contest 156
// URL : https://atcoder.jp/contests/abc156/tasks/abc156_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize "trapv"//  WA to RE int!!
#include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<n;i++)
#define FORR(i,n) for(int i=n;i>=0;i--)
#define pb push_back
#define vint vector<int>
#define sint set<int>
#define mint map<int,int>
#define pint pair< int,int >
#define int long long int 
#define test int tt1234; cin>>tt1234;while(tt1234--)
#define endl "\n"
#define SI(a,n) int a[n];FOR(i,n) cin>>a[i];
#define input(a,n) int n;cin>>n; SI(a,n)
#define all(zz) zz.begin(),zz.end()
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define error(x) cerr << #x <<" is " << x << endl;
#define Error(a,b) cerr<<"( "<<#a<<" , "<<#b<<" ) = ( "<<(a)<<" , "<<(b)<<" )\n";
#define precision(x) cout<<fixed<<setprecision(x);
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define present(container, element) (container.find(element)!=container.end())
#define fint fast;test
#define set(a,x) memset(a,x,sizeof(a))
#define L(x)	((x)<<1)
#define R(x)	(((x)<<1)+1)
#define ft first
#define se second
#define MOD 1000000007
using namespace std;
template<typename... T> void rd(T&... args) { ((cin >> args), ...); }
template<typename... T> void pp(T... args) { ((cout << args << " "), ...); cout<<"\n"; }

void solve(){
	int n,k;
	rd(n,k);
	if(n>=10)pp(k);
	else pp(k+(100*(10-n)));	
	return;	
}


int32_t main() {
    // fint{
    	fast;
    	solve();
    // }
    return 0;
}


Measured memory_bytes: 3536
using System;

namespace Planetary_Exploration
{
    class Program
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine();
            var input = line.Split(' ');
            int M = Int32.Parse(input[0]);
            int N = Int32.Parse(input[1]);

            line = Console.ReadLine();
            int K = Int32.Parse(line);

            int[,,] x  = new int[M,N,3];


            for (int i = 0; i < M; i++)
            {
                int totalJ = 0;
                int totalO = 0;
                int totalI = 0;
                line = Console.ReadLine();
                for (int j = 0; j < N; j ++)
                {
                    var c = line[j];
                    switch (c)
                    {
                        case 'J':
                            totalJ++;
                            break;
                        case 'O':
                            totalO++;
                            break;
                        case 'I':
                            totalI++;
                            break;
                    }
                    x[i, j, 0] = i == 0 ? totalJ : (x[i - 1, j, 0] + totalJ);
                    x[i, j, 1] = i == 0 ? totalO : (x[i - 1, j, 1] + totalO);
                    x[i, j, 2] = i == 0 ? totalI : (x[i - 1, j, 2] + totalI);
                }
            }

            for (int i = 0; i < K; i++)
            {
                line = Console.ReadLine();
                input = line.Split(' ');
                int a = Int32.Parse(input[0]) - 1;
                int b = Int32.Parse(input[1]) - 1;
                int c = Int32.Parse(input[2]) - 1;
                int d = Int32.Parse(input[3]) - 1;
                int J = x[c, d, 0] - (a > 0 ? x[a - 1, d, 0] : 0) - (b > 0 ? x[c, b - 1, 0] : 0) + (a > 0 && b > 0 ? x[a - 1, b - 1, 0] : 0);
                int O = x[c, d, 1] - (a > 0 ? x[a - 1, d, 1] : 0) - (b > 0 ? x[c, b - 1, 1] : 0) + (a > 0 && b > 0 ? x[a - 1, b - 1, 1] : 0);
                int I = x[c, d, 2] - (a > 0 ? x[a - 1, d, 2] : 0) - (b > 0 ? x[c, b - 1, 2] : 0) + (a > 0 && b > 0 ? x[a - 1, b - 1, 2] : 0);
                Console.WriteLine("" + J + " " + O + " " + I);
            }
        }
    }
}

Measured memory_bytes: 26912
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
ll fac[1005],dp[1005][1005];
ll pow2(ll a,ll b){
	ll res=1;
	while(b){
		if(b&1) res=res*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return res;
}
ll get_inv(ll x){
	return pow2(x,mod-2);
}
ll getP(int n,int m){
	return fac[n]*get_inv(fac[n-m])%mod;
}
int main(){
	int N,A,B,C,D;
	scanf("%d%d%d%d%d",&N,&A,&B,&C,&D);
	fac[0]=1;
	for(int i=1;i<=N;i++)
		fac[i]=fac[i-1]*i%mod;
	dp[A-1][0]=1;
	for(int i=A;i<=B;i++){
		for(int j=0;j<=N;j++)
			dp[i][j]=dp[i-1][j];
		for(int k=C;k<=D;k++){
			for(int j=i*k;j<=N;j++){
				dp[i][j]=(dp[i][j]+(dp[i-1][j-i*k]*getP(j,i*k)%mod)*get_inv(pow2(fac[i],k)*fac[k]%mod)%mod)%mod;
			}
		}
	}
	printf("%lld\n",dp[B][N]);
	return 0;
}

Measured memory_bytes: 8064
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main(){
    ll n;
    cin>>n;
    cout<<n*(n-1)/2<<endl;
    return 0;
}

Measured memory_bytes: 256
import numpy as np
H, W = list(map(int, input().split()))
l = []
for h in range(H):
    l.append(list(input()))
nl = np.array(l)

t = np.all(nl == ".", axis=1)
dl = []
for i, f in zip(range(len(t) + 1), t):
    if f:
        dl.append(i)
nl = np.delete(nl, dl, axis=0)

dl = []
t = np.all(nl == ".", axis=0)
for i, f in zip(range(len(t) + 1), t):
    if f:
        dl.append(i)
nl = np.delete(nl, dl, axis=1)

for s in nl:
    print("".join(s))

Measured memory_bytes: 14536
#include<bits/stdc++.h>
using namespace std;
# define pb push_back
# define FOR(i,a,n) for(int i=a;i<n;i++)
# define mp make_pair
# define RFOR(i,a,n) for(int i=n;i>a;i--)
# define pii pair<long long int,long long int>
#define ub upper_bound
#define lb lower_bound
#define MOD 1000000007
typedef long long int ll;
ll mark[1000009];
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
    cout.tie(0);
	ll n;
	cin>>n;
	ll arr[n];
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
		mark[arr[i]]++;
	}
	ll cnt=0;
	ll ans=0;
	for(int i=0;i<n;i++)
	{
		ll k=arr[i];
		mark[arr[i]]--;
		ll w;
		cnt=0;
		for(int j=1;j*j<=k;j++)
		{
			w=k/j;
			if(j*w==k)
			{
				if(mark[j]>0||mark[w]>0)
				{
					cnt++;
				}
			}
		}
		mark[arr[i]]++;
		if(cnt==0)
		ans++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 12984
fun main() {
  val mx = sortedSetOf<Pair<Int, Int>>(compareBy<Pair<Int, Int>> { it.first }.thenBy { it.second })
  val my = sortedSetOf<Pair<Int, Int>>(compareBy<Pair<Int, Int>> { it.first }.thenBy { it.second })
  val (n, q) = readLine()!!.split(" ").map { it.toInt() }
  var m = (n - 2L) * (n - 2L)
  repeat(q) {
    val (t, x) = readLine()!!.split(" ").map { it.toInt() }
    if (t == 1) {
      var p = my.higher(x to 0)
      val h = p?.let { p.second } ?: n
      m -= h - 2
      mx.add(h to x)
    } else {
      var p = mx.higher(x to 0)
      val h = p?.let { p.second } ?: n
      m -= h - 2
      my.add(h to x)
    }
  }
  println(m)
}

Measured memory_bytes: 81864
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#define int long long
#define mod 1000000007
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
using namespace std;
int n, c[123456], ans = 1;
signed main() {
	cin >> n;
	c[0] = 3;
	for0(i, n) {
		int k; cin >> k; k++;
		c[k]++;
		ans *= c[k - 1] - (c[k] - 1);
		ans %= mod;
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024