akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3
import sys
try: from typing import Any, Union, List, Tuple, Dict
except ImportError: pass
def debug(*args): print(*args, file=sys.stderr)
def exit(): sys.exit(0)


X, Y = map(int, input().split())
X, Y = max(X, Y), min(X, Y)

Alice = "Alice"
Brown = "Brown"

if X-Y <= 1:
    print(Brown)
    exit()
if X-Y == 2:
    print(Alice)
    exit()

if Y == 0:
    print(Alice)
    exit()

if ((X-Y) % 3 == 0) or ((X-Y) % 3 == 1):
    print(Alice)
    exit()

print(Brown)


Measured memory_bytes: 38256
#include<stdio.h>
void swap(int *a, int *b){
	int c;
	c=*a;
	*a=*b;
	*b=c;
}
int main(void){
	int N,i,a[101],j,k=0,min;
	scanf("%d",&N);
	for(i=0;i<N-1;i++){
		scanf("%d ",&a[i]);
	}
	scanf("%d",&a[N-1]);
	for(i=0;i<N;i++){
		min=i;
		for(j=i;j<N;j++){
			if(a[j]<a[min]){
				min=j;
			}
		}
		if(i!=min){
			swap(&a[i],&a[min]);
			k++;
		}
	}
	for(i=0;i<N-1;i++){
		printf("%d ",a[i]);
	}
	printf("%d\n",a[N-1]);
	printf("%d\n",k);
}

Measured memory_bytes: 2736
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    int a=sc.nextInt();
    int b=sc.nextInt();
    int c=sc.nextInt();

    if(b-a==c-b) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }
  }
}

Measured memory_bytes: 21844
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <cstdio>
#include <complex>
#include <cstdint>
#include <tuple>

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
inline int readInt() { int x; scanf("%d", &x); return x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007

const int N = 200005;
int nex[26][N];
int dp[N];

int main() {
	string s;
	cin >> s;
	int n = s.length();
	VI last(26, -1);
	for (int i = n; i >= 0; i--) {
		REP(j, 26)nex[j][i] = last[j];
		if(i!=0)last[s[i-1] - 'a'] = i;
	}
	int x = 0;
	bitset<26> check;
	for (int i = n; i >= 0; i--) {
		dp[i] = x;
		if (!check.any())x++;
		if(i!=0)check[s[i-1] - 'a'] = true;
		if (check.count() == 26) check.reset();
	}
	string ret;
	int i = 0;
	while (x) {
		REP(j, 26) {
			if (dp[nex[j][i]-1] == (x - 1)) {
				ret += 'a' + j;
				i = nex[j][i];
				x--;
				break;
			}
		}
	}
	cout << ret << endl;

	return 0;
}

Measured memory_bytes: 21636
#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
template<class T> using vc = vector<T>;
template<class T> using vvc = vc<vc<T>>;
constexpr ll ten(int n){return (n==0) ? 1 : 10 * ten(n-1);}
#define rng(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,N) for(int i=0;i<(int)(N);i++)
#define rep1(i,N) for(int i=1;i<=(int)(N);i++)
#define a first
#define b second
#define eb emplace_back
#define pb push_back
#define all(x) x.begin(),x.end()
template<class T, class U> void chmin(T& t, const U& u){ if(t>u) t = u;}
template<class T, class U> void chmax(T& t, const U& u){ if(t<u) t = u;}

#ifdef LOCAL
#define show(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define show(x) true
#endif

template<class T,class U>
ostream& operator<<(ostream& os, const pair<T,U>& p){
    return os << "P(" << p.fs << ", " << p.sc << ")";
}
template<class T> ostream& operator<<(ostream& os, const vc<T>& v){
    os << "[";
    for(auto d: v) os << d << ", ";
    return os << "]";
}

using vi=vector<int>;

vi kmp(const string&s){
	int n=s.size();
	vi v(n+1);
	v[0]=-1;
	rng(i,1,n+1){
		int j=v[i-1];
		while(j>=0&&s[j]!=s[i-1])
			j=v[j];
		v[i]=j+1;
	}
	return v;
}

const int inf=INT_MAX/2-100;

template<class E,class D>
struct hungarian{
	int n,m;
	const vvc<E>&g;
	vc<D> l,r;
	vi to,ot,p,q;
	vc<char> lu,ru;
	int sz=0;
	void L(int i){
		lu[i]=1;
		for(auto e:g[i])if(!ru[e.to]){
			D w=l[i]+r[e.to]-e.cost;
			if(q[e.to]>w){
				p[e.to]=i;
				q[e.to]=w;
			}
		}
	}
	bool arg(){
		fill(all(p),-1);
		fill(all(q),inf);
		fill(all(lu),0);
		fill(all(ru),0);
		rep(i,n)if(to[i]==-1)L(i);
		while(1){
			int x=-1;
			rep(i,m)if(!ru[i]&&p[i]!=-1&&(x==-1||q[x]>q[i]))x=i;
			if(x==-1)return 0;
			D w=q[x];
			rep(i,n)if(lu[i])l[i]-=w;
			rep(i,m)if(ru[i])r[i]+=w;else if(p[i]!=-1)q[i]-=w;
			if(ot[x]==-1){
				while(x!=-1){
					ot[x]=p[x];
					swap(to[ot[x]],x);
				}
				sz++;
				return 1;
			}
			ru[x]=1;
			L(ot[x]);
		}
	}
	hungarian(int nn,int mm,const vvc<E>&gg):n(nn),m(mm),g(gg),
		l(n),r(m),to(n,-1),ot(m,-1),p(m),q(m),lu(n),ru(m){
			D mx=-inf;
			rep(i,n)for(auto e:g[i])chmax(mx,e.cost);
			fill(all(l),mx);
			while(arg());
		}
	D get(){
		D mn=*min_element(all(l));
		return accumulate(all(l),accumulate(all(r),(-n+sz)*mn));
	}
};

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int n;cin>>n;
    vc<string> ss(n);
    rep(i,n)cin>>ss[i];
    
    vvc<int> ks(n);
    rep(i,n)ks[i]=kmp(ss[i]);
    
    struct E{int to,cost;};
    vvc<E> g(n);
    
    rep(i,n){
		g[i].pb(E{i,ks[i][ss[i].size()]});
		rep(j,n)if(i!=j){
			int x=0;
			for(auto c:ss[i]){
				while(x>=0&&ss[j][x]!=c)x=ks[j][x];
				x++;
			}
			g[i].pb(E{j,x});
		}
	}
	
	hungarian<E,int> h(n,n,g);
	int ans=0;
	rep(i,n)ans+=ss[i].size();
	ans-=h.get();
	cout<<ans<<endl;
}



Measured memory_bytes: 3688
#include<stdio.h>
#include<stdlib.h>


typedef struct node_
{
    int parent;//親
    int lf; //左ノード
    int rh; //右ノード
} node;
 
void init_x(node *X,int no)
{
    X[no].parent = -1;
}
 
void input_x(node *X,int no,int lf,int rh)
{
    X[no].lf = lf;
    X[no].rh = rh;
}

void parent_x(node *X,int No)
{
    switch(X[No].lf){
        case -1:
            break;
        default:
            X[X[No].lf].parent = No;
            break;
    }
    switch(X[No].rh){
        case -1:
            break;
        default:
            X[X[No].rh].parent = No;
            break;
    }
}

void node_print(int N,node *X,int no)
{
    if(N == -1) return;
    if(no == 1) printf(" %d",N);
    node_print(X[N].lf,X,no);
    if(no == 2) printf(" %d",N);
    node_print(X[N].rh,X,no);
    if(no == 3)printf(" %d",N);
}

int main()
{
    int n,d1=0,d2=0,No,prtop;
    scanf("%d",&n);
    node *X = malloc(sizeof(node)*n);
    for(int i=0;i<n;i++) init_x(X,i);
    for(int i=0;i<n;i++)
    {
        scanf("%d%d%d",&No,&d1,&d2);
        input_x(X,No,d1,d2);
        parent_x(X,No);
    }
    for(int i=0; i<n;i++)
    {
        if(X[i].parent == -1)
        {
            prtop = i;
            break;
        }
    }
    printf("Preorder\n");
    node_print(prtop,X,1);
    printf("\nInorder\n");
    node_print(prtop,X,2);
    printf("\nPostorder\n");
    node_print(prtop,X,3);
    printf("\n");
    free(X);
}


Measured memory_bytes: 2112
#include<bits/stdc++.h>
#include<ctype.h>
# define pb push_back
#define fst first
#define sec second
#define For(i,a,b) for(int i=a;i<b;i++)
#define ll long long int
#define ull unsigned long long int
#define mod 1000000007
#define fo(i,n) for(ll i=0;i<n;i++)
#define endl "\n"
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define fo1(i,n) for(ll i=1;i<=n;i++)
#define boolsize 1000001
#define pi pair<ll,ll>
#define vi vector<ll>
#define vii vector<pi>
using namespace std;
template<typename T>
void showvector(vector <T> v)
{
    for(T x:v)
        cout<<x<<" ";
    cout<<endl;

}
template<typename T>
void showvector1(vector <T> v)
{
    ll n=v.size();
    fo1(i,n-1)
        cout<<v[i]<<endl;

}
template<typename T>
void showset(set <T> s)
{
    for(T x: s)
        cout<<x<<" ";
    cout<<endl;
}
template<class T>
void showvectorpair(vector<T> v)
{
    for(auto it=v.begin();it!=v.end();it++)
        cout<<it->first<<" "<<it->second<<endl;
    cout<<endl;
}
template<typename T,typename P>
void showmap(map <T,P> m)
{
    for(auto it=m.begin();it!=m.end();it++)
        cout<<it->first<<" "<<it->second<<endl;
    cout<<endl;
}
template<typename T>
bool comp(T a,T b)
{
    return (a>b);
}
template<class T>
bool comppair(T a,T b)
{
    if(a.first==b.first)
        return(a.second>b.second);
    return (a.first>b.first);
}
bool sameparity(ll a,ll b)
{
    return (a%2==b%2);
}
bool difparity(ll a,ll b)
{
    return !(a%2==b%2);
}
bool isprime(ll x)
{   if(x<=1)
     return false;
    for(ll i=2;i<=sqrt(x);i++)
    {
        if(x%i==0)
            return false;
    }
    return true;
}
bool iseven(ll x)
{
    return !(x%2);
}
bool isodd(ll x)
{
    return (x%2);
}
/// check for test case before submitting
void vfun()
{
    ll n,k;
    cin>>n;
    vector <ll> v(n);
    fo(i,n)
    cin>>v[i];

}

ll ans=0,n=0;
string s;
ll tonum(ll a,ll b)
{
    ll ans=0;
    for(ll i=a;i<=b;i++)
    {
        ans=ans*10+ (s[i]-'0');
    }
    return ans;
}
void solve(ll ind,ll sum)
{
    if(ind==n)
        ans+=sum;
    for(ll i=ind;i<n;i++)
    {
        ll temp=tonum(ind,i);
        solve(i+1,sum+temp);
    }
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("inputh.txt", "r", stdin);
    freopen("outputh.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0); ///cant use scanf, printf
    cin.tie(0);cout.tie(0); /// no longer auto flush cout before each cin, remove for interactive
    //cout << fixed << setprecision(11); /// no scientific output
    ll test=1;
    //cin>>test;
    while(test--)
    {


            cin>>s;
            n=s.size();
            solve(0,0);
            cout<<ans;
//         if(vfun())
//            cout<<"YES\n";
//         else
//            cout<<"NO\n";
    }
}
///before sub
/// check for value of zero and single input in array
///loop vars,1LL in mult, equal, one, bounds, int v ll, endl, finish taking inputs
/// check whether test cases are given or not




Measured memory_bytes: 3672
from itertools import accumulate 

n = int(input())
song= []
time = []

for i in range(n):
    s, t = input().split()
    song.append(s)
    time.append(int(t))

time_acc = list(accumulate(time))
x = input()

print(time_acc[n - 1] - time_acc[song.index(x)])

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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const ll INF = 1<<21;
// static const ll MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
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) { a = b; } }

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

    vector<int> h(n);
    for(int in=0;in<n;in++) {
        cin >> h.at(in);
    }

    vector<int> t(n, 1);
    int a, b;
    for(int im=0;im<m;im++) {
        cin >> a >> b; a--; b--;
        if(h.at(a)<h.at(b)) t.at(a) = 0;
        else if(h.at(a)>h.at(b)) t.at(b) = 0;
        else {
            t.at(a) = 0;
            t.at(b) = 0;
        }
    }

    int ans = 0;
    for(auto it:t) {
        if(it==1) ans++;
    } 

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


Measured memory_bytes: 4052
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

N, M = map(int, input().split())

used = [False] * N

if N % 2 == 1:
    for i in range(M):
        print(N // 2 - i, N // 2 + i + 1)
else:
    for i in range(M):
        # 左に作る
        if i % 2 == 0:
            c = N // 2 // 2
            d = i // 2
            print(c - d, c + d + 1)
        # 右に作る
        else:
            c = N // 2 + (N // 2 + 1) // 2
            d = (i + 1) // 2
            print(c - d, c + d)



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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

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

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

int main(){
	int a[3];
	cin>>a[0]>>a[1]>>a[2];
	swap(a[0],a[1]);
	swap(a[0],a[2]);
	cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using ll = long long;
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; }
const ll INF = 1e9;
const ll MOD = 1e9 + 7;


int main(){
    int h, w;
    cin >> h >> w;
    vector<string> v(h);
    rep(i, h) cin >> v[i];

    int ans = INF;
    using P = pair<int, int>;
    int dx[] = {0, 1};
    int dy[] = {1, 0};

    auto isIN = [&](int y, int x){
        return (0<=y && y<h && 0<=x && x<w);
    };

    queue<P> que;

    que.push({0, 0});

    vector<vector<int>> dist(h, vector<int>(w, INF));

    if(v[0][0] == '#') dist[0][0] = 1;
    else dist[0][0] = 0;

    while(que.size() != 0){
        int y, x;
        P p = que.front();
        y = p.first, x = p.second;
        que.pop();

        rep(i, 2){
            int ny = y + dy[i];
            int nx = x + dx[i];
            if(isIN(ny, nx) && v[ny][nx] == '#' && v[y][x] == '.' && dist[ny][nx] > dist[y][x]+1){
                dist[ny][nx] = dist[y][x]+1;
                que.push({ny, nx});
            }
            else if(isIN(ny, nx) && !(v[ny][nx] == '#' && v[y][x] == '.') && dist[ny][nx] > dist[y][x]){
                dist[ny][nx] = dist[y][x];
                que.push({ny, nx});
            }
        }
    }

    cout << dist[h-1][w-1] << endl;
}

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

using namespace std;
using ll = long long;

int main() {
  ll N;
  cin >> N;
  vector<double> x(N);
  vector<string> u(N);
  double sum = 0;
  for (ll i = 0; i < N; i++){
    cin >> x[i] >> u[i];
    if (u[i]=="JPY"){
      sum += x[i];
    }else{
      sum += x[i]*380000.0;
    }
  }
  cout << sum;
}


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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll = long long;
using R = long double;
const R EPS = 1e-9; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r) {return (r > EPS) - (r < -EPS);}
inline R sq(R x) {return sqrt(max<R>(x, 0.0));}

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

// Problem Specific Parameter:

const int limit = 200010;
int n, ary[limit];
bool tmp[limit];

bool check(int m) {
	rep(i, 2 * n - 1) tmp[i] = (ary[i] >= m);
	const int mid = n - 1;
	rep(i, 1, n) {
		if (tmp[mid - i] == tmp[mid - i + 1]) return tmp[mid - i];
		if (tmp[mid + i] == tmp[mid + i - 1]) return tmp[mid + i];
	}
	return tmp[0];
}

int main(void) {
	cin >> n;
	rep(i, 2 * n - 1) cin >> ary[i];

	int low = 1, high = 2 * n;
	while (high - low > 1) {
		const int mid = (low + high) / 2;
		if (check(mid))
			low = mid;
		else
			high = mid;
	}

	cout << low << endl;

	return 0;
}

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

int main(){

    int a, b, c, d; cin >> a >> b >> c >> d;
    int arr[1000] = {};
    arr[a]++;
    arr[c]++;
    arr[b]--;
    arr[d]--;
    for(int i = 1; i < 1000; i++) arr[i] += arr[i - 1];
    int ans = 0;
    for(int i = 0; i < 1000; i++){
        if(arr[i] == 2) ans++;
    }

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

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

#define NREP() for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define IPT(t, x) t ipt; cin >> ipt; x.push_back(ipt);
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;

const static ll MOD = 1e9 + 7;
ll n, cnt, ans, tmp, sum, a, b, c, d, k, m, h, w, q, x, y;
string s, t;

int main() {
    cin >> s;
    replace(ALL(s), ',', ' ');
    MSG(s)
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

string s;

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> s;
	int n = s.size();
	vector<int> v[26];
	FOR(i, n) {
		v[s[i]-'a'].push_back(i);
	}
	int mi = n;
	FOR(i, 26) {
		int ma = 0;
		if (v[i].empty()) continue;
		else {
			for (int j = 0; j < v[i].size(); j++) {
				if (j == 0) ma = v[i][0];
				else ma = max(ma, v[i][j]-v[i][j-1]-1);
			}
			ma = max(ma, n-v[i].back()-1);
		}
		mi = min(mi, ma);
	}
	cout << mi << endl;
	return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
H = list(map(int, input().split()))
E = [[] for _ in range(N)]
for _ in range(M):
  A, B = map(int, input().split())
  E[A-1] += [B-1]
  E[B-1] += [A-1]

ans = 0
for i in range(N):
  f = True
  for e in E[i]:
    if H[e]>=H[i]:
      f = False
  if f:
    ans += 1
print(ans)


Measured memory_bytes: 29436
N = int(input(""))
si = []

for i in range(0, N):
    si.append(input(""))

c0 = si.count("AC")
c1 = si.count("WA")
c2 = si.count("TLE")
c3 = si.count("RE")

print("AC x", c0)
print("WA x", c1)
print("TLE x", c2)
print("RE x", c3)

Measured memory_bytes: 16200
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████   
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████  
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
const double EPS = 1e-9;
#define INF (1LL<<60)
#define fs first
#define sc second
#define D double
#define int long long
#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(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<vector<P> > Graph;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int n;
  cin >> n;

  vec x(n);
  vector<string> s(n);
  REP(i,n) cin >> s[i] >> x[i];

  auto f = [&](int a, int b){
    if(s[a] != s[b]) return s[a] < s[b];
    else return x[a] >= x[b];
  };

  vec ans(n);
  REP(i,n) ans[i] = i;

  sort(ans.begin(),ans.end(),f);

  REP(i,n) cout << ans[i]+1 << endl;

  return 0;
}

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

using namespace std;

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  if (a[a.size() - 1] == b[0] && b[b.size() - 1] == c[0]) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  string s; cin >> s;
  int n = (int)(s.size())+1;
  vector<ll> su(n+1);
  su[0] = 0;
  for(int i=1;i<n+1;++i) {
    su[i] = su[i-1] + i;
  }
  vector<int> v;
  char now = s[0];
  int cnt = 1;
  for(int i=1;i<n-1;++i) {
    if(now == s[i]) {
      cnt++;
    } else {
      v.push_back(cnt);
      cnt = 1;
      now = s[i];
    }
  }
  v.push_back(cnt);
  ll ans = 0;
  for(int i=0;i<(int)(v.size());++i) {
    ans += su[v[i]-1];
  }
  if(s[0] == '<') {
    for(int i=0;i<(int)(v.size());i += 2) {
      if(i != (int)(v.size())-1) ans += max(v[i], v[i+1]);
      else ans += v[i];
    }
  } else {
    ans += v[0];
    for(int i=1;i<(int)(v.size());i += 2) {
      if(i != (int)(v.size())-1) ans += max(v[i], v[i+1]);
      else ans += v[i];
    }
  }
  cout << ans << endl;
}


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

int main() {
  vector<int> A(3);
  for (int i = 0; i < 3; i++) cin >> A.at(i);

  sort(A.begin(), A.end());

  cout << ((A.at(0) == 5 && A.at(1) == 5 && A.at(2) == 7) ? "YES" : "NO") << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;
int main() {
	int n; cin >> n;
	int a, b, c, d;
	a = n/1000;
	b = (n-a*1000)/100;
	c =  (n-a*1000-b*100)/10;
	d = n-a*1000-b*100-c*10;
	if(a+b+c+d==7){
		cout << a << '+' << b << '+' << c << '+' << d << '=' << 7 << endl;
		return 0;
	}
	if(a+b+c-d==7){
		cout << a << '+' << b << '+' << c << '-' << d << '=' << 7 << endl;
		return 0;
	}
	if(a+b-c+d==7){
		cout << a << '+' << b << '-' << c << '+' << d << '=' << 7 << endl;
		return 0;
	}
	if(a-b+c+d==7){
		cout << a << '-' << b << '+' << c << '+' << d << '=' << 7 << endl;
		return 0;
	}
	if(a-b-c+d==7){
		cout << a << '-' << b << '-' << c << '+' << d << '=' << 7 << endl;
		return 0;
	}
	if(a+b-c-d==7){
		cout << a << '+' << b << '-' << c << '-' << d << '=' << 7 << endl;
		return 0;
	}
	if(a-b+c-d==7){
		cout << a << '-' << b << '+' << c << '-' << d << '=' << 7 << endl;
		return 0;
	}
	if(a-b-c-d==7){
		cout << a << '-' << b << '-' << c << '-' << d << '=' << 7 << endl;
		return 0;
	}						
	return 0;
}

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

     cin>>s>>str;
     int t=0,i;

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

        if(s[i]==str[i])t++;

     }

     cout<<t<<endl;
    return 0;
    }


Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


struct Point{
	void set(double arg_x,double arg_y){
		x = arg_x;
		y = arg_y;
	}
	double x,y;
};

int N;
Point point[5000];
double R;

Point calc_Cross_Point(double x1,double x2,double x3,double x4,double y1,double y2,double y3,double y4){
	Point ret;
	ret.x = ((x2-x1)*(y3*(x4-x3)+x3*(y3-y4))-(x4-x3)*(y1*(x2-x1)+x1*(y1-y2)))/((y2-y1)*(x4-x3)-(y4-y3)*(x2-x1));
	if(x1 != x2){
		ret.y = ((y2-y1)*ret.x+y1*(x2-x1)+x1*(y1-y2))/(x2-x1);
	}else{
		ret.y = ((y4-y3)*ret.x+y3*(x4-x3)+x3*(y3-y4))/(x4-x3);
	}
	return ret;
}

double calc_S(Point a,Point b,Point c,Point d){
	return fabs((b.x*a.y - b.y*a.x)+(c.x*b.y - c.y*b.x)+(d.x*c.y - d.y*c.x)+(a.x*d.y - a.y*d.x))/2;
}

void func(){

	if(N%3 == 0)N /= 3;

	if(N == 1){
		printf("0.433013\n");
		return;
	}

	double base_degree = 360.0/(double)(3*N);

	for(int i = 0; i < 3*N; i++){
		point[i].x = R*cos(((90-base_degree*i)*M_PI)/180.0);
		point[i].y = R*sin(((90-base_degree*i)*M_PI)/180.0);
	}

	Point a,b,c,d,ret;
	a.set(point[0].x,point[0].y);

	ret = calc_Cross_Point(point[0].x,point[N].x,point[1].x,point[2*N+1].x,point[0].y,point[N].y,point[1].y,point[2*N+1].y);
	b.set(ret.x,ret.y);

	c.set(0,0);

	ret = calc_Cross_Point(point[0].x,point[2*N].x,point[3*N-1].x,point[N-1].x,point[0].y,point[2*N].y,point[3*N-1].y,point[N-1].y);
	d.set(ret.x,ret.y);

	printf("%.10lf\n",(double)3*N*calc_S(a,b,c,d));
}


int main(){

	R = 1.0/sqrt(3.0);

	while(true){
		scanf("%d",&N);
		if(N == 0)break;

		func();
	}
}

Measured memory_bytes: 3480
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	ll n,m,a[100001],h;
	h=0;
	cin>>n>>m;
	for(int i=1;i<=m;i++)
	{
		cin>>a[i];
		h=h+a[i];
	}
	if(h>n)
	{
	    cout<<"-1";
	    return 0;
    }
    cout<<n-h;
    return 0;
}

Measured memory_bytes: 3660
#include <iostream>
#include <vector>
#include <set>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
 
int main() {
    int H, W;
    char S[60][60];
    int num[60][60] = {};
    cin >> H >> W;
    
    rep(i,0, H){
        cin >> S[i];
    }
    int dx[8] = {1, -1, 0, 0, -1, 1, 1, -1};
    int dy[8] = {0, 0, 1, -1, -1, 1, -1, 1};
    
    rep(i,0, H){
        rep(j,0, W){
            if (S[i][j] == '#'){
                rep(k, 0, 8){
                    int i2 = i+dx[k];
                    int j2 = j+dy[k];
                    if(i2 >=0 && i2<H && j2 >= 0 && j2<W && S[i2][j2] != '#') {
                        num[i2][j2]++;
                    }else{
                    }
                }
            }
        }
    }
    rep(i,0, H){
           rep(j,0, W){
               if (S[i][j] == '.'){
                   cout << num[i][j];
               }else {
                   cout << S[i][j];
               }
           }
        cout << "" << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cassert>
#define InfL 1000000000
#define InfLL 1000000000000000000LL
#define mod 1000000007
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=(n-1);(i)>=(0);(i)--)
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<db> vd;

int main() {
	ll N;
	cin >> N;
	vl A(N);
	rep(i, N)
		cin >> A[i];
	ll ans = -InfLL;
	if (N % 2 == 0) {
		vl Asum(N + 2, 0);
		rep(i, N) {
			Asum[i + 2] = Asum[i] + A[i];
		}
		rep(i, N + 1) {
			if (i % 2 == 0)
				ans = max(ans, Asum[i] + Asum[N + 1] - Asum[i + 1]);
		}
	}
    else {
		vl Asum(N + 2, 0);
		rep(i, N) {
			Asum[i + 2] = Asum[i] + A[i];
		}
		vl ansL(N, 0);
		vl ansR(N, 0);
		rep(i, N) {
			if (i % 2 == 1)
				ansL[i] = Asum[i + 1] - Asum[i + 2];
		}
		rep(i, N) {
			if (i % 2 == 1) {
				ansR[i] -= Asum[N] - Asum[i];
				ansR[i] += (Asum[N + 1] - Asum[i + 1]);
			}
		}
		vl ansLmax(N + 2, 0);
		vl ansRmax(N + 2, 0);
		rep(i, N) {
			if (i % 2 == 1) {
				ansLmax[i + 2] = max(ansLmax[i], ansL[i]);
			}
		}
		rrep(i, N) {
			if (i % 2 == 1) {
				ansRmax[i] = max(ansRmax[i + 2], ansR[i]);
			}
		}
		rep(i, N) {
			if (i % 2 == 1) {
				ll anstmp = Asum[N];
				anstmp += ansLmax[i];
				anstmp += ansRmax[i];
				ans = max(ans, anstmp);
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 12632
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long ll;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

#define EPS (1e-7)
#define INF (1e15)
#define PI (acos(-1))
#define MOD 1000000007

#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,f,n) for(int i=(f);i<(n);i++)
#define EACH(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)

#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define arrdump(n,a) for(int i=0;i<n;i++) {cout<<((i>0)? " ":"")<<a[i];}cout<<"\n";


typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy4[]={0, 0, 1, -1};
int dx4[]={1, -1, 0, 0};
int dx8[]={0, 0, 1, -1, 1, 1, -1, -1};
int dy8[]={1, -1, 0, 0, 1, -1, -1, 1};

// https://atcoder.jp/contests/abc060/tasks/abc060_b

int main() {
    int a, b, c; cin >> a >> b >> c;

    for (int i = 1; i <= a*b; i++) if (a*i%b==c){
            cout << "YES" << "\n";
            return 0;
    }

    cout << "NO" << "\n";
    return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val N = nextInt()
    val L = listOfInt().sorted()
    var ans = 0
    for (i in 0 until N-2) {
        val a = L[i]
        for (j in i+1 until N-1) {
            val b = L[j]
            for (k in j+1 until N) {
                if (a + b > L[k]) ans += 1
                else break
            }
        }
    }
    println(ans)
}
fun next() = readLine()!!
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)

Measured memory_bytes: 48484
#include<bits/stdc++.h>
#include<math.h>
#include<string.h>
#include<vector>
using namespace std;
#define MAX 200005
#define MOD 998244353
int A[MAX];
int main()
{
    FILE *input=stdin;
    //input=fopen("in.txt","r");
    int t,T=1;
    //fscanf(input,"%d",&T);
    for(t=1; t<=T; t++)
    {
        int K,N,i,j;
        fscanf(input,"%d %d",&K,&N);
        for(i=0;i<N;i++)
        {
            fscanf(input,"%d",&A[i]);
        }
        int res=0;
        for(i=0;i<N;i++)
        {
            res=max(res,(A[(i+1)%N]-A[i]+K)%K);
        }
        res=K-res;
        res=res%K;
        printf("%d",res);
        if(t!=T) printf("\n");
    }
    fclose(input);
    return 0;
}


Measured memory_bytes: 1024
from sys import stdin

n,a,b = [int(x) for x in stdin.readline().rstrip().split()]
sum = 0


# 自分のやつ。もとの数字から上の桁を引いたやつをたしていく
for i in range(n+1):
        #print(i)
        if (a<= i//10000 + (i-i//10000*10000)//1000 + (i-i//1000*1000)//100 + (i-i//100*100)//10 + i%10 <=b):
            sum += i

"""
# 回答例　ひたすら10で割ってって、商が0になったらおわり
for i in range(n+1):
    i_sum = 0
    i_num = i
    print("i_num:"+str(i_num))
    while(True):
        if(i_num//10 ==0):
            i_sum += (i_num%10)
            break
        else:
            i_sum += (i_num%10)
            i_num = i_num//10
    if(a<= i_sum <= b):
        print(i_sum)
        sum += i
print("-------------------")
"""
print(sum)


# じぶんのがスッキリだけど、10^4までしかつかえないので、アルゴリズムとしては解答例の方がいい

Measured memory_bytes: 3188
fn main() {
    let a = read::<i32>();
    let even = a / 2;
    let odd = (a + 1) / 2;
    println!("{}", odd * even);
}

//-------------------------------------------------------------
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}


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

using namespace std;

typedef long long ll;

int main() {
  int A, B, sum = 1, use = 0;
  
  cin >> A >> B;
  
  while (sum < B) {
    sum += A - 1;
    use++;
  }
  
  cout << use << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
signed main(){
  int N,M; cin>>N>>M;
  vector<pii> A(M);
  rep(i,0,M){
    cin>>A[i].first;
    int B; cin>>B;
    rep(j,0,B){
      int C; cin>>C;
      A[i].second+=(1<<C-1);
    }
  }
  vi dp((1<<N),MOD);
  dp[0]=0;
 rep(i,0,M){
    rep(j,0,(1<<N)){
      int K=A[i].second|j;
      dp[K]=min(dp[K],dp[j]+A[i].first);
    }
  }
  int ans=dp[(1<<N)-1];
  if(ans==MOD)
    ans=-1;
  cout<<ans<<endl;
  }



Measured memory_bytes: 256
//g++ -std=gnu++14 a.cpp

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <random>
#include <math.h>

using namespace std;

#define ll long long
#define rep(i, n) for(ll i = 0; i < (n); i++)
ll MOD = 1e9 + 7;
int INF = 1 << 30;
ll INFL = 1LL << 60;

int main(){
  ll N;
  cin >> N;
  ll ans = 0;
  for(ll i = 1;i <= N;i++){
    if(i%3 != 0 && i%5 != 0){
      ans += i;
    }
  }

  cout << ans << endl;

 }


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

int main(){
  string s;
  cin >> s;
  int n;
  cin >> n;
  string q;
  int a, b;
  for (int i = 0; i < n; i ++) {
    cin >> q >> a >> b;
    if (q == "print") {
      string t = s.substr(a, b - a + 1);
      cout << t << endl;
    } else if (q == "reverse") {
      string t = s.substr(a, b - a + 1);
      int j = b - a;
      for (int i = a; i <= b; i ++) {
        s[i] = t[j];
        j --;
      }
    } else if (q == "replace") {
      string p;
      cin >> p;
      for (int i = 0; i < b - a + 1; i ++) {
        s[i + a] = p[i];
      }
    }
  }
}


Measured memory_bytes: 3204
#include <stdio.h>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <iostream>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <queue>
#include <cstring>
using namespace std;

int main() {
	int N, R;
	cin >> N >> R;
	if (N > 10)cout << R << endl;
	else cout << R+100 * (10 - N) << endl;
	

}





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

using namespace std;

const int maxn = 310;
const int mod = 1e9+7;

int n = 0, a[maxn*2], x, vis[maxn*2], del[maxn*2], ans;
int dp[maxn][maxn], ndp[maxn][maxn]; // 滚动数组，注意要加上 maxn 才是真实下标

int main() {
    int _ = 0;
    scanf("%d", &n);
    for (int i = 1; i <= 2*n; i++) scanf("%d", &a[i]);
    for (int i = 1; i <= n; i++) {
        if (a[2*i-1] != -1 && a[2*i] != -1) ++ _, del[a[2*i-1]] = del[a[2*i]] = 1; 
    }
    for (int i = 1; i <= 2*n; i++) del[i] += del[i-1];
    for (int i = 1; i <= n; i++) {
        if ((a[2*i-1] != -1) ^ (a[2*i] != -1)) {
            ++ x;
            if (a[2*i-1] != -1) vis[a[2*i-1] - del[a[2*i-1]]] = 1;
            else vis[a[2*i] - del[a[2*i]]] = 1;
        }
    }
    n -= _;
    // 始终保存右括号减去左括号
   	dp[0][0] = 1;
    for (int i = 2*n; i >= 1; i--) {
        int t = min(n, 2*n-i+1);
        for (int j = 0; j <= t; j++) {
            for (int k = 0; k <= t; k++) {
                ndp[j][k] = 0;
            }
        }
        if (vis[i]) {
            for (int j = 0; j <= t; j++) {
                for (int k = 0; k <= t; k++) {
                    (ndp[j+1][k] += dp[j][k]) %= mod;
                    if (k) (ndp[j][k-1] += dp[j][k]) %= mod;
                }
            }
        } else {
            for (int j = 0; j <= t; j++) {
                for (int k = 0; k <= t; k++) {
                    if (j) (ndp[j-1][k] += 1LL * j * dp[j][k] % mod) %= mod;
                    (ndp[j][k+1] += dp[j][k]) %= mod;
                    if (k) (ndp[j][k-1] += dp[j][k]) %= mod;
                }
            }
        }
        for (int j = 0; j <= t; j++) {
            for (int k = 0; k <= t; k++) {
                dp[j][k] = ndp[j][k];
            }
        }
    }
    ans = dp[0][0];
    for (int i = 1; i <= n-x; i++) ans = 1LL * ans * i % mod;
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a,b,i;
    while(~scanf("%d%d",&a,&b))
    {

        int f=0;
        if(a<=0&&b>=0)
        {
            printf("Zero\n");

        }
        else if(a>0)
        {
            printf("Positive\n");

        }

        else if(a<0&&b<0)
        {
            for(i=a;i<=b;i++)
            {
                if(i<0)
                    f++;
            }
            if(f%2==0)
                printf("Positive\n");
            else if(f%2!=0)
                printf("Negative\n");
        }

    }

    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
string s,t,a;
vector<string>v;
int main()
{
	cin>>s>>t;
	a=s;
	for(int i=0;i<s.size()-t.size()+1;i++)
	{
		bool ok=true;
		for(int j=0;j<t.size();j++)
		{
			if(t[j]!=s[i+j] && s[i+j]!='?')
			{
				ok=false;
				break;
			}
		}
		if(ok)
		{
			for(int j=0;j<t.size();j++)
			{
				if(s[i+j]=='?')
				{
					s[i+j]=t[j];
				}
			}
			for(int j=0;j<s.size();j++)
			{
				if(s[j]=='?')
				{
					s[j]='a';
				}
			}
			v.push_back(s);
			s=a;
		}
	}
	sort(v.begin(),v.end());
	if(v.size())
	{
		cout<<v[0]<<endl;
	}
	else
	{
		cout<<"UNRESTORABLE"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int time = sc.nextInt();
		
		int h = time / 3600;
		int remain = time - (3600 * h);
		
		int m = remain / 60;
		int s = remain - (60 * m);
		
		
		System.out.println(h + ":" + m + ":" + s);
	}
}


Measured memory_bytes: 26120
//By Tushar Gautam
#pragma GCC optimize ("-O2")
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define memreset(a) memset(a,0,sizeof(a))
#define testcase(t) int t;cin>>t;while(t--)
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define leadzero(a) __builtin_clz(a) // count leading zeroes
#define trailzero(a) __builtin_ctz(a) // count trailing zeroes
#define bitcount(a) __builtin_popcount(a) // count set bits (add ll)
#define ln "\n"
#define dbgarr(v,s,e) cerr<<#v<<" = "; forsn(i,s,e) cerr<<v[i]<<", "; cerr<<endl
#define inputfile freopen("input.txt", "r", stdin)
#define outputfile freopen("output.txt", "w", stdout)
#define dbg(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) { cerr<<endl; }
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << "\t"; err(++it, args...);
}
template<typename T1,typename T2>
ostream& operator <<(ostream& c,pair<T1,T2> &v){
	c<<"("<<v.fi<<","<<v.se<<")"; return c;
}
template <template <class...> class TT, class ...T>
ostream& operator<<(ostream& out,TT<T...>& c){
    out<<"{ ";
    forstl(x,c) out<<x<<" ";
    out<<"}"; return out;
}
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<int> v32; 
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
const int LIM = 1e5+5, MOD = 1e9+7;
int t,n,m,k,x,y;
ll dp[(int)1e4+5];
int main(){
	fastio;
	cin>>n;
	int w[n],s[n],in[n];
	ll v[n];
	forn(i,n){
		in[i]=i;
		cin>>w[i]>>s[i]>>v[i];
	}
	sort(in,in+n,[&w,&s](const int &a,const int &b) -> bool {return w[a]+s[a]<w[b]+s[b];});
	ll ans=0;
	forn(i,n){
		int ind=in[i];
		rforn(j,s[ind]){
			ans=max(ans,dp[j]+v[ind]);
			if(j+w[ind]<1e4+5) dp[j+w[ind]]=max(dp[j+w[ind]],dp[j]+v[ind]);
		}
	}
	cout<<ans<<ln;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#include <cstdlib> 
#include <math.h>
#include<cstdio>
#include<cstring>
#define FOR(I, A, B) for (int I = (A); I <= (B); I++)
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fo(i,n) for(int i=0;i<n;i++)
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
const int N=1e5+5;
 
 
int pa[N];
int n,m;
 
ll szz[N];
ll ans[N];
struct edge{
    int u,v;
}edges[N];
 
int find(int x){
    if(pa[x]==x) return pa[x];
    return pa[x]=find(pa[x]);
}


 
int main(){
    IOS
    cin>>n>>m;
    int a,b;
    
    for(int i=1;i<=m;++i){
        cin>>edges[i].u>>edges[i].v;
 
    }
    //cout<<"hre"<<endl;
    
    for(int i=1;i<=n;++i){
        //raank[i]=0;
        pa[i]=i;
        szz[i]=1;
    }
    ans[m]=(ll)n*(n-1)/2;
    //cout<<"herew   df  "<<endl;
    for(int i=m;i>=1;--i){
 
          a=find(edges[i].u);
          b=find(edges[i].v);
          
         
          if(a==b){
               ans[i-1]=ans[i];
          }
          else{
               ans[i-1]=ans[i]-(szz[a]*szz[b]);
               szz[a]+=szz[b];
               pa[b]=a;
          }
          //cout<<szz[a]<<endl;
     
 
 
     }
     for(int i=1;i<=m;i++) 
         cout<<ans[i]<<endl;
      
    
     return 0;
}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
#define fst first
#define snd second
#define rep(n) for(lint I = 0; (I) < (lint)(n); ++(I))
#define repeat(i, n) for(lint i = 0; (i) < (lint)(n); ++(i))
#define repeat_to(i, n) for(lint i = 0; (i) <= (lint)(n); ++(i))
#define repeat_from(i, m, n) for(lint i = (m); (i) < (lint)(n); ++(i))
#define repeat_from_to(i, m, n) for(lint i = (m); (i) <= (lint)(n); ++(i))
#define repeat_reverse_from_to(i, m, n) for(lint i = (m); (i) >= (lint)(n); --(i))
#define el cout<<endl
#define es cout<<" "
#define dump(x) cout<<" "<<#x<<"="<<x
#define pdump(p) cout<<" "<<#p<<"=("<<p.fst<<","<<p.snd<<")"
#define vdump(v) for(size_t I=0; I<v.size(); ++I){cout<<" "<<#v<<"["<<I<<"]="<<v[I];} cout<<endl
using namespace std; using lint = long long; using ld = long double;
using pii = pair<int, int>; using pll = pair<lint, lint>;
template<class T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<class T, class... Ts> 
auto make_vec(size_t a, Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));}

int main(void) {
    int n; cin >> n;
    vector<int> v(n), c(n);
    repeat (i, n) cin >> v[i];
    repeat (i, n) cin >> c[i];
    int ans = 0;
    repeat (i, n) {
        if (v[i] - c[i] > 0) {
            ans += (v[i] - c[i]);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256