akhauriyash/Code-Regression huggingface dataset:
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main() {
  int w, n, x, y, tmp;
  char c;
  VI v;

  cin >> w >> n;

  FOR(i, 0, w) v.PB(i+1);
  FOR(i, 0, n) {
    cin >> x >> c >> y;
    tmp = v[x-1];
    v[x-1] = v[y-1];
    v[y-1] = tmp;
  }
  FOR(i, 0, w) cout << v[i] << endl;
}

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

using namespace std;

int main() {
  std::ios_base::sync_with_stdio(false);
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int ans = 0;
  for (int i = 0; i * a <= d; i++) {
    for (int j = 0; i * a + j * b <= d; j++) {
      if ((d - i * a - j * b) % c == 0) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import math
a,b,h,m = map(int,input().split())
a_s = (30*h)%360+0.5*m
b_s = (6*m)

s = max(a_s,b_s)-min(a_s,b_s)
ans = math.sqrt(a**2+b**2-2*a*b*math.cos(math.radians(s)))
print(ans)

Measured memory_bytes: 9384
#include<cstdio>
#include<cstring>
#include<algorithm>
#define rep(a,b,c) for (int a=b;a<=c;a++)
#define per(a,b,c) for (int a=b;a>=c;a--)
#define go(u) for (int o=ft[u],v;v=E[o].t;o=E[o].n)
#define fi first
#define se second
using namespace std;
typedef long long LL;
typedef pair<int,int> par;
const int N=500010;
int n,q,mx,mn,dis,f[N],a[N],ok[N];
int main(){
	scanf("%d%d",&n,&dis);
	rep(i,1,n) scanf("%d",a+i);
	mn=1;
	f[n+1]=1;
	per(i,n,1){
		if (a[i]<=mn*2-1) mn=mn+a[i];
		f[i]=mn;
	}
	rep(i,1,n){
		if (dis>=f[i+1]) ok[i]=1;
		dis=min(dis,abs(a[i]-dis)); 
	}
	scanf("%d",&q);
	while (q--){
		int x;
		scanf("%d",&x);
		puts(ok[x]?"YES":"NO");
	}
	return 0;
}


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

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	string S;
	int N;
	const char *s;
	int sl[100002] = {0}, bl[100002] = {0}, wl[100002] = {0};

	cin >> S;
	s = S.c_str();
	N = strlen(s);
	for(int i=0; i<N; i++){
		char tmp[2] = {0};
		tmp[0] = s[i];
		sl[i] = atoi(tmp);
		bl[i] = i % 2;
		wl[i] = (i+1) % 2;
	}

	int b = 0, w = 0;
	for(int i=0; i<N; i++){
		b += abs(sl[i] - bl[i]);
		w += abs(sl[i] - wl[i]);
	}
	int ans = min(b, w);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1664
#define LOCAL

#undef _GLIBCXX_DEBUG

#include <bits/stdc++.h>
using namespace std;

#define IOS ios::sync_with_stdio(false);cin.tie(0)
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
#define MOD 1000000007LL
#define LLINF 100000000000000005LL
#define INF (int)1e9+1
#define pb push_back

// Copied from Gennady-Korotkevich's template

template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
	return '"' + s + '"';
}

string to_string(const char* s) {
	return to_string((string)s);
}

string to_string(bool b) {
	return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
	bool first = true;
	string res = "{";
	for (int i = 0; i < static_cast<int>(v.size()); i++) {
		if (!first) {
			res += ", ";
		}
		first = false;
		res += to_string(v[i]);
	}
	res += "}\n";
	return res;
}

template <size_t N>
string to_string(bitset<N> v) {
	string res = "";
	for (size_t i = 0; i < N; i++) {
		res += static_cast<char>('0' + v[i]);
	}
	return res;
}

template <typename A>
string to_string(A v) {
	bool first = true;
	string res = "{";
	for (const auto& x : v) {
		if (!first) {
			res += ", ";
		}
		first = false;
		res += to_string(x);
	}
	res += "}\n";
	return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
	return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
	return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
	return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

template <typename A, typename B, typename C, typename D, typename E>
string to_string(tuple<A, B, C, D, E> p) {
	return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + "," + to_string(get<4>(p)) + ")";
}

void debug_out() {
	cerr << endl;
}

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
	cerr << " " << to_string(H);
	debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "\n[" << #__VA_ARGS__ << "]:\n", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

// End of Gennady-Korotkevich's template 

using llong = long long;
using PII = pair<int, int>;

int main()
{
	IOS;
	int n;
	cin >> n;
	vector<int> a(n);
	llong ans = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 1; i < n; i++) {
		if (a[i] < a[i - 1]) {
			ans += a[i - 1] - a[i];
			a[i] = a[i - 1];
		}
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 3984
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define mod ((int)1e9+7)
#define lim 1000000000000000007
#define lim1 18446744073709551615  //Unsigned
#define sq(a) ((a)*(a))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mms(v,i) memset(v,i,sizeof(v))
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define REPN(i,a,b) for (int i = a; i >= b; i--)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> pi;
typedef pair<ll,ll> PL;
typedef pair<ll,int> PLI;
typedef pair<int,ll> PIL;
typedef pair<int,pair<int,int> > pii;
typedef pair<double,double> pdd;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
typedef tree<pi,null_type,less<pi>,rb_tree_tag,tree_order_statistics_node_update> indexed_set_pair;
ll power(ll a,ll b) {
   ll res=1;
   while(b){
      if(b%2==1) res=(res*a)%mod;
      a=(a*a)%mod;
      b>>=1;
   }
   return res;
}
ll gcdll(ll a,ll b) {
    if (b==0) return a;
    return gcdll(b,a%b);
}
int gcd(int a,int b) {
    if (b==0) return a;
    return gcd(b,a%b);
}

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

const int N = (int)2e5+5;
const int M = (int)1e3+5;
const int Q = 102;
const int logN = 19;

const double pie = acos(-1);

void solve() {
    string s,t;
    cin>>s>>t;
    int ans = 0;
    int n = s.size();
    REP(i,0,n-1) {
        if(s[i]!=t[i])
            ans++;
    }
    cout<<ans;
}
int main() {
    //freopen("./sort/b2.in","r",stdin);
    //freopen("output.txt","w",stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int T=1;
    //cin>>T;
    REP(TC,1,T) {
        //cout<<"Case #"<<TC<<": ";
        solve();
        cout<<"\n";
    }
}


Measured memory_bytes: 3796
n,m,x=map(int,input().split())
CA=[list(map(int,input().split())) for _ in range(n)]

res=10**7

for i in range(2**n):
	money=0
	under=[0]*m
	
	for j in range(n):
		if i>>j&1:
			money+=CA[j][0]
			for k in range(m):
				under[k]+=CA[j][k+1]
		
	if min(under)>=x:
		res=min(res,money)

if res==10**7:
	print("-1")
else:
	print(res)	

Measured memory_bytes: 9220
#pragma comment(linker, "/STACK:512000000")
#include <bits/stdc++.h>
#ifdef AIM
#include <sys/resource.h>
#endif
using namespace std;

#define all(a) a.begin(), a.end()
typedef long long li;
typedef long double ld;
void solve(__attribute__((unused)) bool);
void precalc();
clock_t start;
#define FILENAME ""

int main() {
#ifdef AIM
  string s = FILENAME;
//    assert(!s.empty());
  freopen("/home/alexandero/ClionProjects/cryptozoology/input.txt", "r", stdin);
//freopen("/home/alexandero/ClionProjects/cryptozoology/output.txt", "w", stdout);
#else
//    freopen(FILENAME ".in", "r", stdin);
//    freopen(FILENAME ".out", "w", stdout);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    start = clock();
    int t = 1;
#ifndef AIM
  cout.sync_with_stdio(0);
  cin.tie(0);
#endif

#ifdef AIM
  const rlim_t kStackSize = 256 * 1024 * 1024;
  struct rlimit rl;
  int result;

  result = getrlimit(RLIMIT_STACK, &rl);
  if (result == 0)
  {
    if (rl.rlim_cur < kStackSize)
    {
      rl.rlim_cur = kStackSize;
      result = setrlimit(RLIMIT_STACK, &rl);
      if (result != 0)
      {
        fprintf(stderr, "setrlimit returned result = %d\n", result);
      }
    }
  }
#endif

  precalc();
  cout.precision(10);
  cout << fixed;
  //cin >> t;
  int testNum = 1;
  while (t--) {
      //cout << "Case #" << testNum++ << ": ";
      solve(true);
  }
  cout.flush();
#ifdef AIM1
    while (true) {
      solve(false);
  }
#endif

#ifdef AIM
  cout.flush();
  auto end = clock();

  usleep(10000);
  print_stats(end - start);
  usleep(10000);
#endif

    return 0;
}

template<typename T>
T binpow(T q, T w, T mod) {
    if (!w)
        return 1 % mod;
    if (w & 1)
        return q * 1LL * binpow(q, w - 1, mod) % mod;
    return binpow(q * 1LL * q % mod, w / 2, mod);
}

template<typename T>
T gcd(T q, T w) {
    while (w) {
        q %= w;
        swap(q, w);
    }
    return q;
}
template<typename T>
T lcm(T q, T w) {
    return q / gcd(q, w) * w;
}

template <typename T>
void make_unique(vector<T>& a) {
    sort(all(a));
    a.erase(unique(all(a)), a.end());
}

template<typename T>
void relax_min(T& cur, T val) {
    cur = min(cur, val);
}

template<typename T>
void relax_max(T& cur, T val) {
    cur = max(cur, val);
}

void precalc() {
}

//#define int li
//const int mod = 1000000007;

void solve(__attribute__((unused)) bool read) {
  int n, m;
  cin >> n >> m;
  string s, t;
  cin >> s >> t;
  for (int i = 0; i < n; ++i) {
    li up = (li)i * m;
    if (up % n == 0) {
      auto j = up / n;
      if (s[i] != t[j]) {
        cout << "-1\n";
        return;
      }
    }
  }
  int g = gcd(n, m);
  cout << n / g * (li)m << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;


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

  int n,k;
  cin>>n>>k;
  int ans = 1;
  
  ans *= k;
  for(int i = 0; i < n - 1; i++)
  {
    ans *= (k - 1);
  }
  cout << ans <<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long; // ll は long long　と同じとする。
int main() {
    int N , M;
    cin >> N >> M;
    vector <int> L(M);
    vector <int> R(M);
    for(int i = 0; i < M; i++){
        cin >> L.at(i) >> R.at(i);
    }
    sort(L.begin() , L.end());
    reverse(L.begin() , L.end());
    sort(R.begin() , R.end());
    if(L <= R){
        cout << R.at(0) - L.at(0) + 1 << endl;
    }
    else{
        cout << 0 << endl;
    }
}


Measured memory_bytes: 1152
#encoding:utf-8 No.0500 2014.11.10
while true
  num_of_cards = gets.chomp.to_i
  if num_of_cards == 0
    break
  end

  score_A = 0
  score_B = 0
  num_of_cards.times do
    a,b = gets.chomp.split.map{|n| n.to_i}
    if a > b
      score_A += a+b
    elsif a < b
      score_B += a+b
    else
      score_A += a ; score_B += b
    end
  end

  print "#{score_A} #{score_B}\n"
end

Measured memory_bytes: 6104
#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 n; cin >> n;
  double sum = 0;
  
  rep(i, n) {
    double x; string u; cin >> x >> u;
    sum += (u=="BTC")*380000*x + (u=="JPY")*x;
  } cout << sum;
}
  


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn=3001;
double dp[maxn][maxn],prob[maxn];
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		scanf("%lf",&prob[i]);
	}
	memset(dp,0,sizeof(dp));
	dp[0][0]=1;
	for(int i=1;i<=n;i++)
	{
		double headevent=prob[i],tailevent=1-prob[i];
		dp[0][i]=tailevent * dp[0][i-1];
		for(int heads=1;heads<=i;heads++)
		{
			int x=i-1;
			dp[heads][i]=headevent * dp[heads-1][x] + tailevent * dp[heads][i-1];
		}
	}
	double ans=0;
	for(int i=n/2+1;i<=n;i++)
	{
		ans+=dp[i][n];
	}
	cout<<setprecision(9)<<ans;
	return 0;
}

Measured memory_bytes: 70784
A,B = input().split()
S = input()
ans = ""

f = S[:int(A)]
s = S[int(A)+1:]

if S[int(A)] == "-":
    if f.isdigit() and s.isdigit():
        ans = "Yes"
    else:
        ans = "No"
else:
    ans = "No"

print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <algorithm>
#include <vector>
#include <cstring>
#include <stack>
#include <cctype>
#include <utility>
#include <map>
#include <string>
#include <climits>
#include <set>
#include <sstream>
#include <utility>
#include <ctime>
#include <cassert>
#include <fstream>
using namespace std;
typedef long long LL;
#define MS(A) memset(A, 0, sizeof(A))
#define MSV(A,a) memset(A, a, sizeof(A))
#define MP make_pair
#define PB push_back
#define getcx getchar_unlocked
#define INF (int(1e9))
#define INFL (LL(1e18))
#define EPS 1e-12
#define chkbit(s, b) (s & (1<<b))
#define setbit(s, b) (s |= (1<<b))
#define chk(a) cerr << endl << #a << " : " << a << endl
#define chk2(a,b) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << endl
#define chk3(a,b,c) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << endl
#define chk4(a,b,c,d) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << "\t" << #d << " : " << d << endl
#define rep(i, a, n) for(i=a;i<n;i++)
#define rev(i, a, n) for(i=a;i>=n;i--)
#define rep_itr(itr, c) for(itr = (c).begin(); itr != (c).end(); itr++)
#define MOD 1000000007
#define MAX 100005

int main() {

	int n;

	cin>>n;

	int q = n/1000;

	if(n % 1000 == 0) cout<<0<<endl;
	else cout<<(1000*(q+1) - n)<<endl;




	return 0;
}

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

using namespace std;

typedef long long ll;
ll n, k;
vector<ll> v;

ll countless(ll X) {
    ll an = 0;

    for (auto &x: v) {
        if (x * x <= X) --an;
        if (x == 0) {
            if (X >= 0) an += n;
        } else if (x < 0) {
            ll y = X / x - 5;
            while (y * x > X) ++y;
            ll z = lower_bound(v.begin(), v.end(), y) - v.begin();
            an += n - z;
        } else if (x > 0) {
            ll y = X / x + 5;
            while (y * x > X) --y;
            ll z = upper_bound(v.begin(), v.end(), y) - v.begin();
            an += z;
        }
    }

    return an / 2;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> k;
    v.resize(n);
    for (auto &x: v) {
        cin >> x;
    }
    sort(v.begin(), v.end());

    ll INF = 1e18;
    ll lo = -INF-10, hi = INF+10, mid;
    while (lo < hi) {
        mid = lo + (hi-lo)/2;
        if (countless(mid) < k) {
            lo = mid+1;
        } else {
            hi = mid;
        }
    }
    cout << lo << endl;

    return 0;
}


Measured memory_bytes: 1792
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace CSharpSample01
{

	class Program
	{
		static void Main(string[] args)
		{
			var inputNum = Console.ReadLine();
			var N = inputNum.Length;

			var flag = true;

			for(int i = 0;i < N / 2;i++)
			{
				if(inputNum[i] != inputNum[N - i - 1])
				{
					flag = false;
					break;
				}
			}

			if(flag)
			{
				var targetNum = N / 2;

				for(int i = 0; i < targetNum / 2; i++)
				{
					if (inputNum[i] != inputNum[targetNum - i - 1])
					{
						flag = false;
						break;
					}
				}
			}

			if (flag)
			{
				var startNum = (N + 3) / 2;

				for (int i = 0; i < N- startNum; i++)
				{
					if (inputNum[startNum -1 + i] != inputNum[N - i - 1])
					{
						flag = false;
						break;
					}
				}
			}

			if(flag)
			{
				Console.WriteLine("Yes");
			}
			else
			{
				Console.WriteLine("No");
			}
		}

	}
}

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

// iterator
#define REP(i,from, to) for(lli i=from;i<to;i++)
#define REPE(i,from, to) for(lli i=from;i<=to;i++)
#define REP_R(i,from, to) for(lli i=from;i>to;i--)
#define REPE_R(i,from, to) for(lli i=from;i>=to;i--)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

// input
#define cin1(x)             cin >> x
#define cin2(x, y)          cin >> x >> y
#define cin3(x, y, z)       cin >> x >> y >> z
#define ncin1(n, x)         REP(i, 0, n) {cin1(x[i]);}
#define ncin2(n, x, y)      REP(i, 0, n) {cin2(x[i], y[i]);}
#define ncin3(n, x, y, z)   REP(i, 0, n) {cin3(x[i], y[i], z[i]);}

// output
#define cout1(x)         cout << #x << ": " << x << endl;
#define cout2(x, y)      cout << #x << ": " << x << ", " << #y << ": " << y << endl;
#define cout3(x, y, z)   cout << #x << ": " << x << ", " << #y << ": " << y << ", " << #z << ": " << z << endl;;
#define ncout1(n, x)     REP(i, 0, n) {cout << #x << "[" << i << "]: "<< x[i] << endl;}

#define coutp(p)         cout << #p << ":" <<  " (" << p.first << ", " << p.second << ")" << endl;

// sort
#define sort_r(x, y)        sort(x, y, greater<lli>()); // 降順(5,4,3,,,)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

typedef long long int lli;
typedef pair<lli, lli> P;
typedef tuple<lli, lli, lli> tup;

lli gcd(lli a, lli b) {
    if (a < b)
        swap(a, b);
    if (b == 0)
        return a;
    lli r;
    r = a % b;

    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

int main() {
    lli a,b;
    cin2(a,b);
    // 素因数 key が value 個ある、を表す map
    map<lli, lli> fac;
    lli num = gcd(a,b);

    //cout1(num);
    for(lli i = 2; i*i<=num; i++) {
        while (num % i == 0) {
            fac[i]++;
            num /= i;
        }
    }
    if (num != 1)
        fac[num] = 1;
    lli ans = 1;
    REPIT(it, fac) {
        //cout << it->first << ": " << it->second << endl;
        ans++;
    }
    cout << ans << endl;


}


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

bool check(string s){
    string t = s;
    reverse(t.begin(), t.end());
    return s == t;
}

int main(void){
    
    string S;
    cin >> S;
    bool ans = true;
    
    if(!check(S)) ans = false;
    if(!check(S.substr(0, S.size()/2))) ans = false;
    
    cout << (ans ? "Yes" : "No") << endl;
    
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<array>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
#include<cassert>
#include<functional>
#include<random>
#include<complex>
#include<bitset>
#include<chrono>
//#include<boost/multiprecision/cpp_int.hpp>
#define int int64_t
#define uint uint64_t
#define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define EACH(i, a) for (auto i: a)
#define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define Min(x) *min_element(ALL(x))
#define Max(x) *max_element(ALL(x))
#define Unique(L) (L.erase(unique(ALL(L)), L.end()))
#define veccat(v1, v2) std::copy((v2).begin(),(v2).end(),std::back_inserter(v1)/*v1の後ろにv2を入れる*/)
#define intmax (std::numeric_limits<int64_t>::max() / 4)
using namespace std;
//typedef boost::multiprecision::cpp_int bigint;
const double EPS = 1e-9;
const double PI = acos(-1.0);
int exist[50][50];

void mycout(int a, int b, int c, int d) {
	cout << "? " << a << " " << b << " " << c << " " << d << endl;
}

void solve(int ylb, int yub, int xlb, int xub, int N) {
	//[ylb,yub)行目の[xlb,xub)にN個の爆弾があるとして、解く

	if (N == 0)return;

	const int dy = yub - ylb;
	const int dx = xub - xlb;
	if (dy * dx == N) {
		REP(y,ylb,yub)REP(x, xlb, xub)exist[y][x] = 1;
		return;
	}
	if (dy < dx) {
		const int medx = (xlb + xub - 1) / 2;
		mycout(ylb, xlb, yub - 1, medx);
		int hN;
		cin >> hN;
		solve(ylb, yub, xlb, medx + 1, hN);
		solve(ylb, yub, medx + 1, xub, N - hN);
	}
	else {
		const int medy = (ylb + yub - 1) / 2;
		mycout(ylb, xlb, medy, xub - 1);
		int hN;
		cin >> hN;
		solve(ylb, medy + 1, xlb, xub, hN);
		solve(medy + 1, yub, xlb, xub, N - hN);
	}
}

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

	int H, W, N, K;
	cin >> H >> W >> N >> K;

	int table[50][50];
	int zzz = 1;
	rep(i, H)rep(j, W) {
		table[i][j] = zzz;
		zzz *= 2;
		zzz %= K;
	}

	rep(i, 50)rep(j, 50)exist[i][j] = 0;

	solve(0, H, 0, W, N);

	int ans = 0;
	rep(i, 50)rep(j, 50)if (exist[i][j]) {
		ans += table[i][j];
		ans %= K;
	}
	cout << "! " << ans << endl;

	return 0;
}

Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vb=vector<bool>;
using vvb=vector<vb>;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pll = pair<ll,ll>;
using vpii = vector<pii>;
using vpli = vector<pli>;
using vpll = vector<pll>;

#define rep(i, n) for(int i=0;i<(int)n;i++)
#define rep2(i, s, n) for(int i=(s);i<(int)n;i++)
int INF=1e9+7;

int main() {
  int N,M;
  cin >> N >> M;
  vi a(M),b(M),x(M);
  vvi c(M);
  rep(i,M) {
    cin >> a[i] >> b[i];
    c[i]=vi(b[i]);
    rep(j,b[i]) {
      cin >> c[i][j];
      x[i]+=1<<(c[i][j]-1);
    }
  }
  
  vvi dp(M+1,vi(1<<N,INF));
  dp[0][0]=0;
  rep(i,M) {
    rep(j,1<<N) dp[i+1][j]=dp[i][j];
    rep(j,1<<N) dp[i+1][j|x[i]]=min(dp[i+1][j|x[i]],dp[i][j]+a[i]);
  }
  
  int ans=dp[M][(1<<N)-1];
  if(ans!=INF) cout << ans << endl;
  else cout << -1 << endl;
}

Measured memory_bytes: 19332
#include<cstdio>
using namespace std;
char a[55][55];
char b[55][55];
int main()
{
    int n, m;
    scanf("%d%d",&n,&m);
    char c;
    scanf("%c",&c);
    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= n; j++)
        {
            scanf("%c",&a[i][j]);
        }
        scanf("%c",&c);
    }
    for(int i = 1; i <= m; i++)
    {
        for(int j = 1; j <= m; j++)
        {
            scanf("%c",&b[i][j]);
        }
        scanf("%c",&c);
    }
    for(int x = 1; x <= n-m+1; x++)
    {
        for(int y = 1; y <= n-m+1; y++)
        {
            bool ok = true;
            for(int i = 1; i <= m; i++)
            {
                for(int j = 1; j <= m; j++)
                {
                    if(b[i][j] != a[x+ i - 1][y + j - 1])
                    {
                        ok = false;
                    }
                }
            }
            if(ok == true)
            {
                printf("Yes");
                return 0;
            }
        }
        
    }
    printf("No");
}

Measured memory_bytes: 128
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (n);i++)
using ll = long long;
const ll MOD=1000000007;
const long long INF = 1LL << 60;
const double pi=acos(-1.0);

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



int main(){
  ll N,K; cin>>N>>K;
  vector<ll> A(N);
  ll maxA=0;
  rep(i,N){cin>>A.at(i); chmax(maxA,A.at(i));}
  
  ll ok=maxA,ng=0;
  while(ok-ng>1){
    ll sum=0;
    ll mid=(ok+ng)/2;
    rep(i,N){
      sum+=A.at(i)/mid-1;
      if(A.at(i)%mid!=0) sum++;
    }
    if(sum<=K) ok=mid;
    else ng=mid;
  }
  cout<<ok<<endl;
  return 0;
}


Measured memory_bytes: 4808
using System;
using System.Collections;
using System.Collections.Generic;

using System.Linq;
public class dp_a {

    static DateTime START_TIME;
    static int INT_INF = int.MaxValue / 2;
    // static long LONG_INF = long.MaxValue / 2;
#if !MYTEST
    public static void Main() {
        START_TIME = DateTime.Now;
        System.Console.WriteLine(Answer());
    }
    public static void debugOut(string str) { }
    public static string ReadLine(){
        return System.Console.ReadLine();
    }
#endif
    public static string Answer() {
        var p = ReadLine().Trim().Split(' ');
        //              1234567890
        // int.MaxValue=2147483647
        var N = int.Parse(p[0]);
        var h = new int[N];
        var dp = new int[N];
        p = ReadLine().Trim().Split(' ');
        for (var i = 0; i < N; i++) {
            h[i] = int.Parse(p[i]);
            dp[i] = INT_INF;
        }
        dp[0] = 0;
        for (var i = 1; i < N; i++) {
            var cost = Math.Abs(h[i] - h[i - 1]);
            dp[i] = Math.Min(dp[i], dp[i - 1] + cost);
            if (i > 1) {
                cost = Math.Abs(h[i] - h[i - 2]);
                dp[i] = Math.Min(dp[i], dp[i - 2] + cost);
            }
        }

        return dp[N - 1].ToString();
    }
    #region LOCAL
#if MYTEST
    static System.IO.StreamReader FS = null;
    public static void Main() {
        START_TIME = DateTime.Now;
        if (System.IO.File.Exists("dp_a.txt")) {
            FS = new System.IO.StreamReader("dp_a.txt");
        }
        try {
            while (true) {
                debugOut("<TEST MODE>\n");
                START_TIME = DateTime.Now;
                var testcase = seekNextCase();
                var ans = Answer();
                System.Console.WriteLine(ans);  // debug
                debugOut($"{(DateTime.Now - START_TIME).TotalMilliseconds} msec.\n");
                if (FS != null && !FS.EndOfStream) {
                    var expect = ReadLine();
                    var res = ans == expect ? "OK" : "NG";
                    debugOut($"{testcase} {res} expect={expect} actual={ans}\n");
                }
            }
        } finally {
            if (FS != null) FS.Close();
        }
    }
    public static void debugOut(string str) {
        System.Console.Error.Write(str);
    }
    public static string ReadLine() {
        if (FS != null && !FS.EndOfStream) {
            var line = FS.ReadLine();
            // debugOut(line + "\n");
            if (FS.EndOfStream) {
                FS.Close();
                FS = null;
            }
            return line;
        }
        return System.Console.ReadLine();
    }
    public static string seekNextCase() {
        while (FS != null) {
            var line = ReadLine();
            if (line.StartsWith("---")) {
                return line;
            }
        }
        return null;
    }
#endif
    #endregion
}


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

main(){
	int n,h[110]={} ;
	while( cin >> n , n ){
		n++ ;
		for( int i=0 ; i<n ; i++ ) cin >> h[i] ;
		for( int i=0 ; i<n ; i++ ){
			int tmp[110]={},cnt=0 ;
			for( int j=0 ; j<n ; j++ ){
				if( i==j ) continue ;
				tmp[cnt] = h[j] ; cnt++ ;
			}
			int c=1 , p = tmp[1] - tmp[0] ;
			for( int j=2 ; j<n-1 ; j++ ){
				if( p != tmp[j] - tmp[j-1] ){
					c=0 ; break ;
				}
			}
			if( c ){
				cout << h[i] << endl ;
				break ;
			}
		}
	}
}

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

const int mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};




int main(int argc, const char * argv[]) {
    ll N,M; cin >> N >> M;
    vector<vector<ll>> A(N);
    vector<vector<ll>> B(N);
    for(ll i=0;i<M;i++){
        ll a,b; cin >> a >> b;
        a--; b--;
        A[a].push_back(b);
        A[b].push_back(a);
    }
    
    vector<ll> ans(N);
    for(ll i=0;i<N;i++){
        ans[i] = -1;
    }
    ans[0] = 0;
    
    
    queue<ll> que;
    que.push(0);
    ll parent = 0;
    while(!que.empty()){
        ll current_node = que.front();
        que.pop();
        parent = current_node;
        
        for(auto nextnode : A[current_node]){
            if(ans[nextnode] == -1){
                ans[nextnode] = parent;
                que.push(nextnode);
            }else{
                continue;
            }
        }
    }
    
    for(ll i=0;i<N;i++){
        if(ans[i]==-1){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    for(ll i=1;i<N;i++){
        cout << ans[i]+1 << endl;
    }
    
    
    
   return 0;
}



Measured memory_bytes: 15176
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//int→string
//string→int
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//sqrt
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define REPR(i, n) for(int i = n;i >= 0;i--)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


//#define EPS (1e-10)
//
//struct Point{
//    Point(double _x = 0, double _y = 0){
//        x = _x;
//        y = _y;
//    }
//    double x;
//    double y;
//
//    Point operator + (Point p){
//        return Point(x + p.x, y+ p.y);
//    }
//
//    Point operator - (Point p){
//        return Point(x - p.x, y - p.y);
//    }
//
//    Point operator * (double a){
//        return Point(a * x, a * y);
//    }
//
//    Point operator / (double a){
//        return Point(x / a, y / a);
//    }
//
//    double abs(){
//        return sqrt(norm());
//    }
//
//    double norm(){
//        return x * x + y * y;
//    }
//
//    bool operator < (const Point &p) const{
//        return x!=p.x ? x < p.x : y < p.y;
//    }
//
//    bool operator == (const Point &p) const{
//        return fabs(x - p.x) && fabs(y - p.y) < EPS;
//    }
//
//};
//
//typedef Point Vector;
//
//double dot(Vector a, Vector b){
//    return a.x * b.x + a.y * b.y;
//}

int main() {

    set<int> s;
    int N; scanf("%d", &N);
    REP(i, N){
        int tmp; scanf("%d",&tmp);
        s.insert(tmp);
    }

    printf("%d", s.size());

    return 0;

}

Measured memory_bytes: 256
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

int gcd(int a, int b){
	if (b == 0)return a;
	return gcd(b, a % b);
}

//-----------------------ここから-----------


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

	ll ans;
	if(n == 1 && m == 1){
		ans = 1;
	} else if(n == 1){
		ans = m - 2;
	} else if(m == 1){
		ans = n - 2; 
	} else {
		ans = m * n - (2 * m + 2 * n - 4) ;
	}

	cout << ans << endl; 
}


Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import Control.Monad.ST
import qualified Data.Vector.Unboxed as V
import qualified Data.Vector.Unboxed.Mutable as VM

-- haskell can be this iterative!
sieve :: Int -> V.Vector Bool
sieve upto = runST $ do
    s <- VM.replicate (upto+1) True
    VM.write s 0 False
    VM.write s 1 False
    forM_ [2..(ceiling.sqrt.fromIntegral $ upto)] $ \i -> do
        isP <- VM.read s i
        when isP $ forM_ [i*i, i*i+i..upto] (\n -> VM.write s n False)
    V.unsafeFreeze s

primes :: Int -> V.Vector Int
primes = V.map fst . V.filter snd . V.imap (,) . sieve

main = do
    nums <- map read . lines <$> getContents
    let ps = primes (maximum nums)
    mapM_ (\i -> print . V.length $ V.takeWhile (<= i) ps) nums

Measured memory_bytes: 16380
#include<stdio.h>
#include<math.h>
#include<string.h>
int main( )
{ 
	int a,b,c;
	long int k,s=0;
	scanf("%d %d %d %ld",&a,&b,&c,&k);
	if(k<=a)
	{s=k;}
	else
	{
		s+=a;
		if((k-a)<=b);
		else
		{
			s-=(k-a-b);
		}
	}
	printf("%ld",s);
}


Measured memory_bytes: 1732
#include<iostream>
#include<cstdlib>
#include<iomanip>
#include<cmath>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;

int main()
{
	int x;
	cin >> x;
	bool flag;

	for (int i = x;; i++) {
		flag = true;
		if (i == 2) {
			cout << 2 << endl;
			return 0;
		}
		if (i % 2 == 0)
			continue;
		for (int j = 3; j * j <= i; j++) {
			if (i % j == 0) {
				flag = false;
				break;
			}
		}
		if (flag) {
			cout << i << endl;
			return 0;
		}
	}
}

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

using namespace std;
typedef pair<int,int> PII;
const int N = 1e5 + 10;

int p[N],sum[N],ans[N];

int find(int x)
{
    if(p[x] != x)p[x] = find(p[x]);
    return p[x];
}

int main()
{
#ifdef ONLINE_JUDGE
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#endif
    int n,m,k;
    cin >> n >> m >> k;

    for(int i = 1;i <= n;i++)p[i] = i,sum[i] = 1;

    for(int i = 0;i < m;i++)
    {
        int a,b;
        cin >> a >> b;
        int A = find(a),B = find(b);
        if(A != B)p[B] = A,sum[A] += sum[B];
        ans[a]++,ans[b]++;
    }
    for(int i = 0;i < k;i++)
    {
        int c,d;cin >> c >> d;
        if(find(c) == find(d))
        ans[c]++,ans[d]++;
    }

    
    for(int i = 1;i <= n;i++)
    {
        int t = sum[find(i)] - ans[i] - 1;
        cout << t <<" ";
    }

    
    return 0;
}

Measured memory_bytes: 2560
import bisect
import sys
input = sys.stdin.buffer.readline


n = int(input())
info = [list(map(int, input().split())) for i in range(n)]


sum_a = 0
sum_b = 0
for a, b in info:
    sum_a += a
    sum_b += b
ans = min(sum_a, sum_b)

res = []
for i in range(n):
    a, b = info[i]
    res.append(a)
    res.append(b)
res.sort()
min_half_sum = sum(res[0:n - 2])


for i in range(n):
    a, b = info[i]
    a, b = max(a, b), min(a, b)
    ind1 = bisect.bisect_right(res, a, lo=0, hi=2*n) - 1
    ind2 = bisect.bisect_right(res, b, lo=0, hi=ind1+1) - 1
    
    tmp_ans = min_half_sum
    cnt = 0
    if n - 2 <= ind1:
        tmp_ans += a
    else:
        cnt += 1
    if n - 2 <= ind2:
        tmp_ans += b
    else:
        cnt += 1

    for i in range(n - 2, 2 *n):
        if cnt == 0:
            break
        if i == ind1 or i == ind2:
            continue
        tmp_ans += res[i]
        cnt -= 1
    ans = min(tmp_ans, ans)

print(ans)

Measured memory_bytes: 101756
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < n; ++i)
using ll = long long;
const ll MOD = 1000000007;//998244353;
const int SIZE = 1e5;
vector<bool> color(SIZE);
vector<vector<pair<int, int>>> T(SIZE);
void dfs(int s = 0, int p = -1) {
   for (auto &&i : T[s])
   {
      if (i.first == p)continue;
      if (i.second % 2 == 1){
         color[i.first] = !color[s];
         dfs(i.first,s);
      }
      else{
         color[i.first] = color[s];
         dfs(i.first,s);
      }
   }  
}
int main() {
   ios::sync_with_stdio(false);
   cin.tie(0);
   int n; cin >> n;
   rep(i,n-1){
      int u,v,w; cin >> u >> v >> w;
      u--;v--;
      T[u].push_back(make_pair(v,w));
      T[v].push_back(make_pair(u,w));
   }
   dfs();
   rep(i,n)cout << color[i] << '\n';
}

Measured memory_bytes: 11576
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int p,q;
    char x,y;
    cin>>x>>y;
    p=x,q=y;

    if(p>=65 && p<=70 && q>=65 && q<=70)
    {
        if(p>q) cout<<">\n";
        else if(p<q) cout<<"<\n";
        else if(p==q) cout<<"=\n";
    }
    return 0;
}


Measured memory_bytes: 764
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <cmath>
#include <cstring>
#include <assert.h>
#include <utility>
#include <tuple>
using namespace std;

using int64 = long long;
using int128 = __int128;

#define repeat(i, n) for (auto i = decltype(n)(); (i) < (n); (i)++)

const int64 mod = 998244353;
int64 dp[4001][4001];

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

  string s;
  cin >> s;

  int N = s.size();
  vector<int> red_count(2 * N, 0), blue_count(2 * N, 0);
  for (int i = 0; i < N; i++) {
    if (s[i] == '0') red_count[i] += 2;
    else if (s[i] == '1') {
      red_count[i] += 1;
      blue_count[i] += 1;
    } else {
      blue_count[i] += 2;
    }
    if (i > 0) {
      red_count[i] += red_count[i - 1];
      blue_count[i] += blue_count[i - 1];
    }
  }
  for (int i = N; i < 2 * N; i++) {
    red_count[i] = red_count[i - 1];
    blue_count[i] = blue_count[i - 1];
  }
  dp[0][0] = 1;
  for (int i = 1; i <= 2 * N; i++) {
    for (int j = 0; j <= i; j++) {
      int red = j;
      int blue = i - j;
      if (red > red_count[i - 1] or blue > blue_count[i - 1]) continue;

      (dp[i][j] += dp[i - 1][j]) %= mod;
      if (j > 0) (dp[i][j] += dp[i - 1][j - 1]) %= mod;
    }
  }

  cout << dp[2 * N][red_count[2 * N - 1]] << endl;

  return 0;
}



Measured memory_bytes: 123520
#include "bits/stdc++.h"
using namespace std;

#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define forn(i, n) for (int i = 0; i < n; i++)
#define fin(ds) for (auto &v : ds) cin >> v;
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define pll pair<ll, ll>
#define nl '\n'

typedef long long ll;

map<int, pii> grid;

signed main() { _
    int H, W; cin >> H >> W;
    int D; cin >> D;
    forn(x, H) {
        forn(y, W) {
            int axy; cin >> axy;
            grid[axy] = {x, y};
        }
    }
    
    int end = H * W;
    int memo[end + 7];
    memset(memo, 0, sizeof(memo));
    forn(i, end + 1) {
        if (i - D > 0) {
            pii s = grid[i - D];
            pii e = grid[i];
            memo[i] = abs(e.first - s.first) + abs(e.second - s.second) + memo[i - D];
        }
    }

    int Q; cin >> Q;
    forn(i, Q) {
        int L, R; cin >> L >> R;
        ll cost = 0;
        int st = memo[L];
        int en = memo[R];
        cost += (en - st);
        cout << cost << endl;
    }
}


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

int main(void)
{
    ll x;
    cin >> x;

    for (int a = -118; a <= 119; a++)
    {
        for (int b = -119; b <= 118; b++)
        {
            if(a-b<1)continue;
            int tmp = a * a * a * a * a - b * b * b * b * b;
            if (tmp == x)
            {
                cout << a << ' ' << b << endl;
                return 0;
            }
        }
    }
}


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

using namespace std;

typedef long long ll;
#define fi first
#define se second
#define pb push_back

int main() {
    int n;
    scanf("%d", &n);
    int res = 0;
    for (int i = 0; i < n; i++) {
        int x;
        scanf("%d", &x);
        if (x == res + 1) {
            res++;
        }
    }
    if (res == 0) printf("-1");
    else printf("%d", n - res);
    return 0;
}


Measured memory_bytes: 3748
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <cmath>

#include <fstream>
#include <vector>
#include <algorithm>

using namespace std;

int main(void)
{

    long long x;
    long long data[3000];
    
    cin >> x;
    
    for(int i = 0; i < 3000; i++)
    {
        data[i] = pow(i, 5);
    }
    
    for(int a = 0; a < 3000; a++)
    {
        for(int b = 0; b < 3000; b++)
        {
            if(data[a] - data[b] == x)
            {
                cout << a << " " << b;
                return 0;
            }
            if(data[a] + data[b] == x)
            {
                cout << a << " " << -b;
                return 0;
            }
            if(-data[a] - data[b] == x)
            {
                cout << -a << " " << b;
                return 0;
            }
            if(-data[a] + data[b] == x)
            {
                cout << -a << " " << -b;
                return 0;
            }
        }
    }
    
  
}

Measured memory_bytes: 4208
#include<bits/stdc++.h>
#define ll long long
#define pii_ pair<int,int>
#define mp_ make_pair
#define pb push_back
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define show1(a) cout<<#a<<" = "<<a<<endl
#define show2(a,b) cout<<#a<<" = "<<a<<"; "<<#b<<" = "<<b<<endl
using namespace std;
const ll INF = 1LL<<60;
const int inf = 1<<30;
const int maxn = 2e5+5;
inline void fastio() {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
int main()
{
    ll a;
    int b,c,d;
    scanf("%lld",&a);
    scanf("%d.%d",&b,&c);

    ll ans = a*b + a*c/100;

    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 3832
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

const ll MOD = 1e9 + 7;
const ll INF = 1e16;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
//--------------------------------------------------------------------------------//

int main() {
    init();
    ll K, A, B;
    cin >> K >> A >> B;
    if(A<B-1){
        ll tk = K - (A - 1);
        if(tk<=1){
            cout << K + 1 << endl;
            return 0;
        }
        cout << tk / 2 * (B-A) + A + tk%2<< endl;

    }else{
        cout << K + 1 << endl;
    }
}

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

int main()
{
    string S;
    cin >> S;
    int numz = 0, numo = 0;
    for (int i = 0; i < S.size(); i++)
    {
        if (S[i] == '0')
            numz++;
        if (S[i] == '1')
            numo++;
    }
    cout << 2 * min(numz, numo) << endl;
}
/*test
1.
0011
->4
2.
11011010001011
->12
3.
0
->0
*/

Measured memory_bytes: 512
#include  <iostream>
#include  <cstdlib>


int main(void)
{
	int a, b, c;

	std::cin >> a >> b >> c;

	if(a <= c and c <= b)
		std::cout << "Yes" << std::endl;
	else
		std::cout << "No" << std::endl;

	return EXIT_SUCCESS;
}


Measured memory_bytes: 256