akhauriyash/Code-Regression huggingface dataset:
/* -------------------------------- Template -------------------------------- */

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = std::min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = std::max(a, b); }

// template<typename T> constexpr T inf = [](){ assert(false); };
// template<> constexpr int inf<int> = 1e9;
// template<> constexpr ll inf<ll> = 1e18;
// template<> constexpr ld inf<ld> = 1e30;

struct yes_no : std::numpunct<char> {
  string_type do_truename()  const { return "Yes"; }
  string_type do_falsename() const { return "No"; }
};

void solve();

int main() {
  std::locale loc(std::locale(), new yes_no);
  std::cout << std::boolalpha << std::setprecision(12) << std::fixed;
  std::cout.imbue(loc);
  solve();
  return 0;
}

using namespace std;

/* -------------------------------- Library -------------------------------- */

/* ---------------------------------- Main ---------------------------------- */

void solve() {
  string a, b, c;
  cin >> a >> b >> c;
  cout << a[0] << b[0] << c[0] << endl;
  return;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
    int s;cin>>s;
    vector<int> ma;
    ma.push_back(s);
    int ans=1;
    for(;;){
        ans++;
        if(s%2==0)s/=2;
        else s=3*s+1;
        if(find(ma.begin(),ma.end(),s)!=ma.end()){
            cout<<ans<<endl;
            return 0;
        }
        ma.push_back(s);
    }
}

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

int main()
{
    int N;
    cin >> N;
    vector<int> tastes(N);
    for (int i = 0; i < N; i++)
    {
        int d;
        cin >> d;
        tastes.at(i) = d;
    }
    int answer = 0;
    for (int i = 0; i < N; i++)
    {
        for(int j = i + 1; j < N; j++)
        {
            answer += tastes.at(i) * tastes.at(j);
        }
    }
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int selectionSort(int *A, int N) {
	int i, j;
	int minj, temp;
	int cnt = 0;

	for (i = 0; i < N; i++) {
		minj = i;
		for (j = i; j < N; j++) {
			if (A[j] < A[minj]) {
				minj = j;
			}
		}
		temp = A[i];
		A[i] = A[minj];
		A[minj] = temp;

		if (i != minj) {
			cnt++;
		}
	}
	return cnt;
}


int main()
{
	int N;
	int A[100];
	int i;
	int cnt;

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

	cnt = selectionSort(A, N);

	for (i = 0; i < N; i++) {
		printf("%d", A[i]);
		if (i < N - 1) {
			printf(" ");
		}
	}
	printf("\n%d\n", cnt);

	return 0;
}


Measured memory_bytes: 2024
#include<bits/stdc++.h> 
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
const int N = 200010;
long long n,d,x,y,k;
int main()
{
	cin>>n>>d;
	k=0;
	for(int i=0;i<n;i++){
		cin>>x>>y;
		if((x*x+y*y)<=d*d){
			k++;
		}
	}
	cout<<k<<"\n";
    return 0;
}

Measured memory_bytes: 3624
#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<ll, ll>;

int main()
{
    int n, ans = 0;
    cin >> n;
    rep(i, n)
    {
        string s;
        s = to_string(i + 1);
        if (s.size() % 2 == 1)
            ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3700
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = s_inpl()   |	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = inpl()	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]

import math
import copy
from collections import defaultdict
from collections import Counter
from collections import deque
# 直積 A={a, b, c}, B={d, e}:のとき，A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(seq), 順列 {}_len(seq) P_n: permutations(seq, n)
from itertools import permutations
# 組み合わせ {}_len(seq) C_n: combinations(seq, n)
from itertools import combinations
from bisect import bisect_left, bisect_right
# import numpy as np

def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W

# 四方向: 右, 下, 左, 上
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]

def i_inpl(): return int(input())
def s_inpl(): return map(int,input().split())
def l_inpl(): return list(map(int, input().split()))
INF = float("inf")

############
############
############

def calc(A):
    cnt1 = (A+1)//2
    ans = cnt1 % 2
    if A % 2 == 0:
        ans ^= A
    return ans

A, B = l_inpl()
print(calc(A-1)^calc(B))

Measured memory_bytes: 38384
n = int(input())
a = list(map(int,input().strip().split()))
ans = 1
can = 1
for i in range(0, n):
  if a[i] == 0:
    can = 2
if can != 2:
  for i in range(0, n): 
    ans = ans * a[i]
    if ans > 1000000000000000000:
      can = 0
      break
if can == 2:
  print("0")
elif can == 1:
  print(ans)
else : 
  print("-1")


Measured memory_bytes: 21788
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
    int n,d,x;
    cin >> n >> d >> x;
    int ans = x;
    rep(i,n) {
        int a;
        cin >> a;
        ans += 1+(d-1)/a;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import sys

def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    AB = list(zip(A, B))
    bigger_diff = list(map(lambda ab: max(ab[0] - ab[1], 0), AB))
    lesser_diff = list(map(lambda ab: min(ab[0] - ab[1], 0), AB))
    exceeded = sum(bigger_diff)
    shortage = sum(lesser_diff)

    if exceeded < abs(shortage):
        print(-1)
        sys.exit()

    if all(map(lambda ab: ab[0] >= ab[1], AB)):
        print(0)
        sys.exit()



    ans = len(list(filter(lambda d: d<0, lesser_diff)))

    bigger_diff = sorted(bigger_diff, reverse=True)

    ss = 0
    for i in range(len(bigger_diff)):
        ss += bigger_diff[i]
        if ss >= abs(shortage):
            ans += i + 1
            break
    print(ans)



if __name__=='__main__':
    main()


Measured memory_bytes: 24452
from itertools import accumulate as acc
n, c, *X = map(int, open(0).read().split())

S = [0] + list(acc(X))

ans = []
for k in range(1, n + 1):
    tmp = 5 * S[n] + (k + n) * c
    cur = n - k * 2
    while cur > 0:
        tmp += 2 * S[cur]
        cur -= k
    ans.append(tmp)

print(min(ans))

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

vector<int>v[100009];
int used[100009];
int n,m;

int dfs(int x,int t,int par){
  used[x]=t;
  r(i,v[x].size()){
    int nex=v[x][i];
    if(nex==par)continue;
    if(used[nex]==-1){
      if(dfs(nex,t,x))return 1;
    }
    else{
      if(used[nex]==t){
        return 1;
      }
    }
  }
  return 0;
}

bool FALSE(){
  r(i,n){
    if(v[i].size()>=3){
      return false;
    }
  }
  r(i,n)if(used[i]==-1){
    int x=dfs(i,1,-1);
    if(x)return false;
  }
  return true;
}

signed main(){

  while(cin>>n>>m,n){
    r(i,n+1)v[i].clear();
    memset(used,-1,sizeof(used));
    r(i,m){
      int a,b;
      cin>>a>>b;
      v[b].push_back(a);
      v[a].push_back(b);
    }

    if(!FALSE())cout<<"no"<<endl;
    else cout<<"yes"<<endl;
  }
}


Measured memory_bytes: 9156
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<bitset>
#include<queue>
#include<set>
#include<map>
using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define ROF(i,b,a) for (int i=(b);i>(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,n-1,-1)

typedef int i32;
typedef long long int i64;
typedef unsigned long long int ui64;
typedef float f32;
typedef double f64;
typedef long double f128;
typedef pair<int,int> Pi;

constexpr int INF = 1e9 + 7;
constexpr int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};

int main() {
    int N,M; cin>>N>>M;
    vector<int> from1,toN;
    int a,b;
    REP(i,M) {
        cin>>a>>b;
        if (a==1 || b==1) from1.push_back(a+b-1);
        if (a==N || b==N) toN.push_back(a+b-N);
    }
    sort(from1.begin(),from1.end());
    sort(toN.begin(),toN.end());
    int j = 0;
    REP(i,from1.size()) {
        while (j<toN.size()) {
            if (from1[i]==toN[j]) {
                cout<<"POSSIBLE"<<endl;
                return 0;
            } else if (from1[i]<toN[j]) break;
            j++;
        }
    }
    cout<<"IMPOSSIBLE"<<endl;
}


Measured memory_bytes: 1276
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

ll n;

int main(){
	
	cin >> n;
	cout << (n - 1) * n / 2 << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
vector<int> to[MAXN], from[MAXN];

int par[MAXN];
bool visited[MAXN];
void dfs(int u)
{
  visited[u] = 1;
  for (auto v : to[u])
  {
    if (visited[v])
      continue;
    bool ok = 1;
    for (auto w : from[v])
    {
      if (!visited[w])
      {
        ok = 0;
        break;
      }
    }
    if (ok)
    {
      par[v] = u;
      dfs(v);
    }
  }
}

int main()
{
  int N, M, a, b, root;
  cin >> N >> M;
  for (int i = 0; i < N + M - 1; i++)
  {
    cin >> a >> b;
    a, b;
    to[a].push_back(b);
    from[b].push_back(a);
  }
  for (int i = 1; i <= N; i++)
  {
    if (from[i].size() == 0)
      root = i;
  }
  par[root] = 0;
  dfs(root);
  for (int i = 1; i <= N; i++)
  {
    cout << par[i] << endl;
  }
}

Measured memory_bytes: 21256
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var strings = new List<string> { "AC", "WA", "TLE", "RE" };
            var counts = new List<int> { 0, 0, 0, 0 };

            foreach (var _ in Enumerable.Range(0, N))
            {
                var x = Console.ReadLine();
                foreach (var p in Enumerable.Range(0, 4))
                {
                    if (x == strings[p])
                    {
                        counts[p] += 1;
                    }
                }
            }
            foreach (var p in Enumerable.Range(0, 4))
            {
                Console.WriteLine($"{strings[p]} x {counts[p]}");
            }
        }
    }
}


Measured memory_bytes: 35376
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define mp make_pair
#define INF 1e9

void init()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
}

int main()
{
    init();
    string s,t;
    cin>>s>>t;
    int ans=0;
    rep(i,s.size()){
        if(s[i]!=t[i])ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3796
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<functional>
#include<numeric>
#include<queue>
#include<stack>
#include<map>
#include<unordered_map>
#include<set>
#include<bitset>
#include<random>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define pb push_back
#define endl '\n'
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 2222222222222222222LL;
const ll mod = 1000000007LL;

ll n = 0, m = 0, ans = 0, tmp = 0, ma = -inf, mi = inf;
string s;
bool ok;
ll dx[9] = { 0,1,-1,0,0,1,1,-1,-1 }, dy[9] = { 0,0,0,1,-1,1,-1,1,-1 };
#pragma endregion
#define MAX 222222


ll x[MAX], lsum[MAX], rsum[MAX];

ll solve1(ll a) {
  ll ret = 0, le = n - 1, ri = a;
  ll num = le - ri - 1;

  ret = rsum[ri + (num + 1) / 2];
  if (ri) ret -= rsum[ri - 1];
  if (num % 2) ret -= x[ri + (num + 1) / 2];

  ret += lsum[le - num / 2];
  if (num % 2 == 0) ret -= m - x[le - num / 2];

  return ret;
}

ll solve2(ll a) {
  ll ret = 0, le = a, ri = 0;
  ll num = le - ri - 1;

  ret = lsum[le - (num + 1) / 2];
  if (le != n - 1) ret -= lsum[le + 1];
  if (num % 2) ret -= m - x[le - (num + 1) / 2];

  ret += rsum[ri + num / 2];
  if (num % 2 == 0) ret -= x[ri + num / 2];

  return ret;
}

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


  cin >> m >> n;
  rep(i, n) cin >> x[i];

  rsum[0] = x[0] * 2;
  FOR(i, 1, n) rsum[i] = rsum[i - 1] + x[i] * 2;

  lsum[n - 1] = (m - x[n - 1]) * 2;
  RFOR(i, 0, n - 1) lsum[i] = lsum[i + 1] + (m - x[i]) * 2;

  ans = max(x[n - 1], m - x[0]);
  rep(i, n - 1) ans = max(ans, solve1(i));
  RFOR(i, 1, n) ans = max(ans, solve2(i));
  cout << ans << endl;


  return 0;
}

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

int main() {
    double N, K;
    cin >> N >> K;

    double res = 0;
    for (int i = 1; i <= N; i++) {
        int tmp = i;
        double prob = 1 / N;
        while (tmp < K) {
            tmp *= 2;
            prob *= 0.5;
        }
        res += prob;
    }
    cout << setprecision(19)<< res << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;

int main() {
    int N; cin>>N;
    vector<ll> H(N), I(N);

    for (int i=0;i<N;i++){
        cin >> H[i];
        I[i] = H[i];
    }

    ll p=1000000001;
    for (int i=N-1;i>=0;i--) {
        p = min(p, H[i]);
        if (p - H[i] <= -2) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;




    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF (1<<29)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))
const int dx[] = {-1,0,0,1},dy[] = {0,1,-1,0};

typedef long long int ll;

using namespace std;

int main(){
    while(true){
	int n,m;
	int f[501][501];
	memset(f,-1,sizeof(f));
	cin >> n >> m;
	vector<bool> flist(n+1,false);
	if(n == 0 && m == 0) break;
	REP(i,m){
	    int a,b;
	    cin >> a >> b;
	    f[a][b] = 1;
	    f[b][a] = 1;
	}
	FOR(i,2,n+1){
	    if(f[1][i] == 1){
		flist[i] = true;
		FOR(j,2,n+1){
		    if(f[i][j] == 1) flist[j] = true;
		}
	    }
	}

	int ans =0 ;
	FOR(i,2,n+1) if(flist[i]) ans++;
	cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 2180
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<math.h>

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)

typedef long long i64;
typedef pair<i64,i64> P;


string s,t;
vector<int> v[26];

int main(){
	cin >> s >> t;
	for(int i = 0; i < s.size(); i++){
		v[s[i]-'a'].push_back(i);
	}
	for(int i = 0; i < s.size(); i++){
		v[s[i]-'a'].push_back(i+s.size());
	}
	
	i64 cnt = 0, now = -1;
	for(int i = 0; i < t.size(); i++){
		if(v[t[i]-'a'].empty()){
			cout << -1 << endl;
			return 0;
		}
		int see = t[i]-'a';
		int c = *upper_bound(v[see].begin(), v[see].end(), now);
		cnt += c - now;
		now = c % s.size();
	}
	
	cout << cnt << endl;
	
	return 0;
}

Measured memory_bytes: 1724
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <cassert>
#include <string.h>
#include <iomanip>

using namespace std;

double inv(double a)
{
	return 1/a;
}


int main()
{
	
	int n;
	cin >> n;
	double in[100];
	for (int i = 0; i<n; i++){
		cin >> in[i];
		
	}
	
	double sum = 0.0;
	
	for (int i = 0; i<n; i++)
	{
		sum = sum + inv(in[i]);
		
	}
	
	
	cout <<std::setprecision(10)<< 1/sum <<endl;
	
	
	
	
	
	return 0;
}



Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
from collections import Counter

def solve(n: int, v: "List[int]"):
    v1 = v[0::2]
    v2 = v[1::2]

    counter1 = Counter(v1).most_common(2)
    counter2 = Counter(v2).most_common(2)

    key1,value1 = counter1[0]
    key2,value2 = counter2[0]

    if key1 == key2:
        answer1 = 0
        ##1をかき変える
        if len(counter1)>=2:
            answer1 = len(v1)-counter1[1][1] +len(v2)-value2
        else:
            answer1 = len(v1) +len(v2)-value2

        answer2 = 0
        if len(counter1)>=2:
            answer2 = len(v1)-value1 +len(v2)-counter2[1][1]
        else:
            answer2 = len(v1)-value1 +len(v2)
        print(min(answer1,answer2))   
    else:
        print(len(v1)-value1+len(v2)-value2)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  # type: int
    v = [int(next(tokens)) for _ in range(n)]  # type: "List[int]"
    solve(n, v)

if __name__ == '__main__':
    main()


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

using namespace std;

typedef long long LL;
const int MAXN=100000+100;
const int MOD=1e9+7;
LL dp[MAXN][4];
vector<int> G[MAXN];
int n;

void dfs(int nod,int fa){
	int len=G[nod].size();
	dp[nod][1]=1;
	dp[nod][0]=1;
	for(int i=0;i<len;i++){
		int son=G[nod][i];
		if(son!=fa){
			dfs(son,nod);
			dp[nod][0]=(dp[nod][0]*(dp[son][1]+dp[son][0]))%MOD;
			dp[nod][1]=(dp[nod][1]*dp[son][0])%MOD;
		}
	}
}

int main(){
	cin>>n;
	for(int i=1;i<n;i++){
		int x,y;
		cin>>x>>y;
		G[x].push_back(y);
		G[y].push_back(x);
	}
	dfs(1,-1);
	LL ans=(dp[1][0]+dp[1][1])%MOD;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 15744
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

ll euc(ll a, ll b, ll &x, ll &y) {
  ll xx = y = 0; ll yy = x = 1;
  while (b) {
    ll q = a / b; ll t = b; b = a % b;
    a = t; t = xx; xx = x - q * xx; x = t;
    t = yy; yy = y - q * yy; y = t;
  }
  return a;
}

ll mod_inverse(ll a, ll n) {
  ll x, y;
  if (euc(a,n,x,y) > 1) return -1;
  return ((x % n) + n) % n;
}

ll ans, a = 2, n, l;

void upd(ll x, ll y) {
  if ((l = mod_inverse(a * x, y)) > 0)
    ans = min({ans, l * x * a - 1, (y-l) * x * a});
}

int main() {
  cin >> n; ans = n + (n % 2 == 0);
  while (n % 2 == 0)
    a *= 2, n /= 2;
  for (ll i = 1; i * i <= n; i++)
    if (n % i == 0)
      upd(i, n / i), upd(n / i, i);
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int cmp(int x,int y)
{
	return x>y;
} 	
int main ()
{
	string a,s;
	while(cin>>a)
	{
		cin>>s;int b[1010],c[1010];  
		int sum=0,len;
		int len1=a.size();
	  	int len2=s.size(); 	
		for(int i=0;i<len1;i++)
		{
			b[i]=a[i]-'a';  
		} 
		for(int i=0;i<len2;i++)
		{
			c[i]=s[i]-'a';  
		} 	
		sort(b,b+len1);
	    sort(c,c+len2,cmp);	
		if(len1<len2)
		   len=len1;
		else
		   len=len2;		
		for(int i=0;i<len;i++)
		{
			if(c[i]>b[i]) 
			{
					cout<<"Yes"<<endl;
			  	 break;	
			}
			if(c[i]==b[i] ) 
			 {
			 	 ++sum;
				continue;
			 } 
			if(c[i]<b[i]) 
			{
				cout<<"No"<<endl;
			  	 break;	
			} 
		} 	
	//	cout<<len<<' '<<sum<<endl; 
		if(sum==len)
		{
			if(len1==len2)
			{
				cout<<"No"<<endl; 
			} 		
			if(len1<len2) 
				cout<<"Yes"<<endl;
		   if(len1>len2)
		   		cout<<"No"<<endl; 	   
		} 
	} 	
} 	

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


int main(){
    std::string S,T;
    std::cin >> S >> T;

    if (S.size() + 1 == T.size()){
        if (T.substr(0,T.size() - 1) == S){
            std::cout << "Yes" << std::endl;
        }
        else{
            std::cout << "No" << std::endl;
        }

        
    }
    else{
        std::cout << "No" << std::endl;
    }

}


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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    ll N;
    cin >> N;

    vector<ll> A(N);

    REP(i, N){
        cin >> A[i];
    }

    ll left = 0;
    ll right = 0;
    ll sum = 0;

    ll ans = 0;
    for(ll left=0; left<N; left++){
        while(right<N && ((sum^A[right]) == (sum+A[right]))){
            sum += A[right];
            right++;
        }
        ans += right-left;

        if(left == right){
            right++;
        }
        else{
            sum -= A[left];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int gcd(int a, int b)
{
	if (a % b == 0)
	{
		return(b);
	}
	else
	{
		return(gcd(b, a % b));
	}
}

int main() {
	long long int ans = 0;
	int n;
	cin >> n;
	for (int i = 1; i < n+1; i++) {
		for (int j = 1; j < n+1; j++) {
			for (int k = 1; k < n+1; k++) {
				ans += gcd(gcd(i, j), k);
				
			}
		}
	}
	
	cout << ans << endl;
	return 0;
}

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

char a[110][110];
int A, B;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> A >> B;
	// if (A == 1 && B == 1) {
	// 	cout << "2 1\n.#\n";
	// 	return 0;
	// }

	A -= 1; //#
	B -= 1; //.

	for (int i = 1; i <= 50; ++i) {
		for (int j = 1; j <= 100; ++j) a[i][j] = '.';
	}
	for (int i = 1; i <= 50; i += 2) {
		for (int j = 1; j <= 100; j += 2) {
			if (!B) continue;
			a[i][j] = '#';
			--B;
		}
	}

	for (int i = 100; i >= 51; --i) {
		for (int j = 1; j <= 100; ++j) a[i][j] = '#';
	}
	for (int i = 100; i >= 51; i -= 2) {
		for (int j = 1; j <= 100; j += 2) {
			if (!A) continue;
			a[i][j] = '.';
			--A;
		}
	}

	cout << 100 << ' ' << 100 << endl;
	for (int i = 1; i <= 100; ++i) {
		for (int j = 1; j <= 100; ++j) {
			cout << a[i][j];
		}
		cout << endl;
	}
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int, input().split()))
b=list(map(int, input().split()))
c=list(map(int, input().split()))

ans=0
for i in range(n):
    ans+=b[a[i]-1]
for j in range(n-1):
    if(a[j+1]-a[j]==1):
        ans+=c[a[j]-1]
print(ans)

Measured memory_bytes: 3064
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/
const int mod = 1000000007;

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

int main(){
ll n,m,d;
cin>>n>>m>>d;
if(d==0){
    cout<<(ld)(m-1)/n<<endl;
}
else{
    cout(10)<<(ld)2*(n-d)*(m-1)/(n*n)<<endl;
}
return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> d(n);
    for(int i = 0; i < n; i++) cin >> d[i];
    sort(d.begin(), d.end());
    cout << d[n/2] - d[n/2 - 1] << endl;
}

Measured memory_bytes: 640
#include <stdio.h>

int main(void){
	
	int i,n,max,min,a;
	long long int sum=0;
	
	max=-1000000;
	min=1000000;
	
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a);
		if(a>max) max=a;
		if(a<min) min=a;
		sum+=a;
	}
	
	printf("%d %d %lld\n",min,max,sum);
	
	return 0;
}

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

{
     int n,d,x,i,j,a[100],s;
 scanf("%d%d%d",&n,&d,&x);
 
  for(i=0;i<n;i++)
   scanf("%d",&a[i]);
   s=0;
  for(i=0;i<n;i++){
  for(j=1;j<=d;j=j+a[i])
   s=s+1;
}
 
  printf("%d\n",s+x);
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
using namespace std;
 
int main(){
    int W, H;
 
    while (1){
        cin >> H >> W;
 
        if (W == 0 && H == 0)break;
 
        for (int i = 0; i < H; i++){
            for (int j = 0; j < W; j++){
                 
                    cout << "#";
                 
                
            }
            cout << "\n";
        }
 
        cout << endl;
    }
 
    return 0;
}

Measured memory_bytes: 1152
ns = input().split(" ")
k = int(ns[0])
x = int(ns[1])
l = [x]
if k == 1:
  print(l[0])
else:
  for i in range(1,k):
    np = x + i
    nm = x - i
    if np <= 20000:
      l.append(np)
    if nm >= -20000:
      l.append(nm)
  l2 = sorted(l)
  
  print(*l2)

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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};


void solve(long long N, std::vector<long long> x, std::vector<long long> y){
    double ans = 0.0;
    double cnt = 0;
    VI permutation(N);
    iota(ALL(permutation), 0);
    do {
        cnt += 1.0;
        REP1(i, N) {
            double xx = (x[permutation[i-1]]-x[permutation[i]]);
            double yy = (y[permutation[i-1]]-y[permutation[i]]);
            ans += sqrt(xx * xx + yy * yy);
        }
    } while (next_permutation(ALL(permutation)));

    printf("%.8f\n", (ans / cnt));
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> x(N);
    std::vector<long long> y(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&x[i]);
        scanf("%lld",&y[i]);
    }
    solve(N, std::move(x), std::move(y));
    return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = (int)(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = (int)(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define REVERSE(x) reverse((x).begin(), (x).end())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << '\n'
#define endl '\n'

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-10;

constexpr int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
constexpr int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

template<typename T>
class CoordinateCompression{
    std::vector<T> dat;
    int s;
    int n;

public:
    CoordinateCompression(const std::vector<T>& dat_, int s_ = 0, bool uni = true){
        build(dat_, s_, uni);
    }

    void build(const std::vector<T>& dat_, int s_ = 0, bool uni = true){
        dat = dat_;

        std::sort(dat.begin(), dat.end());
        if(uni){
            dat.erase(std::unique(dat.begin(), dat.end()), dat.end());
        }

        s = s_;

        n = (int)dat.size();

        return;
    }

    int get(T x){
        return (int)(std::lower_bound(dat.begin(), dat.end(), x) - dat.begin()) + s;
    }

    T restore(int k){
        return dat[k - s];
    }

    int size(void){
        return n;
    }
};

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

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

lint dp[301][301][301];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

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

    vector<int> h(n + 1, 0);
    reps(i, n){
        cin >> h[i];
    }

    CoordinateCompression<int> c(h);

    rep(i, 301) rep(j, 301) rep(l, 301) dp[i][j][l] = LLINF;
    dp[0][0][0] = 0;

    rep(i, n){
        rep(j, k + 1){
            rep(l, c.size()){
                chmin(dp[i + 1][j][c.get(h[i + 1])], dp[i][j][l] + max(h[i + 1] - c.restore(l), 0));
                if(j < k){
                    chmin(dp[i + 1][j + 1][l], dp[i][j][l]);
                }
            }
        }
    }

    lint ans = LLINF;
    rep(j, k + 1){
        rep(l, c.size()){
            chmin(ans, dp[n][j][l]);
        }
    }

    cout << ans << endl;

    cout << flush;

    return 0;
}

Measured memory_bytes: 213376
// ??????????????????????????????????????????????????£???X??§?¨??????????????????°?????\???????????????
// ?¨??????????????????????????????????????????£???X??§?¨??????¨?????????X??§?¨???????????????¨????????¨??§
// ??????1?????°??¢?????¢???????¨?????????????
// ????????????????????§???????????¨??§O(n)??§??¨???????°´?????¢???????¨?????????????
// ????°´??????????????¢??????????´?????????§?¨???????
// ???????¨????????????????????????????????????????????????????????????£???X??§?¨????????????????X??§?¨?????????§????¨????????£???°????????????????????°????????????

#include <stdio.h>
#include <string.h>

// ??§???????????????????????????????????§?????????
int d[20010] = {};
int sum[20010] = {};
int to[20010] = {};
int v[20010] = {};

int main() {


  // ??£?¨?
  int i, X, Y, n, ans, k;   // i ??? s ?????????????????°??? X ??? X??§?¨???? Y ??? Y??§?¨?
  char s[20010];


  // ??\???
  scanf( "%s", s );
  n = strlen( s );


  // ??????????????????0??¨???????????¨??????????????§??????????????¨?????????????????????????¨????
  Y = 0;           // ????????????
  int ma = Y;      // ??????????????§???
  int mi = Y;      // ??????????????????

  for ( i = 0; i < n; i++ ) {
    if ( s[i] == '/' ) {
      Y++;
    }else if ( s[i] == '_' ) {
    }else {
      Y--;
    }
    if ( Y > ma ) ma = Y;
    if ( Y < mi ) mi = Y;
  }
  // ??\??????????????????????????????0??¨??????


  //?????????

  // d ???????????????????????????????????£???X??§?¨????
  for ( Y = 0; Y < ma - mi + 1; Y++ ) {
    d[ Y ] = -1;
  }
  // to ????????????X??§?¨????????????¨?????°???????°´??????????????¢?????????????????????
  // X??§?¨???? 0 ??? n + 1 ?????§??§???????????¨?????¨???
  for ( X = 0; X < n + 1; X++ ) {
    to[ X ] = -1;
  }

  Y = -mi;
  d[ Y ] = 0;
  ans = 0;         //?´???????
  sum[ 0 ] = 0;    //?´????????????\????????????


  //?¨????

  for ( i = 0; i < n; i++ ) {

    X = i + 1;

    if ( s[i] == '/' ) {
      Y++;
      if ( d[ Y ] != -1 ) {
	ans += X - d[ Y ] - 1;
	to[ d[ Y ] ] = X;
      }
    }else if ( s[i] == '_' ) {
    }else {
      Y--;
    }
    d[ Y ] = X;
    sum[ X ] = ans;

  }


  // ????°´????????????????¨????

  k = 0;      // ?°´?????????????????°

  for ( X = 0; X < n + 1; X++ ) {

    if ( to[ X ] != -1 ) {

      v[ k ] = sum[ to[ X ] ] - sum[ X ];
      k++;
      X = to[ X ] - 1;

    }

  }


  //??????

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

  printf( "%d", k );
  for ( i = 0; i < k; i++ ) {
    printf( " %d", v[ i ] );
  }
  printf( "\n" );

  return 0;

}

Measured memory_bytes: 800
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int ans = INF;
    int n = s.size();
    rep(i, 0, n - 2){
        string t = "";
        t += s[i];
        t += s[i + 1];
        t += s[i + 2];
        int num = stoi(t);
        ans = min(ans, abs(num - 753));
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main{
	static class FastReader {

        BufferedReader br;
        StringTokenizer st;

        private FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

	 int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
	}

	int[] nextIntArrayOne(int n) {
				int[] a = new int[n+1];
				for (int i = 1; i < n+1; i++)
					a[i] = nextInt();
				return a;
	}

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

	public static void main(String[] args) {
		FastReader s =new FastReader();
		
		StringBuilder str = new StringBuilder();
		
			int n = s.nextInt();
			if(n >= 30) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}
			
		
		System.out.println(str);
	}

	

}



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

int main(int argc, const char * argv[]) {
    // insert code here...
    int a, b;
    cin >> a >> b;
    
    if (b >= a) cout << a << endl;
    else cout << a - 1 << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unordered_map>
 
using namespace std;
 
#define endl '\n'
#define ll long long
#define int long long
const int32_t INFint = 1e9;
const ll INFll = 1e18;
#define MOD 1000000007ll
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
#define vi vector < int >
#define pii pair < int , int >
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define foreach(it,v) for( __typeof((v).begin())it = (v).begin() ; it != (v).end() ; it++ )
 
#define deb1(x)                cout<<#x<<": "<<x<<endl
#define deb2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define deb3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define deb4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define deb5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define deb6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
 
#define For(i, a, b) for (ll i = a; i < b; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define all(v) v.begin(),v.end()
#define gll(a,n) for(ll i=0;i<n;i++) cin>>a[i];
#define gint(a,n) for(int i=0;i<n;i++) cin>>a[i];
#define setZero(a,n) for(int i=0;i<n;i++) a[i]=0;
#define printArray(a,s,e) for(int i=s;i<e;i++) {cout << a[i] << " ";} cout << endl;
//---------------------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------- 
int32_t main(){fast;
	

	int t;
	// cin >> t;
	t = 1;
	while(t--){
		int n;
		cin >> n;
		int arr[n];
		gint(arr, n);

		int dp[n];
		dp[0] = 0;
		dp[1] = abs(arr[1] - arr[0]);

		for(int i=2;i<n;i++){
			dp[i] = min( (abs(arr[i] - arr[i-1]) + dp[i-1]) , (abs(arr[i] - arr[i-2]) + dp[i-2]) );
		}

		cout << dp[n-1];
	}
}







Measured memory_bytes: 1792
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define int long long
#define CONTAINS_VEC(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
#define CONTAINS_SET(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }

bool field[101][101];

signed main()
{
	int W, H;
	cin >> H >> W;
	REP(y, H)
	{
		string s;
		cin >> s;
		REP(x, W)
		{
			field[x][y] = s[x] == '#';
		}
	}

	bool skip_w[101] = {};
	bool skip_h[101] = {};

	for (int x = 0; x < W; x++)
	{
		bool has_black = false;
		for (int y = 0; y < H; y++)
		{
			if (field[x][y]) 
				has_black = true;
		}
		if (!has_black)
		{
			skip_w[x] = true;
		}
	}

	for (int y = 0; y < H; y++)
	{
		bool has_black = false;
		for (int x = 0; x < W; x++)
		{
			if (field[x][y])
				has_black = true;
		}
		if (!has_black)
		{
			skip_h[y] = true;
		}
	}

	for (int y = 0; y < H; y++)
	{
		if (!skip_h[y])
		{
			for (int x = 0; x < W; x++)
			{
				if (!skip_w[x])
				{
					cout << (field[x][y] ? '#' : '.');
				}
			}
			cout << endl;
		}
	}
}



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

#define fi first
#define se second
#define forn(i,n) for(int i=0; i< (int)n; ++i)
#define for1(i,n) for(int i=1; i<= (int)n; ++i)
#define fore(i,l,r) for(int i=(int)l; i<= (int)r; ++i)
#define ford(i,n) for(int i=(int)(n) - 1; i>= 0; --i)
#define fored(i,l,r) for(int i=(int)r; i>= (int)l; --i)
#define pb push_back
#define el '\n'
#define d(x) cout<< #x<< " " << x<<el
#define ri(n) scanf("%d",&n)

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<char,int> pci;
typedef tuple<int, int, int> tiii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;

const int MAXN = 1e5+200;
const int INF = 1e9;
int dp[MAXN];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int n;
    cin>>n;
    int h[n];
    forn(i,n) cin>> h[i];
    dp[0]=0;

    for1(i,n-1){
        dp[i]=INF;
        for1(j,2){
            if(i-j>=0){
                dp[i]= min(dp[i], dp[i-j] + abs(h[i]- h[i-j]));
            }
        }
    }
    cout<< dp[n-1]<<el;


}



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

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

int main()
{
	long long a, b, c; cin >> a >> b >> c;
	if (c <= a + b) {
		cout << "No\n";
		return 0;
	}

	long long v = c - a - b;
	v *= v;

	cout << (v > 4 * a * b ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
int main() {
	ll n, m, d;
	cin >> n >> m >> d;
	if(d==0)printf("%.12lf\n", (double)(n - d)*(double)(m - 1) / (double)(n*n));
	else printf("%.12lf\n", (double)(n - d)*(double)(m - 1)*2 / (double)(n*n));
	return 0;
}

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

int main() {
    int H, W;
    cin >> H >> W;

    const int MAXH = 2010;
    const int MAXW = 2010;

    static string S[MAXH];
    for (int r = 0; r < H; r++) {
        cin >> S[r];
    }

    static int height[MAXH][MAXW];
    for (int c = 0; c < W; c++) {
        int t = 0;
        int status = -1; // 1:同じ, 0:異なる
        for (int r = 0; r < H; r++) {
            if (c > 0 and (S[r][c - 1] == S[r][c]) != status) {
                t = r;
                status = (S[r][c - 1] == S[r][c]);
            }
            height[r][c] = r - t + 1;
        }
    }

    // 最大長方形問題
    int ans = 0;
    for (int r = 0; r < H; r++) {
        static int L[MAXW], R[MAXW];
        memset(L, 0, sizeof(L));
        stack<int> st;
        for (int c = 0; c < W; c++) {
            while (!st.empty() and height[r][st.top()] >= height[r][c]) st.pop();
            L[c] = st.empty() ? 0 : (st.top() + 1);
            st.push(c);
        }

        memset(R, 0, sizeof(R));
        while (!st.empty()) st.pop();
        for (int c = W - 1; c >= 0; c--) {
            while (!st.empty() and height[r][st.top()] >= height[r][c]) st.pop();
            R[c] = st.empty() ? (W - 1) : (st.top() - 1);
            st.push(c);
        }

        for (int c = 0; c < W; c++) {
            ans = max(ans, (R[c] - max(0, L[c] - 1) + 1) * height[r][c]);
        }
    }
    cout << ans << endl;

    // debug
    /*
    cerr << "board" << endl;
    for (int r = 0; r < H; r++) {
        cerr << S[r] << endl;
    }
    cerr << "top" << endl;
    for (int r = 0; r < H; r++) {
        for (int c = 0; c < W; c++) {
            cerr << height[r][c] - 1;
        }
        cerr << endl;
    }
    */

    return 0;
}

Measured memory_bytes: 20224
<>;for(glob<>){
	$x+=$_;$X+=$-=1-($t=2*--$|-1)*$x;$-&&($x=$t);
	$y+=$_;$Y+=$-=1-($t=2*--$|-1)*$y;$-&&($y=$t);
	--$|
}
print$X<$Y?$X:$Y

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

namespace procon
{
    public class Program
    {
        public static void Main(string[] args)
        {
            while (true)
            {
                var inputs = Console.ReadLine().Split().Select(int.Parse).ToArray();
                if (inputs[0] == 0 && inputs[1] == 0) break;

                for (int i = 0; i < inputs[0]; i++)
                {
                    Console.WriteLine(new string('#', inputs[1]));
                }

                Console.WriteLine();
            }
        }
    }
}

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

int main(){
	int pasta[3],juice[2],sum;
	for(int i=0;i<3;i++)cin>>pasta[i];
	for(int i=0;i<2;i++)cin>>juice[i];
	sum=pasta[0]+juice[0]-50;
	for(int i=0;i<3;i++){
		for(int j=0;j<2;j++){
			if(sum>(pasta[i]+juice[j]-50))sum=pasta[i]+juice[j]-50;
		}
	}
	cout<<sum<<endl;
	}

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
	ll n;cin>>n;
	vl a(n);
	rep(i,n)cin>>a[i];
	deque<ll>b;
	rep(i,n){
		if(i%2==0){
			b.PB(a[i]);
		}
		else{
			b.push_front(a[i]);
		}
	}
	if(n%2==1){
		reverse(all(b));
	}
	rep(i,n){
		if(i==n-1)cout<<b[i]<<endl;
		else cout<<b[i]<<" ";
	}
}

Measured memory_bytes: 5376
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	tmp = input[0].split(" ");
	//文字列から10進数に変換するときはparseIntを使います
	var a = ((tmp[0]+tmp[1])-0);
    var ret = "No"
    for (var i=0; i<=100100; i++)
    {
      if(i*i==a)
      {
        ret = "Yes";
        break;
      }
    }
	//出力
	console.log('%s',ret);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 32308
x = int(input())
if 400 <= x <= 599:
    print(8)
elif 600 <= x <= 799:
    print(7)
elif 800 <= x <= 999:
    print(6)
elif 1000 <= x <= 1199:
    print(5)
elif 1200 <= x <= 1399:
    print(4)
elif 1400 <= x <= 1599:
    print(3)
elif 1600 <= x <= 1799:
    print(2)
elif 1800 <= x <= 1999:
    print(1)

Measured memory_bytes: 9192