akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
     int A,B,C;
     cin>>A>>B>>C; 
     int k=0;
     if(A==B&&A!=C){k=1;}
     else if(A==C&&A!=B){k=1;}
     else if(B==C&&A!=B){k=1;}
      
     if(k){cout<<"Yes"<<endl;}
      else{cout<<"No"<<endl;}
      
      return 0;
    }

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <iomanip>	
#include <deque>
#include <set>
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
#define fore(i,a) for(auto &i:a)
#define INF INT_MAX/2;
const int INF2 = 1001001001;
typedef long long ll;
using namespace std;
using vi = vector<int>;
using vll = vector<ll>;
ll mod = 1e9 + 7;
//ll llmax = 10000000000000000000ll;
using namespace std;
using Graph = vector<vector<int>>;


int cnt_digit(ll N)
{
	int digit = 0;

	while (N > 0)
	{
		N /= 10;
		digit++;
	}
	return digit;
}


 // 最大公約数計算
 
ll gcd(ll a, ll b)
{
	if (b == 0) {
		return a;
	}
	else {
		return gcd(b, a % b);
	}
}
// 最小公倍数の計算

ll lcm(ll a, ll b)
{
	ll g = gcd(a, b);

	return a / g * b;
}

struct union_find
{
	vector<int> par, r;
	union_find(int n)
	{
		par.resize(n);
		r.resize(n);
		init(n);
	}


	void init(int n)
	{
		for (int i = 0; i < n; i++) par[i] = i;
		for (int i = 0; i < n; i++) r[i] = 0;
	}

	int find(int x)
	{
		if (par[x] == x)return x;
		else return find(par[x]);
	}

	void unite(int x, int y)
	{
		x = find(x);
		y = find(y);

		if (r[x] < r[y])
		{
			par[x] = y;
		}
		else
		{
			par[y] = x;
			if (r[x] == r[y])
			{
				r[x]++;
			}
		}
	}
};

const int MAX_N = 110000;

int memo[MAX_N];

int rec(int n) {
	if (n == 0)return 0;
	if (memo[n] != -1)return memo[n];

	int res = n;

	for (int pow6 = 1; pow6 <= n; pow6 *= 6)res = min(res, rec(n - pow6) + 1);

	for (int pow9 = 1; pow9 <= n; pow9 *= 9)res = min(res, rec(n - pow9) + 1);

	return memo[n] = res;
}

int calc(int x) {
	int ret = 0;
	while (x % 2 == 0) {
		x /= 2;
		ret++;
	}

	return ret;
}

int a[12][12];
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,m,x;

	cin >> n >> m >> x;
	vector<int> c(n);


	rep(i, 0, n) {
		cin >> c[i];
		rep(j, 0, m) {
			cin >> a[i][j];
		}
	}

	int ans = INF2;

	rep(s, 0, 1 << n) {
		int cost = 0;
		vector<int> d(m);
		rep(i, 0, n) {
			if (s >> i & 1) {
				cost += c[i];
				rep(j, 0, m) {
					d[j] += a[i][j];
				}
			}
		}
		bool ok = true;
		rep(j, 0, m) {
			if (d[j] < x) {

				ok = false;
			}

		}
		if (ok) {
			ans = min(ans, cost);
		}
	}
	if (ans == INF2)cout << -1 << endl;
	else cout << ans << endl;
	

}
	

Measured memory_bytes: 3656
#define _USE_NATH_DEFINES
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>

using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
#define EPS 1e-9
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const int MINF = -1e9;;


int main() {
	int n, k, q;
	vector<int> a;
	
	cin >> n >> k >> q;
	rep(i, n) a.push_back(k);

	vector<int> cnt(n, 0);

	rep(i, q) {
		int aq;
		cin >> aq;
		++cnt[aq - 1];
	}

	rep(i, n) {
		a[i] += (cnt[i] - q);
	}

	rep(i, n) {
		if (a[i] <= 0) cout << "No" << endl;
		else cout << "Yes" << endl;
	}
	return 0;
}

Measured memory_bytes: 1528
#include<bits/stdc++.h>
#define eps 1e-8
#define pi 3.14159265358979
#define LL long long
#define MP make_pair
#define PH push
#define PB push_back
#define PII pair<int,int>
#define VI vector<int>
#define X first
#define Y second
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
#define sqr(x) ((x)*(x))
#define CL(a) memset(a,0,sizeof a)
#define fr(i,n) for(int i=1;i<=n;i++)
#define FR(i,S,n) for(int i=S;i<=n;i++)
#define dr(i,n) for(int i=n;i;i--)
#define DR(i,n,S) for(int i=n;i>=S;i--)
#define SZ(x) ((int)(x).size())
#define rd(x) scanf("%d",&x)
#define pr(x) printf("%d",x)
const int N=222222;
const int M=100000007;
LL Pw(LL a,LL b,LL p){LL v=1;for(;b;b>>=1,a=a*a%p)if(b&1)v=v*a%p;return v;}
using namespace std;
char s[99];
LL V;
int i,j,tmp,an,L;
int main(){
	scanf("%s",s+1);L=strlen(s+1);
	an=(L-1)*9;
	for(i=1;i<=L;i++){
		tmp=0;
		for(j=1;j<=i;j++)V=V*10+s[j]-'0';
		if(i!=L)V--;
		for(;V;V/=10)tmp+=V%10;
		for(j=i+1;j<=L;j++)tmp+=9;
		an=max(an,tmp);
	}
	printf("%d",an);
}

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

int main() {
    int n;
    string s;
    cin >> n;
    cin >> s;
    if (s.size()%2==1) cout << "No";
    else {
        string t=s.substr(0,s.size()/2);
        string t2=s.substr(s.size()/2,s.size()/2);
        cout << (t==t2?"Yes":"No");
    }
}


Measured memory_bytes: 3600
#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() {
    int k, a, b;
    cin >> k >> a >> b;
    ll ans = 1;
    if (b-a <= 2 || k <= a) {
        cout << ans + k << endl;
        return 0;
    }
    k -= a+1;
    ans = b;
    int q = k/2;
    int r = k%2;
    ans += (ll) q * (b-a);
    ans += r;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3600
//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>
#include <climits>
#include <queue>

using namespace std;

//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())

//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);

int tab[30][30];
int dx[] = {1,-1,0,0};
int dy[] = {0,0,-1,1};
int W, H;
int Gx, Gy;

bool out(int x, int y){
  return !(0 <= x && x < W && 0 <= y && y < H);
}

int dfs(int x, int y, int d){
  if(d > 10) return d;

  int res = 11;
  REP(i,4){
	int tx = x+dx[i], ty = y+dy[i];
	if(out(tx,ty) || tab[ty][tx] != 0)
	  continue;
	
	while(!out(tx,ty) && tab[ty][tx] == 0){
	  if(tx == Gx && ty == Gy)
		return d+1;
	  tx += dx[i], ty += dy[i];
	}
	if(out(tx,ty)) continue;

	tab[ty][tx] = 0;
	res = min(res, dfs(tx-dx[i], ty-dy[i], d+1));
	tab[ty][tx] = 1;
  }
  return res;
}

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

  while(cin>>W>>H,W){
	fill((int*)tab,(int*)tab+30*30,0);
	int sx, sy;
	REP(y,H) REP(x,W){
	  cin >> tab[y][x];
	  if(tab[y][x] == 2)
		sx = x, sy = y, tab[y][x] = 0;
	  if(tab[y][x] == 3)
		Gx = x, Gy = y, tab[y][x] = 0;
	}
	int ans = dfs(sx, sy, 0);
	if(ans > 10) cout << -1 << endl;
	else cout << ans << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1200
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
#define MAXN 1000001
using namespace std;
LL a,b;
LL inv[MAXN],prime[MAXN],cnt=0;
void getp()
{
    for(int i=2;i<MAXN;i++)
    {
        if(!inv[i])
        {
            prime[++cnt]=i;
            inv[i]=i;
        }
        for(int j=1;j<=cnt&&prime[j]*i<MAXN;j++)
        {
            inv[prime[j]*i]=prime[j];
            if(i%prime[j]==0)break;
        }
    }
}
LL gcd(LL x,LL y)
{
    return y?gcd(y,x%y):x;
}
int main()
{
    cin>>a>>b;
    a=gcd(a,b);
    
    getp();
    int ans=1;
    for(int i=1;i<=cnt;i++)
    {
        if(a%prime[i]==0)ans++;
        //cout<<prime[i]<<endl;
        while(a%prime[i]==0)a/=prime[i];
    }
    if(a!=1)ans++;
    cout<<ans<<endl;
    return 0;
}


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

int main() {
  int H, W;
  int y=0;
  cin >> H;
  vector<int> vec1(H);
  vector<int> vec2(H);
  vector<int> vec3(H);
  
  for (int i=0; i<H; i++) {
    cin >> vec1.at(i);
  }
  for (int i=0; i<H; i++) {
    cin >> vec2.at(i);
  }
  for (int i=0; i<H; i++) {
    int x=0;
    for (int j=0; j<i+1; j++) {
      x += vec1.at(j);
    }
    for (int j=0; j<H-i; j++) {
      x += vec2.at(H-j-1);
    }
    vec3.at(i)=x;
  //  cout << x << " " << endl;
  }
  for (int i=0; i<H; i++) {
    y=max(vec3.at(i),y);
  //  cout << y << " ";
  }
  if(H==1) y=vec1.at(0)+vec2.at(0);
  cout << y << endl;    
}


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2018/06/30  Problem: AOJ 2578 / Link: http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2578  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----

dp,dpでdp(えぇ…)

----解説ここまで---- */


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


	int S, T, U, N, O, D;
	cin >> S >> T >> U >> N >> O >> D;
	VI decPow(T), spCol(T);
	FOR(i, 0, T) {
		cin >> decPow[i] >> spCol[i];
	}
	VVI PowToColDP(U + 1, VI(101, -INF)); // ある体力消費におけるカロリーの最大値
	PowToColDP[0][0] = 0;
	FOR(i, 0, T) {
		FORR(u, U - 1, 0 - 1) {
			FOR(p, 0, 101) {
				if (PowToColDP[u][p] == -INF)continue;
				if (p + decPow[i] <= 100)
					PowToColDP[u + 1][p + decPow[i]] = max(PowToColDP[u + 1][p + decPow[i]], PowToColDP[u][p] + spCol[i]);
			}
		}
	}
	VI decPowDP = PowToColDP[U];
	VI happy(N), incCol(N);
	FOR(i, 0, N) {
		cin >> happy[i] >> incCol[i];
	}

	VI GetColDP(10001, 0); // あるカロリーにおける幸福度の最大
	FOR(i, 0, N) {
		FOR(c, 0, 10001) {
			if (c + incCol[i] <= 10000)GetColDP[c + incCol[i]] = max(GetColDP[c + incCol[i]], GetColDP[c] + happy[i]);
		}
	}
	FOR(c, 0, 10000) {
		GetColDP[c + 1] = max(GetColDP[c + 1], GetColDP[c]);
	}// あるカロリーまでにおける幸福度の最大にした



	// ここから本質DP
	// decPowDP,GetColDPを使ってD日をDP
	VVI DP(D + 1, VI(S + 1, -INF));
	DP[0][S] = 0;
	FOR(d, 0, D) {// 毎日O回復する
		FOR(s, 0, S + 1) {
			FOR(decs, 0, s + 1) {
				int MaxCol = decPowDP[decs];
				if (MaxCol < 0)continue;
				int nextS = min(S, s - decs + O);
				if (DP[d][s] == -INF)continue;
				DP[d + 1][nextS] = max(DP[d + 1][nextS], DP[d][s] + GetColDP[MaxCol]);
			}
		}
	}
	int ans = -1;
	FOR(i, 0, S + 1) {
		ans = max(ans, DP[D][i]);
	}
	cout << ans << endl;





	return 0;
}// 



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

using namespace std;
#define inf             0x3f3f3f3f
#define INF             2e18
#define eps             1e-9

#define FastRead        ios_base::sync_with_stdio(0);cin.tie(0)
#define fRead           freopen("input.txt","r",stdin)
#define fWrite          freopen("output.txt","w",stdout)

#define LL              long long
#define ull            unsigned long long
#define PI              acos(-1.0)
#define pb              push_back
#define mk              make_pair
#define pii             pair<int,int>
#define pLL             pair<LL,LL>
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define SQR(a)          ((a)*(a))
#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(min(a,b),min(c,d))
#define max4(a,b,c,d)   max(max(a,b),max(c,d))
#define max5(a,b,c,d,e) max(max3(a,b,c),max(d,e))
#define min5(a,b,c,d,e) min(min3(a,b,c),min(d,e))
#define vi              vector <int>
#define vL              vector <LL>
#define LB(a,x)         (lower_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which does not compare less than val.
#define UB(a,x)         (upper_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which compares greater than val.
#define prec(n)         fixed << setprecision(n)

#define MEM(a,x)        memset(a,x,sizeof(a))
#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#define Unique(a)       sort(all(a)),a.erase(unique(all(a)),a.end())

#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define IT(it,x)	    for(it=x.begin();it!=x.end();it++)
LL dp[1<<13];
int main()
{
    FastRead;
    LL n,m;
    cin>>n>>m;
    LL a[m+1],b[m+1],c[m+1];
    for(LL i=0; i<m; i++)
    {
        cin>>a[i]>>b[i];
        LL mask=0;
        for(LL j=0; j<b[i]; j++)
        {
            LL x;
            cin>>x;
            mask=mask|(1<<(x-1));
        }
        c[i]=mask;
    }
    for(LL i=0; i<(1<<n); i++)
        dp[i]=12345678;
    dp[0]=0;
    for(LL i=0; i<(1<<n); i++)
    {
        for(LL j=0; j<m; j++)
        {
            dp[i|c[j]]=min(dp[i|c[j]],dp[i]+a[j]);
        }
    }
//    for(LL i=0; i<(1<<n); i++)
//        cout<<dp[i]<<endl;
    if(dp[(1<<n)-1]==12345678)
        cout<<-1;
    else
        cout<<dp[(1<<n)-1];
}


Measured memory_bytes: 384
#include <iostream>
#include "atcoder/dsu.hpp"
using namespace std;

int main()
{
    int N, Q;
    int t, u, v;

    cin >> N >> Q;

    atcoder::dsu d(N);
    for (int i = 0; i < Q; i++)
    {
        cin >> t >> u >> v;
        if (t == 0)
        {
            d.merge(u, v);
        }
        else if (t == 1)
        {
            cout << (d.same(u, v) ? 1 : 0) << endl;
        }
    }
}


Measured memory_bytes: 4052
#include<bits/stdc++.h>
using namespace std;
bool cmp(long long int x,long long int y)
{
   return x>y;
}
int main(void)
{
   long long int t,n,m,k,x,y,a[100001];
   vector<long long int> v,v1,v2;
   vector< pair <long long int,long long int> >p,p1,p2;
   set<long long int> st;
   priority_queue<long long int> pq;
   priority_queue< long long int,vector<long long int>,greater<long long int> > lpq;
   priority_queue< pair<long long int,long long int>,vector< pair<long long int,long long int> >,greater< pair <long long int,long long int> > > plpq;
   string s;
   //cin>>t;
   //while(t--)
   //{
      cin>>n;
      if(n>=400 && n<=599)
         cout<<8<<endl;
      else if(n>=600 && n<=799)
         cout<<7<<endl;
      else if(n>=800 && n<=999)
         cout<<6<<endl;
      else if(n>=1000 && n<=1199)
         cout<<5<<endl;
      else if(n>=1200 && n<=1399)
         cout<<4<<endl;
      else if(n>=1400 && n<=1599)
         cout<<3<<endl;
      else if(n>=1600 && n<=1799)
         cout<<2<<endl;
      else if(n>=1800 && n<=1999)
         cout<<1<<endl;
   //}
   return 0;
}


Measured memory_bytes: 3628
use std::str::FromStr;

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

fn get_vec<T : FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect();
}

fn get_vec_by_lines<T : FromStr>(n : usize) -> Vec<T> {
    let mut v : Vec<T> = Vec::new();
    for _i in 0..n {
        let x : T = get_one();
        v.push(x);
    }
    return v;
}

fn main() {
    let mut v : Vec<i32> = get_vec();
    v.sort();
    println!("{}", if v[0] == v[1] && v[1] == v[2] || v[0] != v[1] && v[1] != v[2] && v[2] != v[0] {"No"} else {"Yes"});
}


Measured memory_bytes: 4352
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;

	public static void Main(string[] args)
	{
		var a = Console.ReadLine();
		var b = Console.ReadLine();
		
		string t = "123".Replace(a,"").Replace(b,"");
		Console.WriteLine(t);
	}

	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(' '); }
	public static int Clamp(int val, int max, int min = 0) { return Math.Min(max, Math.Max(min, val)); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt();
		return r;
	 }
}


Measured memory_bytes: 11092
#include <iostream>

using namespace std;

int main() {
    string S ;
    cin >> S;
    int t = 9999999;
    string n="   ";
    for (int i = 0 ; i <= S.size()-2; i++) {
        n[0]=S[i+0];
        n[1]=S[i+1];
        n[2]=S[i+2];
        
        if (stoi(n) < 753) {
           
            if (753 - stoi(n) < t ) {
                t = 753 - stoi(n);
            }
        }
        else{
            
            if (stoi(n) - 753 < t ) {
                t = stoi(n) - 753;
            }
        }
    }
    cout << t ;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
#define pb push_back
#define mp make_pair
#define LL long long
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
#define F first
#define S second
using namespace std;
typedef pair<int,int>pii;
char s[500010];
int n;
int a[500010],a2[500010];
int kmp(int* feil){
	int m=strlen(s),i,j=feil[0]=-1;
	for(int i=0;i<m;i++){
		for(;~j&&s[j]!=s[i];j=feil[j]);
		feil[i+1]=++j;
	}
	return m;
}
bool isok(int i,int f){
	return i%(i-f)!=0||f==0;
}
int main(){
	cin>>s;
	n=strlen(s);
	kmp(a);
	if(isok(n,a[n])){
		cout<<"1\n1\n";
		return 0;
	}
	if(n-a[n]==1){
		cout<<n<<"\n1\n";
		return 0;
	}
	reverse(s,s+n);
	kmp(a2);
	int ret=0;
	for(int i=1;i<n;i++)
		if(isok(i,a[i])&&isok(n-i,a2[n-i]))
			ret++;
	cout<<"2\n"<<ret<<endl;
	return 0;
}


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

using namespace std;
#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define _dec(i,j,N) for(int i = (N-1);i >= (j);i--)
#define ALL(x) x.begin(),x.end()
#define PB push_back
#define LL long long

template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {
    _for(i,0,v.size()) os << v[i] << " ";
    return os;
}

template<typename T>
ostream& operator<<(ostream& os,const set<T>& v){
    for(typename set<T>::iterator it = v.begin();it != v.end();it++)
    os << *it <<" ";
    return os;
}

int H,W,K;
const int mod = 1000000007;

LL dp[105][9];

bool valid(int w){
    _for(i,0,W-2){
        int have1 = ((1<<i)&w);
        int have2 = (1<<(i+1))&w;
        if(have1 && have2) return false;
    }
    return true;
}

int main()
{
    _for(i,0,9){
        _for(j,0,105){
            dp[j][i] = 0;
        }
    }

    dp[0][0] = 1;
    cin >> H >> W >> K;

    _for(i,0,H){
        _for(j,0,W){
            for(int w = 0;w < (1<<(W-1));w++){
                //cout << w << endl;
                if(!valid(w)) continue;

                if(j != W-1 && ((1<<(j))&w)){
                    dp[i+1][j+1] = (dp[i+1][j+1] + dp[i][j])%mod;
                }
                else if(j != 0 && ((1<<(j-1))&w)){
                    dp[i+1][j-1] = (dp[i+1][j-1] + dp[i][j])%mod;
                }
                else{
                    dp[i+1][j] = (dp[i][j] + dp[i+1][j])%mod;
                }

            }
        }
    }

    cout << dp[H][K-1] << endl;

    return 0;
}


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

using namespace std;

long long n;
string a[1000005];
map <string, int> mp;
vector<pair <int, string> > v;

int main () {
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> a[i];
		mp[a[i]]++;
	}
	for(map <string, int> :: iterator it = mp.begin(); it != mp.end(); ++it) {
    	pair <int, string> p;
		p.second = it -> first;
    	p.first = it -> second;	
		v.push_back(p);
	}
	sort(v.begin(), v.end());
	for(int i = 0; i < v.size(); i++) {
		if(v[i].first == v[v.size() - 1].first) {
			cout << v[i].second << "\n";
		}
	}
	return 0;
}

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

struct UnionFind {
    vector<int> par;
    int cnt;
    UnionFind(int n) : par(n, -1), cnt(n) {}
    void unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x != y) {
            if (par[y] < par[x]) swap(x, y);
            par[x] += par[y];
            par[y] = x;
            cnt--;
        }
    }
    int find(int x) { return par[x] < 0 ? x : par[x] = find(par[x]); }
    bool same(int x, int y) { return find(x) == find(y); }
    int size(int x) { return -par[find(x)]; }
    int size() { return cnt; }
};

struct Edge {
    int from, to;
    double cost;
    Edge(int s, int t, double c) : from(s), to(t), cost(c) {}
};

bool operator<(const Edge &a, const Edge &b) { return a.cost < b.cost; }

int main() {
    int n;
    while (cin >> n, n) {
        vector<double> x(n), y(n), z(n), r(n);
        for (int i = 0; i < n; i++) cin >> x[i] >> y[i] >> z[i] >> r[i];
        UnionFind uf(n);
        vector<Edge> g;
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {
                double dx = x[i] - x[j];
                double dy = y[i] - y[j];
                double dz = z[i] - z[j];
                double dr = -r[i] - r[j];
                double d1 = dx * dx + dy * dy + dz * dz;
                double d2 = dr * dr;
                double d = max(0.0, dr + sqrt(d1));
                g.push_back(Edge(i, j, d));
            }
        }
        sort(g.begin(), g.end());
        double res = 0.0;
        for (int i = 0; i < g.size(); i++) {
            Edge e = g[i];
            if(!uf.same(e.from, e.to)){
                uf.unite(e.from, e.to);
                res += e.cost;
            }
        }
        cout << fixed << setprecision(3);
        cout << res << endl;
    }
    return 0;
}


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

typedef vector< vector<int> > vvi;
typedef vector< vector<bool> > vvb;
typedef vector< vector<char> > vvc;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<char> vc;

int main(){
    int X,N;
    cin >> X >> N;
    vb a(110,false);
    for(int i=0;i<N;i++){
        int temp;
        cin >> temp;
        a[temp]=true;
    }
    int ansl,ansh;
    int i=X;
    while(i>=0){
        if(!a[i]){
            ansl=i;
            break;
        }
        i--;
    }
    i=X;
    while(i<=101){
        if(!a[i]){
            ansh=i;
            break;
        }
        i++;
    }
    if(abs(ansl-X)<=abs(ansh-X)) cout << ansl << endl;
    else cout << ansh << endl;
    return 0;
}

Measured memory_bytes: 3616
class BellmanFord:
    def __init__(self,v,start):
        self.inf = float('inf')
        self.dist = [self.inf]*v
        self.dist[start] = 0
        self.edge = []
        self.v = v
    
    def add(self,f,t,cost):
        self.edge.append((f,t,cost))
    
    def build(self,gorl):
        for _ in range(self.v - 1):
            for f,t,cost in self.edge:
                if self.dist[t] > self.dist[f] + cost:
                    self.dist[t] = self.dist[f] + cost
        self.ans = self.dist[gorl]
        for f,t,cost in self.edge:
            if self.dist[t] > self.dist[f] + cost:
                self.dist[t] = self.dist[f] + cost
        return self.ans if self.ans == self.dist[gorl] else '-inf'

n,m = map(int,input().split())

bf = BellmanFord(n,0)

for i in range(m):
    a,b,c = map(int,input().split())
    bf.add(a - 1,b - 1,- c)

ans = bf.build(n-1)
if ans == '-inf':
    print('inf')
else:
    print(- ans)


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

int main(){
  int K;
  string S;
  cin >> K >> S;
  if(S.size()<=K){
    cout << S << endl;
  }
  else{
    for(int i=0;i<K;i++){
      cout << S.at(i);
    }
    cout << "..."<< endl;
  }
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std ;
#define An setprecision(16) 
int main(){
    int A,B,C;
    cin >> A >> B >> C;
    if(A==B){
        if(B!=C){
            cout << "Yes\n";
            return 0;
        }else{
            cout << "No\n";
            return 0;
        }
    }else if(A==C){
        cout << "Yes\n";
        return 0;
    }else{
        if(B==C)cout << "Yes\n";
        else cout << "No\n";
    }
}

Measured memory_bytes: 3608
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy
from operator import itemgetter
#以下てんぷら
def j(q):
    if q==1: print("Yes")
    else:print("No")
    exit(0)


def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")

def ip():
    return int(input())
def printrow(a):
    for i in range(len(a)):
        print(a[i])
#n = ip()                                     #入力整数1つ
a,b,c= (int(i) for i in input().split())       #入力整数横2つ以上
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
#こっから本文
if a == b and b==c:j(1)
j(0)

Measured memory_bytes: 22780
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll N,A,B=0,X=0;
  cin >> N;
  for(ll i = 0; i < N; ++i){
    cin >> A;
    if(A<B){
      X+=B-A;
    }else{
      B=A;
    }
  }
  cout << X;
}


Measured memory_bytes: 3536
#!/usr/bin/env python
# -*- coding: utf-8 -*-

MOD = 1000003


def inv(x, m):
  y, u, v = m, 1, 0

  while y != 0:
    t = x // y
    x -= t * y
    u -= t * v
    x, y = y, x
    u, v = v, u

  return u % m


def main():
  facs = [None] * MOD
  invs = [None] * MOD

  facs[0] = 1
  for i in range(1, MOD):
    facs[i] = facs[i - 1] * i % MOD

  invs[-1] = facs[-1]
  for i in range(MOD - 1, 0, -1):
    invs[i - 1] = invs[i] * i % MOD

  for _ in range(int(input())):
    x, d, n = map(int, input().split())

    if d == 0:
      print(pow(x, n, MOD))
      continue

    x = x * inv(d, MOD) % MOD

    if x + n - 1 >= MOD:
      print(0)
      continue

    v = facs[x + n - 1]

    if x != 0:
      v = v * invs[x - 1] % MOD

    if d != 1:
      v = v * pow(d, n, MOD) % MOD

    print(v)


if __name__ == '__main__':
  main()



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

string S;
int n, w, s, e;

void solve() {
  for (int i = 0; i < S.size(); i++) {
    if (S[i] == 'N') n++;
    if (S[i] == 'W') w++;
    if (S[i] == 'S') s++;
    if (S[i] == 'E') e++;
  }
  if ((bool(n) != bool(s)) || (bool(w) != bool(e))) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
}

int main() {
  cin >> S;

  solve();
  return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
int main(){
    int n;
    cin >> n;
    if(n % 2 == 0) cout << n;
    else cout << 2*n;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace At
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = ReadInts();
            if (input[1] - input[0] == input[2] - input[1]) WriteLine("YES");
            else WriteLine("NO");
        }

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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;}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n;
    string s, t;
    cin >> n >> s >> t;
    REP(i, n) {
        cout << s[i] << t[i];
    }
    cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const int maxV = 90010;
const int maxN = 1e5+10;
const int inf = 0x3f3f3f3f;
const int MOD = 993244853;
const ll INF = 1000000000000000010LL;
 
char s[maxN];
ll p[maxN];
ll a[maxN];
int n;
ll get(int L,int R)
{
	return (a[R] - a[L-1]*p[R-L+1]%MOD + MOD)%MOD;
}
bool check(int len)
{
	for(int i=1;i+len-1<=n;i++)
	{
		for(int j=i+len;j+len-1<=n;j++)
		{
			if(get(i,i+len-1) == get(j,j+len-1))
				return true;
		}
	}
	return false;
}
int main() {
	scanf("%d",&n);
	scanf("%s",s+1);
	int base = 13331;
	p[0] = 1;
	for(int i=1;i<=n;i++)
	{
		p[i] = (p[i-1]*base)%MOD;
	}
	for(int i=1;i<=n;i++)
	{
		a[i] = (a[i-1]*base + (s[i]-'a'+1))%MOD;
	}
	int ans = 0;
	int L = 0,R = n;
	while(L<=R)
	{
		int mid = (L+R)/2;
		if(check(mid))
		{
			ans = mid;
			L = mid+1;
		}
		else
		{
			R = mid-1;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 384
A = []
for i in range(3):
  A.append(list(map(int, input().split())))
import numpy as np
A = np.array(A)
N = int(input())
for i in range(N):
  A = np.where(A==int(input()), 0, A)
flag = 0
if 0 in np.sum(A, axis = 0) or 0 in np.sum(A, axis = 1):
  flag = 1
if A[0, 0] + A[1, 1] + A[2, 2] == 0 or A[2, 0] + A[1, 1] + A[0, 2] == 0:
  flag = 1

if flag == 1:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 21420
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>
#include <stack>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

ll dp[1010][20300];
int main(){
    int n;
    cin >> n;
    vector<int> w(n),s(n);
    vector<pair<int,pair<int,pair<int,int> > > > p;
    vector<ll>v(n);
    rep(i,n){
        int a,b,c;
        ll d;
        cin >> a >> b >> d;
        c = a+b;
        p.PB(MP(c,MP(a,MP(b,d))));
    }
    sort(p.begin(),p.end());
    rep(i,n){
        w[i] = p[i].second.first;
        s[i] = p[i].second.second.first;
        v[i] = p[i].second.second.second;
        cerr << w[i] << " " << s[i] << " " << v[i] << endl;
    }
    ll mx = 0;
    Fill(dp,-1);
    dp[0][0] = 0;
    rep(i,n){
        rep(j,10010){
            if(dp[i][j]!=-1){
                dp[i+1][j] = max(dp[i+1][j],dp[i][j]);
                if(j<=s[i]){
                    dp[i+1][j+w[i]] = max(dp[i+1][j+w[i]],dp[i][j]+v[i]);
                    mx = max(mx,dp[i+1][j+w[i]]);
                }
            }
        }
    }
    cout << mx << endl;
    return 0;
}

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

using namespace std;

int main() {
    int n;
    string s;
    cin >> n;
    cin >> s;
    int c = 1;
    for(int i=1;i<n;i++) if(s[i] != s[i-1]) c++;
    cout << c << endl;
    return 0;
}


Measured memory_bytes: 512
import java.util.*;

public class Main {
    private static final Scanner scn = new Scanner(System.in);
    
    public static void main(String[] args) {
        for(int n; (n = scn.nextInt()) > 0; printMap(createMap(n)));
    }
    
    private static Map<Integer, Long> createMap(int n) {
        Map<Integer, Long> mil = new LinkedHashMap<>();
        for(int i = 0; i < n; i++) {
            int id = scn.nextInt();
            long sale = scn.nextLong() * scn.nextLong();
            if(mil.containsKey(id)) {
                mil.put(id, mil.get(id) + sale);
            } else {
                mil.put(id, sale);
            }
        }
        return mil;
    }
    
    private static void printMap(Map<Integer, Long> mil) {
        boolean flg = true;
        for(Integer elm : mil.keySet()) {
            if(mil.get(elm) > 999999) {
                System.out.println(elm);
                flg = false;
            }
        }
        if(flg) {
            System.out.println("NA");
        }
    }
}

Measured memory_bytes: 34676
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<tuple>
#include<iomanip>
#include<map>
#include<queue>
#include<set>
#define int long long
using namespace std;
const int INF = 1e10;
const int ZERO = 0;

typedef pair<int,int> P;

signed main() {
	int H,W,D;
	cin >> H >> W >> D;
	map<int,P> ma;
	for(int i = 0;i < H;i++) {
		for(int j = 0;j < W;j++) {
			int A;
			cin >> A;
			ma[A] = P(i,j);
		}
	}
	int Q;
	cin >> Q;
	int d[90001];
	for(int i = 1;i <= D;i++) {
		d[i] = 0;
	}
	for(int i = D + 1;i < 90001;i++) {
		d[i] = d[i - D] + abs(ma[i].first - ma[i - D].first) + abs(ma[i].second - ma[i - D].second);
	}
	for(int i = 0;i < Q;i++) {
		int A,B;
		cin >> A >> B;
		cout << d[B] - d[A] << endl;
	}
}

Measured memory_bytes: 7424
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n = sc.next();

		if (n.charAt(0) == 'S') {
			System.out.print("Cloudy");

		} else if (n.charAt(0) == 'C') {
			System.out.print("Rainy");

		} else {
			System.out.print("Sunny");
		}

	}
}

Measured memory_bytes: 21460
X, Y = list(map(int, input().split()))
b = (Y - 2 * X) / 2
a = 2 * X - Y / 2
if b >= 0 and a >= 0 and Y % 2 == 0 and (Y - 2 * X) % 2 == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9180
def comb(n, r, mod):
  if r<0 or r>n:
    return 0
  r=min(r, n-r)
  return g1[n]*g2[r]*g2[n-r]%mod

mod=10**9+7
N = 10**5+10
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range(2, N+1):
  g1.append( ( g1[-1] * i ) % mod )
  inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
  g2.append( (g2[-1] * inverse[-1]) % mod )

N, K=map(int, input().split())
A=list(map(int, input().split()))
A.sort()
ans=0
for i in range(N-K+1):
  n, r=N-i-1, K-1
  ans=(ans+(A[-(i+1)]-A[i])*comb(n, r, mod)%mod)%mod
print(ans)


Measured memory_bytes: 67172
# -*- coding: utf-8 -*-
# C - Back and Forth
# 定数の定義
UP = "U"
DOWN = "D"
RIGHT = "R"
LEFT = "L"

# 標準入力の取得
sx,sy,tx,ty = list(map(int, input().split()))

# 移動経路の算出
# 左周りに最短経路を求める
diff_x = tx - sx
diff_y = ty - sy

min_path = ""
# 行き（1回目）
for y in range(diff_y):
    min_path += UP
for x in range(diff_x):
    min_path += RIGHT

# 帰り（1回目）
for y in range(diff_y):
    min_path += DOWN
for x in range(diff_x):
    min_path += LEFT

# 行き（2回目）
min_path += LEFT
for y in range(diff_y+1):
    min_path += UP
for x in range(diff_x+1):
    min_path += RIGHT
min_path += DOWN

# 帰り（2回目）
min_path += RIGHT
for y in range(diff_y+1):
    min_path += DOWN
for x in range(diff_x+1):
    min_path += LEFT
min_path += UP

print(min_path)

Measured memory_bytes: 3064
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		// スペース区切りの整数の入力
		String S = sc.next();
      int count=0;
	for(int i=0;i<N-2;i++){
      if("ABC".equals(S.substring(i,i+3))){
        count++;
      }
    }
      System.out.println(count);
    }
}

Measured memory_bytes: 21716
#include<cmath>
#include<algorithm>
#include<iostream>
#include<vector>
#include<climits>
#include<cfloat>
#include<cstdio>

using namespace std;

typedef double Real;

Real EPS = 1e-8;
const Real PI = acos(-1);

int sgn(Real a, Real b=0){return a<b-EPS?-1:a>b+EPS?1:0;}
Real sqr(Real a){return sqrt(max(a,(Real)0));}

struct Point{  
  Real add(Real a, Real b){
    if(abs(a+b) < EPS*(abs(a)+abs(b)))return 0;
    return a+b;
  }

  Real x, y;
  Point(){}
  Point(Real x,Real y) : x(x) , y(y){}

  Point operator + (Point p){return Point(add(x,p.x), add(y,p.y));}
  Point operator - (Point p){return Point(add(x,-p.x), add(y,-p.y));}
  Point operator * (Real d){return Point(x*d,y*d);}
  Point operator / (Real d){return Point(x/d,y/d);}
  bool operator == (Point p){return !sgn(dist(p));}
  //昇順
  bool operator < (Point p)const{return (p.x!=x)?x<p.x:y<p.y;}
  Real norm(){return sqr(x*x+y*y);}
  Real dist(Point a){return (*this-a).norm();}
  Real dot(Point a){return x*a.x+y*a.y;}
  Real cross(Point a){return x*a.y-y*a.x;}
};

struct Circle{
  Point p;
  Real r;
  Circle(){}
  Circle(Point p, Real r) : p(p) , r(r){}
  
  bool contain(Point a){
    return sgn((a-p).norm(),r)<=0;
  }
  
  Circle circumCircle(Point a,Point b){
    Point q=(a+b)/2;
    return Circle(q,(a-q).norm());
  }
  
  Circle circumscribedCircle(Point p, Point q, Point r){
    Point a=(q-p)*2,b=(r-p)*2;
    Point c(p.dot(p)-q.dot(q),p.dot(p)-r.dot(r));
    Circle res;
    res.p.x=a.y*c.y-b.y*c.x;
    res.p.y=b.x*c.x-a.x*c.y;
    res.p=res.p/a.cross(b);
    return Circle(res.p, p.dist(res.p));
  }

  Circle minEnclosingCircle(vector<Point>ps){
    if(ps.size()==0)return Circle(Point(0,0),0);
    if(ps.size()==1)return Circle(ps[0],0);

    Circle circle=circumCircle(ps[0],ps[1]);
    for(int i=2;i<ps.size();i++){
      if(!circle.contain(ps[i])){
	circle=circumCircle(ps[0],ps[i]);
	for(int j=1;j<i;j++){
	  if(!circle.contain(ps[j])){
	    circle=circumCircle(ps[j],ps[i]);
	    for(int k=0;k<j;k++){
	      if(!circle.contain(ps[k])){
		circle=circumscribedCircle(ps[i],ps[j],ps[k]);
	      }
	    }
	  }
	}
      }
    }
    return circle;
  }

};

int main(void){

  int n;
  cin >> n;
  vector<Point>ps(n);

  for(int i=0;i<n;i++)cin >> ps[i].x >> ps[i].y;
  Circle c;
  printf("%f",c.minEnclosingCircle(ps).r);
  cout << endl;

  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		
		for(;;)
		{
			int n = scanner.nextInt();
			int x = scanner.nextInt();
			
			int cnt = 0;
			if(n==0 && x==0)
			{
				break;
			}
			for(int i=1; i<=n; i++)
			{
				for(int j=i+1; j<=n; j++)
				{
					for(int k=j+1; k<=n; k++)
					{
						if(i+j+k == x)
						{
							cnt++;
						}
					}
				}
			}
			System.out.println(cnt);
		}
	}
}

Measured memory_bytes: 26456
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }

#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Vec2(T, n, m, xs) vector<vector<T>> xs(n, vector<T>(m))
#define Sum(a) accumulate(Range(a), 0)
#define Cusum(T, n, xs, sxs) vector<T> sxs(n+1); For(i, n) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) for(const auto &e : xs) cout << e << "\n"; cout << "\n"
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")

int main(void){
    Cin(int, w, h, n);
    Vec2(int, w, h, c);
    Rep(n){
        Cin(int, x, y, op);
        switch(op){
        case 1: For(i, x) For(j, h) c[i][j] = 1; break;
        case 2: for(int i = x; i < w; i ++) For(j, h) c[i][j] = 1; break;
        case 3: For(j, y) For(i, w) c[i][j] = 1; break;
        case 4: for(int j = y; j < h; j ++) For(i, w) c[i][j] = 1; break;
        }
    }
    int ans = 0;
    For(i, w) For(j, h) ans += c[i][j];
    Cout(h*w - ans);
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
int A[13],B[13],C[13],i,j,*pa,*pb,*pc,n,f;
scanf("%d",&n);
for(j=0;j<n;j++){
   for(i=0;i<10;i++){B[i]=0;C[i]=0;}
   pa=&A[0];
   pb=&B[1];
   pc=&C[1];
   for(i=0;i<10;i++){scanf("%d",&A[i]);}
   for(i=0;i<10;i++){
      f=0;
      if(*(pb-1)<*pa && *(pc-1)<*pa){
      if(*(pb-1)>*(pc-1)){*pb=*pa;pb++;}else{*pc=*pa;pc++;}
      }else if(*(pb-1)<*pa){*pb=*pa;pb++;
      }else if(*(pc-1)<*pa){*pc=*pa;pc++;
      }else {f=1;break;}
      pa++;
   }
if(f==0){printf("YES\n");}else{printf("NO\n");}
}
return 0;
}

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

using namespace std;

using ll = long long;

constexpr char newl = '\n';

ll calc(int n, vector< vector<int> >& vs) {
    priority_queue<int, vector<int>, greater<int> > pq;
    for (int i = 1; i <= n; i++) {
        for (int x : vs[i]) {
            pq.push(x);
        }

        while (pq.size() > i) pq.pop();
    }

    ll res = 0;
    while (!pq.empty()) {
        res += pq.top();
        pq.pop();
    }
    return res;
}

ll solve(int n, vector<int>& K, vector<int>& L, vector<int>& R) {
    ll ans = 0;
    vector< vector<int> > vs1(n + 1), vs2(n + 1);
    for (int i = 0; i < n; i++) {
        ans += min(L[i], R[i]);
        if (L[i] >= R[i]) vs1[K[i]].push_back(L[i] - R[i]);
        else vs2[n - K[i]].push_back(R[i] - L[i]);
    }

    ans += calc(n, vs1) + calc(n, vs2);
    return ans;
}

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

    int t;
    cin >> t;

    for (int loop = 0; loop < t; loop++) {
        int n;
        cin >> n;

        vector<int> K(n), L(n), R(n);
        for (int i = 0; i < n; i++) {
            cin >> K[i] >> L[i] >> R[i];
        }

        cout << solve(n, K, L, R) << newl;
    }

    return 0;
}

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

using namespace std;


    


int main() {
    int N;
    cin >> N;
    
    vector<int> L(N), R(N);
    for(int i=0;i<N;i++){
        cin >> L[i] >> R[i];
        
    }
    int num=0;
    for(int i=0;i<N;i++){
        num+=R[i]-L[i]+1;
    }
    
    cout << num << endl;
}
    


Measured memory_bytes: 256
#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() {
    ll M1, M2, D1, D2;
    cin >> M1 >> D1 >> M2 >> D2;
    cout << (M1 == M2 ? 0 : 1) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std; 
#define ll long long int 
#define pb push_back
#define vv vector<ll>
#define fr(i,x) for(int i=0;i<x;i++)
int dx[4] = {-1,0,0,1};
int dy[4] = {0,-1,1,0};

bool sortbysec(const pair<int,int> &a, 
              const pair<int,int> &b) 
{ 
    
    if(a.first == b.first) return a.second<b.second;
    return (a.first < b.first); 
}
int main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    
    string str;
    cin >> str;
    if(str[0] == 'R'&& str[1] == 'R' && str[2] == 'R'){cout << "3" << endl;return 0;}
    else if(str[0]== 'R' && str[1] == 'R' || str[1] =='R' && str[2] == 'R'){cout << "2" << endl;return 0;}
    else if(str[0] == 'R' || str[1] == 'R' || str[2] == 'R'){cout << "1" << endl;return 0;}
    else
    {
        cout << "0" << endl;
    }
    
    
    
    
    
}

Measured memory_bytes: 3628
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl

const ll mod = 1e9 + 7;
const ll inf = 1e18;

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

    // input
    ll N, M;
    cin >> N >> M;

    // assume N <= M
    if(M<N){
        swap(N, M);
    }

    if(N==1 && M==1){
        p(1);
    }
    // 1 x M
    else if(N==1){
        p(M - 2);
    }
    // N x M (N>=2, M>=2)
    else{
        p(N * M - 2 * M - 2 * N + 4);
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin >> s;
	if (s == "Sunny") puts("Cloudy");
	if (s == "Cloudy") puts("Rainy");
	if (s == "Rainy") puts("Sunny");
	return 0;
}


Measured memory_bytes: 256