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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

int main(){
  double a;
  cout.precision(10);
  while(~scanf("%lf",&a)){
    double sum = a;
    REPR(i,10){
      if(i%2==0)a /= 3.0;
      else a *= 2.0;
      sum += a;
    }
    cout<<fixed<<sum<<endl;
  }
  return 0;
}

Measured memory_bytes: 1280
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
import math
sys.setrecursionlimit(200000)
input = sys.stdin.readline

N, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
S = input().strip()

if S[:N//2] == S[N//2:]:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3316
/*input
10 2
bbaabbbaab
*/

// bbaabbbaab

#include <bits/stdc++.h>
#define pb push_back
#define all(a) a.begin(), a.end()
#define sz(a) (int)a.size()
#define x first
#define y second
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
const int maxn = 2e5 + 100;
const int mod = 1e9 + 7;
int n, k;
string solve(string s)
{
	int it = n - 1;
	int cnt = 0;
	while(it >= 0 && s[it] == s[n - 1])
		++cnt, --it;
	for(int i = 0; i < k - 1; i++)
		cnt *= 2;
	if(cnt >= n)
		return string(n, s[n - 1]);
	else
	{
		string ret = string(cnt, s[n - 1]);
		while(cnt < n)
		{
			ret += s[it];
			--it;
			++cnt;
		}
		return ret;
	}
}
int main()
{
	ios_base::sync_with_stdio(false), cin.tie(0);
	cin >> n >> k;
	string s;
	cin >> s;

	char mn = 'z';
	for(int i = 0; i < n; i++)
		mn = min(mn, s[i]);

	if(k > 12)
		return cout << string(n, mn) << "\n", 0;

	string t = s;
	reverse(all(t));
	string st = s + t;

	string ans = s;
	for(int i = 0; i <= n; i++)
	{
		string ss = st.substr(i, n);
		ans = min(ans, solve(ss));
	}
	cout << ans << "\n";
	return 0;
}

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

using namespace std;

using int64 = long long;

constexpr int64 P = 1000000007;

// Verified: ABC133E, ABC132D, ABC130E
struct FiniteField {
 private:
  int64 x;
 public:
  FiniteField(int64 x) : x(x) {}
  FiniteField() : x(0) {}
  int64 Value() { return x; }
  inline FiniteField operator+(FiniteField o) {
    FiniteField r(*this); r += o; return r;
  }
  inline FiniteField operator-(FiniteField o) {
    FiniteField r(*this); r -= o; return r;
  }
  inline FiniteField operator* (FiniteField o) {
    FiniteField r(*this); r *= o; return r;
  }
  inline FiniteField operator/ (FiniteField o) {
    FiniteField r(*this); r /= o; return r;
  }
  inline void operator+= (FiniteField o) { x = (x + o.x) % P; }
  inline void operator-= (FiniteField o) { x = (x + P - o.x) % P; }
  inline void operator*= (FiniteField o) { x = (x * o.x) % P; }
  void operator/=(FiniteField o) {
    int64 p = P - 2; while (p) { if (p % 2) { *this *= o; } o *= o; p /= 2; }
  }
};

vector<FiniteField> MakeFactorialTable(int n) {
  vector<FiniteField> values(n + 1);
  values[0] = 1;
  for (int i = 1; i <= n; i++) {
    values[i] = values[i - 1] * i;
  }
  return values;
}

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

  int n, k;
  cin >> n >> k;
  cout << (n <= k ? 1 : 0) << endl;
}



Measured memory_bytes: 3156
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

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

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

    int count = 0;
    while (true) {
        int c = 0;
        bool flag = false;
        bool changed = false;
        for (int i = 0; i < n; ++i) {
            --h[i];
            if (h[i] >= 0) {
                flag = true;
                changed = true;
            } else {
                if (flag)
                    ++c;
                flag = false;
            }
        }
        if (flag)
            ++c;
        flag = false;

        count += c;

        if (!changed)
            break;
    }
    cout << count << '\n';
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

using namespace std;

int N,M,T;

int input[200];

int main(){
    scanf("%d%d%d",&N,&M,&T);

    for(int i=1;i<=N;i++) scanf("%d",input+i);

    int res=0;
    for(int i=1;i<N;i++){
        res+=max(0,input[i+1]-input[i]-2*M);
    }

    res+=max(0,input[1]-M);
    res+=max(0,T-input[N]-M);

    printf("%d\n",res);

    return 0;
}


Measured memory_bytes: 2740
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>

using namespace std;

int main()
{
  int N, M, X, Y;
  cin >> N >> M >> X >> Y;
  for (int i = 0; i < N; ++i) {
    int x;
    cin >> x;
    if (X < x) X = x;
  }
  for (int i = 0; i < M; ++i) {
    int y;
    cin >> y;
    if (Y > y) Y = y;
  }
  cout << (X < Y ? "No War" : "War") << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#define push push_back
#define all(v) v.begin(),v.end()
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int max(int a,int b){
	return (a>b)?a:b;
}

int min(int a,int b){
	return (a<b)?a:b;
}

int main(){
	int n,k;
	cin>>n>>k;
	string s;
	cin>>s;
	vector<int> vec;
	int now=1,tmp=0;
	rep(i,s.size()){
		if(s[i]==(char)(now+'0'))tmp++;
		else{
			now=1-now;
			vec.push(tmp);
			tmp=1;
		}
	}
	if(tmp!=0)vec.push(tmp);
	if(vec.size()%2==0)vec.push(0);
	int ans=0;
	int sum[vec.size()];
	sum[0]=vec[0];
	if(vec.size()>1)rep(i,vec.size()-1)sum[i+1]=sum[i]+vec[i+1];
	for(int i=0;i<vec.size();i+=2){
		int left=i,right=min(i+2*k+1,vec.size())-1;
		tmp=sum[right]-sum[left]+vec[left];
		ans=max(ans,tmp);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 4280
#include<iostream>
#include<vector>
#include<stack>

using namespace std;
static const int MAX = 100000;
static const int NIL = -1;

int n;
vector<int> G[MAX];
int color[MAX];

void dfs(int r, int c) {
    stack<int> S;
    S.push(r);
    color[r] = c;
    
    while(!S.empty()) {
        int u = S.top();
        S.pop();
        
        for(int i = 0; i < G[u].size(); i++) {
            int v = G[u][i];
            
            if(color[v] == NIL) {
                color[v] = c;
                S.push(v);
            }
        }
    }
}

void assignColor() {
    int id = 1;
    
    for(int i = 0; i < n; i++) {
        color[i] = NIL;
    }
    
    for(int u = 0; u < n; u++) {
        if(color[u] == NIL) {
            dfs(u, id++);
        }
    }
}

int main() {
    int s, t, m, q;
    
    cin >> n >> m;
    
    for(int i = 0; i < m; i++) {
        cin >> s >> t;
        
        G[s].push_back(t);
        G[t].push_back(s);
    }
    
    assignColor();
    
    cin >> q;
    
    for(int i = 0; i < q; i++) {
        cin >> s >> t;
        
        if(color[s] == color[t]) {
            cout << "yes" << endl;
        } else {
            cout << "no" << endl;
        }
    }
    
    return 0;
}



Measured memory_bytes: 9016
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<cstring>
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9')x=x*10+ch-'0',ch=getchar();
	return x*f;
}
int stack[20];
inline void write(int x)
{
	if(x<0){putchar('-');x=-x;}
	if(!x){putchar('0');return;}
	int top=0;
	while(x)stack[++top]=x%10,x/=10;
	while(top)putchar(stack[top--]+'0');
}
inline void pr1(int x){write(x),putchar(' ');}
inline void pr2(int x){write(x),puts("");}
const int mod=998244353;
inline int ad(int x){return x>=mod?x-mod:x;}
inline int dec(int x){return x<0?x+mod:x;}
char ss[15];
int n,m,a[15][15],row[15],col[15];
inline bool pd(int x,int y)
{
	if(x==0 && y==0)return true;
	if(x==0 || y==0)return false;
	for(int i=0;i<n;i++)if(x>>i&1 && ((row[i]&y)==y || (row[i]&y)==0))return false;
	for(int i=0;i<m;i++)if(y>>i&1 && ((col[i]&x)==x || (col[i]&x)==0))return false;
	return true;
}
int C[15][15],f[15][15][3],g[15][15][3];
int main()
{
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	for(int i=0;i<=10;i++)
	{
		C[i][0]=1;
		for(int j=1;j<=i;j++)C[i][j]=ad(C[i-1][j]+C[i-1][j-1]);
	}
	n=read(),m=read();
	for(int i=0;i<n;i++)
	{
		scanf("%s",ss);
		for(int j=0;j<m;j++)a[i][j]=ss[j]=='.';
	}
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)row[i]+=a[i][j]<<j;
	}
	for(int i=0;i<m;i++)
	{
		for(int j=0;j<n;j++)col[i]+=a[j][i]<<j;
	}
	for(int i=0;i<m;i++)f[0][i][2]=1<<i;
	f[n][m][0]=1<<m;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			for(int k=1;k<n-i;k++)
			{
				g[i+k][j][1]=ad(g[i+k][j][1]+1LL*ad(f[i][j][1]+ad(f[i][j][2]*2))*C[k+i][i]%mod);
				g[i+k][j][2]=ad(g[i+k][j][2]+1LL*f[i][j][2]*dec((1<<k)-2)%mod*C[k+i][i]%mod);
			}
			g[n][m][0]=ad(g[n][m][0]+1LL*f[i][j][2]*dec((1<<(n-i))-2)%mod*C[n][i]%mod*C[m][j]%mod);
			for(int k=1;k<m-j;k++)
			{
				f[i][j+k][1]=ad(f[i][j+k][1]+1LL*ad(g[i][j][1]+ad(g[i][j][2]*2))*C[k+j][j]%mod);
				f[i][j+k][2]=ad(f[i][j+k][2]+1LL*g[i][j][2]*dec((1<<k)-2)%mod*C[k+j][j]%mod);
			}
			f[n][m][0]=ad(f[n][m][0]+1LL*g[i][j][2]*dec((1<<(m-j))-2)%mod*C[m][j]%mod*C[n][i]%mod);
		}
	}
	int ans=0;
	for(int i=0;i<(1<<n);i++)
	{
		for(int j=0;j<(1<<m);j++)
		{
			if(pd(i,j)==false)continue;
			int x=n,y=m;
			for(int k=0;k<n;k++)if(i>>k&1)x--;
			for(int k=0;k<m;k++)if(j>>k&1)y--;
			for(int k=0;k<3;k++)ans=ad(ans+ad(f[x][y][k]+g[x][y][k]));
		}
	}pr2(ans);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,C,f=0;
  cin>>A>>B>>C;
  if(A==B && A!=C) f=1;
  if(A==C && A!=B) f=1;
  if(C==B && A!=C) f=1;
  
  if(f==1) cout<<"Yes";
  else cout<<"No";
  

}

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

void fnInput(int &a_riElementCnt, vector<int> &a_rviElement, 
             int &a_riTargetCnt , vector<int> &a_rviTarget )
{
  cin >> a_riElementCnt;

  a_rviElement.resize(a_riElementCnt);
  for (int i = 0; i < a_riElementCnt; i++)
    cin >> a_rviElement[i];

  cin >> a_riTargetCnt;

  a_rviTarget.resize(a_riTargetCnt);
  for (int i = 0; i < a_riTargetCnt; i++)
    cin >> a_rviTarget[i];
}

int fnRcsSearch(int a_iPos, const vector<int> &a_cnrviElement, int a_iTarget,
                vector<vector<int>> &a_rvviOK)
{
  if (a_iPos == a_cnrviElement.size())  return 0;
  if (!a_iTarget)    return 1;
  if (a_iTarget < 0) return 0;
  if (a_rvviOK[a_iPos][a_iTarget] != -1)
    return a_rvviOK[a_iPos][a_iTarget];

  a_iPos++; 
  int iRtn0 = fnRcsSearch(a_iPos, a_cnrviElement, a_iTarget, a_rvviOK);
  a_rvviOK[a_iPos][a_iTarget] = iRtn0;
  if (iRtn0)  return iRtn0;

  int iSmallTarget = a_iTarget - a_cnrviElement[a_iPos];
  int iRtn1 = fnRcsSearch(a_iPos, a_cnrviElement, iSmallTarget, a_rvviOK);
  if (iSmallTarget >= 0)
  {
    a_rvviOK[a_iPos][iSmallTarget] = iRtn1;
    return iRtn1;
  }
}

void fnExhSearch(const vector<int> &a_cnrviElement, const vector<int> &a_cnrviTarget)
{
  vector<vector<int>> vviOK(21, vector<int>(2001, -1));
  
  for (int i = 0; i < a_cnrviTarget.size(); i++)
  {
    int iTarget = a_cnrviTarget[i];
    int iRtn0, iRtn1;

    if (fnRcsSearch(0, a_cnrviElement, iTarget, vviOK))
    {
      cout << "yes" << endl;
      vviOK[0][iTarget] = fnRcsSearch(0, a_cnrviElement, iTarget, vviOK);
      continue;
    }

    int iSmallTarget = iTarget - a_cnrviElement[0];
    if (fnRcsSearch(0, a_cnrviElement, iSmallTarget, vviOK))
      cout << "yes" << endl;
    else
      cout << "no" << endl;

    if (iSmallTarget >= 0)
      vviOK[0][iSmallTarget] = fnRcsSearch(0, a_cnrviElement, iSmallTarget, vviOK);
  }
}

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

  int iElementCnt, iTargetCnt;
  vector<int> viElement, viTarget;

  fnInput(iElementCnt, viElement, iTargetCnt, viTarget);
  fnExhSearch(viElement, viTarget);

  return 0;
}

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll A, B;
    cin >> A >> B;

    ll ans = -1;
    REP(i,1,10000) {
        if((ll)(i*0.08) == A && (ll)(i*0.10) == B) {
            ans = i;
            break;
        }
    }
    PR(ans);

    return 0;
}

/*



*/

Measured memory_bytes: 3592
// include
#include <iostream>

// using namespace 
using namespace std;

// typedef
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<int, int> PII;

// macro
#define REP(index, num) for (auto index = 0; index < num; index++)
#define FOR(index, num) for (auto index = 1; index <= num; index++)

#define MAX_NUM 1000010
#define INF (int)1e9

// global
int s;
int A[MAX_NUM];

bool IsSame(int b);

int main()
{
  cin >> s;

  REP(nId, MAX_NUM)
    A[nId] = -INF;

  A[0] = s;

  FOR(nId, MAX_NUM)
  {
    int b;
    if (A[nId - 1] % 2)
      b = 3 * A[nId - 1] + 1;
    else
      b = A[nId - 1] / 2;

    if (IsSame(b))
    {
      cout << nId + 1 << endl;
      return 0;
    }

    A[nId] = b;

  }

}

bool IsSame(int b)
{
  REP(nId, MAX_NUM)
  {
    if (A[nId] == -INF)
      break;
    if (A[nId] == b)
      return true;
  }
  return false;
}

Measured memory_bytes: 4096
#include<iostream>
#include<string>
#include<vector>
#include<sstream>


using namespace std;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int x,y;
	int a;
	cin>>x>>y;
	a = ((x+y)%2==1)?(x+y)/2+1:(x+y)/2; 
	cout <<a;
	return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define divceil(A, B) ((A + (B - 1)) / B)
#define MODN 998244353
#define ALL(V) (V).begin(),(V).end()
#define CERR if(false) cerr

using namespace std;


int main(){

    int n;
    string s;
    cin >> n;
    cin >> s;

    rep(i,s.size()){
        s[i] = s[i] + n;

        if(s[i] > 'Z'){
            s[i] = s[i] - 26;
        }
    }

    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
N=int(input())
L=list(map(int,input().split()))
L.sort()
d={}
for l in L:
    if l in d:
        d[l]+=1
    else:
        d[l]=1

ans=0
for a in d:
    for b in d:
        for c in d:
            if a<b<c and a+b>c:
                ans+=d[a]*d[b]*d[c]
print(ans)

Measured memory_bytes: 9144
#include<stdio.h>
#include<math.h>
 
int main(void)
{
	double x, y, r;
 	double x1, x2, x3, y1, y2, y3;
	double ecm[2][3]; //enlarged coefficient matrix:拡大係数行列
	double a, b, A;
	int i;
	int n;

	scanf("%d", &n);
	for(i = 0; i < n; i++)
	{
 		scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);

		ecm[0][0] = x1 - x2;
		ecm[0][1] = y1 - y2;
		ecm[0][2] = (x2 * x2 + y2 * y2) - (x1 * x1 + y1 * y1);
		ecm[1][0] = x1 - x3;
		ecm[1][1] = y1 - y3;
		ecm[1][2] = (x3 * x3 + y3 * y3) - (x1 * x1 + y1 * y1);

		A = (ecm[0][0] * ecm[1][1]) - (ecm[0][1] * ecm[1][0]); 

		a = ((ecm[0][2] * ecm[1][1]) - (ecm[0][1] * ecm[1][2])) / A + 0;
		b = ((ecm[0][0] * ecm[1][2]) - (ecm[0][2] * ecm[1][0])) / A + 0;

		x = (a / -2.0);
		y = (b / -2.0);
		r = sqrt(pow(x1 - x, 2) + pow(y1 - y, 2));

		printf("%.3f %.3f %.3f\n", x, y, r); //四捨五入は自動的にされる
	}
	return 0;
}

Measured memory_bytes: 656
#include <bits/stdc++.h>
#define rep(i,l,r) for(int (i)=(l);(i)<(r);(i)++)
using namespace std;
long long ll;
typedef pair<int, int> P;
 
int h, w;
char ch[21][21];
 
int solve(int sy,int sx,int gy,int gx,int ans[21][21],int flag[21][21]) {
    int dx[4] = {1, 0, -1, 0};
    int dy[4] = {0, 1, 0, -1};
    queue<P> que;
    flag[sy][sx] = 1;
    que.push(P(sy,sx));
    while (!que.empty()){
        P p = que.front();
        que.pop();
        rep(i,0,4){
            int x = p.second + dx[i];
            int y = p.first + dy[i];
            if (0 <= x && x < w && 0 <= y && y < h && !flag[y][x] && ch[y][x] == '.'){
                flag[y][x] = 1;
                ans[y][x] = ans[p.first][p.second] + 1;
                que.push(P(y,x));
            }
        }
    }
    return ans[gy][gx];
}
int main(){
    cin >>h>>w;
    int ans[21][21], flag[21][21];
    rep(i,0,h){
        rep(j,0,w){
            cin >> ch[i][j];
        }
    }
    rep(i,0,21){
     rep(j,0,21){
      ans[i][j]=0;
      flag[i][j]=0;
     }
    }
    
    int ma=0;
    
    rep(i,0,h){
        rep(j,0,w){
            if(ch[i][j]=='.'){
                rep(k,0,h){
                    rep(l,0,w){
                        if(ch[k][l]=='.'){
                            ma=max(ma,solve(i,j,k,l,ans,flag));
                            rep(i,0,21){
     rep(j,0,21){
      ans[i][j]=0;
      flag[i][j]=0;
     }
    }
                        }
                    }
                }
            }
        }
    }
    cout<<ma<<endl;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	x := getNextInt(scanner)
	y := 8
	for i := 600; i < 2001; i += 200 {
		if x < i {
			fmt.Fprintln(writer, y)
			return
		}
		y--
	}
}


Measured memory_bytes: 1816
#include <iostream> //cout
#include <vector> //vector
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)


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

    while(true){
        C -= B;
        // cout << "taka:" << A << ", aok:" << C << endl;
        if(C <= 0){
            cout << "Yes" << endl;
            break;
        }
        A -= D;
        // cout << "taka:" << A << ", aok:" << C << endl;
        if(A <= 0){
            cout << "No" << endl;
            break;
        }
    }
}


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

int main() {

	int a, b, c;

	cin >> a >> b >> c;

	if (c > a && c < b || c < a && c > b) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
	
}

Measured memory_bytes: 256
#include <iostream>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

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

int main(void) {
    int n, X;
    cin >> n >> X;
    int x[n];
    rep(i, n) cin >> x[i];

    int d = abs(X - x[0]);
    rep(i, n) {
        d = gcd(abs(X - x[i]), d);
    }
    cout << d << endl;
}


Measured memory_bytes: 640
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
typedef long long LL;
LL a[100030];
LL mod = 1e9 + 7;
int main() {
    int n, m;
    scanf("%d%d", &n, &m);
    for (int i = 0; i < n; ++i) {
        scanf("%lld", &a[i]);
    }
    for (int i = 0; i < n - 1; ++i) {
        a[i] = a[i + 1] - a[i];
    }
    n--;
    LL ans = 0;
    for (LL i = 0; i < n; ++i) {
        ans = ((i + 1) * (n - i) % mod * a[i] % mod + ans) % mod;
    }
    //cout << ans << endl;
    n = m;
    for (int i = 0; i < n; ++i) {
        scanf("%lld", &a[i]);
    }
    for (int i = 0; i < n - 1; ++i) {
        a[i] = a[i + 1] - a[i];
    }
    n--;
    LL ansB = 0;
    for (LL i = 0; i < n; ++i) {
        ansB = ((i + 1) * (n - i) % mod * a[i] % mod + ansB) % mod;
    }
    printf("%lld\n", ans * ansB % mod);
    return 0;
}

Measured memory_bytes: 1024
N,K = map(int,input().split())
prank = []
output = []
for i in range(K*2) :
    prank.append(input().split())
m = 1
while m < K*2 :
    for n in prank[m]:
        output.append(n)
    m += 2
print(N-len(set(output)))

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define rep(i,N) for(int i=0;i<N;i++)

struct Lazysegtree{
  int n;
  vector<ll>node,lazy;

  Lazysegtree(vector<ll> v) {
    int sz=v.size();
    n=1;while(n<sz)n*=2;
    node.resize(2*n-1,0);
    lazy.resize(2*n-1,0);
    for(int i=0;i<sz;i++)node[i+n-1]=v[i];
    for(int i=n-2;i>=0;i--)node[i]=node[2*i+1]+node[2*i+2];
  }

  void eval(int k,int l,int r){
    if(lazy[k]!=0){
      node[k]+=lazy[k];
      if(r-l>1){
        lazy[2*k+1]+=lazy[k]/2;
        lazy[2*k+2]+=lazy[k]/2;
      }
      lazy[k]=0;
    }
  }

  void update(int x,int val){
    x+=(n-1);
    node[x]=val;
    while(x>0){
      x=(x-1)/2;
      node[x]=node[2*x+1]+node[2*x+2];
    }
  }


  void add(int a,int b,ll x,int k=0,int l=0,int r=-1){
    if(r<0)r=n;
    eval(k,l,r);
    if(b<=l||r<=a)return;
    if(a<=l&&r<=b){
      lazy[k]+=(r-l)*x;
      eval(k,l,r);
    }
    else{
      add(a,b,x,2*k+1,l,(l+r)/2);
      add(a,b,x,2*k+2,(l+r)/2,r);
      node[k]=node[2*k+1]+node[2*k+2];
    }
  }

  ll sum(int a,int b,int k=0,int l=0,int r=-1){
    if(r<0)r=n;
    eval(k,l,r);
    if(r<=a||b<=l)return 0;
    if(a<=l&&r<=b)return node[k];

    ll vl=sum(a,b,2*k+1,l,(l+r)/2);
    ll vr=sum(a,b,2*k+2,(l+r)/2,r);
    return vl+vr;
  }

  ll get(int x){
    return sum(x,x+1);
  }
};

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

  int N;
  cin>>N;
  vector<int>p(N);
  for(int i=0;i<N;i++)cin>>p[i];
  for(int i=0;i<N;i++)--p[i];
  vector<ll>A(N),B(N);
  for(int i=0;i<N;i++)A[i]=i+1;
  for(int i=0;i<N;i++)B[i]=N-i;
  Lazysegtree segA(A),segB(B);
  for(int i=0;i<N;i++){
    segA.add(p[i],N,i);
    segB.add(0,p[i]+1,i);
  }
  for(int i=0;i<N;i++)cout<<segA.get(i)<<" ";
  cout<<endl;
  for(int i=0;i<N;i++)cout<<segB.get(i)<<" ";
  cout<<endl;
  return 0;
}


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

typedef long long ll;
#define rep(n, i) for(int i = 0; i < n; ++i)

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

  ll max_polled = 0;
  map<string, ll> dict;
  rep(N, i) {
    dict[vec[i]]++;
    max_polled = max(max_polled, dict[vec[i]]);
  }

  for(auto word : dict) {
    if(word.second < max_polled) continue;
    cout << word.first << endl;
  }
}

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

Measured memory_bytes: 26752
#![allow(unused_imports)]
use proconio::*;
use num::Integer;

const MAX_K: usize = 100005;
const MOD: i64 = 1000000007;
fn mod_pow(mut a:i64, mut n:usize)->i64 {
    let mut x = 1;
    while n > 0 {
        if n&1 == 1 {
            x *= a;
            x %= MOD;
        }
        a *= a;
        a %= MOD;
        n >>= 1;
    }
    x
}

fn main() {
   input! {
       n: usize,
       k: i64
   }

   let mut dp = [0i64; MAX_K];
   let mut ans: i64 = 0;
   for i in (1..=k).rev() {
       dp[i as usize] = mod_pow(k/i, n);
       for j in 2..=(k/i) as usize {
           dp[i as usize] -= dp[(i as usize)*j];
           if dp[i as usize] < 0 {
               dp[i as usize] += MOD;
           }
       }
       ans += i*dp[i as usize];
       ans %= MOD;
   }
   println!("{}", ans);
}


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

int main(void){
    int S,h,m,s,a;
    cin >> S;
    h=S/3600;
    a=S%3600;
    m=a/60;
    s=a%60;
    
    cout << h;
    cout << ":";
    cout << m;
    cout << ":";
    cout << s;
    cout << endl;
    
}



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

# define rep(i, n) for(int(i)=0;(i)<(n);(i)++)
# define reps(i, n) for(int(i)=1;(i)<=(n);(i)++)
# define rrep(i, n) for(int i=((int)(n)); i>0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>=0; --i)
# define ALL(v) v.begin(), v.end()
template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<typename T> void dump(T e){std::cout << e << std::endl;}
template<typename T> void dump(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void dump(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ dump(v); } }
typedef long long ll;


int main(){
  int n; cin >> n;
  vector <double> x(n);
  vector <double> y(n);
  rep(i,n) cin >> x[i];
  rep(i,n) cin >> y[i];
  
  double p1=0;
  double p2=0;
  double p3=0;
  double p_i=-1;
  rep(i,n) {
    p1 += abs(x[i]-y[i]);
    p2 += pow(abs(x[i]-y[i]),2);
    p3 += pow(abs(x[i]-y[i]),3);
    p_i = (p_i >= abs(x[i]-y[i]))? p_i:abs(x[i]-y[i]);
  }
  printf("%.6lf\n",p1);
  printf("%.6lf\n",sqrt(p2));
  printf("%.6lf\n",cbrt(p3));
  printf("%.6lf\n",p_i);
}



Measured memory_bytes: 3448
x = int(input())
if 400<= x <= 599:
  print(8)
elif 600<= x <=799:
  print(7)
elif 800<= x <=999:
  print(6)
elif 1000<= x <=1199:
  print(5)
elif 1200<= x <=1399:
  print(4)
elif 1400<= x <=1599:
  print(3)
elif 1600<= x <=1799:
  print(2)
elif 1800<= x <=1999:
  print(1)


Measured memory_bytes: 9176
x = gets.to_i
if x <= 599
  puts 8
elsif x <= 799
  puts 7
elsif x <= 999
  puts 6
elsif x <= 1199
  puts 5
elsif x <= 1399
  puts 4
elsif x <= 1599
  puts 3
elsif x <= 1799
  puts 2
else
  puts 1
end


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

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

fn main() {
    input! {
        n: i64,
        k: usize,
        s: chars,
    }
    let mut res = s.clone();
    res[k - 1] = s[k - 1].to_lowercase().take(1).next().unwrap();
    let res2: String = res.into_iter().collect();
    println!("{}", res2);
}


Measured memory_bytes: 4352
def main():
    import sys
    from operator import itemgetter
    from collections import deque
    buf = sys.stdin.buffer
    
    n, d, a = map(int, buf.readline().split())
    m = map(int, buf.read().split())
    monsters = sorted(zip(m, m), key=itemgetter(0))
    
    bomb_area = deque([])
    bomb_power = deque([])
    total_damage = 0
    ans = 0
    for pos, hp in monsters:
        while bomb_area:
            area = bomb_area[0]
            if area < pos:
                bomb_area.popleft()
                power = bomb_power.popleft()
                total_damage -= power
            else:
                break
        if hp <= total_damage:
            continue
        else:
            count = (hp - total_damage + a - 1) // a
            ans += count
            power = a * count
            total_damage += power
            bomb_area.append(pos + 2 * d)
            bomb_power.append(power)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 55496
import math

while True:
    n = int(input())
    if n == 0:
        break
    s = list(map(int, input().split()))
    m = sum(s) / len(s)

    num = 0.0
    for i in range(n):
        num += (s[i] - m) ** 2
    variance = num / n
    deviation = math.sqrt(variance)
    print(deviation)



Measured memory_bytes: 5704
#include <iostream>
#include <queue>
#include<algorithm>
using namespace std;

class FC{
public:
	int p[31];
	int n;

	bool isOver(){
		for(int i=1;i<31;i++){
			if(i!=9&&i!=12&&i!=15&&i!=18&&i!=21&&i!=30){
				if(p[i]!=p[i+1])
					return false;
			}
		}
		return true;
	}


	void rot1(){
		swap(p[7],p[22]); swap(p[8],p[23]); swap(p[9],p[24]);
		swap(p[13],p[18]); swap(p[10],p[12]);
	}

	void rot2(){
		swap(p[1],p[28]); swap(p[2],p[29]); swap(p[3],p[30]);
		swap(p[15],p[16]); swap(p[19],p[21]);
	}
	

	void rot3(){
		swap(p[1],p[24]); swap(p[4],p[27]); swap(p[7],p[30]);
		swap(p[10],p[21]); swap(p[16],p[18]);
	}

	void rot4(){
		swap(p[3],p[22]); swap(p[6],p[25]); swap(p[9],p[28]);
		swap(p[12],p[19]); swap(p[13],p[15]);
	}
};

int main(){
	int N;
	cin>>N;
	
	int NN=0;
	while(NN<N){

		FC now;

		for(int i=1; i<=30; i++){
			cin >>now.p[i];
		}
		now.n=0;

		queue<FC> Q;
		Q.push(now);

		while(!Q.empty()){
			now=Q.front();
			Q.pop();
			if(now.isOver()){
				cout << now.n<<endl;
				break;
			}
			FC nex1 =now; nex1.rot1(); nex1.n++; Q.push(nex1);
			FC nex2 =now; nex2.rot2(); nex2.n++; Q.push(nex2);
			FC nex3 =now; nex3.rot3(); nex3.n++; Q.push(nex3);
			FC nex4 =now; nex4.rot4(); nex4.n++; Q.push(nex4);	
		}
		NN++;
	}
	

	return 0;
}

Measured memory_bytes: 12168
import java.util.Scanner;

public class Main {
	public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		sc.close();
		prtln("2019/04/30".compareTo(S) >= 0 ? "Heisei" : "TBD");
	}
	public static <T> void prtln(T t) { System.out.println(t); }
}

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

#define NL '\n'
#define C char
#define D double
#define F float
#define S string

#define sz(x) x.size()
#define INF LONG_MAX
#define IINF LLONG_MAX
#define PI (2.0*acos(0.0))

#define sfi(x) scanf("%d",&x)
#define sfi2(x,y) scanf("%d %d",&x,&y)
#define sfi3(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define sfl(x) scanf("%lld",&x)
#define sfl2(x,y) scanf("%lld %lld",&x,&y)
#define sfl3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define sfd(x) scanf("%lf",&x);

#define max3(a,b,c) max(a,max(b,c))
#define max4(a,b,c,d) max(max3(a,b,c),d)
#define min3(a,b,c) min(a,min(b,c))
#define min4(a,b,c,d) min(a,min3(b,c,d))

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define For(i, j, k) for(int i = j; i <= k; i++)
#define Rof(i, j, k) for(int i = j; i >= k; i--)
#define all(x) x.begin(),x.end()
#define asort(x) sort(all(x));
#define dsort(x) sort(all(x), greater<int>())
#define unq(x) x.erase(unique(x.begin(),x.end()),x.end())

#define mem(ara,val) memset(ara,val,sizeof(ara))
#define READ freopen("input.txt","r",stdin)
#define WRITE freopen("output.txt","w",stdout)
#define IOS ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0)

typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int, int> PII;

LL gcd(LL a,LL b)
{
    if(b==0) return a;
    else return gcd(b,a%b);
}
LL lcm(LL a,LL b)
{
    return a/gcd(a,b)*b;
}

LL bigmod(LL base, LL power, LL mod)
{
    if(power==0) return 1;
    else if(power%2==1)
    {
        LL value1 = base % mod; LL value2 = (bigmod(base,power-1,mod))%mod;
        return (value1*value2)%mod;
    }
    else
    {
        LL value1 = (bigmod(base,power/2,mod))%mod;
        return (value1*value1)%mod;
    }
}

int main()
{
    //A
    /*int n;
    sfi(n);
    int a,b;
    sfi2(a,b);

    if(n==1) printf("OK");
    else
    {
        int diff = abs(a-b);

        if(diff>=n) printf("OK");
        else printf("NG");
    }*/



    //B
    LL n;
    sfl(n);

    LL pre = 100;

    int count = 0;
    while(true)
    {
        if(pre>=n)
        {
            cout<<count;
            break;
        }
         pre = pre + (pre/100);
         count++;
    }
    
    
    //C
    
}


Measured memory_bytes: 3688
def moveRU(x1,y1,x2,y2)
  (x2-x1).times do
    print "R"
  end
  (y2-y1).times do
    print "U"
  end
end
def moveLD(x1,y1,x2,y2)
  (x1-x2).times do
    print "L"
  end
  (y1-y2).times do
    print "D"
  end
end

sx,sy,tx,ty = readline.split(' ').map(&:to_i)

moveRU(sx, sy, tx, ty)
moveLD(tx, ty, sx, sy)

print "D"
moveRU(sx, sy-1, tx+1, ty)
print "L"

print "U"
moveLD(tx, ty+1, sx-1, sy)
print "R"

puts

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

ll a[1000010];
int main() {
	ll k,n;
	cin>>k>>n;
	for(ll i=0;i<n;i++){
		cin>>a[i];
	}
	ll ans=0;
	for(ll i=1;i<n;i++){
		ans=max(ans,a[i]-a[i-1]);
	}
	ans=max(ans,a[0]+k-a[n-1]);
	cout << k-ans;
	// your code goes here
	return 0;
}

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

map<string,int> data;

int main() {
    data.clear();

    int n; scanf("%d", &n);
    for (int i=1; i<=n; i++) {
        char _s[15]; scanf("%s", _s);

        string s = (string)_s;
        sort(s.begin(), s.end());

        if (data.find(s) == data.end()) data[s] = 0;
        data[s] += 1;
    }

    long long res = 0;
    for (pair<string,int> x: data) {
        long long ret = (long long)x.second;
        res += ret * (ret - 1) / (long long)2;
    }

    printf("%lld\n", res);

    return 0;
}


Measured memory_bytes: 11136
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <tuple>
#include <numeric>
#include <cstdio>
#include <cmath>
using namespace std;
using ll = long long;
const int INF = 1e9;

int main() {
    int n, y; cin >> n >> y;
    for (int i = 0; i <= n; i++) {
        for (int j =0; j <= n; j++) {
            int k = n - i - j;
            if (k >= 0) {
                int sum = i * 10000 + j * 5000 + k * 1000;
                if (sum == y) {
                    cout << i << " " << j << " " << k << endl;
                    return 0;
                }
            }
        }
    }
    cout << "-1 -1 -1\n";
}

Measured memory_bytes: 760
#include <iostream>
using namespace std;
#include <algorithm>
#include <string>
#include <vector>
#define ll long long
struct s1
{
    char name[100];
};
int main()
{

    ll a,b;
    char c;
    cin>>a>>c>>b;
    ll d;
    if(c=='+')
        d=a+b;
    else
        d=a-b;
    cout<<d;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
    int a,b,c,d;
    scanf("%d%d%d", &a,&b,&c);
    if(a > b){
        d = b;
        b = a;
        a = d;
    }if (a > c){
        d = c;
        c = a;
        a = d;
    }if (b > c){
        d = c;
        c = b;
        b = d;
    }
    printf("%d %d %d\n",a,b,c);
    return 0;
}


Measured memory_bytes: 2100
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;

int R, G;

int main(void){
    
    scanf("%d %d", &R, &G);
    printf("%d\n", 2 * G - R);
    
    return 0;
}


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

using namespace std;
using ll = long long;

#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define REP(i,n) FOR(i, 0, n)
#define FORD(i,a,n) for(int i=(a); i>=(n); i--)
#define REPD(i,n) FORD(i, n, 0)

#define ALL(o) (o).begin(), (o).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T, vector<T>, greater<T> >;

const ll MOD = 1000000007;

ll aabs(ll a) {
	if(a  >= 0) {
		return a;
	} else {
		return -a;
	}
}

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

	if((a-b) %2 != 0){
		cout << "IMPOSSIBLE" << endl;
		return 0;
	}

    cout << aabs(a+b)/2 << endl;
}



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

int main(){
	long long int l,r,d;
	cin>>l>>r;
	
	if(r-l>2019)
		d=0;
	else{
		d=(l*(l+1))%2019;
		for(int i=l;i<=r;i++){
			for(int m=i+1;m<=r;m++){
				if(((i%2019)*(m%2019))%2019<d)
					d=((i%2019)*(m%2019))%2019;
			}
		}
	}
	cout<<d<<endl;
	
	return 0;
}

Measured memory_bytes: 256
from itertools import accumulate as ac
n,k=map(int,input().split())
a=list(map(int,input().split()))
b=[0]+list(ac(a))
c=[0]+list(ac([(0 if i<0 else i)for i in a]))
d=0
for i in range(n-k+1):
    d=max(d,max(b[i+k]-b[i],0)+c[i]+c[-1]-c[i+k])
print(d)

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

template <typename T>
class SegmentTree{
  public:
    int n;
    T element;
    vector<T> dat;
    function<T(T,T)> operate;

    SegmentTree(){}
    SegmentTree(int n_,T element_,function<T(T,T)> operate_){
        element = element_;
        operate = operate_;
        n = 1;
        while(n < n_) n *= 2;
        dat = vector<T>(n*2,element);
    }

    void update(int k,T a){
        k += n-1;
        dat[k] = a;
        while(k > 0){
            k = (k-1)/2;
            dat[k] = operate(dat[k*2+1],dat[k*2+2]);
        }
    }

    T query(int a,int b,int k,int l,int r){
        if(r<=a || b<=l) return element;
        if(a<=l && r<=b) return dat[k];
        T vl = query(a,b,k*2+1,l,(l+r)/2);
        T vr = query(a,b,k*2+2,(l+r)/2,r);
        return operate(vl,vr);
    }

    T query(int a,int b) { return query(a,b,0,0,n); }

    T get(int k){ return query(k,k+1); }
};

struct P{
    int l,r,id;
    bool q;
};

bool operator<(const P a, const P b) {
    if(a.r != b.r) return a.r < b.r;
    if(a.q != b.q) return b.q;
    return a.l < b.l;
}

int main(void){
    int n,m,q;
    cin>>n>>m>>q;
    vector<P> segs;
    rep(i,m){
        int l,r;
        cin>>l>>r;
        segs.push_back({l,r+1,0,false});
    }
    rep(i,q){
        int l,r;
        cin>>l>>r;
        segs.push_back({l,r+1,i,true});
    }
    vector<int> res(q);
    sort(all(segs));
    SegmentTree<int> stree(n+1, 0, [](int a,int b){return a+b;});

    for(P seg : segs){
        if(seg.q){
            res[seg.id] = stree.query(seg.l, seg.r);
        }else{
            stree.update(seg.l, stree.get(seg.l)+1);
        }
    }
    for(int x : res){
        cout<<x<<endl;
    }
    return 0;
}


Measured memory_bytes: 10604
#include<bits/stdc++.h>
#define endl '\n';
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr double INFD = 1e100;
constexpr ll mod2 = 1000000007;
constexpr ll mod = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
// ---------------------------------------------------------------------------

int main(){
  int H,W;
  cin >> H >> W;
  vector<string> S(H);
  for(int i=0; i<H; i++){
    cin >> S[i];
  }
  int cnt = 0;
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      if(S[i][j] == '#') cnt++;
    }
  }
  if(cnt == H+W-1){
    cout << "Possible" << endl;
  }else{
    cout << "Impossible" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
h,w = map(int, input().split())
d = {'.':0, '#':1}
s = [['.']*(w+2)]
for i in range(h):
  s += [list('.' + input() + '.')]
s += [['.']*(w+2)]
for i in range(1, h+1):
  for j in range(1, w+1):
    if s[i][j] == '#':
      continue
    b = 0
    for x in range(-1, 2):
      for y in range(-1, 2):
        if s[i+x][j+y] == '#':
          b += 1
    s[i][j] = b
for i in range(1, h+1):
  for j in range(1, w+1):
    print(s[i][j], end='')
  print()
print()

Measured memory_bytes: 3444
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <string>
#include <sstream>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <stack>
#include <cstdio>
#include <climits>
#include <tuple>
#include <ctime> 
#define full(a) a.begin(), a.end()

#define sz(x) ((ll)(x).size())
#define ll long long
#define ull unsigned long long
using namespace std;

ll inp() {
    ll n; cin >> n;
    return n;
}

ll gcd(ll a, ll b) {
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;
}

template<class T>

void prvc(vector<T> vec) {
    for (auto i : vec)cout << i << " ";
    cout << endl;
}

pair<int, int> hat(pair<int, int> l, pair<int, int> r) {
    pair<int, int> ans;
    if (l.first > r.first)swap(l, r);
    if (r.first > l.second) {
        return pair<int, int>(-2e9, -2e9);
    }
    ans.first = r.first;
    ans.second = min(l.second, r.second);
    return ans;
}

ll cnm(ll n, ll m) {
    ll k = n - m;
    if (k < m)std::swap(k, m);
    ll l1 = 1;
    for (int i = k + 1; i <= n; i++) {
        l1 *= i;
        if (l1 % m == 0)l1 /= m, m--;
    }
    for (int i = 2; i <= m; i++)
    {
        l1 /= i;
    }
    return l1;
}

vector<ll> divs(ll n) {
    vector<ll> divisors;
    for (ll i = 1; i <= n; i++) {
        if (n % i == 0)divisors.push_back(i);
    }
    return divisors;
}

std::vector<std::string> split(const std::string& s, char delimiter)
{
    std::vector<std::string> tokens;
    std::string token;
    std::istringstream tokenStream(s);
    while (std::getline(tokenStream, token, delimiter))
    {
        tokens.push_back(token);
    }
    return tokens;
}

void solve() {
    ll n; cin >> n;
    bool k = false;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        ll a, b;
        cin >> a >> b;
        if (a == b)ans++;
        else ans = 0;
        if (ans >= 3)k = true;
    }
    if (k)cout << "Yes\n";
    else cout << "No\n";
}


int main()
{
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    //ll n; cin >> n;
    //while (n--)
        solve();

    return 0;
}

Measured memory_bytes: 3660
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <functional>

using namespace std;



int main()
{
	int a, b, c;
	int res;
	int cnt = 0;

	cin >> a >> b >> c;
	if (a == b) {
		cnt++;
	}
	if (b == c) {
		cnt++;
	}
	if (a == c) {
		cnt++;
	}
	if (cnt == 0) {
		res = 3;
	}
	if (cnt == 1) {
		res = 2;
	}
	if (cnt == 3) {
		res = 1;
	}
	cout << res << endl;


}

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

class comb{
	vector<ll> f,fr;
	ll MOD_;
	public:
	ll calc(ll a,ll b,ll p){//a^(b) mod p   
		if(b==0)return 1;
		ll y = calc(a,b/2,p);y=(y*y)%p;
		if(b & 1) y = (y * a) % p;
		return y;
	}
	void init(ll n,ll mod){//input max_n
		MOD_ = mod;
		f.resize(n+1);
		fr.resize(n+1);
		f[0]=fr[0]=1;
		for(ll i=1;i<n+1;i++){
			f[i] = (f[i-1] * i) % mod;
		}
		fr[n] = calc(f[n],mod-2,mod);
		for(ll i=n-1;i>=0;i--){
			fr[i] = fr[i+1] * (i+1) % mod;
		}
	}
	ll nCr(ll n,ll r){
		if(n<0||r<0||n<r)return 0;
		return f[n] * fr[r] % MOD_ * fr[n-r] % MOD_;
	}//nHr = n+r-1Cr
};


int main(){

	ll N;
	cin >> N;
	vector<ll> x(N),y(N);
	for(int i=0;i<N;i++){
		cin >> x[i] >> y[i];
		x[i] = x[i] + y[i];
		y[i] = x[i] - 2*y[i];
	}

	sort(x.begin(), x.end());
	sort(y.begin(), y.end());

	ll ans = max(x[N-1] - x[0] , y[N-1] - y[0]);
	cout << ans << endl;

}




Measured memory_bytes: 6324
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
#define fi first
#define se second
#define pb push_back
#define mp make_pair
ll power(ll x,ll y,ll p)
{
    ll res = 1;      // Initialize result

    x = x % p;  // Update x if it is more than or
                // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}
int main(){
  ll n,k;
  cin >> n >> k;
  vector <ll> v(n) ;
  for(ll i=0;i<n;i++) cin >> v[i] ;
  sort(v.begin(),v.end()) ;
  if(k>=n) cout << "0" << endl;
  else{
    ll sum=0;
    for(ll i=0;i<n-k;i++){
      sum += v[i] ;
    }
    cout << sum << endl;
  }

}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(void){
    double m[5];
    
    for(int i=0; i<5; i++){
        cin >> m[i];
    }
    sort(m, m+5);
    for(int i=4; i>=0; i--){
        cout << m[i];
        if(i!=0) cout << " " ;
    }
    cout << "\n";
    
    return 0;
}


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

using namespace std;

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

#define MAX 100000
#define NIL -1
#define MOD 1000000007

typedef int _loop_int;
#define rep(i, n) for (int i = 0; i < n; i++)
#define FOR(i, a, b) for (_loop_int i = (_loop_int)(a); i < (_loop_int)(b); ++i)
#define FORR(i, a, b) \
  for (_loop_int i = (_loop_int)(b)-1; i >= (_loop_int)(a); --i)

#define debug(x) cout << #x << ": " << x << endl
#define debig_vec(v)                    \
  cout << #v << ":";                    \
  rep(i, v.size()) cout << " " << v[i]; \
  cout << endl
#define ALL(a) (a).begin(), (a).end()

int main() {
  string S;
  cin >> S;
  int count = 0;
  size_t len = S.length();

  rep(i, len) {
    if (i > len - i - 1) {
      break;
    }
    if (S[i] != S[len - i - 1]) {
      count++;
    }
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256