akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000000000000

typedef long long LL;
typedef long double LD;

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

  vector<int> fact(n+1);
  fact[0]=1;
  for(int i=1;i<=n;i++) fact[i]=fact[i-1]*i;

  vector<int> diff(1<<n,0),num(1<<n,0);
  for(int i=0;i<(1<<n);i++){
    for(int j=0;j<n;j++){
      if(i&(1<<j)){
        diff[i]+=fact[n-j-1];
        num[i]++;
      }
    }
  }

  vector<int> a(n),b(n);
  for(int i=0;i<n;i++) cin >> a[i];

  int start=0;
  int count;
  for(int i=1;i<n;i++){
    count=0;
    for(int j=0;j<n;j++){
      if(a[j]==i){
        start+=count*fact[n-i];
        break;
      }else if(a[j]>i){
        count++;
      }
    }
  }

  vector<int> dist(fact[n],-1);
  dist[start]=0;
  queue<int> bfs;
  bfs.push(start);
  int now,next,nt,dbg;
  while(!bfs.empty()){
    now=nt=bfs.front();
    bfs.pop();
    for(int i=0;i<n;i++) a[i]=-1;
    for(int i=0;i<n;i++){
      count=nt/fact[n-i-1];
      nt-=count*fact[n-i-1];
      for(int j=0;j<n;j++){
        if(a[j]<0){
          if(count==0){
            a[j]=i;
            break;
          }
          count--;
        }
      }
    }
    for(int i=1;i<n-1;i++){
      count=(1<<a[i]);
      next=now;
      for(int j=1;j<=min(i,n-i-1);j++){
        count+=(1<<a[i+j])+(1<<a[i-j]);
        next+=num[count&((1<<n)-(1<<(a[i-j]+1)))]*fact[n-a[i-j]-1]-num[count&((1<<n)-(1<<(a[i+j]+1)))]*fact[n-a[i+j]-1];
        if(a[i+j]>a[i-j]){
          next+=diff[count&((1<<a[i+j])-(1<<(a[i-j]+1)))];
        }else{
          next-=diff[count&((1<<a[i-j])-(1<<(a[i+j]+1)))];
        }
        if(dist[next]==-1){
          dist[next]=dist[now]+1;
          bfs.push(next);
        }
      }
    }
    for(int i=1;i<n;i++){
      count=0;
      next=now;
      for(int j=1;j<=min(i,n-i);j++){
        count+=(1<<a[i+j-1])+(1<<a[i-j]);
        next+=num[count&((1<<n)-(1<<(a[i-j]+1)))]*fact[n-a[i-j]-1]-num[count&((1<<n)-(1<<(a[i+j-1]+1)))]*fact[n-a[i+j-1]-1];
        if(a[i+j-1]>a[i-j]){
          next+=diff[count&((1<<a[i+j-1])-(1<<(a[i-j]+1)))];
        }else{
          next-=diff[count&((1<<a[i-j])-(1<<(a[i+j-1]+1)))];
        }
        if(dist[next]==-1){
          dist[next]=dist[now]+1;
          bfs.push(next);
        }
      }
    }
    if(dist[0]!=-1){
      cout << dist[0] << endl;
      return 0;
    }
  }
  return 0;
}



Measured memory_bytes: 24300
s = input()
s1 = s.replace('x', '')

if s1 != s1[::-1]:
    print(-1)
else:
    li = [0] * (len(s1) + 1)
    cnt = 0
    ans = 0
    for i in range(len(s)):
        if s[i] == 'x':
            li[cnt] += 1
        else:
            cnt += 1

    for i in range((len(s1)+1) // 2):
        a = li[i]
        b = li[-i-1]
        ans += abs(a-b)

    print(ans)


Measured memory_bytes: 9856
n,ma,mb=map(int,raw_input().split())
abc=[map(int,raw_input().split()) for  _ in xrange(n)]
dp=[[[10**5]*(n*10+1) for _ in xrange(n*10+1)] for _ in xrange(n+1)]
for i in xrange(n):
    dp[i][0][0]=0
for i in xrange(n):
    for j in range(n*10+1):
        for k in xrange(n*10+1):
            a,b,c=abc[i][0],abc[i][1],abc[i][2]
            if j-a<0 or k-b<0:
                dp[i+1][j][k]=min(dp[i+1][j][k],dp[i][j][k])
            else:
                dp[i+1][j][k]=min(dp[i][j][k],dp[i+1][j][k],dp[i][j-a][k-b]+c)
i=1
ans=10**5
while ma*i<=n*10 and mb*i<=n*10:
    if dp[n][ma*i][mb*i]!=10**5:
        ans=min(ans,dp[n][ma*i][mb*i])
    i+=1
if ans==10**5:
    print(-1)
else:
    print(ans)


Measured memory_bytes: 86300
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef vector<double> Vec;
typedef vector<Vec> Mat;
typedef pair<ll,ll> P;
typedef pair<double,ll> Pd;
typedef pair<double,double> PD;
typedef priority_queue<P,vector<P>,greater<P> > P_queue;
typedef priority_queue<Pd,vector<Pd>,greater<Pd> > Pd_queue;

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e15;
const double DEL=1e-6;


#define REP(i,a,b) for(int i=(int)a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());
#define ADD(a,b) a=(a+b)%mod
#define MUL(a,b) a=(a*b)%mod

int main(){
    ll N; cin>>N;
    vec d(N);
    rep(i,N) cin>>d[i];
    ll ans=0;
    rep(i,N) if(!(i%2)) if(d[i]%2) ans++;
    cout<<ans<<endl;
}

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

using namespace std;
#define sz(a) (int)a.size()
#define int int64_t
const int MAXN = 1e5 + 1;
template<typename T1, typename T2>
ostream &operator<<(ostream &out, pair<T1, T2> &p) {
     out << "{" << p.first << ", " << p.second << "} ";//optional
     return out;
}

template<typename T1, typename T2>
istream &operator>>(istream &in, pair<T1, T2> &p) {
     in >> p.first >> p.second;
     return in;
}

template<typename T>
istream &operator>>(istream &in, vector<T> &arr) {
     for (auto &i : arr)
          in >> i;
     return in;
}

template<typename T>
ostream &operator<<(ostream &out, vector<T> &arr) {
     for (int i = 0; i < (int)arr.size(); ++i) {
          if (i != 0) {
               out << ' ';
          }
          out << arr[i];//optional
     }
     out << endl;
     return out;
}

int a[MAXN];
int sumk[MAXN], sumb[MAXN];

void add(int fr, int to, int dk, int db) {
     sumk[fr]+= dk;
     sumk[to + 1]-= dk;
     sumb[fr] += db;
     sumb[to + 1] -= db;
}

signed main() {
     int n, m;
     int tot = 0;
     cin >> n >> m;
     for (int i = 1; i <= n; ++i) {
          cin >> a[i];
     }
     for (int i = 2; i <= n; ++i) {
          int fr = a[i - 1];
          int to = a[i];
          int len = (to - fr + m) % m;
          tot += len;
          if (len <= 1) {
               continue;
          }
          fr++;
          if (fr == m + 1) {
               fr = 1;
          }
          if (to >= fr) {
               add(fr, to, 1, -fr);
          } else {
               add(fr, m, 1, -fr);
               add(1, to, 1, m - fr);
          }
     }
     int mx = 0;
     for (int i = 1; i <= m; ++i) {
          sumk[i] += sumk[i - 1];
          sumb[i] += sumb[i - 1];
          mx = max(mx, sumk[i] * i + sumb[i]);
     }
     cout << tot - mx << endl;
     return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (long long i = 0; i < n; i++)
#define RREP(i, n) for (long long i = n - 1; 0 <= i; i--)
#define FOR(i, start, end) for (long long i = start; i < end; i++)
#define RFOR(i, start, end) for (long long i = start - 1; 0 <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
using ll = long long;
using namespace std;
const int INF32       = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7        = 1'000'000'007;
const int MOD9        = 1'000'000'009;
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}

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

    ll N;
    cin >> N;
    vector<ll> a(N);
    for (auto &&i : a) {
        cin >> i;
    }

    ll ans   = 1;
    bool now = a[0] <= a[1] ? true : false;
    FOR(i, 1, N - 1) {
        if (a[i] == a[i + 1])
            continue;
        if (a[i] < a[i + 1] && !now) {
            ans++;
            int nxt = i + 1;
            if (i + 2 < N) {
                now = a[i + 1] <= a[i + 2] ? true : false;
            }
            while (nxt + 2 < N && a[nxt] == a[nxt + 1]) {
                nxt++;
                now = a[nxt] <= a[nxt + 1] ? true : false;
            }

        } else if (a[i + 1] < a[i] && now) {
            ans++;
            int nxt = i + 1;
            if (i + 2 < N) {
                now = a[i + 1] <= a[i + 2] ? true : false;
            }
            while (nxt + 2 < N && a[nxt] == a[nxt + 1]) {
                nxt++;
                now = a[nxt] <= a[nxt + 1] ? true : false;
            }
        }
    }
    print(ans);

    return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<algorithm>
using namespace std;
int perm[11];
int g[11][11];
int d[11];
int v[11];
int ret;
int n;
void solve(int a){
	if(a==n){ret=d[n-1];return;}
	for(int i=0;i<n;i++){
		if(v[i])continue;
		int at=0;
		for(int j=0;j<a;j++)at=max(at,d[j]+g[i][perm[j]]);
		if(at<ret){
			v[i]=1;
			perm[a]=i;
			d[a]=at;
			solve(a+1);
			v[i]=0;
		}
	}
}
int main(){
	int a;
	while(scanf("%d",&a),a){
		n=a;
		for(int i=0;i<a;i++){
			for(int j=0;j<a;j++){
				scanf("%d",&g[i][j]);
			}
		}
		for(int i=0;i<a;i++)for(int j=i+1;j<a;j++){
			g[i][j]=g[j][i]=max(g[i][j],g[j][i]);
		}
		for(int i=0;i<a;i++)perm[i]=i;
		ret=999999999;
		for(int i=0;i<a;i++)v[i]=0;
		solve(0);
		printf("%d\n",ret);
	}
}

Measured memory_bytes: 1012
import sys
N=int(input())
S=input()
L=list()
m=S[-1]
L.append(S)
for i in range(N-1):
  S=input()
  if S[0]!=m:
    print("No")
    sys.exit()
  else:
    L.append(S)
    m=S[-1]
if len(set(L))==N:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 62380
#include<cstdio>
#include<algorithm>
#define MN 5101
using namespace std;

int read_p,read_ca;
inline int read(){
    read_p=0;read_ca=getchar();
    while(read_ca<'0'||read_ca>'9') read_ca=getchar();
    while(read_ca>='0'&&read_ca<='9') read_p=read_p*10+read_ca-48,read_ca=getchar();
    return read_p;
}
int n,K,a[MN],b[MN],c[MN],MMH=0,mmh;
int main(){
	register int i,j;
	n=read();K=read();b[0]=1;
	for (i=1;i<=n;i++) if ((a[i]=read())>=K) n--,i--;else
	for (j=K-a[i];j>=0;j--) b[j+a[i]]+=b[j];
	
	for (i=1;i<=n;i++,MMH+=mmh){
		mmh=1;
		for (j=0;j<K;j++)
		if (j>=a[i]) c[j]=b[j]-c[j-a[i]];else c[j]=b[j];
		for (j=K-a[i];j<K;j++) if (c[j]) mmh=0;
	}
	printf("%d\n",MMH);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int M, N;
int K[110];
int s[110][110], t[110][110];
string cond[110][110];
vector<int> G[110];
int indeg[110];

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> M >> N;
  for (int i = 0; i < M; i++) {
    cin >> K[i];
    for (int j = 0; j < K[i]; j++) {
      cin >> s[i][j] >> cond[i][j] >> t[i][j];
    }
  }  
  bool no = false;
  for (int i = 0; i < M; i++) {
    for (int j = 0; j < K[i]; j++) {
      for (int k = 0; k < K[i]; k++) {
        if (s[i][j] != s[i][k] || cond[i][j] == cond[i][k]) {
          continue;
        }
        if (cond[i][j] == ">=") {
          no |= t[i][j] > t[i][k];
        } else {
          no |= t[i][j] < t[i][k];
        }
      }
    }
  }
  if (no) {
    cout << "No" << endl;
    return 0;
  }
  for (int i = 0; i < M; i++) {
    for (int j = 0; j < M; j++) {
      if (i == j) continue;
      for (int k = 0; k < K[i]; k++) {
        for (int l = 0; l < K[j]; l++) {
          if (s[i][k] != s[j][l] || cond[i][k] == cond[j][l]) {
            continue;
          }
          if (cond[i][k] == "<=" && t[i][k] < t[j][l]) {
            G[i].emplace_back(j);
            indeg[j]++;
          }
        }
      }
    }
  }
  stack<int> st;
  for (int i = 0; i < M; i++) {
    if (!indeg[i]) st.emplace(i);
  }
  map<int, int> mp;
  while (!st.empty()) {
    int cur = st.top();
    st.pop();
    mp[cur]++;
    for (int nxt : G[cur]) {
      if (--indeg[nxt]) continue;
      st.emplace(nxt);
    }
  }
  cout << (mp.size() == M ? "Yes" : "No") << endl;

  return 0;
}


Measured memory_bytes: 4532
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    int H1,M1,H2,M2,K;
    cin >> H1 >> M1 >> H2 >> M2 >> K;
    int len = 0;
    len += M2;
    if (M1 == 0) len += (H2 - H1) * 60;
    else{
        len += (H2 - H1) * 60;
        len -= M1;
    }
    cout << len - K << endl;
}



Measured memory_bytes: 3624
#include<iostream>
#include<vector>
#include <algorithm>
#include <string>
#include <utility>
#include <set>
#include <map>
#include<cmath>
#include <queue>
#include <numeric>
#include <cassert>

using lli = long long int;
int inf = 1000000007;
using namespace std;

vector<lli> in_vec(int n) {
	vector<lli> vec(n);
	for (int i = 0; i < n; i++)cin >> vec[i];
	return vec;
}

void solve()
{
	int A, B, C;
	cin >> A >> B >> C;
	if ((A == 5 && B == 5 && C == 7) ||
		(A == 5 && B == 7 && C == 5) ||
		(A == 7 && B == 5 && C == 5))cout << "YES" << endl;
	else cout << "NO" << endl;
}

int main()
{
	solve();
	return 0;
}

Measured memory_bytes: 256
N = int(input())
if N == 2:
    print(1)
    import sys
    sys.exit()
if N == 3:
    print(3)
    import sys
    sys.exit()


s = 0
m = N//2 if N%2 == 0 else N//2 + 1
for n in range(1, m):
    s += (N//n if N%n != 0 else N//n - 1)

print(s+N//2)

Measured memory_bytes: 9224
from collections import deque

H, W = map(int, input().split())
A = []
D = [[-1 for _ in range(W)] for _ in range(H)]
q = deque([])
for i in range(H):
    S = input()
    for j in range(W):
        if S[j] == "#":
            q.append((i, j))
            D[i][j] = 0
    A.append(S)

while q:
    pos = q.popleft()
    py, px = pos[0], pos[1]
    for (y, x) in [(0, -1), (0, 1), (-1, 0), (1, 0)]:
        ny = py + y
        nx = px + x
        if nx < 0 or W <= nx or ny < 0 or H <= ny:
            continue
        if D[ny][nx] < 0:
            D[ny][nx] = D[py][px] + 1
            q.append((ny, nx))

ans = 0
for i in range(H):
    for j in range(W):
        ans = max(ans, D[i][j])
print(ans)


Measured memory_bytes: 89820
#include<bits/stdc++.h>
using namespace std;
constexpr int64_t mod=1e9+7;
vector<bool> field;
bool dfs(int src, int dst){
  if(src==dst) return true;
  if(field[src]==false || field[dst]==false) return false;
  for (int i = 1; i <= 2; ++i)
  {
    if(field[src+i] && dfs(src+i,dst)){
      return true;
    }
  }
  return false;
}

int main()
{
  int n,a,b,c,d;
  cin>>n>>a>>b>>c>>d;
  string s;
  cin>>s;
  field=vector<bool>(n,true);
  for (int i = 0; i < n; ++i)
  {
    if(s[i]=='#') field[i]=false;
  }
  if(c<d){
    if(dfs(b-1,d-1) && dfs(a-1,c-1)){
      cout<<"Yes";
      return 0;
    }
    cout<<"No";
    return 0;
  }
  for (int i = b-1; i < d-2; ++i)
  {
    if(field[i] && field[i+1] && field[i+2])
    {
      if(!dfs(b-1,i+1)) continue;
      field[i+1]=false;
      if(dfs(a-1,c-1))
      {
        field[i+1]=true;
        if(dfs(i+1,d-1))
        {
          cout<<"Yes";
          return 0;
        }
      }
      field[i+1]=true;
    }
  }
  
  field[b-1]=false;
  if(dfs(a-1,c-1)){
    field[b-1]=true;
    if(dfs(b-1,d-1)){
      cout<<"Yes";
      return 0;
    }
  }
  field[b-1]=true;

  if(dfs(b-1,d-1)){
    field[d-1]=false;
    if(dfs(a-1,c-1)){
      cout<<"Yes";
      return 0;
    }
  }

  cout<<"No";
}

Measured memory_bytes: 7812
import itertools

# input
H, W, K = map(int,input().split())  #Hは縦軸, Wは横軸
init_map = []
for i in range(H):
    row = list(input())  #行を入力
    init_map.append(row) #inital_mapに1行ずつ追加
ans = 0

for paint_h in range(2**H):  #2^n
    for paint_w in range(2**W):
        cnt = 0
        for i in range(H):
            for j in range(W):
                if (paint_h>>i) & 1== 0 and  (paint_w >> j ) & 1 == 0:
                    if init_map[i][j] == "#":   # '#'の数を数える
                        cnt += 1
        if cnt==K:
            ans += 1
print(ans)


Measured memory_bytes: 9076
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;


public class Main {

	static class Scanner{
		BufferedReader br=null;
		StringTokenizer tk=null;
		public Scanner(){
			br=new BufferedReader(new InputStreamReader(System.in));
		}
		public String next() throws IOException{
			while(tk==null || !tk.hasMoreTokens()) {
				String cad = br.readLine();
				if (cad == null)
					return null;
				tk=new StringTokenizer(cad);
			}
			return tk.nextToken();
		}
		public int nextInt() throws NumberFormatException, IOException{
			return Integer.valueOf(next());
		}
		public long nextLong() throws NumberFormatException, IOException{
			return Long.valueOf(next());
		}
		public double nextDouble() throws NumberFormatException, IOException{
			return Double.valueOf(next());
		}
	}
	
	public static void main(String args[]) throws NumberFormatException, IOException {
		Scanner sc = new Scanner();
		int N = sc.nextInt();
		int[] a, b;
		a = new int[N];
		b = new int[N];
		for(int i = 0; i < N; i++)
			a[i] = sc.nextInt();
		for(int j = 0; j < N; j++)
			b[j] = sc.nextInt();
		int[] bsum = new int[N];
		bsum[N - 1] = b[N - 1];
		for(int i = N - 2; i >= 0; i--)
			bsum[i] = b[i] + bsum[i + 1];
		int ans = 0;
		int acum = 0;
		for(int i = 0; i < N; i++) {
			acum += a[i];
			ans = Math.max(ans, acum + bsum[i]);
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 21332
def main():
  import collections
  s = input()
  r = []
  x = 0
  for i in range(len(s)):
    x += int(s[-i-1])*pow(10,i,2019)
    x %= 2019
    r.append(x)
  d = collections.Counter(r) 
  ans = 0
  if 0 in d:
    ans += d[0]
  for k,v in d.items():
    if v >= 2:
      ans += v*(v-1)//2
  print(ans)

main()


Measured memory_bytes: 77028
#include <bits/stdc++.h>
using namespace std;
int main() {
    string S;
    cin >> S;
    int sum  = 700;
    if(S[0] == 'o') sum += 100;
    if(S[1] == 'o') sum += 100;
    if(S[2] == 'o') sum += 100;
    cout << sum << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int N,K;
int A[2<<17];
main()
{
	cin>>N>>K;
	for(int i=0;i<N;i++)cin>>A[i];
	int L=0,R=1e9;
	while(R-L>1)
	{
		int M=L+R>>1;
		long cnt=0;
		for(int i=0;i<N;i++)
		{
			cnt+=(A[i]-1)/M;
		}
		if(cnt<=K)R=M;
		else L=M;
	}
	cout<<R<<endl;
}


Measured memory_bytes: 4368
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
  input()
  s = 0
  m = 1e9
  c = 0

  for v in map(int, input().split()):
    s += abs(v)
    m = min(abs(v), m)

    if v < 0:
      c = 1 - c

  print(s - m * c * 2, flush=True)


if __name__ == '__main__':
  main()



Measured memory_bytes: 11192
using System;
using System.Linq;

namespace _060_CardGame
{
	class Program
	{
		static void Main ( string[] args )
		{
			const int ScoreTotal = 20;
			const int CardCount = 10;

			string inputStr;

			while ((inputStr = Console.ReadLine ()) != null)
			{
				int[] cards = inputStr.Split (' ').Select (int.Parse).ToArray ();

				int myHandSum = cards[0] + cards[1];
				int max = ScoreTotal - myHandSum;

				//?¶?????????????????????§???
				if (max < 10)
				{
					int notExistCount = 0;

					//?????¨???????????????????????????
					for (int i = 0; i < cards.Length; i++)
					{
						if (cards[i] <= max)
							notExistCount++;
					}

					double winPercent = (double) (max - notExistCount) / (CardCount - cards.Length);

					if (0.5 <= winPercent)
						Console.WriteLine ("YES");
					else
						Console.WriteLine ("NO");
				}
				//???????¶??????????20????¶???????????????§
				else
				{
					Console.WriteLine ("YES");
				}
			}
		}
	}
}

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

#define int long long

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);
  
  string s;
  int l;
  cin >> s;
  l = s.size();

  int n;
  cin >> n;

  int res1 = 0, res2 = 0;

  for ( int i = 0; i < l; i++ ) {
    if ( s[i+1] == '+' || i == l-1 ) {
      res1 += s[i]-'0';
      i++;      
    } else {
      int m = s[i]-'0';
      i += 2;      
      while ( s[i-1] == '*' ) {
	m *= s[i]-'0';
	i += 2;	
      }
      res1 += m;
      i--;      
    }    
  }

  res2 = s[0]-'0';  
  for ( int i = 2; i < l; i++ ) {
    if ( s[i-1] == '*' ) {
      res2 *= s[i]-'0';      
      i++;      
    } else {
      res2 += s[i]-'0';
      i++;      
    }
  }

  if ( res1 == n && res2 == n ) {
    puts("U");    
  } else if ( res1 == n ) {
    puts("M");    
  } else if ( res2 == n ) {
    puts("L");    
  } else {
    puts("I");    
  }  
  
  return 0;
}



Measured memory_bytes: 3244
object Main {
	def main(args: Array[String]): Unit = {
		val len = io.StdIn.readInt()
		val levelInt = io.StdIn.readLine().split(" ")
		
		val newList = levelInt.map(_.toInt).sorted
		
		val upperLimit = newList(len / 2)
		val lowerLimit = newList(len / 2 - 1)
		
		var counter = 0
		
		for (_ <- lowerLimit + 1 to upperLimit) {
			counter += 1
		}
		
		println(counter)
	}
}


Measured memory_bytes: 49020
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define vcout(v) rep(i,v.size()) cout << v[i] << " "; cout << endl
#define mcout(m) rep(j,m.size()){vcout(m[j]);}
const ll MOD = 1e9 + 7;

void mainsolve(){

	ll h,n;
	cin >> h >> n;
	vector<ll> a(n);
	rep(i,n) cin >> a[i];

	ll total = 0;
	rep(i,n) total += a[i];
	string s;
	if(total >= h) s = "Yes";
	else s = "No";
	cout << s << endl;

	return;
}

int main(){
	
	//ll TC;cin>>TC;rep(I,TC){cout<<"case:"<<I+1<<"---"<<endl; // comment out!
		mainsolve();
	//} // comment out!
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
const long long INF = LLONG_MAX / 2;
#define FOR(i, r, n) for(int i=(r); i<(n); i++) 
#define REP(i, n) FOR(i, (0), n)
#define ll long long int

template <typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
	vector.erase(vector.begin() + index);
}

using namespace std;
ll ans = 0, sum = 0, n, k, t;
string s;

ll counter = 0;

int main()
{
	cin >> s;
	REP(i,s.size())
	{
		if(s[i]=='g')
		{
			if(counter)
			{
				ans++;
				counter--;
			}
			else counter++;
		}
		else if(s[i]=='p')
		{
			if(counter)
			{
				counter--;
			}
			else {
				ans--;
				counter++;
			}
		}
	}
	cout << ans << endl;
}

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

int main(){
	ll h,w;
	cin >> h >> w;
	if(h == 1 || w == 1){
		cout << 1 << endl;
		return 0;
	}
	ll a = (w+1)/2;
	ll b = w/2;
	ll ans = ((h+1)/2) * a + (h/2) * b;
	cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;


int main(){
	string s;
	cin >> s;
	if (!(s[0] != s[1] || s[1] != s[2])) cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,k,index=1,sum=1,ans=0;
    cin>>n>>k;
    ll a[n],num[n+1];
    memset(num,0,sizeof(num));
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    for(int i=1;i<n;i++){
        if(a[i]==a[i-1]){
            index++;
        }
        else{
            num[index]++;
            index=1;
            sum++;
        }
    }
    num[index]++;
    int maki=(sum-k);
    if(maki<=0){
        cout << 0<<endl;
        return 0;
    }
    for(int i=1;i<=n;i++){
        if(num[i]>=maki){
            ans+=maki*i;
            cout << ans<<endl;
            return 0;
        }
        else{
            maki-=num[i];
            ans+=i*num[i];
        }
    }
    return 0;
}



Measured memory_bytes: 3328
#include <cmath>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <iomanip>
#include <map>
#include <stack>
#include <queue>

using namespace std;

typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,y;
    cin>>n>>y;
    for(int i=0;i<=n;i++){
        for(int j=0;j<=n-i;j++){
            if(y==10000*(n-i-j)+5000*i+1000*j){
                cout<<n-i-j<<' '<<i<<' '<<j;
                return 0;
            }
        }
    }
    
    cout<<"-1 -1 -1"<<endl;
}

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

int dp[1<<16];
int a[20][20],n;

int dfs(int S){
	if(dp[S]!=-1e15)return dp[S];
	int res=0;
	r(i,n){
		for(int j=i+1;j<n;j++){
			if((S&(1<<i))&&(S&(1<<j))){
				res+=a[i][j];
			}
		}
	}
	for(int i=(S-1)&S;i>0;i=(i-1)&S){
    	res=max(res,dfs(i)+dfs(i^S));
 	}
 	return dp[S]=res;
}

signed main(){
	r(i,(1<<16))dp[i]=-1e15;
	cin>>n;
	r(i,n)r(j,n)cin>>a[i][j];
	cout<<dfs((1<<n)-1)<<endl;
}

Measured memory_bytes: 768
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include<numeric>
#include<cmath>
#include<map>
#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;
typedef pair<int,int> P;
typedef pair<ll,ll> pll;
const ll inf = 1LL << 60;
const ll mod = 998244353;

int main(){
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	//cout << fixed << setprecision(15);
    int N,S; cin>>N>>S;
    vector<ll> A(N);
    REP(i,N){
        cin>>A[i];
    }
    vector<vector<ll > > dp(N+1,vector<ll>(S+1,0)); //個数、何通りあるか
    dp[0][0] = 1;
    REP(i,N){
        REP(j,S+1){
            if(A[i] > j){
                dp[i+1][j] = 2 * dp[i][j] %mod;
            }
            else{
                dp[i+1][j] = (2 * dp[i][j] + dp[i][j-A[i]]) % mod;
            }
        }
    }

    cout << dp[N][S] <<endl;


}

Measured memory_bytes: 73632
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;


struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};
int main() {
	while (1) {
		int H, W; cin >> H >> W;
		if (!H)break;
		UnionFind uf(H*W);
		vector<string>field(H);
		for (int i = 0; i < H; ++i) {
			cin >> field[i];
		}
		for (int i = 0; i < H; ++i) {
			for (int j = 0; j < W; ++j) {
				if (j!=W-1&&field[i][j] == field[i][j + 1]) {
					uf.unionSet(i*W + j, i*W + j + 1);
				}
				if (i!=H-1&&field[i][j] == field[i + 1][j]) {
					uf.unionSet(i*W + j, (i + 1)*W + j);
				}
			}
		}
		set<int>aset;
		for (int i = 0; i < H*W; ++i) {
			aset.emplace(uf.root(i));
		}
		cout << aset.size() << endl;
	}
	return 0;
}

Measured memory_bytes: 3212
room = [[[0 for i in range(10)] for j in range(3)] for k in range(4)] 

n = int(input())
for i in range(n):
    b, f, r, v = map(int, input().split())
    room[b-1][f-1][r-1] += v
    
for i in range(4):
    for j in range(3):
        for k in range(10):
            print(" ", room[i][j][k], sep="", end="")
        print("")
    if i <= 2:
        split_str="#"*20
        print(split_str)


Measured memory_bytes: 5636
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#ifdef ONLINE_JUDGE
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
#define fu(a,b,c) for(int a=b;a<=(int)c;++a)
#define fd(a,b,c) for(int a=b;a>=(int)c;--a)
#define cu(a,b,c) for(int a=b;a<(int)c;++a)
#define cd(a,b,c) for(int a=(b)-1;a>=(int)c;--a)
#define gcd(a,b) __gcd(a,b) 
#define pii pair<int,int>
#define pll pair<long long,long long>
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define pf push_front
#define uint unsigned int
#define MOD 998244353
#define MAXN 200005
#define MAXH 4
#define MAXM 100
#define INF 1LL << 30
#define ll long long
#define ull unsigned long long
#define RNG mt19937
#define udist(a,b) uniform_int_distribution<uint32_t> distribution(a,b)
#define max3(a,b,c) max(a, max(b, c))
#define min3(a,b,c) min(a, min(b, c))
#define gmax(a,b) a = max(a, b)
#define gmin(a,b) a = min(a, b)
#define whatis(x) cerr << #x << " is " << x << endl;
#define fast_io() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PI 3.1415926535897932384626433
using namespace std;

int main(){
	fast_io();
	int a,b,c;
	cin >> a >> b >> c;
	int mx = max3(a,b,c);
	int dist = 3 * mx - a - b - c;
	cout << (dist&1? dist/2 + 2 : dist/2) << '\n';
}

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

int main()
{
	int n, p, o, x, t;
	cin >> n >> p;
	list<int> ll[n];
	while (p--)
	{
		cin >> o >> t;
		if (o == 1)
		{
			list<int>::iterator iter = ll[t].begin();
			for ( iter ; iter != ll[t].end(); iter++)
			{
				if (iter != ll[t].begin())cout << " ";
				cout<< *iter;
			}
			cout << endl;		
		}
		else
		{
			cin >> x;
			if (o == 0)ll[t].push_back(x);
			else if (o == 2) ll[x].splice(ll[x].end(), ll[t]);
		}
	}
return 0;
}


Measured memory_bytes: 18652
if __name__ == '__main__':
    N = int(input())
    t = [None]*N
    x = [None]*N
    y = [None]*N
    for i in range(N):
        t[i], x[i], y[i] = map(int, input().split())
    flag=True
    # check first step
    if (t[0] - max(x[0], -x[0]) - max(y[0], -y[0])) %2 != 0 or t[0] < max(x[0], -x[0]) + max(y[0], -y[0]):
        print('No')
        flag = False
    
    for i in range(N-1):
        delta_t = t[i+1] - t[i]
        delta_x = x[i+1] - x[i]
        if delta_x < 0:
            delta_x = -delta_x
        delta_y = y[i+1] - y[i]
        if delta_y < 0:
            delta_y = -delta_y
        delta = delta_x + delta_y
        if (delta_t - delta) % 2 == 0 and delta_t >= delta:
            continue
        else:
            if flag:
                print('No')
                flag = False
            break
    if flag:
        print('Yes')

Measured memory_bytes: 11724
#include<stdio.h>
int main()
{
  int N,K,i;
  char a[50];
  
  scanf("%d %d\n",&N,&K);
  for(i=0;i<N;i++){
    scanf("%c",&a[i]);
  }
  
  for(i=0;i<N;i++){
    if(i==K-1){
    a[i]=a[i]+32;
  }
    printf("%c",a[i]);
  }
}

Measured memory_bytes: 128
n, c, k = map(int, input().rstrip("\n").split())
time = sorted(int(input()) for _ in range(n))

ans = 1

iter_ = iter(time)
top = next(iter_)
i = 1
next_ = next(iter_)

try:
    while True:

        while next_ - top <= k and i < c:
            next_ = next(iter_)
            i += 1

        ans += 1
        top = next_
        i = 1
        next_ = next(iter_)
except StopIteration:
    print(ans)


Measured memory_bytes: 7396
#include <bits/stdc++.h>
using namespace std;
// using namespace __gnu_pbds;
// template <class c, class cmp = less<c> > using ordered_set = tree<c, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;



#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL); 

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define in insert
#define ld long double


#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
template <typename T,typename U>pair<T,U> operator+(const pair<T,U> & l,const std::pair<T,U> & r) { return {l.first+r.first,l.second+r.second};}
typedef long long int ll;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const ll mod =998244353;
const ll MAX_NODES =200001;
const ll MAX_LOG =50;
const ll maxn = 3000000+10;
#define endl '\n'
#define int ll
ll power(ll x, ll n) {
	ll res = 1;
	for (; n > 0; n >>= 1) {
	if (n & 1) res = (res * x) % mod;
	x = (x * x) % mod;
	}
	return res;
}
const int ALPHA = 26;
vector<vector<int>> trie;
bool dfs(int u)
{	
	bool check =0;
	for(int i= 0;i<26;i++)
	{
		if(trie[u][i]!=-1)
		{	
			
			bool k = (!(dfs(trie[u][i])));
			check|=k;
		}
	}
	return check;
}
bool dfs1(int u)
{	
	bool check =0;
	bool child = false;
	for(int i= 0;i<26;i++)
	{
		if(trie[u][i]!=-1)
		{	
			child = true;
			bool k = (!(dfs1(trie[u][i])));
			check|=k;
		}
	}
	if(!child)
		return true;
	return check;
}
int32_t main()
{   

    IOS 
	long double x,ans;
	cin>>x;
	x/=(3.0);
	ans = (x*x*x);
	cout<<setprecision(15)<<fixed<<ans<<endl;
	
	
   
		
	  


    
	
    
    
   
     
       
    

 
}






Measured memory_bytes: 256
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <ios>
#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 <string>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <forward_list>
#include <random>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

const int dx[] = {0, -1, 1, 0};
const int dy[] = {-1, 0, 0, 1};

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

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

    int n;
    string s;
    cin >> n >> s;
    if( s.size() % 2 ) {
        cout << "No" << endl;
        return 0;

    }

    for( int i = 0; i < s.size() / 2; ++i ) {
        if( s[i] != s[s.size() / 2 + i] ) {
            cout << "No" << endl;
            return 0;

        }
    }
    cout << "Yes" << endl;

    return 0;
}



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

#define ll long long

void swap (int *x, int *y) {
  int temp;

  temp = *x;
  *x = *y;
  *y = temp;

  return;
}


long int gcd(long int a, long int b){
  long int c;

  while (b > 0){
    c = a % b;
    a = b;
    b = c;
  }

  return a;
}

int upll(const void*a, const void*b){
  return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;
}

int downll(const void*a, const void*b){
  return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;
}

void sortup(ll*a,int n){
  qsort(a,n,sizeof(ll),upll);
}

void sortdown(ll*a,int n){
  qsort(a,n,sizeof(ll),downll);
}

long int modpow(long int a,long int n,long int mod){
  long int ans=1;
  while(n>0){
    if(n & 1){
      ans=ans*a%mod;
    }
    a=a*a%mod;
    n/=2;
  }
  return ans;
}

long int modinv(long int a,long int mod){
  return modpow(a,mod-2,mod);
}

int max(int a,int b){
  if(a<b){
    return b;
  }
  else{
    return a;
  }
}

int min(int a,int b){
  if(a<b){
    return a;
  }
  else{
    return b;
  }
}

void chmax(int *a,int b){
  if(*a < b){
    *a = b;
  }

  return;
}

void chmin(int *a,int b){
  if(*a > b){
    *a =b;
  }

  return;
}


int main(void){
  long int a,b;
  long int c,d;
  scanf("%ld%ld%ld%ld",&a,&b,&c,&d);
  long int dif=b-a,pro=0;
  if(a%c!=0&&a%d!=0){
    dif++;
  }
  pro+=(b/c)-(a/c);
  pro+=(b/d)-(a/d);
  long int g=0;
  if(gcd(c,d)==1){
    g=c*d;
  }else{
    for(int i=1;i<c*d;i++){
      if(c*i%d==0){
        g=c*i;
        break;
      }
    }
  }
  pro-=(b/g)-(a/g);
  printf("%ld\n",dif-pro);
  return 0;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll H, W;
    cin >> H >> W;

    ll ans1 = INF;
    if (W % 3 == 0) {
        ans1 = 0;
    } else {
        ans1 = H;
    }

    ll ans2 = INF;
    if (H % 3 == 0) {
        ans2 = 0;
    } else {
        ans2 = W;
    }

    ll ans3 = INF;
    rep2(h, 1, H) {
        ll b = h * W;
        ll b2 = (H - h) * (W / 2);
        ll b3 = (H - h) * (W - W / 2);
        ans3 = min(ans3, abs(max({b, b2, b3}) - min({b, b2, b3})));
    }

    ll ans4 = INF;
    rep2(w, 1, W) {
        ll b = w * H;
        ll b2 = (W - w) * (H / 2);
        ll b3 = (W - w) * (H - H / 2);
        ans4 = min(ans4, abs(max({b, b2, b3}) - min({b, b2, b3})));
    }
    cout << min({ans1, ans2, ans3, ans4}) << '\n';
}

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


Measured memory_bytes: 256
H, W = map(int, input().split())
a = []
for i in range(H):
    a.append(input().split())

for j in range(H):
    a[j].insert(0, '#')
    a[j].append('#')

a.append('#' * (W + 2))
a.insert(0, '#' * (W + 2))

for k in range(H + 2):
    print(''.join(a[k]))



Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod = 1e9+7;

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> sunuke(n,0);
    for(int i = 0; i < k; i++){
        int d;
        cin >> d;
        for(int j = 0; j < d; j++){
            int a;
            cin >> a;
            a--;
            sunuke[a]++;
        }
    }    
    int ans = 0;
    for(int i = 0; i < n; i++){
        if(sunuke[i] == 0) ans++;
    }
    cout <<ans << endl;
}

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

#define ll long long
#define MOD 1000000007
#define LLMN LONG_LONG_MIN
#define LLMX LONG_LONG_MAX
#define MAX 1000000

ll  fastpower(ll a, ll n)
{
    ll res = 1;
    while(n > 0)
    {
        if(n % 2 != 0)
        {
            res = (res * a) % MOD;
        }
        n /= 2;
        a=(a * a) % MOD;
    }
    return res;
}

void getprime(vector<bool>&prime)
{
    for(ll i = 2;i < MAX; i++)
    {
        if(prime[i-1])
        {
            for(ll j = i*i; j < MAX; j += i)
                prime[j-1] = false;
        }
    }
}

void getfact(vector<ll>&fact, vector<ll>&factinv)
{
    fact[0] = 1;
    factinv[0] = 1;
    
    for(ll i = 1; i < MAX; i++)
        fact[i] = (fact[i-1] * i)%MOD;
    
    for(ll i = 1; i < MAX; i++)
        factinv[i] = (factinv[i-1] * fastpower(i, MOD -2) )%MOD;

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll n,m,x;
    cin>>n>>m>>x;
    vector<ll>c(n);
    vector<vector<ll>>a(n, vector<ll>(m,0));
    for(ll i=0;i<n;i++)
    {
        cin>>c[i];
        for(ll j=0;j<m;j++)
        {
            cin>>a[i][j];
        }
    }
    ll p=pow(2,n);
    ll res=LLMX;
    for(ll i=0;i<p;i++)
    {
        ll sum=0;
        vector<ll>xx(m,0);
        for(ll j=0;j<n;j++)
        {
            if(i & (1<<j))
            {
                for(ll k=0;k<m;k++)
                {
                    xx[k]+=a[j][k];
                }
                sum+=c[j];
            }
        }
        bool f=true;
        for(ll k=0;k<m;k++)
        {
            if(xx[k] < x)
            {
                f=false;
                break;
            }
        }
        if(f)
        {
            res=min(res, sum);
        }
    }
    if(res == LLMX)
        cout<<"-1";
    else
        cout<<res;
    return 0;
}

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

#define rep(i, n) for(int i=0; i<(n); ++i)
#define max  200001

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){
 
    int a, b, c;
    
    scanf("%d%d%d", &a, &b, &c);
    
    printf("%d", a*b/2);
    
    return 0;
}



Measured memory_bytes: 1700
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<stdio.h>
#define MAXN 100010
using namespace std;
int n;
struct stu
{
    int num;
    int idx;
    bool operator < (const stu & x) const{
        return num<x.num;
    }
}a[MAXN];
int main()
{
    cin>>n;
    int x;
    for(int i=1;i<=n;i++)
    {
        cin>>x;
        a[i].idx=i;
        a[i].num=x;
    }
    sort(a+1,a+n+1);
    for(int i=1;i<=n;i++)   cout<<a[i].idx<<" ";
    cout<<endl;
    return 0;
}

Measured memory_bytes: 1536
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
typedef long long ll;
ll n;
int main()
{
  cin >> n;
  cout << n*(n-1)/2 << "\n";
  
  return 0;
}


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

#define LL long long
#define LD long double
#define Mod 1000000007
#define L_Mod 17100000013

const double eps = 1e-9;
const int INF = 0x3f3f3f3f;
const double PI = 3.1415926535;

#define NO_TLE std::ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

#define ree(a,n) memset(a,n,si 2)

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define red(i,l,u) for(int (i)=(int)(l);(i)>=(int)(u);--(i))


int main()
{
    LL i,j,w,h,n,m,a[105][105]= {0},tp[10013]= {0},num=0;
    cin>>w>>h;
    cin>>n;
    for(i=0; i<n; i++)
        cin>>tp[i];
    for(i=0; i<w; i++)
    {
        if(i%2==0)
            for(j=0; j<h; j++)
            {
                if(tp[num]==0)
                    num++;
                a[i][j]=num+1;
                tp[num]--;
            }
        else
            for(j=h-1; j>=0; j--)
            {
                if(tp[num]==0)
                    num++;
                a[i][j]=num+1;
                tp[num]--;

            }
    }
    for(i=0; i<w; i++)
    {
        for(j=0; j<h; j++)
            cout<<a[i][j]<<" ";
        cout<<endl;
    }
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define repk(i,k,n) for (ll i = k; i <= (ll)(n); ++i)
#define MAX 500010
#define MOD 1000000007
typedef long long  ll;

using namespace std;

ll fac[MAX]; // n!
ll finv[MAX]; // n!の逆元
ll inv[MAX]; // nの逆元


// n!(fac)とその逆元(finv)を先に計算しておく
void comInit(){
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

ll ans;

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

	comInit();

	ll N,M;
	cin >> N >> M;

	ans = fac[N] * fac[M] % MOD;
	
	if(abs(N-M) >= 2){
		cout << 0 << endl;
		return 0;
	}

	if(N == M){
		ans = ans * 2 % MOD;
	}
	
	cout << ans << endl;

	return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF INT_MAX/3

//#define N 2000

template<size_t N>
const bitset<N> operator+(const bitset<N>& lhs, const bitset<N>& rhs)
{
    bitset<N> a(lhs), b(rhs), ret(lhs ^ rhs);

    for (b = (a & b) << 1, a = ret; b.any(); b = (a & b) << 1, a = ret) ret ^= b;

    return ret;
}

template<size_t N>
int edit_distance_bitset(const string& str1, const string& str2)
{
    char s1[N] = { ' ' };
    char s2[N] = { ' ' };
    char *p1, *p2;

    if (str1.size() >= str2.size()) { p1 = s1;  p2 = s2; }
    else { p1 = s2;  p2 = s1; }
    copy(str1.begin(), str1.end(), p1 + 1);
    copy(str2.begin(), str2.end(), p2 + 1);
    int m = strlen(s1);
    int n = strlen(s2);

    const bitset<N> ONE(1);
    bitset<N> Peq[256];
    bitset<N> Pv, Mv, Eq, Xv, Xh, Ph, Mh;
    int Score = m;

    for (int i = 0; i < m; i++) {
        Peq[s1[i]] |= ONE << i;
        Pv |= (ONE << i);
    }
    for (int j = 0; j < n; j++) {
        Eq = Peq[s2[j]];
        Xv = Eq | Mv;
        Xh = (((Eq & Pv) + Pv) ^ Pv) | Eq;
        Ph = Mv | ~(Xh | Pv);
        Mh = Pv & Xh;
        if ((Ph & (ONE << (m - 1))).any()) Score++;
        else if ((Mh & (ONE << (m - 1))).any()) Score--;
        Ph = Ph << 1 | ONE;
        Pv = (Mh << 1) | ~(Xv | Ph);
        Mv = Ph & Xv;
    }

    return Score;
}

int main(){
	string a,b;
  cin>>a>>b;
  cout<<edit_distance_bitset<2000>(a,b)<<endl;
  return 0;
}

Measured memory_bytes: 3276
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>
#include<map>

/*
#include<boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/rational.hpp>
namespace mp = boost::multiprecision;
using Real = mp::number<mp::cpp_dec_float<1024>>;
using Bint = mp::cpp_int;
*/

using namespace std;

#define int long long
#define REP(i,s,e) for((i)=(s);(i)<(e);(i)++)
#define RREP(i,s,e) for((i)=((s)-1);(i)>=(e);(i)--)
#define FOR(i,n) for((i)=(0);(i)<(n);(i)++)
#define RFOR(i,n) for((i)=((n)-1);(i)>=(0);(i)--)
#define MOD 1000000007


signed main(){
    double R;
    cin>>R;
    printf("%.12f\n",2*R*acos(-1));
}


Measured memory_bytes: 3256