akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

int main(){
    int n;
    int room[4][3][10]={0};
    scanf("%d\n",&n);
    for(int i=0; i<n; i++){
        int b,f,r,v;
        scanf("%d %d %d %d\n",&b,&f,&r,&v);
        room[b-1][f-1][r-1] += v;
    }
    for(int i=0; i<4; i++){
        for(int j=0; j<3; j++){
            for(int k=0; k<10; k++){
                printf(" %d",room[i][j][k]);
            }
            printf("\n");
        }
        if(i!=3){
            for(int i=0; i<20; i++){
                printf("#");
            }
            printf("\n");
        }
    }
    return 0;
}



Measured memory_bytes: 2756
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define fi first
#define se second
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
mt19937 mrand(random_device{}()); 
const ll mod=998244353;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

const int N=301000;
int f[N],sz[N],n,cnt[N],fcnt[N];
ll fac[N],fnv[N];

int find(int x) { return f[x]==x?x:f[x]=find(f[x]); }
int main() {
	scanf("%d",&n);
	rep(i,1,n+1) f[i]=i;
	fac[0]=fnv[0]=1;
	rep(i,1,n+1) {
		fac[i]=fac[i-1]*i%mod;
		fnv[i]=powmod(fac[i],mod-2);
	}
	rep(i,1,n+1) {
		int u;
		scanf("%d",&u);
		f[find(u)]=find(i);
	}
	rep(i,1,n+1) sz[find(i)]++;
	rep(i,1,n+1) if (find(i)==i) {
		cnt[sz[i]]++;
	}
	for (int i=1;i<=n;i++) for (int j=i+i;j<=n;j+=i) fcnt[j]+=cnt[i]*i;
	ll ans=1;
	for (int i=n;i>=1;i--) if (cnt[i]) {
		int p=cnt[i],m=i;
		ll cc=0;
		for (int k=1;k<=p;k++) {
			cc=(cc+powmod((ll)p*m,p-k)*fac[p-1]%mod*fnv[k-1]%mod*fnv[p-k]%mod*powmod(fcnt[i],k))%mod;
		}
		if (i==1) {
			cc=powmod(p,max(p-2,0))%mod;
		} else if (i==2) {
			if (cnt[1]==0) {
				cc=powmod(2*p,p-1)%mod;
			}
		}
		ans=ans*cc%mod;
	}
	printf("%lld\n",ans);
}


Measured memory_bytes: 11512
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long int ll;
typedef long double ld;
#define pii pair<int,int>
#define pll pair<ll,ll>
 
int main()
{
	int n,m,a,s=0;
	vector<int> v;
	cin >> n >> m;
	for(int i=0;i<n;i++)
	{
		cin >> a;
		v.pb(a);
		s+=a;
	}
	int c =0 ;
	for(int i=0;i<n;i++)
	{
		if(v[i]*4*m >= s) c++;
	}
	if(c>=m)
		cout << "Yes\n";
	else
		cout << "No\n";
	return 0; 
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using PP = pair<long, long>;
const int INF = 1e9;
template <class T> T Next() { T t; cin >> t; return t; }

int n, a, b;
int mask(int l, int r) {
  return (1 << r) - (1 << l);
}

int del(int val, int k) {
  return (val & mask(0, k)) | ((val & mask(k + 1, n)) >> 1);
}

int ins(int val, int k, int bit) {
  return (val & mask(0, k)) | ((val & mask(k, n)) << 1) | (bit << k);
}

vector<int> rec(int s, int t, int cnt) {
  assert(s != t);
  if (cnt == 1) return {s, t};
  int k = 0;
  while (!(((s ^ t) >> k) & 1)) ++k;
  int ns = del(s, k); 
  int nt = del(t, k);
  int nu = 0;
  while (bitset<64>(nu ^ ns).count() % 2 == 0) ++nu;
  vector<int> vs = rec(ns, nu, cnt - 1);
  vector<int> vt = rec(nu, nt, cnt - 1);
  vector<int> ret;
  for (int p : vs) ret.push_back(ins(p, k, (s >> k) & 1));
  for (int q : vt) ret.push_back(ins(q, k, (t >> k) & 1));
  return ret;
}

int main() {
  cin >> n >> a >> b;
  if (bitset<64>(a ^ b).count() % 2 == 0) {
    cout << "NO" << endl;
  } else {
    cout << "YES" << endl;
    auto v = rec(a, b, n);
    for (int i = 0; i < v.size(); ++i) {
      cout << v[i] << (i + 1 == v.size() ? '\n' : ' ');
    }
  }
}

Measured memory_bytes: 1628
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int x,y,z;
  cin>>x>>y>>z;
  int c = y+x;
  y = c-y;
  x = c-x;
  int d = z+x;
  z = d-z;
  x = d-x;
  cout<<x<<' '<<y<<' '<<z<<'\n';
  return 0;
}

Measured memory_bytes: 256
import collections
temp = 0
n = input()
li = list(map(int,input().split()))
c = collections.Counter(li)
c_items = list(c.items())
for j in c_items:
    temp += ((j[1] * (j[1]-1)) // 2)
for i in li:
    print(temp - (c[i]-1))

Measured memory_bytes: 28344
import sys
sys.setrecursionlimit(1000000)
#def input():
#    return sys.stdin.readline()[:-1]

'''
n=int(input())
for i in range(n):
    a[i]=int(input())
    a[i],b[i]=map(int,input().split())
a=[int(x) for x in input().split()]
n,m=map(int,input.split())

'''

test_data1 = '''\
A??C
'''

test_data2 = '''\
ACACAC
'''

test_data3 = '''\
7
994 518 941 851 647 2 581
'''

test_data4 = '''\
?AC?AC
'''
td_num=3

def GetTestData(index):
    if index==1:
        return test_data1
    if index==2:
        return test_data2
    if index==3:
        return test_data3
    if index==4:
        return test_data4
    
if False:
    with open("../test.txt", mode='w') as f:
        f.write(GetTestData(td_num))
    with open("../test.txt") as f:
        # Start Input code ---------------------------------------
        n=int(f.readline())
        a=[int(x) for x in f.readline().split()]
        # End Input code ---------------------------------------
else:
    # Start Input code ---------------------------------------
    n=int(input())
    a=[int(x) for x in input().split()]
    # End Input code ---------------------------------------
#print(n,a,sum(a)-n)
print(sum(a)-n)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a); i<(b); i++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define sort(v,n) sort(v,v+n);
#define vsort(v) sort(v.begin(),v.end());
#define ll long long
#define pb(a) push_back(a)
#define fi first
#define se second
#define inf 999999999
using namespace std;
typedef pair<int,int> p;
typedef pair<ll,ll> lp;
bool is_uruu(int y) {
        return y % 4 == 0 && (y % 100 != 0 || y % 400 == 0);
}
const ll MOD=1e9+7;
//---------------------------------------------------------------------------//

int main(){
        int x,y,x2,y2;
        cin>>x>>y>>x2>>y2;
        string s;
        int n=x2-x;
        int m=y2-y;
        for(int i=0; i<n; i++) {
                s+="R";
        }
        for(int i=0; i<m; i++) {
                s+="U";
        }
        for(int i=0; i<n; i++) {
                s+="L";
        }
        for(int i=0; i<m; i++) {
                s+="D";
        }
        s+="D";
        for(int i=0; i<n+1; i++) {
                s+="R";
        }
        for(int i=0; i<m+1; i++) {
                s+="U";
        }
        s+="L";
        s+="U";
        for(int i=0; i<n+1; i++) {
                s+="L";
        }
        for(int i=0; i<m+1; i++) {
                s+="D";
        }
        s+="R";
        cout<<s<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int n,x[110],mixn=0x7fffffff;

int main()
{   cin>>n;
    for(int i=1;i<=n;++i)
        cin>>x[i];
    for(int i=1;i<=100;++i)
    {
        int ans=0;
        for(int j=1;j<=n;++j)
            ans+=(x[j]-i)*(x[j]-i);
        mixn=min(mixn,ans);
    }
    cout<<mixn<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
using ll = long long;
using namespace std;
const int INF = 1e9;
const int MOD = 1e9 + 7;
struct mint {
    ll x;
    mint(ll x = 0) : x((x % MOD + MOD) % MOD) {}
    mint operator-() const { return mint(-x); }
    mint &operator+=(const mint a) {
        if ((x += a.x) >= MOD)
            x -= MOD;
        return *this;
    }
    mint &operator-=(const mint a) {
        if ((x += MOD - a.x) >= MOD)
            x -= MOD;
        return *this;
    }
    mint &operator*=(const mint a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t)
            return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1)
            a *= *this;
        return a;
    }

    mint inv() const { return pow(MOD - 2); }
    mint &operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream &operator>>(istream &is, const mint &a) { return is >> a.x; }
ostream &operator<<(ostream &os, const mint &a) { return os << a.x; }

int main() {
    ll X, Y;
    cin >> X >> Y;

    mint ans = 1;
    if ((X + Y) % 3 == 0) {
        ll m, n;
        m = (2 * X - Y) / 3;
        n = (2 * Y - X) / 3;

        if (m < 0 || n < 0) {
            cout << 0 << endl;
            return 0;
        }

        rep(i, n)
            ans *= (m + n - i);

        rep(i, n)
            ans /= (i + 1);

    } else
        ans = 0;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int a,b,c;
int map[4][4];
int main()
{
	cin>>a>>b>>c;
	map[1][1]=a;
	map[1][2]=b;
	map[2][2]=c;
	map[3][3]=c*2-map[1][1];
	map[3][2]=c*2-map[1][2];
	map[1][3]=c*3-map[1][1]-map[1][2];
	map[2][3]=c*3-map[1][3]-map[3][3];
	map[2][1]=c*3-map[2][2]-map[2][3];
	map[3][1]=c*3-map[3][2]-map[3][3];
	for(int i=1;i<=3;i++)
	{
		for(int j=1;j<=3;j++)
		{
			cout<<map[i][j]<<" ";
		}
		cout<<endl;
	}
	return 0;
}

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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    vector<ll> ketaNums(N, -1);
    int answer = 0;
    for (int i = 0; i < M; i++)
    {
        int s, c;
        cin >> s >> c;
        s--;
        if (N > 1 && s == 0 && c == 0)
        {
            answer = -1;
        }
        if (ketaNums.at(s) == -1)
        {
            ketaNums.at(s) = c;
        }
        else if (ketaNums.at(s) != c)
        {
            answer = -1;
        }
    }
    if(N > 1 && ketaNums.at(0) == -1)
    {
        ketaNums.at(0) = 1;
    }
    if (answer == 0)
    {
        for (int i = 0; i < N; i++)
        {
            if (ketaNums.at(i) == -1)
            {
                ketaNums.at(i) = 0;
            }
            answer *= 10;
            answer += ketaNums.at(i);
        }
    }
    cout << answer << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <cstdlib>
#include <cmath>

using namespace std;

int main(){
  string s;
  cin >> s;
  cout << s.at(0) << s.size()-2 << s.at(s.size()-1) << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <stdio.h>
#include <stdlib.h>
#define rep(i,n) for (int i=0;i<(n);i++)
#define PI 3.14159265358979323846264338327950L
using namespace std;
using P = pair<int,int>;
using ll = long long;
using namespace std;
int main(void){
    string s;
    cin >> s;
    rep(i, s.length()){
        cout << "x";
    }
    return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <vector>

using lint = long long;

using namespace std;

struct Sub {
    lint b, l, r;
    Sub(int b = 0, int l = 0, int r = 0) : b(b), l(l), r(r) {}
};

int main() {
    lint N, X;
    cin >> N >> X;

    vector<Sub> subs(N);
    for (auto& s : subs) {
        cin >> s.b >> s.l >> s.r;
    }
    sort(subs.begin(), subs.end(), [&](Sub a, Sub b) {
        return a.r * (X - a.b) + a.l * a.b > b.r * (X - b.b) + b.l * b.b;
    });

    // 勉強時間で二分探索
    lint ok = N * X, ng = -1;
    while (ok - ng > 1) {
        lint mid = (ok + ng) / 2;

        lint score = 0;  // 先頭からmid/X科目だけX点を取り、他は0点
        for (int i = 0; i < N; ++i) {
            if (i < mid / X) {
                score += subs[i].r * (X - subs[i].b);
            } else {
                score -= subs[i].l * subs[i].b;
            }
        }

        lint R = mid % X;
        bool judge = (score >= 0);

        int n = mid / X;
        if (R > 0) {
            for (int r = 0; r < N; ++r) {
                lint nscore = score;
                if (r < n) {
                    // r番目を消してn番目を追加
                    nscore -= subs[r].r * (X - subs[r].b) + subs[r].l * subs[r].b;
                    nscore += subs[r].l * min(subs[r].b, R) + subs[r].r * max(0LL, R - subs[r].b);
                    nscore += subs[n].r * (X - subs[n].b) + subs[n].l * subs[n].b;
                } else {
                    // r番目を追加する
                    nscore += subs[r].l * min(subs[r].b, R) + subs[r].r * max(0LL, R - subs[r].b);
                }
                if (nscore >= 0) judge = true;
            }
        }

        (judge ? ok : ng) = mid;
    }

    cout << ok << endl;
    return 0;
}


Measured memory_bytes: 2560
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P>IP;
typedef vector<ll> V;
typedef vector<V> V2;
typedef vector<vector<P> > G;
void g_dir(G &graph, ll a, ll b, ll w = 1){graph[a].push_back(P(b, w));}
void g_undir(G &graph, ll a, ll b, ll w = 1){g_dir(graph, a, b, w);g_dir(graph, b, a, w);}
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}
const ll INF = 1145141919;
const ll MOD = 1000000007;
const ll NUM = 101010;

int main(){

    ll N;
    cin >> N;
    rep1(h, 3500)rep1(n, 3500){
        ll A = h * n * N;
        ll B = 4 * h * n - h * N - n * N;
        if(B <= 0)continue;
        if(A % B)continue;
        ll w = A / B;
        cout << h << " " << n << " " << w << endl;
        return 0;
    }
    
    
    return 0;
}

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

struct dat{
  int id,price;
  string name;
};

int main(void){
  list<dat> lst;
  int n,p,min;
  string str;
  auto itr = lst.begin();
  cin >> n;
  for(int i = 0; i < n; ++i){
    cin >> str >> p;
    dat d;
    d.id = i+1;
    d.name = str;
    d.price = p;
    for(itr = lst.begin();itr != lst.end();++itr){
      if((((*itr).name == str) && ((*itr).price < p)) || ((*itr).name > str))
      {
        lst.insert(itr,d);
        break;
      }
    }
    if(itr == lst.end())
    {
      lst.insert(itr,d);
    }
  }
  for(itr = lst.begin();itr != lst.end();++itr){
     cout << (*itr).id << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr long long INF = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int H,W,K;
    cin>>H>>W>>K;

    string c[H];
    rep(i,H){
        cin>>c[i];
    }
    int N=H+W;
    int ans=0;
    for(int bit=0;bit<(1<<H);bit++){
        for(int bitw=0;bitw<(1<<W);bitw++){
            int sum=0;
            for(int i=0;i<H;i++){
                if(bit&(1<<i))continue;
                for(int j=0;j<W;j++){
                    if(bitw&(1<<j)){
                        if(c[i][j]=='#')sum++;
                    }
                }
            }
            if(sum==K)ans++;
        }
    }
    cout << ans << endl;



    



}


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

using namespace std;

int ans, cnt;

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

	int N;
	cin >> N;
	
	int ac = 0;
	int wa = 0;
	int tle = 0;
	int re = 0;
	rep(i, N) {
		string s;
		cin >> s;
		if (s == "AC") ac++;
		if (s == "WA") wa++;
		if (s == "TLE") tle++;
		if (s == "RE") re++;
	}

	cout << "AC x " << ac << endl;
	cout << "WA x " << wa << endl;
	cout << "TLE x " << tle << endl;
	cout << "RE x " << re << endl;

	return 0;
}

Measured memory_bytes: 3660
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int k = scan.nextInt();
		int[] a = new int[n];

		for (int i = 0; i < a.length; i++) {
			a[i] = scan.nextInt();
		}

		int max = 0;
		int sum = 0;
		for (int i = 0; i < a.length; i++) {
			if (i < k - 1) {
				sum += a[i];
				continue;
			}

			sum += a[i];
			max = Math.max(max, sum);
			sum -= a[i - k + 1];
		}
		System.out.println((max - k) * 0.5 + k);
	}

}

Measured memory_bytes: 81976
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <queue>
#include <cstdio>
#include <map>
#include <set>
#include <utility>
#include <stack>
#include <cstring>
#include <cmath>
#include <vector>
#include <ctime>
#include <bitset>
using namespace std;
#define pb push_back
#define sd(n) scanf("%d",&n)
#define sdd(n,m) scanf("%d%d",&n,&m)
#define sddd(n,m,k) scanf("%d%d%d",&n,&m,&k)
#define sld(n) scanf("%lld",&n)
#define sldd(n,m) scanf("%lld%lld",&n,&m)
#define slddd(n,m,k) scanf("%lld%lld%lld",&n,&m,&k)
#define sf(n) scanf("%lf",&n)
#define sff(n,m) scanf("%lf%lf",&n,&m)
#define sfff(n,m,k) scanf("%lf%lf%lf",&n,&m,&k)
#define ss(str) scanf("%s",str)
#define ansn() printf("%d\n",ans)
#define lansn() printf("%lld\n",ans)
#define r0(i,n) for(int i=0;i<(n);++i)
#define r1(i,e) for(int i=1;i<=e;++i)
#define rn(i,e) for(int i=e;i>=1;--i)
#define mst(abc,bca) memset(abc,bca,sizeof abc)
#define lowbit(a) (a&(-a))
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pll pair<long long,long long>
#define mp(aa,bb) make_pair(aa,bb)
#define lrt rt<<1
#define rrt rt<<1|1
#define X first
#define Y second
#define PI (acos(-1.0))
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007 ;
const double eps=1e-9;
const int inf=0x3f3f3f3f;
//const ll infl = 10000000000000000;
const int maxn=  2e5+10;
const int maxm = 2e5+10;
//Pretests passed
int in(int &ret)
{
    char c;
    int sgn ;
    if(c=getchar(),c==EOF)return -1;
    while(c!='-'&&(c<'0'||c>'9'))c=getchar();
    sgn = (c=='-')?-1:1;
    ret = (c=='-')?0:(c-'0');
    while(c=getchar(),c>='0'&&c<='9')ret = ret*10+(c-'0');
    ret *=sgn;
    return 1;
}
int a[10][1000];
int dp[20][200];
int main()
{
#ifdef LOCAL
    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
#endif // LOCAL

    int n;
    sd(n);
    r1(i,2)r1(j,n)sd(a[i][j]);
    for(int i=1;i<=2;++i)
    {
        for(int j=1;j<=n;++j)
        {
            dp[i][j] = max(dp[i][j],dp[i][j-1] + a[i][j]);
            if(i>1)dp[i][j] = max(dp[i][j],dp[i-1][j] + a[i][j]);
        }
    }
    int ans = dp[2][n];
    ansn();
    return 0;

}


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

#define FOR(i,b,e) for(int i=(b); i <= (e); ++i)
#define FORD(i,b,e) for(int i=(b); i >= (e); --i)
#define SIZE(c) (int) (c).size()
#define FORE(i,c) FOR(i,0,SIZE(c)-1)
#define FORDE(i,c) FORD(i,SIZE(c)-1,0)

#define pb push_back
#define mp make_pair
#define st first
#define nd second


using namespace std;

typedef long long ll;
typedef pair <int,int> pii;
typedef pair <ll,ll> pll;

typedef vector <int> VI;
typedef vector <bool> VB;
typedef vector <pii> VP;
typedef vector <ll> VL;
typedef vector <pll> VPL;

typedef vector <VI> VVI;
typedef vector <VL> VVL;
typedef vector <VB> VVB;
typedef vector <VP> VVP;

const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000000000000001LL;


/*************************************************************************/

int main() {
    ios_base::sync_with_stdio(0);
    
    int n;
    cin >> n;
    
    ll a = 0;
    while (n--) {
        int x;
        cin >> x;
        
        a += x;
    }
    
    cout << (a % 2 ? "NO" : "YES");

    return 0;
}

/*************************************************************************/


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
bool cmp(pair<int, int>p1, pair<int, int>p2){
	return p1.second<p2.second;
}
int main(){
	int n;
	cin>>n;
	vector<pair<int, int>> v;
	int Lmax=0, Rmin=INT_MAX, Dmax=0;
	for(int i=0;i<n;i++){
		int x, y;
		cin>>x>>y;
		Dmax=max(Dmax, y-x);
		v.push_back({x, y});
		Lmax=max(Lmax, x);
		Rmin=min(Rmin, y);
	}
	sort(v.begin(), v.end(), cmp);
	int Lmin, Rmax=0, ans=0;
	for(int i=1;i<n;i++){
		Lmin=v[i].second;
		Rmax=max(Rmax, v[i-1].first);
		ans=max(ans, max(0, Lmin-Lmax+1)+max(0, Rmin-Rmax+1));
	}
	ans=max(ans, Dmax+1+max(0, Rmin-Lmax+1));
	cout<<ans;
}

Measured memory_bytes: 1400
n, m, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a, b = [0], [0]
for i in range(n):
    a.append(a[i] + A[i])
for i in range(m):
    b.append(b[i] + B[i])

ans, j = 0, m
for i in range(n+1):
    if a[i] > k:
        break
    while b[j] > k - a[i]:
        j -= 1
    ans = max(ans, i+j)
print(ans)


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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

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

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF   = 2e9;
const ll  INFLL = 1e18;
typedef pair<int, int> PII;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

int main()
{
    ios::sync_with_stdio(false);
    int X, Y;
    cin >> X >> Y;

    int ans = INF;

    if (abs(X) == abs(Y)) {
        ans = 1;
    } 

    if (-X < Y) {
        ans = min(ans, 1 + Y - (-X));
        cerr << "A" << endl;
        DUMP(ans);
    } 

    if (X < -Y) {
        ans = min(ans, (-Y) - X + 1);
        cerr << "B" << endl;
        DUMP(ans);
    }

    if (X < Y) {
        ans = min(ans, Y - X);
        cerr << "C" << endl;
        DUMP(ans);
    } 

    if (-X < -Y) {
        ans = min(ans, (-Y) - (-X) + 2);
        cerr << "D" << endl;
        DUMP(ans);
    }



    cout << ans << endl;
}



Measured memory_bytes: 256
#include <cstdio>
#include <cstring>

const int MaxN = 300 + 5, MaxM = 300 + 5;

int N, M, K;
char S[MaxN][MaxM];
int A[MaxN][MaxM];

void init() {
  scanf("%d %d %d", &N, &M, &K);
  for (int i = 1; i <= N; ++i)
    scanf("%s", S[i] + 1);
}

void solve() {
  int preLine = 0, id = 0;
  for (int i = 1; i <= N; ++i) {
    bool have = false;
    for (int j = 1; j <= M; ++j)
      if (S[i][j] == '#') have = true;
    if (have == false) continue;
    int p = 0;
    for (int j = 1; j <= M; ++j) {
      if (S[i][j] == '.') continue;
      id++;
      for (int k = p + 1; k <= j; ++k) A[i][k] = id;
      p = j;
    }
    for (int j = p + 1; j <= M; ++j) A[i][j] = A[i][p];
    for (int k = preLine + 1; k < i; ++k)
      memcpy(A[k], A[i], sizeof A[i]);
    preLine = i;
  }
  for (int i = preLine + 1; i <= N; ++i)
    memcpy(A[i], A[preLine], sizeof A[preLine]);
  for (int i = 1; i <= N; ++i)
    for (int j = 1; j <= M; ++j)
      printf("%d%c", A[i][j], " \n"[j == M]);
}

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

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

const int maxn=2e5+10;
int n,a[maxn],d,r;

int main(){
	ios::sync_with_stdio(false);
	cin>>n;
	for(int i=1,x;i<=n;++i){
		cin>>x;
		++a[x];
	}
	for(int i=n-1;i;--i)
		if(a[i]){
			d=i;
			break;
		}
	if(d&1){
		r=d/2+1;
		for(int i=d;i>r;--i)
			if(a[i]<2){
				puts("Impossible");
				return 0;
			}
		if(a[r]!=2){
			puts("Impossible");
			return 0;
		}
		for(int i=r-1;i;--i)
			if(a[i]){
				puts("Impossible");
				return 0;
			}
	}
	else{
		r=d/2;
		for(int i=d;i>r;--i)
			if(a[i]<2){
				puts("Impossible");
				return 0;
			}
		if(a[r]!=1){
			puts("Impossible");
			return 0;
		}
		for(int i=r-1;i;--i)
			if(a[i]){
				puts("Impossible");
				return 0;
			}
	}
	puts("Possible");
	return 0;
}

Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
def A():
    a,b = LI()
    print(math.ceil((a+b)/2))

#B
def B():
    s = S()
    t = S()
    s.sort()
    t.sort()
    t = t[::-1]
    l = [s,t]
    l.sort()
    if l[0] == s:
        print("Yes")
    else:
        print("No")
#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    A()


Measured memory_bytes: 39152
#include <cstdio>
#include <vector>
#include <iostream>
using namespace std;
typedef unsigned int uint;
inline int in() {
    int x = 0, c;
    for (; (uint)((c = getchar()) - '0') >= 10; ) { if (c == '-') return -in(); if (!~c) throw ~0; }
    do { x = (x << 3) + (x << 1) + (c - '0'); } while ((uint)((c = getchar()) - '0') < 10);
    return x;
}

int main(){
	int n,S;
	while(n=in(),S=in(),(n||S)){
		int w[102]={},a[102]={};
		int ans = 0;
		for(int i = 0 ; i < n ; i++){int b; w[b=in()]++; a[b]++; }
		for(int i = 99 ; i >= 0 ; i--) w[i] += w[i+1];
		for(int i = 0 ; i <= 100 ; i++) if(2*i>S) ans+=a[i]*(a[i]-1)/2;
		for(int i = 1 ; i <= 100 ; i++) ans+=a[i]*w[max(i+1,S-i+1)];
		printf("%d%c",ans,10);
	}
}

Measured memory_bytes: 0
#include <iostream>
//#include <fstream>
#include <vector>

using namespace std;

int main(int argc, const char * argv[]) {
    
//    ifstream in("input.txt");
//    cin.rdbuf(in.rdbuf());
    
    vector<int> vec(5);
    vector<int> vecMod(5);
    int sum = 0;
    for (int i=0; i<5; ++i)
    {
        cin >> vec[i];
        vecMod[i] = vec[i] % 10;
        if (vecMod[i] == 0)
        {
            vecMod[i] += 10;
        }
        sum += vec[i] - vecMod[i] +10;
//        cout << sum << endl;
    }
    
    int min = *min_element(vecMod.begin(), vecMod.end());
    
//    cout << min << endl;
    cout << sum - (10 - min) << endl;
    
    return 0;
}


Measured memory_bytes: 256
import math
for i in range(10**9+7) :
    a,op,b = map(str,input().split())
    if op == "?" : break
    a = int(a)
    b = int(b)
    if op == "+" : print(a+b)
    elif op == "-" : print(a-b)
    elif op == "*" : print(a*b)
    else : print(math.floor((a/b)))



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

int main() {
  int a, b, c, d;
  cin >> a >> b;
  c = a / 2 + b / 2;
  d = (a + b) / 2;
  if (c == d) {
    cout << "Even" << endl;
  }
  else {
    cout << "Odd" << endl;
  }
}


Measured memory_bytes: 256
from functools import lru_cache

@lru_cache()
def p(n, x):
    if n == 0:
        return 1
    if x == 1:
        return 0
    n_ = 2**(n + 1) - 1
    if x == n_:
        return 2**n
    if x > n_:
        return p(n - 1, x - n_) + 2**n
    return p(n - 1, x - 1)

def main():
    print(p(*map(int, input().split())))

if __name__ == '__main__':
    main()

Measured memory_bytes: 3572
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
#include <cstdlib>
#include <cmath>
using namespace std;

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

    sort(s.begin(), s.end());
    char x;
    bool flag;
    for (char c = 'a'; c <= 'z'; c++){
        flag = false;
        for (int i = 0; i < s.size(); i++){
            if (c == s[i]){
                flag = true;
                break;
            }
        }
        if (!flag){
            cout << c << endl;
            return 0;
        }
    }
    cout << "None" << endl;
}

Measured memory_bytes: 512
def solve(A):
    correct_a = sorted(A)
    correct_index = {n: i for i, n in enumerate(correct_a)}
    ans, min_n = 0, correct_a[0]
    cycles = []
    used = [0]*len(A)
    for i in filter(lambda i: not used[i], range(len(A))):
        used[i] = 1
        cycle, next_i = [i], correct_index[A[i]]
        while next_i != i:
            cycle.append(next_i)
            used[next_i] = 1
            next_i = correct_index[A[next_i]]
        cycles.append(cycle)

    for cycle in cycles:
        if len(cycle) == 2:
            ans += correct_a[cycle[0]] + correct_a[cycle[1]]
        elif len(cycle) > 2:
            ans += (min(correct_a[cycle[0]]*(len(cycle)-1), correct_a[cycle[0]]*2 + min_n*(len(cycle)+1))
                    + sum(correct_a[i] for i in cycle[1:]))

    return ans


if __name__ == "__main__":
    input()
    a = list(map(int, input().split()))
    print(solve(a))


Measured memory_bytes: 5732
#include <iostream>
#include <vector>

using namespace std;

long long gcd(long long a, long long b);

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

	int ans = a[0];
	for (int i = 1; i < n; i++) {
		ans = gcd(ans, a[i]);
	}
	cout << ans << endl;

	return 0;
}

long long gcd(long long a, long long b)
{
	if (a < b) {
		long long t = a;
		a = b;
		b = t;
	}

	long long r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}

	return b;
}

Measured memory_bytes: 640
#include<stdio.h>
#include<string.h>

/*int main(void)
{
  char N[2000010];
  char n;
  int sum = 0;
  int l,m;

  scanf("%s",N);
  l = strlen(N);

  while(l >= 0)
  {
    n = N[l];
    m = atoi(n);
    sum += m;
    l--;
  }

  if(sum % 9 == 0)printf("Yes");
  else printf("No");
  
  return 0;
}*/

char s[200010];
int main(){
    scanf("%s",s);
    int len=strlen(s);
    int sum=0;
    for(int i=0;i<len;i++)sum+=s[i]-'0';
    if(sum%9==0){
        puts("Yes");
    }else{
        puts("No");
    }
}

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


using namespace std;
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

template<class T> inline bool chmin(T& a, T b) {
  //aの方が大きければ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;
}
bool compare_a_big(pair<int,int> l,pair<int,int> r){
  //firstが大きい方からソート、firstが同じならbが小さい方から
  if(l.first != r.first){
    return l.first>r.first;
  }
  else{
    return l.second < r.second;
  }
}
bool compare_a_b_big(pair<int,int> l,pair<int,int> r){
  //firstが大きい方からソート、firstが同じならbが大きい方から
  if(l.first != r.first){
    return l.first>r.first;
  }
  else{
    return l.second > r.second;
  }
}
bool compare_b_small(pair<int,int> l,pair<int,int> r){
  //secondが小さい方からソート、firstが同じならfirstが小さい方から
  if(l.second != r.second){
    return l.second<r.second;
  }
  else{
    return l.first < r.first;
  }
}
const int INF = 1e9;
const int M = 1000000007;


typedef long long int ll;
vector<ll> fac(300001); //n!(mod M)
vector<ll> ifac(300001); //k!^{M-2} (mod M)
//a,bの範囲的にこれだけ配列を用意していけば十分

ll mpow(ll x, ll n){ //x^n(mod M) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % M;
        x = x*x % M;
        n = n >> 1;
    }
    return ans;
}

ll comb(ll a, ll b){ //aCbをmod計算、a,b<=300000でないと使えない
    fac[0] = 1;
    ifac[0] = 1;
    for(ll i = 0; i<300000; i++){
        fac[i+1] = fac[i]*(i+1) % M; // n!(mod M)
        ifac[i+1] = ifac[i]*mpow(i+1, M-2) % M; // k!^{M-2} (mod M) ←累乗にmpowを採用
    }
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % M;
    return tmp * fac[a] % M;
}



int main(){

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



  int dp[h+1];

  for(i=0;i<h+1;i++){
    dp[i] = INF;
  }

  dp[0] = 0;


  pair<int,int> p[n];
  for(i=0;i<n;i++){
    p[i] = make_pair(a[i],b[i]);
  }

  int j;

  for(i=0;i<n;i++){
    for(j=0;j<h+1;j++){
      if(j<p[i].first){
        chmin(dp[j],dp[0]+p[i].second);
      }
      else{
        chmin(dp[j],dp[j-p[i].first]+p[i].second);
      }
    }
  }

  cout << dp[h] << endl;


}


Measured memory_bytes: 4992
#include<iostream>

using namespace std;

int main(){

    unsigned int n, i, j;

    cin >> n;

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

        unsigned int x = i;

        // 3で割れる
        if( x % 3 == 0 ){
            cout << " " << i;
        }else{
            while ( x > 0 ){
                if ( x % 10 == 3){
                    cout << " " << i;
                    break;
                }
                x /= 10;
            }
        }
    }

    cout << endl;

    return 0;

}


Measured memory_bytes: 3112
from math import floor, ceil
n=int(input())
a=[int(i) for i in input().split()]
for i in range(len(a)):
    a[i]-=(i+1)

a.sort()

n = a[(len(a)+1)//2-1]
a = [abs(i-n) for i in a]

print(sum(a))


Measured memory_bytes: 25968
#include <stdio.h>
 
int x[4][3][10];
int main() {
    int n, b, f, r, v;
    scanf("%d", &n);
    while(n-- > 0) {
        scanf("%d%d%d%d", &b, &f, &r, &v);
        x[b-1][f-1][r-1] += v;
    }
    for (int i=0; i<4; i++) {
        for (int j=0; j<3; j++) {
            for (int k=0; k<10; k++) {
                printf(" %d", x[i][j][k]);
            }
            puts("");
        }
        if (i != 3) puts("####################");
    }
}



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

int main() {
  std::string s;
  std::vector<bool> a(26, false);

  std::cin >> s;

  for (const auto i : s) {
    int j = i - 'a';
    if (a[j]) {
      std::cout << "no" << std::endl;
      return 0;
    } else {
      a[j] = true;
    }
  }
  std::cout << "yes" << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <vector> 
#include <algorithm>
#include<iomanip>
#include<math.h>
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
using namespace std;
 
int main() {
    unsigned long long K,s=100;
    cin >> K;
    for (unsigned long long x = 1;; x++) {
        s = (unsigned long long)(s*1.01);
        if (K <= s) {
            cout << x << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3596
if __name__ == '__main__':
    N, K = map(int, input().split())
    h_list = list(map(int, input().split()))

    dp_list = [0]
    for n in range(1, N):
        tmp_h = h_list[n]
        if n < K:
            lst = [abs(tmp_h - h_list[i]) + dp_list[i] for i in range(n)]
        else:
            lst = [abs(tmp_h - h_list[n-k]) + dp_list[n-k] for k in range(1, K + 1)]
        dp_list.append(min(lst))
    print(dp_list[-1])

Measured memory_bytes: 20584
using System;
using System.Numerics;
class neet{
  public static void Main(String[] args){
    var a =Console.ReadLine();
    String [] b = a.Split();
     BigInteger n = BigInteger.Parse(b[0]);
    BigInteger s =BigInteger.Parse(b[1]);
    BigInteger f = s/2;
    if(n>=f){
    Console.WriteLine($"{f}");
    }else{
         Console.WriteLine($"{((s-(2*n))/4)+n}");
    }
 
  }

}


Measured memory_bytes: 13524
#include<bits/stdc++.h>
#define vi vector<int>
#define vvi vector<vector<int> >
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vectors<decltype(inner)>(x, inner); }
using ll = long long;
using ld =long double;
#define int ll
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
int dx[]={0,0,1,-1};
int dy[]={1,-1,0,0};
int W,H;
bool inrange(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
using namespace std;
typedef pair<int, int> pii;
typedef pair<int,pii> piii;
#define MP make_pair
signed main(){
    int n; cin >> n;
    vector<int>num(n,1);
    vector<bool>Isred(n,false);
    Isred[0] = true;
    int m; cin >> m;
    rep(i,m){
        int x,y; cin >> x >> y;
        --x,--y;
        if(num[x] == 0)continue;
        if(Isred[x] == false){
            num[x]--;
            num[y]++;
        } else {
            if(Isred[x] && num[x] == 1){
                Isred[x] = false;
                Isred[y] = true;
                num[y]++,num[x]--;
            } else {
                num[y]++,num[x]--;
                Isred[y] = true;
            }
        }
    }
    int ans = 0;
    rep(i,n) ans += Isred[i];
    cout << ans << endl;
}


Measured memory_bytes: 1024
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int V[] = new int[N];
		int C[] = new int[N];
		for(int i = 0; i < N; i++) {
			V[i] = sc.nextInt();
		}
		for(int i = 0; i < N; i++) {
			C[i] = sc.nextInt();
		}
		
		int ans = 0;
		for(int i = 0; i < N; i++) {
			if(C[i] < V[i]) {
				ans += V[i] - C[i];
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 21716
#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;
const int mod = 1000000007;

int main() {
	ll n, k;
	cin >> n >> k;
	vector<ll> a(n);
	rep(i, n) cin >> a[i];

	ll l = 0, r = 1e9;
	while (r - l > 1) {
		ll x = (l + r) / 2;
		auto f = [&](ll x) {
			ll cnt = 0;
			rep(i, n) cnt += (a[i] - 1)/x;
			return cnt <= k;
		};
		if (f(x)) r = x;
		else l = x;
	}
	cout << r << endl;
}


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

//~ const int MOD=1000000007;
const int MOD=998244353;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

ll a[200000];
int main(){
	int n;cin>>n;
	__int128 ans=1;
	rep(i,n){
		scanf("%lld",&a[i]);
		if(a[i]==0){
			puts("0");return 0;
		}
	}
	rep(i,n){
		ans*=a[i];
		if(ans>(ll)1e18){
			puts("-1");
			return 0;
		}
	}
	cout<<(ll)ans<<endl;
}

Measured memory_bytes: 4436
#include <bits/stdc++.h>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define rFORe(i, a, n) for(int (i) = (int)(n); (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 1, (n))
#define REPo(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define rREPe(i, n) rFORe((i), 1, (n))
#define rREPo(i, n) rFORe((i), 0, (n))
#define rep(i, n) FOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fi first
#define se second
#define dup(x, y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using P = pair<int,int>;
using T = tuple<int,int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using vp = vector<P>;
using vt = vector<T>;

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

int main() {
  ll x;
  cin >> x;
  ll ans = x/11*2;
  x %= 11;
  if(x>6) ans++;
  if(x>0) ans++;
  cout << ans << endl;

  return 0;
}

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

int main() {
    int n;
    cin>>n;
    vector<int> v(n+1,0);
    for(int i=1 ;i<=n;i++){
        cin>>v[i];
    }
    if(n==2){
        cout<<abs(v[2]-v[1])<<"\n";
        return 0;
    } 
    vector<int> dp(n+1,0);
    dp[2]=abs(v[2]-v[1]);
    dp[3]=min(abs(v[2]-v[3])+dp[2],abs(v[3]-v[1]));
    for(int i=4;i<=n;i++){
        dp[i]=min(abs(v[i]-v[i-1])+dp[i-1],abs(v[i]-v[i-2])+dp[i-2]);
    }
    cout<<dp[n]<<"\n";
	return 0;
}

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

namespace abc086_a
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            Console.WriteLine((n[0] * n[1]) % 2 == 0 ? "Even" : "Odd");
        }
    }
}


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

int main() {
  int H, W, k = 0;
  while(1){
    if(k > 0)
      cout << endl;
    cin >> H >> W;
    if(H == 0 && W == 0)
      break;
    for (int i = 0; i < H; i++){
      for(int j = 0; j < W; j++){
        if(i == 0 || i == H -1)
          cout << "#";
        else{
          if(j == 0 || j == W -1)
            cout << "#";
          else
            cout << ".";  
        }
        if(j == W - 1){
          cout << endl;
          break;
        }  
      }
    }
    k++;
  }
}



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

int main() {
  int A[3];
  cin >> A[0] >> A[1] >> A[2];
  sort(A, A + 3);
  if(A[0] == A[1]) cout << A[2] << endl;
  else cout << A[0] << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int nextInt() {
  int n = 0;
  int c;
  while ((c = getchar()) != EOF) {
    if (('0' <= c) && (c <= '9'<c)) {
      n = n * 10 + (c - '0');
    }
    else {
      break;
    }
  }
  return n;
}

int main(){
	int t = nextInt();
	int x = nextInt();
    /*
      T = X x t
      t = T/X
    */

    printf("%lf\n", (double)t/x);
	return 0;
}


Measured memory_bytes: 128
class UnionFind():
    def __init__(self,n):
        self.par=[i for i in range(n)]
    def root(self, x):
        if self.par[x]==x:
            return x
        else:
            self.par[x]=self.root(self.par[x])
            return self.par[x]
    def same(self,x,y):
        return self.root(x)==self.root(y)
    def unite(self,x,y):
        x=self.root(x)
        y=self.root(y)
        if x!=y:
            self.par[x]=y
 
n, m=map(int, input().split())
p=[int(s)-1 for s in input().split()]
pair=[[int(s)-1 for s in input().split()] for _ in range(m)]
 
uf=UnionFind(n)
for pi in pair:
    uf.unite(pi[0],pi[1])
 
cnt=0
for i, pi in enumerate(p):
    if uf.same(i,pi):
        cnt+=1
print(cnt)

Measured memory_bytes: 29412
def li():
    return list(map(input().split()))


if __name__ == "__main__":
    s = input()
    k = int(input())

    count = 0
    before = ""
    for si in s:
        if before == si:
            count += 1
            before = ""
        else:
            before = si

    count2 = 0
    before2 = ""
    for si in s + s:
        if before2 == si:
            count2 += 1
            before2 = ""
        else:
            before2 = si
    diff = count2 - count

    is_corner = before == s[0]

    all_same = True
    before2 = s[0]
    for si in s:
        if before2 != si:
            all_same = False
        before2 = si

    corner_count = k - 1 if is_corner else 0
    if len(s) == 1:
        print(k // 2)
    elif all_same:
        print(len(s) * k // 2)
    else:
        print(count + diff * (k - 1))
    # print(count, count2)


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

int main() {
    ll n,m,q;
    std::cin >> n>>m>>q;
    vector<ll> a(q),b(q),c(q),d(q);
    for (int i = 0; i < q; i++) {
        std::cin >> a[i]>>b[i]>>c[i]>>d[i];
        a[i]--;b[i]--;
    }
    ll ans = 0;
    function<void(int,int, vector<int>)> rec = [&] (int now, int nowv, vector<int> aa) {
        if(now!=n){
            for (int i = nowv; i <= m; i++) {
                aa.push_back(i);
                rec(now+1, i, aa);
                aa.pop_back();
            }
            return;
        }else{
            ll tmp = 0;
            for (int i = 0; i < q; i++) {
                if(aa[b[i]]-aa[a[i]]==c[i]){
                    tmp += d[i];
                }
            }
            ans = max(ans, tmp);
        }
    };
    rec(0,1,{});
    
    std::cout << ans << std::endl;
}


Measured memory_bytes: 3608
import sys
# import math
# import bisect
# import numpy as np
# from decimal import Decimal
# from numba import njit, i8, u1, b1 #JIT compiler
# from itertools import combinations, product
# from collections import Counter, deque, defaultdict

# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.14159265358979323846

def read_str():      return sys.stdin.readline().strip()
def read_int():      return int(sys.stdin.readline().strip())
def read_ints():     return map(int, sys.stdin.readline().strip().split())
def read_ints2(x):   return map(lambda num: int(num) - x, sys.stdin.readline().strip().split())
def read_str_list(): return list(sys.stdin.readline().strip().split())
def read_int_list(): return list(map(int, sys.stdin.readline().strip().split()))
def GCD(a: int, b: int) -> int: return b if a%b==0 else GCD(b, a%b)
def LCM(a: int, b: int) -> int: return (a * b) // GCD(a, b)

def Main():
    n = read_int()
    a = read_int_list()
    ans = 1
    cnt = [3] + [0] * n
    for x in a:
        ans = ans * cnt[x] % MOD
        cnt[x] -= 1
        cnt[x + 1] += 1
    print(ans)

if __name__ == '__main__':
    Main()

Measured memory_bytes: 20708