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

void a_Poor(int A, int B, int C)
{
    if ((A != B) && (B != C) && (C != A))
    {
        std::cout << "No";
        return;
    }

    if ((A == B) && (B == C))
    {
        std::cout << "No";
        return;
    }

    std::cout << "Yes";
}

int main(int , char*[])
{
    int A, B, C;
    std::cin >> A >> B >> C;
	a_Poor(A, B, C);
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <string>
#include <cmath>
#include <sstream>
#include <istream>
#include <iomanip>
#include <typeinfo>


using namespace std;
typedef long long ll;

int main(){

    ll N = 0;
    cin >> N;
    
    vector<ll > p(N,0);
    for(ll i = 0; i < N; i++){
        cin >> p[i];
    }

    sort(p.begin(),p.end());

    ll total = 0;
    for(ll i = 0; i < N-1; i++){
        total += p[i];
    }  
    total += p[p.size()-1] / 2;

    cout << total << endl;


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define in(n)  int n; cin>>n;
#define loop for(int i=0;i<n;i++)
#define pb push_back
#define pf push_front
#define ll long long int
using namespace std;
int  main()
{

int a;
int b;
int c;
cin>>a>>b>>c;
int d=max(a,max(b,c));
cout<<abs(d-(a+b+c));

}


Measured memory_bytes: 256
from collections import deque

H, W = map(int, input().split())
Map = [input() for _ in range(H)]

slst = [[] for _ in range(H)]
for i in range(H):
  for j in range(W):
    if Map[i][j] == '#':
      slst[i].append(j)

m = 0
for i in range(1,H):
  if slst[i-1][-1] != slst[i][0]:
    print('Impossible')
    exit()
    
print('Possible')

Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define ll long long
#define rw freopen("input.txt","r",stdin),freopen("output.txt","w",stdout);
#define pb push_back
#define F first
#define S second
#define pf push_front
#define lp(i,a,b) for (int i=a;i<=b;++i)
#define lp2(i,a,b) for (int i=a;i>=b;--i)
#define f(x) return cout<<x<<"\n",0
#define pii pair<ll,int>
#define mod 1000000007
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define p(x) cout<<#x<<" = { "<<x<<" } \n"
#define FAST ios::sync_with_stdio(0),ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
const int N=1e5+4;
int arr[N][4]= {},dp[N][4]= {},n;
int solve(int idx,int prv)
{
    if (idx>=n)
        return 0;
    int &ret=dp[idx][prv];
    if (~ret)
        return ret;
    ret=0;
    lp(i,1,3)
    {
        if (i!=prv)
            ret=max(ret,solve(idx+1,i)+arr[idx][i]);
    }
    return ret;
}
int main()
{
#ifdef ONLINE_JUDGE
    FAST;
#endif
    memset(dp,-1,sizeof(dp));
    cin>>n;
    lp(i,0,n-1)
    {
        lp(j,1,3)
        cin>>arr[i][j];
    }
    cout<<solve(0,0)<<"\n";
    return 0;
}

Measured memory_bytes: 11136
#include <iostream>
#include <string>
#include <vector>
#include <cstdint>
#include <algorithm>
using namespace std;

#define N 100

int a[N];

int main() {
	int n;
	int ans = 0;

	cin >> n;
	for( int i = 0; i < n; i++ ) {
		cin >> a[i];
	}

	sort(a, a+n);
	ans = a[n-1] - a[0];

	cout << ans << "\n";
 
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for(int i=0; i<(int)c; i++)
int main() {
	string s,ans;
	cin >>s;;

	ans="ABC";
	if (s=="ABC") ans ="ARC";
	cout <<ans<<endl;
	return 0;
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    string s;
    cin>>n;
    cin>>s;
    int len = s.length();
    int c=0,i=0,j=len-1;
    while(i<len&&j>=0){
        while(s[i]=='R'&&i<len){
          
            i++;
            //   cout<<"\ni : "<<i;
        }
        while(s[j]=='W'&&j>=0){
                  j--;
                // cout<<"\nj:"<<j;
        }
        if(i==len||j==-1){
            // cout<<"\nout of bound";
            break;
        }
        if(i>=j){
            // cout<<"\ni >= j";
            break;
        }
        // cout<<"ONE DONE";
        c++;
        i++;
        j--;
    }
     cout<<c;

    return 0;
}



Measured memory_bytes: 3700
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>
#include <list>
#include <forward_list>
#include <algorithm>
#include <numeric>
#include <utility>
#define _USE_MATH_DEFINES
#include <cmath>
#include <bitset>

using namespace std;

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

  int n, m;
  cin >> n >> m;
  vector<int> vis(n);

  vector<vector<int>> edges(n);
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    edges[a - 1].push_back(b-1);
    edges[b - 1].push_back(a - 1);
  }

  queue<int> vert;
  vert.push(0);
  while (!vert.empty()) {
    int v = vert.front();
    vert.pop();
    for (int p : edges[v]) {
      if (!vis[p]) {
        vis[p] = v + 1;
        vert.push(p);
      }
    }
  }

  vis.erase(vis.begin());
  if (all_of(vis.begin(), vis.end(), [](int v) { return v > 0; })) {
    cout << "Yes\n";
    for (int i : vis)
      cout << i << '\n';
  }
  else
    cout << "No" << endl;
}

Measured memory_bytes: 10236
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <queue>

#define MAX_N 1000001

using namespace std;

long long M[MAX_N];
long long A[MAX_N];
long long n;
long long bias=0;

void solve()
{
    M[0] = 0;
    int i=0;
    while(i != n-2){
        M[(i+2)%n] = M[i]+2*(A[(i+1)%n]-A[i%n]);
        i+=2;
        i%=n;
    }
    bias = (2*A[0]-M[0]-M[1])/2;

    for(int i = 0;i<n;i++)cout<<M[i]+bias<<" ";
    cout<<endl;

}

int main()
{
    cin>>n;
    for(int i = 0;i<n;i++){
        cin>>A[i];
    }
    solve();
    return 0;
}


Measured memory_bytes: 6144
//DFSテンプレート
fun main(args: Array<String>) {
    var X = nextLong()
    val P = prime(X, 110000L)
    println(P[0])
}
fun next() = readLine()!!
fun nextLong() = next().toLong()
fun prime(from: Long, to: Long = from): List<Long> {
    return (from..to).filter { i ->
        val max = Math.sqrt(i.toDouble()).toLong()
        (2..max).all { j -> i % j != 0L }
    }
}

Measured memory_bytes: 38264
from itertools import combinations
N, M, Q = map(int, input().split())
qs = []
for _ in range(Q):
    qs.append(tuple(map(int, input().split())))

ans = 0
for cs in combinations(range(N+M-1), M-1):
    cs = set(cs)
    arr = []
    tmp = 0
    i = 0
    for k in range(N+M-1):
        if k in cs:
            tmp += 1
        else:
            arr.append(tmp)
            i += 1
        if i >= N:
            break
    score = 0
    for a, b, c, d in qs:
        if arr[b-1] - arr[a-1] == c:
            score += d
    ans = ans if ans > score else score
print(ans)


Measured memory_bytes: 9220
//#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

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

char s[65][35];
int d[65][35][2];
signed main(void)
{
	while(true) {
		int w, h;
		cin >> w >> h;
		if(!w && !h) break;
		REP(i, h) REP(j, w) cin >> s[i][j];

		vector<PII> sxy, gxy;
		REP(i, h) REP(j, w) {
			if(s[i][j] == 'S') {
				sxy.PB(MP(i, j));
			} else if(s[i][j] == 'T') {
        gxy.PB(MP(i, j));
      }
		}

    int ans = INF;
		for(PII i: sxy) {
			//i.first, i.second ???????§???°?????¨??????????¶?????¶???????????????????????????????
			//0?????????1??????
			REP(l, 2) {
				REP(j, h) REP(k, w) d[j][k][0] = d[j][k][1] = INF;
				queue<VI> que;
				que.push({i.first, i.second, (int)l});
				d[i.first][i.second][l] = 0;

				while(que.size()) {
					VI p = que.front(); que.pop();
					int y = p[0], x = p[1], left = p[2];
					if(s[y][x] == 'T') continue;
					REP(j, 9) {
						int nx, ny;
						//left???1???????¬????????¶?????????????
						//left???0???????¬????????¶?????????????
						nx = x + dx[left][j], ny = y + dy[left][j];
						if(IN(0, h, ny) && IN(0, w, nx) && s[ny][nx] != 'X') {
              int tmp;
              if(s[ny][nx] == 'S') tmp = d[y][x][left];
              else if(s[ny][nx] == 'T') tmp = d[y][x][left];
              else tmp = d[y][x][left] + s[ny][nx] - '0';
              if(d[ny][nx][!left] > tmp) {
    						que.push({ny, nx, !left});
                d[ny][nx][!left] = tmp;
              }
						}
					}
				}
        for(PII j: gxy) {
          ans = min(ans, d[j.first][j.second][0]);
          ans = min(ans, d[j.first][j.second][1]);
        }
        //cout << i.first << " " << i.second << " " << l << " " << ans << endl;
        /*REP(j, h) {
          REP(k, w) {
            cout << "(";
            if(d[j][k][0] == INF) cout << -1 << ",";
            else cout << d[j][k][0] << ",";
            if(d[j][k][1] == INF) cout << -1 << ",";
            else cout << d[j][k][1] << ",";
            cout << ")";
          }
          cout << endl;
        }*/
			}
		}
    if(ans == INF) cout << -1 << endl;
    else cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 3204
<?php
  $n = trim(fgets(STDIN));
  $i = 2;
  function lucas($a,$b){
      global $n,$i;
      if($n <= $i){
         return $a+$b;
      }
     $i++;
      return lucas($b,$a+$b);
    }
  $a = 2;
  $b = 1;
  if ($n == 0) echo "2\n";
  else if ($n == 1) echo "1\n";
  else{
    echo lucas($a,$b)."\n";
  }

Measured memory_bytes: 4728
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int base=131;
const int mod1=19260817,mod2=21788233;
struct node
{
    ll x,y;
    bool operator <(const node&a)const
    {
        return x<a.x;
    }
}p[10050];
ll hash1(string s)
{
    ll ans=0;
    for(int i=0;i<s.length();i++)
        ans=(ans*base+ll(s[i]))%mod1;
        return ans;
}
ll hash2(string s)
{
    ll ans=0;
    for(int i=0;i<s.length();i++)
        ans=(ans*base+ll(s[i]))%mod2;
        return ans;
}
int main()
{
    string s;
    ll res=0,n;
    char t;
    while(cin>>n)
    { 
        
            cin>>s;
            p[1].x=hash1(s);
            p[1].y=hash2(s);
            t=s[s.length()-1];
        for(int i=2;i<=n;i++)
        {
            cin>>s;
            if(s[0]!=t)
            {
                cout<<"No"<<endl;
                return 0;
            }
            t=s[s.length()-1];
            p[i].x=hash1(s);
            p[i].y=hash2(s);

        }
        sort(p+1,p+1+n);
        for(int i=1;i<=n;i++)
        {
            if(p[i].x!=p[i-1].x||p[i].y!=p[i-1].y)
                res++;
        }
        if(res!=n)
        cout<<"No"<<endl;
        else
        cout<<"Yes"<<endl;

    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int , int> P;
typedef pair<ll, ll> PL;
const int INT_INF = 2147483646;
const ll LL_INF = 9223372036854775807;

bool SecondCompare(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second>b.second;
}
 
int n,k;
ll h[100010];

int main(){
    cin >> n >> k;
    for(int i = 0; i < n; i++){
        cin >> h[i];
    }
    sort(h, h+n);
    ll ans = 0;
    ll memans = 0;
    ans = h[k-1]-h[0];

    for(int i = k; i < n; i++){
        if(ans > h[i]-h[i-k+1]) ans = h[i]-h[i-k+1];
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
S = input()

a = int(S[:2])
b = int(S[2:])

if 1 <= a <= 12:
    if 1 <= b <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1 <= b <= 12:
        print("YYMM")
    else:
        print("NA")


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,d;
    cin>>d>>n;

    if(n == 100) n++;

    if(d == 0) cout<<n<<endl;

    else if (d == 1) cout<<n<<"00";

    else if( d == 2) cout<<n<<"0000";


    cout<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>


int main(void){
	int h,n;
	long long int x;
	int a[100000];
	int i;
	x = 0;
	scanf("%d %d",&h,&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
		x += a[i];
	}

	if(x < h){
		printf("No\n");
	}else{
		printf("Yes\n");
	}


	return 0;
}



Measured memory_bytes: 512
// Problem Link: 
// Tutorial Link: 

#include<bits/stdc++.h>
 
using namespace std;
 
#define LL long long
#define ll  long long
#define all(v) v.begin(), v.end()
#define pb push_back
#define pLL pair<LL,LL>
#define ff first
#define ss second
#define rep(i,a,b) for(LL i=a;i<b;++i)
#define repb(i,a,b) for(LL i=a;i>b;--i)
#define ld double
#define mp make_pair
#define vLL vector<LL>
#define vpLL vector<pLL>
#define vld vector<ld>
#define pld pair<ld,ld>
#define vpld vector<pld>
#define SLL set<LL>
#define SpLL set<pLL>
#define FIO ios::sync_with_stdio(false)
#define mod 1000000007

LL a,b,c,k;

int main()
{
	FIO;
	cin >> a >> b >> c >> k;
	LL cnt = 0;
	while(b <= a && cnt < k) {
		b *= 2;
		cnt++;
	}
	while(c <= b && cnt < k) {
		c *= 2;
		cnt++;
	}
	if(a < b && b < c) cout << "Yes\n";
	else cout << "No\n";
}

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

const int MAX = 500000;
const int SENTINEL = 2000000000;

int L[MAX/2+1], R[MAX/2+1];
int cnt;

void merge(int A[], int left, int right, int mid){
  int n1 = mid - left;
  int n2 = right - mid;
  for(int i=0;i<n1;i++) L[i] = A[left + i];
  for(int i=0;i<n2;i++) R[i] = A[mid + i];
  L[n1] = SENTINEL;
  R[n2] = SENTINEL;
  int i = 0, j = 0;
  for(int k=left;k<right;k++){
    cnt++;
    if(L[i] <= R[j]){
      A[k] = L[i++];
    }
    else{
      A[k] = R[j++];
    }
  }
}

void mergesort(int A[], int left, int right){
  if(right - left > 1){
    int mid = (left + right) / 2;
    mergesort(A, left, mid);
    mergesort(A, mid, right);
    merge(A, left, right, mid);
  }
}

int main(){
  int n;
  cin >> n;
  int S[MAX];
  for(int i=0;i<n;i++){
    cin >> S[i];
  }
  mergesort(S, 0, n);
  for(int i=0;i<n;i++){
    if(i != n-1) cout << S[i] << " ";
    else cout << S[i] << endl;
  }
  cout << cnt << endl;
  return 0;
}



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

int main() {
    string s; cin >> s;
    if (s == "SUN") cout << 7;
    else if (s == "MON") cout << 6;
    else if (s == "TUE") cout << 5;
    else if (s == "WED") cout << 4;
    else if (s == "THU") cout << 3;
    else if (s == "FRI") cout << 2;
    else if (s == "SAT") cout << 1;
    cout << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define Mid (l+r)/2
const int mod=1e9+7,inf=0x3f3f3f3f,maxn=1e5+5;
int n,m,Q,K;

int read(){
    int x=0,f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=(x<<1)+(x<<3)+c-'0';c=getchar();}
    return x*f;
}



signed main(){
//  freopen("a.in","r",stdin);
//  freopen("a.out","w",stdout);
string s;
cin>>s;
int ans=0;
    for(int i=0;i<s.size()/2;++i){
        if(s[i]!=s[s.size()-1-i])ans++;
    }
    cout<<ans<<endl;



    return 0;
}

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

typedef long int lint;
typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<long, long> pll;

#define EACH(i, c) for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i, s, e) for (int i = (s); i < (int)(e); ++i)
#define REP(i, n) FOR(i, 0, n)
#define endl '\n'
#define mod 1000000007
#define INF 100000000
#define fk first
#define sv second

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

template<typename T>
void print(const std::vector<T>& v, char sep=' ') {
  for (int i = 0; i < (int)v.size(); i++) {
    if (i != 0) cout << sep;
    cout << v[i];
  }
  cout << endl;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b, w;

  cin >> w >> a >> b;

  int c = min(a, b);
  int d = max(a, b);
  if (c + w > d) {
    cout << "0\n";
  }
  else {
    cout << d - (c + w) << endl;
  }
}



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

const int N = 310;
const int mod = 1e9 + 123;
const int BASE = 26;

int n;
char a[N][N], b[N][N];
int row[N], col[N];

int binpow(int a, int b) {
	int ret = 1;
	while(b) {
		if (b & 1) ret = 1LL * ret * a % mod; a = 1LL * a * a % mod;
		b >>= 1;
	}
	return ret;
}

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

	cin >> n;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			cin >> a[i][j];
		}
	}

	int pw_n = binpow(BASE, n - 1);

	int res = 0;
	for (int A = 0; A < n; ++A) {
		for (int i = 0; i < n; ++i) {
			for (int j = 0; j < n; ++j) {
				b[i][j] = a[(i + A) % n][j];
			}
		}
		for (int i = 0; i < n; ++i) {
			row[i] = 0;
			for (int j = 0; j < n; ++j) row[i] = (1LL * row[i] * BASE + b[i][j] - 'a') % mod;
		}
		for (int j = 0; j < n; ++j) {
			col[j] = 0;
			for (int i = 0; i < n; ++i) col[j] = (1LL * col[j] * BASE + b[i][j] - 'a') % mod;
		}

		for (int B = 0; B < n; ++B) {
			// check
			bool ok = true;
			for (int i = 0; i < n; ++i) {
				if (row[i] != col[(i + B) % n]) {
					ok = false; break; 
				}
			}
			res += ok;

			// shift
			for (int i = 0; i < n; ++i) {
				int cur = b[i][B] - 'a';
				row[i] = (row[i] - 1LL * cur * pw_n) % mod;
				row[i] = (1LL * row[i] * BASE + cur) % mod;
				if (row[i] < 0) row[i] += mod;
			}
		}
	}

	cout << res << '\n';
}

Measured memory_bytes: 512
import sys
sys.setrecursionlimit(10**7)
input=sys.stdin.readline
def dfs(v,p):
    if res_v[v]!=-1:
        return res_v[v]
    size[v]=len(G[v])
    dp[v]=[0]*size[v]
    res=1
    for i in range(size[v]):
        nv=G[v][i]
        if nv==p:
            p_i[v]=i
            continue
        R=dfs(nv,v)
        dp[v][i]=R
        res=res*(R+1)%MOD
    return res
    
def reroot(v,res_p,p):
    if p!=-1:
        dp[v][p_i[v]]=res_p
    for i in range(size[v]):
        ans[v]=ans[v]*(dp[v][i]+1)%MOD
    dp_L=[1]*(size[v]+1)
    dp_R=[1]*(size[v]+1)
    for i in range(size[v]):
        dp_L[i+1]=dp_L[i]*(dp[v][i]+1)%MOD
    for i in reversed(range(size[v])):
        dp_R[i]=dp_R[i+1]*(dp[v][i]+1)%MOD
        
    for i in range(size[v]):
        nv=G[v][i]
        if nv==p:
            continue
        reroot(nv,dp_L[i]*dp_R[i+1]%MOD,v)

N,MOD=map(int,input().split())
G=[[] for i in range(N)]
for i in range(N-1):
    x,y=map(lambda x:int(x)-1,input().split())
    G[x].append(y)
    G[y].append(x)
res_v=[-1]*N
dp=[[] for i in range(N)]
size=[-1]*N
p_i=[-1]*N
dp_L=[[] for i in range(N)]
dp_R=[[] for i in range(N)]
ans=[1]*N

z_root=dfs(0,-1)
res_v[0]=z_root
reroot(0,0,-1)
print(*ans,sep='\n')


Measured memory_bytes: 148172
#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 X first
#define Y second
#define all(x) x.begin(), x.end()
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
	enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int mod = (int)1e9 + 7;
const int MX = (int)1e5 + 10;

void add_self(int &x, int y){x += y; if(x >= mod) x -= mod;}
void sub_self(int &x, int y){x -= y; if(x < 0) x += mod;}
void mul(int &x, int y){x = x * 1LL * y % mod;}


int main(){

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

	int n;
	cin >> n;
	vector<int> a(n);
	for(auto &x : a) cin >> x;

	ll res = 0;

	/* 1 2 3 5 4 */
	stack<pair<int, int>> stk;
	int it = 0;
	for(auto &x : a){
		while(!stk.empty() && stk.top().X > x){ // delete those mins, can never be used
			int y, idx;
			tie(y, idx) = stk.top();
			stk.pop();
			int prv = stk.empty() ? -1 : stk.top().Y;
			res += y * 1LL * (it - idx) * (idx - prv);
		}
		stk.push({x, it++});
	}

	while(!stk.empty()){
		int y, idx;
		tie(y, idx) = stk.top();
		stk.pop();
		int prv = stk.empty() ? -1 : stk.top().Y;
		res += y * 1LL * (n - idx) * (idx - prv);
	}

	cout << res << endl;

	return 0;
}

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

int main() {
	int a, b;
	cin >> a >> b;
	if (a <= 5) {
		cout << 0 << endl;
	}
	else if (a > 5 && a <= 12) {
		cout << b / 2 << endl;
	}
	else {
		cout << b << endl;
	}
}


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

int n;
int t[102];
string s, alpha;
int idx[128];

int main(){
  alpha = "";

  for(int i = 0; i < 26; i++){
    char ch = 'A' + i;
    alpha += ch;
    idx[ch] = i;
  }
  for(int i = 0; i < 26; i++){
    char ch = 'a' + i;
    alpha += ch;
    idx[ch] = i + 26;
  }

  while(cin >> n, n){
    for(int i = 0; i < n; i++){
      cin >> t[i];
    }

    cin >> s;

    for(int i = 0; i < s.size(); i++){
      int md = i % n;
      s[i] = alpha[(idx[s[i]] + 52 - t[md]) % 52];
    }

    cout << s << endl;
  }
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
 
using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int mod = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2> 
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
 
 
 
VI dice(const VI& cr, int z){
	auto nc = cr;
	if(z==0){  
		nc[0] = 7 - cr[1]; nc[1] = cr[0];
	}else if(z==1){
		nc[0] = 7 - cr[2];  nc[2] = cr[0];
	}else if(z==2){ 
		nc[0] = cr[1]; nc[1] = 7 - cr[0];
	}else if(z==3){ 
		nc[0] = cr[2]; nc[2] = 7 - cr[0];
	}else if(z==4){  
		nc[1] = 7 - cr[2]; nc[2] = cr[1];
	}else { 
		nc[1] = cr[2]; nc[2] = 7 - cr[1];
	}
	return nc;
}
 
 
int main(){
	int n;
	cin >>n;
	vector<VI> ds(n, VI(6));
	rep(i,n) rep(j,6) cin >> ds[i][j];
	
	vector<int> cr = {1,3,2};
	set<VI> st;
	rep(g, 7){
		rep(i,4){
			cr = dice(cr, 7);
			st.insert(cr);
		}
		cr = dice(cr, g<3? 1: 2);
	}
	vector<set<VI>> nst(n);
	rep(i,n) for(auto x: st){
		VI w1 = {ds[i][x[0]-1], ds[i][x[1]-1],ds[i][x[2]-1]};
		nst[i].insert(w1);
	}
	bool same=false;
	rep(i,n) rep2(j,i+1,n){
		if( nst[i] == nst[j] ){ same=true; break;}
	}
	cout <<(same? "No": "Yes") <<"\n";
	return 0;
}


Measured memory_bytes: 3404
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (ll)(v).size()
#define inf 1e18
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(o,0,n)cout<<v[o]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
#define M 100010


int main(){
    
    ll n;cin>>n;
    vll v;
    ll n1=n,ans=0;
    for(ll i=2;i*i<=n1;++i){
    	if(n%i==0){
    		ll p=i,cnt=0;
    		while(n%p==0)n/=p,cnt++;
    		v.pb(cnt);
    	}
    }
    if(n>1)v.pb(1);
    rep(i,0,sz(v)){
    	ll c=1;
    	while(c<=v[i])v[i]-=c,c++,ans++;
    }
    cout<<ans;
    
    
    return 0;
}

Measured memory_bytes: 3644
import numpy as np
N = int(input())
a = np.zeros((N))
for i in range(N):
  a[i] = int(input())
A_i = np.argsort(a)
A = np.sort(a)
for j in range(N):
  if(j==A_i[N-1]):
    print(int(A[N-2]))
  else:
    print(int(A[N-1]))

Measured memory_bytes: 31504
#include<cstdio>
#include<cstring>
const int maxn=1010;
int n,m;
bool mp[maxn][maxn];
char vs[maxn];
bool tg;
int na,nb,nm;
int f[maxn][maxn];
int ans;
int In() {
	register char c;
	for(;c=getchar(),c<'0'||c>'9';);
	register bool f=c=='-';
	register int s=f?0:c-'0';
	for(;c=getchar(),c>='0'&&c<='9';)s=s*10+c-'0';
	return f?-s:s;
}
void cmax(register int &a,register int b) {
	a<b?a=b:0;
}
int dmin(register int a,register int b) {
	return a<b?a:b;
}
void dfs(int x) {
	if(vs[x]==2) ++na;
	else ++nb;
	for(int i=1;i<=n;++i)if(i!=x&&!mp[x][i]) {
		if(!vs[i]) vs[i]=vs[x]^1,dfs(i);
		else if(vs[x]==vs[i]) tg=1;
	}
}
int main() {
	n=In(),m=In();
	for(register int i=1,x,y;i<=m;++i)x=In(),y=In(),mp[y][x]=mp[x][y]=1;
	memset(f,192,sizeof f);
	f[0][0]=0;
	for(register int i=1;i<=n&&!tg;++i)if(!vs[i]) {
		na=nb=0,++nm;
		vs[i]=2,dfs(i);
		if(tg) break;
		for(register int j=na;j<=n;++j)cmax(f[nm][j],f[nm-1][j-na]+nb);
		for(register int j=nb;j<=n;++j)cmax(f[nm][j],f[nm-1][j-nb]+na);
	}
	if(tg) return puts("-1"),0;
	for(register int i=1;i<=n;++i)cmax(ans,dmin(f[nm][i],i));
	printf("%d\n",ans*(ans-1)/2+(n-ans)*(n-ans-1)/2);
	return 0;
}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
#include <string.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m; i < n; i++) 
typedef long long int ll;
int main(){
    int N;
    cin>>N;
    vector<int>A(N);
    rep(i,N){
        cin>>A.at(i);
    }
    map<int,int>ma;
    for(auto x:A){
        ma[x]++;
    }
    set<int>s;
    int count=0;
    for(auto x:A){
        if(s.count(x)){
            continue;
        }
        if(ma.at(x)%2!=0){
            count++;
        }
        s.insert(x);
    }
    cout<<count<<endl;




    return 0;
}

Measured memory_bytes: 9984
#include <cmath>
#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
	double a, b, C;
	cin >> a >> b >> C;

	C *= M_PI / 180.0;
	double h = b * sin(C);
	double c = sqrt(a*a + b*b - 2.0*a*b*cos(C));

	cout << fixed << setprecision(4);
	cout << 0.5*a*h << ' ';
	cout << a+b+c << ' ';
	cout << h << endl;

	return 0;
}



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

int f(int n){
	return n-(n/10)*10;
}

int main() {
	
	string nums;
	int n[10];
	
	while(getline(cin,nums)){
		
		for(int i=0;i<10;++i){
			n[i] = nums[i] - '0';
		}
		
		for(int i=9;i>=0;--i){
			for(int j=0;j<i;++j){
				n[j] =f( n[j] + n[j+1] );
			}
		}
		
		cout << n[0] << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1172
n, h = gets.split.map(&:to_i)
a = Array.new(n){gets.split.map(&:to_i)}
amax = a.map{|x, y| x}.inject{|x, y| x > y ? x : y}
b = a.map{|x, y| y}.select{|x| x > amax}.sort_by{|x| -x}
cnt = 0
while b.size > 0
  cnt += 1
  h -= b.shift
  if h <= 0
    puts cnt
    exit
  end
end
puts cnt + (h.to_f / amax).ceil

Measured memory_bytes: 14968
#include <iostream>
#include <vector>
#include <iostream>
#include <cstdio>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <algorithm>
#include <cmath>
#include <queue>
#include <deque>
#include <stack>
 
#define ll long long
#define pb push_back
#define vi vector<int>
#define sz(a) (int((a).size()))
#define mp make_pair
#define f first
#define s second
#define pii pair<int, int>
 
using namespace std;
 
const int mod = 998244353;
const int inf = (int)2e9;
const ll INF = (ll)2e18;
const int N = 100100;

int n, a[111], ans = inf;

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> a[i];

	for (int i = -100; i <= 100; i++) {
		int cur = 0;
		for (int j = 1; j <= n; j++) {
			cur += (a[j] - i) * (a[j] - i);
		}
		ans = min(ans, cur);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
from sys import stdin
from itertools import repeat
def main(mn=min):
    n = int(stdin.readline())
    dat = map(int, stdin.read().split(), repeat(10, 3 * n - 3))
    last = [None] * (n + 1)
    xt = [None] * (3 * n - 3)
    co = [None] * (3 * n - 3)
    for i in xrange(n - 1):
        x, y, c = dat[i*3:i*3+3]
        xt[i*3] = last[y]
        xt[i*3+1] = last[x]
        last[y] = i * 3
        last[x] = i * 3 + 1
        co[i*3] = co[i*3+1] = c
    st = [1]
    pu = st.append
    po = st.pop
    d = [None] * (n + 1)
    ch = [0] * (n + 1)
    ans = ok = 0
    ce = []
    while st:
        x = po()
        if d[x] is None:
            pu(x)
            d[x] = 0
            y = last[x]
            while y is not None:
                z = dat[y]
                if d[z] is None:
                    pu(z)
                y = xt[y]
        else:
            ch[x] = 1
            d[x] = 1
            y = last[x]
            bc = 0
            while y is not None:
                z = dat[y]
                if d[z]:
                    f = mn(ch[z], n - ch[z]) * 2
                    ans += co[y] * f
                    if ch[z] * 2 > n:
                        bc = 1
                    ch[x] += ch[z]
                y = xt[y]
            if not bc and (n - ch[x]) * 2 <= n:
                ce.append(x)
    mco = 1001001001
    if len(ce) == 2:
        i = ce[0]
        y = last[i]
        while y is not None:
            if dat[y] == ce[1]:
                mco = co[y]
            y = xt[y]
    else:
        i = ce[0]
        y = last[i]
        while y is not None:
            mco = mn(mco, co[y])
            y = xt[y]
    print ans - mco
main()


Measured memory_bytes: 28832
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#define int long long

template <class T>
bool INRANGE(T x, T a, T b) { return a <= x && x <= b; }
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;}
template <class T>
void printv(vector<T> v) {for (T t : v) {cout << t << " ";}cout << '\n';}

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

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

    int N;
    cin >> N;

    if (N%2 != 0) {
        cout << 0 << endl;
        return 0;
    }

    vi d(N);
    REP(i,N) cin >> d[i];

    sort(ALL(d));

    cout << d[N/2] - d[N/2-1] << endl;

    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#include<tr1/unordered_map>
#define pb push_back
#define lowbit(x) ((x)&-(x))
#define pii pair<int,int>
#define SZ(x) (int)x.size()
#ifdef __linux__
#define getchar getchar_unlocked
#endif
#define mem(a,b) memset(a,b,sizeof(a))
#define  For(i,a,b) for(int i=a,i##E=b;i<=i##E;++i)
#define rFor(i,a,b) for(int i=a,i##E=b;i>=i##E;--i)
typedef long long LL;
using namespace std;
const int N=100010;
const int inf=0x3f3f3f3f;
template<typename T>inline bool chkmin(T &a,const T &b){return a>b?a=b,1:0;}
template<typename T>inline bool chkmax(T &a,const T &b){return a<b?a=b,1:0;}
template<typename T>inline void read(T &x)
{
	x=0;int _f(0);char ch=getchar();
	while(!isdigit(ch))_f|=(ch=='-'),ch=getchar();
	while( isdigit(ch))x=x*10+ch-'0',ch=getchar();
	x=_f?-x:x;
}
inline void file()
{
#ifdef ztzshiwo
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
#endif
}
int n,c[N][2],type[N],tot,dep[N];
char S[N];
LL ans,L;
inline void insert()
{
	int p=1;
	For(i,0,strlen(S)-1)
	{
		int x=S[i]-'0';
		if(!c[p][x])
		{
			c[p][x]=++tot;
			dep[tot]=dep[p]+1;
		}
		type[p]=1;
		p=c[p][x];
	}
	type[p]=2;
}
inline void bfs()
{
	queue<int>q;
	q.push(1);
	while(!q.empty())
	{
		int u=q.front();q.pop();
		if(type[u]==2)continue;
		if(c[u][0])q.push(c[u][0]);
		else ans^=lowbit(L-dep[u]);
		if(c[u][1])q.push(c[u][1]);
		else ans^=lowbit(L-dep[u]);
	}
}
int main()
{
	file();
	read(n),read(L);
	tot=1;
	For(i,1,n)
	{
		scanf("%s",S);
		insert();
	}
	bfs();
	if(ans)puts("Alice");else puts("Bob");
	return 0;
}


Measured memory_bytes: 1920
def solve():
    A= int(input())
    B= int(input())
    C = int(input())
    X = int(input())
    count = 0
    for i in range(A+1):
        for j in range(B+1):
            for k in range(C+1):
                if i*500 + j*100 + k*50 == X:
                    count += 1
    return print(count)

if __name__ == '__main__':
    solve()


Measured memory_bytes: 3060
# INPUT
n = int(input())

# PROCESS

def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i:
        divisors.append(n//i)
  return divisors

answer = 0
for i in range(1, n+1):
  if (i % 2 == 0):
    continue
  else:
    yakusu = make_divisors(i)
    if (len(yakusu) == 8):
      answer += 1

# OUTPUT
print(answer)


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <math.h>
#include <stdio.h>
#define INF 1000000000
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
typedef long long int ll;
using namespace std;

int main() {

	int n, a, b; cin >> n >> a >> b;
	if (n * a >= b) { cout << b << endl; }
	else { cout << n * a << endl; }

	return 0;
}

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

int main() {
    int N; cin >> N;
    vector<pair<int, int>> ba(N);
    REP(i, 0, N) cin >> ba[i].second >> ba[i].first;

    sort(ba.begin(), ba.end());
    ll cur = 0;
    REP(i, 0, N) {
        if (cur + ba[i].second <= ba[i].first) {
            cur += ba[i].second;
        } else {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 1792
import javax.xml.crypto.Data;
import java.util.*;
import java.io.*;

public class Main {
    public static int SENTINEL = 100000007;
    public static int MAX = 10007;
    public static int NIL = -1;

    public static int[] dp = new int[100];


    public static void main(String[] args) throws IOException {

        //??\???
        /*
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] str = br.readLine().split(" ");
        */

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int q = sc.nextInt();
        P[] PP = new P[n];
        Queue<P> Q = new ArrayDeque<P>();

        for(int i = 0; i < n; i++) {
            PP[i] = new P(sc.next(), sc.nextInt());
            Q.offer(PP[i]);
        }

        int T = 0;
        while(!Q.isEmpty()) {
            P Process = Q.poll();
            if(Process.time <= q) {
                T += Process.time;
                System.out.print(Process.name + " " + T);
                System.out.println();
            }
            else {
                T += q;
                P newProcess = new P(Process.name, Process.time - q);
                Q.offer(newProcess);
            }
        }
    }

}

class Stack {
    int top;
    int MAX = 100007;
    int[] S = new int[MAX];

    Stack() {
        top = 0;
    }
    boolean isEmpty() {
        return top == 0;
    }
    boolean isFull() {
        return top > MAX;
    }
    void push(int x) {
        if(isFull()) return;
        top++;
        S[top] = x;
    }
    int pop() {
        if(isEmpty()) return -1;
        top--;
        return S[top + 1];
    }
}


class P {
    String name;
    int time;
    P(String n, int t) {
        name = n;
        time = t;
    }
}

Measured memory_bytes: 74476
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>



using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const double EPS = 1e-10;
long long const MOD = 1000000007;

long long mod_pow(long long x, long long n) {
    long long res = 1;
    for (int i = 0;i < 60; i++) {
        if (n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

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

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

void fastInput() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

vector<long long> Divisor(long long n) {
    vector<long long> ret;
    for(long long i=1; i*i<=n; i++) {
        if(n % i == 0) {
            ret.push_back(i);
            if(i*i!=n) ret.push_back(n / i);
        }
    }
    return ret;
}

int main(void) {
    int N; cin >> N;
    vector<int> a(N+1);
    for (int i = 1; i <= N; i++) {
        cin >> a[i];
    }

    vector<int> ans;
    vector<int> cnt(N+1);
    for (int i = N; i >= 1; i--) {
        vector<long long> divs = Divisor(i);
        if (cnt[i]%2 != a[i]) {
            ans.push_back(i);
            for (auto &j : divs) {
                cnt[j]++;
            }
        }
    }
    cout << ans.size() << endl;
    for (auto &i : ans) {
        cout << i << endl;
    }
    
}

Measured memory_bytes: 3064
#include<stdio.h>

int n,A[50];

int solve(int i,int m)
{
	if(m==0) return 1;
	if(i>=n) return 0;
	
	int res = solve(i+1,m) || solve(i+1,m-A[i]);
	return res;
	
}

int main(void)
{
	int q,M,i;
	
	scanf("%d",&n);
	for(i=0;i<n;i++) scanf("%d",&A[i]);
	
	scanf("%d",&q);
	for(i=0;i<q;i++)
	{
		scanf("%d",&M);
		if(solve(0,M)) printf("yes\n");
		else printf("no\n");
	}
	
	return 0;
}


Measured memory_bytes: 2092
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) ((x < 0)?-(x):x)
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

typedef long long cat;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int N, S;
	cin >> N >> S;
	vector< pair<int, cat> > A(N);
	for(int i = 0; i < N; i++) {
		cin >> A[i].ff >> A[i].ss;
		A[i].ff -= S;
	}
	int l = 0, r = N-1;
	vector<int> order;
	while(l < r && A[l].ff < 0 && A[r].ff > 0) {
		if(A[l].ss >= A[r].ss) {
			order.push_back(A[r].ff);
			A[l].ss += A[r].ss;
			r--;
		}
		else {
			order.push_back(A[l].ff);
			A[r].ss += A[l].ss;
			l++;
		}
	}
	if(A[l].ff < 0) for(int i = l; i <= r; i++) order.push_back(A[i].ff);
	else for(int i = r; i >= l; i--) order.push_back(A[i].ff);
	order.push_back(0);
	cat ans = 0;
	for(int i = 1; i < (int)order.size(); i++) ans += abs(order[i]-order[i-1]);
	cout << ans << "\n";
	return 0;
}

// look at my code
// my code is amazing


Measured memory_bytes: 2428
import java.util.Arrays;
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int[] n = new int[3];
        for(int i=0;i<3;++i)n[i]=scan.nextInt();
        Arrays.sort(n);
        int ans = 0;
        while(n[1]<n[2]){
            ++ans;
            n[0]++;
            n[1]++;
        }
        while(n[0]<n[1]){
            ++ans;
            n[0]+=2;
        }
        if(n[0]>n[1])++ans;
        System.out.println(ans);


    }
}

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

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

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
  long long n,m,k,a;
  map<long long,long long> tab;
  cin >> n >> m;
  REP(i, n){
    cin >> k;
    REP(j, k){
      cin >> a;
      //cout << a << ": " << tab[a] << "->" << (tab[a]+1) << endl;
      tab[a]++;
    }
  }

  int count = 0;
  REP(i, m) {
    //cout << (i+1) << ": "<< tab[i+i] << endl;
    if(tab[i+1] == n) count++;
  }

  cout << count << endl;
    // Failed to predict input format
    return 0;
}


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

using namespace std;

void solve() {
  ll N;
  cin >> N;
  vector<ll> X(N);
  rep (i, N) cin >> X[i];

  ll ans = 0;
  rep (i, N) ans += (X[i] - 1) * (X[i] - 1);

  for (ll aaa = 2; aaa <= 100; aaa++) {
    ll tmp = 0;
    rep (i, N) tmp += (X[i] - aaa) * (X[i] - aaa);
    ans = min(ans, tmp);
  }

  cout << ans << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  cout << fixed;
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<eps)
int main()
{
	int a[5];
	while(1)
	{
		int t[4]={0};
		for(int i=0;i<5;i++)
		{
			cin >> a[i];
			if(a[i]==0)goto end;
			t[a[i]]++;
		}
		int cnt=0;
		for(int i=1;i<=3;i++)if(t[i]==0)cnt++;
		if(cnt==0||cnt==2)
		{
			for(int i=0;i<5;i++)cout << 3 << endl;
		}
		else
		{
			if(t[2]==0)
			{
				for(int i=0;i<5;i++)
				{
					if(a[i]==3)cout << 1 << endl;
					else cout << 2 << endl;
				}
			}
			else
			{
				int win=100;
				for(int i=1;i<=3;i++)
				{
					if(t[i]==0)continue;
					else win=min(win,i);
				}
				for(int i=0;i<5;i++)
				{
					if(a[i]==win)cout << 1 << endl;
					else cout << 2 << endl;
				}
			}
		}
	}
	end:;
	return 0;
}

Measured memory_bytes: 1160
n = int(input())
s = list(map(int, input().split()))

ans = 0
for d in range(1, (n-1)//2+1):
    ans_cur = 0
    l, r = 0, n-1
    while r > d and l != r and l != r+d:
        ans_cur += s[l]+s[r]
        ans = max(ans, ans_cur)
        l += d
        r -= d
print(ans)

Measured memory_bytes: 14464
#include<stdio.h>
int main(void) {
	int N, a;
	scanf("%d", &N);

	a = N / 10;
	a %= 10;
	if (N % 10 == 7) {
		printf("Yes");
	}
	else if (700 <= N && N < 800) {
		printf("Yes");
	}
	else if (a == 7) {
		printf("Yes");
	}
	else {
		printf("No");
	}
	return 0;
}





Measured memory_bytes: 1708
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

use std::iter::Iterator;

fn main() {

    input!{
       R:usize,
    }

    let mut S = "";

    if R < 1200 {
        S = "ABC"
    }else if  1200 <= R && R < 2800 {
        S = "ARC"
    }else{
        S = "AGC"
    }

    println!("{}", S);

}


Measured memory_bytes: 4352
#include <bits/stdc++.h> 
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
#define mod  1000000007
#define mp make_pair
#define pb push_back
#define sd second
#define mod  1000000007
#define ft first
#define all(x) x.begin(),x.end()
#define alr(x) x.rbegin(),x.rend()
#define endl '\n'
#define cnl cout<<endl;
#define pi  3.141592653589793238
#define ms(x,v) ((x), v, sizeof((x)))
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++) 
ll i,j,k;
void solve(){
        ll n ; cin >> n;
        ll ans = 1; 
        ll res = 1;
        while(n>1){
            n /= 2; 
            res = res*2; 
            
            ans = ans+ res;
        }
            cout<< ans << endl;
     return ; 
} 
    signed main(){
    
    //CASET
    solve();
    
   
    return 0;
  }

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

int main() {
  
  int a=0, b=0;
  
  cin >> a >> b;
  
  if(a==b || a<b) {
    
    cout << a << endl;
    
  } else if(b<a) {
    
    cout << a-1 << endl;
    
  }
  
  return 0;
  
}

Measured memory_bytes: 256
#include <stdio.h>
#include<vector>
#include<iostream>
#include<string>
#include<deque>
#include<queue>
#include<stack>
#include<list>
#include<cmath>
#include<algorithm>
using namespace std;


int main() {
	long long int a, b;
	cin >> a>> b;
	long long int sum = 0;
	if (a % 2 == 1) { sum ^= a; a++; }
	if (b % 2 == 0) { sum ^= b; b--; }
	if (((b - a+1) / 2) % 2 == 1)sum ^= 1;

		
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256