akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
    int h,w,k;
    cin>>h>>w>>k;
    vector<string>s(h);
    rep(i,h)cin>>s[i];
    int ans=1e9;
    rep(bit,1<<(h-1)){
        int g=0;
        vector<int>id(h);
        rep(i,h){
            id[i]=g;
            if(bit>>i&1)g++;
        }
        g++;
        int cnt=g-1;
        vector<vector<int>>x(g,vector<int>(w));
        rep(i,h)rep(j,w){
            x[id[i]][j]+=s[i][j]-'0';
        }
        vector<int>now(g);

        auto add=[&](int j){
            rep(i,g)now[i]+=x[i][j];
            rep(i,g)if(now[i]>k)return false;
            return true;
        };

        rep(j,w){
            if(!add(j)){
                cnt++;
                now=vector<int>(g);
                if(!add(j)){
                    cnt=1e9;
                    break;
                }
            }
        }
        ans=min(ans,cnt);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3664
import java.util.*;
public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int m = sc.nextInt();
      char[][] grid = new char[n][n];
      for(int i = 0; i < n; i++)
        grid[i] = sc.next().toCharArray();

      char[][] template = new char[m][m];
      for(int i = 0; i < m; i++)
        template[i] = sc.next().toCharArray();

      for(int i = 0; i < n - m + 1; i++) {
        loop:
        for(int j = 0; j < n - m + 1; j++) {
          for(int ti = 0; ti < m; ti++) {
            for(int tj = 0; tj < m; tj++) {
              if(template[ti][tj] != grid[i + ti][j + tj])
                continue loop;
            }
          }
          System.out.println("Yes");
          return;
        }
      } 
      System.out.println("No");
  }
}

Measured memory_bytes: 21972
#include<iostream>
#include<stdio.h>
using namespace std;

int main(){

	int n,q;

	int left,right,point;
	int count=0;
	cin>>n;
	int s[n];
	for(int i=0;i<n;i++){
		cin>>s[i];
	}
	cin>>q;
	int t[q];
	for(int i=0;i<q;i++){
		cin>>t[i];
	}

	for(int i=0;i<q;i++){
		left=0;
		right=n-1;
		point=(left+right)/2;
		while(1){
			if(right-left==1){
				if(s[right]==t[i]||s[left]==t[i]){
					count++;
					break;
				}else{
					break;
				}
			}

			if(s[point]==t[i]){
				count++;
				break;
			}else if(s[point]<t[i]){
				left=point;
				point=(left+right)/2;
			}else if(s[point]>t[i]){
				right=point;
				point=(left+right)/2;
			}
		}
	}
	cout<<count<<endl;
}


Measured memory_bytes: 3600
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<map>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define rep2(i,a,b)for(int i=a;i<b;i++)
#define mp make_pair
#define pb push_back
#define P pair<int,int>
#define ll __int64
//#define ll long long

const int N=30000;
int n;
int t[50000];
bool u[50000];
int pos;

vector<int>p;
int main(){
	cin>>n;

	
	if(n==3){
		cout<<"2 5 63"<<endl;
		return 0;
	}

	
	t[0]=2;t[1]=4;t[2]=3;t[3]=9;
	u[2]=u[4]=u[3]=u[9]=1;
	pos=4;
	if(n%2){t[4]=6;u[6]=1;pos++;}

	for(int i=1;i<=30000;i++){
		if(pos>=n)break;
		if(!u[i]&&i%2==0&&i%6!=0){
			u[i]=1;
			t[pos++]=i;
		}
		if(pos>=n)break;
	}

	for(int i=1;i<=30000;i++){
		if(pos>=n)break;
		if(!u[i]&&i%3==0&&i%6!=0){
			u[i]=1;
			t[pos++]=i;
		}
		if(pos>=n)break;
	}

	for(int i=1;i<=30000;i++){
		if(pos>=n)break;
		if(!u[i]&&i%6==0){
			u[i]=1;
			t[pos++]=i;
		}
		if(pos>=n)break;
	}	



	rep(i,n){
		cout<<t[i];
		if(i==n-1)cout<<endl;
		else cout<<" ";
	}

	//cout<<pos<<endl;
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long   signed int LL;
typedef long long unsigned int LU;
#define incID(i, l, r) for(LL i = (l)    ; i <  (r); ++i)
#define incII(i, l, r) for(LL i = (l)    ; i <= (r); ++i)
#define decID(i, l, r) for(LL i = (r) - 1; i >= (l); --i)
#define decII(i, l, r) for(LL i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
template<typename T> bool setmin  (T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmax  (T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
LL mo(LL a, LL b) { assert(b > 0); a %= b; if(a < 0) { a += b; } return a; }
LL fl(LL a, LL b) { assert(b > 0); return (a > 0 ? a / b : (a - b + 1) / b); }
LL ce(LL a, LL b) { assert(b > 0); return (a < 0 ? a / b : (a + b - 1) / b); }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
#define bit(b, i) (((b) >> (i)) & 1)
#define BC __builtin_popcountll
#define SC static_cast
#define SI(v) SC<int>(v.size())
#define SL(v) SC<LL >(v.size())
#define RF(e, v) for(auto & e: v)
#define ef else if
#define UR assert(false)

// ---- ----

int main() {
	LL n, k;
	cin >> n >> k;
	vector<LL> a(n), s(n + 1);
	inc(i, n) { cin >> a[i]; a[i]--; }
	inc(i, n) { s[i + 1] = (s[i] + a[i]) % k; }
	
	LL ans = 0;
	map<LL, LL> mp;
	inc(i, n + 1) {
		LL j = i - k;
		if(j >= 0) { mp[s[j]]--; }
		ans += mp[s[i]];
		mp[s[i]]++;
	}
	
	cout << ans << endl;
	
	return 0;
}


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

int main() {
    long long x, y, ans = 0;

    cin >> x >> y;

    if ( x == 1 && y == 1) {
        ans = 1;
    } else if( x != 1 && y == 1) {
        ans = x - 2;
    } else if (x == 1 && y != 1) {
        ans = y - 2;
    } else {
        ans = (x - 2) * (y - 2);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
 
const int mx=200010;
const ll mod=1e9+7;

vector<vector<vector<ld>>> dp(330, vector<vector<ld>>(330, vector<ld>(330,0)));
int n;

ld rec(int x, int y, int z){
  if(dp[x][y][z]!=0){ return dp[x][y][z]; }
  if(!x && !y && !z){ return 0; }
  ld ret=0;
  if(x){ ret += rec(x-1,y+1,z)*(ld)x/n; }
  if(y){ ret += rec(x,y-1,z+1)*(ld)y/n; }
  if(z){ ret += rec(x,y,z-1)*(ld)z/n; }
  ret += 1.0;											//????
  return dp[x][y][z] = ret*n/(x+y+z);
}

int main(){  
  cin >> n;
  int x=0,y=0,z=0;
  rep(i,n){
    int a; cin >> a;
    if(a==3){ x++; }
    if(a==2){ y++; }
    if(a==1){ z++; }
  }

  ld ans=rec(x,y,z);
  cout << fixed << setprecision(12) << ans << endl;
  return 0;
}

Measured memory_bytes: 567808
def judge(loads,truck,truck_weight):#loadsは荷物のリスト.truckは使えるトラックの台数
    truck_num=1
    weight_sum=0
    for load in loads:
        if(weight_sum + load >truck_weight):
            truck_num+=1
            if(truck < truck_num):
                return 0
            weight_sum=load
        else:
            weight_sum+=load
    return 1

#与えられた条件で荷物の積み込みが可能なら１、不可能なら０を返す


def binal_search(loads,truck,min,max):#minからmaxの範囲で最小トラック積載量を求める
    if(max ==min):
        return  min
    mid=(min+max)//2
    if(judge(loads,truck,mid)):
        return binal_search(loads,truck,min,mid)
    else:
        return binal_search(loads,truck,mid+1,max)


        


n,truck=map(int,input().split())
loads=[]
for loop in range(n):
    loads.append(int(input()))
loads_max=sum(loads)
loads_min=max(loads)
print(binal_search(loads,truck,loads_min,loads_max))


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

using ll = long long;

const int S = 1 << 17;
// first is constant term
pair<ll, ll> seg[2 * S];
//inclusive
void incr(int l, int r, int v1, int v2) {
	for (int a=S+l, b = S+r+1; a < b; a /= 2, b /= 2) {
		if (a & 1) {
			seg[a].first += v1;
			seg[a].second += v2;
			++a;
		}
		if (b & 1) {
			--b;
			seg[b].first += v1;
			seg[b].second += v2;
		}
	}
}

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int N, M;
	cin >> N >> M;
	vector<int> A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i]; A[i] --;
	}
	for (int i = 1; i < N; i++) {
		int prv = A[i-1], nxt = A[i];
		assert(prv != nxt);
		seg[1].first += (nxt + M - prv) % M;
		// ans -= a - (prv+1) from prv+1 to nxt
		if (prv < nxt) {
			incr(prv+1, nxt, prv+1, -1);
		} else {
			incr(prv+1, M-1, prv+1, -1);
			// ans -= (a+M) - (prv+1)
			incr(0, nxt, prv+1 - M, -1);
		}
	}

	for (int i = 1; i < S; i++) {
		seg[2*i].first += seg[i].first;
		seg[2*i].second += seg[i].second;
		seg[2*i+1].first += seg[i].first;
		seg[2*i+1].second += seg[i].second;
	}
	
	ll ans = 1e18;
	for (int i = 0; i < M; i++) {
		ans = min(ans, seg[S+i].first + seg[S+i].second * i);
	}
	cout << ans << '\n';

	return 0;
}


Measured memory_bytes: 4736
#include<iostream>
using namespace std;
int main(){
    int N;
    cin >> N;
    int A[N];
    
    for(int i=0; i<N; i++){
        cin >> A[i];
    }
    
    for(int i=0; i<N; i++){
        int v=A[i];
        int j = i - 1;
        
        while(j>=0 && A[j] > v){
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;
        
        for(int k=0; k<N; k++){
            cout << A[k];
            if(k==N-1){
                cout <<endl;
            }else{
                cout << " ";
            }
        }
    }
    
    return 0;
}


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

int main(){
	int k,s,cnt=0;
	cin>>k>>s;
	for(int i=0;i<=k;i++){
		for(int j=0;j<=k;j++){
			int z=s-i-j;
			if(z<=k&&0<=z)cnt++;
		}
	}		
	cout<<cnt<<endl;
	return 0;
}		

Measured memory_bytes: 256
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include<bits/stdc++.h>
using namespace std;
#define rint register int
#define rep(i,l,r) for(rint i=l;i<=r;i++)
#define per(i,l,r) for(rint i=l;i>=r;i--)
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back 
#define fir first
#define sec second
template<typename T1,typename T2>void ckmin(T1 &a,T2 b){if(a>b)a=b;}
template<typename T1,typename T2>void ckmax(T1 &a,T2 b){if(a<b)a=b;}
template<typename T>T gcd(T a,T b){return b?gcd(b,a%b):a;}
int read(){
  int x=0,f=0;
  char ch=getchar();
  while(!isdigit(ch))f|=ch=='-',ch=getchar();
  while(isdigit(ch))x=10*x+ch-'0',ch=getchar();
  return f?-x:x;
}
const int N=200005;
int pre[N][2],suf[N][2];
char s[N];
int n;
int main(){
  scanf("%d%s",&n,s+1);
  for(int i=1;i<=n;i++){
    pre[i][0]=pre[i-1][0];
    pre[i][1]=pre[i-1][1];
    int typ=s[i]=='R';
    pre[i][typ]++;
  }
  for(int i=n;i>=1;i--){
    suf[i][0]=suf[i+1][0];
    suf[i][1]=suf[i+1][1];
    int typ=s[i]=='R';
    suf[i][typ]++;
  }
  int ans=1e9;
  for(int i=0;i<=n;i++){
    int x=pre[i][0];
    int y=suf[i+1][1];
    ans=min(ans,x+y-min(x,y));
  }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 7052
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public void main(Scanner sc) {
        String march[] = "MARCH".split("");
        long cnt[] = new long[5];
        Arrays.fill(cnt, 0);

        int n = sc.nextInt();
        for (int i = 0; i < n; i++) {
            String str = sc.next();
            for (int j = 0; j < 5; j++) {
                if (str.startsWith(march[j])) {
                    cnt[j]++;
                }
            }
        }

        long ans = 0L;
        ans += cnt[0] * cnt[1] * cnt[2];
        ans += cnt[0] * cnt[1] * cnt[3];
        ans += cnt[0] * cnt[1] * cnt[4];
        ans += cnt[0] * cnt[2] * cnt[3];
        ans += cnt[0] * cnt[2] * cnt[4];
        ans += cnt[0] * cnt[3] * cnt[4];
        ans += cnt[1] * cnt[2] * cnt[3];
        ans += cnt[1] * cnt[2] * cnt[4];
        ans += cnt[1] * cnt[3] * cnt[4];
        ans += cnt[2] * cnt[3] * cnt[4];

        System.out.println(ans);
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        new Main().main(sc);
        sc.close();
    }
}


Measured memory_bytes: 46536
#include "bits/stdc++.h"
using namespace std;

#define int long long
#define PB push_back
#define PPB pop_back
#define ALL(X) (X).begin(),(X).end()
typedef pair<int, int> pii;

static const int INF = 1LL << 61;
//static const int MAX_N = 100005;

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

    int n;
    cin >> n;
    cout << n * (n + 1) / 2 << endl;
}

Measured memory_bytes: 256
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

signed main() {
	int k;
	std::cin >> k;
	int count = k/2*(k-k/2);
	print(count);
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.math.BigDecimal;

public class Main {
  public static void main(String[] args) {
    B(args);
  }
  public static void A(String[] args) {
    Scanner scanner = new Scanner(System.in);
    String line = scanner.nextLine().trim();
    String[] fields = line.split("/");
    if (10000 * Integer.parseInt(fields[0]) + 100 * Integer.parseInt(fields[1]) + Integer.parseInt(fields[2]) <= 20190430) {
      System.out.println("Heisei");
    } else {
      System.out.println("TBD");
    }
  }
  public static void B(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int n = Integer.parseInt(scanner.nextLine().trim());
    BigDecimal res = new BigDecimal(0);
    for (int i = 0; i < n; i++) {
      String[] line = scanner.nextLine().trim().split(" ");
      res = res.add(new BigDecimal(line[0]).multiply(line[1].equals("JPY") ? new BigDecimal(1) : new BigDecimal(380000.0)));
    }
    System.out.println(res.toString());
  }
}


Measured memory_bytes: 22868
n, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
f = [int(i) for i in input().split()]
a.sort()
f.sort(reverse=True)

mi = 0
ma = max([i * j for i, j in zip(a, f)])

while mi != ma:
    b = (mi + ma) // 2
    cost = 0
    for i, j in zip(a, f):
        cost += max(0, i - b // j)
    if cost <= k:
        ma = b
    else:
        mi = b + 1
print(mi)


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

using lli = long long;
using pii = pair<int, int>;
using pll = pair<lli, lli>;
using Double = long double;
template<typename T>
using Vector = vector<vector<T>>;
template<typename T>
using Prior = priority_queue<T>;
template<typename T>
using prior = priority_queue<T, vector<T>, greater<T>>;

#define IOS() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define X first
#define Y second
#define Push push_back
#define ALL(x) x.begin(), x.end()
#define RALL(x) x.rbegin(), x.rend()

void solve() {
	string s;
	cin >> s;
	int sz = s.size();

	int L = -1, R = -1;
	for (int i = 1; i < sz; ++i) {
		if (s[i] == s[i - 1]) {
			L = i, R = i + 1;
			break;
		}
	}

	for (int i = 2; i < sz; ++i) {
		if (s[i] == s[i - 2]) {
			L = i - 1, R = i + 1;
			break;
		}
	}

	cout << L << " " << R << "\n";
}

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


Measured memory_bytes: 512
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();
		//int c = sc.nextInt();
		// 文字列の入力
		//String s = sc.next();
		//1文字ずつ
		//s.atChar(i);
		// 出力
		//System.out.println("");
		
		int A=sc.nextInt();
		int B=sc.nextInt();
		//int K=sc.nextInt();
		int height=0;
		int Height=0;
		int difA=0;
		int difB=0;
		boolean x=true;
		//System.out.println("A:"+A+"B:"+B);
XX:		for(int i=1;x && i<1000;i++){
			height=Height;
			Height+=i;
			//System.out.println("he:"+height);
			for(int k=1;k<height;k++){
				difA=height-A;
				difB=Height-B;
				//if(i<10)System.out.println("difA:"+difA+",difB:"+difB);
				if(difA==difB){
					System.out.println(height-A);
					x=false;
					break XX;
				}
			}
			
		}
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <cstdio>

using namespace std;

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

    int mi, ma;
    ma= min(a, b);
    if (a+b < n) {
        mi = 0;
    } else {
        mi = a+b-n;
    }

    printf("%d %d\n", ma, mi);

    return 0;
}


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

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

/* Macros reg. ends here */

const ll INF = 1LL << 50;

struct V {
  double x, y;
  V(double x = 0, double y = 0) : x(x), y(y) {}
  V& operator+=(const V& v) {
    x += v.x;
    y += v.y;
    return *this;
  }
  V operator+(const V& v) const { return V(*this) += v; }
  V& operator-=(const V& v) {
    x -= v.x;
    y -= v.y;
    return *this;
  }
  V operator-(const V& v) const { return V(*this) -= v; }
  V& operator*=(double s) {
    x *= s;
    y *= s;
    return *this;
  }
  V operator*(double s) const { return V(*this) *= s; }
  V& operator/=(double s) {
    x /= s;
    y /= s;
    return *this;
  }
  V operator/(double s) const { return V(*this) /= s; }
  double dot(const V& v) const { return x * v.x + y * v.y; }
  double cross(const V& v) const { return x * v.y - v.x * y; }
  double norm2() const { return x * x + y * y; }
  double norm() const { return sqrt(norm2()); }

  int ort() const {  // orthant
    if (y > 0)
      return x > 0 ? 1 : 2;
    else
      return x > 0 ? 4 : 3;
  }
  bool operator<(const V& v) const {
    int o = ort(), vo = v.ort();
    if (o != vo) return o < vo;
    return cross(v) > 0;
  }
};
istream& operator>>(istream& is, V& v) {
  is >> v.x >> v.y;
  return is;
}
ostream& operator<<(ostream& os, const V& v) {
  os << "(" << v.x << "," << v.y << ")";
  return os;
}

int main() {
  // ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll n;
  cin >> n;

  vector<V> vs(n);
  rep(i, n) cin >> vs[i];

  Sort(vs);

  vector<V> arr(2 * n);
  rep(i, n) arr[i] = arr[i + n] = vs[i];

  double ans = 0.0;
  rep(i, n) {
    repLRE(j, 1, n){
      V u;
      rep(k, j) u += arr[i + k];
      chmax(ans, u.norm());
    }
  }

  cout << ans << endl;  

  return 0;
}


Measured memory_bytes: 3852
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int maxn = 3000 + 5;
pii dish[maxn];
int dp[maxn][2 * maxn + 5], t;
bool cmp(const pii &p1, const pii &p2) {
    return p1.first < p2.first;
}
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n >> t;
    for (int i = 1; i <= n; ++i)
        cin >> dish[i].first >> dish[i].second;
    sort(dish + 1, dish + 1 + n, cmp);
    for (int i = 1; i <= n; ++i)
        for (int j = 0; j <= 2 * maxn; ++j)
            if (j < dish[i].first || j - dish[i].first >= t)
                dp[i][j] = dp[i - 1][j];
            else
                dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - dish[i].first] + dish[i].second);
    cout << *max_element(dp[n], dp[n] + 2 * maxn + 3) << '\n';
    return 0;
}

Measured memory_bytes: 70784
#include <iostream>
#include <string>
#include <stdlib.h>
#include <math.h>

int main(int argc, char const* argv[]){
    using namespace std;
    string a, b;
    cin >> a >> b;
    long c=atol((a+b).c_str());
    /*
    cout << a << endl;
    cout << b << endl;
    cout << c << endl;
    */
    long d = round(sqrt(c));
    if(d*d==c){
        cout << "Yes";
    }else{
        cout << "No";
    }
    return 0;
}


Measured memory_bytes: 256
import sys
from collections import deque
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, M = map(int, readline().split())
graph = [[] for _ in range(N)]
for i in range(M):
    A, B = map(int1, readline().split())
    graph[A].append(B)
    graph[B].append(A)
ans = [None] * (N)

visited = [False] * N
visited[0] = True

que = deque([0])

while len(que) > 0:
    acc = que.popleft()
    for connected in graph[acc]:
        if visited[connected]:
            continue

        ans[connected] = acc + 1
        visited[connected] = True
        que.append(connected)

if sum(visited) == len(visited):
    print("Yes")
    for sign in ans[1:]:
        print(sign)
else:
    print("No")

Measured memory_bytes: 38664
N,K,*xy = map(int, open(0).read().split())
_x_ = sorted(xy[::2])
ans = 4 * 10 ** 18
for _x in _x_:
  for x_ in _x_[1:]:
    w = x_ - _x
    c = 0
    _h_ = []
    for x, y in zip(xy[::2], xy[1::2]):
      if _x <= x <= x_:
        c += 1
        _h_.append(y)
      if c >= K:
        _h_.sort()
        h = min(_h_[i + K - 1] - _h_[i] for i in range(c - K + 1))
        ans = min(ans, h * w)

print(ans)

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

int main() {
	int n;
	while (scanf("%d", &n), n) {
		int cnt = 0;
		string back;
		rep(i, n) {
			string s; cin >> s;
			if (s == "lu"&&back == "ru")cnt++;
			if (s == "ru"&&back == "lu")cnt++;
			if (s == "ld"&&back == "rd")cnt++;
			if (s == "rd"&&back == "ld")cnt++;
			back = s;
		}
		printf("%d\n", cnt);
	}
}

Measured memory_bytes: 3276
#include <bits/stdc++.h>
#include <vector> 
# include <cstdint>
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define RFOR(i,l,r) for(int i=(l);i>=(int)(r);i--)
#define rep(i,n)  FOR(i,0,n)
#define rrep(i,n)  RFOR(i,n-1,0)

#define int long long
using namespace std;
const int MX = 1e6;
const int inf = 1e13;
const int mod = 1e9+7;
#define ll long long

signed main() {
    int n, m, k;
    cin >> n >> m >> k;
    rep(i,n+1) {
        rep(j,m+1) {
            if(i*(m-j)+(n-i)*j==k){
                cout << "Yes" << endl;
                return 0;
            }
        }
    } 
    cout << "No" << endl;
    return 0;
}



Measured memory_bytes: 3608
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<queue>
#include<algorithm>
using namespace std;
int n,m,v,p;
int a[100005],ans,nums=0;
long long sum[100005];
int main()
{
	scanf("%d%d%d%d",&n,&m,&v,&p);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	sort(a+1,a+n+1);reverse(a+1,a+n+1);
	for(int i=1;i<=n;i++)
	{
		sum[i]=sum[i-1]+a[i];
		if(a[i]==a[i-1]) nums++;
		else nums=1;
		if(i-nums+1<=p)
		{
			ans++;
			continue;
		}
		if(a[i]+m<a[p]) break;
		int num=p-1+(n-i)+nums-1;
		if(num>=v-1) ans++;
		else
		{
			int l=p,r=i-nums;
			if(l>r) break;
			else
			{
				while(l<r)
				{
					int mid=(l+r)>>1;
					if(a[i]+m>=a[mid]) r=mid;
					else l=mid+1;
				}
				if(1ll*(a[i]+m)*(i-nums-l+1)-(sum[i-nums]-sum[l-1])>=1ll*(v-num-1)*m) ans++;
				else break;
			}
		}
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 4980
// AOJ DPL_5_K Balls and Boxes 11
// n 個の区別できないボールを k 個の区別できない箱に入れる
// とき、可能な入れ方の総数を求めてください。
// ただし、
//    どのボールも、必ずいずれかの箱に入れる。
//    各箱に入れることのできるボールの数は高々1つまで。
// 2019.3.11 bal4u

#include <stdio.h>
#include <stdlib.h>

int main()
{
	int n, k;

	scanf("%d%d", &n, &k);
	puts(n <= k ? "1" : "0");
	return 0;
}


Measured memory_bytes: 2112
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 1000000000;
const long long int llINF = 1000000000000000000;

using namespace std;
using ll = long long int;
using vv = vector<vector<ll>>;
using edge = struct {
  int to;
  int cost;
};
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end());
#define MIN(vec) *std::min_element(vec.begin(), vec.end());
#define BIT(n, num) std::bitset<(n)>((num)).to_string()
#define REV(T) greater<T>()

typedef pair<ll, ll> Pair;
bool pairCompare(const Pair &firstElof, const Pair &secondElof) {
  return firstElof.second > secondElof.second;
}

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n)
        ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

map<ll, int> prime_factor(ll n) {
  map<ll, int> ret;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1)
    ret[n] = 1;
  return ret;
}

ll factorial(int n) {
  ll ans = 1;
  for (int i = 2; i <= n; i++) {
    ans *= i;
    ans %= MOD;
  }
  return ans;
}
ll P(int n, int m) {
  ll ans = 1;
  for (int i = m + 1; i <= n; i++) {
    ans *= i;
    ans %= MOD;
  }
  return ans;
}
ll power(int n, int m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = power(n, m / 2);
    return (tmp * tmp) % MOD;
  } else {
    return (n * power(n, m - 1)) % MOD;
  }
}
ll C(int n, int m) {
  return (P(n, n - m) * power(factorial(m), MOD - 2)) % MOD;
}

ll gcd(ll a, ll b) {
  if (b == 0)
    return a;
  return gcd(b, a % b);
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main() {
  ll N;
  ll b = 0;
  cin >> N;
  cin >> b;
  REP(i, N - 1) {
    ll a;
    cin >> a;
    b = gcd(a, b);
  }
  cout << b << endl;
  return 0;
}


Measured memory_bytes: 256
s = input()
count =0
for i in range(len(s)):
	if (i+1) % 2 == 0 : 
		if s[i] =='L' or s[i] =='U' or s[i] =='D':
			count += 1
	else:
		if s[i] =='R' or s[i] =='U' or s[i] =='D':
			count += 1


if count == len(s):
	print('Yes')
else:
	print('No')


Measured memory_bytes: 2940
def summation(n):
    ans = 0
    for i in range(n+1):
        ans += i
        
    return ans


def main():
    a,b = map(int, input().split())
    
    n_plus1 = b-a
    
    ans = summation(n_plus1) - b
    
    print(ans)
    
    return 0

    
if __name__ == "__main__":
    main()

Measured memory_bytes: 2940
import numpy as np
N, M, C = (int(i) for i in input().split())
B = [list(map(int, input().split()))]
AB = np.array([list(map(int, input().split())) for _ in range(N)])
aa = np.sum((B* AB), axis=1)
print(np.sum((aa+C) >= 1))

Measured memory_bytes: 13144
N, M = map(int, input().split())

p2 = 2 ** N
table = [10 ** 9] * p2
table[0] = 0
for m in range(M):
    a, _ = map(int, input().split())
    c = sum(2 ** (i - 1) for i in map(int, input().split()))
    for x in range(p2):
        an = x | c
        table[an] = min(table[an], table[x] + a)
ans = table[p2 - 1]
 
print(ans if ans != 10 ** 9 else -1)

Measured memory_bytes: 3188
//Author: Fuadul Hasan(fuadul202@gmail.com)
//BSMRSTU,Gopalganj
#include<bits/stdc++.h>
using namespace std;int tc = 1;
#define happy ios::sync_with_stdio(false);
#define coding  cin.tie(0);
#define mp make_pair
#define ll long long
#define Pi atan(1)*4
#define pb  push_back
#define vpr vector<pr> 
#define pr pair<int, int> 
#define vi std::vector<int>
#define vll std::vector<ll>
#define YES printf("YES\n");
#define NO printf("NO\n");
#define Yes printf("Yes\n");
#define No printf("No\n");
#define all(n) n.begin(),n.end()
#define point(x) setprecision(x)
#define Test printf("Case %d: ",tc++);
#define Unique(c) (c).resize(unique(all(c))-(c).begin())

const int M = 1e9 + 7;
const ll  Inf = (ll)2e18 + 5;
const int N   = 2e5 + 5;

int solve() 
{
	//happy coding

	int a[3];
	for(int i=0;i<3;i++){
		cin>>a[i];
	}

	sort(a,a+3);

	if(a[0]==5&&a[1]==5&&a[2]==7){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}
	
	return 0;
}
int main(){
	int test = 1;
	//scanf("%d", &test);
	while (test--)solve();return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

const int N=505;

int n,k,a[N][N];

int main() {
	scanf("%d",&k);n=(k>>1)+(k&1);n+=n&1;n=min(n,k);
	fo(i,0,n-1) fo(j,0,n-1) a[j][(i+j)%n]=i;
	fo(i,n,k-1) 
		fo(j,0,n-1) if (j&1) a[j][(i+j)%n]=i;
	printf("%d\n",n);
	fo(i,0,n-1) {
		fo(j,0,n-1) printf("%d ",a[i][j]+1);
		puts("");
	}
	return 0;
}

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

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int N, K;
    cin >> N >> K;
    bool D[10] = {false};
    int X;
    for (int i = 0; i < K; i++) {
	cin >> X;
	D[X] = true;
    }
    while(true){
	X = N;
	bool ok = true;
	while(X){
	    if(D[X % 10]){ ok = false; break; }
	    X /= 10;
	}
	if(ok == true) break;
	N++;
    }
    cout << N;
    return 0;
}

Measured memory_bytes: 256
num = gets

  threeLines = Array.new

  num.to_i.times do
    threeLines.push(gets)
  end

  num.to_i.times do |cnt|
    lineArray = threeLines[cnt].split(" ")
    lineArray.map!(&:to_i)

    lineArray.sort!
    lineArray.reverse!

    if(lineArray[0].to_i**2 == lineArray[1].to_i**2 + lineArray[2].to_i**2)
      puts "YES"
    else
      puts "NO"
    end
  end

Measured memory_bytes: 6108
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main(){
	int n;
	cin >> n;
	int a[n];
	REP(i,n) cin >> a[i];
	int ans = 0,cnt = 1;
	for(int i = 1; i < n; i++){
		if(a[i] == a[i - 1]) cnt++;
		else{
			ans += cnt / 2;
			cnt = 1;
		}
	}
	ans += cnt / 2;
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <locale>
#include <string>
#include <map>
#include <algorithm>

using namespace std;

int main() {
	string text;
	string pattern;
	
	cin >> text;
	cin >> pattern;
	
	text = text + text;
	int pos = text.find(pattern);
	pos >= 0 ? (cout << "Yes" << endl) : (cout << "No" << endl);
	return 0;
}


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

int main()
{
    int a, b;
    scanf("%d %d", &a, &b);
    
    if(a==1)
    {
        a=14;
    }
    
    if(b==1)
    {
        b=14;
    }
    
    if(a>b)
    {
        printf("Alice");
    }
    
    else if(a<b)
    {
        printf("Bob");
    }
    
    else 
    {
        printf("Draw");
    }
    return 0;
}

Measured memory_bytes: 256
N = int(input())

fizzbuzz_sum = 0

for i in range(N+1):
    if i % 15 == 0:
        continue
    elif i % 3 == 0:
        continue
    elif i % 5 == 0:
        continue
    else:
        fizzbuzz_sum += i

print(fizzbuzz_sum)

Measured memory_bytes: 9172
use io::*;
use std::cmp::min;

fn main() {
    let con = read_string();
    let mut sc = Scanner::new(&con);

    let d: usize = sc.next();
    let g: i64 = sc.next();
    let v: Vec<(i64, i64)> = (0..d).map(|_| (sc.next(), sc.next())).collect();

    let mut ans = std::i64::MAX;
    for bit in 0..1 << d {
        let mut sum = 0;
        let mut count = 0;

        let mut rest_max = 0;
        for i in 0..d as i64 {
            if bit & (1 << i) != 0 {
                sum += (i + 1) * 100 * v[i as usize].0 + v[i as usize].1;
                count += v[i as usize].0;
            } else {
                rest_max = i;
            }
        }

        if sum < g {
            let s = 100 * (rest_max + 1);
            let need = (g - sum + s - 1) / (s);

            if need >= v[rest_max as usize].0 { continue; }
            count += need;
        }
        ans = min(ans, count);
    }
    println!("{}", ans);
}


pub mod io {

    use std;
    use std::str::FromStr;

    pub struct Scanner<'a> {
        iter: std::str::SplitWhitespace<'a>,
    }

    impl<'a> Scanner<'a> {
        pub fn new(s: &'a str) -> Scanner<'a> {
            Scanner {
                iter: s.split_whitespace(),
            }
        }

        pub fn next<T: FromStr>(&mut self) -> T {
            let s = self.iter.next().unwrap();
            if let Ok(v) = s.parse::<T>() {
                v
            } else {
                panic!("Parse error")
            }
        }

        pub fn next_vec_len<T: FromStr>(&mut self) -> Vec<T> {
            let n: usize = self.next();
            self.next_vec(n)
        }

        pub fn next_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.next()).collect()
        }
    }

    pub fn read_string() -> String {
        use std::io::Read;

        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }

    pub fn read_line() -> String {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    }
}

Measured memory_bytes: 4352
#include<iostream>
#include<cmath>
#include<string>
#include<cctype>
#include<algorithm>
using namespace std;

long long scf_2(int a){
	long long sum=1;
	for(int i=1;i<=a;i++)
		sum*=2;
	return sum;
}

int main(){
	int n,m;
	cin>>n>>m;
	n-=m;
	long sum=n*100+m*1900;
	cout<<sum*scf_2(m);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <array>
#include <cmath>
#include <climits>
#include <cstdint>
using namespace std;

inline namespace atcoder {
    using i32 = int32_t; using u32 = uint32_t;
    using i64 = int64_t; using u64 = uint64_t;
    using f32 = float; using f64 = double;

    template <typename T, size_t Depth>
    struct vector_helper { using type = vector<typename vector_helper<T, Depth - 1>::type>; };
    template <typename T>
    struct vector_helper<T, 0> { using type = T; };
    template <typename T, size_t Depth>
    using vector_t = typename vector_helper<T, Depth>::type;

    template <typename T> using vec = vector_t<T, 1>;
    template <typename T> using vvec = vector_t<T, 2>;
    template <typename T> using vvvec = vector_t<T, 3>;
}

int main() {
    int a, b, c; cin >> a >> b >> c;
    int sum = a + b + c;
    int mx = max(max(a, b), c);
    int mn = min(min(a, b), c);
    int md = sum - mx - mn;
    cout << ((mx == md && mx != mn) || (mn == md && mx != mn) ? "Yes" : "No") << endl;
}



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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

void print(const std::vector<int> &v)
{
    std::for_each(v.begin(), v.end(), [](int x) {
        std::cout << x << " ";
    });
    std::cout << std::endl;
}

int main()
{
    lint n;cin >> n;
    lint ans=0;
    vector<int> p(n), q(n),v(n);
    REP(i, n)
    cin >> p[i];
    REP(i, n)
    cin >> q[i];
    REP(i, n)
    v[i] = i + 1;
    int a, b,cnt=0;

    do
    {
        cnt++;
        //print(v);
        if(p==v){
            a = cnt;
        }
        if (q == v)
        {
            b = cnt;
        }
    } while (std::next_permutation(v.begin(), v.end()));
    cout << abs(a-b) << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long LL;
typedef pair<int, int> pii;
 
#define fst first
#define snd second
#define pb push_back
#define REP(i, a, b)  for(int i = (a), i##end = (b); i < i##end; ++i)
#define DREP(i, a, b) for(int i=(a-1), i##end = (b); i >=i##end; --i)
 
template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }
 
const int oo = 0x3f3f3f3f;
const int maxn = 100000 + 5;
 
template<typename T> T read() {
    T n(0), f(1);
    char ch = getchar();
    for( ;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
    for( ; isdigit(ch); ch = getchar()) n = n * 10 + ch - 48; 
    return n * f;
}

int N, M, K;
int main() {
#ifdef Wearry
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    cin >> N >> M >> K;

    bool flag = 0;
    for(int i = 0; i <= N; ++i) {
        for(int j = 0; j <= M; ++j) {
            if(j*(N-i) + i*(M-j) == K) { 
                flag = 1;
            }
        }
    }
    puts(flag ? "Yes" : "No");
    return 0;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <algorithm>
#include <string>
#include <list>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    string s, answer = "";
    cin >> s;
    for (int i = 0; i < s.size(); ++i) {
        if (s[i] == 'C' && answer.size() == 0) {
            answer += s[i];
        }

        if (s[i] == 'F' && answer.size() == 1) {
            answer += s[i];
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.*;

public class Main{

    static boolean binarySearch(int[] s, int n, int key){
        int left = 0;
        int right = n - 1;
        while(left <= right){
            int mid = (left + right) / 2;
            if(s[mid] == key){
                return true;
            }else if(s[mid] < key){
                left = mid + 1;
            }else if(key < s[mid]){
                right = mid - 1;
            }
        }

        return false;
    }
    public static void main(String[] args){
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        try{
        int n = Integer.parseInt(br.readLine());
        String[] str1 = br.readLine().split(" ");
        int[] s = new int[n];
        for(int i = 0; i < n; i++)
            s[i] = Integer.parseInt(str1[i]);

        int q = Integer.parseInt(br.readLine());
        String[] str2 = br.readLine().split(" ");
        int[] t = new int[q];
        for(int i = 0; i < q; i++)
            t[i] = Integer.parseInt(str2[i]);

        int count = 0;
        for(int i = 0; i < q; i++)
            if(binarySearch(s, n, t[i]))
                count++;

        System.out.println(count);        
        }catch(IOException e){
            e.printStackTrace();
        }
    }
}


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

using namespace std;

int main(){
        string s, res;
        cin>>s;
        res+=s[0];
        int rlen=s.length();
        if((rlen-2)/10!=0){
                res+=(rlen-2)/10+'0';
        }
        if((rlen-2)/10!=0||(rlen-2)%10!=0){
                res+=(rlen-2)%10+'0';
        }
        res+=s[rlen-1];
        cout<<res<<endl;
        return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
typedef vector<vector<ll>> mat;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<60;
double pi=3.141592653589793238462643383279L;
double eps=1e-14;
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(int i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define mrep(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll popcount(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;cin>>n;
    ll a[n][n];
    ll sum=0;
    rep(i,0,n)rep(j,0,n){
        cin>>a[i][j];
        sum+=a[i][j];
    }
    sum/=2;
    //cout<<sum<<endl;
    bool used[n][n];
    memset(used,false,sizeof used);
    rep(i,0,n-2){
        rep(j,i+1,n-1){
            rep(k,j+1,n){
                vector<pll> v;
                v.push_back({a[i][j],0});
                v.push_back({a[j][k],1});
                v.push_back({a[k][i],2});
                sort(v.begin(),v.end());
                if(v[2].first>v[0].first+v[1].first){
                    cout<<-1<<endl;
                    return 0;
                }
                else if(v[2].first==v[0].first+v[1].first){
                    if(v[2].second==0){
                        if(used[i][j]==false)sum-=a[i][j];
                        used[i][j]=true;
                        used[j][i]=true;
                    }
                    if(v[2].second==1){
                        if(used[j][k]==false)sum-=a[j][k];
                        used[j][k]=true;
                        used[k][j]=true;
                    }
                    if(v[2].second==2){
                        if(used[k][i]==false)sum-=a[k][i];
                        used[i][k]=true;
                        used[k][i]=true;
                    }
                }
            }
        }
    }
    cout<<sum<<endl;
}





Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define pb push_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define chmin(x,y) if(x>y)x=y
#define chmax(x,y) if(x<y)x=y
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll,vector<ll>,greater<ll>> SPQ;
using vi=vector<ll>;
using vvi=vector<vector<ll>>;
using vc=vector<char>;
using vvc=vector<vector<char>>;
const ll inf=1001001001001001;
const int Inf=1001001001;
const int mod=1000000007;
int main(){
    ll n,k;cin>>n>>k;
    vi v(n);
    ll ans=1;
  	n-=k;k--;
  if(n>0)ans+=(n-1)/k+1;
  cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cmath>
#include <stack>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <queue>




int main()
{
	long long a, b, c, d;

	std::cin >> a >> b >> c >> d;

	long long start = std::max(a, c);
	long long end = std::min(b, d);

	if (end - start < 0) {
		std::cout << 0 << std::endl;
	} else {
		std::cout << end - start << std::endl;
	}
	


	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define GSIZE 100

void insertionSort(int *, int, int);
int shellSort(int *, int);

int cnt = 0;
int g[GSIZE];

int main(){
  int n, m;
  int i;

  scanf("%d", &n);

  int a[n];

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

  m = shellSort(a, n);

  printf("%d\n", m);
  for(i=m-1;i>=0;i--){
    if(i == 0) printf("%d\n", g[i]);
    else printf("%d ", g[i]);
  }
  printf("%d\n", cnt);
  for(i=0;i<n;i++){
    printf("%d\n", a[i]);
  }
  return 0;
}

void insertionSort(int *a, int n, int g){
  int v;
  int i, j;

  for(i=g;i<n;i++){
    v = a[i];
    j = i - g;
    while(j >= 0 && a[j] > v){
      a[j+g] = a[j];
      j -= g;
      cnt++;
    }
    a[j+g] = v;
  }
}

int shellSort(int *a, int n){
  int i = 0, j;
  
  g[0] = 1;
  while(g[i] < n){
    i++;
    g[i] = 3 * g[i-1] + 1;
  }
  //printf("%d\n", i);
  //ここの時点でg[i] >= n
  //i+1がgの要素数

  //ループ1回も回らなかったらiおかしくなる
  if(i == 0) i++;
  
  //g[i]はnを超えてるから含めない
  for(j=i-1;j>=0;j--){
    insertionSort(a, n, g[j]);
  }

  return i;
}



Measured memory_bytes: 5672
main = do
  n <- readLn
  as <- map read . words <$> getLine
  let u = maximum as
      l = minimum as
      x = length $ filter (==u-1) as
  putStrLn $ if u==l && (n==u+1||u<=n`div`2)
    then "Yes"
    else if u-l>1||x>=u||n-x==1||u>x+(n-x)`div`2 
      then "No" 
      else "Yes"


Measured memory_bytes: 30076
#include<bits/stdc++.h>
#define N 100005
#define M 1000000007
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define rep(i, begin, end) for( __typeof(end) i = (begin) -((begin) > (end)); i!=(end)-((begin) > (end));i+= 1-2*((begin) >(end)))
#define all(x) (x).begin(),(x).end()
#define Min(...) min({__VA_ARGS__})
#define Max(...) max({__VA_ARGS__})

using namespace std;
typedef long long ll;
map<int,int> m;
int main(){
    ios_base::sync_with_stdio(0);
    int n,x;
    cin>>n;     
    rep(i,0,n){
        cin>>x;
        m[x]++;
        m[x+1]++;
        m[x-1]++;
    }
    int mx =0;
    rep(i,0,N){
        if(m[i])
            mx =max(mx,m[i]);
    }
    cout<<mx<<endl;
    return 0;
}

Measured memory_bytes: 4992
#include  <bits/stdc++.h>
using namespace std;
static int fast_io = []() { std::ios::sync_with_stdio(false); cin.tie(nullptr); return 0; }();

int main(){ 
  long long int a,b;
  cin>>a>>b;
  cout<<a*b<<"\n";  
  return 0; 
}

Measured memory_bytes: 3552
import itertools
n=int(input())
p=tuple(map(int, input().split()))
q=tuple(map(int, input().split()))

for i, v in enumerate(itertools.permutations(range(1,n+1))):
    if p==v:
        s=i
    if q==v:
        t=i
print(abs(s-t))


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

bool multi_check(vector<int> v, int m){
  for(int i=0; i<m; i++){
    if(v[i]==v[m]) return true;
  }
  return false;
}

int main(){
  int s;
  cin >> s;
  vector<int> v(100001);
  v[0]=s;
  int h=1;
  while(true){
    if(v[h-1]%2==0) v[h]=v[h-1]/2;
    else v[h]=3*v[h-1]+1;
    if(multi_check(v,h)){
      cout << h+1 <<endl;
      return 0;
    }
    else h++;
  }
}

Measured memory_bytes: 1024