akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<iostream>
#include<stdlib.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<math.h>
#include<queue>
#include<stack>
#include<map>
using namespace std;
const int size=2e6+10;
const int INF=1e9;
typedef long long LL;
//LL tree[size];
LL a[size];
LL b[size];
//int lowbit(int x)
//{
//    return x&(-x);
//}
//void update(int x)
//{
//    while(x<size)
//    {
//        tree[x]+=1;
//        x+=lowbit(x);
//    }
//}
//LL ask(int x)
//{
//    LL sum=0;
//    while(x)
//    {
//       sum+=tree[x];
//       x-=lowbit(x);
//    }
//    return sum;
//}
struct node
{
    int l,r;
    int sum;
}tree[size];
//void build(int l,int r,int rt)
//{
//    int mid=(l+r)>>1;
//    tree[rt].l=l,tree[rt].r=r,tree[rt].sum=0;
//    if(l==r) return ;
//    build(l,mid,rt*2);
//    build(mid+1,r,rt*2+1);
//}
//void pushdown(int rt)
//{
//    tree[rt].sum=tree[rt*2].sum+tree[rt*2+1].sum;
//}
void update(int num,int x)
{
    if(tree[num].l==tree[num].r)
    {
        tree[num].sum++;
        return ;
    }
    int mid=(tree[num].l+tree[num].r)/2;
    if(x<=mid)
        update(2*num,x);
    else update(2*num+1,x);
    tree[num].sum++;
}
//void update(int pos,int l,int r,int rt)
//{
//    if(l==r)
//    {
//        tree[rt].sum++; return ;
//    }
//    int mid=(l+r)>>1;
//    if(pos<=mid) update(pos,l,mid,rt*2);
//    else update(pos,mid+1,r,rt*2+1);
//    pushdown(rt);
//}
//LL ask(int l,int r,int rt)
//{
////    printf("l=%d r=%d\n ",l,r);
//    if(l>r) return 0;
//    if(l==tree[rt].l&&r==tree[rt].r)
//        return tree[rt].sum;
//   LL sum=0;
//   int mid=(l+r)>>1;
//   if(l<=mid) sum+=ask(l,mid,rt*2);
//   if(r>mid) sum+=ask(mid+1,r,rt*2+1);
//   return sum;
//}
void build(int num,int l,int r)
{
    if(l==r)
    {
        tree[num].l=tree[num].r=l;
//        fa[r]=num;
        tree[num].sum=0;
        return ;
    }
    tree[num].l=l; tree[num].r=r; tree[num].sum=0;
    int mid=(l+r)/2;
    build(2*num,l,mid);
    build(2*num+1,mid+1,r);
}
int ask(int l,int r,int rt)
{
    if(tree[rt].l==l&&tree[rt].r==r)
    {
        return tree[rt].sum;
    }
    int mid=(tree[rt].l+tree[rt].r)/2;
    if(l>mid)
    {
         return ask(l,r,2*rt+1);
    }
    else if(r<=mid)
    {
        return ask(l,r,2*rt);
    }
    else
    {
        return ask(l,mid,2*rt)+ask(mid+1,r,2*rt+1);
    }
}
int main()
{
   int n;LL p;
   while(scanf("%d%lld",&n,&p)!=EOF)
   {
      // memset(tree,0,sizeof(tree));
     build(1,1,n+1);
     LL ans=0;
     for(int i=1;i<=n;i++) scanf("%lld",&b[i]);
     for(int i=1;i<=n;i++)
     {
         b[i]-=p;
         b[i]=b[i]+b[i-1];
         if(b[i]>=0) ans++;
         a[i-1]=b[i];
     }
     sort(a,a+n);
     int cnt=unique(a,a+n)-a;
//     build(1,n,1);
     for(int i=1;i<=n;i++)
     {
          int temp=lower_bound(a,a+cnt,b[i])-a+1;
         int pri=ask(1,temp,1);
        ans+=pri;
//          printf("pri=%d\n",pri);
          update(1,temp);
     }
//     out(1,n,1);
     printf("%lld\n",ans);
   }
}


Measured memory_bytes: 14080
INF = 1000
h, w = gets.split.map(&:to_i)
a_map = []
h.times do
  a_map << gets.chop.chars
end
a_cost = Array.new(h) { Array.new(w, nil) }
a_cost[0][0] = a_map[0][0] == '.' ? { flg: false, cost: 0 } : { flg: true, cost: 1 }
next_idxs = [[0, 0]]
loop do
  break if next_idxs.include?([h-1, w-1])

  tmp_next_idx = []
  next_idxs.each do |hidx, widx|
    # go right
    if hidx + 1 < h
      if !a_cost[hidx][widx][:flg] && a_map[hidx+1][widx] == '#'
        a_cost[hidx+1][widx] = { flg: true, cost: a_cost[hidx][widx][:cost] + 1 } if a_cost[hidx+1][widx].nil? || a_cost[hidx+1][widx][:cost] > a_cost[hidx][widx][:cost] + 1
      elsif a_cost[hidx][widx][:flg] && a_map[hidx+1][widx] == '#'
        a_cost[hidx+1][widx] = { flg: true, cost: a_cost[hidx][widx][:cost] } if a_cost[hidx+1][widx].nil? || a_cost[hidx+1][widx][:cost] > a_cost[hidx][widx][:cost]
      else
        a_cost[hidx+1][widx] = { flg: false, cost: a_cost[hidx][widx][:cost] } if a_cost[hidx+1][widx].nil? || a_cost[hidx+1][widx][:cost] > a_cost[hidx][widx][:cost]
      end
      tmp_next_idx << [hidx+1, widx]
    end

    # go down
    if widx + 1 < w
      if !a_cost[hidx][widx][:flg] && a_map[hidx][widx+1] == '#'
        a_cost[hidx][widx+1] = { flg: true, cost: a_cost[hidx][widx][:cost] + 1 } if a_cost[hidx][widx+1].nil? || a_cost[hidx][widx+1][:cost] > a_cost[hidx][widx][:cost] + 1
      elsif a_cost[hidx][widx][:flg] && a_map[hidx][widx+1] == '#'
        a_cost[hidx][widx+1] = { flg: true, cost: a_cost[hidx][widx][:cost] } if a_cost[hidx][widx+1].nil? || a_cost[hidx][widx+1][:cost] > a_cost[hidx][widx][:cost]
      else
        a_cost[hidx][widx+1] = { flg: false, cost: a_cost[hidx][widx][:cost] } if a_cost[hidx][widx+1].nil? || a_cost[hidx][widx+1][:cost] > a_cost[hidx][widx][:cost]
      end
      tmp_next_idx << [hidx, widx+1]
    end
  end
  next_idxs = tmp_next_idx.uniq
end
puts a_cost[h-1][w-1][:cost]

Measured memory_bytes: 5756
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

N = inp()
S = input()
ans = 1
for i in range(1,N):
    if S[i-1] != S[i]:
        ans += 1

print(ans)


Measured memory_bytes: 4580
using System;

class Program
{
    static void Main()
    {
        var n=int.Parse(Console.ReadLine());
        int[,] table = new int[3*4, 10];   
        for (var i = 1; i <= n; i++)
        {
            var line = Console.ReadLine().Split(' ');
            int b = int.Parse(line[0]);
            int f = int.Parse(line[1]);
            int r = int.Parse(line[2]);
            int v = int.Parse(line[3]);

            int rowIndex = 3 * (b - 1) + (f-1);
            int columnIndex = r-1;
            table[rowIndex, columnIndex] += v;
        }

        for(var i=0; i<table.GetLength(0); i++)
        {
            for (var j = 0; j < table.GetLength(1); j++)
            {
                    Console.Write(" "+table[i, j]);
                    if (j == table.GetLength(1) - 1)Console.WriteLine();
            }
            if (  (i % 3 == 2)&&(i+1!=table.GetLength(0))  ) Console.WriteLine("####################");
        }
    }
}


Measured memory_bytes: 7872
#include<bits/stdc++.h>
using namespace std;
int main(){
int N;
  cin>>N;
  set<string>S;
  for(int i=0;i<N;i++){
  string s;
    cin>>s;
    S.insert(s);
  }int ans=S.size();
  cout<<ans<<endl;
   return 0;
}

Measured memory_bytes: 19256
using System;
using System.Collections.Generic;

namespace AtCoderTest
{
    class Program2
    {
        static int cntStation = 500;
        static int[,] numAry;

        static void Main(string[] args)
        {
            string line;

            for (int i = 0; (line = Console.ReadLine()) != null && line != ""; i++)
            {
                if (i == 0)
                {
                    cntStation = int.Parse(line);
                    numAry = new int[cntStation - 1, 3];
                }
                else
                {
                    string[] words = line.Split(' ');
                    for (int j = 0; j <= 2; j++ )
                    {
                        numAry[i - 1, j] = int.Parse(words[j]);
                    }
                }
            }
            for (int i = 0; i < cntStation; i++)
            {
                Console.WriteLine(TimeCount(i));
            }
 //           Console.ReadLine();
        }

        static int TimeCount(int idx)
        {
            if (idx == cntStation) return 0;

            int elapsedTime = 0;
            for (int i = idx; i < cntStation - 1; i++)
            {
                elapsedTime = ArrivedTime(i, elapsedTime);
            }
            return elapsedTime;
        }

        static int ArrivedTime(int idx, int elapsedTime)
        {
            int startTime = numAry[idx, 1];
            while (elapsedTime > startTime)
            {
                startTime = startTime + numAry[idx, 2];
            }
            return startTime + numAry[idx, 0];
        }
    }
}


Measured memory_bytes: 11092
/// In The Name Of God
/// I wish, that I could leave it all behind me / Go to my own world where no one can find me
#include<bits/stdc++.h>

using namespace std;

#define F first
#define S second
#define mp make_pair
#define pb push_back
#define int long long
#define ll long long
#define pii pair <int , int>
#define ld long double
#define for2(a,b,c) for(int (a) = (b); (a) < (c); (a)++)
#define for3(a,b,c) for(    (a) = (b); (a) < (c); (a)++)
#define setp cout << fixed << setprecision(15)
#define endl "\n"
#define minit(a,b) a = min(a,b)
#define maxit(a,b) a = max(a,b)
#define PII pair<int,int>
#define Vec vector<int>
#define error(x) cerr << #x << " = " << (x) << endl;
#define all(x) (x).begin() , (x).end()

int test[200][200];

int32_t main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t; cin >> t;
    while(t--){
        int a,b,c,d; cin >> a >> b >> c >> d;
        if(d < b || a < b){
            cout << "No" << endl;
            continue;
        }
        if(c+1 >= b){
            cout << "Yes" << endl;
            continue;
        }
        if(__gcd(b,d) == 1){
            cout << "No" << endl;
            continue;
        }
        d = __gcd(b,d);
        d %= b;
        a %= b;
        if(a < b && a > c){
            cout << "No" << endl;
            continue;
        }
        if(!d){
            cout << "Yes" << endl;
            continue;
        }
        a += d*((b-1-a)/d);
        if(a > c && a < b){
            cout << "No" << endl;
        }else cout << "Yes" << endl;
        continue;

    }
    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

X = [[0,0] for i in range(N)]

for i in range(N):
  X[i][0] = A[i]
  X[i][1] = i+1
  
X.sort()

ans = []
for i in range(N):
  ans.append(X[i][1])
  
print(" ".join(map(str, ans)))

Measured memory_bytes: 28412
#include "bits/stdc++.h"

using namespace std;

void solve(void)
{
	int a, b, t;
	cin >> a >> b >> t;
	cout << t / a * b << endl;
}

int main()
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 256
s=input()
sl=len(s)

l=[0 for i in range(sl+1)]
for i in range(sl):
    if s[i]=='<':
        l[i+1]=max(l[i]+1, l[i+1])

for i in range(sl-1,-1,-1): # reversed(range(sl))
    if s[i]=='>':
        l[i]=max(l[i+1]+1, l[i])

print(sum(l))

Measured memory_bytes: 29748
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		String S = sc.next();

		int[] leftW = new int[N];
		int[] rightE = new int[N];

		leftW[0] = S.charAt(0) == 'W' ? 1 : 0;
		for (int i = 1; i < N; i++) {
			leftW[i] = leftW[i - 1] + (S.charAt(i) == 'W' ? 1 : 0);
		}

		rightE[N - 1] = S.charAt(N - 1) == 'E' ? 1 : 0;
		for (int i = N - 2; i >= 0; i--) {
			rightE[i] = rightE[i + 1] + (S.charAt(i) == 'E' ? 1 : 0);
		}

		int ans = Integer.MAX_VALUE;
		for (int i = 0; i < N; i++) {
			int x;
			if (i == 0) {
				x = rightE[i + 1];
			} else if (i == N - 1) {
				x = leftW[i - 1];
			} else {
				x = leftW[i - 1] + rightE[i + 1];
			}
			ans = Math.min(ans, x);
		}

		out.println(ans);

		sc.close();

	}

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

}


Measured memory_bytes: 31552
#include<bits/stdc++.h>
using namespace std;
string s;
int len,cnt;
int main()
{
	cin>>s;
	len=s.size();
	for(int i=1;i<len-1;++i)
		if(s[i]!=' ')
			cnt++;
	cout<<s[0]<<cnt<<s[len-1];
	
	return 0;
}

Measured memory_bytes: 256
if isfile("mystdin.txt");mystdin=open("mystdin.txt","r");redirect_stdin(mystdin);end
pI(x)=parse(Int,x)
pM(x::Array{SubString{String},1})=map(pI,x)
function main()
  n,m,x=pM(split(readline()))
  a=zeros(Int,n)
  for i=pM(split(readline()))
    a[i]=1
  end
  for i=2:n
    a[i]=a[i-1]+a[i]
  end
  println(min(a[n]-a[x],a[x]))
end
main()
if isdefined(Base, :mystdin);close(mystdin);end


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

int main() {
    int a, b, c;
    int tri=0, sharp=0, obtuse=0, right=0;
    while(cin>>a>>b>>c) {
        int temp = max({a, b, c});
        if(temp==b) {
            swap(a, b);
        } else if(temp==c) {
            swap(a, c);
        }
        if(a>=b+c) break;
        tri++;
        int d = b*b+c*c-a*a;
        if(d==0) right++;
        else if(d>0) sharp++;
        else obtuse++;
    }
    cout << tri << ' ' << right << ' ' << sharp << ' ' << obtuse << '\n';

    return 0;
}




Measured memory_bytes: 3080
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
int main(){
  int n;cin >> n;
  string str;
  int imax=-1,cnt=0;
  vector<string> v;
  map<string,int> m;
  for(int i = 0; i < n; i++){
    cin >> str;
  	m[str] ++;
  }
   for(auto it = m.begin(); it != m.end(); ++it) {
     	if(imax < it->second){
        	imax = it->second;
          	cnt = 0;
          	v.clear();
        }
     	if(imax == it->second){
        	cnt ++;
          	v.push_back(it->first);
        }
    }
    sort(v.begin(), v.end());
    for(string s : v)
    	cout << s << endl;
    return 0;
}


Measured memory_bytes: 28148
//#include "debug.h"
#include <string.h>
#include <limits.h>
#include <map>
#include <set>
#include <vector>
#include <array>
#include <algorithm>
using namespace std;

#define MAXN 600

typedef array<short,4> tile;

int n;
tile a[MAXN];
long d[MAXN];

int input() {
	if (scanf("%d", &n) < 0) return 0;
	for (int i=0; i<n; i++)
		for (int j=0; j<4; j++)
			scanf("%hd", &a[i][j]);
	return 1;
}

void init() {
}

tile rotate(const tile &x, int k=1) {
	tile y;
	for (int i=0; i<4; i++) y[(i+k) % 4] = x[i];
	return y;
}

tile normalize(const tile &x) {
	tile z=x;
	for (int i=1; i<4; i++) {
		tile y=rotate(x, i);
		if (y<z) z=y;
	}
	return z;
}

int mirror(const tile &x) {
	int r = 1;
	for (int i=1; i<4; i++) {
		tile y=rotate(x, i);
		if (y==x) r++;
	}
	return r;
}

tile get_face(const tile &u, const tile &d, int x, int y) {
	return normalize({u[x], u[y], d[3-y], d[3-x]});
}

//use id to speed up
long id(const tile &x) {
	return x[0]*1000000000L + x[1]*1000000L + x[2]*1000L + x[3];
}

long solve() {
	map<long,long> ct;
	map<long,long> mi;
	for (int i=0; i<n; i++) {
		a[i] = normalize(a[i]);
		d[i] = id(a[i]);
		ct[d[i]]++;
		mi[d[i]] = mirror(a[i]);
	}
	long ans = 0;
	for (int i=0; i<n; i++) {
		ct[d[i]]--;
		for (int j=i+1; j<n; j++) {
			ct[d[j]]--;
			for (int k=0; k<4; k++) {
				tile d=a[i], u=rotate(a[j], k);
				tile f[4];
				long g[4];
				long r = 1;
				for (int t=0; t<4; t++) {
					f[t] = get_face(u, d, t, (t+3)%4);
					g[t] = id(f[t]);
					r *= mi[g[t]] * ct[g[t]]--;
				}
				//printf("* %d %d %d: %ld\n", i, j, k, r);
				ans += r;
				for (int t=0; t<4; t++) ct[g[t]]++;
			}
			ct[d[j]]++;
		}
		ct[d[i]]++;
	}
	return ans/3;
}

void output(long ans) {
	printf("%ld\n", ans);
}

void cleanup() {
}

int main() {
	//int ca; scanf("%d", &ca);
	while (input()) {
		init();
		output(solve());
		cleanup();
		//break;
	}
}





Measured memory_bytes: 159872
#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<vector<ll> > Graph;
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; }
const ll INF = 1e18;


int main(){
  ll a,b,c,k;
  cin >> a >> b >> c >> k;
  ll now = 0;
  if(a>=k){
    cout << k << endl;
    return 0;
  }
  now+=a;
  if(a+b>=k){
    cout << a << endl;
    return 0;
  }
  else{
    int now = k-(a+b);
    cout << a-now << endl;
  }
  return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int f(long long int x, long long int y);

int main() {
	long long int n, min = INT_MAX;
	cin >> n;

	for(int i = 1; i <= sqrt(n); i++) {
		if(n % i == 0) {
			int num = f(i, n / i);
			if(num < min) {
				min = num;
			}
		}
	}
	cout << min << endl;

	return 0;
}

int f(long long int x, long long int y) {
	int p = 0, q = 0;
	while(x != 0) {
		p++;
		x /= 10;
	}
	while(y != 0) {
		q++;
		y /= 10;
	}

	if(p < q) {
		return q;
	} else {
		return p;
	}
}

Measured memory_bytes: 256
//set many funcs template
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define inf 1072114514
#define llinf 1145141919810364364
#define mod 1000000007

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}

int main(void){
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    if(a==b){printf("%d\n",c);}
    if(a==c){printf("%d\n",b);}
    if(b==c){printf("%d\n",a);}
    return 0;
}

Measured memory_bytes: 128
//#pragma once
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <sstream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cctype>
#include <cstdlib>      // srand,rand


using namespace std;
#define modd 1000000007



typedef pair<long long, long long> pl;



typedef string::const_iterator State;
class ParseError {};




#define ll long long




class UnionFind {
public:
	vector <ll> par;
	vector <ll> siz;

	// Constructor
	UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL){
		for (ll i = 0; i < sz_; ++i) par[i] = i;
	}
	void init(ll sz_) {
		par.resize(sz_);
		siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
		for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
	}

	// Member Function
	// Find
	ll root(ll x) { // 根の検索
		while (par[x] != x) {
			x = par[x] = par[par[x]]; // x の親の親を x の親とする
		}
		return x;
	}

	// Union(Unite, Merge)
	bool merge(ll x, ll y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;

		// merge technique（データ構造をマージするテク．小を大にくっつける）
		if (siz[x] < siz[y]) swap(x, y);
		siz[x] += siz[y];
		par[y] = x;
		return true;
	}



	bool issame(ll x, ll y) { // 連結判定
		return root(x) == root(y);
	}

	ll size(ll x) { // 素集合のサイズ
		return siz[root(x)];
	}


};


class SegmentTree {
private:
	int n;
	vector <ll> node;

public:
	// 元の配列　v をセグメントツリーで表現する。
	SegmentTree(vector<ll> v) {
		//最下段のノード数は元配列のサイズ以上になる最小の2冪->これをnとおく。
		//セグ木全体で必要なノード数は2n-1個である。
		int sz = v.size();
		n = 1; 
		while (n < sz)n *= 2;

	}

};




long long N, M, K, a, b, c, d, e, H, W, L,T;
ll A[100005][30];
ll B[300005] = {};
ll C[100][3005] = {};
bool f, ff;
string S,SS;
set <long long>sll;
pl bufpl;
vector <long long>vl[600005];
vector <long long>vll;
vector <pl>vpl;
vector <string> vs;
set<ll> llset[50];
multiset<ll> llmset;
queue<ll> ql;


struct ST
{
	ll first;
	ll second;
	ll kaisuu;
	

	bool operator<(const ST& another) const
	{
		return first < another.first;//比較
	};

};



/*vector <ST> vst;
ST st[200005];
ST bufst;
bitset<5000> bits;*/


long long modinv(long long aa, long long mm) {
	long long bb = mm, uu = 1, vv = 0;
	while (bb) {
		long long tt = aa / bb;
		aa -= tt * bb; swap(aa, bb);
		uu -= tt * vv; swap(uu, vv);
	}
	uu %= mm;
	if (uu < 0) uu += mm;
	return uu;
}


ll minn, maxx;
double ansa;

ll zettai(ll aa) {

	if (aa < 0) {
		aa *= -1;
	}
	return aa;

}



double ab[20000];

bool fa[200009] = {};

ll amari[15] = {};
ll ama[7][10] = {};

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

	c = zettai(a + b);

	if (c % 2 == 1) {
		cout << "IMPOSSIBLE" << endl;
	}
	else {
		cout << c/2 << endl;
	}


	//cout << fixed << setprecision(10) << ansa << endl;
	return 0;


	
}


Measured memory_bytes: 16256
import java.util.Scanner;

public class Main {
	//java11

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		long X = sc.nextLong();
		long Y = sc.nextLong();

		int ans = 0;
		for(long i=X; i<=Y; i*=2) {
			ans++;
		}

		System.out.println(ans);
	}
}


Measured memory_bytes: 23124
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int  n, cnt=0, max=0;
  cin >> n;
  vector<int> poll(n);
  vector<string> s(n), ans(n);
  string now;
  for(int i=0; i<n; i++){
    cin>>s[i];
  }
  sort(s.begin(), s.end());
  now = s[0];
  
  for(int i=0;i<n;i++){
    if(i<n-1 && now == s[i]){
      cnt++;
    }else if(i<n-1 && now != s[i] && now == s[i-1]){
      now = s[i];
      if(max <= cnt){
        max = cnt;
        poll[i-1] = cnt;
      }
      cnt=1;
    }else if(i==n-1 && now==s[i]){
      cnt++;
      if(max <= cnt){
        max = cnt;
        poll[i]=cnt;
      }
    }else if(i==n-1 && now!=s[i]){
      if(max <= cnt){
        max = cnt;
        poll[i-1] = cnt;
        if(max == 1){
          poll[i] = 1;
        }
      }
    }
  }
  
  for(int i=0;i<n;i++){
    if(poll[i] == max){
      cout << s[i] <<endl;
    }
  }
  
}

Measured memory_bytes: 16640
#pragma region Header
#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#define IFD(...)
#ifndef NDEBUG
#define NDEBUG
#endif
#endif
#include <utility>
#include <cstdint>
#include <cmath>
#include <cassert>
#include <vector>
#include <array>
#include <deque>
#include <queue>
#include <stack>
#include <tuple>
#include <set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <string>
#include <functional>
#include <algorithm>
#include <numeric>
#include <stdexcept>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <boost/hana/functional/fix.hpp>
using boost::hana::fix;
using namespace std;
using i32 = int32_t;
using i64 = int64_t;
using u32 = uint32_t;
using u64 = uint64_t;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repd(i, n) for (int i = (n) - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define FORD(i, b, a) for (int i = (b); i >= (a); --i)
template <typename T>
int SZ(T const &x)
{
    return static_cast<int>(x.size());
}
template <class T>
bool chmax(T &a, T const &b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
bool chmin(T &a, T const &b)
{
    if (b < a)
    {
        a = b;
        return true;
    }
    return false;
}
#pragma endregion

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);

    int n;cin>>n;
    i64 ans = 0;
    FOR(a, 1, n - 1)
    {
        int bmax = (n - 1) / a;
        ans += bmax;
    }
    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <climits>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;

int INF = 1<<29;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする

int main(){
	int n,i;
	cin>>n;
	int ans=0;
	for(i=1;i<=n;i++){
		ans += i;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
//#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef pair<int,int> Pi;
typedef long long int ll;
const int INF=(ll)(1<<30)-1;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int n;
ll a[100100];
vector<ll> b;
vector<ll> c;

int main(){
	cin>>n;
	ll sum=0;
	b.push_back(0);
	REP(i,n){
		int t;
		cin>>t;
		sum+=(ll)t;
		b.push_back(sum);
	}
	sort(b.begin(),b.end());
	int s=1;
	for(int i=1;i<b.size();i++){
		if(b[i-1]!=b[i]){
			if(s>1){
				c.push_back(s);
				s=1;
			}
		}else{
			s++;
		}
	}
	if(s>1){
		c.push_back(s);
	}
	ll ans=0;
	for(int i=0;i<c.size();i++){
		ans+=(ll)(c[i]*(c[i]-1))/2;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 2420
N = gets.to_i
a = []
a = gets.split.map(&:to_i)
a = a.sort

# if N==2
#   if a[0]*a[1] > 10**18
#     puts -1
#   else
#     puts a[0]*a[1]
#   end
#   exit
# end

# if N % 2 == 1
#   ans = a[N/2]
# else
#   ans = 1
# end

# (N/2).times do |i|
#   ans = ans * (a[i] * a[N-1-i])
#   if ans == 0
#    puts 0
#    exit
#   end
#   if ans > 10**18
#     puts -1
#     exit
#   end
# end
# puts ans

# aに1個でも0があればかけ算の結果は0確定
# a.each do |ai|
#   if ai == 0
#     puts 0
#     exit
#   end
# end

# 答えが0にならない場合は以下で処理
"memo:
 C++言語のlong long型でも1e18はオーバーフローしてしまうので注意が必要らしい
 rubyの場合，整数のオーバーフローは起こらない
 ただし，全部掛け算してから判定すると多倍長整数のかけざんに時間がかかってTLEになる
 →1回かけ算するごとに1e18を超えてるかのチェックを入れる 
 "
ans = 1
N.times do |i|
 ans *= a[i]
 # 10^18をこえた瞬間に-1を出力して終了
 if ans > 1e18
  puts -1 
  exit
 end
end

puts ans

Measured memory_bytes: 22988
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 1000000000;
constexpr ll INF= 1e18;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<int,int> P;
typedef tuple<int,int,int> TP;

template<typename T>
T Pow(T a,T b) {
    T ret = 1;
    for(int i = 0;i < b;i++) {
        ret *= a;
    }
    return ret;
}
 
ll mod(ll val) {
    ll res = val % MOD;
    if(res < 0) {
        res += MOD;
    }
    return res;
}
 
ll RS(ll N, ll P, ll M){
    if(P==0) return 1;
    if(P < 0) {
        return 0;
    }
    if(P%2==0){
        ll t = RS(N, P/2, M);
        return t*t % M;
    }
    return N * RS(N, P-1, M) % M;
}

int main() {
    int N;
    cin >> N;
    vector<ll> vec(N);
    for(int i = 0;i < N;i++) {
        cin >> vec.at(i);
    }
    sort(vec.begin(),vec.end());
    reverse(vec.begin(),vec.end());
    ll ret = 0;
    for(ll i = 0;i < N;i++) {
        if(i != 0) {
            ll cnt = RS(2,i - 1,MOD) * (i + 2) % MOD;
            cnt = cnt * RS(2,N - i - 1,MOD) % MOD * RS(2,N,MOD) % MOD;
            cnt = cnt * vec.at(i) % MOD;
            ret += cnt;
        }
        else {
            ret += vec.at(i) % MOD * RS(2,N - i - 1,MOD) % MOD * RS(2,N,MOD) % MOD;
        }
        ret %= MOD;
    }
    cout << ret << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include<unordered_map>
#include <set>
#include<unordered_set>
#include <queue>
#include <stack>
#include <vector>
#include<bitset>
#include<deque>
#include<string>
#include<list>
#include<iterator>
#include<sstream>
#include <algorithm>
#include <math.h>

#define lli long long int
#define ld long double
#define lower(a) transform(a.begin(),a.end(),a.begin(),::tolower);

using namespace std;

const int N = 3e5 + 500;
const long long mod = 1e9 + 7;
const long long cmod = 998244353 ;
const long long inf = 1LL << 61;
const int M = 1e6 + 500;
const lli ths = 1LL << 40;
const int NN = 5e3 + 6;

void pre() {
    return ;
}

void solve()
{
    lli n = 3;
    lli a[n][n];
    for(int i = 0; i < n; i ++) {
        for(int j = 0; j < n; j ++) {
            cin>>a[i][j];
        }
    }
    lli t = 0;
    cin>>t;
    while(t --) {
        lli x;
        cin>>x;
        for(int i = 0; i < n; i ++) {
            for(int  j = 0; j <  n ; j ++) {
                if(a[i][j] == x)
                    a[i][j] = 0;
            }
        }
    }
    bool ok = 0;
    for(int i = 0; i < n; i ++) {
        lli j = 0;
        if(a[i][j] == 0 && a[i][j + 1] == 0 && a[i][j + 2] == 0)
            ok = 1;
        if(a[0][i] == 0 && a[1][i] == 0 && a[2][i] == 0)
            ok = 1;
    }
    if(a[0][0] == 0 && a[1][1] == 0 && a[2][2] == 0)
        ok = 1;
    if(a[2][0] == 0 && a[1][1] == 0 && a[0][2] == 0)
        ok = 1;
    if(ok)
        cout<<"Yes";
    else
        cout<<"No";
    cout<<'\n';
    return ;
}

/*
*/

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

//    pre();

    int t = 1;
//    cin>>t;
    while(t --)
    {
        solve();
    }
    return 0;
}
/*
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF 2 << 29
#define MOD 1000000007
#define Yes(f) puts((f)? "Yes" : "No")
#define YES(f) puts((f)? "YES" : "NO")
int gcd(int a, int b) {
	if (b != 0)return gcd(b, a % b);
	return a;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}
using Graph = vector<vector<int>>;

int main(){
	int n; cin >> n;
	string s; cin >> s;
	bool f = true;
	if(n % 2){
		cout << "No" << endl;
		return 0;
	}
	for(int i = 0; i < n / 2; i++){
		if(s[i] != s[i + n / 2]) f = false;
	}
	Yes(f);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define e(i,n) for(int i=0;i<n;i++)
using namespace std;int m[9],t[9];
bool F(){e(i,9){e(j,9)t[j]=m[j];if(t[i]>=2){t[i]-=2;bool o=1;
e(j,4){int p=0,d=0;while(!t[p])p++;if(!d&&t[p]>=3)t[p]-=3,d=1;
	if(!d&&p<7)if(t[p+1]&&t[p+2])t[p]--,t[p+1]--,t[p+2]--,d=1;
	if(!d){o=0;break;}}if(o)return 1;
}}return 0;}
int main(){string s;while(cin>>s){e(i,9)m[i]=0;int d=0;e(i,s.size())m[s[i]-'1']++;
	e(i,9){m[i]++;if(m[i]<5)if(F()){if(d)cout<<" ";cout<<i+1;d=1;}m[i]--;}
	if(!d)cout<<0;cout<<endl;
}return 0;}

Measured memory_bytes: 3084
#include <bits/stdc++.h>
#include <algorithm>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define stdi(in) freopen(in, "r", stdin)
#define stdo(out) freopen(out, "w", stdout)
#define stdio(in, out) stdi(in); stdo(out)
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define MAX 100007
#define MOD 1000000007
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
#define ordered_set tree<int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>


int n;
vector<int> compa[22];
ll dp[22][1LL<<22];
ll allmask;

ll solve(ll i, ll mask){
    //cerr<<"i == "<<i<<'\n';
    if(mask == allmask) return 1;
    if(i>=n) return 0;

    if(dp[i][mask]!=-1) return dp[i][mask];

    ll ways = 0;

    for(auto it: compa[i]){
        if(!(mask & (1LL<<it))){
            ways = (ways+solve(i+1, mask | (1LL<<it)))%MOD;
        }
    }

    return dp[i][mask] = ways;

}


int main(){
    /*#ifndef ONLINE_JUDGE
        stdio("in", "out");
    #endif*/

    cin>>n;
    allmask = (1LL<<n)-1;
    memset(dp, -1, sizeof(dp));
    //cerr<<"allmask == "<<allmask<<endl;
    int ij;
    for(int i=0;i<n;i++){
        for(int j=0;j<n; j++){
            cin>>ij;
            if(ij == 1){
                compa[i].pb(j);
            }
        }
    }

    ll ans = solve(0, 0);

    cout<<ans<<'\n';

    return 0;   
}

Measured memory_bytes: 721152
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        try (Scanner s = new Scanner(System.in)) {
            final int N = s.nextInt();
            final int[] dp = new int[N + 1];
            Arrays.fill(dp, N);
            dp[0] = 0;
            for (int i = 0; i < N; i++) {
                if (dp[i] == N) continue;
                for (int j = 9; i + j <= N; j *= 9) {
                    dp[i + j] = Math.min(dp[i + j], dp[i] + 1);
                }
                for (int j = 6; i + j <= N; j *= 6) {
                    dp[i + j] = Math.min(dp[i + j], dp[i] + 1);
                }
            }
            for (int i = Math.min(N, 6); i > 0; i--) {
                dp[N] = Math.min(dp[N - i] + i, dp[N]);
            }
            System.out.println(dp[N]);
        }
    }
}


Measured memory_bytes: 23764
import java.util.Calendar;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		//Calendarテ」ツつッテ」ツδゥテ」ツつケテ」ツ?ョテ」ツつェテ」ツδ姪」ツつクテ」ツつァテ」ツつッテ」ツδ?al1テ」ツつ津ァツ板淌ヲツ按静」ツ?療」ツ?ヲテ」ツ??」ツ?セテ」ツ?凖」ツ??
		Calendar cal1 = Calendar.getInstance();
		Scanner aScanner = new Scanner(System.in);
		while(aScanner.hasNextInt()){
			//setテ」ツδ。テ」ツつステ」ツδε」ツδ嘉」ツ?ァテヲツ猟・テヲツ卍づ」ツ?ォ2100テ・ツケツエ3テヲツ慊?テヲツ猟・テ」ツつ津ィツィツュテ・ツョツ堙」ツ?療」ツ?ヲテ」ツ??」ツ?セテ」ツ?凖」ツ??
			int month = aScanner.nextInt() - 1;
			int date = aScanner.nextInt();
			if(month < 0){break;}
			cal1.set(2004, month, date);
			//               
			switch (cal1.get(Calendar.DAY_OF_WEEK)){

				// テ・ツ渉姪・ツセツ療」ツ?療」ツ?淌ヲツ崢愿ヲツ猟・テ」ツδ陛」ツつ」テ」ツδシテ」ツδォテ」ツδ嘉」ツ?ョテ・ツ?、テ」ツ?ィテ・ツ青?ヲツ崢愿ヲツ猟・テ」ツつ津ィツ。ツィテ」ツ?凖・ツ?、テ」ツつ津ヲツッツ氾ィツシツε」ツ?療」ツ?ヲテヲツ崢愿ヲツ猟・テ」ツつ津・ツセツ療」ツ?セテ」ツ?凖」ツ??
				case Calendar.SUNDAY:
					System.out.println("Sunday");
					break;
				case Calendar.MONDAY:
					System.out.println("Monday");
					break;
				case Calendar.TUESDAY:
					System.out.println("Tuesday");
					break;
				case Calendar.WEDNESDAY:
					System.out.println("Wednesday");
					break;
				case Calendar.THURSDAY:
					System.out.println("Thursday");
					break;
				case Calendar.FRIDAY:
					System.out.println("Friday");
					break;
				case Calendar.SATURDAY:
					System.out.println("Saturday");
					break;
			}
		}
	}
}

Measured memory_bytes: 17276
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
typedef long long ll;
const ll mod = 1e9+7;
ll dp[100005][4];
int main(){
    string s; cin >> s;
    int n = s.size();

    for(int i = n; i >= 0; i--){
        for(int j = 3; j >= 0; j--){
            if(i == n) dp[i][j] = (j == 3 ? 1 : 0);
            else{
                dp[i][j] = dp[i+1][j]*(s[i] == '?' ? 3LL : 1LL);
                if(j < 3 && (s[i] == '?' || s[i] == "ABC"[j])) dp[i][j] += dp[i+1][j+1];
                dp[i][j] %= mod;
            }
        }
    }

    ll ans = dp[0][0];
    cout << ans << endl;
}

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

#define REP(i, start, count) for(int i=(start); i<(int)(count); ++i)
#define rep(i, count) REP(i, 0, count)
#define ALLOF(c) (c).begin(), (c).end()

typedef long long ll;
typedef unsigned long long ull;

int N, K;

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

    vector<int> x(N);
    rep(i, N) {
        cin >> x[i];
    }

    ll ans = 1000000000000000000LL;

    for(int l = 0; l < N - K + 1; ++l) {
        int r = l + K - 1;
        ll ltor = abs(x[l]) + abs(x[r] - x[l]); 
        ll rtol = abs(x[r]) + abs(x[r] - x[l]);

        ans = min(ans, min(ltor, rtol));
    } 

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

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int ,int> P;
#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
template <class T> void cumulative_sum( T array, size_t N );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;

int main( void ){
	vector<vector<int>> vec(3, vector<int>(3));
	rep(i,0,3){
		rep(j,0,3)
			cin >> vec[i][j];
	}
	bool is_correct = true;
	rep(i,0,2){
		int dif_y = vec[i][0] - vec[i+1][0];
		rep(j,1,3){
			if (vec[i][j] - vec[i+1][j] != dif_y)
				is_correct = false;
		}
	}
	rep(i,0,2){
		int dif_x = vec[0][i] - vec[0][i+1];
		rep(j,1,3){
			if (vec[j][i] - vec[j][i+1] != dif_x)
				is_correct = false;
		}
	}
	if (is_correct)
		cout << "Yes\n";
	else
		cout << "No\n";
}

int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
template <class T> void cumulative_sum( T array, size_t N ) {
	rep( i, 1, N + 1 ){
		array[ i ] += array[ i - 1 ];
	}
}
template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC085A
{
    class Program
    {
        static void Main(string[] args)
        {
            String s;
            s = Console.ReadLine();

            char[] cs = s.ToCharArray();

            cs[3] = '8';

            Console.WriteLine(cs);

            Console.ReadKey();
            }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<endl;
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;
const ll inf=1e15;

class UnionFind{
public:
	vector<int> par;
	vector<int> rank;
	vector<int> size;
 
	UnionFind(int n){
		rep(i,n){
			par.push_back(i);
			rank.push_back(0);
			size.push_back(1);
		}
	}
 
	int find(int x) {
		if(par[x]==x){
			return x;
		}else{
			return par[x]=find(par[x]);
		}
	}
 
	void unite(int x,int y){
		x=find(x);
		y=find(y);
		if(x==y) return;
		if(rank[x]<rank[y]){
			par[x]=y;
			size[y]+=size[x];
		}else{
			par[y]=x;
			size[x]+=size[y];
			if(rank[x]==rank[y]) rank[x]++;
		}
	}

	bool same(int x,int y){
		return find(x)==find(y);
	}
};

struct edge{ll u,v,cost;};

bool comp(const edge e1,const edge e2){return e1.cost<e2.cost;}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  vector<P> x(n),y(n);
  rep(i,n){
    cin>>x[i].fi>>y[i].fi;
    x[i].se=i;
    y[i].se=i;
  }
  sort(begin(x),end(x));
  sort(begin(y),end(y));
  vector<edge> g;
  rep(i,n-1){
    g.push_back({x[i].se,x[i+1].se,abs(x[i].fi-x[i+1].fi)});
  }
  rep(i,n-1){
    g.push_back({y[i].se,y[i+1].se,abs(y[i].fi-y[i+1].fi)});
  }
  sort(begin(g),end(g),comp);
  UnionFind uf(n);
  ll ans=0;
  rep(i,g.size()){
    if(!uf.same(g[i].u,g[i].v)){
      uf.unite(g[i].u,g[i].v);
      ans+=g[i].cost;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 11632
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
ll h,w;
ll ho[1111][1111];
struct co{
  ll y,x,y1,x2;
};
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>h>>w;
  vector<co>ans;
  for(int i=0;i<h;i++)for(int j=0;j<w;j++)cin>>ho[i][j];
  for(int i=0;i<h;i++){
    if(i%2 == 0){
      for(int j=0;j<w;j++){
	if(i == h-1 && j == w-1)continue;
	if(j!=w-1){
	  if(ho[i][j]%2){ho[i][j+1]++;ho[i][j]--;ans.pb({i,j,i,j+1});}
	}else{
	  if(ho[i][j]%2){ho[i+1][j]++;ho[i][j]--;ans.pb({i,j,i+1,j});}
	}
      }
    }else{
      for(int j=w-1;j>=0;j--){
	if(i == h-1 && j == 0)continue;
	if(j!=0){
	  if(ho[i][j]%2){ho[i][j-1]++;ho[i][j]--;ans.pb({i,j,i,j-1});}
	}else{
	  if(ho[i][j]%2){ho[i+1][j]++;ho[i][j]--;ans.pb({i,j,i+1,j});}
	}
      
      }
    }
  }
  cout<<ans.size()<<endl;
  for(auto a:ans){
    cout<<a.y+1<<" "<<a.x+1<<" "<<a.y1+1<<" "<<a.x2+1<<endl;
  }/*
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cout<<ho[i][j]<<" ";
    }
    cout<<endl;
    }*/
  return 0;
}

Measured memory_bytes: 12272
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+9;
int n,m;
string s;
int main(){
  cin>>n>>m>>s;
  vector<int>ans;
  bool flag=1;
  ans.push_back(n);
  int st=n,ed=n,an=-1;
  while(st){
    while(ed>=0&&st-ed<=m){
      if(s[ed]=='0')an=ed;
      ed--;
    }
    if(an==-1||an>=st){
      cout<<-1<<endl;
      return 0;
    }
    ans.push_back(an);
    st=an;
  }   
  //for(auto i:ans)cout<<i<<" ";cout<<endl; 
  st=0;ans.pop_back();
  while(ans.size()){cout<<ans.back()-st<<" ",st=ans.back(),ans.pop_back();}
  return 0;
}


Measured memory_bytes: 1144
#include <iostream>
#include <cmath>
#define EPS 1.0e-5
using namespace std;

int main() {
  double x1,y1,x2,y2,x3,y3,xp,yp;
  double a[2],b[2];
  double A,B;
  while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
    //    cout << x1 << " " << y1 << " " << x2 << " " << y2 << " " << x3 << " " << y3 << " " << xp << " " << yp << endl;
    a[0] = x2 - x1;
    a[1] = y2- y1;
    b[0] = x3 - x1;
    b[1] = y3 - y1;
    if(fabs(a[0]*b[0]+a[1]*b[1]) != 1) {
      A = ( b[1] * (xp-x1) - b[0] * (yp-y1)) / (a[0] * b[1] - b[0] * a[1]);
      B = (a[1] * (xp-x1) - (yp-y1) * a[0]) / (a[1] * b[0] - b[1] * a[0]);
      if ((A+B < 1) && (A > 0) && (B > 0)) {
        cout << "YES" << endl;
      }
      else {
        cout << "NO" << endl;
      }
    }
    else
      cout << "NO" << endl;
  }
}

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

int myPow(int x,int n){
    if(n == 0) return 0;
    int ret = 1;
    rep(i,n) ret *= x;
    return ret;
}

int main(){
    int n,m;
    cin >> n >> m;
    vector<int> s(m);
    vector<char> c(m);
    rep(i,m) cin >> s[i] >> c[i];

    for(int i = myPow(10,n-1); i < myPow(10,n); ++i){
        string str = to_string(i);
        bool check = true;
        rep(j,m){
            if(str[s[j]-1] != c[j]) check = false;
        }
        if(check){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {


    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        long result = 0;
        int N=sc.nextInt();

        Long[] a=new Long[3*N];

        for(int i=0;i<3*N;i++){
            a[i]=sc.nextLong();

        }

        Arrays.sort(a,Collections.reverseOrder());

        int j=0;

        while(j<N){
            result+=a[1+j*2];
            j++;
        }

        System.out.println(result);


    }
}


Measured memory_bytes: 103068
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iterator>
#include <map>
#include <set>
#include <string>
#include <vector>

using namespace std;
using ull = unsigned long long;

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

    ull ans = 1;
    for (ull i = 1; i * i <= N; ++i) {
        ans = i * i;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <cstring>
#include <iostream>
#include <math.h>
using namespace std;
int main ()
{
	int a,b;
	scanf("%i%i",&a,&b);
	if(b<a)	printf("%i",a-1);
	else printf("%i",a);
	return 0;
}


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

// macro
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
int main()
{
  int i;
  string n;cin>>n;
  int dig=n.size();
  vector<int> num(dig);
  rep(i,dig)num[i]=n[i]-'0';
  vector<vector<int>> dp(dig+1,vector<int>(2,0));
  for(i=dig-1;i>=0;i--)
  {
    dp[i][0]=min(dp[i+1][0]+num[i],dp[i+1][1]+num[i]+1);
    if(i!=dig-1)dp[i][1]=min(dp[i+1][0]+(10-num[i]),dp[i+1][1]+(9-num[i]));
    else dp[i][1]=dp[i+1][0]+(10-num[i]);
  }
  cout<<min(dp[0][0],dp[0][1]+1)<<endl;
}


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

int dh[4] = {-1, 1, 0, 0};
int dw[4] = {0, 0, -1, 1};

int main() {
    int H, W;
    cin >> H >> W;
    vector<string> s(H);
    for (int i = 0; i < H; i++) {
        cin >> s[i];
    }

    queue<pair<int, int>> que;
    que.push({0, 0});
    vector<vector<int>> dist(H, vector<int>(W, 1e9));
    dist[0][0] = 0;
    while (!que.empty()) {
        auto now = que.front();
        que.pop();
        int h = now.first, w = now.second;
        for (int i = 0; i < 4; i++) {
            int nh = h + dh[i];
            int nw = w + dw[i];
            if (0 <= nh && nh < H && 0 <= nw && nw < W && s[nh][nw] == '.' && dist[nh][nw] == 1e9) {
                dist[nh][nw] = dist[h][w] + 1;
                que.push({nh, nw});
            }
        }
    }
    if (dist[H - 1][W - 1] == 1e9) {
        cout << -1 << endl;
        return 0;
    }

    int ans = 0;
    for (int h = 0; h < H; h++) {
        for (int w = 0; w < W; w++) {
            if (s[h][w] == '.') {
                ans++;
            }
        }
    }
    ans -= dist[H - 1][W - 1] + 1;
    cout << ans << endl;
}


Measured memory_bytes: 256
using System;

namespace _2_B {
    class Program {
        static void Main (string[] args) {
            var input = Console.ReadLine ().Split ();
            var a = Convert.ToInt32 (input[0]);
            var b = Convert.ToInt32 (input[1]);
            var c = Convert.ToInt32 (input[2]);

            if (a < b && b < c) {
                Console.WriteLine ("Yes");
            } else {
                Console.WriteLine ("No");
            }
        }
    }
}


Measured memory_bytes: 17992