akhauriyash/Code-Regression huggingface dataset:
from itertools import permutations

n=int(input())
p=tuple(map(int,input().split()))
q=tuple(map(int,input().split()))

a=[i for i in range(1,n+1)]
#aa=permutations(a)
l=[]
l=[aa for aa in permutations(a)]
l=sorted(l)
for i in range(len(l)):
 if l[i]==p:
  pp=i
 if l[i]==q:
  qq=i
print(abs(pp-qq))

Measured memory_bytes: 8308
#include<iostream>
#include<cstdio>
#include<vector>
#define P pair<int,int>
using namespace std;

int a, b, x[6] = { -1,-1,0,0,1,1 }, y[2][6] = { { 0,1,-1,1,0,1 },{-1,0,-1,1,-1,0}};
char c[105][105]{};
bool f;
vector<P>V;
void shima(int a, int b) {
	c[a][b] = 2;
	V.push_back(P(a, b));
	for (int i = 0; i < 6; i++) {
		switch (c[a + x[i]][b + y[a & 1][i]]) {
		case 0:f = false; break;
		case '0':shima(a + x[i], b + y[a & 1][i]);
		}
	}
}
int main() {
	cin >> b >> a;
	for (int d = 2; d <= a+1; d++) {
		for (int e = 2; e <= b+1; e++) {
			cin >> c[d][e];
		}
	}
	for (int d = 2; d <= a+1; d++) {
		for (int e = 2; e <= b+1; e++) {
			if (c[d][e] == '0') {
				f = true;
				V.clear();
				shima(d, e);
				if(f)for (int k = 0; k < V.size(); k++)c[V[k].first][V[k].second] = '1';
			}
		}
	}
	int sum = 0;
	for (int d = 1; d <= a+2; d++) {
		for (int e = 1; e <= b+2; e++) {
			for (int f = 0; f < 6; f++) {
				if (c[d][e] == '1'^c[d + x[f]][e + y[d & 1][f]] == '1')sum++;
			}
		}
	}
	cout << sum/2 << endl;
}

Measured memory_bytes: 3544
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

const ll L=26;

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

  ll N;
  cin>>N;

  N--;

  ll num=L;
  int p=1;
  while(1){
    if(N>=num){
      N-=num;
      num=num*L;
      p++;
    }else break;
  }

  string ans(p,'a');
  for(int i=1;i<=p;i++){
    ans[i-1]=char('a'+N%26);
    N/=26;
  }

  reverse(all(ans));
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdio>
#include <map>
#include <complex>
#include <climits>
using namespace std;

typedef int lli;
typedef complex<lli> P;

const double pi = acos(-1);
const double eps = 1e-8;
const lli inf = INT_MAX;

const int MAXN = 100000000;
int N;
P *A;

bool compare_y(P a, P b) {
  return a.imag() < b.imag();
}

lli closest_pair(P *a, int n) {
  if(n <= 1) return inf;
  int m = n / 2;
  lli x = a[m].real();
  lli d = min(closest_pair(a, m), closest_pair(a+m, n-m));
  inplace_merge(a, a + m, a + n, compare_y);

  vector<P> b;
  for(int i = 0; i < n; ++i) {
    if(labs(a[i].real() - x) >= d) continue;
    for(int j = 0; j < b.size(); ++j) {
      lli dx = a[i].real() - b[b.size() - j - 1].real();
      lli dy = a[i].imag() - b[b.size() - j - 1].imag();
      if(dy >= d) break;
      d = min(d, (dx * dx + dy * dy));
    }
    b.push_back(a[i]);
  }
  return d;
}

int main() {
  cin >> N;
  A = new P[N];
  for(int i = 0; i < N; ++i) {
    cin >> A[i].real() >> A[i].imag();
  }
  lli res = closest_pair(A, N);
  cout << res << endl;
}

Measured memory_bytes: 10704
INF=100000000000000
def warshall_floyd(D):
    for k in range(V):
        for i in range(V):
            for j in range(V):
                D[i][j]=min(D[i][j],D[i][k]+D[k][j])

if __name__ == "__main__":
    V,E=map(int,input().split())
    D=[[INF if j!=i else 0 for j in range(V)] for i in range(V)]
    dall=0

    for i in range(E):
        s,t,d=map(int,input().split())
        D[s][t]=d
        if d>=0:
            dall+=d

    warshall_floyd(D)
    flg=False

    for i in range(V):
        if D[i][i]<0:
            flg=True
            break

    
    if flg:
        print("NEGATIVE CYCLE")
    else:
        #print('\n'.join(map(str,D[r])))
        for i in range(V):
            print(' '.join(["INF" if j>dall else str(j) for j in D[i]]))


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

using namespace std;

using ll = long long;

const ll MOD = 1000000007;

ll modpow(ll x, ll n, ll mod = MOD) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}

ll f[3005], fi[3005];
ll dp[3005][3005];

ll comb(int r, int c, ll m) {
    return f[r] * fi[c] % m * fi[r - c] % m;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    ll m;
    cin >> n >> m;
    
    f[0] = 1;
    for (int i = 1; i <= n; i++) f[i] = f[i - 1] * i % m;
    fi[n] = modpow(f[n], m - 2, m);
    for (int i = n; i >= 1; i--) fi[i - 1] = fi[i] * i % m;
    dp[0][0] = 1;
    for (int i = 1; i <= n; i++) {
        dp[i][0] = 1;
        for (int j = 1; j <= i; j++) {
            dp[i][j] = (dp[i - 1][j - 1] + dp[i - 1][j] * (j + 1) % m) % m;
        }
    }

    ll ans = 0;
    for (int i = 0; i <= n; i++) {
        ll tmp = 0;
        for (int j = 0; j <= i; j++) {
            (tmp += dp[i][j] * modpow(2, (n - i) * j, m)) %= m;
        }
        tmp = tmp * modpow(2, modpow(2, n - i, m - 1), m) % m;
        if (i % 2 == 0) (ans += comb(n, i, m) * tmp % m) %= m;
        else (ans += (m - comb(n, i, m) * tmp % m)) %= m;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 69120
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a,b,c,d,e,k;
    cin>>a>>b>>c>>d>>e>>k;
    if(e-a>k) cout << ":("<<"\n";
    else cout << "Yay!"<<"\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <limits>
#include <cmath>
#include <cassert>

using namespace std;
using ll = long long;

const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl

int change(int p, int x)
{
    return p * (100 + x) / 100;
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x, y, s;
    while(cin >> x >> y >> s, x or y or s)
    {
        int ans = 0;
        for(int i = 1; i < s; i++)
        {
            for(int j = 1; j < s; j++)
            {
                if(change(i, x) + change(j, x) != s) continue;
                ans = max(ans, change(i, y) + change(j, y));
            }
        }
        cout << ans << endl;
    }
    return 0;
}




Measured memory_bytes: 3160
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


# サイズが大きいとdefaultdictが早い(for文を書かなくて済む)
n = int(input())
ans = 0
for i in range(1,n+1):
    ans += i*(n-i+1)
for _ in range(n-1):
    u,v = map(int, input().split())
    ans -= min(u,v) * (n - max(u,v) + 1)
print(ans)

Measured memory_bytes: 68260
#include <cstdio>
#include <vector>
#include <algorithm>

int main() {
  int A, B, C, D, E, F;
  scanf("%d %d %d %d %d %d", &A, &B, &C, &D, &E, &F);
  A *= 100;
  B *= 100;

  std::vector<int> water, sugar;
  for (int i=0; i<=F; i+=A)
    for (int j=0; j<=F; j+=B)
      water.push_back(i+j);

  for (int i=0; i<=F; i+=C)
    for (int j=0; j<=F; j+=D)
      sugar.push_back(i+j);

  std::sort(water.begin(), water.end());
  water.erase(std::unique(water.begin(), water.end()), water.end());

  std::sort(sugar.begin(), sugar.end());
  sugar.erase(std::unique(sugar.begin(), sugar.end()), sugar.end());
  
  int W=A, S=0;
  for (int w: water)
    for (int s: sugar) {
      if (w*E < s*100) continue;
      if (w+s > F) continue;

      if (S*(w+s) < s*W) {
        W = w+s;
        S = s;
      }
    }

  printf("%d %d\n", W, S);
  return 0;
}


Measured memory_bytes: 2420
#pragma GCC target ("avx2")
#pragma GCC target ("sse2")
#pragma GCC optimize ("Ofast")
#pragma GCC push_options
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define __V vector
#define all(x) x.begin(), x.end()
#define rall(x) x.begin(), x.end()
#define oit ostream_iterator
#define mod 1000000007ll
using namespace std;
void doin() {
	cin.tie();
	cout.tie();
	ios::sync_with_stdio(0);
#ifndef ONLINE_JUDGE
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif
}
template<typename X, typename Y>
istream& operator>>(istream& in, pair<X, Y> &a) {
	in >> a.first >> a.second;
	return in;
}
template<typename T>
void getv(T& i) {
	cin >> i;
}
template<typename T, typename ... Ns>
void getv(vector<T>& v, int n, Ns ... ns) {
	v.resize(n);
	for (auto& i : v)
		getv(i, ns...);
}
template<typename T>
void getv1(T& i) {
	cin >> i;
}
template<typename T, typename ... Ns>
void getv1(vector<T>& v, int n, Ns ... ns) {
	v.resize(n + 1);
	for (int i = 1; i <= n; i++)
		getv(v[i], ns...);
}
#ifdef _WIN32
#define getchar_unlocked() _getchar_nolock()
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
inline void getch(char &x) {
	while (x = getchar_unlocked(), x < 33) {
		;
	}
}
inline void getstr(string &str) {
	str.clear();
	char cur;
	while (cur = getchar_unlocked(), cur < 33) {
		;
	}
	while (cur > 32) {
		str += cur;
		cur = getchar_unlocked();
	}
}
template<typename T> inline bool sc(T &num) {
	bool neg = 0;
	int c;
	num = 0;
	while (c = getchar_unlocked(), c < 33) {
		if (c == EOF)
			return false;
	}
	if (c == '-') {
		neg = 1;
		c = getchar_unlocked();
	}
	for (; c > 47; c = getchar_unlocked())
		num = num * 10 + c - 48;
	if (neg)
		num *= -1;
	return true;
}
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef int _I;
typedef pair<_I, _I> pi;
typedef pair<ld, ld> pd;
typedef map<_I, _I> mii;
typedef __V <_I> vi;
typedef __V <char> vc;
typedef __V <ld> vd;
typedef __V <vd> vvd;
typedef __V <pi> vpi;
typedef __V <__V<_I>> vvi;
typedef __V <__V<char>> vvc;
typedef __V <__V<pi>> vvpi;
using AntonTsypko = void;
using arsijo = AntonTsypko;
using god = arsijo;
uniform_real_distribution<double> double_dist(0, 1);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng64(chrono::steady_clock::now().time_since_epoch().count());

int main() {
	doin();
	int n, m, cnt[1000], ans = 0;
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		int t;
		cin >> t;
		int k;
		for (int j = 0; j < t; j++)
			cin >> k, cnt[k]++;
	}
	for(int i = 1; i <= m; i++) if(cnt[i] == n) ans++;
	cout << ans;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
int main (void) {
    ll N;
    ll C;
    ll K;

    cin >> N >> C >> K;
    ll T[N];
    for (int i = 0; i < N; i++) {
        cin >> T[i];
    }

    sort(T, T + N);
    int ans = 1;
    ll now = T[0];
    int cnt = 1;
    for (int i = 1; i < N; i++) {
        if (T[i] - now > K || cnt >= C) {
            ans++;
            now = T[i];
            cnt = 1;
        } else {
            cnt++;
        }
    }

    cout << ans << endl;

    return 0;
}


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

typedef long long ll;

int n;
ll a, b;

ll solve(ll*, ll);
bool enough(ll*, ll);

int main(){
  cin >> n >> a >> b;
  ll h[n];

  ll M=0;
  for(int i=0; i<n; i++) {
    cin >> h[i];
    M = max(M, h[i]);
  }

  ll ans = solve(h, M); //配列と最大値を渡して、にぶたん

  cout << ans << endl;

  return 0;
}

ll solve(ll* h, ll M){
  ll l=0, m, r=M;

  while(l+1<r){
    m = (l+r)/2;
    if(enough(h, m)){
      r=m;
    }
    else l=m;
  }

  return r;
}

bool enough(ll* h, ll t){
  ll cnt=0;
  for(int i=0; i<n; i++){
    if(h[i]<b*t) continue;
    cnt += (ll)ceil((h[i]-b*t*1.0)/(a-b));
  }

  return (cnt<=t)? true: false;
}


Measured memory_bytes: 1024
#include"bits/stdc++.h"
#define rep(i,n) for(ll i=0;i<n;++i)
#define ALL(x) x.begin(),x.end()

using namespace std;
typedef long long ll;

template<typename T>
T gcd(T a, T b) {
    if (a % b == 0) {
        return(b);
    }
    else {
        return(gcd(b, a % b));
    }
}

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

int main(void) {
    int n;
    cin >> n;
    vector<int>l(n);
    rep(i, n) {
        cin >> l[i];
    }
    sort(ALL(l));
    int ans = 0;
    for (int i = 0; i < n - 2; ++i) {
        for (int j = i + 1; j < n - 1; ++j) {
            for (int k = j + 1; k < n; ++k) {
                if (l[k] < l[i] + l[j] && !(l[k] == l[i] || l[i] == l[j] || l[k] == l[j])) {
                    ++ans;
                }
            }
        }
    }
    cout << ans;
}

/*
*/


Measured memory_bytes: 3624
/*"Success isn't permanent, failure isn't fatal,
                                      it's the courage to continue that counts"*/
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define ll long long 
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
#define lpri(n) printf("%lld",n)
#define pri(n) printf("%d",n)
#define pln() printf("\n")
#define priln(n) printf("%d\n",n)
#define lpriln(n) printf("%lld\n",n)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define pb push_back     
#define mp make_pair
#define F first
#define S second
#define gcd __gcd
#define inf INT_MAX
#define ninf INT_MIN
const int mod=1e9+7;         
const int N=1e5+4;

int main()
{
	string s,t;

	cin>>s>>t;

	t.pop_back();

	if(s==t)cout<<"Yes";
	else
	cout<<"No";
    return 0;
}


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

const ll INF = ll(1e18)+1;
const ll MOD = ll(1e9)+7;


int main() {
  ll N;
  string S;

  cin >> N >> S;

  ll ans = 0;

  ll rgb = 0;


  ll num = 1;
  while(1) {

    if(num*2+1 > N) {
      break;
    }

    for (int i = 0; i < N-num*2; i++) {
      if(S.at(i) != S.at(i+num) && S.at(i+num) != S.at(i+num*2) && S.at(i) != S.at(i+num*2)) {
        rgb += 1;
      }
    }

    num += 1;
  }
  

  ll rnum = 0;
  ll gnum = 0;
  ll bnum = 0;

  for (int i = 0; i < N; i++) {
    if(S.at(i) == 'R') {
      rnum += 1;
    } else if(S.at(i) == 'G') {
      gnum += 1;
    } else if(S.at(i) == 'B') {
      bnum += 1;
    }
  }

  ans = rnum * gnum * bnum - rgb;

  cout << ans << endl;

  
  
  
  return 0;
}

Measured memory_bytes: 3640
def getlist():
	return list(map(int, input().split()))

N = int(input())
A = getlist()
j = 0
for i in range(N):
	if A[i] <= 0:
		j += 1
	A[i] = abs(A[i])

A = sorted(A)
if j % 2 == 0:
	print(sum(A))
else:
	print(sum(A) - 2 * A[0])

Measured memory_bytes: 14224
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int H = sc.nextInt();
        int W = sc.nextInt();
        System.out.println((N-H+1)*(N-W+1));
        sc.close();

    }

}


Measured memory_bytes: 21844
#include <iostream>
#define int long long
using namespace std;

int powmod(int a, int n, int mod) {
	if (n == 0) return 1;
	if (n % 2 == 0) return powmod((a * a) % mod, n / 2, mod);
	return (a * powmod(a, n - 1, mod)) % mod;
}

int mod = 1000000007;
int x, y;
int fact[2000001];
int finv[2000001];
int inv[2000001];

int comb(int n, int k) {
	return fact[n] * finv[k] % mod * finv[n - k] % mod;
}

signed main() {
	cin >> x >> y;
	
	int i;
	fact[0] = fact[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (i = 2; i <= 2000000; i++) {
		fact[i] = i * fact[i - 1] % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
	
	if ((x + y) % 3 != 0) { cout << 0 << endl; return 0; }
	int k = (x + y) / 3;
	
	x -= k;
	y -= k;
	if (x < 0 || y < 0) { cout << 0 << endl; return 0; }
	
	cout << comb(k, x) << endl;
	return 0;
}

Measured memory_bytes: 47104
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>
#include<iterator>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rep(i,n) for(int i=0; i<n; i++)

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, char> plc;

int main()
{
	int n;
	while (cin >> n, n) {
		int d = -10;
		stack<int> stk;
		while (abs(n) > 0) {
			int rem = (n % 10 < 0 ? n % 10 + 10 : n % 10);
			stk.push(rem);
			n = (n - rem) / d;
		}
		while (!stk.empty()) {
			cout << stk.top();
			stk.pop();
		}
		cout << endl;
	}
	return	0;
}

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

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  ll c=1000,s=0;
  cin >>n;
  vector<int> a(n);
  rep(i,n){
    cin >>a[i];
    if(i==0)continue;
    if(a[i]>a[i-1]){
      s+=c/a[i-1];
      c-=(c/a[i-1])*a[i-1];
    }else{
      c+=s*a[i-1];
      s=0;
    }
  }
  c+=s*a[n-1];
  cout <<c;
}


Measured memory_bytes: 3644
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, M] = [int(input_raw[0]), int(input_raw[1])]
    dic = {}
    for m in range(1, M + 1):
        dic[m] = 0

    for i in range(N):
        input_raw = read_func().strip().split()
        K = int(input_raw[0])
        for j in range(K):
            dic[int(input_raw[j + 1])] += 1

    count = 0
    for m in dic:
        if dic[m] == N:
            count += 1
    print count


if __name__ == '__main__':
    main()


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

    long long h[n];
    for (int i = 0; i < n; i++) cin >> h[i];

    sort(h, h + n);

    long long attacks = 0;
    for (int i = 0; i < (n - k); i++) {
        attacks += h[i];
    }

    cout << attacks << endl;

    return 0;
}


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

int memo[100][100];

int solve(int n, int p){

  if(!n && !p) return 1;
  if(n < 0 || !p) return 0;
  if(memo[n][p]) return memo[n][p];

  int res = 0;
  for(int i=0;i<10;i++) res += solve(n-i, p-1);

  return memo[n][p] = res;
}

int main(){

  for(int i=0;i<100;i++) solve(i, 4);

  int n;
  while(cin >> n) cout << memo[n][4] << endl;
}

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

typedef long long ll;

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

    ll ans = 0;
    for(int i=0;i<N;i++){
        ll a;
        cin >> a;

        ll num = 0;
        while(a%2==0){
            num++;
            a = a / 2;
        }
        ans += num;
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H, W;
  cin >> H >> W;
  
  int i;
  for (i = 0; i < W + 2; i++)
    cout << '#';
  cout << endl;
  
  for (i = 0; i < H; i++){
    string s;
    cin >> s;
    cout << '#' << s << '#' << endl;
  }

  for (i = 0; i < W + 2; i++)
    cout << '#';
  cout << endl;

}

Measured memory_bytes: 256
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		string[] input = Console.ReadLine().Split(' ');
		int n = int.Parse(input[0]);
		int m = int.Parse(input[1]);
		int[] obstacles = new int[n+1];//壊れている時1
    for(int i = 0; i < m; i++)
    {
      obstacles[int.Parse(Console.ReadLine())] = 1;
    }
    long mod = 1000000007;
    long[] dp = new long[n+1];
    dp[0] = 1;
    if(obstacles[1] != 1) dp[1] = 1;

    for(int i = 2; i <= n; i++)
    {
      if(obstacles[i] != 1)
      {
        dp[i] = dp[i-1] + dp[i-2];
        dp[i] %= mod;
      }
    }
    
		Console.WriteLine(dp[n]);
	}
}

Measured memory_bytes: 14048
#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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

int main(){
    int n; cin >> n;
    int k = n % 10;
    if(k == 2 || k == 4 || k == 5 || k == 7 || k == 9){
        cout << "hon" << endl;
    }else if(k == 0 || k == 1 || k == 6 || k == 8){
        cout << "pon" << endl;
    }else{
        cout << "bon" << endl;
    }
}

Measured memory_bytes: 3636
/*
wxy.

*/
#include<bits/stdc++.h>

using namespace std;
namespace wxy{
	int n;
}
using namespace wxy;
int main(){
	cin>>n;
	int p,s=0,m=-1;
	for(int i=1;i<=n;++i){
		cin>>p;
		s+=p;
		auto tomax=[](int &a,int b){b>a?a=b:0;};
		tomax(m,p);
	}
	s-=m/2;
	printf("%d\n",s);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int fff(char a,char b){
	return a>b;
}
int main(){
	char a[101],b[101];
	gets(a);
	gets(b);
	sort(a,a+strlen(a));
	sort(b,b+strlen(b),fff);
	if(strcmp(a,b)<0) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std;
typedef unsigned long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    string s;
    cin>>s;
    if(s[1]=='B')
        cout<<"ARC"<<endl;
    else
        cout<<"ABC"<<endl;
    return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>

int main(){
    int r,g,b;

    scanf("%d %d %d",&r,&g,&b);

    if((r * 100 + g * 10 + b) % 4 == 0){
        printf("YES\n");
    }
    else{
        printf("NO\n");
    }

    return 0;
}

Measured memory_bytes: 128
const main = (input) => {
  const args = input.split('\n')
  const nm = args[0].split(' ').map(v => Number(v))
  const n = nm[0]
  const m = nm[1]
  const lines = args.slice(1, args.length).map(line => line.split(' ').map(v => Number(v)))
  const room = Array(n + 1).fill(0).map(() => [])
  for (let i = 0; i < m; i++) {
    const [a, b] = lines[i]
    room[a].push(b)
    room[b].push(a)
  }
  let prev = Array(n).fill(-1)
  prev[0] = 0
  const queue = []
  queue.push(1)
  while (queue.length > 0) {
    const p = queue.shift()
    room[p].forEach(n => {
      if (prev[n - 1] !== -1) {
        return
      }
      prev[n - 1] = p
      queue.push(n)
    })
  }
  console.log('Yes')
  for (let i = 1; i < n; i++) {
    console.log(prev[i])
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 116852
N,M = map(int,input().split())

from heapq import heappush, heappop
INF = float("inf")
miti = [-1]*N
def dijkstra(N, G, s):
    dist = [INF] * N
    que = [(0, s)]
    dist[s] = 0
    while que:
        c, v = heappop(que)
        if dist[v] < c:
            continue
        for t, cost in G[v]:
            if dist[v] + cost < dist[t]:
                dist[t] = dist[v] + cost
                if miti[t] == -1:
                    miti[t] = v+1
                heappush(que, (dist[t], t))
    return dist

edge = [[] for _ in range(N)]

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

dist = dijkstra(N,edge,0)

if -1 in miti[1:]:
    print("No")
else:
    print("Yes")
    for t in miti[1:]:
        print(t)

Measured memory_bytes: 64292
def main():
    from collections import Counter
    n = int(input())
    a = list(map(int, input().split()))
    b = Counter(a)
    ans = 0
    for k, v in b.items():
        if k == v:
            continue
        if k > v:
            ans += v
        else:
            ans += v - k

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 18676
#include<bits/stdc++.h>
#define MAXN 200005
#define INF 1000000000000000000LL
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,ll> P;
struct edge{int to,cost;};
vector<edge> G[MAXN];
int n,cnt,a[MAXN];
int p[MAXN],r[MAXN];
ll fans;
struct min2
{
    P val[2];
    void init() {val[0]=val[1]=P(-1,INF);}
    void add(P p)
    {
        if(p.F==val[0].F) { if(p.S<val[0].S) val[0]=p;}
        else if(p.F==val[1].F) { if(p.S<val[1].S) val[1]=p;}
        else if(p.S<val[0].S) { val[1]=val[0]; val[0]=p;}
        else if(p.S<val[1].S) val[1]=p;
        if(val[0].S>val[1].S) swap(val[0],val[1]);
    }
    P get(int x)
    {
        if(val[0].F!=-1&&val[0].F!=x) return val[0];
        else if(val[1].F!=-1&&val[1].F!=x) return val[1];
        return P(-1,INF);
    }
    void add(min2 rhs,int cost)
    {
        if(rhs.val[0].F!=-1) add(P(rhs.val[0].F,rhs.val[0].S+cost));
        if(rhs.val[1].F!=-1) add(P(rhs.val[1].F,rhs.val[1].S+cost));
    }
};
min2 f[MAXN],ans[MAXN];
void init(int n)
{
    for(int i=1;i<=n;i++)
    {
        p[i]=i;
        r[i]=0;
    }
}
int find(int x)
{
    if(p[x]==x) return x;
    else return p[x]=find(p[x]);
}
void unite(int x,int y)
{
    x=find(x);
    y=find(y);
    if(x==y) return;
    if(r[x]<r[y]) p[x]=y;
    else
    {
        p[y]=x;
        if(r[x]==r[y]) r[x]++;
    }
}
bool same(int x,int y)
{
    return find(x)==find(y);
}
void add_edge(int u,int v,int cost)
{
    G[u].push_back((edge){v,cost});
    G[v].push_back((edge){u,cost});
}
void dfs1(int v,int p)
{
    f[v].init();
    for(auto e:G[v])
    {
        int to=e.to,cost=e.cost;
        if(to==p) continue;
        dfs1(to,v);
        f[v].add(P(find(to),a[to]+cost));
        f[v].add(f[to],cost);
    }
}
void dfs2(int v,int p)
{
    ans[find(v)].add(f[v],a[v]);
    for(auto e:G[v])
    {
        int to=e.to,cost=e.cost;
        if(to==p) continue;
        f[to].add(P(find(v),a[v]+cost));
        f[to].add(f[v],cost);
        dfs2(to,v);
    }
}
ll boruvka()
{
    init(n);
    cnt=n; fans=0;
    while(cnt>1)
    {
        for(int i=1;i<=n;i++) ans[i].init();
        dfs1(1,0);
        dfs2(1,0);
        for(int i=1;i<=n;i++)
        {
            P res=ans[i].get(i);
            if(res.F!=-1&&!same(res.F,i))
            {
                unite(res.F,i); cnt--;
                fans+=res.S;
            }
        }
    }
    return fans;
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    for(int i=0;i<n-1;i++)
    {
        int u,v,cost;
        scanf("%d%d%d",&u,&v,&cost);
        add_edge(u,v,cost);
    }
    printf("%lld\n",boruvka());
    return 0;
}


Measured memory_bytes: 41600
// 最長共通部分列 問題
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<vector>

using namespace std;

#define MAX_N 100
// 無効な値の定義
const int INV = -1;

int main(void)
{
    int n, u, num, v_num;
    int ary_adj[MAX_N];

    for(int i = 0; i < MAX_N; i++)
    {
        ary_adj[i] = 0;
    }

    cin >> n;

    for(int i = 0; i < n; i++)
    {
        cin >> u;
        cin >> num;

        for(int j = 0; j < num; j++)
        {
            cin >> v_num;
            ary_adj[v_num] = 1;
        }

        for(int k = 1; k <= n; k++)
        {
            if( k > 1 )
            {
                cout << " ";
            }

            if( ary_adj[k] == 1 )
            {
                cout << 1;
                ary_adj[k] = 0;
            }
            else
            {
                cout << 0;
            }
        }

        cout << endl;
    }

    return 0;
}



Measured memory_bytes: 3100
N = int(input())
S = str(input())
ans_li = []
for i in range(1,N,1):
  tmp_1 = list(set(S[i:]))
  tmp_2 = list(set(S[:i]))
  tmp_3 = set(tmp_1)&set(tmp_2)
  ans_li.append(len(tmp_3))
print(max(ans_li))

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

#if MYDEBUG
#include "lib/cp_debug.hpp"
#else
#define DBG(...) ;
#endif
#if __cplusplus <= 201402L
template <typename T>
T gcd(T a, T b) { return ((a % b == 0) ? b : gcd(b, a % b)); }
template <typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }
#endif
using LL = long long;
constexpr LL LINF = 334ll << 53;
constexpr int INF = 15 << 26;
constexpr LL MOD = 1E9 + 7;
#define int LL
namespace Problem {
using namespace std;
struct UnionFind {
  vector<pair<LL, LL>> memo;
  vector<LL> par;
  UnionFind(int n) {
    par = vector<LL>(n, -1);
  }
  int root(int x) {
    if (par[x] < 0) return x;
    return par[x] = root(par[x]);
  }
  int reversible_root(int x) {
    if (par[x] < 0) return x;
    return reversible_root(par[x]);
  }
  void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x != y) {
      if (par[x] < par[y]) swap(x, y);
      par[y] += par[x];
      par[x] = y;
    }
    return;
  }
  void reversible_unite(int x, int y) {
    x = reversible_root(x);
    y = reversible_root(y);
    if (x != y) {
      if (par[x] < par[y]) swap(x, y);
      memo.emplace_back(x, par[x]);
      memo.emplace_back(y, par[y]);
      par[y] += par[x];
      par[x] = y;
    }
    return;
  }
  bool same(int x, int y) {
    return root(x) == root(y);
  }
  int size(int x) {
    return -par[root(x)];
  }
  int reversible_size(int x) {
    return -par[reversible_root(x)];
  }
  void revert() {
    for (int i = memo.size() - 1; i >= 0; --i) {
      par[memo[i].first] = memo[i].second;
    }
    memo.clear();
  }
  void rollback(int i) {
    par[memo[i].first] = memo[i].second;
  }
};

class Solver2 {
 public:
  int n, m;
  UnionFind uf;
  vector<pair<pair<int, int>, pair<LL, int>>> edges;
  Solver2(LL n, LL m) : n(n),
                        m(m),
                        uf(n){};

  void solve() {
    for (int i = 0; i < n; ++i) {
      int tmp;
      cin >> tmp;
      uf.par[i] = -tmp;
    }
    for (int i = 0; i < m; ++i) {
      int a, b, y;
      cin >> a >> b >> y;
      --a;
      --b;
      edges.push_back({{a, b}, {y, -1}});
    }
    sort(edges.begin(), edges.end(), [&](auto xx, auto yy) { return xx.second.first < yy.second.first; });
    for (int i = 0; i < m; ++i) {
      int a = edges[i].first.first;
      int b = edges[i].first.second;
      if (uf.reversible_root(a) != uf.reversible_root(b)) {
        edges[i].second.second = uf.memo.size();
        uf.reversible_unite(a, b);
      }
    }
    int ans = 0;
    for (int i = m - 1; i >= 0; --i) {
      if (uf.reversible_size(edges[i].first.first) < edges[i].second.first) {
        ans++;
        if (edges[i].second.second != -1) {
          uf.rollback(edges[i].second.second);
          uf.rollback(edges[i].second.second + 1);
        }
      }
    }
    cout << ans << endl;
  }
};  // namespace Problem
}  // namespace Problem

signed main() {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(12);
  long long n = 0, m;
  std::cin >> n >> m;

  Problem::Solver2 sol(n, m);
  sol.solve();
  return 0;
}


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

using ll = long long;
using ull = unsigned long long;
constexpr ll mo = 1e9+7;
constexpr int inf = 1<<30;
constexpr ll infl = 1ll<<60;

using namespace std;

int main(){
    cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    
    string s,t;
    cin>>s>>t;
    int n= (int)s.size();
    int count = 0;
    for(int i=0;i<n;++i){
        if(s[i] != t[i])count++;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3808
N,M = map(int,input().split())
student = [list(map(int,input().split())) for _ in range(N)]
cpoint = [list(map(int,input().split())) for _ in range(M)]
for i in range(N):
    mannmn = 10**10
    mann = 10**10
    for j in range(M):
        mann = abs(student[i][0] - cpoint[j][0])+abs(student[i][1] - cpoint[j][1])
        if mann < mannmn:
            mannmn = mann
            ref = j
    print(ref+1)
        

Measured memory_bytes: 9044
#include<iostream>
#include<cstring>
#include<cstdio>
#include<queue>
#include<cstdlib>
using namespace std;
int  A,B;
char a[105][105];
int main()
{
	scanf("%d%d",&A,&B);
	for (int i=1;i<=50;++i)
		for (int j=1;j<=100;++j)
			a[i][j]='#';
	for (int i=51;i<=100;++i)
		for (int j=1;j<=100;++j)
			a[i][j]='.';
	int cnt=1;
	for (int i=1;i<=50;i+=2)
	{
		if (cnt==A) break;
		for (int j=1;j<=100;j+=2)
		{
			if (cnt==A) break;
			a[i][j]='.'; cnt++;
		}
	}
	cnt=1;
	for (int i=52;i<=100;i+=2)
	{
		if (cnt==B) break;
		for (int j=1;j<=100;j+=2)
		{
			if (cnt==B) break;
			a[i][j]='#'; cnt++;
		}
	}
	printf("100 100\n");
	for (int i=1;i<=100;++i)
	{
		for (int j=1;j<=100;++j)
			cout<<a[i][j];
		cout<<endl;
	}
			
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	void run() {
		Scanner sc = new Scanner(System.in);
		int[] t = new int[1005];
		for (int i = 1; i < 1005; i++) {
			t[i] = t[i - 1] + i;
		}

		while (true) {
			int n = sc.nextInt();
			if (n == 0) {
				break;
			}

			int cnt = 0;
			for (int i = 0; i < 1005; i++) {
				for (int j = i + 2; j < 1005; j++) {
					if (t[j] - t[i] == n) {
						cnt++;
					}
				}
			}
			
			System.out.println(cnt);
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 19648
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
  
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e7 + 555;
const double PI = acos(-1.0);


void solve()
{
	
	int n;
	cin >> n;
	int a[n];
	rep(i, n) cin >> a[i];
	int sum = 0;
	rep(i, n){
		for(int j = 0; j < i; ++j){
			sum += a[i] * a[j];
		}
	}
	cout << sum;
}
 
int main()
{
    Red;
    solve();
    return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<map>
using namespace std;
char s1[100001],s2[100001];
int main(){
	cin>>s1;
	int l=strlen(s1)-1;
	for(int i=0;i<=l;i++){
		if(s1[i]=='b')
			s2[i]='d';
		if(s1[i]=='d')
			s2[i]='b';
		if(s1[i]=='p')
			s2[i]='q';
		if(s1[i]=='q')
			s2[i]='p';
	}
	for(int i=0;i<=l;i++)
		if(s1[i]!=s2[l-i]){
			cout<<"No"<<endl;
			return 0;
		}
	cout<<"Yes"<<endl; 
}

Measured memory_bytes: 384
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cerr << #x << " = " << (x) << endl;
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = 1e9;
const double pi = acos(-1.0);

int main() {
	LL n; cin >> n;
	VL a(n); rep(i, n)cin >> a[i];

	LL ans = 0;
	LL r = 0, sum = 0;

	rep(l, n) {
		while (r < n && sum + a[r] == (sum ^ a[r])) {
			sum += a[r]; r++;
		}
		ans += r - l;
		if (l == r)r++;
		else sum -= a[l];
	}

	Cout(ans);
}

Measured memory_bytes: 1792
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
using namespace std;
int n,m,c;
int sum;
int b[30];
int ans;
int a[200][200];
int main() {
	cin>>n>>m>>c;
	for(int i=1;i<=m;i++){
		cin>>b[i];
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			cin>>a[i][j];
		}
	}
	for(int i=1;i<=n;i++){
		sum=0;
		for(int j=1;j<=m;j++){
			sum+=a[i][j]*b[j];
		}
		sum+=c;
		if(sum>0){
			ans++;
		}
	}
	cout<<ans;
	return 0;
}

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

using namespace std;

int main(int argc, const char *argv[]) {
  int n;
  cin >> n;

  vector<bool> vd(n);
  for (int i = 0; i < n; ++i) {
    int d1, d2;
    cin >> d1 >> d2;
    vd[i] = d1 == d2;
  }

  bool ok = false;
  for (int i = 0; i < n - 2 && !ok; ++i) {
    ok = vd[i] && vd[i + 1] && vd[i + 2];
  }

  if (ok) {
    cout << "Yes" << '\n';
  } else {
    cout << "No" << '\n';
  }

  return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>

int main(){
    int N, Array[200001], max, minSub;
    scanf("%d\n",&N);
    for (int ix = 0 ; ix < N ; ix++)
        scanf("%d",&Array[ix]);
    max = Array[1] - Array[0];
    minSub = Array[0];
    for (int jx = 1 ; jx < N ; jx++){
        if (max < Array[jx] - minSub)
            max = Array[jx] - minSub;
        if ( minSub > Array[jx])
            minSub = Array[jx];
    }
  
  printf("%d\n",max);
  return 0;
}


Measured memory_bytes: 2644
#include<bits/stdc++.h>
using namespace std;
/*
1e18だからO(N)はTLE
k==1のとき
a=b+c b=a+c c=a+b //b-a
k==2
a=2a+b+c b=2b+a+c c=2c+a+b //a-b
k==3
a=2a+3b+3c b=2b+3a+3c c=2c+3a+3b //b-a
k==4
a=6a+5b+5c b=6b+5a+5c c=6c+5a+5b //a-b
k==5
a=10a+11b+11c //b-a

規則性見えた
*/
int main(){
  int64_t a,b,c,k;
  cin >> a >> b >> c >> k;
  if(k%2==0)
    cout << a-b << endl;
  else
    cout << b-a << endl;
  return 0;
}

Measured memory_bytes: 3608
# -*- coding: utf-8 -*-
import sys
from math import gcd
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

X=int(input())
g=gcd(X,360)
l=X*360//g
print(l//X)

Measured memory_bytes: 62056
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x)  cout << #x << " = " << (x) << endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  int c[3][3];
  REP(i,3) REP(j,3) cin >> c[i][j];

  int ok = 1;
  REP(i,2) {
    int x = c[0][0] - c[0][i+1];
    if (c[1][0] - c[1][i+1] != x) ok = 0;
    if (c[2][0] - c[2][i+1] != x) ok = 0;
  }
  REP(i,2) {
    int x = c[0][0] - c[i+1][0];
    if (c[0][1] - c[i+1][1] != x) ok = 0;
    if (c[0][2] - c[i+1][2] != x) ok = 0;
  }

  COUT(ok ? "Yes" : "No");
  return 0;
}

Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
mod=pow(10,9)+7
sort_A=sorted(A)
numbers=[]
if N%2==0:
    for n in range(1,N,2):
        numbers+=[n]*2
    if sort_A==numbers:
        print(2**(N//2)%mod)
    else:
        print(0)
else:
    numbers.append(0)
    for n in range(2,N,2):
        numbers+=[n]*2
    if sort_A==numbers:
        print(2**(N//2)%mod)
    else:
        print(0)
        

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

using ll = long long;
#define repi(n) for (int i = 0; i < (n); i++)
#define repj(n) for (int j = 0; j < (n); j++)
#define repk(n) for (int k = 0; k < (n); k++)
#define rep(i, n) for (int i = 0; (i) < (n); i++)
#define repr(i, a, b) for (auto i = (a); i < (b); i++)
#define repv(itr) for (auto&& v : (itr))
#define updatemax(t, v) (t = max((t), (v)))
#define updatemin(t, v) (t = min((t), (v)))
const int dx[] = {-1, 0, 0, 1, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, -1, 1, -1, 1};
template <typename T>
T minptr(T begin, T end) {
  T re = begin;
  for (T i = begin + 1; i != end; i++) {
    if (*i < *re) re = i;
  }
  return re;
}
template <typename T>
T maxptr(T begin, T end) {
  T re = begin;
  for (T i = begin + 1; i != end; i++) {
    if (*i > *re) re = i;
  }
  return re;
}
int __vmax(int x) {
  return INT_MAX;
}
double __vmax(double x) {
  return 1e+300;
}
ll __vmax(ll x) {
  return LLONG_MAX;
}
int __vmin(int x) {
  return INT_MIN;
}
double __vmin(double x) {
  return -1e+300;
}
ll __vmin(ll x) {
  return LLONG_MIN;
}
template <typename T>
vector<T> lis(T begin, T end, bool allowequal = false, bool lds = false) {
  using V = typename iterator_traits<T>::value_type;
  int n = end - begin;
  vector<V> a(n, lds ? __vmin(*begin) : __vmax(*begin));
  vector<int> id(n);
  if (lds && allowequal) {
    for (int i = 0; i < n; i++) {
      id[i] = n - 1 -
              (lower_bound(a.rbegin(), a.rend(), begin[i]) - 1 - a.rbegin());
      a[id[i]] = begin[i];
    }
  } else if (lds) {
    for (int i = 0; i < n; i++) {
      id[i] = n - 1 -
              (upper_bound(a.rbegin(), a.rend(), begin[i]) - 1 - a.rbegin());
      a[id[i]] = begin[i];
    }
  } else if (allowequal) {
    for (int i = 0; i < n; i++) {
      id[i] = upper_bound(a.begin(), a.end(), begin[i]) - a.begin();
      a[id[i]] = begin[i];
    }
  } else {
    for (int i = 0; i < n; i++) {
      id[i] = lower_bound(a.begin(), a.end(), begin[i]) - a.begin();
      a[id[i]] = begin[i];
    }
  }
  int m = *maxptr(id.begin(), id.end());
  vector<T> re(m + 1);
  for (int i = n - 1; i >= 0; i--) {
    if (id[i] == m) re[m--] = begin + i;
  }
  return re;
}
template <typename T>
class segtree {
 private:
  int n;
  vector<T> data, lazy;

 public:
  segtree(int n_) {
    n = pow(2, ceil(log2(n_)));
    data.resize(n);
    lazy.resize(n);
    auto __x = data[0];
    repi(n) {
      data[i] = __vmin(__x);
      lazy[i] = 0;
    }
  }
};

int main() {
  string s[26];
  s[25] = "Christmas";
  s[24] = "Christmas Eve";
  s[23] = "Christmas Eve Eve";
  s[22] = "Christmas Eve Eve Eve";
  int n;
  cin >> n;
  cout << s[n] << endl;
}


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

using namespace std;

const int N = 1e5+7;
const int MOD = 1e9+7;
typedef pair<int, int> pii;

template <int _MOD> struct Mint
{
    int v = 0;
    Mint() {}
    Mint(int _v) : v((_v%_MOD+_MOD)%_MOD) {}
    Mint(long long _v) : v(static_cast<int>((_v%_MOD+_MOD)%_MOD)) {}
    Mint operator = (const int &_v) { return *this = Mint(_v); }
    Mint operator = (const long long &_v) { return *this = Mint(_v); }
    bool operator ! () const { return !this->v; }
    bool operator < (const Mint &b) const { return v < b.v; }
    bool operator > (const Mint &b) const { return v > b.v; }
    bool operator == (const Mint &b) const { return v == b.v; }
    bool operator != (const Mint &b) const { return v != b.v; }
    bool operator <= (const Mint &b) const { return v < b.v || v == b.v; }
    bool operator >= (const Mint &b) const { return v > b.v || v == b.v; }
    Mint operator + (const Mint &b) const { return Mint(v+b.v); }
    Mint operator - (const Mint &b) const { return Mint(v-b.v); }
    Mint operator * (const Mint &b) const { return Mint(1ll*v*b.v); }
    Mint operator / (const Mint &b) const { return Mint(b.inv()*v); }
    Mint& operator += (const Mint &b) { return *this = *this+b; }
    Mint& operator -= (const Mint &b) { return *this = *this-b; }
    Mint& operator *= (const Mint &b) { return *this = *this*b; }
    Mint& operator /= (const Mint &b) { return *this = *this/b; }
    Mint operator - () const { return Mint(-v); }
    Mint& operator ++ () { return *this += 1; }
    Mint& operator -- () { return *this -= 1; }
    Mint operator ++ (int) { Mint tmp = *this; *this += 1; return tmp; }
    Mint operator -- (int) { Mint tmp = *this; *this -= 1; return tmp; }
    Mint pow(int p) const {
        Mint res(1), x(*this);
        while (p) {
            if (p&1) res = res*x;
            x *= x;
            p >>= 1;
        }
        return res;
    }
    Mint inv() const { return pow(_MOD-2); }
    friend istream& operator >> (istream &is, Mint &mt) { return is >> mt.v; }
    friend ostream& operator << (ostream &os, const Mint &mt) { return os << mt.v; }
};
using mint = Mint<MOD>;

int n;
int a[N];
mint inv[N], sum[N];

inline void init()
{
    inv[0] = 1;
    for (int i = 1; i <= n; ++i) {
        inv[i] = mint(i).inv();
        sum[i] = sum[i-1]+inv[i];
    }
}

inline void solve()
{
    cin >> n;
    for (int i = 1; i <= n; ++i) cin >> a[i];

    mint res = 0;
    init();
    for (int i = 1; i < n; ++i)
        res += sum[i]*(a[i+1]-a[i]);
    for (int i = 1; i < n; ++i)
        res *= i;
    cout << res << endl;
}

int main()
{
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int T = 1;
    while (T--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 1408
x1,y1,x2,y2 = (int(i) for i in input().split())
if (x2-x1) > 0 and (y2-y1) >=0 :
    x3 = x2 - abs((y2 - y1))
    y3 = y2 + abs((x2 - x1))
    x4 = x3 - abs((y3 - y2))
    y4 = y3 - abs((x3 - x2))
    print(x3,y3,x4,y4)


elif (x2-x1) <= 0 and (y2-y1) >=0 :
    x3 = x2 - abs((y2 - y1))
    y3 = y2 - abs((x2 - x1))
    x4 = x3 + abs((y3 - y2))
    y4 = y3 - abs((x3 - x2))
    print(x3,y3,x4,y4)

elif (x2-x1) <= 0 and (y2-y1) < 0 :
    x3 = x2 + abs((y2 - y1))
    y3 = y2 - abs((x2 - x1))
    x4 = x3 + abs((y3 - y2))
    y4 = y3 + abs((x3 - x2))
    print(x3,y3,x4,y4)


else:
    x3 = x2 + abs((y2 - y1))
    y3 = y2 + abs((x2 - x1))
    x4 = x3 - abs((y3 - y2))
    y4 = y3 + abs((x3 - x2))
    print(x3,y3,x4,y4)

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void solve() {
    char a;
    cin >> a;
    char b = tolower(a);
    if (a == b) {
        cout << 'a' << '\n';
    } else {
        cout << 'A' << '\n';
    }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


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

int main(){
  int N;
  cin >> N;
  vector<vector<int>> data(2, vector<int> (N));
  for(int i = 0; i < 2; i++){
    for(int j = 0; j < N; j++){
      cin >> data.at(i).at(j);
    }
  }
  int ame = 0;
  for(int i = 0; i < N; i++){
    int ame1 = 0;
    for(int j = 0; j <= i; j++){
      ame1 += data.at(0).at(j);
    }
    for(int k = i; k < N; k++){
      ame1 += data.at(1).at(k);
    }
    if(ame1 > ame) ame = ame1;
  }
  cout << ame << endl;
}


Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    l=[0]+list(map(int,input().split()))+[0]
    max=0
    for i in range(n+1):
        max+=abs(l[i+1]-l[i])
    for j in range(1,n+1):
        x=abs(l[j+1]-l[j])
        y=abs(l[j]-l[j-1])
        z=abs(l[j+1]-l[j-1])
        print(max-x-y+z)
resolve()

Measured memory_bytes: 65004