akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <limits.h>
using namespace std;

int main(int argc, const char * argv[]) {
  int N;
  int minn,maxn;
  int result=0;
  cin>>N;
  int excolor=0;
  vector<bool> color(8,0);
  for(int i=0;i<N;i++){
    int tmp;
    cin>>tmp;
    if(tmp<400){color[0]=1;}
    else if(tmp<800){color[1]=1;}
    else if(tmp<1200){color[2]=1;}
    else if(tmp<1600){color[3]=1;}
    else if(tmp<2000){color[4]=1;}
    else if(tmp<2400){color[5]=1;}
    else if(tmp<2800){color[6]=1;}
    else if(tmp<3200){color[7]=1;}
    else{excolor++;}
  }
  for(int j=0;j<8;j++){
    if(color[j]==1) result++;
  }
  cout << max(result, 1) << " " << excolor + result << endl;
  return 0;
}


Measured memory_bytes: 256
#![allow(unused_imports)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;
use std::ops::Bound::*;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let t = read::<usize>();
    for i in 0..t {
        let v = read_vec::<i64>();
        let (n, m, a, b) = (v[0], v[1], v[2], v[3]);
        let ans = floor_sum(n, m, a, b);
        println!("{}", ans);
    }
}

fn floor_sum(n: i64, m: i64, a: i64, b: i64) -> i64 {
    fn internal(n: i64, m: i64, mut a: i64, mut b: i64, mut acc: i64) -> i64 {
        if a >= m {
            let q = a / m;
            acc += (n - 1) * n / 2 * q;
            a -= q * m;
        }
        if b >= m {
            let q = b / m;
            acc += n * q;
            b -= q * m;
        }
        let y_max = (a * n + b) / m;
        let x_max = y_max * m - b;
        if y_max == 0 {
            return acc;
        }
        acc += (n - (x_max + a - 1) / a) * y_max;
        let mut sub_b = a - x_max % a;
        if sub_b >= a {
            sub_b -= a;
        }
        internal(y_max, a, m, sub_b, acc)
    }
    internal(n, m, a, b, 0)
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 2228
#include<bits/stdc++.h>
#define int long long
#define all(a) a.begin(),a.end()
#define sz(a) a.size()
#define re return 
#define MP make_pair
#define pb push_back
#define pii pair<int,int>
#define se second
#define fi first
using namespace std;
int a,b;
string s;
signed main(){
	ios_base::sync_with_stdio(0);
	cin>>a>>b>>s;
	if(s[a]!='-'){
		cout<<"No";
		re 0;
	}
	s.erase(s.begin()+a);
	for(int i=0;i<a+b;i++){
		if(!isdigit(s[i])){
			cout<<"No";
			re 0;
		}
	}
	cout<<"Yes";
	re 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <assert.h>
#include <functional>
#include <unordered_map>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						(int)2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define ArrayLength(x)			(sizeof( x ) / sizeof( x[ 0 ]))
#define	MAX_QWORD				((QWORD)0xFFFFFFFFFFFFFFFF)
#define M_PI					3.14159265358979323846
typedef long long				ll;
typedef unsigned long long int	QWORD;
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/

int main()
{
	int N, A;
	string S;
	cin >> N >> A;
	vector<ll> x(N);
	REP(i, N) cin >> x[i];
	REP(i, N) x[i] -= A;
	sort(x.begin(), x.end());

	int valMax = N * 50;
	int halfVal = valMax / 2;
	vector<vector<ll>> dp(N + 1, vector<ll>(valMax, 0));
	
	dp[0][halfVal] = 1;
	REP(i, N) {
		REP(j, valMax) {
			if (0 < dp[i][j]) {
				dp[i + 1][j] += dp[i][j];
				dp[i + 1][j + x[i]] += dp[i][j];
			}
		}
	}

	cout << dp[N][halfVal] - 1<< endl;
	return 0;
}



Measured memory_bytes: 1280
#include <cstdio>
#include <cmath>

#define Rep(i, n) for (int i = 1; i <= n; i ++)

using namespace std;

const int N = 410, N0 = 1e7 + 10;

int d0[N], d[N], cd;

bool isnotprime[N0];
int prime[N0], cnt;
void get_prime()
{
	isnotprime[1] = true;
	for (int i = 2; i <= 1e7 + 5; i ++){
		if (!isnotprime[i]) prime[++ cnt] = i;
		for (int j = 1; j <= cnt && i * prime[j] <= 1e7 + 5; j ++) {
			isnotprime[i * prime[j]] = true;
			if (!(i % prime[j])) break;
		}
	}
}

bool g[N][N], vis[N];
int lnk[N];

bool dfs(int x)
{
	Rep(i, cd) if (g[x][i] && !vis[i]){
		vis[i] = true;
		if (lnk[i] == -1 || dfs(lnk[i])) {
			lnk[i] = x;
			return true;
		}
	}
	return false;
}

int main()
{
	int n;
	scanf("%d", &n);
	Rep(i, n) scanf("%d", &d0[i]);
	d0[0] = -1;
	Rep(i, n) {
		if (d0[i - 1] != d0[i] - 1) d[++ cd] = d0[i];
		if (d0[i + 1] != d0[i] + 1) d[++ cd] = d0[i] + 1;
	}
	
	get_prime();
	Rep(i, cd) if (d[i] & 1)
		Rep(j, cd) if (!(d[j] & 1))
			if (!isnotprime[(int)abs(d[j] - d[i])]) g[i][j] = true;
	
	int c0 = 0, c1 = 0, cc = 0;
	Rep(i, cd) lnk[i] = -1;
	Rep(i, cd) {
		if (d[i] & 1) {
			Rep(j, cd) vis[j] = false;
			if (dfs(i)) cc ++;
			c1 ++;
		}
		else c0 ++;
	}
	int ans = cc;
	c0 -= cc, c1 -= cc;
	ans += (c0 / 2) * 2, c0 %= 2;
	ans += (c1 / 2) * 2, c1 %= 2;
	if (c0 && c1) ans += 3;
	
	printf("%d\n", ans);
	
	return 0;
}

Measured memory_bytes: 14208
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using i128 = boost::multiprecision::int128_t;
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using Vbo = vector<bool>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using VVbo = vector<Vbo>;
using VVV = vector<VV>;
using VVVll = vector<VVll>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
#define rep2(i, m, n) for(int i=int(m); i<int(n); ++i)
#define drep2(i, m, n) for(int i=int(m)-1; i>=int(n); --i)
#define rep(i, n) rep2(i, 0, n)
#define drep(i, n) drep2(i, n, 0)
#define all(a) a.begin(), a.end()
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << " "; return os; }
template<typename T> inline int count_between(vector<T> &a, T l, T r) { return lower_bound(all(a), r) - lower_bound(all(a), l); } // [l, r)
inline int fLog2(const int x) { return 31-__builtin_clz(x); } // floor(log2(x))
inline int fLog2(const ll x) { return 63-__builtin_clzll(x); }
inline int cLog2(const int x) { return (x == 1) ? 0 : 32-__builtin_clz(x-1); } // ceil(log2(x))
inline int cLog2(const ll x) { return (x == 1) ? 0 : 64-__builtin_clzll(x-1); }
inline int popcount(const int x) { return __builtin_popcount(x); }
inline int popcount(const ll x) { return __builtin_popcountll(x); }
const int INF  = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS   = 1e-10;
const ld PI    = acos(-1.0);
const int MOD  = int(1e9)+7;
// const int MOD  = 998244353;

Vll a;
VV G;
V deg;

void ng() {
  cout << "NO\n";
  exit(0);
}

ll dfs(int u, int p=-1) {
  if (p != -1 && deg[u] == 1) return a[u];
  ll res = 2*a[u];
  for (int v : G[u]) if (v != p) {
    ll x = dfs(v, u);
    if (x > a[u]) ng();
    res -= x;
  }
  if (res < 0 || res > a[u]) ng();
  return res;
}

int main() {
  ll n; cin >> n;
  a.assign(n, 0);
  deg.assign(n, 0);
  cin >> a;

  G.assign(n, V());
  rep(i, n-1) {
    int a, b; cin >> a >> b;
    --a; --b;
    G[a].push_back(b);
    G[b].push_back(a);
    ++deg[a];
    ++deg[b];
  }

  ll x = dfs(0);
  if (deg[0] == 1 && x != a[0]) ng();
  if (deg[0] != 1 && x != 0) ng();
  cout << "YES\n";
  return 0;
}


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

void cut(vector<int>& a, int p, int c) {
  vector<int> ptemp(p), ctemp(c);
  for (int i = 0; i < p; i++) {
    ptemp[i] = a[i];
  }
  for (int i = 0; i < c; i++) {
    ctemp[i] = a[p + i];
  }
  for (int i = 0; i < c; i++) {
    a[i] = ctemp[i];
  }
  for (int i = 0; i < p; i++) {
    a[i + c] = ptemp[i];
  }/*
  for (int i = 0; i < a.size();i++){
    printf("%2d", a[i]);
  }
  cout << endl;
  */
  return;
}

int main() {
  int n, r;
  while (1) {
    cin >> n >> r;
    if (n == 0) {
      break;
    }
    vector<int> a(n);
    iota(a.rbegin(), a.rend(), 1);
    // cout << a[0] << " " << a[1] << " " << a[2] << endl;
    int p, c;
    for (int i = 0; i < r; i++) {
      cin >> p >> c;
      p--;
      cut(a, p, c);
    }
    cout << a[0] << endl;
  }
  return 0;
}


Measured memory_bytes: 2988
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL


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

    int N;
    vs32 a;
    cin >> N;

    a.resize(N, 0);
    int A;
    rep (i, N)
    {
        cin >> A;
        ++a[A];
    }

    u64 ans = 0;
    bool flag = true;
    int n = 0;
    if ((N & 1) == 1)
    {
        for (int i = 2; i < N && flag; i += 2)
        {
            if (a[i] != 2) flag = false;
        }
        if (flag)
        {
            n = (N - 1) / 2;
            ans = 1;
        }
    }
    else
    {
        for (int i = 3; i < N && flag; i += 2)
        {
            if (a[i] != 2) flag = false;
        }
        if (flag)
        {
            n = N / 2;
            ans = 1;
        }
    }

    while (n > 0)
    {
        ans *= 2;
        ans %= MOD;
        --n;
    }

    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 640
#include <vector>
#include <array>
#include <algorithm>
#include <iostream>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <math.h>
#include <assert.h>
#include <queue>
#include <deque>
#include <iomanip>
#include <numeric>
#include <fstream>

using namespace std;

typedef long long ll;
typedef long double ld;

#define fi first
#define se second

#define mp make_pair
#define pb push_back
#define sz(x) ((int)(x).size())

typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<ld>> vvd;
typedef vector<string> vs;
typedef vector<bool> vb;

typedef pair <int, int> pii;
typedef pair <ll, ll> pll;


int main() {
    cout << setprecision(30);
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

    string s;
    cin >> s;
    ll ans = 0;
    ll n = sz(s);

    string last = "";
    for (int i = 0; i < n; ++i) {
        if (s.substr(i, 1) != last) {
            ++ans;
            last = s.substr(i, 1);
            continue;
        } else {
            if (i + 1 < n) {
                ++i;
                ++ans;
                last = s.substr(i, 2);
            } else {
                break;
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 720
#include <stdio.h>
#define N 100
int G[N][N],d[N],n,t,Q[N],head,tail;

void BFS(void);
void enqueue(int);
int dequeue(void);

int main (){
  int i,j,k,u,v;

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

  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d",&v);
      G[u-1][v-1] = 1;
    }
  }

  BFS();

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

void BFS(void){
  
  int v,i;
  
  d[0] = 0;
  head = 0;
  tail = 0;
  enqueue(0);

  while(head != tail){
    v = dequeue();
    for(i=0;i<n;i++){
      if(G[v][i] && d[i] == -1){
        d[i] = d[v]+1;
        enqueue(i);
      }
    }
  }
  
  return;
}

void enqueue(int n){
  Q[tail] = n;
  tail++;
  if(tail==N) tail=1;
}
int dequeue(){
  int n;
  n = Q[head];
  head++;
  if(head==N) head=1;
  return n;
}

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

int main(){
	string s;
	cin>>s;

	int a[s.size()];


		for (char j = 'a'; j < 'z'; j++){
			int count=0;
		for (int i = 0; i < s.size(); i++){
			if(s[i]==j){
				count++;
			}
		}
		if(count%2==1){
			cout<<"No"<<endl;
			return 0;
		}
	}

	cout<<"Yes"<<endl;

}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int a, b, c;
	int r_cnt=0, l_cnt=0;

	while( ~scanf("%d,%d,%d", &a, &b, &c) ){
		if( a*a + b*b == c*c ){
			r_cnt++;
		}else if( a==b ){
			l_cnt++;
		}
	}

	printf("%d\n", r_cnt);
	printf("%d\n", l_cnt);

	return 0;
}
				

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

using namespace std;

typedef long long ll;

int main(){


	ll p,q;

	while(cin>>p>>q){
		set<ll> dNumList;
		string retStr;
		p*=10;
		dNumList.insert(p);
		while(1){
			if(p<q){
				retStr+='0';
				p*=10;
				if(dNumList.find(p)!=dNumList.end()){
					break;
				}
				dNumList.insert(p);
			}
			else{
				ll left = p % q;
				ll np = p / q;
				retStr+=('0'+np);
				p=left*10;
				if(p==0){
					break;
				}
				if(dNumList.find(p)!=dNumList.end()){
					break;
				}
				dNumList.insert(p);
			}
		}
		cout<<retStr<<endl;
		if(p==0){
			continue;
		}
		else{
			string sufs;
			dNumList.clear();
			dNumList.insert(p);
			while(1){
				if(p<q){
					sufs+='0';
					p*=10;
					if(dNumList.find(p)!=dNumList.end()){
						break;
					}
					dNumList.insert(p);
				}
				else{
					ll left = p % q;
					ll np = p / q;
					if(np==0){
						break;
					}
					sufs+=('0'+np);
					p=left*10;
					if(dNumList.find(p)!=dNumList.end()){
						break;
					}
					dNumList.insert(p);
				}
			}
			ll empSize=retStr.size()-sufs.size();
			string loops;
			for(int i = 0; i < retStr.size(); i++){
				if(i>=empSize){
					loops+='^';
				}
				else{
					loops+=' ';
				}
			}
			cout<<loops<<endl;
		}
	}

	//while(cin>>p>>q){
	//	set<ll> dNumList;
	//	string retStr;
	//	ll pp=p;
	//	const ll qq=q;
	//	dNumList.insert(pp);
	//	bool f=false;


	//	bool z=false;
	//	// pp>qqツづ個湘ェツ債、pp<qqツづ可づ按づゥツづ慊づ可可算
	//	while(1){
	//		if(pp<qq){
	//			ll cnt=0;
	//			while(pp<qq){
	//				pp*=10;
	//				if(dNumList.find(pp)!=dNumList.end()){
	//					f=true;
	//					break;
	//				}
	//				if(cnt>=1)
	//					retStr+='0';
	//				dNumList.insert(pp);
	//				cnt++;
	//			}
	//			if(f)
	//				break;
	//		}

	//		ll left=pp%qq;
	//		pp/=qq;
	//		retStr+=(char)(pp+'0');
	//		pp=left;

	//		if(dNumList.find(pp)!=dNumList.end())
	//			break;
	//		if(pp==0){
	//			z=true;
	//			break;
	//		}
	//		dNumList.insert(pp);
	//	}
	//	f=false;
	//	string sufs;
	//	if(z){
	//		cout<<retStr<<endl;
	//		continue;
	//	}

	//	int init=0;
	//	if(f){
	//		init=1;
	//	}

	//	if(pp!=0){
	//		dNumList.clear();
	//		dNumList.insert(pp);

	//		while(1){
	//			if(pp<qq){
	//				ll cnt=init;

	//				while(pp<qq){
	//					pp*=10;
	//					if(dNumList.find(pp)!=dNumList.end()){
	//						f=true;
	//						break;
	//					}
	//					if(cnt>=1)
	//						sufs+='0';
	//					dNumList.insert(pp);
	//					cnt++;
	//				}
	//				if(f)
	//					break;
	//			}
	//			init=0;
	//			ll left=pp%qq;
	//			pp/=qq;
	//			sufs+=(char)(pp+'0');
	//			pp=left;
	//			
	//			if(dNumList.find(pp)!=dNumList.end()||pp==0)
	//				break;
	//			dNumList.insert(pp);
	//		}
	//	}			

	//	cout<<retStr<<endl;
	//	ll empSize=retStr.size()-sufs.size();
	//	string loops;
	//	for(int i = 0; i < retStr.size(); i++){
	//		if(i>=empSize){
	//			loops+='^';
	//		}
	//		else{
	//			loops+=' ';
	//		}
	//	}
	//		cout<<loops<<endl;
	//}

	return 0;
}

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

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

  char b, ans;
  cin  >> b;
  if(b=='A')ans='T';
  else if(b=='T')ans='A';
  else if(b=='C')ans='G';
  else ans='C';

  cout << ans << endl;

  return 0;
}

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

/*------------------------------------------------------------------*/

#define ll long long int
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define MOD 1000000007

bool isvowel(char c)
{
    if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')
        return true;
    else
        return false;
}
ll isprime(ll n)
{
    for(ll i=2;i<=sqrt(n);i++)
    {
        if(n%i==0)
            return i;
    }
    return 1;
}
ll power(ll a,ll b)
{
    if(b==0)
        return 1;
    if(b==1)
        return a%MOD;
    ll temp=power(a,b/2);
    if(b%2==0)
        return ((temp%MOD)*(temp%MOD))%MOD;
    else
        return ((((temp%MOD)*(temp%MOD))%MOD)*a%MOD)%MOD;
}

/*-----------------------------------------------------------------------------*/
//ll dp[100001][100001]={0};
ll fun(ll a,ll b)
{
    ostringstream str1;
    str1<<a;
    string s1=str1.str();
    ostringstream str2;
    str2<<b;
    string s2=str2.str();
    string s="";
    for(ll i=0;i<s1.length();i++)
    {
        s+=s1[i];
        s+=s2[i];
    }
    stringstream g(s);
    ll x=0;
    g>>x;
    return x;
}
int main()
{
    //ios_base::sync_with_stdio(false);
	//cin.tie(NULL);


    //freopen("leapfrog_ch_.txt","rt",stdin);
    //freopen("output.txt","wt",stdout);

    ll t;
    t=1;
    //cin>>t;
    while(t--)
    {
        ll a,b;
        cin>>a>>b;
        ll k=a+b;
        if(k%2==0)
            cout<<k/2;
        else
            cout<<"IMPOSSIBLE";
    }
    return 0;
}


Measured memory_bytes: 256
def topological_sort(nodes, edges) -> []:
    visited = set()
    result = []

    def dfs(v):
        if v not in visited:
            visited.add(v)
            for u in edges[v]:
                dfs(u)
            result.append(v)

    for s in nodes:
        dfs(s)

    return result

def aoj_system_test():
    """
    The problem of aoj for topological sort use special judge.
    So, I can't verify using online-judge-tools. (T T)
    """
    V, E = map(int, input().split())
    nodes = []
    edges = []
    for i in range(V):
        nodes.append(i)
        edges.append([])
    for _ in range(E):
        a, b = map(int, input().split())
        edges[b].append(a)
    ret = topological_sort(nodes, edges)
    for v in ret:
        print(v)

if __name__ == '__main__':
    aoj_system_test()


Measured memory_bytes: 9772
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def prime_factorize(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


def main():
    N = int(readline())
    prime = prime_factorize(N)
    ans = str(N) + ':'
    for i, k in prime:
        ans += ' {}'.format(i) * k
    print(ans)

if __name__ == '__main__':
    main()



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


int n, m, k;

void color_row(vector<string>& g, int r) {
  REP(j, m) g[r][j] = '.';
}

void color_col(vector<string>& g, int c) {
  REP(i, n) g[i][c] = '.';
}

int black(int rmask, int cmask, vector<string> g) {
  REP(i, n) if(rmask & (1 << i)) color_row(g, i);
  REP(j, m) if(cmask & (1 << j)) color_col(g, j);
  int res = 0;
  REP(i, n) REP(j, m) res += g[i][j] == '#';
  return res;
}

int main() {
  cin >> n >> m >> k;
  vector<string> g(n);
  REP(i, n) cin >> g[i];
  int ans = 0;
  REP(i, 1 << n) {
    REP(j, 1 << m) {
      if(black(i, j, g) == k) ++ans;
    }
  }
  cout << ans << endl;
  
  return 0;
}

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

int main()
{
  int n,x,counter;
  counter = 0;
  cin >> n >> x;
  vector<int> D(n+1);
  vector<int> L(n+1);
  
  for(int i = 0; i < n;++i){
    cin >> L.at(i);
  }
  D.at(0) = 0;
  for(int i = 1;i < n+1;++i){
    D.at(i) = D.at(i-1) + L.at(i-1);
  }
  for(int i = 0;i < n+1;++i){
    if(D.at(i) <= x){
      ++counter;
    }
  }
  cout << counter << endl;
}

      
  

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N =1e5+100;
int main()
{
    int n,k,q;

    while(~scanf("%d%d%d",&n,&k,&q))
    {
        int sum[N] ={0},x;
        for(int i=0;i<q;i++)
        {
            scanf("%d",&x);
            sum[x]++;
        }
        for(int i=1;i<=n;i++)
        {
            if(k+sum[i]>q)
                printf("Yes\n");
            else
                printf("No\n");
        }
    }
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.10f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e18;
const ll MAX_N = 201010;

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i;
	}
}

// 二項係数計算
long long COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] / (fac[k] * fac[n - k]);
}


//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };
ll dp[10101][110];

//long longしか使わない
//素数は1より大きい
//lower_boundは指定したkey以上の要素の一番左のイテレータをかえす
//upper_boundは指定したkeyより大きい要素の一番左のイテレータをかえす
int main() {
	ll n, m;
	cin >> n >> m;
	vector<ll>a(n);
	rep(i, n) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	vector<pair<ll, ll>>p(m);
	rep(i, m) {
		ll a, b;
		cin >> a >> b;
		p[i].first = b;
		p[i].second = a;
	}
	sort(p.rbegin(), p.rend());
	vector<ll>alt;
	bool flag = false;
	rep(i, m) {
		rep(j, p[i].second) {
			alt.push_back(p[i].first);
			if (alt.size() == n) {
				flag = true;
				break;
			}
		}
		if (flag)break;
	}
	ll ans = 0;
	ll k = alt.size();
	ll res = min(n, k);
	rep(i, res) {
		if (a[i] < alt[i])a[i] = alt[i];
	}
	rep(i, n) {
		ans += a[i];
	}
	cout << ans << endl;
	return 0;
}


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

int main() {
    ll h, w;
    cin >> h >> w;

    if (h == 1 or w == 1) {
        cout << 1 << endl;
        return 0;
    }

    ll tmp = (h*w);
    cout << tmp/2 + bool(tmp%2) << endl;
}


Measured memory_bytes: 256
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from functools import *
from itertools import permutations,combinations,groupby
import sys
import bisect
import string
import math
import time
import random
def Golf():
    *a,=map(int,open(0))
def S_():
    return input()
def IS():
    return input().split()
def LS():
    return [i for i in input().split()]
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def NI(n):
    return [int(input()) for i in range(n)]
def NI_(n):
    return [int(input())-1 for i in range(n)]
def StoI():
    return [ord(i)-97 for i in input()]
def ItoS(nn):
    return chr(nn+97)
def LtoS(ls):
    return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[]
    g=[[] for i in range(n)]
    for i in range(E):
        inp=LI()
        org_inp.append(inp)
        if index==0:
            inp[0]-=1
            inp[1]-=1
        if len(inp)==2:
            a,b=inp
            g[a].append(b)
            if not Directed:
                g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp
            aa=(inp[0],inp[2])
            bb=(inp[1],inp[2])
            g[a].append(bb)
            if not Directed:
                g[b].append(aa)
    return g,org_inp
def GGI(h,w,search=None,replacement_of_found='.',mp_def={'#':1,'.':0}):
#h,w,g,sg=GGI(h,w,search=['S','G'],replacement_of_found='.',mp_def={'#':1,'.':0}) # sample usage
    mp=[1]*(w+2)
    found={}
    for i in range(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[1]+[mp_def[j] for j in s]+[1]
    mp+=[1]*(w+2)
    return h+2,w+2,mp,found
def bit_combination(k,n=2):
    rt=[]
    for tb in range(n**k):
        s=[tb//(n**bt)%n for bt in range(k)]
        rt+=[s]
    return rt
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['YES','NO']

mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
u_alp=string.ascii_uppercase
ts=time.time()
#sys.setrecursionlimit(10**7)
input=lambda: sys.stdin.readline().rstrip()
 
def ran_input():
    import random
    n=random.randint(4,16)
    rmin,rmax=1,10
    a=[random.randint(rmin,rmax) for _ in range(n)]
    return n,a

show_flg=False
show_flg=True

ans=0

a,b=LI()
x=b-a
ans=x*(x-1)//2-a

print(ans)




Measured memory_bytes: 39404
#!/usr/bin/python3

def find(A, id, V, time):
    i = id - 1
    A[i][0] = True
    A[i][1] = time
    time += 1
    for v in V[i]:
        if A[v - 1][0] == False:
            time = find(A, v, V, time)
    A[i][2] = time
    time += 1
    return time

n = int(input())
# [isFind, d, f]
A = [[False, 0, 0] for i in range(n)]
U = []
V = []
for i in range(n):
    l = list(map(int, input().split()))
    U.append(l[0])
    V.append(l[2:])

time = 1
for u in U:
    if A[u - 1][0] == False:
        time = find(A, u, V, time)

for u in U:
    l = [u]
    l.extend(A[u - 1][1:])
    print(' '.join(map(str, l)))

Measured memory_bytes: 7792
#include<cstdio>
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>


using namespace std;


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

#ifdef __BORLANDC__
	typedef __int64 ll;
#else
	typedef long long ll;
#endif

const int N = 111111;

int a[N];

int main()
{
	int n;
	cin>>n;
	
	rep(i,n)cin>>a[i];
	
	int mini = 0;
	ll ans = 0;
	rep(i,n)
	{
		if(a[i] > mini+1)
		{
			ans += (a[i]-1)/(mini+1);
			a[i]=1;
		}
		
		
		mini = max(mini, a[i]);
	}
	
	
	cout<<ans<<endl;
}




Measured memory_bytes: 640
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <math.h> 
#define enld '\n'
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
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; }
// ---------------------------------------------------------------------------

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int H,W,A,B;
  cin >> H >> W >> A >> B;
  vector<string> G(H);
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      int h = (i<B);
      int w = (j<A);
      if((h^w) == 0){
        G[i] += '0';
      }else{
        G[i] += '1';
      }
    }
  }
  for(int i=0; i<H; i++){
    cout << G[i] << "\n";
  }
  return 0;
}

Measured memory_bytes: 5036
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define mem(a,v) memset((a), (v), sizeof (a))
#define enl printf("\n")
#define case(t) printf("Case #%d: ", (t))
#define ni(n) scanf("%d", &(n))
#define nl(n) scanf("%lld", &(n))
#define nai(a, n) for (int _i = 0; _i < (n); _i++) ni(a[_i])
#define nal(a, n) for (int _i = 0; _i < (n); _i++) nl(a[_i])
#define pri(n) printf("%d\n", (n))
#define prl(n) printf("%lld\n", (n))
#define pii pair<int, int>
#define pil pair<int, long long>
#define pll pair<long long, long long>
#define vii vector<pii>
#define vil vector<pil>
#define vll vector<pll>
#define vi vector<int>
#define vl vector<long long>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef cc_hash_table<int,int,hash<int>> ht;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;
const double pi = acos(-1);
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const int MAXN = 1e6 + 5;
const double eps = 1e-9;
int a[MAXN];

int main() {
	ll n, l;
	nl(n), nl(l);
	nai(a, n);
	double ansx = 0, ansy = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i+1; j < n; j++) {
			double x = cos(pi * (a[i]+a[j]) / (double)l);
			double y = sin(pi * (a[i]+a[j]) / (double)l);
			int cnt = i + (n-j-1) - (j-i-1);
			ansx += x*cnt;
			ansy += y*cnt;
		}
	}
	ll tot = (n*(n-1)*(n-2)) / 6ll;
	ansx /= (double) tot;
	ansy /= (double) tot;
	printf("%.12f %.12f\n", ansx, ansy);
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1e17;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

ll n, a;



int main(){
	cin>>n>>a;
	ll res = INF;
	for(int i = 1; i <= 50; i++){
		ll t = pow(n, 1.0/i);
		ll r = 0;
		ll s = 1;
		rep(j, i) s *= t;
		while(s<n){
			s /= t;
			s *= t+1;
			r++;
		}
		chmin(res, a*(i-1)+t*i+r);
	}
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#ifdef SIR
#define err(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define err(...) 42
#endif

typedef long long ll;

using namespace std;

const int dd = (int)1e5 + 7;

int P[dd], R[dd], cnt[dd];
ll sum[dd];

int get(int v) { return v == P[v] ? v : P[v] = get(P[v]); }

int ans = 0;

void un(int a, int b, int e) {
    a = get(a), b = get(b);
    assert(a != b);

    if (R[b] > R[a]) swap(a, b);
    R[a] += R[b], P[b] = a;
    sum[a] += sum[b];

    if (e <= sum[a]) {
        ans += cnt[a] + 1 + cnt[b];
        cnt[a] = 0;
    } else {
        cnt[a] = cnt[a] + 1 + cnt[b];
    }
}

struct edge { int a, b, c; };

void solve() {
    int n, m;
    cin >> n >> m;

    for (int i = 0; i < n; i++) P[i] = i, R[i] = 1, cnt[i] = 0;
    for (int i = 0; i < n; i++) cin >> sum[i];

    vector<edge> E(m);
    for (int i = 0; i < m; i++) cin >> E[i].a >> E[i].b >> E[i].c;
    sort(E.begin(), E.end(), [](edge a, edge b) {
        return a.c < b.c;
    });

    for (int i = 0; i < m; i++) {
        int a = E[i].a - 1;
        int b = E[i].b - 1;
        int c = E[i].c;

        if (get(a) == get(b)) {
            if (c <= sum[get(a)]) ans++;
            else cnt[get(a)]++;
        } else {
            un(a, b, c);
        }
    }
    cout << m - ans << "\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#ifdef SIR
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    solve();
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

llong mod = 1000000007;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

int main(){
  int N;cin>>N;
  vector<int> A(N);REP(i,N)cin >> A[i];
  vector<int> X(N);
  REP(i,N){
    if( i% 2 == 0){
      X[0] += A[i];
    }else{
      X[0] -= A[i];
    }
  }
REP(i,N){
  if(i ==0)continue;
  X[i] = 2*(A[i-1] - X[i-1]/2);
}
REP(i,N){
  cout << X[i]<<" ";
  if(i == N-1)cout <<endl;
}

}


Measured memory_bytes: 2048
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Iterator;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeSet;
import java.io.BufferedReader;
import java.io.InputStreamReader;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */
public class Main {
	public final static double MAX_T = 1000000;
	public final static double MIN_T = 0;
	public static int s = 0;

	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}

	static class TaskC {

		public void solve(int testNumber, InputReader in, PrintWriter out) {
			int n = in.nextInt();
			int numberOfFour = 0, numberOfTwo = 0, numberOfOtherElements = 0;
			for (int i = 0; i < n; i++) {
				int cn = in.nextInt();
				if (cn % 4 == 0) {
					numberOfFour++;
				} else if (cn % 2 == 0) {
					numberOfTwo++;
				} else {
					numberOfOtherElements++;
				}
			}

			if (numberOfFour >= numberOfOtherElements) {
				out.println("Yes");
			} else {
				if (numberOfTwo == 0 && numberOfFour + 1 == numberOfOtherElements) {
					out.println("Yes");
					return;
				}
				out.println("No");
			}
		}

	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public double nextFloat() {
			return Double.parseDouble(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

	}
}


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

using namespace std;


// t - 1 + max
int main () {
    int n, q;
    cin >> n >> q;
    vector<pair<int, int>> e(n - 1);
    vector<vector<int>> g(n, vector<int>(0));
    for (int i = 0; i < n - 1; i++) {
        cin >> e[i].first >> e[i].second;
        e[i].first--;
        e[i].second--;
        g[e[i].first].push_back(e[i].second);
        g[e[i].second].push_back(e[i].first);
    }
    vector<int> v(n, 0);
    int p, x;
    for (int i = 0 ; i < q; i++) {
        cin >> p >> x;
        v[p - 1] += x;
    }

    vector<bool> used(n, false);
    queue<int> que;
    que.push(0);
    used[0] = true;
    while(!que.empty()) {
        int cur = que.front();
        que.pop();
        for(auto u : g[cur]) {
            if (!used[u]) {
                v[u] += v[cur];
                used[u] = true;
                que.push(u);
            }
        }
    }
    for (auto u : v) {
        cout << u << " ";
    }
    cout << "\n";

    return 0;
}







Measured memory_bytes: 17140
N = int(input())
A = [int(input()) for _ in range(N)]
pushed = [False] * N
pushed[0] = True
button = 0
count = 0
while True:
    count += 1
    button = A[button] - 1
    if button == 1:
        print(count)
        exit()
    if pushed[button]:
        print(-1)
        exit()
    pushed[button] = True

Measured memory_bytes: 7852
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		String s = sc.next();
		String t = sc.next();
		boolean b = false;
		for (int i = 0; i < s.length(); i++) {
			if ((s.substring(i) + s.substring(0, i)).equals(t)) {
				b = true;
				break;
			}
		}
		if (b) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 23764
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;


int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		int t = a[i] - 1;
		if (a[t] - 1 == i)
			cnt++;
	}
	cout << cnt / 2 << endl;

	return 0;
}

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

using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define reps(i, m, n) for (int i = m; i <= n; ++i)

using i64 = long long;
using pii = pair<i64, i64>;

template<class A, class B>inline bool chmax(A &a, const B &b){return b > a ? a = b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b < a ? a = b,1 : 0;}

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

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

  int n, t, a;
  cin >> n >> t >> a;

  vector<pair<double, int>> vec;
  rep(i, n) {
    int h;
    cin >> h;
    double temp = (double)t - ((double)h * 0.006);
    double diff = fabs((double)a - temp);
    vec.push_back(make_pair(diff, i+1));
  }

  sort(all(vec));

  cout << vec[0].second << "\n";

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int N_MAX = 1e5+10;
vector<vector<int> > T(N_MAX);

void dfs(int cur,int v, int p, vector<int>& d){
  d[v] = cur;
  for(const int& u:T[v]){
    if(u==p)continue;
    dfs(cur+1,u,v,d);
  }
}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N;cin >> N;
  int v,u;cin >> u >> v;
  rep(i,N-1){
    int a,b;cin >>  a >> b;
    T[a].emplace_back(b);
    T[b].emplace_back(a);
  }
  vector<int> du(N_MAX,-1);
  dfs(0,u,-1,du);
  vector<int> dv(N_MAX,-1);
  dfs(0,v,-1,dv);
  int ans = 0;
  repp(w,1,N+1) if(du[w] < dv[w]) ans = max(ans,dv[w]-1);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 11648
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e9;

int main()
{
    int x = 700;
    string s;
    cin >> s;
    if(s[0] == 'o')
        x += 100;
    if(s[1] == 'o')
        x += 100;
    if(s[2] == 'o')
        x += 100;
    cout << x << endl;
    return 0;
}


Measured memory_bytes: 3628
#include <stdio.h>

int H,W;
int i,j;

main(){
	while(1){
	scanf("%d%d",&H,&W);
	if(H != 0 && W != 0 ){
		for(i=1 ;i<=H; i++){
			for(j=0;j<W; j++){
				if(i%2 == 0){
					if(j%2 == 0){
						printf(".");
					}else{
						printf("#");
					}
				}else{
					if(j%2 == 0){
						printf("#");
					}else{
						printf(".");
					}
				}		
			}
			printf("\n");
		}
	}else{
		break;
	}
	printf("\n");
	}
	return 0;
}

Measured memory_bytes: 572
N=int(input())
csf=[tuple(map(int,input().split(' '))) for i in range(N-1)]
for i in range(N-1):
    now = 0
    for j in csf[i:]:
        c,s,f= [k for k in j]
        while now > s:
            s += f
        now = s+c
    print(now)
print(0)

Measured memory_bytes: 43996
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf = 1012345678;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};
#include <stdio.h>
#include <math.h>
int main(){
  int P, Q, R;
  cin >> P >> Q >> R;
  int M = max(max(P,Q),R);
  int ans = P+Q+R-M;
  cout << ans << endl;

  return 0;
}



// ./compile.sh main


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

int main() {
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	int ans = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] >= k) {
			ans++;
		}
	}

	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1e18

int main() {
    string s, rs;
    cin >> s;
    rs = s;
    reverse(rs.begin(), rs.end());
    if (rs[0] == '1' || s[0] == '0' || s.substr(0, s.size() - 1) != rs.substr(1, rs.size() - 1)) {
        cout << -1 << endl;
        return 0;
    }

    int head = 1;
    for (int i = 1; i < s.size() - 1; i++) {
        if (s[i] == '1') {
            cout << head << " " << i + 1 << endl;
            for (int j = head + 1; j <= i; j++) {
                cout << j << " " << i + 1 << endl;
            }
            head = i + 1;
        }
    }
    cout << head << " " << s.size() << endl;
    return 0;
}

Measured memory_bytes: 1728
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

int main()
{
    int h, w;
    cin >> h >> w;

    int cnt = 0;
    rep(i, h)
    {
        string s;
        cin >> s;
        rep(j, w)
        {
            if (s[j] == '#')
            {
                cnt++;
            }
        }
    }

    if (cnt == h + w - 1)
    {
        cout << "Possible" << endl;
    }
    else
    {
        cout << "Impossible" << endl;
    }
    return 0;
}

Measured memory_bytes: 256