akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
   int n;
   cin>>n;
   cout<<(n*(n+1))/2<<endl;

    return 0;
}


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


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

  int count = 0 ;
  rep( i, 3) {
    if ( s[i] == t[i] ) ++count ;
  }
  cout << count ;
  return 0 ;
}



Measured memory_bytes: 256
#include <iostream>
#include<cstdio>
#include<vector>
#include<cstring>
#include<algorithm>
#include<set>
#include<queue>
#include<map>
#include<cmath>
using namespace std;
#define LL long long
#define rep(i,a,n) for(int i=a;i<n;++i)
#define per(i,a,n) for(int i=n-1;i>=a;--i)
#define mem(a,t) memset(a,t,sizeof(a))
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define sz(v) ((int)sizeof(v))
#define N 305
const int inf=1e9;
int num[N];
int used[N];
int a[N][N];
int c[N];
int main()
{
    ios_base::sync_with_stdio(false);
    int n,m;
    cin>>n>>m;
    rep(i,0,n){
        rep(j,0,m){
            cin>>a[i][j];
        }
    }
    mem(c,0);
    int ans=n,i,cnt=0;
    while(cnt<m){
        int num[N]={};
        for(i=0;i<n;++i){
            num[a[i][c[i]]]++;
        }
        //rep(i,1,m+1) cout<<num[i]<<' ';
        size_t pos=max_element(num+1,num+m+1)-num;
        //cout<<pos<<' ';
        ans=min(ans,num[pos]);

        //cout<<num[pos]<<endl;
        used[pos]=1;
        for(i=0;i<n;++i){
            while(c[i]<m&&used[a[i][c[i]]]) ++c[i];
            if(c[i]==m) break;
        }
        if(i<n) break;
       // ++cnt;
    }
    cout<<ans<<endl;
    return 0;
}


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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

typedef long long ll;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }


void compute() {

}

int main() {
  int n;
  cin >> n;
  set<string> S;
  int score = 0;
  map<string,int> mp, np;
  string s;
  rep(i,n) {
    cin >> s;
    ++mp[s];
  }
  cin >> n;
  rep(i,n) {
    cin >> s;
    ++np[s];
  }
  for(map<string,int>::iterator it=mp.begin();it!=mp.end();++it) {
    score = max(score,it->second-np[it->first]);
  }
  cout << score << endl;
  compute();
  return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<math.h>

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

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

const int mod = 1e9 + 7;
const long double pi = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;

int main() {
	int A, B;
	cin >> A >> B;
	if (A <= 8 && B <= 8) {
		cout << "Yay!";
	}
	else {
		cout << ":(";
	}
	system("pause");
	return 0;
}

Measured memory_bytes: 504
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <memory.h>
#include <cassert>
#include <iomanip>

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;



int main() {
	for (double s, h; cin >> s >> h, (s != 0 && h != 0); ) {
		double x = sqrt(h * h + s * s / 4.0);
		cout << setprecision(10) << s * x * 2.0 + s * s << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <cstdio>
#include <stack>
#include <vector>
using namespace std;

using i64 = long long;

#define REP(i, stop) for (int i = 0, i##_len = stop; i < i##_len; ++i)

const int is = 1 << 17;
char ib[is], *ip = ib + is, it;
inline char getc() {
	if (ip == ib + is) { fread_unlocked(ib, 1, is, stdin); ip = ib; }
	return *ip++;
}
inline int read() {
	int r = 0;
	if (ip + 16 > ib + is) while ((it = getc()) & 16) r = r * 10 + it - '0';
	else while ((it = *ip++) & 16) r = r * 10 + it - '0';
	return r;
}

const int os = 1 << 17;
char ob[os], *op = ob, ot;
inline void putc(const char c) {
	*op++ = c;
	if (op == ob + os) { fwrite_unlocked(ob, 1, os, stdout); op = ob; }
}
// x shoud be greater than or equal to zero
inline void write(int x) {
	char d[6];
	int i = 0;
	while (true) {
		d[i] = x % 10 + 48;
		x /= 10;
		++i;
		if (x <= 0) break;
	}
	while (i--) {
		putc(d[i]);
	}
	putc(' ');
}

using P = pair<i64, i64>;
signed main() {
  i64 N = read(), Q = read();
  vector<vector<i64>> G(N);
  REP(_, N - 1) {
    i64 a = read(), b = read();
    a -= 1;
    b -= 1;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  vector<i64> cnt(N);
  REP(_, Q) {
    i64 p = read(), x = read();
    p -= 1;
    cnt[p] += x;
  }
  vector<i64> ans(N);
  vector<bool> used(N, false);
  stack<P> st;
  st.push({0, 0});
  while (st.size()) {
    P a = st.top();
    st.pop();
    i64 v = cnt[a.first] + a.second;
    ans[a.first] = v;
    used[a.first] = true;
    for (i64 b : G[a.first]) {
      if (!used[b]) {
        st.push({b, v});
      }
    }
  }
  REP(i, N) {
    printf("%d ", ans[i]);
//    write(ans[i]);
  }
//  fwrite_unlocked(ob, 1, op - ob, stdout);
}


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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int n = in.nextInt();

            boolean odd = false;

            for (int i = 0; i < n; i++) {
                int cn = in.nextInt();
                if (cn % 2 == 1) {
                    odd = true;
                    break;
                }
            }

            out.println(odd ? "first" : "second");
        }

    }

    static class FastScanner {
        private InputStream in;
        private byte[] buffer;
        private int bufPointer;
        private int bufLength;

        public FastScanner(InputStream in) {
            this.in = in;
            buffer = new byte[1024];
        }

        private boolean hasNextByte() {
            if (bufPointer < bufLength) return true;
            bufPointer = 0;
            try {
                bufLength = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            return (bufLength > 0);
        }

        private int readByte() {
            return hasNextByte() ? buffer[bufPointer++] : -1;
        }

        private static boolean isPrintableChar(int c) {
            return (c >= 33 && c <= 126);
        }

        public boolean hasNext() {
            while (hasNextByte() && !isPrintableChar(buffer[bufPointer]))
                bufPointer++;
            return hasNextByte();
        }

        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
                throw new NumberFormatException();
            return (int) nl;
        }

        public long nextLong() {
            if (!hasNext())
                throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || b > '9')
                throw new NumberFormatException();

            while (true) {
                if (b >= '0' && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if (b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }

    }
}



Measured memory_bytes: 22596
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

int main(void) {
  unordered_map<string, long> mp;
  long N;
  cin >> N;
  while (N--) {
    string tmp;
    cin >> tmp;
    mp[tmp] ++;
  }
  cin >> N;
  while (N--) {
    string tmp;
    cin >> tmp;
    mp[tmp] --;
  }
  long result = (*(mp.begin())).second;
  for (auto it: mp) if (result < it.second) result = it.second;
  cout << max(0l, result) << endl;
  return 0;
}


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

import numpy as np
from numpy import pi
N = int(input())
X,Y = np.array([input().split() for _ in range(N)],dtype=np.float64).T

# ひとつずつ計算する。垂直二等分線のどっちか側。
# 半平面の共通部分

def solve(i):
    Xother = np.delete(X,i)
    Yother = np.delete(Y,i)
    angle = np.arctan2(Y[i]-Yother,X[i]-Xother) # 半平面の中心線
    # 右半平面に帰着
    angle -= angle[0]
    # -pi,piに含める
    angle[angle<-pi] += 2*pi
    angle[angle>pi] -= 2*pi
    lower = np.zeros_like(angle)
    upper = np.zeros_like(angle)
    case1 = (angle<=0)
    case2 = (angle>=0)
    lower[case1] = -pi/2
    upper[case1] = angle[case1]+pi/2
    lower[case2] = angle[case2]-pi/2
    upper[case2] = pi/2
    
    return max(0,upper.min() - lower.max())/(2*pi)

answer = [solve(i) for i in range(N)]
print(*answer,sep='\n')

Measured memory_bytes: 12672
#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
const long long INF = 1LL << 60;
// const int INF=1010101010;
using Graph = vector<vector<int>>;

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  SORT(a);
  int ma = -1;
  rep(i, n - 1) {
    if (min(a[i], a[n - 1] - a[i]) > ma) {
      ma = a[i];
    }
  }
  cout << a[n - 1] << " " << ma << endl;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype

template <class T>
int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount

const double EPS = 1e-10;
typedef long long ll;
typedef pair<int, int> pint;


vector<int> edge[100];
bool used_once[100];
bool used[100];
int dfs(int v)
{
	used_once[v] = true;
	used[v] = true;
	int res = 0;
	foreach (it, edge[v])
		if (!used[*it])
			res = max(res, dfs(*it));
	used[v] = false;
	return res + 1;
}
int main()
{
	int n;
	while (scanf("%d", &n), n)
	{
		for (int i = 0; i < 100; ++i)
			edge[i] = vector<int>();
		while (n--)
		{
			int a, b;
			scanf("%d%d", &a, &b);
			--a; --b;
			edge[a].push_back(b);
			edge[b].push_back(a);
		}
		
		pint e[100];
		for (int i = 0; i < 100; ++i)
			e[i] = pint(edge[i].size(), i);
		sort(e, e+100);

		int res = 0;
		int last = 9999;
		fill(used_once, used_once + 100, false);
		for (int i = 0; i < 100; ++i)
		{
			if (!used_once[e[i].second] || e[i].first == last)
			{
				res = max(res, dfs(e[i].second));
				last = e[i].first;
			}
		}
		printf("%d\n", res);
	}
}

Measured memory_bytes: 928
def cul(x, y):
    res = 0
    for yp in range(H):
        for xp in range(W):
           res += map[yp][xp] * min(abs(y-yp), abs(x-xp))
    return res

H, W = list(map(int,input().split()))
map = [list(map(int,input().split())) for i in range(H)]
ans = cul(0, 0)
for y in range(H):
    for x in range(W):
        ans = min(ans, cul(x, y))
print(ans)


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

const int MAX_N = 2e3 + 6;
int n, m, q;
string S[MAX_N];
int cnt[MAX_N][MAX_N];
int psum1[MAX_N][MAX_N];
int psum2[MAX_N][MAX_N];

int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    cin >> n >> m >> q;
    for (int i = 1; i <= n; i++) {
        cin >> S[i];
        S[i] = '#' + S[i];
    }

    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++)
            cnt[i][j] = (S[i][j] == '1') + cnt[i - 1][j] + cnt[i][j - 1] - cnt[i - 1][j - 1];

    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++) {
            psum1[i][j] = (S[i][j] == '1' && S[i - 1][j] == '1') + psum1[i - 1][j] + psum1[i][j - 1] - psum1[i - 1][j - 1];
            psum2[i][j] = (S[i][j] == '1' && S[i][j - 1] == '1') + psum2[i - 1][j] + psum2[i][j - 1] - psum2[i - 1][j - 1];
        }

    while (q--) {
        int x1, y1, x2, y2;
        cin >> x1 >> y1 >> x2 >> y2;
        cout << cnt[x2][y2] - cnt[x1 - 1][y2] - cnt[x2][y1 - 1] + cnt[x1 - 1][y1 - 1]
                - (psum1[x2][y2] - psum1[x1][y2] - psum1[x2][y1 - 1] + psum1[x1][y1 - 1]) 
                - (psum2[x2][y2] - psum2[x2][y1] - psum2[x1 - 1][y2] + psum2[x1 - 1][y1]) << "\n";
    }
    return 0;
}

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


int main() {

long X,N;
cin>>X>>N;
vector<long> p(N);

for(long i=0;i<N;i++) {
  cin>>p[i];
}

long ans=0;
long m=1234567890;

for(int i=-100;i<=200;i++){
  long tmp=abs(i-X);
  long flg=true;
  for(int j=0;j<N;j++){
    if(p[j]==i) flg=false;
  }
  if(flg&&tmp<m){
    ans=i;
    m=tmp;
  }
}


cout<<ans<<endl;

}


Measured memory_bytes: 3636
import sys, heapq


def main():
    
    input = sys.stdin.readline
    
    N, M = map(int, input().split())
    value = [-int(inp) for inp in input().split()]

    heapq.heapify(value)

    for _ in range(M):
        old_elem = heapq.heappop(value)
        if old_elem == 0:
            break
        new_elem = -(- old_elem // 2)
        heapq.heappush(value, new_elem)

    print(- sum(value))
    
if __name__=="__main__":
    main()

Measured memory_bytes: 14200
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E18;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);



int main(){fastio
    string s,t;cin>>s>>t;
    ll ans=inf;
    rep(i,0,s.size()-t.size()){
        ll sum=0;
        rep(j,0,t.size()-1){
            if(t[j]!=s[i+j]){
                sum++;
            }
        }
        ans=min(ans,sum);
    }
    cout<<ans<<endl;

    return 0;
}





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

int64_t pow2(int64_t X) {
	if (X == 0) return 1;
	if (X == 1) return 2;
	return pow2(X >> 1) * pow2(X >> 1) * pow2(X & 1);
}
int main() {
	int64_t N, X, patty = 0;
	cin >> N >> X;
	for (;N >= 0;-- N, -- X) {
		if (X >= pow2(N + 1) - 1) { // 半分より多い
			patty |= pow2(N);
			X -= pow2(N + 1) - 2;
		}
	}
	cout << patty;
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

まず、レベルLバーガーの枚数を考えてみるか(本題じゃないけど)
枚数をf(x)とする
この時、f(0)=1, f(x)=3+2f(x-1)より、f(x)=2^(x+2)-3
ということでXは最大で2^52-3が考えられるのでオーバーフローとかに注意、あとはO(X)は許されないっぽい

次に、バーガーの規則を考えていこう
まず、試しに5個だけ列挙
P
BPPPB
BBPPPBPBPPPBB
BBBPPPBPBPPPBBPBBPPPBPBPPPBBB
BBBBPPPBPBPPPBBPBBPPPBPBPPPBBBPBBBPPPBPBPPPBBPBBPPPBPBPPPBBBB
さて、これをどう考えるか考えてみよう
まず、全てのバーガーは対称な形をしているので、X≧2^(N+1)-1なら、答えはX-2^(N+1)+1と2^(N+1)-2の時の答え+1と表すことができる
ちなみに2^(N+1)-2の計算後の答えは2^N-1ね
さて、上の操作でまずXが半分を超えることは無くなった
次に、X-1は要するに1個上のバーガーなので、この時の答えが分かれば再帰的に求まる
よって、これを再帰でもメモ化再帰でもすれば求まる
今回は小さいし再帰しようか、O(N)ね
*/

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;
 
#define rep(i, n) for(int i = 0; i < (int)(n);    i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
typedef std::vector<int> vi;
typedef std::vector<std::vector<int>> vvi;

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

template<typename T> class BinaryIndexedTree {
  private:
    int S;
    std::vector<T> v;
  public:
    BinaryIndexedTree<T> (int _S) {
      S = _S;
      v.resize(S+1);
    }
    void update(int i, T k) {
      for(i++; i <= S; i += i&-i) v[i] = v[i] + k;
    }
    T read(int i) {
      T sum = 0;
      for(i++; i; i -= i&-i)  sum = sum + v[i];
      return sum;
    }
    T read(int l, int r) {
      return read(r) - read(l-1);
    }
};

int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  int N; std::cin >> N;
  BinaryIndexedTree<int> bit(N+1);

  int cnt = 0;
  rep(i,N) {
    int P; std::cin >> P;
    if ( bit.read(P, N) == i ) cnt++;
    bit.update(P, 1);
  }
  std::cout << cnt << std::endl;
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <set>

using namespace std;

int main()
{
    set<char> dict {'a', 'e', 'i', 'o', 'u'};
    char c;
    cin >> c;
    if (dict.find(c) == dict.end()) {
        cout << "consonant" << endl;
    } else {
        cout << "vowel" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
from collections import Counter
n = int(input())
S = list(input() for i in range(n)) 

ctr = Counter()
ans = 0
for s in S:
    s =  ''.join(sorted(list(s)))
    if s in ctr:
        ans += ctr[s]
    ctr[s] += 1 

print(ans)

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

int main(){
string S;
  cin>>S;
  int ans1=0, ans2=0;
  for(int i=0; i<S.size(); i++){
   if(S.at(i)=='A'){
    ans1=i-1;
    break;}
  }
  
  for(int i=S.size()-1; i>0; i--){
   if(S.at(i)=='Z'){
    ans2=i;
    break;
   }
  }
  cout<<ans2-ans1<<endl;
}

Measured memory_bytes: 640
//tong cac An : SumAn <=R - day An co Am!=Am+1
//M so co min = x va N-m tat ca <= x-1
//M so co min >=x - M co so co min >=x+1
//N-M tat ca <= x-1 <=> co it nhat 0 so >x - co it nhat 1 so >x + ....
#include <bits/stdc++.h>
#define ll long long
#define maxn 600100
#define base 1000000007
 
using namespace std;
 
int n,m,l,r;
ll fac[maxn],finv[maxn],inv[maxn],ans;
 
void init() {
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for (int i=2;i<maxn;i++) {
        inv[i] = base - inv[base%i]*(base/i)%base;
        fac[i] = (1ll*fac[i-1]*i)%base;
        finv[i] = (finv[i-1]*inv[i])%base;
    }
}
 
ll C(int k,int n) {
    if (n<k||k<0) return 0;
    return fac[n]*finv[k]%base*finv[n-k]%base;
}
 
ll solve2(int R1,int n,int m,int x) {
    ll tmp=0;
    if (R1<0) return 0;
    for (int k=0;k<=n-m&&k*x<=R1;k++) {
        int R2 = R1-k*x;
        ll ea = C(k,n-m) * C(R2,R2+n)%base;
        if (k%2==0) tmp = (tmp+ea)%base;
        else tmp = (tmp-ea+base)%base;
    }
    return tmp;
}
 
ll solve(int R,int n,int m) {
    ll tmp = C(R,R+n);
    for (int x=1;m*x<=R;x++) tmp = (tmp - C(m,n)*(solve2(R-x*m,n,m,x) - solve2(R-(x+1)*m,n,m,x)+base)%base + base)%base;
    return tmp;
}
 
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin);
    cin>>n>>m>>l>>r;
    init();
    ans = (solve(r,n,m) - solve(l-1,n,m) + base)%base;
    cout << ans;
}

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

int main() {
    int N, C, K;
    cin >> N >> C >> K;
    int num = 1;
    int divide = 0;
    vector<int> T(N);
    for (int i=0; i<N; i++) {
        cin >> T.at(i);
    }
    sort(T.begin(), T.end());
    int Time = T.at(0);
    for (int i=1; i<N; i++) {
        if (num != C) {
            if (Time + K >= T.at(i)) {
                num++;
            } else {
                divide++;
                num = 1;
                Time = T.at(i);
            }
        } else {
            divide++;
            num = 1;
            Time = T.at(i);
        }
    }
    int ans = divide + 1;
    cout << ans << endl;
    return 0;
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll A, B;
    cin >> A >> B;
    if(A > 8 || B > 8) cout << ":(";
    else cout << "Yay!";
    cout << endl;
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define VSORT(v) sort(v.begin(), v.end())
#define DVSORT(v) sort(v.begin(), v.end(),greater<int>())
#define SORT(v, n) sort(v, v+n)
#define DSORT(v,n) sort(v, v+n,greater<int>())
#define vi vector<int>
#define pb push_back
#define P pair<int,int>


template <class T> void chmin(T&a, const T&b) { a = min(a,b); }
template <class T> void chmax(T&a, const T&b) { a = max(a,b); }

const double EPS =1e-9;
const long INF =999999999;
const long MOD =1000000007; //10^9+7
#define PI 3.14159265258979

int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

int main(){
	int N,M,a,b;
	set<pair<int,int>> st;

	cin>>N>>M;
	FOR(i,1,M+1){
		cin>>a>>b;
		st.insert(P(a,b));
	}

	FOR(i,2,N+1){
		if(st.find(P(1,i))!=st.end()&&st.find(P(i,N))!=st.end()){
			puts("POSSIBLE");
			break;
		}else if(i==N){
			puts("IMPOSSIBLE");
		}
	}
	
	return 0;
}



Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    int arr[n];
    for(int i = 0 ; i < n ; i++)
        cin >> arr[i];
    ll sum = 0;
    for(int i = 0 ; i < n-1 ; i++){
        sum += max(0 , arr[i] - arr[i + 1]);
        arr[i+1] = max(arr[i] , arr[i+1]);
    }
    cout<<sum;
}



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

int main () {
    int K , N;
    cin >> K >> N;
    vector <int> A(N);
    int ans = -1;
    for(int i = 0; i < N; i++){
        cin >> A[i];
        if(i > 0){
			ans = max(ans , A[i] - A[i - 1]);
		}
    }
    cout << K - max(ans , K - A[N - 1] + A[0]) << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using str = string;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
const double PI = 3.141592653589793238;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define REP(i, m, n) for (int i = m; i < (int)n; i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greator<>()
#define d20 std::setprecision(20)
#define veci vector<int>
#define vecll vector<long long int>
#define vecb vector<bool>
#define vecd vector<double>
template <typename T>
T lcm(T a, T b)
{
	return a / __gcd(a, b) * b;
}
void comb(vector<vector<long long int>> &v)
{
	for (size_t i = 0; i < v.size(); i++)
	{
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (size_t k = 1; k < v.size(); k++)
	{
		for (size_t j = 1; j < k; j++)
		{
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
		}
	}
}
ll repeat_squaring(ll n, ll p, ll m)
{
	if (p == 0)
		return 1;
	if (p % 2 == 0)
	{
		ll t = repeat_squaring(n, p / 2, m);
		return t * t % m;
	}
	return n * repeat_squaring(n, p - 1, m);
}

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	cout << a + b + c - max({a, b, c}) << endl;
	return 0;
}

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

char m[502][502] ;
int cnt[502] , cnt2[502] , n ;
char a[502][502] ;

int res ;
void gao (int i , int j) {
  for (int k = 1 ; k <= n ; ++k)
    if (k != i) a[k][j] = a[i][k];
  a[i][j] = a[i][i];
  cnt[i] = cnt2[j] = 0;
  for (int k = 1 ; k <= n ; ++k)
    cnt[i] += a[i][k] == '#' , cnt2[j] += a[k][j] == '#';
  ++res;
}

int solve (int p) {
  res = 0;
  memset(cnt,0,sizeof(cnt));
  memset(cnt2,0,sizeof(cnt2));
  for (int i = 1 ; i <= n ; ++i) for (int j = 1 ; j <= n ; ++j) a[i][j] = m[i][j];
  for (int i = 1 ; i <= n ; ++i)
    for (int j = 1 ; j <= n ; ++j)
      cnt[i] += a[i][j] == '#' , cnt2[j] += a[i][j] == '#';

  if (a[p][p] != '#') {
    if (cnt2[p] == 0) {
      int x = 1 ; while (cnt[x] == 0) ++x;
      int y = 1 ; while (a[x][y] == '.') ++y;
      gao(x,p);
      gao(y,p);
    }
    else {
      int x = 1 ; while (a[x][p] == '.') ++x;
      gao(x,p);
    }
  }
  for (int i = 1 ; i <= n ; ++i) if (a[p][i] == '.') gao(p,i);
  for (int i = 1 ; i <= n ; ++i) if (cnt2[i] != n) gao(p,i);
  return res;
}

int main (void) {
  cin >> n;
  for (int i = 1 ; i <= n ; ++i)
    scanf("%s",m[i]+1);

  bool flag = 0;
  for (int i = 1 ; i <= n ; ++i)
    for (int j = 1 ; j <= n ; ++j)
      if (m[i][j] == '#') flag = 1;
  if (flag == 0) cout << -1 << endl;
  else {
    int ans = n*2+2;
    for (int i = 1; i <= n ; ++i)
      ans = min(solve(i),ans);
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 768
import sys
input=sys.stdin.readline
n=int(input())
Tree=[[] for _ in range(n)]
for _ in range(n-1):
    a,b,c=map(int,input().split())
    Tree[a-1].append((b-1,c))
    Tree[b-1].append((a-1,c))
Q,k=map(int,input().split())
dist=[float('inf')]*n
dist[k-1]=0
stack=[k-1]

while stack!=[]:
    p=stack.pop()
    for q in Tree[p]:
        qp,ql=q[0],q[1]
        if dist[qp]==float('inf'):
            dist[qp]=dist[p]+ql
            stack.append(qp)

for _ in range(Q):
    x,y=map(int,input().split())
    print(dist[x-1]+dist[y-1])

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

#define all(v) v.begin(), v.end()
#define rep(i, n) REP(i, 0, n)
#define REP(i, x, n) for (int i = x; i < n; i++)
#define REPE(i, x, n) for (int i = x; i <= n; i++)
#define OP(x) cout << x << endl;
template<typename T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> void chmax(T& a, T b) { if(a > b) a = b; }
template<class T> void chmin(T& a, T b) { if(a < b) b = a; }
typedef long long ll;

int main() {
    int n, m, x; cin >> n >> m >> x;
    vector<bool> a(m, false);
    rep(i, m){
        int t; cin >> t;
        a[t] = true;
    }
    int cost1 = 0;
    int cost2 = 0;
    for(int i = x + 1; i <= n; i++){
        if(a[i]) cost1++;
    }
    for(int i = x; i >= 0; i--){
        if(a[i]) cost2++;
    }
    cout << min(cost1, cost2) << endl;
}


Measured memory_bytes: 256
n=int(input())
data=[]
for i in range(n):
    data.append(list(map(int,input().split())))
    
first_h_index=0
for i in range(n):
    if data[i][2] > 0:
        first_h_index=i
        break
    
for i in range(101):
    for j in range(101):
        h=data[first_h_index][2]+abs(data[first_h_index][0]-i)+abs(data[first_h_index][1]-j)
        for k in range(n):
            if data[k][2] != max(h-abs(data[k][0]-i)-abs(data[k][1]-j),0):
                break
        else:
            print(i,j,h)
            exit()


Measured memory_bytes: 73568
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    S = I()
    y = ceil(S,10**9)
    x = 10**9*y - S
    print(0,0,10**9,1,x,y)

if __name__ == '__main__':
    main()

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

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

}

Measured memory_bytes: 640
/*
      author : nishi5451
      created: 11.08.2020 20:24:28
*/

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


int main(){
    int a,b;
    cin >> a >> b;
    cout << max(max(a+b,a-b),a*b) << endl;
    return 0;
}

Measured memory_bytes: 3604
n = int(input())
TXY = [list(map(int,input().split())) for i in range(n)]
t = 0
x = 0
y = 0
ok = 0
            
for i in range(n):
    time = TXY[i][0]-t
    distance = abs(TXY[i][1]-x) + abs(TXY[i][2]-y)
    if time >= distance:
        if time%2 == distance%2:
            ok += 1
            
print("YNeos"[ok<n::2])

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

using Edge = struct{int to; int cost;};
using Graph = vector<vector<Edge>>;

vector<int> res;

Graph G;
void dfs(int v, int p, int c){
    res[v] = c;
    for(auto e: G[v]){
        if(e.to == p) continue;
        if(e.cost & 1) dfs(e.to, v, 1-c);
        else dfs(e.to, v, c);
    }
}

int main(){
    int n;
    cin >> n;
    G.assign(n, vector<Edge>());
    for(int i=0; i<n-1; i++){
        int u, v, w;
        cin >> u >> v >> w;
        u--; v--;
        G[u].push_back(Edge{v, w});
        G[v].push_back(Edge{u, w});
    }

    res.assign(n, 0);
    dfs(0, -1, 1);
    for(auto ans : res) cout << ans << endl;
    return 0;
}

Measured memory_bytes: 8960
// Tazoe

#include <iostream>
using namespace std;

int calc(int y, int m, int d)
{
	int M[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

	int days = 0;
	for(int i=1; i<m; i++){
		days += M[i-1];

		if(i==2&&(y%400==0||(y%100!=0&&y%4==0))){
			days++;
		}
	}

	return days+d;
}

int main()
{
while(true){
	int y1, m1, d1, y2, m2, d2;
	cin >> y1 >> m1 >> d1 >> y2 >> m2 >> d2;
if(y1<0||m1<0||d1<0||y2<0||m2<0||d2<0)  break;
	int sum = 0;
	for(int i=y1; i<y2; i++){
		sum += 365;

		if(i%400==0||(i%100!=0&&i%4==0)){
			sum++;
		}
	}

	const int M[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

	for(int i=1; i<m2; i++){
		sum += M[i-1];

		if(i==2&&(y2%400==0||(y2%100!=0&&y2%4==0))){
			sum++;
		}
	}
	sum += d2;

	for(int i=1; i<m1; i++){
		sum -= M[i-1];

		if(i==2&&(y1%400==0||(y1%100!=0&&y1%4==0))){
			sum--;
		}
	}
	sum -= d1;

	cout << sum << '\n';
}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int N;
int f(int x, int y) {
    if (x > y) swap(x, y);
    return x * N + y;
}
int main() {
    cin >> N;
    vector<vector<int>> A(N, vector<int>(N-1));
    for (auto &row : A) for (auto &a : row) cin >> a, a--;
    vector<vector<int>> G(N*N);
    vector<int> cnt(N*N);
    for (int i = 0; i < N; i++) {
        for (int j = 1; j < N-1; j++) {
            G[f(i, A[i][j-1])].push_back(f(i, A[i][j]));
            cnt[f(i, A[i][j])]++;
        }
    }
    vector<int> S;
    for (int i = 0; i < N; i++) {
        for (int j = i + 1; j < N; j++) {
            if (cnt[i * N + j] == 0) {
                S.push_back(i * N + j);
            }
        }
    }
    int ans = 0;
    int used = 0;
    while (!S.empty()) {
        ans++;
        vector<int> add;
        for (auto item : S) {
            used++;
            for (auto next : G[item]) {
                cnt[next]--;
                if (cnt[next] == 0) add.push_back(next);
            }
        }
        S.swap(add);
    }
    if (used != N * (N - 1) / 2) ans = -1;
    cout << ans << '\n';
    return 0;
}


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

int main(){
 int n,l;
  string c;
  cin>>n>>l>>c;
  for(int i=0;i<n;i++){
    if(c[i]-'0'>=0&&c[i]-'9'<=0){
    continue;
    }
    else{
      cout<<"No"<<endl;
      return 0;
    }
    }
  if(c[n]!='-'){
    cout<<"No"<<endl;
    return 0;
  }
  for(int i=0;i<l;i++){
    if(c[n+1+i]-'0'>=0&&c[n+1+i]-'9'<=0){
    continue;
    }
    else{
      cout<<"No"<<endl;
      return 0;
    }
    }
cout<<"Yes"<<endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define maxx 100010
using namespace std;
long long n,w,peso[200],valor[200],dp[200][maxx];

int main() {
	cin >> n >> w;
	for(int i = 1; i <= n; i++){
		cin >> peso[i] >> valor[i];
	}

	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= w; j++){
			if(peso[i] <= j){
				dp[i][j] = max(valor[i] + dp[i-1][j - peso[i]],dp[i-1][j]);
			}
			else dp[i][j] = dp[i-1][j];
		}
	}

	cout << dp[n][w] << endl;
	return 0;
}

Measured memory_bytes: 79360
program test
implicit none
integer :: a,b,c,x,y,p(3)

read(*,*) a,b,c,x,y

p(1) = b * max(y-x,0) + c * 2 * x
p(2) = a * max(x-y,0) + c * 2 * y
p(3) = a * x + b * y

write(*,*) minval(p(1:3))
 
end program

Measured memory_bytes: 768
#include <iostream>
#include <string>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

struct Cube
{
	int f[6];
	Cube(){}

	void roll(int i,int j,int k,int l)
	{
		int t = f[i];
		f[i] = f[j];
		f[j] = f[k];
		f[k] = f[l];
		f[l] = t;
	}

	void roll_z() { roll(1,2,4,3); }
	void roll_y() { roll(0,2,5,3); }
	void roll_x() { roll(0,1,5,4); }

	void move(char c)
	{
		if(c == 'E') rep(i,3) roll_y();
		else if(c == 'W') roll_y();
		else if(c == 'N') roll_x();
		else if(c == 'S') rep(i,3) roll_x();
	}
};

int getRight(Cube c,int a,int b)
{
	rep(i,6)
	{
		rep(j,4)
		{
			if(c.f[0] == a && c.f[1] == b)
			{
				return c.f[2];
			}
			c.roll_z();
		}
		if(i%2 == 0) c.roll_y();
		else c.roll_x();
	}

	return -1;
}

int main()
{
	Cube c;
	int n;
	rep(i,6) cin >> c.f[i];
	cin >> n;

	rep(k,n)
	{
		int a,b;
		cin >> a >> b;
		cout << getRight(c,a,b) << endl;
	}
	return 0;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	n-=1;
	int b[n];
	for(int i=0;i<n;i++)
	{
		cin>>b[i];
	}
	int a[n+1];
	a[0]=0x7fffffff;
	for(int i=0;i<n;i++)
	{
		a[i]=a[i]<b[i]?a[i]:b[i];
		a[i+1]=b[i];
	}
	int cnt=0;
	for(int i=0;i<=n;i++)
	{
		cnt+=a[i];
	}
	cout<<cnt;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<x<<endl
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
const ll LINF = LLONG_MAX;
const int INF = INT_MAX;
const double PI=acos(-1);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    int n; cin>>n;
    vector<int> s(n);
    int sum=0;
    rep(i,0,n){
        cin>>s[i];
        sum+=s[i];
    }
    if(sum%10!=0){
        cout<<sum<<endl;
        return 0;
    }
    sort(all(s));
    rep(i,0,n){
        if(s[i]%10!=0){
            cout<<sum-s[i]<<endl;
            return 0;
        }
    }
    cout<<0<<endl;
    return 0;
}

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

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

    int ans[n+1] = {0};
    for(int i = 0; i < m; i++){
        ans[a[i]]++;
        ans[b[i]]++;
    }

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


Measured memory_bytes: 256
#include<stdio.h>
#define N 100

int main(void){
  int i,num;
  char blood[5];
  int blC[4]={0};
  int hog;
  char hoge;

  for(;scanf("%d%c%s",&hog,&hoge,&blood)==3;){
    if(blood[0]=='O'){
      blC[3]++;
    }else if(blood[0]=='B'){
      blC[1]++;
    }else if(blood[0]=='A'){
      if(blood[1]=='B'){
        blC[2]++;
      }else{
        blC[0]++;
      }
    }
  }
  for(i=0;i<4;i++){
    printf("%d\n",blC[i]);
  }
  return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

int main() {
	char str[2][3];
	scanf("%s",str[0]);
	scanf("%s",str[1]);
	if(str[0][0]==str[1][2] && str[0][1]==str[1][1] && str[0][2]==str[1][0]) printf("YES\n");
	else  printf("NO\n");
	return 0;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin() x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin() x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s; cin >> s;
	if (s <= "2019/04/30")
		cout << "Heisei\n";
	else
		cout << "TBD\n";
	return 0;
}

Measured memory_bytes: 256
from operator import itemgetter

n = int(input())
sp = [input().split() for i in range(n)]

for i in range(n):
  sp[i][1] = int(sp[i][1])
  sp[i].append(i+1)

sp = sorted(sp, key=itemgetter(1), reverse=True)
sp = sorted(sp, key=itemgetter(0))

for i in range(n):
  print(sp[i][2])

Measured memory_bytes: 3064
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <set>
#include <queue>
#include <map>
#include <numeric>
#include <functional>
#include <math.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000000007LL)


int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<vector<pil>> G(N);
    for (int n = 1; n <= N-1; ++n) {
        int u, v;
        ll w;
        cin >> u >> v >> w;
        --u; --v;
        G[u].emplace_back(v, w);
        G[v].emplace_back(u, w);
    }
    
    vector<ll> D(N, INF);
    vector<int> Used(N, 0);
    D[0] = 0;
    Used[0] = 1;
    queue<int> Que;
    Que.push(0);
    while (!Que.empty()) {
        int Temp = Que.front(); Que.pop();
        for (auto e : G[Temp]) {
            int u = e.first;
            ll w = e.second;
            if (Used[u]) continue;
            Used[u] = 1;
            D[u] = D[Temp] + w;
            Que.push(u);
        }
    }
    for (int n = 0; n < N; ++n) {
        cout << D[n]%2 << '\n';
    }

    return 0;
}


Measured memory_bytes: 9088
using System;

namespace test2 {

    public class Program {

        public static void Main(string[] args) {

            var n = int.Parse(Console.ReadLine());
            var s = Console.ReadLine().ToCharArray();

            for(var i = 0; i < s.Length; i++) {

                var tmp = s[i];
                var x = tmp - 'A';
                x = (x + n) % 26;

                s[i] = (char)('A' + x);

            }

            Console.WriteLine(s);

        }

    }

}

Measured memory_bytes: 27536
#include <stdio.h>
#include <math.h>
int main(){
  int a,b,max,min;
  scanf("%d %d",&a,&b);
  if(a>b){min=b;max=a;}
  else {min=a;max=b;}
  
  if((max-min)%2==0)printf("%d\n",(max-min)/2+min);
  else printf("IMPOSSIBLE\n");
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define debug(...) { printf("#  "); printf(__VA_ARGS__); puts(""); }
#define fi first
#define se second
#define endl "\n" 
using ll = long long;
using pII = pair <int, int>;
using pLL = pair <ll, ll>;
using VI = vector <int>;
using VL = vector <ll>;
constexpr int mod = 1e9 + 7;
template <class T1, class T2> inline void chadd(T1 &x, T2 y) { x += y; while (x >= mod) x -= mod; while (x < 0) x += mod; } 
template <class T1, class T2> inline void chmax(T1 &x, T2 y) { if (x < y) x = y; }
template <class T1, class T2> inline void chmin(T1 &x, T2 y) { if (x > y) x = y; }
inline int rd() { int x; cin >> x; return x; }
template <class T> inline void rd(T &x) { cin >> x; }
template <class T> inline void rd(vector <T> &vec) { for (auto &it : vec) cin >> it; }
template <class T> inline void out(T s) { cout << s << "\n"; }
template <class T> inline void out(vector <T> &vec) { for (auto &it : vec) cout << it << " "; cout << endl; } 
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline ll qpow(ll base, ll n) { ll res = 1; while (n) { if (n & 1) res = res * base % mod; base = base * base % mod; n >>= 1; } return res; }
constexpr int N = 1e5 + 10;
int n, k, q, a[N]; 
inline void add(int l, int r) {
	if (l > r) return;
	++a[l];
	--a[r + 1];
}
void run() {
	memset(a, 0, sizeof a);
	for (int i = 1, x; i <= q; ++i) {
		cin >> x;
		add(1, x - 1);
		add(x + 1, n);
	}
	for (int i = 1; i <= n; ++i) {
		a[i] += a[i - 1];
		if (a[i] >= k) out("No");
		else out("Yes");
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr); cout.tie(nullptr);
	cout << fixed << setprecision(20);
	while (cin >> n >> k >> q) run();
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
  ll n,k;
  cin >> n >> k;
  string s;
  cin >> s;
  vl a(n+2*k+5,0);
  ll j=0;
  if(s[0]=='0'){
    j++;
  }
  a[j]++;
  FOR(i,1,n){
    if(s[i]==s[i-1]){
      a[j]++;
    }
    else{
      j++;
      a[j]++;
    }
  }
  ll t=0;
  rep(i,2*k+1){
    t +=a[i];
  }
  ll ans=t;
  for(ll i=0;2*k+i<n;i+=2){
    t -=a[i]+a[i+1];
    t +=a[2*k+1+i]+a[2*k+2+i];
    ans=max(ans,t);
  }
  cout << ans << endl;
}

Measured memory_bytes: 2816
#include <bits/stdc++.h>
typedef long long ll; 
const ll mod = 1e9+7;
#define fo(i, n) for (int i = 0; i < n; i++)
#define sc(n) scanf("%d", &n) 
using namespace std;

void solve() {
    int m, d; cin >> m >> d;
    int count = 0;
    for (int i = 1; i <= m; i++) {
        for (int j = 1; j <= d; j++) {
            int d10 = j / 10;
            int d1 = j % 10;
            if ((d10 < 2) || (d1 < 2)) continue;
            if (d10 * d1 == i) count++;
        }
    }
    cout << count;
}

int main() {
    int t = 1;
    //scanf("%d", &t);
    while (t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))
ans = 1
min_dif = abs(t-h[0]*0.006-a)
for i in range(1,n):
    dif = abs(t-h[i]*0.006-a)
    if min_dif > dif: min_dif,ans = dif,i+1
print(ans)

Measured memory_bytes: 38384
#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(){
    ll x;
    cin >> x;

    ll count =1000;
    vector<int> a(count);
    rep(i,count){
        a.at(i) = i*i*i*i*i;
    }

    rep(i,count){
        for(int j=i+1;j<count;j++){
            if(a.at(j)-a.at(i)==x){
                cout << j << " " << i <<endl;
                return 0;
            }else if(a.at(j)+a.at(i)==x){
                cout << j << " -" << i <<endl;
                return 0;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 3632