akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type contest struct {
	in  io.Reader
	out io.Writer
}

func (con *contest) Scan(a ...interface{}) (int, error) {
	return fmt.Fscan(con.in, a...)
}
func (con *contest) Scanln(a ...interface{}) (int, error) {
	return fmt.Fscanln(con.in, a...)
}
func (con *contest) Scanf(f string, a ...interface{}) (int, error) {
	return fmt.Fscanf(con.in, f, a...)
}
func (con *contest) Print(a ...interface{}) (int, error) {
	return fmt.Fprint(con.out, a...)
}
func (con *contest) Println(a ...interface{}) (int, error) {
	return fmt.Fprintln(con.out, a...)
}
func (con *contest) Printf(f string, a ...interface{}) (int, error) {
	return fmt.Fprintf(con.out, f, a...)
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	con := &contest{in: in, out: out}
	con.main()
}

const mod = 1e9 + 7

func (con *contest) sum(x []int) int {
	n := len(x) - 1
	p := n
	q := 0
	r := 0
	for i := 0; p > 0; i++ {
		q += p
		s := ((x[i+1] - x[i]) * q) % mod
		r = (r + s) % mod
		if p > 1 {
			t := ((x[n-i] - x[n-i-1]) * q) % mod
			r = (r + t) % mod
		}
		p -= 2
	}
	return r
}

func (con *contest) main() error {
	var n, m int
	con.Scan(&n, &m)
	x := make([]int, n)
	y := make([]int, m)
	for i := 0; i < n; i++ {
		con.Scan(&x[i])
	}
	for i := 0; i < m; i++ {
		con.Scan(&y[i])
	}
	sumX := con.sum(x)
	sumY := con.sum(y)
	con.Println((sumX * sumY) % mod)
	return nil
}

/*
012345678
111111111 9
122222221 16
123333321 21
123444321 24
123454321 25
123444321 24
123333321 21
122222221 16
111111111 9

01234567
11111111 8
12222221 14
12333321 18
12344321 20
12344321 20
12333321 18
12222221 14
11111111 8
*/


Measured memory_bytes: 5504
#include<bits/stdc++.h>
using namespace std;
//#include<ext/rope>
//using namespace __gnu_cxx
//#include<ext/pb_ds/priority_queue.hpp>
//using namespace __gnu_pbds;
#define lowbit(x) (x&-x)
#define pb push_back
#define empb emplace_back
#define all(x) (x).begin(),(x).end()
#define clr(a,b) memset(a,b,sizeof(a))
#define caze(T) for(cin>>T;T;T--)
#define inf (1<<29)
#define Endl ('\n')
#define fi first
#define se second
#define db double
#define ldb long double
#define ll long long
#define pii pair<int,int>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define pll pair<ll,ll>
#define ull unsigned long long
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
inline char nc() {
	#define SZ 1000000
	static char buf[SZ], *p1, *p2;
	return p1==p2&&(p2=(p1=buf)+fread(buf,1,SZ,stdin),p1==p2)?EOF:*p1++;
}
template<typename T>
inline int scan(T &x) {
	char c, sign=1; 
	while(!isdigit(c=nc())&&c!=EOF)if(c=='-')sign*=-1;
	if(c==EOF) return EOF;
	for(x = 0; isdigit(c); c = nc())
		x = (x<<1) + (x<<3) + (c&15);
	return x *= sign, 1;
}
template<typename T, typename...Args>
inline int scan(T &x, Args&...args) {
	return scan(x), scan(args...);
}
const int N=1<<7;
char mp[N][N];
int main()
{
	int n,m;cin>>n>>m;
	for(int i=0;i<n;++i)
		for(int j=0;j<m;++j)
			cin>>mp[i][j];
	vector<int>r(n,1),c(m,1);
	for(int i=0;i<n;++i)
	{
		int&f=r[i];
		for(int j=0;f&&j<m;++j)
			f&=mp[i][j]=='.';
	}
	for(int j=0;j<m;++j)
	{
		int&f=c[j];
		for(int i=0;f&&i<n;++i)
			f&=mp[i][j]=='.';
	}
	for(int i=0;i<n;++i)
	{
		if(r[i]) continue;
		for(int j=0;j<m;++j)
			if(!c[j])
				putchar(mp[i][j]);
		putchar('\n');
	}
}

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


int main() {

    while (true) {
        int H;
        cin >> H;
        if (H==0) break;

        int P[H][5] = {};
        rep(i, H) rep(j, 5) cin >> P[i][j];

        int score = 0;
        bool can_vanish = true;

        while (can_vanish) {
            can_vanish = false;
            rep(i, H) {
                int p0 = P[i][0], p1 = P[i][1], p2 = P[i][2], p3 = P[i][3], p4 = P[i][4];

                if ((p0==p1) && (p1==p2) && (p2!=p3)) {
                    if (P[i][2] != 0) can_vanish = true;
                    score += P[i][2] * 3;
                    P[i][0] = P[i][1] = P[i][2] = 0;
                } else if ((p0!=p1) && (p1==p2) && (p2==p3) && (p3!=p4)) {
                    if (P[i][2] != 0) can_vanish = true;
                    score += P[i][2] * 3;
                    P[i][1] = P[i][2] = P[i][3] = 0;
                } else if ((p1!=p2) && (p2==p3) && (p3==p4)) {
                    if (P[i][2] != 0) can_vanish = true;
                    score += P[i][2] * 3;
                    P[i][2] = P[i][3] = P[i][4] = 0;
                } else if ((p0==p1) && (p1==p2) && (p2==p3) && (p3!=p4)) {
                    if (P[i][2] != 0) can_vanish = true;
                    score += P[i][2] * 4;
                    P[i][0] = P[i][1] = P[i][2] = P[i][3] = 0;
                } else if ((p0!=p1) && (p1==p2) && (p2==p3) && (p3==p4)) {
                    if (P[i][2] != 0) can_vanish = true;
                    score += P[i][2] * 4;
                    P[i][1] = P[i][2] = P[i][3] = P[i][4] = 0;
                } else if ((p0==p1) && (p1==p2) && (p2==p3) && (p3==p4)) {
                    if (P[i][2] != 0) can_vanish = true;
                    score += P[i][2] * 5;
                    P[i][0] = P[i][1] = P[i][2] = P[i][3] = P[i][4] = 0;
                }
            }

            rep(j, 5) {
                int i=H-1;
                while (i>0) {
                    int cnt = 0;
                    while ((P[i][j] == 0) && (cnt<=H)) {
                        for (int h=i; h>=1; h--) P[h][j] = P[h-1][j];
                        P[0][j] = 0;
                        cnt++;
                    } 
                    i--;
                }
            }
        }

        cout << score << endl;

    }

    return 0;
}




Measured memory_bytes: 3060
//専用ライブラリ
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll>P;
#define INF 10e16
#define MOD 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define PI acos(-1.0)
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int cmp(P a,P b){
        if(a.fi!=b.fi)
        return a.fi>b.fi;
        else
        return a.se<b.se;
}
//---------------------------------------------------------------------------
#define INFTY 2001
#define WHITE 0
#define GRAY 1
#define BLACK 2
#define N 100

// 最小全域木を構成し、重みの総和を返す関数
int prim(int n, int A[N][N]) {
  int i, vertex, min_cost, sum_weight, cost[N], color[N];
  // 初期化
  for (i = 0; i < n; i++) {
    cost[i] = INFTY;
    color[i] = WHITE;
  }
  cost[0] = 0;
  color[0] = GRAY;
  sum_weight = 0;
  
  while (1) {
    // Tに隣接する頂点の中で最小のコストを持つものを選ぶ
    vertex = -1;
    min_cost = INFTY;
    for (i = 0; i < n; i++) {
      if (color[i] == GRAY && cost[i] < min_cost) {
        min_cost = cost[i];
        vertex = i;
      }
    }
    // T = V ならば終了
    if (vertex == -1) break;

    color[vertex] = BLACK;  // vertexをTに加える
    sum_weight += cost[vertex];

    // vertexに隣接し、Tに属していない頂点のコストを更新
    for (i = 0; i < n; i++) {
      if (color[i] != BLACK && A[vertex][i] < INFTY) {
        color[i] = GRAY;
        if (cost[i] > A[vertex][i]) cost[i] = A[vertex][i];
      }
    }
  }

  return sum_weight;
}

/*
// 最小全域木の辺の重みの和を計算する関数
int sum_weight(int n, int parent[], int A[N][N]) {
  int sum = 0;
  
  for (int i = 1; i < n; i++) sum += A[i][parent[i]];
  
  return sum;
}*/

//---------------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int i, j, n, w, A[N][N];
    cin >> n;
    // 隣接行列が与えられる
    for (i = 0; i < n; i++) {
      for (j = 0; j < n; j++) {
        cin >> w;
        if (w == -1) A[i][j] = INFTY;
        else A[i][j] = w;
      }
    }

    cout << prim(n, A) << endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------



Measured memory_bytes: 3188
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;
char a[101];
int main()
{
//	freopen("weigh.in","r",stdin);
//	freopen("weigh.out","w",stdout);	
	cin>>a;
	int sum=strlen(a);
	cout<<a[0]<<sum-2<<a[sum-1];
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define INF 120000000

using namespace std;

typedef pair<int, int> P;
typedef long long int LL;

int main() {
    stack<int> st;

    string s;
    while (cin >> s) {
        if (s[0] == cin.eof()) break;
        if (isdigit(s[0])) {
            int a = stoi(s);
            st.push(a);
        } else {
            int a = st.top(); st.pop();
            int b = st.top(); st.pop();
            if (s[0] == '+') {
                st.push(b + a);
            } else if (s[0] == '-') {
                st.push(b - a);
            } else {
                st.push(b * a);
            }
        }
    }

    cout << st.top() << endl;

    return 0;
}

Measured memory_bytes: 3160
#include<cstdio>
int main(){
	int H,W,A,B;
	scanf("%d%d%d%d",&H,&W,&A,&B);
	for(int i=0;i<H;i++,puts("")){
		for(int j=0;j<W;j++)putchar('0'+((i<B)==(j<A)));
	}
} 

Measured memory_bytes: 1152
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt(), M = in.nextInt(), sum = 0;
        for (int i = 0; i < M; i++) {
            sum += in.nextInt();
        }
        System.out.println(N >= sum ? N - sum : -1);
    }
}

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

int main() {
    int x, y;
    cin >> x >> y;

    for (int i = 0; i <= x; i++) {
        for (int j = 0; j <= x; j++) {
            if (i + j == x && i * 2 + j * 4 == y) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

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


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

int main(){
    int a,b,k;
    cin >> a >> b >> k;
    if (((b-a+1)/2)<k) {
        for (int i=a;i<=b;i++){
            cout << i << endl;
        }
    }else{
        for (int i=a;i<a+k;i++){
            cout << i << endl;
        }
        for (int i=b-k+1;i<=b;i++){
            cout << i << endl;
        }
    }

    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  ll N,K; cin >> N >> K;
  vector<ll> data(N+1); for(int i = 1;i<N+1;i++) cin >> data.at(i);
  int a=1,b=1; //循環を検出するための変数
  ll i = 0,ans = 1;
  int num = 0; //循環がスタートするまでの数と循環してる個数
  while(a != b || i ==0){//追いつくところを計算
    if(i > K){
      for(i = 0; i < K ; i++) ans = data[ans];
      cout << ans << endl;
      return 0;
    }
    a = data[a];
    b = data[data[b]];
    i++;
  }
  b = 1; i = 0;//早い方を最初の位置に戻して
  while(a != b){//ループ開始地点を算出
    a = data[a];
    b = data[b];
    i++; //ループまでの余計な移動数
  }
  K -= i; //ループまでの余計な移動分減らす
  ans = a; //ループの開始地点からスタートさせる
  while(a != b || num == 0){//ループ個数を算出
    a = data[a];
    b = data[data[b]];
    num++; 
  }
  for(i = 0; i < K % num; i++){//ループ回数で割った分だけ回す
    ans = data[ans];
  }
  cout << ans << endl;
}

Measured memory_bytes: 4772
#ifdef _MSC_VER
#  define _CRT_SECURE_NO_WARNINGS
#  define _USE_MATH_DEFINES
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

#include <bits/stdc++.h>
using namespace std;
using i32 = int; using i64 = long long int; using f64 = double;
using u32 = unsigned int; using u64 = unsigned long long int; using str = string;
template <typename T> using vec = vector<T>; void in() { }
template <typename T, typename...TS> void in(T &&x, TS &&...xs) { cin >> x; in(move(xs)...); }
template <typename T> void out(T &&x) { cout << x << "\n"; }
template <typename T, typename...TS> void out(T &&x, TS &&...xs) { cout << x << " "; out(move(xs)...); }
#define indef(t, ...) t __VA_ARGS__; in(__VA_ARGS__)
#define get(t) []{ t x; cin >> x; return x; }()
#define times(n, i) for (i32 i = 0; i < (n); ++i)
#define range(a, b, i) for (i32 i = (a); i < (b); ++i)
#define upto(a, b, i) for (i32 i = (a); i <= (b); ++i)
#define downto(a, b, i) for (i32 i = (a); i >= (b); --i)
#define all(xs) (xs).begin(), (xs).end()
#define sortall(xs) sort(all(xs))
#define reverseall(xs) reverse(all(xs))
#define even(x) ((abs(x) & 1) == 0)
#define odd(x) ((abs(x) & 1) == 1)
#define bit(x, i) (((x) >> i) & 1)
#define append emplace_back
#define bisect_left lower_bound
#define bisect_right upper_bound
#define bound(a, x, b) (a <= x && x <= b)
const i64 MOD = 1000000007ll;
const f64 EPS = 1e-10;

pair<i32, i32> p[201];
i32 dp[201][201][100];

void solve() {
    indef(i32, a, b); a--; b--;
    out(a*b);
}

i32 main()
{
    ios::sync_with_stdio(false);

#ifdef _MSC_VER
    /**
    ifstream fin("input.txt"); cin.rdbuf(fin.rdbuf()); assert(fin);
    ofstream fout("output.txt"); cout.rdbuf(fout.rdbuf()); assert(fout);
    /**/
#endif

    //cout << fixed << setprecision(9);
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
//#include <iomanip>
#include <string>
#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;
//#define all(v) v.begin(),v.end()
//ll mod = 1e9+7 ;
//long double pie = acos(-1) ;
//ll INF = 1000000000000 ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void fix_cout(){cout << fixed << setprecision(20) ;}

int main(){
	string s ; cin >> s ;
	ll ans = 1+s.size()*(s.size()-1)/2 ;
	vll cnt(26,0) ;
	for(int i=0;i<s.size();i++) cnt.at(s.at(i)-'a')++ ;
	for(int i=0;i<26;i++) ans -= cnt.at(i)*(cnt.at(i)-1)/2 ;
	cout << ans << endl ;
}


Measured memory_bytes: 640
import std.stdio;
import std.conv;
import std.algorithm;
import std.range;
import std.string;
import std.math;
import std.format;

void main() {
  foreach (string line; stdin.lines) {
    double a, b, c, d, e, f;
    line.formattedRead("%f %f %f %f %f %f\n", &a, &b, &c, &d, &e, &f);

    double x, y = 0;
    y = (c * d - a * f) / (b * d - a * e);
    x = (c - b * y) / a;

    writefln("%.3f %.3f", round(x * 1000) / 1000, round(y * 1000) / 1000);
  }
}

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

int main() {
	int x,y;
	while(cin>>x>>y,x||y) {
		if(x>y) {
			cout<<y<<" "<<x<<endl;
		}
		else {
			cout<<x<<" "<<y<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
inline int nxt(){int aaa;scanf("%d",&aaa);return aaa;}

void solve()
{
    int n=nxt();
    string s,t,temp="";
    cin>>s>>t;
    for(int i=0;i<n;i++){
        temp+=s[i];
        temp+=t[i];
    }
    cout<<temp<<endl;

}
int main()
{
    int tc=1;
    while(tc--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<array>

int main(void) {

	int A, B, D, result;
	std::cin >> A >> B;
	D = A * B;
	result = D % 2;
	if (result == 0) {
		std::cout << "No" << std::endl;
	}
	else if (result == 1)
	{
		std::cout << "Yes" << std::endl;
	}

}

Measured memory_bytes: 256
#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>;

const double PI = acos(-1);

int main() {
  double a, b, x;
  cin >> a >> b >> x;
  double tn;
  double ans;
  if (a * a * b > 2 * x) {
    tn = (a * b * b) / (2 * x);
    ans = atan(tn);
  } else {
    tn = 2 * (a * a * b - x) / (a * a * a);
    ans = atan(tn);
  }
  cout << std::fixed << std::setprecision(10) << ans * double(180) / PI << endl;
  return 0;
}

Measured memory_bytes: 4056
# include <iostream>
# include <string>
using namespace std;
int main(){
  int n, a, b, c, d;
  cin >> n >> a >> b >> c >> d;
  char grid[n+5];
  for(int i=1; i<=n; i++) cin >> grid[i];

  for(int i=a; i<b; i++){
    if(grid[i] == '#' && grid[i+1] == '#'){
      cout << "No" << endl;
      return 0;
    }
  }

  for(int i=c; i<d; i++){
    if(grid[i] == '#' && grid[i+1] == '#'){
      cout << "No" << endl;
      return 0;
    }
  }

  if(c < d){
    cout << "Yes" << endl;
  }
  else{
    for(int i=2; i<n; i++){
      if(grid[i-1] == '.' && grid[i] == '.' && grid[i+1] == '.' && b <= i && i <= d){
        cout << "Yes" << endl;
        return 0;
      }
    }
    cout << "No" << endl;
  }
  return 0;
}

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

import numpy as np

MOD = 998244353

S = input().rstrip()

arr = np.array(list(S.replace('a','0').replace('b','1').replace('c','2')),dtype=np.int32)

if (arr == arr[0]).all():
    print(1)
    exit()

def solve_naive(S):
    se = set([S])
    q = [S]
    while q:
        S = q.pop()
        for i in range(len(S)-1):
            x,y = S[i:i+2]
            if x == y:
                continue
            for t in 'abc':
                if t != x and t != y:
                    T = S[:i] + t+t + S[i+2:]
                    if T not in se:
                        q.append(T)
                        se.add(T)
    return len(se)

LS = len(S)
if LS < 6:
    answer = solve_naive(S)
    print(answer)
    exit()

# 適当な必要条件のもと全部作れる
# mod 3不変量
answer = pow(3,LS-1,MOD)
# 同一値の連続が存在しないものを間引く
if LS%3 == 0:
    x,y = (3+MOD)//2,0
    for _ in range(LS//3):
        x,y = 4*x+4*y,2*x+6*y
        x %= MOD
        y %= MOD
    if arr.sum()%3 == 0:
        answer -= x
    else:
        answer -= y
else:
    answer -= pow(2,LS-1,MOD)
# 初手に完成しているやつは使って良い
if (arr[:-1] != arr[1:]).all():
    answer += 1

answer %= MOD
print(answer)

Measured memory_bytes: 15560
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<cstdlib>

using namespace std;

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

    unsigned long long a[n];
    for(int i=0;i<n;i++)cin >> a[i];

    vector<unsigned long long> range;

    sort(a, a+n, greater<unsigned long long>());

    for(int i=0;i<n-1;i++){
        if(a[i]==a[i+1]){
            range.push_back(a[i]);
            i++;
        }
        //if(range.size()>2)break;
    }
//for(int i=0;i<range.size();i++)cout << "#" << range[i];
    if(range.size()<2)cout << 0 << endl;
    else cout << range[0] * range[1] << endl;;
}


Measured memory_bytes: 1660
sx,sy,tx,ty=map(int,input().split())
a=["U","R","D","L"]
for i in[0,2]:
 print(a[i]*(ty-sy),end="")
 print(a[i+1]*(tx-sx),end="")
for i in[0,2]:
 print(a[(i+3)%4],end="")
 print(a[i]*(ty-sy+1),end="")
 print(a[i+1]*(tx-sx+1),end="")
 print(a[(i+2)%4],end="")

Measured memory_bytes: 3064
<?php
$input = trim(fgets(STDIN));
$temp = str_replace(array("\r\n", "\r", "\n"), '', $input);
$array = explode(" ", $temp);
$n = $array[0];
$d = $array[1];

$monitor_number = $d * 2 + 1;
$answer = ceil($n / $monitor_number);
echo $answer . "\n";

Measured memory_bytes: 3956
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>
#include <ctime>
#include <assert.h>
#include <chrono>
#include <random>
#include <numeric>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
	return (ull)rng() % B;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,m,k; cin >> n >> m >> k;
    vector<int> a(m);
    vector<int> mp(n,-1);
    //map<int,int>> mp;
    for(int i=0;i<m;i++){
        cin >> a[i];
        a[i]--;
        mp[a[i]]=i;
    }
    vector<vector<int>> v(n,vector<int>(k));
    for(int i=0;i<n;i++){
        for(int j=0;j<k;j++){
            cin >> v[i][j];
            v[i][j]--;
        }
    }
    vector<vector<int>> g(1<<m);
    { // グラフの構築
        for(int i=1;i<(1<<m);i++){
            for(int j=0;j<k;j++){
                int t=0;
                for(int s=0;s<m;s++){
                    if((1<<s)&i){
                        if(mp[v[a[s]][j]]>=0){
                            t|=(1<<mp[v[a[s]][j]]);
                        }
                    }
                }
                g[i].push_back(t);
            }
        }
    }
    vector<int> d(1<<m,1e9);
    d[(1<<m)-1]=0;
    queue<int> q;
    q.push((1<<m)-1);
    while(q.size()){
        int s=q.front(); q.pop();
        for(int t:g[s]){
            if(d[t]>d[s]+1){
                d[t]=d[s]+1;
                q.push(t);
            }
        }
    }
    cout << d[0] << endl;
}



Measured memory_bytes: 38876
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
// constexpr long double EPS = 1e-15;
// const long double PI = acos(-1);
constexpr int inf = 2e9;
constexpr ll INF = 2e18;
constexpr ll MOD = 1e9+7;
constexpr ll MOD1 = 998244353;
typedef pair<ll,ll> P;
//#define all(v) (v).begin(), (v).end()
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
//#define mp make_pair

int a[100010];
int n,m;
int cost[2000];
int b[2000];

void f(int s) {
    if (s == (1 << n) - 1) return;
    for (int i = 0; i < n; i++) {
        if (!(s & (1 << i))) {
            for (int j = 0; j < m; j++) {
                if (!(b[j] & (1 << i))) continue;
                if (a[s | b[j]] == -1 || a[s | b[j]] > a[s] + cost[j]) {
                    a[s | b[j]] = a[s] + cost[j];
                    f(s | b[j]);
                }
            }
        }
    }
}

void solve() {
    memset(a,-1,sizeof(a));
    cin >> n >> m;
    REP(i,m) {
        int aa,bb;
        cin >> aa >> bb;
        cost[i] = aa;
        REP(j,bb) {
            int k;
            cin >> k;
            b[i] += (1 << (k-1));
        }
    }

    a[0] = 0;
    f(0);
    cout << a[(1 << n) - 1] << endl;
}

int main(int argc, char *argv[]){
    // /* Regular */
    // int case_num = 1;
    // if (argc > 1 && stoi(argv[1])) cin >> case_num;
    // REP(case_no, case_num) {
    //   cerr << endl << "case " << case_no + 1 << endl;
    //   solve();
    // }
    /* AOJ */
    solve();
    return 0;
}

Measured memory_bytes: 640
// https://atcoder.jp/contests/abcXXX/tasks/abcXXX_x

#include <bits/stdc++.h>

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

static const ll INF = 1001001001;
static const ll LLINF = 1001001001001001001;
static const ll MOD = (ll)1e9 + 7;
static const double EPS = 1e-9;

#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define RANGE(i, m, n) for(ll i = (m); i <= (n); ++i)
#define RRANGE(i, m, n) for(ll i = (m); i >= (n); --i)
#define POSITIVE(x) (x)=((x) < 0) ? 0 : (x)

ll power(ll x, ll y) {
    ll ret = 1;
    while(y-- > 0) ret *= x;
    return ret;
}

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

ll extgcd(ll a, ll b, ll& x, ll& y) {
    x = 1; y = 0;
    assert(a >= 0);
    assert(b >= 0);
    if (b == 0) return a;
    ll X, Y;
    auto d = extgcd(b, a % b, X, Y);
    x = Y;
    y = X - (a / b) * Y;
    return d;
}

int run(istream& in, ostream& out) {
    ll N, M ;
    in >> N >> M;
    vector<ll> a(N);
    ll total = 0;
    REP(i, N) {
        in >> a[i];
        total += a[i];
    }
    sort(a.begin(), a.end(), greater<>());
    out << (a[M-1]*4*M >=total ? "Yes" : "No") << endl;
    return 0;
}

int main() {
    return run(cin, cout);
}


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

static const int MAX_N = 1e5;
vector<int> g[MAX_N];
int color[MAX_N];
int n, m;

bool dfs(int u, int c)
{
	color[u] = c;
	for (int v : g[u])
	{
		if (color[v] == c)
		{
			return false;
		}
		else if (color[v] == 0 && !dfs(v, -c))
		{
			return false;
		}
	}
	return true;
}

int main()
{
	cin >> n >> m;
	for (int i = 0; i < m; ++i)
	{
		int x, y;
		cin >> x >> y;
		--x;
		--y;
		g[x].push_back(y);
		g[y].push_back(x);
	}

	if (dfs(0, 1))
	{
		int64_t b = 0, w = 0;
		for (int i = 0; i < n; ++i)
		{
			if (color[i] == 1)
			{
				++b;
			}
			else if (color[i] == -1)
			{
				++w;
			}
		}
		cout << b * w - m << endl;
	}
	else
	{
		cout << 1LL * n * (n - 1) / 2 - m << endl;
	}
}

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

int binarySearch(int *, int, int);

main(){
  int n,q,i,count=0;
  int *sAry,*tAry;

  scanf("%d", &n);
  sAry = malloc(n*sizeof(int));
  for(i=0; i<n; i++) scanf("%d", sAry+i);
  scanf("%d", &q);
  tAry = malloc(q*sizeof(int));
  for(i=0; i<q; i++) scanf("%d", tAry+i);

  for(i=0; i<q; i++)
    count += binarySearch(sAry, n, tAry[i]);

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

  return 0;
}

binarySearch(int *ary, int n, int a){
  int right,mid,left;  //search用

  right=n; //右端の１つ後
  left=0; //左端

  while(right > left){
    mid = (right+left)/2;
    if(ary[mid] == a) return 1;
    else if(ary[mid] > a) right = mid;
    else if(ary[mid] < a) left = mid +1;
  }
  return 0;
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld ;
#define pb push_back
#define fi first
#define se second
const int N = 1e5+6;
const ll mod = 1e9+7;
void solve(){
    int n;
    cin>>n;
    int ans = 0;
    int mx = 1e9;
    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        mx = min(x,mx);
        if(x<=mx)ans++;

    }
    cout<<ans<<endl;
}
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//    preprocess();
    int t =1;
//    cin>>t;
    while(t--)solve();
    return 0;
}




Measured memory_bytes: 256
# by the authority of GOD    author: manhar singh sachdev #

import os,sys
from io import BytesIO, IOBase

def main():
    n = input().strip()
    x = 0
    for i in n:
        x += int(i)
    if x%9:
        print('No')
    else:
        print('Yes')

#Fast IO Region
BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == '__main__':
    main()

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

int main() {
    int N; cin >> N;
    vector<double> probability(N); for (int i = 0; i < N; i++) cin >> probability[i];
    vector<vector<double>> table(N, vector<double>(N+1));
    table[0][0] = 1 - probability[0];
    table[0][1] = probability[0];
    for (int i = 1; i < N; i++) {
        table[i][0] = table[i-1][0] * (1 - probability[i]);
        for (int j = 1; j <= N; j++) {
            table[i][j] = table[i-1][j-1] * probability[i] + table[i-1][j] * (1 - probability[i]);
        }
    }
    double ans = 0;
    for (int i = N; N/2 < i; i--) ans += table[N-1][i];
    cout << setprecision(13);
    cout << ans << endl;
}


Measured memory_bytes: 70656
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    String S = sc.next();
    char SS =0;
    for (int i=0; i<S.length(); i++) {
      if(S.charAt(i) + N > 'Z') {
        SS += S.charAt(i) + N - 26;
      } else {
        SS += S.charAt(i) + N;
      }
      System.out.print(SS);
      SS =0;
    }
  }
}

Measured memory_bytes: 25192
#include <iostream>
#include <string>
using namespace std;
typedef long long ll;


int main(){
    int N, K;
    string S;
    cin >> N >> K >> S;

    int dif = 0, ans = 0;
    for (int i = 0; i < N-1; ++i){
    	if (S[i] != S[i+1]) dif++;
    	else ans++;
    }
    cout << ans + min(dif, 2*K) << endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // コンテナ a の 要素 b から c へのイテレータ
#define MOD 1000000007
#define INF 1000000000
typedef pair<int64_t, int64_t> PII;
typedef vector<int64_t> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

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

int N; cin >> N;
VI b(N); rep(i, 0, N) cin >> b[i];
rep(i, 0, N){
    if (i+1 - b[i] < 0){
        cout << "-1\n";
        return 0;
    }
}
VI a;
Rrep(i, N, 1){
    Rrep(j, i-1, 0){
        if (b[j] == j+1) {
            a.push_back(b[j]);
            b.erase(b.begin()+j);
            break;
        }
    }
}
Rrep(i, N-1, 0) cout << a[i] << "\n";
}

// 境界，出力文字列 チェック
// 可読性優先．高速化次点．
// まずは全探索，分割統治，次にDP
// 制限を見る．境界に注意．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性，二分探索
// 存在判定：構成方法，入力の特徴
// gcd, lcm ,素因数分解．
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// テストケース作成は数表あり



Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <iostream>
#include<math.h>
#include<bitset>
#include<iomanip>
using namespace std;

int main() {
	int N, a, b; long long K; cin >> N >> K;
	long long c[100010] = { 0 };
	for (int i = 0; i < N; i++){
		cin >> a >> b;
		c[a] += b;
	}
	long long x = 0;
	int ans;
	for (int i = 1; ; i++) {
		x += c[i];
		if (x >=K) {
			ans = i; break;
		}
	}
	cout << ans << endl;
}



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

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;

char alpha[3] = {'A', 'B', 'C'};

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  string s; cin >> s;
  int size = s.size();
  // Sの先頭からi-1文字目まで処理して、j個Oをつけている場合のSの残りの部分に対する処理の方法の個数
  ll dp[size+1][4];
  dp[size][3] = 1;
  for(int j=0;j<=2;j++) dp[size][j] = 0;

  for(int i=size-1;i>=0;i--){
    // j = 3
    if(s[i] == '?'){
      dp[i][3] = (dp[i+1][3] * 3) %MOD;
    }else{
      dp[i][3] = dp[i+1][3];
    }
    // j <= 2
    for(int j=2;j>=0;j--){
      // Oをつける場合
      if(s[i] == '?'){
        dp[i][j] = (dp[i+1][j] * 3) %MOD;
      }else{
        dp[i][j] = dp[i+1][j];
      }
      // Oをつけない場合
      if(s[i] == '?' || s[i] == alpha[j]){
        dp[i][j] = (dp[i][j] + dp[i+1][j+1]) %MOD;
      }
    }
  }
  cout << dp[0][0] << endl;
}

Measured memory_bytes: 3664
while True:
    num_H, num_W = list(map(int, input().split()))
    num_W1 = num_W // 2
    num_H1 = num_H // 2
    if num_H == num_W == 0:
        exit()
    if num_W % 2 == 0 and num_H % 2 == 0:
        for count in range(num_H1):
            print("#." * num_W1)
            print(".#" * num_W1)
        print("")
    elif num_W % 2 == 0 and num_H % 2 == 1:
        for count in range(num_H1):
            print("#." * num_W1)
            print(".#" * num_W1)
        print("#." * num_W1)
        print("")
    elif num_W % 2 == 1 and num_H % 2 == 0:
        for count in range(num_H1):
            print("#" + ".#" * num_W1)
            print("." + "#." * num_W1)
        print("")
    elif num_W % 2 == 1 and num_H % 2 == 1:
        for count in range(num_H1):
            print("#" + ".#" * num_W1)
            print("." + "#." * num_W1)
        print("#" + ".#" * num_W1)
        print("")



Measured memory_bytes: 5620
#include <iostream>
#include <tuple>

using namespace std;

typedef long long ll;

tuple<ll, ll, ll> simulate(ll a, ll b, ll c)
{
    return make_tuple(b + c, c + a, a + b);
}

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

    if (abs(b - a) >= 1000000000000000000ll)
    {
        cout << "Unfair" << endl;
    }
    else
    {
        cout << (k % 2 == 0 ? (a - b) : (b - a)) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
/// kAAzuki Hoshino
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int n,u,v,dist[3][202020]; 
vi adj[202020];

void dfs(int s, int p, int c){
  for(auto t:adj[s]){
    if(t!=p){
      dist[c][t] = dist[c][s]+1;
      dfs(t, s, c);
    }
  }
}

signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
  
  cin >> n >> u >> v;
  for(int i=1;i<n;i++){
    int x,y;
    cin >> x >> y;
    adj[x].pb(y);
    adj[y].pb(x);
  }        
  dfs(u,-1,0);
  dfs(v,-1,1);
  int ans = 0;
  for(int i=1;i<=n;i++){
    if(dist[0][i]<dist[1][i]){
      ans = max(ans, dist[1][i]-1);
    }
  }
  cout << ans << endl;

    

return 0;
}
///....


Measured memory_bytes: 18176
/*2019/10/19 */
/*template*/
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#define MOD 1000000007
#define MIN 999999999
#define MAX -999999999
typedef long long int ll;
typedef unsigned long long int ull;
void llswap(ll *x,ll *y){ll tmp;tmp=*x;*x=*y;*y=tmp;}
void swap(int *x,int *y){int tmp;tmp=*x;*x=*y;*y=tmp;}
int rmax(int x,int y){return x>y?x:y;}
int rmin(int x,int y){return x>y?y:x;}
ll llrmax(ll x,ll y){return x>y?x:y;}
ll llrmin(ll x,ll y){return x>y?y:x;}
int asc(const void *a,const void *b){if(*(int*)a < *(int*)b)return -1;else if(*(int*)a == *(int*)b)return 0;else return 1;}
int desc(const void *a,const void *b){if(*(int*)a < *(int*)b)return 1;else if(*(int*)a == *(int*)b)return 0;else return -1;}
int llasc(const void *a,const void *b){if(*(ll*)a < *(ll*)b)return -1;else if(*(ll*)a == *(ll*)b)return 0;else return 1;}
int lldesc(const void *a,const void *b){if(*(ll*)a < *(ll*)b)return 1;else if(*(ll*)a == *(ll*)b)return 0;else return -1;}
int gcd(int x,int y){if(y==0)return x;return gcd(y,x%y);}
 
//int asc_t(const void *a,const void *b){if(((pair_t*)a)->d < ((pair_t*)b)->d)return -1;else if(((pair_t*)a)->d == ((pair_t*)b)->d)return 0;else return 1;}
//int asc_t(const void *a,const void *b){if(((pair_t*)a)->d < ((pair_t*)b)->d)return 1;else if(((pair_t*)a)->d == ((pair_t*)b)->d)return 0;else return -1;}
int main(){
    int n,l[2000];
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&l[i]);
    }
    int ans=0;
    qsort(l,n,sizeof(int),asc);
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            for(int k=j+1;k<n;k++){
                if(l[i]<l[j]+l[k]&&l[j]<l[i]+l[k]&&l[k]<l[i]+l[j]){
                    ans++;
                }else{
                    break;
                }
            }
        }
    }
    printf("%d\n",ans);
    return 0;
}

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

//press B 0 or 1 time, then press A 0 or more times, then press B 0 or 1 time

int main(){
	int x, y;
	scanf("%d%d", &x, &y);
	int ans = INT_MAX;
	//0...0
	if(x <= y) ans = std::min(ans, y - x);
	//0...1
	if(x <= -y) ans = std::min(ans, -y - x + 1);
	//1...0
	if(-x <= y) ans = std::min(ans, y + x + 1);
	//1...1
	if(-x <= -y) ans = std::min(ans, -y + x + 2);
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N,K;
    string S;
    cin >> N >> K >> S;
    if(S.at(K-1) == 'A'){
        S.at(K-1) = 'a';
    }
    else if(S.at(K-1) == 'B'){
        S.at(K-1) = 'b';
    }
    else {
        S.at(K-1) = 'c';
    }
    cout << S << endl;
} 

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

n = x[0]
m = x[1]
c = x[2]

b = list(map(int,input().split()))

a = [0]*n

for i in range(0,n):
  a[i] = list(map(int,input().split()))
#print(a,b)
cn = 0

for i in range(0,n):
  temp = 0
  for j in range(0,m):
    temp = temp + a[i][j] * b[j]
  if((c+temp)>0):
    cn = cn + 1
print(cn)

Measured memory_bytes: 62228
#include <stdio.h>
#include <string.h>
int main(){
    char str[101];
    int len;

    scanf("%s",str);
    len = strlen(str);
    char top = str[0];
    char rear = str[len-1];
    printf("%c%d%c\n",top,len-2,rear);
    return 0;
}


Measured memory_bytes: 128
#最後がどういう状態になればいいか考えればいい
s=list(input())
s=list(map(int,s))

n=len(s)
check_1=[i%2 for i in range(n)]
check_2=[(i%2+1)%2 for i in range(n)]

cnt_1=0
cnt_2=0
for i in range(n):
  if s[i]!=check_1[i]:
    cnt_1=cnt_1+1
  if s[i]!=check_2[i]:
    cnt_2=cnt_2+1
print(min(cnt_1,cnt_2))


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

const int MX = 100100;
bool inLS[MX];
vector<pair<int, int>> LS;  // [idx, val]
vector<ll> res;

signed main() {
  int N;  cin >> N;
  vector<int> A(N);
  REP(i, N) cin >> A[i];
  res.assign(N, 0);
  
  int prv = A[0];
  LS.emplace_back(-1, 0);
  LS.emplace_back(0, prv);
  inLS[0] = true;
  
  for (int i = 1; i < N; ++i) {
    if (prv < A[i]) {
      prv = A[i];
      inLS[i] = true;
      LS.emplace_back(i, A[i]);
    }
  }
  
  reverse(LS.begin(), LS.end());
  
  int cnt = 0;
  ll sum = 0;
  
  priority_queue<int> pq;
  REP(i, N) pq.emplace(A[i]);
  
  int sz = LS.size();
  REP(i, sz - 1) {
    int tcnt = 0;
    ll tsum = 0;
    int until = LS[i + 1].second;
    while (not pq.empty() and pq.top() > until) {
      ++tcnt;
      tsum += pq.top();
      pq.pop();
    }
    int idx = LS[i].first;
    res[idx] += tsum - (ll)until * tcnt;
    res[idx] += (ll)(LS[i].second - until) * cnt;
    cnt += tcnt;
    sum += tsum;
  }
  
  REP(i, N) cout << res[i] << endl;
}


Measured memory_bytes: 4084
#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 n, m; cin >> n >> m;
    vector<int> a(m);
    int sum = 0;
    rep(i, m) {
        cin >> a[i];
        sum += a[i];
    }
    if(n < sum) cout << -1;
    else {
        cout << n - sum;
    }
}


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

using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
typedef long int li;

int main()
{
    IOS;
    //freopen("fr.txt","r",stdin);
    string s,t;
    cin>>s>>t;
    string r=t+s;
    cout<<r<<endl;
    return 0;
}

Measured memory_bytes: 3624
import sys


def main():
    N, M = map(int, input().split())
    s = M // N  # 答えはs以下
    m = M % N

    for i in range(s, 0, -1):
        if m % i == 0:
            print(i)
            sys.exit()
        else:
            m += N


main()


Measured memory_bytes: 38512
//  cout << char(i+48) << endl;//なぜかaは47と得る時がある。+48で出力もaにできる。
//  cout << char(97) << endl;//アスキーコードでaを出力
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
// 10桁でdouble出力するパターン１ 
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン２
//cout << fixed << setprecision(10);
//  cout << ma << endl;

/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int n;
  cin >> n;
  vector<int>t(n+1);
  vector<int>x(n+1);
  vector<int>y(n+1);
  for(int i = 1;i<n+1;i++){
  cin >> t.at(i) >> x.at(i) >> y.at(i);
  }
  int flag=0;
  int kyori = 0;
  for(int i = 1;i<n+1;i++){
    kyori = abs(x.at(i)-x.at(i-1))+abs(y.at(i)-y.at(i-1));
    if(kyori > abs(t.at(i)-t.at(i-1))){
      flag = 1;
      break;
    }
    if(kyori%2==0&&abs(t.at(i)-t.at(i-1))%2==0 || kyori%2!=0&&abs(t.at(i)-t.at(i-1))%2!=0);
    else{
      flag = 1;
//      cout << i << endl;
      break;
    }
  }
  if(flag==1) cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
}

Measured memory_bytes: 1408
#include<iostream>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int INF = 0x3f3f3f3f;
const double pi=acos(-1),eps=1e-8;
const int maxn = 1<<17;
const int mod = 1e9+7;
ll gcd(ll a,ll b)
{
    return b?gcd(b,a%b):a;
}
int coutt[4][2]= {{0,1},{1,0},{-1,0},{0,-1}};
int a[100006];
int main()
{
    int n;
    scanf("%d",&n);
    int sum=0;
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        if(a[i]%2==1&&i%2==0)
            sum++;
    }
    printf("%d\n",sum);
    return 0;
}


Measured memory_bytes: 3812
n, m = map(int, input().split())
a = [0]*n
b = [0]*n
for i in range(n):
    a[i], b[i] = map(int, input().split())

c = [0]*m
d = [0]*m
for i in range(m):
    c[i], d[i] = map(int, input().split())

index = 0

for i in range(n):
    ans = 2 * 10 ** 16 + 1
    for j in range(m):
        cnt = abs(a[i]-c[j]) + abs(b[i]-d[j])
        if cnt < ans:
            ans = cnt
            index = j+1
    print(index)


Measured memory_bytes: 3064
/*
 * ABC097_B.cpp
 *
 *  Created on: May 21, 2018
 *      Author: 13743
 */
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<cstring>
using namespace std;
typedef long long lng;
typedef unsigned long long ulng;

#define pb push_back
#define SZ(a) int((a).size())
#define ALL(a) (a).begin(), (a).end
#define FOR(i,a,b) for(int i=(a); i<=(b); ++i)
#define FORD(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) FOR(i,0,n-1)
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())

lng power(lng b, lng e) {lng sol=1; while(e>0) {if(e&1) {sol=sol*b;} e>>=1; b*= b;} return sol;}



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

	int X;
	cin >> X;

	int ans = 1;
	int beki = 0;
	FOR(i, 2, X) {
		if(i*i > X) continue;
		beki = i;
		while(beki*i <= X) {
			beki *= i;
		}
		ans = max(ans, beki);
	}

	cout << ans << endl;
}






Measured memory_bytes: 256