akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <iomanip>
#include <stdio.h>
#include <string.h>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using std::map;
using std::set;
using std::bitset;
using std::vector;
using std::string;
using std::multimap;
using std::multiset;
using std::deque;
using std::queue;
using std::stack;
using std::pair;
using std::iterator;

using std::sort;
using std::stable_sort;
using std::reverse;
using std::max_element;
using std::min_element;
using std::unique;
using std::ios_base;
using std::swap;
using std::fill;

using std::setprecision;
using std::fixed;

using std::min;
using std::max;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef string S;

namespace MySpace{

};

#define F(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define fi first
#define se second
#define re return
#define all(x) (x).begin(), (x).end()

ll inq(ll x, ll y, ll mod)
{
    if (y == 0) return 1;
    ll l = inq(x, y / 2, mod);
    if (y % 2) return l * l % mod * x % mod;
    return l * l % mod;
}

ll rev(ll x, ll mod)
{
    return inq(x, mod - 2, mod);
}

inline int nextInt()
{
    int x = 0;
    char c = getchar();
    int mi = (c == '-');
    if (c == '-') c = getchar();
    while ('0' <= c && c <= '9')
    {
        x = 10 * x + c - '0';
        c = getchar();
    }
    if (mi) return x * -1;
    return x;
}

vector<int> graph[500000];
ll mark[500000];

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n, m;
    cin >> n >> m;
    for (int i = 1; i <= m; i++)
    {
        int v, u;
        cin >> v >> u;
        graph[v].push_back(u);
        graph[u].push_back(v);
    }
    vector<int> v1, v2;
    v1.push_back(1);
    mark[1] = 1;
    for (int i = 0; i < v1.size(); i++)
    {
        int u = v1[i];
        for (auto w : graph[u])
        {
            if (mark[w] == 0)
            {
                mark[w] = 1;
                v1.push_back(w);
                break;
            }
        }
    }
    v2.push_back(1);
    for (int i = 0; i < v2.size(); i++)
    {
        int u = v2[i];
        for (auto w : graph[u])
        {
            if (mark[w] == 0)
            {
                mark[w] = 1;
                v2.push_back(w);
                break;
            }
        }
    }
    cout << v1.size() + v2.size() - 1 << "\n";
    F(i, v2.size() - 1) cout << v2[v2.size() - 1 - i] << " ";
    F(i, v1.size()) cout << v1[i] << " ";
}

Measured memory_bytes: 18808
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1e9;
const long long LINF = 1LL << 50;
#define int long long

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	VE a(n); rep(i, n)cin >> a[i];
	sort(ALL(a));
	int ans = 0;
	rep(i, n) {
		rep(j, n) {
			if (i >= j)continue;
			int tmp = a[i] + a[j];
			int tmp2 = lower_bound(a.begin() + j + 1, a.begin() + n, tmp) - a.begin();
	
			ans += tmp2 - j - 1;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int k,s,cnt=0;
    cin>>k>>s;
    for(int x=0;x<=k;x++){
        for(int y=0;y<=k;y++){
            if(s-x-y>=0&&s-x-y<=k){
                cnt++;
            } 
        }
    }
    cout<<cnt<<endl;
    return 0;
}

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

ll N, Q;
vector<vector<ll>> G;
vector<ll> score;
vector<bool> seen;

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return b/gcd(a,b)*b;}

int dfs(vector<vector<ll>> &G, int v, int point) {
  seen[v] = true;
  if (v != 0) {
    score[v] += point;
  }
  for (auto next_v: G[v]) {
    if (seen[next_v]) continue;
    dfs(G, next_v, score[v]);
  }
  return 0;
}

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

  cin >> N >> Q;
  G.resize(N);
  score.resize(N, 0);
  seen.resize(N, false);
  rep(i, N-1) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  vector<P> counter(Q);
  rep(i, Q) {
    cin >> counter[i].first >> counter[i].second; 
    ll node = --counter[i].first;
    score[node] += counter[i].second;
  }
  dfs(G, 0, score[0]);
  rep(i, N) {
    if (i == N-1) {
      printf("%lld", score[i]);
    } else {
      printf("%lld ", score[i]);
    }
  }
  return 0;
}


Measured memory_bytes: 27392
sS = input().rstrip()
sT = input().rstrip()

aS = [0] * 26
aT = [0] * 26
sABC = "abcdefghijklmnopqrstuvwxyz"
for i in range(26):
    aS[i]=sS.count(sABC[i])
    aT[i]=sT.count(sABC[i])
aS.sort()
aT.sort()
if aS == aT:
    print ("Yes")
else:
    print ("No")


Measured memory_bytes: 3632
//inlclude前用define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdio>
#include<type_traits>
#include<numeric>
#include<limits>
#include<iomanip>
#include<set>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef long long int ll;

//define
#define INF 100000000
#define NUM 1000000007
#define all(x) begin(x), end(x)

int main() {
	ll n, m;
	cin >> n >> m;
	cout << (abs(n-2)) * (abs(m-2)) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
#define rep(i,n) for(int i=0;i<n;++i)
typedef long long int ll;
typedef unsigned long long ull;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
typedef pair<ll,ll> P;


int main()
{
    ll a,b,v,w,t;
    cin>>a>>v;
    cin>>b>>w;
    cin>>t;
    ll d = abs(a-b),vv=v-w;

    rep(i,t+1)
    {
        if(d<=vv*i)
        {
            cout<<"YES"<<endl;
            return 0;
        }
    }
    
    cout<<"NO"<<endl;
    return 0;

}

Measured memory_bytes: 3624
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
As = list(mapint())
Bs = list(mapint())

rest = 0
ans = 0
for i in range(N):
    a = As[i]
    b = Bs[i]
    if a>=rest:
        a -= rest
        ans += rest
    else:
        ans += a
        a = 0
    if b>=a:
        rest = b-a
        ans += a
    else:
        rest = 0
        ans += b

ans += min(rest, As[-1])

print(ans)

Measured memory_bytes: 98192
N = int(input())
ws = [int(i) for i in input().split()]
sum = sum(ws)
weight = 0
for w in ws:
    next = weight + w
    if sum / 2 < next:
        difn = abs(sum - next - next)
        difw = abs(sum - weight - weight)
        if difn < difw:
            print(difn)
        else:
            print(difw)
        break
    weight=next

Measured memory_bytes: 3060
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと


def read_a_int(): return int(read())


def read_ints(): return list(map(int, read().split()))


def read_col(H):
    '''H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_tuple(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_matrix(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right

A, V = read_ints()
B, W = read_ints()
T = read_a_int()

if W >= V:  # 鬼役のほうが遅い
    print('NO')
    exit()

D = V - W  # スピードの差
if D * T >= abs(B - A):
    print('YES')
else:
    print('NO')


Measured memory_bytes: 65388
#include<bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    //--<for debugging>
    #define whatis(x) cout << #x << " is " << x<<" ";
    #define whatisl(x) cout << #x << " is " << x<<"\n";
    #define parr(array,end)for(ll loop=0;loop<end;loop++)cout<<array[loop]<<" ";cout<<"\n";
    #define lline cout<<"\n";
    #define errorl(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);cout<<"\n";}
    #define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);cout<<"___";}
        
    void err(istream_iterator<string> it) {}
    template<typename T, typename... Args>
    void err(istream_iterator<string> it, T a, Args... args) {
        cout << *it << " = " << a <<" , ";
        err(++it, args...);
    }
    //--</for debugging> 
    #define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
    #define testcase ll tt; cin >> tt; while(tt--)
    #define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
    #define pb push_back 
    #define vars ll h,i,j,k,d,l,p,q,r,x,y,a,b,c,v,var,n,m,z,s,ans,ind1,ind2,flag,limit1,limit2,limit3,mod;
    #define vll vector<ll>
    #define pll pair<ll,ll>
    #define sll set<ll>
    #define pint pair<int,int>
    const ll INF=1e9+7;
    const ll MOD=1e9+7;
    int main()
    {
        boost vars
        string str="aeiou";
        char cvar;
        cin>>cvar;
        for(i=0;i<str.length();i++){if(str[i]==cvar){cout<<"vowel";return 0;}}
        cout<<"consonant";
    }

Measured memory_bytes: 256
/*********************************************************************************
*   Falling down is an accident, Staying down is a choice.                       *
**********************************************************************************/
#include <bits/stdc++.h>
using namespace std;
#define FastIO ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
#define ll long long int
#define pb push_back
#define fi first
#define se second
const ll inf = 1e9+7; 
const ll modc = 998244353;
void solve();int main(){FastIO;solve();return 0;}
/*********************************************************************************/
void solve()
{
    vector<int> a(5,0);
    int ans;
    for(int i=0;i<5;i++)
    {
        cin>>a[i];
        if(a[i]==0)
        {
            ans = i+1;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3612
#include <cstdio>
#include <string>
#include <memory>
#include <list>
#include <algorithm>

struct Data {

    Data(int n) :
        value{ n },
        nextData{},
        prevData{} {
    }

    int value;
    std::unique_ptr<Data> nextData;
    Data* prevData;

};

class Deque {

public:
    Deque() :
        baseData{ new Data(0) }
    {
        baseData->nextData = std::unique_ptr<Data>(baseData);
        baseData->prevData = baseData;
    }

    ~Deque() {
        baseData->nextData.reset();
    }

    void print() {
        auto data = baseData->nextData.get();
        std::printf("%d", data->value);
        for (data = data->nextData.get(); data != baseData; data = data->nextData.get()) {
            std::printf(" %d", data->value);
        }
        std::puts("");
    }

    void insert(int n) {
        std::unique_ptr<Data> newData{ new Data{ n } };
        newData->prevData = baseData;
        newData->nextData = std::move(baseData->nextData);
        newData->nextData->prevData = newData.get();
        baseData->nextData = std::move(newData);
    }

    void deleteOne(int n) {
        for (auto data = baseData->nextData.get(); data != baseData; data = data->nextData.get()) {
            if (data->value != n) { continue; }

            auto && nextData = data->nextData;
            nextData->prevData = data->prevData;
            data->prevData->nextData = std::move(nextData);
            return;
        }

    }

    void deleteFirst() {
        auto && newBeginData = baseData->nextData->nextData;
        newBeginData->prevData = baseData;
        baseData->nextData = std::move(newBeginData);
    }

    void deleteLast() {
        auto newPrevData = baseData->prevData->prevData;
        auto && newNextData = baseData->prevData->nextData;
        baseData->prevData = newPrevData;
        newPrevData->nextData = std::move(newNextData);
    }

private:
    Data* baseData;

};

int main () {

    const int BUF_SIZE = 24;

    int commandCount;
    std::scanf("%d\n", &commandCount);

    Deque deque;
    while (commandCount--) {
        char command[BUF_SIZE];
        std::fgets(command, sizeof(command), stdin);
        std::string command_str(command);

        if (command_str.substr(0, 6) == "insert") {
            auto number = command_str.substr(7);
            number.pop_back();
            int value = std::stoi(number);
            deque.insert(value);
        } else if (command_str.substr(0, 11) == "deleteFirst") {
            deque.deleteFirst();
        } else if (command_str.substr(0, 10) == "deleteLast") {
            deque.deleteLast();
        } else if (command_str.substr(0, 6) == "delete") {
            auto number = command_str.substr(7);
            number.pop_back();
            int value = std::stoi(number);
            deque.deleteOne(value);
        }
    }

    deque.print();

    return 0;

}

Measured memory_bytes: 36008
#include<bits/stdc++.h>
using namespace std;
const int N = (int)1e5+5;

long long int arr[N];
int main()
{
    int t,a,b,n,i,j=0,m1,m2,d1,d2;
  cin>>m1;
  n=ceil(float(m1/1.08));
  m2=n*1.08;
  if(m2==m1)
  cout<<n<<endl;

  else
    cout<<":("<<endl;






    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
using namespace std;
int main() {
	int sum = 0, N, L, ans = 0, mini = 1000000000;
	cin >> N >> L;
	vector<int>A(N);
	for (int i = 0; i < N; i++) {
		A[i] = L + i;
		sum += A[i];
	}
	for (int i = 0; i < N; i++)
	{
		if (abs(sum - sum + A[i]) <= mini) {
			mini = abs(sum - sum - A[i]);
			ans = sum - A[i];
		}
	}
	cout << ans;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define pb push_back
#define eb emplace_back
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const ll MOD = 1e9+7;
const int n_max = 620;

int main(){
    ll n; cin >> n;
    string s[n*2];
    rep(i,n)cin >> s[i];
    rep(i,n)s[i] += s[i];
    rep(i,n)s[n+i] = s[i];
    // rep(i,2*n)cout << s[i] << "\n";
    bitset<n_max> bs(0);
    vector<Pll> test(2*n-1);
    rep(i,n) {
        ll sx = n-1-i, sy = 0;
        test[i] = {sx,sy};
    }
    rep(i,n-1){
        ll sx = 0, sy = i+1;
        test[i+n] = {sx,sy};
    }
    rep(i,2*n-1){
        ll sx = test[i].first;
        ll sy = test[i].second;
        string t[n];
        rep(j,n)t[j] = s[sx+j].substr(sy,n);
        bool ok = true;
        rep(j,n)rep(k,n){
            if(t[j][k] != t[k][j]){ok = false;}
        }
        bs[i] = ok;
    }
    ll ans = 0;
    rep(i,2*n-1){
        if(bs[i] == 1)ans += min(i+1,2*n-1-i);
    }
    cout << ans << endl;
}

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

int main(){
    int n,k,h,s=0;
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>h;
        if(h>=k){s++;}
    }
    cout<<s<<endl;
    return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
using namespace std;
#define ALL(x) (x).begin(), (x).end()
#define OUT(x) cout << (x) << endl
typedef long long ll;

int main() {
    string s, t;
    cin >> s >> t;
    int lens = int(s.size()), lent = int(t.size());
    int dp[lens + 1][lent + 1];
    for (int i = 0; i < lens + 1; i++) {
        for (int j = 0; j < lent + 1; j++) {
            dp[i][j] = 0;
        }
    }
    for (int i = 0; i < lens; i++) {
        for (int j = 0; j < lent; j++) {
            if (s[i] == t[j]) {
                dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + 1);
            }
            dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i + 1][j]);
            dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j + 1]);
        }
    }
    string ans = "";
    int i = lens, j = lent;
    while (i > 0 && j > 0) {
        if (dp[i][j] == dp[i - 1][j]) {
            i--;
        } else if (dp[i][j] == dp[i][j - 1]) {
            j--;
        } else {
            ans = s[i - 1] + ans;
            i--;
            j--;
        }
    }
    OUT(ans);
}

Measured memory_bytes: 35456
long long a=1;i,z,s,j=113,t,v[999];C(x,y){for(i=z=1;i<=y;z=z*x--/i++);}main(b){for(;i=getchar()-10;++s)++v[i];for(;--j>86;a*=b%2&&t++?0:z)b=v[j],C(s/2,b/2),s-=b;z=!printf("%lld\n",a);}

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

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
//const ll INF = 1LL<<60;
//const ll MOD = 1e9+7;    
#define pi 3.14159265359
const double PI = 2 * acos(0);
#define hell 1000000007
#define io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define fix(n) cout << fixed << setprecision(n)
#define ins(s) string s;cin>>s
#define mset(a,n) memset(a,n,sizeof a)
#define Max(a,b) ((a)>(b)?(a):(b))
#define Min(a,b) ((a)<(b)?(a):(b))
#define rep(i,a,b) for (__typeof((b)) i=(a);i<(b);i++)
#define repp(i,a,b,p) for(__typeof((b)) i=(a);i<(b);i+=p)
#define ren(i,a,b) for(__typeof((a)) i=(a);i>=(b);i--)
#define lbd lower_bound
#define ubd upper_bound
#define ll  long long
#define ull unsigned long long
#define ld long double
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define piii pair<pair<int,int>,int>
#define all(v) (v).begin(), (v).end()
#define sz(x) (int)x.size()
#define out(n) cout<<n<<" "
#define outl(n) cout<<n<<endl
#define line cout<<endl
clock_t start;
mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());
#define bug(n) {outl(n);return;}

ll convert_number(string s,int i,int j){
  string k = s.substr(i,j);
  stringstream str(k); 
    ll x;  
    str >> x; 
    return x;
}
int count_digits(ll n) 
{ 
    return floor(log10(n) + 1); 
}

ll check  (string s){
  for(ll i=0;i<s.length();i++){
    if(s[i]!=s[s.length()-i-1]) return i;
  }
  return -1;
}
vector<int> checkpal(string s){
  vi a = {};
  for(ll i=0;i<s.length()/2;i++){
    if(s[i]!=s[s.length()-i-1]) a.pb(i);
  }
  return a;
}

int divisors(int N){
  int sum=0;
for(int i=1;i*i<=N;i++){
  if(N%i==0){
    if(i*i==N) sum++;
    else sum+=2;
  }
}
return sum;
}



void solve(){


 int n;
 cin >> n;
 string s;
 string s1 = "AC",s2="WA",s3 = "TLE",s4="RE";
 int a[4] = {0};
 for(int i=0;i<n;i++){
  cin >> s;
  if(s==s1) a[0]++;
  else if(s==s2) a[1]++;
  else if(s==s3) a[2]++;
  else if(s==s4) a[3]++;
 }
 cout << s1 << " x " << a[0] << "\n" << s2 << " x " << a[1] << "\n" << s3 << " x " << a[2] << "\n"<< s4 << " x " << a[3];

}


  




void prep(){
    
}

int main() {
         io;
    int t=1;
    //cin >> t;
    // uncomment if different test cases are there in single input
    prep();
    start = clock(); 
    fix(5);
    while(t--)solve(); // runs t number of times
    return 0;
  
}



Measured memory_bytes: 3652
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <iostream>
#include <queue>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <string>
#include <random>

using namespace std;
typedef long long ll;
const int maxn = 100005;

struct P{
  int a, b, idx;
  P(int a, int b, int idx):a(a),b(b),idx(idx){}
};
bool cmp1(const P&x, const P&y){
  return x.a - y.b > y.a - x.b;
}
bool cmp2(const P&x, const P&y){
  return x.b - y.a > y.b - x.a;
}

int n,a[maxn],b[maxn];
bool f[maxn];
int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "w", stdout);
#endif
  cin>>n;
  vector<P>A,B;
  for(int i=0;i<n;i++){
    scanf("%d%d",&a[i],&b[i]);
    A.push_back(P(a[i],b[i],i));
    B.push_back(P(a[i],b[i],i));
  }
  sort(A.begin(),A.end(),cmp1);
  sort(B.begin(),B.end(),cmp2);
  ll ret = 0;
  int pos = 0;
  for(int i=0;i<n;i++){
    if(f[A[i].idx])continue;
    ret += A[i].a;
    f[A[i].idx] = 1;
    while(pos<n&&f[B[pos].idx])pos++;
    if(pos<n){
      ret-=B[pos].b;
      f[B[pos].idx]=1;
    }
  }
  cout<<ret<<endl;
  return 0;
}

Measured memory_bytes: 3756
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>

#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long>vll;
typedef pair<int,int> pi;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

int main(){
  int c=0;
  string s;
  bool ok=true;
  cin>>s;
  for(int i=2;i<s.size()-1;i++){
    if(s[i]=='C'&&!c)c++;
    else if('A'<=s[i]&&s[i]<='Z')ok=false;
  }
  
  if(s[0]!='A'||('A'<=s[1]&&s[1]<='Z')||('A'<=s[s.size()-1]&&s[s.size()-1]<='Z'))ok=false;
  cout<<(c==1&&ok?"AC":"WA")<<endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())
input_list = [int(input()) for i in range(N)]

pointer = input_list[0]
count = 1
index = 0

while True:
    if pointer == 2:
        print(count)
        break
    if index == 10**5 + 1:
        print(-1)
        break
    pointer = input_list[pointer-1]
    count += 1
    index += 1

Measured memory_bytes: 7084
while True:
    money=int(input())
    
    if money>0:
        oturi=1000-money
        a=oturi//500
        aa=oturi-a*500
        b=aa//100
        bb=aa-b*100
        c=bb//50
        cc=bb-c*50
        d=cc//10
        dd=cc-d*10
        e=dd//5
        ee=dd-e*5
        f=ee
        print(a+b+c+d+e+f)
    
    else:
        break


Measured memory_bytes: 5584
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<algorithm>
#include<numeric>
#include<utility>

#define reps(i, j, k) for (int i = (j); i < (k); i++)
#define rep(i, j) reps(i, 0, j)

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 num = 0;

	int N, H;
	cin >> N >> H;

	vector<pii> ab(N);
	int max_a = 0, max_ai;

	rep(i, N) {
		cin >> ab[i].first >> ab[i].second;
		if (max_a < ab[i].first) {
			max_a = ab[i].first;
			max_ai = i;
		}
	}

	sort(ab.begin(), ab.end(), [](const pii x, const pii y) { return x.second > y.second; });

	rep(i, N) {
		if (max_a < ab[i].second) {
			num++;
			H -= ab[i].second;
			if (H <= 0) break;
		}
		else break;
	}

	if (H <= 0) cout << num << endl;
	else cout << num + (H + max_a - 1) / max_a << endl;

	return 0;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
const int Maxn=10;
int n,m;
inline int read()
{
	int s=0,w=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
	while(ch>='0' && ch<='9')s=(s<<3)+(s<<1)+(ch^48),ch=getchar();
	return s*w;
}
int main()
{
	n=read(),m=read();
	if(m<(n<<1) || m>(n<<2) || ((m-(n<<1)) & 1))
	puts("No");
	else puts("Yes");
	return 0;
}

Measured memory_bytes: 3596
n,k=map(int,raw_input().split())
a=map(int,raw_input().split())
total=[0]*(n+1)
asum=[0]*(n+1)
for i in xrange(n):
    asum[i+1]=asum[i]+a[i]
    if a[i]>0:
        total[i+1]=total[i]+a[i]
    else:
        total[i+1]=total[i]
ans=0
for i in xrange(n-k+1):
    tmp=asum[i+k]-asum[i]
    ans=max(ans,tmp+total[i]+total[n]-total[i+k],total[i]+total[n]-total[i+k])

print(ans)


Measured memory_bytes: 12236
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<queue>

#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 SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef long long int ll;
ll dx[4] = {1,0,0,-1};
ll dy[4] = {0,1,-1,0};

#define ARRAY_MAX 1005
int a[ARRAY_MAX];

int main(){

    int n;
    REP(i,ARRAY_MAX){
        a[i] = i;
    }
    REP(i,ARRAY_MAX-1){
        a[i+1] += a[i];
    }

    while(cin >> n,n){
        int ans = 0;
        for(int i = 1;i < n;i++){//連続するi+1個
            for(int j = 1;j+i <= n;j++){
                if(a[j+i]-a[j-1] == n){
                    ans++;
                }
            }
        }
        cout << ans << endl;
    }


    return 0;
}


Measured memory_bytes: 3012
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	num, _ := strconv.Atoi(scanString())
	return num
}

func scanString() string {
	sc.Scan()
	return sc.Text()
}

func abs(n int) int {
	if n >= 0 {
		return n
	}
	return -n
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func init() {
	sc.Split(bufio.ScanWords)
}

func main() {
	n, k := scanInt(), scanInt()

	r := n % k
	ans := min(r, abs(r-k))

	fmt.Println(ans)
}


Measured memory_bytes: 640
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class D
{
	public static void Main()
	{
		int N = GetInt();
		int[] a = new int[N];
		for(int i = 0; i < N; i++)
			a[i] = GetInt();

		int n = a.Max();
		int r = -1;
		double dist = double.MaxValue;
		for(int i = 0; i < N; i++)
		{
			if(a[i] == n)
				continue;
			double tmpDist = Math.Abs(a[i] - (double)n/2.0);
			if(tmpDist < dist)
			{
				dist = tmpDist;
				r = a[i];
			}
		}

		Console.WriteLine("{0} {1}", n, r);		
	}	
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}


Measured memory_bytes: 24544
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;
ll a[2050];
int main(){
	ll n,z,w,cot;
	cin>>n>>z>>w;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	cot=abs(w-a[n]);
	if(n!=1)
		cot=max(cot,abs(a[n]-a[n-1]));
	cout<<cot;
	return 0;
} 

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

typedef long long LL;

template<typename T>
void printmatrix(vector<vector<T> > ar){
    for (int i = 0; i < (int)ar.size(); i++) {
        for (int j = 0; j < (int)ar.size(); j++) {
            cout << ar[i][j];
        }
        cout << endl;
    }
}

template<typename T>
void printvector(vector<T> vec){
    for (int i = 0; i < (int)vec.size(); i++) {
        cout << vec[i] << endl;
    }
}

template<typename T>
void unique(vector<T>& vec){
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
}

template<typename T>
vector<T> cumsum(vector<T> vec){
    vector<T> newvec((T)vec.size());
    int tmp = 0;
    for (int i = 0; i < (int)vec.size(); i++) {
        tmp += vec[i];
        newvec[i] = tmp;
    }

    return newvec;
}


int main(int argc, char const* argv[])
{
    int a,b;
    cin >> a >> b;
    if ((a & 1) && (b & 1)) {
        cout << "Odd" << endl;
    }else{
        cout << "Even" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
int main()
{
    using namespace std;
    int N, bits(0);
    cin >> N;
    while (N >= 10)
    {
        if (N % 10 == 7)
        {
            bits = 1;
        }
        N /= 10;
    }
    if (N == 7)
    {
        bits = 1;
    }
    if (bits == 0)
    {
        cout << "No" << endl;
    }
    else
    {
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 3624
#define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

using namespace std;

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

	int m = 100000;
	for (int i = 0; i < n; i++)
	{
		m = m * (1 + 0.05);
		m = (m / 1000 + (m % 1000 == 0 ? 0 : 1)) * 1000;
	}

	cout << m << endl;
}


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

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


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

int main () {

  int N;
  cin >> N;

  string W[100];
  for (int i=0; i<N; i++) {
    cin >> W[i];
  }

  bool flag = true;

  for (int i=1; i<N; i++) {
    // cout << char(W[i-1][W[i-1].size()]) << " " <<  char(W[i][0]) << endl;                 
    if (W[i-1][W[i-1].size()-1] != W[i][0]){
      flag = false;
    }
    for (int j=0; j<i; j++) {
      if (W[i] == W[j]) {
          flag = false;
        }
    }
    if (!flag) {
      break;
    }
  }

  if (flag) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#!/usr/local/bin/python3
from collections import Counter

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

L = sorted(L)
cnt = Counter(L)
ans = 0

i = 0
while i < len(L):
    j = i + 1
    if cnt[L[i]] != 1:
        j += cnt[L[i]] - 1
    while j < len(L):
        k = j + 1
        if cnt[L[j]] != 1:
            k += cnt[L[j]] - 1
        while k < len(L):
            a, b, c = L[i], L[j], L[k]
            if (a + b > c) and (b + c > a) and (c + a > b):
                ans += cnt[a] * cnt[b] * cnt[c]
            k += cnt[L[k]]
        j += cnt[L[j]]
    i += cnt[L[i]]

print(ans)


Measured memory_bytes: 9376
using System;
using System.Collections.Generic;

class Program
{
	static void Main(string[] args)
	{
        List<int> a = new List<int>();
       // List<int> b = new List<int>();


        //string[] s = Console.ReadLine().Split(' ');

        // int a = int.Parse(Console.ReadLine());

        while(true)
        {
            string[] s = Console.ReadLine().Split(' ');

            switch(s[1])
            {
                case "+":
                    a.Add(int.Parse(s[0]) + int.Parse(s[2]));
                    break;
                case "-":
                    a.Add(int.Parse(s[0]) - int.Parse(s[2]));
                    break;
				case "/":
					a.Add(int.Parse(s[0]) / int.Parse(s[2]));
					break;
				case "*":
					a.Add(int.Parse(s[0]) * int.Parse(s[2]));
                    break;
                default:
                    goto ExitLoop;
                    
            }
           
        }
        ExitLoop:;

        for (int i = 0; i < a.Count;i++)
        {
            Console.WriteLine("{0}",a[i]);
        }

		//Console.WriteLine("");


	}
}

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

int main(){
  int a, b;
  cin >> a >> b;
  int l1= (a*25+1)/2, r1= ((a+1)*25+1)/2;
  int l2= b*10, r2= (b+1)*10;
  for(int i=l1; i<r1; ++i){
    if(i>=l2 && i<r2){
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
#define MAX 100010
#define inf 1<<28
using namespace std;

typedef pair<int,int> pii;

class State{
public:
  int n,cost,sum;
  State(int n,int cost,int sum):n(n),cost(cost),sum(sum){}
  bool operator<(State s)const{
    if(cost!=s.cost)return s.cost<cost;
    return s.sum<sum;
  } 
};

vector<pair<int,int> > v[MAX];
int n,t,c[MAX];
string a,b,s[MAX];
set<int> st;
vector<int> start,end;
pii dis[MAX];
priority_queue<State> pq;
map<int,vector<int> > M;
map<string,int> Ma;
int canp[MAX];

pii dijkstra(){
  for(int i=0;i<MAX;i++){
    dis[i].f=inf;
    dis[i].s=inf;
  }

  for(int i=0;i<start.size();i++){
    pq.push(State(start[i],0,0));
    dis[start[i]]=mp(0,0);
  }

  while(!pq.empty()){
    State u=pq.top();
    pq.pop();

    if(st.find(u.n)!=st.end())return mp(u.cost,u.sum);

    if(dis[u.n]<mp(u.cost,u.sum))continue;

    for(int i=0;i<v[u.n].size();i++){
      int next=v[u.n][i].f,cost=dis[u.n].f+v[u.n][i].s,sum=dis[u.n].s;
      if(mp(cost,sum)<dis[next]){
	dis[next]=mp(cost,sum);
	pq.push(State(next,cost,sum));
      }
    }
    vector<int> vi=M[canp[u.n]];
    for(int i=0;i<vi.size();i++){
      if(vi[i]==u.n)continue;
      int next=vi[i],cost=dis[u.n].f+t,sum=dis[u.n].s+1;
      if(mp(cost,sum)<dis[next]){
	dis[next]=mp(cost,sum);
	pq.push(State(next,cost,sum));
      }
    }
  }
  return mp(-1,-1);
}

int main()
{
  int k,count1=0,count2=0;

  cin>>n>>t;
  cin>>a>>b;

  for(int i=0;i<n;i++){
    cin>>k;
    for(int j=0;j<k;j++)cin>>s[j];
    for(int j=0;j<k-1;j++)cin>>c[j];
    for(int j=0;j<k;j++){
      int con;
      if(Ma.find(s[j])==Ma.end()){
	count2++;
	con=count2;
	Ma[s[j]]=count2;
      }
      else con=Ma[s[j]];
      M[con].push_back(count1);
      canp[count1]=con;

      if(s[j]==a)start.push_back(count1);
      if(s[j]==b)st.insert(count1);

      if(j<k-1){
	v[count1].push_back(mp(count1+1,c[j]));
	v[count1+1].push_back(mp(count1,c[j]));
      }
      count1++;
    }
  }

  pii p=dijkstra();
  if(p==mp(-1,-1))cout<<-1<<endl;
  else cout<<p.f<<" "<<p.s<<endl;

  return 0;
}

Measured memory_bytes: 24756
N = int(input())
A = [int(_) for _ in input().split()]

A2 = [0] * (N + 1)

for i in range(1, N + 1):
    A2[i] = A2[i - 1] + A[i - 1]


def find(_l, _r):
    l, r = _l, _r
    lv, rv = A2[l - 1], A2[r]
    while l < r - 1:
        m = (r + l) // 2
        a = A2[m] - lv
        if a <= (rv - lv) / 2:
            l = m
        else:
            r = m
    if l < _r:
        if abs((A2[l] - lv) - (rv - A2[l])) > abs((A2[l + 1] - lv) - (rv - A2[l + 1])):
            return A2[l + 1] - lv, rv - A2[l + 1]
    return A2[l] - lv, rv - A2[l]


ans = 1e10
for i in range(2, N - 1):
    p, q = find(1, i)
    r, s = find(i + 1, N)
    # print(p, q, r, s)
    ans = min(ans, abs(max(p, q, r, s) - min(p, q, r, s)))
print(ans)


Measured memory_bytes: 96376
# -*- coding: utf-8 -*-
import sys
from math import sqrt


def calc_triangle_type(edge_length_str):
    edge_length = edge_length_str.split(" ")
    edge_length = list(map(lambda x: int(x), edge_length))
    edge_length_sorted = sorted(edge_length)
    if edge_length_sorted[0] + edge_length_sorted[1] <= edge_length_sorted[2]:
        return None
    right_angled_longest_edge = sqrt(
        edge_length_sorted[0] * edge_length_sorted[0] + edge_length_sorted[1] * edge_length_sorted[1])
    if edge_length_sorted[2] < right_angled_longest_edge:
        return 0
    elif edge_length_sorted[2] == right_angled_longest_edge:
        return 1
    else:
        return 2


def main():
    inputStr = sys.stdin.read()
    lines = inputStr.split("\n")
    counts_by_tryangle_type = {0: 0, 1: 0, 2: 0}
    total_triangle = 0
    for line in lines[:-1]:
        tryangle_type = calc_triangle_type(line)
        if tryangle_type is None:
            break
        counts_by_tryangle_type[tryangle_type] = counts_by_tryangle_type[tryangle_type] + 1
        total_triangle = total_triangle + 1
    print("{} {} {} {}".format(total_triangle,
                               counts_by_tryangle_type[1],
                               counts_by_tryangle_type[0],
                               counts_by_tryangle_type[2]))


if __name__ == '__main__':
    main()



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

#define LL long long
#define DD long double

#define MOD 1000000007
#define INF 1e18

void setIO(string s = "") { 
  cin.sync_with_stdio(0); cin.tie(0);
  if (s.size()) s += ".in", freopen(s.c_str(), "r", stdin);
}

bool cmp(pair<string, int>& a, pair<string, int>& b) { 
    return a.second < b.second; 
} 
  
int tt = 1;
void solve() {
  int n;
  string s;
  cin >> n;
  map<string, int> f;
  for (int i = 0; i < n; i++) {
    cin >> s;
    f[s]++;
  }

  if (f.size() == 1) {
    for (auto &it : f) cout << it.first << endl;
    return;
  }

  vector<pair<string, int>> vf;
  for (auto &it : f) vf.push_back(it);
  sort(vf.rbegin(), vf.rend(), cmp);
  set<string> top;
  top.insert(vf[0].first);
  for (int i = 1; i < vf.size(); i++) {
    if (vf[i].second < vf[i-1].second) break;
    else top.insert(vf[i].first);
  }

  for (auto it : top) {
    cout << it << endl;
  }

}

int main() {
  setIO();
  while (tt--) {
    solve();
  }
  return 0;
}

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

int main(){
  int x,y;
  cin>>x>>y;
  int sum=0;
  for(int i=0;i<y;i++){
  int z;
  cin>>z;
  sum+=z;
  }
  if(x>=sum){
  cout<<x-sum<<endl;
  }
  else{
  cout<<-1<<endl;
  }
}

Measured memory_bytes: 3636
#include <iostream>
#include <cmath>
#include <algorithm>
#include <stdio.h>
#include <sstream>
#include <string>
using namespace std;

int main(){
  int a, b, c, d, e, k;
  cin >> a >> b >> c >> d >> e >> k;
  if(e-a>k) cout << ":(" <<endl;
  else cout << "Yay!" <<endl;
  return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
#define MOD 1000000007
#define EPS (1e-10)
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<char, int>P;

int main() {
	string s; cin >> s;
	string w;
	for (char c : s) {
		if (w.empty() || w.back() != c)w += c;
	}
	cout << w.size() - 1 << endl;
}

Measured memory_bytes: 512
n = int(input())
al = []
for _ in range(n):
    s = input()
    if not '.' in s:
        al.append(int(s)*(10**9))
    else:
        syosu_keta = len(s.split('.')[1])
        rem = 9 - syosu_keta
        a = int(s.replace('.',''))
        a *= (10**rem)
        al.append(a)


al25 = [ [0]*19 for _ in range(19) ]
ans = 0
for a in al:
    cnt2 = 0
    cnt5 = 0
    curr_a = a
    for i in range(18):
        if curr_a%2 == 0:
            cnt2 += 1
            curr_a = curr_a//2
        else:
            break
    curr_a = a
    for i in range(18):
        if curr_a%5 == 0:
            cnt5 += 1
            curr_a = curr_a//5
        else:
            break

    for i in range(18-cnt2,19):
        for j in range(18-cnt5,19):
            ans += al25[i][j]

    al25[cnt2][cnt5] += 1

print(ans)

Measured memory_bytes: 88312
#include <iostream>
#include <algorithm>
#include <vector>
#include <array>
#include <string>
#include <queue>
#include <cmath>
#include <iterator>

using namespace std;
using lli = long long int;

int main(void){
    string a;
    cin >> a;
    int k = 0;
    for(char n:a){
        if(n == '1')k++;
    }
    cout << k << endl;
    return 0;
}


Measured memory_bytes: 256
# define _CRT_SECURE_NO_WARNINGS 1
# define _USE_MATH_DEFINES
# include <iostream>
# include <numeric>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <complex>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <ctime>
# include <set>
# include <forward_list>
# include <map>
# include <stack>
using namespace std;
# define INF ((int)(1<<25))
# define REP(i,n) for(int i=0;i<(int)n;i++)
# define FOR(i,n) REP(i,n)
# define FORI(i,k,n) for(int i=k;i<(int)n;i++)
# define TORAD 2.0*M_PI/360.0
# define INT(x) int x;cin>>x;
# define ALL(x) begin(x),end(x)
# define RALL(x) (x).rbegin(),(x).rend()
# define DEBUG(x) cout<<#x<<":"<<x<<endl;
# define EPS 1e-12
#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#endif
typedef long long lint;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
const int dx[4] = { 0, 1, 0, -1 }, dy[4] = { -1, 0, 1, 0 };
template<class T> void debug(T a) { for (auto i : a)cout << i << endl; }

int main()
{
	const int M = 20;
	while (true)
	{
		int x, y;
		int a[M][M];

		cin >> x >> y;
		if (!x&&!y)break;

		FOR(i, M)FOR(j, M)
		{
			a[i][j] = 1;
		}

		FORI(i, 1, y + 1)FORI(j, 1, x + 1)
		{
			cin >> a[i][j];
		}
		FORI(i, 1, x + 1)
		{
			a[y + 1][i] = 0;
		}
		int ans[M][M] = {};
		FORI(i, 1, x + 1)
		{
			if (a[1][i] == 0)ans[1][i] = 1;
		}
			
		FORI(i, 1, y)
		{
			FORI(j, 1, x + 1)
			{
				switch (a[i][j])
				{
				case 0:
					FORI(k, -1, 1 + 1)
					{
						if (a[i+1][j + k] == 0)
						{
							ans[i+1][j + k] += ans[i][j];
						}
					}
					if (a[i + 1][j] == 2)
					{
						ans[i + 1][j] += ans[i][j];
					}
					break;
				case 1:
					ans[i][j] = 0;
					break;
				case 2:
					if (a[i + 2][j] != 1)
					{
						ans[i + 2][j] += ans[i][j];
					}
					break;
				}
			}
		}

		int ANS = 0;
		FORI(i, 1, x + 1)
		{
			ANS += ans[y][i]+ans[y+1][i];
		}
		cout << ANS << endl;



	}
}

Measured memory_bytes: 3080
#ABC133-C
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
l,r=IL()
ans=2019
for i in range(l,min(l+2019,r+1)-1):
    for j in range(i+1,min(l+2019,r+1)):
        ans=min(ans,i*j%2019)
print(ans)

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

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <algorithm>
#include <typeinfo>
#define _USE_MATH_DEFINES
#include <cmath>

using namespace std;

int main(){

    while(true){
        string x;
        cin >> x;
        if(x=="0"){
            break;
        }
        int sum=0;
        for(int i=0; i<x.size(); i++){
            sum += (x[i] - '0');
        }
        cout << sum << endl;
    }


    return 0;
}



Measured memory_bytes: 3160
n = int(input())
A = [[int(i) for i in input().split()] for i in range(n)]
A.sort(reverse = True, key = lambda x: x[2])

for i in range(101):
    for j in range(101):
        px, py, ph = A[0]
        H = ph + abs(px - i) +abs(py - j)
        if all(h == max(H - abs(x - i) - abs(y - j) , 0) for x, y, h in A):
            print(i, j, H)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
#define all(in) in.begin(), in.end()
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
signed main(){
    int N; cin >> N;
    vector<vector<int>>edge(N);
    for(int _ = 0; _ < N - 1; ++_){
        int a,b; cin >> a >> b;
        --a,--b;
        edge[b].push_back(a); edge[a].push_back(b);
    }
    vector<int>c(N);
    for(auto & e : c) cin >> e;
    priority_queue<int,vector<int>>que;
    for(auto e : c) que.push(e);
    vector<bool>used(N,false);
    vector<int>ans(N,0LL);
    function<void(int)> dfs = [&](int v){
        used[v] = true;
        for(auto nv : edge[v]){
            if(used[nv])
                continue;
            ans[nv] = que.top();
            que.pop();
            dfs(nv);
        }
        return;
    };
    for(int v = 0; v < N;++v){
        if(edge[v].size() == 1){
            ans[v] = que.top();
            que.pop();dfs(v);
            break;
        }
    }
    int sum = 0;
    for(int from = 0; from < N; ++from){
        for(auto to : edge[from]){
            if(from < to) continue;
            sum += min(ans[from],ans[to]);
        }
    }
    cout << sum << endl;
    for(int i = 0; i < ans.size(); ++i){
        if(i) cout << " ";
        cout << ans[i];
    }
    cout << endl;
}


Measured memory_bytes: 1792