akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define db double
#define ldb long double
#define pii pair<int,int>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define pll pair<ll,ll>
#define xh1(a,b) for(int i=a;i<b;i++)
#define xh2(a,b) for(int j=a;j<b;j++)
#define stlbl(a) for(it=a.begin();it!=a.end();it++)
#define dzkt int T;cin>>T;while(T--)
#define mst(a,i) memset(a,i,sizeof(a))
#define iosks std::ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
const int N=3e5+10,inf=1e9+10,mod=1e9+7;
const db pi=atan(1)*4;
ll pow2(ll a,ll b) {ll s=1; while(b) {if(b&1) s=(s*a)%mod; a=(a*a)%mod; b/=2; } return s;}
int gcd(int a,int b) {return b==0?a:gcd(b,a%b); }
int lcm(int a,int b) {return a/gcd(a,b)*b; }
ll prime(ll x) {for(ll i=2;i<=sqrt(x+0.5);i++) if(x%i==0) return 0; return 1; }
int read()
{
    int s=0,f=1;
    char ch=getchar();
    while(ch<'0'&&ch>'9') {if(ch=='-') f=-1; ch=getchar();}
    while(ch>='0'&&ch<='9') {s=s*10+ch-'0'; ch=getchar();} return s*f;
}
set<ll> st;
vector<ll> vec;

ll a,b,v,w,t;

int main()
{
    iosks;
    cin>>a>>v>>b>>w>>t;
    if(w>v) cout<<"NO"<<endl;
    else if(v==w) {if(a==b) cout<<"YES"<<endl; else cout<<"NO"<<endl;}
    else {
        ll k=abs(a-b);
        if(k<=t*(v-w)) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    return 0;
}


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

int main() {
  string str = "";
  bool leftFlag = false;
  int count = -1;
  int i = -1;
  while(str != "#") {
    cin >> str ;
    leftFlag = false;
    count = -1;
    i = -1;
    while(true) {
      i++;
      if(str[i] == '\0') break;
        if(str[i] < 'h') {
          if(leftFlag == false || count == -1) {
            count++;
            leftFlag = true;
          }
        } else if(str[i] < 'q' && str[i] >= 'h') {
          if(leftFlag == true || count == -1) {
            count++;
            leftFlag = false;
          }
        } else if(str[i] < 'u' && str[i] >= 'p') {
          if(leftFlag == false || count == -1) {
            count++;
            leftFlag = true;
          }
        } else if(str[i] == 'u' || str[i] == 'y') {
          if(leftFlag == true || count == -1) {
            count++;
            leftFlag = false;
          }
        } else {
          if(leftFlag == false || count == -1) {
            count++;
            leftFlag = true;
          }
        }
    }
    if(str != "#"){
      cout << count << endl;
    }

  }


}



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

const int MAXN = 200005;

int N, ai, bi;
vector <int> g[MAXN];

int calc(int u, int parent, int &d){
	int depth = 0;
	for(int v : g[u]){
		if(v == parent)continue;
		
		int cdepth = calc(v, u, d) + 1;
		d = max(d, depth + cdepth + 1);
		depth = max(depth, cdepth);
	}
	return depth;
}

int main(){
	scanf("%d", &N);
	for(int i = 0; i < N - 1; i++){
		scanf("%d %d", &ai, &bi);
		ai--, bi--;
		
		g[ai].push_back(bi);
		g[bi].push_back(ai);
	}
	
	int d = 0;
	calc(0, -1, d);
	
	if(d % 3 == 2)printf("Second\n");
	else printf("First\n");
	
	return 0;
}	


Measured memory_bytes: 23168
#include<iostream>
#include<cstdio>
#define N (100000+1000)
using namespace std;

struct Edge{int to,next;}edge[N<<1];
int n,k,a[N],head[N],num_edge,ans;

void add(int u,int v)
{
	edge[++num_edge].to=v;
	edge[num_edge].next=head[u];
	head[u]=num_edge;
}

int Dfs(int x)
{
	int maxn=0;
	for (int i=head[x]; i; i=edge[i].next)
		maxn=max(maxn,Dfs(edge[i].to)+1);
	if (maxn==k-1 && x!=1 && a[x]!=1){maxn=-1; ans++;}
	return maxn;
}

int main()
{
	scanf("%d%d%d",&n,&k,&a[1]);
	for (int i=2; i<=n; ++i)
		scanf("%d",&a[i]),add(a[i],i);
	Dfs(1);
	printf("%d",ans+(a[1]!=1));
}

Measured memory_bytes: 6528
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<random>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
constexpr auto INF = 1000000000;
constexpr auto LLINF = 1LL << 62;
constexpr auto mod = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }
template<class T> inline bool chlonger(T& a, T b) { 
    if (a.length() < b.length()) { 
        a = b; 
        return 1; 
    }
    else if (a.length() == b.length()) {
        rSORT(a, [](char a, char b) {return a > b; });
        rSORT(b, [](char a, char b) {return a > b; });
        chmax(a, b);
        return 1;
    }
    return 0;
}

int ctoi(char a) {
    switch (a) {
    case '1':
        return 1;
    case '2':
        return 2;
    case '3':
        return 3;
    case '4':
        return 4;
    case '5':
        return 5;
    case '6':
        return 6;
    case '7':
        return 7;
    case '8':
        return 8;
    case '9':
        return 9;
    }
}

string dp[10010];

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

    int n, m;
    cin >> n >> m;
    int num[9] = { 2,5,5,4,5,6,3,7,6 };

    map<int, char> map;
    char q;
    FOR(i, 0, m) {
        cin >> q;
        chmax(map[num[ctoi(q) - 1]], q);
    }
    VI a;
    FOR(i, 0, 8)if (map[i])a.push_back(i);

    eFOR(i, 1, n) {
        for (int j : a) {
            if (j <= i && (i == j || dp[i - j] != "")) {
                chlonger(dp[i], dp[i - j] + map[j]);
            }
        }
    }
    
    rSORT(dp[n], [](char a, char b) {return a > b; });
    cout << dp[n] << "\n";
}

Measured memory_bytes: 49920
function main(input) {
  let a,b,n;
  [a, b, n] = input[0].trim().split(" ").map(i => parseInt(i));

  
  let max = -100000000;
  if(n>=b){
    max = Math.floor(a*(b-1)/b) - (a * Math.floor((b-1)/b));
  }else{
    max = Math.floor(a*n/b) - (a * Math.floor(n/b));
  }
  console.log(max);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));

Measured memory_bytes: 29636
n = int(input())
a = list(map(int, input().split()))
q = int(input())
m = list(map(int, input().split()))

value = []
for i in range(2 ** n):
    ans = 0
    for j in range(n):  # このループが一番のポイント
        if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
            ans += a[j]
    value.append(ans)  

for mm in range(len(m)):          
    if m[mm] in value:
        print("yes")
    else:
        print("no")


Measured memory_bytes: 43076
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

int min(int* array, int n) {
	int i;
	int min = array[0];
	for (i = 1; i < n; i++) if (min > array[i]) min = array[i];
	return min;
}

int main() {
	int n, a, b, c, l[8], i;
	scanf("%d%d%d%d", &n, &a, &b, &c);
	for (i = 0; i < n; i++) scanf("%d", &l[i]);
	
	//cur 次に追加する要素のインデックス
	int dfs(int cur, int x, int y, int z){
		int ret[4];
		if (cur == n) {
			return (x * y * z == 0) ? 100000000 : abs(x - a) + abs(y - b) + abs(z - c) - 30;
		}
		ret[0] = dfs(cur + 1, x, y, z);
		ret[1] = dfs(cur + 1, x + l[cur], y, z) + 10;
		ret[2] = dfs(cur + 1, x, y + l[cur], z) + 10;
		ret[3] = dfs(cur + 1, x, y, z + l[cur]) + 10;
		return min(ret, 4);
	}

	printf("%d", dfs(0, 0, 0, 0));
}



Measured memory_bytes: 128
N, K = map(int, input().split())
if K> ((N-1)*(N-2))//2:
    print(-1)
else:
    p = []
    q = []
    for t in range(2, N):
        for u in  range(t+1, N+1):
            q.append([t, u])
    for i in range(2, N+1):
        p.append([1, i])
    for j in range(((N-1)*(N-2))//2 - K):
        p.append(q[j])
    print(len(p))
    for y in p:
        print(*y)

Measured memory_bytes: 74736
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int days[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int main()
{
	while(true){
		string S;
		cin >> S;
		if(S=="#")break;
		int cou=0;
		for(int i=0;i<(int)S.length();i++){
			if(S[i]=='.')cou++;
		}
		if(cou==2){
			int y=0,m=0,d=0;cou=0;
			for(int i=0;i<(int)S.length();i++){
				if(S[i]=='.'){
					cou++;
					continue;
				}
				if(cou==0){
					y*=10;
					y+=S[i]-'0';
				}
				else if(cou==1){
					m*=10;
					m+=S[i]-'0';
				}
				else{
					d*=10;
					d+=S[i]-'0';
				}
			}
			ll sumday=0;int y1=2013;int m1=1;
			if(y==2012){
				sumday=(ll)(d-21);
			}
			else{
				sumday=11;
				while(y1<y-400){
					y1+=400;
					sumday+=(ll)(366*97+365*303);
				}
				while(y1<y){
					if(y1%400==0)sumday+=(ll)366;
					else if(y1%100==0)sumday+=(ll)365;
					else if(y1%4==0)sumday+=(ll)366;
					else sumday+=(ll)365;
					y1++;
				}
				while(m1<m){
					if(m1==2){
						if(y1%400==0)sumday+=(ll)29;
						else if(y1%100==0)sumday+=(ll)28;
						else if(y1%4==0)sumday+=(ll)29;
						else sumday+=(ll)28;
					}
					else{
						sumday+=(ll)days[m1-1];
					}
					m1++;
				}
				sumday+=(ll)(d-1);
			}
			ll b1,ka1,t1,w1,ki1;
			ki1=sumday%(ll)20;
			sumday/=(ll)20;
			w1=sumday%(ll)18;
			sumday/=(ll)18;
			t1=sumday%(ll)20;
			sumday/=(ll)20;
			ka1=sumday%(ll)20;
			sumday/=(ll)20;
			b1=sumday%(ll)13;
			printf("%lld.%lld.%lld.%lld.%lld\n",b1,ka1,t1,w1,ki1);
		}
		else{
			int b=0,ka=0,t=0,w=0,ki=0;cou=0;
			for(int i=0;i<(int)S.length();i++){
				if(S[i]=='.'){
					cou++;
					continue;
				}
				if(cou==0){
					b*=10;
					b+=S[i]-'0';
				}
				else if(cou==1){
					ka*=10;
					ka+=S[i]-'0';
				}
				else if(cou==2){
					t*=10;
					t+=S[i]-'0';
				}
				else if(cou==3){
					w*=10;
					w+=S[i]-'0';
				}
				else{
					ki*=10;
					ki+=S[i]-'0';
				}
			}
			int y=2012;int m=12;int d=21;
			d+=b*(20*20*18*20)+ka*(20*18*20)+t*(18*20)+w*20+ki;
			while(d>days[m-1]){
				d-=days[m-1];
				m++;
				if(m==13){
					y++;m=1;
					if(y%400==0)days[1]=29;
					else if(y%100==0)days[1]=28;
					else if(y%4==0)days[1]=29;
					else days[1]=28;
				}
			}
			days[1]=28;
			printf("%d.%d.%d\n",y,m,d);
		}
	}
	return 0;
}

Measured memory_bytes: 1204
#include<bits/stdc++.h>
using namespace std;
int main(){
  int i,j,n,w;
  cin>>n>>w;
  vector<vector<int>> arr(n , vector<int>(2,0));
  for(i=0;i<n;i++)
  for(j=0;j<2;j++)
  cin>>arr[i][j]; //Weight, Value

  vector<vector<long int>> dp(n+1, vector<long int>(w+1,0));
  for(i=1;i<=n;i++)
  for(j=0;j<=w;j++)
  if(arr[i-1][0]<=j)
    dp[i][j]=max(dp[i-1][j], arr[i-1][1]+dp[i-1][j-arr[i-1][0]]);
  else
    dp[i][j]=dp[i-1][j];

  cout<<dp[n][w]<<endl;
  return 0;
}


Measured memory_bytes: 80256
#include<stdio.h>
 #include<math.h> 
int main(){ unsigned int a,b;
 while(~scanf("%u%u",&a,&b)){ 
unsigned int c=a,d=b; while(a>0&&b>0){
 if(a>b)a=a%b; 
else b=b%a; } 
printf("%u %u\n",a+b,c/(a+b)*d);
 }

 } 


Measured memory_bytes: 2684
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSR(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n,m;
int main(){
	cin>>n>>m;
	int ans = 1;
	for(int i=1;i*i<=m;i++){
		if(m%i == 0){
			if(i >= n) ans = max(ans,m/i);
			if(m/i >= n) ans = max(ans,i);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.Scanner;
public class Main {
	static Scanner sc=new Scanner(System.in);
	static PrintWriter pr=new PrintWriter(System.out);
	public static void main(String[] args) {
		while(true){    
			String temp= sc.nextLine();
			if(temp.equals("-"))break;
			int m=Integer.parseInt(sc.nextLine());
			for(int i=0;i<m;i++){
				String str=sc.nextLine();
				int h=Integer.parseInt(str);
				temp=temp.substring(h,temp.length())+temp.substring(0,h);
			}
			pr.println(temp);
		}
		pr.flush();
	}
}

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

using namespace std;

using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template <typename T> using pq = priority_queue<T>;
template <typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template <typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for (ll i = ll(n - 1); i >= 0; i--)
#define each(i, mp) for (auto &i : mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template <class T> ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}

template <class T> istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

template <class T> ostream &operator<<(ostream &out, const vector<vector<T>> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << '\n';
    return out;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

void solve() {
    ll n, d;
    cin >> n >> d;
    ll ans = 0;
    rep(i, n) {
        ll x, y;
        cin >> x >> y;
        if (x * x + y * y <= d * d) ans++;
    }
    cout << ans << '\n';
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}


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

using namespace std;

int main(){
    int h,w;
    cin >> w >> h;
    int n;
    cin >> n;
    int ans = 0;
    int a = h+2*w-2;
    int b = h+2*w-6;
    while(n--){
        int p;
        cin >> p;
        if(p == 0) a--;
        else b--;
        if(a <= w-1 && b <= w-1){
            if(a == b) ans++;
        }
        if(w-1 <= b && b <= w+h-4 && w+1 <= a && a <= w+h-2){
            if(a-2 == b) ans++;
        }
        if(w+h-4 <= b && w+h <= a){
            if(a-4 == b) ans++;
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 3136
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
#include <numeric> //lcm
#include <iomanip> //double精度 setprecision

using namespace std;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = n-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define rrep1(i,n) for(int i = (n); i >= 1; --i)
#define REP(i,n,m) for(int i = (n); i < (m); ++i)
#define all(vec) (vec).begin(),(vec).end()

#define debug(vec) for(auto v : vec) cerr << v << " "; cerr << endl;
#define debug2D(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << v << " "; cerr << endl; } 
#define debugP(vec) for(auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl;
#define debug2DP(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl; } 

typedef long long ll;

constexpr ll INF = 1000000000; //10^10
//const ll MOD = 998244353;
constexpr ll MOD = 1000000007;

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

ll dfs(vector<int>& a, vector<int>& b, vector<int>& c, vector<int>& d, int n, int m, int q, vector<int> as, int depth) {
	ll ans0 = 0;
	if (n == depth) {
		rep(i, q) {
			if (as[b[i]] - as[a[i]] == c[i]) ans0 += d[i];
		}
		return ans0;
	}
	else {
		vector<int> nas(as.size() + 1);
		rep(i, as.size()) nas[i] = as[i];
		for (ll ai = as.back(); ai <= m; ++ai) {
			nas.back() = ai;
			chmax(ans0, dfs(a,b,c,d,n,m,q,nas,depth+1));
		}
		return ans0;
	}
}

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

	ll n,m,q; cin >> n >> m >> q;
	vector<int> a(q), b(q), c(q), d(q);
	rep(i, q) {
	  cin >> a[i] >> b[i] >> c[i] >> d[i];
		a[i]--; b[i]--;
	}

	vector<int> as(1); as[0] = 1;
	cout << dfs(a,b,c,d,n,m,q,as,1) << endl;
}



Measured memory_bytes: 3644
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>

using namespace std;
int main(){
    double x,h,high,ans;
    while(cin>>x>>h){
        if(x==0)break;
        ans=(x/2)*(x/2)+h*h;
        high=sqrt(ans);
        ans=(x*x)+(4*(x*high/2));
        printf("%lf\n",ans);
    }
    return 0;
}

Measured memory_bytes: 1232
#include <iostream>
#include <string>
#include <stdio.h>
#include <math.h>
#include <queue>
using namespace std;


int main(int argc, char* argv[])
{
	long long A = 0;
	int N;

	scanf("%d", &N);

	for(int i=1; i<N+1; i++){
		if(i % 3 != 0 && i % 5 != 0){
			A += i;
		}
	}

	printf("%lld", A);

	return 0;
}





Measured memory_bytes: 3828
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<set>
#include<tuple>
#include<ctime>
#include<functional>
#include<cmath>
#include<cassert>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> p; 
#define rep(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))

int main(){
    int N,sum1=0;
    cin>>N;
     int A=N;
    while(N>0){
        sum1+=N%10;
        N/=10;
    }
    if(A%sum1==0) p("Yes");
    else p("No");
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <complex>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <iterator>

using namespace std;

#define dump(n) cout<<"# "<<#n<<'='<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define iter(c) __typeof__((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();++i)
#define all(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;

const int INFTY=1<<29;
const double EPS=1e-9;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
	os<<'[';
	rep(i,a.size()) os<<(i?" ":"")<<a[i];
	return os<<']';
}

struct Edge{
	int from,to,dist,enemy;
	Edge(){}
	Edge(int f,int t,int d,int e):from(f),to(t),dist(d),enemy(e){}
};
typedef vector<vector<Edge>> Graph;

struct State{
	int v,money,enemy;
	State(){}
	State(int v,int m,int e):v(v),money(m),enemy(e){}
	bool operator<(const State& s)const{return enemy<s.enemy;}
	bool operator>(const State& s)const{return enemy>s.enemy;}
};

int main()
{
	for(int n,m,l;cin>>n>>m>>l,n|m|l;){
		Graph g(n);
		rep(i,m){
			int f,t,d,e; cin>>f>>t>>d>>e; f--,t--;
			g[f].emplace_back(f,t,d,e);
			g[t].emplace_back(t,f,d,e);
		}
		
		vvi dp(n,vi(l+1,INFTY)); // [頂点][残金]=>襲撃人数
		priority_queue<State,vector<State>,greater<State>> pq;
		pq.emplace(0,l,0);
		while(!pq.empty()){
			State cur=pq.top(); pq.pop();
			if(dp[cur.v][cur.money]!=INFTY) continue;
			dp[cur.v][cur.money]=cur.enemy;
			for(Edge e:g[cur.v]){
				pq.emplace(e.to,cur.money,cur.enemy+e.enemy);
				if(e.dist<=cur.money)
					pq.emplace(e.to,cur.money-e.dist,cur.enemy);
			}
		}
		
		int res=INFTY;
		rep(i,l+1)
			res=min(res,dp[n-1][i]);
		cout<<res<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 11384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N, M, p;
    cin >> N >> M >> p;
    vector<int> d(M);
    
    for(int i=0; i<M; ++i) {
        cin >> d[i];
        d[i] -= p;
        d[i] = (d[i] + N) % N;
    }
    
    sort(d.begin(), d.end());
    int res = min(d.back(), N - d[0]);
    
     for(int i=0; i<M-1; ++i) {
        res = min(res, min(2*d[i] + (N - d[i+1]), 2*(N - d[i+1]) + d[i]));
    }
   
    cout << res * 100 << endl;
    
}



Measured memory_bytes: 3188
s=list(input())
t=list(input())
n=len(t)
max_num=0
for i in range(0,len(s)-n+1):
  num=0
  for j in range(n):
    if t[j]==s[i+j]:num+=1
  max_num=max(max_num, num)
print(max(0,n-max_num))
  
  

Measured memory_bytes: 65132
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define pb push_back
#define all(x) x.begin(), x.end()
#define pi pair<int, int>
#define l first
#define r second
#define int long long

using namespace std;

const int maxn = 2e5 + 1, mod = 1e9 + 7;

int a[maxn], n;

pi solve(int md) {
    vector<pi> dp(n + 1);
    dp[0] = {0, 0};
    dp[1] = ((a[0] + md > 0) ? pi(a[0] + md, 1) : pi(0, 0));
    for (int i = 1; i < n; i++)
        dp[i + 1] = (dp[i - 1].l + a[i] + md > dp[i].l ? pi(dp[i - 1].l + a[i] + md, dp[i - 1].r + 1) : dp[i]);
    return dp[n];
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    int l = -1e12, r = 1e12;
    while (r - l > 1) {
        int md = (l + r) / 2;
        if (solve(md).r >= n / 2)
            r = md;
        else
            l = md;
    }
    auto gg = solve(r);
    cout << gg.l - (n/2) * r;
    return 0;
}


Measured memory_bytes: 8304
# -*- coding: utf-8 -*-

N = int(raw_input())
S = list()

_count = 0
_A = 0
_B = 0
_BA = 0
for i in range(N):
    S.append(raw_input())

for s in S:
    if s[-1] == "A":
        _A += 1
    if s[0] == "B":
        _B += 1
    if s[-1] == "A" and s[0] == "B":
        _BA += 1
    for i in range(len(s)-1):
        if s[i:i+2] == "AB":
            _count += 1
    
_count += min(_A,_B)
if _A == _B == _BA != 0:
    _count -= 1

print str(_count)

Measured memory_bytes: 3452
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	Scanner sc = new Scanner(System.in);

	void run() {
		int b1 = sc.nextInt();
		int b2 = sc.nextInt();
		int b3 = sc.nextInt();
		int b = b1 * 4 + b2 * 2 + b3;
		switch (b) {
		case 4:
		case 2:
		case 0:
			System.out.println("Close");
			break;
		case 6:
		case 1:
			System.out.println("Open");
			break;
		}
	}

	public static void main(String[] args) {

		new Main().run();
	}

}

Measured memory_bytes: 17180
N,M=map(int,input().split())
a=[0 for i in range(M)]
b=[0 for i in range(M)]
cnt=[0 for i in range(N)]
for i in range(M):
    a[i],b[i]=map(int,input().split())

for j in range(M):
    cnt[a[j]-1]+=1
    cnt[b[j]-1]+=1

for s in range(N):
    print(cnt[s])

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

unsigned long long gcd(unsigned long long a, unsigned long long b) {
    if(a < b) {
        return gcd(b, a);
    }
    unsigned long long r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

int main() {
    int K;
    cin >> K;
    long long ans = 0;
    for (int i = 1; i <= K ; ++i) {
        for (int j = 1; j <= K ; ++j) {
            for (int k = 1; k <= K; ++k) {
                ans += gcd(gcd(i, j), k);
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3580
m,d = map(int,input().split())
ans = 0
for i in range(1,d+1):
    if i % 10 <= 1:
        continue
    if i // 10 <= 1:
        continue
    tmp_1 = i%10
    tmp_2 = i//10
    if tmp_1*tmp_2 <= m:
        ans += 1
        
print(ans)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(),(obj).end()
#define SORTD(s) sort((s).rbegin(),(s).rend())
#define rep(i,n) for(int i=0;i<(n);i++)
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; }
typedef long long ll;
#define PI 3.14159265358979323846264338327950L
const int mod=1000000007,MAX=200005,INF=1<<30;

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

  	int ans=0;
  
	for(int i=1;i<=n;i++)
          ans +=(n-1)/i;

  
  cout<<ans<<endl;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
const int maxn = 1e5+5;

int main ()
{
    int n;
    scanf("%d",&n);
    int a[maxn], cnt[maxn], Max = -1;
    memset(cnt,0,sizeof(cnt));
    rep(i,1,n+1) {
        scanf("%d",&a[i]);
        cnt[a[i]]++;
        cnt[a[i]+1]++;
        cnt[a[i]+2]++;
        Max = max(Max,cnt[a[i]]);
        Max = max(Max,cnt[a[i]+1]);
        Max = max(Max,cnt[a[i]+2]);
    }
    cout<<Max<<endl;

    return 0;
}

Measured memory_bytes: 1024
#define _CRT_NONSTDC_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <list>
#include <iomanip>
#include <queue>
#include <functional>
#include <cassert>
#include <cmath>
#include <set>
#include <map>
#include <numeric>

#define NL << endl
#define REP(i,n) for(int (i) = 0; i < (n); ++(i))
#define IN(n) cin >> (n)
#define INR(n) for(auto&& e:(n)) cin >> e
#define Yes cout << "Yes" NL
#define No cout << "No" NL

using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr int INTMAX = numeric_limits<int>::max();
constexpr int INTMIN = numeric_limits<int>::min();
constexpr ll LLMAX = numeric_limits<long long>::max();
constexpr ll LLMIN = numeric_limits<long long>::min();
constexpr int MOD = 1000000007;


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

using namespace std;

bool a[200000] = { 0 };
bool b[200000] = { 0 };

signed main() {
	int n, m;
	IN(n);
	IN(m);
	n--, m--;
	for (int i = 0; i < 200000; i++) {
		int e, r;
		cin >> e >> r;
		e--, r--;
		if (e == 0) a[r] = true;
		if (r == 0) a[e] = true;
		if (e == n) b[r] = true;
		if (r == n) b[e] = true;
	}
	for (int i = 0; i < 200000; i++) {
		if (a[i] && b[i]) {
			cout << "POSSIBLE" NL;
			return 0;
		}
	}

	cout << "IMPOSSIBLE" NL;
	return 0;

}



Measured memory_bytes: 640
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		long X = sc.nextLong();
		long K = sc.nextLong();
		long D = sc.nextLong();
		sc.close();

		long answer = 0L;
		if(X == 0L){
			if(K % 2L == 0L){
				answer = 0L;
			} else {
				answer = D;
			}
		} else {
			if(X < 0L){
				X *= -1L;
			}
			long quotient = X / D;
			if(K < quotient){
				answer = X - (K * D);
			} else {
				long mod = X % D;
				K -= quotient;
				if(K % 2L == 0L){
					answer = mod;
				} else {
					answer = Math.abs(mod - D);
				}
			}
		}
		System.out.println(answer);
	}

}

Measured memory_bytes: 35652
/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
If I'm the sun, you're the moon
Because when I go up, you go down
*******************************
I'm working for the day I will surpass you
https://www.a2oj.com/Ladder16.html
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class Main
   {
      public static void main(String omkar[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));  
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int N = Integer.parseInt(st.nextToken());
         long sum = 0L;
         for(int a=1; a <= N; a++)
            for(int b=1; b <= N; b++)
               for(int c=1; c <= N; c++)
                  sum += gcd(gcd(a,b),c);
          System.out.println(sum);
      }
      public static long gcd(long a, long b)
      {
         if(a > b)
         {
            long t = a;
            a = b;
            b = t;
         }
         if(a == 0L)
            return b;
         return gcd(b%a, a);
      }
   }

Measured memory_bytes: 32844
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;

int main(void) {
    string S;
    cin >> S;

    int N = S.size()-1;
    int64_t ans = 0;
    for( int bit = 0; bit < 1 << N; bit++ ) {
        string formula = S;
        int addIndex=1;
        for( int i=0; i < N; i++ ) {
            if( (bit>>i) & 1 == 1 ){
                formula.insert(addIndex, "+");
                addIndex++;
            }
            addIndex++;
        }
        int k=0;
        int64_t sum=0;
        while( formula[k] != '\0'){
            if( formula[k] != '+' ){
                sum = sum * 10 + (formula[k] - '0');
            } else {
                ans += sum;
                sum = 0;
            }
            k++;
        }
        ans += sum;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int x, i;
	
	i = 1;
	while (1)
	{
		scanf("%d", &x);
		if(x <= 0) break;
		printf("Case %d: %d\n",i, x);
		i = i + 1;
	}
	
	return 0;
}

Measured memory_bytes: 600
n, q = map(int, input().split())
s = input()
a = [0]*(len(s)+5)

for i in range(len(s)):
    if s[i:i+2] == 'AC':
        a[i+2] = a[i+1]+1
    else:
        a[i+2] = a[i+1]

# print(a)
for i in range(q):
    l, r = map(int, input().split())
    print(a[r]-a[l])

Measured memory_bytes: 6164
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <time.h>

using namespace std;
typedef long long ll;
#define pl pair<ll,ll>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)
#define dbg(x) cout << #x"="<< (x) << endl
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a) 
#define in(x) cin >> x;
#define all(x) (x).begin(), (x).end()
#define INF 2147483600
#define fi first
#define se second

int main(){
    ll n;cin>>n;
    vector<ll> a(n+1);
    a[0]=0;
    rep(i,n){
      cin>>a[i+1];
    }
    int total=0;
    FOR(i,1,n+1){
      total+=abs(a[i]-a[i-1]);
    }
    total+=abs(a[n]);

    FOR(i,1,n+1){
        if(i!=n){
            cout<<total-abs(a[i]-a[i-1])-abs(a[i+1]-a[i])+abs(a[i+1]-a[i-1])<<endl;
        }else{
            cout<<total-abs(a[n]-a[n-1])-abs(a[n])+abs(a[n-1])<<endl; 
        }
    }
    return 0;
}

Measured memory_bytes: 2048
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#include<functional>
#define rep(i,n,m) for(int i=(n);i<(int)(m);i++)
#define reps(i,n,m) for(int i=(n);i<=(int)(m);i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define fs first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define LB(a,x) lb(all(a), x) - a.begin()
#define UB(a,x) ub(all(a), x) - a.begin()
#define printfdouble(x) printf("%.20f\n",(x))
#define chartoint(c) (int)((c) - '0')
#define chartoll(c) (long long)((c) - '0')
#define MOD 1000000007
#define itn int
#define enld endl
#define ednl endl
#define icn cin
#define cotu cout
#define Endl endl
#define stirng string
using namespace std;
typedef long long ll;
const double pi = 3.141592653589793;
using Graph = vector<vector<int>>;
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<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    ll N; cin >> N;
    vector<ll> A(N);
    vector<ll> B(N);
    rep(i,0,N) cin >> A[i] >> B[i];
    sort(all(A));
    sort(all(B));
    ll ans;
    if(N % 2 != 0){
        ans = B[N/2] - A[N/2] + 1;
    }else{
        ans = (B[N/2-1] + B[N/2]) - (A[N/2-1] + A[N/2]) + 1;
    }

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

Measured memory_bytes: 6348
#include <iostream>
#include <functional>
#include <algorithm>
#include <cstdio>
using namespace std;

int main(void) {
    int n;
    int a, b;
    int P[101];

    scanf("%d", &n);
    scanf("%d", &a);
    scanf("%d", &b);

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

   // sort(P, P+n);

    int easy=0, mid=0, hard=0; 
    for(int j=0; j<n; j++) {
        if (P[j] <= a) easy++;
        else if (P[j] > a && P[j] <= b) mid++;
        else hard++;
    }
    int m = min(easy, mid);
    m = min(m, hard);

    cout << m << endl;
}
        


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

#define int long long
#define itn int
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'
#define SZ(x) ((int)(x).size())
#define bit(n) (1LL << (n))
constexpr int MOD = 1e9 + 7;

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = LLONG_MAX / 2;
using P = pair<int, int>;
using vec = vector<int>;
template <typename T>
using mat = vector<vector<T>>;

// clang-format off
template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) { return stream << p.first << "," << p.second; }
template <typename T>
void print(const vector<T> vec) { rep (i, vec.size() - 1) cout << vec[i] << ' '; cout << vec[vec.size() - 1] << '\n'; }
template <typename Arg>
void print(const Arg arg) { cout << arg << '\n'; }
template <typename Head, typename... Args>
void print(const Head head, const Args... args) { cout << head << " "; print(args...); }
template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) { rep (i, v.size()) cin >> v[i] >> w[i]; }
template <typename T>
void init(vector<T>& v) { rep (i, v.size()) cin >> v[i]; }
template <typename T>
T sum_(vector<T> vec, T init = 0) { return std::accumulate(all(vec), T(init)); }
template<typename T>
bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T>
bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <typename T>
int index(const T& vec, const typename T::iterator it) { return distance(vec.begin(), it); }
template <typename T = int>
mat<T> mmat(int n, int m=0) { return mat<T>(n, vector<T>(m)); }
template <typename T = int>
vector<T> ivec(int n) { vector<T> v(n); init(v); return v; }
// clang-format on

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
// -------------------------------------------------------------------
// sort 1 2 3 4
// pqr 1 2 3 must impl >

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    if (a > b) {
        rep (i, a)
            cout << b;
        cout << endl;
    } else {
        rep (i, b)
            cout << a;
        cout << endl;
    }

    return 0;
}


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

int main(){
  int N;
  string S;
  cin >> N >> S;
  int r = 0, b = 0;
  for(int i = 0; i < N; ++i){
    if(S[i] == 'R') ++r;
    else ++b;
  }
  if(r > b) cout << "Yes" << endl;
  else cout << "No"<< endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        char c = n.charAt(n.length() - 1);
        if (c == '2' || c == '4' || c == '5' || c == '7' || c == '9') {
            System.out.println("hon");
        } else if (c == '3') {
            System.out.println("bon");
        } else {
            System.out.println("pon");
        }
    }

}


Measured memory_bytes: 35668
import sys
N = list(map(int, input().split()))

while N[0]>0 and N[2]>0:
    N[2] -= N[1]
    if N[2]<1:
        print('Yes')
        sys.exit()
    N[0] -= N[3]
    if N[0]<1:
        print('No')
        sys.exit()


Measured memory_bytes: 8872
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
def A():
    n = I()
    print(n*800-200*(n//15))

#B
def B():
    k = I()
    ans = 0
    for i in range(1,k):
        for j in range(i+1,k+1):
            if (i%2)^(j%2):
                ans += 1
    print(ans)

#C
def C():
    x,t = LI()
    print(max(0,x-t))

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

def J():
    return

def K():
    return

#Solve
if __name__ == "__main__":
    C()


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

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    ll a[n];
    for(int i=0;i<n;i++) cin >> a[i];
    ll c = 1, ans = 0;
    for(int i=0;i<n;i++){
    	if(i == 0) ans += a[i] - 1, a[i] = 1;
    	if(c == a[i]){
    		c++;
    		continue;
    	}
    	if(c > a[i]) continue;
    	if(a[i] % c == 0){
    		ans++;
    		a[i] -= (c + 1);
    		i--;
    		continue; 
    	}
    	ans += a[i] / c;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<set>
using namespace std;
int main()
{
    int n,m;
    cin>>n;
    cin>>m;
    if(m<2){
        cout<<"IMPOSSIBLE";
        return 0;
    }
    set<int> s1,s2;
    vector<vector<int>> res(m,vector<int>(2,0));
    for(int i=0;i<m;i++){
        cin>>res[i][0];
        cin>>res[i][1];
        if(res[i][0]==1){
            if(s2.count(res[i][1])!=0) {
                cout << "POSSIBLE";
                return 0;
            }
            s1.insert(res[i][1]);
        }
        if(res[i][1]==n){
            if(s1.count(res[i][0])!=0) {
                cout << "POSSIBLE";
                return 0;
            }
            s2.insert(res[i][0]);
        }
    }
    cout<<"IMPOSSIBLE";
    return 0;
}

Measured memory_bytes: 20608
N = int(input())
List = list(int(i) for i in input().split())
count = 0

def cal(n):
    count = 0
    while True:
        if n % 2 == 0:
            count += 1
            n /= 2
        else:
            break
    return count

for i in List:
    count += cal(i)

print(count)


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

int		main(void)
{
	string str;
	cin >> str;
	ll q;
	cin >> q;
	ll i = 0;
	int	t, f;
	string c;
	string pre = "";
	string aft = "";
	int rev = 1;
	int tmp;
	while (i < q)
	{
		cin >> t;
		if (t == 1)
			rev *= -1;
		else
		{
			cin >> f >> c;
			if (f == 1)
				tmp = rev * -1;
			else
				tmp = rev;
			if (tmp > 0)
				aft = aft + c;
			else
				pre = c + pre;
		}
		i++;
	}
	if (rev < 0)
	{
		reverse(str.begin(), str.end());
		reverse(pre.begin(), pre.end());
		reverse(aft.begin(), aft.end());
		cout << aft << str << pre;
	}
	else
		cout << pre << str << aft;
}


Measured memory_bytes: 1208
#include<stdio.h>
#include <string.h>
int main(void){
  int i, j, tmp;
  char a[100], b[100];
  scanf("%s %s", a, b);
  for( i = 0; i < strlen(a); i++){
    for( j = i + 1 ; j < strlen(a); j++){
      if( a[i] > a[j]){
        tmp = a[j];
        a[j] = a[i];
        a[i] = tmp;
      }
    }
  }
  for( i = 0; i < strlen(b); i++){
    for( j = i + 1 ; j < strlen(b); j++){
      if( b[i] < b[j]){
        tmp = b[j];
        b[j] = b[i];
        b[i] = tmp;
      }
    }
  }
  if( strcmp( a, b) < 0 ){
    puts("Yes");
  }else{
    puts("No");
  }
  return 0;
}

Measured memory_bytes: 128
# = map(int, input().split())
# = list(map(int, input().split()))
n, x, y = map(int, input().split())
x -= 1
y -= 1
ans = [0] * n
for i in range(n):
    for j in range(i+1, n):
        dist = min([j-i, abs(x-i)+abs(y-j)+1, abs(y-i)+abs(x-j)+1]) 
        ans[dist] += 1
for k in range(1, n):
    print(ans[k])


Measured memory_bytes: 3444
# coding : utf-8

import numpy as np

A,B,C = input().split()
A,B,C = int(A),int(B),int(C)


maxl = max(A,B,C)
diff = [maxl-A,maxl-B,maxl-C]

diff = sorted(diff)

count = 0

count += diff[1]
diff[2] -= diff[1]

count += int(diff[2]/2)
diff[2] = diff[2]%2

if diff[2] == 1:
	count += 2

print(int(count))

Measured memory_bytes: 21636
#include <iostream>
#include <iomanip>
#include <array>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <tuple>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <numeric>
#include <cassert>
#include <functional>
using namespace std;

typedef unsigned long long int llui;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
constexpr double pi = 3.141592653589793238462643383279502884L;

// TODO: Mod class

const int sz = 1e5;

int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int& x : a) {
    cin >> x;
    --x;
  }
  vector<int> pass(n);
  int cur = 0;
  int step = 0;
  while (true) {
    if (pass[cur] == true) {
      cout << -1 << endl;
      return 0;
    }
    if (cur == 1) {
      cout << step << endl;
      return 0;
    }
    ++step;
    pass[cur] = true;
    cur = a[cur];
  }
}


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

using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> height(n), count(n, 1), check(n);

    for (int i = 0; i < n; i++)
    {
        cin >> height.at(i);
    }

    for (int i = 0; i < m; i++)
    {
        int a, b;
        cin >> a >> b;
        check.at(a - 1) = 1;
        check.at(b - 1) = 1;

        if (height.at(a - 1) >= height.at(b - 1))
        {
            count.at(b - 1) = 0;
        }
        if (height.at(b - 1) >= height.at(a - 1))
        {
            count.at(a - 1) = 0;
        }
    }

    int c = 0;

    for (int i = 0; i < n; i++)
    {
        if (count.at(i) == 1)
        {
            c++;
        }
        else if (check.at(i) == 0)
        {
            c++;
        }
    }

    cout << c << endl;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
string S[55];
int T[55];
string B;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,N) {
		cin>>S[i]>>T[i];
	}
	cin>>B;
	int sum=0;
	int a=0;
	FOR(i,N) {
		if(a) sum+=T[i];
		a |= S[i]==B;
	}
	cout<<sum<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


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

using namespace std;

int main()
{
    int N;
    cin >> N;

    int count = 0;
    for (int c = 1; c < N; ++c)
    {
        int n = N - c;
        int ns = floor(sqrt(n));
        for (int a = 1; a <= ns; ++a)
        {
            if (n % a == 0)
            {
                if (a == n / a)
                {
                    count += 1;
                }
                else
                {
                    count += 2;
                }
            }
        }
    }

    cout << count;
}

Measured memory_bytes: 3204
#include <iostream>
#include <algorithm>
#include <set>
#include <cstring>
using namespace std;
typedef long long ll;
ll n,k,ans,s,m,t;
ll a[100005];
int main(void){
   scanf("%lld%lld",&n,&k);
   for(int i=0;i<n;i++){
       ll x;
       scanf("%lld",&x);
       if(x>0)ans+=x;
       a[i]=x;
   }
   for(int i=0;i<k;i++){
       if(a[i]<0)s+=a[i];
       else t+=a[i];
   }
   m=max(s,-t);
   for(int i=k;i<n;i++){
       if(a[i]<0)s+=a[i];
       else t+=a[i];
       if(a[i-k]<0)s-=a[i-k];
       else t-=a[i-k];
       m=max(m,max(s,-t));
   }
   printf("%lld\n",ans+m);
}

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

int main()
{
  int N, K;
  cin >> N >> K;
  
  int *p1;
  p1 = new int[N];

  for(int i=0; i<N; ++i)
  {
    cin >> p1[i];
  }
  
  int tmp=0;
  
  for (int i=0; i<N; ++i) {
    for (int j=i+1; j<N; ++j) {
      if (p1[i] > p1[j]) {
        tmp =  p1[i];
        p1[i] = p1[j];
        p1[j] = tmp;
      }
    }
  }
  
  int max=0;
  
  for(int i=0; i<K; ++i)
  {
    max+=p1[i];
  }
  
  cout << max << endl;
  
  return 0;
}
  

Measured memory_bytes: 3632
#include <stdio.h>
int A,B,C,D,E,T;
int main(){
  scanf("%d %d %d %d %d",&A,&B,&C,&D,&E);
  if(A>0){
    T=(B-A)*E;
  } else if(A<0){
    T=(0-A)*C+D+B*E;
  }
  printf("%d\n",T);
  return 0;
}

Measured memory_bytes: 2660
n = int(input())
num_list = list(map(int, input().split()))

ans_list = [0] * (max(num_list)+1)
for i in range(max(num_list)+1):
    for j in range(n):
        ans_list[i] += ((num_list[j] - i)**2)

print(min(ans_list))


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) x.begin(),x.end()
#define dmp(x) cerr<<#x<<":"<<x<<endl
#define FOR(i,a,b) for(int i=(int)a,c=(int)b;i<c;++i)
#define rep(i,b) FOR(i,0,b)
#define ROF(i,a,b) for(int i=b-1,c=(int)a;i>=c;--i)
#define per(i,b) ROF(i,0,b)
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

signed main(){
  int a,p;
  cin>>a>>p;
  cout<<(a*3+p)/2<<endl;
  return 0;
}


Measured memory_bytes: 256