akhauriyash/Code-Regression huggingface dataset:
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
#include<boost/operators.hpp>
#include<boost/dynamic_bitset.hpp>

namespace adaptor = boost::adaptors;
using index_t = std::size_t;

void Main()
{
	std::vector<int64_t> powers;
	for (std::int64_t i = 2; i <= 2000000000; i <<= 1)
	{
		powers.emplace_back(i);
	}
	std::multiset<std::int64_t> set;
	int N;
	std::cin >> N;
	for (auto i : boost::irange(0, N))
	{
		std::int64_t v;
		std::cin >> v;
		set.emplace(v);
	}
	int count = 0;
	while (set.size() != 0)
	{
		auto top = std::prev(set.end());
		auto p = *boost::upper_bound(powers, *top);
		auto ite = set.lower_bound(p - *top);
		if (*ite + *top == p && ite != top)
		{
			set.erase(ite);
			++count;
		}
		set.erase(top);
	}
	std::cout << count << std::endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

Measured memory_bytes: 9600
N=input()
a=list(map(int,input().split()))
j=range(400,3600,400)
c=[0]*8
r=0
for i in a:
    for k in range(8):
        if i>=3200:
            r+=1
            break
        if i<j[k]:
            c[k]+=1
            break
ans=8-c.count(0)
print(max(ans,1),ans+r)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using p = pair<int,int>;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> p(n);
  rep(i,n) cin >> p[i];
	sort(p.begin(),p.end());
  int sum = 0;
  rep(i,k) {
    sum+= p[i];
  }
  cout << sum << endl;
}


Measured memory_bytes: 3588
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

x, y = map(int, input().split())

mod = 10**9+7 #出力の制限
g1 = [1]*(x+y) # 元テーブル
g2 = [1]*(x+y) #逆元テーブル
inverse = [1]*(x+y)
inverse[0] = 1

if (x+y)%3 != 0 :
  print(0)
else:
  n = (x + y) // 3
  if x >= n and y >= n:
    a = x - n
    b = y - n
    
    for i in range(2, n + 1):
      g1[i]=( g1[i-1] * i ) % mod 
      inverse[i]=( -inverse[mod % i] * (mod//i) ) % mod 
      g2[i]=(g2[i-1] * inverse[i]) % mod
    
    answer = cmb(a+b,a,mod)
    print(answer)
  else:
    print(0)


Measured memory_bytes: 113396
import math
a,b,C = map(int,input().split())
C = math.radians(C)
S = 0.5*a*b*math.sin(C)
L = a+b+math.sqrt(a**2+b**2-2*a*b*math.cos(C))
h = 2*S/a
print(S,L,h)


Measured memory_bytes: 5708
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		int a[] = new int[n];

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

		int mode = 0;
		int count = 1;

		for(int i = 1; i < n; i++){
			if(mode == 0){
				if(a[i] > a[i - 1]){
					mode = 1;
				}
				else if(a[i] < a[i - 1]){
					mode = 2;
				}
			}
			else if(mode == 1 && a[i] < a[i - 1]){
				mode = 0;
				count++;
			}
			else if(mode == 2 && a[i] > a[i - 1]){
				mode = 0;
				count++;
			}
		}

		System.out.println(count);
	}
}


Measured memory_bytes: 49224
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {//222
	int n;
	cin>>n;
	int ans = 1;
	REP(i,2,sqrt(n)) {
		int val = i*i;
		while(val<=n)val*=i;
		val/=i;
		if(val<=n)
		ans=max(ans,val);
	}
	cout<<ans;
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


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

int main(){
  string s; cin >> s;
  int s_size = s.size();
  int r = 0;
  int count = 0;
  for(int i=0;i<s_size;i++){
    char c = s[i];
    if(c=='A'||c=='C'||c=='G'||c=='T'){
      count++;
      r = max(count,r);
    }else{
      count = 0;
    }
  }
  cout << r << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define deb(x) cout << #x << ':' << x << endl;
#define loop3(i, k, n) for(i=k; i<n; i++)
#define ll  long long 
#define loop(i,n) for(int i=0;i<n;i++)
#define loop2(i,n) for(int i = 1;i<=n;i+=1)
#define pb push_back
#define mp make_pair
#define v1d vector<ll> 
#define v2d vector<vector<ll>>
const int INF = 1e9 +5 ;
int main()
{
    ll k,x;
    cin>>k>>x;
    for(int i = x - k + 1; i<= x + k -1;i++)
    {
        cout<<i<<" ";
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<fstream>
#include<vector>
#include<algorithm>
#include<map>
#include<queue>
#include<cmath>

using namespace std;

int main(){
    int K;
    cin >> K;
    vector<int> modans;
    int nowmod = 7 % K;
    for(int i=0;i<K;i++){
        modans.push_back(nowmod);
        nowmod *= 10;
        nowmod %= K;
    }

    int summod = 0;
    for(int i=0;i<K;i++){
        summod += modans[i];
        summod %= K;
        if(summod == 0){
            cout << i+1 << endl;
            return 0;
        }
    }
    cout << -1 << endl;

    return 0;
}


Measured memory_bytes: 6996
#include<stdio.h>
#include<math.h>

int isprime(int);

int main(){
  int i,t,n,a[10000],prime=0;
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(i=0;i<n;i++){
  t=isprime(a[i]);
  if(t==1) prime++;
  }
  printf("%d\n",prime);
  return 0;
} 

int isprime(int x){
  int i;

  if(x==2) return 1;
  
  if(x<2 || x%2==0) return 0;

  i=3;
  while(i<=sqrt(x)){
    if(x%i==0) return 0;
    i=i+2;
  }

  return 1;
}

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

lc = []
l = []

for i in range(n):
    s,p = (num for num in input().split())
    p = int(p)
    if s in lc:
        idx = lc.index(s)
        l[idx][1].append((i,p))
    else:
        lc.append(s)
        l.append([s,[(i,p)]])
        
#print(lc)
#print(l)

l.sort(key = lambda x:x[0])
for i in range (len(lc)):
    t = l[i][1]
    t.sort(key = lambda x: x[1], reverse=True)
    for tu in t:
        print(tu[0]+1)

Measured memory_bytes: 38384
n = int(input())
h = list(map(int, input().split()))
i = 0
count = 0
ans = []
while i < n - 1:
  if h[i] < h[i + 1]:
    ans.append(count)
    count = 0
  else:
    count += 1
  i += 1
ans.append(count)
print(max(ans))


Measured memory_bytes: 63984
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int,int>;

const long long INFLL = 1LL << 60;
const int INFI = 1000000000;


int main(){
    long long A,B,C,K; cin >>A >> B>>C>> K;
    if(K%2 == 0) cout << A-B << endl;
    else cout << B-A << endl;
    
}


Measured memory_bytes: 256
N, M, C = map(int,input().split())
Bs = list(map(int,input().split()))

As = []
As += [[int(i) for i in input().split()] for _ in range(N)]

def tim(A):
    r = 0
    for i in range(M):
        r += A[i]*Bs[i]
    r += C
    return r > 0

print(sum([tim(A) for A in As]))

Measured memory_bytes: 3064
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(true) {
            int n = sc.nextInt();
            if(n == 0) break;

            int sum = 0;
            int max = -1;
            int min = 1001;
            for(int i = 0; i < n; i++) {
                int s = sc.nextInt();
                if(s > max) max = s;
                if(s < min) min = s;
                sum += s;
            }

            System.out.println((sum - max - min) / (n - 2));
        }
    }
}


Measured memory_bytes: 29044
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

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

#endif
// 実数の場合
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

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

    int k, n;
    cin >> n >> k;
    vector<int> l(n);
    for (int i = 0; i < n; i++) {
        cin >> l[i];
    }

    sort(l.begin(), l.end(), greater<>());
    int ans = 0;
    for (int i = 0; i < k; i++) {
        ans += l[i];
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
from heapq import heappop,heappush
q=int(input())
queries=[list(map(int,input().split()))for _ in range(q)]
l=[]
r=[]
ans=0
queonecount=0
mid=-1
for query in queries:
  if query[0]==1:
    queonecount+=1
    _,a,b=query
    ans+=b
    heappush(l,-a)
    heappush(r,a)
    midl=-heappop(l)
    midr=heappop(r)
    ans+=abs(midl-midr)
    heappush(l,-midr)
    heappush(r,midl)
  if query[0]==2:
    minind=-heappop(l)
    print(minind,ans)
    heappush(l,-minind)

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

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
const ll mod = 1e9 + 7;
const int INF = 1e9;

int main() {
	cin.sync_with_stdio(false);
	ld X, Y;
	cin >> X >> Y;
	ld cnt = 0;
	while (X <= Y) {
		X *= 2;
		cnt++;
	}
	cout << cnt << endl;
	return 0;
}

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

int main() {
    int N;
    map<int,char> m;
    m[0] = '0';
    m[1] = '1';
    m[2] = '2';
    m[3] = '3';
    m[4] = '5';
    m[5] = '7';
    m[6] = '8';
    m[7] = '9';
    while (cin >> N, N) {
        string ans;
        while (N) {
            int mod = N % 8;
            ans = m[mod] + ans;
            N /= 8;
        }
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 3144
#include<stdio.h>
int main(void)
{
int a,s[3],d[3],f[3],g[3],j,i,k,h,z,x;
scanf("%d",&a);
while(a!=0){
for(i=1;i<=a;i++){
scanf("%d %d %d %d %d %d %d %d",&s[1],&d[1],&f[1],&g[1],&s[2],&d[2],&f[2],&g[2]); //1=A 2=B
//printf("%d %d %d %d %d %d %d %d %d\n",s[1],d[1],f[1],g[1],s[2],d[2],f[2],g[2]);
k=(s[1]*s[2])-(d[1]*d[2])-(f[1]*f[2])-(g[1]*g[2]);
h=(s[1]*d[2])+(s[2]*d[1])+(f[1]*g[2])-(g[1]*f[2]);
z=(s[1]*f[2])+(s[2]*f[1])+(g[1]*d[2])-(g[2]*d[1]);
x=(s[1]*g[2])+(s[2]*g[1])+(d[1]*f[2])-(d[2]*f[1]);
printf("%d %d %d %d\n",k,h,z,x);
}
scanf("%d",&a);
}
return 0;
}

Measured memory_bytes: 1028
#include <iostream>

using namespace std;

int main()
{

   int a=1,b=1;
   cin>>a>>b;
   if(a<=9 && b<=9){
    if(a==b)
   for (int i=0;i<a;i++){
       cout<<b;
   }
    else
    {
        if(a<b){
            for(int i=0;i<b;i++)
            cout<<a;
            }
        else if(b<a){
            for(int i=0;i<a;i++)
                cout<<b;
        }
    }
}


    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n,t;
  cin >> n >> t;
  vector<ll> a(n);
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  ll mi=1000000001,ma=-1,cnt=0;
  for(int i=0;i<n;i++){
    if(ma==a[i]-mi){
      cnt++;
    }
    ma=max(ma,a[i]-mi);
    mi=min(mi,a[i]);
  }
  cout << cnt+1 << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstdlib>
#include<utility>
#include<tuple>
#include<string>
#include<vector>
#include<numeric>
#include<algorithm>
#include<queue>
#include<deque>
#include<bitset>
#include<cmath>
#include<map>
#include<iomanip>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
#define rep(i, a, b) for(int i = a; i < b; i++)

int main() {
	
	vector<int> x(5);
	int ans;

	rep(i, 0, 5) {
		cin >> x[i];
		if (x[i] == 0) ans = i + 1;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define dbug(x) cout<<#x<<"="<<x<<endl
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while ('0'>ch||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do {(t*=10)+=ch-'0';ch=getchar();} while ('0'<=ch&&ch<='9'); t*=f;
}
//const int L=-1,R=1;
const int maxn=600010;
int n,k,cnt,l,r,flag;
char s[maxn],t[maxn];
bool A(char ch) {
	if (flag&&ch=='B') return 1;
	if (!flag&&ch=='A') return 1;
	return 0;
}
void C(char &ch) {
	if (ch=='A') ch='B';
	else ch='A';
}
int main() {
	//freopen("1.txt","r",stdin);
	read(n); read(k);
	scanf("%s",s+1);
	for (int i=1;i<=n;i++) t[i]=s[i];
	l=1; r=n;
	while (cnt<k) {
		cnt++;
		if (A(t[l])) C(t[l]);
		else {
			flag^=1;
			t[++r]=t[l]; l++;
		}
		if (cnt>=2*n&&cnt%2==k%2) break;
	}
	for (int i=l;i<=r;i++) {
		if (flag) C(t[i]);
		printf("%c",t[i]);
	} printf("\n");
	/*
	int pos,from;
	while (k--) {
		pos=1; from=R;
		while (1<=pos&&pos<=n) {
			if (s[pos]=='A') {
				from=-from;
				s[pos]='B';
			} else s[pos]='A';
			pos+=from;
		}
		printf("%s\n",s+1);
	}
	*/
	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>


using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define INF64 1999999999999999999
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007




string s;
int main() {
	bool h = false;
	cin >> s;
	ll a = (s[5] - '0') * 10 + (s[6] - '0'), b = (s[8] - '0') * 10 + (s[9] - '0');
	if (a > 4)h = true;
	cout << (h ? "TBD" : "Heisei") << endl;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define SZ(i) int(i.size())
#ifdef tmd
#define IOS()
#define debug(...) fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);_do(__VA_ARGS__);
template<typename T> void _do(T &&x){cerr<<x<<endl;}
template<typename T, typename ...S> void _do(T &&x, S &&...y){cerr<<x<<", ";_do(y...);}
#else
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define debug(...)
#endif

const int MAXN = 1000006;
const ll MOD = 1000000007;

/*********************GoodLuck***********************/
int main () {
    IOS();
    string str;
    cin >> str;
    if (str[0] == 'R') {
        cout << "Sunny" << endl;
    } else if (str[0] == 'S') {
        cout << "Cloudy" << endl;
    } else {
        cout << "Rainy" << endl;
    }
    return 0;
}


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

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second

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

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

const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS = 1e-5;

double dp[51][5001]; // i, sum = ?¢????
int X, Y, Z;
int V[4];
vector<pii> g[51];
pii event[51];

int main() {
	while (cin >> X >> Y >> Z, X || Y || Z) {
		REP(i, X) scanf("%d", V + i);
		
		fill(event, event + Y + 1, pii(0, 0));
		REP(i, Y + 1) g[i].clear();
		
		fill(dp[0], dp[Y + 1], 0);
		
		REP(i, Z) {
			int n, e, a;
			scanf("%d %d %d", &n, &e, &a);
			if (e == 1) {
				event[n] = pii(1, a);
			}
			else {
				if (e == 3) a = -a;
				event[n] = pii(2, a);
			}
		}
		
		REP(i, Y) {
			REP(j, X) {
				int p = min(i + V[j], Y);
				int c = 0;
				
				if (event[p].fi == 1) p = min(p + event[p].se, Y);
				else if (event[p].fi == 2) c = event[p].se;
				
				g[i].push_back(pii(p, c));
			}
		}
		
		dp[0][0] = 1;
		REP(i, Y) {
			REP(j, 5001) {
				if (dp[i][j] == 0) continue;
				
				REP(k, g[i].size()) {
					int np = g[i][k].fi;
					int nc = max(j + g[i][k].se, 0);
					
					dp[np][nc] += dp[i][j] / X;
				}
			}
		}
		
		double ans = 0;
		REP(i, 5001) if (dp[Y][i] != 0)
			ans += i * dp[Y][i];
		ans += EPS;
		
		printf("%d\n", (int)ans);
	}
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> as(N);
  rep(i, N) cin >> as[i];

  string ans = "APPROVED";
  rep(i, N) {
    int a = as[i];
    if (a%2 != 0) continue;
    if (a%3 != 0 && a%5 != 0) {
      ans = "DENIED";
      break;
    }
  }
  cout << ans << endl;
}


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

vector<int> b,p;
int o=0,z=0;
int N,M;

int calc(int d){
    vector<int> v;
    for(int i=0;i<M;i++){
        for(int j=0;j<p[i];j++) v.push_back((i+d)%2);
    }

    int one = 0;
    int zero = 0;
    for(int i=0;i<N;i++){
        if(v[i]==0)  zero++;
        else one++;
    }
    if(one==o and zero==z){
        vector<int> s,t;
        for(int i=0;i<N;i++){
            if(b[i]==1 and v[i]==0){
                s.push_back(i);
            }else if(b[i]==0 and v[i]==1){
                t.push_back(i);
            }
        }
        int cnt = 0;
        for(int i=0;i<s.size();i++){
            cnt += abs(t[i]-s[i]);
        }
        return cnt;
    }
    return numeric_limits<int>::max();
}

int main(){
    int ans = numeric_limits<int>::max();
    cin >> N >> M;
    b.resize(N);
    p.resize(M);
    for(int i=0;i<N;i++) cin >> b[i];
    for(int i=0;i<M;i++) cin >> p[i];
    for(int i=0;i<N;i++) 
        if(b[i]==0) z++;
        else o++;

    // start from zero
    vector<int> v;
    for(int i=0;i<M;i++){
        for(int j=0;j<p[i];j++) v.push_back(i%2);
    }

    ans = min(calc(0),calc(1));
    cout << ans << endl;
}

Measured memory_bytes: 3148
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a,b;
  cin>>a>>b;
  if(0>=a&&0<=b) {
    cout<<"Zero";
    return 0;
  }
  if(a>0){
    cout<<"Positive";
    return 0;
  }
  
  if((b-a+1)%2==0){
    cout<<"Positive";
    return 0;
  }
  cout<<"Negative";
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)
	s := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&s[i])
	}

	ans := exec(n, s)
	fmt.Println(ans)
}

func exec(n int, s []int) int {
	sort.Sort(sort.Reverse(sort.IntSlice(s)))
	alice, bob, isAlice := 0, 0, true

	for _, n := range s {
		if isAlice {
			alice += n
		} else {
			bob += n
		}
		isAlice = !isAlice
	}
	return alice - bob
}


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

int main() {
  char c;
  cin >> c;
  if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o'){
  cout << "vowel" << endl;} else{
  cout << "consonant" << endl;
  }
  
    }

Measured memory_bytes: 256
n = int(input())
As = list(map(int, input().split()))
sum = [0]
for i in range(0, n):
    asum = sum[i] + As[i]
    sum.append(asum)
#print(sum)
ans = 10**18
for j in range(0, n):
    l = sum[j]
    r = sum[n] - sum[j]
    find = abs(l-r)
    ans = min(ans, find)
print(ans)

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

using namespace std;

struct UnionFind{
    int n;
    vector<int> par;
    vector<int> siz;

    UnionFind(int n) : n(n){
        par.resize(n);
        iota(par.begin(),par.end(),0);
        siz.assign(n,1);
    }

    void unite(int a,int b){
        int ra = root(a);
        int rb = root(b);

        if(ra == rb){
            return;
        }

        if (siz[ra] < siz[rb]){
            swap(ra,rb);
        }

        siz[ra] += siz[rb];
        par[rb] = ra;
    }

    int root(int x){
        if (par[x] == x){
            return x;
        }
        return par[x] = root(par[x]);
    }

    int get_size(int x){
        return siz[x];
    }
};

int main(){
    int n,m;
    cin >> n >> m;
    UnionFind uf(n);
    for(int i=0 ; i<m ; i++){
        int a,b; cin >> a >> b;
        uf.unite(a,b);
    }

    int ans = 0;
    for(int i=0 ; i<n ; i++){
        ans = max(ans,uf.get_size(i));
    }

    cout << ans << endl;
}

Measured memory_bytes: 4820
#include <iostream>
#include <string>
#include <algorithm>
#define llint long long
#define mod 1000000007

using namespace std;

llint n, k;

const int FACT_MAX = 200005;
llint fact[FACT_MAX], fact_inv[FACT_MAX];

llint modpow(llint a, llint n)
{
	if(n == 0) return 1;
	if(n % 2){
		return ((a%mod) * (modpow(a, n-1)%mod)) % mod;
	}
	else{
		return modpow((a*a)%mod, n/2) % mod;
	}
}

void make_fact()
{
	llint val = 1;
	fact[0] = 1;
	for(int i = 1; i < FACT_MAX; i++){
		val *= i;
		val %= mod;
		fact[i] = val;
	}
	fact_inv[FACT_MAX-1] = modpow(fact[FACT_MAX-1], mod-2);
	for(int i = FACT_MAX-2; i >= 0; i--){
		fact_inv[i] = fact_inv[i+1] * (i+1) % mod;
	}
}

llint comb(llint n, llint k)
{
	llint ret = 1;
	ret *= fact[n];
	ret *= fact_inv[k], ret %= mod;
	ret *= fact_inv[n-k], ret %= mod;
	return ret;
}

int main(void)
{
	cin >> n >> k;
	make_fact();
	for(int i = 1; i <= k; i++){
		if(n-k < i-1) cout << 0 << endl;
		else cout << comb(k-1, i-1) * comb(n-k+1, i) % mod << endl;
	}
	return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;
struct edge {
    int to, cost;
};
typedef vector<vector<edge> > AdjList;
AdjList graph;

typedef pair<int, int> P;

const int INF = 10000000;

vector<int> dist; 
vector<int> prever;
vector<int>ans;
void dijkstra(int n, int s){
    dist = vector<int>(n,INF);
    prever = vector<int>(n,-1);
    dist[s] = 0;

    priority_queue<P, vector<P>, greater<P> > que;
    que.push(P(0,s));

    while(!que.empty()){
        P p = que.top();
        que.pop();
        int v = p.second;
        if(dist[v] < p.first){
            continue;
        }
        for(int i=0;i<graph[v].size();i++){
            edge e = graph[v][i];
            if(dist[e.to] > dist[v] + e.cost){
                dist[e.to] = dist[v] + e.cost;
                prever[e.to] = v;
                que.push(P(dist[e.to],e.to));
                ans[e.to]=v;
            }
        }
    }
}

vector<int> get_path(int t){ //頂点tへの最短路
    vector<int> path;
    for(; t != -1;t=prever[t]){
        path.push_back(t);
    }

    reverse(path.begin(), path.end());
    return path;
}

int main(void){
    int n, m;
    cin >> n >> m;
    graph = AdjList(n);
    for(int i=0;i<m;i++){
        int from, to;
        cin >> from >> to ;
      from--;
      to--;
        graph[from].push_back((edge){to,1});
      graph[to].push_back((edge){from,1});
    }
  ans = vector<int>(n);
  dijkstra(n,0);
  cout<<"Yes"<<endl;
  
  rep2(j,1,n){
    
    
    
    
     cout << ans[j]+1 << endl;
    
        
  }
}



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

/* define const */
const int M5 = 100000;
const long Div = 1000000007;
/* finish defineing const */

int A[M5+10] = {};
int Cnt[M5+10] = {};

int main()
{
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> A[i];
    Cnt[A[i]]++;
  }
  // finish inputting

  bool f = true;
  long t = 0;

  sort(A, A+n);
  //  for (int i = 0; i < n; i++) cout << "-" << A[i] << ";" << Cnt[i]<< endl;
  if (n == 1) {
    if (Cnt[0] != 1) f = false;
  }
  else {
  if (n%2 == 1) { // nが奇数
    for (int i = 0; i*2 < n; i++) {
      if (i == 0 && Cnt[i] != 1) {
	f = false;
	//	cout << i << "~" << Cnt[i] << endl;
	break;
      }
      else if (i != 0 && Cnt[i*2] != 2) {
	f = false;
	//	cout << i << "~"<<  endl;
	break;
      }
    }
  }
  else { // nが偶数
    for (int i = 0; (i*2+1) < n; i++) {
      if (Cnt[i*2+1] != 2) {
	f = false;
	break;
      }
    }
  }
  }

  if (!f) cout << 0 << endl;
  else {
    long ans = 1;
    if (n == 1) ans = 1;
    else {
      for (int i = 0; i < n/2; i++) {
	ans = (ans * 2) % Div;
      }
    }
    cout << ans << endl;
  }
}


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

int main(){
  int N,M;
  cin >> N >> M;
  int counter=0;
  int n_start=0;
  int n_end=N;
  for(int m=0; m<=M; m++){
    int L,R;
    cin >> L >> R;
    
    if(n_start<L) n_start=L;
    if(R<n_end)   n_end=R;
  }
  counter = (n_start>n_end ? 0 : n_end-n_start+1);
  cout << counter << endl;
  return 0;
}



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


int main()
{
  while(true)
  {
    int h,w;
    cin>>h>>w;
    if(h==0 && w==0) break;
    for (int i = 0; i < h; ++i)
    {
      for (int j = 0; j < w; ++j)
      {
        cout<<((i+j)%2==0? "#":".");
      }
      cout<<endl;
    }
    cout<<endl; 
  }
}


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

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);

  int n,m;cin>>n>>m;
  if(n==m){
    puts("Yes");
  }else
    puts("No");
  
  return 0;
}


Measured memory_bytes: 256
import math
mod = 10**9+7

# 素因数分解、辞書で返すやつ
# mathをimportする
def prime(n):
    factor = {}
    tmp = int(math.sqrt(n)) + 1
    for num in range(2, tmp):
        while n % num == 0:
            n //= num
            if not num in factor.keys():
                factor[num] = 1
            else:
                factor[num] += 1
        if num > n:
            break
    if n != 1:
        if not n in factor.keys():
            factor[n] = 1
        else:
            factor[n] += 1
    return factor

#互いに素なa,bについて、a*x+b*y=1の一つの解
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]

# aの逆元(mod m)を求める。(aとmは互いに素であることが前提)
def mod_inv(a,m=mod):
    x = extgcd(a,m)[0]
    return (m+x%m)%m

import sys
input = sys.stdin.readline


N = int(input())
A = list(map(int, input().split()))

dic = {}
for a in A:
    pr = prime(a)
    for num, count in pr.items():
        if not num in dic.keys():
            dic[num] = count
        else:
            if dic[num] < count:
                dic[num] = count

lcm = 1
for num, count in dic.items():
    lcm *= pow(num, count, mod)
    lcm %= mod

ans = 0
for a in A:
    ans += mod_inv(a)*lcm
    ans %= mod

print(ans)


Measured memory_bytes: 4596
#include<stdio.h>



int main(){
int N,x;
int A[8]={0,0,0,0,0,0,0};
int n[8]={0,0,0,0,0,0,0};
int n0[8]={0,1,1,1,1,1,1};
int n1[8]={0,0,0,0,1,1,0};
int n2[8]={1,0,1,1,0,1,1};
int n3[8]={1,0,0,1,1,1,1};
int n4[8]={1,1,0,0,1,1,0};
int n5[8]={1,1,0,1,1,0,1};
int n6[8]={1,1,1,1,1,0,1};
int n7[8]={0,1,0,0,1,1,1};
int n8[8]={1,1,1,1,1,1,1};
int n9[8]={1,1,0,1,1,1,1};

while(1){
scanf("%d",&N);if(N==-1)break;
for(int i=0;i<7;i++)
A[i]=0;

for(int i=0;i<N;i++)
{
scanf("%d",&x);
switch(x){

case 0:
for(int i=0;i<7;i++)
n[i]=n0[i];
break;

case 1:
for(int i=0;i<7;i++)
n[i]=n1[i];
break;

case 2:
for(int i=0;i<7;i++)
n[i]=n2[i];
break;

case 3:
for(int i=0;i<7;i++)
n[i]=n3[i];
break;

case 4:
for(int i=0;i<7;i++)
n[i]=n4[i];
break;

case 5:
for(int i=0;i<7;i++)
n[i]=n5[i];
break;

case 6:
for(int i=0;i<7;i++)
n[i]=n6[i];
break;

case 7:
for(int i=0;i<7;i++)
n[i]=n7[i];
break;

case 8:
for(int i=0;i<7;i++)
n[i]=n8[i];
break;

case 9:
for(int i=0;i<7;i++)
n[i]=n9[i];
break;
}
for(int i=0;i<7;i++)
{if(A[i]!=n[i])printf("1");
else if(A[i]==n[i])printf("0");
A[i]=n[i];
}
printf("\n");
}
}
return 0;
}

Measured memory_bytes: 1000
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int dp[2005][2005]={0};
int main() {
    int h, w; cin >> h >> w;
    vector<string> s(h);
    rep(i,h) cin >> s[i];
    vector< vector<int> > yoko(h+1);
    vector< vector<int> > tate(w+1);
    {
    rep(j, w) tate[j].push_back(-1);
    rep(i, h) {
        yoko[i].push_back(-1);
        rep(j, w) {
            if(s[i][j]=='#') {
                yoko[i].push_back(j);
                tate[j].push_back(i);
            }
        }
    }
    }
    rep(i, h) yoko[i].push_back(w);
    rep(j, w) tate[j].push_back(h);
    //yoko
    rep(i, h) {
        for(int j=0;j<yoko[i].size()-1;j++) {
            int left = yoko[i][j] + 1;
            int right = yoko[i][j+1] - 1;
            int c = right - left + 1;
            for(int k=left;k<=right;k++) dp[i][k] += c;
        }
    }
    //tate
    rep(j, w) {
        for(int i=0;i<tate[j].size()-1;i++) {
            int left = tate[j][i] + 1;
            int right = tate[j][i+1] - 1;
            int c = right - left + 1;
            for(int k=left;k<=right;k++) dp[k][j] += c;
        }
    }
    int ma = 0;
    rep(i,h) rep(j,w) ma = max(ma, dp[i][j]);
    cout << ma-1 << endl;
}


Measured memory_bytes: 54272
// https://atcoder.jp/contests/abc176/tasks/abc176_e
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define CEIL(a, b) ((a - 1) / b + 1)

void solve() {
    int H, W, M;
    cin >> H >> W >> M;
    vector<int> row(H), col(W);
    vector<pair<int, int>> v(M);
    REP(i, M) {
        int r, c;
        cin >> r >> c;
        r--, c--;
        row[r]++;
        col[c]++;
        v[i] = {r, c};
    }
    sort(ALL(v));
    v.erase(unique(ALL(v)), v.end());

    vector<int> R, C;
    int maxr = -1, maxc = -1;
    REP(i, H) {
        if (row[i] > maxr)
            maxr = row[i], R.clear(), R.push_back(i);
        else if (row[i] == maxr)
            R.push_back(i);
    }
    REP(i, W) {
        if (col[i] > maxc)
            maxc = col[i], C.clear(), C.push_back(i);
        else if (col[i] == maxc)
            C.push_back(i);
    }
    // 爆弾の数が最大の行と列に爆弾があるか確認
    for (auto &r : R) {
        for (auto &c : C) {
            if (!binary_search(ALL(v), make_pair(r, c))) {
                cout << maxr + maxc << endl;
                return;
            }
        }
    }
    cout << maxr + maxc - 1 << endl;
}

signed main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    solve();
}


Measured memory_bytes: 20976
#include<iostream>
#include<vector>
using namespace std;
int main() {
	int N; cin >> N;
	vector<int>W(N);
	for (int i = 0;i < N;i++) {
		cin >> W[i];
	}

	int ans = 6000;
	int sum_1 = 0, sum_2 = 0;
	for (int i = 0;i < N;i++) {
		int data = 0, sum_2 = 0;
		sum_1 += W[i];
		for (int j = 1+i;j < N;j++) {
			sum_2 += W[j];
		}
		data = sum_2 - sum_1;
		if (data < 0)data *= -1;
		if (ans > data)ans = data;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
#define FASTIO std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl '\n'
#define hell        163577857
#define vi          vector<int>
// #define int         long long int
const long long INF = 1000 * 1000 * 1000 * 1ll * 1000 * 1000 * 1000;
typedef long long ll;
typedef pair<int, int> pairs;

int main () {
  string s, t;
  cin >> s >> t;
  if (s.length() >= t.length()) {
    cout << "No" << endl;
    return 0;
  }

  for (int i = 0; i < s.length(); i++) {
    if (s[i] != t[i])  {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 3628
n = int(input())
a = sorted(list(map(int, input().split())))
a.reverse()
ans = []
c = 1
for i in range(1, n):
    if len(ans) >= 2:
        break
    if a[i] == a[i - 1]:
        c += 1
        m = a[i]
    else:
        if c >= 2:
            ans.append([a[i - 1], c])
        c = 1
if len(ans) < 2 and c >= 2:
    ans.append([a[n - 1], c])

if len(ans) >= 2:
    if ans[0][1] >= 4:
        print(ans[0][0] ** 2)
    else:
        print(ans[0][0] * ans[1][0])
elif len(ans) == 1:
    if ans[0][1] >= 4:
        print(ans[0][0] ** 2)
    else:
        print(0)
else:
    print(0)

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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#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, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    int a, b;
    cin >> a >> b;
    int ans = -1;
    FOR(i, 1, 10100){
        if(i*8/100 == a && i/10 == b){
            ans = i;
            break;
        }
    }
    cout << ans << 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 all(vec) vec.begin(), vec.end()
#define END return 0
typedef int64_t ll;
const int mod7 = 1e9 + 7;
const int mod9 = 1e9 + 9;
const int inf = 1 << 30;
const ll INF = 1LL << 60;
template<typename T> T gcd(T a, T b) {return b ? gcd(b, a % b) : abs(a);}
template<typename T> T lcm(T a, T b) {return a / gcd(a, b) * b;}
template<typename T> bool chmax(T &a, T b) {if (a < b) {a = b; return true;} return false;}
template<typename T> bool chmin(T &a, T b) {if (a > b) {a = b; return true;} return false;}
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) {fill((T*)array, (T*)(array+N), val);}

int main() {
    string s[3];
    rep(i, 3) cin >> s[i];
    int it[3] = {-1, -1, -1}, cur = 0;
    while(true) {
        it[cur]++;
        if(it[cur] == s[cur].size()) break;
        if(s[cur][it[cur]] == 'a') cur = 0;
        else if(s[cur][it[cur]] == 'b') cur = 1;
        else cur = 2;
    }
    cout << char('A' + cur) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
using namespace std;

int main() {
  int N, M; cin >> N >> M;
  vector<int> S(M);
  vector<char> C(M);
  for (int i = 0; i < M; i++) cin >> S[i] >> C[i];

  for (int i = 0; i < 1000; i++) {
    bool flag = true;
    string str = to_string(i);
    if (str.length() < N) continue;
    for ( int j = 0; j < M; j++) {
      if (str[S[j] - 1] != C[j]) flag = false;
    }
    if (flag) {
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}


Measured memory_bytes: 256
n, k = gets.split.map(&:to_i) 
candles = Array.new
candles = gets.split.map(&:to_i) 


min_sum = 4*[candles[0].abs, candles[n-1].abs].max
#find the time to time to light k candles for every sequence of k candles
for i in 0..candles.length-k 
	if candles[i] > 0
		sum = candles[i+k-1]
	elsif candles[i+k-1] < 0
		sum = -candles[i]
	else
		if -candles[i] <= candles[i+k-1]
			sum = 2*(-candles[i]) + candles[i+k-1]
	    else
	    	sum = -candles[i] + 2*candles[i+k-1]
	    end
	end
	
	if sum < min_sum
		min_sum = sum
	end
end

puts min_sum

Measured memory_bytes: 8460
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  
  int a = 0;
  for (int i = 0; i < n; i++) {
    int l, r;
    cin >> l >> r;
    a += r-l+1;
    
  }
  
  cout << a << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
typedef long long int lli;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<pll> vop;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<int> vi;
#define REP(i,a,b) for( long long i=a;i<b;i++)
#define REPR(i,a,b) for(long long i=a;i>=b;i--)
#define adb(a) for(auto i:a) cout << i << " "; cout << endl
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
#define endl "\n"
#define mem(a,b) memset(a,b,sizeof(a))
#define mod 1000000009
#define MAX 500005;
#define PI 3.14159265358979323846

ll power(ll a, ll b, ll m) { ll ans = 1; a = a % m; while (b) { if (b & 1) ans = (ans * a) % m; b /= 2; a = (a * a) % m; } return ans; }

ll lcm(ll a, ll b) { return (a * b) / __gcd(a, b); }

ll modInverse(ll a, ll m) { ll g = __gcd(a, m); return power(a, m - 2, m); }


int main()
{


    fastIO;
    int test = 1;
    //cin >> test;
    while (test--)
    {
        int n, k;
        cin >> n >> k;
        int h[n + 1];
        REP(i, 1, n + 1) cin >> h[i];
        int dp[n + 1];
        memset(dp, 1000001, sizeof(dp));
        dp[0] = 0;
        dp[1] = 0;
        REP(i, 2, n + 1)
        {
            REP(j, 1, k + 1) {
                if (i - j >= 1)
                    dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]));
            }
        }
        cout << dp[n] << endl;
    }
    return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long n,ans=0;
  string s,l,r;
  cin >> n >> s;
  l=s.substr(0,n);
  r=s.substr(n,n);
  string red,blue;
  map<string, int> mp;
  for(int bit=0;bit<(1 << n);bit++){
    red="";
    blue="";
    for(int i=0;i<n;i++){
      if(bit & (1 << i)){
        red+=l[i];
      }else{
        blue+=l[i];
      }
    }
    string t=red+","+blue;
    mp[t]++;
  }
  for(int bit=0;bit<(1 << n);bit++){
    red="";
    blue="";
    for(int i=0;i<n;i++){
      if(bit & (1 << i)){
        red+=r[i];
      }else{
        blue+=r[i];
      }
    }
    reverse(red.begin(), red.end());
    reverse(blue.begin(), blue.end());
    string t=blue+","+red;
    ans+=mp[t];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 67200
from collections import defaultdict
N, K, Q = map(int, input().split())
A = list(map(int, input().split()))
A_sorted = sorted(A)
ans = float("inf")
ap = 0
for i, a in enumerate(A_sorted):
    if a==ap:
        continue
    ap = a
    L = [0]
    d = defaultdict(list)
    for aa in A:
        if aa < a:
            if L[-1]==0:
                continue
            else:
                L.append(0)
        else:
            L[-1]+=1
            d[aa].append(len(L)-1)
    cnt = 0
    aap = 0
    for aa in A_sorted[i:]:
        if aap==aa: continue
        aap = aa
        for v in d[aa]:
            if L[v] >= K:
                L[v] -= 1
                cnt += 1
        if cnt >= Q:
            break
    else:
        break
    ans = min(ans, aa-a)
print(ans)


Measured memory_bytes: 3916
#include<bits/stdc++.h>
using namespace std;
const long long M =1e5+2,MOD=1e9+7;
typedef long long ll;
#define pb push_back
#define Y printf("YES\n")
#define N printf("NO\n")
#define O printf("-1\n")
bool f_2=false,vis[M]= {false},f=false;
vector<ll>v,v_1,v_2;
string s,p,q,ok,ch;
map<ll,ll>mp,mp_2;
set<ll>st,st_1;
ll arr[M],ar[M];
ll cnt=0,cost=0,mx=0,NODE,t,par,zero=0;
deque<ll>Q;
//vector< pair<ll,ll > >v,v_1;
struct node
{
    ll pa,ran,visit;

};
//node X[M];
int main()
{
    ios::sync_with_stdio(false);//ISHWAR
    cin.tie(0);//Tourist_Twin
    //freopen("kamona.txt","r",stdin);
    ll a,b,c=1,n,t,sum=0,mx=0,l,x,y,i=0,j=0,result=0,e,sum_2,sum_1=0,d=0,k,mx_2=0,pos=0,neg=0,m,second=0;
    double cc=0.0;
    cin>>t;
    while(t--)
    {
        cin>>a;
        v.pb(a);
    }
    sort(v.begin(),v.end());
    cc=(v[0]+v[1])/2.0;
    for(i=2;i<v.size();i++)
    {
        cc=(v[i]+cc)/2.0;
    }
    cout<<fixed<<setprecision(9)<<cc<<endl;


    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <vector>
#include <iostream>
#include <string>
#include <functional>

using namespace std;


int main() {
	string S;
	cin >> S;
	int a = 0;
	for (int i = 0; i < S.length(); i++) {
		a += (S[i] == '+') ? 1 : -1;
	}
	cout << a << endl;
	return 0;
}

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

int main() {
  long K;
  cin >> K;
  long ans = 0;
  for (long i = 1; i <= K; i++) {
    if (i % 3 && i % 5) ans+= i;
  }
  cout << ans << "\n";
}

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

using namespace std;

int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n,j;
    cin>>n;
    int T[100000];
    int T1[100000];
    for (int i=0;i<n;i++)

    {cin>>T[i];
    }
    for (int i=0;i<n;i++)
        {
        j=T[i]-1;
        T1[j]=i+1;
        }
    for (int i=0;i<n;i++)
    {
    cout<<T1[i]<<endl;
    }

    return 0;
}


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

#if defined(DEBUG)

#include <unistd.h>
#include <sys/fcntl.h>
#define DLOG(...)        cerr << dbgFormat(__VA_ARGS__) << endl
#define DCALL(func, ...) func(__VA_ARGS__)

template <class... Args>
string dbgFormat(const char* fmt, Args... args) {
  size_t len = snprintf(nullptr, 0, fmt, args...);
  char buf[len + 1];
  snprintf(buf, len + 1, fmt, args...);
  return string(buf);
}

#else  // defined(DEBUG)

#define DLOG(...)
#define DCALL(func, ...)

#endif // defined(DEBUG)
// ----------------------------------------------------------------------

// ----------------------------------------------------------------------
int main(int argc, char *argv[]) {
#if defined(DEBUG)
  // GDB on Cygwin ignores redirection at run command.
  if (argc == 2) dup2(open(argv[1], 0), 0);
#else
  // For performance.  We should not use C-style stdio functions
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
#endif
  cout << setprecision(20);

  int N; cin >> N;
  string S; cin >> S;
  int ans = 0;
  char prev = -1;
  for (int i = 0; i < N; i++) {
    char now = S.at(i);
    if (prev != now) ans++;
    prev = now;
  }
  cout << ans << endl;

  return 0;
}



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

bool is_palindrome(string s){

    if(s == string( s.rbegin(), s.rend() )){
        return true;
    }else{
        return false;
    }

}

int main(){
    string s;
    cin >> s;
    
    if(is_palindrome(string(s.begin(), s.begin() + s.size()/2)) && is_palindrome(string(s.begin() + s.size()/2 + 1, s.end())) && is_palindrome(s)){
        cout << "Yes";
    }else{
        cout << "No";
    }
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <stdio.h>
using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPL(i,f,n) for(int i=f, i##_len=(n); i<i##_len; ++i)
typedef long long ll;

int main() {
	string MARCH = "MARCH";
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N;
	string s;
	ll c[5] = { 0 };
	cin >> N;
	REP(i, N) {
		cin >> s;
		REP(j, MARCH.length()) {
			if (s[0] == MARCH[j]) {
				c[j]++; 
				break;
			}
		}
	}
	ll ans = 0;
	REP(i, 5) {
		REPL(j,i+1, 5) {
			REPL(k,j+1, 5) {
				ans += c[i] * c[j] * c[k];
			}
		}
	}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

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

    string s;
    cin >> s;
    ll n = s.size();
    ll p = 0, g = 0, win = 0, lose = 0;
    REP(i, n){
        if(p < g){
            p++;
            if(s[i] == 'g') win++;
        }
        else{
            g++;
            if(s[i] == 'p') lose++;
        }
    }
    cout << win - lose << endl;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <sstream>
#include <map>
#include <vector>
#include <queue>
#include <iomanip>

using namespace std;
typedef long long ll;

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

ll ans, mx, sum, mn = 1e8, cnt;
ll b[1000000];
int main(){
	ll n;
	cin>>n;
	
	for(ll i=0; i<n-1; i++){
		ll a;
		cin>>a;
		b[a]++;
	}
	//cout<<b[0]<<endl;
	for(ll i=1; i<=n; i++){
		cout<<b[i]<<endl;
	}
	
}


Measured memory_bytes: 4712
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{


    ll i,j,k,a,b,c,n,t,m,q;
    vector<ll> v,s;
    map<ll,ll> ma,sa;
    string st,et;
    cin>>n>>k>>q;
    for(i=1;i<=q;i++){
        cin>>a;
        ma[a]++;
    }
    for(i=1;i<=n;i++){
        a = q-ma[i];
        //b = q-a;
        c = k-a;
        //cout<<a<<" "<<b<<" "<<c<<endl;
        if(c<=0){
            cout<<"No"<<endl;
        }
        else cout<<"Yes"<<endl;
    }
}


Measured memory_bytes: 6912
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
    class Program
    {
        static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        static long[] ReadLongs()
        {
            return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }

        static double ReadDouble()
        {
            return double.Parse(Console.ReadLine());
        }

        static double[] ReadDoubles()
        {
            return Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
        }

        static string ReadString()
        {
            return Console.ReadLine();
        }

        static string[] ReadStringSplit()
        {
            return Console.ReadLine().Split(' ');
        }

        static void A()
        {
            var N = ReadLong();
            Console.WriteLine((double)((N + 1) / 2) / (double)N);
        }

        static void B()
        {
            var NK = ReadLongs();
            var N = NK[0];
            var K = NK[1];
            var hs = ReadLongs();
            var ans = 0;
            foreach (var h in hs) {
                if (h >= K)
                {
                    ans++;
                }
            }
            Console.WriteLine(ans);
        }

        static void C()
        {
            var N = ReadLong();
            var A = ReadLongs();
            var ans = new int[N];
            for (int i = 0; i < A.Length; ++i)
            {
                ans[A[i] - 1] = i + 1;
            }
            foreach (var a in ans)
            {
                Console.Write(a + " ");
            }
            Console.WriteLine();
        }

        static void D()
        {

        }

        static void Main(string[] args)
        {
            //A();
            //B();
            C();
            //D();
        }
    }
}


Measured memory_bytes: 39484
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define inf 1e+9
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }

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

    int n,k,ans=0;
	string s;
	char c[4];
	//cin >> n >> k;
	//cin >> s;
	rep(i,4){
		cin >> c[i];
		if(c[i] == c[i-1] && i>0){
			ans++;
		}
	}
	
	if(ans==0){
		cout << "Good" << endl;
	}
	else{
	cout << "Bad" << endl;
	}
}

Measured memory_bytes: 256