akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;

int main(){
  int q;cin >>q;
  for(int i=0;i<q;i++){
    string x,y;cin >> x >> y;
    int lx=x.length();int ly=y.length();
    //cout << lx << ly;
    vector< vector<int> > dp(ly,vector<int>(lx,0));
    int f=0;
    for(int j=0;j<ly;j++){
      if(x[0]==y[j]){f=1;}
      dp[j][0]=f;
    }
    f=0;
    for(int j=0;j<lx;j++){
      if(y[0]==x[j]){f=1;}
      dp[0][j]=f;
    }
    for(int j=0;j<ly;j++){
      for(int k=0;k<lx;k++){
        if(j!=0 and k!=0){
          int l=0;
          if(x[k]==y[j]){l=1;}
          //{}でmaxと同じように使える
          dp[j][k]=max({dp[j-1][k],dp[j][k-1],dp[j-1][k-1]+l});
        }
      }
    }
    cout << dp[ly-1][lx-1] << endl;
  }
}



Measured memory_bytes: 6704
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
typedef complex<double> P;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 30;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };

int l[10], v1, v2;
int main() {
	while ( ~scanf( "%d,", &l[ 0 ] ) ) {
		int s = l[ 0 ];
		for ( int i = 1; i < 10; i++ ) {
			scanf( "%d,", &l[ i ] );
			s += l[ i ];
		}
		scanf( "%d,%d", &v1, &v2 );
		double t = 1. * s / ( v1 + v2 );
		double M = t * v1;
		int ans = 0;
		while ( M > 0 ) {
			M -= l[ ans ];
			++ans;
		}
		printf( "%d\n", ans );
	}
	return 0;
}

Measured memory_bytes: 1188
#include <iostream>
using namespace std;
typedef long long ll;
int main(){
  ll n,d;cin>>n>>d;
  ll a=0,b,c;
  for(int i=0;i<n;i++){
    cin >>b>>c;
    if(b*b+c*c<=d*d){a++;}
  }
  cout <<a<<endl;
  
  
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[110];
int main()
{
	int n;
	int x;
	double ans = 0;
	cin >> n;
	for(int i = 1; i <= n; i ++)
	{
		cin >> a[i];
	}
	sort(a + 1, a + 1 + n);
	if(n == 2) ans = 1.0 * (a[1] + a[2]) / 2;
	else
	{
		ans = 1.0 * (a[1] + a[2]) / 2;
		for(int i = 3; i <= n; i ++)
			ans = (ans + a[i]) / 2;
	}
	cout << ans << '\n';
	

	return 0;
}


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

int main(){
    int K;
    cin >> K;
    if(K == 4 || K == 6 || K == 9 || K == 10 || K == 14 || K == 21 || K == 22 || K == 25 || K == 26){
        cout << 2 << endl;
    }
    else if(K == 8 || K == 18 || K == 20 || K == 27){
        cout << 5 << endl;
    }
    else if(K == 16){
        cout << 14 << endl;
    }
    else if(K == 24){
        cout << 15 << endl;
    }
    else if(K == 28 || K == 30){
        cout << 4 << endl;
    }
    else if(K == 32){
        cout << 51 << endl;
    }
    else{
        cout << 1 << endl;
    }
    system("pause");
    return 0;
}

Measured memory_bytes: 504
/*
	submission # - User: herp_sy
	https://atcoder.jp/contests/
*/

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

// utility of stdin,stdout
#define _CRT_SECURE_NO_WARNINGS
#define OUT cout << 
#define BR << endl
#define RET return 0
#define TLong long long
#define TBMod 1000000007

int main(int argc, char const *argv[]){
	int n;
	int cnt = 0;

	cin >> n;
	std::vector<int> p(n + 3);
	for (int i = 1; i <= n; ++i){
		cin >> p.at(i);
		if(p.at(i) != i)	++cnt;
	}
	if(cnt >= 3)	OUT("NO");
	else OUT("YES");
	RET;
}


Measured memory_bytes: 256
from collections import defaultdict, deque

def dfs(graph, start_node):
  queue = deque()
  queue.append([start_node,1,[0]])
  ans = 0
  while len(queue) > 0:
    prv_node, node_num, done = queue.pop()
    for node in graph[prv_node]:
      if node not in done:
        if node_num+1 == N:ans += 1
        else:queue.append([node,node_num+1,done+[node]]) 
  return ans

N,M=map(int,input().split())
graph = defaultdict(list)

for _ in range(M):
  a,b = map(int, input().split())
  graph[a-1].append(b-1)
  graph[b-1].append(a-1)
print(dfs(graph, 0))

Measured memory_bytes: 39920
h,w=map(int,input().split())
l=[list(input()) for i in range(h)]
ans=[[0 for i in range(w)] for j in range(h)]
if l[0][0]=='#':
  ans[0][0]=1
for i in range(h):
  for j in range(w):
    if i!=0 or j!=0:
      if i!=0 and j!=0:
        if l[i][j]=='#' and l[i-1][j]=='.':
          x=ans[i-1][j]+1
        else:
          x=ans[i-1][j]
        if l[i][j]=='#' and l[i][j-1]=='.':
          y=ans[i][j-1]+1
        else:
          y=ans[i][j-1]
        ans[i][j]=min(x,y)
      elif i==0 and j!=0:
        if l[i][j]=='#' and l[i][j-1]=='.':
          y=ans[i][j-1]+1
        else:
          y=ans[i][j-1]
        ans[i][j]=y
      else:
        if l[i][j]=='#' and l[i-1][j]=='.':
          x=ans[i-1][j]+1
        else:
          x=ans[i-1][j]
        ans[i][j]=x
print(ans[h-1][w-1])

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e9 + 7;


// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, x, k, p;
string s, t;

// <------------- Implement Functions Here ----------> //

// <------------- Start of main() -------------------> //

void MAIN() {
	cin >> n >> p ;
	ll val = pow(p,(ld)1/((ld)n));
	for(ll i=val;i>=1;i--) {
		ll P = pow(i,n);
		if(p%P==0) {
			cout<<i;return;
		}
	}
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}

Measured memory_bytes: 4080
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
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;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;


struct StronglyConnectedComponents{
    vector<int> used,cmp,vs;
    vector<vector<int>> v,rv;
    StronglyConnectedComponents(int n):used(n),cmp(n,-1),v(n),rv(n){}

    void add_edge(int x,int y){
        v[x].push_back(y);
        rv[y].push_back(x);
    }
    void dfs(int x){
        used[x]=true;
        for(auto to:v[x])if(!used[to])dfs(to);
        vs.push_back(x);
    }

    void rdfs(int x,int k){
        cmp[x]=k;
        for(auto to:rv[x])if(cmp[to]==-1)rdfs(to,k);
    }

    int scc(){
        rep(i,used.size())if(!used[i])dfs(i);
        reverse(vs.begin(),vs.end());
        int k=0;
        for(auto x:vs)if(cmp[x]==-1)rdfs(x,k++);
        return k;
    }
    void build(vector<vector<int>> &g){
        int k=scc();
        g.resize(k);
        set<pair<int,int>> used;
        rep(i,v.size()){
            for(auto& to:v[i]){
                int x=cmp[i],y=cmp[to];
                if(x==y||used.count({x,y}))continue;
                g[x].push_back(y);
                used.emplace(x,y);
            }
        }
    }
};
int main(){
    int n,m;
    cin>>n>>m;
    StronglyConnectedComponents scc(n);
    rep(i,m){
        int x,y;
        cin>>x>>y;
        --x;--y;
        scc.add_edge(x, y);
    }
    int k = scc.scc();
    vector<vector<int>> ans(k);
    rep(i,n){
        ans[scc.cmp[i]].push_back(i+1);
    }
    rep(i,k)sort(ans[i].begin(),ans[i].end());
    rep(i,n){
        for(auto e : ans[scc.cmp[i]]){
            cout<<e<<" \n"[e == ans[scc.cmp[i]].back()];
        }
    }
    return 0;
}


Measured memory_bytes: 4200
#include<iostream>
using namespace std;
int n,ans;
int dp[76];
bool isp(int a)
{
	for(int i=2;i*i<=a;i++)if(a%i==0)return 0;
	return 1;
}
main()
{
	cin>>n;
	dp[1]=1;
	for(int i=2;i<=n;i++)
	{
		if(!isp(i))continue;
		int cnt=0;
		for(int j=1;j<=n;j++)
		{
			int a=j;
			while(a%i==0)cnt++,a/=i;
		}
		for(int k=75;k>=1;k--)for(int j=1;j<=cnt&&k*(j+1)<=75;j++)
		{
			dp[k*(j+1)]+=dp[k];
		}
	}
	cout<<dp[75]<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<numeric>
#include<limits>
#include <cstdint>
#include<stack>
#include<queue>
using namespace std;
#define ll long long int
#define rep(N) for(ll i=0;i<N;i++)
#define rep2(N1,N2) for(ll i=0;i<N1;i++)for(ll j=0;j<N2;j++)
#define rep3(N1,N2,N3)for(ll i=0;i<N1;i++)for(ll j=0;j<N2;j++)for(ll k=0;k<N3;k++)
#define For(i,N) for(ll i=0;i<N;i++)

void yn(bool b) {
	if (b)printf("yes\n");
	else printf("no\n");
}

void Yn(bool b) {
	if (b)printf("Yes\n");
	else printf("No\n");
}

void YN(bool b) {
	if (b)printf("YES\n");
	else printf("NO\n");
}

int ctoi(char c) {
	return c - '0';
}

ll kai(ll x) {
	ll a = 1;
	if (x <= 0)
		return 1;
	else {
		for (ll i = 0; i < x; i++)
			a = a * (i + 1);
		return a;
	}
}

ll rui(ll x, ll y) {
	ll a = 1;
	for (ll i = 0; i < y; i++)
		a = a * x;
	return a;
}
const int nmax = 150;
int cccc[nmax][nmax];
ll comb(ll n, ll k) {
	if (n < k) {
		cout << "error n<k" << endl;
		return -1;
	}
	if (cccc[n][k] > 0)return cccc[n][k];
	if (k == 0 || n == k)return 1;
	return cccc[n][k] = comb(n - 1, k - 1) + comb(n - 1, k);
}

ll keta(ll a) {
	ll i = 1;
	while (1) {
		if (a < pow((ll)10, i))
			return i;
		i++;
	}
}
vector<ll> v;
ll n, m;
//m進数全探索
ll inc(ll a = n - 1) {
	if (a == 0 && v[0] == m) {
		v[0] = -1;
		return v[0];
	}
	if (v[a] == m) {
		v[a] = 0;
		inc(a - 1);
		return v[a];
	}
	else {
		++v[a];
		return v[a];
	}
}

ll mod = 1e9+7;

ll modkai(ll a) {
	ll ret = 1;
	rep(a) {
		ret *= (i + 1);
		ret %= mod;
	}
	return ret;
}

ll modpowl(ll a, ll b) {
	if (b == 0) {

		return 1;
	}
	if (b == 1) {

		return a;
	}
	if (b >= 2) {
		if (b % 2 == 0) {
			ll c = modpowl((a*a) % mod, b / 2);
			c = c % mod;

			return c;
		}
		else {
			ll c = (modpowl((a*a) % mod, b / 2) % mod)*a;
			c = c % mod;

			return c;
		}
	}
}
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod%i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}

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

ll llpow(ll a, ll b) {
	if (b == 0) {

		return 1;
	}
	if (b == 1) {

		return a;
	}
	if (b >= 2) {
		if (b % 2 == 0) {
			ll c = llpow((a*a), b / 2);
			c = c;

			return c;
		}
		else {
			ll c = (llpow((a*a), b / 2))*a;
			c = c;

			return c;
		}
	}
}
std::vector<ll> Eratosthenes(ll N)
{
	std::vector<bool> is_prime(N + 1);
	for (ll i = 0; i <= N; i++)
	{
		is_prime[i] = true;
	}
	std::vector<ll> P;
	for (ll i = 2; i <= N; i++)
	{
		if (is_prime[i])
		{
			for (ll j = 2 * i; j <= N; j += i)
			{
				is_prime[j] = false;
			}
			P.emplace_back(i);
		}
	}
	return P;
}

int main() {
	ll X;
	cin >> X;
	vector<ll>a;
	a=Eratosthenes(1e5*2);
	auto it = lower_bound(a.begin(),a.end(),X);
	cout << *it;
}

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

#define taskname ""
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define for0(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex <ld> cd;
typedef vector <cd> vcd;
typedef vector <int> vi;

template<class T> using v2d = vector <vector <T> >;
template<class T> bool uin(T &a, T b)
{
    return a > b ? (a = b, true) : false;
}
template<class T> bool uax(T &a, T b)
{
    return a < b ? (a = b, true) : false;
}

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

const ll mod = 1e9 + 7;

int n;
ll ans = 0;

ll power(ll a, ll b)
{
    ll r = 1;
    while (b)
    {
        if (b & 1)
        {
            r = r * a % mod;
        }
        b /= 2;
        a = a * a % mod;
    }
    return r;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n;
    ans = power(10, n) - power(9, n) * 2 + power(8, n);
    ans = (ans % mod + mod) % mod;
    cout << ans;
    return 0;
}


Measured memory_bytes: 3584
/** coder Mohammad Al-Hussein *_^ */
#include <bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define mp make_pair
#define All(v) v.begin(),v.end()
#define mod  1000000007
#define write freopen("output.txt","w",stdout)
#define read freopen("test (1).txt","r",stdin)
#define FIO std::ios_base::sync_with_stdio(false);
using namespace std;
set<int> my;
int main()
{
    int a,b,c;
    cin >> a >> b >> c;
    
    my.insert(a);
    my.insert(b);
    my.insert(c);
    cout << int(my.size()) << '\n';







    return 0;
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
b0=0
for i in range(n):
    b0+=(-1)**(i%2)*a[i]
b0=int(b0//2)
b=[b0]
for i in range(n):
    b.append(a[i]-b[i])
b=[2*i for i in b]
mapb=map(str,b[:-1])
print(' '.join(mapb))

Measured memory_bytes: 19912
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b)-1);i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int, int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))

int main(void){
	string a[3];
	vector<int> v[3];
	cin >> a[0] >> a[1] >> a[2]; // a0 b1 c2
	
	rep(i, 3) irep(j, a[i].size()) v[i].push_back(a[i][j]);
	
	int t = 0, s;
		
	while(true){
		if(v[t].size()==0){
			cout << char('A'+t) << endl;
			break;
		}
		
		s = v[t].back()-'a';
		v[t].pop_back();
		t = s;
	}	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define   sz(s)         s.size()
#define   ll            long long int
#define   ull           unsigned ll
#define   ld            long double
#define   print(v)      for(ll i=0;i<v.size();i++)cout<<v[i]<<" "
#define   printpair(v)  for(ll i=0;i<v.size();i++)cout<<v[i].first<<" "<<v[i].second<<"\n"
#define   bmd           1000000007
#define   bmd1          998244353
#define   umll          unordered_map<ll,ll>
#define   mll           map<ll,ll>
#define   mcl           map<char,ll>
#define   pll           pair<ll,ll>
#define   F             first
#define   S             second
#define   setp(x)       setprecision(x)
#define   pb            push_back
#define   all(v)        v.begin(),v.end()
#define   tr(a)         for(auto it=a.begin();it!=a.end();it++)
#define   trr(a)        for(auto it1=a.begin();it1!=a.end();it1++)
#define   vll           vector<long long int>
#define   sorty(v)      sort(v.begin(),v.end())
#define   rsort(v)      sort(v.rbegin(),v.rend())
#define   unik(v)       v.erase(unique(all(v)),v.end())
#define   PI            3.1415926535897932384626
#define   db()          cout<<"\n"<<"here"<<"\n"
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;


//---------------------------------------------------------------------------
const int MOD = bmd;
const int N=2e5+100;
inline  ll sqr(ll x){return x*x;}
inline  void normal(ll &a) { a = (a+MOD)%MOD; }
inline  ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline  ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline  ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline  ll modPow(ll b, ll p) { ll r = 1;b=b%MOD; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline  ll modInv(ll a) { return modPow(a, MOD-2); }
inline  ll modDiv(ll a,ll b) { return modMul(a, modInv(b)); }
//---------------------------------------------------------------------------
void solve()
{
    string s,t;
    cin>>s>>t;
    ll ans=0;
    for(ll i=0;i<sz(s);i++){
        if(s[i]!=t[i])
            ans++;
    }
    cout <<ans<<"\n";
}

int main()
{
    //ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);//first give all input then gives output
    ll t=1;
    //cin>>t;
    while(t--){
        solve();
    }

    return 0;
}


Measured memory_bytes: 3884
#include <stdio.h>

int main()
{
  int y, d, m;
  int h;
  char *date[] = {"Saturday", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday"};

  for(;;)
    {
      int Y, C, G;
      y = 2004;
      scanf("%d %d", &m, &d);

      if(d == 0 || m == 0) break;
      if(m == 1 || m == 2)
	{
	  m += 12;
	  y--;
	}

      Y = y%100;
      C = y/100;
      G = 5*C + C/4;

      h = (d + (26*(m + 1)/10) + Y + Y/4 + G)%7;
      printf("%s\n", date[h]);
    }

  return 0;
}

Measured memory_bytes: 1012
#include<stdio.h>
#define MAX 100000
#define NIL -1
struct tree {
        int parent;
        int left;
        int right;
};
void depth(int, int, struct tree*, int*);
void disp(int, struct tree*, int*);
main()
{
        struct tree t[MAX];
        int i, j, n, id, k, c, prec, root, d[MAX];
        scanf("%d", &n);
        for (i = 0; i < n; i++) {
                t[i].parent = t[i].left = t[i].right = NIL;
        }
    for(i = 0; i < n; i++) {
        scanf("%d %d", &id, &k);
        for(j = 0; j < k; j++) {
            scanf(" %d", &c);
            if (!j) {
                                t[id].left = c;
                        } else {
                                t[prec].right = c;
                        }
            prec = c;
            t[c].parent = id;
        }
    }
    for (i = 0; i < n; i++) {
        if(t[i].parent == NIL) {
                        root = i;
                        break;
                }
        }
        depth(root, 0, t, d);
        for (i = 0; i < n ; i++) {
                disp(i, t, d);
        }
}
void depth(int u, int p, struct tree *t, int *d)
{
        d[u] = p;
        if (t[u].right != NIL) {
                depth(t[u].right, p, t, d);
        }
        if (t[u].left != NIL) {
        depth(t[u].left, p + 1, t, d);
    }
}
void disp(int u, struct tree *t, int *d)
{
        int c;
        printf("node %d: parent = %d, depth = %d, ", u, t[u].parent, d[u]);
        if (t[u].parent == NIL) {
                printf("root, [");
                if (t[u].left == -1) {
                        printf("]\n");
                        return;
                }
        } else if (t[u].left != NIL) {
                printf("internal node, [");
        } else {
                printf("leaf, []\n");
                return;
        }
        for (c = t[u].left; t[c].right != NIL; c = t[c].right) {
                printf("%d, ", c);
        }
        printf("%d]\n", c);
}

Measured memory_bytes: 7976
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
int main(void){
    int n,m;cin>>n>>m;
    string s;cin>>s;
    reverse(s.begin(),s.end());
    vector<int> a(n+1,-1);
    int tmp=0;
    rep(i,n+1){
        if(s[i]=='0')tmp=i;
        a[i]=tmp;
    }
    tmp=0;
    vector<int> b;
    while(tmp<n){
        if(tmp+m>=n){
            b.push_back(n-tmp);
            break;
        }
        int nx=a[tmp+m];
        if(nx==tmp){
            cout<<-1<<endl;
            return 0;
        }
        b.push_back(nx-tmp);
        tmp=nx;
    }
    reverse(b.begin(),b.end());
    rep(i,b.size())cout<<b[i]<<" ";
    cout<<endl;
}

Measured memory_bytes: 1528
import sys
sys.setrecursionlimit(10000000)
input=sys.stdin.readline
mod = 10 ** 9 + 7

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

fac = [1]*(n+1)
inv = [1]*(n+1)
for i in range(1,n+1):
  fac[i] = (fac[i-1]*i) % mod  
inv[n] = pow(fac[n], mod-2, mod)
for i in range(n, 0, -1):
  inv[i-1] = (inv[i]*i) % mod
    
def cmb(n, r):
     
  if r < 1:
        return 1
  return (((fac[n] * inv[r])%mod) * inv[n-r]) % mod
 


ans=0
k=min(k,n-1)
for i in range(k+1):
    ans += cmb(n,i) * cmb(n-1,i) %mod

print(ans%mod)




Measured memory_bytes: 18804
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int[]a = new int[3];
    ArrayList<Integer>ans  = new ArrayList<>();
    
    for(int i=0; i<3; i++) {
        a[i] = sc.nextInt();
    	if(!ans.contains(a[i])){		
    	      ans.add(a[i]);
    		}
    }
    	System.out.println(ans.size());
    		}
}

Measured memory_bytes: 35524
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
d = sum(A)
for i in range(N):
  if A[i]>=B[i]:
    A[i] = A[i]-B[i]
  elif A[i]<B[i]:
    A[i+1] = A[i+1]-(B[i]-A[i]) if A[i+1]-(B[i]-A[i])>=0 else 0
    A[i] = 0
print(d-sum(A))

Measured memory_bytes: 18624
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int n;
vector<int> v;
int main(){
    while(cin >> n, n){
        int cnt=0;
        for(int i=1; i<n; ++i){
            int sum=0;
            for(int j=i; j<n; ++j){
                sum +=j;
                if(sum==n) {
                    cnt++;
                    break;
                }
                if(sum > n) break;
            }
        }
        cout << cnt << endl;
    }
        
    return 0;
}


Measured memory_bytes: 2972
g1=[1,3,5,7,8,10,12]
g2=[4,6,9,11]
g3=[2]
x,y=[int(i) for i in input().split()]

if x in g1 and y in g1:
    print('Yes')
elif x in g2 and y in g2:
    print('Yes')
elif x in g3 and y in g3:
    print('Yes')
else:
    print('No')

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

int main()
{
    int R, G, B, N; cin>>R>>G>>B>>N;

    long res=0;
    for(long r=0; r<=N; ++r) for(long g=0; g<=N; ++g) {
        long t=r*R+g*G;
        if (t>N or (N-t)%B>0) continue;
        res++;
    }
    cout<<res<<endl;
}


Measured memory_bytes: 256
import Data.Char (isPunctuation)

extractWords :: String -> [String]
extractWords =
    filter (\s -> let l = length s in 3 <= l && l <= 6) . words . filter isNotCommaPeriod
    where isNotCommaPeriod c = (c /= '.') && (c /= ',')

main :: IO ()
main = putStrLn . unwords . extractWords =<< getLine

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

int main() {
  int N, M;
  cin >> N >> M;
  
  vector<int> vec(N);
  
  for (int i = 0; i < 2*M; i++) {
    int number;
    cin >> number;
    
    for (int j = 1; j <= N; j++) {
      if (number == j) {
        vec.at(j-1)++;
        break;
      }
      
      else {
        continue;
      }
    }
  }
  
  for (int k = 0; k < N; k++) {
    cout << vec.at(k) << endl;
  }
  
  
}



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

int solve(int n,int k,int arr[])
{
    int dp[n+1];
    dp[1]=0;
    for(int i=2;i<=n;i++)
    {
        vector<int> v;
        for(int j=1;j<=k;j++)
        {
            if(i-j>=1)
            {
                v.push_back(abs(arr[i]-arr[i-j])+dp[i-j]);
            }
        }
        sort(v.begin(),v.end());
        dp[i]=v.at(0);
    }
    return dp[n];
}

int main()
{
    int n,k;
    cin>>n>>k;
    int arr[n+1];
    for(int i=1;i<=n;i++)
    {
        cin>>arr[i];
    }
    cout<<solve(n,k,arr);

    return 0;
}

Measured memory_bytes: 1024
import java.awt.geom.Line2D;
import java.util.*;
public class Main {
	Scanner in = new Scanner(System.in);
	public static void main(String[] args) {
		new Main();
	}

	public Main() {
		int q = in.nextInt();
		for(int i=0;i<q;i++)new CGL_2B().doIt();
	}
	
	class CGL_2B{
		void doIt(){
			Line2D l1 = new Line2D.Double(in.nextDouble(),in.nextDouble(),in.nextDouble(),in.nextDouble());;
			Line2D l2 = new Line2D.Double(in.nextDouble(),in.nextDouble(),in.nextDouble(),in.nextDouble());;
			if(l1.intersectsLine(l2))System.out.println("1");
			else System.out.println("0");
		}
	}
	

}

Measured memory_bytes: 48676
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	int n;cin>>n;
	for(int i = 1; i <= 10; i++) {
		if (i * 1000 >= n){
			cout << i * 1000 - n << endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;
const ll INF=(ll)1e18+10;
const double PI=acos(-1);

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 (a>b) { a=b; return 1; } return 0; }
int dy[]={-1,1,0,0};
int dx[]={0,0,-1,1};



int main() {
    string S;
    cin>>S;
    if(S[0]==S[1]&&S[1]==S[2]) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define pb emplace_back
#define F first
#define S second
#define rep(i, st, ed) for(ll i=st; i<ed; ++i)
#define repn(i, st, ed) for(ll i=st; i<=ed; ++i)
#define repb(i, ed, st) for(ll i=ed; i>=st; --i)
#define all(v) v.begin(),v.end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define PI acosl(-1.0)
#define mp(a, b) make_pair(a, b)
#define eps 1e-9
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
const int N = 2e5 + 10;
const ll INF = 1LL << 60;
ll iv[N];
ll powM(ll a, ll b){ll res = 1;for(;b;a=a*a%M,b/=2) if(b&1) res=res*a%M;return res;}
ll nckbig(int n, int k){ll ans = 1;for(int i=1; i<=k; ++i){ans = ans*(n-i+1)%M*iv[i]%M;}return ans;}
void caliv(){iv[1] = 1;for(int i=2; i<N; i++){iv[i] = M-M/i*iv[M%i]%M;}}
ll f1[N], f2[N];
void calf(){f1[0] = f2[0] = 1;for(int i=2; i <N; ++i){f1[i] = f1[i-1]*i%M;f2[i] = f2[i-i]*iv[i]%M;}}
ll nck(int n, int k){return f1[n]*f2[n-k]%M*f2[k]%M;}
ll npk(int n, int k){return f1[n]*f2[n-k]%M;}
void Rnck(int big){if(big){caliv();}else{calf();}}

ll f[N*4];
vector<ll> v;
void upd(ll pos, ll val)
{
	for(int i=pos; i<N*4; i += i&-i) f[i] += val;
}

ll query(ll pos)
{
	ll res = 0;
	for(int i=pos; i>0; i -= i&-i) res += f[i];
	return res;
} 

bool check(ll m, ll sz)
{
	memset(f, 0, sizeof(f));
	ll inv = 0;
	ll n = sz;
	vector<ll> tmp(n+1);
	tmp[0] = 0;
	for(int i=0; i<n; i++)
		tmp[i+1] = tmp[i]  + (v[i] >= m?1:-1);
	for(int i=0; i<=n; i++)
	{
		ll ind = tmp[i] + N + 1;
		inv += query(ind);
		upd(ind, 1);
	} 
	ll total = (n*(n+1)) /2;
	ll obj = (total+1) /2;
	if(inv>= obj) return true;
	else return false;
}


void solve()
{
	int n;
	cin>>n;
	v.resize(n);
	for(int i=0; i<n; i++) cin>>v[i];
	ll l = 0, r = 1 << 30;
	ll ans = 0;
	while(l <= r)
	{
		ll mid = l + (r-l) / 2;
		if(check(mid, n)) {ans = mid, l = mid + 1;}
		else r = mid - 1;
	}
	cout<<ans<<endl;
}


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


Measured memory_bytes: 9996
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))

from sys import exit

h, w = getList()
for i in range(h):
    strs = input().split()

    for j, s in enumerate(strs):
        if s == "snuke":
            print(chr(ord("A") + j) + str(i+1))
            exit()



Measured memory_bytes: 38256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int c = sc.nextInt();
		int r = sc.nextInt();
		int matrix[][] = new int[c + 1][r + 1];
		for (int i = 0; i < c; i++) {
			for (int j = 0; j < r; j++) {
				matrix[i][j] = sc.nextInt();
			}
		}

		for (int i = 0; i < c; i++) {
			for (int j = 0; j < r; j++) {
				matrix[i][r] += matrix[i][j];
			}
		}

		for (int i = 0; i < c; i++) {
			for (int j = 0; j <= r; j++) {
				matrix[c][j] += matrix[i][j];
			}
		}

		for (int i = 0; i <= c; i++) {
			for (int j = 0; j <= r; j++) {
				System.out.print(matrix[i][j]);
				if (!(j == r))
					System.out.print(" ");
			}
			System.out.println();
		}
	}

}

Measured memory_bytes: 43028
import sys
sys.setrecursionlimit(1000000)

n, m = map(int, input().split())
edges = [[] for _ in range(n)]
revEdges = [[] for _ in range(n)]
for _ in range(n - 1 + m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    edges[a].append(b)
    revEdges[b].append(a)

visited = [False] * n
lst = []
def search(x):
    if not visited[x]:
        visited[x] = True
        for to in edges[x]:
            search(to)
        lst.append(x)

for i in range(n):
    search(i)
lst.reverse()
dic = {}
for i in range(n):
    dic[lst[i]] = i

parent = [-1] * n
for i in lst:
    if not revEdges[i]:
        continue
    maxScore = -1
    index = -1
    for fr in revEdges[i]:
        if maxScore <= dic[fr]:
            maxScore = dic[fr]
            index = fr
    parent[i] = index

for i in range(n):
    print(parent[i] + 1)

Measured memory_bytes: 90032
#include <stdio.h>

#define true 1
#define false 0

int main(void){
	int n;
	int a[210];
	int i,count=0;

	scanf("%d", &n);
	for (i = 0; i < n; i++){
		scanf("%d", &a[i]);
	}
	while (true){
		int exist_odd = false;
		for (i = 0; i < n; i++){
			if (a[i] % 2 != 0) exist_odd = true;
			if (exist_odd){
				printf("%d\n", count);
				return 0;
			}
			a[i] = a[i] / 2;
		}
		count++;
	}
	
	
	return 0;
}

Measured memory_bytes: 128
# coding=utf-8


def square(number: float) -> float:
    return number * number


if __name__ == '__main__':
    while True:
        s = 0
        try:
            d = int(input())
        except EOFError:
            break
        for i in range(600//d):
            s += square(i*d)*d
        print(s)

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

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(), (x).end()

using namespace std;

template <typename T> T &chmin(T &a, const T &b) {return a = min(a, b);}
template <typename T> T &chmax(T &a, const T &b) {return a = max(a, b);}

using ll = long long;
using ld = long double;

const int INF = 1e9;
const ld eps = 1e-9, pi = acos(-1.0);

int p[100005];
int y[100005];
vector<int> order[100005];

int main(){
  int n, m;
  cin >> n >> m;
  REP(i, m) { cin >> p[i]; cin >> y[i]; order[p[i]-1].push_back(y[i]); }
  REP(i, n) sort(ALL(order[i]));
  REP(i, m) { printf("%06d", p[i]); printf("%06d", lower_bound(ALL(order[p[i]-1]), y[i])-order[p[i]-1].begin()+1); printf("\n"); }
  return 0;
}

Measured memory_bytes: 7808
#include<iostream>
#include<string>
using namespace std;
int main(){
  double n;
  string s="";
  while(1){
    cin >> n;
    if(n<0){
      break;
    }
    if(n>=128){
      n-=128;
      s+="1";
    }
    else{
      s+="0";
    }
    if(n>=64){
      n-=64;
      s+="1";
    }
    else{
      s+="0";
    }
    if(n>=32){
      n-=32;
      s+="1";
    }
    else{
      s+="0";
    }
    if(n>=16){
      n-=16;
      s+="1";
    }
    else{
      s+="0";
    }
    if(n>=8){
      n-=8;
      s+="1";
    }
    else{
      s+="0";
    }
    if(n>=4){
      n-=4;
      s+="1";
    }
    else{
      s+="0";
    }
    if(n>=2){
      n-=2;
      s+="1";
    }
    else{
      s+="0";
    }
    if(n>=1){
      n-=1;
      s+="1";
    }
    else{
      s+="0";
    }

    s+=".";

    if(n>=0.5){
      n-=0.5;
      s+="1";
    }
    else{
      s+="0";
    }
    if(n>=0.25){
      n-=0.25;
      s+="1";
    }
    else{
      s+="0";
    }
    if(n>=0.125){
      n-=0.125;
      s+="1";
    }
    else{
      s+="0";
    }
    if(n>=0.0625){
      n-=0.0625;
      s+="1";
    }
    else{
      s+="0";
    }


    if(n==0){
      cout << s << endl;
    }
    else{
      cout << "NA" << endl;
    }

    s="";
  }
}

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

int main(){
    string s;
    cin >> s;
    
    string ans;
    ans += s[0];
    ans += s[1];
    ans += s[2];

    cout << ans << endl;
}


Measured memory_bytes: 3628
#include <stdio.h>
#include <math.h>
#define PI 3.141592653589
 
int main(){
    double a,b,c,C,h,S,L;
    scanf("%lf %lf %lf",&a,&b,&C);
    h=b*sin(C/180*PI);
    S=a*h/2;
    c=sqrt(pow(a,2)+pow(b,2)-2*a*b*cos(C/180*PI));
    printf("%lf\n%lf\n%lf",S,a+b+c,h);
    return 0;
}   


Measured memory_bytes: 2056
/* 
 * Project: AtCoder Beginners Contest 137 A - Transfer
 * Author: toms74209200 <https://github.com/toms74209200>
 *
 * Created on 2020/09/07
 * Copyright (c) 2020 toms74209200
 * 
 * This software is released under the MIT License.
 * http://opensource.org/licenses/mit-license.php
 */
#include <cstdio>
#include <cstdint>
using namespace std;

int32_t a, b, c;

void solve() {

    int32_t rest = 0;
    if (a-b > c) {
        ;
    } else {
        rest = c-(a-b);
    }

    printf("%d\n", rest);
}

int main() {

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

    solve();

}

Measured memory_bytes: 3188
from collections import Counter

n = int(input())
c = list(input())
c_s = sorted(c)
count = 0
W = 0
R = 0

for i in range(n):
    if c_s[i] == 'R' and c[i] == 'W':
        W += 1
    if c_s[i] == 'W' and c[i] == 'R':
        R += 1
print(max(R,W))

Measured memory_bytes: 12864
#include<iostream>
#include<cstdio>
#include<iomanip>
#include<queue>
#include<string>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<algorithm>
#include<cmath>
using namespace std;
#define pb push_back
#define fi first
#define sc second
#define mp make_pair

double eps=1e-10;

double add(double a,double b){
	if(abs(a+b)<eps*(abs(a)+abs(b))){
		return 0;
	}else{
		return a+b;
	}
}

struct P{
	double x,y;
	P(){}
	P(double x,double y):x(x),y(y){
	}
	P operator +(P p){
		return P(add(x,p.x),add(y,p.y));
	}
	P operator -(P p){
		return P(add(x,-p.x),add(y,-p.y));
	}
	P operator *(double d){
		return P(x*d,y*d);
	}
	double dot(P p){
		return add(x*p.x,y*p.y);
	}
	double det(P p){
		return add(x*p.y,-y*p.x);
	}
};
bool on_seg(P p1,P p2,P q){
	return (p1-q).det(p2-q)==0&&(p1-q).dot(p2-q)<=0;
}
P intersection(P p1,P p2,P q1,P q2){
	return p1+(p2-p1)*((q2-q1).det(q1-p1)/(q2-q1).det(p2-p1));
}

bool cmp_x(const P& p,const P& q){
	if(p.x!=q.x){
		return p.x<q.x;
	}else{
		return p.y<q.y;
	}
}

vector<P> convex_hull(P* ps,int n){
	sort(ps,ps+n,cmp_x);
	int k=0;
	vector<P> qs(2*n);
	for(int i=0;i<n;++i){
		while(k>1&&(qs[k-1]-qs[k-2]).det(ps[i]-qs[k-1])<=0){
			--k;
		}
		qs[k++]=ps[i];
	}
	for(int i=n-2,t=k;i>=0;--i){
		while(k>t&&(qs[k-1]-qs[k-2]).det(ps[i]-qs[k-1])<=0){
			--k;
		}
		qs[k++]=ps[i];
	}
	qs.resize(k);
	qs[k-1]=qs[0];
	return qs;
}

void solve(int s,int t){
	int n[2];
	vector<P> qs[2];
	n[0]=s;
	n[1]=t;
	for(int k=0;k<2;++k){
		P ps[100];
		for(int i=0;i<n[k];++i){
			cin>>ps[i].x>>ps[i].y;
		}
		qs[k]=convex_hull(ps,n[k]);
		if(qs[k].size()==1){
			qs[k].resize(2);
			qs[k][1]=qs[k][0];
		}
	}
	bool f=false;
	for(int i=0;i<qs[0].size()-1;++i){
		for(int j=0;j<qs[1].size()-1;++j){
			if((qs[0][i]-qs[0][i+1]).det(qs[1][j]-qs[1][j+1])==0){
				f=on_seg(qs[0][i],qs[0][i+1],qs[1][j])||on_seg(qs[0][i],qs[0][i+1],qs[1][j+1])||on_seg(qs[1][j],qs[1][j+1],qs[0][i])||on_seg(qs[1][j],qs[1][j+1],qs[0][i]);
			}else{
				P r=intersection(qs[0][i],qs[0][i+1],qs[1][j],qs[1][j+1]);
				f=on_seg(qs[0][i],qs[0][i+1],r)&&on_seg(qs[1][j],qs[1][j+1],r);
			}
			if(f){
				break;
			}
		}
		if(f){
			break;
		}
		
	}
	if(f){
		cout<<"NO"<<endl;
		return;
	}
	if(qs[0][0].x==qs[1][0].x){
		cout<<"YES"<<endl;
		return;
	}else if(qs[0][0].x>qs[1][0].x){
		swap(qs[0],qs[1]);
	}
	P p0=qs[1][0],e2=((P){0,1});
	vector<P> r;
	for(int i=0;i<qs[0].size()-1;++i){
		if((qs[0][i]-qs[0][i+1]).det(e2)==0){
			if(qs[0][i].x==p0.x&&qs[0][i].y<p0.y&&p0.y<qs[0][i+1].y){
				f=true;
				break;
			}
		}else{
			P rc=intersection(qs[0][i],qs[0][i+1],p0,p0+e2);
			if(on_seg(qs[0][i],qs[0][i+1],rc)){
				if(rc.x!=qs[0][i+1].x){
					r.pb(rc);
				}
			}
		}
	}
	if(f){
		cout<<"NO"<<endl;
	}else if(r.size()<2){
		cout<<"YES"<<endl;
	}else{
		if(r[0].y<p0.y&&p0.y<r[1].y){
			cout<<"NO"<<endl;
		}else{
			cout<<"YES"<<endl;
		}
	}
}

int main(){
	while(true){
		int s,t;
		cin>>s>>t;
		if(s==0&&t==0){
			break;
		}else{
			solve(s,t);
		}
	}
}

Measured memory_bytes: 3148
#include<bits/stdc++.h>
#define ll long long
#define mod (ll)1000000007
using namespace std;
const int N = 1e5+5;
ll fact[N];
ll p(ll a, ll x){
    if(x == 0)  return 1ll;
    if(x == 1)  return a%mod;

    ll sm = p(a,x/2);
    sm = (sm*sm)%mod;

    if(x%2)
        sm = (sm*a)%mod;

    return sm;
}
ll f(ll n, ll k, ll a){
    ll num = fact[n];
    ll den = (fact[n-k]*fact[k])%mod;

    den = p(den, mod-2);

    num = (num*den)%mod;

    num = (num*a)%mod;

    return num;
}
int main()
{
    fact[0] = 1;
    for(int i = 1; i < N; i++)
        fact[i] = (fact[i-1]*i)%mod;

    ll n,k;
    cin>>n>>k;
    ll a[n];
    for(int i = 0; i < n; i++)  cin>>a[i];

    sort(a,a+n);

    ll ans = 0;

    for(int i = n-1; i >= 0; i--){
        // choose k-1 element from i elements
        if(k-1 > i) continue;

        ans = (ans%mod + f(i,k-1,a[i]) + mod)%mod;
    }

    for(int i = 0; i < n; i++){
        // choose k-1 element from n-1-i elements;
        if(k-1 > n-i-1)
            continue;

        ans = (ans%mod - f(n-i-1, k-1, a[i]) + mod)%mod;
    }
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
#include<cstring>

using namespace std;

#ifdef LDEBUG
#define debug(x) cout << #x << ":" << x << endl
#else
#define debug(...)
#endif

#define REP(i,n) for(int i=0; i<n; ++i)

typedef unsigned long long u64;
typedef long long i64;

int n;
int a[100005];

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

        cin >> n;

        REP(i,n)
                cin >> a[i];

        int m = 1;
        REP(i,n)
                if (a[i] < 0) m *= -1;

        i64 r = 0;
        if (m == 1) {
                REP(i,n)
                        if(a[i] < 0)
                                a[i] *= -1;
                REP(i,n)
                        r += a[i];
        } else {
                REP(i,n)
                        if(a[i] < 0)
                                a[i] *= -1;
                sort(a, a+n);
                a[0] *= -1;

                REP(i,n)
                        r += a[i];
        }

        cout << r << endl;


        return 0;
}


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

typedef long long ll;

int main()
{
    ll a,b,c,d;
    cin>> a >> b >> c >> d;
    ll x=max({a*c,a*d,b*c,b*d});
    cout<< x <<endl;
    return 0;
}

Measured memory_bytes: 3640
#include <iostream>

using namespace std;

int main(){
  int H=0,W=0;
  cin>>H>>W;
  for(int i=0;i<W+2;i++)
    cout<<'#';
  cout<<endl;

  char tmp;
  for(int i=0;i<H;i++){
    cout<<'#';
    for(int j=0;j<W;j++){
      cin>>tmp;
      cout<<tmp;
    }
    cout<<'#'<<endl;
  }
  
  for(int i=0;i<W+2;i++)
    cout<<'#';
  cout<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <string.h>
#include <stdio.h>
#include <queue>
#include <limits.h>
#include <stack>
#include <set>
#include <map>

#define P pair
#define MP make_pair

typedef long long int llint ;

using namespace std;

int n,y;
int a,b,c;

int main()
{
	cin>>n>>y;
	for(int i=0;i<=n;i++)
	{
		for(int k=0;k<=n;k++)
		{
			if(k+i>n)
			continue;
			int j=n-i-k;
			if(i*10000+k*5000+j*1000==y)
			{
				cout<<i<<" "<<k<<" "<<j;
				return 0;
			}
		}
	}
	cout<<"-1 -1 -1";
    return 0;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc134/tasks/abc134_b

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

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define EPS (1e-9)
#define INF (1e9)
#define INFL (1e18)
#define MOD (1000000007)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOREACH(x, a) for (auto &(x) : (a))
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define LEN(x) (sizeof(x) / sizeof(*(x)))
// ll gcd(long a, long b) { return b ? gcd(b, a % b) : a; }
// ll lcm(long a, long b) { return a * b / gcd(a, b); }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, d;
    cin >> n >> d;
    double db;
    db = (double)n / (d * 2 + 1);
    int di;
    di = (int)db;
    if (abs(di - db) > EPS) {
        di++;
    }
    cout << di << endl;

    return 0;
}


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

int ans = 0;

void dfs(int depth, string s, const int x, const int N)
{
    if (depth == x)
    {
        if (stoi(s) > N)
        {
            return;
        }

        // cout << s << endl;

        bool ok_3 = false, ok_5 = false, ok_7 = false;
        for (int i = 0; i < s.size(); i++)
        {
            if (s[i] == '3')
            {
                ok_3 = true;
            }

            if (s[i] == '5')
            {
                ok_5 = true;
            }

            if (s[i] == '7')
            {
                ok_7 = true;
            }
        }

        if(ok_3 && ok_7 && ok_5)
        {
            ans++;
        }

        return;
    }

    s[depth] = '3';
    dfs(depth + 1, s, x, N);

    s[depth] = '5';
    dfs(depth + 1, s, x, N);

    s[depth] = '7';
    dfs(depth + 1, s, x, N);

    return;    
}

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

    int L = to_string(N).length();
    for (int i = 3; i <= L; i++)
    {
        string s(i, '3');
        dfs(0, s, i, N);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
signed main(){
  int n;
  std::cin>>n;
  std::vector<int> a(n);
  for(auto& ai:a)std::cin>>ai;
  
  int allxor = 0;
  for(auto& ai:a)allxor ^= ai;
  
  for(auto& ai:a)std::cout<< (allxor^ai) <<std::endl;
}


Measured memory_bytes: 4012
#include<stdio.h>
int main(void){
    int n,s=100000,a,b,i;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        s=s*1.05;
        a=s%1000;
        b=s/1000;
        if(a!=0){
            b=b+1;
        }
        s=b*1000;
    }
    printf("%d\n",s);
    return 0;
}

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


bool C(string& s, int k) {
    int n = s.size();
    set<char> st;
    for(int i = n-k; i < k; ++i) {
        st.insert(s[i]);
    }
    return (st.size() == 1);
}

int main()
{
    string s;
    cin >> s;
    int n = s.size();
    int l = n/2, r = n+1;
    while(r-l > 1) {
        int mid = (l+r)/2;
        if(C(s,mid)) l = mid;
        else r = mid;
    }
    cout << l << endl;
    return 0;
}

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

#define TR 3000
#define ll long long

using namespace std;

pair<ll, ll> dp[TR][TR][2];
bool visited[TR][TR][2];
ll a[TR];
int n;


pair<ll, ll> f(int l, int r, bool person) {
	if(visited[l][r][person])
		return dp[l][r][person];
	if(l == r) {
		if(person == 0)
			dp[l][r][0] = make_pair(a[l], 0);
		else
			dp[l][r][1] = make_pair(0, a[l]);
		visited[l][r][person] = 1;
		return dp[l][r][person];
	}
	pair<ll, ll> p_r, p_l;
	p_r = f(l, r - 1, !person);
	p_l = f(l + 1, r, !person);
	if(!person) {
		if((p_r.first + a[r] - p_r.second) > (p_l.first + a[l] - p_l.second))
			dp[l][r][person] = make_pair(p_r.first + a[r], p_r.second);
		else
			dp[l][r][person] = make_pair(p_l.first + a[l], p_l.second);
	}
	else {
		if((p_r.first - (p_r.second + a[r])) < (p_l.first - (p_l.second + a[l])))
			dp[l][r][person] = make_pair(p_r.first, p_r.second + a[r]);
		else
			dp[l][r][person] = make_pair(p_l.first , p_l.second + a[l]);
	}
	visited[l][r][person] = 1;
	return dp[l][r][person];

}

int main() {
	cin >> n;
	for(int i = 0 ; i < n ; i++)
		cin >> a[i];
	pair<ll, ll> ans = f(0, n -1, 0);
	
	cout << ans.first - ans.second << endl;
	return 0;
}

Measured memory_bytes: 172752