akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <cstdlib>
using namespace std;
#define ll long long
typedef vector<vector<ll> > matrix;
#define pb push_back
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
const double PI  =3.141592653589793238463;
long long MOD = 1000000007;

int stringToInteger(string x){
    int gg=0;
    stringstream geek(x);
    geek >> gg;
    return gg;
}

ll powmod(ll a,ll b,ll m)
{
    ll ans=1;
    while(b>0){ if(b%2)
        {ans*=a; ans%=m;}
         b/=2; a=a*a; a=a%m;
        }
        return ans%m;
}
ll gcd(ll a,ll b)
{

    return __gcd(a,b);
}
ll mulmod(ll a,ll b,ll m)
{  ll ans=0;
    a %=m;
    while (b>0)
    {       if(b&1) ans = (ans + a) % m;
        a = (a * 2)%m;
        b /= 2;
    }
    return ans % m;
}

ll f[2000001];



ll pow(ll a, ll b, ll MOD)
{
 ll x=1,y=a;
 while(b > 0)
 	{
 		if(b%2 == 1)
 	{
 		x=(x*y);
 		if(x>MOD) x%=MOD;
 	}
 	y = (y*y);
 	if(y>MOD) y%=MOD;
 	b /= 2;
 	}
 return x;
}

/* Modular Multiplicative Inverse
 Using Euler's Theorem
 a^(phi(m)) = 1 (mod m)
 a^(-1) = a^(m-2) (mod m) */
ll InverseEuler(ll n, ll MOD)
{
 return pow(n,MOD-2,MOD);
}

bool prime[100005];
void seive()
{  memset(prime,true,sizeof(prime));
    for(int i=2;i*i<=100005;i++)
    {
         if(prime[i]==true) {
        for(int j=2*i;j<=(100005);j+=i)
           { prime[j]=false;}
           }

    }
}
bool in(float x1,float y1,float x,float y,float r )
{
    if(abs(x1-x)*abs(x1-x)+abs(y1-y)*abs(y1-y)<=r*r) return true;
    return false;
}
bool cmp(pair<int,int> &a,pair<int,int> &b)
{

        return (a.second<b.second);
}
//
//vector<vector<int> >matrix;
matrix mul(matrix A,matrix B)
{
    matrix C(3, vector<ll>(3));
    for(int i=1;i<=2;i++)
    for(int j=1;j<=2;j++)
     for(int k=1;k<=2;k++)
         C[i][j] = (C[i][j] + A[i][k] * B[k][j]);
    return C;

}
matrix pow(matrix A, int p)
{
    if (p == 1)
        return A;
    if (p % 2)
        return mul(A, pow(A, p-1));
    matrix X = pow(A, p/2);
    return mul(X, X);
}
ll fib(int N,int a,int b)
{
    vector<ll> F1(3);
    F1[1] = a;
    F1[2] = b;
    matrix T(3, vector<ll>(3));
    T[1][1] = 0, T[1][2] = 1;
    T[2][1] = -1, T[2][2] = 1;
    if (N == 1)
        return a;
    if(N==2) return b;
    T = pow(T, N-1);
    ll res = 0;
    for(int i=1;i<=2;i++)
        res = (res + T[1][i] * F1[i]+ MOD)%MOD ;
    return res;
}

//1 2 3 4 5
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

 int t =1;
 while(t--)
  {
      int n;
      cin>>n;
      ll ans;
      for(int i=0;i<n;i++)
      {
          ll a;
          cin>>a;
          if(i==0) ans=a;
          else
          {
              ans=(ans/(gcd(ans,a)))*(a);
          }

      }
cout<<ans;
     // 3 0 3 0 3

  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
/*
string S_str[H];
cins(S_str, S_str + H);
S_str[i][j];
*/
inline int at(ll x, int k){ return (x >> k) & 1; }
#define rep(i, n) for(int i = 0; i < n; i++)


int main(){
  ll k,n;
  cin >> k >> n;
  ll m=0;
  ll a[n];
  ll bef;
  ll j;
  ll temp;
  rep(i,n){
    cin >> temp;
    if(i!=0){
    if(m<temp-bef){
      m=temp-bef;
    }
  }
  else{
    j=temp;
  }
    bef=temp;
  }

  if(k-temp+j>m){
    m=k-temp+j;
  }

  cout << k-m << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
using namespace std;
#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;
#define INF (1<<29)

int calc(int x){
  int ret=0;
  while(x>0){
    ret+=x%10;
    x/=10;
  }
  return ret;
}

int main(){
  int n, ans=INF;
  cin >> n;
  for(int i=1;i<n;i++){
    int j=n-i;
    int a=calc(i);
    int b=calc(j);
    ans=min(a+b,ans);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ls (o<<1)
#define rs (o<<1|1)
#define pb push_back
const double PI= acos(-1.0);
const int M = 1e5+7;
/*
int head[M],cnt;
void init(){cnt=0,memset(head,0,sizeof(head));}
struct EDGE{int to,nxt,val;}ee[M*2];
void add(int x,int y,int z){ee[++cnt].nxt=head[x],ee[cnt].to=y,ee[cnt].val=z,head[x]=cnt;}
*/
int a[100]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

int main()
{
	ios::sync_with_stdio(false);
  	cin.tie(0);
  	int n;
  	cin>>n;
  	cout<<a[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define m 1000000
int cnt[m+5],ara[m+5];
bool p[m+5];
main()
{
    memset(p,true,sizeof(p));
    for(int i=2;i*i<=m;i++)
    {
        if(p[i]==0)continue;
        for(int j=i*i;j<=m;j+=i)
        {
            p[j]=false;
        }
    }
    /*for(int i=2;i<=10;i++)
    {
        cout<<p[i]<<" ";
    }
    cout<<endl;*/
    int n,i,t=1,j;
    cin>>n;
    for(i=1;i<=n;i++)cin>>ara[i];
    for(i=1;i<=n;i++)
    {
        cnt[ara[i]]++;
    }
    for(i=2;i<=m;i++)
    {
        if(p[i]==false)continue;
        int c=0;
        for(j=i;j<=m;j+=i)
        {
            c+=cnt[j];
        }
        if(c>=2)
        {
            t=0;break;
        }
    }
    if(t==1)
    {
        printf("pairwise coprime\n");return 0;
    }
    int g=ara[1];
    for(i=2;i<=n;i++)
    {
        g=__gcd(g,ara[i]);
    }
    if(g==1)
    {
       printf("setwise coprime\n");
    }
    else
    {
        printf("not coprime\n");
    }
}


Measured memory_bytes: 12428
#include<stdio.h>

int main(){
   int N;
  scanf("%d",&N);
   
   
   if((N%10==2)||(N%10==4)||(N%10==2)||(N%10==5)||(N%10==7)||(N%10==9)){
      printf("hon\n");
   } else if((N%10==0)||(N%10==1)||(N%10==6)||(N%10==8)){
      printf("pon\n");
   } else if(N%10==3){
      printf("bon\n");
   }
   return 0;
}

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

namespace AtCoder.Abc
{
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            var inputIntArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
            var calc = (double)(inputIntArray[0] + inputIntArray[1]) / 2;
            Console.WriteLine(Math.Ceiling(calc));
        }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define ll long long

using namespace std;
const ll Mod = 1e9 + 7;
ll n,a,b;

long long fastpower(long long a,long long b)
{
    if(b==0)
        return 1;
    if(b==1)
        return a;
    long long res = fastpower(a,b/2)%Mod;
    res = (res %Mod  * res % Mod )%Mod;
    if(b%2!=0)
        res*=a;
    return res % Mod;
}

ll C(ll n , ll k){
    ll Res = 1;
    for(ll i = n;i>n - k;i--)  Res*=i , Res%=Mod;
    for(ll i = k;i>=1;i--)  Res*=fastpower(i , Mod - 2) , Res%=Mod;
    return Res;
}

int main()
{
    cin >> n >> a >> b;
    cout << (fastpower(2 , n) - 1 - (C(n , a) + C(n , b)) + 2 * Mod)%Mod;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define MOD 1000000007ULL;
#define rep(i,n) for(ll i=0;i<n;i++)



int main() {
	ll a,b;
  	cin>>a>>b;
  	cout<<a*b<<endl;
}

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

using namespace std;
using ll = long long;
using v1 = vector<int>;
using v2 = vector<vector<int>>;
int N;
int S=0;

void dfs(v2 a, int h, int w, int su){
	su += a.at(h).at(w);
	if(h == 1 && w == N-1){
		if(su > S) S = su;
	}
	v1 mh = {0, 1};
	v1 mw = {1, 0};
	for(int i = 0; i<2; i++){
		int nh = h + mh.at(i);
		int nw = w + mw.at(i);
		if(nh>=2 || nw>= N) continue;
		dfs(a, nh, nw, su);
	}
}

int main(){
	cin >> N;
	v2 a(2,vector<int>(N));
	rep(i, 2){
		for(int j = 0; j < N; ++j){
			cin >> a.at(i).at(j);
		}
	}
	dfs(a, 0, 0, 0);
	cout << S << endl;
}


Measured memory_bytes: 384
#define _GLIBCXX_DEBUG // test only

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

int main() {

  ios::sync_with_stdio(false);
  cin.tie(0);
  int a,b;
  cin >> a >> b;
  if(a>8||b>8) cout << ":(" << endl;
  else cout << "Yay!" << endl;
}

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

int main(){
    int n,t;
    cin >> n >> t;
    //nはプロセスの個数,tは時間
    queue<pair<string,int> > qu;
    int sumtime = 0;

    //入力
    for(int i=0;i<n;i++){
        string n;
        int x;
        cin >> n >> x;

        qu.push(make_pair(n,x));
    }

    pair<string,int> now;

    while(qu.size()>0){
        now = qu.front();
        qu.pop();

        if(now.second-t<=0){
            sumtime += now.second;
            cout << now.first << " " << sumtime << endl;
        }else{
            sumtime += t;
            now.second -= t;
            qu.push(now);
        }
    }
}


Measured memory_bytes: 6328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll INF=200000000000001;
ll N;
 
struct edge{ll to,cost;};
typedef pair<ll,ll> P;
struct graph{
  ll V; vector<vector<edge>> G; vector<ll> d;
  graph(ll n){init(n);}
  
  void init(ll n){
    V=n; G.resize(V); d.resize(V);
    for(int i=0;i<V;i++)d[i]=INF;
  }
  
  void add(ll s,ll t,ll cost){
    edge e; e.to=t,e.cost=cost;
    G[s].push_back(e);
  }
  
  void dijkstra(ll s){
    for(int i=0;i<V;i++)d[i]=INF;
    d[s]=0;
    priority_queue<P,vector<P>,greater<P>> que;
    que.push(P(0,s));
    while(!que.empty()){
      P p=que.top(); que.pop(); ll v=p.second;
      if(d[v]<p.first)continue;
      for(auto e:G[v]){
        if(d[e.to]>d[v]+e.cost){d[e.to]=d[v]+e.cost; que.push(P(d[e.to],e.to));}
      }
    }
  }
};
 
int main(){
  cin >> N;
  graph graph1(N+100);
  for(int i=0;i<N-1;i++){
    long long u,v,w;
    cin >> u >> v >> w;
    graph1.add(u,v,w); graph1.add(v,u,w);
  }
  graph1.dijkstra(1);
  for(int i=1;i<=N;i++){
    //cout << i << " " << graph1.d[i] << endl;
    if(graph1.d[i]==INF){cout << 0 << endl;}
    else if(graph1.d[i]%2==0){cout << 1 << endl;}
    else{cout << 0 << endl;}
  }
}

Measured memory_bytes: 8704
#include<stdio.h>

static const int N = 100;

int min(int a, int b){ return a < b ? a : b; }

int main(){
  int i, j, k, l, v;
  int n, p[N+1], m[N+1][N+1];
  scanf("%d", &n);
  for ( i = 1; i <= n; i++ ){
    scanf("%d %d", &p[i-1], &p[i]);
  }

  for ( i = 1; i <= n; i++ ) m[i][i] = 0;
  for ( l = 2; l <= n; l++ ){
    for ( i = 0; i <= n-l+1; i++ ){
      j = i+l-1;
      m[i][j] = (1<<21);
      for ( k = i; k <= j-1; k++ ){
	m[i][j] = min(m[i][j], m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j]);
	v = m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j];
	//printf("m[%d,%d] + m[%d,%d] + p[%d]p[%d]p[%d] = %d\n", i, k, k+1, j, i-1, k, j, v);
      }
    }
  }

  /*for ( int i = 1; i <= n; i++ ){
    for ( int j = 1; j <= n; j++ ){
      printf("%4d", m[i][j]);
    }
    printf("\n");
  }*/

  printf("%d\n", m[1][n]);

  return 0;
}



Measured memory_bytes: 2108
#include<stdio.h>
#include<algorithm>
typedef long long LL;
using namespace std;
int main() {
	int n;
	while(scanf("%d",&n)!=EOF) {
		int cnt=1;
		int tm,flag=-1;
		scanf("%d",&tm);
		for(int i=1; i<n; i++) {
			int t;
			scanf("%d",&t);
			if(t==tm)
				continue;
			if(t<tm) {
				if(flag==1) {
					cnt++;
					flag=-1;
				} else if(flag==-1)
					flag=0;
			} else if(t>tm) {
				if(flag==0) {
					cnt++;
					flag=-1;
				} else if(flag==-1)
					flag=1;
			}
			tm=t;
		}

		printf("%d\n",cnt);
	}
	return 0;
}


Measured memory_bytes: 128
#!/usr/bin/env python3

d, n = list(map(int, input().split()))

if n == 100:
    if d == 0:
        print(100+1)
    elif d == 1:
        print(100*100+100)
    else:
        print(100*10000+10000)
else:
    if d == 0:
        print(n)
    else:
        print((100**d)*n)


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

#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <stdint.h>
#include <string.h>

//#define _USE_MATH_DEFINES
//#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>
#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

const i64 mod = 1000000007ll;
const i64 smod = 998244353ll;
const i64 inf = 1000000007; // 10000000000000007ll;

const double eps = 1e-8;

const i64 MAXN = 2'000'000 + 6;

i64 n, m;

i64 a[MAXN];
i64 c[MAXN];

inline i64 cnt(i64 i) {
    return c[i] * (c[i] - 1) / 2;
}

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed);


    cin >> n;
    for (i64 i = 0; i < n; i++) {
        cin >> a[i];
    }

    for (i64 i = 0; i < n; i++) {
        c[a[i]] += 1;
    }

    i64 R = 0;
    for (i64 i = 1; i <= n; i++) {
        R += cnt(i);
    }

    stringstream ss;
    for (i64 i = 0; i < n; i++) {
        i64 t = R;
        t -= cnt(a[i]);
        c[a[i]] -= 1;
        t += cnt(a[i]);
        c[a[i]] += 1;
        ss << t << endl;
    }

    cout << ss.str();

    return 0;
}

Measured memory_bytes: 12420
using System;
class Program
    {
    	static void Main(string[] args)
    	{
            int a = int.Parse(Console.ReadLine());
            int b =  int.Parse(Console.ReadLine());
            int c = int.Parse(Console.ReadLine());
            int d =  int.Parse(Console.ReadLine());

         



          Console.WriteLine(Math.Min(a,b)+Math.Min(c,d));
    	}


    }

Measured memory_bytes: 13140
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;

#define FOR(i, N) for (int i = 0; i < (int)N; i++)
#define FORIN(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

using Pi = pair<int, int>;
using ll = long long;
const int INF = 1 << 28;

string to_string(string s) {
  return s;
}

template<class S,class T>
string to_string(pair<S,T> p){
	return "{"+to_string(p.first)+","+to_string(p.second)+"}";
}

template <class T>
string to_string(vector<T> v) {
  string ret = "{";
  for (int i = 0; i < v.size() - 1; ++i) {
    ret += to_string(v[i]) + ",";
  }
  if (v.size() > 0) {
    ret += to_string(v.back());
  }
  ret += "}";
  return ret;
}

void debug() {
  cerr << endl;
}

template <class Head, class... Tail>
void debug(Head head, Tail... tail) {
  cerr << to_string(head) << " ";
  debug(tail...);
}

void print() {
  cout << endl;
}

template <class Head, class... Tail>
void print(Head head, Tail... tail) {
  cout << to_string(head);
  print(tail...);
}

void get() {}

template <class Head, class... Tail>
void get(Head& head, Tail&... tail) {
  cin >> head;
  get(tail...);
}

template <class T>
void getv(vector<T>& vec) {
  for (int i = 0; i < vec.size(); ++i)
    cin >> vec[i];
}

int main() {
  int M,D;
  cin>>M>>D;
  int ans=0;
  for(int i=1;i<=M;++i){
    for(int j=1;j<=D;++j){
      int d1=j/10;
      int d10=j%10;
      if(d1>=2&&d10>=2&&d1*d10==i)ans++;
    }
  }
  print(ans);
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<math.h>
typedef long long ll;
using namespace std;

double X[10], Y[10]; 

int V[10], N;

double d(int x, int y) {
	return sqrt((X[x] - X[y]) * (X[x] - X[y]) + (Y[x] - Y[y]) *(Y[x] - Y[y]));
}

double dfs(int x, int cnt, double sum) {
	if (cnt == N) return sum;
	V[x] = 1;
	double res = 0;
	for (int i = 0; i < N; i++) {
		if (V[i]) continue;
		res += dfs(i, cnt + 1, sum + d(x, i));
	}
	V[x] = 0;
	return res;
}

int main()
{
	double ans = 0;
	int f = 1;
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%lf%lf", &X[i], &Y[i]);
	}
	for (int i = 0; i < N; i++) {
		ans += dfs(i, 1, 0);
		f *= (i + 1);
	}
	printf("%lf", ans / f);
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
int main(void){
  int R,G,B,N;
  int r,g,ans=0;
  scanf("%d %d %d %d",&R,&G,&B,&N);
  for(r=0;r<=N/R;r++){
    for(g=0;g<=N/G;g++){
      if((N-R*r-G*g)%B==0 && N-R*r-G*g>=0){
        ans+=1;
      }
    }
  }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 128
while True:
  n = int(input())
  if n==0:
    break
  ans = 2*n-n
  for x in range(n+1,2*n+1):
    for i in range(2,int(x**0.5)+1):
      if x%i==0:
        ans-=1
        break
  print(ans)


Measured memory_bytes: 5692
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    string s;
    cin >> s;
    VI cnt(s.size());
    if (s[s.size()-1] == 'W') cnt[s.size()-1] = 1;
    LL ans = 0;
    RREP(i,0,s.size()-1) {
        cnt[i] = cnt[i+1] + (s[i] == 'W') * 1;
        if (s[i] == 'B') ans += cnt[i];
    }
    cout << ans << endl;
}

int main() {
    solve();
    
    return 0;
}

Measured memory_bytes: 1412
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <map>
#include <stack>
//#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)

int main(void)
{
    //abc089c
    lli ans = 0;
    map<char, lli> x;
    lli N;
    cin >> N;
    string s;
    for (int i = 0; i < N; i++)
    {
        cin >> s;
        if (s[0] == 'M' || s[0] == 'A' || s[0] == 'R' || s[0] == 'C' || s[0] == 'H')
        {
            x[s[0]]++;
        }
    }
    char a[5] = {'M', 'A', 'R', 'C', 'H'};
    for (int i = 0; i < 5; i++)
    {
        for (int j = i + 1; j < 5; j++)
        {
            for (int k = j + 1; k < 5; k++)
            {
                ans += x[a[i]] * x[a[j]] * x[a[k]];
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3564
/*input
6
4 1 3 1 6 2
*/

//sometimes it's the people who no one imagines anything of 
//who do the things that no one can imagine.

//code author: iamxlr8

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

#define ll long long
#define N 300005

int main() 
{
    ll n,x;
    cin>>n;
    map<ll,ll> m;
    for(ll i=0;i<n;i++)
    {
        cin>>x;
        m[x]++;
    }
    for(auto x:m)
    {
        if(x.second>1)
        {
            cout<<"NO";
            return 0;
        }
    }
    cout<<"YES";
    return 0;
}

Measured memory_bytes: 12800
#include<iostream>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<cstdlib>
#include<cstdio>
#include<cmath>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
#define fastIO_ ios_base::sync_with_stdio(false); cin.tie(false); cout.tie(false);
int main()
{
    double n;
    cin>>n;
    double k = n / 3;
    printf("%.6lf\n", k * k * k);
    return 0;
}

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

int main() {
 vector<int>vec(3);
  
 cin >> vec.at(0) >> vec.at(1) >> vec.at(2);
  
 cout << vec.at(2) << " " << vec.at(0) << " " << vec.at(1) << endl;
}

Measured memory_bytes: 3600
// Grid Compression

#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <ios>
#include <iomanip>
#include <string>
#include <numeric>

using namespace std;

int h, w;

bool is_in(vector<int> v, int n) {
    auto itr = find(v.begin(), v.end(), n);
    if( itr != v.end() ) {
        return true;
    }
    return false;
}

int main() {
    cin >> h >> w;

    char a[h][w];

    // 標準入力から読み込めていない？
    for (int i = 0; i < h; i++) {
        for(int j = 0; j < w; j++) {
            cin >> a[i][j];
        }
    }

    vector<int> erase_row;
    vector<int> erase_col;
    for (int row = 0; row < h; row++) {
        bool is_erase = true;
        for(int col = 0; col < w; col++) {
            if (a[row][col] == '#') {
                is_erase = false;
            }
        }
        if (is_erase) {
            erase_row.push_back(row);
        }
    }

    for (int col = 0; col < w; col++) {
        bool is_erase = true;
        for(int row = 0; row < h; row++) {
            if (a[row][col] == '#') {
                is_erase = false;
            }
        }
        if (is_erase) {
            erase_col.push_back(col);
        }
    }

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (is_in(erase_row, i) || is_in(erase_col, j)) {
                continue;
            }
            cout << a[i][j];
        }
        if (!is_in(erase_row, i)) {
            cout << endl;
        }

    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MAX 1001*101

ll N, W, w[105], v[105];
ll K[MAX];

void init()
{
    for(int i = 1; i < MAX; i++)
        K[i] = INT_MAX;
}

void Knapsack()  ///O(item*(item*profit))
{
    ll ans = 0;
    for(int i = 0; i < N; i++)
    {
        for(int j = ans; j>=0; j--)
        {
            if(K[j]+w[i] <= W && K[j+v[i]] > K[j]+w[i])
            {
                K[j+v[i]] = K[j] + w[i];
                ans = max(ans,j+v[i]);
            }
        }
    }

    cout<<ans<<endl;
}

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    init();
    cin>>N>>W;
    for(int i = 0; i < N; i++)
    {
        cin>>w[i]>>v[i];
    }
    Knapsack();
    return 0;
}


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

int main(){
	int tx, ty;
	double x = 0, y = 0;
	double r, t, ts=0, rad;
	double pi = 3.141592653589793;
	char k;
	rad = pi / 2;
	ts = 90;
	while(1){
		cin >> r >> k >> t;
		if(r == 0 && t == 0){
			break;
		}
		x = x + r*cos(rad);
		y = y + r*sin(rad);
		ts = ts - t;
		rad = ts * pi / 180;
	}
	tx = int(x/1);
	ty = int(y/1);
	cout << tx << endl << ty << endl;

	return 0;
}

Measured memory_bytes: 1228
#include<bits/stdc++.h>
using namespace std;
const int mod=998244353;
typedef long long ll;
ll ksm(ll x,ll k){ll re=1;for(;k;k>>=1,x=x*x%mod)if(k&1)re=re*x%mod;return re;}
int pls(int x,int y){return x+y>=mod?x+y-mod:x+y;}
int mns(int x,int y){return x-y<0?x-y+mod:x-y;}
const int N=310,K=45010;
int n,a[N],s;
int dp[2][K],cnt[2][K],ret;
int main(){
	//freopen("a.in","r",stdin);
	scanf("%d",&n);for(int i=1;i<=n;i++)scanf("%d",&a[i]),s+=a[i];
	s/=2;
	int nw=0;
	dp[0][0]=cnt[0][0]=1;
	for(int i=1;i<=n;i++){
		nw^=1;
		for(int j=s;j>=a[i];j--) dp[nw][j]=pls(dp[nw^1][j],pls(dp[nw^1][j-a[i]],dp[nw^1][j-a[i]])),cnt[nw][j]=pls(cnt[nw^1][j],cnt[nw^1][j-a[i]]);
		for(int j=a[i]-1;~j;j--)dp[nw][j]=dp[nw^1][j],cnt[nw][j]=cnt[nw^1][j];
	}
	for(int i=1;i<=s;i++)ret=pls(ret,mns(dp[nw][i],pls(cnt[nw][i],cnt[nw][i])));
	ret=(ksm(3,n)-3*ksm(2,n)+3-(ll)ret*3)%mod;ret=(ret+mod)%mod;
	printf("%d\n",ret);
}


Measured memory_bytes: 896
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define FOR(i,a,b) for (int i=(a),for_##i##_max=(b);i<=(for_##i##_max);++i)
#define RFOR(i,a,b) for (int i=(a),rfor_##i##_min=(b);i>=(rfor_##i##_min);--i)
#define REP(i,n) for (int i=0,rep_##i##_len=(n);i<(rep_##i##_len);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

namespace { // Basics

template<typename T>
void chmin(T &x, T y) {
  x = std::min(x, y);
}

template<typename T>
void chmax(T &x, T y) {
  x = std::max(x, y);
}

template<typename T>
__attribute__((unused))
const auto minimum = static_cast<T const &(*)(T const &, T const &)>(std::min);

template<typename T>
__attribute__((unused))
const auto maximum = static_cast<T const &(*)(T const &, T const &)>(std::max);

template<typename T>
__attribute__((unused))
T constexpr infty = std::numeric_limits<T>::max / 3;
template<>
__attribute__((unused))
auto constexpr infty<int> = 1'100'100'100;
template<>
__attribute__((unused))
auto constexpr infty<long long int> = 100'500'400'300'200'100LL;

using lli = long long int;
using ld = long double;

} // namespace

using namespace std;

int main() {
  // cout << fixed << setprecision(10);

  string S; cin >> S;
  S[3] = '8';
  cout << S << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
struct node
{
    int x;
    int y;
    int v1;
    int v2;
}a[200100];
bool cmp1(node a,node b)
{
    return a.v1<b.v1;
}
bool cmp2(node a,node b)
{
    return a.v2<b.v2;
}
void solve(int T)
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d %d",&a[i].x,&a[i].y);
        a[i].v1=a[i].x-a[i].y;
        a[i].v2=a[i].x+a[i].y;
    }
    sort(a+1,a+n+1,cmp1);
    int ans=abs(a[1].v1-a[n].v1);
    sort(a+1,a+n+1,cmp2);
    ans = max(ans,abs(a[1].v2-a[n].v2));
    cout << ans;
}



signed main()
{
    int t=1;
    //scanf("%d",&t);
    for(int i=1;i<=t;i++)
    {
        solve(i);
    }
    return 0;
}

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

int main()
{
   ios::sync_with_stdio(false), cin.tie(0);
   int N;
   int a[102];

   cin >> N;
   for(int i=0; i<N; ++i)cin >> a[i];

   int cnt = 0;

   for(int i=0; i < N; ++i){
      int minj = i;
      for(int j = i+1; j < N; ++j){
         if(a[j] < a[minj])minj = j;
      }
      if(i != minj){
         int t = a[i];
         a[i] = a[minj];
         a[minj] = t;
         ++cnt;
      }
   }
   for(int i=0; i<N; ++i)
      cout << a[i] << (i+1 < N ? ' ' : '\n');
   cout << cnt << endl;
}



Measured memory_bytes: 3156
#include <bits/stdc++.h>
#include <set>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

#define INF 100000000
#define MOD 100000007

#define writeln(n) cout<<n<<endl

using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
//vector<tuple<long long, long long, long long>>vec;

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;
}

llong pownew(llong m, llong n) {
    if (n == 0) { return 1; }
    if (n % 2 == 0) { return pow(m*m, n/2); }
    return pow(m, n-1) * m;
}

bool isprime(int p) {
    if (p == 1) return false;
    for (int i = 2; i < p; i++) {
        if (p%i == 0) return false;
    }
    return true;
}

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

const int inf=100000000;

long long modpow(long long a, long long n, long long mod) //a^n
{
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int gcd(int a, int b) {
    return b != 0 ? gcd(b, a % b) : a;
}
//setprecision(10);



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

    llong n,c,k; cin>>n>>c>>k;
    vector<llong> t(n,0);
    REP(i,n) cin>>t[i];
    llong ans=0;
    sort(t.begin(),t.end());

    for(int i=0; i<n;)
    {
        ++ans;
        int cnt=i;
        while (i<n&&t[i]-t[cnt]<=k&&i-cnt<c)
        {
            ++i;
        }
    }
    cout<<ans<<endl;
    return  0;
}


Measured memory_bytes: 1152
def pcount(n,p):
    #count degree of p in factorization of n!
    count = 0
    temp = p
    while temp <= n:
        count += n/temp
        temp *= p
    return count

n = int(raw_input())
if n%2 == 1:
  print 0
else:
  print pcount(n/2, 5)

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

using namespace std;

int getSum(int a, int b) {
    int sum = 0;
    while(a) {
        sum += a % 10;
        a /= 10;
    }
    while(b) {
        sum += b % 10;
        b /= 10;
    }
    return sum;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    int a = 1;
    int b = n - a;
    int ans = getSum(a, b);
    while(a < n) {
        int chk = getSum(a, b);
        ans = min(ans, chk);
        a ++;
        b = n - a;
    }
    cout << ans << '\n';
    return 0;
}

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

using namespace std;

const int md = 1e9 + 7;
const int mxn = 2e5;

int fc[mxn + 11];

void init(){
    fc[0] = 1;
    for (int i = 1; i <= mxn; i++){
        fc[i] = fc[i - 1] * 1LL * i % md;
    }
}

int pw(int a, int n){
    int ans = 1;
    while (n > 0){
        if (n & 1)
            ans = ans * 1LL * a % md;
        a = a * 1LL * a % md;
        n >>= 1;
    }
    return ans;
}

int f(int X, int Y){
        int Z = X + Y;
        int res = fc[Z];
        res = res * 1LL * pw(fc[X], md - 2) % md;
        res = res * 1LL * pw(fc[Y], md - 2) % md;
    return res;

}

int main(){
    init();
    int H, W, A, B;
    scanf("%d %d %d %d", &H, &W, &A, &B);
    int ans = 0;
    for (int i = B + 1; i <= W; i++){
        ans += f(H - A - 1, i - 1) * 1LL * f(A - 1, W - i) % md;
        ans %= md;
    }
    printf("%d\n", ans);
}


Measured memory_bytes: 1024
import java.util.*;
	import java.util.Map.Entry;
	 
	 
	 class Main {
		 static int mod =  (int) (Math.pow(10,9)+7);
//		 static int mod =  (int) 998244353;
		 static List<ArrayList<Integer>>  list = new ArrayList<ArrayList<Integer>>();
	    public static void main(String[] args) {
	    	
	        Scanner sc = new Scanner(System.in);
	        int N = sc.nextInt();	
	        long[] a = new long[N];
	        for (int i=0 ; i<N; i++) {
	            a[i] = Long.parseLong(sc.next());
	        }
	        long ans=1;
	        int[] m = new int[3];
	        for(int i=0;i<N;i++) {
	        	int tmp =0;
	        	for(int j=0;j<3;j++) {
	        		if(m[j]==a[i])tmp++;
	        	}
	        	for(int j=0;j<3;j++) {
	        		if(m[j]==a[i]) {
	        			m[j]++;
	        			break;
	        		}
	        	}
	        	ans=(ans*tmp)%mod;
	        }
	        
	        
	        System.out.println(ans);
	        

	    }
	    
	    

	}

Measured memory_bytes: 48136
#include<bits/stdc++.h>
#define int long long
using namespace std;

signed main(){
    int N; cin>>N;
    string s; cin>>s;

    vector<vector<int>> dp(N+1,vector<int>(N+1));
    for(int i=N-2;i>=0;i--){
        for(int j=i+1;j<N;j++){
            if(s[i]==s[j]){
                dp[i][j]=dp[i+1][j+1]+1;
            }
        }
    }
    int ans=0;
    for(int i=0;i<N-1;i++){
        for(int j=i+1;j<N;j++){
            int len=min(j-i,dp[i][j]);
            ans=max(ans,len);
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 195840
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using db = double;
using pii = pair < int, int >;
using pll = pair < ll, ll >;
const int N = 2e5 + 10;
const ll inf = 1e15 + 42;
#define endl "\n"
const ll mod = 1000000007;
 
void testCase() {
    int n;
    cin >> n;
    while (n) {
        if (n%10 == 7) {
            cout << "Yes" << endl;
            return;
        }
        n = n / 10;
    }
    cout << "No" << endl;
}
 
int main() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    testCase();
    return 0;
}

Measured memory_bytes: 3608
function Main(input) {
  input = input.split("\n");
  const nums = input[0].split(" ");
  const N = parseInt(nums[0]);
  const D = parseInt(nums[1]);

  let answer = 0;

  for (let i = 1; i < N + 1; i++){
    let xy = input[i].split(" ");
    let x = parseInt(xy[0]);
    let y = parseInt(xy[1]);
    if (Math.sqrt(x * x + y * y) <= D) {
      answer++;
    }
  }

  console.log(answer);

}
// デバッグ用
function debug() {
  var input = document.getElementById("input").value;
  Main(input);
}

//* この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 62644
def ispalindrome(s): return True if s == s[::-1] else False

s = input()

ans = "No"

upper_s = s[:int((len(s)-1)/2)]
lower_s = s[int((len(s)+3)/2)-1:]

if ispalindrome(s) and ispalindrome(upper_s) and ispalindrome(lower_s):
    ans = "Yes"
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define LL long long int
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略

int main(){
  int n, k;
  cin >> n >> k;
  vector<int> d(101);
  vector<int> a(101);
  int cnt[n+1] = {}; 
  for(int i = 0; i < k; i++){
    cin >> d.at(i);
    for(int j = 0; j < d[i]; j++){
      cin >> a.at(i);
      cnt[a[i]]++;
    }
  }
  int ans = 0;
  for(int i = 1; i <= n; i++){
    if(cnt[i] == 0){
      ans++;
    }
  }
  cout << ans;
}

Measured memory_bytes: 3628
import collections
n = int(input())
si = []
for i in range(n):
    si.append(input())

ss = collections.Counter(si)
n_ma = max(ss.values())
ans = []
for i in ss.keys():
    if ss[i] == n_ma:
        ans.append(i)
ans.sort()
for i in range(len(ans)):
    print(ans[i])



Measured memory_bytes: 100432
#include <iostream>

using namespace std;

int main(){
	
	int n, m;
	
	cin >> n >> m;
	
	for (int i=0; i<m; i++) {
		int num;
		cin >> num;
		n-= num;
	} 
	
	if (n<0) {
		cout << -1 << endl;
	} else {
		cout << n << endl;
	}
	
	return 0;
	
}

Measured memory_bytes: 3624
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func main() {
	a, _ := strconv.Atoi(read())

	for i := a; i < 1000; i++ {
		switch i {
		case 111:
			fmt.Println(111)
			return
		case 222:
			fmt.Println(222)
			return
		case 333:
			fmt.Println(333)
			return
		case 444:
			fmt.Println(444)
			return
		case 555:
			fmt.Println(555)
			return
		case 666:
			fmt.Println(666)
			return
		case 777:
			fmt.Println(777)
			return
		case 888:
			fmt.Println(888)
			return
		case 999:
			fmt.Println(999)
			return
		}
	}
}


Measured memory_bytes: 640
#include<cstdio>
#include<vector>
using namespace std;
vector<int> ans; 
int main()
{
	long long n;int i,j;
	scanf("%lld",&n);++n;
	for(i=50;i--;)if(n&(1LL<<i))break;
	for(j=1;j<=i;++j)ans.push_back(j);
	for(j=1;j<=i;++j)ans.push_back(j);
	for(j=i;j--;)if(n&(1LL<<j))ans.insert(ans.begin()+i,50+j);
	for(j=0;j<i;++j)if(n&(1LL<<j))ans.insert(ans.begin()+i-j,50+j);
	printf("%d\n",ans.size());
	for(i=0;i<ans.size();++i)printf("%d ",ans[i]);
}

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

int c;
void calc(int n){
  if (n % 2 ==0){
  c++;
  calc(n/2);
  }
}

int main() {
  int n;
  scanf("%d",&n);

  int a;
  int max = 0;
  for(int i=0;i<n;i++){
    scanf("%d",&a); 
    calc(a);
  }
  cout << c;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <utility>
#include <algorithm>
#include <math.h>

using namespace std;

#define ll long long

int main(){
    int K, X, min = -1000000, max = 1000000;
    cin >> K >> X;
    if(X - K + 1 > min)min = X - K + 1;
    if(X + K - 1 < max)max = X + K - 1;
    for(int i = min; i <= max; i++)cout << i << " ";
    return 0;
}


Measured memory_bytes: 256
num_input = input()
listA_input = input().split(" ")
listB_input = input().split(" ")
N = int(num_input)
allkenemies = 0
A = []
B = []
for n_A in listA_input:
  A.append(int(n_A))
for n_B in listB_input:
  B.append(int(n_B))
for num in range(0,N):
  kenemies = min(A[num],B[num])
  allkenemies += kenemies
  A[num] -= kenemies
  B[num] -= kenemies
  kenemies = min(A[num+1],B[num])
  allkenemies += kenemies
  A[num+1] -= kenemies
print(allkenemies)

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

int main(void){
    
    int a, b;
    cin >> a >> b;
    
    string str_A, str_B;
    
    for(int i = 0; i < b; i++){
        str_A.push_back('0' + a);
    }

    for(int i = 0; i < a; i++){
        str_B.push_back('0' + b);
    }
    
    if(str_A < str_B){
        cout << str_A << endl;
    }
    else{
        cout << str_B << endl;
    }
    
}


Measured memory_bytes: 256
#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 <cstdlib>
#define rep(i,n) for(int i = 0;i<(n);i++);
#define all(a) (a).begin(),(a).end()
using namespace std;
using ld = long double;
using ll = long long;
const ll INF = 100100100100100;

int main() {//10000 5000 1000
	ll N, Y;
	cin >> N >> Y;
	bool yes = false;
	bool ok = false;
	for (ll a = 0; a <= N; a++) {
		for (ll b = 0; b <= N - a; b++) {
			if (a * 10000 + b * 5000 + (N - a - b) * 1000 == Y) {
				cout << a << " " << b << " " << (N - a - b) << endl;
				yes = true;
				ok = true;
				break;
			}
		}
		if (yes) break;
	}
	if (ok == false) cout << "-1 -1 -1" << endl;
}

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


int main()
{


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



	ans = a * x + b * y;

	for (int i = 2;i <= 2 * max(x, y);i+=2) {
	
		int money;



		money = a * max(x - i / 2, 0) + b * max(y - i / 2, 0) + c * i;
		ans = min(ans, money);

	}

	cout << ans << endl;
}

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

signed main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  
  int h1,m1,h2,m2,k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  int sum1 = h1*60+m1;
  int sum2 = h2*60+m2;
  int ans = (sum2-sum1)-k;

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




Measured memory_bytes: 3640
#include<stdio.h>
int main(void) {
	int x, y, i;
	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	scanf("%d%d%d", &x, &y,&i);
	if (x <  y&& y < i) {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}







	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	return 0;
}


Measured memory_bytes: 2044
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <math.h>
#include <set>
#include <deque>
#include <queue>
#include <list>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
	int n[3], a, b, c;
	cin >> a >> b >> c;
	n[0] = a;
	n[1] = b;
	n[2] = c;
	sort(n, n + 3);
	int x = n[2] - n[1] + (n[1] - n[0]) / 2;
    if ((n[1] - n[0]) % 2 == 0) cout << x;
    else cout << x + 2;
}
/*
*/

Measured memory_bytes: 3620
#include<iostream>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<string>
using namespace std;
long long a[100010],b[100010],x[100010],v[100010];

int main()
{
//	cout<<a[0]<<" "<<b[0];
	long long n,c;
	cin>>n>>c;
	cin>>x[1]>>v[1];
	a[1]=v[1]-x[1];
	for(int i=2;i<=n;i++){
		cin>>x[i]>>v[i];
		a[i]=a[i-1]-x[i]+v[i]+x[i-1];
	}
	b[1]=v[n]-(c-x[n]);
	for(int i=2;i<=n;i++){
		b[i]=b[i-1]-(c-x[n-i+1])+v[n-i+1]+(c-x[n-i+2]);
	}
	long long ans=0;
	for(int i=2;i<=n;i++){
		a[i]=max(a[i-1],a[i]);
		b[i]=max(b[i-1],b[i]);
		ans=max(ans,max(a[i],b[i]));
	}
        ans=max(ans,max( a[n],b[n]) ) ;
	long long ans1=0,ans2=0;
	for(int i=1;i<=n;i++){
		
		ans1=max(ans1, a[i]-x[i]+b[n-i] );
		ans2=max(ans2, b[i]-(c-x[n-i+1])+a[n-i] );
	}
	cout<<max( ans, max(ans1,ans2) )<<endl;
}

Measured memory_bytes: 3328
#include <iostream>
#include <vector>
using namespace std;
 
int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    int mod = 1000000007;
    long long sum = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
        sum += A[i];
        sum %= mod;
    }
 
    long ans = 0;
 
    //i について全探索する
    for (int i = 0; i < N; i++)
    {
        //A[i+1] ... A[N] の値を更新する
        sum -= A[i];
        if (sum < 0) sum += mod;
 
        ans += A[i] * sum;
        ans %= mod;
    }
 
    cout << ans%mod << endl;
}

Measured memory_bytes: 4024
D = int(input())
c = list(map(int, input().split()))

s = []
for _ in range(D):
    s.append(list(map(int, input().split())))

t = []
for _ in range(D):
    t.append(int(input()))

# last(d, i)を計算するためのメモ
dp = [0] * 26


def dec(d):
    # d日の終わりに起こる満足度の減少計算の関数
    s = 0
    for j in range(26):
        s += c[j] * (d - dp[j])

    return s


# vは満足度
v = 0
for i in range(D):
    # 初日の満足度
    if (i == 0):
        v += s[i][t[i] - 1]
        # 開催されたコンテストの日付をメモ
        dp[t[i] - 1] = (i + 1)
        v -= dec(i + 1)
        print(v)
        continue

    # elif (0 < i and i < D - 1):
    v += s[i][t[i] - 1]
    dp[t[i] - 1] = (i + 1)
    v -= dec(i + 1)
    print(v)


Measured memory_bytes: 9328
#include<bits/stdc++.h>
using namespace std;
const int N=2e6+5,mod=1e9+7;
char O[1<<14],*S=O,*T=O;
#define gc (S==T&&(T=(S=O)+fread(O,1,1<<14,stdin),S==T)?-1:*S++)
inline int read(){
	int x=0,f=1; char ch=gc;
	while(ch<'0' || ch>'9'){if(ch=='-')f=-1; ch=gc;}
	while(ch>='0' && ch<='9'){x=(x<<1)+(x<<3)+(ch^48); ch=gc;}
	return x*f;
}
int x[7],y[7],jc[N],jy[N],ans;
inline int C(int x,int y){return 1ll*jc[x+y]*jy[x]%mod*jy[y]%mod;}
inline int F(int x1,int y1,int x2,int y2){
	return (1ll*C(x2+1,y2+1)+C(x1,y1)-C(x2+1,y1)-C(x1,y2+1)+mod+mod)%mod;
}
int main(){
	for(int i=1;i<7;++i) x[i]=read();
	for(int i=1;i<7;++i) y[i]=read();
	jc[0]=jy[0]=jc[1]=jy[1]=1;
	for(int i=2;i<=N-5;++i) jc[i]=1ll*jc[i-1]*i%mod,jy[i]=1ll*(mod-mod/i)*jy[mod%i]%mod;
	for(int i=2;i<=N-5;++i) jy[i]=1ll*jy[i-1]*jy[i]%mod;
	
	for(int i=x[3];i<=x[4];++i)
		ans=(1ll*(mod-y[3]-i)*F(i-x[2],y[3]-1-y[2],i-x[1],y[3]-1-y[1])%mod*F(x[5]-i,y[5]-y[3],x[6]-i,y[6]-y[3])+ans)%mod;
	for(int i=x[3];i<=x[4];++i)
		ans=(1ll*(y[4]+i+1)*F(i-x[2],y[4]-y[2],i-x[1],y[4]-y[1])%mod*F(x[5]-i,y[5]-1-y[4],x[6]-i,y[6]-1-y[4])+ans)%mod;
	for(int i=y[3];i<=y[4];++i)
		ans=(1ll*(mod-x[3]-i)*F(x[3]-1-x[2],i-y[2],x[3]-1-x[1],i-y[1])%mod*F(x[5]-x[3],y[5]-i,x[6]-x[3],y[6]-i)+ans)%mod;
	for(int i=y[3];i<=y[4];++i)
		ans=(1ll*(x[4]+i+1)*F(x[4]-x[2],i-y[2],x[4]-x[1],i-y[1])%mod*F(x[5]-1-x[4],y[5]-i,x[6]-1-x[4],y[6]-i)+ans)%mod;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 16000
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#include <math.h>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
//No change above here

const ll maxi = 2 * 1e5 + 5;
ll mod = 5;
double pi = 3.141592653589793238;

//function for power
ll power(ll x, ll n) {
	ll res = 1;
	x %= mod;
	while (n) {
		if (n & 1)
			res = (res * x) % mod;
		x = (x * x) % mod;
		n >>= 1;
	}
	return res;
}

ll sum_digits(ll n)
{
	ll ret = 0;
	while (n)
	{
		ret += n % 10;
		n /= 10;
	}
	return ret;
}

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

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

ll max_subarray(vector<int>& v)
{
	if (v.empty())
		return 0;
	ll glob = v[0], loc = v[0];
	for (int i = 1; i < v.size(); ++i)
	{
		loc = max(v[i] + 0LL, loc + v[i]);
		glob = max(loc, glob);
	}
	return glob;
}

long long num_digits(long long x)
{
	long long ans = 0;
	while (x)
	{
		++ans;
		x /= 10;
	}
	return ans == 0 ? 1 : ans;
}

vector<int> topological_sort(vector<vector<int>>& graph, int n, vector<int>& indegree)
{
	vector<int> ans;
	stack<int> s;
	for (int i = 0; i < n; ++i)
		if (indegree[i] == 0)
			s.push(i);
	while (!s.empty())
	{
		int x = s.top();
		s.pop();
		ans.push_back(x);
		for (auto& adj : graph[x])
			if (--indegree[adj] == 0)
				s.push(adj);
	}
	return ans;
}

ll dir[4][2] = { {1, 0}, {-1, 0}, {0, 1}, {0, -1} };

ll p, q;
bool valid(ll i, ll j) { return i >= 1 && i <= p && j >= 1 && j <= q; }


//declare needed things here


int main()
{
	IOS;
	ll k,x=7,c=1;
	cin >> k;
	bool found = false;
	while (c <= k)
	{
		if (x % k == 0)
		{
			found = true;
			break;
		}
		x = (x  * 10 + 7)%k;
		++c;
	}
	if (found)
		cout << c << endl;
	else
		cout << "-1" << endl;
	return 0;
}


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

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

  return gcd(b, a%b);
}

ll lcm(ll a,  ll b){
  ll gc = gcd(a, b);

  return a * b / gc;
}

int main(){
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  a--;
  ll lc  = lcm(c, d);
  ll co_c = (b / c) - (a / c);
  ll co_d = (b / d) - (a / d);
  ll co_lc = (b / lc) - (a / lc);
  cout << b - a - (co_c + co_d - co_lc) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define ll long long
#define pb push_back
#define pi pair<int,int>
#define pii pair<pi,int>
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
bool pr(int x)
{
    if(x<2)
        return 0;
    for(int i=2;i*i<=x;i++)
        if(x%i==0)
        return 0;
    return 1;
}
int main()
{
    go;
    string x,y;
    cin>>x>>y;
    y+=x;
    cout<<y;
    return 0;
}


Measured memory_bytes: 256