akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define vul vector<ull>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi2d vector<vi >
#define vl2d vector<vl >
#define vpll vector<pll >

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rz resize
#define fr(i,n) for(i=0;i<(n);i++)
#define frr(i,n) for(i=(n-1);i>=0;i--)
#define fre(i,n) for(i=0;i<=(n);i++)
#define frre(i,n) for (i=(n);i>=0;i--)
#define frab(i,a,b) for(i=(a);i<(b);i++)
#define freab(i,a,b) for(i=(a);i<=(b);i++)
#define frrab(i,a,b) for(i=(b-1);i>=a;i--)
#define frreab(i,a,b) for(i=(b);i>=a;i--)

#define sz(a) int((a).size())
#define mset(a,b) (memset(a,b,sizeof(a)))
#define max3(a,b,c) (max((a),max((b),(c))))
#define min3(a,b,c) (min((c),min((a),(b))))
#define sumv(v) accumulate(all(v),ll(0))
#define productv(v) accumulate(all(v), ll(1), multiplies< ll >())
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
vector <ll> sprime;
vector<char> prime (1000000, true);
void sieve(ll n)
{
  //O(nloglogn) time
  sprime.pb(0);
  prime[0] = prime[1] = false;
  ll cnt = 0;
  for (ll i = 2; i <= n; ++i)
  {
    if (prime[i])
    {
      cnt++;
      sprime.pb(i);
      for (ll j = 2 * i; j <= n; j += i)
        prime[j] = false;
    }
  }
}
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll fastpowMOD(ll a, ll p, ll MOD) { if (p == 0) return 1; ll z = fastpowMOD(a, p / 2, MOD); z = (z * z) % MOD; if (p % 2) z = (z * a) % MOD; return z; }
ll fastpow(ll a, ll p) { if (p == 0) return 1; ll z = fastpow(a, p / 2); z = (z * z); if (p % 2) z = (z * a); return z; }

#define mod 1000000007
#define inf LLONG_MAX
#define minf LLONG_MIN
#define pi 3.14
#define ex 2.71

//*********************************************///
const int N = 1e5 + 5;
int i,j;
ll w[N];
ll v[N];


ll dp[105][N];


void solve()
{
  int n,wt;
  cin>>n>>wt;
  freab(i,1,n)
    cin>>w[i]>>v[i];
  freab(i,1,n)
    freab(j,1,wt)
      if(j-w[i]>=0)
      dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i]]+v[i]);
      else
        dp[i][j]=dp[i-1][j];
    cout<<dp[n][wt]<<endl;
}

int main()
{
  fast;
  int z;
  //cin>>z;
  z=1;
  while(z--)
  {
    solve();
  }
  return 0;
}


Measured memory_bytes: 80384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); i++)
using ll = long long;
const ll INF = 1e16;
int main() {
	ll a, b, c, d; cin >> a >> b >> c >> d;
	cout << max(a*c, max(a*d, max(b*c, b*d))) << endl;
   return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int i=0; i<n; i++)
typedef long long ll;
typedef pair<int,int> P;
const ll MOD = (int)1e9+7;
const ll INF = MOD*MOD;
const ll powll = 1LL<<1;

int main(){
  ll n; cin >> n;
  ll a,b; cin >> a >> b;

  if(a == 0){
    cout << 0 << "\n";
  }else if(b == 0){
    cout << n << "\n";
  }else {
    cout << (n/(a+b))*a + min(n%(a+b), a) << "\n";
  }
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

int main(void) {
  cout.precision(12);

  string L;
  cin >> L;

  vector<long> three_n(100010);
  three_n[0] = 1;
  for (long i = 1; i < 100010; i++) {
    three_n[i] = (three_n[i-1] * 3) % MOD;
  }

  long result = 0;
  long size = L.size();

  long count = 1;

  for (long i = 0; i < size; i++) {
    if (L[i] == '0') continue;
    long tmp = three_n[size - i - 1] * count;
    count *= 2;
    count %= MOD;

    result = (result + tmp) % MOD;
  }

  result += count;
  result %= MOD;

  cout << result << endl;

  return 0;
}


Measured memory_bytes: 1280
#include <stdio.h>
int main()
{
    int N,K,Q,c;
    scanf("%d %d %d",&N,&K,&Q);
    int num[100000],A[100000];
    for(int i=0;i<N;i++){
            num[i]=K;
    }
    for(int i=0;i<Q;i++){
    scanf("%d",&A[i]);
    }
    for(int i=0;i<Q;i++){
            num[A[i]-1]+=1;
    }
    for(int i=0;i<N;i++){
            c=num[i]-Q;
    if(c<=0) printf("No\n");
    else printf("Yes\n");
    }
    return 0;
}

Measured memory_bytes: 1280
/*
 * File Name:	B.cpp
 * Author	:	CraZYali
 * Year		:	2019.10.23 23:36
 * Email	:	yms-chenziyang@outlook.com
 */

#define DREP(i, s, e) for (register int i(s), end_##i(e); i >= end_##i; i--)
#define  REP(i, s, e) for (register int i(s), end_##i(e); i <= end_##i; i++)
#define DEBUG fprintf(stderr, "Passing [%s] in Line %d\n", __FUNCTION__, __LINE__)

#define chkmax(a, b) a = max(a, (b))
#define chkmin(a, b) a = min(a, (b))

#include <iostream>
#include <cstdio>

using namespace std;
const int maxn = 300 + 5, maxm = 300 + 5;

template <typename T> inline T read()
{
	T ans(0), flag(1);
	char c(getchar());
	while (!isdigit(c))
	{
		if (c == '-') flag = -1;
		c = getchar();
	}
	while (isdigit(c))
	{
		ans = ans * 10 + c - 48;
		c = getchar();
	}
	return ans * flag;
}

#define file(FILE_NAME) freopen(FILE_NAME".in", "r", stdin), freopen(FILE_NAME".out", "w", stdout);

int n, m, fav[maxn][maxm];

bool pick[maxn];
int cnt[maxn];

int main()
{
#ifdef CraZYali
	file("B");
#endif
	cin >> n >> m;
	REP(i, 1, n)
		REP(j, 1, m) fav[i][j] = read<int>();
	REP(i, 1, m) pick[i] = 1;
	int ans = 1e9;
	REP(times, 1, m)
	{
		REP(j, 1, m) cnt[j] = 0;
		REP(i, 1, n)
			REP(j, 1, m)
				if (pick[fav[i][j]])
				{
					cnt[fav[i][j]]++;
					break;
				}
		int k = 1;
		REP(j, 2, m) if (cnt[j] > cnt[k]) k = j;
		chkmin(ans, cnt[k]);
		pick[k] = 0;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <boost/functional/hash.hpp>

#define debug 0
#define esc(ret) cout << (ret) << endl,quick_exit(0)
#define fcout(d) cout << fixed << setprecision(d)
#define repU(i,s,t) for(int i = (int)(s); i <= (int)(t); ++i)
#define repD(i,s,t) for(int i = (int)(s); i >= (int)(t); --i)
#define rep(i,n) repU(i,0,(n) - 1)
#define rep1(i,n) repU(i,1,(n))
#define all(v) begin(v),end(v)
#define vct vector
#define prique priority_queue
#define l_bnd lower_bound
#define u_bnd upper_bound
#define puf push_front
#define pub push_back
#define pof pop_front
#define pob pop_back
#define mkp make_pair
#define mkt make_tuple
#define ins insert
#define era erase
#define fir first
#define sec second
#define qceil(n,d) ((n) > 0 ? ((n) - 1) / (d) + 1 : (n) / (d))
#define parity(a,b) (a & 1 ^ b & 1 ^ 1)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair<int,int> pii;
typedef pair<db,int> pdi;
typedef tuple<int,int,int> tiii;

const int dir[][2] = { {1,0},{0,1},{-1,0},{0,-1},{1,1},{-1,1},{-1,-1},{1,-1} };
const int mod = 1e9 + 7;
const int inf32 = (1 << 30) - 1;
const ll inf64 = (1LL << 62) - 1;


ll N,M,Q,K,L,H,W,D;
string S;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int R,C;
	cin >> R >> C >> N;
	prique<pii,vct<pii>,greater<pii>> points;
	rep(i,N){
	    int x1,x2,y1,y2;
	    cin >> x1 >> y1 >> x2 >> y2;
	    if(0 == min({x1,y1,R - x1,C - y1}) && 0 == min({x2,y2,R - x2,C - y2})){
	        if(x1 == R){
	            points.push({y1 + R,i});
	        }else{
	            if(y1 == C) points.push({C + R * 2 - x1,i});
	            else if(!y1) points.push({x1,i});
	            else points.push({R * 2 + C * 2 - y1,i});
	        }
	        if(x2 == R){
	            points.push({y2 + R,i});
	        }else{
	            if(y2 == C) points.push({C + R * 2 - x2,i});
	            else if(!y2) points.push({x2,i});
	            else points.push({R * 2 + C * 2 - y2,i});
	        }
	    }
	}
	stack<int> tmp;
	bool used[100010] = {};
	while(!points.empty()){
	    int n = points.top().sec;
	    points.pop();
	    if(used[n]){
	        if(!tmp.empty() && tmp.top() == n) tmp.pop();
	        else esc("NO");
	    }else tmp.push(n),used[n] = 1;
	}
	esc("YES");
}


Measured memory_bytes: 2420
#include <iostream>
#include <vector>
#include <stack>
using namespace std;
const int N_MAX = 200000;

int main() {
	int n, q;
	cin >> n >> q;
	vector<vector<int>> g(n);
	for (int i = 0; i < n-1; i++) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	int c[N_MAX] = {0};
	for (int i = 0; i < q; i++) {
		int p, x;
		cin >> p >> x;
		p--;
		c[p] += x;
	}
	struct State
	{
		int v, parent, count;
	};
	stack<State> s;
	s.push({0, -1, c[0]});
	int ans[N_MAX];
	while (!s.empty()) {
		auto cur = s.top(); s.pop();
		ans[cur.v] = cur.count;
		for (int nv : g[cur.v]) {
			if (nv == cur.parent) continue;
			s.push({nv, cur.v, cur.count+c[nv]});
		}
	}
	for (int i = 0; i < n; i++) {
		cout << ans[i];
		if (i != n-1) cout << ' ';
		else cout << endl;
	}
	return 0;
}

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

using namespace std;

bool is_reachable(vector<int> &vec, int target, bool force_start) {
  vector<vector<char>> dp(vec.size() + 1, vector<char>(20000));
  dp[0][10000] = 1;
  for (size_t i = 0; i < vec.size(); ++i) {
    for (size_t j = vec[i]; j < dp[0].size() - vec[i]; ++j) {
      if (!force_start || 0 < i) {
        dp[i + 1][j - vec[i]] |= dp[i][j];
      }
      dp[i + 1][j + vec[i]] |= dp[i][j];
    }
  }

  return 0 != dp[vec.size()][target + 10000];
}

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

  string s;
  int x, y;
  cin >> s >> x >> y;
  vector<int> dx{0}, dy;
  int dir = 0;
  for (size_t i = 0; i < s.size(); ++i) {
    if (s[i] == 'F') {
      if (dir == 0) {
        dx.back()++;
      } else {
        dy.back()++;
      }
    } else {
      dir = 1 - dir;
      if (dir == 0) {
        dx.push_back(0);
      } else {
        dy.push_back(0);
      }
    }
  }
  if (is_reachable(dx, x, true) && is_reachable(dy, y, false)) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
}


Measured memory_bytes: 77952
import math
from itertools import combinations
n = int(input())
xy = [list(map(int,input().split())) for i in range(n)]
def enc(i,j,k):
  a,b = i
  c,d = j
  e,f = k
  aa = a * a
  bb = b * b
  cc = c * c
  dd = d * d
  ee = e * e
  ff = f * f
  if (2 * (e - a)*(b - d) - 2 * (c - a) * (b - f)) == 0:
    ymax = max(b,d,f)
    ymin = min(b,d,f)
    xmax = max(a,c,e)
    xmin = min(a,c,e)
    (px,py) = ((xmax-xmin)/2,(ymax-ymin)/2)
    r = math.hypot(xmax-xmin,ymax-ymin)/2
  else:
    py = ((e - a) * (aa + bb - cc - dd) - (c - a) * (aa + bb - ee- ff)) / (2 * (e - a)*(b - d) - 2 * (c - a) * (b - f))
    px = (2 * (b - f) * py - aa - bb + ee + ff) / (2 * (e - a)) \
      if (c == a) else (2 * (b - d) * py - aa - bb + cc + dd) / (2 * (c - a))
    r = math.hypot(px - a, py - b)
  return (r,px,py)
def judge(r,px,py):
  ls = [math.hypot(px-x,py-y) for x,y in xy]
  if max(ls) <= r+10**-7:
    return True
  else:
    return False
ans = 10**18
for i,j in combinations(xy,2):
  x1,y1 = i
  x2,y2 = j
  px = (x1+x2)/2
  py = (y1+y2)/2
  r = math.hypot(x1-x2,y1-y2)/2
  if judge(r,px,py):
    ans = min(ans,r)
for i,j,k in combinations(xy,3):
  r,px,py = enc(i,j,k)
  if judge(r,px,py):
    ans = min(ans,r)
print(ans)

Measured memory_bytes: 49244
N = int(input())
D, X = map(int, input().split())
A = [int(input()) for i in range(N)]
count = X

A = sorted(A)

for i in range(N):
    a = A[i]
    count +=1
    for j in range(D):
        if a+1<=D:
            count+=1
            a += A[i]
        else:
            break

print(count)


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

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {

int n;
char tmp;
int count = 0;

cin >> n;
char s[n];
for(int i = 0; i < n; i++) cin >> s[i];

for(int i = 0; i < n; i++){
  if(i == 0){
    tmp = s[i];
    count += 1;
    continue;
  }
  else{
    if(tmp == s[i]){
      continue;
    }
    else{
      tmp = s[i];
      count += 1;
    }
  }
}
cout << count << endl;
}

Measured memory_bytes: 384
/*
Author: CNYALI_LK
LANG: C++
PROG: c.cpp
*/
#include<bits/stdc++.h>
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define all(x) x.begin(),x.end()
using namespace std;
const double eps=1e-8;
const double PI=acos(-1.0);
typedef long long ll;
template<class T>int chkmin(T &a,T b){return a>b?a=b,1:0;}
template<class T>int chkmax(T &a,T b){return a<b?a=b,1:0;}
template<class T>T sqr(T a){return a*a;}
template<class T>T mmin(T a,T b){return a<b?a:b;}
template<class T>T mmax(T a,T b){return a>b?a:b;}
template<class T>T aabs(T a){return a<0?-a:a;}
#define min mmin
#define max mmax
#define abs aabs
int main(){
#ifdef cnyali_lk
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
#endif
	int n,m;
	scanf("%d%d",&n,&m);
	printf("%d\n",(1<<m)*(n*100+m*1800));

	return 0;
}



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

typedef long long ll;
const int maxn = 1e5 + 5, mod = 1e9 + 7;

inline int gi()
{
	char c = getchar();
	while (c < '0' || c > '9') c = getchar();
	int sum = 0;
	while ('0' <= c && c <= '9') sum = sum * 10 + c - 48, c = getchar();
	return sum;
}

inline void inc(int &a, int b) {a += b; if (a >= mod) a -= mod;}

char s[maxn];
int n, sum, flg, nxt[2][maxn], f[maxn];

int main()
{
	scanf("%s", s + 1); n = strlen(s + 1);
	flg = 0;
	for (int i = 1; i < n; ++i) flg += s[i] == s[i + 1];
	if (!flg) return puts("1"), 0;
	f[n + 1] = 1; nxt[0][n + 1] = nxt[1][n + 1] = nxt[0][n + 2] = nxt[1][n + 2] = n + 2;
	for (int i = n; i; --i) {
		(sum += s[i] - 'a' + 1) %= 3;
		nxt[0][i] = s[i] == 'a' ? i + 1 : nxt[1][i + 1];
		nxt[1][i] = s[i] == 'b' ? i + 1 : nxt[0][i + 1];
		f[i] = sum == 0;
		inc(f[i], f[nxt[0][i]]);
		inc(f[i], f[nxt[1][i]]);
	}
	printf("%d\n", f[1] - (sum == 0));
	
	return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;

ll d[11];
int main(){
    IOS();
    REP (i,3) cin >> d[i];
    sort(d,d+3);
    if (d[0] == d[2]) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    public static void main(final String[] args) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int L = scan.nextInt();

        int eat = Integer.MAX_VALUE;
        int eat_c = Integer.MAX_VALUE;
        int[] a = new int[N];
        int cnt = 0;
        for (int i = 1; i < N + 1; i++) {
            a[cnt] = L + i -1;
            int temp = 0;
            if (a[cnt] < 0 ) {
                temp = a[cnt] * -1;
            } else {
                temp = a[cnt];
            }

            int min = Math.min(eat_c, temp);
            if (min < eat_c) {
                eat =  a[cnt];
                eat_c =  min;
            }
            cnt++;
        }
        int count = 0;
        boolean eatFlag = false;
        for (int i = 0; i < N; i++) {
            if (a[i] == eat && !eatFlag) {
                eatFlag = true;
                continue;
            }
            count += a[i];
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 25044
#include<cstdio>
#include<algorithm>
#define Z int
#define V void
#define L long long
#define T struct
#define U using namespace std
#define S(n) scanf("%lld",&n)
#define P(n) printf("%lld",(n+p)%p)
#define F(i,a,b) for(L i=a;i<=b;i++)
#define D(i,a,b) for(L i=a;i>=b;i--)
#define W while
#define I if
#define R return
#define nx 100001
#define p (L)(1e9+7)
U;
T pt{L x,y;}a[nx],b[nx*2];
L n,m,x[nx],y[nx],tot,cnt,l,r,h,t,f[nx*2];
L cmp(pt x,pt y){R x.x<y.x||(x.x==y.x&&x.y>y.y);}
V ins(L x,L y){W(x<=cnt)(f[x]+=y)%=p,x+=x&-x;}
L ask(L x){L s=0;W(x)(s+=f[x])%=p,x-=x&-x;R s;}
Z main(){
	S(n),S(m);
	F(i,1,n)S(x[i]);
	F(i,1,m)S(y[i]);
	l=1,r=n;
	W(x[l]<y[1]&&l<=r)l++;
	W(x[r]>y[m]&&l<=r)r--;
	h=0,t=m+1;
	F(i,l,r){
		W(y[h+1]<x[i]&&h<m)h++;
		b[++tot].x=x[i]-y[h],b[tot].y=i;
	}
	D(i,r,l){
		W(y[t-1]>x[i]&&t>1)t--;
		b[++tot].x=y[t]-x[i],b[tot].y=-i;
	}
	sort(b+1,b+tot+1,cmp),cnt=1;
	F(i,1,tot)cnt+=b[i].x>b[i-1].x,
	b[i].y>0?a[b[i].y].x=cnt:a[-b[i].y].y=cnt;
	sort(a+l,a+r+1,cmp),ins(1,1);
	F(i,l,r)I(a[i].x!=a[i-1].x||a[i].y!=a[i-1].y)
	ins(a[i].y,ask(a[i].y-1));
	P(ask(cnt));
}

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

int main() {
    long double a, b, c;
    cin >> a>>b;
    
    if(a>b*2) c = a - b*2;
    else c = 0;
    
    cout<<c<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int k,x;
    scanf("%d %d",&k,&x);
    for(int i=x-k+1;i<=k+x-1;i++)
    {
        printf("%d",i);
        if(i!=k+x-1)
            printf(" ");
    }

    return 0;
}


Measured memory_bytes: 256
import math

a, b, h, m = (input().rstrip().split(' '))
a = int(a)
b = int(b)
h = int(h)
m = int(m)

theta = (h / 12 + m / 60 / 12) * 2 * math.pi
a_x = a * math.sin(theta)
a_y = a * math.cos(theta)

phi = m / 60 * 2 * math.pi
b_x = b * math.sin(phi)
b_y = b * math.cos(phi)

distance = math.sqrt((a_x - b_x)**2 + (a_y - b_y)**2)

print(distance)


Measured memory_bytes: 9440
import math

D,G=map(int,input().split())
a=[list(map(int,input().split())) for i in range(D)]

ans=100000
for i in range(2**D):
    s=bin(i)[2:].zfill(D)
    x=[int(s[i]) for i in range(D)]
    q,score=0,G
    for i in range(D):
        if x[i]==1:
            q+=a[i][0]
            score -= a[i][0]*(i+1)*100 + a[i][1]


    if score>0:
        for i in range(D-1,-1,-1):
            if x[i]==0:
                k=(a[i][0]-1)*(i+1)*100
                if k>=score:
                    q+= math.ceil( score/((i+1)*100) )
                    score=-1
                    break

                else:
                    q+=a[i][0]-1
                    score-= (a[i][0]-1)*(i+1)*100
        
    if score<=0: ans=min(ans,q)


print(ans)

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

long long e_gcd(long long a, long long b)
{
    if (a % b == 0)
    {
        return b;
    }else
    {
        return (e_gcd(b, a % b));
    }
    
}

int main(int argc, char const *argv[])
{
    long long A, B;
    cin >> A >> B;
    long long n = e_gcd(B, A);
    long long cnt = 1;
    for (long long i = 2; i * i <= n ; i++)
    {
        if (n == 1) break;
        if (n % i != 0) continue;
        while (n % i == 0)
        {
            n /= i;
        }
        cnt += 1;
    }

    if (n != 1) cnt += 1;
    cout << cnt << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
using namespace std;
typedef long long LL;
#define ms(a, b) memset(a, b, sizeof(a))
#define pb push_back
#define mp make_pair
const int INF = 0x7fffffff;
const int inf = 0x3f3f3f3f;
const int mod = 1e9+7;
const int maxn = 100000 + 10;
int a[maxn];
void init() {

}
void solve() {
    int n;
    cin >> n;
    for(int i = 0;i<n;i++)
        cin >> a[i];
    int Max = 0;
    for(int i = 0;i<n;i++)
        Max = max(Max, a[i]);
    int Max_cnt = 0;
    for(int i = 0;i<n;i++){
        if(a[i]==Max)   Max_cnt++;
        if(a[i]<Max-1){
            cout << "No" << endl;
            return;
        }
    }
    if(Max_cnt==n && Max == n-1){
        cout << "Yes" << endl;
        return;
    }
    int Minc = n - Max_cnt + 1;
    int Maxc = ( n - Max_cnt ) + Max_cnt/2;
    if(Minc <= Max && Max <= Maxc)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return;
}
int main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
//        freopen("output.txt", "w", stdout);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    init();
    solve();
    return 0;
}


Measured memory_bytes: 640
import sys
input = lambda: sys.stdin.readline().rstrip()


def solve():
    N = int(input())
    S = list(input())

    ans = 1
    now = S[0]
    for i in range(1, N):
        if S[i] == now:
            continue
        else:
            ans += 1
            now = S[i]

    print(ans)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 4084
#include <bits/stdc++.h>
using namespace std;
void solve () {
    int n, x;
    cin >> n >> x;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    long long ans = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] + a[i - 1] > x) {
            long long b = max (0, a[i] + a[i - 1] - x);
            ans += b;
            a[i] -= b;
        }
    }
    cout << ans;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    solve();
    return 0;
}


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

const int N=3010;

struct Edge{ int to,next; }way[N<<1];

int n,A[N],num[N],tot;

void Build(int a,int b) { way[++tot]=(Edge){b,num[a]}; num[a]=tot; }

void Init() {
	scanf("%d",&n);
	for (int i=1;i<=n;++i) scanf("%d",&A[i]);
	int a,b;
	for (int i=2;i<=n;++i) {
		scanf("%d%d",&a,&b);
		Build(a,b); Build(b,a);
	}
}

bool Dfs(int x,int fa) {
	for (int i=num[x];i;i=way[i].next) {
		int v=way[i].to;
		if (v==fa) continue;
		if (A[v]<A[x] && !Dfs(v,x)) return 1;
	}
	return 0;
}

void Solve() {
	for (int i=1;i<=n;++i) 
		if (Dfs(i,0)) printf("%d ",i);
	putchar('\n');
}

int main() {
	Init();
	Solve();
	return 0;
}

Measured memory_bytes: 256
using System;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            string b = Console.ReadLine();
            int A = int.Parse(b);
            string an;
            if (A == 3 || A == 5 || A == 7) { an = "YES"; }
            else { an = "NO"; }
            Console.Write(an);
        }
    }
}

Measured memory_bytes: 13140
#include <stdio.h>
#define NIL -1

typedef struct {
  int p;
  int l;
  int r;
}Node;
Node T[100005];
int n,D[100005];

void print(int u)
{
  int i,c;
  printf("node %d: parent = %d, depth = %d, ",u,T[u].p,D[u]);
  if(T[u].p==NIL) printf("root, ");
  else if(T[u].l==NIL) printf("leaf, ");
  else printf("internal node, ");
  
  printf("[");
  
  for(i=0,c=T[u].l; c!=NIL;i++,c=T[c].r){
    if(i>0) printf(", ");
    printf("%d",c);
  }
  printf("]\n");

}
int rec(int u,int p)
{
  D[u]=p;
  if(T[u].r!=NIL) rec(T[u].r,p);
  if(T[u].l!=NIL) rec(T[u].l,p+1);
  return 1;
}


int main()
{
  int n,i,j,d,v,c,l,r;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    T[i].p=NIL;
    T[i].l=NIL;
    T[i].r=NIL;
  }
  for(i=0;i<n;i++){
    scanf("%d %d",&v,&d);
    for(j=0;j<d;j++){
      scanf("%d",&c);
      if(j==0) T[v].l=c;
      else T[l].r=c;
      l=c;
      T[c].p=v;
    }
  }
  for(i=0;i<n;i++){
    if(T[i].p==NIL) r=i;
  }
  
  rec(r,0);
  for(i=0;i<n;i++) print(i);
  return 0;
}

Measured memory_bytes: 5300
import java.util.ArrayDeque;
import java.util.Queue;
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		int num, quantum = 0;
		int time = 0; // time;総時間数
		Queue<String> qName = new ArrayDeque<String>();
		Queue<Integer> qTime = new ArrayDeque<Integer>();

		num = scan.nextInt(); // 入力数
		quantum = scan.nextInt(); // クオンタム（実行する処理時間）
		scan.nextLine();

		for (int i = 0; i < num; i++) {
			qName.add(scan.next());
			qTime.add(scan.nextInt());
		}

		while (!qName.isEmpty()) {
			String qNamePolled = qName.poll();
			int getTime = qTime.poll();

			if (getTime > quantum) { // 総時間数をカウントしていく
				time = time + quantum;
			} else {
				time = time + getTime;
			}

			if (getTime > quantum) {
				qTime.add(getTime - quantum);
				qName.add(qNamePolled);
			} else { // 今のプロセス処理終了
				System.out.println(qNamePolled + " " + time);
			}
		}
		scan.close();
	}
}



Measured memory_bytes: 75852
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<bitset>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1 << 28;
//cout << fixed << std::setprecision(9)
//memset(a, 0, sizeof(a));
//--------------------------

int dp[1001][1001];

int lcs(string x, string y)
{	
	int n = x.size();
	int m = y.size();

	x = " " + x;
	y = " " + y;

	for (int i = 1; i <= n; i++) dp[i][0] = 0;
	for (int j = 1; j <= m; j++) dp[0][j] = 0;

	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++) {
			if (x[i] == y[j]){
				dp[i][j] = dp[i - 1][j - 1] + 1;
			}
			else {
				dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
			}
		}
	return dp[n][m];
}

int main()
{
	int q;
	string s1, s2;
	cin >> q;

	for (int i = 0; i < q; i++) {		
		cin >> s1 >> s2;
		cout << lcs(s1, s2) << endl;
	}

	return 0;
}

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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

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

    int s;
    cin >> s;
    cout << s / 3600 << ":" << (s % 3600) / 60 << ":" << (s % 60) << endl;
}



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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;
typedef tuple<long long, long long, long long> tllint;

static const int MAX = 2e5;
// static const int NIL = -1;
// static const llint INF = 1<<21;
static const llint MOD = 1e9 + 7;

llint fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void init_combination() {
    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;
    }
}

// 二項係数計算
llint combination(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;
}

llint com(llint n, llint r) {
    llint ans = 1;
    if(r<0 || n<r) return 0;
    else {
        for(int i=0;i<r;r++) {
            ans *= n-i;
        }
        for(int i=0;i<r;r++) {
            ans /= (r-i);
        }
        return ans;
    }
}

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
bool compTuple(const tllint& arg1, const tllint& arg2) { return get<2>(arg1) > get<2>(arg2); }
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(void) {
    llint s;
    cin >> s;

    llint cnt = 1, ans = 0, h;
    init_combination();

    while(1) {
        h = s - 3*cnt;
        if(h<0) break;
        ans += combination(h+cnt-1, cnt-1);
        ans %= MOD;
        cnt++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 8304
#include <iostream>
#include <cmath>

using namespace std;

long long func(long long a, long long x)
{
    if (a < 0)
        return 0;
    return a / x + 1;
}

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

    long long a, b, x;
    cin >> a >> b >> x;

    cout << func(b, x) - func(a - 1, x) << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		int t = -1;
		ArrayList<Integer> list = new ArrayList<Integer>();
		long cnt = 1;
		list.add(s);
		while(true) {
			cnt++;
			if(s % 2 == 0) {
				t = s / 2;
			} else {
				t = 3 * s + 1;
			}
			if(list.contains(t)) {
				System.out.println(cnt);
				return;
			}
			list.add(t);
			s = t;
		}
	}
}


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

typedef long long ll;

ll H, W, K;
ll SX, SY, TX, TY;
vector<vector<bool>> L;
queue<pair<ll, ll>> Q;
vector<vector<ll>> D;
const ll INF = 1ll << 60;
const ll DX[] = {0, 1, 0, -1};
const ll DY[] = {1, 0, -1, 0};

int main() {
  cin >> H >> W >> K;
  cin >> SX >> SY >> TX >> TY;
  L.resize(H + 2);
  for (auto &Lx : L) Lx.resize(W + 2, true);
  for (ll x = 1; x <= H; ++x) {
    for (ll y = 1; y <= W; ++y) {
      char c;
      cin >> c;
      if (c == '.') L[x][y] = false;
    }
  }
  D.resize(H + 2);
  for (auto &Dx : D) {
    Dx.resize(W + 2, INF);
  }
  Q.push({SX, SY});
  D[SX][SY] = 0;
  while (!Q.empty()) {
    ll x, y;
    tie(x, y) = Q.front();
    Q.pop();
    ll d = D[x][y];
    for (ll i = 0; i < 4; ++i) {
      ll dx = DX[i], dy = DY[i];
      for (ll j = 1; j <= K; ++j) {
        ll x2 = x + j * dx;
        ll y2 = y + j * dy;
        if (L[x2][y2]) break;
        if (D[x2][y2] <= d) break;
        if (D[x2][y2] == d + 1) continue;
        Q.push({x2, y2});
        D[x2][y2] = d + 1;
      }
    }
  }
  ll res = D[TX][TY];
  cout << (res == INF ? -1 : res) << endl;
  return 0;
}


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

int po(int n)
{
    int a=1;
    for(int i=1;i<=n;i++)
        a=10*a;
    return a;
}


int main()
{

    int a,b;
    int i=0;

    cin>>a>>b;
    int d=b;

    while(d>0)
    {
        ++i;
        d=d/10;

    }
    a=a*po(i);
    int j=0;


    while(b>0)
    {
        int e=b%10;
        a=a+pow(10,j)*e;
        b=b/10;
        j++;

    }
    int count=0;
    for(int k=2;k<=sqrt(a);k++)
    {
        if(k*k==a)
            count=1;

    }

    if(count==1)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;



    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n, t[102] = {}, v[102] = {}, d[40404][222] = {};
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> t[i], t[i] += t[i], t[i] += t[i - 1];
    for (int i = 1; i <= n; i++) cin >> v[i], v[i] += v[i];
    for (int i = 0; i <= 40400; i++) for (int j = 0; j <= 213; j++) d[i][j] = -mod;
    d[0][0] = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = t[i - 1] + 1; j <= t[i]; j++) {
            for (int k = 0; k <= v[i]; k++) {
                d[j][k] = d[j - 1][k] + k + k;
                if (k) d[j][k] = max(d[j][k], d[j - 1][k - 1] + k + k - 1);
                if (j == t[i - 1] + 1) {
                    if (k < v[i]) d[j][k] = max(d[j][k], d[j - 1][k + 1] + k + k + 1);
                } else {
                    d[j][k] = max(d[j][k], d[j - 1][k + 1] + k + k + 1);
                }
            }
        }
    }
    cout << setprecision(13) << d[t[n]][0] / 8.0 << '\n';
}


Measured memory_bytes: 35456
class UnionFind(object):
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
        self.size = [1 for _ in range(n)]
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
            self.size[x] += self.size[y]
    def is_same(self, x, y):
        return self.find(x) == self.find(y)
    def get_size(self, x):
        x = self.find(x)
        return self.size[x]
    def get_group(self):
        a=0
        for i in range(len(self.par)):
          if self.find(i)==i:
            a+=1
        return a
N,M=map(int,input().split())
lity=[]
lity.append(int(N*(N-1)/2))
ans=0
uf=UnionFind(N)
AB=[list(map(int,input().split())) for i in range(M)]
for i in range(M-1,-1,-1):
  a,b=AB[i]
  x=uf.find(a-1)
  y=uf.find(b-1)
  sizex=0
  sizey=0
  if x!=y:
    sizex=uf.get_size(a-1)
    sizey=uf.get_size(b-1)
  uf.union(a-1,b-1)
  ans=lity[-1]-sizex*sizey
  lity.append(ans)
for j in range(M-1,-1,-1):
  print(lity[j])

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

template<typename T, typename U> void cmax(T &a, U b) { if (a < b) a = b; }
template<typename T, typename U> void cmin(T &a, U b) { if (a > b) a = b; }

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

  int N;
  cin >> N;

  vector<pair<int, int>> V(N);
  int x_max = INT_MIN, x_min = INT_MAX;
  int y_max = INT_MIN, y_min = INT_MAX;

  for (int i = 0; i < N; i++) {
    int x, y;
    cin >> x >> y;
    V.at(i) = {x, y};
    cmax(x_max, x);
    cmax(y_max, y);
    cmin(x_min, x);
    cmin(y_min, y);
  }

  int X = (x_max + x_min) / 2;
  int Y = (y_max + y_min) / 2;

  long mx = LONG_MIN, I = -1;
  for (int i = 0; i < N; i++) {
    auto [x, y] = V.at(i);
    long tmp = abs(X - x) + abs(Y - y);
    if (tmp > mx) mx = tmp, I = i; 
  }

  X = V.at(I).first;
  Y = V.at(I).second;

  long ans = 0;
  for (int i = 0; i < N; i++) {
    auto [x, y] = V.at(i);
    long tmp = abs(X - x) + abs(Y - y);
    cmax(ans, tmp);
  }
  cout << ans << "\n";
}

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

void ti(){
  #ifndef ONLINE_JUDGE
    freopen("in.txt", "r+", stdin);
    freopen("out.txt", "w", stdout);
  #endif
}

int main(){

  // ti();
  long long int t; cin>>t;
  cout<<t+t*t+t*t*t<<endl;

  return 0;
}


Measured memory_bytes: 3628
fn getline() -> String {
    let mut __ret = String::new();
    std::io::stdin().read_line(&mut __ret).ok();
    return __ret;
}

fn main() {
    let s = getline();
    let vec: Vec<_> = s.trim().split(' ').collect();
    let h: i32 = vec[0].parse().unwrap();
    let w: i32 = vec[1].parse().unwrap();

    let mut lines: Vec<String> = Vec::new();

    for _ in 0..h {
        let s = getline();
        let t: String = String::from(s.trim());
        lines.push(t);
    }

    for _ in 0..(w + 2) {
        print!("#");
    }
    println!("");

    for line in lines.iter() {
        println!("#{}#", line);
    }
    for _ in 0..(w + 2) {
        print!("#");
    }
    println!("");
}


Measured memory_bytes: 4352
#include <stdio.h>
#include <stdlib.h>
using namespace std;

int n,i,j,k;
long long K,a[105];

int main()
{
	scanf("%lld",&K);
	if(K==0)
	{
		printf("2\n");
		printf("0 0\n");
		return 0;
	}
	if(K==1)
	{
		printf("2\n");
		printf("2 0\n");
		return 0;
	}
	if(K<=50)n=K;else n=50;
	for(i=1;i<=n;++i)a[i]=(K/n+(K%n>=i))*(n+1);
	printf("%d\n",n);
	for(i=1;i<=n;++i)printf("%lld ",a[i]-K+n-1);
}

Measured memory_bytes: 128
from operator import mul
from functools import reduce


def combinations_count(n, r, P):
    r = min(r, n - r)
    inv_y = 1
    for i in range(1, r + 1):
        inv_y = (inv_y * i) % P
    inv_y = pow(inv_y, P - 2, P)
    x = 1
    for i in range(n - r + 1, n + 1):
        x = x * i % P
    return (x * inv_y) % P



n, a, b = map(int, input().split())
P = int(1e9+7)
ans = pow(2, n, P) - 1  # 1本以上の花束の種類


ans = (ans - combinations_count(n, a, P))
ans = (ans - combinations_count(n, b, P))
print(ans%P)


Measured memory_bytes: 67536
#include <bits/stdc++.h>
//#pragma GCC optimize(2)
//author wjl

using namespace std;
#define LL long long
#define Rint register int
#define U unsigned
#define forn(i,a,b) for(int i = a;i <= b;++i)
#define nfor(i,a,b) for(int i = a;i >= b;--i)
#define pii pair<int ,int>
#define MS0(X) memset(X,0,sizeof(X))
#define MSf(X) memset(X,false,sizeof(X))
#define MS1(X) memset(X,-1,sizeof(X))
#define BR printf("--------------------\n")
#define pb push_back
#define rep(i,a,b) for(Rint i=a;i<=b;++i)
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl
const double PI=atan(1.)*4.;
const int maxn=1e6+5;
const int inf = 0x3f3f3f3f;
const int mod=1e9+7;
const double e=2.71828182845904523536;
int dirx[8]={1,0,-1,0,1,-1,-1,1};
int diry[8]={0,1,0,-1,1,1,-1,-1};
LL n;
LL a[maxn],sum[maxn];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        sum[i]=a[i]+sum[i-1];
    }
    LL ans=1e18+7;
    for(int i=1;i<=n-1;i++)
    {
        ans=min(ans,abs(sum[n]-sum[i]-sum[i]));
    }
    cout<<ans<<"\n";
    return 0;
}
/*
5 2
8 6 4 10 12
2
3
*/


Measured memory_bytes: 5888
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a,b,c;
	cin>>a>>b>>c;
	bool ans=false;
	if(a==b&&b!=c)ans=true;
	if(c==b&&a!=c)ans=true;
	if(a==c&&b!=a)ans=true;
	Yn(ans);
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
using namespace std;
int main(){
	double a,b,c,d;
	cin>>a;
	for(b=1; b<=9999; b++)
		for(c=1; c<=9999; c++){
			d=1/(4/a-1/b-1/c);
			if(d>0 && d==int(d)){
				cout<<b<<" "<<c<<" "<<d;
				b=99999999999999;
				c=743734778876543;
				break;
			}
		}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main(void) {
  int A, B, C, D, x, y;
  if(scanf("%d %d %d %d", &A, &B, &C, &D)==1);
  x = (A - (A % D)) / D;
  if(A%D!=0) {
    x ++;
  }
  y = (C - (C % B)) / B;
    if(C%B!=0) {
    y ++;
  }
  if (x<y) {
    printf("No");
  }
  else {
    printf("Yes");
  }
  return 0;
}

Measured memory_bytes: 1736
#include<bits/stdc++.h>
using namespace std;
string a,b;
int main()
{
    cin>>a>>b;
    int x=a.size(),y=b.size();
    for(int i=0;i<y;i++)
	{
        cout<<a[i]<<b[i];
    }
    if(x>y)
	{
        cout<<a[x-1];
    }
    return 0;
}

Measured memory_bytes: 256
import  math

n, d = map(int, input().split())
x = []
ans = 0

for i in range(n):
    X = list(map(int,input().split()))
    x.append(X)

for i in range(n):
    val = x[i]
    for j in range(i+1, n):
        val1 = x[j]
        val2 = 0
        for r in range(d):
            val2 += (val[r] - val1[r])**2
        if math.sqrt(val2).is_integer():
            ans += 1

print(ans)

Measured memory_bytes: 61788
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define INF         1e9
#define EPS         1e-9
#define REP(i,n)    for(lint i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(lint i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(lint i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(lint i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define R_UP(a,b)   (((a)+(b)-1)/(b))
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP        cout << fixed << setprecision(10)
using namespace std;
using lint = long long;
template<typename T = lint>inline T in() { T x; cin >> x; return x; }

signed main() {
	SETP;
	int q = in();
	REP(i, q) {
		double xp0 = in(), yp0 = in(), xp1 = in(), yp1 = in(), xp2 = in(), yp2 = in(), xp3 = in(), yp3 = in();
		cout << ((xp1*yp0 - xp0 * yp1)*(xp3 - xp2) - (xp3*yp2 - xp2 * yp3)*(xp1 - xp0)) / ((xp1 - xp0)*(yp3 - yp2) - (xp3 - xp2)*(yp1 - yp0)) << ' ' << ((xp1*yp0 - xp0 * yp1)*(yp3 - yp2) - (xp3*yp2 - xp2 * yp3)*(yp1 - yp0)) / ((xp1 - xp0)*(yp3 - yp2) - (xp3 - xp2)*(yp1 - yp0)) << endl;
	}
}


Measured memory_bytes: 3284
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <queue>
#include <ctime>
using namespace std;

typedef pair<double,int> P;
string s[11];
int N, you, hand, score;

int f(int a, int b){
	if( s[a][b] == 'o' ) return 3;
	if( s[a][b] == 'x' ) return 1;
	return 0;
}

// [a,b] のどれかの整数を返す.
int random(int a, int b){
	int range = b - a + 1;
	return rand() % range + a;
}

int main(){
	srand((unsigned int)time(NULL));
	int H[256] = {0}, P[11] = {0};
	H['o'] = 3;
	H['-'] = 1;
	
	cin >> N;
	for(int i=0 ; i < N ; i++ ){
		cin >> s[i];
	}
	int cnt=0, h[11] = {0};
	for(int k=1 ; k <= N ; k++ ){
		for(int i=0 ; i < 30 ; i++, cnt++ ){
			hand = k;
			printf("%d\n", hand); fflush(stdout);
			scanf("%d", &you);
			h[you-1]++;
			score += f(hand-1,you-1);
		}
	}
	for(; cnt < 500 ; cnt++ ){
		hand = random(1,N);
		printf("%d\n", hand); fflush(stdout);
		scanf("%d", &you);
		h[you-1]++;
		score += f(hand-1,you-1);
	}
	bool flag = false;
	for(int i=0 ; i < N ; i++ ){
		if( h[i] >= 400 ){
			flag = true;
			hand = i+1;
		}
	}
	for(; cnt < 1000 ; cnt++ ){
		hand = flag? hand : random(1,N);
		printf("%d\n", hand); fflush(stdout);
		scanf("%d", &you);
		h[you-1]++;
		score += f(hand-1,you-1);
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <iomanip>
#include <vector>
#include <valarray>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <complex>
#include <string>
#include <sstream>

#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cmath>

using namespace std;

#define all(c) c.begin(),c.end()
#define repeat(i,n) for(int i=0;i<static_cast<int>(n);i++)
#define debug(x) #x << "=" << (x)
#define dump(x) cerr << debug(x) << " (L:" << __LINE__ << ")"<< endl

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<long> vl;
typedef vector<vector<long> > vvl;
typedef vector<string> vs;

template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec){
    os << "[";
    for(int i = 0; i < vec.size(); i++){
        os << vec[i] << ",";
    }
    os << "]";
    return os;
}

template<typename T>
T input(){
    T t;
    cin >> t;
    return t;
}

template<typename T>
vector<T> input(const int N){
    vector<T> v(N);
    repeat(i,N) cin >> v[i];
    return v;
}

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

long long lcm(long long a, long long b){
    return (a / gcd(a, b)) * b;
}

long long mul(const long long& a, const long long& b, const long long& mod) {
    return ((a % mod) * (b % mod)) % mod;
}

long long power(const long long& x, const long long& y, const long long& mod) {
    if (y == 0) {
        return 1;
    } else if (y == 1) {
        return x % mod;
    } else {
        long long value = power(x, y / 2, mod);
        if (y % 2 == 0) {
            return mul(value, value, mod);
        } else {
            return mul(value, value, mod) * x % mod;
        }
    }
}

long long div(const long long& a, const long long& b, const long long& mod) {
    return mul(a, power(b, mod - 2, mod), mod);
}

map<long long, long long> factorials;
long long factorial(const long long& n, const long long& mod) {
    if (n == 0 || n == 1) {
        return 1;
    }
    if (factorials[n] != 0) {
        return factorials[n];
    }
    factorials[n] = n * factorial(n - 1, mod) % mod;
    return factorials[n] % mod;
}

long long combination(const long long& n, const long long& x, const long long& mod) {
    long long numerator = 1;
    long long denominator = 1;
    repeat(i, x) {
        numerator *= (n - i) % mod;
        numerator %= mod;
        denominator *= (i + 1) % mod;
        denominator %= mod;
    }
    return div(numerator, denominator, mod);
}

int main(){
    long N, T;
    cin >> N >> T;

    long lastEndTime = 0;
    long time;
    long totalTime = 0;
    repeat (i, N) {
        cin >> time;
        if (time <= lastEndTime) {
            totalTime += (time + T) - lastEndTime;
        } else {
            totalTime += T;
        }
        lastEndTime = time + T;
    }
    cout << totalTime << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
string str;

int main(){
	cin >> str;
	ll ans = 0;
	ll cnt = 0;
	
	for(ll i = 0; i < str.size(); i++){
		char c = str[i];
		if(c == 'A' || c == 'T' || c == 'G' || c == 'C'){
			cnt++;
			ans = max(cnt, ans);
		}
		else{cnt = 0;}
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
using namespace std;

vector<long long int> sum;

bool hantei(int index, long long int key,int left,int right) {
	if (sum[index] - sum[left] >= sum[right] - sum[index])return true;
	else return false;
}

int nibutan(long long int key, int left, int right) {
	int ng = left;
	int ok = right-1;

	while (abs(ok - ng) > 1) {

		int mid = (ng + ok) / 2;

		if (hantei(mid, key, left, right))ok = mid;
		else ng = mid;

	}
	if (ok!=left+1&&abs(sum[right] + sum[left] - 2 * sum[ok]) > abs(sum[right] + sum[left] - 2 * sum[ok - 1]))ok--;
	return ok;
}


int main() {
	//cout << fixed << setprecision(10);
	long long int a, b, c, d, n, m,h,w,H,W;
	string str;
	cin >> H >> W >> h >> w;
	cout << (H-h)*(W-w);
}

Measured memory_bytes: 256