akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

int main()
{
	int n;
	long long pre_x, a, b, count{};
	scanf("%d%lld%lld", &n, &a, &b);
	scanf("%lld", &pre_x);
	for (int i = 1; i < n; i++)
	{
		long long x;
		scanf("%lld", &x);
		count += std::min(b, a * (x - pre_x));
		pre_x = x;
	}
	printf("%lld\n", count);

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int Parent(int);
int Left(int);
int Right(int);

int main(){
  int h,i,key,A[250],pn,ln,rn;
  scanf("%d",&h);
  for(i=0;i<h;i++){
    scanf("%d",&key);
    A[i+1]=key;
  }
  for(i=0;i<h;i++){
    printf("node %d: ",i+1);
    printf("key = %d, ",A[i+1]);
    if(i!=0){
      pn=Parent(i+1);
      printf("parent key = %d, ",A[pn]);
    }
    if(Left(i+1)<=h){
    ln=Left(i+1);
    printf("left key = %d, ",A[ln]);
    }
    if(Right(i+1)<=h){
    rn=Right(i+1);
    printf("right key = %d, ",A[rn]);
    }
    printf("\n");
  }
  
  return 0;
}

int Parent(int x){
  return x/2;
}
int Left(int x){
  return 2*x;
}
int Right(int x){
  return 2*x+1;
}



Measured memory_bytes: 2044
mod = 10**9 + 7

g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
N = 10**6

def main():
    x, y = map(int, input().split(' '))
    if (2*x-y) % 3 == 0 and (2*y-x) % 3 == 0:
        n = (2*x-y) // 3
        m = (2*y-x) // 3
        for i in range( 2, N + 1 ):
            g1.append( ( g1[-1] * i ) % mod )
            inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
            g2.append( (g2[-1] * inverse[-1]) % mod )
        print(cmb(n+m, n, mod))
    else:
        print(0)


def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod


if __name__ == '__main__':
    main()


Measured memory_bytes: 124040
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define i_cin(X) scanf("%d", &X)
#define i_cin2(X,Y) scanf("%d %d",&X,&Y)
#define i_cin3(X,Y,Z) scanf("%d %d %d",&X,&Y,&Z)
#define l_cin(X) scanf("%ld",&X)
#define s_cin(X) scanf("%s",&X)

#define  i_cout(X) printf("%d\n",X)
#define  l_cout(X) printf("%ld\n",X)
#define  s_cout(X) printf("%s\n",X)
#define  ll_cout(X) printf("%lld\n",X)

int main(void) {
	int   N,tmp;
	char  str[4];
	i_cin(N);
	snprintf(str, sizeof(str), "%d", N);
	if(str[0]==str[2])
		 s_cout("Yes");
	else s_cout("No");
	return 0;
}


Measured memory_bytes: 128
from math import *
n,m = map(int,input().split())
sol = 0
a = 1900 * m + 100 * (n - m)
pot = 2 ** m 
for i in range(1,1000):
    sol += i * ( (pot - 1) ** (i- 1) / (pot) ** i)
print(ceil(sol * a))


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

int main(){
    int N,highest,total;
    cin >> N;
    int P[N]={};
    highest = 0;
    total = 0;
    for(int i =0;i<N;i++){

        cin >> P[i];
        total += P[i];
        if(P[i]>highest){
            highest = P[i];
        }

    }
    cout << total - (highest/2) <<endl;



}

Measured memory_bytes: 256
from itertools import accumulate
from collections import Counter
N = int(input())
Alist = [0]+list(map(int, input().split()))
cumsum = Counter(sorted(list(accumulate(Alist)))).most_common()
ans = 0

for k, v in cumsum:
    if v > 1:
        ans += v*(v-1)//2
    else:
        break
print(ans)


Measured memory_bytes: 48508
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>

#define sl(x) scanf("%ld", &x)
#define ss(x) scanf("%s", x)
#define pl(x) printf("%ld\n", x)
#define ps(x) printf("%s\n", x)

#define INF 100000000000
#define M 1000000007

#define min(a,b) (((a)<(b))?(a):(b))
#define max(a,b) (((a)>(b))?(a):(b))

int main() {
	long N;
	long i, j;
	long upper;
	long sum;
	long dif;
	long ans = 0;
	
	sl(N);
	upper = (long)ceil((-1 + sqrt(1 + 8*N)) / 2);
	sum = upper*(upper+1)/2;
	
	dif = sum - N;
	
	for(i=1;i<=upper;i++) {
		if(i != dif) pl(i);
	}
	
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <queue>
using namespace std;
#define rep2(x,from,to) for(int x=(from);x<(to);++(x))
#define rep(x,to) rep2(x,0,to)

int main() {
	int m,n,x,y;
	cin >> m >> n;
	vector<vector<int> > g(m+1);
	map<int, int> ma;
	rep2(i,1,m+1) {
		ma.insert(make_pair(i,0));
	}
	rep(i,n) {
		cin >> x >> y;
		g[x].push_back(y);
		ma[y]++;
	}
	while(1) {
		bool f = 1;
		for(auto it = ma.begin(); it != ma.end(); ++it) {
			int i = (*it).first, j = (*it).second;
			if(j == 0) {
				cout << i << endl;
				(*it).second--;
				for(int a : g[(*it).first]) {
					ma[a]--;
				}
			} else if(j > 0) {
				f = 0;
			}
		}
		if(f) break;
	}
	return 0;
}

Measured memory_bytes: 1212
/*
Code By RyeCatcher
*/
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <ext/pb_ds/hash_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <queue>
#define ri register int 
#define ll long long 
#define ull unsigned long long 
using std::min;
using std::max;
using std::lower_bound;
using namespace __gnu_pbds;
template <class T>inline void read(T &x){
    x=0;int ne=0;char c;
    while(!isdigit(c=getchar()))ne=c=='-';
    x=c-48;
    while(isdigit(c=getchar()))x=(x<<3)+(x<<1)+c-48;
    x=ne?-x:x;return ;
}
const int maxn=200005;
const int inf=0x7fffffff;
int n,nn,a[maxn],b[maxn],c[maxn],mx=-inf,mi=inf;
ll sum[maxn<<2];
inline void update(int x,int d){for(;x<=nn;x+=x&(-x))sum[x]+=d;}
inline ll query(int x){ll ans=0;for(;x;x-=x&(-x))ans+=sum[x];return ans;}
inline ll chk(int k){
    ll ans=0;
    b[0]=0;
    for(ri i=1;i<=n;i++){
        b[i]=b[i-1]+((a[i]<=k)?1:-1);
        c[i]=b[i];
        ans+=(b[i]>0);
    }
    std::sort(c+1,c+1+n);
    nn=std::unique(c+1,c+1+n)-(c+1);
    memset(sum,0,sizeof(sum));
    for(ri i=1;i<=n;i++){
    	b[i]=lower_bound(c+1,c+1+nn,b[i])-c;
        ans+=query(b[i]-1);
        update(b[i],1);
    }
    return ans;
}
int main(){
    read(n);
    for(ri i=1;i<=n;i++){
        read(a[i]);
        mi=min(mi,a[i]),mx=max(mx,a[i]);
    }
    int L=mi,R=mx,mid,ans;
	ll lim=1ll*n*(n+1)/4+1;//注意long long 
    while(L<=R){
        mid=(L+R)>>1;
        if(chk(mid)>=lim)ans=mid,R=mid-1;
        else L=mid+1;
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 8448
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a[3]= {0};
    cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    int sum = 0;
    sum += a[1]-a[0];
    sum += a[2]-a[1];
    cout<<sum;
    return 0;
}


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

int main(){
    int N;
    cin >> N;
    vector<int> A(N-1);
    for(int i=0; i<N-1; i++) cin >> A.at(i);
    vector<int> number(N, 0);
    for(int i=0; i<N-1; i++) number.at(A.at(i) - 1)++;
    for(int i=0; i<N; i++) cout << number.at(i) << endl;
}

Measured memory_bytes: 4824
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
 
int main() {
    ll n;
    cin >> n;

    vl t(n);
    rep(i, n) {
        cin >> t[i];
    }

    vl a(n);
    rep(i, n) {
        cin >> a[i];
    }

    vl Taka(n, -1);  // Taka[i] : 高橋君の情報からわかる山iの高さ。不明なときは-1
    Taka[0] = t[0];
    ll now = t[0];  // 現在の山の高さの最大値
    exrep(i, 1, n-1) {
        if(t[i] > now) {
            Taka[i] = t[i];
            now = t[i];
        }
    }

    vl Aoki(n, -1);  // Aoki[i] : 青木君の情報からわかる山iの高さ。不明なときは-1
    Aoki[n-1] = a[n-1];
    now = a[n-1];
    for(ll i = n-2; i >= 0; i--) {
        if(a[i] > now) {
            Aoki[i] = a[i];
            now = a[i];
        }
    }

    vl v(n);  // v[i] : 二人の情報を合わせてわかる山iの高さ。不明なときは-1
    rep(i, n) {
        if(Taka[i] == Aoki[i]) {  // 二人の情報が一致している(不明なときも含めて)とき
            v[i] = Taka[i];
        }
        else {  // 二人の情報が一致していないとき
            if(Aoki[i] == -1) {
                v[i] = Taka[i];
            }
            else if(Taka[i] == -1) {
                v[i] = Aoki[i];
            }
            else {
                out(0);
                re0;
            }
        }
    }

    ll ans = 1;
    rep(i, n) {
        if(v[i] == -1) {
            ans *= min(t[i], a[i]);
            ans %= mod;
        }
        else if(min(t[i], a[i]) < v[i]) {
            out(0);
            re0;
        }
    }

    out(ans);
    re0;
}

Measured memory_bytes: 4224
#include<bits/stdc++.h>
#define del(a,i) memset(a,i,sizeof(a))
#define ll long long
#define inl inline
#define il inl void
#define it inl int
#define ill inl ll
#define re register
#define ri re int
#define rl re ll
#define mid ((l+r)>>1)
#define lowbit(x) (x&(-x))
#define INF 0x3f3f3f3f
using namespace std;
template<class T>il read(T &x){
	int f=1;char k=getchar();x=0;
	for(;k>'9'||k<'0';k=getchar()) if(k=='-') f=-1;
	for(;k>='0'&&k<='9';k=getchar()) x=(x<<3)+(x<<1)+k-'0';
	x*=f;
}
template<class T>il _print(T x){
	if(x/10) _print(x/10);
	putchar(x%10+'0');
}
template<class T>il print(T x){
	if(x<0) putchar('-'),x=-x;
	_print(x);
}
ll mul(ll a,ll b,ll mod){long double c=1.;return (a*b-(ll)(c*a*b/mod)*mod)%mod;}
it qpow(int x,int m,int mod){
	int res=1,bas=x;
	while(m){
		if(m&1) res=(1ll*res*bas)%mod;
		bas=(1ll*bas*bas)%mod,m>>=1;
	}
	return res;
}
const int MAXN = 2e5+5;
int n,val[MAXN],dp[MAXN],ans;
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	read(n),dp[0]=1;
	for(ri i=1;i<=n;++i)
		read(val[i]);
	for(ri i=1;i<=n;++i)
		dp[val[i]]|=dp[val[i]-1];
	for(ri i=1;i<=n;++i)
		if(dp[i]) ans=i;
	if(ans) print(n-ans);
	else print(-1);
	return 0;
}

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

long long a, b, c, d;

int main(){
	cin>>a>>b>>c>>d;
	while(a>=0&&c>=0){
		c=c-b;
		if(c<=0){
			cout<<"Yes"<<endl;
			break;
		}
		a=a-d;
		if(a<=0){
			cout<<"No"<<endl;
			break;
		}
	}
}


Measured memory_bytes: 3636
import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))
lb, ub = max(0, sum(A) - N * (N-1)), sum(A)
for S in range(lb, ub+1):
    s = 0
    for a in A:
        x = (a + S) // (N + 1)
        if 0 <= a - (N + 1) * x + S <= N - 1:
            s += x
        else:
            break
    else:
        if S == s:
            print(S)
            break

Measured memory_bytes: 38896
#define _CRT_SECURE_NO_WARNINGS 1

#include <cmath>
#include <cstdio>
#include <string>
#include <vector>

using namespace std;

#define MAX_LETTERS  12

const char Alphabet[4] = { 'A', 'C', 'G', 'T' };

int cipher(string S)
{
	int Ans = 0;

	for (string::size_type i = 0; i < S.size(); i++)
	{
		for (int j = 0; j < 4; j++)
		{
			if (Alphabet[j] == S[i])
			{
				Ans += pow<int>(sizeof(Alphabet) / sizeof(const char), S.size() - i - 1) * j;
			}
		}
	}

	return Ans;
}

int main()
{
	vector<vector<bool> > D;

	unsigned n;

	for (int i = 0; i <= MAX_LETTERS; i++)
	{
		D.push_back(vector<bool>(pow<unsigned>(sizeof(Alphabet) / sizeof(const char), i), false));
	}

	scanf("%d", &n);

	vector<string> W;

	vector<bool> F(n);

	for (vector<bool>::size_type i = 0; i < n; i++)
	{
		char S1[20], S2[20];

		string S3, S4;

		scanf("%s%s", &S1, &S2);

		S3 = S1;
		S4 = S2;

		if (S3 == "find")
		{
			F[i] = true;
		}

		W.push_back(S4);
	}

	for (vector<string>::size_type i = 0; i < n; i++)
	{
		if (F[i] == false)
		{
			D[W[i].size()][cipher(W[i])] = true;
		}
		else
		{
			printf("%s\n", (D[W[i].size()][cipher(W[i])] ? "yes" : "no"));
		}
	}

	return 0;
}

Measured memory_bytes: 58708
#include<stdio.h>
#include<stdlib.h>

#define MAX 100001

typedef struct node{
  int p;
  int l;
  int r;
} Tree;

int main(){
  int n,i,j,id,k,c,r=0,p,d;
  Tree T[MAX];

  scanf("%d",&n);

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

  for(i=0;i<n;i++){
    scanf("%d%d",&id,&k);

    for(j=0;j<k;j++){
      scanf("%d",&c);
      T[c].p=id;

      if(j==0){
	T[id].l=c;
      }else{
	T[r].r=c;
      }

      r=c;
    }
  }

  for(i=0;i<n;i++){
    d=0;
    p=T[i].p;

    while(p!=-1){
      p=T[p].p;
      d++;
    }

    if(d==0){
      printf("node %d: parent = -1, depth = 0, root, [",i);
    }else if(T[i].l==-1){
      printf("node %d: parent = %d, depth = %d, leaf, [",i,T[i].p,d);
    }else{
      printf("node %d: parent = %d, depth = %d, internal node, [",i,T[i].p,d);
    }

    p=T[i].l;

    if(p!=-1){
      printf("%d",p);
    }

    while(p!=-1){
      p=T[p].r;

      if(p!=-1){
	printf(", %d",p);
      }
    }

    printf("]\n");
  }

  return 0;
}    

Measured memory_bytes: 1784
#include<iostream>
#include<map>
#include<string>
#include<utility>
#include<vector>
#include<cmath>
#include<algorithm>
#define rep(i, n) for(int i=0; i<n; i++)
#define rrep(i, n) for(int i=n-1; i>=0; i--)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define rFOR(i, a, b) for(int i=b; i>=a; i--)
#define MAX 10
typedef long long ll;
using namespace std;

int main(void){
  int u[] = {0, 1, 2, 1, 4, 1, 4, 1, 1, 4, 1, 4, 1};
  int x, y; cin >> x >> y;
  if(u[x]==u[y])  cout << "Yes" << endl;
  else  cout << "No";
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<queue>
using namespace std;

struct UnionFind {
    vector<int> d;
    UnionFind(int n): d(n,-1) {}
    int find(int x){
        if(d[x]<0) return x;
        return d[x] = find(d[x]);
    }
    bool unite(int x,int y){
        x = find(x); y = find(y);
        if(x==y) return false;
        if(d[x]>d[y]) swap(x,y);
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    bool same(int x,int y){
        return find(x)==find(y);
    }
    int size(int x){
        return -d[find(x)];
    }
};

int deg[100005];
vector<int> to[100005];

int main(){
    int n,m,k;
    cin >> n >> m >> k;
    UnionFind uf(n);

    for(int i=0;i<m;i++){
        int x,y;
        cin >> x >> y;
        x--; y--;
        deg[x]++;
        deg[y]++;
        uf.unite(x,y);
    }
    for(int i=0;i<k;i++){
        int x,y;
        cin >> x >> y;
        x--; y--;
        to[x].push_back(y);
        to[y].push_back(x);
    }
    for(int i=0;i<n;i++){
        int ans = uf.size(i)-1-deg[i];
        for(int c : to[i]){
            if(uf.same(i,c)) --ans;
        }
        cout << ans << ' ';
    }
    cout << endl;
    return 0;




}

Measured memory_bytes: 6784
#include <bits/stdc++.h>
using namespace std;
#define mod 998244353
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3fll
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
int n;
ll a[404],sum[404];
ll dp[404][404];
inline void upd(ll &a,ll b)
{
	if(a>b)a=b;
}
int main()
{
	memset(dp,0x3f,sizeof(dp));
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%lld",&a[i]);
		dp[i][i]=0;
	}
	sum[0]=a[0];
	for(int i=1;i<n;i++)sum[i]=sum[i-1]+a[i];
	for(int len=2;len<=n;len++)
	{
		for(int l=0,r=l+len-1;r<n;l++,r++)
		{
			for(int k=l;k<r;k++)//[l,k],[k+1,r]
			{
				upd(dp[l][r],dp[l][k]+dp[k+1][r]);
			}
			dp[l][r]+=sum[r]-(l?sum[l-1]:0);
		}
	}
	printf("%lld\n",dp[0][n-1]);
	return 0;
}

Measured memory_bytes: 1536
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
using namespace std;

#define ll long long
#define INF (1 << 30)
#define INFLL (1LL << 60)

#define FOR(i,a,b) for(ll i = (a);i<(b);i++)
#define REP(i,a) FOR(i,0,(a))
#define MP make_pair

int main() {
	string str;
	cin >> str;
	cout << str[0] << str.size() - 2 << str[str.size()-1] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <numeric>
#include <algorithm>
#include <utility>


using std::cout;
using std::cin;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;


ll gcd(ll a, ll b) {
    while (b != 0) {
        auto tmp = a;
        a = b;
        b = tmp % a;
    }
    return a;
}

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


void oneCase () {
    int n;
    cin >>n;
    vector<int> time(n);
    int total = 0;
    for (auto& value : time) {
        cin >> value;
        total += value;
    }
    int d;
    cin >> d;
    for (int i = 0; i < d; ++i) {
        int drink, newtime;
        cin >> drink >> newtime;
        cout << total - time[drink - 1] + newtime << "\n";
    }


}





int main() {
    int t = 1;
//    cin >> t;
    while (t > 0) {
        oneCase();
        --t;
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int n,ans[200005];
int main(){
	cin>>n;
	for(int i=2;i<=n;i++){
		int x;
		scanf("%d",&x);
		ans[x]++;
	}
	for(int i=1;i<=n;i++)
		printf("%d\n",ans[i]);
}

Measured memory_bytes: 4500
#include <bits/stdc++.h>
#define F(i, l, r) for(int i = (l), _end_ = (int)(r); i <= _end_; ++i)
#define f(i, r, l) for(int i = (r), _end_ = (int)(l); i >= _end_; --i)
#define Set(a, v) memset(a, v, sizeof(a))
#define file(a) freopen(a".in","r",stdin),freopen(a".out","w",stdout)
using namespace std;

template<typename T>bool chkmax(T &a,T b){return (a<b)?a=b,1:0;}
template<typename T>bool chkmin(T &a,T b){return (a>b)?a=b,1:0;}

inline int read() {
 int x = 0, fh = 1; char ch = getchar();
    for (; !isdigit(ch); ch = getchar() ) if (ch == '-') fh = -1;
    for (; isdigit(ch); ch = getchar() ) x = (x<<1) + (x<<3) + (ch ^ '0');
    return x * fh;
}
int n;
int a[100005];
int k;
int dis[100005];
vector<int>G[100005];
int ans;
void dfs(int x){
	dis[x]=1;
   for(int v:G[x]){
        dfs(v);
		chkmax(dis[x],dis[v]+1);
   }
   if(dis[x]>=k&&a[x]!=1){
     a[x]=1;
	 ans++;
	 dis[x]=0;
   }
}
int main () {
#ifndef ONLINE_JUDGE
//file("agc004d");
#endif
    n=read();
	k=read();
	F(i,1,n)a[i]=read();
    ans=a[1]!=1;
	a[1]=1;
	F(i,2,n)G[a[i]].push_back(i);
    dfs(1);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 11136
import java.util.Scanner;


public class Main {


  public static void main(String[] args) {

	  Scanner sc=new Scanner(System.in);
	  int H,W;
	  int n=Integer.MAX_VALUE;
	 
	  for(int i=0;i<n;i++){
		  H=Integer.parseInt(sc.next());
		  W=Integer.parseInt(sc.next());
		if(H==0&&W==0){
			break;
		}
		else{
			for(int j=0;j<H;j++){
				for(int k=0;k<W;k++){
					System.out.print("#");
				}
				System.out.println("");
			}
			System.out.println("");
		}
	  
	  }
	
		 
	

  }
}

Measured memory_bytes: 25792
// Mode value

#include <iostream>
#include <algorithm>
#include <vector>

using std::cout;		using std::endl;
using std::cin;			using std::sort;
using std::vector;

int main(void)
{
	int num;
  int counters[101] = {0};
	int max_count = 1;
	vector<int> numbers;

  while (cin >> num) {
    counters[num]++;
  }

  for (int i = 1; i <= 100; i++) {
    if (max_count < counters[i]) {
      if (numbers.empty()) {
        numbers.push_back(i);
      } else {
        numbers.erase(numbers.begin(), numbers.end());
        numbers.push_back(i);
      }
      max_count = counters[i];
    } else if (max_count == counters[i]) {
      numbers.push_back(i);
    }
  }

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

  for (vector<int>::const_iterator iter = numbers.begin(); iter != numbers.end(); iter++) {
    cout << *iter << endl;
  }

  return 0;
} 

Measured memory_bytes: 1216
n,m=map(int,input().split())
s=list(map(int,input().split()))
t=list(map(int,input().split()))
dp=[(m+1)*[1]for _ in range(n+1)]
for i in range(n):
  for j in range(m):
    dp[i+1][j+1]=dp[i][j+1]+dp[i+1][j]
    if s[i]!=t[j]:dp[i+1][j+1]-=dp[i][j]
    dp[i+1][j+1]%=(10**9+7)
print(dp[-1][-1])

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

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

string s;
int main(){
  int k;
  cin>>s>>k;
  int n=s.size();
  for(int j=0;j<n;++j){
    if(s[j]=='a')continue;
    int cha = 'z'-s[j]+1;
    if(k>=cha){
      k-=cha;
      s[j]='a';
    }
  }
  k%=26;
  if(k)s[n-1]+=k;
  if(s[n-1]>'z')s[n-1]-=26;
  cout<<s<<endl;
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep1(i,n) for(ll i=1;i<(ll)n;i++)
#define repf(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define repr(i,a,b) for(ll i=(ll)a-1;i>=(ll)b;i--)
#define Fi first
#define Se second
typedef pair<ll, ll> pll;
const ll MAX = 1000;
const char END = '\n';

ll youkurido(ll x, ll y) {
	if (x > y) swap(x, y);
	ll n = y % x;
	if (n == 0)
		return x;
	else
		youkurido(x, n);
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	ll N, X;
	cin >> N >> X;
	vector<ll> x(N);
	rep(i, N) {
		cin >> x[i];
		x[i] = X - x[i];
		if (x[i] < 0)
			x[i] *= -1;
	}
	ll Ans = x[0];
	rep1(i, N)
		Ans = youkurido(Ans, x[i]);

	cout << Ans << END;

	return 0;
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
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;
}

int main() {
  int N; cin >> N;
  vector<ll> A(N); REP(i, N) cin >> A[i];
  // 尺取法
  ll ans = 0;
  int right = 0;
  int sum = 0;
  for(int left = 0; left < N; ++left) {
    while(right < N && (sum ^ A[right]) == (sum + A[right])) {
      // 条件を満たし続けるまでsumとrightをカウントアップする
      sum += A[right];
      ++right;
    }
    // 条件を満たさなくなったら、いまのleftからrightを引く。
    // なぜなら、条件を満たす区間の部分区間もまた条件を満たすから(非自明なので怖い)
    ans += right - left;
    if(left == right) ++right; // もしleftがrightにたどり着いたら、rightを動かす
    else {
      sum -= A[left]; // leftが一つ左に動くので、a[left]分だけsumから削除する
    }
  }
  cout << ans << endl;
}

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

using namespace std;

#define inf 1<<30
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
typedef long long llong;
typedef unsigned long long ullong;
typedef pair<int, int> P;


int main(){
	string s;
	cin >> s;
	llong cnt = 0;
	llong w = 0;
	for(int i = (int)s.size()-1; i >= 0; i--){
		if(s[i] == 'W')
			w++;
		else
			cnt += w;
	}

	cout << cnt << endl;

	return 0;
}



// WWWBBBBBBBBWWWWWBW

Measured memory_bytes: 640
#include <cstdio>
#include <iostream>
using namespace std;
int ans = 0;
void judge(int a[], int aa, int b,int  c) {
	if (aa == 10)ans = 1;
	if (a[aa] > b) {
		if (a[aa] > c)
		{
			judge(a, aa + 1, a[aa], c);
			judge(a, aa + 1, b, a[aa]);
		}
		judge(a, aa + 1, a[aa], c);
	}
	else if (a[aa] > c)judge(a, aa + 1, b, a[aa]);
}
int main() {
	int n;
	int a[10] = { 0 };
	cin >> n;
	for (int i = 0; i < n; i++) {
		ans = 0;
		for (int j = 0; j < 10; j++) {
			cin >> a[j];
		}
		judge(a, 0, 0, 0);
		if (ans == 1)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	}

Measured memory_bytes: 1152
n, k = map(int, input().split())
A = [int(input()) for i in range(n)]
A = [a-k for a in A]

from itertools import accumulate
C = [0]+A
C = list(accumulate(C))
#print(C)

class BIT:
    def __init__(self, n):
        self.n = n
        self.bit = [0]*(self.n+1) # 1-indexed

    def init(self, init_val):
        for i, v in enumerate(init_val):
            self.add(i, v)

    def add(self, i, x):
        i += 1 # to 1-indexed
        while i <= self.n:
            self.bit[i] += x
            i += (i & -i)

    def sum(self, i, j):
        # return sum of [i, j)
        return self._sum(j) - self._sum(i)

    def _sum(self, i):
        # return sum of [0, i)
        res = 0
        while i > 0:
            res += self.bit[i]
            i -= i & (-i)
        return res

B = list(set(C))
B.sort(reverse=True)
D = {}
for i, b in enumerate(B):
    D[b] = i

C = [D[c] for c in C]
bit = BIT(max(C)+1)
ans = 0
for c in C:
    ans += bit.sum(c, bit.n)
    bit.add(c, 1)
print(ans)

Measured memory_bytes: 55516
#include <bits/stdc++.h>
using namespace std;
typedef long long llong;
llong MOD = 1000000007LL;

llong ModInv(llong a, llong m) {
  llong b = m, u = 1, v = 0;
  while (b) {
    llong t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

llong Combi(const int& n, const int& k) {
  llong value = 1LL;
  for (int i = n; i > n - k; i--) {
    value = (value * i) % MOD;
  }
  for (int i = k; i > 1; i--) {
    value = (value * ModInv(i, MOD)) % MOD;
  }
  return value;
}

int main() {
  int x, y;
  cin >> x >> y;
  if (x < y) swap(x, y);
  int diff = x - y;
  if (y - diff < 0 || (y - diff) % 3 != 0) {
    cout << 0 << endl;
    return 0;
  }
  int count_a = (y - diff) / 3 + diff;
  int count_b = (y - diff) / 3;
  cout << Combi(count_a + count_b, count_b) << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

static const int N = 10000;
static const int MIN = 2;
static const int MAX = 10*10*10*10*10*10*10*10;

int main(){
  int n, i,j,count=0,flag,a=0;
  int A[N+1];

  scanf("%d", &n);

  for ( i = 1; i <= n; i++ ){
    scanf("%d", &A[i]);
  }

  for(i = 1; i <= n; i++){
    if(A[i] == 2){
      a = 1;
    }
    if(A[i]%2 == 1){
      flag = 0;
      for(j = 3; j <= sqrt(A[i]); j+=2){
        if(A[i] % j==0){
          flag = 1;
          break;
        }
      }    
      if(flag == 0){
        count++;
      }
    }
  }
  if(a == 1){
    count++;
  }
  printf("%d\n",count);
  
  return 0;
}

Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <utility>
#include <string>
#include <stack>
#include <regex>
#include <numeric>
#include <queue>
#include <set>
 
#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;

int main(int argc, char const *argv[])
{
  string s, t;
  cin >> s >> t;
  ll res = 0;
  REP(i,3) {
    if (s[i] == t[i]) {
      res++;
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, L;
  cin >> N >> L;
  int S = 0;
  vector<int> vec(N);  
  for(int i = 0; i < N; i++){
    S += (L + i);
    vec.at(i) = L + i;
  }
  
  if(L >= 0){
    sort(vec.begin(),vec.end());
    cout << S - vec.at(0) << endl;
    return 0;
  }
  if(L < 0){
    if(L + N -1 >= 0){
      cout << S << endl;
      return 0;
    }
    if(L + N -1 < 0){
      sort(vec.begin(),vec.end());
      cout << S - vec.at(N-1);
      return 0;
    }
  }
}

  

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

using ll = long long int;
using P = pair<int,int>;
using P3 = pair<ll,P>;
using PP = pair<P, P>;
constexpr int INF = 1<<30;
constexpr ll MOD = 100000;
constexpr int di[] = {0,1,0,-1};
constexpr int dj[] = {1,0,-1,0};

bool chmin(int &a, int b){
    a = min(a, b);
    return a > b;
}

int h, w;
int a[30][30];
map<int,int> d[30][30];

int dijkstra(){
    d[h-1][w-1][0] = 0;
    priority_queue<PP, vector<PP>, greater<PP> > que;
    que.push(PP(P(0,0),P(h-1,w-1)));
    while(!que.empty()){
        PP pp = que.top();
        que.pop();
        int i = pp.second.first, j = pp.second.second;
        int c = pp.first.second;
        if(i==0 && j==0) return pp.first.first;
        if((*--d[i][j].upper_bound(c)).second < pp.first.first) continue;
        for(int k=0;k<4;k++){
            int ni = i+di[k], nj = j+dj[k];
            int nc = c+a[i][j];
            if(ni<0 || ni>=h) continue;
            if(nj<0 || nj>=w) continue;
            int tmp = d[i][j][c] + c*2 + a[i][j];
            if(d[ni][nj].empty()){
                d[ni][nj][nc] = tmp;
                que.push(PP(P(tmp, nc),P(ni,nj)));
            }else{
                auto itr = d[ni][nj].upper_bound(nc);
                if(itr == d[ni][nj].begin() || (*--itr).second > tmp){
                    d[ni][nj][nc] = tmp;
                    que.push(PP(P(tmp, nc),P(ni,nj)));
                }
            }
        }
    }
}

bool solve(){
    cin >> h >> w;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin >> a[i][j];
        }
    }
    cout << dijkstra() << endl;
    return true;
}

int main(){
    solve();
    return 0;
}



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

int main() {
    int n, k; cin >> n >> k;
    string s; cin >> s;
    vector<int> sum = {0};
    if(s[0] == '1') sum.push_back(0);
    {
        int cur = 1;
        for(int i = 1; i < n; ++i) {
            if(s[i - 1] != s[i]) {
                sum.push_back(cur);
                cur = 1;
            } else {
                cur += 1;
            }
        }
        sum.push_back(cur);
    }
    for(int i = 0; i + 1 < (int)sum.size(); ++i) {
        sum[i + 1] += sum[i];
    }

    int ans = 0;
    for(int i = 0; i < (int)sum.size(); ++i) {
        const int r = min((int)sum.size() - 1, 2 * k + (i & 1) + i);
        ans = max(ans, sum[r] - sum[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1020
import java.util.Scanner;
  
class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String str = scan.nextLine().toLowerCase();
		int ans = 0;
		while (scan.hasNextLine()) {
			String str2 = scan.nextLine();
			if (str2.equals("END_OF_TEXT")) {
				break;
			}
			String[] str3 = str2.split(" ");
			for (int i = 0, l = str3.length; i < l; i++) {
				String s = str3[i];
				if (s.toLowerCase().equals(str)) {
					ans++;
				}
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 17164
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std; using ll = long long; using ld = long double;  using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vlll = vector<vll>; using vpll = vector<pll>;
using vs = vector<string>; using tll = tuple<ll, ll, ll>; using vtll = vector<tll>;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
const ld PI = 3.1415926535897932;
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define co(i) cout << i << endl;
#define co2(i,j) cout << i << " " << j << endl;
#define co3(i) cout << i << " ";
#define po(i) cout << i.first << " " << i.second << endl;
void in() {}
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.second < secondElof.second;
}
//AtCoder以外ではコメントアウトを忘れずに！
#include <atcoder/all>
using namespace atcoder;
//**Snippetリスト**//
//rep, vin, all, iteLoop, bitSearch, bitList, nod, LIS, digitDP, treeDP, Rerooting//
//gcdlcm, isPrime, eratos, primeFactorize, Npow, combination, divisor, modinv, doubling//
//dfs, bfs, dijkstra, WarshallFloyd, BellmanFord, UnionFind, Kruskal, RMQ, LCA, FordFulkerson//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R, Q, T;
ll MOD = 1000000007, INF = 1LL << 60, ans = 0, z = 0, o = 1;
vll flag, D; vector<vpll> path; vs S;
int main() {
	ll N, D;
	cin >> N >> D;
	vl X(N), Y(N);
	for (i = 0; i < N; i++) {
		cin >> X[i] >> Y[i];
	}
	two_sat TS(N);
	for (i = 0; i < N; i++) {
		for (j = i+1; j < N; j++) {
			if (abs(X[i] - X[j]) < D) {
				// cannot use both of x[i] and x[j]
				TS.add_clause(i, false, j, false);
			}
			if (abs(X[i] - Y[j]) < D) {
				TS.add_clause(i, false, j, true);
			}
			if (abs(Y[i] - X[j]) < D) {
				TS.add_clause(i, true, j, false);
			}
			if (abs(Y[i] - Y[j]) < D) {
				TS.add_clause(i, true, j, true);
			}
		}
	}
	if (!TS.satisfiable()) {
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;
	auto ans = TS.answer();
	for (i = 0; i < N; i++) {
		cout << (ans[i] ? X[i] : Y[i]) << endl;
	}
}

Measured memory_bytes: 3764
using System;
using System.Linq;

public class Test
{
	public static void Main()
	{
		int n;
		string s;
		n = int.Parse(Console.ReadLine());
		s = Console.ReadLine();
		int[] count = new int[n];
		int count2 = 0;
		for(int i=0;i<n;i++)
		{
			if(0<=i-1&&s[i-1]=='W')count2++;
			count[i] = count2;
		}
		count2 = 0;
		for(int i=n-1;i>=0;i--)
		{
			if(n>i+1&&s[i+1]=='E')count2++;
			count[i] += count2;
		}
		Console.WriteLine(count.Min());
	}
}


Measured memory_bytes: 13408
#include <stdio.h>
#include <string.h>
#define MAXN 110

char map[MAXN][MAXN];
char ch;

int dfs(int r, int c)
{
	if(map[r][c] == ch){
		map[r][c] = 0;
		dfs(r+1,c);
		dfs(r-1,c);
		dfs(r,c+1);
		dfs(r,c-1);
		return 1;
	}
	return 0;
}

int main()
{
	for(;;)
	{
		ch = 0;
		int ans = 0;
		int h = 0, w = 0;
		memset(map, 0, sizeof(map));
		scanf("%d %d", &h,&w);
		if(!h || !w)
			break;
		int i,j;
		for(i=1;i<=h;i++)
		{
			for(j=1;j<=w;j++)
			{
				char c = getc(stdin);
				map[i][j] = c == '\n' ? getc(stdin) : c;
			}
		}
		for(i=1;i<=h;i++)
		{
			for(j=1;j<=w;j++)
			{
				if(map[i][j]){
					ch = map[i][j];
					if(ch!='@'&&ch!='#'&&ch!='*')
						continue;
					dfs(i,j);
					ans++;
				}
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 936
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define ll int
#define bits_count __builtin_popcountll
#define endl '\n'
#define double double
#define ld double
#define FOR(i,a,n) for (ll i=(a);i<=(n);++i)
#define RFOR(i,a,n) for (ll i=(n);i>=(a);--i)
#define FI(i,n) for (ll i=0; i<(n); ++i)
#define ZERO(a) memset((a),0,sizeof((a)))
#define MINUS(a) memset((a),-1,sizeof((a)))
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define all(g) g.begin(),g.end()
#define sz(x) (ll)x.size()
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }

// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
// using namespace __gnu_pbds;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int MAXN = 2e5 + 10;
pair<int,int> a[MAXN];
int upto[MAXN];
const int MOD = 998244353;
int dp[MAXN];
int seg[4*MAXN];

void update(int node,int s,int e,int idx,int val){
    if(s > e) return;
    if(s == e){ seg[node] = val; return; }
    
    int mid = (s+e)>>1;

    if(idx <= mid) update(2*node,s,mid,idx,val);
    else update(2*node+1,mid+1,e,idx,val);

    seg[node] = max(seg[2*node],seg[2*node+1]);
}

int query(int node,int s,int e,int qs,int qe){
    if(s > e || qs > e || qe < s) return 0;

    if(qs <= s && e <= qe){
        return seg[node];
    }
    int mid = (s+e)>>1;
    return max(query(2*node,s,mid,qs,qe),query(2*node+1,mid+1,e,qs,qe));
}

void solve(){
    int n; cin>>n;

    FOR(i,1,n) cin>>a[i].first>>a[i].second;

    sort(a+1,a+n+1);
   
    FOR(i,1,n) {
        upto[i] = i;
        update(1,1,n,i,i);
    }

    RFOR(i,1,n){
        pair<int,int> xx = {a[i].first + a[i].second - 1,1e9};
        int idx = upper_bound(a+i,a+n+1,xx) - a;
        int x = query(1,1,n,i,idx-1);
        upto[i] = x;
        update(1,1,n,i,upto[i]);
    }

    dp[n+1] = 1;
    int ans = 0;
    RFOR(i,1,n){
        dp[i] = (dp[i+1] + dp[upto[i] + 1])%MOD; 
        // clog<<dp[i]<<endl;
    }

    cout<<dp[1]<<endl;
}

signed main(){

   FastRead;    


    int t = 1; 
    // cin>>t; 
    FOR(i,1,t){
        // cout<<"Case #"<<i<<": ";
        solve();
    }
}


Measured memory_bytes: 12800
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws FileNotFoundException {

		//    	File file = new File("src/in.txt");
		//    	Scanner sc = new Scanner(file);

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int[] H  = new int[N];
		int max = 0;
		for(int i=0;i<N;i++) {
			H[i] = Integer.parseInt(sc.next());
		}
		int tmp = 0;
		for(int i=0;i<N-1;i++) {
			if(H[i]>=H[i+1]) {
				tmp++;
				if(tmp>max) {
					max=tmp;
				}
			} else {
				tmp = 0;
			}
		}
		System.out.println(max);
	}
}

Measured memory_bytes: 48572
#include <stdio.h>

int main(void)
{
	int n,a,b,i,x=0,d,s,y,z;
	scanf("%d %d %d",&n,&a,&b);
	for(i=0;i<n;i++){
		s=0;
		y=i+1;
		z=y;
		while(y){
			d=y%10;
			s=s+d;
			y=y/10;
		}
		
		if(s>=a){
			if(s<=b){
				x=x+z;
			}
		}
	}
	printf("%d",x);
	return 0;
}

Measured memory_bytes: 128
using System;

class Program
{
    static void Main(string[] args)
    {
        //変数定義
        string[] input;

        //Inputします
        input = Console.ReadLine().Split(' ');

        if (int.Parse(input[1]) % int.Parse(input[0]) == 0)
            Console.WriteLine(int.Parse(input[0]) + int.Parse(input[1]));
        else
            Console.WriteLine( int.Parse(input[1])- int.Parse(input[0]) );
        
    }
}


Measured memory_bytes: 13140
package main

import "fmt"

func main() {
	var s int
	fmt.Scanln(&s)

	ns := make([]bool, 1000001)

	var m int
	n := s
	for i := 2; ; i++ {
		ns[n] = true

		if n%2 == 0 {
			n = n / 2
		} else {
			n = 3*n + 1
		}

		if ns[n] {
			m = i
			break
		}
	}

	fmt.Println(m)
}


Measured memory_bytes: 512
//************************
//*  Date: 2018.11.2     *
//*  Problem:            *
//*  Author: xuziyuan    * 
//************************

#include <bits/stdc++.h>

#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define replet(c) for(char c='a';c<='z';c++)
#define LL long long
#define pii pair<int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair
#define sqr(a) ((a)*(a))

using namespace std;

const LL MOD=1e9+7;

int n,m;
map <int,int> mp;//mp[year]=number
vector <int> cities[100010];
string ans[100010];

string itoa2(int x)
{
	string ret="";
	while(x>0)
	{
		ret.pb(x%10+'0');
		x/=10;
	}
	while(ret.size()<6) ret.pb('0');
	reverse(ret.begin(),ret.end());
	return ret;
}

int main()
{
	cin>>n>>m;
	rep(i,m)
	{
		int p,y;
		scanf("%d%d",&p,&y);
		mp[y]=i;
		cities[p].pb(y);
		ans[i]+=itoa2(p);
	}
	repn(i,n)
	{
		sort(cities[i].begin(),cities[i].end());
		rep(j,cities[i].size())
		{
			ans[mp[cities[i][j]]]+=itoa2(j+1);
		}
	}
	rep(i,m) puts(ans[i].c_str());
	rt0;
}

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

using namespace std;
using ll = long long;
constexpr int mod = 1e9+7;
constexpr int md = mod;
int main(){
    int n,m;
    cin>>n>>m;
    vector<int> ball(n+1,1);
    vector<bool> red(n+1,false);
    red[1] = true;
    for(int i=0;i<m;++i){
        int x,y;
        cin>>x>>y;
        ball[y]++;
        ball[x]--;
        if(red[x]){
           if(ball[x] == 0) red[x] = false;
           red[y] = true;
        }
    }
    cout << count(red.begin(),red.end(),true) << endl;
    return 0;
}



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

#define ONLINE_JUDGE
#define pb(a) push_back(a)
#define ALL(a) a.begin(), a.end()
#define FOR(x,to) for(x=0;x<(to);x++)

using ll = long long;

const int E5 = 1e5;

//////////// Solution /////////////////////////////////

void solve() {	
	int n,c[500],s[5000],f[500];

	cin >> n;
	for (int i = 0; i < n-1; ++i) {
		cin >> c[i] >> s[i] >> f[i];
	}

	for (int i = 0; i < n-1; ++i) {
		int t = 0;
		for (int j=i; j < n-1; ++j) {
			if (t <= s[j]) {
				t = s[j];
			} else {
				t = ((t-1)/f[j] + 1) * f[j];
			}
			t += c[j];
		}
		cout << t << '\n';
	}
	cout << 0 << '\n';
}	

/////////// End Solution ///////////////////////////////////////

//////// Initialization ////////////////////////////////////

int main() {

	#ifndef ONLINE_JUDGE
	FILE *FIN = freopen("/home/danil/prog/input.txt", "r", stdin);
	clock_t time_start = clock();
	#endif

	ios::sync_with_stdio(false);
	cin.tie(NULL);

	solve();

	#ifndef ONLINE_JUDGE
	fclose(FIN);
	cerr << "\x1b[031m\n-----------------\nTime=" << (ll)((double)(clock()-time_start) / CLOCKS_PER_SEC * 1000) << "ms\n\x1b[0m";
	#endif

	return 0;
}

//////// End Initialization ///////////////////////////////////////

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//make_tuple emplace_back next_permutation push_back make_pair second first

#if MYDEBUG
#include "lib/mydebug.h"
#else
#define DBG(...) ;
#endif

using LL = long long;
constexpr LL LINF=334ll<<53;
constexpr int INF=15<<26;
constexpr LL  MOD=1E9+7;

struct Problem{
    int n;
    vector<int> x;
    vector<LL> fac,inv;
    Problem(LL n):n(n),x(n+1),fac(1e5+20),inv(1e5+20){};
    long long modpow(long long a, long long n,long long mod=MOD){
        long long i=1,ret=1,p=a;
        while(i<=n){
            if(i&n) ret=(ret*p)%mod;
            i=(i<<1);
            p=(p*p)%mod;
        }
        return ret;
    }
    LL modcomb(int a, int b){
        return (fac[a]*inv[b]%MOD)*fac[a-b]%MOD;
    }

    LL calc(int p, int r){
        if(p==n)return fac[n-r];
        if(p==n-1)return fac[n-r];
        int nxt=p+1;
        for(int i=p+1; i<=n; ++i){
                nxt=i;
            if(x[i]<2*(i-r)-1){
                break;
            }
        }
        LL sub=calc(nxt,r+1);
        return sub*(nxt-r)%MOD;
    }

    void solve(){
        fac[0]=1;
        for(int i=1; i<1e5+10; ++i){
            fac[i]=fac[i-1]*i%MOD;
        }
        inv[1e5+9]=modpow(fac[1e5+9],MOD-2);
        for(int i=1e5+8; i>=0; --i){
            inv[i]=inv[i+1]*(i+1)%MOD;
        }
        for(int i=0; i<n; ++i){
            cin >> x[i+1];
        }
        cout << calc(0,0)<<"\n";

    }
};


int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    long long n=0;
    cin >> n;
    Problem p(n);
    p.solve();
    return 0;
}



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

const int mod = 1e9+7;
const int INF = 2000000;
const double PI = acos(-1.0);

int main() {
    
    ll X, D, K;
    cin >> X >> K >> D;
    ll ans;
    X = abs(X);
    ll pc = (X/D);
    if (pc >= K) ans = X - K * D;
    else {
        ll A1 = X - pc * D;
        ll A2 = A1 - D;
        if(pc % 2 == 0) {
            if(K % 2 == 0) ans = A1;
            else ans = abs(A2);
        }
        else {
            if(K % 2 == 0) ans = abs(A2);
            else ans = A1;
        }
    }
    cout << ans << endl;
}


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


i64 A, B, C, D;

int main() {
    cin >> A >> B >> C >> D;

    bool robot_a = false;
    bool robot_b = false;
    i64 T = 0;
    REP(t, 100 + 1) {
        if (t == A) robot_a = true;
        if (t == B) robot_a = false;
        if (t == C) robot_b = true;
        if (t == D) robot_b = false;

        if (robot_a && robot_b) {
            T++;
        }
    }

    cout << T << endl;

    return 0;
}

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

int main(){
    ll N, K;
    cin >> N >> K;

    ll ans = (N / K) * (N / K) * (N / K);
    if(K % 2 == 0){
        ll k = (N / (K / 2) + 1) / 2;
        ans += k * k * k;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
from collections import defaultdict
N=int(input())

xdic=defaultdict(set)
ydic=defaultdict(set)
for i in range(N):
  xs,ys,d=input().split()
  x=int(xs)
  y=int(ys)
  if d=="L":
    xdic[-1].add(x)
    ydic[0].add(y)
  elif d=="R":
    xdic[1].add(x)
    ydic[0].add(y)
  elif d=="U":
    xdic[0].add(x)
    ydic[1].add(y)
  else:
    xdic[0].add(x)
    ydic[-1].add(y)

xset=set()
for d in [-1,0,1]:
  if len(xdic[d]):
    min_d=min(xdic[d])
    max_d=max(xdic[d])
    xset.add((min_d,d))
    xset.add((max_d,d))
  
yset=set()
for d in [-1,0,1]:
  if len(ydic[d]):
    min_d=min(ydic[d])    
    max_d=max(ydic[d])
    yset.add((min_d,d))
    yset.add((max_d,d))

def cand_time(plist):
  ret=set()
  for i in range(len(plist)):
    p1,d1=plist[i]
    for j in range(i+1,len(plist)):
      p2,d2=plist[j]
      if d1==d2:
        continue
        
      if d1==-1:
        if d2==0:
          t=p1-p2
        else:
          t=(p1-p2)/2
      elif d1==0:
        if d2==-1:
          t=p2-p1
        else:
          t=p1-p2
      else:
        if d2==-1:
          t=(p2-p1)/2
        else:
          t=p2-p1
       
      if t>0:
        ret.add(t)
  return ret

cand_time_x=cand_time(list(xset))
cand_time_y=cand_time(list(yset))
#print(cand_time_x,cand_time_y)
cand_t=[0]+list(cand_time_x)+list(cand_time_y)
#print(cand_t)

def get_pos(pd,t):
  p,d=pd
  return p+d*t

answer=float("inf")
for t in cand_t:
  pos_min_x=float("inf")
  pos_max_x=-float("inf")
  for x2 in xset:
    pos_min_x=min(pos_min_x,get_pos(x2,t))
    pos_max_x=max(pos_max_x,get_pos(x2,t))
    
  pos_min_y=float("inf")
  pos_max_y=-float("inf")
  for y2 in yset:
    pos_min_y=min(pos_min_y,get_pos(y2,t))
    pos_max_y=max(pos_max_y,get_pos(y2,t))

  #print(t,pos_min_x,pos_max_x,pos_min_y,pos_max_y)
  t_ans=abs(pos_max_x-pos_min_x)*abs(pos_max_y-pos_min_y)
  if answer>=t_ans:
    answer=t_ans
    #print(answer,t,abs(pos_max_x-pos_min_x),abs(pos_max_y-pos_min_y))
  
print(answer)

Measured memory_bytes: 21920