akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define INF 0x3f3f3f
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define F first
#define S second
#define PB push_back
#define GCD __gcd
#define COUNT1 __builtin_popcount
#define FORJ(i,j,k) for(int i=j; i<k; ++i)
#define FOR(i,k) FORJ(i,0,k)
#define FORR(i,k) for(int i=k; i>=0; --i)
#define FORE(x,v) for(auto &x : v)
#define FORG(y,x,g) FOR(y, sz(g)) FOR(x, sz2(g))
#define CIN(a) int a; cin>>a;
#define CINC(a) char a; cin>>a;
#define CINS(a) string a; cin>>a;
#define CIND(a) double a; cin>>a;
#define CINL(a) ll a; cin>>a;
#define CINP(a) PII a; cin>>a.F>>a.S;
#define CINLINE(a) string a; getline(cin, a);
#define CIN2(a,b) int a,b; cin>>a>>b;
#define CIN3(a,b,c) int a,b,c; cin>>a>>b>>c;
#define CIN4(a,b,c,d) int a,b,c,d; cin>>a>>b>>c>>d;
#define CINV(n,a) VI a; FOR(i,n) { CIN(x); a.PB(x); }
#define CINV2(n,a,b) VI a,b; FOR(i,n) { CIN2(x,y); a.PB(x); b.PB(y);}
#define CINVP(n,a) VP a; FOR(i,n) { CINP(p); a.PB(p);}
#define ALL(x) x.begin(), x.end()
#define INS(x) inserter(x, x.begin())
#define D(x) cout<<#x<<": "<<(x)<<endl
#define H cout<<"H"<<hcnt++<<endl;

using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<bool> VB;
typedef vector<string> VS;
typedef vector<PII> VP;
typedef vector<VI> GI;
typedef vector<VB> GB;
typedef vector<vector<char> > GC;
typedef map<char,int> MC;
typedef map<int,int> MI;
typedef map<string,int> MS;

void OUT(auto x) { cout<<x<<endl; }
void OUTP(const PII &p) { cout<<p.F<<" "<<p.S<<endl; }
void OUTB(int x) { cout<<bitset<32>(x)<<endl; }
void OUTN(const auto &x) { cout<<x->d<<endl; }
void OUTV(const auto &x) { FORE(d,x) cout<<d<<" "; cout<<endl; }
void OUTVP(const VP &x) { FORE(d,x) cout<<d.F<<" "<<d.S<<endl; }
void OUTVN(const auto &x) { FORE(d,x) cout<<d->d<<" "; cout<<endl; }
void OUTG(const auto &x) { FORE(v,x) { FORE(u,v) cout<<u; cout<<endl; } }
void OUTM(const auto &x) {FORE(p,x) cout<<p.F<<":"<<p.S<<" "; cout<<endl;}
PII operator+(const PII &l, const PII &r) { return {l.F+r.F, l.S+r.S}; }
void amin(auto &x, auto y) { if(y < x) x = y; }
void amax(auto &x, auto y) { if(x < y) x = y; }
bool bet(auto x, auto l, auto r) { return x>=l && x<r; }
auto mod(auto x, auto m) { return ((x % m) + m) % m; }
bool IsSameSign(auto a, auto b) { return ((a>=0) ^ (b<0)); }
int sz(const auto &x) { return (int)x.size(); }
int sz2(const auto &x) { return (int)x[0].size(); }
bool IsSafe(const auto &x, int i) { return bet(i,0,sz(x)); }
auto Safe(const auto &x, int i) { return IsSafe(x,i) ? x[i] : 0; }
bool Find(const auto &x, auto y) { return x.find(y) != x.end(); }
void Tally(const auto &v, auto &m) { FORE(x,v) m[x]++; }

int hcnt=1;
VP nb4 = {{0,1}, {1,0}, {0,-1}, {-1,0}};
VP nb8 = {{0,1}, {1,1}, {1,0}, {1,-1}, {0,-1}, {-1,-1}, {-1,0}, {-1,1}};

//#include "custom.h"

int main() {
  CIN2(N,K);
  ll ans=0;
  FORJ(b,K+1,N+1) {
    int p =N/b;
    int a1 = p*max(0,b-K);
    int a2 = max(0,N-p*b -K + 1);
    if(!K)
      a2 = N-p*b;
    ans+=a1+a2;
  }
  OUT(ans);
}


Measured memory_bytes: 256
import fractions
import sys
A, B = map(int,input().split())

GCD = fractions.gcd(A,B)

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

l = factorization(GCD)
if len(l) == 1 and l[0][0] == 1:
    print(len(l))
else:
    print(len(l)+1)

Measured memory_bytes: 5048
#include <iostream>
#include <cstring>
#include<vector>
#include <algorithm>
#include<cstdlib>
#include<set>
#include<math.h>
#include<map>
#include<iomanip>

using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(n,x) for(ll i=0;i<n;i++) cin>>x[i];


int main()
{
	ll n;
	cin >> n;
	set<string> a;
	string s;
	for (ll i = 0; i< n; i++)
	{
		cin >> s;
		a.insert(s);
	}
	cout << a.size() << "\n";

	return 0;
}

Measured memory_bytes: 19168
#include <iostream>
#include <climits>
#include <set>
#include <string>
#include <algorithm>
#include <vector>
#define MAX 1000000007


using namespace std;
#define ll long long
#define dbg if(0)
#define ISRANGE(val,lo,hi) ((lo<=val)&&(val<hi))



int main(){
    ll ans,rep,a,b;
    cin>>a>>b;
    if(a<b){
        ans=a;
        rep=b;
    }else{
        ans=b;
        rep=a;
    }
    for(int i=0;i<rep;i++){
        cout<<ans;
    }
    cout<<endl;


    return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <math.h>
#include <vector>
#include <cstring>
#include <ctime>
#include <set>
#include <bitset>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <ctime>
#include <climits>
#include <cassert>
#define fr first
#define sc second
#define MP make_pair
#define ad push_back
#define PB push_back
#define fastio ios_base::sync_with_stdio(false); cin.tie(0);
#define lli long long int
#define y1 arayikhalatyan
#define j1 jiglypuff
#define ld long double
#define itn int
#define pir pair<int, int> 
#define all(x) (x).begin(), (x).end()
using namespace std;

lli gcd(lli a, lli b) { return (b == 0LL ? a : gcd(b, a % b)); }
ld dist(ld x1, ld y1, ld x2, ld y2)
{
	return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
lli S(lli a)
{
	return (a * (a + 1LL)) / 2;
}
char vow[] = { 'a', 'e', 'i', 'o', 'u' };
int dx[] = { 1, -1, 0, 0, -1, -1, 1, 1 };
int dy[] = { 0, 0, 1, -1, -1, 1, -1, 1 };


const int N = 1e5 + 30;
const lli mod = 998244353;
const ld pi = acos(-1);
const int T = 238;
const ld e = 1e-6;

lli bp(lli a, lli b = mod - 2LL)
{
	lli ret = 1;
	while (b)
	{
		if (b & 1) ret *= a, ret %= mod;
		a *= a;
		a %= mod;
		b >>= 1;
	}
	return ret;
}
ostream& operator<<(ostream& c, pir a)
{
	c << a.fr << " " << a.sc;
	return c;
}




int n, m, q;
pair<pir, pir > a[N];
lli pat;
int b[12];
lli hashv()
{
	lli ret = 0;
	for (int i = 0; i < q; i++)
	{
		if (b[a[i].fr.sc] - b[a[i].fr.fr] == a[i].sc.fr) ret += a[i].sc.sc;
	}
	return ret;
}
void rec(int i1, int nax)
{
	if (i1 == n)
	{
		for (int i = nax; i <= m; i++)
		{
			b[i1] = i;
			pat = max(pat, hashv());
		}
	}
	else
	{
		for (int i = nax; i <= m; i++)
		{
			b[i1] = i;
			rec(i1 + 1, i);
		}
	}
}
int main()
{
	fastio;
	cin >> n >> m >> q;
	for (int i = 0; i < q; i++)
	{
		cin >> a[i].fr.fr >> a[i].fr.sc >> a[i].sc.fr >> a[i].sc.sc;
	}
	rec(1, 1);
	cout << pat << endl;
	return 0;
}


/*


  __
*(><)*
  \/ /
  ||/
--||
  ||
  /\
 /  \
/    \
*/



Measured memory_bytes: 3704
def check(a):
    flag = True
    for i in C:
        if (i[0] == a[0]) or (i[1] == a[1]) or (abs(i[0]-a[0]) == abs(i[1]-a[1])):
            flag = False
    return flag

def recq(r):
    if r == 8:
        pass
    elif DPr[r] == 1:
        recq(r+1)
    else:
        for c in range(8):
            if DPc[c]:
                continue
            else:
                if check((r,c)):
                    DPr[r] = 1
                    DPc[c] = 1
                    C.append([r,c])
                    recq(r+1)
                    flag = False
                    for i in range(8):
                        if DPr[i]==0:
                            flag = True
                    if flag:
                        C.pop()
                        DPr[r] = 0
                        DPc[c] = 0
k = int(input())
C = [[int(i) for i in input().split()] for _ in range(k)]
DPr = [0 for i in range(8)]
DPc = [0 for i in range(8)]
for i in C:
    DPr[i[0]]=1
    DPc[i[1]]=1
recq(0)
Q = [["." for i in range(8)] for i in range(8)]
for i in C:
    Q[i[0]][i[1]] = "Q"
for i in Q:
    tmp = ""
    for j in i:
        tmp+=j
    print(tmp)


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

int main() {
	ios_base::sync_with_stdio( false );

	int N;
	cin >> N;

	int d = 0;
	int x = N;
	while( x > 0 ) {
		d += x % 10;
		x /= 10;
	}

	cout << (N % d == 0 ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
A = list(map(int, input().split()))
for i in range(N):
    if A[i] == 1:
        x = i
        break

y = N - x - 1
ans = float("inf")


def ceil(m, n):
    return -(-m // n)


for s in range(K):
    t = K - 1 - s
    ans = min(ans, ceil(y - t, K - 1) + ceil(x - s, K - 1))

print(ans + 1)


Measured memory_bytes: 13880
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1LL << 60
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const long long MOD=1000000007;

// vector<p> cut(M); vector<vector<ll> > v(4);
// cut[i].second
// cut[i].first;
// REP(i,M){
//     int a,b;cin>>a>>b;
//     cut[i] = make_pair(b,a);//last first の順番
// }
// for(int i=0; i<N;i++){
// }
// sort(cut.begin(),cut.end()), sort(v.rbegin(), v.rend()); //sort
// char '' str ""
int main(void)
{
    int s;cin>>s;
    set<int> se;
    set<int>::iterator ite;
    se.insert(s);
    for(int i=2; i<=1000000;i++){
      if(s%2 == 0){ s /= 2;}else{ s = 3*s + 1;}
      ite = se.find(s);
      if(ite != se.end()){
        cout<<i<<endl; return 0;
      }else{
        se.insert(s);
      }
    }
    return 0;
}


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

namespace C
{
    public class Program

    {
        public static void Main(string[] args)
        {
            int n = RInt();
            long[] a = RLongAr();
            long[] b = RLongAr();

            if(a.Sum() < b.Sum())
            {
                Console.WriteLine("-1");
                return;
            }

            if (a.Where((x, i) => x < b[i]).Count() == 0)
            {
                Console.WriteLine("0");
                return;
            }

            int res = 0; 
            long[] dif = new long[n]; 
            for (int i = 0 ; i < n ; i++)
            {
                dif[i] = a[i] - b[i];
            }

            long sumshortage = dif.Where(x => x < 0).Sum() * -1;
            int shortageCnt = dif.Count(x => x < 0);
            Array.Sort(dif);

            int minusCnt = 0;
            for (int i = dif.Count() - 1 ; i >= 0 ; i--)
            {
                minusCnt++;
                sumshortage -= dif[i];
                if (sumshortage <= 0) break;                
            }

            res = shortageCnt + minusCnt;
            Console.WriteLine(res);
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}


Measured memory_bytes: 38108
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rep2(i,st,ed) for(int i = st; i < ed; ++i)
#define mk(x,y) make_pair(x,y)
#define pb(x) push_back(x)
const ll mod = 1e9 + 7;
const ll N = 2e5 + 200;
const int INF = 0x3f3f3f3f;
const double eps = 1e-7;



int main(){
	ll n,k;
	cin>>n>>k;
	map<ll,int> mp;
	while(k--){
		ll m;
		cin>>m;
		rep(i,m){
			ll x;
			cin>>x;
			mp[x] = 1;
		}
	}
	ll sum = 0;
	rep2(i,1,n+1){
		if(!mp[i]) sum++;
	}
	cout<<sum<<endl;	
	return 0;
}

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

int main(){
    int a,b;
    cin >> a >> b;
    if((a+b)%2==0){
        cout << (a+b)/2 << endl;
    }
    else{
        cout << "IMPOSSIBLE" << endl;
    }
    

    return 0;
}

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

l = [[0 for i in range(10)] for j in range(10)]

for i in range(1, n + 1):
    p = str(i)
    s = int(p[0])
    f = int(p[-1])
    l[s][f] += 1

ans = 0

for i in range(10):
    for j in range(10):
        ans += l[i][j] * l[j][i]

print(ans)

Measured memory_bytes: 41580
import java.util.*;

public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        if(a>b){
        for(int i=0; i<a; i++){
            System.out.print(b);
}
        }else{
        for(int i=0; i<b; i++){
            System.out.print(a);
        }
     }
}
}



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

int main()
{
  int64_t h, w;
  cin >> h >> w;
  
  if (h == 1 || w == 1)
    cout << 1 << endl;
  else if ((h * w) % 2 == 0)
    cout << (h * w) / 2 << endl;
  else if ((h * w) % 2 != 0)
    cout << (h * w) / 2 + 1 << endl;
}
  

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fst first
#define snd second
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef vector<char> vc;
typedef vector<vector<char> > vvc;
typedef vector<double> vd;
typedef vector<vector<double> > vvd;
template<class T> using vv=vector<vector< T > >;
typedef deque<int> di;
typedef deque<deque<int> > ddi;
typedef deque<bool> db;
typedef deque<deque<bool> > ddb;

// cout pair
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {
  s << p.first << " " << p.second << "\n"; return s;
}

// cout vector<pair>
template<typename T1, typename T2> ostream& operator<<(ostream& s, const vector<pair<T1, T2> >& vp) {
  int len = vp.size(); s << "\n";
  for (int i = 0; i < len; ++i) { s << vp[i]; }
    s << "\n"; return s;
}

// cout vector
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size(); s << "\n";
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << "\t";
  }
  s << "\n"; return s;
}

// cout deque
template<typename T> ostream& operator<<(ostream& s, const deque<T>& v) {
  int len = v.size(); s << "\n";
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << "\t";
  }
  s << "\n"; return s;
}

// cout 2-dimentional vector
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) { s << vv[i]; }
  return s;
}

// cout 2-dimentional deque
template<typename T> ostream& operator<<(ostream& s, const deque< deque<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) { s << vv[i]; }
  return s;
}

int main() {
  int n;
  cin >> n;
  vi t(n);
  vi a(n);
  rep (i, n) {
    cin >> t[i];
  }
  rep (i, n) {
    cin >> a[i];
  }
  vi ma(n, INT_MAX);
  vi mi(n, 1);

  ma[0] = mi[0] = t[0];
  FOR (i, 1, n) {
    if (t[i] > t[i-1]) {
      ma[i] = mi[i] = t[i];
    } else {
      ma[i] = t[i];
    }
  }

  ma[n-1] = min(ma[n-1], a[n-1]);
  mi[n-1] = max(mi[n-1], a[n-1]);
  for (int i = n-2; i >= 0; --i) {
    if (a[i] > a[i+1]) {
      ma[i] = min(ma[i], a[i]);
      mi[i] = max(mi[i], a[i]);
    } else {
      ma[i] = min(ma[i], a[i]);
    }
  }
  ll ans = 1;
  int mod = 1000000007;
  rep (i, n) {
    int tmp = ma[i] - mi[i] + 1;
    if (tmp <= 0) {
      ans = 0;
      break;
    }
    ans *= tmp;
    ans %= mod;
  }
  printf("%lld\n", ans);

  return 0;
}


Measured memory_bytes: 1920
n = gets.to_i
p = []
n.times{|i|
  p[i] = gets.split.map(&:to_i)
}
p << p[0]
q = gets.to_i
q.times{
  x, y = gets.split.map(&:to_i)
  count = 0
  on_line = false
  n.times{|i|
    a = [p[i  ][0] - x, p[i  ][1] - y]
    b = [p[i+1][0] - x, p[i+1][1] - y]
    if  a[0]*b[1] - a[1]*b[0] == 0 && a[0]*b[0]+a[1]*b[1] <= 0
      on_line = true
      break
    end
    a, b = b, a if a[1] > b[1]
    count += 1 if a[1] <= 0 && b[1] > 0 && a[0]*b[1] - a[1]*b[0] > 0
  }
  if on_line == true
    puts "1"
  elsif count % 2 == 0
    puts "0"
  else
    puts "2"
  end
}

Measured memory_bytes: 8900
W, H, N = map(int, input().split())
XY = [1 for i in range(W * H)]
for n in range(N):
  x, y, a = map(int, input().split())
  if a == 1:
    for i in range(W * H):
      if i % W < x :
      	XY[i] = 0 
  if a == 2:
    for i in range(W * H):
      if i % W >= x:
      	XY[i] = 0
  if a == 3:
    for i in range(y * W):
      XY[i] = 0 
  if a == 4:
    for i in range(y * W, W * H):
      XY[i] = 0 
print(sum(XY))

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

int main(void){
    int N; cin >> N;
    int F[N];
    for (int i = 0; i < N; i++)
    {
        F[i] = 0;
    }
    
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < 10; j++)
        {
            int f;
            cin >> f;
            F[i] += f*pow(2,9-j);
        }
    }
    int P[N][11];
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < 11; j++)
        {
            cin >> P[i][j];
        }
    }
    int ans,MAX_ans = -(1<<30);
    for (int bit = 1; bit < (1<<10); bit++)
    {
        ans = 0;
        for (int i = 0; i < N; i++)
        {
            bitset<10> x = bit & F[i];
            ans += P[i][x.count()];
        }
        MAX_ans = max(ans,MAX_ans);
    }
    cout << MAX_ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

typedef pair<int, int>P;
typedef pair<int, P> Q;

int main() {

	int h, w;

	cin >> h >> w;

	vector< vector<char> > s(h, vector<char>(w));
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> s[i][j];
		}
	}

	vector< vector<int> > aa(h, vector<int>(w, -1));

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

	queue<Q> q;
	q.push(Q(0, P(0, 0)));
	aa[0][0] = 0;
	while (!q.empty()) {
		Q qq = q.front();
		q.pop();
		P pp = qq.second;
		for (int i = 0; i < 4; i++) {
			if (0 <= pp.first + dx[i] && pp.first + dx[i] < w && 0 <= pp.second + dy[i] && pp.second + dy[i] < h) {
				if (s[pp.second + dy[i]][pp.first + dx[i]] == '.'&&aa[pp.second + dy[i]][pp.first + dx[i]] == -1) {
					aa[pp.second + dy[i]][pp.first + dx[i]] = qq.first + 1;
					q.push(Q(qq.first + 1, P(pp.first + dx[i], pp.second + dy[i])));
				}
			}
		}
	}

	if (aa[h - 1][w - 1] == -1) {
		cout << -1 << endl;
	}
	else {
		int ans = 0;
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if (s[i][j] == '.') {
					ans++;
				}
			}
		}
		//cout << ans << ' ' << aa[h - 1][w - 1] << endl;
		cout << ans - (aa[h - 1][w - 1] + 1) << endl;
	}

	return 0;
}

Measured memory_bytes: 256
/*
String[]の初期化、整数の型がlongになっているか
関数（splitとかcontainsとか）内では"+"とかは正規表現となされるので"\\+"とする
配列のコピーはarr1=arr.clone()
HashSet<>[]はおのおの初期化した？？？？？
負の数の割り算は絶対値が小さいほうに切り捨てられるex.-1/2=0ので、ある値>kみたいな式だとバグらせやすいので注意
ある値>=kとして、切り上げた値をとるべき
toLowerCase()はアルファベット以外に対して行ってもエラーにはならない
 */
//入力終了→Ctrl+D
import java.util.*;
import java.awt.*;
import java.awt.Graphics.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
    public static void main(String[] $) {
        Scanner sc = new Scanner(in);
        String s=sc.next();
        int n=sc.nextInt();
        for (int i = 0; i < n; i++) {
            String q=sc.next();
            int a=sc.nextInt(),b=sc.nextInt();
            if(q.equals("print")){
                out.println(s.substring(a,b+1));
            }else if(q.equals("reverse")){
                String t=s.substring(a,b+1);
                t=new StringBuilder(t).reverse().toString();
                s=s.substring(0,a)+t+s.substring(b+1,s.length());
            }else {
                String p=sc.next();
                s=s.substring(0,a)+p+s.substring(b+1,s.length());
            }
        }
    }
}


Measured memory_bytes: 29664
#include<bits/stdc++.h>
#define ll long long
#define inf 1000000009
using namespace std;
int main()
{
    char a[20],b[20],c[20];
    int x,y;
    scanf("%s%s%d%d%s",a,b,&x,&y,c);
    if(strcmp(a,c)==0)
        printf("%d %d",x-1,y);
    else
        printf("%d %d",x,y-1);
    return 0;
}

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

using namespace std;

const int N = 1e5 + 10;

int n, p[N];
long long a[N], rd[N];


int head[N];

int main() {
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }
    for(int i = 1; i <= n; i++) p[i] = i;
    sort(p + 1, p + n + 1,[](int x,int y){ return a[x] < a[y];});
    fill(head + 1, head + n + 1, 1);

    vector<pair<int, int>> ans;
    for(int i = n; i >= 2; i--) {
        int cur = p[i];
        int L = 1, R = i - 1;
        long long con_weight = a[cur] + 2 * head[cur] - n; 
        while (L <= R){
            int mid = (L + R) / 2;
            if (con_weight > a[p[mid]]) L = mid + 1;
            else R = mid - 1;
        }
        if (L >= i || con_weight != a[p[L]]) {
            cout << "-1" << endl;
            return 0;
        }
        ans.push_back(make_pair(p[L], cur));
        head[p[L]] += head[cur];
        rd[p[L]] += rd[cur] + head[cur];
        //cout << cur << " " << p[L] <<'\n';
        //for(int j = 1; j <= n; j++) cout << head[j] << " \n"[j==n]; 
    }
    if (rd[p[1]] != a[p[1]]) {
        cout << "-1" << endl;
        return 0;
    }
    for(auto i : ans) cout << i.first << " " << i.second << '\n';
}


Measured memory_bytes: 4596
M=998244353
N=gets.to_i
S=gets.chomp
a=[0]*6
p (0...N*3).inject((1..N).inject(1){|s,i|(s*i)%M}){|s,i|
	c=S[i]=="R"?0:S[i]=="G"?1:2
	if a[c+3]>0 then
		a[c+3]-=1
		(s*(a[c+3]+1))%M
	elsif a[t=(c+1)%3]>0 then
		a[t]-=1
		a[3+(c+2)%3]+=1
		(s*(a[(c+1)%3]+1))%M
	elsif a[t=(c+2)%3]>0 then
		a[t]-=1
		a[3+(c+1)%3]+=1
		(s*(a[(c+2)%3]+1))%M
	else
		a[c]+=1
		s
	end
}

Measured memory_bytes: 2572
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author yosiiii
 */


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

class CHonestOrUnkind2 {
public:
    vector<vector<int>> a;
    int n;
    int ma=0;
    void solve(std::istream& in, std::ostream& out) {
        in >> n;
        a = vector<vector<int>>(n,vector<int>(n,0));
        rep(i,n){
            int tt;
            in >> tt;
            rep(j,tt){
                int x,y;
                in >> x >> y;
                x--;
                a[i][x]=y==0?-1:1;
            }
        }
        vector<int> t(n,0);
        dfs(0,t);
        out << ma << endl;
	}
	void dfs(int id,vector<int> t){
        if(id>=n){
            int cnt=0;
            rep(i,n){
                if(t[i]==1){
                    cnt++;
                }
//                cout << t[i] << " ";
            }
            ma = max(ma,cnt);
            return ;
        }
        bool f=true;
        rep(i,id){
            if(t[i]==1&&a[i][id]==-1){
                f=false;
            }
            if(t[i]==1&&a[id][i]==-1)f=false;
            if(t[i]==-1&&a[id][i]==1)f=false;
        }
        if(f){
            t[id]=1;
            dfs(id+1,t);
        }
        f=true;
        rep(i,id){
            if(t[i]==1&&a[i][id]==1){
                f=false;
            }
        }
        if(f){
            t[id]=-1;
            dfs(id+1,t);
        }
        t[id]=0;
    }
};


int main() {
	CHonestOrUnkind2 solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
void main()
{
    long n = rdElem;

    long[string] list;
    string s = rdStr;
    ++list[s];
    foreach (i; 1 .. n)
    {
        string w = rdStr;
        if (s[$-1] != w[0] || w in list)
        {
            "No".writeln;
            return;
        }
        ++list[w];
        s = w;
    }

    "Yes".writeln;
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.mathspecial;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;
import core.bitop;

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

int main() {
	int a,b,c[82],i,j,k,f;
	while(cin >> b >> a) {
		b=b*10; c[0]=b;
		for (k=0;k<80;k++) {
			cout << b/a;  
			b=(b-a*(b/a))*10; f=0;
			for (i=0;i<k+1;i++) if (b==c[i] || b==0)  { f=1; break;}
			if (f==1) break;
			c[k+1]=b;
		}
		cout << endl;
		if (b>0) { 
			for (j=0;j<k+1;j++) if (j<i) cout << ' '; else cout << '^'; 
			cout << endl;
		}
	}
return 0;
}

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

int main() {
	int A, B, M;
	vector<int> via;
	vector<int> vib;

	cin >> A >> B >> M;

	int minA = 100000;
	int minB = 100000;

	int tmp;
	for (int i = 0; i < A; i++) {
		cin >> tmp;
		via.push_back(tmp);
		if (minA > tmp) minA = tmp;
	}
	for (int i = 0; i < B; i++) {
		cin >> tmp;
		vib.push_back(tmp);
		if (minB > tmp) minB = tmp;
	}
	int ans = minA + minB;

	int x, y, c;
	for (int i = 0; i < M; i++) {
		cin >> x >> y >> c;
		tmp = via[x-1] + vib[y-1] - c;
		if (ans > tmp) ans = tmp;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1400
/*
Author: QAQAutomaton
Lang: C++
Code: B.cpp
Mail: lk@qaq-am.com
Blog: https://www.qaq-am.com/
*/
#include<bits/stdc++.h>
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define DEBUG printf("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define Debug debug("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define all(x) x.begin(),x.end()
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef complex<double> cp;
typedef pair<int,int> pii;
int inf;
const double eps=1e-8;
const double pi=acos(-1.0);
template<class T,class T2>int chkmin(T &a,T2 b){return a>b?a=b,1:0;}
template<class T,class T2>int chkmax(T &a,T2 b){return a<b?a=b,1:0;}
template<class T>T sqr(T a){return a*a;}
template<class T,class T2>T mmin(T a,T2 b){return a<b?a:b;}
template<class T,class T2>T mmax(T a,T2 b){return a>b?a:b;}
template<class T>T aabs(T a){return a<0?-a:a;}
template<class T>int dcmp(T a,T b){return a>b;}
template<int *a>int cmp_a(int x,int y){return a[x]<a[y];}
#define min mmin
#define max mmax
#define abs aabs
struct __INIT__{
	__INIT__(){
		memset(&inf,0x3f,sizeof(inf));
	}
}__INIT___;
namespace io {
	const int SIZE = (1 << 21) + 1;
	char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c, qu[55]; int f, qr;
	// getchar
	#define gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	// print the remaining part
	inline void flush () {
		fwrite (obuf, 1, oS - obuf, stdout);
		oS = obuf;
	}
	// putchar
	inline void putc (char x) {
		*oS ++ = x;
		if (oS == oT) flush ();
	}
	template<typename A>
	inline bool read (A &x) {
		for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1;else if(c==EOF)return 0;
		for (x = 0; c <= '9' && c >= '0'; c = gc()) x = x * 10 + (c & 15); x *= f;
		return 1;
	}
	inline bool read (char &x) {
		while((x=gc())==' '||x=='\n' || x=='\r');
		return x!=EOF;
	}
	inline bool read(char *x){
		while((*x=gc())=='\n' || *x==' '||*x=='\r');
		if(*x==EOF)return 0;
		while(!(*x=='\n'||*x==' '||*x=='\r'||*x==EOF))*(++x)=gc();
		*x=0;
		return 1;
	}
	template<typename A,typename ...B>
	inline bool read(A &x,B &...y){
		return read(x)&&read(y...);
	}
	template<typename A>
	inline bool write (A x) {
		if (!x) putc ('0'); if (x < 0) putc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10;
		while (qr) putc (qu[qr --]);
		return 0;
	}
	inline bool write (char x) {
		putc(x);
		return 0;
	}
	inline bool write(const char *x){
		while(*x){putc(*x);++x;}
		return 0;
	}
	inline bool write(char *x){
		while(*x){putc(*x);++x;}
		return 0;
	}
	template<typename A,typename ...B>
	inline bool write(A x,B ...y){
		return write(x)||write(y...);
	}
	//no need to call flush at the end manually!
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
}
using io :: read;
using io :: putc;
using io :: write;
signed main(){
#ifdef QAQAutoMaton 
	freopen("B.in","r",stdin);
	freopen("B.out","w",stdout);
#endif
	int n;
	read(n);
	write(n*(n-1)/2-(n/2),'\n');
	for(int i=1;i<=n;++i)for(int j=i+1;j<=n;++j){
		if((i+j)!=(n|1))write(i,' ',j,'\n');
	}
	return 0;
}



Measured memory_bytes: 2304
#ifndef DEBUG
#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i <= i##_len; ++i)
#define rep3(i, l, r) for (int i = l, i##_len = (r); i < i##_len; ++i)
#define REP3(i, l, r) for (int i = l, i##_len = (r); i <= i##_len; ++i)
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
typedef int64_t Int;
typedef long double Ld;

using namespace std;
template <class T>
using Graph = vector<vector<T>>;

const Ld pi = M_PI;
const Int MOD = 1000000007;
const Int INF = 1LL << 62;

Int Floor(Int a, Int b) {
    return (a - (a % b)) / b;
}

template <class T>
inline bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template <class T>
inline bool chmin(T &a, const T &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
inline T Gcd(T a, T b) {
    T c;
    while (b) {
        c = b;
        b = a % b;
        a = c;
    }
    return a;
}

Int Lcm(Int a, Int b) {
    if (a < b) {
        swap(a, b);
    }

    return a / Gcd(a, b) * b;
}

vector<Int> divisor(Int n) {
    vector<Int> ret;
    for (Int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n)
                ret.push_back(n / i);
        }
    }
    sort(all(ret));

    return ret;
}

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

    int n = 2;
    vector<Int> a(n), b(n);
    Int ans = -1000000000000000050;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> b[i];
    }

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            chmax(ans, a[i] * b[j]);
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3652
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
int main() {
	long long N, M;
	cin >> N >> M;
	if (N == 1&&M==1) {
		cout << 1 << endl;
	}
	else if (N == 1) {
		cout << M - 2 << endl;
	}
	else if (M == 1) {
		cout << N - 2 << endl;
	}
	else if (N == 2 || M == 2) {
		cout << 0 << endl;
	}
	else {
		cout << N * M - 2 * M - 2 * (N - 2) << endl;
	}
	return 0;
}


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

#ifndef ONLINE_JUDGE
	#define W(x, y) cerr << "\033[31m" << #x << " = " << x << "\033[0m" << y;
#else
	#define W(x, y)
#endif


#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vii vector<pii>
#define vl vector<ll>
#define vll vector<pll>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pi acos(-1)
#define ld long double
#define prime 1000000007

using namespace std;

#define INF 1000000000

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	
	ll n;
	cin >> n;
	
	vll vet(n);
	for(auto&p:vet){
		cin >> p.ff >> p.ss;
	}
	sort(vet.begin(), vet.end());
	vector<ld> vet2;
	ld var = 0;
	do{
		for(int i = 1; i < n; ++i){
			var += hypotl((vet[i].ff-vet[i-1].ff), (vet[i].ss-vet[i-1].ss));
		}
	}while (next_permutation(vet.begin(), vet.end()));

	ll fat = 1;
	for(int i = 2; i <= n; ++i){
		fat *= i;
	}
	var /= fat;
	cout << setprecision(10) << fixed << var << endl;
	return 0;
}

Measured memory_bytes: 512
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>

using namespace std;
typedef long long ll;
#define INF int(1e9)
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define REPONE(i, n) for(int i = 1; i <= (int)(n); i++)
#define EACH(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(int i = m;i < n;i++)


void solve() {
}

int main() {
    int a, b;
    cin >> a >> b;
    if (a > b) cout << a - 1 << endl;
    else cout << a << endl;
    solve();
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String []args) throws IOException {
    	FastScanner in  = new FastScanner(System.in);
    	PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false);
    	solve(in, out);
    	in.close();
    	out.close();
    }
    static long gcd(long a, long b){ return (b==0) ? a : gcd(b, a%b); }
    static int gcd(int a, int b){ return (b==0) ? a : gcd(b, a%b); }
    private static int fact(int n) { int ans=1; for(int i=2;i<=n;i++) ans*=i; return ans; }
    static class FastScanner{
	BufferedReader reader;
	StringTokenizer st;
	FastScanner(InputStream stream){reader=new BufferedReader(new InputStreamReader(stream));st=null;}
	String next(){while(st == null || !st.hasMoreTokens()){try{String line = reader.readLine();if(line == null){return null;}
	     st = new StringTokenizer(line);}catch (Exception e){throw new RuntimeException();}}return st.nextToken();}
	String nextLine()  {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}
	int    nextInt()   {return Integer.parseInt(next());}
	long   nextLong()  {return Long.parseLong(next());}
	double nextDouble(){return Double.parseDouble(next());}
	char   nextChar()  {return next().charAt(0);}
	int[]  nextIntArray(int n)         {int[] arr= new int[n];   int i=0;while(i<n){arr[i++]=nextInt();}  return arr;}
	long[] nextLongArray(int n)        {long[]arr= new long[n];  int i=0;while(i<n){arr[i++]=nextLong();} return arr;}
	int[]  nextIntArrayOneBased(int n) {int[] arr= new int[n+1]; int i=1;while(i<=n){arr[i++]=nextInt();} return arr;}
	long[] nextLongArrayOneBased(int n){long[]arr= new long[n+1];int i=1;while(i<=n){arr[i++]=nextLong();}return arr;}
	void   close(){try{reader.close();}catch(IOException e){e.printStackTrace();}}
    }
    
    /********* SOLUTION STARTS HERE ************/
    
    private static void solve(FastScanner in, PrintWriter out){
        int n = in.nextInt();
        long a[] = new long[n];
        long b[] = new long[n];
        long c[] = new long[n];
        for(int i=0;i<n;i++){
            a[i] = in.nextLong();
            b[i] = in.nextLong();
            c[i] = in.nextLong();
        }
        for(int i=1;i<n;i++){
            a[i] += Math.max(b[i-1],c[i-1]);
            b[i] += Math.max(a[i-1],c[i-1]);
            c[i] += Math.max(b[i-1],a[i-1]);
        }
        out.println(Math.max(Math.max(a[n-1],b[n-1]),c[n-1]));
    }
    
    /************* SOLUTION ENDS HERE **********/
}

Measured memory_bytes: 42964
#include <bits/stdc++.h>
#define lli long long int
using namespace std;

int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	lli ans = 0;
	for(int i=0;i<n;i++){
		if(a[i]%2==0){
			if(a[i] >= 2){
				ans += max(a[i]/2-1,0);
				a[i] = 2;
			}
		} else {
			ans += a[i]/2;
			a[i] = 1;
		}
	}
	for(int i=0;i<n;i++){
		if(a[i] == 2){
			a[i]-=2;
			ans++;
		} else if(a[i] == 1){
			if(i+1<n && a[i+1] >= 1){
				a[i]--;
				a[i+1]--;
				ans++;
			}
		}
	}
	cout << ans << endl;
	
	return 0;
}

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


/*//______OPTIMISATION______//
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")*/

//________________MACROS_______________//
#define   fast 	 		ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define   int   		long long int
#define   pb  			push_back
#define   f     		first
#define   s     		second
#define   deb(x) 		cerr << #x << " " << x << endl;
#define   debb(x, y) 		cerr << #x << " = " << x << "," << #y << " = " << y << endl <<endl;
#define   in            	insert
#define   lb            	lower_bound
#define   ub            	upper_bound
#define   all(x)        	x.begin(), x.end()
#define   endl              '\n'
bool isPrime(int n)
{
	for(int i = 2; i * i <= n; i++)
	{
		if(n % i == 0)
		{
			return false;
		}
	}
	return true;
}

bool isPowerOfTwo (int x)
{
    return (x && (!(x&(x-1))));
}

int countDigit(int num)
{
	return (floor(log10(num)) + 1);
}

int rightMostFirstSetBit (int n)
{
    return log2(n & -n)+1;
}

int noOfBitInBinaryRepresntation(int n)
{
    return log2(n)+1;
}
signed main()
{
    fast ;

    int test_case = 1;
    //cin >> test_case;

    while (test_case--)
    {
        int n ;
        cin >> n ;
        int l= (n * 360) / __gcd( n , (int)360) ;
        cout <<l / n << endl;
    }
    return 0;
}



Measured memory_bytes: 3704
#include <stdio.h>
#include <stdlib.h>
#define ll long long
void swap(ll *x,ll *y){ll temp;temp=*x;*x=*y;*y=temp;}
ll gcd(ll p,ll q){for(ll t;q;)t=p%q,p=q,q=t;return p;}
ll lcm(ll p,ll q){return p/gcd(p,q)*q;}
int asc(const void *a,const void *b){return *(double*)a-*(double*)b>0?1:-1;}
ll desc(const void *a,const void *b){return *(ll*)b-*(ll*)a;}
// qsort(array, length, sizeof(int), asc);

int main(void) {
    int n;
    scanf("%d", &n);
    double v[1000]={0};
    for(int i=0; i<n; i++) scanf("%lf", &v[i]);
    qsort(v, n, sizeof(double), &asc);
    for(int i=0; i<n-1; i++){
        double tmp = (v[i]+v[i+1])/2.0;
        v[i+1] = tmp;
    }
    
    
    printf("%g\n", v[n-1]);
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;

int main() {
    int A1, A2, A3;
    cin >> A1 >> A2 >> A3;
    int ans = max({A1, A2, A3}) - min({A1, A2, A3});
    
    cout << ans << endl;

    return 0;
}

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

public class Main {
    public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt(); //カードの枚数
    String[] x = new String[n];
    String[] bubble = new String[n];
    String[] select = new String[n];
    for (int i=0; i<n; i++) { //カードを読み込む
        x[i] = sc.next();
        bubble[i] = x[i];
        select[i] = x[i];
    }
    //バブルソート
    bubbleSort(bubble);
    //選択ソート
    selectSort(select);
    //安定or不安定判定
    String result = isStable(bubble, select);
    //結果を出力
    out(bubble,"Stable");
    out(select,result);
    }
    /**
     * 選択ソート
     */
    public static void selectSort(String[] x) {
        for(int i=0; i<x.length; i++) {
            int minj = i; //最小値の位置
            for(int j=i; j<x.length; j++) {
                //カードの数字が最小値の位置を見つける
                if(x[j].charAt(1)<x[minj].charAt(1)) minj = j;
            }
            //未ソートの先頭が最小値でない場合、先頭と最初値を入れ替える
            if(i != minj) {
                String a = x[i];
                x[i] = x[minj];
                x[minj] = a;
            }
        }
    }
    /**
     * バブルソート
     */
    public static void bubbleSort(String[] x) {
        for(int i=x.length-1; i>0; i--) {
            for (int j=0; j<i; j++) {
                if(x[j].charAt(1)>x[j+1].charAt(1)){
                    String a = x[j];
                    x[j] = x[j+1];
                    x[j+1] = a;
                }
            }
        }
    }
    /**
     * 安定 or 不安定
     */
    public static String isStable(String[] s,String[] b) {
        if(Arrays.equals(s, b)) {
            return "Stable";
        } else {
            return "Not stable";
        }
    }
    /**
     * 出力
     */
    public static void out(String[] s,String r) {
        for (int i=0; i<s.length-1; i++) {
            System.out.print(s[i]+" ");
        }
        System.out.print(s[s.length-1]);
        System.out.println();
        System.out.println(r);
    }
}



Measured memory_bytes: 26436
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<queue>
#include<algorithm>
#include<vector>
#include<math.h>
#include<bitset>
#include<iomanip>
using namespace std;

typedef stack<int> IntStack;
typedef queue<int> IntQueue;

const double pi = 3.141592653589793;


//文字0~9をint型0~9に変換
int char_to_int(char c)
{
	if (c == '0') return 0;
	if (c == '1') return 1;
	if (c == '2') return 2;
	if (c == '3') return 3;
	if (c == '4') return 4;
	if (c == '5') return 5;
	if (c == '6') return 6;
	if (c == '7') return 7;
	if (c == '8') return 8;
	if (c == '9') return 9;
	else return -1;
}
//a^b mod MODを計算
long long int ModPower(long long int a, long long int b, long long int MOD)
{
	if (b == 0) return 1;
	else if (b % 2 == 0)
	{
		long long int d = ModPower(a, b / 2, MOD);
		return (d*d) % MOD;
	}
	else
	{
		return (a*ModPower(a, b - 1, MOD)) % MOD;
	}
}
//nCr mod MODを計算
long long int ModCombi(long long int n, long long int r, long long int MOD)
{
	if (n == 0 || r == 0) return 1;

	long long int Kn=1, Kr=1, Knr=1;

	long long int temp = 1;
	for (long long int i = 1; i <= n; i++)
	{
		temp *= i;
		temp %= MOD;
		if (i == n) Kn = temp;
		if (i == r) Kr = temp;
		if (i == n - r) Knr = temp;
	}

	long long int x = ModPower(Kr, MOD - 2, MOD);
	long long int y = ModPower(Knr, MOD - 2, MOD);

	long long int ans;
	ans = Kn * x;
	ans %= MOD;
	ans *= y;
	ans %= MOD;

	return ans;
}


/*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*/



int main()
{
	int A, P;
	cin >> A >> P;
	P += A * 3;
	cout << P / 2;

	return 0;
}

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

a = 0
for i in range(N):
    if i%2 == 0:
        a+=A[i]
    else:
        a-=A[i]

answer = [a]
for i in range(N-1):
    answer.append((A[i]-answer[-1]//2)*2)

print(" ".join(str(i) for i in answer))

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

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

	vector<vector<int>> dp(n + 1, vector<int>(2, (1 << 30)));
	dp[0][0] = 0;

	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < 2; j++)
		{
			for (int k = 0; k < 2; k++)
			{
				if ((j && !k) || (dp[i][j] == (1 << 30)))
				{
					continue;
				}
				dp[i + 1][k] = min(dp[i + 1][k], dp[i][j] + !(k == (s[i] == '#')));
			}
		}
	}

	cout << min(dp[n][0], dp[n][1]) << endl;

	return 0;
}

Measured memory_bytes: 11396
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD =  (int)1e9 + 7;
const double EPS = 1e-9;

struct BIT
{
	//[0,mn]
	vector<int> node;
	int mn;

	BIT(int mn)
	{
		this->mn = mn;
		node.resize(mn + 1, 0);
	}

	void add(int i, int x)
	{
		while (i <= mn)
		{
			node[i] += x;
			i += (i&-i);
		}
	}

	int sum(int i)
	{
		int res = 0;
		while (i > 0)
		{
			res += node[i];
			i -= (i&-i);
		}
		return res;
	}
};

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

	int N, Q;
	string S;
	cin >> N >> S >> Q;

	vector<BIT> bitv;
	rep(i, 0, 26)bitv.push_back(BIT(N + 10));

	rep(i, 0, N)
	{
		bitv[S[i] - 'a'].add(5 + i, 1);
	}

	int k, p, l, r;
	char c;

	rep(i, 0, Q)
	{
		cin >> k;
		if (k == 1)
		{
			cin >> p >> c;
			p--;
			bitv[S[p] - 'a'].add(5 + p, -1);
			S[p] = c;
			bitv[S[p] - 'a'].add(5 + p, 1);
		}
		else
		{
			cin >> l >> r;
			l--, r--;
			int ans = r - l + 1;
			rep(j, 0, 26)
			{
				ans -= max(0LL, bitv[j].sum(5+r) - bitv[j].sum(5 + l - 1) - 1);
			}
			cout << ans << endl;
		}
	}

	return 0;
}

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

int main() {
	int n, k, x[100];
	int r = 0;
	cin >> n >> k;
	for (int i = 0; i != n; i++) {
		cin >> x[i];
		if (x[i] < k - x[i]) {
			r = r + x[i] * 2;
		}
		else {
			r = r + (k - x[i]) * 2;
		}
	}
	cout << r << '\n';

	return 0;
}

Measured memory_bytes: 256