akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std ;
template < class R > inline void Readin( R &K ) {bool F=K=0;char C=getchar();while(C<'0'||C>'9')
{if(C=='-')F=1;C=getchar();}while(C<='9'&&C>='0')K=(K<<1)+(K<<3)+C-'0',C=getchar();if(F)K=-K;}
template < class R > inline bool Checkmax( R &A , R B ) { return A < B ? A = B , 1 : 0 ; }
template < class R > inline bool Checkmin( R &A , R B ) { return A > B ? A = B , 1 : 0 ; }
const int MaxN = 200000 + 10 ;
int N , P[MaxN] , Np[MaxN] ;
int Siz[MaxN] , Find[MaxN] ;
long long Ans ;
int F( int Nod ) {
	return Find[Nod] ? ( Find[Nod] == Nod ? Nod : Find[Nod] = F( Find[Nod] ) ) : 0 ;
}
inline void Merge( int A , int B ) {
	A = F(A) ;
	B = F(B) ;
	if( B ) {
		Siz[A] += Siz[B] ;
		Find[B] = A ;
	}
}
int main() {
	Readin( N ) ;
	for(register int i = 0 ; ++i <= N ; ) {
		Readin( P[i] ) ;
		Np[P[i]] = i ;
	}
	for(register int i = N ; i ; --i ) {
		Ans += 1ll * ( Siz[F(Np[i]-1)] + 1 ) * ( Siz[F(Np[i]+1)] + 1 ) * i ;
		Find[Np[i]] = Np[i] ;
		Siz[Np[i]] = 1 ;
		Merge( Np[i] , Np[i] - 1 ) ;
		Merge( Np[i] , Np[i] + 1 ) ;
	}
	return not printf( "%lld\n" , Ans ) ;
}

Measured memory_bytes: 3328
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<bool> vb;
#define pb push_back
#define fi first
#define se second
#define in insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int mod = 1e9 + 7;
void solve(){
    int n, m;
    cin >> n >> m;
    vector<vector<char>> a(n, vector<char>(n)), b(m, vector<char>(m));
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            cin >> a[i][j];
        }
    }
    for (int i = 0; i < m; ++i) {
        for (int j = 0; j < m; ++j) {
            cin >> b[i][j];
        }
    }
    for (int i = 0; i < n - m + 1; ++i) {
        for (int j = 0; j < n - m + 1; ++j) {
            bool q = true;
            for (int ii = 0; ii < m; ++ii) {
                for (int jj = 0; jj < m; ++jj) {
                    if (b[ii][jj] == a[ii+i][jj+j]) continue;
                    q = false;
                    break;
                }
                if (!q) break;
            }
            if (q) {
                cout << "Yes";
                return;
            }
        }
    }
    cout << "No";
}
int main(){
    speed;
    int t = 1;
    //cin >> t;
    for (int i = 1; i <= t; ++i) {
        solve();
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string.h>
#include <vector>
//s#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a; i<n; i++)
#define r0 return 0
#define INF (int)1e15
#define MOD 1000000007

#define access(i) a[i/3][i%3]
int gcd(int x, int y)
{
    if(y==0)
        return x;
    return gcd(y, x%y);
}

 long long numbers[500005];

//int a[100005];

 int main(){

 long long n;
cin>>n;

 double t,a;
 cin>>t>>a;

  double mini = INT_MAX;
  int pos=0;

 for(int i=0;i<n;i++){

   double H;
   cin>>H;

    double  x = t-H*0.006;
     double diff ;

  diff = abs(x-a);

   if(diff < mini){
        mini = diff;
     pos = i; }

 }

 cout<<pos+1<<endl;


 return 0;
 }


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define REPR(i, m, n) for (int i = (int)(m); i >= (int)(n); i--)
#define all(v) v.begin(), v.end()
typedef long long ll;
const int INF = 1001001001;
typedef pair<int,int> pii;

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; }

using Graph = vector<vector<pii> >;

int n;
vector<bool> seen;
vector<int> dist;
priority_queue<pair<int, int> > pq;

void dijkstra(const Graph &G, int v){
  seen[v] = true;

  for(pii p : G[v]){
    int u = p.first;
    int c = p.second;
    if(seen[u] == true) continue;
    if(chmin(dist[u], dist[v]+c)) pq.push(make_pair((-1)*dist[u], u));
  }

  while(!pq.empty()){
    pair<int, int> tmp;
    tmp = pq.top();
    pq.pop();
    if(seen[tmp.second]) continue;
    int nv = tmp.second;
    dijkstra(G, nv);
  }

  return;
}

int main(){
  cin >> n;

  Graph G(n);
  rep(i, n){
    int v, k; cin >> v >> k;
    rep(j, k){
      int u, c; cin >> u >> c;
      G[v].push_back(make_pair(u, c));
    }
  }

  seen.assign(n, false);
  dist.assign(n, INF);
  dist[0] = 0;
  dijkstra(G, 0);

  rep(i, n) cout << i << " " << dist[i] << endl;

  return 0;
}




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

int main() {
  int N;
  int frag = 1;
  cin >> N;
  for (int i=0; i<N; ++i) {
    string color;
    cin >> color;
    if (color == "Y"){
      cout << "Four" << endl;
      frag = 0;
      break;
    }
  }
  if (frag) {
  cout << "Three" << endl;
  }
}


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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
typedef vector<ll> VL; const int MD = 1e9 + 7;
void dbg(){ cerr << "\n"; } template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n, k;
	string s;
	cin >>n >>k >>s;
	int sm = 0;
	rep(i, n-1) sm += s[i]==s[i+1];
	cout <<min(sm+ 2*k, n-1) <<"\n";
	return 0;
	
}


Measured memory_bytes: 512
package main

import "fmt"

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	min := 1
	max := n
	for i := 0; i < m; i++ {
		var l, r int
		fmt.Scan(&l, &r)
		if min < l {
			min = l
		}
		if r < max {
			max = r
		}
	}
	ans := max - min + 1
	if ans < 0 {
		fmt.Println(0)
		return
	}
	fmt.Println(ans)
}


Measured memory_bytes: 5504
//-----------------------
// author : xyqkoala
// time : 2020-08-22
//-----------------------

#include<iostream>
#include<vector>
#include<string>
#include<deque>
#include<unordered_map>
#include<unordered_set>
#include<queue>
#include<algorithm>
#include<cmath>
#include<numeric>
using namespace std;

typedef long long LL;
const int MOD = 1e9+7;

void solve();


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

void solve(){
	int m,n;
	int ch,cw,dh,dw;
	cin>>m>>n>>ch>>cw>>dh>>dw;
	ch--;cw--;
	dh--;dw--;
	vector<string> nums(m);
	for(int i=0;i<m;i++) cin>>nums[i];
	deque<pair<int,pair<int,int>>> que;
	que.push_back({0,{ch,cw}});
	nums[ch][cw] = '#';
	vector<vector<int>> dir = {{1,0},{-1,0},{0,-1},{0,1}};
	int res = -1;
	while(!que.empty()){
		auto inque = que;
		bool ff = false;
		while(!inque.empty()){
			auto p = inque.front();
			inque.pop_front();
			int x = p.second.first;
			int y = p.second.second;
			int c = p.first;
			bool f = false;
			for(auto item:dir){
				int dx = x+item[0];
				int dy = y+item[1];
				if(dx==dh && dy==dw){
					f = true;
					res = c;
					break;
				}
				if(dx<0||dx>=m||dy<0||dy>=n||nums[dx][dy]=='#') continue;
				nums[dx][dy] = '#';
				inque.push_back({c,{dx,dy}});
				que.push_back({c,{dx,dy}});
			}
			if(f){
				ff = true;
				break;
			}
		}
		if(ff) break;

		int tm = que.size();
		while(tm--){
			auto p = que.front();
			int x = p.second.first;
			int y = p.second.second;
			int c = p.first;
			que.pop_front();
			bool f = false;
			for(int i=-2;i<=2;i++){
				for(int j=-2;j<=2;j++){
					int dx = x+i;
					int dy = y+j;
					if(dx== dh && dy==dw){
						f = true;
						res = c+1;
						break;
					}

					if(dx<0||dx>=m||dy<0||dy>=n||nums[dx][dy]=='#') continue;
					nums[dx][dy] = '#';
					que.push_back({c+1,{dx,dy}});
				}
				if(f){
					ff = true;
					break;
				}
			}
			if(f) break;
		}

		if(ff) break;
	}

	cout<<res<<endl;
}


Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
#define ref(i,x,y)for(int i=x;i<=y;++i)
const int N=101;
const int mod=1e9+7;
int n,c[N][N],dp[N][N][N],f[N][N];
int main(){
	cin>>n;
	ref(i,0,n)c[i][0]=1;
	ref(i,1,n)ref(j,1,i)c[i][j]=(c[i-1][j]+c[i-1][j-1])%mod;
	ref(i,1,n)dp[1][i>>1][(i-1)>>1]=n;
	ref(i,1,n){
		ref(ss,1,n-i){
			memset(f,0,sizeof f);
			int ii=i+ss;
			ref(s0,0,ss){int s1=ss-s0;
				if(!dp[i][s0][s1])continue;
				ref(I,0,ss){
					int s=1LL*c[n-i][I]*c[n-i-I][ss-I]%mod*dp[i][s0][s1]%mod;
					int lo=max(0,I-s1),ma=min(I,s0);
					if(lo>ma)continue;
					(f[s0-ma][I-ma]+=s)%=mod;
				}
			}
			ref(s0,1,n)ref(s1,1,n-s0)
				(f[s0][s1]+=f[s0-1][s1-1])%=mod;
			ref(s0,0,n)ref(s1,0,n-s0)
				(dp[ii][s0][s1]+=f[s0][s1])%=mod;
		}
	}
	cout<<dp[n][0][0]<<endl;
}

Measured memory_bytes: 3456
#include <iostream>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    int minn;
    int f=0;
    for(int i=0;i<n;i++)
    {
        int a,b;
        cin>>a>>b;
        if(b<=k)
        {
            if(!f)
            {
                minn=a;
                f=1;
            }
            else
            {
                if(a<minn)
                    minn=a;
            }
        }
    }
    if(!f)
        cout<<"TLE";
    else
        cout<<minn;
    return 0;
}


Measured memory_bytes: 256
def main():
    A, B, C, D = [int(x) for x in input().split()]
    while A > 0 and C > 0:
        C -= B
        if C <= 0:
            print("Yes")
            break

        A -= D
        if A <= 0:
            print("No")
            break

if __name__ == "__main__":
    main()


Measured memory_bytes: 9168
N = int(input())
s = str(input())

KEY = N - 20
# 以下に、記述してください。
enc = ""

for char in list(s):
    ASCII = ord(char)
    num = ASCII - 97
    num = (num + KEY) % 26
    ASCII = num + 97
    enc += chr(ASCII)

print(enc.upper())

Measured memory_bytes: 41040
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		sc.close();

		int[] cnt = new int[2];
		for (int i = 0; i < s.length; i++) {
			cnt[s[i] - '0']++;
		}
		System.out.println(Math.min(cnt[0], cnt[1]) * 2);
	}
}


Measured memory_bytes: 26944
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <string>
#define ll long long
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vvvl vector<vector<vector<ll> > >
#define vd vector<double>
#define vvd vector<vector<double> >
#define vvvd vector<vector<vector<double> > >
#define mod 1000000007
using namespace std;


int main(void){
    string s,t; cin>>s>>t;
    vl vs(26),vt(26);
    for(int i=0;i<s.length();++i){
        vs[s[i]-'a']++;
        vt[t[i]-'a']++;
    }
    sort(vs.begin(),vs.end());
    sort(vt.begin(),vt.end());
    for(int i=0;i<vs.size();++i) if(vs[i] != vt[i]){
        cout<<"No"<<endl;
        return 0;
    }cout<<"Yes"<<endl;
}


Measured memory_bytes: 776
# coding: utf-8
# Your code here!

from collections import deque

N = int(input())
P = deque(list(map(int, input().split())))
ans, tmp, minnum = 0, 0, pow(10,9)
Array = []

for i in range(N):
    tmp = P.popleft()
    Array.append(tmp)
    if tmp < minnum:
        minnum = tmp
    if Array[-1] == minnum:
        ans += 1
print(ans)


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

int main()
{
  int n;
  cin>>n;
  int arr[n][3];
  for(int i=0;i<n;i++)
  {
      for(int j=0;j<3;j++)
      {
          cin>>arr[i][j];
      }
  }
  for(int i=1;i<n;i++)
  {
      for(int j=0;j<3;j++)
      {
           arr[i][j]=arr[i][j]+max(arr[(i-1)][(j+1)%3],arr[(i-1)][(j+2)%3]);
      }

  }
  cout<<max(arr[n-1][0],max(arr[n-1][1],arr[n-1][2]));

}


Measured memory_bytes: 4792
n, y = map(int, input().split())

num_10 = 0
num_5  = 0
num_1  = 0
none = True

for i in range(n+1):
    for j in range(n+1):
        k = n-i-j
        if (i*10000 + j*5000 + k*1000) == y and k >= 0:
            num_10 = i
            num_5 = j
            num_1 = k
            none = False
            break
    if none == False:
        break
if none:
    print('-1 -1 -1')
else:
    print("{} {} {}".format(num_10, num_5, num_1))

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



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

if(a<0&&b>0)cout<<"Zero";
else if(a<0&&b<0){
	if((b-a+1)%2)cout<<"Negative";
	else
	cout<<"Positive";
}
else if(a>0)cout<<"Positive";
}

Measured memory_bytes: 3636
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.HashMap;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            int[] a = in.nextIntArray(n);

            HashMap<Integer, Integer> dp = new HashMap<>();
            long ans = 0;
            int base = 0;
            for (int i = 0; i < n; i++) {
                base = (base - a[i] % m + m) % m;
                dp.merge((base + a[i]) % m, 1, Integer::sum);
                ans += dp.getOrDefault(base, 0);
            }

            out.println(ans);
        }

    }

    static class InputReader {
        private BufferedReader br;
        private StringTokenizer st;

        public InputReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
            st = new StringTokenizer("");
        }

        public String nextString() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

        public int[] nextIntArray(int n) {
            int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt();
            }
            return res;
        }

    }
}



Measured memory_bytes: 44976
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        int a = sc.nextInt()*100;
        int b = sc.nextInt()*100;
        int c = sc.nextInt();
        int d = sc.nextInt();
        int e = sc.nextInt();
        int f = sc.nextInt();
        HashSet<Integer> w = new HashSet<>();
        HashSet<Integer> s = new HashSet<>();
        for(int i = 0; i <= f; i++){
            for(int j = 0; j <= f; j++){
                if(a*i+b*j > f) break;
                w.add(a*i+b*j);
            }
        }
        for(int i = 0; i <= f; i++){
            for(int j = 0; j <= f; j++){
                if(c*i+d*j > f) break;
                s.add(c*i+d*j);
            }
        }
        ArrayList<Integer> wl = new ArrayList<>(w);
        ArrayList<Integer> sl = new ArrayList<>(s);
        Collections.sort(wl);
        Collections.sort(sl);
        int answ = wl.get(1);
        int anss = 0;
        for(int ww : wl){
            if(ww != 0){
                for(int ss : sl){
                    int ws = ww+ss;
                    if(ws > f) break;
                    if(ws*e >= ss*(e+100) && ws*anss < ss*answ){
                        answ = ww+ss;
                        anss = ss;
                    }
                }
            }
        }
        System.out.println(answ + " " + anss);
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    } 
}


Measured memory_bytes: 24532
t = int(1e5)
n, m = map(int, input().split())
ans = 0
dp = [m + 1 for _ in range(t + 1)]
dp[0] = 0
for _ in range(n):
    w, v = map(int, input().split())
    for i in range(t, v - 1, -1):
        if dp[i - v] + w <= m:
            dp[i] = min(dp[i], dp[i - v] + w)
            ans = max(ans, i)
print(ans)

Measured memory_bytes: 44784
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		List<Integer> visit = new ArrayList<>();
		for(int i = 0; i < M; i++) {
			visit.add(sc.nextInt());
		}
		Collections.sort(visit);
		List<Integer> diff = new ArrayList<>();
		for(int i = 0; i < M - 1; i++) {
			diff.add(visit.get(i + 1) - visit.get(i));
		}
		Collections.sort(diff);
		int count = M - N;
		int ans = 0;
		while(count > 0) {
			ans += diff.get(0);
			diff.remove(0);
			count--;
		}
		System.out.println(ans);
	}

}


Measured memory_bytes: 57800
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/

#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

const ll MODBASE = 1000000007LL;
const int MAXN = 200010;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;

#include <atcoder/all>
using namespace atcoder;

int n, pos[MAXN], posY[MAXN], res[MAXN];
II a[MAXN];
set<int> s;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n;
    FOR(i,1,n) {
        cin >> a[i].FI >> a[i].SE;
        pos[a[i].FI] = i-1;
        posY[a[i].SE] = i-1;
    }
    sort(a+1, a+n+1);
    dsu Dsu(n);
    FOR(i,1,n) {
        int y = a[i].SE;
        int cs = posY[a[i].SE];
        int Min = 1e9;
        while (SZ(s)) {
            int g = *s.begin();
            if (g > y) break;
            Dsu.merge(posY[g], cs);
            Min = min(Min, g);
            s.erase(g);
        }
        if (Min != 1e9) s.insert(Min);
        s.insert(y);
    }
    s.clear();
    FORE(i,n,1) {
        int y = a[i].SE;
        int cs = pos[a[i].FI];
        int Max = 0;
        while (SZ(s)) {
            int g = *s.rbegin();
            if (g < y) break;
            Dsu.merge(posY[g], cs);
            Max = max(Max, g);
            s.erase(g);
        }
        if (Max) s.insert(Max);
        s.insert(y);
    }

    FOR(i,1,n) cout << Dsu.size(i-1) << "\n";
    return 0;
}


Measured memory_bytes: 11692
#include <bits/stdc++.h>
using namespace std;
 
#define int         long long
#define endl        "\n"
#define pii         pair<int, int>

const int mod = 1e9+7;
const int MAXN = 1e5+5;
const int N = 1e5+5;

int fac[N];
int spf[MAXN]; 

void pre(int p) {
    fac[0] = 1;
    for(int i=1; i<N; i++) {
        fac[i] = (fac[i-1] * i) % p;
    }
}


void sieve() 
{ 
    spf[1] = 1; 
    for (int i=2; i<MAXN; i++) spf[i] = i; 
    for (int i=4; i<MAXN; i+=2) spf[i] = 2; 
  
    for (int i=3; i*i<MAXN; i++) 
    { 
        if (spf[i] == i) 
        { 
            for (int j=i*i; j<MAXN; j+=i) if (spf[j]==j) spf[j] = i; 
        } 
    } 
} 

vector<int> getFactorization(int x) 
{ 
    vector<int> ret; 
    while (x != 1) 
    { 
        ret.push_back(spf[x]); 
        x = x / spf[x]; 
    } 
    return ret; 
} 

unsigned long long power(unsigned long long x, 
                         int y, int p) 
{ 
    unsigned long long 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; 
} 
  
// Returns n^(-1) mod p 
unsigned long long modInverse(unsigned long long n, int p) 
{ 
    return power(n, p - 2, p); 
} 
  
// Returns nCr % p using Fermat's little 
// theorem. 
unsigned long long nCr(unsigned long long n, 
                                 int r, int p) 
{ 
    // Base case 
    if (r == 0) return 1; 
    return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) % p; 
}

///////////////////////////////////////////////////////////////////////////////////////////////////
 
void solve(int TC) { 
   int n; cin >> n;
   map<int, int> cnt;
   for(int i=0; i<n; i++) {
       int x; cin >> x;
       cnt[x]++;
   }
   vector<int> a;
   for(auto it : cnt) {
       if(it.second >= 2) {
           int times = it.second / 2;
           for(int i=0; i<times; i++) {
               a.push_back(it.first);
           }
       }
   }
   sort(a.rbegin(), a.rend());
   if((int)a.size() < 2) {
       cout << 0; return;
   }
   int ans = a[0]*a[1];
   cout << ans;
}
 
signed main() {
 
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(12);
 
 
    int T = 1;
    //cin >> T;
    for(int i=1; i<=T; i++) {
        solve(i);
    }
    return 0;
 
}

Measured memory_bytes: 9856
tmp = input()
my_str = input()
 
start = 0
end = 1
max_len = 0
 
while (end < len(my_str)):
    if my_str[start:end] in my_str[end:]:
        if end - start > max_len:
            max_len = end - start
        end += 1
    else:
        start += 1
print(max_len)

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

int main(){
    double a,b,deg,theta;
    cin >> a >> b >> deg;
    theta = deg / 180 * acos(-1);
    double S,L,h;
    h = b * sin(theta);
    S = a * h / 2;
    L = a + b + sqrt(pow(a,2)+pow(b,2)-2*a*b*cos(theta));
    printf("%f %f %f",S,L,h);
    return 0;
}



Measured memory_bytes: 3340
///Let us start the game
#pragma GCC optimize ("O3")
#include "bits/stdc++.h"
using namespace std;
#define F first
#define S second
#define pb push_back
using ll = long long;
using ii = pair<int, int>;
using db = long double;
using ull = unsigned long long;
const int N = 2e3 + 5, M = 1e7 + 5, MOD = 1e9+7;
const db EPS = 1e-7;
int ans[100005];
int n;
string s;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);

  cin >> s;
  n = s.size();

  for(int i = 0, j = 0; i < n; i = j){
    for(; j < n && s[i] == s[j]; j++);
    int Ecnt = (j - i + 1) / 2;
    int Ocnt = (j - i) - Ecnt;
    if(s[i] == 'L'){
      ans[i] += Ecnt;
      ans[i-1] += Ocnt;
    } else {
      ans[j] += Ocnt;
      ans[j-1] += Ecnt;
    }
  }

  for(int i = 0; i < n; i++)
    cout << ans[i] << " \n"[i+1==n];

  return 0;
}


Measured memory_bytes: 1104
#include<stdio.h>

int abs(int a){
  if(a<0)a = -a;
  return a;
}

int main(){
  int A[3];

  int max=0, min=101;
  int maxi;

  for(int i=0; i<3; i++){
    scanf("%d", &A[i]);
    if(max<A[i]){
      max = A[i];
      maxi = i;
    }
  }

  int cost = 0;
  int cmin = 1000;
  for(int i=0; i<3; i++){
    for(int j=0; j<3; j++){
      if(j==i)continue;
      for(int k=0; k<3; k++){
	if(k==j || k==i)continue;
	cost = abs(A[j]-A[i]) + abs(A[k]-A[j]);
	if(cmin>cost)cmin = cost;
      }
    }
  }
  
  printf("%d\n", cmin);

  return 0;
}


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

#define MAX_N (100000)
#define MAX_M (100000)

int main(int argc, char *argv[]) {
  // read inputs
  int N, M, xs[MAX_M], ys[MAX_M];
  scanf("%d %d", &N, &M);
  for (int i = 0; i < M; i++) {
    scanf("%d %d", &xs[i], &ys[i]);
    xs[i]--;  // NOTE : modified input
    ys[i]--;  // NOTE : modified input
  }

  // solve
  int flags[MAX_N], cnts[MAX_N], ans = 0;
  for (int i = 0; i < N; i++) {
    flags[i] = 0;
    cnts[i] = 1;
  }
  flags[0] = 1;
  for (int i = 0; i < M; i++) {
    const int x = xs[i], y = ys[i];
    cnts[y]++;
    cnts[x]--;
    if (flags[x]) {
      flags[y] = 1;
      if (cnts[x] == 0) {
        flags[x] = 0;
      }
    }
  }
  for (int i = 0; i < N; i++) {
    if (flags[i]) {
      ans++;
    }
  }
  printf("%d\n", ans);

  return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <cstdio>
using namespace std;
long long n;
void DFS(long long x) {
        if (!x) return;
        x--;
        DFS(x/26);
        cout<<(char)('a'+x%26);
        return;
}
signed main()
{
        scanf("%lld",&n);
        DFS(n);
        return 0;
}


Measured memory_bytes: 3692
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [input() for _ in range(n)]

# N = 200 x 200 x 200 = 8000000でO(N)で計算できることから間に合うはず
import math
ans = 0
K = int(input())
for i in range(1,K+1):
    for j in range(1,K+1):
        tmp = math.gcd(i,j)
        for k in range(1,K+1):
            ans += math.gcd(k,tmp)
print(ans)






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

#define ll long long

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

    ll n,ans=0;
    cin>>n;
    ll m = log2(n);
    for(int i=0;i<=m;i++)
    {
    	ans += pow(2,i);
    }
    cout<<ans;
}

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++)

int main(int argc, char const *argv[]) {
	string s; cin >> s;
	int ans;
	if (s == "SUN") ans = 7;
	if (s == "MON") ans = 6;
	if (s == "TUE") ans = 5;
	if (s == "WED") ans = 4;
	if (s == "THU") ans = 3;
	if (s == "FRI") ans = 2;
	if (s == "SAT") ans = 1;
	cout << ans << endl;
	return 0;
}


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

#define pi 3.14159265358979323846264

#define ll long long
#define fori(n) for(long long i=0;i<n;i++)
#define forj(n) for(long long j=0;j<n;j++)

#define sp(n) setprecision(n)
#define d7 1000000007
#define mkp make_pair
#define mkt make_tuple

using namespace std;

bool isPrime(long long k){
    if(k<=1){return false;}
    if(k==2){return true;}
    if(k%2==0){return false;}
    long long i = 3;
   while (i*i <= k) {if (k % i == 0) {return false;}i += 2;}
return true;
}

ll binomialCoeff(ll n, ll k){
    ll C[n + 1][k + 1];ll i, j;
    for (i = 0; i <= n; i++){
        for (j = 0; j <= min(i, k); j++)
        {if (j == 0 || j == i) C[i][j] = 1;
            else C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]);}}
    return C[n][k];
 }

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

ll srihrg(ll n,ll k,ll m){
    ll ans;
    ans=1;
    fori(k){
        ans=(ans*n)%m;
    }
    return ans;
}

ll kk=1;
void dfsi(vector<bool> &vis, vector<ll> adj1[], ll n, ll start, vector<ll> &pre, vector<ll> &pos){
    vis[start]=true;
    pre[start]=kk;kk++;
    for(ll i: adj1[start]){
        if(!vis[i]){
            vis[i]=true;
            dfsi(vis,adj1,n,i,pre,pos);
        }
    }
    pos[start]=kk;kk++;
}

void bfsi(vector<ll> &dis, vector<ll> adj[], ll s, vector<ll> &parent){
    dis[s]=-1;
    queue<ll> q;
    q.push(s);
    while(!q.empty()){
        ll z=q.front();
        q.pop();
        for(ll v:adj[z]){
            if(dis[v]==0){
            q.push(v);
            dis[v]=-dis[z];
                parent[v]=z;}
        }
    }
}

void make_set(ll v, vector<ll> &parent, vector<ll> &krank) {
    parent[v] = v;
    krank[v] = 0;
}

ll find_set(ll v,vector<ll> &parent, vector<ll> &krank) {
    if (v == parent[v])
        return v;
    return parent[v] = find_set(parent[v], parent, krank);
}

void union_sets(ll a, ll b,vector<ll> &parent, vector<ll> &krank) {
    a = find_set(a,parent,krank);
    b = find_set(b,parent,krank);
    if (a != b) {
        if (krank[a] < krank[b])
            swap(a, b);
        parent[b] = a;
        if (krank[a] == krank[b])
            krank[a]++;
    }
}

void dijkstra(ll s, vector<ll> &dist, vector<ll> &parent, ll n, vector<pair<ll,ll>> adj[]){
    dist[s]=0;
    vector<bool> u(n,false);
    fori(n){
        ll v=-1;
        forj(n){
            if(!u[j] &&(v==-1||(dist[j]<dist[v]))) v=j;
        }
        if(dist[v]==d7) break;
        u[v]=true;
        for(auto j:adj[v]){
            ll a,b;
            a=j.first;
            b=j.second;
            if(dist[v]+b<dist[a]){
                dist[a]=dist[v]+b;
                parent[a]=v;
            }
        }
    }
}


int main(int argc, const char * argv[]) {
// cout<<"Om\n";
 //Praise to Lord
 //make cin/cout faster
 ios_base::sync_with_stdio(false);
 cin.tie(NULL);
// code now
   
    ll n,m;
    cin>>n>>m;
    ll k=0;
    while(n>0){
        n/=m;k++;
    }
    cout<<k;
    
//code ends
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()

C = list2d(10, 10, 0)
for a in range(1, N+1):
    s = int(str(a)[0])
    t = int(str(a)[-1])
    C[s][t] += 1

ans = 0
for i in range(1, 10):
    for j in range(1, 10):
        ans += C[i][j] * C[j][i]
print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    string s,s1;
    cin>>s;
    int q;
    cin>>q;
    int t_counter=0;
    while(q)
    {
        int t;
        cin>>t;
        if(t==1)
        {
            t_counter++;
        }
        else
        {
            int f;
            string c;
            cin>>f>>c;
            if(t_counter%2==0)
            {
                if(f==1)
                {
                    s.insert(0,c);
                }
                else
                {
                    s.insert(s.length(),c);
                }
            }
            else
            {
                if(f==1)
                {
                    s.insert(s.length(),c);
                }
                else
                {
                    s.insert(0,c);
                }
            }
        }
        q--;
    }
    if(t_counter%2!=0)
    {
        reverse(s.begin(),s.end());
    }
    cout<<s;
    return 0;
}







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

using namespace std;

typedef long long ll;

ll a, b;

ll gcd(ll a, ll b)
{
	if(!b)
		return a;
	if(a < b)
		return gcd(b, a);
	if(!(a&1) and !(b&1))
		return gcd(a>>1, b>>1)<<1;
	else if(!(a&1))
		return gcd(a>>1, b);
	else if(!(b&1))
		return gcd(a, b>>1);
	else
		return gcd(b, a-b);
}

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

int main()
{
	//freopen("in.txt", "r", stdin);
	while(true)
	{
		if(scanf("%lld", &a) == EOF || scanf("%lld", &b) == EOF)
			return 0;
		ll g = gcd(a, b);
		printf("%lld %lld\n", g, lcm(g));
	}
}


Measured memory_bytes: 3184
#include <algorithm>
#include <array>
#include <assert.h>
#include <bitset>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstring>
#include <functional>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <istream>

#include <map>
#include <math.h>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include <experimental/optional>

namespace asl
{
    
    template <typename T>
    std::istream &operator>>(std::istream &is, std::vector<T> &vec)
    {
        for (auto &value : vec)
            is >> value;
        return is;
    }

} 

namespace asl
{
    
    const int m1000000007 = 1000000007;
    
    int MOD = m1000000007;

    void set_mod(int mod)
    {
        MOD = mod;
    }

    class Mint
    {
    public:
        int val;

        Mint(long long v = 0)
        {
            if (v >= 0)
            {
                if (v < MOD)
                    val = v;
                else
                    val = v % MOD;
            }
            else
            {
                if (v >= -MOD)
                {
                    val = v + MOD;
                }
                else
                {
                    v %= MOD;
                    if (v < 0)
                        v += MOD;
                    val = v;
                }
            }
        }

        Mint &operator+=(const Mint &other)
        {
            val += other.val;
            if (val >= MOD)
                val -= MOD;
            return *this;
        }

        friend Mint operator+(const Mint &a, const Mint &b) { return Mint(a) += b; }
        
        friend std::ostream &operator<<(std::ostream &stream, const Mint &m)
        {
            return stream << m.val;
        }

    };
} 

#include <random>

#define endl '\n'

using namespace std;
using namespace asl;

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

    set_mod(m1000000007);

    int n;
    cin >> n;
    long long a, b;
    vector<long long> v(n);

    cin >> a >> b >> v;

    if (a >= b)
        swap(a, b);

    vector<Mint> dpA(n), dpB(n);
    dpA[0] = 1, dpB[0] = 1;
    int good_seq = 0;

    for (int i = 1, j = 0; i < n; ++i)
    {
        while (v[i] - v[j] >= b)
            ++j;

        if (good_seq >= i - j - 1)
        {
            dpB[i] += j == 0 ? 1 : dpB[j - 1];
            if (j > 0 && v[j] - v[j - 1] >= a)
                dpB[i] += dpA[j - 1];
        }

        if (v[i] - v[i - 1] >= a)
            good_seq++;
        else
            good_seq = 0;

        if (good_seq)
            dpA[i] += dpA[i - 1];

        if (i < 2 || v[i] - v[i - 2] >= a)
            dpA[i] += dpB[i - 1];
    }

    cout << dpA.back() + dpB.back() << endl;

    return 0;
}




Measured memory_bytes: 4764
use proconio::input;

fn main() {
    input! {
        n: usize,
        d: isize,
        xy: [[isize; 2]; n]
    }
    let d2 = d.pow(2);
    let c = xy
        .iter()
        .filter(|p| p[0].pow(2) + p[1].pow(2) <= d2)
        .count();
    print!("{}", c)
}


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

int main(void) {
  int n; cin >> n;
  int t = n;
  int s = 0;
  while (t != 0) {
    s += t % 10;
    t = t / 10;
  }
  
  if (n % s == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

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

const int maxn = 1e5 + 10;
int a[maxn];

int main() {
	ios::sync_with_stdio(false);
	int n, k;
	cin >> n >> k;
	int _max = 0;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		_max = max(_max, a[i]);
		if (a[i] == k) {
			cout << "POSSIBLE" << endl;
			return 0;
		}
	}
	sort(a + 1, a + n + 1);
	for (int i = 1; i < n; i++) {
		if (!binary_search(a + 1, a + n + 1, k - a[i])) continue;
		int pos = lower_bound(a + 1, a + n + 1, k - a[i]) - a;
		if (a[i] + a[pos] <= _max) {
			cout << "POSSIBLE" << endl;
			return 0;
		}
	}
	cout << "IMPOSSIBLE" << endl;
	return 0;
}

Measured memory_bytes: 640
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int[] p = new int[4];
    for(int i = 0; i < 6; i++){
      p[sc.nextInt()-1]++;
    }
    int c = 0;
    for(int i = 0; i < 4; i++){
      if(p[i] == 1 || p[i] == 2){
        c++;
      }
    }
    System.out.println(c == 4 ? "YES" : "NO");
  }
}

Measured memory_bytes: 23892
#include <bits/stdc++.h>
#define rep(i,n) for (int (i) = 0; (i) < (n); i++)
#define ll long long
using namespace std;
int main() {
  ll N = 0,M = 0,K = 0,ans = 0;
  cin >> N >> M;
  map<ll,ll> mp;
  rep(i,N){
    cin >> K;
    rep(j,K){
      ll a = 0; cin >> a;
      mp[a]++;
    }
  }
  for (auto p : mp){
    if(p.second == N){
      ans++;
    }
  }
  cout << ans;
}

Measured memory_bytes: 3608
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
using lint=long long;
typedef pair<int,int> P;
const int inf=1000000007;
const int MOD=1000000007;
signed main(){
  int n,m;cin>>n>>m;
  vector<int> s(n+1,0);
  vector<int> t(m+1,0);
  vector<vector<lint>> dp(n+1,vector<lint>(m+1,1));
  rep1(i,n)cin>>s[i];
  rep1(i,m)cin>>t[i];
  dp[0][0]=1;
  rep1(i,n){
      rep1(j,m){
          dp[i][j]=dp[i-1][j]+dp[i][j-1]-dp[i-1][j-1]+MOD;
          dp[i][j]%=MOD;
          if(s[i]==t[j]){
              dp[i][j]+=dp[i-1][j-1];
              dp[i][j]%=MOD;
          }
      }
  }
  cout<<dp[n][m]<<"\n";
  //cout<<"debug"<<endl;
  rep1(i,n*0){
      rep1(j,m){
          cout<<dp[i][j]<<" ";
      }
      cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 34580
// inputに入力データ全体が入る
function Main(input) {
  // 1行目がinput[0], 2行目がinput[1], …に入る
  input = input.split("\n");
  tmp0 = input[0].split(" ");
  S = input[0];

  first = Number(S[0] + S[1]);
  second = Number(S[2] + S[3]);
  if (1 <= first && first <= 12 && 1 <= second && second <= 12) {
    console.log("AMBIGUOUS");
  } else if (1 <= first && first <= 12 && (second > 12 || second === 0)) {
    console.log("MMYY");
  } else if ((first > 12 || first === 0) && 1 <= second && second <= 12) {
    console.log("YYMM");
  } else {
    console.log("NA");
  }
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
// Main("0100\n");


Measured memory_bytes: 21064
#include <bits/stdc++.h>
#define long long long
#define up(i,a,b) for (int i=a; i<=b; i++)
#define down(i,a,b) for (int i=a; i>=b; i--)
#define endl '\n'
#define X first
#define Y second
#define II pair<int, int>
#define III pair<int, pair<int, int> >
#define debug(X) cerr<< #X << " = " <<X << endl
#define debug2(X,Y) cerr<< #X << " = " <<X << ","<<#Y<<" = "<<Y<<endl
#define show(X,a,b) {cerr << #X << " = "; up(__,a,b) cerr << X[__] << ' '; cerr << endl;}
#define gc getchar
#define pc putchar
using namespace std;
char a[5];
void input()
{
    up(i,1,4) cin>>a[i];
    int cur= 0;
    char o= '.';
    up(i,1,4)
     if (a[i]== o)
	 {
	 	cur++;
	 	if (cur== 3) { cout<<"Yes"; return;}
	 }
	 else
	 {
	 	cur= 1; o= a[i];
	 };
	 cout<<"No";
}
void solve()
{

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);// don't use when interactive

    #ifdef I_Love_Pork
    #define TASK "tmp"
    freopen(TASK".inp","r",stdin);
    freopen(TASK".out","w",stdout);
	  #endif

    input();
    solve();

    return 0;
}


Measured memory_bytes: 256
import collections
from collections import defaultdict

n = int(input())
l = list(map(int, input().split()))

dict = defaultdict(int)
for i in l:
    dict[i]+=1

ans = 0
for v in dict.values():
    ans += int((v*(v-1)) // 2)

for k in l:
    print(ans - (dict[k] - 1))

Measured memory_bytes: 26780
Acsum=[]
acsum=0
for i in range(5*10**4):
  acsum+=i
  Acsum.append(acsum)
def binarysearch(x):
  ng=-1
  ok=5*10**4
  while abs(ok-ng)>1:
    mid=(ok+ng)//2
    if Acsum[mid]>=x:
      ok=mid
    else:
      ng=mid
  return ok
n=abs(int(input()))
print(binarysearch(n))


Measured memory_bytes: 5144
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
#define mem(a) memset(a,0,sizeof(a))
#define pd(a) printf("%.10f\n",a)
#define pb(a) push_back(a)
#define in(a) insert(a)
#define pi M_PI
#define R cin>>
#define F first
#define S second
#define C class
#define ll long long
#define ln cout<<'\n'
template<C T>void pr(T a){cout<<a;ln;}
template<C T,C T2>void pr(T a,T2 b){cout<<a<<' '<<b;ln;}
template<C T,C T2,C T3>void pr(T a,T2 b,T3 c){cout<<a<<' '<<b<<' '<<c;ln;}
template<C T>void PR(T a,int n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
bool check(int n,int m,int x,int y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<60,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  ll n,x;
  cin >> n >> x;
  x=min(x,n-x);
  ll c=__gcd(n,x);
  pr((n-c)*3);
}

int main() {
  ios::sync_with_stdio(0);cin.tie(0);
  Main();return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int i,j=0,k;
  cin>>i;
  k=i/100;
  j=j+k;
  i=i-k*100;
  k=i/10;
  j=j+k;
  i=i-k*10;
  j=j+i;
  cout<<j<<endl;
}
  

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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


Measured memory_bytes: 3192
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <queue>
#include <cstdlib>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
//#define ARRAY(type,n) (type *)malloc(sizeof(type)*n)
template<typename T>
T* ARRAY(int n){
	(T*)malloc(sizeof(T)*n);
}
template<typename T>
T** ARRAY2(int m,int n){
	T** type = (T**)malloc(sizeof(T*)*m);
	for(int i=0;i<m;i++){
		type[i]=(T*)malloc(sizeof(T)*n);
	}
	return type;
}
class llm{
public:
llm(ll value){this->value = (ll)value;}
ll value;
llm operator + (llm obj){return llm((this->value + (ll)(obj.value))%MOD);}
llm operator + (ll obj){return llm((this->value + obj)%MOD);}
llm operator - (llm obj){return llm(((this->value + MOD - (ll)(obj.value)))%MOD);}
llm operator - (ll obj){return llm(((this->value + MOD - obj))%MOD);}
llm operator * (llm obj){return llm((this->value * (ll)(obj.value))%MOD);}
llm operator * (ll obj){return llm((this->value * obj)%MOD);}
llm operator / (llm obj){return llm(this->value / (ll)(obj.value));}
llm operator / (ll obj){return llm(this->value / obj);}
llm operator % (llm obj){return llm(this->value % (ll)(obj.value));}
llm operator % (ll obj){return llm(this->value % obj);}};
ostream& operator<<(ostream& os, llm l){os << l.value;return os;} 
llm operator+(ll a,llm l){return llm((a + l.value)%MOD);} 
llm operator*(ll a,llm l){return llm((a * l.value)%MOD);}

ll c[53][53];

ll C(int n,int k){
	if(c[n][k]!=-1){
		return c[n][k];
	}else if(n==k){
		c[n][k] = 1;
		return 1;
	}
	
	c[n][k] = C(n-1,k)*n/(n-k);
	//cout<<n<<" "<<k<<" "<<c[n][k]<<endl;
	return c[n][k];
}



int main(void){
	rep(i,53){
		rep(j,53){
			c[i][j]=-1;
		}
	}
	int n,a,b;
	cin>>n>>a>>b;
	ll v[n];
	rep(i,n){
		cin>>v[i];
	}

	sort(v,v+n);
	reverse(v,v+n);

	ll memo=v[a-1];
	int count = 0;
	ll ans2 = 0;
	rep(i,a){
		if(memo==v[i]){
			count++;
		}
		ans2+=v[i];
	}

	int count2 = 0;
	
	rep(i,n){
		if(memo==v[i]){
			count2++;
		}

	}

	
	ll ans = 0;
	if(count == a){
		for(int i=a;i<=min(b,count2);i++){
			ans += C(count2,i);
		}
	}else{
		ans += C(count2,count);
	}




	cout<<fixed;
	cout<<(double)ans2/a<<endl;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 508
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <math.h>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <set>
#include <queue>
#include <sstream>
#include <stack>
#include <deque>
#include <memory.h>
#include <cassert>
#include <ctime>
#include <climits>
#include <list>
#include <time.h>
#include <unordered_map>
#include <bitset>
#include <exception>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned long long ull;
#define pb push_back
#define mp make_pair
#define FILE "file"
#define lc v << 1
#define rc (v << 1) + 1
#define inf 1e+9
#define linf ll(1e+18)
#define dinf 1e+14

typedef long long ll;
#define pb push_back
#define mp make_pair


vector<pair<ll, ll>> v;
bool cmp(pair<ll, ll> a, pair<ll, ll> b)
{
    return a.first < b.first;
}

void solve()
{
    int n, m;
    cin >> n >> m;
    
    v.resize(n);
    for(int i = 0; i < n; i++)
    {
        cin >> v[i].first >> v[i].second;
    }
    
    sort(begin(v), end(v), cmp);
    
    ll ans = 0;
    
    ll cnt = 0;
    int i = 0;
    while(cnt < m)
    {
        ll temp = min(m - cnt, v[i].second);
        cnt += temp;
        ans += temp * v[i].first;
        i++;
    }
    cout << ans;
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    //freopen("/Users/bekhzodsoliev/Desktop/C++/cp/cp/file.in", "r", stdin);freopen("/Users/bekhzodsoliev/Desktop/C++/cp/cp/file.out", "w", stdout);
    
    int t = 1;
    //cin >> t;
    
    while(t--)
    {
        solve();
    }
    
    return 0;
}


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

int main() {
    long long N, A, B, C, D, E;
    vector <long long> deliver(5);
    long long min_num = pow(10, 15);
    cin >> N;
    for(int i = 0; i < 5; i++)
    {
        cin >> deliver[i];
        min_num = min(min_num, deliver[i]);
    }
    long long time = 4;
    double a = (double)N / min_num;
    time += (long long) a;
    if(a - (long long) a != 0) time++;
    cout << time<< endl;

    return 0;  

}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if (b % a == 0) {
            System.out.println(a + b);
            return;
        }
        System.out.println(b - a);
    }

}


Measured memory_bytes: 21716