akhauriyash/Code-Regression huggingface dataset:
import java.util.Arrays;
import java.util.Scanner;

public class Main{

	final static int MAX = 300000;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		// 目的の大きさよりも大きいものを作る
		boolean[] s = new boolean[MAX];
		Arrays.fill(s, true);

		s[0] = false;
		s[1] = false;

		//エラトステネスの篩
		for (int i = 2; i * i < MAX; i++) {
			if (s[i]) {
				for (int j = i + i; j < MAX; j += i) {
					if (j % i == 0) {
						s[j] = false;
					}
				}
			}
		}

		// System.out.println(s[17]);
		// System.out.println(s[19]);
		// System.out.println(s[23]);

		while (true) {
			int n = sc.nextInt();

			if (n == 0) {
				break;
			}

			int cnt = 0;

			for (int i = n + 1; i <= 2 * n; i++) {
				if (s[i]) {
					cnt++;
				}
			}

			System.out.println(cnt);

		}

	}
}

Measured memory_bytes: 22640
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;


int main(){
  int a;
  cin >>a;
  cout <<a+(a*a)+(a*a*a)<<endl;
}  

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
typedef double DOUBLE;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1
#define j0 gray_cat_j0

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const ll LL_INF = 1e17 + 16;
const int INF = 1e9 + 10;
const ll MOD = 1e9 + 7;

const int MAXN = (1 << 18) + 55, MAXD = 1 << 10, MAXL = 1e5 + 1;

vector<pii> pp_v[MAXD];
pii tmp[MAXN];
int top;

int v[MAXN], w[MAXN];

void solve(){
	int n;
	scanf("%d", &n);
	REPN(i, 1, n) {
		scanf("%d%d", &v[i], &w[i]);
	}
	
	pp_v[0].pb(mp(0, 0));
	REP(i, 1, MAXD) {
		pp_v[i] = pp_v[i / 2];
		REP(j, 0, SZ(pp_v[i / 2])) {
			if (pp_v[i / 2][j]._1 + w[i] <= MAXL) {
				pp_v[i].pb(mp(pp_v[i / 2][j]._1 + w[i], pp_v[i / 2][j]._2 + v[i]));
			}
		}
	}
	
	REP(i, 1, MAXD) {
		SORT(pp_v[i]);
		REP(j, 1, SZ(pp_v[i])) {
			pp_v[i][j]._2 = max(pp_v[i][j]._2, pp_v[i][j - 1]._2);
		}
	}
	
	int q;
	scanf("%d", &q);
	REP(i, 0, q) {
		int pos, lim;
		scanf("%d%d", &pos, &lim);
		if (pos < MAXD) {
			int ind = upper_bound(pp_v[pos].begin(), pp_v[pos].end(), mp(lim, INF)) - pp_v[pos].begin() - 1;
			printf("%d\n", pp_v[pos][ind]._2);
			continue;
		}
		int top = 1;
		tmp[0] = mp(0, 0);
		for(; pos >= MAXD; pos /= 2) {
			int old_top = top;
			REP(j, 0, old_top) {
				if (tmp[j]._1 + w[pos] <= lim) {
					tmp[top++] = mp(tmp[j]._1 + w[pos], tmp[j]._2 + v[pos]);
				}
			}
		}
		sort(tmp, tmp + top);
		REP(j, 1, top) {
			tmp[j]._2 = max(tmp[j]._2, tmp[j - 1]._2);
		}
		int ans = 0;
		/*printf("*********************\n%d\n", lim);
		REP(j, 0, SZ(pp_v[pos])) {
			printf("%d %d\n", pp_v[pos][j]._1, pp_v[pos][j]._2);
		}
		REP(j, 0, top) {
			printf("%d %d\n", tmp[j]._1, tmp[j]._2);
		}*/
		for(int i1 = 0, j1 = SZ(pp_v[pos]) - 1; i1 < top; i1++) {
			for(; j1 >= 0 && pp_v[pos][j1]._1 + tmp[i1]._1 > lim; j1--);
			if (j1 >= 0) {
				ans = max(ans, pp_v[pos][j1]._2 + tmp[i1]._2);
			}
		}
		printf("%d\n", ans);
	}
}

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 11056
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repl(i, l, r) for (ll i = (l); i < (r); i++)
#define per(i, n) for (ll i = n - 1; i >= 0; i--)
#define lper(i, r, l) for (ll i = r - 1; i >= l; i--)
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define CST(x) cout << fixed << setprecision(x)
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pl = pair<ll, ll>;
const ll MOD = 1000000007;
const int inf = 1e9 + 10;
const ll INF = 4e18;
const ll dy[4] = {1, 0, -1, 0};
const ll dx[4] = {0, -1, 0, 1};
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	double r;
	cin >> r;
	CST(10) << r * 2 * M_PI << endl;
	return 0;
}

Measured memory_bytes: 3796
#include <assert.h>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <bitset>
typedef long long ll;
typedef unsigned long long ull;

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define DEBUG(vec) for (auto v : vec) { cout << v << " "; } cout << endl;

using namespace std;

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

  int N, A;
  cin >> N >> A;

  cout << N * N - A << endl;
  return 0;
}


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

vector<int64_t> dsy(vector<int64_t>dis,vector<vector<pair<int64_t,int64_t>>> g,int64_t start,int64_t goal){
    int n=dis.size();
    priority_queue<pair<int64_t,int64_t>,vector<pair<int64_t,int64_t>>,greater<pair<int64_t,int64_t>>> Q;
    dis[start]=0;
    Q.push(make_pair(0,start));

    while(!Q.empty()){
        int pos=Q.top().second;Q.pop();
        for(int i=0;i<g.at(pos).size();i++){
            int to=g.at(pos).at(i).first;
            int cost=g.at(pos).at(i).second;
            if(dis[to]==-1||dis[to]>dis[pos]+cost){
                dis[to]=dis[pos]+cost;
                Q.push(make_pair(dis[to],to));
            }
        }
    }
    return dis;
}

int64_t dss(vector<int64_t>dis,vector<vector<pair<int64_t,int64_t>>> g,int64_t start,int64_t goal){
    int n=dis.size();
    priority_queue<pair<int64_t,int64_t>,vector<pair<int64_t,int64_t>>,greater<pair<int64_t,int64_t>>> Q;
    dis[start]=0;
    Q.push(make_pair(0,start));

    while(!Q.empty()){
        int pos=Q.top().second;Q.pop();
        for(int i=0;i<g.at(pos).size();i++){
            int to=g.at(pos).at(i).first;
            int cost=g.at(pos).at(i).second;
            if(dis[to]==-1||dis[to]>dis[pos]+cost){
                dis[to]=dis[pos]+cost;
                Q.push(make_pair(dis[to],to));
            }
        }
    }
    return dis[goal];
}

int main(){
    int64_t n,m,s,t; cin>>n>>m>>s>>t;
    int64_t money=pow(10,15);

    vector<vector<pair<int64_t,int64_t>>>gy(n),gs(n);
    vector<int64_t> dis(n,-1);
    vector<int64_t> dis2(n,-1);

    for(int i=0;i<m;i++){
        int u,v,a,b;
        cin>>u>>v>>a>>b;
        gy.at(u-1).push_back(make_pair(v-1,a));
        gy.at(v-1).push_back(make_pair(u-1,a));
        gs.at(u-1).push_back(make_pair(v-1,b));
        gs.at(v-1).push_back(make_pair(u-1,b));
    }

    dis=dsy(dis,gy,s-1,t-1);//sから各国への円の合計
    dis2=dsy(dis2,gs,t-1,s-1);//tから各国へのすぬけの合計
    vector<int64_t> dis_min(n);
    dis_min.at(n-1)=dis[n-1]+dis2[n-1];

    for(int i=n-2;i>=0;i--){
        dis_min[i]=min(dis[i]+dis2[i],dis_min[i+1]);
    }

    for(int i=0;i<n;i++){
        cout<<money-dis_min[i]<<endl;
    }
    /*
    for(int i=0;i<n;i++){//各年でのループ
        int64_t result=pow(10,16);
        for(int j=0;j<n;j++){
            result=min(result,dis[i]+dis2[i]);
        }
        
        for(int j=i;j<n;j++){//どの国で両替するか
            int64_t disj=dis[j];
            int64_t dssj=dss(dis2,gs,j,t-1);
            if(disj==-1||dssj==-1) continue;
            int64_t sum=disj+dssj;
            //cout << disj<<" "<<dssj<<" "<<sum << endl;
            result=min(result,sum);
        }
        cout << money-result << endl;
    }*/
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  int64_t res = 0;
  map<int, int> mp;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    res += a;
    mp[a]++;
  }
  int Q;
  cin >> Q;
  for (int i = 0; i < Q; i++) {
    int64_t from, to;
    cin >> from >> to;
    res -= from * mp[from];
    res += to * mp[from];
    mp[to] += mp[from];
    mp[from] = 0;
    cout << res << '\n';
  }
  return 0;
}


Measured memory_bytes: 8052
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890123456789LL
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) ((x < 0)?-(x):x)
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

typedef long long cat;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int N;
	string S;
	cin >> N >> S;
	vector<int> ans[3][3];
	for(int i =0; i < 9; i++) ans[i/3][i%3].resize(N+1,0);
	int last0 =-1, nxt0 =0;
	for(int i =0; i < N; i++) if(S[i] == '0') {
		nxt0 =max(nxt0,i+1);
		while(nxt0 < N && S[nxt0] != '0') nxt0++;
		for(int j =0; j < 9; j++) ans[2][j/3][i+1] =max(ans[2][j/3][i+1],ans[j%3][2][last0+1]);
		if(i == 0 || S[i-1] == '0') {
			last0 =i;
			continue;
		}
		if(i == N-1 || S[i+1] == '0') {
			last0 =i;
			continue;
		}
		// to the left
		for(int j =0; j < 3; j++) {
			if(j != 2 && nxt0 == i+2) continue;
			ans[0][j][i+1] =max(ans[0][j][i+1],ans[2][0][last0+1]+i-1-last0);
			if(last0 != i-2) ans[0][j][i+1] =max(ans[0][j][i+1],ans[0][0][last0+1]+i-2-last0);
		}
		// to the right
		for(int j =0; j < 3; j++) {
			if(j != 2 && last0 == i-2) continue;
			ans[1][2][i+1] =max(ans[1][2][i+1],ans[j][1][last0+1]+nxt0-i-1);
			if(nxt0 != i+2) ans[1][1][i+1] =max(ans[1][1][i+1],ans[j][1][last0+1]+nxt0-i-2);
		}
		last0 =i;
	}
	int ansF =0;
	for(int i =0; i < 9; i++) for(int j =0; j <= N; j++) ansF =max(ansF,ans[i/3][i%3][j]);
	cout << ansF << "\n";
	return 0;}

// look at my code
// my code is amazing


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

const int INF = 1001001001;//全て条件を満たさないときの無限大値
int a[12][12];//二次元配列設定

int main() {
  int n,m,x;
  cin >> n >> m >> x;

  vector<int> c(n);//配列に登録

  rep(i,n) {
    cin >> c[i];//コストの登録
    rep(j,m) cin >> a[i][j];//習熟度の登録
  }

  //二進数で問題を解く。シフト演算で1を左にずらして全検索
  int ans = INF;
  rep(s,1<<n) { //シフト演算で1を左にずらして全検索
    int cost = 0;
    vector<int> d(m);

    rep(i,n) {
      if (s>>i&1) {
        cost += c[i];
        rep(j,m) d[j] += a[i][j];//習熟度の加算
      }
    }
    bool ok = true;
    rep(j,m) if (d[j] < x) ok = false;//習熟度が条件以下のものを除外する
    if (ok) ans = min(ans,cost);
  }
  if (ans == INF) cout << -1 << endl;
  else cout << ans << endl;
}


Measured memory_bytes: 3632
import heapq
N, M = map(int, input().split())
A_list = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(A_list)
for i in range(M):
    max_num = heapq.heappop(A_list) * (-1)
    heapq.heappush(A_list, (-1) * (max_num // 2))
print((-1) * sum(A_list))



Measured memory_bytes: 20272
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,a,b) for(int i=(a);i<(b);++i)

template<class T> inline void chmin(T& a, T b) {if (a > b) a = b;}
template<class T> inline void chmax(T& a, T b) {if (a < b) a = b;}

//vector出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){
  o<<"{";
  for(int i=0;i<(int)v.size();i++) o << (i>0?", ":"") << v[i];
  o<<"}"<<endl;
  return o;
}

//逆元　a/b の modをとるとき -> a*modinv(b)%mod
long long modinv(long long a, long long m = 1e9+7) {
  long long b = m, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m; 
  if (u < 0) u += m;
  return u;
}
ll const mod = 1e9+7;

// combination
const int MAX = 510000;
const ll MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

// べき乗
ll modpow(ll x, ll n) {
    x = x%MOD;
    if(n==0) return 1;  //再帰の終了条件

    else if(n%2==1) {
        return (x*modpow(x, n-1))%MOD;  //nが奇数ならnを1ずらす
    }
    else return modpow((x*x)%MOD, n/2)%MOD;  //nが偶数ならnが半分になる
}

int main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  rep(i,N) cin >> A[i];
  sort(A.begin(),A.end());
  int l=0,r=N-1;
  ll ans=0;
  if (N%2==0) {
    rep(i,N/2){
      ans -= 2*A[i];
    }
    rep2(i,N/2,N){
      ans += 2*A[i];
    }
    ans = ans-A[N/2]+A[N/2-1];
  }

  else {
    rep(i,N/2){
      ans -= 2*A[i];
    }
    rep2(i,N/2,N){
      ans += 2*A[i];
    }
    ans = ans - A[N/2] - A[N/2+1];

    ll tans = 0;
    rep(i,N/2+1){
      tans -= 2*A[i];
    }
    rep2(i,N/2+1,N){
      tans += 2*A[i];
    }
    tans = tans + A[N/2] + A[N/2-1];
    chmax(ans,tans);
  }

  cout << ans << endl;
}


Measured memory_bytes: 4032
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>
#include<deque>
#include<random>
#include<set>

using namespace std;
typedef long long ll;
typedef double lldo;
#define mp make_pair
#define pub push_back
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else  return gcd(b, a % b); }
ll lcm(ll a, ll b) { if (a == 0) { return b; }return a / gcd(a, b) * b; }
template<class T>ll LBI(vector<T>& ar, T in) { return lower_bound(ar.begin(), ar.end(), in) - ar.begin(); }
template<class T>ll UBI(vector<T>& ar, T in) { return upper_bound(ar.begin(), ar.end(), in) - ar.begin(); }

ll N, a[101] = {}, b[101] = {}, c[101] = {}, d[101] = {};

template<typename T>
struct FordFulkerson {
	//辺
	struct edge
	{
		//行先と逆辺、revはid参照されているので、
		//追加された順に1,2,3,...となっている
		int to, rev;
		//cap は capacityの略
		T cap;
		edge(int to, T cap, int rev) :to(to), cap(cap), rev(rev) {};
	};

	const T INF;
	int timestamp;

	//グラフと探索済みかの配列
	vector<vector<edge>> graph;
	vector<int> used;

	FordFulkerson(int n) :INF(numeric_limits<T>::max()), timestamp(0) {
		graph.resize(n);
		used.assign(n, -1);
	}

	void add_edge(int from, int to, T cap) {
		//from ~ toにcapの辺を通す
		graph[from].emplace_back(to, cap, int(graph[to].size()));
		//to~from　に0容量の辺を通す
		graph[to].emplace_back(from, 0, int(graph[from].size()) - 1);
	}

	//ただのdfs探索
	//これは一本のパスについてflowを返していく
	T dfs(int v, const int t, T flow) {
		//終了地点にきたらflowを返す
		if (v == t) return flow;
		//探索済み
		used[v] = timestamp;

		for (auto& e : graph[v]) {
			//流す余地があって未探索
			if (e.cap > 0 and used[e.to] != timestamp) {
				//このノード以降のフローを求める
				T d = dfs(e.to, t, min(flow, e.cap));
				if (d > 0) {
					e.cap -= d;
					graph[e.to][e.rev].cap += d;
					return d;
				}
			}
		}
		//ここにたどり着くのは増加パスがない時
		return 0;
	}

	T max_flow(int s, int t) {
		T flow = 0;
		while (1) {
			//これは2回目の探索ならused[v]=1で2回目の探索、となっている。
			T f = dfs(s, t, INF);
			//cout << f << endl;
			//増加する限り続行
			if (f == 0) return flow;
			flow += f;
			timestamp++;
		}
	}
};

int main() {
	cin >> N;
	FordFulkerson<ll> ff(2 * N + 2);
	for (int i = 1; i <= N; i++) {
		cin >> a[i] >> b[i];
		ff.add_edge(0, i, 1);
	}
	for (int i = 1; i <= N; i++) {
		cin >> c[i] >> d[i];
		ff.add_edge(i + N, 2 * N + 1, 1);
	}
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) {
			if (a[i] < c[j] && b[i] < d[j])ff.add_edge(i, j + N, 1);
		}
	}
	cout << ff.max_flow(0, 2 * N + 1) << endl;
	return 0;
}

Measured memory_bytes: 384
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


# --------------------------------------------

dp = None


def main():
    A, B = li_input()

    if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0:
        print("Possible")
    else:
        print("Impossible")


main()


Measured memory_bytes: 4724
import math
A,B,H,M = map(int,input().split())

tmp = M * 0.5
if H == 0:
    H = 12
if M == 0:
    M = 60

h = H*30
m = (M/5)*30

if h >= m:
    rad = (h+tmp)-(m)
else:
    rad = (m)-(h+tmp)

ans = A**2 + B**2 - 2*A*B*(math.cos(math.radians(rad)))
print(ans**0.5)


Measured memory_bytes: 9520
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, b) for (int i = 0; i < (b); i++ )

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

const int INF = 100000000;
const double PI=acos(-1);

int main(){
    ll H,N;
    cin >> H >> N;
    ll A[N],B[N];
    rep(i,N) {
        cin >> A[i] >> B[i];
    }
    vector<vector<ll>> dp(N+1,vector<ll>(H+1,INF));

    dp[0][0] = 0;

    rep(i,N) {
        rep(j,H+1) {
            
            dp[i+1][j] = min(dp[i][j],dp[i+1][max((ll)0,j-A[i])]+B[i]);

        }
    }
    cout << dp[N][H] << endl;
}


Measured memory_bytes: 78592
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
 
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
 
using namespace std;

signed main()
{
    fast;
    string s;
    cin>>s;

    if ( (s[2] == s[3]) && (s[4] == s[5]) )
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    return 0;
}

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  __MAKE_TIME__  Problem: __PROBLEM__ / Link: __CONTEST_URL__  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

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

	int N; cin >> N;
	string s; cin >> s;
	FOR(i, 0, N-1) {
		string a = s.substr(0, i+1);
		string b = s.substr(i+1);
		auto f = [](string s) {
			LL val = 0;
			FOR(i, 0, SZ(s)) {
				val |= 1LL << (s[i] - 'a');
			}
			return val;
		};
		LL A = f(a);
		LL B = f(b);
		LL C = A & B;
		ans = max(ans, __builtin_popcount(C));
	}
	
	
	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
inline ll read(){char ch=getchar();ll f=1;while(ch<'0'||ch>'9'){if(ch=='-')f=-f;ch=getchar();}
	ll x=0;while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();return x*f;}
const ll P=1000000007;
map<ll,ll>dp;
ll akioi(ll p){
    if(dp[p]!=0)return dp[p];
    else return dp[p]=(akioi(p/2)+akioi((p-1)/2)+akioi((p-2)/2))%P;
}
int main(){
	dp[0]=1;dp[1]=2;
	cout<<akioi(read());
	return 0;
}

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

int main() {
  int n;
  vector<char> p;
  vector<int> x;
  int count = 0;

  cin >> n;
  for(int i = 0; i < n; i++) {
    char P;
    int X;
    cin >> P >> X;
    p.push_back(P);
    x.push_back(X);
  }

  if(p[0] == ')') {
    cout << "NO" << endl;
    return 0;
  }

  for(int i = 0; i < n; i++) {
    if(p[i] == '(')
      count += x[i];
    else if (p[i] == ')') {
      if(count < x[i]) {
        cout << "NO" << endl;
        return 0;
      }
      count -= x[i];
    }
  }

  if(count == 0)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}



Measured memory_bytes: 3144
#!/usr/bin/env python3
import sys, math, fractions, itertools, collections, copy, heapq


def solve(s: str):
    mn = 1e18
    for i in range(ord('a'), ord('z')+1):
        t = list(s)
        counter = 0
        while len(set(t)) > 1:
            for j, ss in enumerate(t[:-1]):
                if chr(i) == t[j+1]:
                    t[j] = t[j+1]
            t = t[:-1]
            counter += 1
        mn = min(counter, mn)
    print(mn)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    s = next(tokens)  # type: str
    solve(s)

if __name__ == '__main__':
    main()


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

using namespace std;

int main() {
  long long n, d;
  cin >> n >> d;
  int ans = 0;
  while(n--) {
	long long x, y;
    cin >> x >> y;
    if(x * x + y * y <= d * d) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
using namespace std;

int arr[200010];

int main()
{
    int k,n;
    int flag;

    cin>>k>>n;

    for(int i=0; i<n; i++)
    {
        cin>>arr[i];
    }

    flag=arr[0]+k-arr[n-1];

    for(int j=0; j<n; j++)
    {
        flag=max(flag,arr[j+1]-arr[j]);

    }
    cout<<k-flag<<endl;
    return 0;
}



Measured memory_bytes: 4376
//ITNOA
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
typedef long long ll;
const ll INF=1e9+10,MAX=2e5+1e4,MOD=1e9+7,MAXL=25;
typedef pair<ll,ll> pii;
typedef pair<pii,ll> piii;
void OUT(long double o,int x){
	 cout<<fixed<<setprecision(x)<<o;
	 return;
}
ll a[MAX];
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n,m;
	cin>>n>>m;
	if(n==1&&m==1)
		cout<<1;
	else if(n==1)
		cout<<m-2;
	else if(m==1)
		cout<<n-2;
	else
		cout<<(n-2)*(m-2);
	return 0;
}


Measured memory_bytes: 256
from collections import deque

class process():
    def __init__(self, name, ptime):
        self.name = name
        self.ptime = ptime

def main():
    n, q = map(int, input().split())
    w_queue = deque()

    for _ in range(n):
        name, ptime = input().split()
        p = process(name, int(ptime))
        w_queue.append(p)

    t = 0

    while True:
        p = w_queue.popleft()
        
        if p.ptime <= q:
            print(p.name, str(t + p.ptime))
            t += p.ptime
        else:
            p.ptime -= q
            w_queue.append(p)
            t += q
       
        if len(w_queue) == 0:
            break
        
main()


Measured memory_bytes: 17728
n,m = list(map(int,input().strip().split()))

grid = []
for i in range(m):
  array = list(map(int, input().strip().split()))
  grid.append(array)
  
for i in range(1,n+1):
  road = 0
  for j in grid:
    if i in j:
      road +=1
  print(road)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)x.size())
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
template<class T> inline void read(T &x){
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
template<class T> inline void umin(T &x, T y){x=x<y?x:y;}
template<class T> inline void umax(T &x, T y){x=x>y?x:y;}
inline ui R() {
	static ui seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}
int n;char s[5][66666];
int cnt[533];
int main() {
	read(n);
	rep(i,1,3)scanf("%s",s[i]+1);int res=0;
	rep(i,1,n){
		memset(cnt,0,sizeof(cnt));
		rep(j,1,3)cnt[s[j][i]]++;int mx=0;
		rep(j,0,500)umax(mx,cnt[j]);
		res+=3-mx;
	}
	cout<<res;
	return 0;
}


Measured memory_bytes: 256
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();
        int c = sc.nextInt();
        
        System.out.println(b-a==c-b?"YES":"NO");
    }
}


Measured memory_bytes: 21204
#include "bits/stdc++.h"
using namespace std;
#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define PI 3.1415926535
typedef long long ll;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<Pll> vPll;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<double>> vvd;
typedef vector<vector<Pi>> vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
string YN(bool y) { return (y?"YES":"NO"); }
string yn(bool y) { return (y?"Yes":"No"); }
string ON(bool y) { return (y?"OK":"NG"); }
vvi tree(100010);
bool visited[100000]={};
int prev_node[100000], n_cost, n;
void DFS(int i, int cost)
{
	visited[i]=true;

	if(i==n-1) n_cost=cost;

	rep(j, tree[i].size()){
		if(visited[tree[i][j]]) continue;
		prev_node[tree[i][j]]=i;
		DFS(tree[i][j], cost+1);
	}
}
int main(void)
{
	cin>>n;

	rep(i, n-1){
		int a, b;
		cin>>a>>b;
		tree[a-1].push_back(b-1);
		tree[b-1].push_back(a-1);
	}
	prev_node[0]=-1;
	rep(i, n) visited[i]=false;

	DFS(0, 0);

	int j=n-1, cnt=0;
	while(1){
		cnt++;
		if(cnt>=(int)(n_cost/2+n_cost%2)) break;
		j=prev_node[j];
	}
	rep(k, tree[j].size()){
		if(tree[j][k]==prev_node[j]){
			tree[j].erase(tree[j].begin()+k);
		}
	}
	rep(k, tree[prev_node[j]].size()){
		if(tree[prev_node[j]][k]==j){
			tree[prev_node[j]].erase(tree[prev_node[j]].begin()+k);
		}
	}
	rep(i, n) visited[i]=false;

	DFS(0, 0);

	int ans=0;
	rep(i, n){
		if(visited[i]) ans++;
	}
	if(ans>n-ans){
		cout<<"Fennec"<<endl;
	}else{
		cout<<"Snuke"<<endl;
	}
}

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

int main(){
  string Number;
  while(1){
    cin >> Number;
    if(atoi(Number.c_str()) == 0)break; 
    long Len=Number.size();
    int N[11][Len];
    string str;
    for(int m=0;m<Len;++m){
      for(int n=0;n<11;++n){
	N[n][m]=0;
      }
    }
    str=Number[0];
    if(atoi(str.c_str())!=0)N[atoi(str.c_str())][0]=1;
    for(int n=1;n<Len;++n){
      str=Number[n];
      int k=atoi(str.c_str());
      if(k!=0)N[k][n]+=1;
      for(int m=0;m<11;++m){
	if(N[m][n-1]!=0){
	  N[(m*10+k)%11][n]+=N[m][n-1];
	}
      }
    }
    int Ans=0;
    for(int n=0;n<Len;++n){
      Ans+=N[0][n];
    }
    cout << Ans << endl;
  }
}

Measured memory_bytes: 4760
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n-1); i >= 0; i--)
#define all(v) (v).begin(),(v).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
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 (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a/gcd(a,b)*b; }
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
	int n;
	cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    ll ans = 1000;
    rep(i,n-1) {
        ll stock = 0;
        if(a[i]<a[i+1]) stock = ans / a[i];
        ans += (a[i+1] - a[i]) * stock;
    }
    cout << ans << "\n";
	return 0;
}


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

int cmp(const void *a,const void *b){
    return *(int*)a-*(int*)b;
}

int main(){
    int n,s;
    scanf("%d",&n);
    int d[n];
    for(int i=0;i<n;i++){
        scanf("%d",&d[i]);
    }
    qsort(d,n,sizeof(int),cmp);
    s=d[n/2]-d[(n/2)-1];
    if(s==0){
        printf("0\n");
        exit(0);
    }
    else{
        printf("%d\n",s);
    }
    return 0;
}


Measured memory_bytes: 892
//----------ACCIDENTAL COMPETITIVE PROGRAMMER---------------------

#include<bits/stdc++.h>

/*
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
*/
using namespace std;

#define LL long long
#define LD long double
#define PB push_back
#define MP make_pair


const LL MOD = (1e9) + 7 ;
const LD EPS = 0.0000001 ;

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

    int n; cin >> n;
    int m; cin >> m;
    vector<int> arr[m + 1];
    for (int i = 1; i <= m; i++){
    	int t; cin >> t;
    	for (int j = 0; j < t; j++){
    		int x; cin >> x;
    		arr[i].PB(x);
    	}
    }

    int cnt[m + 1];
    for (int i = 1; i <= m; i++)
    	cin >> cnt[i];
    for (int i = 1; i <= m; i++)
    	cnt[i] = cnt[i] % 2;
    
    int ans = 0;
    for (int i = 0; i < (1<<n); i++){
    	int tot[n + 1];
    	for (int j = 0; j <= n; j++)
    		tot[j] = 0;
    	for (int j = 0; j < n; j++){
    		if (i & (1 << j))
    			tot[j + 1]++;
    	}
    	bool flag = true;
    	for (int j = 1; j <= m; j++){
    		int temp = 0;
    		for (int k = 0; k < arr[j].size(); k++)
    			temp += tot[arr[j][k]];
    	    temp = temp % 2;
    		if (temp != cnt[j])
    			flag = false;
    	}
    	if (flag){
    	    ans++;
    	}
    }
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define MAX 50004
int dp[MAX], d[MAX];

int main(){
	int n, m = 0;
	static bool c[MAX]={true, true};
	for(int i = 2;i < MAX;i++){
		if(!c[i]){
			for(int j = 2;i*j < MAX;j++)c[i*j] = true;
			d[m++] = i;
		}
	}
	
	for(int i = 0;i < 3000;i++)
		for(int j = i;d[i]+d[j] < MAX-3;j++)
			dp[d[i] + d[j]]++;
	while(cin >> n, n)cout << dp[n] << endl;
	return 0;
}

Measured memory_bytes: 3256
#include<bits/stdc++.h>
using namespace std;
//freopen("input.txt" , "r" , stdin);
//freopen("output.txt" , "w" , stdout);
#define ll            long long
#define endl          '\n'
//ll ans=floor(y*log10(x))+1;   number of digits in x^y
//for(ll i=1;i<1000000;i++)for(ll j=i;j<1000000;j+=i)divisors[j]++;  counting divisors or NOD(1 to N) ..its works like as prime_factorizations...
//for(ll i=1;i<1000000;i++)for(ll j=i;j<1000000;j+=i)sum_of_divisors[j]+=i;  sum of divisors ... sum_of_divisors(6)=1+2+3+6=12......
#define gcd(a, b)        __gcd(a, b)
#define lcm(a, b)        ((a)*((b)/gcd(a,b)))
#define w(x)          ll x;cin>>x;while(x--)
#define IOS           ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i,n)      for(ll i=0;i<n;i++)
#define REP1(i1,n)    for(ll i=1;i<n;i++)
#define pb             push_back
#define mk             make_pair
#define ff             first
#define ss             second
const double pi = acos(-1.0);
#define  mpee            map<ll,ll>
#define  v             vector<ll>
#define  be            begin()
#define  e             end()
#define mod            1000000007
#define Max              100009s
int main()
{
ll t;
cin>>t;
ll a[t];
REP(i,t)cin>>a[i];
ll ans=0;
for(ll i=0;i<t-1;i++)
{
    int  mx=a[i]-a[i+1];
     mx=max(0,mx);
     ans+=mx;
    if(a[i]>a[i+1])a[i+1]=a[i];
}
cout<<ans<<endl;
}
//for(ll i=0;i<len;i++)cout<<v[i]<<" ";
/*

Alhamdulilla...

*/


Measured memory_bytes: 5128
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cstdlib>  
#include<cmath>   
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include<map>
#include<algorithm>
#include<functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<list>
#include<deque>
#include<climits>
#include<typeinfo>
#include<utility>
#define LEN 100005
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(ll i=0;i<n;i++)
#define For(i,m,n) for(int i=m;i<n;i++)
#define FOR(i,m,n) for(ll i=m;i<n;i++)
using namespace std;
using ll = long long;
double pi() { return 3.14; }
int sum(int a, int b) { return a + b; }
int mul(int a, int b) { return a * b; }
ll LGCD(ll x, ll y) { if (x % y == 0) return y;else return LGCD(y, x % y); }
ll LLCM(ll x, ll y) { return x * y / LGCD(x, y); }

int GCD(int x, int y) { if (x % y == 0) return y;else return GCD(y, x % y); }
int LCM(int x, int y) { return x * y / GCD(x, y); }
ll dpc[10000][10000];

//void nCr(ll n, ll r) {
//	ll ans = 1;
//	for (int i = n; i > n - r; --i) {
//		ans = ans * i;
//	}
//	for (int i = 1; i < r + 1; ++i) {
//		ans = ans / i;
//	}
//	printf("%d",ans);
//}

ll combination(ll n, ll r) {
	if (n == r) { return dpc[n][n] = 1; }
	else if (r == 0) { return dpc[n][0] = 1; }
	else if (r == 1) { return dpc[n][1] = n; }
	else if (dpc[n][r]) { return dpc[n][r]; }
	else { return dpc[n][r] = combination(n - 1, r - 1) + combination(n - 1, r); }
}

//cout << fixed << setprecision(10);


int main() {

	int r;
	double l;
	cin >> r;
	l = r * 2 * 3.1415926535;
	cout << l << endl;



	

	return 0;
}


Measured memory_bytes: 3788
N = int(input())
S = input()

from collections import Counter
c = Counter()

for si in S:
    c[si] += 1

# print(c.values())

ans = 1
for n in c.values():
    ans *= n + 1

ans -= 1
ans = ans % (10 ** 9 + 7)
print(ans)

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

using namespace std;

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


Measured memory_bytes: 256
#include <stdio.h>
#define N 100

int main(void){

  int i,j,n,key,k;
  int A[N];

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

  for(i=1;i<=n;i++){
    key = A[i];
    j = i - 1;
    while(j>0 && A[j] >key){
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = key;

    for(k=1;k<=n;k++){
      if(k == n){
	printf("%d\n",A[k]);
      }else{
	printf("%d ",A[k]);
      }
    }
  }
  return 0;
}



Measured memory_bytes: 2064
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>

using ll = long long;
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))

int solve(std::vector<int> &v) {
  if(v.size() == 1)
    return (v[0] - 1) % 2;
  else if(v.size() == 2)
    return (v[0] + v[1]) % 2;
  else {
    ll sum = 0;
    for(int i = 0; i < v.size(); i++)
      sum += v[i];
    if((sum - v.size()) % 2 == 1)
      return 1;
    int odds = 0, pos = 0;
    for(int i = 0; i < v.size(); i++){
      if(1 == v[i])
        return 0;
      else if(v[i] % 2 == 1){
        odds++;
        pos = i;
      }
    }
    if(odds == 1) {
      v[pos]--;
      int gcd = 0;
      for(int i = 0; i < v.size(); i++)
        gcd = std::__gcd(gcd, v[i]);
      for(int i = 0; i < v.size(); i++)
        v[i] /= gcd;
      return !solve(v);
    } else
      return 0;
  }
}

int main() {
  int n;
  std::cin >> n;
  std::vector<int> v(n);
  for(int i = 0; i < n; i++)
    std::cin >> v[i];
  int verdict = solve(v);
  if(verdict == 0)
    std::cout << "Second";
  else
    std::cout << "First";
}


Measured memory_bytes: 3664
#include<iostream>

int main(){
    std::string s; std::cin >> s;
    int diff=1e4;
    for(int i=0; i<s.size()-2; ++i){
        int num=std::stoi(s.substr(i,3));
        num = std::abs(num-753);
        diff = std::min(diff,num);
    }
    std::cout << diff << std::endl;
    return 0;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
long long cnt[1230],n;
void add(int x)
{
	for(int i=2;i*i<=x;i++)
		while(x%i==0)
			cnt[i]++,
			x/=i;
	if(x!=1)cnt[x]++; 
 } 
const int mod=1e9+7;
int main()
{
	cin>>n;
	for(int i=2;i<=n;i++)
		add(i);
	long long ans=1; 
	for(int i=2;i<=n;i++)ans=ans*(cnt[i]+1)%mod;
	cout<<ans;
}

Measured memory_bytes: 256
H, W = map(int,input().split())
S = [input() for _ in range(H)]
ans = "Yes"
for i in range(H-1):
  for j in range(W-1):
    if(S[i][j] == "#"):
      if(i != 0 and S[i-1][j] == "#"):
        continue
      if(i != H and S[i+1][j] == "#"):
        continue
      if(j != 0 and S[i][j-1] == "#"):
        continue
      if(j != W and S[i][j+1] == "#"):
        continue
      ans = "No"
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <cassert>
#include <random>

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

using namespace std;
typedef long long int ll;
const ll INF = 1000000000;
const double PI = acos(-1);
const int mod = 1000000007;


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

    int ans = 0;
    rep(i, n) {
        if ((i + 1) % 2 != 0 && (a[i] % 2) != 0) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3620
#include <stdio.h>

#define SIZE 2000000

int main() {
  static int A[SIZE];
  int H=0;
  int i, l, largest, tmp, n;
  static char com[21], buf[20];
  buf[19]='\n';
  char *p;
  do {
    fgets(com, 20, stdin);
    if (*com == 'i') {
      A[++H] = 0;
      p = com+7;
      do {
        A[H] = A[H]*10+*p-'0';
        p++;
      } while (*p!='\n');

      for (i=H; i>1 && A[i>>1]<A[i];i>>=1) {
        tmp = A[i>>1];
        A[i>>1] = A[i];
        A[i] = tmp;
      }

    } else if (com[1]=='x') { // extract
      n = A[1];
     for (i=18; n>0; n/=10) buf[i--]=(n%10)+'0';
      fputs(buf+i+1, stdout);
      A[1] = A[H];
      i = 1;
      do {
        l = i<<1;
        if (l < H && A[l] > A[i])        largest = l;
        else         largest = i;
        if (l+1 < H && A[l+1] > A[largest])  largest = l+1;
        if (largest == i) break;
        tmp = A[i];
        A[i] = A[largest];
        A[largest] = tmp;
        i = largest;
      } while (1);
      H--;
    }
  } while (com[2]!='d');
  return 0;
}


Measured memory_bytes: 5528
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

int N;
int X,Y;

vector<vector<int>> g;

void bfs(int st,vector<int> &dist){
  queue<int> Q;
  Q.push(st);
  rep(i,N) dist[i]=MOD;
  dist[st]=0;
  while(!Q.empty()){
    int now=Q.front();
    Q.pop();

    for(auto nex:g[now]){
      if(dist[nex]==MOD){
        dist[nex]=dist[now]+1;
        Q.push(nex);
      }
    }
  }
}

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

  cin>>N;
  cin>>X>>Y;
  X--;Y--;

  g.resize(N);
  rep(i,N-1){
    g[i].push_back(i+1);
    g[i+1].push_back(i);
  }
  g[X].push_back(Y);
  g[Y].push_back(X);

  vector<vector<int>> dist(N,vector<int> (N,MOD));
  rep(i,N) bfs(i,dist[i]);

  vector<int> ans(N,0);
  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
      ans[dist[i][j]]++;
    }
  }

  for(int i=1;i<=N-1;i++) cout<<ans[i]<<endl;


  return 0;
}


Measured memory_bytes: 16128
#include <iostream>

using namespace std;

int main() {
    // input 1
    int r, c;
    cin >> r >> c;
    
    // input 2
    int arr[r*c];
    for(int i=0; i<r; i++) {
        for(int ii=0; ii<c; ii++) {
            cin >> arr[c*i + ii];
        }
    }

    // output
    for(int i=0; i<r; i++){
        int sum = 0;
        for(int ii=0; ii<c; ii++){
            cout << arr[c*i + ii] << " ";
            sum += arr[c*i + ii];
        }
        cout << sum << endl;
    }
    int sum_all = 0;
    for(int j=0; j<c; j++) {
        int sum = 0;
        for(int jj=0; jj<r; jj++) {
            sum += arr[c*jj + j];
        }
        cout << sum << " ";
        sum_all += sum;
    }
    cout << sum_all << endl;
}


Measured memory_bytes: 3172
///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=100005;
const int mxw=1e5+5;
const int mxn=(1<<18)+10;
const int magic=(1<<9);
int v[mxn],w[mxn];
int dp[magic][mxw];
int ses(int x,int l)
{
    if(x<magic)return dp[x][l];
    vector<pi>vec;
    while(x>=magic)
    {
        vec.pb(mp(w[x],v[x]));
        x>>=1;
    }
    int sz=vec.size();
    int ret=0;
    int tmp=(1<<sz);
    for(int msk=0;msk<tmp;msk++)
    {
         int sw=0,sv=0;
         for(int j=0;j<sz;j++)
         {
             if((msk>>j) & 1)
             {
                 sw+=vec[j].fi;
                 sv+=vec[j].si;
             }
         }
         if(sw<=l)
         {
             ret=max(ret,sv+dp[x][l-sw]);
         }
    }

    return ret;
}
 main()

{
    fast
    int n;
    cin>>n;
    f(i,1,n)
    {
        cin>>v[i]>>w[i];
    }
    for(int i=1;i<magic && i<=n;i++)
    {
        for(int j=1;j<mxw;j++)
        {
            dp[i][j]=dp[i>>1][j];
            if(w[i]<=j)
            {
                dp[i][j]=max(dp[i][j],v[i]+dp[i>>1][j-w[i]]);
            }
        }
    }
    int q;
    cin>>q;
    while(q--)
    {
        int x,l;
        cin>>x>>l;
        cout<<ses(x,l)<<"\n";
    }
    return 0;

}





































Measured memory_bytes: 406992
import java.util.*;

class Main{
	public static void main(String[] $){
    Scanner in = new Scanner(System.in);
    int n = in.nextInt();
    int m = in.nextInt();
    int flag = 0;
    
    for(int i  = 0 ; i < n ; i++){
        int nam = in.nextInt();
		if(nam>=m){
		    flag++;
		}
	}
	System.out.print(flag);
}
}

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


int main() {
    ll n; cin>>n;
    ll ans=0;
    rep(i,n){
        if((i+1)%3==0){
            continue;
        }
        if((i+1)%5==0){
            continue;
        }
        ans+=i+1;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3612
from heapq import heappush, heappop

class Dijkstra:
    def __init__(self, N):
        self.N = N # #vertices
        self.E = [[] for _ in range(N)]

    def add_edge(self, init, end, weight, undirected=False):
        self.E[init].append((end, weight))
        if undirected: self.E[end].append((init, weight))
    
    def distance(self, s):
        INF = float('inf')
        E, N = self.E, self.N
        self.dist = dist = [INF] * N # the distance of each vertex from s
        self.prev = prev = [-1] * N # the previous vertex of each vertex on a shortest path from s
        dist[s] = 0
        n_visited = 1 # #(visited vertices)
        heap = []
        heappush(heap, (0, s))
        while heap:
            d, v = heappop(heap)
            if dist[v] < d: continue
            for u, c in E[v]:
                temp = d + c
                if dist[u] > temp:
                    dist[u] = temp; prev[u] = v
                    heappush(heap, (temp, u))
            n_visited += 1
            if n_visited == N: break
        return dist
    
    def shortest_path(self, t):
        P = []
        prev = self.prev
        while True:
            P.append(t)
            t = prev[t]
            if t == -1: break
        return P[::-1]

N, M = map(int, input().split())
edges = [tuple(map(int, input().split())) for _ in range(M)]
S, T = map(int, input().split())
dijkstra = Dijkstra(3 * N)
for a, b in edges:
    a, b = a - 1, b - 1
    dijkstra.add_edge(a, N + b, 0)
    dijkstra.add_edge(N + a, 2 * N + b, 0)
    dijkstra.add_edge(2 * N + a, b, 1)
ans = dijkstra.distance(S - 1)[T - 1]
print(ans if ans != float('inf') else -1)

Measured memory_bytes: 96124