akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	
	ll n;
	cin>>n;
	string arr;
	ll i;
	cin>>arr;
	ll j,sum=0,l=arr.length();
	ll r[l+2]={0},g[l+2]={0},b[l+2]={0};
	if(arr[l-1]=='R')
		r[l-1]=1;
	else if(arr[l-1]=='G')
		g[l-1]=1;
	else
		b[l-1]=1;
 
    for(i=l-2;i>=0;i--)
    {
    	if(arr[i]=='R')
    	{
    		r[i]=r[i+1]+1;
    		b[i]=b[i+1];
    		g[i]=g[i+1];
    	}
    	else if(arr[i]=='B')
    	{
    	    r[i]=r[i+1];
    		b[i]=b[i+1]+1;
    		g[i]=g[i+1];	
    	}
    	else
    	{
    	     r[i]=r[i+1];
    		b[i]=b[i+1];
    		g[i]=g[i+1]+1;		
    	}
    }
     for(i=0;i<l;i++)
     {
     	if(arr[i]=='R')
     {
     	for(j=i+1;j<l;j++)
     	{
               if(arr[j]=='G'&&arr[j+j-i]=='B')
               {
               	sum=sum+b[j+1]-1;
               }
               else if(arr[j]=='G'&&arr[j+j-i]!='B')
               {
               	sum=sum+b[j+1];
               }
               if(arr[j]=='B'&&arr[j+j-i]=='G')
               {
               	sum=sum+g[j+1]-1;
               }
               else if(arr[j]=='B'&&arr[j+j-i]!='G')
               {
               	sum=sum+g[j+1];
               }
     	}
     }
      else if(arr[i]=='B')
     {
     	for(j=i+1;j<l;j++)
     	{
               if(arr[j]=='G'&&arr[j+j-i]=='R')
               {
               	sum=sum+r[j+1]-1;
               }
               else if(arr[j]=='G'&&arr[j+j-i]!='R')
               {
               	sum=sum+r[j+1];
               }
               if(arr[j]=='R'&&arr[j+j-i]=='G')
               {
               	sum=sum+g[j+1]-1;
               }
               else if(arr[j]=='R'&&arr[j+j-i]!='G')
               {
               	sum=sum+g[j+1];
               }
     	}
     }   
       else if(arr[i]=='G')
     {
     	for(j=i+1;j<l;j++)
     	{
               if(arr[j]=='B'&&arr[j+j-i]=='R')
               {
               	sum=sum+r[j+1]-1;
               }
               else if(arr[j]=='B'&&arr[j+j-i]!='R')
               {
               	sum=sum+r[j+1];
               }
               if(arr[j]=='R'&&arr[j+j-i]=='B')
               {
               	sum=sum+b[j+1]-1;
               }
               else if(arr[j]=='R'&&arr[j+j-i]!='B')
               {
               	sum=sum+b[j+1];
               }
     	}
     }    
     }
     cout<<sum;
	return 0;
}

Measured memory_bytes: 3736
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ll mod = 1e9 + 7;
//const ll mod = 998244353;
#define REP(i,n) for(int i=0;i<(int)n;++i)
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
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 (a>b) { a=b; return 1; } return 0; }
template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
string num2bit(ll num, ll len){
    string bit = "";
    REP(i, len){
    bit += char('0'+(num>>i & 1));
    }
    return bit;
}

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

    double R;
    cin >> R;
    printf("%.10f\n", 2*R*M_PI);

    return 0;
}

Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
#define rreps(i, n) for(int i=((int)(n)); i>0; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pl(s) cout << (s) << "\n";
#define pls(...) {bool space = false; for(auto i : __VA_ARGS__) (cout << (space?" ":"") << i), space = true; cout << "\n";}
#define plexit(s) {cout << (s) << "\n"; exit(0);}
#define yes(s) cout << ((s)?"Yes":"No") << "\n";
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using ll = long long; using ull = unsigned long long; using ld = long double;
template<typename T = int> using V = vector<T>; template<typename T = int> using P = pair<T, T>;
using Vi = V<int>; using Vl = V<ll>; using Vd = V<ld>; using VVi = V<Vi>; using VVl = V<Vl>; using Pi = P<int>; using Pl = P<ll>; using Pd = P<ld>;
constexpr ll MOD = 1000000007; constexpr int INF = (1 << 30) - 1; constexpr ll INFL = 1LL << 60; constexpr ld EPS = 1e-12; constexpr ld PI = 3.141592653589793238462643383279;

int main(void) {
  int n; cin >> n;
  string s; cin >> s;
  int ans = 0;
  reps(i,n-1) {
    string front = s.substr(0,i);
    string rear = s.substr(i,n-i);
    int count = 0;
    rep(j,26) {
      char c = 'a'+j;
      if (front.find(c) != string::npos && rear.find(c) != string::npos) ++count;
    }
    chmax(ans,count);
  }
  pl(ans)
  return 0;
}


Measured memory_bytes: 3632
#include <stdio.h>
#include <iostream>

using namespace std;

void outPut(int Array[],char mark){
	for(int i = 1; i <= 13; i++){
		if(Array[i] == 0) cout << mark << " " << i << endl;
	}
}

int main(){
	char mark[2];
	int n,S[14],H[14],C[14],D[14],tmp;
	for(int i = 0; i < 14; i++) S[i] = H[i] = C[i] = D[i] = 0;
	scanf("%d",&n);

	for(int i = 0; i < n; i++){
		scanf("%s %d",mark,&tmp);
		switch(mark[0]){
		case 'S':
			S[tmp] = 1;
			break;
		case 'H':
			H[tmp] = 1;
			break;
		case 'C':
			C[tmp] = 1;
			break;
		case 'D':
			D[tmp] = 1;
			break;
		}
	}
	outPut(S,'S');
	outPut(H,'H');
	outPut(C,'C');
	outPut(D,'D');
}


Measured memory_bytes: 3132
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

// result slice, index of pivot
func partition(elems []int) ([]int, int){
	n := len(elems)
	pivot := elems[n-1]
	pos := -1
	for i := 0; i < n-1; i++ {
		if elems[i] <= pivot {
			pos++
			elems[i], elems[pos] = elems[pos], elems[i]
		}
	}
	pos++
	elems[pos], elems[n-1] = elems[n-1], elems[pos]
	return elems, pos
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	n, err := nextInt(sc)
	if err != nil {
		panic(err)
	}

	elems := make([]int, n)
	for i := 0; i < n; i++ {
		x, err := nextInt(sc)
		if err != nil {
			panic(err)
		}
		elems[i] = x
	}
	result, index := partition(elems)
	fmt.Println(formatResult(result, index))
}

func formatResult(elems []int, pivotInd int) string {
	n := len(elems)
	ss := make([]string, n)
	for i := 0; i < n; i++ {
		ss[i] = strconv.Itoa(elems[i])
		if i == pivotInd {
			ss[i] = "[" + ss[i] + "]"
		}
	}
	return strings.Join(ss, " ")
}

func nextText(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func nextInt(sc *bufio.Scanner) (int, error) {
	return strconv.Atoi(nextText(sc))
}


Measured memory_bytes: 5600
#include <cstdio>
#include <algorithm>
char s[200001];
int O;
int main()
{
	scanf("%s", s);
	for (int i = 0, x = 0; s[i]; i++)
		O = std::max(O, s[i] == 'T' ? ++x : --x);
	printf("%d\n", O << 1);
	return 0;
}


Measured memory_bytes: 384
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <climits>
#include <cassert>
using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef long long ll;

#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
#define REP(i,n) FOR(i,0,n)

bool pred(const  pair<double, string> &l, const  pair<double, string> &r) {
    if(l.first!=r.first)return l.first<r.first;
	REP(i,min(l.second.size(),r.second.size())){
		if(l.second[i]!=r.second[i])return l.second[i]>r.second[i];
	}
	return l.second.size()>r.second.size();
}

int main() {
	int N;
	while (cin >> N, N) {
		vector< pair<double, string> > veff;
		REP(t, N) {
			string l;
			int p, a, b, c,d, e, f, s, m;
			cin >> l;
			cin >> p >> a >> b >> c >>d >> e >> f >> s >> m;
			double i = f * s * m - p;
			double eff = i / ( (a+b+c+d+e) + (d+e)*(m-1) );
			veff.push_back(make_pair(eff, l));
		}
		sort(RALL(veff),pred);
		REP(i, veff.size()) {
			// cout << veff[i].second << " " << veff[i].first << endl;
			cout << veff[i].second << endl;
		}
		cout << "#" << endl;
	}
}

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

using namespace std;

#define N 120

int n,a[N],b[N],f[N],g[N];

int main(){
	scanf("%d",&n); 
	for (int i=1;i<=n;++i){
		scanf("%d",&a[i]);
		f[i]=f[i-1]+a[i];
	}
	for (int i=1;i<=n;++i){
		scanf("%d",&b[i]);
		g[i]=max(g[i-1],f[i])+b[i];
	}
	printf("%d\n",g[n]);
	
	return 0;
}
			

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 5e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//
// 1~1e5までの値について素数:自身の値, 合成数:最小の素因数 の配列を返す
const int PSIZE = 1e5 + 1;
struct eratosthenes_sieve{
    int Primes[PSIZE];
    bool isPrime[PSIZE];
    eratosthenes_sieve(){
        iota(Primes, Primes + PSIZE, 0);
        fill(isPrime, isPrime + PSIZE, 0);
        for (int i = 2; i < PSIZE; i++){
            if (Primes[i] != i) continue;
            for (int s = i * 2; s < PSIZE; s += i){
                Primes[s] = i;
            }
            isPrime[i] = true;
        }
    }
    
    // 数値vの素因数の配列を取得
    vector<int> get_pfactor(int v){
        vector<int> res;
        int p = Primes[v];
        while(v > 1){
            while (Primes[v] == p) v /= Primes[v];
            res.emplace_back(p);
            p = Primes[v];
        }
        reverse(res.begin(), res.end());
        return res;
    }

    // 数値vの素因数分解を取得
    map<int, int> get_factrization(int v){
        map<int, int> mp;
        while(v>1){
            mp[Primes[v]]++;
            v /= Primes[v];
        }
        return mp;
    }
};
using ES = struct eratosthenes_sieve;

ll od[PSIZE];
int main() {
    init();
    ll Q;
    cin >> Q;
    ES es;
    repe(x,3,PSIZE){
        od[x] = es.isPrime[x] and es.isPrime[(x + 1) / 2];
        od[x] += od[x - 1];
    }

    rep(i,Q){
        ll l, r;
        cin >> l >> r;
        cout << od[r] - od[l - 1] << '\n';
    }
}

Measured memory_bytes: 1920
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = Integer.parseInt(in.next());
		int[][][] house = new int[4][3][10];
		for (int x = 0; x < 4; x++) {
			for (int y = 0; y < 3; y++) {
				for (int z = 0; z < 10; z++) {
					house[x][y][z] = 0;
				}
			}
		}
		for (int i = 0; i < n; i++) {
			int b = Integer.parseInt(in.next());
			int f = Integer.parseInt(in.next());
			int r = Integer.parseInt(in.next());
			int v = Integer.parseInt(in.next());
			for (int j = 1; j <= 4; j++) {
				if (j == b) {
					for (int k = 1; k <= 3; k++) {
						if (k == f) {
							for (int m = 1; m <= 10; m++) {
								if (m == r) {
									house[j - 1][k - 1][m - 1] += v;
								}
							}
						}
					}
				}
			}
		}
		for (int x = 0; x < 4; x++) {
			for (int y = 0; y < 3; y++) {
				for (int z = 0; z < 10; z++) {
					System.out.print(" " + house[x][y][z]);
				}
				System.out.println("");
			}
			if (x != 3) {
				System.out.println("####################");
			}
		}
	}
}	


Measured memory_bytes: 28560
//王景毅 2018/7/1 13:52:47
#include<bits/stdc++.h>
using namespace std;
int a[100001];
int main()
{
    int n,k,_1,ans=INT_MAX;
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		if(a[i]==1)
			_1=i;
	}
	for(int i=1;i<=k;i++)
        if(_1>=i&&n-_1>=k-i)
            ans=min(ans,(int)(ceil(1.0*(_1-i)/(k-1))+ceil(1.0*(n-(_1+k-i))/(k-1))));
	printf("%d\n",ans+1);
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define N 1000005
using namespace std;

int n, m, q, a[N], b[N];
char s[N], t[N];

int main() {
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
	scanf("%s %s %d",s + 1, t + 1, &q);
	n = strlen(s + 1);
	m = strlen(t + 1);
	for(int i = 1; i <= n; i++)
		a[i] = a[i - 1] + ((s[i] == 'A')?2:1);
	for(int i = 1; i <= m; i++)
		b[i] = b[i - 1] + ((t[i] == 'A')?2:1);
	while(q--){
		int x, y, z, t;
		scanf("%d %d %d %d",&x ,&y ,&z ,&t);
		if( abs( (a[y] - a[x - 1]) - (b[t] - b[z - 1]) )%3 == 0 )
			puts("YES");
		else
			puts("NO");
	}
	return 0;
}

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

using namespace std;

int solve(int N, int M)
{
  if (N == 1) {
    return M;
  }

  int D = M / N;
  while (M % D != 0) {
    D--;
  }
  return D;
}

int main()
{
  int N;
  int M;

  cin >> N;
  cin >> M;

  cout << solve(N, M) << endl;

  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<utility>
using namespace std;
typedef long long ll;
pair<ll,ll> c[100001];
int a[100001],b[100001],n,x[100000],y[100000];
vector<int> vx[100001],vy[100001];
ll ans;

void dfs(int v,int p,int z){
    if(!z){
        c[p].first++;
        a[v]=p;
        for(int i=0;i<vx[v].size();i++){
            if(b[vx[v][i]]!=p){
                dfs(vx[v][i],p,z^1);
            }
        }
    }
    else{
        c[p].second++;
        b[v]=p;
        for(int i=0;i<vy[v].size();i++){
            if(a[vy[v][i]]!=p){
                dfs(vy[v][i],p,z^1);
            }
        }
    }
}

int main(){
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d %d",&x[i],&y[i]);
        vx[x[i]].push_back(y[i]);
        vy[y[i]].push_back(x[i]);
    }
    for(int i=1;i<=100000;i++){
        a[i]=i;
        b[i]=i+100000;
    }
    for(int i=1;i<=100000;i++){
        c[i]=make_pair(0,0);
        if(a[i]==i){
            dfs(i,i,0);
            if(c[i].first>1&&c[i].second>1){
                ans+=c[i].first*c[i].second;
            }
        }
    }
    for(int i=0;i<n;i++){
        if(c[a[x[i]]].first>1&&c[a[x[i]]].second>1){
            ans--;
        }
    }
    printf("%lld\n",ans);
}

Measured memory_bytes: 14080
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define show(x) cout << #x << " = " << (x) << endl;
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl;
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
//cout << fixed << setprecision(10);

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

int main () {
  int n, k, r, s, p;
  string t;
  cin >> n >> k >> r >> s >> p >> t;

  int ans = 0;
  rep(i,k) {
    string tt;
    int it = i;
    while (it < n) {
      tt += t[it];
      it += k;
    }

    // suc = tt[j-3]!=tt[j-2] && tt[j-2]==tt[j-1]
    bool suc = false; 
    // suc && tt[j-1]==tt[j]  -> +point, suc = false;  "rpp"+'p'
    // suc && tt[j-1]!=tt[j]  -> +point, suc = false;  "rpp"+'s'
    // !suc && tt[j-1]==tt[j] -> +0,     suc = true;   "rrp"+'p' "rrr"+'r' "prp"+'p'
    // !suc && tt[j-1]!=tt[j] -> +point, suc = false;  "rrp"+'s' "rrr"+'s' "prp"+'s'

    rep(j,tt.size()) {
      char c = tt[j];
      if (suc) suc = false;
      else {
        if (j && tt[j-1] == tt[j]) {
          suc = true;
          continue;
        }
      }
      if (c == 'r') ans += p;
      if (c == 's') ans += r;
      if (c == 'p') ans += s;
    }
  }

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

Measured memory_bytes: 640
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
      	int b = sc.nextInt();
      	int c = sc.nextInt();
      	boolean isTrue = false;
      	for(int i = a; i <= a*b; i+=a){
        	if(i%b == c){
              isTrue = true;
              break;
            }
        }
      	if(isTrue) System.out.println("YES");
      	else System.out.println("NO");
    }
}

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

template <typename T> T gcd(T x, T y) {
  if (y == 0)
    return x;
  return gcd(y, x % y);
}

template <typename T> T lcm(T x, T y) {
  if (x == 0 || y == 0)
    return 0;
  return x / gcd(x, y) * y;
}

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

vector<int> p;
vector<int> r;

void init(int n) {
  p.reserve(n);
  r.reserve(n);
  for (int i = 0; i < n; i++) {
    p[i] = i;
    r[i] = 0;
  }
}

int root(int x) { return p[x] == x ? x : p[x] = root(p[x]); }

bool same(int x, int y) { return root(x) == root(y); }

void unite(int x, int y) {
  x = root(x);
  y = root(y);
  if (x == y)
    return;

  if (r[x] < r[y])
    p[x] = y;
  else {
    p[y] = x;
    if (r[x] == r[y])
      r[x]++;
  }
}

int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  int ans = 0;
  for (int i = 1; i < N; i++) {
    string X = S.substr(0, i);
    string Y = S.substr(i);
    set<char> st;
    for (int j = 0; j < i; j++) {
      if (find(Y.begin(), Y.end(), X[j]) != Y.end())
        st.insert(X[j]);
    }

    if (ans < st.size())
      ans = st.size();
  }
  cout << ans << endl;
}


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

int64_t mod = 1000000007;
int64_t large = 9223372036854775807;
double PI = 3.141592653589793;

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

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.141592653589793
//vector < vector<int>>a(0, vector<int>(0));二次元配列宣言


int main()
{
	int n, d;
	cin >> n >> d;
	int x[20][20];
	int i, j;
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < d; j++)
		{
			cin >> x[i][j];
		}
	}
	int cnt=0;
	int k,l;
	int sum;
	for (i = 0; i < n - 1; i++)
	{
		for (l = i + 1; l < n; l++)
		{
			sum = 0;
			for (j = 0; j < d; j++)
			{
				sum += (abs(x[i][j] - x[l][j])) * (abs(x[i][j] - x[l][j]));

				//cout <<"i="<<i<<" "<<"j="<<j<<" "<< x[i][j] <<" "<< x[l][j] <<" "<< sum << endl;
			}
			//cout << sum << endl;
			for (k = 1; k <= 1000; k++)
			{
				if (sum == k * k)
					cnt++;
			}
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <string>
#include <set>
#include <bitset>
#include <unordered_map>

using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
template <class T>
using Vvec = vector<vector<T> >;

int main()
{
    char c;
    cin >> c;
    printf("%c\n", c+1);
}

Measured memory_bytes: 256
import math
a, b, h, m = map(int, input().split())

angle_a = h*360/12 + m*360/60/12
angle_b = m*360/60
ax = a * math.sin(math.radians(angle_a))
ay = a * math.cos(math.radians(angle_a))
bx = b * math.sin(math.radians(angle_b))
by = b * math.cos(math.radians(angle_b))
print(math.sqrt(abs(ax-bx)**2 + abs(ay-by)**2))

Measured memory_bytes: 9480
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <sstream>
#include <string>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <limits>
#include <unordered_map>
#include <unordered_set>
#include <math.h>
#include <fstream>
#include <iterator>
#include <random>
#include <chrono>


#define forr(i,start,count) for (int i = (start); i < (start)+(count); ++i)
#define set_map_includes(set, elt) (set.find((elt)) != set.end())
#define readint(i) int i; cin >> i
#define readll(i) ll i; cin >> i
#define readdouble(i) double i; cin >> i
#define readstring(s) string s; cin >> s

typedef long long ll;

using namespace std;

vector<vector<int>> memoization(3, vector<int>(200003, -1));

int main()   {
    cout.precision(17);
    ll modd = 1000 * 1000 * 1000 + 7;
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    uniform_int_distribution<int> rand_gen(0, modd);   // rand_gen(rng) gets the rand no
    ll infinit = 10000000000000000;


//    readint(test_cases);
    int test_cases = 1;
    forr(t, 1, test_cases) {
        readint(n);
        vector<pair<string, int>> songs;
        forr(i,0,n) {
            readstring(s); readint(d);
            songs.push_back(make_pair(s,d));
        }
        readstring(s);

        int ss = 0;
        forr(i,0,n) {
            if (songs[i].first == s) {
                ss = i;
            }
        }
        ss++;
        int ret = 0;
        for (;ss < songs.size(); ++ss) {
            ret += songs[ss].second;
        }

        cout << ret << endl;

    }
    return 0;
}


Measured memory_bytes: 3328
#define _USE_MATH_DEFINES
#include<iostream>
#include<algorithm>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#define ll long long
#define str string
#define ld long double
#define vec vector
#define vll vec<ll>
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,b,a) for(ll i=b;i>=a;i--)
#define ALL(a) a.begin(),a.end()
#define rALL(a) a.rbegin(),a.rend()
#define kai "\n"
#define yuque priority_queue
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define mie min_element
#define mae max_element
#define tos to_string
#define sep setprecision
#define lob lower_bound
#define upb upper_bound
#define nep next_permutation
#define MOD 1000000007ll
#define MIN (1e-10)
#define equal(a,b) (abs((a)-(b))<MIN)
#define v2 ten
#define chokusen senbun
#define tenten senbun
#define takaku vec<ten>
using namespace std;
void solve();
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed;
	solve();
}
struct pea{
	ll f,s;
	bool operator<(const pea &p)const{
		return f!=p.f?f<p.f:s<p.s;
	};
};
struct tri{
	ll f,s,t;
	bool operator<(const tri &p)const{
		if(f!=p.f)return f<p.f;
		if(s!=p.s)return s<p.s;
		return t<p.t;
	};
};
class ten{
public:
	ld x,y;
	ten operator+(ten p){return{x+p.x,y+p.y};}
	ten operator-(ten p){return{x-p.x,y-p.y};}
	ten operator*(ld k){return{k*x,k*y};}
	ten operator/(ld k){return{x/k,y/k};}
	ld abs(){return sqrt(abs2());}
	ld abs2(){return x*x+y*y;};
	bool operator<(const ten &p)const{return x!=p.x?x<p.x:y<p.y;};
	bool operator==(const ten &p)const{return (-MIN<x-p.x)&&(x-p.x<MIN)&&(-MIN<y-p.y)&&(y-p.y<MIN);};
	ld naiseki(v2 b){return x*b.x+y*b.y;}
	ld gaiseki(v2 b){return x*b.y-y*b.x;}
};
struct senbun{ten p1,p2;};
struct en{ten o;ld r;};
//最大正方形
ll seimen(const vec<vll> &g){
	ll h=g.size(),w=g[0].size();
	vec<vll> dp(h,vll(w,1));
	bool b=false;
	rep(i,0,h)if(g[i][0]==1)dp[i][0]=0;else b=true;
	rep(i,1,w)if(g[0][i]==1)dp[0][i]=0;else b=true;
	ll maxhen=(b?1:0);
	rep(i,1,h){
		rep(j,1,w){
			if(g[i][j]==1)dp[i][j]=0;
			else{
				dp[i][j]=min({dp[i][j-1],dp[i-1][j-1],dp[i-1][j]})+1;
				maxhen=max(maxhen,dp[i][j]);
			}
		}
	}
	return maxhen*maxhen;
}
void solve(){
	ll h,w;cin>>h>>w;
	vec<vll> c(h,vll(w));
	rep(i,0,h)rep(j,0,w)cin>>c[i][j];
	cout<<seimen(c)<<kai;
}


Measured memory_bytes: 33632
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using uint = unsigned int;
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde);
#endif

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> ds(n);
    for(int i = 0; i < n; i++){
        cin >> ds[i];
    }
    vector<char> dp(1 << 24);
    dp[1] = true;
    for(int i = 0; i < n; i++){
        vector<char> next(1 << 24);
        int d = ds[i];
        if(!d){
            cout << 0 << '\n';
            return 0;
        }
        for(int bits = 0; bits < (1 << 24); bits++){
            if(!dp[bits]){ continue; }
            if((bits >> d & 1) == 0){
                next[bits | (1 << d)] = true;
            }
            if((bits >> (24 - d) & 1) == 0){
                next[bits | (1 << (24 - d))] = true;
            }
        }
        dp.swap(next);
    }
    int ans = 0;
    for(int bits = 0; bits < (1 << 24); bits++){
        if(!dp[bits]){ continue; }
        printb(bits);
        vector<int> v;
        for(int i = 0; i < 24; i++){
            if(bits >> i & 1){
                v.push_back(i);
            }
        }
        prints(v);
        int cand = M;
        if(v.size() <= 1){ exit(1); }
        for(size_t i = 1; i < v.size(); i++){
            cand = min(cand, abs(v[i] - v[(i - 1)]));
            printd(cand, i);
        }
        cand = min(cand, v[0] + 24 - v.back());
        ans = max(ans, cand);
    }
    cout << ans << '\n';
}


Measured memory_bytes: 33148
#include<iostream>
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<cctype>
using namespace std;
long long n;
inline void ws(int x){int now(0);while(x){now++,x/=10;}printf("%d",now);return;}
signed main()
{
	scanf("%lld",&n);
	for(register int i(sqrt(n));i;i--){if(!(n%i)){ws((n/i));break;}}
	return putchar(10),0;
}

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

int64 ans;
vector<int64> patty; // バーガーNのパティの枚数
vector<int64> sheet; // バーガーNの層の数


// バーガーNの、下からlayer層目
void burger(int N, int64 layer) {
  if (layer == 1) {
    if (N == 0) {
      ans++;
      return;
    } else {
      return;
    }
  }
  else if (layer <= sheet[N - 1] + 1) {
    burger(N - 1, layer - 1);
  }
  else if (layer == sheet[N - 1] + 2) {
    ans += patty[N - 1] + 1;
    // cerr << "ans:" << ans << "\n";
    // cerr << "pattern 1" << "\n";
    return;
  }
  else if (layer <= 2 * sheet[N - 1] + 2) {
    ans += patty[N - 1] + 1;
    // cerr << "ans:" << ans << "\n"; 
    // cerr << "pattern 2" << "\n";
    burger(N - 1, layer - sheet[N - 1] - 2);
  }
  else if (layer == 2 * sheet[N - 1] + 3) {
    ans += 2 * patty[N - 1] + 1;
    //cerr << "ans:" << ans << "\n"; 
    //cerr << "pattern 3" << "\n";
    return;
  } else {
    //cout << "error" << "\n";
    return;
  }
}

int main() {
  int N; int64 X; cin >> N >> X;
  
  /* 
  vector<string> S(N + 1);
  S[0] = "P";
  for (int i = 1; i <= N; i++) {
    S[i] = "B" + S[i - 1] + "P" + S[i - 1] + "B";
    cerr << S[i] << endl;;
  }
  return 0;
  */

  patty.resize(N + 1); // バーガーNのパティの枚数
  patty[0] = 1;
  sheet.resize(N + 1); // バーガーNの層の数
  sheet[0] = 1;

  for (int i = 1; i <= N; i++) {
    patty[i] = 2 * patty[i - 1] + 1;
    sheet[i] = 2 * sheet[i - 1] + 3;
  }

  burger(N, X);

  cout << ans << endl;
}


Measured memory_bytes: 256
import sys
read = sys.stdin.readline
import time
from heapq import heappush, heappop, heapify
import math
import itertools as it
from collections import deque 


def inp():
    return int(input())
def inpl():
    return list(map(int, input().split()))
start_time = time.perf_counter()
# ------------------------------

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

N, M = inpl()
graph = [set() for i in range(N)]
uf = UnionFind(N)
for i in range(M):
    A, B = inpl()
    A, B = A - 1, B - 1 
    uf.union(A, B)

ans = 0
ls = uf.roots()
for i in ls:
    ans = max(ans, uf.size(i))
print(ans)


# -----------------------------
end_time = time.perf_counter()
print('time:', end_time-start_time, file=sys.stderr)



Measured memory_bytes: 64832
#include <stdio.h>
#include <ctype.h>
#include <map>

typedef std::map<char,int> counter_map;

int main( int argc , char** argv )
{
	int c;
	counter_map counter;

	while( 1 )
	{
		c = getchar();
		if( c == EOF )
		{
			break;
		}

		c = tolower( c );

		counter_map::iterator itr = counter.find( c );
		if( itr == counter.end() )
		{
			counter.insert( counter_map::value_type( c , 1 ) );
		}
		else
		{
			itr->second++;
		}
	}


	for( int i = 'a' ; i <= 'z' ; i++ )
	{
		counter_map::iterator itr = counter.find( i );
		if( itr == counter.end() )
		{
			printf( "%c : %d\n" , i , 0 );
		}
		else
		{
			printf( "%c : %d\n" , itr->first , itr->second );
		}
	}

	return 0;
}

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

int main()
{

    int a,b,t;
    int d=0;

    scanf("%d%d%d",&a,&b,&t);

    if(a>=1 && a<=20 && b>=1 && b<=20 && t>=1 && t<=20){

        int i=1;
        while(a*i <= t+0.5){
            d = d + b;
            i++;
        }
        printf("%d\n",d);

    }


    return 0;
}


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

typedef long long LL;

int main()
{
    LL i, n, sum=0;

    ios::sync_with_stdio(false);
    cin>>n;

    for(i=1; i<=n; i+=3)
        if( i%5!=0 )
            sum+=i;
    for(i=2; i<=n; i+=3)
        if( i%5!=0 )
            sum+=i;
    cout<<sum;

    return 0;
}

Measured memory_bytes: 3608
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <map>
#include <queue>
#define rep(i,n) for (int i=0;i<(n);i++)

using namespace std;

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

	vector<int> s(m);
	vector<int> c(m);
	vector<int> a(n);
	for (int i = 0;i < n;i++) {
		a[i] = -1;
	}

	for (int i = 0;i < m;i++) {
		cin >> s[i] >> c[i];
	}

	for (int i = 0;i < m;i++) {
		if (a[s[i] - 1] == -1) {
			a[s[i] - 1] = c[i];
		}
		else if (a[s[i] - 1] != c[i]) {
			cout << -1 << endl;
			return 0;
		}
	}

	if (a[0] == 0) {
		if (n == 1) 
			cout << 0 << endl;
		else cout << -1 << endl;

		return 0;
	}

	int ans = 0;

	for (int i = 0;i < n;i++) {
		if (a[i] == -1) {
			if (i == 0 && n > 1) {
				ans += 1 * pow(10, n - 1);
			}
		}
		else {
			ans += a[i] * pow(10, n - 1 - i);
		}
	
	}

	cout << ans << endl;

	return 0;
}

//BBBBBBBBBBBBBBB
//int main() {
//	int a[3][3];
//	for (int i = 0;i < 3;i++) {
//		cin >> a[i][0] >> a[i][1] >> a[i][2];
//	}
//
//	int n;
//	cin >> n;
//	vector<int> b(n);
//
//	for (int i = 0;i < n;i++) {
//		cin >> b[i];
//	}
//
//	for (int i = 0;i < n;i++) {		
//		for (int j = 0;j < 3;j++) {
//			for (int k = 0;k < 3;k++) {
//				if (b[i] == a[j][k]) {
//					a[j][k] = 0;
//				}
//			}
//		}
//	}
//
//	for (int i = 0;i < 3;i++) {
//		if (a[i][0] == 0 && a[i][1] == 0 && a[i][2] == 0) {
//			cout << "Yes" << endl;
//			return 0;
//		}
//	}
//
//	for (int i = 0;i < 3;i++) {
//		if (a[0][i] == 0 && a[1][i] == 0 && a[2][i] == 0) {
//			cout << "Yes" << endl;
//			return 0;
//		}
//	}
//
//	if (a[0][0] == 0 && a[1][1] == 0 && a[2][2] == 0) {
//		cout << "Yes" << endl;
//		return 0;
//	}
//
//	if (a[0][2] == 0 && a[1][1] == 0 && a[2][0] == 0) {
//		cout << "Yes" << endl;
//		return 0;
//	}
//
//	cout << "No" << endl;
//
//	return 0;
//}


//AAAAAAAAAAAA
//int main() {
//	int n;
//	cin >> n;
//
//	cout << n / 2 + n % 2 << endl;
//
//	return 0;
//}

Measured memory_bytes: 3736
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
	string a,s;
	int g=0;
	cin>>a;
	s="CODEFESTIVAL2016";
	for(int i=0;i<=15;i++)
		if(a[i]!=s[i])
			g++;
	cout<<g<<endl;
	return 0;
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define each(it,v) for(auto &it : v)
#define all(v) (v).begin(),(v).end()
#define mod 1e9+7

using namespace std;
using vi = vector<int>;
using vl = vector<long>;
using P = pair<int,int>;

main()
{
        int n; cin>>n;
        int a[2][n];
        rep(i,2)rep(j,n)cin>>a[i][j];

        int ans=0;
        rep(t,n)
        {
                int sum=0;
                int h=0;
                rep(i,n)
                {
                        if(i==t)
                        {
                                sum+=a[h][i];
                                h++;
                        }
                        sum+=a[h][i];
                }
                ans=max(ans,sum);
        }
        cout<<ans<<endl;
}


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

li = [False] * (n + 1)

s = 0
for i in range(1, n+1):
    s += i
    li[i] = True

    if s == n:
        break
    if n - s < i + 1:
        li[i+1-(n-s)] = False
        s -= i+1-(n-s)

# print(li)
for j in range(1, i+1):
    if li[j]:
        print(j)


Measured memory_bytes: 87232
#include <iostream>
using namespace std;
void output(int array[],int array2[],int number){
    int num = 0;
    for(int j = 0;j<number;j++){
        num = num + array[j]*array2[j];               
    }
    cout<<num<<endl;
}

int main(){
    int n,m,number;
    cin>>n>>m;
    int A[100][100] = {0};
    int B[100] = {0};    
    for(int i = 0;i<n;i++){
        for(int j = 0;j<m;j++){
            cin>>number;
            A[i][j] = number;
        }      
    }
    for(int i = 0;i < m;i++){
        cin>>number;
        B[i] = number;
    }
    for(int i = 0;i<n;i++){
        output(A[i],B,m);
    }
    return 0;
}


Measured memory_bytes: 3148
import std.stdio;
import std.c.stdio;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.regex;
import std.typecons;

int H, W;
char[][] F;
void input() {
    scanf("%d %d\n", &H, &W);
    F = new char[][H];
    foreach (h; 0 .. H) {
        F[h] = cast(char[])(readln.chomp);
    }
}

bool check() {
    int[char] sx, sy, gx, gy;
    bool[char] used;
    foreach (y; 0 .. H) {
        foreach (x; 0 .. W) {
            if (F[y][x] == '.') continue;
            char c = F[y][x];
            if (c in used) {
                sx[c] = min(sx[c], x);
                sy[c] = min(sy[c], y);
                gx[c] = max(gx[c], x);
                gy[c] = max(gy[c], y);
            } else {
                used[c] = true;
                sx[c] = x;
                sy[c] = y;
                gx[c] = x;
                gy[c] = y;
            }
        }
    }
    auto G = new bool[][](26, 26);
    foreach (c, p; used) {
        for (int y = sy[c]; y <= gy[c]; y++) {
            for (int x = sx[c]; x <= gx[c]; x++) {
                if (F[y][x] == '.') {
                    return false;
                }
                if (F[y][x] != c) {
                    char d = F[y][x];
                    int xc = c - 'A',
                        xd = d - 'A';
                    if (G[xd][xc]) return false;
                    G[xc][xd] = true;
                }
            }
        }
    }

    version(Debug) {
        foreach (i; 0 .. 26) {
            foreach (j; 0 .. 26) {
                if (G[i][j]) {
                    writefln("%c -> %c", cast(char)(i + 'A'), cast(char)(j + 'A'));
                }
            }
        }
    }

    foreach (i; 0 .. 26) {
        bool flag = false;
        bool dfs(int x) {
            if (i == x) {
                if (flag) return false;
                flag = true;
            }
            foreach (j; 0 .. 26) {
                if (G[x][j] && (!dfs(j))) {
                    return false;
                }
            }
            return true;
        }
        if (!dfs(i)) return false;
    }
    return true;
}

void solve() {
    writeln(check ? "SAFE" : "SUSPICIOUS");
}

 
void main() {
    int T; scanf("%d\n", &T);
    foreach (t; 0 .. T) {
        input; solve;
    }
}

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

using namespace std;

const int N = 100100;

int a[N];

int main()
{
  	int n;	cin >> n;
  
  	for(int i = 0; i < n; i++)	scanf("%d", a + i);
  	
  	a[n] = 2e9;
  
  	for(int i = n - 1; ~i; --i)
    {
      	if(a[i] > a[i + 1])	a[i]--;
      	if(a[i] > a[i + 1])	return 0 * puts("No");
    }
  	
    puts("Yes");
}

Measured memory_bytes: 640
import sys
sys.setrecursionlimit(10**9)
def solve(w,h):
    G = [list(map(int,input().split())) for _ in range(h)]
    seen = [[False]*w for _ in range(h)]
    ans = 0
    def dfs(x,y):
        if seen[y][x]:
            return
        seen[y][x] = True
        for dx in range(-1,2):
            for dy in range(-1,2):
                nx = x + dx
                ny = y + dy
                if 0 <= nx < w and 0 <= ny < h:
                    if G[y][x] == 1:
                        dfs(nx,ny)
    for x in range(w):
        for y in range(h):
            if G[y][x] == 1 and seen[y][x] == False:
                dfs(x,y)
                ans += 1
    print(ans)


while True:
    w,h = map(int,input().split())
    if w == 0 and h == 0:
        break
    solve(w,h)




Measured memory_bytes: 8740
#include<bits/stdc++.h>
using namespace std;
int main(){
  vector<int> a(4);
  int N;
  for(int i=0;i<6;i++){
    cin>>N;
    a.at(N-1)++;
  }
  sort(a.begin(),a.end());
  if(a.at(0)==1 && a.at(1)==1 && a.at(2)==2)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}

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

int main(){

  long long int n;
  
  cin>>n;
  
  if(n%11 != 0){
    if(n%11 <= 6){
      n /= 11;
      n *= 2;
      n += 1;
    }else{
      n /= 11;
      n *= 2;
      n += 2;
    }
  }else{
    n /= 11;
    n *= 2;
  }
 
  cout<<n<<endl;

  return 0;
}


Measured memory_bytes: 256
import math


def f(n):
    pop = 0
    ntemp = n
    for i in range(int(math.log2(n)) + 1):
        pop += ntemp % 2
        ntemp //= 2
    return n % pop


n = int(input())
S = input()
popcount = 0
for i in range(n):
    popcount += int(S[i])

# 1が1個しかない場合の例外処理
if popcount == 1:
    if S[-1] == 1:
        ans = [2] * n
        ans[-1] = 0
    else:
        ans = [1] * n
        ans[-1] = 2
        for i in range(n):
            if S[i] == '1':
                ans[i] = 0
    for i in range(n):
        print(ans[i])
    exit()


Sint = int(S, 2)
remminus = Sint % (popcount - 1)
remplus = Sint % (popcount + 1)

# 1,2,4,...の余りのリストを準備
remlistminus = []
remlistplus = []
temp = 1
for i in range(n):
    remlistminus.append(temp)
    temp = (temp * 2) % (popcount - 1)
temp = 1
for i in range(n):
    remlistplus.append(temp)
    temp = (temp * 2) % (popcount + 1)
remlistminus.reverse()
remlistplus.reverse()

ans = []
for i in range(n):
    count = 1
    if S[i] == '0':
        rem = (remplus + remlistplus[i]) % (popcount + 1)
        while rem > 0:
            rem = f(rem)
            count += 1
    else:
        rem = (remminus - remlistminus[i]) % (popcount - 1)
        while rem > 0:
            rem = f(rem)
            count += 1
    ans.append(count)
for i in range(n):
    print(ans[i])


Measured memory_bytes: 95316
#include <bits/stdc++.h>
using namespace std;
 
struct edge {int /*from,*/to,cost;};
typedef long long ll;
typedef pair<int,int> P;
typedef pair<pair<int,int>,int> PP;
typedef vector<int> VI;
typedef vector<long long int> VL;
typedef vector<edge> VE;
//static const int INF = 2147483647;
//static const long long INF = 9223372000000000000;
//static const long long INF = 9223372000000000000/2;
//static const long long INF = 9223372000000000000/2145;
static const int INF = 1000010000;
//static const int NIL = -1;
//static const int MOD = 1000000007;
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define np next_permutation
#define pq priority_queue
//#define int ll

int rec(int n){
    if(n%2==1) return 0;
    else return rec(n/2)+1;
}

signed main(){
    int a[214];
    int n;
    scanf("%d",&n);
    int ans = INF;
    for(int i=0;i<n;i++){
        int tmp;
        scanf("%d",&tmp);
        ans = min(ans,rec(tmp));
    }
    printf("%d\n",ans);
    return 0;
}

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

int main()
{
  int N;
  cin >> N;
  vector<vector<int>> F(N, vector<int>(10)), P(N, vector<int>(11));
  for(int i = 0;i < N;i++){
    for(int j = 0;j < 10;j++){
      cin >> F[i][j];
    }
  }
  for(int i = 0;i < N;i++){
    for(int j = 0;j <= 10;j++){
      cin >> P[i][j];
    }
  }
  int res = INT_MIN;
  for(int i = 1;i < (1 << 10);i++){
    int sum = 0;
    for(int k = 0;k < N;k++){
      int cnt = 0;
      for(int j = 0;j < 10;j++){
        if((i & (1 << j)) && F[k][j]){
          cnt++;
        }
      }
      sum += P[k][cnt];
    }
    res = max(res, sum);
  }
  cout << res << endl;
}


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

int main(){
	
	int n,m; cin>>n>>m;
	priority_queue<int> q;
	for(int i=0; i<n; i++) {
		int a;
		cin>>a;
		q.push(a);
	}
	for(int i=0; i<m; i++){
		int t = q.top()/2;
		q.pop();
		q.push(t);
	}
	ll cnt{};
	while(!q.empty()){
		cnt += q.top();
		q.pop();
	}
	cout << cnt << endl;
}

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

using namespace std;

#define M 100001
#define x first
#define y second
#define ii pair<int, int>
#define pb push_back

int n, m;
bool visit[M], ans = true;
vector<ii> q[M];
int d[M];

void dfs(int u){
    visit[u] = true;
    for (int i = 0; i < q[u].size(); i++){
        if (!visit[q[u][i].x]){
            d[q[u][i].x] = d[u] + q[u][i].y;
            dfs(q[u][i].x);
        }
        else{
            if (d[q[u][i].x] != d[u] + q[u][i].y){
                ans = false;
                break;
            }
        }
    }
}

int main(){
    cin >> n >> m;
    for (int i = 1; i <= m; i++){
        int x, y, d;
        cin >> x >> y >> d;
        q[x].pb(ii(y, d));
        q[y].pb(ii(x, -d));
    }
    for (int i = 1; i <= n; i++) if (!visit[i]) dfs(i);
    if (ans) cout << "Yes";
    else cout << "No";
}

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

using namespace std;

using ll = long long;

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

    string s;
    cin >> s;
    sort(s.begin(), s.end());
    if (s == "abc") cout << "Yes\n";
    else cout << "No\n";

    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++)
using ll = long long;
int main() {
  int n ,k;
  cin >> n >> k;
  int cnt = 0;
  rep(i,n){
    int x;
    cin >> x;
    if(x >= k) cnt++;
  }
  cout << cnt << endl;
  }


Measured memory_bytes: 256
#include <iostream>
#define rep(i,n) for(long long i = 0;i<n;i++)
#define REP(i,k,n) for(long long i=k;i<n;i++)

using namespace std;
int main(){
  long long n,x;
  long long a[100100];
  cin >> n >> x;
  rep(i,n){
    cin >> a[i];
  }
  long long ans = 0;
  if(a[0]>x){
    ans += a[0]-x;
    a[0] = x;
  }
  for(long long i=0;i<n-1;i++){
    long long dist = a[i]+a[i+1]-x;
    if(dist > 0){
      ans    += dist;
      a[i+1] -= dist;
    }
  }
  cout << ans << endl;

  return 0;

}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
main () {
  int N;
  cin >> N;
  int i = 1;
  int sum = 0;
  int sa = 0;
 
  
 
  while (i <= N) {
    int l, r;
    cin >> l >> r;
    sa = r - l + 1;
    sum += sa;
    i++;
  }
  
  cout << sum << endl;
}

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

int main(){
  string input;
  cin >> input;
  int s = 0, e = input.size() - 1;
  bool fs = false, fe = false;
  while(!fs || !fe){
    if(input[s] == 'A') fs = true;
    else s++;
    if(input[e] == 'Z') fe = true;
    else e--;
  }
  // cout << s << endl;
  // cout << e << endl;
  cout << e-s+1 << endl;

  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int H, W;
bool A[500][500];

pii get(int n) {
    if ((n / W) % 2 == 0) return {n / W, n % W};
    else return {n / W, W - 1 - n % W};
}

int main() {
    cin >> H >> W;
    int a;
    REP(i, H) REP(j, W) {
        cin >> a;
        A[i][j] = a % 2 == 1;
    }
    cout << endl;

    vector<pii> ans;
    REP(i, H * W - 1) {
        pii c = get(i);
        if (A[c.first][c.second]) {
            pii n = get(i + 1);
            A[n.first][n.second] = !A[n.first][n.second];
            ans.push_back({i, i + 1});
        }
    }
    cout << ans.size() << endl;
    for (pii p : ans) {
        pii c = get(p.first);
        cout << c.first + 1 << " " << c.second + 1 << " ";
        c = get(p.second);
        cout << c.first + 1 << " " << c.second + 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 3444