akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;
 
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static final long mod=1000000007;
    
    public  static void main(String[] args)   throws Exception, IOException{
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // char c[][] = new char[h][w];
        // char c[]=sc.nextString().toCharArray();
        // int d[]=new int[n];
        // for(int i=0; i<n; i++) {d[i]=sc.nextInt();}

        int n=sc.nextInt();
        int a[]=new int[100001];
        int ans=0,even=0,odd=0;
        for(int i=0; i<n; i++) {a[sc.nextInt()]++; }

        for(int i=0; i<a.length; i++) {
            if(a[i]>0){
                if(a[i]%2==0)even++;
                ans++;
            }
        }
        if(even%2==1)ans--;
  
        out.println(ans);
        out.flush();
    }


    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }  
}

class P implements Comparable<P>{
    int id, d;
    P(int  id, int d) {
        this.id=id;
        this.d=d;
    }
    public int compareTo(P p){
        return d-p.d; //des
    }
}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}

Measured memory_bytes: 36432
import math

def slv(A, B):
    A, B = (A, B) if A > B else (B, A)
    
    s = A * B
    c = math.floor(math.sqrt(A * B))
    
    if c * (c + 1) < s:
        return 2 * c - 1
    elif A == B:
        return 2 * c - 2
    elif c * c < s:
        return 2 * c - 2
    elif c * (c - 1) < s:
        return 2 * c - 3

Q = int(input())
for q in range(Q):
    A, B = map(int, input().split())
    print(slv(A, B))

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<int> v;
  for(int i = 0; i < 4; i++){
    int x;
    cin >> x;
    v.push_back(x);
  }
  sort(v.begin(), v.end());
  if(v[0] == 1 && v[1] == 4 && v[2] == 7 && v[3] == 9)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;  
  return 0;
}

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

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define MIN(a,b) ((a)>(b)? (b): (a))
#define MAX(a,b) ((a)<(b)? (b): (a))

const long long INF = 1LL << 60;
typedef unsigned long long ll;
const long long MOD = 1000000000 + 7;

int main(){
    int a,b;
    string s;
    cin >> a >> b;
    cin >> s;
    if(s.size()!=a+b+1){
        cout << "No" << endl;
        return 0;
    }
    rep(i,s.size()){
        if(i<a){
            if(s[i]>='0'&&s[i]<='9'){
                continue;
            }else{
                cout << "No" << endl;
                return 0;
            }
        }else if(i==a){
            if(s[i]!='-'){
                cout << "No" << endl;
                return 0;
            }
        }else{
            if(s[i]>='0'&&s[i]<='9'){
                continue;
            }else{
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
object Main {
  def main(args: Array[String]): Unit = {
    val in = new java.util.Scanner(System.in)
    rec(in)
  }
  def rec(in:java.util.Scanner):Unit ={
    val a = in.nextInt
    val b = in.nextInt
    if(a == 0 & b == 0) return
    for(i <- 1 to a){
      for(j <- 1 to b){
        if(i ==1 || j == 1 || i == a || j == b){
          printf("#")
        }else{
          printf(".")
        }
      }
      println("")
    }
    println("")
    rec(in)
  }
}

Measured memory_bytes: 93700
import math as mt

a, b ,angle = list(map(int,input().split()))
degree = mt.radians(angle)

S = 0.5 * a * b * mt.sin(degree)
c = mt.sqrt((a**2 + b**2) - (2*a*b*mt.cos(degree)))
L = (a + b + c)

s = L / 2
s2 = s*(s-a)*(s-b)*(s-c)
s2 = mt.sqrt(s2)
s2 = 2 * s2  / a
print(S)
print(L)
print(s2)



Measured memory_bytes: 5708
#include<bits/stdc++.h>
using namespace std;
int main(){
  string g;
  int y,m,d;
  while(1){
    cin>>g>>y>>m>>d;
    if(g == "#") break;
    if(y>31 || (y==31 && m>=5)){
      cout<<"? "<<y-31+1<<" "<<m<<" "<<d<<endl;
    }
    else cout<<g<<" "<<y<<" "<<m<<" "<<d<<endl;
  }
  return 0;
}


Measured memory_bytes: 3152
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();
     
      long[] h = new long[n];
      for(int i = 0; i < n; i++) {
		h[i] = sc.nextLong();
      }
            
      boolean flg = true;
      for(int i = 0; i < n-1; i++) {
        if(h[i] - h[i+1] >= 2) {
          flg = false;
          break;

        } else if((h[i] - h[i+1]) == 1) {
          h[i]--;
          if(i != 0) {
            if(h[i-1] <= h[i]) {
              // 何もしない
            } else {
              flg = false;
              break;
            }
          }

        } else if ((h[i] - h[i+1]) == 0) {
          if(i != 0) {
            if(h[i-1] == h[i]) {
              // 何もしない
            } else {
              h[i]--;
            }
          } else {
            h[i]--;
          }
        } else if(h[i] - h[i+1] < 0)  {
          // 何もしない
        }
      }

      if(flg) {
        System.out.println("Yes");
      }else {
        System.out.println("No");
        
      }
    }
}


Measured memory_bytes: 50436
import sys
from collections import deque

read = sys.stdin.buffer.read


def main():
    MOD = 1000000007
    N, *AB = map(int, read().split())
    G = [[] for _ in range(N)]
    for a, b in zip(AB[::2], AB[1::2]):
        G[a - 1].append(b - 1)
        G[b - 1].append(a - 1)

    stack = deque([0])
    order = []
    prev = [0] * N
    prev[0] = -1
    while stack:
        v = stack.pop()
        order.append(v)
        for nv in G[v]:
            if nv != prev[v]:
                stack.append(nv)
                prev[nv] = v

    pow2 = [0] * (N + 1)
    pow2[0] = 1
    for i in range(N):
        pow2[i + 1] = pow2[i] * 2 % MOD

    nodes = [1] * N
    numer = 0

    for v in reversed(order):
        if prev[v] != -1:
            nodes[prev[v]] += nodes[v]
        numer = (numer + pow2[N - 1] - pow2[N - nodes[v]]) % MOD
        for nv in G[v]:
            if nv != prev[v]:
                numer = (numer - pow2[nodes[nv]] + 1) % MOD

    denom = pow2[N]
    ans = (numer * pow(denom, MOD - 2, MOD)) % MOD
    print(ans)
    return


if __name__ == '__main__':
    main()


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

#define int long long
#define double long double
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), (x).end())
#define bit(n) (1LL << (n))
#define dump(x) cerr << #x " = " << (x) << endl
using vint=vector<int>;
using vvint=vector<vint>;
using pint=pair<int, int>;
using vpint=vector<pint>;
template<typename T> using priority_queue_rev=priority_queue<T, vector<T>, greater<T>>;
constexpr double pi = 3.1415926535897932384626433832795028;
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T1, typename T2> bool chmax(T1 &a, const T2 &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> bool chmin(T1 &a, const T2 &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct Setup {
    static constexpr int PREC = 20;
    Setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int N, A, B;
int p[5500];
int dp[5500][5500];
signed main() {
    cin >> N >> A >> B;
    reps(i, N) { cin >> p[i]; }
    rep(i, 5500)rep(j, 5500) { dp[i][j] = 1e13; }
    dp[0][0] = 0;
    reps(i, N) {
        for (int j = 0; j <= N; j++) {
            if (j < p[i]) {
                // そのまま集合に入れる
                chmin(dp[i][p[i]], dp[i - 1][j]);
                // 左に移す
                chmin(dp[i][j], dp[i - 1][j] + A);
            } else {
                // 右に移す
                chmin(dp[i][j], dp[i - 1][j] + B);
            }
        }
    }
    int ans = LLONG_MAX;
    for (int i = 0; i <= N; i++) { chmin(ans, dp[N][i]); }
    cout << ans << endl;
}


Measured memory_bytes: 236672
#include <bits/stdc++.h>
 
#define fi first
#define se second
 
using namespace std;
 
typedef pair<int, int> ii;
 
int n, h[100005], dp[100005];
int main()
{
	cin >> n;
	for(int i = 1; i <= n; ++i)
		cin >> h[i];
	dp[1] = 0;
	dp[2] = abs(h[2] - h[1]);
	for(int i = 3; i <= n; ++i)
	{
		dp[i] = min(abs(h[i] - h[i - 2]) + dp[i - 2], abs(h[i] - h[i - 1]) + dp[i - 1]);
	}
	cout << dp[n];
	return 0;
}

Measured memory_bytes: 1024
A,B,C,X,Y = list(map(int,input().split()))

Zmax = max(X,Y)
Zmin = min(X,Y)
tot = 0

if A+B >= 2*C:
    if X >= Y:
        if A <= 2*C:
            tot = 2*Zmin *C + (Zmax-Zmin) * A
        else:
            tot = 2*Zmin *C + 2*(Zmax-Zmin) * C
    else:
        if B <= 2*C:
            tot = 2*Zmin *C + (Zmax-Zmin) * B
        else:
            tot = 2*Zmin *C + 2*(Zmax-Zmin) * C
else:
    tot = X*A + Y*B

print(tot)


Measured memory_bytes: 3064
class UnionFindVerSize():
    def __init__(self, N):
        self._parent = [n for n in range(0, N)]
        self._size = [1] * N
        self._edge = [0] * N

    def find_root(self, x):
        if self._parent[x] == x: return x
        self._parent[x] = self.find_root(self._parent[x])
        return self._parent[x]

    def unite(self, x, y):
        gx = self.find_root(x)
        gy = self.find_root(y)
        if gx == gy:
            self._edge[gx] += 1
            return

        if self._size[gx] < self._size[gy]:
            self._parent[gx] = gy
            self._size[gy] += self._size[gx]
            self._edge[gy] += self._edge[gx]+1
        else:
            self._parent[gy] = gx
            self._size[gx] += self._size[gy]
            self._edge[gx] += self._edge[gy]+1

    def get_size(self, x):
        return self._size[self.find_root(x)]

    def is_same_group(self, x, y):
        return self.find_root(x) == self.find_root(y)

    def calc_group_num(self):
        N = len(self._parent)
        ans = 0
        for i in range(N):
            if self.find_root(i) == i:
                ans += 1
        return ans

    def check(self,x,y):
        gx = self.find_root(x)
        gy = self.find_root(y)
        if gx==gy:
            return  self._size[gx]>=self._edge[gx]+1
        else:
            nv=self._size[gx]+self._size[gy]
            ne=self._edge[gx]+self._edge[gy]+1
            return nv>=ne

import sys

input=sys.stdin.readline

N,H,W=map(int,input().split())
card=[]
for i in range(N):
    r,c,a=map(int,input().split())
    card.append((a,r-1,c-1))

card.sort()

uf=UnionFindVerSize(H+W)
ans=0
while card:
    val,r,c=card.pop()
    if uf.check(r,H+c):
        uf.unite(r,H+c)
        ans+=val

print(ans)


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

static const int N = 100;

int main(){
  int n,p[N+1],m[N+1][N+1];
  cin >> n;
  for(int i = 1;i <= n;i++){
    cin >> p[i-1] >> p[i];
  }

  for(int i = 1; i <= n;i++)m[i][i] = 0;
  for(int l = 2; l <= n;l++){
    for(int i = 1;i <= n - l + 1;i++){
      int j = i + l - 1;
      m[i][j] = (1 << 21);
      for(int k = i;k <= j - 1;k++){
        m[i][j] = min(m[i][j], m[i][k] + m[k+1][j] + p[i-1] * p[k] * p[j]);
      }
    }
  }

  cout << m[1][n] << endl;

  return 0;
}



Measured memory_bytes: 3112
nums = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(nums[k-1])

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL, LL> PII;

// chmax, chmin
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
function<T(T, T)> op_max = [](T a, T b) -> T { return max(a, b); };
template <typename T>
function<T(T, T)> op_min = [](T a, T b) -> T { return min(a, b); };

template <typename T>
function<T(T, T)> op_sum = [](T a, T b) -> T { return a + b; };

namespace detail {
template <typename T, std::size_t NDIMS>
struct vector_builder {
  using type = std::vector<typename vector_builder<T, NDIMS - 1>::type>;

  static type make(std::vector<std::size_t> dims, const T& v = {}) {
    const auto vec = std::vector<T>(dims.empty() ? 0 : dims.back(), v);
    if (!dims.empty()) dims.pop_back();
    return vector_builder<std::vector<T>, NDIMS - 1>::make(dims, vec);
  }
};

template <typename T>
struct vector_builder<T, 1> {
  using type = std::vector<T>;

  static type make(std::vector<std::size_t> dims, const T& v = {}) {
    return type(dims.empty() ? 0 : dims.back(), v);
  }
};
}  // namespace detail

template <typename T, typename... SIZE_T>
auto exvector(const T& v, SIZE_T... dims) {
  static_assert(sizeof...(dims) != 0, "invalid dimension");
  std::vector<std::size_t> vec_dims{dims...};
  return detail::vector_builder<T, sizeof...(dims)>::make(vec_dims, v);
}

using namespace std;
//********************  dumps ************************//

template <typename T>
void dump(const T& data, vector<int>& iter) {
  cout << data << " ";
}
template <typename T>
void dump(const vector<T>& data, vector<int>& iter) {
  for (auto elem : data) dump(elem, iter);
  cout << endl;
}

template <typename T>
void dump(const vector<vector<T>>& data, vector<int>& iter) {
  for (auto elem : iter) {
    cout << "[" << elem << "]";
  }
  cout << endl;
  for (int i = 0; i < data.size(); i++) {
    iter.push_back(i);
    dump(data[i], iter);
    iter.pop_back();
  }
  cout << endl;
}

template <typename T>
void dump(const vector<T>& data, int dummy) {
  for (int i = 0; i < data.size(); i++) {
    cout << "[" << i << "] " << data[i] << endl;
  }
}
template <typename T>
void dump(const T& data) {  // T : data, U = base type val.
  vector<int> iter;
  dump(data, iter);
}
///////////////////////////////////////////////

void solve(long long X, long long Y) { cout << X + Y / 2 << endl; }

int main() {
  long long X;
  scanf("%lld", &X);
  long long Y;
  scanf("%lld", &Y);
  solve(X, Y);
  return 0;
}


Measured memory_bytes: 256
//In the Name of God
//Ya Ali

#include<bits/stdc++.h>

#define int long long

#define err(A) cout<<#A<<" = "<<(A)<<endl

using namespace std;

const int maxn=100100;

int n;

int a[maxn],b[maxn];

int ans;

int f(int x,int y)
{
  return (y-x%y)%y;
}

int32_t main()
{
  cin>>n;
  for(int i=0;i<n;i++)
    cin>>a[i]>>b[i];

  for(int i=n;i--;)
    {
      a[i]+=ans;
      ans+=f(a[i],b[i]);
    }

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
const int N=100005;
int n,k,w,a[N],ans=1e9;
int read()
{
	int r=0,f=1;
	char p=getchar();
	while(p>'9'||p<'0')
	{
		if(p=='-')
			f=-1;
		p=getchar();
	}
	while(p>='0'&&p<='9')
	{
		r=r*10+p-48;
		p=getchar();
	}
	return r*f;
}
int main()
{
	n=read(),k=read();
	for(int i=1;i<=n;i++)
	{
		a[i]=read();
		if(a[i]==1)
			w=i;
	}
	for(int i=1;i<=k;i++)
		if(w>=i&&n-w>=k-i)
			ans=min(ans,(int)(ceil((double)(w-i)/(double)(k-1))+ceil((double)(n-(w+k-i))/(double)(k-1))));
	printf("%d\n",ans+1);
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
int main(void);

int main(void){

    int i = 1;
    int x;
    
    do{
        scanf("%d", &x);
        
        if(x > 0){
            
            printf("Case %d: %d\n", i, x);
            
        }
        
        i++;
        
    }while(x != 0);

    return 0;

}


Measured memory_bytes: 2028
mod = 10**9 + 7

n, m = list(map(int, input().split()))
a = set([int(input()) for _ in range(m)])

dp = {}
for i in range(n + 1):
    dp[i] = 1
dp[1] = 0 if 1 in a else 1
for i in range(2, n + 1):
    if i in a:
        dp[i] = 0
    else:
        dp[i] = dp[i - 1] % mod + dp[i - 2] % mod
        dp[i] %= mod

print(dp[n] % mod)


Measured memory_bytes: 25228
// Last Change: 02/09/2019 21:22:21.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

void LoopUntilZeroInpput() {
  int hogegegege = 0;
  while (cin >> hogegegege && hogegegege != 0) {
  }
}

int main() {
  int town[4] = {};
  for (int i = 0; i < 3; ++i) {
    int inpA, inpB;
    cin >> inpA >> inpB;
    ++town[--inpA];
    ++town[--inpB];
  }

  bool possibility = true;
  for (int i = 0; i < 4; ++i) {
    if (town[i] > 2) {
      possibility = false;
    }
  }

  if (possibility) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }

  //LoopUntilZeroInpput();
}


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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define per(i, a, b) for(int i = (b)-1; i >= (a); --i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fst first
#define snd second

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pii> vii;

int main() {
  cin.tie(0)->sync_with_stdio(0);
  cin.exceptions(cin.failbit);

  int n, k;
  cin >> n >> k;

  vi a(n);
  rep(i,0,n) cin >> a[i];

  vvl dp(n+1, vl(k+1));
  const ll mod = 1e9+7;
  rep(i,0,a[0]+1) dp[0][i] =1LL;

  rep(i,1,n) {
    rep(j,1,k+1) {
      dp[i-1][j] += dp[i-1][j-1];
      dp[i-1][j] %= mod;
    }
    rep(j,0,k+1) {
      dp[i][j] = dp[i-1][j] - (j-a[i]-1 >= 0 ? dp[i-1][j-a[i]-1] : 0);
      dp[i][j] %= mod; dp[i][j] += mod; dp[i][j] %= mod;
    }
  }

  cout << dp[n-1][k] << '\n';
}

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

// http://www.prefield.com/algorithm/misc/dice.html
enum FACE { TOP, BOTTOM, FRONT, BACK, LEFT, RIGHT };
class dice {
public:
	dice(int top,int front,int right,int left,int back,int bottom) {
		id[TOP] = top; id[FRONT] = front; id[RIGHT] = right;
		id[LEFT] = left; id[BACK] = back; id[BOTTOM] = bottom;
	}
	int& operator[] (FACE f) { return id[f]; }
	const int& operator[] (FACE f) const { return id[f]; }
	bool operator==(const dice &b) const {
		const dice &a = *this;
		return a[TOP] == b[TOP] && a[BOTTOM] == b[BOTTOM] &&
			a[FRONT] == b[FRONT] && a[BACK] == b[BACK] &&
			 a[LEFT] == b[LEFT] && a[RIGHT] == b[RIGHT];
	}
	void roll_north() { roll(TOP, FRONT, BOTTOM, BACK); }
	void roll_south() { roll(TOP, BACK, BOTTOM, FRONT); }
	void roll_east() { roll(TOP, LEFT, BOTTOM, RIGHT); }
	void roll_west() { roll(TOP, RIGHT, BOTTOM, LEFT); }
	void roll_right() { roll(FRONT, LEFT, BACK, RIGHT); }
	void roll_left() { roll(FRONT, RIGHT, BACK, LEFT); }
	bool equivalent_to(const dice& di){
		for (int k = 0; k < 6; (k&1?roll_east():roll_north()),++k)
			for (int i = 0; i < 4; roll_right(), ++i)
				if (*this == di) return true;
		return false;
	}
private:
	void roll(FACE a, FACE b, FACE c, FACE d){
		int tmp = id[a];
		id[a] = id[b]; id[b] = id[c];
		id[c] = id[d]; id[d] = tmp;
	}
	int id[6];
};

int main(){
	int d[6];
	for(int i=0;i<6;i++)cin>>d[i];
	dice di(d[0],d[1],d[2],d[3],d[4],d[5]);
	for(int i=0;i<6;i++)cin>>d[i];
	dice di2(d[0],d[1],d[2],d[3],d[4],d[5]);
	cout<<(di.equivalent_to(di2) ? "Yes" : "No")<<endl;
}

Measured memory_bytes: 1160
def solve():
    INF = float('inf')
    P = 0
    D = 1

    Ts = input().rstrip()

    N = len(Ts)

    dp = [[-INF]*(2) for _ in range(N+1)]
    dp[0][D] = 0
    prevss = [[-1]*(2) for _ in range(N+1)]
    for i, T in enumerate(Ts, start=1):
        if T == 'P' or T == '?':
            dpP = dp[i-1][P]
            dpD = dp[i-1][D]
            if dpP >= dpD:
                dp[i][P] = dpP
                prevss[i][P] = P
            else:
                dp[i][P] = dpD
                prevss[i][P] = D
        if T == 'D' or T == '?':
            dpP = dp[i-1][P] + 2
            dpD = dp[i-1][D] + 1
            if dpP >= dpD:
                dp[i][D] = dpP
                prevss[i][D] = P
            else:
                dp[i][D] = dpD
                prevss[i][D] = D

    #for i in range(N+1):
    #    print(dp[i], Ts[i-1])

    if dp[-1][P] >= dp[-1][D]:
        j = P
    else:
        j = D
    anss = [j]
    for i in reversed(range(2, N+1)):
        j = prevss[i][j]
        anss.append(j)
    #print(anss)

    anss = ''.join(['P' if ans == P else 'D' for ans in anss[::-1]])
    print(anss)


solve()


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

using namespace std;

int main()
{
    int a[105],n,i,y[10]={0},j,x=0,s=0;
    scanf("%d",&n);
    for(i=0;i<n;i++)
        scanf("%d",&a[i]);
    for(i=0;i<n;i++)
    {
        if(a[i]>=3200) x++;
        for(j=0;j<8;j++)
            if(a[i]/400==j) y[j]=1;
    }
    for(i=0;i<8;i++)
        if(y[i]) s++;
    if(s==0)
    {
        printf("1 %d\n",x);
    }
    else
    {
        printf("%d %d\n",s,s+x);
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int N;
char str[101010];
int ss[101010];
int ssi[101010];
pair<int, int> solve(char c)
{
    ss[0] = 0;
    ssi[0] = 0;
    for(int i=1; i<=N; ++i)
    {
        if(c== str[i]) ss[i] = ss[i-1]+1;
        else ss[i] = ss[i-1]-1;
        ssi[i] = ssi[i-1];
        if(ss[i] < ss[ssi[i]])
            ssi[i] = i;
        if(i!=1 && ss[ssi[i-2]] < ss[i])
            return make_pair(ssi[i-2]+1, i);
    }
    return make_pair(-1, -1);
    
}
int main()
{
    scanf("%s", str+1);
    N = strlen(str+1);
    for(char c = 'a'; c <= 'z'; ++c)
    {
        pair<int, int> res = solve(c);
        if(res.first != -1)
        {
            printf("%d %d\n", res.first, res.second);
            return 0;
        }
    }
    puts("-1 -1");
    return 0;
}

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

int main() {
	int n, m;
	cin >> n;
	int d[n];
	for (int i = 0; i < n; ++i) {
		cin >> d[i];
	}
	cin >> m;
	int t[m];
	for (int i = 0; i < m; ++i) {
		cin >> t[i];
	}
	if (m > n) {
		cout << "NO" << endl;
		return 0;
	}
	sort (d, d + n);
	sort (t, t + m);

	int d_i = 0;
	for (int i = 0; i < m; ++i) {
		while ((i + d_i) < n && d[i + d_i] < t[i]) {
			++d_i;
		}
		if ((i + d_i) >= n) {
			cout << "NO" << endl;
			return 0;
		}
		if (d[i + d_i] != t[i]) {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<cstring>

using namespace std;

int main(void) {
	int num;
	int map[9][9], check[10];
	bool mapb[9][9];
	int i, j, k;

	cin >> num;

	for(i = 0; i < num; i++) {
		for(j = 0; j < 9; j++) {
			for(k = 0; k < 9; k++) {
				cin >> map[j][k];
				mapb[j][k] = false;
			}
		}

		for(j = 0; j < 9; j++) {
			memset(check, 0, sizeof(check));
			for(k = 0; k < 9; k++) {
				check[map[j][k]]++;
			}
			for(k = 0; k < 9; k++) {
				if(check[map[j][k]] >= 2) { mapb[j][k] = true; }
			}
		}

		for(j = 0; j < 9; j++) {
			memset(check, 0, sizeof(check));
			for(k = 0; k < 9; k++) {
				check[map[k][j]]++;
			}
			for(k = 0; k < 9; k++) {
				if(check[map[k][j]] >= 2) { mapb[k][j] = true; }
			}
		}

		for(j = 0; j < 9; j++) {
			memset(check, 0, sizeof(check));
			for(k = 0; k < 9; k++) {
				check[map[k/3+(j/3)*3][k%3+(j%3)*3]]++;
			}
			for(k = 0; k < 9; k++) {
				if(check[map[k/3+(j/3)*3][k%3+(j%3)*3]] >= 2) { mapb[k/3+(j/3)*3][k%3+(j%3)*3] = true; }
			}
		}

		for(j = 0; j < 9; j++) {
			for(k = 0; k < 9; k++) {
				cout << (mapb[j][k]?"*":" ") << map[j][k];
			}
			cout << endl;
		}

		if(i+1 < num) { cout << endl; }
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <cstring>
#include <climits>
using namespace std;

int main() {
    int64_t x;
    cin >> x;
    int64_t q = x / 11;
    int64_t r = x % 11;
    q *= 2;
    if (r > 0) q += 1;
    if (r > 6) q += 1;
    cout << q << endl;
    return 0;
}


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

char ss[10];
int main(){
        scanf("%s", ss);
       if(ss[2]==ss[3]&&ss[4]==ss[5])
            printf("Yes\n");
       else
           printf("No\n");
       return 0;

 }


Measured memory_bytes: 256
import sys

read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines


#mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
#import numpy as np


def main():
	n,k=map(int,input().split())
	
	cnt0=max(n//k,0)
	cnt2=max((n-k//2)//k+1,0)
	
	#print(cnt0,cnt2)
	
	if k%2:
		ans=cnt0**3
	else:
		ans=cnt0**3+cnt2**3
	
	print(ans)
	
	

if __name__ == "__main__":
	main()


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <string>
using namespace std;
typedef vector<bool> VB;
#define MAXS 8000

int main() {
  string s; cin >> s;
  int x, y; cin >> x >> y;
  x += MAXS;
  y += MAXS;

  vector<int> vx, vy;
  int count = 0;
  bool flag = true;
  for (char c : s) {
    if (c == 'T') {
      if (flag) vx.push_back(count);
      else vy.push_back(count);
      count = 0;
      flag = !flag;
    }
    else count++;
  }
  if (flag) vx.push_back(count);
  else vy.push_back(count);

  vector<VB> dp(vx.size(), VB(MAXS*2+1));
  dp[0][MAXS+vx[0]] = true;
  for (int i = 1; i < vx.size(); i++) {
    for (int j = 0; j <= MAXS*2; j++) {
      if (dp[i-1][j]) {
        dp[i][j-vx[i]] = true;
        dp[i][j+vx[i]] = true;
      }
    }
  }
  if (!dp[vx.size()-1][x]) {
    cout << "No" << endl;
    return 0;
  }

  if (vy.empty()) {
    cout << (y == MAXS ? "Yes" : "No") << endl;
    return 0;
  }
  dp.assign(vy.size(), VB(MAXS*2+1));
  dp[0][MAXS-vy[0]] = true;
  dp[0][MAXS+vy[0]] = true;
  for (int i = 1; i < vy.size(); i++) {
    for (int j = 0; j <= MAXS*2; j++) {
      if (dp[i-1][j]) {
        dp[i][j-vy[i]] = true;
        dp[i][j+vy[i]] = true;
      }
    }
  }
  cout << (dp[vy.size()-1][y] ? "Yes" : "No") << endl;
}

Measured memory_bytes: 8192
#include <iostream>
using namespace std;
int main() {
    int n;
    int a, b, c;
    cin >> n;
    a = n / 100;
    b = (n - a * 100) / 10;
    c = n - a * 100 - b * 10;
    if (a == 7 || b == 7 || c == 7) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3636
N,K = map(int,input().split())
p = list(map(int,input().split()))
lis = [0]*N
for i in range(N):
    if p[i]%2 == 1:
        lis[i] = p[i]//2+1
    else:
        lis[i] = (p[i]+1)/2
ans = sum(lis[:K])
temp = sum(lis[:K])
for j in range(N-K):
    temp -= lis[j]
    temp += lis[j+K]
    if temp > ans:
        ans = temp
print(ans)

Measured memory_bytes: 25060
// Contest: AtCoder Beginner Contest 159 (https://atcoder.jp/contests/abc159)
// Problem: C: Maximum Volume (https://atcoder.jp/contests/abc159/tasks/abc159_c)


// region {{{ boilerplate
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <chrono>
#include <cstdint>
#include <deque>
#include <exception>
#include <forward_list>
#include <functional>
#include <initializer_list>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#if __cplusplus >= 201703L
#   include <optional>
#   include <string_view>
#   include <variant>
#endif

using namespace std;

#if __cplusplus >= 201703L
#   define all(a)      begin(a),end(a)
#   define sz(x)       ((int)size(x))
#else
#   define all(a)      (a).begin(),(a).end()
#   define sz(x)       ((int)(x).size())
#endif

#define rep(a, b)      for(int a = 0; a < (b); ++a)
#define reps(a, b, c)  for(int a = (b); a < (c); ++a)
#define trav(a, b)     for(auto& a : b)

using ll = long long;
using ld = long double;
using u64 = uint64_t;
using u32 = uint32_t;

using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vpi = vector<pi>;

#if __cplusplus >= 201703L
#   define MAYBE_UNUSED [[maybe_unused]]
#else
#   define MAYBE_UNUSED
#endif

MAYBE_UNUSED static constexpr int INF = (int)1e9 + 5;
MAYBE_UNUSED static constexpr ll INFL = (ll)1e18 + 5;
MAYBE_UNUSED static mt19937 rng((u32)chrono::duration_cast<chrono::nanoseconds>(chrono::high_resolution_clock::now().time_since_epoch()).count());
//endregion }}}

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

    double l; cin >> l;
    l /= 3;
    cout.precision(20);
    cout << (l * l * l) << '\n';

    return 0;
}

Measured memory_bytes: 256
N,D=map(x->parse(Int,x),split(readline()))
X=[map(x->parse(Int,x),split(s)) for s=readlines()]
ans=0
for i=1:N,j=i+1:N
	now=sum((X[i][k]-X[j][k])^2 for k=1:D)
	if isqrt(now)^2==now
		ans+=1
	end
end
println(ans)


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

int main()
{
    int n,d;
    
    cin>>d>>n;
    
    if(d==0)
     { if(n==100)
         {cout<<101;return 0;}
         cout<<n;
     }
    else if(d==1)
    {
     if(n==100)
         {cout<<10100;return 0;}
      cout<<(n*100);
    }
    else if(d==2)
     {
       if(n==100)
         {cout<<1010000;return 0;}
         cout<<(n*10000);
     }
    else
     ;
     
     return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define PN cout << endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (n-1); i >= (int)(m); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - (a)) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - (a)) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return


ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }


/*
vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}
*/

/*
ll ncr[100][100];
ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

ll npr[100][100]={};
ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

ll nHr(int n,int r){ret nCr(n+r-1,r);}
*/

///////////////////////////////////////////////////////////////////////////

int main(){
    ll n,k;
    cin >> k >> n;
    ll a[n+1];

    inrep(n,a);

    a[n] = a[0] + k;

    ll ans = 0;
    rep(i,0,n)ans = max(ans,a[i+1] - a[i]);

    P(k - ans);
    return  0;
}


Measured memory_bytes: 1792
n, k = map(int, input().split())
a = [i for i in range(n+1)]
mod = 10**9+7
ans = 0
for i in range(k, n+2):
  L = i * (i - 1) / 2
  R = n * i - i * (i - 1) / 2
  ans += R - L + 1
  ans %= mod
print(int(ans))

Measured memory_bytes: 17040
// https://atcoder.jp/contests/sumitrust2019/tasks/sumitb2019_b

#include "algorithm"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define fi first
#define se second
using namespace std;
typedef long long ll;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

void solve() {
  ll N;
  cin >> N;

  rep(num, N + 1) {
    double taxed = num * 1.08;
    if (floor(taxed) == N) drop(num);
  }

  drop(":(");
}

void solve2() {
  ll N;
  cin >> N;

  ll cand1 = floor(N / 1.08);
  ll cand2 = floor((N + 1) / 1.08);

  if (cand1 + cand1 * 8 / 100 == N) drop(cand1);
  if (cand2 + cand2 * 8 / 100 == N) drop(cand2);
  drop(":(");
}

void solve3() {
  ll N;
  cin >> N;

  double l = N / 1.08;
  double h = (N + 1) / 1.08;

  // l <= X < h なる整数があるか

  // l が整数か
  if (floor(l) == ceil(l)) drop(floor(l));

  // l < X < h かつ X != h か
  if (floor(l) != floor(h) && floor(h) != ceil(h)) {
    drop(floor(h));
  }

  drop(":(");
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve3();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
long long MOD = 1e9 + 7;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef boost::multiprecision::cpp_int bigint;

ll N, M;
vector<ll> used = { 0,2,5,5,4,5,6,3,7,6 };
vector<bigint> DP;
vector<ll> nums;

int main() {
	cin >> N >> M;
	nums.resize(M);
	for (ll m = 0; m < M; m++)cin >> nums[m];
	DP.resize(N + 1, -1);
	DP[0] = 0;
	for (ll n = 1; n <= N; n++) {
		for (ll m = 0; m < M; m++) {
			if (n < used[nums[m]])continue;
			if(DP[n] < 10 * DP[n - used[nums[m]]] + nums[m]){
            	DP[n] = 10 * DP[n - used[nums[m]]] + nums[m];
			}
		}
	}
	cout << DP[N] << endl;
	return 0;
}

Measured memory_bytes: 14720
#include<iostream>

using namespace std;

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

    bool can = false;
    if(a == 5 && b == 5 && c == 7) can = true;
    else if(a == 7 && b == 5 && c == 5) can = true;
    else if(a == 5 && b == 7 && c == 5) can = true;
    
    if(can) cout << "YES" << endl;
    else cout << "NO" << endl;
    
    return 0;
}

Measured memory_bytes: 256
// Copyright 2017 wu_qing
#include <cstdio>
#include <utility>
const int N = 2e3 + 10;
int n, m, q, p[N][N], p1[N][N], p2[N][N], x1, x2, y1, y2, t1, t2, t3, cur;
char c[N];
bool b[N][N], c1[N][N], c2[N][N];
int main() {
    scanf("%d%d%d", &n, &m, &q);
    for (int i = 1; i <= n; i++) {
        scanf("%s", c + 1);
        for (int j = 1; j <= m; j++)
            b[i][j] = c[j] == '1';
    }
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++)
            p[i][j] = p[i - 1][j] + p[i][j - 1] - p[i - 1][j - 1] + b[i][j];
    for (int i = 1; i <= n; i++)
        for (int j = 1; j < m; j++)
            if (b[i][j] && b[i][j + 1])
                c1[i][j] = true;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j < m; j++)
            p1[i][j] = p1[i - 1][j] + p1[i][j - 1] - p1[i - 1][j - 1] +
                c1[i][j];
    for (int j = 1; j <= m; j++)
        for (int i = 1; i < n; i++)
            if (b[i][j] && b[i + 1][j])
                c2[i][j] = true;
    for (int j = 1; j <= m; j++)
        for (int i = 1; i < n; i++)
            p2[i][j] = p2[i - 1][j] + p2[i][j - 1] -p2[i - 1][j - 1] +
                c2[i][j];
    for (int i = 1; i <= q; i++) {
        scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
        if (x1 > x2) std::swap(x1, x2);
        if (y1 > y2) std::swap(y1, y2);
        t1 = p[x2][y2] - p[x1 - 1][y2] - p[x2][y1 - 1] + p[x1 - 1][y1 - 1];
        t2 = p1[x2][y2 - 1] - p1[x1 - 1][y2 - 1] - p1[x2][y1 - 1] +
            p1[x1 - 1][y1 - 1];
        t3 = p2[x2 - 1][y2] - p2[x1 - 1][y2] - p2[x2 - 1][y1 - 1] +
            p2[x1 - 1][y1 - 1];
        printf("%d\n", t1 - t2 - t3);
    }
    return 0;
}


Measured memory_bytes: 60672
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<functional>
#include<stack>
#include<queue>
#include <iomanip>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

#define DBG cerr << '!' << endl;
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(int (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(int (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(10)

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;


int main()
{
	string str;cin >> str;
	
	cout << str[0] << str.size()-2 << str[str.size()-1] << endl;
	
	return 0;
}

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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		memo = new long[87];
		Console.WriteLine(luca(N));
	}
	long[] memo;
	
	long luca(int n){
		if(n == 0) return memo[n] = 2;
		if(n == 1) return memo[n] = 1;
		if(memo[n] != 0) return memo[n];
		return memo[n] = luca(n-1) + luca(n-2);
	}
	
	int N;
	public Sol(){
		N = ri();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 13140
#define _USE_MATH_DEFINES
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <functional>

/*
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };
*/

using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    if(n%k==0)
        cout << 0;
    else
        cout << 1;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;

int main() 
{
	int a;
	string s;
	cin >> a >> s;

	if (a >= 3200)
	{
		cout << s << endl;
	}
	else if (a < 3200)
	{
		cout << "red"<< endl;
	}


}

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

int main(void) {
  int N;
  cin >> N;
  string S = "";
  while (N != 0) {
    int mod = N % 2;
    if (mod) {
      N--;
      S = "1" + S;
    } else
      S = "0" + S;
    N /= -2;
  }
  if (S == "")
    S = "0";
  cout << S << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  
  int n,old[7],in;


  while(1){
    
    for(int i=0 ; i < 7 ; i++)old[i]=0;
    
    cin >>n;
    
    if(n == 0)break;
    
    
    for(int i=0 ; i < n ; i++){
      cin >>in;
      
      if(in >= 0 && in <= 9){
	old[0]++;
      }else if(in >= 10 && in <=19){
	old[1]++;
      }else if(in >= 20 && in <=29){
	old[2]++;
      }else if(in >= 30 && in <=39){
      old[3]++;		   
      }else if(in >= 40 && in <=49){
	old[4]++;
      }else if(in >= 50 && in <=59){
	old[5]++;
      }else{
	old[6]++;
      }
      
    }
    
    for(int i=0 ; i < 7 ; i++){
      cout <<old[i]<<endl;
    }
    
  }
  
  return 0;
}

Measured memory_bytes: 1160
#include <iostream>

using namespace std;

int C[501] = {0};
int S[501] = {0};
int F[501] = {0};

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

  int N;
  cin >> N;
  for (int i = 0; i < N; ++i) cin >> C[i] >> S[i] >> F[i];

  for (int i = 0; i < N; ++i) {
    int t = S[i] + C[i];
    for (int j = i + 1; j < N - 1; ++j) {
      if (t <= S[j]) {
        t = S[j] + C[j];
      } else {
        const int r = (t - S[j]) % F[j];
        const int n = r == 0 ? t : t - r + F[j];
        t = n + C[j];
      }
    }
    cout << t << endl;
  }

  return 0;
}


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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define IMP cout << "IMPOSSIBLE" << endl
#define Imp cout << "Impossible" << endl
#define imp cout << "impossible" << endl
#define M1 cout << "-1" << endl
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

template <typename T>
ostream &operator<<(ostream &os, vector<T> &v)
{
    os << "{";
    rep(i, v.size()) os << v[i] << (i == (int)v.size() - 1 ? "" : ", ");
    os << "}";
    return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &p)
{
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}
template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }
struct in
{
    const size_t n = 0;
    in() = default;
    in(size_t n) : n(n){};
    template <typename T>
    operator T()
    {
        T ret;
        cin >> ret;
        return ret;
    }
    template <typename T>
    operator vector<T>()
    {
        assert(n != 0);
        vector<T> ret(n);
        for (auto &x : ret)
            cin >> x;
        return ret;
    }
};

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using vpint = vector<pint>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main()
{
    vint a = in(3);
    sort(ALL(a));
    if ((a[0] == a[1] && a[1] != a[2]) || (a[0] != a[1] && a[1] == a[2]))
        Yes;
    else
        No;
}

signed main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
typedef pair<int,int> P;

int main() {
  int n,m;
  cin >> n >> m;
  map<int,int> ma;
  for(int i=0; i<m; i++) {
    int x,y;
    cin >> x >> y;
    if(ma.count(y)) ma[y]=min(ma[y],x);
    else ma[y]=x;
  }
  ma[0]=0;
  vector<P> a;
  for(map<int,int>::iterator it=ma.begin(); it!=ma.end(); it++) {
    a.push_back(P(it->F,it->S));
  }
  m=a.size();
  sort(a.begin(),a.end());
  int d[m+1];
  fill(d,d+m+1,100000);
  d[0]=0;
  for(int i=1; i<m; i++) {
    int M=a[i].S;
    for(int j=i-1; j>=0; j--) {
      d[i]=min(d[i],d[j]+(a[i].F-a[j].F)+(a[i].F-M)*2);
      M=min(M,a[j].S);
    }
  }
  int ans=n-a[m-1].F+d[m-1]+1;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1228
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <limits>
#include <climits>
#include <utility>
#include <algorithm>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

int digits(int x)
{
    int res = 0;
    while (x) {
        res++;
        x /= 10;
    }

    return res;
}

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

    ll ans = 0;
    for (int i = 1; i <= N; ++i) {
        if (digits(i) % 2 != 0) {
            ++ans;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 888