akhauriyash/Code-Regression huggingface dataset:
n = int(input())
card = [input().split() for i in range(n)]
suits ='SHCD'
lsts = [[0 for i in range(13)] for j in range(4)]

for i in range (n):
    for j in range(4):
        if card[i][0] == suits[j]:
            lsts[j][int(card[i][1])-1] += 1
for i in range (4):
    for j in range(13):
        if lsts[i][j] == 0:
            print(suits[i],j+1)



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

int main() {
	// your code goes here
	int n,W;cin>>n>>W;
	long long int a[n][2];
	for(int i=0;i<n;i++){
		cin>>a[i][0]>>a[i][1];
	}
	long long int dp[n+1][W+1];
	memset(dp,0,sizeof(dp));
	for (int i = 0; i <= n; i++) 
   { 
       for (int w = 0; w <= W; w++) 
       { 
           if (i==0 || w==0) 
               dp[i][w] = 0; 
           else if (a[i-1][0] <= w) 
                 dp[i][w] = max(a[i-1][1] + dp[i-1][w-a[i-1][0]],  dp[i-1][w]); 
           else
                 dp[i][w] = dp[i-1][w]; 
       } 
   } 
	cout<<dp[n][W]<<endl;
	return 0;
}

Measured memory_bytes: 79104
#include "bits/stdc++.h"


using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;++i)
#define REP(i,s,n) for(int i=(s);i<(n);++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define REPR(i,s,n) for(int i=(s);i>=(n);--(i))
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define DOUBLE fixed << setprecision(10)
#define fi first
#define se second
const double pi = acos(-1.0);
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef deque<ll> dll;
typedef pair<ll, ll> P;
typedef vector<P> vP;
const ll mod = 1e9 + 7;
ll dx[4] = { 1,0,-1,0 };
ll dy[4] = { 0,1,0,-1 };
template <typename T>
bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
};
template <typename T>
bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
};
void Pvll(vll v) {
	cout << "------------------------------------------------\n";
	rep(i, v.size()) cout << v[i] << " ";
	cout << endl;
	cout << "------------------------------------------------\n";
}
void Pvvll(vvll v) {
	cout << "------------------------------------------------\n";
	rep(i, v.size()) {
		rep(j, v[i].size()) {
			cout << v[i][j] << " ";
		}
		cout << endl;
	}
	cout << "------------------------------------------------\n";
}

void Ps(string s) {
	cout << "------------------------------------------------\n";
	rep(i, s.size()) cout << s[i] << " ";
	cout << endl;
	cout << "------------------------------------------------\n";
}

void Pvs(vs s) {
	cout << "------------------------------------------------\n";
	rep(i, s.size()) {
		rep(j, s[i].size()) {
			cout << s[i][j] << " ";
		}
		cout << endl;
	}
	cout << "------------------------------------------------\n";
}

void Yes(bool x) {
	if (x) cout << "Yes\n";
	else cout << "No\n";
}

void YES(bool x) {
	if (x) cout << "YES\n";
	else cout << "NO\n";
}

void yes(bool x) {
	if (x) cout << "yes\n";
	else cout << "no\n";
}

void Yay(bool x) {
	if (x) cout << "Yay!\n";
	else cout << ":(\n";
}

ll  n, m, r, l, k, h, ans = 0, ret = M;
bool flag = false, flag2 = false, flag3 = false;
string s,t;

void INIT() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << DOUBLE;
}

int main() {
	INIT();
	ll a, b;
	cin >> a >> b;
	if ((a + b) % 2 == 1) cout << "IMPOSSIBLE\n";
	else cout << (a + b) / 2 << endl;


	return 0;
}


Measured memory_bytes: 764
N, M = map(int, input().split())
A = [list(input()) for _ in range(N)]
B = [list(input()) for _ in range(M)]

#スタート地点を動かす
for i in range(N - M + 1):
    for j in range(N - M + 1):
        #あるスタート地点でAにBが含まれるかをチェック
        flag = True
        for x in range(M):
            for y in range(M):
                if A[i + x][j + y] != B[x][y]:
                    flag = False
                    break
            if flag == False:
                break
        if flag == True:
            print ('Yes')
            exit()

print ('No')
                



Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (int i = j; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define n_p(v) next_permutation(v.begin(),v.end())
#define to_ll(b) stoll(b)
#define MOD 1000000007
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp

signed main(){
	int n; cin>>n;
	map<ll,ll> mp;
	//vl vec(n);
	rep(i,0,n){
		ll a; cin>>a;
		if(a%4==0){
			mp[4]++;
		}
		else if(a%2==0){
			mp[2]++;
		}
		else mp[1]++;
		
	}
	string ans="No";
	ll b=mp[2];
	b/=2;
	
	if(n-1<=(mp[4]+b)*2) ans="Yes";
	if(mp[2]==n) ans=="Yes";
	cout<<ans;	
		
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int N;
	ll a[100001];
	ll x=0;
	scan(N);
	rep(i,N){
		scan(a[i]);
		x^=a[i];
	}
	if(x==0) prin("Yes");
	else prin("No");
	return 0;
}


Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<math.h>

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

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

const int mod = 1e9 + 7;
const long double pi = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;

int main() {
	string s;
	cin >> s;
	if ((s[0] == s[1] && s[1] == s[2]) || (s[1] ==s[2] &&  s[2] == s[3])) {
		cout << "Yes";
	}
	else cout << "No";

	system("pause");
	return 0;
}

Measured memory_bytes: 504
#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <map> 
#include<set>
#include<queue>

typedef long long ll;


#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;

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

const long long INF = 1000000000000000;
const ll inf = -1e18;
typedef pair<ll, ll> P;
ll ma = 1000000000 + 7;
ll mx = 1000003;
ll h, w, n,m,k; string s,t;
int dis[101][101]; int graph[52][52]; bool vis[52];
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
ll gcd(ll x, ll y) {
	if (x % y == 0) return y;
	return gcd(y, x % y);

}
ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
void comb(vector<vector <ll> >& v) {
	for (ll i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (ll k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%ma;
		}
	}
}

ll GetDigit(ll num) {
	return log10(num) + 1;
}
int sy, sx;
P nums[10];
char maze[1010][1010];
/*ll bfs(ll goal) {
	queue<P> que;
	rep(i,h){
		rep(j, w) {
			dis[i][j] = -1;
		}
	}
	que.push(P(sy, sx));
	dis[sy][sx] = 0;

	while (que.size() > 0) {
		P p = que.front();
		que.pop();
		if (p.first == nums[goal].first && p.second == nums[goal].second) break;
		for (int i = 0; i < 4; i++) {
			int ny = p.first + dy[i];
			int nx = p.second + dx[i];
			if (0 <= ny && ny < h && 0 <= nx && nx < w && maze[ny][nx] != 'X' && dis[ny][nx] == -1) {
				que.push(P(ny, nx));
				dis[ny][nx] = dis[p.first][p.second] + 1;
			}
		}
	}
	sy = nums[goal].first;
	sx = nums[goal].second;
	return dis[nums[goal].first][nums[goal].second];
}*/

int main() {
	cin >> h >> w;
	queue<P> que;
	vector<vector<ll>> score(h, vector<ll>(w, -1));
	rep(i, h) {
		rep(j, w) {
			cin >> maze[i][j];
			if (maze[i][j] == '#') {
				que.push(P(i, j));
				score[i][j] = 0;
			}
		}
	}

	while (!que.empty()) {
		ll x = que.front().second;
		ll y = que.front().first;
		que.pop();
		rep(i, 4) {
			ll nx = x + dx[i];
			ll ny = y + dy[i];
			if (nx == -1 || ny == -1 || nx == w || ny == h)continue;
			if (score[ny][nx] >= 0)continue;
			que.push(P(ny, nx));
			score[ny][nx] = score[y][x]+1;
		}
	}
	ll max = 0;
	for (int i = 0; i < h * w; i++) {
		if (score[i / w][i % w] > max)max = score[i / w][i % w];
	}
	cout << max << endl;
}


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

int main() {
  string s;
  cin >> s;
  int n = s.size();
  vector<string> x(n-2);
  vector<int> xi(n-2);
  int ans = 1000;
  for(int i=0; i<n-2; i++) {
    x.at(i) = s.substr(i, 3);
    xi.at(i) = stoi(x.at(i));
    int temp = 753 - xi.at(i);
    if(temp < 0) {
      temp = -temp;
    }
    ans = min(ans, temp);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<iostream>
using namespace std;

const int maxN=310;
const int Mod=1e9+7;

int n,Seq[maxN+maxN];
int use[maxN+maxN],one[maxN+maxN];
int F[2][maxN][maxN];

void Plus(int &x,int y);
int main(){
    int ecnt=0,ocnt=0;
    scanf("%d",&n);for (int i=1;i<=n+n;i++) scanf("%d",&Seq[i]);
    for (int i=1;i<=n+n;i+=2)
        if (Seq[i]==-1&&Seq[i+1]==-1) ++ecnt;
        else if (Seq[i]==-1||Seq[i+1]==-1) one[Seq[i]+Seq[i+1]+1]=1,++ocnt;
        else use[Seq[i]]=use[Seq[i+1]]=1;
    int now=1;F[now][0][0]=1;
    for (int i=n+n;i>=1;i--)
        if (!use[i]){
            now^=1;memset(F[now],0,sizeof(F[now]));
            for (int j=0;j<=ecnt+ocnt;j++)
                for (int k=0;k<=ocnt;k++)
                    if (F[now^1][j][k]){
                        int key=F[now^1][j][k];
                        if (one[i]){
                            if (j) Plus(F[now][j-1][k],key);
                            Plus(F[now][j][k+1],key);
                        }
                        else{
                            Plus(F[now][j+1][k],key);
                            if (j) Plus(F[now][j-1][k],key);
                            if (k) Plus(F[now][j][k-1],1ll*k*key%Mod);
                        }
                    }
        }
    int Ans=F[now][0][0];for (int i=1;i<=ecnt;i++) Ans=1ll*Ans*i%Mod;
    printf("%d\n",Ans);return 0;
}
void Plus(int &x,int y){
    x+=y;if (x>=Mod) x-=Mod;return;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int n;
vector<int> v[200000];
string s;
bool b[200000];
void f(int x){
    bool p=false, q=false;
    for(int i=0;i<v[x].size();i++){
        int t=v[x][i];
        if(b[t]){
            if(s[t]=='A')p=true;
            if(s[t]=='B')q=true;
        }
        if(p&&q)return;
    }
    b[x]=false;
    for(int i=0;i<v[x].size();i++){
        if(i>0){
            if(v[x][i]==v[x][i-1])continue;
        }
        int t=v[x][i];
        if(b[t]){
            f(t);
        }
    }
}
int main(void){
    int m;
    cin>>n>>m>>s;
    for(int i=0;i<m;i++){
        int a, b;
        cin>>a>>b;
        a--;
        b--;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    fill(b, b+n, true);
    for(int i=0;i<n;i++){
        sort(v[i].begin(), v[i].end());
    }
    for(int i=0;i<n;i++){
        f(i);
    }
    for(int i=0;i<n;i++){
        if(b[i]){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
}


Measured memory_bytes: 18692
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define yn(ans) cout<<(ans?"Yes":"No")<<endl
#define YN(ans) cout<<(ans?"YES":"NO")<<endl
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}

int main(){
    int n;
    in(n);
    vector<int> vec(n);
    int ans=0;
    in(vec);
    sort(all(vec));
    for(int i=0;i<n-2;i++){
        for(int j=i+1;j<n-1;j++){
            ans+=(int)(lower_bound(all(vec),vec[i]+vec[j])-(vec.begin()+j+1));
        }
    }
    out(ans);
}

Measured memory_bytes: 3812
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define int long long
#define FOR(i, m, n) for(int i = m;i <= n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int lcm(int a, int b) { int g = gcd(a, b); return a / g * b; }
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int x; cin >> x;
    int ans = 1;
    FOR(i,2,x) for(int j = 2; pow(i,j) <= x; j++) ans = max(ans,(int)pow(i,j));
    ANS;

    return 0;
}

Measured memory_bytes: 256
import sys,math,copy,queue,itertools,bisect,collections,heapq
sys.setrecursionlimit(10**7)
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())
INF = 10**9+1
MOD = 10**9 + 7
DD = ((1,0),(-1,0),(0,1),(0,-1))

N = NI()
a = LI()

root = [[] for _ in range(N)]
for _ in range(N-1):
    u,v = LI()
    root[u-1].append(v-1)
    root[v-1].append(u-1)

lis = [INF for _ in range(N)]
q = []

q.append((0,0,0))
ans = [-1 for _ in range(N)]
while q:
    c,p,v = q.pop()
    if c == 0:
        x = bisect.bisect_left(lis,a[p])
        y = lis[x]
        if y == INF: v +=1
        if y > a[p]: lis[x] = a[p]
        ans[p] = v
        q.append((1,x,y))
        for d in root[p]:
            if ans[d] < 0:
                q.append((0,d,v))
    else:
        lis[p] = v
print(*ans,sep='\n')

Measured memory_bytes: 151452
def f(h, a, b)
  base = b
  optional = a-b
  (1..h.max).bsearch{|i|
    cnt = 0
    h.map{|hp|
      cnt += ([hp - base * i, 0].max.fdiv(optional)).ceil
      break if cnt > i
    }
    cnt <= i
  }
end

N, A, B = gets.split.map(&:to_i)
H = N.times.map{gets.to_i}

p f(H, A, B)


Measured memory_bytes: 19196
#include<stdio.h>
#define DATA_NUM 3000
int main(){
    int i;
    int temp;
    int x[DATA_NUM],y[DATA_NUM];
    
    for(i=0;i<DATA_NUM;i++){
        scanf("%d %d",&x[i],&y[i]);
        if(x[i]==0 && y[i]==0){
            break;
        }
    }
    
    for(i=0;i<DATA_NUM;i++){
        if(x[i]==0 && y[i]==0){
            break;
        }
        if(x[i]>y[i]){
            temp = x[i];
            x[i] = y[i];
            y[i] = temp;
        }
    }
    
    for(i=0;i<DATA_NUM;i++){
        if(x[i]==0 && y[i]==0){
            break;
        }
        printf("%d %d\n",x[i],y[i]);
    }
    return 0;
}


Measured memory_bytes: 1980
#include<stdio.h>
#define M 100000
int main(){
	int i,j,a,d[M+10]={};
	char p[M+10]={1,1};
	for(i=2;i*i<M;i++){
		if(p[i])continue;
		for(j=i*i;j<M;j+=i)p[j]=1;
	}
	for(i=0;i<M;i++)d[i+1]=d[i]+1-(p[i+1]|p[(i+2)/2]);
	scanf("%d",&a);
	while(a--){
		scanf("%d %d",&i,&j);
		printf("%d\n",d[j]-d[i-1]);
	}
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define F first
#define S second
#define ll long long
#define ld long double
#define pb push_back

using namespace std;

const ll N=3e3+5;

int n,mem[N][N];

string s,t,ANS;

int dp(int l,int r)
{
    if (l==s.length()||r==t.length())return 0;
    if (mem[l][r]!=-1)return mem[l][r];
    int ans=dp(l+1,r);
    ans=max(ans,dp(l,r+1));
    if (s[l]==t[r])ans=max(ans,1+dp(l+1,r+1));
    return mem[l][r]=ans;
}

void trace(int l,int r)
{
    if (l==s.length()||r==t.length())return;
    if (s[l]==t[r]){ANS+=s[l];trace(l+1,r+1);}
    else if (mem[l+1][r]>=mem[l][r+1])trace(l+1,r);
    else trace(l,r+1);
}

int main()
{
    memset(mem,-1,sizeof mem);
    cin >> s >> t;
    int ans=dp(0,0);
    trace(0,0);
    cout << ANS << endl;
}


Measured memory_bytes: 35968
#include<cstdio>
#include<string>
#include<vector>
#include<cstdlib>
#include<cstring>
#include<numeric>

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

using namespace std;

typedef	vector<int>	vi;

vi cut(string num,int stat){
	int len=num.length(),bef=0;
	vi res;
	rep(i,len)if(stat&(1<<i) || i==len-1){
		res.pb(atoi(num.substr(bef,i-bef+1).c_str()));
		bef=i+1;
	}
	return res;
}

int main(){
	for(;;){
		int tar;
		char num[7];	scanf("%d%s",&tar,num);
		if(tar==0)	break;
		int len=strlen(num);

		int ans=-1;
		vi ans2;
		bool dup=false;
		rep(i,1<<(len-1)){
			vi c=cut(num,i);
			int sum=accumulate(c.begin(),c.end(),0);
			if(sum<=tar){
				if(ans<sum)	ans=sum,ans2=c,dup=false;
				else if(ans==sum)	dup=true;
			}
		}

		if(ans==-1)		puts("error");
		else if(dup)	puts("rejected");
		else{
			printf("%d",ans);
			rep(i,ans2.size())	printf(" %d",ans2[i]);
			putchar('\n');
		}
	}

	return 0;
}

Measured memory_bytes: 0
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main
{
	PrintWriter out = new PrintWriter(System.out);
	BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer tok = new StringTokenizer("");
    String next() throws IOException {
        if (!tok.hasMoreTokens()) { tok = new StringTokenizer(in.readLine()); }
        return tok.nextToken();
    }
    int ni() throws IOException { return Integer.parseInt(next()); }
    long nl() throws IOException { return Long.parseLong(next()); }
  
    void solve() throws IOException {
        int n=ni(),k=ni();
        if ((n+k)%2==1) System.out.println("IMPOSSIBLE");
        else System.out.println((n+k)/2);
    }
    
    public static void main(String[] args) throws IOException {
        new Main().solve();
    }
}

Measured memory_bytes: 22228
//コンパイラ最適化用
#pragma GCC optimize("O3")
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) ll(x.size()) //sizeをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define Umap unordered_map
#define Uset unordered_set

signed main(){
    //入力の高速化用のコード
    //ios::sync_with_stdio(false);
    //cin.tie(nullptr);
    ll n;cin>>n;
    vector<ll> a(n);REP(i,n)cin>>a[i];
    multiset<ll> colors;
    colors.insert(a[0]);
    FOR(i,1,n-1){
        auto ne=colors.lower_bound(a[i]);
        if(ne==colors.begin()){
            colors.insert(a[i]);
        }else{
            colors.erase(--ne);
            colors.insert(a[i]);
        }
    }
    cout<<SIZE(colors)<<endl;
}

Measured memory_bytes: 8580
#include <stdio.h>
 
int adj[100][100];
 
int main(void) {
    int i, j;
    int n;
 
    scanf("%d", &n);
 
    for (i = 0; i < n; i++) {
        int u, k;
 
        scanf("%d %d", &u, &k);
        u--;
 
        for (j = 0; j < k; j++) {
            int v;
 
            scanf("%d", &v);
            v--;
 
            adj[u][v] = 1;
        }
    }
 
              for(i=0;i<n;i++){
                            for(j=0;j<n;j++){
                                             printf("%d",adj[i][j]);
                                             if(j!=n-1)printf(" ");
                                             
                                             }
                             printf("\n");
                             }
           return 0;
           }


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

int main() {
	double pi = 4.0 * atan(1.0);
	double r;
	cin >> r;
	printf("%f %f\n", pi * r * r, 2.0 * pi * r);
	return 0;
}

Measured memory_bytes: 1232
H,W=gets.chomp.split(" ").map{|n| n.to_i}
M=Array.new(H){Array.new(W)}
0.upto(H-1){|i|
	M[i]=gets.chomp.split('')
}
x = 0
y = 0
cnt = 1
while(x != W-1 || y != H-1)
	is_down = (y+1 < H && M[y+1][x] == "#")
	is_right = (x+1 < W && M[y][x+1] == "#")
	if(is_down && is_right)
		puts "Impossible"
		exit(0)
	elsif(! is_down && ! is_right)
		puts "Impossible"
		exit(0)
	elsif(is_down)
		y += 1
		cnt += 1
	elsif(is_right)
		x += 1
		cnt += 1
	end
end
if(cnt != M.inject(0){|sum,l| sum + l.count{|a| a=="#"}})
		puts "Impossible"
		exit(0)
end	
puts "Possible"


Measured memory_bytes: 1788
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <unordered_set>
using namespace std;
#define inf 999999999
#define loop(i, a, b) for (int i = (a), i##len = (b); i < i##len; ++i)
#define rep(i, n) loop(i, 0, n)
#define lin long long

lin n, m;

int main(void)
{
    cin >> n >> m;

    lin res = 0;
    if (n == 1 && m == 1)
    {
        res = 1;
    }
    else if (n == 1)
    {
        res = m - 2;
    }
    else if (m == 1)
    {
        res = n - 2;
    }
    else
    {
        res = (n - 2) * (m - 2);
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
pub fn main() {
    use std::collections::HashMap;
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    let mut iter = input.split_whitespace().map(|w| w.parse().unwrap());
    let n: usize = iter.next().unwrap();
    let a: Vec<usize> = (0..n).map(|_| iter.next().unwrap()).collect();
    let factors: Vec<HashMap<usize, u32>> = a
        .iter()
        .map(|&x| {
            let mut map = HashMap::new();
            let mut x = x;
            let mut i = 2;
            while i * i <= x {
                if x % i == 0 {
                    *map.entry(i).or_insert(0) += 1;
                    x /= i;
                } else {
                    i += 1;
                }
            }
            if x > 0 {
                *map.entry(x).or_insert(0) += 1;
            }
            map
        })
        .collect();
    let mut lcm_factors: HashMap<usize, u32> = HashMap::new();
    for i in 0..n {
        for (&p, &e) in &factors[i] {
            let max_e = lcm_factors.entry(p).or_insert(0);
            *max_e = std::cmp::max(*max_e, e);
        }
    }
    const MODULO: usize = 1_000_000_007;
    let mut lcm = 1;
    for (&p, &e) in &lcm_factors {
        lcm = (lcm * p.pow(e)) % MODULO;
    }
    let mut ans = 0;
    for i in 0..n {
        let mut b = lcm;
        let mut base = a[i];
        let mut exponent = MODULO - 2;
        while exponent != 0 {
            if exponent & 1 == 1 {
                b = b * base % MODULO;
            }
            base = base * base % MODULO;
            exponent >>= 1;
        }
        ans = (ans + b) % MODULO;
    }
    println!("{}", ans);
}

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

int printNcR(int n, int r)
{
    long long p = 1, k = 1;

    if (n - r < r)
        r = n - r;

    if (r != 0) {
        while (r) {
            p *= n;
            k *= r;
            long long m = __gcd(p, k);
            p /= m;
            k /= m;

            n--;
            r--;
        }
    }

    else
        p = 1;
    return p;
}

int main()
{
    int a, b, aa = 0, bb = 0;
    cin >> a >> b;
    if(a > 1)aa = printNcR(a, 2);
    if(b > 1)bb = printNcR(b, 2);
    cout << aa + bb;
    return 0;
}


Measured memory_bytes: 256
// counting sort
#include <stdio.h>
#include <stdlib.h>
#define MAX 10000

int	 main(){

	int *A,*B,C[10001],N;
	int i,j;

	scanf("%d",&N);


	A = malloc(sizeof(int)*N+1);
	B = malloc(sizeof(int)*N+1);

	for (i = 1; i <= N; i++){
		scanf("%d",&A[i]);
	}
//////////////////////////////
	for (i = 0; i < MAX; i++){
		C[i] = 0;		
	}

	for (j = 1; j <= N; j++){
		C[A[j]]++;
	}

	for (i = 1; i <= MAX; i++){
		C[i] = C[i] + C[i-1];
	}

	for(j = N; j >= 1; j--){
		B[C[A[j]]] = A[j];
		C[A[j]]--;
	}
///////////////////////////////
	for (i = 1; i <= N; i++){
		if(i > 1) printf(" ");
		printf("%d",B[i]);
	}	
	printf("\n");

	return 0;
}		

Measured memory_bytes: 16276
from collections import defaultdict


def main():
    N = int(input())
    counter = defaultdict(int)
    for _ in range(N):
        s = input()
        counter[s] += 1
    max_cnt = 0
    max_cnt_str_list = list()
    for s, cnt in counter.items():
        if cnt > max_cnt:
            max_cnt = cnt
            max_cnt_str_list = [s]
        elif cnt == max_cnt:
            max_cnt_str_list.append(s)
    max_cnt_str_list = sorted(max_cnt_str_list)
    for s in max_cnt_str_list:
        print(s)


if __name__ == '__main__':
    main()

Measured memory_bytes: 33372
#include<bits/stdc++.h>//本当は必要なヘッダファイルだけインクルードするべきです
using namespace std;//本当は個別にusingするか変数や関数ごとにstd::をつけるべきです
//本当は関数内に宣言し明示的に初期化するべきです

int main(void){
  int n,q;cin>>n>>q;
  string name;int time;
  queue<pair<string,int>>queue;
  while(n--){
    cin>>name>>time;
    queue.push(make_pair(name,time));
  }
  int now=0;
  while(!queue.empty()){
    pair<string,int>e=queue.front();queue.pop();
    string name=e.first;
    int time=e.second;
    if(time<=q){
      cout<<name<<" "<<(now+time)<<endl;
      now+=time;
    }else{
      time-=q;
      queue.push(make_pair(name,time));
      now+=q;
    }
  }
  return 0;
}



Measured memory_bytes: 6368
import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


def main():
    D = NI()
    C = NLI()
    S = [NLI() for _ in range(D)]
    #T = [NI() - 1 for _ in range(D)]
    T = []
    last = [0]*26
    conf = 0
    for i in range(D):
        idx, s = argmax(S[i])
        T.append(idx)
        conf += s
        last[idx] = i+1
        for a in range(26):
            conf -= C[a] * (i+1 - last[a])
        print(idx+1)


def argmax(A):
    A = [[i, a] for i, a in enumerate(A)]
    A.sort(key=lambda x: x[1], reverse=True)
    return A[0]


if __name__ == "__main__":
    main()


Measured memory_bytes: 9852
#include<iostream>
#include<cmath>
#include<math.h>
#include<algorithm>
#include<memory>
#include<string>
#include <iomanip> 
#include<map>
using namespace std;
int main()
{
	int n, m;
	cin >> n >> m;
	cout << (n - 1)*(m - 1);
}

Measured memory_bytes: 256
def preParse(u):
    if u == None:
        return
    print(' {}'.format(u), end='')
    preParse(nodes[u][1])
    preParse(nodes[u][2])

def inParse(u):
    if u == None:
        return
    inParse(nodes[u][1])
    print(' {}'.format(u), end='')
    inParse(nodes[u][2])

nodes = {}

# {key:[parent,left,right]}

N = int(input())

root = None

def insert(nodes,z,root):
    x = root
    y = None
    while x != None:
        y = x
        if z < x:
            x = nodes[x][1]
        else:
            x = nodes[x][2]
    nodes[z][0] = y

    if y == None:
        root = z
    elif z < y:
        nodes[y][1] = z
    else:
        nodes[y][2] = z
    return root

for i in range(N):
    order = input().split()
    if order[0] == 'print':
        inParse(root)
        print()
        preParse(root)
        print()
        continue

    z = int(order[1])
    nodes[z] = [None,None,None]
    root = insert(nodes,z,root)



Measured memory_bytes: 85864
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1505,mod=998244353;
int n,cnt,num,e[2],st[N],tot,a[N][N],c[N][N],head[N],nex[N*N<<1],to[N*N<<1];
void add(int u,int v){to[++tot]=v;nex[tot]=head[u];head[u]=tot;}
char s[N][N];
vector<int>v[N][N];
bool vis[N];
void dfs(int u)
{
    vis[u]=true;
    cnt++;num^=st[u];
    for(int i=head[u];i;i=nex[i])
        if(!vis[to[i]])
            dfs(to[i]);
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<n;i++) scanf("%s",s[i]+1);
    for(int i=0;i<=n;i++)
    {
        int x=i,y=0,dx=1,dy=1;
        for(int j=1;j<=(i==0||i==n?n:2*n);j++)
        {
            v[x][y].push_back(i);
            if(x+dx<0||x+dx>n) dx*=-1;
            if(y+dy<0||y+dy>n) dy*=-1;
            x+=dx;y+=dy;
        }
    }
    for(int i=1;i<n;i++)
        for(int j=1;j<n;j++)
        if(s[i][j]=='o') a[i][j]=1;
        else if(s[i][j]=='x') a[i][j]=2;
    for(int i=1;i<n;i++)
        for(int j=1;j<n;j++)
    {
        int x=v[i][j][0],y=v[i][j][1];
        c[x][y]|=a[i][j];
        if(c[x][y]==3){printf("0\n");return 0;}
    }
    for(int i=0;i<=n;i++)
        for(int j=i+2;j<=n;j+=2)
        if(!c[i][j]) add(i,j),add(j,i),e[i&1]++;
        else st[i]^=c[i][j]-1,st[j]^=c[i][j]-1;
    ll ans=1;
    for(int opt=0;opt<=1;opt++)
    {
        int sum=(n-opt)/2+1;
        if(sum&1)
        {
            cnt=0;
            for(int i=opt;i<=n;i+=2)
                if(!vis[i])
                {
                    cnt--;num=0;
                    dfs(i);
                    if(num&1){printf("0\n");return 0;}
                }
            for(int j=1;j<=e[opt]-cnt;j++)
                ans=(ans<<1)%mod;
        }
        else for(int i=1;i<=e[opt];i++)
            ans=(ans<<1)%mod;
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 155648
#include <cstdio>
#pragma warning(disable : 4996)
int N, M, Q, a[100009], c[100009], p[100009], inv[100009];
int main() {
	scanf("%d%d%d", &N, &M, &Q);
	for (int i = 0; i < Q; i++) scanf("%d", &a[i]), a[i]--;
	for (int i = 0; i < M; i++) inv[i] = -1;
	int cur = 0;
	for (int i = Q - 1; i >= 0; i--) {
		if (inv[a[i]] == -1) {
			inv[a[i]] = cur;
			c[cur] = 1;
			p[cur++] = a[i];
		}
		else {
			if (c[inv[a[i]]] < (inv[a[i]] == 0 ? N : c[inv[a[i]] - 1])) {
				c[inv[a[i]]]++;
			}
		}
	}
	for (int i = 0; i < M; i++) {
		if (inv[i] == -1) p[cur++] = i;
	}
	bool ret = true;
	for (int i = 0; i < M; i++) {
		if (i >= 1 && c[i - 1] != N && p[i - 1] > p[i]) {
			ret = false;
		}
	}
	printf(ret ? "Yes\n" : "No\n");
	return 0;
}

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

int main() {

	int h, w;
	while (cin >> h >> w && h || w) {
		for (int i = 1; i <= h; i++) {
			for (int k = 1; k <= w; k++) {
				if (i == 1 || k == 1 || i == h || k == w) {
					cout << '#';
				}else{
					cout << '.';
				}
			}
			cout << endl;
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3020
n = gets.to_i
robots = []
n.times { robots << gets.split.map(&:to_i) }
from_to = robots.map { |p, l| [p - l, p + l] }
from_to.sort! { |a, b| a[1] <=> b[1] }
current = - (10 ** 10)
sum = 0
from_to.each do |from, to|
  next if from < current
  current = to
  sum += 1
end
puts sum


Measured memory_bytes: 12536
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <random>
using namespace std;

#define endl '\n'
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define uniq(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

ll h, w, a, b;

ll mod_pow(ll x, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = (res * x) % mod;
        x = (x * x) % mod;
        n >>= 1;
    }
    return res;
}

ll mod_inverse(ll x) {
    return mod_pow(x, mod-2);
}

const int max_n = 200010;
ll fact[max_n];
void calc_fact() {
    fact[0] = 1;
    for (ll i = 1; i < max_n; i++)
        fact[i] = (fact[i-1] * i) % mod;
}
ll mod_comb(ll n, ll k) {
    if (n < 0 || k < 0 || n < k) return 0;
    return (fact[n] * mod_inverse(fact[k]) % mod) * mod_inverse(fact[n-k]) % mod;
}

ll solve() {
    ll res = 0;
    calc_fact();
    for (int i = 0; i < h-a; i++) {
        res = (res + mod_comb(i+b-1, i) * mod_comb(w-b-1+h-i-1, h-i-1) % mod) % mod;
    }
    return res;
}

void input() {
    cin >> h >> w >> a >> b;
}

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

    input();
    cout << solve() << endl;
}


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

int main(){
  int N; cin >> N;
  int ans = 0;
  vector<int> a(N);
  vector<int> b(N);
  vector<int> c(N-1);
  for(int i = 0;i < N;i++) cin >> a[i];
  for(int i = 0;i < N;i++) cin >> b[i];
  for(int i = 0;i < N-1;i++) cin >> c[i];
  for(int i = 0;i < N;i++) a[i]--;

  for(int i = 0;i < N;i++){
    ans += b[a[i]];
  }
  for(int i = 0;i < N-1;i++){
    if (a[i]+1 == a[i+1]){
      ans += c[a[i]];
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
/* ex4_3
   kento_titech*/
#include<stdio.h>
int snow_height(int h_west,int h_east);//積雪を求める関数のプロトタイプ宣言
int main(void){
    int a,b;//a,bはそれぞれ西と東に見える高さ
    scanf("%d %d",&a,&b);
    printf("%d\n",snow_height(a,b));

    return 0;
}
int snow_height(int h_west,int h_east){//h_west,h_eastはそれぞれ西と東に見える部分の高さ
        int height;
        height=(h_east-h_west)*(h_east-h_west+1)/2-h_east;//1からh_east-h_westまでの総和が東側の塔の高さ。
                                    //積雪heightはそこからh_eastを引いたもの.
        return(height);

    }

Measured memory_bytes: 128
import itertools
n,m,q=map(int,input().split())
l=[list(map(int,input().split())) for i in range(q)]
x=0
for v in itertools.combinations_with_replacement(range(1,m+1),n):
  t=list(v)
  p=0
  for i in l:
    p+=(i[3]*(t[i[1]-1]-t[i[0]-1]==i[2]))
  x=max(x,p)
print(x)

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

int main()
{
    int64_t n,m;
    cin>>n>>m;
    bitset<32>a(n),b(m);
    cout<<(a&b)<<endl;
    cout<<(a|b)<<endl;
    cout<<(a^b)<<endl;
}



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

#define int long long
#define F first
#define S second
#define pii pair <int, int>

const int maxn = 1e5 + 10;
int n, a[maxn];
int c0, c1, cnt, GCD;

bool solve() {
	c1 = 0, c0 = 0, cnt = 0, GCD = 0;
	for (int i = 0; i < n; i++) {
		if (a[i] == 1) {
			c1++;
			cnt++;
			continue;
		}
		if (a[i] % 2) {
			c1++;
			a[i]--;
		}
		else
			c0++;
		GCD = __gcd(GCD, a[i]);
	}
	if (c0 % 2) 		 return 1;
	if (cnt || c1 > 1) return 0;
	for (int i = 0; i < n; i++) a[i] /= GCD;
	return !solve();
}
	


int32_t main() {
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	if (solve())
		cout << "First";
	else
		cout << "Second";
	return 0;
}


Measured memory_bytes: 4416
s=input()
k=int(input())

st=set()
s_len=len(s)

length=1
while length<=min(s_len,k):
  for i in range(s_len-length+1):
    sub_s=s[i:i+length]
    st.add(sub_s)
  length+=1

list=sorted(st)
print(list[k-1])

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

int main()
{
    ll n;
    cin >>n;
    ll a[n+1];
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }

    ll ans =0;
    for(int i=1;i<=n;i++)
    {
        if( a[i] == i )
        {
            if( i-1 > 0 && i+1<= n && a[i+1] != i+1)
            {
                swap( a[i] , a[i-1]);
                ans++;
            }
            else if( i-1 > 0 && i+1<= n && a[i+1] == i+1)
            {
                swap( a[i] , a[i+1 ] );
                ans++;
            }
            else if( i-1 == 0  )
            {
                swap( a[i+1] , a[i]);
                ans++;
            }
            else if( i+1 == n+1)
            {
                swap( a[i] , a[i-1]);
                ans++;
            }
        }
    }
    cout<<ans;
}

Measured memory_bytes: 4352
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


A, B, C = MI()
m = max(A, B, C)

ans = (m - A) // 2
A += (m - A) // 2 * 2
ans += (m - B) // 2
B += (m - B) // 2 * 2
ans += (m - C) // 2
C += (m - C) // 2 * 2

d = 3 * m - (A + B + C)
if d == 0:
    print(ans)
elif d == 1:
    print(ans + 2)
else:
    print(ans + 1)


Measured memory_bytes: 38384
x, y = [int(i) for i in raw_input().split()]
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
if x in a and y in a:
    print('Yes')
elif x in b and y in b:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 2572
#include<iostream>
using namespace std;
//int dp[100003],v[100003];
int main()
{
	int n;
	cin>>n;
	int dp[n],v[n];
	for(int i =0;i<n;i++)
	{
		dp[i] = (int)1e9+5;
	}
	for(int i=0;i<n;i++)
	{
		cin>>v[i];
	}
	//v[n] = 10000;
	//v[n+1] = 100000;
	//v[n+2] = 10000;
	dp[0]  =0;
	for(int i =0;i<n;i++)
	{
		for(int j = i+1;j<i+3;j++)
		{
			if(j<n)
			{
				dp[j] = min(dp[j],dp[i]+abs(v[i] - v[j]));
			}
		}
	}
	cout<<dp[n-1]<<"\n";
}

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

using namespace std;

typedef long long ll;

const int MAX_N = 1e5 + 200;

int n, X, bi[MAX_N], li[MAX_N], ri[MAX_N], idx[MAX_N];
ll si[MAX_N];

ll calc(int id, int x)
{
    if (x <= bi[id])
        return 1LL * li[id] * x;
    return 1LL * li[id] * bi[id] + 1LL * ri[id] * (x - bi[id]);
}

ll check(ll mid)
{
    ll ans = 0, acc = 0;
    int spare = mid % X;
    if (spare == 0)
        spare += X;
    int cnt = (mid - spare) / X;
    for (int i = 1; i <= cnt; i++)
        acc += si[idx[i]];
    for (int i = cnt + 1; i <= n; i++)
        ans = max(ans, acc + calc(idx[i], spare));
    acc += si[idx[cnt + 1]];
    for (int i = 1; i <= cnt; i++)
        ans = max(ans, acc - si[idx[i]] + calc(idx[i], spare));
    return ans;
}

int main()
{
    ll goal = 0;
    scanf("%d%d", &n, &X);
    for (int i = 1; i <= n; i++)
    {
        scanf("%d%d%d", &bi[i], &li[i], &ri[i]);
        si[i] = calc(i, X), goal += 1LL * bi[i] * li[i], idx[i] = i;
    }
    sort(idx + 1, idx + 1 + n, [](const int &rhs1, const int &rhs2) { return si[rhs1] > si[rhs2]; });
    if (goal == 0)
        puts("0"), exit(0);
    ll l = 1, r = 1LL * n * X, res;
    while (l <= r)
    {
        ll mid = (l + r) >> 1;
        if (check(mid) >= goal)
            r = mid - 1, res = mid;
        else
            l = mid + 1;
    }
    printf("%lld\n", res);
    return 0;
}

Measured memory_bytes: 6152
Num = list(map(int, input().split()))

for i in range(len(Num)-1):                # 1巡で１つ確定
    for j in range(len(Num)-1, i, -1):     # jを(i+1)まで下げる 
        if Num[j] < Num[j-1]:
           Num[j],Num[j-1] = Num[j-1],Num[j]

L=[str(a) for a in Num]
L=" ".join(L)
print(L)


Measured memory_bytes: 5600
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<queue>
#define ll long long
#define plus 0
#define minus 1
using namespace std;
const int N=1e5+10;
struct Dot{
	int x,y,id;
	Dot(){}
	Dot(int x1,int y1,int id1){x=x1; y=y1; id=id1;}
	friend bool operator < (Dot a,Dot b){
		if (a.x!=b.x) return a.x<b.x;
		if (a.y!=b.y) return a.y<b.y;
		return a.id<b.id;
	}
}a[N];
int vis[N];
map<int,vector<int> >rec2[2];
map<int,set<Dot> >rec1[2];
set<Dot>::iterator it,it2;
queue<Dot> q;
ll ans;
int n,A,B,D;
int Abs(int x){return x<0?-x:x;}
void prework(){
	while (!q.empty()) q.pop();
	memset(vis,false,sizeof(vis));
	for (int i=1;i<=n;++i){
		if (i==A)
			q.push(a[i]),vis[i]=true;
		else{
			rec1[plus][a[i].x+a[i].y].insert(a[i]);
			rec1[minus][a[i].x-a[i].y].insert(a[i]);
		}
	}
}
int Cnt=0;
void get_point(int which,ll val,int lx,int rx){
	Dot ttmp;
	if (rec1[which].find(val)==rec1[which].end()) return;
	set<Dot> &tmp=rec1[which][val];
	it=tmp.lower_bound(Dot(lx,0,0));
	ttmp=*it;
	for (it2=it;ttmp.x<=rx&&it!=tmp.end();it=it2,ttmp=*it2){
		++it2;
		q.push(ttmp),vis[ttmp.id]=true;
		rec1[plus][ttmp.x+ttmp.y].erase(ttmp);
		rec1[minus][ttmp.x-ttmp.y].erase(ttmp);
	}
}
void bfs(){
	Dot u,v;
	while (!q.empty()){
		v=q.front(); q.pop();
		if (1LL*v.x+v.y+D<=2e9)
			get_point(plus,1LL*v.x+v.y+D,v.x,v.x+D);
		get_point(plus,1LL*v.x+v.y-D,v.x-D,v.x);

		get_point(minus,1LL*v.x-v.y+D,v.x,v.x+D);
		get_point(minus,1LL*v.x-v.y-D,v.x-D,v.x);

		//printf("%d\n",(int)q.size());
	}
	//printf("%d\n",debug);
}
int calc(int which,int val,int lx,int rx){
	if (rec2[which].find(val)==rec2[which].end()) return 0;
	vector<int> &tmp=rec2[which][val];
	return lower_bound(tmp.begin(),tmp.end(),rx+1)-lower_bound(tmp.begin(),tmp.end(),lx);
}

void solve(){
	sort(a+1,a+1+n);
	ans=0;
	Dot v;
	for (int i=1;i<=n;++i){
		v=a[i];
		//printf("%d %d %d\n",v.x,v.y,v.id);
		if (!vis[v.id]) continue;
		if (1LL*v.x+v.y+D<=2e9)
			ans+=calc(plus,v.x+v.y+D,v.x,v.x+D);
		ans+=calc(plus,v.x+v.y-D,v.x-D,v.x);

		ans+=calc(minus,v.x-v.y+D,v.x+1,v.x+D-1);
		ans+=calc(minus,v.x-v.y-D,v.x-D+1,v.x-1);

		rec2[plus][v.x+v.y].push_back(v.x);
		rec2[minus][v.x-v.y].push_back(v.x);
		//printf("%lld\n",ans);
	}
	printf("%lld\n",ans);
}

int main(){
#ifndef ONLINE_JUDGE
	//freopen("a.in","r",stdin);
#endif
	scanf("%d%d%d",&n,&A,&B);
	for (int i=1;i<=n;++i)
		scanf("%d%d",&a[i].x,&a[i].y),a[i].id=i;
	D=Abs(a[A].x-a[B].x)+Abs(a[A].y-a[B].y);
	prework();
	bfs();
	solve();
	//printf("%d\n",Cnt);
}

Measured memory_bytes: 41984
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


N = int(input())

A = factorization(N)
ans = 0
for a, b in A:
    if a == 1:
        continue
    cnt = b
    for i in range(1, b+1):
        if cnt < i:
            break
        cnt -= i
        ans += 1
print(ans)



Measured memory_bytes: 63284
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main(){
  double x1,y1,x2,y2;
  cin>>x1>>y1>>x2>>y2;
  cout<<fixed<< setprecision(6)<<sqrt(pow(x2-x1,2)+pow(y2-y1,2))<<endl;
  return 0;
}

Measured memory_bytes: 3192
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<=n;++i)
ll p(ll x,ll num){
  ll ans=1;
  rep(i,x){
    ans*=num;
  }
  return ans;
}
int main(){
  ll n;
  cin>>n;
  vector<ll> d(n);
  vector<ll> c(n);
  rep(i,n)cin>>d[i]>>c[i];
  ll sum=0;
  ll keta=0;
  rep(i,n){
    sum+=d[i]*c[i];
    keta+=c[i];
  }
  keta--;
  ll add=0;
  ll x=0;
  ll num=9;
  add=(sum-1)/9;
  //  cout<<sum<<endl;
  //  cout<<x<<endl;
  //  cout<<add<<endl;
  //  cout<<keta<<endl;
  ll ans=keta+add;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3328
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <string>
#include <iostream>
#include <stack>

using namespace std;

int main(){
    string s;
    getline(cin, s);
    long ans = 0;
    int i = 0;
    int num_a = 0;
    while(i + 2 < s.size()){
        if(s.at(i) == 'A' && s.at(i + 1) == 'B' && s.at(i + 2) == 'C'){
            ans++;
            ans += num_a;
            if(num_a == 0){
                s.at(i) = 'B';
                s.at(i+1) = 'C';
                s.at(i+2) = 'A';
            }else if(num_a == 1){
                s.at(i) = 'C';
                s.at(i+1) = 'A';
                s.at(i+2) = 'A';
            }else if(num_a >= 2){
                s.at(i) = 'A';
                s.at(i+1) = 'A';
                s.at(i+2) = 'A';
            }
            num_a = max(0, num_a - 2);
        }else{
            if(s.at(i) == 'A'){
                num_a += 1;
            }else{
                num_a = 0;
            }
            i++;
        }
    }
    printf("%ld\n", ans);
}


Measured memory_bytes: 640