akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstring>
#include <cmath>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  int ans = 0;
  rep(i, n) ans = __gcd(a[i], ans);
  cout << ans << endl;
  return 0;
}

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

int main()
{
    int x, h, n, m, l;
    cin >> x >> h >> n >> m >> l;
    if ((n + l) <= x && (n - l) >= 0)
    {
        if ((m + l) <= h && (m - l) >= 0)
            cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    else
        cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3100
import java.util.*;
public class Main{
    public static void main(String[]args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int bit = 0;
        for(int i=0; i<N; i++){
            bit |= sc.nextInt();
        }
        System.out.println(Integer.numberOfTrailingZeros(bit));
    }
}


Measured memory_bytes: 23124
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] pos = new int[n];
    for(int i = 0; i < n; i++) {
      int p = sc.nextInt();
      pos[p - 1] = i;
    }
    int m = 1;
    int t = 1;
    for(int i = 1; i < n; i++) {
      if(pos[i] > pos[i - 1]) {
        t++;
      } else {
        m = Math.max(m, t);
        t = 1;
      }
      if(t == n) m = n;
    }
    System.out.println(n - m);
  }
}

Measured memory_bytes: 85288
def solve():
    n,k=map(int,input().split())
    a=[-1]+list(map(int,input().split()))

    stp=[-1]*(n+1)

    vis=1
    stp[1]=0
    while k >= 0 :
        if k==0 :
            return vis
        nxt=a[vis]
        if stp[nxt] == -1 :
            stp[nxt]=stp[vis]+1
            vis=nxt
            k-=1
        else:
            loop=stp[vis]+1-stp[nxt]
            k%=loop
            for i in range(0,k) :
                vis=a[vis]
            return vis

print(solve())


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

using namespace std;

int a[10][10];
int n;

int main()
{
	for(int i=1;i<=9;i++)
	{
		for(int j=1;j<=9;j++)
		{
			a[i][j]=i*j;
		}
	}
	cin>>n;
	for(int i=1;i<=9;i++)
	{
		for(int j=1;j<=9;j++)
		{
			if(a[i][j]==n)
			{
				cout<<"Yes"<<endl;
				return 0;
			}
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const long long INF = 1LL << 60;

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

uintmax_t combination(unsigned int n, unsigned int r) {
  if ( r * 2 > n ) r = n - r;
  uintmax_t dividend = 1;
  uintmax_t divisor  = 1;
  for ( unsigned int i = 1; i <= r; ++i ) {
    dividend *= (n-i+1);
    divisor  *= i;
  }
  return dividend / divisor;
}

int modPow(long long a, long long n, long long p) {
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
  long long t = modPow(a, n / 2, p);
  return (t * t) % p;
}

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

ll memo[1000010];

ll fib(ll x){
  if(x == 0) return 1;
  else if(x <= 2) return x;
  else if(memo[x] != 0) return memo[x];
  return memo[x] = fib(x-2) + fib(x-1);
}

int main()
{
  int n,k;
  cin >> n >> k;
  vector<int> d(k);

  vector<bool> sunuke(n,false);

  rep(i,k){
      cin >> d[i];
      vector<int> a(d[i]);
      rep(j,d[i]) cin >> a[j];
      rep(j,d[i]){
          sunuke[a[j] - 1] = true;
      }
  }

    int ans = 0;
  rep(i,n){
      if(!sunuke[i]) ans++;
  }

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

Measured memory_bytes: 3632
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <numeric>
typedef long long Int;
#define rep(i,a,b) for(Int i=a;i<b;++i)
#define rrep(i,a,b) for(Int i=a;i>=b;--i)
using namespace std;

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

    string s; cin >> s;
    set<char> st(s.begin(), s.end());
  
    for(char key = 'a'; key <= 'z'; ++key) {
      auto it = st.find(key);
      if (it == st.end()) {
        cout << key << endl;
        return 0;
      }
    }
  
    cout << "None" << endl;
}


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

#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define int long long int
#define fi first
#define se second
#define pub push_back
#define mkp make_pair
#define pi pair<int,int>
#define push push
#define all(v) v.begin(),v.end()
#define rep(i,l,r) for(int i = (int)(l) ; i < (int)(r) ; i++)
#define clr(a,x) memset(a,x,sizeof(a));
#define rr(v) for(auto &val:v)
#define print(v) for(const auto itr:v){ cout << itr << ' ';} cout << endl;
#define init(v,x) for(auto &itr:v){ itr = x; }
#define minpq(x) x,vector<x>,greater<x>
#define ln length()
#define sz size()
#define infinity 1e18;
#define elif else if


int t,n;

signed main(){
    fastIO
    
    string s;
    string s1 = "es";
    
    cin >> s;
    
    if(s[s.ln-1] == 's') s.append(s1);
    else s.append("s");
    
    cout << s << '\n';

    return 0;
}


Measured memory_bytes: 3656
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    ll K; cin >> K;
    char L = 0;
    int idx = -1;
    rep(i, S.length()) {
        if (S[i] != '1') {
            idx = i;
            L = S[i];
            break;
        }
    }
    if (idx < K && idx != -1) {
        cout << S[idx] << endl;
    } else {
        cout << S[K - 1] << endl;
    }



    return 0;
}


Measured memory_bytes: 256
/*
--------------              |   /
      |                     |  /
      |                     | /
      |             *       |/          |    |         ------            *
      |                     |           |    |        /      \
      |             |       |\          |    |       |       |\          |
   \  |             |       | \         |    |       |       | \         |
    \ |             |       |  \        |    |        \     /   \        |
     V              |       |   \        \__/|         -----     \       |
*/
#include <bits/stdc++.h>
using namespace std;

#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(NULL);
#define mem(i,j) memset(i,j,sizeof (i));
using ll = int64_t;
using ull = uint64_t;
using ld = long double;
using uint = uint32_t;
const double EPS  = 1e-8;
const int INF     = 0x3F3F3F3F;
const ll LINF     = 4611686018427387903;
const int MOD     = 1e9+7;
/*-----------------------------------------------------------------------------------------------------*/

int arr[3001][3001];
ll dp[3001][3001][4];

signed main() {
	EmiliaMyWife
	
	int r, c, k;
	cin >> r >> c >> k;
	while(k--) {
		int a, b, c;
		cin >> a >> b >> c;
		arr[a][b] = c;
	}
	ll ans = 0;
	for(int i = 1; i <= r; i++) {
		for(int j = 1; j <= c; j++) {
			dp[i][j][0] = max(dp[i-1][j][3], dp[i][j-1][0]);
			for(int z = 1; z < 4; z++)
				dp[i][j][z] = max({dp[i-1][j][3]+arr[i][j], dp[i][j-1][z], dp[i][j-1][z-1]+arr[i][j]});
			//cout << dp[i][j][3] << " \n"[j==c];
		}
	}
	cout << dp[r][c][3] << '\n';

	return 0;
}


Measured memory_bytes: 319936
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <map>
#include <set>
#include <functional>
using namespace std;

int main(){
	int number, suu, in;
	// result = 整理番号と正解数の対応
	map<int, int> result;
	// rank = 順位表   need to include <functional>
	set<int, greater<int> > rank;

	while (scanf("%d,%d", &number, &suu), number||suu){
		result.insert(std::pair<int, int>(number, suu));
		rank.insert(suu);
	}
	while (cin >> in, !cin.eof()){
		// 整理番号が入力されるのでresultで正解数調べてrankを参照する.

		int place = 0;
		set<int>::iterator it = rank.begin();
		// set<int> rank; のときに
		//   set<int>::reverse_iretator it = rank.rbegin();とする方法もある.

		int thisSuu = result[in];
		// mapは[]使える. 以下は[]じゃなくiterator使う方法.
		// map<int, int>::iterator it_map = result.find(in);
		// int thisSuu = (*it_map).second;

		while (it != rank.end()){
			place++;
			if (thisSuu == *it){
				cout << place << endl;
				break;
			}
			it++;
		}
	}
	return 0;
}

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

int main() {
  int n,cnt=0;
  string s;
  cin >> n;
  cin >> s;
  rep(i,n){
    if(i<n-2 and s[i] == 'A' and s[i+1] == 'B' and s[i+2] == 'C'){
      cnt++;
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<queue>
#include<map>
#include<stack>
#include<fstream>
#include<stdlib.h>
#include<set>
#include<climits>
#include<cmath>  
#include<memory.h> 
#include<sstream>
#include<time.h>
#include<iomanip>
using namespace std;
const unsigned long long BIGEST=1000000000000000000+1000000000000000000;
const long long BIGER=1000000000000000000;
const int BIG=1000000000;
const long long MOD=1000000007;
const long long LMOD=154590409516822759;
//const long long LMOD=1000000007;
#define Fi first
#define Se second
#define P2 pair
#define Pii pair<int,int>
#define Pll pair<long long,long long>
#define Cb make_pair
#define ll long long
#define Ull unsigned long long
#define Sf scanf
#define Pf printf
#define Pb push_back
#define Psh push
#define Stc stack
#define Vct vector
#define Ret return
#define Re0 return 0
#define Sz size
#define Is insert
#define Que queue
#define Emp empty
#define Fro front
#define Rv reverse
#define Er erase
#define Bg begin
#define Srt sort
#define Pq priority_queue
#define Ins insert
#define Ite iterator
#define Cou count
#define Cot continue
#define Beg begin
int f[2][81][12805];
#define zr 6400
int a[81][81];
int main()
{
	int n,m;
	Sf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			Sf("%d",&a[i][j]);
		}
	}
	int t=0;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			Sf("%d",&t);
			a[i][j]-=t;
			//cout<<a[i][j]<<" ";
		}
		//cout<<endl;
	}
	f[0][1][zr]=1;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			for(int k=1;k<=2*zr;k++)
			{
				if(k+a[i][j]>=0&&k+a[i][j]<=2*zr)
				{
					f[i%2][j][k+a[i][j]]|=f[(i+1)%2][j][k];
				}
				if(k-a[i][j]>=0&&k-a[i][j]<=2*zr)
				{
					f[i%2][j][k-a[i][j]]|=f[(i+1)%2][j][k];
				}
			}
			f[(i+1)%2][1][zr]=0;
			for(int k=1;k<=2*zr;k++)
			{
				f[(i+1)%2][j][k]=0;
			}
		}
		for(int j=1;j<=m;j++)
		{
			for(int k=1;k<=2*zr;k++)
			{
				if(k+a[i][j]>=0&&k+a[i][j]<=2*zr)
				{
					f[i%2][j][k+a[i][j]]|=f[i%2][j-1][k];
				}
				if(k-a[i][j]>=0&&k-a[i][j]<=2*zr)
				{
					f[i%2][j][k-a[i][j]]|=f[i%2][j-1][k];
				}
			}
		}
	}
	int mn=BIG;
	for(int i=0;i<=2*zr;i++)
	{
		if(f[n%2][m][i])
		{
			//cout<<i-zr<<endl;
			mn=min(mn,abs(zr-i));
		}
	}
	cout<<mn;
	return 0;
}

Measured memory_bytes: 8320
#include <stdio.h>
int dis[100009];
int pre[100009];
int find(int num)
{
	if(pre[num]==num)
	{
		
		return num;
	}
	
	int root=find(pre[num]);
	
	dis[num]+=dis[pre[num]];
	
	return pre[num]=root;
}
int check(int left,int right,int diss)
{
	int fl=find(left), fr=find(right);
//	printf("%d %d  %d %d<<\n",left,fl,right,fr);
	if(fl==fr)
	{
	//	printf("%d %d<<\n",dis[left],dis[right]);
		if((dis[right]-dis[left])==diss)
		{
			
			return 1;
		}else {
			return 0;
		}
	}
	
	pre[fr] = fl;
	
	dis[fr]=diss+dis[left]-dis[right];
//	printf("%d %d",fr,pre[fr]);
	return 1;
}

int main()
{
	int l,r,d;
	int num_case;
	int num_people;
	int flag;
	while(scanf("%d %d",&num_people,&num_case)!=EOF)
	{
		for(int i=1;i<=num_people;i++)
		{
			dis[i]=0;
			pre[i]=i;
		}
		flag=1;
		while(num_case--)
		{
			scanf("%d %d %d",&l,&r,&d);
			if( check(l,r,d) == 1 )
			{
				;
			}else {
				flag=0;
			}
		}
		if(flag)
		{
			printf("Yes\n");
		}else {
			printf("No\n");
		}
	}
}



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

using namespace std;

#define pb push_back
#define mk make_pair
#define mod 1000000007
#define ff first
#define ss second

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

ll modpow(ll a, ll b){

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


int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int x,y,a,b,c;
    cin>>x>>y>>a>>b>>c;

    vector<int> red(a), green(b), other(c);

    for(int i = 0; i < a; i++) cin>>red[i];
    for(int i = 0; i < b; i++) cin>>green[i];
    for(int i = 0; i < c; i++) cin>>other[i];

    sort(red.rbegin(), red.rend());
    sort(green.rbegin(), green.rend());
    sort(other.rbegin(), other.rend());

    multiset<pair<int, int> > allColors;

    for(int i = 0; i < a; i++) {
        allColors.insert({red[i], 0});
    }

    for(int i = 0; i < b; i++) {
        allColors.insert({green[i], 1});
    }

    for(int i = 0; i < c; i++) {
        allColors.insert({other[i], 2});
    }

    int indr = 0;
    int indg = 0;

    ll ans = 0;

    while(x || y) {

        pair<int, int> pp = *(allColors.rbegin());

        if(pp.second == 0) {
            if(x > 0) {
                ans += pp.first;
                indr++;
                x--;
            }
        } else if(pp.second == 1) {
            if(y > 0) {
                ans += pp.first;
                indg++;
                y--;
            }
        } else {
            if(x > 0 && y > 0) {
                ans += pp.first;
                int lr = red[indr + x - 1];
                int lg = green[indg + y - 1];

                if(lr > lg) {
                    y--;
                } else {
                    x--;
                }
            } else if(x > 0) {
                ans += pp.first;
                x--;
            } else {
                ans += pp.first;
                y--;
            }
        }

        auto it = allColors.end();
        it--;
        allColors.erase(it);

    }

    cout<<ans<<endl;

}


Measured memory_bytes: 15488
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define endl "\n"
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define prt(x) cout << (x)
#define prtl(x) cout << (x) << endl
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define rrep(i,a,b) for(ll i=a; i>b; i--)
#define mp(a, b) make_pair(a, b)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using vvc = vector<vector<char>>;
using ll = long long int;
using P = pair<long long int, long long int>;
using Map = map<long long int, long long int>;
ll INF = 1LL<<60;
ll M = 1000000007;


int main(){
    ll N; cin >> N;
    string S; cin >> S;
    ll Q; cin >> Q;
    vector<set<ll>> sg(26);
    rep(i, 0, 26){
        sg[i].insert(INF);
    }
    rep(i, 0, N){
        ll d = S[i] - 'a';
        sg[d].insert(i);
    }
    rep(i, 0, Q){
        ll a; cin >> a;
        if(a == 1){
            ll x; char q;
            cin >> x >> q;
            x--;
            if(q == S[x]){
                continue;
            }
            ll e = S[x] - 'a', f = q - 'a';
            S[x] = q;
            sg[e].erase(x); sg[f].insert(x);
        }else{
            ll l, r; cin >> l >> r;
            l--; r--;
            ll c = 0;
            rep(j, 0, 26){
                if(*sg[j].lower_bound(l) <= r){
                    //char t = 'a' + j;
                    //prtl(t);
                    c++;
                }
            }
            prtl(c);
        }
    }
}

Measured memory_bytes: 27248
#include<bits/stdc++.h>
#define dd(x) cout<<#x<<" = "<<x<<" "
#define de(x) cout<<#x<<" = "<<x<<endl
#define sz(x) int(x.size())
#define All(x) x.begin(),x.end()
#define fi first
#define se second
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef priority_queue<int> pq;
const int maxn=1e5+10,mod=1e9+7,INF=0x3f3f3f3f;
int a[maxn],b[maxn];
int main()
{
	int n;
	cin>>n;
	for (int i=1;i<=n+1;++i)
		scanf("%d",&a[i]);
	for (int i=1;i<=n;++i)
		scanf("%d",&b[i]);
	ll ans=0;
	for (int i=1;i<=n;++i){
		if (a[i]>=b[i])
			ans+=b[i];
		else if (a[i]+a[i+1]>=b[i]){
			a[i+1]-=b[i]-a[i];
			ans+=b[i];
		}
		else{
			ans+=a[i]+a[i+1];
			a[i+1]=0;
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1024
// ABC129_B
#include <iostream>
#include <string>
#include <vector>
#include <iterator>  // std::prev(iter, n) n 個分デクリメントしたイテレータ
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;
using ll = long long;

#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define MIN(vec) min_element(vec.begin(), vec.end())  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(vec.begin(), vec.end())
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(vec.begin(), vec.end(), 0LL)  // 0 は初期値
#define pll pair<ll, ll>
#define F first
#define S second
const ll INF = 1LL<<60;  // 10^18（const int inf   = 1<<29;）

int main() {
    // input(sunippets: inpv, inpn, inps)
    ll N;
    cin >> N;
    vector<ll> vec(N);
    REP(i, N) cin >> vec[i];
    
    // calculation
    vector<ll> partial = vec; // copy vec
    partial_sum(vec.begin(), vec.end(), partial.begin());
    ll sm = SUM(vec);
    ll res = INF;
    
    REP(i, N) {
        ll prev = partial[i];
        ll post = sm - prev;
        res = min(res, abs(prev - post));
    }
    
    cout << res << "\n";
    
    return 0;
}

Measured memory_bytes: 256
N = parse(Int,readline())
S = chomp(readline())
list = [0]
for i in 1:N
    if string(S[i]) == "I"
        list = push!(list,list[i]+1)
    else
        list = push!(list,list[i]-1)
    end
end
sortlist = sort(list,rev=true)
println(sortlist[1])

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

#define llint long long int

using namespace std;

int main() {
    string S;

    cin >> S;

    bool ame = false;
    int count = 0;
    int max_count = 0;

    for (int i = 0; i <= 3; i++) {
        if (S[i] == 'R') {
            if (ame == false) {
                ame = true;
                count = 1;
            }
            else {
                count++;
            }
        }
        else {
            ame = false;

            if (count > max_count) {
                max_count = count;
            }
        }
    }
    cout << max_count << endl;
}

Measured memory_bytes: 3596
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//????????????????????????????????????
#define int long long
#define str string
#define rep(i,j) for(int i=0;i<(int)(j);i++)
typedef long long ll;
typedef long double ld;
const ll inf = 4523372036854775807;
const ld pi = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989;
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//??£??\???????????¨???
	ll to, cost;
};
struct S {//???????????±?????\???????????°
	int from, to, cost;
};
struct H {
	int x, y;
};
ll gcm(ll i, ll j) {//?????§??¬?´???°
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld radian(ld a, ld b, ld c, ld d) {
	return sqrt(pow(a - c, 2) + pow(b - d, 2));
}
//---------------------------------------------------
//+++++++++++++++++++++++++++++++++++++++++++++++++++
struct K {
	int x, y, z;
};
bool operator<(K a, K b) { return a.x < b.x; }
struct A {
	int x, cost;
};
int n, m, b[5000][5000], ans;
K o[500000];
queue<A> a[5000];
signed main() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		cin >> o[i].x >> o[i].y >> o[i].z;
		o[i].x--; o[i].y--;
	}
	sort(o, o + m);
	for (int i = 0; i < m; i++) 
		a[o[i].y].push(A{ o[i].x,o[i].z });
	for (int j = 0; j < n; j++) {
		if (a[j].empty())
			continue;
		for (int i = 0; i < n; i++) {
			while (!(a[j].empty()) && a[j].front().x + a[j].front().cost < i)
				a[j].pop();
			if (a[j].empty() || a[j].front().x > i)
				continue;
			b[i][j] = max(b[i][j], i - a[j].front().x + 1);
		}
	}
	for (int i = 0; i < n; i++) 
		for (int j = 1; j < n; j++) 
			b[i][j] = max(b[i][j], b[i][j - 1] - 1);
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			if (b[i][j])
				ans++;
	cout << ans << endl;
	getchar(); getchar();
}

Measured memory_bytes: 220388
import java.util.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(in);
String o=sc.next();
String e=sc.next();
int ol=o.length();
int el=e.length();
String temp=o+e;
String ans="";
for (int i = 0; i <ol+el ; i++) {
    if(i%2==0){
        ans+=Character.toString(temp.charAt(i/2));
    }else{
        ans+=Character.toString(temp.charAt(ol+(i-1)/2));
    }
}
    out.println(ans);
}
}

Measured memory_bytes: 21204
// Created by sz
#include <bits/stdc++.h>
using namespace std;

const int maxn = 105, maxk = 1e5+5;
const int mod = 1e9+7;
int N, K, a[maxn], dp[maxn][maxk];

int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    

    cin>>N>>K;
    for(int i = 0; i<N; i++){
        cin>>a[i];
    }
    
    dp[0][0] = 1;
    for(int i = 0; i< N; i++){
        dp[i+1][0] = 1;
        for(int k = 1; k <= K; k++){
            dp[i+1][k] = ((dp[i+1][k-1]%mod + dp[i][k]%mod)%mod - (k-1>=a[i]?dp[i][k-1-a[i]]:0)%mod +mod)%mod;
//            for(int m = 0; m<=a[i]&&m<=k; m++){
//                dp[i+1][k] += (dp[i][k-m])%mod;
//                dp[i+1][k] %= mod;
//            }
        }
    }
    
    cout<<dp[N][K]<<endl;


    
    return 0;
}


Measured memory_bytes: 40832
#include<bits/stdc++.h>
#define ll long long
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
double PI=acos(-1);
ll n,w,weight[105],value[105];
ll dp[105][100005];
ll inf=1e18;

int main(){
    IO
    cin>>n>>w;
    int ans;
    for(int i=0;i<105;i++){
        for(int j=0;j<100005;j++) dp[i][j]=inf;
    }
    for(int i=1;i<n+1;i++) cin>>weight[i]>>value[i];
    for(int i=1;i<n+1;i++){
        for(int j=1;j<=100000;j++){
             if(j-value[i]<=0) dp[i][j]=min(weight[i],dp[i-1][j]);
             else dp[i][j]=min(dp[i-1][j],dp[i-1][j-value[i]]+weight[i]);
        }
    }
    for(int i=1;i<=100000;i++){
        if(dp[n][i]<=w) ans=i;
    }
    /*for(int i=1;i<=n;i++){
        for(int j=1;j<=100000;j++){
            if(dp[i][j]<inf)cout<<dp[i][j]<<" ";
        }
        cout<<'\n';
    }*/
    cout<<ans<<'\n';

    return 0;
}


Measured memory_bytes: 85664
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

n = int(input())

yen = 0
btc = 0.0
for i in range(n):
    x, u = input().split()
    if u == "JPY":
        yen += int(x)
    else:
        btc += float(x)
print(yen + btc * 380000)


Measured memory_bytes: 9112
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = 1000000007;
 
//Aのn乗modM

long long modpow(long long a,long long n,long long p)
{
    if(n==1)
    {
        return a%p;
    }
    if(n%2==1)
    {
        return a*modpow(a,n-1,p)%p;
    }
    long long t = modpow(a,n/2,p);
    return t*t%p;
}
 
//O(K)でnCkを求める
int comb( int N, int K ){
  int X = 1; //分子
  int Y = 1; //分母
  for( int i = N; i > N-K; i-- ){
    X = (X*i)%MOD;
  }
  for( int i = 1; i <= K; i++ ){
    Y = (Y*i)%MOD;
  }
  return X * modpow(Y, MOD-2, MOD)%MOD;   //Aの逆元を取る場合、modpow(A, MOD-2, MOD) https://qiita.com/drken/items/3b4fdf0a78e7a138cd9a 3-4参照
}
 
signed main() {
  int N, A, B;
  cin >> N >> A >> B;
  
  int ans = modpow(2, N, MOD);
  cout << (ans-1+MOD+MOD- comb(N, A) - comb(N, B))%MOD << endl;
}

Measured memory_bytes: 256
import numpy as np
from copy import deepcopy
from heapq import heappop, heappush
from bisect import bisect_left, bisect
from collections import Counter, defaultdict, deque
from itertools import product, permutations, combinations

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

s = 0

S = [0]

for i in range(N):
    S.append(A[i] + S[i])

for i in range(N):
    s += A[i] * S[i]

print(s % (10**9 + 7))
exit()


Measured memory_bytes: 50032
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
input = sys.stdin.readline
INF = float("inf")


# 処理内容
def main():
    X = int(input())
    if X >= 30:
        print("Yes")
    else:
        print("No")
    


if __name__ == '__main__':
    main()

Measured memory_bytes: 72760
N,M = list(map(int,input().split()))

p = list(map(int,input().split()))

e_list = [[] for i in range(N)]

for i in range(M):
    x,y = list(map(int,input().split()))
    x,y=x-1,y-1
    e_list[x].append(y)
    e_list[y].append(x)

from collections import deque

def BFS(vi,color,color_list,e_list):
    Q = deque([vi])
    color_list[vi]=color
    while len(Q)>0:
        v = Q.pop()
        for v1 in e_list[v]:
            if color_list[v1]==-1:
                color_list[v1]=color
                Q.appendleft(v1)
    return color_list

color_list = [-1 for i in range(N)]
color = 0
for i in range(N):
    if color_list[i]==-1:
        color_list = BFS(i,color,color_list,e_list)
        color+=1
count=0

for i in range(N):
    if color_list[p[i]-1]==color_list[i]:
        count+=1

print(count)

Measured memory_bytes: 29540
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<algorithm>	
#define inf ll(1e18)
using namespace std;
typedef long long ll;

int main()
{
    ll a, b, c;
    scanf("%lld%lld%lld", &a, &b, &c);
    a = abs(a);
    ll d = a / c;
    if (d >= b) {
        printf("%lld", a - b * c);
    }
    else if ((b - d) % 2) {
        printf("%lld", c * (d + 1) - a);
    }
    else {
        printf("%lld", a - c * d);
    }
    return 0;
}

Measured memory_bytes: 3812
#include <iostream>
#include <vector>
#include <math.h>
#include <iomanip>

using namespace std;

int main () {
    int N, K;
    cin >> N >> K;
    double sum = 0;
    int db =  2;
    int count = 0;

    if (N >= K) {
        sum += (double) (N - K + 1) / N;
        count++;
    }

    for (int i = 0; i < 50; i++) {
        int memo = 0;
        if (db * N >= K) {
            if (count == 0) {
                memo = N - ceil((double) K / db) + 1;
            }
            else {
                memo = ceil((double) (K * 2) / db) - ceil((double) K / db);
            }
            count++;
            sum += (double) memo / (N * db);
        }
        db *= 2;
    }
    cout << fixed << setprecision(15);
    cout << sum << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <functional>
#include <set>
#include <ctime>

using namespace std;
typedef long long ll;

int __gcd(int x, int y)
{
    if (y == 0) return x;
    return __gcd(y, x % y);
}


int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    while (a > 0 && c > 0) {
        c -= b;
        a -= d;
    }
    if (a <= 0 && c <= 0) {
        cout << "Yes" << endl;
    } else if (a <= 0) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }

    return 0;
}

Measured memory_bytes: 3128
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <complex>

#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

#include <stdexcept>

using namespace std;

// type alias
using ll = long long;
using ull = unsigned long long;
using comp = complex<double>;

const ll MOD = 1000000007LL;
const double PI = 3.14159265358979323846;

//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(); }

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl
#define DEBUG(x) cerr << #x << " = " << (x) << " (l" << __line__ << ")" << " " << __file__ << endl

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

	ll N, Q;
	string S;
	cin >> N >> S >> Q;

	map<char, set<ll>> char_to_set;
	for (ll i = 0; i < N; ++i) {
		if (char_to_set.count(S[i]) == 0) {
			char_to_set[S[i]] = set<ll>();
		}
		char_to_set[S[i]].insert(i);
	}

	ll type, iq, lq, rq, res;
	char cq;
	for (ll i = 0; i < Q; ++i) {
		cin >> type;
		if (type == 1) {
			cin >> iq >> cq;
			--iq;
			char_to_set[S[iq]].erase(iq);
			char_to_set[cq].insert(iq);
			S[iq] = cq;
		}
		else if (type == 2) {
			cin >> lq >> rq;
			--lq, --rq;
			res = 0;
			for (auto iter = char_to_set.begin(); iter != char_to_set.end(); ++iter) {
				auto set_iter = (iter->second).lower_bound(lq);
				if (set_iter != iter->second.cend() && (*set_iter) <= rq) {
					++res;
				}
			}
			cout << res << endl;
		}
	}


	return 0;
}


Measured memory_bytes: 24220
#include <bits/stdc++.h>
using namespace std;
using ipair = pair<int, int>;
using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())

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 int INF = 1001001001;


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

  ll ans = 0;
  ans += (X / 500) * 1000;
  X %= 500;
  ans += (X / 5) * 5;

  cout << ans << endl;

  return 0;
}


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

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

  double a[110];
  for (int i=0;i<n;i++) cin >> a[i];
  double denominator = 0;
  for (int i=0;i<n;i++) denominator += 1 / a[i];
  cout << 1 / denominator << endl;
}

Measured memory_bytes: 256
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

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

    ll  a,b,c,d,e,n,k,maxi=0,f=0,mini=INF,sum=0,q;
	string str,stra,straa;
    ll x,y,z;
    char ca,cb,cc;
    cin>>a>>b;
    if(a<=5){
        cout<<0;
    }else if(a<=12){
        cout<<b/2<<endl;
    }else{
        cout<<b<<endl;
    }
}


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

int main() {
    int n, x;
    cin >> n >> x;
    vector<int> m(n);
    rep(i, n) cin >> m[i];
    int ans = 0;
    
    rep(i, n) {
        ans++;
        x -= m[i];
    }
    
    sort(m.begin(), m.end());
    cout << (ans + x / m[0]) << endl;
    return 0;
}

Measured memory_bytes: 256
s=input()
a=list(set(s))
l=[]
for i in a:
  b=s+i
  m=0
  c=0
  for j in range(len(b)):
    c+=1
    if b[j]==i:
      if c>m:
        m=c
      c=0
  l.append(m)
print(min(l)-1)

Measured memory_bytes: 3060
#include<cstdio>
int main(){
    char ch[100][100];
    int cnt[100][100]={{0}};
    int i,j,k;
    int h,w;
    scanf("%d %d",&h,&w);
    for(i=0;i<h;i++){
        for(j=0;j<w;j++){
            scanf(" %c",&ch[i][j]);
        }
    }
    for(i=0;i<h;i++){
        for(j=0;j<w;j++){
            if(ch[i][j]=='c'){
                cnt[i][j]=0;
            }
            else if(ch[i][j]=='.') {
                for(k=j;k>=0;k--){
                    if(ch[i][k]=='c'){
                        cnt[i][j]=j-k;
                        break;
                    }
                    cnt[i][j]=-1;
                }
            }
        }
    }
    for(i=0;i<h;i++){
        for(j=0;j<w;j++){
            printf("%d",cnt[i][j]);
            if(j!=w-1)printf(" ");
            else printf("\n");
        }
    }
    return 0;
}

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

#define rep(i,n) for(int i = 0;i < n; i++)

using namespace std;

int main() {
    int a, b, k, max;
    cin >> a >> b >> k;
    if(a < b){
        max = b;
    }else{
        max = a;
    }
    int array[100];
    int count;
    for(int i = 1; i < max + 1; i++){
        if(a % i == 0 && b % i == 0){
            array[count] = i;
            count++;
        }
    }
    cout << array[count - k] << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ratio>
const long long INF = LLONG_MAX / 2;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i, r, n) for(int i=(ll)(r); i<(ll)(n); i++) 
#define REP(i, n) FOR(i, (0), n)
#define ALL(r) r.begin(), r.end()
#define ll long long int
using namespace std;
vector<ll> v;
vector<pair<ll, ll>> vp;
vector<vector<ll>> vv(110, vector<ll>(50, 0));
vector<tuple<ll, ll, ll>> vt;
set<ll> st;
map<ll, ll> mp;

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

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

using namespace std;
typedef long long ll;

#define rep(i, N) for (int i = 0; i < (int)N; i++)
const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;


int main() {
  int N; cin >> N;
  int result = pow(N,3);
  cout << result << endl;
  return 0;
}

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

int main(){
	int time = 0;
	int t;
	int s, m;
	for(int i = 0; i < 4; i++){
		cin >> t;
		time += t;
	}
	s = time % 60;
	m = time / 60;
	cout << m << endl << s << endl;

	return 0;
}

Measured memory_bytes: 1160
fun main(arr:Array<String>) {
    val s = readLine()!!.toInt()
    val numlist = mutableSetOf<Int>()
    var current = s
    var idx = 1
    while (!numlist.contains(current)) {
        numlist.add(current)
        if(current % 2 == 0) {
            current /= 2
        } else {
            current = current * 3 + 1
        }
        idx ++
    }
    println(idx)
}

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

LL a,b,p1,p2,dp[101][100005],ar[100005],ar1[100005];
LL knapsack(LL w,LL wt[],LL cost[],LL n){
    for(LL i=1;i<=n;i++){
        for(LL j=1;j<=w;j++){
            if(wt[i-1]<=j){
                dp[i][j]=max(cost[i-1]+dp[i-1][j-wt[i-1]],dp[i-1][j]);
            }
            else{
                dp[i][j]=dp[i-1][j];
            }
        }
    }
    return dp[n][w];
}
int main(){
    cin>>a>>b;
    for(int i=0;i<a;i++){
        cin>>ar[i]>>ar1[i];
        //v.push_back(ar);
        //v1.push_back(ar1);
    }
    cout<<knapsack(b,ar,ar1,a)<<endl;
    return 0;
}


Measured memory_bytes: 78720
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if (A+B > C+D){
    cout << "Left" << endl;
  } else if (A+B == C+D) {
    cout << "Balanced" << endl;
  } else {
    cout << "Right" << endl;
  }
}

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(ll i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;
#define MAX_N 100010

// 500, 75min


ll N, X;

signed main()
{
    cin >> N >> X;

    //for(N = 2; N <= 10; ++N) {
    //    for(X = 1; X < N; ++X) {
            //printf("N: %lld X: %lld -> ", N, X);
            ll a = min(X, N - X);
            ll b = max(X, N - X);
            ll ans = 0;
            ll tmp = 0;
            if(b % a == 0) {
                ans = b + (b / a) * 2 * a;
                printf("%lld\n", ans);
                return 0;
            }
            else {
                tmp = (b / a) * 2 * a + a + b;
                ans += tmp;
                ll new_a = b % a;
                ll new_b = a;
                a = new_a; b = new_b;
            }
            while(b % a != 0) {
                tmp = (b / a) * 2 * a;
                ans += tmp;
                ll new_a = b % a;
                ll new_b = a;
                a = new_a; b = new_b;
            }
            tmp = (b / a) * 2 * a - a;
            ans += tmp;
            printf("%lld\n", ans);
    //    }
    //}

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#define llint long long

using namespace std;

llint n, m;
llint a[100005];
llint sum[100005];
map<llint, llint> mp;

int main(void)
{
	cin >> n >> m;
	for(int i = 1; i <= n; i++) cin >> a[i];
	
	for(int i = 1; i <= n ; i++){
		sum[i] = (sum[i-1] + a[i]) % m;
	}
	for(int i = 0; i <= n; i++){
		mp[sum[i]]++;
	}
	
	llint ans = 0;
	for(auto x : mp) ans += x.second*(x.second-1)/2;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5760
//
//	Created by shamim_nik
//

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,
		tree_order_statistics_node_update> indexed_set;

#define br printf("\n")
#define pi acos(-1)

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

//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	int num;
    cin >> num;
    cout << fixed << setprecision(20) << (long double)(2 * pi * num) << endl;
	return 0;
}

Measured memory_bytes: 3796
#include <stdlib.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
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;
}
const long long INF=1LL << 60;
long long a,b;
long long dp[100200][110];
long long w[110],v[110];

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


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<vector>
double F(double r,double s)
{
	return (r+s)*::cos(asin((r-s)/(r+s)));
}
int main()
{
	int l,a[12],n,i,j,k;
	char*p,s[256];
	while(fgets(s,256,stdin))
	{
		p=strtok(s," ");
		l=atoi(p);
		for(n=0;p;)
		{
			p=strtok(0," ");
			if(p)a[n++]=atoi(p);
		}
		std::vector<int>u,v;
		double dp[1<<12][12];
		std::fill(dp[0],dp[1<<12],1e10);
		for(i=0;i<n;++i)dp[1<<i][i]=a[i];
		for(i=1;i<(1<<n);++i)
		{
			u.clear();
			v.clear();
			for(j=0;j<n;++j)
			{
				if(i&(1<<j))u.push_back(j);
				else v.push_back(j);
			}
			for(j=0;j<u.size();++j)
			{
				for(k=0;k<v.size();++k)
				{
					double&r=dp[i|(1<<v[k])][v[k]];
					r=std::min(r,dp[i][u[j]]+F(a[u[j]],a[v[k]]));
				}
			}
		}
		k=(1<<n)-1;
		for(i=0;i<n;++i)dp[k][i]+=a[i];
		puts(*std::min_element(dp[k],dp[k]+n)-1e-7<l?"OK":"NA");
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip>
using namespace std;
#define int long long

int gcd(int c,int d){
    return d ? gcd(d, c % d) : c;
}



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

    int n,m; cin >> n >> m;
    vector<int> x(m);
    for(int i = 0;i < m;i ++) cin >> x.at(i);

    sort(x.begin(),x.end());
    vector<int> y(m-1);
    for(int i = 0;i < m-1;i ++) y.at(i) = x.at(i+1) - x.at(i);

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

    int ans = 0;

    if(n < m){
        for(int i = 0;i < m-n;i ++) ans += y.at(i);
    }

    cout << ans << endl;
}



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

const long long MOD = 1000000007;
const long long MAX = 2000000;

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

int main()
{
    int N, K;
    cin >> N >> K;
    long long H[N];
    for (int i = 0; i < N;i++){
        cin >> H[i];
    }
    sort(H, H + N);
    reverse(H, H + N);
    long long sum = 0;
    for (int i = K; i < N;i++){
        sum += H[i];
    }
    cout << sum << endl;
}


Measured memory_bytes: 1792
/*
 * FILE: ABC_124_A.cpp
 *
 * @author: Piyush Kanti Das <piyush123kantidas[at]gmail[dot]com>
 *
 * LINK:
 *
 * DATE CREATED: 01.07.2019 13:17:55 +06
 *
 * DESCRIPTION:
 *
 * DEVELOPMENT HISTORY:
 * Date         Version     Description
 * --------------------------------------------------------------
 * 01-07-2019	1.0         File Created
 *
 */


/*
// _______________________________________________________________/\\\_________
//  ______________________________________________________________\/\\\_________
//   ___/\\\\\\\\\___/\\\____/\\\__/\\\____________________________\/\\\_________
//    __/\\\/////\\\_\///____\//\\\/\\\___/\\\____/\\\__/\\\\\\\\\\_\/\\\_________
//     _\/\\\\\\\\\\___/\\\____\//\\\\\___\/\\\___\/\\\_\/\\\//////__\/\\\\\\\\\\__
//      _\/\\\//////___\/\\\_____\//\\\____\/\\\___\/\\\_\/\\\\\\\\\\_\/\\\/////\\\_
//       _\/\\\_________\/\\\__/\\_/\\\_____\/\\\___\/\\\_\////////\\\_\/\\\___\/\\\_
//        _\/\\\_________\/\\\_\//\\\\/______\//\\\\\\\\\___/\\\\\\\\\\_\/\\\___\/\\\_
//         _\///__________\///___\////_________\/////////___\//////////__\///____\///__
//
*/

#include<bits/stdc++.h>
using namespace std;

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

#define __FastIO        ios_base::sync_with_stdio(false); cin.tie(0)

#define forr(i, a, b)   for (__typeof (a) i=a; i<=b; i++)
#define rof(i, b, a)    for (__typeof (a) i=b; i>=a; i--)
#define rep(i, n)       for (__typeof (n) i=0; i<n; i++)
#define forit(i, s)     for (__typeof ((s).end ()) i = (s).begin (); i != (s).end (); ++i)
#define all(ar)         ar.begin(), ar.end()

#define fill(ar)   		memset(ar, -1, sizeof(ar))
#define clr(a)          memset(a, 0, sizeof(a))

#define nl              cout << '\n';
#define sp              cout << ' ';
#define ckk             cout << "##########\n"

#define pb              push_back
#define MP 				make_pair

#define debug1(x)       cerr << #x << ": " << x << endl
#define debug2(x, y)    cerr << #x << ": " << x << '\t' << #y << ": " << y << endl
#define debug3(x, y, z) cerr << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": " << z << endl

#define gama 0.57721566490
#define PI              acos(-1.0)
#define INF             0x7fffffff
#define MOD             1000000007
#define EPS             1e-7
#define MAX             100005

int Set(int N,int pos){return N=N | (1<<pos);}
int Reset(int N,int pos){return N= N & ~(1<<pos);}
bool Check(int N,int pos){return (bool)(N & (1<<pos));}


ll BM( ll a , ll b , ll m )
{
    if ( b == 0 ) return 1 ;
    ll x = BM(a,b/2,m);
    x = (( x % m) * (x % m))%m;
    
    if( b % 2 ) x = (( x % m) * (a %m)) % m ;
    return x ;
}

//Auto-format --> ctrl+shift+a
/********************* Code starts here ************************/

int main() {
    __FastIO;   //Be aware to use it!
    
    int A, B;
    cin >> A >> B;
    int mx = max(A, B);
    int ans = max(mx+mx-1,A+B);
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    int n,d;
    cin>>n>>d;
    vector<int> a[n];
    for(int i=0;i<n;i++){
        for(int j=0;j<d;j++){
            int val;
            cin>>val;
            a[i].push_back(val);
        }
    }
    int ans=0;
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            double sum=0;
            for(int j1=0;j1<d;j1++){
                sum += (abs(a[i][j1]-a[j][j1])*abs(a[i][j1]-a[j][j1]));
            }
            ll val = sqrt(sum);
            sum = (double)sqrt(sum);
            if(val==sum) ans++;
            //cout<<val<<" "<<sum<<'\n';
        }
    }
    cout<<ans<<'\n';
    return 0;
}

Measured memory_bytes: 256