akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define int long long

using namespace std;

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int psum[2001];
    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < 2001; i++) psum[i] = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        psum[a[i]]++;
    }
    for (int i = 1; i < 2001; i++) psum[i] += psum[i-1];
    int res = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i+1; j < n; j++) {
            int r = a[i]+a[j]-1;
            int l = max(a[i],a[j])-min(a[i],a[j])+1;
            res += psum[r]-psum[l-1];
            if (a[i] >= l && a[i] <= r) res--;
            if (a[j] >= l && a[j] <= r) res--;
        }
    }
    cout << res/3 << '\n';
}
/*

 */

Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
#define rep(i,e) for(int i= 0; i< (int)(e); i++)
#define reps(i,s,e) for(int i = s; i < (int)(e); i++)
#define repr(i,s,e) for(int i = s; i > (int)(e); i--)
#define pb push_back
typedef long long ll;
const ll INF = 1LL << 60;

int main()
{
    vector<int> a(3);
    cin >> a[0] >> a[1] >> a[2];
    sort(a.begin(),a.end());
    if((a[0]-a[1])%2==0){
        cout << ((a[2]-a[0])+(a[2]-a[1]))/2;
        return 0;
    }else{
        cout << ((a[2]-a[0])+(a[2]-a[1])+3)/2;
    }
}

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


int main(){
    int n;
    cin >> n;
    int ans = 0;
    rep(i,n){
        ll a;
        cin >> a;
        while(a%2==0){
            a/=2;
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define eps 1e-7
#define e 1e-3
#define mp make_pair
#define pb push_back
#define ll long long
using namespace std;
typedef vector<int> vi;
typedef vector<int> lnum;
const int INF = 4*1000*1000;
const int MOD = 1000 * 1000 * 1000 + 7;
const int base = 1000*1000*1000;

char field[10][10];
int n , m;
int cnt = 0;
int main()
{
	scanf("%d %d\n" , &n , &m);
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < m; j++)
		{
			scanf("%c" , &field[i][j]);
			cnt += field[i][j] == '#';
		}
		scanf("\n");
	}
	if(cnt == n + m - 1)
	{
		cout << "Possible";
	}
	else
		cout << "Impossible";
    return 0;
}


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

int main() {
	int a, b, c, d, e, k;
	cin >> a >> b >> c >> d >> e >> k;

	if (e - a > k) {
		cout << ":(" << endl;
	}
	else {
		cout << "Yay!" << endl;
	}
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void solve() {
	int h, w;
	cin >> h >> w;
	vector<string> v(h);
	rep(i,h) cin >> v[i];
	vector<int> cnt(26);
	rep(i,h) rep(j,w) cnt[v[i][j] - 'a']++;
	priority_queue<int> q;
	rep(i,26) q.push(cnt[i]);
	int p = 0;
	for (int i = 0; i < (h / 2) * (w / 2); i++) {
		int t = q.top(); q.pop();
		if (t >= 4) {
			t -= 4;
			q.push(t);
		} else {
			cout << "No" << endl;
			return;
		}
	}
	if (h % 2 == 0 && w % 2 == 0) {
		cout << "Yes" << endl;
	} else {
		if (h % 2 == 1 && w % 2 == 1) {
			bool flag = 0;
			while (!q.empty()) {
				int t = q.top(); q.pop();
				if (t % 2 == 1) {
					if (flag) {
						cout << "No" << endl;
						return;
					}
					flag = 1;
				}
			}
			if (flag) cout << "Yes" << endl;
			else cout << "No" << endl;
		} else {
			while(!q.empty()) {
				int t = q.top(); q.pop();
				if (t % 2 == 1) {
					cout << "No" << endl;
					return;
				}
			}
			cout << "Yes" << endl;
		}
	}
}

int main() {
	solve();
	return 0;
}

Measured memory_bytes: 3564
// ==============================================
// Library
// ==============================================
#define _CRT_SECURE_NO_WARNINGS

// When you are using the gcc compiler, you need only the following lines.
// #include <bits/stdc++.h>

// When you are using other compilers, you need the following line instead.
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

using namespace std;

// competitive macro
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b) - 1; i >= (a); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i ,n) for (int i = (n) - 1; i >= 0; i--)
#define LL long long
#define ULL unsigned long long

// If you use this function, "cin" speeds up.
// However, you can not mix "cin" and "scanf", "cout" and "printf".
void fastIOS()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
}
// ==============================================
// ==============================================

array<int, 100000> A = {};

int main()
{
	fastIOS();

	int A, B;
	string op;
	cin >> A >> op >> B;

	if (op == "+")
		cout << A + B << "\n";
	else
		cout << A - B << "\n";

}

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


int main(){
  int N, M;cin>>N>>M;
  
  map<ll, ll> counter;
  ll cumsum=0;
  for (int i=0;i<N;++i){
    ll a;cin>>a;
    cumsum+=a;
    counter[cumsum%M]++;
  }

  int L=counter.size();
  ll ans=0;
  for (auto p:counter){
    ll c=p.second;
    ans+=(c*(c-1))/2;
  }

  ans+=counter[0];
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4224
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
const int maxn =1e5+1;
using  ll = long long;
int main(){
	ll n,w,v,w1,j,i;
	scanf("%lld%lld",&n,&w);
vector<ll> we(maxn);
for(ll item=0;item<n;item++)
{
   scanf("%lld%lld",&w1,&v);
   for(j=w-w1;j>=0;j--)
   {
   	we[w1+j]=max(we[w1+j],we[j]+v);
   }
}
j=0;
for(i=0;i<=w;i++)
j=max(j,we[i]);
cout<<j<<"\n";
}

Measured memory_bytes: 1024
n = input()
vlist = list(map(int, input().split()))
gulist = {}
kilist = {}

for i in range(len(vlist)):
  x = vlist[i]

  if i % 2 == 0:
    if x not in gulist:
      gulist[x] = 0
    gulist[x] = gulist[x] + 1
  else:
    if x not in kilist:
      kilist[x] = 0
    kilist[x] = kilist[x] + 1

maxguname = 0
maxgunum = 0
maxkiname = 0
maxkinum = 0

for k, v in gulist.items():
  if maxgunum < v:
    maxguname = k
    maxgunum = v

for k, v in kilist.items():
  if maxkinum < v:
    maxkiname = k
    maxkinum = v

nextguname = 0
nextgunum = 0
nextkiname = 0
nextkinum = 0

for k, v in gulist.items():
  if maxguname == k:
    continue
  if nextgunum < v:
    nextguname = k
    nextgunum = v

for k, v in kilist.items():
  if maxkiname == k:
    continue
  if nextkinum < v:
    nextkiname = k
    nextkinum = v

maxgu = len(vlist)//2 - maxgunum
nexgu = len(vlist)//2 - nextgunum
maxki = len(vlist)//2 - maxkinum
nexki = len(vlist)//2 - nextkinum

if maxguname == maxkiname:
  if nextgunum > nextkinum:
    print(maxki + nexgu)
  else:
    print(maxgu + nexki)
else:
  print(maxgu + maxki)

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

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

    if(S.at(2) == S.at(3) && S.at(4) == S.at(5)){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

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

typedef long long ll;
const int maxn=2005;


string s;
ll a[200005],b[200005];
ll c[200005],d[200005];
int main()
{
	int n;
	cin>>n;
	cin>>s;
	int one=0;
	reverse(s.begin(),s.end());
	for( int i=0;i<n;i++ ) one+=s[i]=='1';
	
	ll mod1=one+1,mod2=max(one-1,1);
	ll res1=0,res2=0,now1=1,now2=1;
	for( int i=0;i<s.size();i++ )
	{
		if( s[i]=='1' )
		{
			res1=(res1+now1)%mod1;
			res2=(res2+now2)%mod2;	 
		}
		c[i]=now1%mod1;
		d[i]=now2%mod2;
		now1=(now1*2)%mod1;
		now2=(now2*2)%mod2;
	}
	
	vector<int> p;
	for( int i=0;i<n;i++ )
	{
		ll res,ans=0;
		if( one==1 && s[i]=='1' )
		{
			p.push_back(0);
			continue;
		}
		
		if( s[i]=='0' )	res=(res1+c[i])%mod1;
		else res=(res2-d[i]+mod2)%mod2;
		ans++;
		while( res )
		{
			res%=__builtin_popcount(res);
			ans++;
		}
		p.push_back(ans);
	}
	reverse(p.begin(),p.end());
	for( int v:p ) cout<<v<<endl;
} 


Measured memory_bytes: 7640
import java.util.Scanner;

public class Main {
   public static void main(String[] args) {
      Scanner scan = new Scanner(System.in);
      int a = scan.nextInt();
      int b = scan.nextInt();
      int c = scan.nextInt();

      if (a < b && b < c) {
         System.out.println("Yes");
      } else {
         System.out.println("No");
      }
   }
}



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

int main() {
  int n;
  cin >> n;
  vector<int> cards(n);

  for (int i = 0; i < n; i++) cin >> cards.at(i);

  sort(cards.begin(), cards.end(), greater<int>());
  
  int alice = 0;
  int bob = 0;
  
  for (int i = 0; i < n; i += 2) alice += cards.at(i);
  for (int i = 1; i < n; i += 2) bob += cards.at(i);

  cout << alice - bob << endl;
}

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

#define ll long long
#define ld long double
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define sz(x) ((int)(x).size())

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main()
{
    int n;
    ll m;
    cin >> n >> m;
    vector<ll> vc(n);

    rep(i, n)
    {
        cin >> vc[i];
    }
    vector<int> counter(n);
    rep(i, n)
    {
        int num = 0;
        ll a;
        a = vc[i];
        while (a % 2 == 0)
        {
            a = a / 2;
            num++;
        }
        counter[i] = num;
    }
    rep(i, n - 1)
    {
        if (counter[i] != counter[i + 1])
        {
            cout << 0 << endl;
            //cout << "???" << endl;
            return 0;
        }
    }

    ll temp = 1;
    for (int i = 0; i < n; i++)
    {
        temp = lcm(vc[i]/2, temp);
        if (temp>m)
        {
            cout << 0 << endl;
            //cout << "???" << endl;
            return 0;
        }
        
    }
    ll ans = 0;
    ll p = 0;
    //cout << temp << endl;
    while (temp * 2* p + temp <= m)
    {
        p++;
        ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1408
i = int(input())
n = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(n[i - 1])

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

#define ll long long
#define vec vector<ll>
#define sortv(a); sort(a.begin(), a.end());
#define rev(a); reverse(a.begin(), a.end());
#define FOR(i,a,b) for (ll i = (ll)(a); i < (b); i++)
#define ROF(i,a,b) for (ll i = (ll)(b)-1; i >= (a); i--)

ll MOD = 1000000007;
ll INF = 1LL << 60;

/*****************************************************************************/
int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n,m;
	cin>>n>>m;
	int ok=0;
	int ng=0;
	vector<bool> good(n+3,0);
	map<int,int> fails;
	FOR(i,0,m) {
		int num;
		string res;
		cin>>num>>res;
		if (good[num]) continue;
		if (res=="WA") {
			fails[num]++;
		} else {
			ok++;
			good[num]=true;
		}
	}
	FOR(i,1,n+1) {
		if (good[i]) {
			ng+=fails[i];
		}
	}
	cout<<ok<<" "<<ng;
}

Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


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

	int sx, sy, gx, gy;
	cin >> sx >> sy >> gx >> gy;
	if (sx > gx) {
		swap(sx, gx);
		swap(sy, gy);
	}
	int n;
	cin >> n;
	vector<int> x(n), y(n);
	rep(i, n) cin >> x[i] >> y[i];
	if (sx == gx) {
		bool flag = false;
		rep(i, n) {
			if (x[i] == sx) {
				if (sy <= y[i] && y[i] <= gy || gy <= y[i] && y[i] <= sy) flag = true;
			}
		}
		ld ans = abs(sy - gy); ans *= 100;
		if (flag) ans += 10 * pi - 20;
		cout << ans << '\n';
		return 0;
	}
	if (sy == gy) {
		bool flag = false;
		rep(i, n) {
			if (y[i] == sy) {
				if (sx <= x[i] && x[i] <= gx || gx <= x[i] && x[i] <= sx) flag = true;
			}
		}
		ld ans = abs(sx - gx); ans *= 100;
		if (flag) ans += 10 * pi - 20;
		cout << ans << '\n';
		return 0;
	}
	vector<P> p(n);
	rep(i, n) {
		p[i].first = x[i];
		p[i].second = y[i];
	}
	sort(all(p));
	vector<int> lis(n, inf);
	if (sy > gy) {
		rep(i, n) p[i].second = -p[i].second;
		sy = -sy; gy = -gy;
	}
	rep(i, n) {
		if (p[i].first < sx || gx < p[i].first) continue;
		if (p[i].second < sy || gy < p[i].second) continue;
		int idx = lower_bound(all(lis), p[i].second) - lis.begin();
		lis[idx] = p[i].second;
	}
	ld ans = abs(sx - gx) + abs(sy - gy); ans *= 100;
	int l = lower_bound(all(lis), inf) - lis.begin();
	ans += (ld)l * (5 * pi - 20);
	if (gx - sx + 1 == l || gy - sy + 1 == l) ans += 5 * pi;
	cout << ans << '\n';
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
 
#define int long long
 
// loop
#define FOR(i, a, b) for (int i = (a); i < (b); i++) 	// a ~ b-1	(ascending)
#define REP(i, n) FOR(i, 0, n)							// 0 ~ n-1
#define NREP(i, n) FOR(i, 1, n + 1)						// 1 ~ n
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)	// a ~ b	(descending)
#define RREP(i, n) RFOR(i, n, 0)						// n ~ 0
#define RNREP(i, n) RFOR(i, n, 1)						// n ~ 1
 
// container operation
#define EACH(i, c) for (auto i = (c).begin(); i != (c).end(); i++)
#define ASORT(c) std::sort((c).begin(), (c).end())
#define DSORT(c) std::sort((c).begin(), (c).end(), std::greater<typeof((c).front())>())
#define SIZE(x) ((int)(x).size())
 
// debug
#define check(x) std::cout << #x << " = " << x << '\n'
 
// print
#define cout(x) std::cout << x << '\n'
 
// typedef
typedef std::vector<int> VI;
typedef std::vector<VI> VII;
typedef std::vector<std::string> VS;

std::string yes = "Yes\n";
std::string no = "No\n";

void solve();

signed main() {
  solve();
  return 0;
}

void solve() {
  int a, b;
  std::cin >> a >> b;
  
  // cout((int)std::ceil(((double)(a + b))/2));
  cout((int)std::ceil(((double)(a + b))/2));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pb          push_back
#define pll         pair<ll,ll>
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mode        998244353
#define mod         1000000007
#define inf         1000000000000000000LL
#define vl          vector<ll>
#define F           first
#define S           second
#define db          long double
#define sz(x)       (ll)x.size()
#define fix(n)      cout<<fixed<<setprecision(n)
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define all(x)      x.begin(),x.end()
#define mset(x)     memset(x,0,sizeof x)
#define pi          3.14159265358979323



void solve()
{
       ll a, b;
       cin>>a>>b;
       ll x = 0;
       cout<<max(a+b, 2*max(a,b)-1);
}


int main() {
	ll T = 1;
	speed_up
	//cin>>T;
	while(T--)
	    solve();
	return 0;
}


Measured memory_bytes: 256
n = int(input())
p = list(map(int,input().split()))
count = 0
for i in range(1,n-1):
  if (p[i]>p[i-1] and p[i]<p[i+1]) or (p[i]<p[i-1] and p[i]>p[i+1]):
    count += 1
print(count)


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <cstdio>
const int INF = 10000000;

int main(){
	int n, m;
	while(std::cin >> n, n){
		std::cin >> m;
		int cost[100][100];
		for(int i=0;i<10000;i++){
			cost[i/100][i%100] = INF;
		}

		for(int i=0;i<m;i++){
			int a, b, d;
			scanf("%d,%d,%d", &a, &b, &d);
			cost[a][b] = d / 100 - 1;
			cost[b][a] = d / 100 - 1;
		}
		int mincost[100];
		bool used[100];
		int res = 0;

		for(int i=0;i<100;i++){
			mincost[i] = INF;
			used[i] = false;
		}
	
		mincost[0] = 0;
		while(1){
			int v = -1;
			for(int u=0;u<n;u++){
				if(!used[u] && (v == -1 || mincost[u] < mincost[v]))
					v = u;
			}
			if(v == -1)break;
			used[v] = true;
			res += mincost[v];

			for(int u=0;u<n;u++){
				mincost[u] = std::min(mincost[u], cost[v][u]);
			}
		}

		std::cout << res << std::endl;
	}
}

Measured memory_bytes: 0
# -*- coding: utf-8 -*-
import numpy as np

h, w = map(int, input().split())

s = [list(input()) for i in range(h)]
b = np.array(s)
b = np.where(b == '.', 1, 0)

u = np.zeros((h, w), dtype=np.int)
for i in range(1, h):
    u[i] += (u[i - 1] + 1) * b[i - 1]

d = np.zeros((h, w), dtype=np.int)
for i in range(h - 2, -1, -1):
    d[i] += (d[i + 1] + 1) * b[i + 1]

l = np.zeros((h, w), dtype=np.int)
for j in range(1, w):
    l[:, j] += (l[:, j - 1] + 1) * b[:, j - 1]

r = np.zeros((h, w), dtype=np.int)
for j in range(w - 2, -1, -1):
    r[:, j] += (r[:, j + 1] + 1) * b[:, j + 1]

print(((u + d + l + r) * b).max() + 1)

Measured memory_bytes: 266576
#include<iostream>
#include<string>
using namespace std;
 main()
{
    char arr[5];
    cin >> arr;
    if((arr[0]==arr[1])||(arr[1]==arr[2])||(arr[2]==arr[3]))
    {
        cout << "Bad";
    }
    else
    {
        cout << "Good";
    }
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
K = int(input())
if K % 2 == 0: #奇数：K/2個 偶数：K/2個
    print(int((K/2) * (K/2)))
if K % 2 == 1: #奇数：(K+1)/2個 偶数：(K-1)/2個
    print(int(((K+1)/2) * ((K-1)/2)))


Measured memory_bytes: 2940
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>

typedef long long int ll;


using namespace std;

int x,h;
double y;
double ans;

int main(){
	while(1){
		cin>>x>>h;
		if(x==0&&h==0)break;
		y=sqrt(4*h*h+x*x)/2.0;
		ans=x*(2*y+x);
		printf("%.15lf\n",ans);
	}
}

Measured memory_bytes: 1192
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a, b, c, d, N, ans=0, L, X;
    vector<int> v(3);
    char tmp, tmp2;
    string S, S2, S3;
    bool flag=true;
    
    cin >> S;

    // ans = (N%2==0) ?N : 2*N ;
    a=0;b=0;c=0;d=0;
    for(int i=0; i<4; i++){
	if(S[0]==S[i])
	    a++;
	if(S[1]==S[i])
	    b++;
	if(S[2]==S[i])
	    c++;
	if(S[3]==S[i])
	    d++;			
    }
    
    // tmp = X%L;
    // tmp2 = X/L;
    // ans = ((X/L)%2!=0) ? L-tmp:tmp;
    flag = (a==b&&b==c&&c==d&&a==2);
    
    // cout << a << endl;
    // cout << flag ? "Yes": "No" << endl;
    // ans = a<=b ? a:a-1;

    
    // ans = min(A, B) + min(C, D);
    // cout << ans<< endl;

    // if(S[1]==S[2] &&(S[0]==S[1] | S[2]==S[3]))
    // 	cout << "Yes" <<endl;
    // else
    // 	cout << "No" <<endl;

    // string S;
    // cin >>S;
    // cout << S + "pp"<<endl;
    if(flag)
    	puts("Yes");
    else
    	puts("No");
}



Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <cmath>
#include <iomanip>
#include <deque>
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;
ll intpow(ll N, ll P){
    if(P==0) return 1;
    if(P%2==0){
        ll t = intpow(N, P/2);
        return t*t;
    }
    return N * intpow(N, P-1);
}
ll modpow(ll N, ll P,ll k){
    if(P==0) return 1;
    if(P%2==0){
        ll t = modpow(N, P/2,k)%k;
        return t*t%k;
    }
    return N * modpow(N, P-1,k)%k;
}
ll modkai(ll n,ll m,ll k){//n*(n-1)*(n-2)*...(m+1)%k
    if(n == m)return 1;
    return modkai(n-1,m,k)*n%k;
}
ll mod_cnb(ll n,ll m,ll k){//nCm%k,kは十分大きい素数
  int m_=modkai(m,0,k);
  return modkai(n,n-m,k)*modpow(m_,k-2,k)%k;
}
ll gcd(ll n,ll m){
    ll n_ = max(n,m);
    ll m_ = min(n,m);
    if(n_%m_ == 0)return m_;
    return gcd(m_,n_%m_);
}
ll lcm(ll n,ll m){
    return n*m/gcd(n,m);
}
int main(){
    ll a,b;cin>>a>>b;
    ll g=gcd(a,b);
    ll G=g;
    vector<ll>v;
    for(ll i=2;i*i<=G;i++){
        if(g%i == 0){
            v.push_back(1);
            g /= i;
        }
        while(g%i == 0){
            v[v.size()-1]++;
            g /= i;
            }
    }
  if(g>1)v.push_back(1);
        cout << v.size()+1 << endl;
        return 0;
}

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

int main()
{
    int n;
    cin >> n;
    int a[n];
    rep(i, n) cin >> a[i];
    
    int cu = 1;
    rep(i, n) if (a[i] == cu) cu++;

    if (cu == 1) cout << -1 << endl;
    else cout << n - cu + 1 << endl;

    return 0;
}

Measured memory_bytes: 1024
#pragma region
#include <assert.h>
#include <math.h>

#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define pb push_back
#define f(i, a, b) for (int i = a; i < b; i++)
#define revf(i, b, a) for (int i = b; i >= a; i--)
#define all(v) v.begin(), v.end()
#define srt(v) sort(v.begin(), v.end())
#define revsrt(v) sort(v.rbegin(), v.rend())
#define sp << ' ' <<
#define en << '\n'
#define precision(x) cout << fixed << setprecision(x);

using namespace std;

template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &v) {
  os << "{" << v.first << ", " << v.second << "}" en;
  return os;
}

template <typename T> ostream &operator<<(ostream &os, set<T> &v) {
  for (T t : v)
    os << t << " ";
  os en;
  return os;
}

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (T t : v)
    os << t << " ";
  os en;
  return os;
}

template <typename T> istream &operator>>(istream &is, vector<T> &v) {
  int n = v.size();
  for (int i = 0; i < n; i++)
    is >> v[i];
  return is;
}

#define int long long
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
#pragma endregion

int mod = 1e9 + 7; // 998244353;
const int MAX = 1e5 + 5;

void preprocessing() {}

void solvetestcase() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int ans = max(max(a * c, b * d), max(a * d, b * c));
  cout << ans << endl;
}

#undef int
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);

  preprocessing();

  int t = 1;
  // UNCOMMENT FOR TESTCASES	\
	cin >> t;

  f(T, 1, t + 1) {
    // UNCOMMENT FOR CODEJAM,HACKERCUP	\
		cout << "Case #" << T << ": ";
    solvetestcase();
    cout.flush();
  }

  return 0;
};

/*
    AUTHOR:     KUNAL TAWATIA
    EDUCATION:  INDIAN INSTITUTE OF TECHNOLOGY, JODHPUR
*/


Measured memory_bytes: 3648
#ABC106B
def main():
    import sys
    N = int(sys.stdin.readline())
    result = 0
    
    for i in range(1, N+1, 2):
        result +=yakusu_cnt(i)
    print(result)
    
def yakusu_cnt(n):
    ans = 0
    for i in range(1, n+1):
        if n%i==0:
            #print(i)
            ans+=1
    if ans ==8:
        return 1
    else:
        return 0


if __name__=='__main__':
    main()

Measured memory_bytes: 3060
def base10to8(n):

    ans = ""
    while n > 0:
        ans = str(n % 8) + ans
        n = n // 8

    return ans


while True:

    n = int(input())
    if n == 0:
        break

    s = base10to8(n)

    table = [0,1,2,3,5,7,8,9]
    for i in range(len(s)):
        print(table[int(s[i])], end="")
    print("")




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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = 1LL << 60;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(16);

}

signed main() {
	ll n;

	cin >> n;

	vector<ll> v;
	vector<ll> dp(n + 1, INF);

	v.push_back(1);

	ll x = 6;

	while (x <= n) {
		v.push_back(x);
		x = x * 6;
	}

	ll y = 9;

	while (y <= n) {
		v.push_back(y);
		y = y * 9;
	}

	dp[0] = 0;

	FOR(i, 1, n + 1) {
		REP(j, v.size()) {
			if (v[j] <= i) {
				dp[i] = min(dp[i], dp[i - v[j]] + 1);
			}
		}
	}

	cout << dp[n] << endl;
}

Measured memory_bytes: 1024
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
using namespace std;

int main()
{
  
  long int tot = 0;
  int i, j, n, m, temp;
  cin >> n >> m;
  
  priority_queue<long int> a;

  for (i = 0; i < n; i++)
  {
    int x;
    cin >> x;
    a.push(x);
  }
  for (i = 0; i < m; i++)
  {
    if (!a.empty())
    {
      int y;
      y = a.top();
      a.pop();    
      y /= 2;
      if (y != 0)
      {
        a.push(y);
      }
    }
    else
    {
      break;
    }
  }
    while(!a.empty())
  {
    tot += a.top();
    a.pop();
  }
  
  
  cout << tot;

  return 0;  
}


Measured memory_bytes: 1400
#モンスターの体力は H
#トキはN種類の魔法が使え、
#i番目の魔法を使うと、モンスターの体力を Ai減らすことができますが、
#トキの魔力を Bi消耗します。

#dp[i] = モンスターの体力を i 減らすため消耗する魔力の最小値
#dp[i+1] = min(dp[i-Ai]+Bi,dp[i])
#dp[0]=0

import numpy as np
 
h, n = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
ab = np.array(ab)
 
a = ab[:, 0]
b = ab[:, 1]
 
dp = np.zeros(100001, dtype=np.int)
for i in range(1, h+1):
    dp[i] = (dp[i-a]+b).min()
print(dp[h])


Measured memory_bytes: 14436
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        for (int i = 0; i < 26; i++) {
            char c = (char) ('a' + i);
            int l = -1;
            for (int j = 0; j < s.length(); j++) {
                if (s.charAt(j) == c) {
                    if (l == -1) l = j;
                    else if (j - l <= 2) {
                        System.out.println((l + 1) + " " + (j + 1));
                        return;
                    }
                    else l = j;
                }
            }
        }
        System.out.println(-1 + " " + -1);
    }
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    cout << fixed << setprecision(10);
    int h,w,k;
    cin >> h >> w >> k;
    string s[h];
    rep(i,h) cin >> s[i];

    int cnt = 0;
    rep(i, 1<<h){
        rep(j, 1<<w){
            int now = 0;
            rep(k,h){
                rep(l,w){
                    if((i>>k)&1)continue;
                    if((j>>l)&1) continue;
                    if(s[k][l] == '#') now++;
                }
            }
            if(now == k) cnt ++;
        }
    }
    cout << cnt << endl; 
    return 0;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
int main()
{
	string s;
	cin>>s;
	int ans=1e9;
	for(int j=0;j<26;j++)
	{
		int cur=0;
		int pre=-1;
		for(int i=0;i<s.length();i++)
		{
			if(s[i]-'a'==j)
			{
				cur=max(cur,i-pre-1);
				pre=i;
			}
		}
		cur=max(cur,(int)s.length()-pre-1);
		ans=min(ans,cur);
	}
	cout<<ans<<'\n';
}


Measured memory_bytes: 3628
#include <stdio.h>

int main() {
    int i = 1;
    int x = 1;
    while(x != 0){
        scanf("%d", &x);
        if(x == 0) {
            exit(0);
        } else {
            printf("Case %d: %d\n", i, x);
            ++i;
        }
    }
}


Measured memory_bytes: 2028
K,N = map(int, input().split())
A = list(map(int, input().split()))
# K, N = 20, 3
# A = [5, 10, 15]
l = []

l.append(K - A[-1] + A[0])
for i in range(1, N):
  l.append(A[i] - A[i - 1])
l.pop(l.index(max(l)))
print(sum(l))


Measured memory_bytes: 86220
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String w;
		int count[];
		count = new int[27];
		boolean ans = true;
		
		w = sc.next();
		
		for(int i = 0; i < w.length(); ++i) {
			++count[w.charAt(i)-'a'];
		}
		
		for(int i = 0; i < 27; ++i) {
			if(count[i] % 2 == 1) {
				ans = false;
				break;
			}
		}
		
		if(ans) System.out.println("Yes");
		else System.out.println("No");
		
		sc.close();
	}

}


Measured memory_bytes: 22740
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
  string s;
  cin >> s;
  stack<char> stk;
  int ans = 0;
  for(char c : s){
    c -= '0';
    if(!stk.empty() && stk.top() == (c ^ 1)){
      ans += 2;
      stk.pop();
    }else{
      stk.push(c);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
int main() {
    int a,b,c;
    scanf("%d",&a);
    scanf("%d",&b);
    scanf("%d",&c);
    double PI = acos(-1);
    double s,l,h;
    s = 1.0/2.0*a*b*sin(c*PI/180);
    h = 2.0*s/a;
    l = a + b + sqrt(pow(a,2)+pow(b,2)-2.0*a*b*cos(c*PI/180));
    printf("%f\n%f\n%f",s,l,h);
}


Measured memory_bytes: 3428
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
const int INF = 1001001001;
const ll LINF = 1e18;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const P p1, const P p2){ return p1.first < p2.first;};
bool p_comp_fg(const P p1, const P p2){ return p1.first > p2.first;};
bool p_comp_ss(const P p1, const P p2){ return p1.second < p2.second;};
bool p_comp_sg(const P p1, const P p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}


int main(){
    ll N, sum_a = 0; cin >> N;
    vl as(N, 0);
    REP(i, N){
        cin >> as[i]; sum_a += as[i];
    }
    ll sum_s = 0; ll ret = LINF;
    REP(i, N - 1){
        sum_s += as[i]; ll sum_arai = sum_a - sum_s;
        ll diff = abs(sum_s - sum_arai);
        if(diff < ret) ret = diff;
    }
    cout << ret << endstr;
    return 0;
}


Measured memory_bytes: 1792
n,m,l = map(int,input().split())
inf = 10 ** 18
d1 = [[inf for _ in range(n)] for _ in range(n)]
for i in range(n):
  d1[i][i] = 0
for _ in range(m):
  a,b,c = map(int,input().split())
  a -= 1
  b -= 1
  d1[a][b] = c
  d1[b][a] = c
for k in range(n):
  for i in range(n):
    for j in range(n):
      d1[i][j] = min(d1[i][j], d1[i][k]+d1[k][j])
d2 = [[inf for _ in range(n)] for _ in range(n)]
for i in range(n):
  for j in range(n):
    if d1[i][j] == 0:
      d2[i][j] = 0
    elif d1[i][j] <= l:
      d2[i][j] = 1
for k in range(n):
  for i in range(n):
    for j in range(n):
      d2[i][j] = min(d2[i][j], d2[i][k]+d2[k][j])
q = int(input())
for _ in range(q):
  s,t = map(int,input().split())
  s -= 1
  t -= 1
  ans = d2[s][t]
  if ans >= inf:
    print(-1)
  else:
    print(ans-1)

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

using namespace std;

typedef long long int ll;

int main(){
	ll x,k,d;
	cin >> x >> k >> d;
	x = abs(x);
	ll fa = x / d;
	ll rm = x % d;
	if(fa == k){
		cout << rm << "\n";
	}
	else if(fa > k){
		cout << x - (d * k)  << "\n";
	}else{
		k -= fa;
		if(k&1ll) cout << d - rm << "\n";
		else cout << rm << "\n";
	}
	return 0;
}


Measured memory_bytes: 3632
from collections import deque

s = input()
q = int(input())
ls = [input().split() for _ in range(q)]

ans = deque(s)
cnt = 0

for t in ls:
    if t[0] == '1':
        cnt += 1
    elif t[0] == '2':
        if cnt % 2 == 0:
            if t[1] == '1':
                ans.appendleft(t[2])
            elif t[1] == '2':
                ans.append(t[2])
        elif cnt % 2 == 1:
            if t[1] == '1':
                ans.append(t[2])
            elif t[1] == '2':
                ans.appendleft(t[2])

if cnt % 2 == 0:
    print("".join(ans))
elif cnt % 2 == 1:
    ans.reverse()
    print("".join(ans))

Measured memory_bytes: 44660
#include <iostream>
using namespace std;
int main(void){
    int a,b;
    cin>>a>>b;
    if( a < b ){
        cout<<"a < b"<<endl;
    }else if( a > b ){
        cout<<"a > b"<<endl;
    }else if( a = b ){
        cout<<"a == b"<<endl;
    }
}



Measured memory_bytes: 3044
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<sstream>
#include<string>
#include<string.h>
#include<cmath>
#include<stack>
#include<vector>
#include<map>
#define E (2.71828182)
#define PI (3.1415926535898)
#define	mem(a,b)	memset(a,b,sizeof(a))
#define	_max(a,b,c)	(max(a,b)>c?max(a,b):c)
#define mod	1000000007
#include<set>
#define gc getchar
#define debug(a) cout << "*" << a << "*" << endl
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<float, int> P;
const int N = 200000;
const long long  MAX_V = 5005, INF = 2147483647, MOD = 998244353;
#include <iostream>
using namespace std;
char sp[1000005];
int ans;
int main()
{
	while (~scanf("%s", sp))
	{
		ans = 0;
		for (int i = strlen(sp) - 1; i > 0; i--)
		{
			if (sp[i] > '5')
			{
				ans += 10 - sp[i] + '0';
				sp[i - 1]++;
			}
			else if (sp[i] < '5')
			{
				ans += sp[i] - '0';
			}
			else
			{
				if (sp[i - 1] >= '5')
				{
					ans += 10 - sp[i] + '0';
					sp[i - 1]++;
				}
				else
				{
					ans += sp[i] - '0';
				}
			}
		}
		if (sp[0] <= '5')	ans += sp[0] - '0';
		else ans += 11 - sp[0] + '0';
		printf("%d\n", ans); 
	}
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a); i<=(b); ++i)
#define FORR(i,a,b) for (int i=(a); i>=(b); --i)
#define REP(i,b) for (int i=0; i<(b); ++i)
#define endl '\n'
#define sz(x) (int) x.size()
#define mod %
#define fillchar(x,y,z) memset(x,z,y)
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define sqr(x) ((x)*(x))
typedef long long int64;
typedef unsigned long long qword;
using namespace std;
const int maxn=1e5+5;
int n,m;
int64 f[maxn];
void Input()
{
    cin >> n >> m;
    int sum=0;
    FOR(i,1,n) {
        int w,v;
        cin >> w >> v;
        sum=min(m-w,sum);
        FORR(j,sum,0)
            f[j+w]=max(f[j+w],f[j]+v);
        sum+=w;
    }
    cout << *max_element(f,f+1+sum);
}
void Solve()
{

}
int main()
{
    #ifdef meomeomeooooo
        freopen("input.txt","r",stdin);
        //freopen(".out","w",stdout);
    #endif // meomeomeooooo
    iostream::sync_with_stdio(false);
    cin.tie(0);
    Input();
    Solve();
    return 0;
}



Measured memory_bytes: 1024
#include <stdio.h>

int main(int argc, char const *argv[])
{
	char s[6];
	scanf("%s",s);

	int a=2;
	int b=3;
	int c=4;
	int d=5;
	if( s[a]==s[b] && s[c]==s[d]){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <list>
#include <math.h>
#include <map>
using namespace std;
#define REP(i, k, n) for(int i = k;i < n; i++)
#define rep(i, n) REP(i,0,n)
int dx[4] = {0,-1,1,0};
int dy[4] = {-1,0,0,1};
long long int N;

int keta(long long x){
	int cnt = 0;
	while(x != 0){
		x /= 10;
		cnt++;
	}
	return cnt;
}
int main(void){
	cin >> N;
	int ans = keta(N);
	for(int i = 2; i <= sqrt(N); i++){
		if(N % i != 0)continue;
		long long B  = N / i;
		ans = min(ans, max(keta(B),keta(i)));
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
import java.io.*;
 
class Main {
    public static void main(String args[]) {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
     
        try {
            while (true) {
                String line[] = new String[8];
                char c = 'A';
                int mem[] = new int[2];
                for (int i=0;i<8;i++) {
                    line[i] = br.readLine();
                }
             
                for (int i=0;i<8;i++) {
                    if (line[i].indexOf("1111")!=-1) {
                        c = 'C';
                        break;
                    } else if ((mem[0] = line[i].indexOf("11"))!=-1) {
                        mem[1] = line[i+1].indexOf("11");
                        if (mem[0]==mem[1]) {
                            c = 'A';
                            break;
                        } else if (mem[0]+1==mem[1]) {
                            c = 'E';
                            break;
                        } else if (mem[0]-1==mem[1]) {
                            c = 'G';
                            break;
                        }
                    } else if ((mem[0] = line[i].indexOf("1"))!=-1) {
                        mem[1] = line[i+1].indexOf("11");
                        if (mem[0]==mem[1]) {
                            c = 'F';
                            break;
                        } else if (mem[0]-1==mem[1]&&mem[1]>=0) {
                            c = 'D';
                            break;
                        } else {
                            c = 'B';
                            break;
                        }
                    }
                }
                System.out.println(c);
                if (br.readLine()==null) break;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Measured memory_bytes: 15052
#include<cstdio>
int n,a,b;
int main()
{
	scanf("%d",&n);
	if(n%100<=12&&n%100>=1)a=1;
	if(n/100<=12&&n/100>=1)b=1;
	if(a&&b)puts("AMBIGUOUS");
	else if(a)puts("YYMM");
	else if(b)puts("MMYY");
	else puts("NA");
	return 0;
}


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

int main() {
  int n; cin >> n;
  set<int> a;
  int min_a = 1e9+5;
  rep(i,n) {
    int ai; cin >> ai;
    min_a = min(min_a, ai);
    a.insert(ai);
  }
  while (a.size() > 1) {
    int min_na = min_a;
    for (auto ai : a) {
      if (min_a == ai) continue;
      a.erase(ai);
      int na = ai % min_a;
      if (na != 0) {
        a.insert(na);
        min_na = min(min_na, na);
      }
    }
    min_a = min_na;
  }
  cout << min_a << endl;
  return 0;
}

Measured memory_bytes: 8060
#include <bits/stdc++.h>
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define P 1000000007
#define in(x, a, b) (a <= x && x < b)
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)

using namespace std;
using ll = long long;
typedef pair<int, int> ii;
typedef vector<ii> vii; 
typedef vector<int> vi;
const ll inf = 1000000001, INF = (ll)1e18 + 1;

void solve() {
	int n;
	cin >> n;
	
	vi ans(n, 0);
	for(int x = 1; x * x <= n; x++) {
		for(int y = 1; y * y <= n; y++) {
			for(int z = 1; z * z <= n; z++) {
				int calc = (x * x + y * y + z * z + x * y + y * z + z * x);
				if(calc <= n) ans[calc]++;
			}
		}
	}
	
	for(int i = 1; i <= n; i++) cout << ans[i] << endl;
}

int main(){
#define MULTITEST 0
#if MULTITEST   
 
    CASET {
        solve();
    }
    
#else

    solve();
    
#endif

    return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
#define ll long long

using namespace std ;

int main()
{
    string s ;
    cin >> s ;
    bool turn = 0 ;
    vector < char > b , a ;
    int q ;
    cin >> q ;
    for ( int i = 0 ; i < q ; i++ )
    {
        int t ;
        cin >> t ;
        if ( t == 1 )
        {
            turn = !turn ;
        }
        else
        {
            int f ;
            char c ;
            cin >> f >> c ;
            if ( f  == 1 && !turn || f == 2 && turn )
            {
                b.push_back(c);
            }
            else
            {
                a.push_back(c);
            }
        }
    }
    if ( turn )
    {
        for ( int i = a.size() - 1 ; i >= 0 ; i-- )
            cout <<a[i];
        reverse(s.begin(),s.end());
        cout << s ;
        for ( auto i : b )
            cout << i ;
    }
    else
    {
        for ( int i = b.size() - 1 ; i >= 0 ; i-- )
        cout << b[i] ;
        cout << s ;
        for ( auto i : a )
        cout << i ;
    }
	return 0;
}




Measured memory_bytes: 1024
# include <bits/stdc++.h>
# define ll unsigned long long
using namespace std;
const int N = 2e5 + 1000;
int main(){
	ll n, res = 0, cnt = 5;
	cin >> n; 
	if(n % 2){
		cout << "0\n";
		return 0;  
	}
	for(;cnt <= n; cnt *= 5){
		res += n / cnt / 2;
	}
	cout << res << '\n';
}


Measured memory_bytes: 256
import sys

def resolve():
    D, N = list(map(int, input().split(" ")))
    if D == 0:
        if N == 100:
            print(101)
        else:
            print(N)
    if D == 1:
        if N == 100:
            print(100*101)
        else:
            print(100*N)
    if D == 2:
        if N == 100:
            print(10000*101)
        else:
            print(10000*N)    

if '__main__' == __name__:
    resolve()

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

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;

	int a, b;
	a = x2 - x1;
	b = y2 - y1;
	int x, y;
	x = x2;
	y = y2;
	rep(i, 2)
	{
		swap(a, b);
		a *= -1; 
		x += a; 
		y += b;
		if (i)
			cout << " ";
		cout << x << " " << y; 
	}
	cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(false),cin.tie(NULL);
    ll n;
    cin>>n;
    ll a[n],sum=0;
    for(ll i=0;i<n;i++){
            cin>>a[i];
            sum^=a[i];
    }
    for(ll i=0;i<n;i++)cout<<(sum^a[i])<<" ";
    cout<<endl;

    return 0;
}



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

int main() {
  int n, m, x, y;
  cin >> n >> m >> x >> y;
  int xmax = x;
  int ymin = y;
  int a, b;
  for (int i = 0; i < n; i++) {
    cin >> a;
    xmax = max(a, xmax);
  }
  for (int i = 0; i < m; i++) {
    cin >> b;
    ymin = min(b, ymin);
  }
  if (xmax < ymin) {
    cout << "No War" << endl;
  }
  else {
    cout << "War" << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    while(a>0 && c>0){
        c=c-b;
        if(c<=0){
            cout<<"Yes"<<endl;
            return 0;
        }
        a=a-d;
        if(a<=0){
            cout<<"No"<<endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3624
/*
貪欲
後ろから見る
DP
順位表をチェック
二分探索


*/
#pragma GCC optimize("Ofast")
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include <map>
#include<tuple>
using namespace std;
#define INF 3e18+7
#define MAX 100000
#define MOD 1000000007
typedef long long ll;
typedef pair<double,int> P;
//typedef pair<pair<int,int>,int> p;
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)
struct edge{ll to,cost,val;};
template<class T,class U>bool chmin(T&a,const U&b){if(a<=b)return false;a=b;return true;}
template<class T,class U>bool chmax(T&a,const U&b){if(a>=b)return false;a=b;return true;}
//__builtin_popcount(S);
//C.erase(unique(C.begin(),C.end()),C.end());

bool dp[90][90][6500];

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

    string s;
    cin>>s;
    int n=(int)s.size();
    int count=0;
    for(int i=0;i<(int)s.size()/2;i++){
        if(s[i]!=s[n-1-i]) count++;
    }
    cout<<count<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;cin>>N;
  vector<int> A(N);
  vector<int> B(N);
  for(int i=0;i<N;i++)cin>>A[i];
  B=A;
  sort(B.begin(),B.end());
  int f=B[N-1],s=B[N-2];
  for(int i=0;i<N;i++){
    cout<<(A[i]==f?s:f)<<endl;
  }
}

Measured memory_bytes: 3200
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define MOD 1000000007
#define INF 1 << 30

using namespace std;
typedef long long ll;
typedef pair<int, int> pp;

int main(void) {
	int num, i, a = 0;
	ll ans = 0;
	string s;
	cin >> s;
	num = s.size();
	vector<int> d(num + 1, -1);
	rep(i, num) {
		if (s[i] == '<') {
			d[i] = a++;
			d[i + 1] = a;
		}
		else
			a = 0;
	}
	if (s[num - 1] == '>')
		d[num] = 0;
	a = 0;
	for (i = s.size() - 1; i >= 0; i--) {
		if (s[i] == '>')
			chmax(d[i], d[i + 1] + 1);
	}
	rep(i, num + 1)
		ans += d[i];
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 2820