akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long LL;
const LL N = 1000000007;

LL dp[65][2][2];
LL bx[65],by[65];

LL dfs(LL pos,LL l1,LL l2){
	if(!pos) return 1;
	if(dp[pos][l1][l2] != -1) return dp[pos][l1][l2];
	LL ret = 0;
	LL t1 = l1 ? bx[pos] : 0,t2 = l2 ? by[pos] : 1;
	for(LL y = t1;y <= t2;y ++){
		for(LL x = t1;x <= y;x ++){
			ret += dfs(pos - 1,l1 && x == t1,l2 && y == t2);
			ret %= N;
		}
	}
	dp[pos][l1][l2] = ret;
	return ret;
}

int main(){
	memset(dp,-1,sizeof(dp));
	LL l,r,ll = 0,rr = 0,ans = 0;
	cin >> l >> r;
	while(1){ if(!l) break; bx[++ ll] = l & 1; l >>= 1; }
	while(1){ if(!r) break; by[++ rr] = r & 1; r >>= 1; }
	for(LL i = ll;i <= rr;i ++) ans = (ans + dfs(i - 1,i == ll,i == rr)) % N;
	cout << ans << endl;
	return 0;
} 

Measured memory_bytes: 256
#include<stdio.h>
#define NIL -1
#define MAX 100000


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

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

}

void print(int u){
  int i,c;
  printf("node %d: ",u);
  printf("parent = %d, ",T[u].p);
  printf("depth = %d, ",D[u]);

  if(T[u].p==NIL)printf("root, ");
  else if(T[u].l==NIL)printf("leaf, ");
  else printf("internal node, ");

  printf("[");
  
  for(i=0,c=T[u].l;c!=NIL;i++,c=T[c].r){
    if(i)printf(", ");
    printf("%d",c);
  }
  printf("]\n");
}

int main(){
  int i,j,d,v,c,l,r;

  scanf("%d", &n);

  for (i=0;i<n;i++) {
    T[i].p = T[i].l = T[i].r = NIL;
  }

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



Measured memory_bytes: 6380
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define ll long long
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define P pair<int, int>
#define debug(var) cerr << "[" << #var << "] " << var << endl
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define pr(s) cout << (s) << '\n'
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
const int INF = 1001001001;
const ll INFll = 1E+18;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s;
    cin >> s;
    auto sa = suffix_array(s);
    ll n = s.size();
    ll ans = n*(n+1)/2;
    auto lcp = lcp_array(s, sa);
    for (auto x: lcp) {
        //debug(x);
        ans -= x;
    }
    pr(ans);
    
    
    return 0;
}


Measured memory_bytes: 15632
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pf push_front

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
double pi = 3.141592653589793;
ll mod = 1000000007;
ll INF = 1000000001;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;



int main(){
	int r;
    cin >> r;
    cout<<3*r*r<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int ans = 0;
    REP(i, n) {
        int a;
        cin >> a;
        while(a % 2 == 0) a /= 2, ans++;
    }
    cout << ans << endl;
    
    return 0;
}


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

int main() {
  double A, B, H, M;
  cin >> A >> B >> H >> M;
  double rad, pi = M_PI, ans;
  rad = M * pi / 30;
  rad -= (60*H + M) * pi / 360;
  ans = A*A + B*B - 2*A*B*cos(rad);
  printf("%.10lf\n", sqrt(ans));
  return 0;
}

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

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

  int X; cin >> X;
  vector<vector<ll>> dp(100200, vector<ll>(7, 0));
  dp[0][0] = 1;
  for (int j = 1; j <= 6; j++) {
    for (int i = 0; i <= 100000; i++) {
      int x = 100 + j - 1;
      if (i + x > 100000) break;
      if (dp[i][j - 1] == 1 || dp[i][j] == 1) {
        dp[i][j] = 1;
        dp[i + x][j] = 1;
      }
    }
  }

  cout << dp[X][6] << '\n';
  return 0;
}

Measured memory_bytes: 8832
#include<stdio.h>
int top,S[1000];

void push(int x){
    S[++top] = x;
}

int pop(){
    top --;
    
    return S[top+1];
}

void AandBpop(int *a,int *b){
    *b = pop();
    *a = pop();
}

int main(){
    int a,b;
    char s[10];
    top = 0;
    
    while( scanf("%s",s) != EOF){
        if(s[0] == '+'){
            AandBpop(&a,&b);
            push(a+b);
        }else if(s[0] == '-'){
            AandBpop(&a,&b);
            push(a-b);
        }else if(s[0] == '*'){
            AandBpop(&a,&b);
            push(a*b);
        }else{
            push(atoi(s));
        }
    }
    
    printf("%d\n",S[top]);
    
    return 0;
}

Measured memory_bytes: 548
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstdint>
#include <map>

using namespace std;

int main()
{
    int n,k;
    cin >> n >> k;

    int series = n/k;
    int64_t count = 0;
    for(int i = 0; i < k; ++i)
    {
        if(2*(k-i) % k == 0)
        {
            int x = i;
            int y = (k-i) % k;
            int64_t ser_x = (x + series * k) <= n ? series + 1: series;
            int64_t ser_y = (y + series * k) <= n ? series + 1: series;
            if(x == 0) ser_x -= 1;
            if(y == 0) ser_y -= 1;
            //cout << x << ',' << y << ',' << y << '\n';
            //cout << '*' << ser_x << '\n';
            //cout << '*' << ser_y << '\n';
            //cout << '*' << ser_y << '\n';
            count += ser_x * ser_y * ser_y;
        }
    }
    cout << count << '\n';
 
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(){
	int n, m;
	cin >> n;
	vector<pair<pair<string, string>, int> > v(n);
	for(int i=0; i< n; i++){
		cin >> v[i].first.first >> v[i].first.second;
		int a, b, c;
		scanf("%d/%d/%d", &a, &b, &c);
		a = a*10000 + b*100 + c;
		v[i].second = a;
	}
	cin >> m;
	for(int i=0; i< m; i++){
		if(i != 0) cout << endl;
		string a, b, c, d;
		cin >> a >> b >> c >> d;
		int cc = -1, dd = -1;
		if(c != "*") cc = stoi(c.substr(0, 4))*10000 + stoi(c.substr(5, 2))*100 + stoi(c.substr(8, 2));
		if(d != "*") dd = stoi(d.substr(0, 4))*10000 + stoi(d.substr(5, 2))*100 + stoi(d.substr(8, 2));
		for(int j=0; j < n; j++){
			if((a == "*" || v[j].first.first.find(a) != string::npos) &&
					(b == "*" || v[j].first.second.find(b) != string::npos) &&
					(c == "*" || cc <= v[j].second) &&
					(d == "*" || v[j].second <= dd)) cout << v[j].first.first << endl;
		}
	}
}

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

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

  int n, m;
  cin >> n;

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

  cin >> m;
  vector<int> p(m), x(m);
  for (int i = 0; i < m; i++) {
    cin >> p[i] >> x[i];
    p[i]--;
  }

  for (int i = 0; i < m; i++) {
    int idx = p[i];

    int tmp = t[idx];
    t[idx] = x[i];

    int ans = accumulate(t.begin(), t.end(), 0);

    cout << ans << endl;

    t[idx] = tmp;
  }

  return 0;
}

Measured memory_bytes: 256
a = int(input())
b = list(map(int,input().split()))

x_sum = 0
for i in range(a):
  x_sum += b[i]

p = round(x_sum / a)
#print(p)

h = 0
for i in range(a):
  h += (b[i]-p)**2
  
print(h)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int n,k;
int a[201010];
long long ans;
void solve(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>k;
    for(int i=1;i<=n;++i){
        cin>>a[i];
    }
    sort(a+1,a+n+1,greater<int>());
    for(int i=k+1;i<=n;++i){
        ans=ans+a[i];
    }
    cout<<ans<<endl;
}
int main(){
    solve();
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define INF 2000000000
typedef long long int ll;
typedef pair<ll,ll> ii;
typedef pair<ii,ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
#define getbit(n,i) (((n)&(1<<(i)))!=0)
#define setbit0(n,i) ((n)&(~(1<<(i))))
#define setbit1(n,i) ((n)|(1<<(i)))
#define togglebit(n,i) ((n)^(1<<(i)))
#define lastone(n) ((n)&(-(n)))
#define read freopen("debug\\in.txt","r",stdin)
#define write freopen("debug\\out.txt","w",stdout)
#define fi first
#define se second
#define getI(a) scanf("%d",&a)
#define getII(a,b) scanf("%d%d",&a,&b)
#define PI (acos(-1))
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL)
#define mod (1000000007)
#define asz 500005
#define pb push_back
#define ppf pop_front
#define ppb pop_back
#define pf push_front
   
int main()
{
    fastread;
    ll n,r;
    cin>>n>>r;
    if(n>=10){
    	cout<<r;
	}
	else{
		cout<<r+100*(10-n);
	}
    return 0;
}

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

int main() {
    string t;
    cin >> t;
    if(t == "A") {
        cout << "T";
    } else if(t == "C") {
        cout << "G";
    } else if(t == "T") {
        cout << "A";
    } else if(t == "G") {
        cout << "C";
    }
    return 0;
}


Measured memory_bytes: 256
# https://atcoder.jp/contests/arc080/tasks/arc080_b

import itertools
from collections import Counter
from collections import defaultdict
import bisect

def main():
    H, W = map(int, input().split())
    N = int(input())
    A = list(map(int, input().split()))
    ans = [[0] * W for _ in range(H)]

    h = 0
    w = 0
    for i in range(N):
        rest = A[i]
        while rest > 0:
            ans[h][w] = i + 1
            rest -= 1
            if h % 2 == 0:
                if 0 <= w < W - 1:
                        w += 1
                else:
                    h += 1
            else:
                if 0 < w <= W - 1:
                        w -= 1
                else:
                    h += 1

    for h in range(H):
        print(' '.join(map(str, ans[h])))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3824
#include <iostream>
// #include <set>
#define rep(i,n)  for(int i=0; i<n; i++)
using namespace std;
int main(void){
    int n, y;
    int a, b, c;
    cin >> n >> y;
    y /= 1000;
    
    rep(i, n+1){
        c = i;
        b = (y-n-9*c) / 4;
        a = n - b - c;
        if (a + b + c != n) continue;
        if (10*c + 5*b + a != y) continue;
        if (a < 0 or b < 0 or c < 0) continue;
        else {
            cout << c << " " << b << " " << a << endl;
            return 0;
        }
    }
    cout << "-1 -1 -1" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    vector<int> a(3);
    cin >> a[0] >> a[1] >> a[2];
    sort(a.begin(), a.end());
    if((a[0] == a[1] && a[1] != a[2]) || (a[0] != a[1] && a[1] == a[2])) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<cd> vcd;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvl;
typedef unordered_map<int, int> umpii;
typedef unordered_map<ll, ll> umpll;
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

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

const int MOD = 1000000007;
const ll INF = 1e18;
const int inf = 1e9;
const int MX = 100001; //check the limits, dummy

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

    int n, m; cin >> n >> m;
    vvi v(m, vi());
    vi c(m, 0);
    int t = 0;
    F0R(i, m){
        int a, b; cin >> a >> b;
        c[i] = a;
        F0R(j, b) {
            int x; cin >> x; x--;
            t = t | (1 << x);
            v[i].pb(x);    
        }
    }

    int q = 1 << n;
    if(t != q - 1) {
        cout << -1 << endl;
        return 0;
    }

    vvi dp(m + 1, vi(q, inf));
    F0R(i, m) dp[i][0] = 0;
    FOR(i, 1, m + 1) {
        F0R(j, q) {
            int r = j;
            for(int x : v[i - 1]) {
                if(r & (1 << x)) r -= 1 << x;
            }
            dp[i][j] = min(dp[i][j], dp[i - 1][j]);
            dp[i][j] = min(dp[i][j], dp[i][r] + c[i - 1]);
        }
    }

    cout << dp[m][q - 1] << endl;
}

Measured memory_bytes: 16384
#include <stdio.h>

int main(){
	
	int a,b,c,n[1001],i,max=100000000,d;
	
	scanf("%d\n%d %d",&a,&b,&c);
	
	b=b*1000;
	c=c*1000;
	
	for(i=0;i<a;i++){
		scanf("%d",&n[i]);
		n[i]=b-n[i]*6;
		if(max>abs(c-n[i])){
			max=abs(c-n[i]);
			d=i;
		}
	}
	
	printf("%d\n",d+1);
	
	return 0;
}


Measured memory_bytes: 128
n,m=map(int,input().split())
ks=[list(map(int,input().split())) for _ in range(m)]
p=list(map(int,input().split()))
li1=[]

for i in range(2**n):
  li2=[0]*n
  for j in range(n):
    if (i>>j)&1==1:
      li2[j]=1
  li1.append(li2)

ans=0  
for i in li1:
  light=True
  for j in range(m):
    cnt=0
    for k in range(1,ks[j][0]+1):
      if i[ks[j][k]-1]==1:
        cnt+=1
        
    if cnt%2!=p[j]:
      light=False
      
  if light:
    ans+=1
      
print(ans)

Measured memory_bytes: 3188
#include<iostream>
#include<list>
#include<string>
#include<cstring>
#include<sstream>
#include<cctype>
#include<string.h>
#include<algorithm>
#include<cmath>
#include<stack>
#include<fstream>
#include<cstdlib>
#include<vector>
#include<map>
#include<set>
#include<utility>
#include<iomanip>
#include<queue>
using namespace std;

#define LL long long int
#define uLL unsigned long long int

#define S(a) scanf("%d",&a)
#define S2(a,b) scanf("%d%d",&a,&b)
#define S3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define SLL(a) scanf("%lld",&a)
#define SLL2(a,b) scanf("%lld%lld",&a,&b)
#define SLL3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define SC(a) scanf("%c",&a)
#define P(a) printf("%d",a)
#define PS(a) printf("%s",a)
#define PLL(a) printf("%lld",a)
#define PCASE(kk) printf("Case %d: ",kk++)
#define PCASENL(kk) printf("Case %d:\n",kk++)
#define NL puts("")

#define pb push_back
#define mp(a,b) make_pair(a,b)
#define pi (2.0*acos(0.0))
#define pii pair<int,int>

template<typename T>inline T POW(T B,T P)
{
    if(P==0) return 1;
    if(P&1) return B*POW(B,P-1);
    else return SQR(POW(B,P/2));
}
template <typename T>inline T ModInv (T b,T m)
{
    return BigMod(b,m-2,m);
}
template<typename T>inline T ABS(T a)
{
    if(a<0)return -a;
    else return a;
}
template<typename T>inline T gcd(T a,T b)
{
    if(a<0)return gcd(-a,b);
    if(b<0)return gcd(a,-b);
    return (b==0)?a:gcd(b,a%b);
}
template<typename T>inline T lcm(T a,T b)
{
    if(a<0)return lcm(-a,b);
    if(b<0)return lcm(a,-b);
    return a*(b/gcd(a,b));
}
template <class T> inline T BMOD(T p,T e,T m)
{
    T ret=1;
    while(e)
    {
        if(e&1) ret=(ret*p)%m;
        p=(p*p)%m;
        e>>=1;
    }
    return (T)ret;
}

//for(__typeof(pp.begin()) i=pp.begin(); i!=pp.end(); i++ )

//knight and king move....



//int Dx[]={-2,-1,1,2,1,2,-2,-1};
//int Dy[]={-1,-2,2,1,-2,-1,1,2};
//int dx[]={-1,1,0,0};
//int dy[]={0,0,-1,1};
//int dx[]= {-1,-1,0,0,1,1};
//int dy[]= {-1,0,-1,1,0,1};
//////////////////////////////////////////////////

int main()
{
    LL n,x;
    SLL2(n,x);

    LL ds=(n-(2*x));

    if(ds==0)
    {
        PLL((x*3LL)),NL;
    }
    else if(ds>0)
    {
        LL ans;

        ans=3LL*x+(n-x);
        LL l=x,w=ds;
        if(l<w)swap(l,w);
        while(1)
        {
            if(l%w==0)
            {
                ans+=((2LL*(l/w))-1)*w;
                break;
            }
            ans+=(2LL*(l/w))*w;
            l=l-(((l/w))*w);
//            l%=w;
            if(l==0)break;
            if(l<w)swap(l,w);

        }
        PLL(ans),NL;
    }
    else
    {
        ds=n-x;
        LL ans=x+ds;
        LL l=x,w=ds;
        if(l<w)swap(l,w);
        while(1)
        {
            if(l%w==0)
            {
                ans+=((2LL*(l/w))-1)*w;
                break;
            }
            ans+=(2LL*(l/w))*w;
            l=l-(((l/w))*w);
//            l%=w;
            if(l==0)break;
            if(l<w)swap(l,w);

        }
        PLL(ans),NL;
    }



    return 0;
}


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

string x[100][100];
bool p[100][100];
int h,w;
char T[11]="0123456789";
char c;
string dp[100][100];

bool isnum(string p){
	for(int i=0;i<10;i++){
		if(T[i]==p[0]){
			return true;
		}
	}
	return false;
}

string _max(string a,string b){
	if(a.size()<b.size()){return b;}
	if(a.size()>b.size()){return a;}
	if(a>b){return a;}
	return b;
}

int main(){
	while(true){
		for(int i=0;i<100;i++){
			for(int j=0;j<100;j++){
				dp[i][j]="";
				x[i][j]="a";
			}
		}
		cin>>w>>h;
		if(h==0 && w==0){break;}
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				cin>>c;
				string G="";
				G+=c;
				x[i][j]=G;
			}
		}
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				if(isnum(x[i][j])==true){
					if(x[i][j]!="0"){
						dp[i][j]=""+x[i][j];
					}
					p[i][j]=true;
				}
				else{
					p[i][j]=false;
				}
			}
		}
		for(int i=0;i<70;i++){
			for(int j=0;j<h;j++){
				for(int k=0;k<w;k++){
					if(dp[j][k]!=""){
						if(p[j+1][k]==true){
							dp[j+1][k]=_max(dp[j+1][k],dp[j][k]+x[j+1][k]);
						}
						if(p[j][k+1]==true){
							dp[j][k+1]=_max(dp[j][k+1],dp[j][k]+x[j][k+1]);
						}
					}
				}
			}
		}
		string maxn="";
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				maxn=_max(maxn,dp[i][j]);
			}
		}
		cout<<maxn<<endl;
	}
}

Measured memory_bytes: 2032
def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def ilen(it):
    return sum(1 for _ in it)


def solve():
    """
    C[N-K+1][i]*C[K-1][i-1]
    1 1 1
    1 2 3
    1 3 6
    """
    N, K = read_ints()
    C = [
        [0 for _ in range(2002)] for _ in range(2002)
    ]
    modulo = 10**9+7
    C[1][1] = 1
    for i in range(2, 2002):
        for j in range(1, i+1):
            C[i][j] = (C[i-1][j]+C[i-1][j-1])%modulo

    for i in range(1, K+1):
        print((C[N-K+1+1][i+1]*C[K-1+1][i-1+1])%modulo)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 106284
#include<stdio.h>

int main(void){

  double g = 9.8;
  double high;
  double time;
  double speed;
  double n;

  while(scanf("%lf",&speed)!=EOF){
    time = speed / g;
    high = time * time * g / 2.0;
    n = ( 5 + high )/5;
    if((int)n != n)n++;
    printf("%d\n",(int)n);
  }  

  return 0;
}

Measured memory_bytes: 628
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define debug(x) cerr << "[debug] " << #x << ": " << x << endl;
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << endl;
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

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

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

signed main() {
  init();
  ll N;
  cin >> N;
  ll ans = 0;
  rep(i, N) {
    ll a;
    cin >> a;
    while (a % 2 == 0) {
      ans++;
      a /= 2;
    }
  }
  COUT(ans);
  return 0;
}

Measured memory_bytes: 3596
a,b,c = map(int,input().strip().split())
if c-(a+b)<=0:
    print("No")
else:
    l = 4*a*b
    r = (c**2+(a+b)**2-2*c*(a+b))
    if l<r:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 3064
/*
  _    _ _      _ _      _ _      
 | |__| | | _ _| | | _ _| | | ___
 | '_ \_  _| ' \_  _| ' \_  _(_-< 
 |_.__/ |_||_||_||_||_||_||_|/__/

*/

#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 db(x) cout << #x << "=" << x << '\n'
#define rep(i, k, n) for (int i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define si(x) scanf("%d", &x)
#define sl(x) scanf("%lld", &x)
#define ss(x) scanf("%s", x)
#define pi(x) printf("%d\n", x)
#define pl(x) printf("%lld\n", x)
#define ps(x) printf("%s\n", x)
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for (auto it = a.begin(); it != a.end(); it++)
#define F first
#define S second
#define pb push_back
#define ll long long

#define X real()
#define Y imag()
#define angle(a)                (atan2((a).imag(), (a).real()))
#define vec(a,b)                ((b)-(a))
#define same(p1,p2)             (dp(vec(p1,p2),vec(p1,p2)) < EPS)
#define dp(a,b)                 ( (conj(a)*(b)).real() )	// a*b cos(T), if zero -> prep
#define cp(a,b)                 ( (conj(a)*(b)).imag() )	// a*b sin(T), if zero -> parllel
#define length(a)               (hypot((a).imag(), (a).real()))
#define normalize(a)            (a)/length(a)
//#define polar(r,ang)            ((r)*exp(point(0,ang)))  ==> Already added in c++11
#define rotateO(p,ang)          ((p)*exp(point(0,ang)))
#define rotateA(p,ang,about)  (rotateO(vec(about,p),ang)+about)
#define reflectO(v,m)  (conj((v)/(m))*(m))


typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef complex<double> point;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const double PI  = acos(-1.0);
const double EPS = 1e-9;
const int mod = 1000000007;
const int N = 1e6 + 7, M = N, OO = 1e9 + 7;
const ll LLOO = 1e18 + 7;

//=======================

vector<int> primes;
bool isprime[N];

void sieve()
{
	memset(isprime,1,sizeof isprime);
	isprime[0] = isprime[1] = 0;
	rep(i,2,1001)
	{
		if (!isprime[i]) continue;
		primes.pb(i);
		for(int j = i*2 ;j < N ; j+=i)
		{
			isprime[j] = 0;
		}
	}
}

vi g[N];
int n,a[N];

void solve()
{
    si(n);
    ll ans = 1;
    rep(i,2,n)
    {
		int x = i;
		ll cnt = 1;
		ll res = 1;
		for(auto p:primes)
		{
			while(x%p == 0) {x/=p;cnt++;}
			res *= cnt;
			cnt = 1;
		}
		if (x > 1) res *= 2;
		ans += res;
		//if ((int)sqrt(i)*sqrt(i) == i) ans--;
	}
	pl(ans);
}

int main()
{
	sieve();
    // uncomment if file :
    // freopen("in","r",stdin);
    // freopen("out","w",stdout);
    int t = 1;
    // si(t); // uncomment if testcases
    while (t--)
        solve();
    return 0;
}


// btw i use arch


Measured memory_bytes: 28224
/*---> 16 January 2020 <--- > 11:57:28 <---*/
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("unroll-loops")
// #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//#pragma GCC target ("sse4")
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
//template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
#define int long long
#define F first
#define S second
#define mod 1000000007
#define inf (int)1e18+5
#define sz(x) (int)x.size()
#define PI 3.141592653589793238510
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define __ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define vi vector<int>
#define vpii vector<pair<int,int> > 
#define vvi vector<vector<int> >
#define PRINT_TIME cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s." <<endl;
#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__) << "] "
typedef long double ld;
typedef pair<int,int> pii;
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
const int N=1e5+5;

int32_t main(){__
	char c;
	cin>>c;
	cout<<(char)(c+1)<<"\n";
return 0;
}

Measured memory_bytes: 256
from itertools import accumulate as ac
n,k=map(int,input().split())
a=sorted(list(map(int,input().split())))
m=10**9+7
d=[1]
for i in range(k-1,n+1):
    d.append((d[-1]*i*pow(i-k+2,m-2,m))%m)
a=list(ac(a))
p=0
for i in range(n-k+1):
    c=(a[-1]-a[i+k-2])-a[n-i-k]
    p=(p+c*d[i])%m
if k==1:
    print(0)
else:
    print(p%m)

Measured memory_bytes: 14416
use proconio::input;

fn main() {
    input! {
      a: String,
      b: String,
    }

    let n :u32 = (a + &String::from(b)).parse().unwrap();
    let mut count = 0;

    for i in 1 .. n + 1 {
        if n % i == 0 {
            count += 1;
        }
    }

    if count % 2 == 1 {
        println!("Yes");
    } else {
        println!("No");
    }

}


Measured memory_bytes: 2084
#include <stdio.h>
#include <algorithm>
using namespace std;

int abs(int n)
{
    return n>=0?n:-n;
}

int main()
{
    int n,k;
    int h[100000];
    scanf("%d %d",&n,&k);
    for(int i=0;i<n;i++)
    scanf("%d",&h[i]);
    sort(h,h+n);
    int min=1000000000;
    for(int i=0;i<n-k+1;i++)
    {
        if(min>abs(h[i]-h[i+k-1])) min=abs(h[i]-h[i+k-1]);
    }
    printf("%d\n",min);
}


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

#define NREP() for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define IPT(x) ll t; cin >> t; x.push_back(t);
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<string> vvs;

const static ll MOD = 1e9 + 7;

int main(int argc, char *argv[]) {
    ll r;
    cin >> r;

    MSG(fixed << setprecision(15) << 2*r*3.14159265358979323846)
}


Measured memory_bytes: 3792
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w;
    cin >> h >> w;
    REP(i, h){
        string str;
        cin >> str;
        cout << str << "\n";
        cout << str << "\n";
    }

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
public class Aprob {
    public static void Main() {
        string[] readSome = new string[3];
        readSome = Console.ReadLine().Split(' ');
        long a = long.Parse(readSome[0]);
        long b = long.Parse(readSome[1]);
        long x = long.Parse(readSome[2]);
        if (a % x == 0) {
            Console.WriteLine(b / x - a / x+1);
        } else {
            Console.WriteLine(b / x - a / x);
        }
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <cstdio>

using namespace std;

#define print(a) printf("%d\n", a)

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

#define MAX(a,b) ((a)>(b)?(a):(b))


int main(){
	int s = 0, t = 0, tmp;
	
	REP(i,4){
		cin >> tmp;
		s += tmp;
	}
	
	REP(i,4){
		cin >> tmp;
		t += tmp;
	}
	
	print(MAX(s,t));
	
	return 0;
}

Measured memory_bytes: 3192
s = input()
k = int(input())
n = len(s)
heads = []
d = set()
for c in s:
    d.add(c)

for key in d:
    heads.append(key)

heads.sort()
ind = 0
ans = []
while True:
    if ind > len(heads)-1:
        break
    head = heads[ind]
    p = set()
    for i in range(len(s)):
        if s[i] == head:
            p.add(i)
    # print(head)
    ext = 0
    while True:
        flag = False
        dis = -1
        for key in p:
            if key+ext > n-1:
                flag = True
                dis = key
        if flag:
            p.discard(dis)
            # print(ext)
            # print(p)
        if not p:
            break
        for key in p:
            temp = s[key]
            for j in range(1,ext+1):
                temp += s[key+j]
            # print(temp)
            if temp not in ans:
                ans.append(temp)
        ext += 1
        if ext > 5:
            break
        if len(ans) >= 500:
            break
    if len(ans) >= 500:
        break
    else:
        ind += 1

# print(ans)
ans.sort()
print(ans[k-1])

# for i in range(len(s)):
#     if


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;

int main () {
    ull n, k;
    cin >> n >> k;

    ull a = n % k;
    ull b = abs((double)(k - a));
    if (a < b) {
        cout << a << endl;
    } else {
        cout << b << endl;
    }
}


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

int main(){
    long long int n, k;
    cin>>n>>k;
    long long int temp;
    temp=n%k;
    if(temp==0){
        cout<<0<<endl;
        return 0;
    }
    vector <long long int> v;

    for(int i=0; i<10000000; i++){
        temp=abs(temp-k);
        v.push_back(temp);
    }
    sort(v.begin(), v.end());

    if(v[0]>n){
        cout<<n<<endl;
        return 0;
    }
    cout<<v[0]<<endl;

    return 0;
}



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

int main(){
  int N,K;
  cin >> N >> K;
  vector<int> num(N);
  for(int i=0;i<N;i++){
    int A;
    cin >> A;
    num.at(A-1)++;
  }
  sort(num.begin(),num.end());
  reverse(num.begin(),num.end());
  int sum=0;
  for(int i=0;i<K;i++){
    sum+=num.at(i);
  }
  cout << N-sum << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<55;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n,k;
vi a;

int main(){
	cin>>n>>k;
	a=vi(n+2);
	for(int i=1;i<=n;i++) cin>>a[i];
	vvl dp(n+2,vl(k+1,INF));
	dp[0][0]=0;
	for(int i=0;i<=n;i++) for(int j=0;j<=k;j++) if(dp[i][j]<INF){
		for(int I=i+1;I<=n+1;I++){
			int J=I-i-1+j;
			if(J<=k){
				dp[I][J]=min(dp[I][J],dp[i][j]+max(0,a[I]-a[i]));
			}
		}
	}
	ll res=INF;
	for(int i=0;i<=k;i++) res=min(res,dp[n+1][i]);
	cout<<res<<endl;
}

Measured memory_bytes: 1024
// Etavioxy
#include<cstdio>
#include<cctype>
#include<cstring>
#include<algorithm>
#include<cmath>
#define il inline
#define ll long long
#define rep(i,s,t) for(register int i=(s);i<=(t);i++)
#define rev_rep(i,s,t) for(register int i=(s);i>=(t);i--)
#define each(i,u) for(int i=head[u];i;i=bow[i].nxt)
#define file(s) freopen(s".in" ,"r",stdin),freopen(s".out","w",stdout)
#define pt(x) putchar(x)
using namespace std;
il int ci(){
	register char ch;int f=1;
	while(!isdigit(ch=getchar()))f=ch=='-'?-1:1;
	register int x=ch^'0';
	while(isdigit(ch=getchar()))x=(x*10)+(ch^'0');
	return f*x;
}

enum{};

int main(){
	int a=ci(), b=ci(), c=ci(), d=ci(), e=ci();
	int T=c*60+d-(a*60+b)-e;
	printf("%d\n",T);
	return 0;
}


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

using namespace std;

#define REP(i, N) for (int i = 0; i < (int)N; i++)
#define RREP(i, N) for (int i =(int)N-1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define INF (1 << 30)
#define LLINF (1LL << 62)
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

typedef long long ll;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

int main(){
  int n,m;
  cin>>n>>m;
  int a[n];
  ll dp[n+1];
  //memset(dp,-1,sizeof(dp));
  dp[0]=1;dp[1]=1;
  REP(i,m){
    cin>>a[i];
  }

  int k=0;
  int df=a[k];
  if(df==1){
    dp[1]=0;
    k++;
    if(k<m)df=a[k];
  }
  for(int i=2;i<=n;i++){
    //cout<<k<<" "<<dp[i+2]<<endl;
    if(i==df){
      dp[i]=0;
      k++;
      if(k<m)df=a[k];
    }else{
      dp[i]=dp[i-1]%1000000007+dp[i-2]%1000000007;
    }
    if(dp[i]>=1000000007){
      dp[i]=dp[i]%1000000007;
    }
  }
  cout<<dp[n]<<endl;
}

Measured memory_bytes: 1408
N,M = map(int, input().split())
I = []

for i in range(N):
  I.append(list(map(int, input().split())))
  
I.sort()

ans, cnt = 0, 0
for i in range(N):
  if cnt + I[i][1] >= M:
    ans += I[i][0] * (M - cnt)
    break
  else:
    ans += I[i][0] * I[i][1]
    cnt += I[i][1]
    
print(ans)

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

using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define FILL(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define FILL2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
int __stoi(string s){ return atoi(s.c_str()); }
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}
template<class T> void chmax(T& a, T b){ if(a<b){a=b;} }
template<class T> void chmin(T& a, T b){ if(a>b){a=b;} }
template<class T> bool isIn(T a,vector<T> v){ for(T x:v){ if(a==x){return true;}} return false;}
string strReplace(string s,string target, string replacement){
    if (!target.empty()) {
      std::string::size_type pos = 0;
      while ((pos = s.find(target, pos)) != std::string::npos) {
        s.replace(pos, target.length(), replacement);
        pos += replacement.length();
      }
    }
    return s;
}
const ll MOD = 1e9+7;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define MP make_pair

bool DEBUG = 0;

int D; 
int c[30];
int s[400][30];
int t[400];


ll cal_score(int temp[]){
    int last[30] = {0};
    ll score = 0;
    for(int d=1;d<=D;++d){
        int i = temp[d];
        score += s[d][i];
        last[i] = d;
        for(int j=1;j<=26;++j){
            score -= c[j]*(d-last[j]);
        }
        //cout << score << "\n";
    }
    return score;
}

int main(){
    cin >> D;
    for(int i=1;i<=26;++i){ cin >> c[i]; }
    for(int d=1;d<=D;++d){ for(int i=1;i<=26;++i){ cin >> s[d][i]; } }
    
    int score_max = 0;
    
	random_device rand_d;
    default_random_engine e1(rand_d()*rand_d());
    uniform_int_distribution<int> uniform_dist(1, 26);   
    
    REP(count,30000){
        int temp[400];
        int last[30] = {0};
        for(int d=1;d<=D;++d){
            temp[d] = uniform_dist(e1);
            while(d - last[ temp[d] ] < min(7,d)){
                temp[d] = uniform_dist(e1);
            }                
            for(int i=1;i<=26;++i){
                if((double)(s[d][i]-c[i]*(d-last[i]))>(double)(s[d][temp[d]] - c[temp[d]]*(d-last[temp[d]]))*1.1){
                    temp[d] = i;
                }
            }
            last[ temp[d] ] = d;
        }
        if(cal_score(temp)>score_max){
            for(int d=1;d<=D;++d){
                t[d] = temp[d];
            }
        }
    }
    for(int d=1;d<=D;++d){
        cout << max(t[d]%27,1) << "\n";
    }
    if(DEBUG){
        cout << cal_score(t) << "\n";
    }
}


Measured memory_bytes: 3680
import math

x1, y1, x2, y2 = map(int, input().split())

a = x2 - x1
b = y2 - y1

x3 = x2 - b
y3 = y2 + a
x4 = x1 - b
y4 = y1 + a

print(x3, y3, x4, y4)


Measured memory_bytes: 2940
n = int(input())
abt = [chr(i) for i in range(97, 97+26)]
lst = [str(input()) for i in range(n)]
ans = ""
for i in abt:
    l = []
    for j in lst:
        l.append(j.count(i))
    ans += i*min(l)
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <map>
#include <utility>
#include <list>
#include <climits>
#include <bitset>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++)
#define in_arr(type, a, n) copy_n(istream_iterator<type>(cin), n, (a).begin());
#define ll long long int

int main(){
    int n;
    cin >> n;
    if(n < 3){
        cout << 0 << endl;
        return 0;
    }
    int sum = 0;
    rep(i, n + 1){
        int prd = 0;
        if(i % 2 == 0)
            continue;
        for(int j = 1; j <= i; j++){
            if(i % j == 0){
                prd++;
            }
        }
        if(prd == 8){
            sum++;
        }
    }
    cout << sum << endl;
    return 0;
}



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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

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

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

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


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

  int n;
  cin >> n;
  vector<ll> L(n), R(n);

  rep(i, n){
    cin >> L[i] >> R[i];
    R[i]++;
  }

  ll lmax = -1;
  ll rmin = 1e10;

  ll len_max = -1;
  rep(i, n){
    chmax(len_max, R[i] - L[i]);
    chmax(lmax, L[i]);
    chmin(rmin, R[i]);
  }

  vector<pair<ll, ll>> ab(n);

  ll ans = -1;
  chmax(ans, max(rmin-lmax, 0LL)+len_max);
  
  rep(i, n){

    ll a = max(R[i] - lmax, 0LL);
    ll b = max(rmin - L[i], 0LL);

    ab[i] = make_pair(a, -b);

  }

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

  ll w = 1e10;

  rep(i, n){
    if(i){
      chmax(ans, w + ab[i].first);
    }
    chmin(w, -ab[i].second);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 6348
#include <iostream> 
#include <bits/stdc++.h>
#include <vector> 
#include <algorithm> 
#include <string>
#include <cmath>
#include <iomanip> 
#include<climits> 
#include <utility>   
#include <set>
#include <numeric> 
#include <iterator>
#include <map> 
using namespace std; 
#define ll long long int
typedef pair<int,int> p; 
 

int main() {
int n,k;
cin>>n>>k;
int t=log10(n)/log10(k);
cout<< t+1;




}

Measured memory_bytes: 512
class in{struct It{int it;const bool rev;explicit constexpr It(int it_, bool rev=false):it(it_),rev(rev){}int operator*(){return it;}bool operator!=(It& r){return it!=r.it;}void operator++(){rev?--it:++it;}};const It i,n;public:explicit constexpr in(int n):i(0),n(n<0?0:n){}explicit constexpr in(int i,int n):i(i,n<i),n(n){}const It& begin(){return i;}const It& end(){return n;}};

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

int biMatch(const vector<vector<int>>& adj, int ln) { // adj: [0,ln)->inL [ln,n)->inR
    int n = adj.size();
    vector<int> matchTo(n, -1);
    vector<bool> used(n, false);
    function<bool(int)> dfs = [&](int v) {
        for(int nv : adj[v]) if(!used[nv]) {
            used[nv] = true;
            if(matchTo[nv] < 0 || dfs(matchTo[nv])) {
                matchTo[v] = nv;
                matchTo[nv] = v;
                return true;
            }
        }
        return false;
    };
    int ans = 0;
    for(int v : in(ln)) if(matchTo[v] < 0) {
        used.assign(n, false);
        if(dfs(v)) ++ans;
    }
    return ans;
}
template<typename T>
T gcd(T a, T b) {
    if(b == 0) return a;
    return gcd(b, a % b);
}
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m;
    while(cin >> n >> m && n) {
        vector<int> a(n), b(m);
        for(int& x : a) cin >> x;
        for(int& x : b) cin >> x;
        vector<vector<int>> adj(n + m);
        for(int i : in(n)) for(int j : in(m)) {
            if(gcd(a[i], b[j]) > 1) {
                int v = i, u = j + n;
                adj[v].emplace_back(u);
                adj[u].emplace_back(v);
            }
        }
        cout << biMatch(adj, n) << '\n';
    }
    return 0;
}

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

#define fi first
#define se second
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> ii;

const int len = 2e5+5;
const ll inf = 1e18;
int arr[len], n, x;
ll dp[len];

ll solve(int i){
    if (i == 0) return 0;
    if (dp[i] != -1) return dp[i];

    ll ans = inf, sum = 2*arr[i] + x, cur = 3;
    for (int j = i; j >= 1; j--){
        sum += arr[j]*1LL*cur;
        cur += 2;
        ans = min(ans, sum + solve(j-1));
    }

    //printf("i = %d, ans = %lld\n", i, ans);
    return dp[i] = ans;
}

ll check(int k){
    //printf("k = %d\n", k);
    ll ans = (n+k)*1LL*x;
    int cur = 3, pos = n;
    while (pos > 0){
        //printf("pos = %d\n", pos);
        for (int temp = 0; temp < k && pos > 0; temp++){
            if (cur == 3)
                ans += 5*1LL*arr[pos];
            else
                ans += cur*1LL*arr[pos];

            pos--;
        }

        cur+=2;
    }

    return ans;
}

int main(){
    scanf("%d %d", &n, &x);
    for (int i = 1; i <= n; i++)
        scanf("%d", &arr[i]);
    //for (int i = 1; i <= n; i++)
      //  dp[i] = -1;

    int l = 0, r = n;
    while (l+1 < r){
        int mid = (l+r)/2;
        if (check(mid) < check(mid+1))
            r = mid;
        else
            l = mid;
    }

    printf("%lld\n", check(l+1));
    return 0;
}


Measured memory_bytes: 1024
#pragma GCC optimize "-O3"
#pragma GCC target ("avx")
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v),greater<int>())
#define SPEED ios::sync_with_stdio(false);cin.tie(0);cout<<fixed<<setprecision(12)
signed gcd(int a, int b){return b?gcd(b,a%b):a;}
signed lcm(int a, int b){return a*b/gcd(a,b);}
//priority_queue<int, vi, greater<int> > que;//昇順

using namespace std;

const int mod=1e9+7;

signed main(){
    SPEED;
    int a,b;
    cin >> a >> b;
    if(a%3==0||b%3==0||(a+b)%3==0)
    {
        cout << "Possible" << endl;
    }
    else
    {
        cout << "Impossible" << endl;
    }
}


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

using namespace std;

int n;
long long b[65], a[100005];

void insert(long long v) {
    for (int i = 59; i >= 0; i--) {
        if ((v >> i) & 1) {
            if (b[i]) v ^= b[i];
            else {
                b[i] = v;
                for (int j = i - 1; j >= 0; j--) if ((b[i] >> j) & 1) b[i] ^= b[j];
                for (int j = i + 1; j < 60; j++) if ((b[j] >> i) & 1) b[j] ^= b[i];
                break;
            }
        }
    }
}

int main() {
    scanf("%d", &n);

    for (int i = 0; i < n; i++) scanf("%lld", &a[i]);

    long long x = 0;

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

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 60; j++) {
            if (x >> j & 1) a[i] &= ~(1LL << j);
        }

        insert(a[i]);
    }


    long long res = 0;

    for (int i = 0; i < 60; i++) res ^= b[i];

    printf("%lld\n", x + 2LL * res);
}


Measured memory_bytes: 1152