akhauriyash/Code-Regression huggingface dataset:
#include <fstream>
#include <iostream>
#include <algorithm>
#define nmax 100005
#define valmax 1000000000
using namespace std;
struct sushi{
    long long val;
    long long pos;
} v[nmax];

int compare(const sushi &a, const sushi &b)
{
    return a.pos < b.pos;
}
long long m, st[nmax], dr[nmax];
int n;

int main()
{
    int i, j;
    cin >> n;
    cin >> m;
    for (i = 1; i <= n ; i++) {
        cin >> v[i].pos;
        cin >> v[i].val;
    }
    sort(v + 1, v + n + 1, compare);

    long long ans = 0, tot = 0;

    for (i = 1; i<= n ; i++) {
        tot += v[i].val;
        ans = max(ans, tot - v[i].pos);
    }
    tot = 0 ;
    for (i = n; i >= 1 ; i--) {
        tot += v[i].val;
        ans = max(ans, tot - (m - v[i].pos));
    }
    tot = 0;

    for (i = 1 ; i <= n ; i++) {
        tot += v[i].val;
        st[i] = tot;
    }
    for (i = 1 ; i <= n ; i++) {
        st[i] -= v[i].pos;
        /*if (st[i] < n * valmax)
            st[i] = n * valmax;*/

        st[i] = max(st[i-1], st[i]);
    }

    tot = 0 ;
    for (i = n ; i >= 1 ; i--) {
        tot += v[i].val;
        dr[i]= tot;
    }
    for (i = n; i >= 1 ; i--) {
        dr[i] -= (m - v[i].pos);

        /*if (dr[i] < n * valmax)
            dr[i] = n * valmax;*/

        dr[i] =  max(dr[i+1], dr[i]);
    }

    for (i = 1; i <= n; i++)
        ans = max(ans, st[i] - v[i].pos + dr[i + 1]);
    for (i = 1; i <= n; i++)
        ans = max(ans, dr[i] - (m - v[i].pos) + st[i -1]);

    cout<<ans<<'\n';

    return 0;
}

Measured memory_bytes: 3328
#include <iostream>
using namespace std;
int main()
{
	int i,i2,ts,ss,head,f=0,tf;
	char t[100],s[100];
	cin>>s>>t;
	for(i=0;i<t[i]!='\0';ts=i,i++);
	for(i=0;i<s[i]!='\0';ss=i,i++);
	for(i=ss-ts;i>-1;i--)
	{
		tf=0;
		for(i2=0;i2<=ts;i2++)
		{
			if(s[i+i2]!='?'&&t[i2]!=s[i+i2])tf=1;
		}
		if(tf==0)
		{
			f=1;
			head=i;
			break;
		}
	}
	if(f)
	{	
		for(i=0;i<head;i++)
		{
			if(s[i]=='?')cout << 'a';
			else cout << s[i];
		}
		for(i=0;i<=ts;i++)cout << t[i];
		for(i=head+ts+1;i<=ss;i++)
		{
			if(s[i]=='?')cout << 'a';
			else cout << s[i];
		}
		cout << "\n";
	}
	else
	cout << "UNRESTORABLE\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IOS                                                                    \
  ios::sync_with_stdio(0);                                                     \
  cin.tie(0);                                                                  \
  cout.tie(0)
#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<ll, ll>;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
ll bpow(ll b, ll p, ll m = 1000000007LL) {
  ll rt = 1;
  for (; p; p >>= 1, b = b * b % m)
    if (p & 1)
      rt = rt * b % m;
  return rt;
}
ll n, k;
ll a[200005];
bool check(ll mi) {
  ll cnt = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] > mi)
      cnt += a[i] / mi;
  }
  return cnt <= k;
}
int main() {
  IOS;
  cin >> n >> k;
  for (int i = 0; i < n; i++)
    cin >> a[i];
  ll lo = 1, hi = 1000000000;
  while (lo <= hi) {
    ll mi = lo + hi >> 1;
    if (check(mi))
      hi = mi - 1;
    else
      lo = mi + 1;
  }
  cout << lo << endl;
}


Measured memory_bytes: 5100
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
ans=0
dist=1000
for i in range(n):
  d=abs(t-h[i]*0.006-a)
  if d<=dist:
    dist=d
    ans=i+1
print(ans)


Measured memory_bytes: 3060
#include <stdio.h>
#include <string.h>

int N;
char S[101];
char T[101];

int main() {
    scanf("%s", S);
    N = strlen(S);
    for (int i = 0; i < N; i++) {
        for (int j = i; j <= N; j++) {
            int t = 0;
            for (int k = 0; k < N; k++) {
                if (k < i || k >= j) {
                    T[t++] = S[k];
                }
            }
            T[t++] = 0;
            if (strcmp(T, "keyence") == 0) {
                puts("YES");
                return 0;
            }
        }
    }
    puts("NO");
    return 0;
}


Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;

namespace V1172{
    public class Program{
        public static void Main(string[] args){
            var sr = new StreamReader();
            //---------------------------------
            var primes = Prime.Sieve(300000).ToArray();

            while(true){
                var N = sr.Next<int>();
                if(N == 0) break;

                var left = Array.BinarySearch(primes, N);
                if(left < 0) left = ~left;
                else left++;

                var right = Array.BinarySearch(primes, 2 * N);
                if(right < 0) right = ~right;
                else right++;

                Console.WriteLine(right - left);
            }
            //---------------------------------
        }
    }

    public class Prime{
        public static bool Is(int n){
            for(var i = 2; i * i <= n; i++) if(n % i == 0) return false;
            return n > 1;
        }

        public static IEnumerable<int> Sieve(int n){
            var sieve = new bool[n + 1];
            for(var i = 2; i <= n; i++){
                if(!sieve[i]){
                    yield return i;
                    for(var j = i << 1; j <= n; j += i) sieve[j] = true;
                }
            }
        }
    }

    public class StreamReader{
        private readonly char[] _c = {' '};
        private int _index = -1;
        private string[] _input = new string[0];
        private readonly System.IO.StreamReader _sr = new System.IO.StreamReader(Console.OpenStandardInput());

        public T Next<T>(){
            if(_index == _input.Length - 1){
                _index = -1;
                while(true){
                    string rl = _sr.ReadLine();
                    if(rl == null){
                        if(typeof(T).IsClass) return default(T);
                        return (T)typeof(T).GetField("MinValue").GetValue(null);
                    }
                    if(rl != ""){
                        _input = rl.Split(_c, StringSplitOptions.RemoveEmptyEntries);
                        break;
                    }
                }
            }
            return (T)Convert.ChangeType(_input[++_index], typeof(T), System.Globalization.CultureInfo.InvariantCulture);
        }
    }
}

Measured memory_bytes: 10976
#include<iostream>
#include<cstdio>

using namespace std;
#define _for(i,a,b) for(int i = (a); i < (b); i++)
#define _rep(i,a,b) for(int i = (a); i <= (b); i++)

int main(){
    int a,b;
    cin >> a>> b;
    if(a >9 || b > 9) cout << "-1\n";
    else cout << a*b <<endl;
    return 0;
}

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

void output(int A[], int N, int W){

    for (int i=0; i<N; i++){
        if (i==N-1)
        {
            cout << A[i] << endl;
            cout << W << endl;
        }
        else
        {
            cout << A[i] << flush;
            cout << " " << flush;
        }
    }
}

int trace(int A[],int N){

    int j,V,W;
    
    j=0;
    W=0;
    while (j!=N-1){
          for (int i=N-1; i>j; i--){
              if (A[i-1]>A[i]){
                  V=A[i];
                  A[i]=A[i-1];
                  A[i-1]=V;
                  W++;
              }
          }
          j++;
    }
    return W;
}

int main() {
    
    int N,W;
    int A[100];
    
    cin >> N;
    
    for (int i=0; i<N; i++){
        cin >> A[i];
    }
    
    W=trace(A, N);
    output(A, N, W);
    
    return 0;
}


Measured memory_bytes: 3108
#include<bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

template<class Ty>
using passive_queue = priority_queue<Ty, vector<Ty>, greater<Ty>>;

struct Problem {

	void Solve() {
		UL X, Y; cin >> X >> Y;
		UL A, B; cin >> A >> B;
		UL C; cin >> C;
		vector<pair<UL, UL>> V;
		rep(i, A) { UL d; cin >> d; V.push_back({ d, 0 }); }
		rep(i, B) { UL d; cin >> d; V.push_back({ d, 1 }); }
		rep(i, C) { UL d; cin >> d; V.push_back({ d, 2 }); }
		sort(V.rbegin(), V.rend());
		UL z = 0;
		ULL S = 0;
		UL i = 0;
		rep(i, V.size()) {
			if (z >= X + Y) break;
			if (V[i].second == 0) {
				if (X) { S += V[i].first; X--; }
			}
			else if (V[i].second == 1) {
				if (Y) { S += V[i].first; Y--; }
			}
			else if (V[i].second == 2) {
				z++; S += V[i].first;
			}
		}
		cout << S << endl;
	}

	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}


Measured memory_bytes: 6512
#include<iostream>
#include <stdlib.h>
#include <algorithm>
#include <string>
#include <vector>
#include <numeric>
#include <map>

typedef long long int ll;
using namespace std;
int main() {
	int N,M,x,y,z,count=1,num=1,flag=0;
	cin >> N >> M;
	vector <int> A(N,0);
	vector <int> B(M,0);
	vector <int> C(M,0);
	vector <int> D(M,0);
	vector <int> E(M,0);
	for(int i=0;i<N;i++){
		cin>>x;
		A[i]=x;
	}
	sort(A.begin(),A.end());
	for(int i=0;i<M;i++){
		cin >> y>>z;
		B[i]=y;
		C[i]=z;
		D[i]=z;
	}
	sort(D.begin(),D.end());
	for(int i=M-1;i>=0;i--){
		for(int j=0;j<D.size();j++){
			if(D[i]==C[j]){
				for(int k=flag;k<flag+B[j];k++){
					if(C[j]>A[k]){
						
						A[k]=C[j];
					}else{
						cout << accumulate(A.begin(),A.end(),0LL)<<endl;
						return 0;
					}
				}
				flag+=B[j];
				if(flag>0){
				C[j]=-1;
				break;
				}
			}
		}
	}
	
	cout << accumulate(A.begin(),A.end(),0LL)<<endl;
	return 0;
}

Measured memory_bytes: 2176
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define rep(i, a, b) for (int i=a; i<(b); i++)
#define rp(i, a) for (int i=0; i<(a); i++)
#define repd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define rpd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(9);
    cout << std::fixed;

    ll h,w;
    cin >> h >> w;
    char a[h][w];
    rp(i,h) rp(j,w) cin >> a[i][j];

    rp(i,w+2){
        cout <<"#";
    }
    cout <<endl;
    rp(i,h){
        cout << "#";
        rp(j,w){
            cout <<a[i][j];
        }
        cout << "#"<<endl;
    }
    rp(i,w+2){
        cout <<"#";
    }
    cout << endl;

    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
const int INF = 0x3f3f3f3f, N = 2e5 + 5;
const ll LINF = 1e18 + 5;
int n, m, a[N];
int main()
{
 	ios::sync_with_stdio(false);
 	cin.tie(0);
 	cin >> n >> m;
 	for(int i=1; i<=n; i++) cin >> a[i];
 	priority_queue <int, vector<int>, greater<int>> pq;
 	for(int i=1; i<=n; i++) pq.push(a[i]);
 	vector <pii> op(m);
 	for(auto &it : op) cin >> it.second >> it.first;
 	sort(all(op));
 	reverse(all(op));
 	for(auto it : op)
 	{
 		bool ok = 1;
 		for(int i=0; i<it.second; i++)
 		{
 			int cur = pq.top(); 
 			if(cur<it.first) 
 			{
 				pq.pop();
 				pq.push(it.first);
 			}
 			else 
 			{
 				ok = 0;
 				break;
 			}
 		}
 		if(!ok) break;
 	}
 	ll sum = 0;
 	while(sz(pq))
 	{
 		sum += pq.top();
 		pq.pop();
 	}
 	cout << sum;
	return 0;
}


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

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define ppb pop_back()
#define ppf pop_front()
#define all(vec) vec.begin(), vec.end()
#define fol(i,a,b) for(int i=a;i<b;i++)
#define loop(i,a,b) for(int i=a;i>=b;i--)
#define forr(x,arr) for(auto& x:arr)
#define mod 1000000007
#define INF 0x3f3f3f3f3f3f3f3f
#define EPS 1e-7
#define sz(x) ((lli)(x).size())
#define endl '\n'

#ifdef SANJU
    #define localsys 1
#else
    #define localsys 0
#endif

using   lli     =   long long;
using   lld     =   long double;
using   ulli    =   unsigned long long int;
using   pll     =   pair<lli, lli>;
using   ttt     =   pair<lli, pll>;
using   vttt    =   vector<ttt>;
using   vll     =   vector<pll>;
using   vl      =   vector<lli>;
using   vi      =   vector<int>;
using   vvi     =   vector<vector<int>>;
using   cd      =   complex<lld>;

long long int cons=1e9+7;

#define min2(a,b)  ((a)<(b)?(a):(b))

void sanjeev(int kkkk)
{
    long long int n,k;
    cin>>n>>k;
    vector<long long int>A;
    A.push_back(0);
    for(long long int i=0;i<n;i++)
    {
        long long int t;
        cin>>t;
        A.push_back(t);
    }

    long long int dp[n+1][k+1]={0};
    for(long long int i=0;i<=A[n];i++)dp[n][i]=1;

    long long int pre[n+1][k+1]={0};
    pre[n][0]=dp[n][0];

    for(long long int i=1;i<=k;i++)pre[n][i]=pre[n][i-1]+dp[n][i];    

    for(long long int i=n-1;i>=1;i--)
    {
        for(long long int j=0;j<=k;j++)
        {
           long long int l=j-min2(j,A[i]);
           long long int r=j;
           if(l==0)
           {
            dp[i][j]+=pre[i+1][r];
            dp[i][j]%=cons;
           }
           else 
           {
            dp[i][j]+=(cons+pre[i+1][r]-pre[i+1][l-1])%cons;
            dp[i][j]%=cons;
           }

           if(j==0)
           {
            pre[i][j]=dp[i][j];
           }
           else
           {
            pre[i][j]=pre[i][j-1]+dp[i][j];
            pre[i][j]%=cons;
           }
        }
    }
    cout<<dp[1][k];    
}

int main()
{
    if(!localsys) ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    cout << fixed << setprecision(10);
    int t=1;
    //cin>>t;
    fol(i,0,t) { sanjeev(i+1); }
    if(localsys) system("pause");
}


Measured memory_bytes: 157184
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <iostream>
#include <cstring>
#include <cstdio>


#define ll long long
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define f(n) for (ll i = 0; i < n; i++)

using namespace std;

int main()
{
	ios_base::sync_with_stdio(0);
	int n;
	cin >> n;
	vll nums(n);
	f(n) cin >> nums[i];
	vll ans(n);
	ll sum = 0;
	ll flag = 1;
	f(n)
	{
		nums[i] *= 2;
		sum += nums[i] * flag;
		flag *= -1;
	}
	ans[0] = sum / 2;
	f(n - 1)
	{
		ans[i + 1] = nums[i] - ans[i];
	}
	f(n) cout << ans[i] << ' ';
	cout << '\n';
}


Measured memory_bytes: 2944
import java.util.Scanner;
 
public class Main {
 public static void main(String[] args){
  Scanner scan = new Scanner(System.in);
   int n=scan.nextInt();
   int i = 1;      
    while(i <= n){
     if(i % 3 == 0){
      System.out.print(" " + i);
     }else{
      int Check=i;          
       while(Check > 0){
        if(Check % 10 == 3){
         System.out.print(" " + i);
         break;
        }
       Check = Check / 10;
       }
     }
      i++;
    }
     System.out.println();
 }
}

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

int main() {
    int x, n;
    cin >> x >> n;
    vector<int> num(102, 0);
    rep(i,n) {
        int p;
        cin >> p;
        num[p]=1;

    }
    int ans, mn = 1e9;
    rep(i,102){
        if(num[i]!=0) continue;
        int d = abs(i-x);
        if(mn > d){
            mn = d;
            ans = i;
        }

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

Measured memory_bytes: 3636
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <bitset>

using namespace std;
typedef pair<int, int> Pi;
typedef long long ll;
#define pii Pi
#define pll PL
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
typedef tuple<int, int, int> t3;
typedef pair<ll, ll> PL;
typedef long double ldouble;

int n, a[300030];

void solve(){
	scanf("%d", &n);
	rep(i, 3*n)scanf("%d", a+i);
	sort(a, a+n*3);
	ll ans = 0;
	for(int i=0;i<n;i++)ans += a[3*n-2*i-2];
	printf("%lld\n", ans);
}

int main(){
	int Tc = 1; // scanf("%d\n", &Tc);
	for(int tc=1;tc<=Tc;tc++){
		solve();
	}
}

Measured memory_bytes: 1408
// 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};
bool comp(pair<ll, ll> a, pair<ll , ll> b) {
    // 基本はfirstで比較
    if(a.first != b.first){
         return a.first < b.first; // 昇順
        //return a.first > b.first; // 降順
    }

    // それ以外はsecondで比較
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        // どちらも同じ
        return true;
    }
}

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>>n>>e;
    vector<pair<ll,ll>> p(n);
    rep(i,n){
        cin>>a>>b;
        p[i]=make_pair(a,b);
    }
    sort(all(p),comp);
    rep(i,n){
        if(p[i].second<=e){
            cout<<p[i].first<<endl;
            return 0;
        }
    }
    cout<<"TLE"<<endl;

    

    return 0;
}


Measured memory_bytes: 3528
n,m,X,Y=map(int,input().split())
x=sorted(list(map(int,input().split())))
y=sorted(list(map(int,input().split())))
ans='War'
for i in range(X+1,Y+1):
    if x[-1]<i and y[0]>=i:
        ans='No War'
        break
print(ans) 


Measured memory_bytes: 3060
#include<iostream>
#include<cmath>
#include<vector>
using namespace std;
const int N = 2e5+5;

typedef long long ll ;
int father[N];
int height[N];
int people[N];

int find(int x)
{
    if (x != father[x])
        father[x] = find(father[x]);

    return father[x];
}

//合并并返回合并后的祖先序号
void Union(int x, int y)
{
    x = find(x);
    y = find(y);

    if (height[x] > height[y])
    {
        father[y] = x;

        //两者祖先相同时，实际没发生合并，只考虑祖先不同的情况
        if (x != y)
            people[x] += people[y];
    }
    else
    {
        father[x] = y;
        
        //两者祖先相同时，实际没发生合并，只考虑祖先不同的情况
        if (x != y)
            people[y] += people[x];

        if (height[x] == height[y]) //树高相同时让父节点的树高值加一
            height[y] += 1;
    }
}




int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,m;
    cin>>n>>m;
    for(int i =1;i<=n;i++)
    {
        father[i]=i;
        height[i]=0;
        people[i]=1;
    }
    for(int i =0;i<m;i++)
    {
        int a,b;
        cin>>a>>b;
        Union(a, b);
    }
    int cnt=1;
    for(int i = 1 ;i<=n;i++)
        if(people[i]>cnt)
            cnt=people[i];
    cout<<cnt;
}


Measured memory_bytes: 5976
#include<bits/stdc++.h>
using namespace std;
int const MAXN = 1e5+9;
int vis[MAXN];
int main(){
    int n,k,q;
    cin >> n >> k >> q;
    for (int i = 0; i < q;i++){
        int x;
        cin >> x;
        vis[x]++;
    }
    for (int i = 0; i < n; i++){
        int score = k - q + vis[i+1];
        if (score > 0) cout << "Yes\n";
        else cout << "No\n";
    }
}


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

using namespace std;
typedef long long ll;
typedef pair <int,int> pa;
const int N = 2e5+100;
bitset<30000>bs[2];
const int M=8005;
int  x,y,z,c=0;
string s;
void solve()
{
   int i;

   cin>>s>>x>>y;
   for(i=0;s[i]=='F';i++);

   bs[0][M+i]=bs[1][M]=1;
   for(;i<=s.size();i++){
         if(s[i] == 'F') c++;
         else bs[z]=(bs[z]<<c) | (bs[z]>>c),z=!z,c=0;
       }
   cout<< (bs[0][x+M] & bs[1][y+M] ?"Yes":"No")<<endl;
}
int main()
{
    ios::sync_with_stdio(0);cin.tie(0);
    solve();
    return 0;
}


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

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    string s;
    cin >> s;

    long long k;
    cin >> k;

    vector <long long> cont;

    int len=1;
    int n = s.size();

    for (int i=0; i<n; i++) {
        if (i==n-1 || s[i] != s[i+1]) {
            cont.push_back(len);
            len = 1;
        } else {
            len++;
        }
    }

    long long ans=0;

    for (auto& ci : cont) {
        ans += (ci/2);
    }

    long long rep = ans + (s[0] == s[n-1] && cont[0]%2 && cont[cont.size()-1]%2);
    ans = ans + (k-1)*rep;

    if (cont.size()==1) {
        ans = (k*cont[0])/2;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
typedef pair<LL, LL> pii;
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { -1,0,1,0 }, dy[4] = { 0,-1,0,1 };
const char dir[4] = { 'u','l','d','r' };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)
# pragma warning(disable:4996)

int n;
pair<int,int> G[30];
int indeg[30];
vector<int> v1, v2, v3;
void preorder(int cur, int prev) {
	v1.emplace_back(cur);
	if(G[cur].first>=0)preorder(G[cur].first,cur);
	if(G[cur].second>=0)preorder(G[cur].second, cur);
}

void inorder(int cur, int prev) {
	if (G[cur].first >= 0)inorder(G[cur].first, cur);
	v2.emplace_back(cur);
	if (G[cur].second >= 0)inorder(G[cur].second, cur);
}

void postorder(int cur, int prev) {
	if (G[cur].first >= 0)postorder(G[cur].first, cur);
	if (G[cur].second >= 0)postorder(G[cur].second, cur);
	v3.emplace_back(cur);
}
int main() {
	cin >> n;
	REP(i, n) {
		int id, l, r;
		cin >> id >> l >> r;
		if (l >= 0)indeg[l]++;
		if (r >= 0)indeg[r]++;
		G[id] = make_pair(l, r);
	}
	int root = -1;
	REP(i, n)if (indeg[i] == 0)root = i;
	cout << "Preorder" << endl;
	preorder(root, -1);
	REP(i, n) {
		cout << " ";
		cout << v1[i];
	}
	cout << endl;
	cout << "Inorder" << endl;
	inorder(root, -1);
	REP(i, n) {
		cout << " ";
		cout << v2[i];
	}
	cout << endl;
	cout << "Postorder" << endl;
	postorder(root, -1);
	REP(i, n) {
		cout << " ";
		cout << v3[i];
	}
	cout << endl;
}


Measured memory_bytes: 3132
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aryssoncf
 */



// Taken from: https://github.com/bqi343/USACO/blob/master/Implementations/content/contest/templateShort.cpp

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ull> vul;
typedef vector<ll> vl;
typedef vector<pii> vpii;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

#define mp make_pair
#define pb push_back
#define f first
#define s second

const int MOD = 1e9+7; // 998244353; // = (119<<23)+1
const int MX = 2e5+5;

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

mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());


//
// Created by aryssoncf on 28/10/2019.
//

#include <type_traits>


#include <iterator>
#include <utility>

template <typename T>
constexpr auto hasBegin(int) -> decltype(std::begin(std::declval<T>()), true) {
    return true;
}

constexpr bool hasBegin(...) {
    return false;
}

template <typename T>
using IsContainer = std::integral_constant<bool, hasBegin<T>(0)>;


#ifndef JHELPER_EXAMPLE_PROJECT_IO_HPP
#define JHELPER_EXAMPLE_PROJECT_IO_HPP

#endif //JHELPER_EXAMPLE_PROJECT_IO_HPP

template<typename T>
std::istream &operator>>(std::istream &is, std::vector<T> &vec) {
    for (T &element: vec) {
        is >> element;
    }
    return is;
}

template<typename T, typename U>
std::istream &operator>>(std::istream &is, std::pair<T, U> &p) {
    is >> p.first;
    is >> p.second;
    return is;
}

template <class X, class Y>
std::ostream & operator << (std::ostream & os, std::pair <X, Y> const& p) {
    return os << p.first << " " << p.second;
}

template <class Ch, class Tr, class Container>
std::basic_ostream <Ch, Tr> & operator << (std::basic_ostream <Ch, Tr>& os, Container const& x) {
    bool first = true;
    for(auto& y : x) {
        if (first) {
            first = false;
        } else {
            os << " ";
        }
        os << y;
    }
    return os;
}

using namespace std;

class ALphabet {
public:
	void solve(std::istream& in, std::ostream& out) {
        char c;
        in >> c;
        char res = isupper(c) ? 'A' : 'a';
        out << res << '\n';
	}

	void setup() {}
};


int main() {
    std::ios_base::sync_with_stdio(false);
	ALphabet solver;
    solver.setup();
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	in.tie(nullptr);
    out << std::fixed;
    out.precision(20);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3604
L, R = map(int, input().split())

new_L = L % 2019
new_R = R % 2019


if R - L >= 2019:
    print(0)
else:
    mi=10**10
    for l in range(new_L,new_R+1):
        for r in range(l+1,new_R+1):
            mod = (l*r) % 2019
            if mod < mi:
                mi=mod
    print(mi)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <iomanip>
#include <stack>
#include <string>
#include <set>
#include <queue>
#include <functional>
#include <deque>

using namespace std;

#define forn(i,n) for(int i = 0; i < n; i++)
#define forr(i,n) for(int i = n-1; i >= 0; i++)
#define ALL(x) x.begin(),x.end()
#define mp(x,y) make_pair(x,y);
#define lson x*2, l, m
#define rson x*2+1, m+1, r

typedef long long int64;
typedef unsigned long long uint64;
typedef pair<int, int> pii;
typedef pair<int64, int64> pii64;
typedef vector<int> vint;
typedef vector<int64> vint64;
template <typename T> istream& operator >> (istream& in, vector<T>& t) { for (int i = 0;i < t.size();i++) in >> t[i]; return in; }
template <typename T> ostream& operator << (ostream& out, vector<T>& t) { for (int i = 0;i < t.size();i++) out << t[i] << " "; return out; }

int main()
{
#ifdef _SANYA
	freopen("abc.txt", "r", stdin);
#else
#define T "permutation"
	//freopen(T ".in", "r", stdin);
	//freopen(T ".out", "w", stdout);
#endif
	int n; cin >> n;
	int sch = 1;
	while (sch <= n)
	{
		sch *= 2;
	}
	sch /= 2;
	cout << sch << endl;
	exit(0);
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>

#include<vector>
#include<string>

#include<algorithm>
#include<cmath>

using namespace std;
typedef long long ll;
const int INF = 1e9+1;
template <class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template <class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}

int main() {
    ll N;
    cin >> N;
    vector<ll> a(N);
    for (ll i = 0; i < N; i++) cin >> a[i];
    
    sort(a.begin(),a.end());
    ll count = 0;
    ll tmp = 0;
    ll i = N-1;
    while (i >= 1) {
        if (a[i] == a[i-1]) {
            count++;
            if (count == 1) tmp = a[i];
            if (count == 2) {
                cout << tmp * a[i] << endl;
                return 0;
            }
            i--;
        }
        i--;
    }
    cout << 0 << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
using namespace std;
int main() {
    string s;
    int n;
    cin >> s >> n;
    
    for (int i = 0; i < n; i ++) {
        string cmd;
        cin >> cmd;
        if (cmd == "print") {
            int a, b;
            cin >> a >> b;
            for (int j = a; j <= b; j++) {
                printf("%c", s[j]);
            }
            cout << endl;
        } else if (cmd == "reverse") {
            int a, b;
            cin >> a >> b;
            string tmp = "";
            for (int j = a; j <= b; j++) {
                tmp = s[j] + tmp;
            }
            for (int j = a; j <= b; j++) {
                s[j] = tmp[j - a];
            }
        } else if (cmd == "replace") {
            int a, b;
            cin >> a >> b;
            string tmp = "";
            cin >> tmp;
            for (int j = a; j <= b; j++) {
                s[j] = tmp[j - a];
            }
        }
    }
    
    return 0;
}


Measured memory_bytes: 3200
# coding: utf-8

# https://atcoder.jp/contests/abc093/tasks/arc094_a
# 14:55-15:03


def main():
    a, b, c = map(int, input().split())
    a, b, c = sorted([a, b, c], reverse=True)

    ans = 0
    if b % 2 == c % 2:
        ans += (b-c) // 2
        ans += a-b
    else:
        a += 1
        c += 1
        ans += 1
        ans += (b-c) // 2
        ans += a-b
    
    return ans


print(main())


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

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n;
    while(cin >> n) {
        vector<int> v(2*n);
        for(int i = 0; i < 2*n; i++) {
            cin >> v[i];
        }
        sort(v.begin(), v.end());
        int ans = 0;
        for(int i = 0; i < 2*n; i += 2) {
            ans += v[i];
        }
        cout << ans << '\n';
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//make_tuple emplace_back next_permutation push_back make_pair second first

#if MYDEBUG
#include "lib/mydebug.h"
#else
#define DBG(...) ;
#endif

using LL = long long;
constexpr LL LINF=334ll<<53;
constexpr int INF=15<<26;
constexpr LL  MOD=1E9+7;

struct Problem{
    int n;
    vector<vector<char>> b;
    Problem(LL n):n(n),b(n,vector<char>(n)) {};

    void solve(){
        vector<int> r(n),c(n);
        bool emp=true;
        for(int i=0; i<n; ++i){
            for(int j=0; j<n; ++j){
                cin >> b[i][j];
                if(b[i][j]=='.'){
                    c[j]++;
                    r[i]++;
                }else{
                    emp=false;
                }
            }
        }
        if(emp){cout << -1 <<endl; return;}
        int ansr =INF, ansc = 0;
        for(int i=0; i<n; ++i){
            if(c[i]>0)ansc++;
        }
        for(int i=0; i<n; ++i){
            int tmp;
            if(c[i]<n)tmp=r[i];
            else tmp=r[i]+1;
            ansr=min(ansr,tmp);
        }
        cout <<ansc+ansr << "\n";
    }

};


int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    long long n=0;
    cin >> n;
    Problem p(n);
    p.solve();
    return 0;
}



Measured memory_bytes: 512
#include <cstdio>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdlib>

#include <numeric>

#include <map>

using namespace std;

typedef long long LL;

LL n, m, k;

const int N = 1000010;

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

bool number[N+1];
    int prime[N+1];
    int i,j,cnt=0;
    



int main() { 
   
    cin >> n >> m;
    LL x = gcd(n, m);
    LL a = 1;
    
    memset(number,true,sizeof(number));
    for(i=2;i<=N;i++)
    {
        if(number[i])
            prime[cnt++]=i;
        for(j=0;j<cnt&&prime[j]*i<=N;j++)
        {
            number[prime[j]*i]=false;
            if(i%prime[j]==0)
                break;
        }
    }

    for (int z = 0; z < cnt && x > 1; ++z) {
        if (x % prime[z] == 0) {
            a += 1;
            while (x % prime[z] ==0) x/=prime[z];
        }
    }

    if (x > 1) a += 1;


    cout << a << endl;
}   

Measured memory_bytes: 3328
using System;

class Program
{
    static void Main()
    {
        var line = Console.ReadLine().Split(' ');
        var a = int.Parse(line[0]);
        var b = int.Parse(line[1]);

        var ans1 = a / b;
        var ans2 = a % b;
        var ans3 = 1.0 * a / b;
        Console.WriteLine("{0} {1} {2:0.#####0}", ans1, ans2, ans3);
    }
}


Measured memory_bytes: 7892
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000009LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
    int r, g, b, n; cin >> r >> g >> b >> n;
    ll res = 0;
    rep(i, n+1){
        rep(j, n+1){
            int m = r*i + g*j;
            if(m>n) continue;
            double z = (n-m)/(double)b;
            if(z == floor(z)) res++;
        }
    }
    cout << res << ln;
}


Measured memory_bytes: 256
from sys import stdin

n= int(stdin.readline().rstrip())
S = 0
for i in range(n):
  n = stdin.readline().rstrip().split()
  if n[1] == "JPY":
    S += int(n[0])
  else:
    S += float(n[0])*380000.0
    
print(S)
      

Measured memory_bytes: 2940
r1,c1,r2,c2 = map(int,input().split())

MOD = 10**9+7
MAXN = r2+c2+5
fac = [1,1] + [0]*MAXN
for i in range(2,MAXN+2):
    fac[i] = fac[i-1] * i % MOD

def inv(n):
    return pow(n,MOD-2,MOD)

def comb(n,r):
    if n < r: return 0
    if n < 0 or r < 0: return 0
    return fac[n] * inv(fac[r]) * inv(fac[n-r]) % MOD

r2,c2 = r2+1,c2+1
ans = comb(r2+c2,r2) - comb(r2+c1,r2) - comb(r1+c2,r1) + comb(r1+c1,r1)
ans %= MOD
print(ans)

Measured memory_bytes: 82152
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;
map<string,ll>mp;
int main(){
    int n;
    cin>>n;
    vector<string>s(n);
      set<string>st;
    for (int i = 0; i < n; i++)
    {
        cin>>s[i];
        sort(s[i].begin(),s[i].end());
       /* if(st.count(s[i])!=0){
            mp[s[i]]++;
        }
        st.insert(s[i]);*/
    }
    sort(ALL(s));
    for (int i = 0; i < n; i++)
    {
        mp[s[i]]++;
    }
    set<string>q(ALL(s));
    vector<string>v(ALL(q));
   // show(v);
    ll ans=0;
    for (int i = 0; i < v.size(); i++)
    {  // cerr<<mp[v[i]]<<endl;
        ans+=mp[v[i]]*(mp[v[i]]-1)/2;
    }
    cout<<ans<<endl;
    
  

    

    return 0;
}

Measured memory_bytes: 18944
N,M,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
xmax=-101
ymin=101
for i in range(N):
	if x[i]>xmax:
		xmax=x[i]
for i in range(M):
	if y[i]<ymin:
		ymin=y[i]
if ymin>xmax:
	if X<ymin and ymin<=Y:
		print("No War")
	else:
		print("War")
else:
	print("War")

Measured memory_bytes: 3064
(h, w), *ca = [list(map(int, l.split())) for l in open(0)]

ccc = ca[:10]
aaa = ca[10:]

for k in range(10):
    for i in range(10):
        for j in range(10):
            ccc[i][j] = min(ccc[i][j], ccc[i][k]+ccc[k][j])

costs = [cc[1] for cc in ccc]

tmp = 0
for aa in aaa:
    for a in aa:
        if a == -1:
            pass
        else:
            tmp += costs[a]

print(tmp)

Measured memory_bytes: 74040
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<tuple>
#include<bitset>
#include<iomanip>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
pair<vll,vll > prime_factor_decomp(ll n) {
    vll p, e;
    ll m = n;
    for (ll i = 2; i * i <= n; i++) {
        if (m % i != 0) continue;
        int c = 0;
        while (m % i == 0) c++, m /= i;
        p.push_back(i);
        e.push_back(c);
    }
    if (m > 1) {
        p.push_back(m);
        e.push_back(1);
    }
    return mp(p, e);
}
int main(){
	ll N,P;
	scan(N);scan(P);
	pair<vll, vll > soinsu=prime_factor_decomp(P);
	ll ans=1;
	rep(i,soinsu.first.size()){
		rep(j,soinsu.second[i]/N){
			ans*=soinsu.first[i];
		}
	}
	prin(ans);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long int;
using ld=long double;
using VI=vector<ll>;
using VD=vector<ld>;
using VVI=vector<VI>;
using VC=vector<char>;
using VB=vector<bool>;
using VVC=vector<VC>;
using VS=vector<string>;
using PLL =pair<ll,ll>;
using PLD=pair<ld,ld>;
using VPLL=vector<PLL>;
#define print(x) std::cout<<x<<"\n"
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repd(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SZ(x) ((ll)(x).size())
#define MAX(x) *max_element((x).begin(),(x).end())
#define MIN(x) *min_element((x).begin(),(x).end())
#define SORTR(x) sort((x).rbegin(),(x).rend())
#define SORT(x) sort((x).begin(),(x).end())
#define SUM(x) accumulate((x).begin(),(x).end(), 0)
#define FILL(x,a) fill(x.begin(),x.end(),a)
#define EACH(i,x) for(typeof((x).begin()) i=(x).begin(); i!=(x).end(); ++i)
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

const ll INF = 1e18;
const ld EPS   = 1e-10;
const int MOD  = int(1e9)+7;
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; }
template <class BidirectionalIterator>
bool next_partial_permutation(BidirectionalIterator first, BidirectionalIterator middle,BidirectionalIterator last){reverse(middle, last); return next_permutation(first , last);}
ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll GCD(VI v){ll a = v[0]; for (ll i = 1; i<SZ(v); i++) {a = gcd(a, v[i]);} return a;}
ll LCM(VI v){ll a = v[0]; for (ll i = 1; i<SZ(v); i++) {a = lcm(a, v[i]);} return a;}
VI Bit2Vector(const ll bit, ll n) {	VI s;	rep(i,n) if (bit & (1 << i)) s.push_back(i); return s;}


void Main()
{
	ll n,m,l; ll res=0;
	string s,t,u; string sres="No or NO";

	cin>>n>>m;
	res=n*m;
	

	cout << res << "\n";
	return;
}

int main()
{
	std::cin.tie(0);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}


Measured memory_bytes: 3656
while True:
	num = raw_input().split(" ")
	num1 = int(num[0])
	num2 = int(num[1])
	if num1 == 0 and num2 == 0:
		break
	elif num1 > num2:
		print("{0} {1}".format(num2, num1))
	else:
		print("{0} {1}".format(num1, num2))

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

int main() {
  int x, y;
  cin >> x >> y;
  if (x > 12) {
    cout << y << endl;
  }
  else if (x < 6) {
    cout << 0 <<endl;
  }
  else {
    cout << y / 2 << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
int main()
{
	int n;
	
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a.at(i);
	}

	sort(a.begin(), a.end(), greater<int>());

	int alice = 0;
	int bob = 0;

	for (int i = 0; i < n; ++i) {
		if (i % 2 == 0) {
			alice += a.at(i);
		}
		else {
			bob += a.at(i);
		}
	}

	cout << alice -bob << endl;
	return 0;
}

Measured memory_bytes: 256
type tree = Nil | Node of int * tree * tree

let create () = Nil

let insert x t =
  let rec doit = function
    | Nil -> Node (x, Nil, Nil)
    | Node (y, l, r) when x < y -> Node (y, doit l, r)
    | Node (y, l, r) -> Node (y, l, doit r)
  in
  doit t

let preorder f t =
  let rec doit = function
    | Nil -> ()
    | Node (x, l, r) -> (f x; doit l; doit r)
  in
  doit t

let inorder f t =
  let rec doit = function
    | Nil -> ()
    | Node (x, l, r) -> (doit l; f x; doit r)
  in
  doit t

let print t =
  let f e = print_string " "; print_int e in
  inorder f t;
  print_newline ();
  preorder f t;
  print_newline ()

let find x t =
  let rec doit = function
    | Nil -> false
    | Node (y, _, _) when x = y -> true
    | Node (y, l, _) when x < y -> doit l
    | Node (_, _, r) -> doit r
  in
  doit t

let delete x t =
  let rec dudu = function
    | Nil -> exit 1
    | Node (x, Nil, _) -> x
    | Node (_, l, _) -> dudu l
  and wa = function
    | Nil -> exit 1
    | Node (_, Nil, r) -> r
    | Node (x, l, r) -> Node (x, wa l, r)
  and doit = function
    | Nil -> exit 1
    | Node (y, l, r) when x = y ->
        if l = Nil then r
        else if r = Nil then l
        else Node (dudu r, l, wa r)
    | Node (y, l, r) when x < y -> Node (y, doit l, r)
    | Node (y, l, r) -> Node (y, l, doit r)
  in
  doit t

let split str delim =
  let rec doit s acc =
    match
      try Some (String.rindex s delim) with _ -> None
    with
    | None -> s :: acc
    | Some i ->
        let s1 = String.sub s 0 i in
        let s2 = String.sub s (i + 1) (String.length s - String.length s1 - 1) in
        doit s1 (s2 :: acc)
  in
  doit str []

let () =
  let m = read_int () in
  let rec read i t =
    if i < m then begin
      match split (read_line ()) ' ' with
      | ["insert"; n] -> read (i + 1) (insert (int_of_string n) t)
      | ["find"; n] -> (print_endline (if find (int_of_string n) t then "yes" else "no"); read (i + 1) t)
      | ["delete"; n] -> read (i + 1) (delete (int_of_string n) t)
      | _ -> (print t; read (i + 1) t)
    end
  in
  read 0 (create ())

Measured memory_bytes: 25060
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;

int main() {
	int R[MAX], n;

	cin >> n;
	for (int i = 0; i < n; i++)cin >> R[i];

	int maxv = -1000000000;
	int minv = R[0];

	for (int i = 1; i < n; i++) {
		maxv = max(maxv, R[i] - minv);
		minv = min(minv, R[i]);
	}

	cout << maxv << endl;
	return 0;
}


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

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef pair<ll, ll> P;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
/***** define constant start *******/
const ll MOD = 1000000007;
const double PI = 3.1415926535897932;
const ll INF = 10000000000;
/****** define constant end ********/


/****** define variable start ******/
ll h, n;
vl a;
/******* define variable end *******/

ll solve(){
    cin >> h >> n;
    a.resize(n);
    ll sum = 0;
    REP(i, n){
        cin >> a[i];
        sum += a[i];
    }
    if(sum >= h){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}
int main(){
    //clock_t start = clock();
    cout << std::fixed << std::setprecision(10);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll end_solve = solve();
    /*
    clock_t end = clock();
    const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC * 1000.0;
    printf("time %lf[ms]\n", time);
    */
    return (int)end_solve;
}


Measured memory_bytes: 1024
n = int(input())
l = list(map(int, input().split()))

ans = 0
for i in range(n):
    for j in range(i+1, n):
        for k in range(j+1, n):
            _lst = [l[i], l[j], l[k]]

            if len(set(_lst)) == 3:
                _max = max(_lst)
                _lst.remove(_max)
                if _max < sum(_lst):
                    ans += 1

print(ans)


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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; 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 VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

const string YES = "Yes";
const string NO = "No";
const ll mod = 1e9+7;



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

    ll n; cin >> n;
    map<string, int> m;
    int mx = 0;
    REP(i,n){
        string s; cin >> s;
        m[s]++;
        mx = max(mx, m[s]);
    }
    for (auto p:m){
        if (p.second == mx){
            cout << p.first << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 23808