akhauriyash/Code-Regression huggingface dataset:
# C - pushpush
# https://atcoder.jp/contests/abc066/tasks/arc077_a

from collections import deque

n = int(input())
a = input().split()

b = deque(maxlen=n)

for i in range(n):
    if n%2 == 0: 
        if i%2 == 0:
            b.append(a[i])
        else:
            b.appendleft(a[i])
    else:
        if i%2 == 0:
            b.appendleft(a[i])
        else:
            b.append(a[i])
print(*b)

Measured memory_bytes: 24388
// AtCoder Beginner Contest 160 C.cpp

#include <iostream>
#include <vector>
#include <valarray>
#include <algorithm>

using namespace std;

int main()
{
	int k, n, max;
	cin >> k >> n;
	vector<int>a(n);
	valarray<int>b(n);
	for (auto& i : a) {
		cin >> i;
	}
	sort(a.begin(), a.end());
	for (int i = 0; i < n - 1; i++) {
		b[i] = a[i + 1] - a[i];
	}
	b[b.size() - 1] = (k - a[a.size() - 1]) + a[0];
	max = b.max();
	cout << k - max << endl;
}

Measured memory_bytes: 1792
class Factorial:
    def __init__(self, max_fact, mod):
        #mod should be prime number
        #using homogeneous_product(n,r), max_fact ≧ max(n+r-1)
        f = [1] * 2 + [None] * (max_fact - 1)
        for idx in range(2, max_fact + 1):
            f[idx] = f[idx - 1] * idx % mod
        fi = [None] * max_fact + [pow(f[-1], mod - 2, mod)]
        for idx in range(max_fact, 0, -1):
            fi[idx - 1] = fi[idx] * idx % mod
        self.mod = mod
        self.f = f
        self.fi = fi

    def factorial(self, n):
        return self.f[n]

    def factorial_inverse(self, n):
        return self.fi[n]

    def combination(self, n, r):
        f = self.f
        fi = self.fi
        return f[n] * fi[r] * fi[n - r] % self.mod

    def permutation(self, n, r):
        return self.f[n] * self.fi[n - r] % self.mod

    def homogeneous_product(self, n, r):
        f = self.f
        fi = self.fi
        return f[n + r - 1] * fi[r] * fi[n - 1] % self.mod


max_fact = 5 * 10**5
mod = 10**9 + 7
fact_instance = Factorial(max_fact, mod)
comb = fact_instance.combination
perm = fact_instance.permutation

N, M = [int(_) for _ in input().split()]
ans = 0
for p in range(N + 1):
    ans += (-1)**p * comb(N, p) * perm(M - p, N - p)
    ans %= mod
ans *= perm(M, N)
ans %= mod
print(ans)


Measured memory_bytes: 106360
#include<iostream>
#include<cmath>
#include<string>
#include<string.h>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<stack>
#include<set>
#include<climits>
#include<deque>
#include<tuple>
#include<iomanip>
using namespace std;
#define int                  int64_t
#define double               long double
#define vi                   vector<int>
#define di                   deque<int>
#define si                   set<int>
#define vpii                 vector<pair<int,int>>
#define pi                   pair<int,int>
#define pub                  push_back
#define puf                  push_front
#define pob                  pop_back
#define pof                  pop_front
#define all(a)               (a).begin(),(a).end()
#define rall(a)              (a).rbegin(),(a).rend()
#define PI                   3.1415926535897932384626433832795
#define read(a)              for(auto& x:a) cin>>x
#define speak(a)             for(auto x:a) cout<<x<<' '
#define rep(i,s,n)           for(int i=s;i<n;++i)
#define repe(i,s,n)          for(int i=s;i<=n;++i)
#define repr(i,n,s)          for(int i=n;i>=s;--i)
#define endl                 '\n'
#define gap                  ' '
#define MAX                  LLONG_MAX
#define MIN                  LLONG_MIN
#define min3(a,b,c)          min(a, min(b, c))
#define max3(a,b,c)          max(a, max(b, c))
#define MOD                  1000000007
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    map<vi,int>mp;
    int n,i=1;cin>>n;
    vi a(n),b(n),q;read(a);read(b);
    repe(i,1,n) q.pub(i);
    do{mp[q]=i++;}while(next_permutation(all(q)));
    cout<<abs(mp[a]-mp[b]);
}


Measured memory_bytes: 9924
#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;

using lli = long long int;
void YESNO(bool), YesNo(bool);
template <class T1, class T2>
bool chmin(T1 &l, const T2 &r);
template <class T1, class T2>
bool chmax(T1 &l, const T2 &r);

void solve(std::string S)
{
  rep(i, S.size())
  {
    if (S[i] != S[0])
    {
      YesNo(true);
      return;
    }
  }
  YesNo(false);
}

int main()
{
  std::string S;
  std::cin >> S;
  solve(S);
  return 0;
}

// -- lib
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }

template <class T1, class T2>
bool chmin(T1 &l, const T2 &r)
{
  return (l > r) ? (l = r, true) : false;
}

template <class T1, class T2>
bool chmax(T1 &l, const T2 &r)
{
  return (l < r) ? (l = r, true) : false;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m;
string a[101];
int main(){
	ios::sync_with_stdio(false);
	cin>>n>>m;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	sort(a+1,a+1+n);
	for(int i=1;i<=n;i++)
		cout<<a[i];
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int>a(n,0);
  vector<int>b(n,0);
  vector<int>atb(n,0);
  for(int i=0;i<n;i++){
    cin >> atb[i];
  }
  for(int i=0;i<n;i++){
    a[i]=(i)*20000+1;
    b[i]=(n-i-1)*20000;
  }
  for(int i=0;i<n;i++){
    b[atb[i]-1]+=i+1;
  }
  for(int i=0;i<2;i++){
    for(int j=0;j<n;j++){
      if(i==0)cout << a[j];
      else cout << b[j] ;
      if(j==n-1)continue;
      cout << " ";
    } 
    cout << endl;
  }
  return 0;
}




Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INTINF = 1<<29;
const ll LLINF = 1LL<<61;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int DX[8]={ 0, 1, 0,-1, 1, 1,-1,-1};
const int DY[8]={ 1, 0,-1, 0, 1,-1, 1,-1};


int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  char x,y;
  cin >> x >> y;
  if(x<y){
      cout << "<" << endl;
  }else if(x>y){
      cout << ">" << endl;
  }else{
      cout << "=" << endl;
  }
}


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

using namespace std;

long func(long a,long b){
	int c = 0;
	while(a!=0||b!=0){
		a = a / 10;
		b = b / 10;
		c++;
	}
	return c;
}

int main(void){
	long n,res;
	int flag = 1;
	cin >> n;
	long k = (long)sqrtl(n);
	for(long i=k;i>0;i--){
		if(n%i == 0){
			res = func(i,n/i);
			break;
		}
	}
	cout << res << endl;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<char, ll> pcl;

#define m0(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
#define rep(i, n) for(int i = 0; i < (n); i++)
#define asort(x) sort(all(x));
#define dsort(x, t) sort(x.begin(), x.end(), greater<t>());
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define MINS(m, s) m.insert(mp(s, 1));
#define MFIN(m, s) m.find(s) != m.end()
#define mp make_pair
#define pb push_back
#define INF (1 << 29)
const int mod = 1000000007;

vector<ll> res;
void n_Prime(ll n) {
    ll a;
    a = 2;
    while(n >= a * a) {
        if(n % a == 0) {
            res.push_back(a);
            n /= a;
        } else {
            a++;
        }
    }
    res.push_back(n);
}

int main() {
    ll n, cnt;
    vector<ll> pre;

    cin >> n;
    cnt = 0;
    if(n == 1) {
        cout << "0" << endl;
        exit(0);
    }
    n_Prime(n);
    pre.push_back(res[0]);
    cnt++;

    for(int i = 1; i < res.size(); ++i) {
        bool ok = true;
        for(ll j = 0; j < pre.size(); j++) {
            if(res[i] == pre[j]) {
                ok = false;
                break;
            }
        }
        if(ok) {
            pre.push_back(res[i]);
            cnt++;
        } else {
            ll ren = res[i];
            ll tmp = res[i];
            bool ok2 = true;
            ++i;
            if(res[i] == 0) {
                cout << cnt << endl;
                exit(0);
            }
            while(!ok) {
                if(ren != res[i]) {
                    ok2 = false;
                    --i;
                    break;
                }
                tmp *= res[i];
                ++i;

                for(ll j = 0; j < pre.size(); j++) {
                    if(tmp == pre[j]) {
                        break;
                    }
                    if(j == pre.size() - 1) {
                        if(pre[j] != tmp) {
                            ok = true;
                            --i;
                        }
                    }
                }
                if(res[i] == 0) {
                    cout << cnt << endl;
                    exit(0);
                }
            }
            if(ok2) {
                pre.push_back(tmp);
                cnt++;
            }
        }
    }

    cout << cnt << endl;
    return 0;
}

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



int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s;
    cin>>s;
    if(s.size()==2)cout<<s<<endl;
    else cout<<s[2]<<s[1]<<s[0]<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#ifdef ONLINE_JUDGE
#define D(...)
#else
#define D(...)cerr<<__LINE__<<":"<<"["<<#__VA_ARGS__<<"]->",P(__VA_ARGS__)
#endif
void P(){cerr<<endl;} 
template<typename H,typename...T>void P(H h,T...t){cerr<<h<<" ";P(t...);}
int main()
{
    ios::sync_with_stdio(false);cin.tie(0);
    int n;cin>>n;
    for(int i=0;4*i<=n;++i){
        if((n-4*i)%7==0){
            return cout<<"Yes",0;
        }
    }
    cout<<"No"<<endl;



}

Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
using namespace std;


int main(){
    // あとで消す
    //std::ifstream in("din1.txt");
    //std::cin.rdbuf(in.rdbuf());

    long N;
    cin >> N;

    long long val=0;

    // 2 -> 1 1
    // 3 -> 3 1+2
    // 4 -> 6 1+2+3

    // 12 ->  1+2+...+11

    // 1...N-1
    if(N%2==0){
        val = N/2+N*((N-1)/2);
    }else{
        val = (N)*((N-1)/2);
    }

    cout << val << endl;

    return 0;
}


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

p_min = []
x_min = float('inf')
for x in p:
    x_min = min(x, x_min)
    p_min.append(x_min)

ans = 0
for i in range(n):
    if p[i] <= p_min[i]:
        ans += 1
print(ans)

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

#define ll long long
#define sd(x) scanf("%d", &(x))
#define pii pair<int, int>
#define F first
#define S second
#define all(c) ((c).begin()), ((c).end())
#define sz(x) ((int)(x).size())
#define ld long double

template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
	os<<"("<<p.first<<", "<<p.second<<")";
	return os;
}

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
	os<<"{";
	for(int i = 0;i < (int)v.size(); i++){
		if(i)os<<", ";
		os<<v[i];
	}
	os<<"}";
	return os;
}

#ifdef LOCAL
#define cerr cout
#else
#endif

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

int getMid(int l, int r, int n){
    if(l < r) return (l + r) / 2;
    else{
        int A = n - l, B = r;
        int delta = (A + B) / 2;
        if(A >= B) return (l + delta) % n;
        else return (r - delta + n) % n;
    }
}
int dist(int a, int b, int n){
    return (b - a + n) % n;
}
char s[100];

int val[100005];
bool asked[100005];
int ask(int pos){
    if(asked[pos]) return val[pos];
    printf("%d\n", pos);
    fflush(stdout);
    int v;
    scanf("%s", s);
    asked[pos] = 1;
    if(s[0] == 'M') return val[pos] = 1;
    if(s[0] == 'F') return val[pos] = 0;
    return -1;
}

int main(){
    int n; scanf("%d", &n);
    int v_0 = ask(0);
    if(v_0 == -1) return 0; 
    int v_mid = ask(n / 2);
    if(v_mid == -1) return 0;
    int l, r;
    if(v_mid == (v_0 + n / 2) % 2) l = n / 2, r = 0;
    else l = 0, r = n / 2;
    while(1){
        int mid = getMid(l, r, n);
        int v = ask(mid);
        if(v == -1) return 0;
        int d = dist(l, mid, n) % 2;
        if(v == (val[l] + d) % 2){
            l = mid;
        } else r = mid;
    }
}

Measured memory_bytes: 980
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(), (x).end()  //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
#define SZ(x) ((int)(x).size)
const long long mod = 1e9+7;
typedef priority_queue<int> PQ;
typedef vector<long long> Vl;
typedef vector<int> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<VS> VSS;  
typedef vector<VI> VVI;   // VVI a(n,vector<int>(m)) n * m 
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef vector<pair<int, int> > PS;
typedef long long ll;  //ll とdoubleは違う
// cout << << endl;
// cin >> ;
template<typename T>
T gcd(T a, T b){
	return b != 0 ? gcd(b, a % b) : a;
}    
template<typename T>
T lcm(T a, T b){
    return a/gcd(a,b)*b;
}       

int main(){
    ll c=0,d=0,k=0,n,h,w,l,r,ans=0,ptr=0;
    string s,s1,s2;
    cin >> n;
    VI a(n);

    rep(i,n){
        cin >> a[i];
	}
    sort(ALL(a));

    while(ptr<n){
        int cc = a[ptr], f=0;
        while (ptr<n&&a[ptr] == cc){
            f++;
            ptr++;
        }
        ans += f%2;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
n,k=map(int,input().split())
a=list(map(int,input().split()))
b=[]
L=len(bin(k))-2
for x in a:
	b.append(bin(x)[2:])
	L=max(L,len(bin(x))-2)
for i in range(n):
	b[i]="0"*(L-len(b[i]))+b[i]
X=0
for i in range(L):
	if 2**(L-i-1)<=k:
		one=0
		for j in range(n):
			if b[j][i]=="1":
				one+=1
		if one<n-one:
			k-=2**(L-i-1)
			X+=2**(L-i-1)
ans=0
for x in a:
	ans+=X^x
print(ans)

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

using namespace std;
#define ll long long
#define ld long double

#define endl '\n'
#define FAST                      \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
const int MAXN = 1e5 + 5;
ll fastPow(ll x, ll b)
{
    if (b == 0)
        return 1;
    else if (!(b & 1))
    {
        return fastPow(x * x, b / 2);
    }
    else
        return x * fastPow(x * x, (b - 1) / 2);
}
    //__builtin_popcount ();
    int main()
{
    FAST
int x;
cin>>x;
set<int>s;
for (int i = 0; i < x; i++)
{
    int a;
    cin>>a;
s.insert(a);
}
if(x==s.size())
cout<<"YES"<<endl;
else
{
    cout<<"NO"<<endl;
}



    return 0;
}

Measured memory_bytes: 9600
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)x.size())
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
template<class T> inline void read(T &x){
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
template<class T> inline void umin(T &x, T y){x=x<y?x:y;}
template<class T> inline void umax(T &x, T y){x=x>y?x:y;}
inline ui R() {
	static ui seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}
const int N = 2300;
int n,m,a,b;char s[N][N];
void A(int x, int y){
	if(s[x][y]=='.'&&s[x][y+1]=='.'&&a){
		a--;s[x][y]='<';s[x][y+1]='>';
	}
}
void B(int x, int y){
	if(s[x][y]=='.'&&s[x+1][y]=='.'&&b){
		b--;s[x][y]='^';s[x+1][y]='v';
	}
}
int main() {
	read(n);read(m);read(a);read(b);
	rep(i,1,n)rep(j,1,m)s[i][j]='.';
	if((n&1)&&(m&1)){
		if(n==1){for(int j=1;j+1<=m;j+=2)A(1,j);}
		else if(m==1){for(int i=1;i+1<=n;i+=2)B(i,1);}
		else{
		for(int i=2;i+1<=m;i+=2)A(n,i);
		for(int i=1;i+1<=n;i+=2)B(i,m);
		if(b&1)B(n-1,1),A(n-2,1);
		for(int i=1;i+1<=n;i+=2)for(int j=1;j+1<=m;j+=2)
			if(a)A(i,j),A(i+1,j);else B(i,j),B(i,j+1);
		}
	}
	else{
		if(n&1)for(int j=1;j+1<=m;j+=2)A(n,j);
		if(m&1)for(int j=1;j+1<=n;j+=2)B(j,m);
		for(int i=1;i+1<=n;i+=2)for(int j=1;j+1<=m;j+=2)
			if(a)A(i,j),A(i+1,j);else B(i,j),B(i,j+1);
	}
	if(a||b)puts("NO");
	else{
		puts("YES");rep(i,1,n){rep(j,1,m)printf("%c",s[i][j]);puts("");}
	}
	return 0;
}


Measured memory_bytes: 5248
#include<stdio.h>

int main(void){

    int n,t,c,t2,i,mc;
    mc = 1001;
    
    scanf("%d",&n);
    scanf("%d",&t);
    
    for(i=0;i<n;i++){
        scanf("%d",&c);
        scanf("%d",&t2);
        
        if(t2 <= t && c < mc){
            mc = c;
        }
    }
    
    if(mc == 1001){
        printf("TLE");
    }else{
        printf("%d",mc);
    }
    return 0;
}

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

ll gcd(ll a, ll b) {
  if (a < b) swap(a, b);
  if (a % b == 0) return b;
  return gcd(a % b, b);
}
ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

int main(void) {
  int n;
  cin >> n;
  vector<ll> t(n);
  rep(i, n) {
    cin >> t[i];
  }

  ll ans = t[0];
  for (int i = 1; i < n; i++) {
    ans = lcm(ans, t[i]);
  }

  cout << ans << endl;
  
  return 0;
}

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

using namespace std;

#define endl '\n'

typedef long long int64;
typedef pair<int,int> pii;
typedef vector<int> vi;

const int oo = 0x3f3f3f3f;
const double eps = 1e-9;
const int maxn = 100000 + 10;

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

#ifdef MARX
	freopen("data.in", "r", stdin);
	// freopen("data.out", "w", stdout);
#endif

	int n; cin >> n;

	vector<int64> v(n), d(n);

	int64 sum = 0;

	for (int i = 0; i < n; ++i){
		cin >> v[i];
		sum += v[i];
	}

	int64 tot = 1LL * n * (n + 1) / 2;

	if (sum % tot){
		cout << "NO" << endl;
		return 0;
	}

	int64 k = sum / tot;

	bool ok = true;

	for (int i = 0; i < n; ++i){
		d[i] = v[i] - v[(i - 1 + n) % n];
		d[i] = k - d[i];

		// cout << d[i] << endl;

		if (d[i] < 0 || (d[i] % n > 0) )
			ok = false;
	}

	cout << (ok ? "YES" : "NO") << endl;

	return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <stdlib.h>

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

int main(){
	int n,ans=0;
	scanf("%d",&n);
	int dp[n][3],a[n][3];
	for(int i=0;i<n;i++){
		scanf("%d%d%d",&a[i][0],&a[i][1],&a[i][2]);
		dp[i][0] = 0,dp[i][1] = 0,dp[i][2] = 0;//dpの初期化
	}
	dp[0][0] = a[0][0],dp[0][1] = a[0][1],dp[0][2] = a[0][2];//初期値
	for(int i=1;i<n;i++){
		for(int j=0;j<3;j++){
			for(int k=0;k<3;k++){
				if(j!=k)
					dp[i][k]=max(dp[i][k],dp[i-1][j]+a[i][k]);
			}
		}
	}
	for(int i=0;i<3;i++){
		ans=max(ans,dp[n-1][i]);
	}
	printf("%d",ans);
}


Measured memory_bytes: 4016
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {
	
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		
		int n = sc.nextInt();
		
		for (int i = 0; i < n; i++) {
			
			char[][] board = new char[8][8];
			for (int y = 0; y < 8; y++) {
				board[y] = sc.next().toCharArray();
			}
			
			int sx = sc.nextInt() - 1;
			int sy = sc.nextInt() - 1;
			
			bomb(board, sx, sy);
			
			out.println("Data " + (i + 1) + ":");
			for (int y = 0; y < 8; y++) {
				for (int x = 0; x < 8; x++) {
					out.print(board[y][x]);
				}
				out.println();
			}
		}
		out.flush();
	}
	
	static void bomb(char[][] board, int bx, int by) {
		if (board[by][bx] == '1') {
			board[by][bx] = '0';
			for (int x = max(0, bx - 3); x <= min(7, bx + 3); x++) {
				bomb(board, x, by);
			}
			for (int y = max(0, by - 3); y <= min(7, by + 3); y++) {
				bomb(board, bx, y);
			}
		}
	}
	
	static int max(int a, int b) {
		return a < b ? b : a;
	}
	
	static int min(int a, int b) {
		return a < b ? a : b;
	}
	
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) return false;
		}
		return true;
	}
	
	private byte readByte() {
		if (hasNextByte()) {
			return buffer[ptr++];
		} else {
			return -1;
		}
	}
	
	private boolean isPrintableChar(int c) {
		return '!' <= c && c <= '~';
	}
	
	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
	}
	
	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}
	
	public String next() {
		if (!hasNext()) { throw new NoSuchElementException(); }
		StringBuilder sb = new StringBuilder();
		byte b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	
	public int nextInt() {
		if (!hasNext()) { throw new NoSuchElementException(); }
		int n = 0;
		boolean minus = false;
		byte b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) { throw new NumberFormatException(); }
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	
}

Measured memory_bytes: 24064
# coding: utf-8
n, x = map(int,input().split())
A = list(map(int,input().split()))
S = sum(A)
if A[0] > x:
    A[0] = x
for i in range(n-1):
    s = A[i+1] + A[i]
    if s > x:
        A[i+1] -= s - x
print(S - sum(A))

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

int main() {
  int A,B,N,K;  
  string S,T;
  cin >> N >> K;
  for(int i=0;i<N;i++){
    int h;
    cin >> h;
    if(h>=K){
      A++;
    }
    h=0;
  }

  cout << A << endl;

}

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

using ll = long long;
#define ld long double
#define ull unsigned long long int

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  // (i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define ret return

typedef pair<int, int>    pii;
typedef vector<int>       vi;
typedef vector<vi>        vii;
typedef vector<long long> vl;

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

    // 入力
    int n;
    cin >> n;
    int a[n];
    rep(i, n) { cin >> a[i]; }
    // check
    // rep(i, n) {
    //     if (i > 0) cout << " ";
    //     cout << a[i];
    // }

    // 処理
    int maxV = 0;
    rep(i, n) {
        rep(j, n) { maxV = max(maxV, abs(a[i] - a[j])); }
    }
    // 出力
    cout << maxV << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        boolean isEven = n%2==0;
        int m = in.nextInt();
        int mid = (int)Math.floor(n/2.0);
        int quarter = (int)Math.floor(n/4.0);
        for(int i=0; i<m; i++) {
            int offset = (isEven && i>=quarter) ? 1 : 0;
            System.out.print(mid-i);
            System.out.print(' ');
            System.out.println(mid+1+i+offset);
        }
    }
}


Measured memory_bytes: 55784
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
using namespace std;
using ll=long long;
int main(){
  ll n,m,i=0,ans=0;cin>>n>>m;
  vector<pair<ll,ll>>a(n);
  for(int i=0;i<n;i++){
    cin>>a[i].first>>a[i].second;
  }
  sort(a.begin(),a.end());
  while(true){
    ll x=a[i].first,y=a[i].second;
    if(y<m){
      ans+=x*y;
      m-=y;
    }else{
      ans+=x*m;
      break;
    }
    i++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i = (a);i <= (b); i++)
#define ROF(i, a, b) for(int i = (a);i >= (b); i--)
const int N = 3e3 + 11;
const int mod = 998244353;
int f[N], a[N];
int n, s;
void Add(int &x, int y){
    x = (x + y) - (x + y >= mod ? mod : 0);
}
int M(int x, int y){
    return 1LL * x * y % mod;
}
int main(){
    cin>>n>>s;
    FOR(i, 1, n)scanf("%d", &a[i]);
    f[0] = 1;
    int ans = 0;
    FOR(i, 1, n){
        if(a[i] > s)continue;
        if(a[i] == s){
            Add(ans, M(n - i + 1, i));
        }
        else Add(ans, M(f[s-a[i]], n - i + 1));
        ROF(j, s - a[i], 1){
            Add(f[j+a[i]], f[j]);
        }
        Add(f[a[i]], M(f[0], i));
    }
    cout<<ans<<endl;
    return 0;
}


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

int main(){
  int D,G;
  cin>>D>>G;
  G/=100;
  std::vector<int> p(D),c(D);
  for(int i=0;i<D;i++){
    cin>>p[i]>>c[i];
    c[i]/=100;
  }
  int fans=1000000000;
  for(int i=0;i<pow(2,D);i++){
    int k=0;
    int ans=0;
    for(int j=0;j<D;j++){
      if((i>>j)&1){
        k+=(j+1)*p[j]+c[j];
        ans+=p[j];
      }
    }
    for(int j=D-1;j>=0&&k<G;j--){
      if(((i>>j)&1)==0){
        int ll=min((G-k-1)/(j+1)+1,p[j]-1);
        k+=ll*(j+1);
        ans+=ll;
      }
    }
    if(k>=G)fans=min(fans,ans);
  }
  cout<<fans<<endl;
}


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

char f(int on, int cnt){
	if(on==1){
		if(cnt==1)return '.';
		if(cnt==2)return ',';
		if(cnt==3)return '!';
		if(cnt==4)return '?';
		if(cnt==0)return ' ';
	}else if(on==2){
		if(cnt==1)return 'a';
		if(cnt==2)return 'b';
		if(cnt==0)return 'c';
	}else if(on==3){
		if(cnt==1)return 'd';
		if(cnt==2)return 'e';
		if(cnt==0)return 'f';
	}else if(on==4){
		if(cnt==1)return 'g';
		if(cnt==2)return 'h';
		if(cnt==0)return 'i';
	}else if(on==5){
		if(cnt==1)return 'j';
		if(cnt==2)return 'k';
		if(cnt==0)return 'l';
	}else if(on==6){
		if(cnt==1)return 'm';
		if(cnt==2)return 'n';
		if(cnt==0)return 'o';
	}else if(on==7){
		if(cnt==1)return 'p';
		if(cnt==2)return 'q';
		if(cnt==3)return 'r';
		if(cnt==0)return 's';
	}else if(on==8){
		if(cnt==1)return 't';
		if(cnt==2)return 'u';
		if(cnt==0)return 'v';
	}else if(on==9){
		if(cnt==1)return 'w';
		if(cnt==2)return 'x';
		if(cnt==3)return 'y';
		if(cnt==0)return 'z';
	}
}

int main(){
	int n;
	std::cin >> n;
	for(int i = 0; i < n; ++i){
		std::string s;
		std::cin>>s;
		int key[10];
		for(int i=0;i<10;++i)key[i]=0;
		int on=0;
		for(int i = 0; i < s.size();++i){
			if(s[i]!='0'){
				key[s[i]-'0']++;
				on=s[i]-'0';
				
			}else{
				if(on){
					int cnt=key[on];
					if(on==7 || on==9 && key[on]>=4)cnt%=4;
					else if(on==1 && key[on]>=5)cnt%=5;
					else if(on>=1 && on<=9 && on!=9 && on!=7 && on!=1 && key[on]>=3)cnt%=3;
					std::cout<<f(on,cnt);
					//std::cout<<key[on]<<std::endl;
					for(int i=0;i<10;++i)key[i]=0;
				}
				on=0;
			}//44033055505550666011011111090666077705550301110
		}
		std::cout<<std::endl;
	}
	return 0;
}

Measured memory_bytes: 1204
def array_integer(a)
	0.upto(a.count) {|x|
		a[x] = a[x].to_i
	}
	return a
end

a,b = array_integer(STDIN.gets.split(" "))

d = a / b
r = a % b
f = a.to_f / b.to_f

printf("%d %d %0.5f\n", d, r, f)


Measured memory_bytes: 6880
#include <bit>
#include <bitset>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <iomanip>

typedef long double ld;
typedef long long ll;

using namespace std;


#define MAXN (1 << 20)

/* TEMPLATE ENDS HERE */
int n, k, pos;
int a[MAXN];

int f(int t) {
	if (t <= 0) {
		return 0;
	}
	return 1 + (t - 1) / (k - 1);
}

int main() {
	cout << fixed << setprecision(12);	
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] == 1) {
			pos = i;
		}
	}
	int ret = n;
	for (int i = pos - k + 1; i <= pos; i++) {
		int cur = 1 + f(i) + f(n - 1 - (i + k - 1));
		//cerr << cur << endl;
		ret = min(ret, cur);
	}
	cout << ret << endl;
	return 0;
}


ll MOD = ((ll)1e9 + 7);

struct mod {
	ll x;

	mod(ll tx = 0) {
		x = tx;
		x %= MOD;
	}
	
	mod& operator=(const ll & tx) {
		x = tx % MOD;
		return *this;
	}
	
	mod& operator=(const mod & m2) {
		x = m2.x;
		return *this;
	}

	mod operator+(const mod& m2) const {
		return mod((x + m2.x) % MOD);
	}

	mod& operator+=(const mod& m2) {
		x += m2.x;
		x %= MOD;
		return *this;
	}

	mod operator-(const mod & m2) const {
		return mod((x - m2.x + MOD) % MOD);
	}

	mod& operator-=(const mod & m2) {
		x -= m2.x;
		x = (x + MOD) % MOD;
		return *this;
	}

	mod operator*(const mod & m2) const {
		return mod((x * m2.x) % MOD);
	}

	mod& operator*=(const mod & m2) {
		x *= m2.x;
		x %= MOD;
		return *this;
	}

	mod mypow(ll k) const {
		mod ret = 1;
		mod cur = x;
		while (k) {
			if (k & 1) {
				ret *= cur;
			}
			cur *= cur;
			k >>= 1;
		}
		return ret;
	}

	mod inv() const {
		return mypow(MOD - 2);
	}

	mod operator/(const mod & m2) const {
		return (*this) * m2.inv();
	}

	mod& operator/=(const mod & m2) {
		x *= m2.inv().x;
		x %= MOD;
		return *this;
	}

	bool operator<(const mod & m2) const {
		return x < m2.x;
	}
};

ostream &operator<<(ostream & os, const mod & m) {
	return os << m.x;
}



Measured memory_bytes: 4016
#include<bits/stdc++.h>
#define For(i,l,r) for(int i = (l),i##end = (r);i <= i##end;i++)
#define Fordown(i,r,l) for(int i = (r),i##end = (l);i >= i##end;i--)
#define debug(x) cout << #x << " = " << x << endl
 
using namespace std;
 
typedef long long ll;
 
template <typename T> inline bool chkmin(T &x,T y) { return y < x ? x = y,1 : 0; }
template <typename T> inline bool chkmax(T &x,T y) { return x < y ? x = y,1 : 0; }
 
const int INF = 0x3f3f3f3f;
const int N = 1e2 + 10,M = N * 20;
 
int to[M],nex[M],beg[N],w[M],dis[N],gap[N],a[N];
int e = 1,S,T,tot;
 
inline int read() {
	int x = 0,flag = 1;
	char ch = getchar();
	while(!isdigit(ch) && ch != '-')ch = getchar();
	if(ch == '-')flag = -1,ch = getchar();
	while(isdigit(ch))x = (x << 3) + (x << 1) + (ch - '0'),ch = getchar();
	return x * flag;
}
 
inline void add(int x,int y,int z) {
	to[++e] = y,nex[e] = beg[x],beg[x] = e,w[e] = z;
	to[++e] = x,nex[e] = beg[y],beg[y] = e,w[e] = 0;
}
 
inline int Isap(int x,int f) {
	if(x == T || !f) return f;
	int res = f;
	for(int i = beg[x];i;i = nex[i])
		if(w[i] > 0 && dis[x] == dis[to[i]] + 1) {
			int val = Isap(to[i],min(res,w[i]));
			w[i] -= val,w[i ^ 1] += val;
			res -= val;
			if(!res) return f;
		}
	if(!(--gap[dis[x]])) dis[S] = tot;
	++gap[++dis[x]];
	return f - res;
}
 
int main() {
 
	int n = read();
	ll ans = 0;
	For(i,1,n) a[i] = read();
 
	S = n + 1,T = tot = n + 2;
	For(i,1,n) for(int j = i + i;j <= n;j += i) {
		if(a[j] > 0 && a[i] <= 0) add(j,i,INF);
	}
	For(i,1,n) {
		if(a[i] > 0) add(S,i,a[i]),ans += a[i];
		else add(i,T,-a[i]);
	}
 
	for(gap[0] = tot;dis[S] < tot;) ans -= Isap(S,INF);
 
	printf("%lld\n",ans);
 
	return 0;
}

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

int compare(const void *a, const void *b){
  return (*(int *)a)- (*(int *)b);
}
 
int main(){
  int n;
  scanf("%d",&n);
  int a[n];
  for(int i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  qsort(a,n,sizeof(int),compare);
  
  for(int i=0;i<n-1;i++){
    if(a[i]==a[i+1]){
      printf("NO");
      return 0;
    }
  }
  
  printf("YES");
  return 0;
}

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

#define REP(i, n) for(int (i) = 0; (i) < (n); ++(i))
#define REPR(i, n) for(int (i) = (n); (i) >= 0; --(i))
#define FOR(i, n, m) for(int (i) = (n); (i) < (m); ++(i))

// constexpr int INF = 1e9;
constexpr ll INF = 1LL<<61;
constexpr ll mod = 1e9+7;



int main(){
  int N;
  cin >> N;
  vector<pair<int, int>> A(N);
  REP(i, N){
    int a;
    cin >> a;
    A[i] = {a, i};
  }
  sort(A.begin(), A.end());
  int ans = 0;
  REP(i, N){
    if(i % 2 != A[i].second % 2){
      ans++;
    }
  }
  cout << ans / 2 << endl;
  
  return 0;
}

Measured memory_bytes: 3996
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;
constexpr ll INF = (1LL << 55);

int main(){
  string s;
  cin >> s;
  int n = sz(s);
  vector<vector<int>> dp(n+1, vector<int>(2,0));

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 2; j++) {
      int d = s[i] - '0';
      if (i == 0 && j) continue;
      for (int k = 0; k <= (j ? 9 : d); k++) {
        dp[i + 1][j | (k < d)] = max(dp[i + 1][j | (k < d)], dp[i][j] + k);
      }
    }
  }
  cout << max(dp[n][0], dp[n][1]) << endl;
  return 0;
} 

Measured memory_bytes: 256
//https://atcoder.jp/contests/keyence2020/tasks/keyence2020_a
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
template<class T>bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1; } return 0;}
template<class T>bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1; } return 0;}
int main() {
    ll H,W; cin>>H>>W;
    ll N; cin>>N;
    ll mx=max(H,W);    
    ll ans= (N+mx-1)/mx;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main()
{
    int n, a, b;
    cin >> n >> a >> b;
    int sum = 0;
    rep(i, n + 1)
    {
        string s = to_string(i);
        int tmp = 0, tmpp = 0;
        rep(j, s.size())
        {
            tmp *= 10;
            tmp += s[j] - '0';
            tmpp += s[j] - '0';
        }
        if (tmpp >= a && tmpp <= b)
        {
            sum += tmp;
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
using namespace std;
long long pd[110];
long long GCD(long long a,long long b)
{
    if(a<b)
    {
        long long c;
        c=a;
        a=b;
        b=c;
    }
    return b==0?a:GCD(b,a%b);
}
int main()
{
    int n;
    while(cin>>n)
    {
        long long mn,sum=1;
        cin>>pd[0];
        mn=pd[0];
        for(int i=1;i<n;i++)
        {
            long long c;
            cin>>pd[i];
            if(GCD(pd[i],mn)==1)mn=mn*pd[i];
            else {
                c=GCD(pd[i],mn);
                mn=mn/c*pd[i];
            }

        }

        cout<<mn<<endl;

    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
constexpr int MOD = 1e9 + 7;

int main() {
    int n;
    cin >> n;
    string b[2];
    cin >> b[0] >> b[1];
    int dp[n + 1] = {};
    dp[0] = 1;
    for (int i = 0; i < n; i++) {
        if (i == 0) {
            if (b[0][i] == b[1][i]) {
                dp[1] = 3;
            } else {
                dp[1] = 6;
            }
        } else {
            if (b[0][i] == b[1][i]) {
                if (b[0][i - 1] == b[1][i - 1]) {
                    dp[i + 1] = 1ll * dp[i] * 2 % MOD;
                } else {
                    dp[i + 1] = dp[i];
                }
            } else {
                if (b[0][i] == b[0][i - 1]) {
                    dp[i + 1] = dp[i];
                    continue;
                }
                if (b[0][i - 1] == b[1][i - 1]) {
                    dp[i + 1] = 1ll * dp[i] * 2 % MOD;
                } else {
                    dp[i + 1] = 1ll * dp[i] * 3 % MOD;
                }
            }
        }
    }
    cout << dp[n] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
const long INF=1000000000000000;
const long MOD=1000000007;

int main() {
    long H,W;
    cin>>H>>W;
    
    vector<string> a(H);
    for(int i=0;i<H;i++) cin>>a.at(i);
    
    for(int i=0;i<W+2;i++)cout<<"#";
    cout<<endl;
    
    for(int i=0;i<H;i++)cout<<"#"<<a.at(i)<<"#"<<endl;
    
    for(int i=0;i<W+2;i++)cout<<"#";
    cout<<endl;
}


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

namespace program
{
    class Program
    {
        static void Main()
        {
          var n = Input.ScanInt();
          var k = Input.ScanInt();
          var a = Input.ScanIntArray();
          Out(a.Select(x=>Math.Min(x, k-x)).Sum()*2);
        }
        static public void Out(object s) { Console.WriteLine(s); }
    }
    
    static class Input {
        static public int ScanInt() { return int.Parse(Console.ReadLine()); }
        static public uint ScanUint() { return uint.Parse(Console.ReadLine()); }
        static public double ScanDouble() { return double.Parse(Console.ReadLine()); }
        static public long ScanLong() { return long.Parse(Console.ReadLine()); }
        static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); }
        static public int[] ScanIntArray() { return Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray(); }
        static public uint[] ScanUintArray() { return Console.ReadLine().Split().Select(x => uint.Parse(x)).ToArray(); }
        static public double[] ScanDoubleArray() { return Console.ReadLine().Split().Select(x => double.Parse(x)).ToArray(); }
        static public long[] ScanLongArray() { return Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray(); }
        static public ulong[] ScanUlongArray() { return Console.ReadLine().Split().Select(x => ulong.Parse(x)).ToArray(); }

        static public string ScanStr() { return Console.ReadLine(); }
        static public string[] ScanStrArray() { return ScanStr().Split(); }
    }

    static class MyMath {
        public static int DistanceL1(int[] a, int[] b){
            if(a.Length != b.Length) return -1;
            int[] c = new int[a.Length];
            for(int i=0;i<a.Length;i++)
              c[i] = Math.Abs(a[i]-b[i]);
            return c.Sum();
        }

        public static double DistanceL2(int[] a, int[] b){
            if(a.Length != b.Length) return -1;
            int[] c = new int[a.Length];
            for(int i=0;i<a.Length;i++)
              c[i] = (a[i]-b[i])*(a[i]-b[i]);
            return Math.Sqrt(c.Sum());
        }
        public static int GCD(int a, int b)
        {
            Func<int, int, int> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static ulong GCD(ulong a, ulong b)
        {
            Func<ulong, ulong, ulong> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static int LCM(int a, int b)
        {
            return a * b / GCD(a, b);
        }
        public static ulong LCM(ulong a, ulong b)
        {
            return a * b / GCD(a, b);
        }
    }
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ll long long
#define PINT pair<int,int>
#define f1 first
#define s2 second
const int INF = 1e9 + 7;

using namespace std;

int main(){
    cin.tie(0), ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> vi(n+2),sa(n+1);
    vi[0]=vi[n+1]=0;
    FOR(i,1,n+1) cin >> vi[i];
    ll ki=0;
    REP(i,n+1){
        sa[i]=abs(vi[i+1]-vi[i]);
        ki+=sa[i];
    }
    FOR(i,1,n+1){
        ll ans = ki - sa[i-1] - sa[i];
        ans += abs(vi[i+1]-vi[i-1]);
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 2048
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
int main() {
  int d;
  cin >> d;
  cout << "Christmas ";
  d = 25 - d;
  rep(i,d)
    cout << "Eve ";
}


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

public class Hello {
    public static void Main() {
      var nums = NumInput();

      if((nums[0] * nums[1])%2 == 0) Result("Even");
      else Result("Odd");
        
    }
    static int[] NumInput(){
        var input_line = Console.ReadLine().Split(' ');
        return input_line.Select(int.Parse).ToArray();
    }
    
    static void Result(string text){
        Console.WriteLine( text );
    }   
}

Measured memory_bytes: 13268
# -*- coding: utf-8 -*-
# E

import sys
from collections import defaultdict, deque
from heapq import heappush, heappop
import math
import bisect

# 再起回数上限変更
# sys.setrecursionlimit(1000000)

import sys
input = sys.stdin.readline

INF = float("INF")

N, M, L = map(int, input().split())

cost = [[INF] * N for _ in range(N)]
for i in range(N):
    cost[i][i] = 0

for _ in range(M):
    v1, v2, w = map(int, input().split())
    v1, v2 = v1-1, v2-1
    cost[v1][v2] = w
    cost[v2][v1] = w

for k in range(N):
    for i in range(N):
        for j in range(N):
            if cost[i][j] > cost[i][k] + cost[k][j]:
                cost[i][j] = cost[i][k] + cost[k][j]

for i in range(N):
    for j in range(N):
        if cost[i][j] == 0:
            continue
        elif cost[i][j] <= L:
            cost[i][j] = 1
        else:
            cost[i][j] = INF

for k in range(N):
    for i in range(N):
        for j in range(N):
            if cost[i][j] > cost[i][k] + cost[k][j]:
                cost[i][j] = cost[i][k] + cost[k][j]

q = int(input())
for _ in range(q):
    s, t = map(int, input().split())
    if cost[s-1][t-1] == INF:
        print(-1)
    else:
        print(cost[s-1][t-1] - 1)


Measured memory_bytes: 80220
#include<iostream>
using namespace std;
 
int main(){
 
  string s;
  int cnt[26]={}, ans=0;
 
  cin>>s;
  for(int i=0;i<s.size();i++){
    cnt[s[i]-'a']++;
  }
 
  for(int i=0;i<26;i++){
    if(cnt[i]%2) ans++;
  }
 
  cout<<ans/2<<endl;
   
  return 0;
}

Measured memory_bytes: 3192
#include <bits/stdc++.h>
#include <vector>
#include <cmath>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP2(i, m, n) for (int i = (m); i < (int)(n); ++i)
#define REPR(i, n) for (int i = (n)-1; i >= 0; --i)
#define REPR2(i, m, n) for (int i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<(n))
#define bit_check(bit, i) (bit>>(i)) & 1
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REP(i, a.size()) cin >> a[i];
#define INPUTP(a) REP(i, a.size()) cin >> a[i].first >> a[i].second;
#define ENDL cout << endl;
using namespace std;
using LL = long long;
using LD = long double;
using PII = pair<int, int>;
using VPII = vector<PII>;
using PLL = pair<LL, LL>;
using VPLL = vector<PLL>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VC = vector<char>;
using VS = vector<string>;
using VB = vector<bool>;
const LL INF = 1e14;
const LL MOD = 1e9 + 7;

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

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, a, b;
  cin >> n >> a >> b;
  int MAX, MIN;
  MAX = min(a, b);
  MIN = max(a+b-n, 0);
  cout << MAX << " " << MIN << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int R, G, B, N;
    cin >> R >> G >> B >> N;

    int ans = 0;
    rep(i, N + 1) {
        rep(j, N + 1) {
            int tmp = N - (R * i + G * j);
            if (tmp >= 0) {
                if (tmp == 0) {
                    ans++;
                }
                else if (tmp % B == 0) {
                    ans++;
                }
            }
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.buffer.readline

def main():
    N = int(input())
    s,keta = 0,0
    for _ in range(N):
        a,b = map(int,input().split())
        s += a*b
        keta += b
        
    print((s-1)//9+keta-1)
        
if __name__ == "__main__":
    main()


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

ll gcd(ll a, ll b){
    if(a < b) return gcd(b, a);
    ll r = a % b;
    while(r != 0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}
ll lcm(ll a, ll b){
    ll ret = (a * b)/gcd(a,b);
    return ret;
}

int main(){
    ll N;
    cin >> N;
    vector<ll> A(N), L(N), R(N);
    rep(i, 0, N) cin >> A[i];

    L[0] = A[0];
    rep(i, 1, N){
        L[i] = gcd(L[i-1], A[i]);
    }

    R[N-1] = A[N-1];
    for(ll i = N-2; i >= 0; i--){
        R[i] = gcd(R[i+1], A[i]);
    }

    ll ans = R[1];
    rep(i, 1, N-1){
        ans = max(ans, gcd(L[i-1], R[i+1]));
    }
    ans = max(ans, L[N-2]);

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
N, M = map(int, input().split())
H = []  # 高さのリスト
L = [0 for i in range(N)]  # 悪い展望台 1 良い展望台 0

for i in input().split():
    H.append(int(i))

for j in range(M):
    a, b = map(int, input().split())
    if H[a-1] > H[b-1]:
        L[b-1] = 1
    if H[a-1] < H[b-1]:
        L[a-1] = 1
    if H[a-1] == H[b-1]:
        L[a-1] = 1
        L[b-1] = 1

good = L.count(0)
print(good)

Measured memory_bytes: 20884
def examA():
    T, X = LI()
    ans = T/X
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examA()


Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define P pair<int,int>
#define PI 3.141592653589793
const int INF = 1001001001;
const ll MX = 1e18;

int main() {
	int d;
	cin >> d;
	vector<int> c(26),l(26),t(d);
	rep(i, 26) cin >> c[i];

	vector<vector<int>> s(d, vector<int>(26));
	rep(i, d)rep(j, 26) cin >> s[i][j];
	rep(i, d) {
		cin >> t[i];
		t[i]--;
	}
	int ans = 0;
	rep(i, d) {
		int x = t[i];
		ans += s[i][x];
		l[x] = i + 1;
		rep(j, 26) {
			if (j == x)continue;
			ans -= c[j] * (i + 1 - l[j]);
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 3648