akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>

int main(void) {
  int a, b, c, d, i, n;

  while (scanf("%d", &n) != EOF) {
    i = 0;

    for (a = 0; a <= 9; a++) {
      for (b = 0; b <= 9; b++) {
        for (c = 0; c <= 9; c++) {
          for (d = 0; d <= 9; d++) {
            if (a + b + c + d == n) {
              i++;
            }
          }
        }
      }
    }

    printf("%d\n", i);
  }

  return EXIT_SUCCESS;
}

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

int main(){
    ll n,k;
    cin >> n >> k;
    vector<ll> h(n);
    rep(i, n){
        cin >> h.at(i);
    }
    if(k>=n){
        cout << 0 << endl;
        return 0;
    }

    sort(h.begin(), h.end(), greater<ll>());
    // rep(i, n) cout << h.at(i) << ' ';
    
    ll res =0;
    for(int i=k;i<n;i++){
        res+=h.at(i);
    }
    cout << res << endl;
    return 0;
 }

Measured memory_bytes: 1792
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define PB push_back
#define MP make_pair
#define ll long long

inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}

int ret[200000] = {};
bool used[200001] = {};

int main(){
    std::ios::sync_with_stdio(false);
    int n, x;
    cin >> n >> x;
    if(x == 1 || x == 2*n-1)
    {
        cout << "No" << endl;
    }
    else
    {
        cout << "Yes" << endl;
        if(n == 2)
        {
            for(int i=1;i<=3;++i) cout << i << endl;
        }
        else
        {
            if(x == (2 * n - 2))
            {
                ret[n-2] = x-1;
                ret[n-1] = x;
                ret[n] = x+1;
                ret[n+1] = x-2;
                used[x-2] = true;
                used[x-1] = true;
                used[x] = true;
                used[x+1] = true;
            }
            else
            {
                ret[n-2] = x+1;
                ret[n-1] = x;
                ret[n] = x-1;
                ret[n+1] = x+2;
                used[x-1] = true;
                used[x] = true;
                used[x+1] = true;
                used[x+2] = true;
            }
            int cur = 1;
            for(int i=0;i<2*n-1;++i)
            {
                while(used[cur])
                {
                    cur++;
                }
                if(ret[i] == 0)
                {
                    ret[i] = cur;
                    used[cur] = true;
                }
            }
            for(int i=0;i<2*n-1;++i)
            {
                cout << ret[i] << endl;
            }
        }
    }
}

Measured memory_bytes: 2432
#include <iostream>
using namespace std;
typedef long long ll;

int main(){
  int n; cin>>n; ll x[n];
  for(int i=0;i<n;i++) cin>>x[i];
  ll an = 1e18;
  for(ll i=0;i<=100;i++) {
    ll sm=0;
    for(int j=0;j<n;j++) {
      sm+=(x[j]-i)*(x[j]-i);
    }
    an = min(an, sm);
  }
  cout<<an<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using pLL = std::pair<long long, long long>;
using ll = long long;
#define SORT(v) std::sort(v.begin(), v.end())

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	int ans = 0;
	for (size_t i = 0; i < 4; ++i) {
		if (s[i] == '+') ans++;
		else ans--;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <fstream>
#include <vector>
#include <bitset>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

int R,G,B,N;
int ans;

int main()
{
	ios::sync_with_stdio(0);
	cin >> R >> G >> B >> N;
	for (int i = 0;i * R <= N;i++)
		for (int j = 0;i * R + j * G <= N;j++)
			if ((N - i * R - j * G) % B == 0)
				ans++;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import Data.List

snd' :: ([Int], [Int], [Int]) -> Int -> ([Int], Int)
snd' (l, [a,b], []) n	
  | a >	b = (l ++ [b], n+1)
  | otherwise =	(l ++ [a], n)
snd' (l, [a,b], r) n
  | a > b = snd' (l++[b], [a, head r], tail r) (n + 1)
  | otherwise = snd' (l++[a], [b, head r], tail r) n

fst' ::	([Int], Int) ->	Int
fst' (x:[], n) = n
fst' (x:y:xs, n) = fst' (snd' ([], [x,y], xs) n)

main = do
  list <- fmap (tail . map read . words) getContents
  putStrLn $ unwords $ map show $ sort $ list
  print $ fst' (list, 0)

Measured memory_bytes: 4216
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    vector<int> a(3);
    for(int i = 0; i < 3; i++) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    cout << a[0]*10 + a[1] + a[2] << endl;
}


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

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<double, double> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<string> &o) {
    string a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;


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

    int ans = 0;

    while (a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
        ll na = 0, nb = 0, nc = 0;
        ll fa = a / 2;
        ll fb = b / 2;
        ll fc = c / 2;
        nb += fa;
        nc += fa;
        na += fb;
        nc += fb;
        na += fc;
        nb += fc;
        if (a == na && b == nb && c == nc) {
            ans = -1;
            break;
        }
        a = na;
        b = nb;
        c = nc;
        ans++;
    }
    cout << ans << endl;

}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>
#include<deque>

using namespace std;
typedef long long int ll;

#define C cout<<
#define E <<endl
#define CE cout<<endl

ll n,m,a,b,c,x,y,z,aa[200010],ab[200010],ac[1010][1010];
bool r,ra,rb,rc;
string s,sa,sb,sc;
char ca,cb,cc,cd[1010][1010];
vector<ll> va,vb,vc;

int main(){
    cin>>n>>m;
    C max(ll(0),n-m) E;
}



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

#define pb push_back
#define io ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define clr(v) v.clear()
vector<ll>v;
pair<ll,ll>p;
map<ll,ll>mp;
set<ll>st;
deque<ll>dq;
priority_queue<ll>pq;
#define f(i,b) for(i=0;i<b;i++)
#define f1(i,b) for(i=1;i<=b;i++)
#define fr(i,b)for(i=b-1;i>=0;i--)
ll mn=INT_MAX,mx=INT_MIN;
ll n,m,tc,i,j,tmp,sum,cn,ans,res,pos,flag;

string s;


ll a[200007],b[200007];
int main()
{

   io;
string str;

cin>>s>>str;
ll l=s.size();
if(l!=str.size())
{
    puts("No");
}
else
{
 for(i=0;i<l;i++)
 {
     bool flag=true;
     for(j=0;j<l;j++)
     {
         if(s[j]!=str[(j+i)%l])
            {flag=false;}

     }
     if(flag==true)
     {
         puts("Yes");
         return 0;
     }
 }
 puts("No");
}
return 0;
}





Measured memory_bytes: 3548
/*Lucky_Glass*/
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<vector>
#include<queue>
using namespace std;
const int MAXN=1e5;
struct EDGE{
	int v,val[2];
	EDGE(){}
	EDGE(int c,int d,int e){v=c;val[0]=d;val[1]=e;}
};
int n_cty,n_edg,s,t;
vector<EDGE>lnk[MAXN+5];
long long dist[2][MAXN+5],ans[MAXN+5];//0:yen start->i   1:snuuk end->i
bool vis[MAXN+5];
void SPFA(int start,int kind)
{
	memset(vis,0,sizeof vis);
	fill(dist[kind],dist[kind]+n_cty+3,1e15);
	queue<int> que;que.push(start);
	dist[kind][start]=0;vis[start]=true;
	while(!que.empty())
	{
		int u=que.front();que.pop();
		for(int i=0;i<lnk[u].size();i++)
		{
			int v=lnk[u][i].v,val=lnk[u][i].val[kind];
			if(dist[kind][v]>dist[kind][u]+val)
			{
				dist[kind][v]=dist[kind][u]+val;
				if(!vis[v])
					vis[v]=true,que.push(v);
			}
		}
		vis[u]=false;
	}
}
struct DEQUE{
	int val,date;
	DEQUE(){}
	DEQUE(int a,int b){val=a;date=b;}
};
int main()
{
	scanf("%d%d%d%d",&n_cty,&n_edg,&s,&t);
	for(int i=0;i<n_edg;i++)
	{
		int u,v,a,b;scanf("%d%d%d%d",&u,&v,&a,&b);
		lnk[u].push_back(EDGE(v,a,b));
		lnk[v].push_back(EDGE(u,a,b));
	}
	SPFA(s,0);
	SPFA(t,1);
	fill(ans+1,ans+n_cty+3,1e15);
	for(int i=n_cty;i>=1;i--)
	{
		long long val=dist[0][i]+dist[1][i];
		ans[i]=min(ans[i+1],val);
	}
	for(int i=1;i<=n_cty;i++)
		printf("%lld\n",(long long)1e15-ans[i]);
	/*
	deque<DEQUE> low;
	for(int i=1;i<=n_cty;i++)
	{
		int val=dist[0][i]+dist[1][i];
		while(!low.empty() && low.back().val>val) low.pop_back();
		low.push_back(DEQUE(val,i));
	}
	for(int i=1;i<=n_cty;i++)
	{
		while(!low.empty() && low.front().date<i) low.pop_front();
		printf("%lld\n",(long long)1e15-low.front().val);
	}
	*/
	return 0;
}


Measured memory_bytes: 10880
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
#define INF 10000000000
ll a, b, c, n, m, x, y, z, w, h, ans = 0, cnt = 0, mx = 0, mn = INF;
string s, t;

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

    while(cin >> n){
        ll list[n + 1];
        rep(i, 1, n + 1){
            cin >> list[i];
        }
        ll dp[n + 1];
        dp[1] = 0;
        dp[2] = abs(list[1] - list[2]);
        rep(i, 3, n + 1){
            dp[i] = min(dp[i - 1] + abs(list[i - 1] - list[i]), dp[i - 2] + abs(list[i - 2] - list[i]));
        }
        cout << dp[n] << endl;
    }
}



Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
string s,st;
int zs;
int main()
{
	cin>>st;
	s="CODEFESTIVAL2016";
	for (int i=0;i<st.size();i++)
	  if (st[i]!=s[i]) zs++;
	cout<<zs<<endl;
	return 0;
}


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

#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define eb emplace_back
#define ins insert
#define f first
#define s second
#define cbr cerr<<"hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ll(x.size())
#define all(x) (x).begin(), (x).end()
#define lbd(x,y) (lower_bound(all(x),y)-x.begin())
#define ubd(x,y) (upper_bound(all(x),y)-x.begin())
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
inline long long rand(long long x, long long y) { return rng() % (y+1-x) + x; } //inclusivesss
string inline to_string(char c) {string s(1,c);return s;} template<typename T> inline T gcd(T a,T b){ return a==0?llabs(b):gcd(b%a,a); }

using ll=long long; 
using ld=long double;
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
using pi=pair<ll,ll>; using spi=pair<ll,pi>; using dpi=pair<pi,pi>; 

#define LLINF ((long long)1e18)
#define INF int(1e9+1e6)
#define MAXN (200006)
ll n, A[MAXN], B[MAXN], w=-1;
int main(){
	FAST
	cin>>n;
	FOR(i,1,n)cin>>A[i];
	FOR(i,1,n)cin>>B[i];
	reverse(B+1,B+n+1);
	FOR(i,1,n)if(A[i]==B[i]){
		if(w==-1) w=A[i];
		else assert(w==A[i]);
	}
	pi clash=pi(LLINF,-LLINF); FOR(i,1,n) if(A[i]==B[i]) clash.f = min(clash.f, i), clash.s = max(clash.s, i);
	ll co = clash.f;
	FOR(i,1,n) if(A[i] != w && co <= clash.s && B[i] != w) {
		swap(B[i], B[co++]);
	}
	FOR(i,1,n) if(A[i] == B[i]) { cout<<"No\n"; return 0; }
	cout<<"Yes\n";
	FOR(i,1,n) cout<<B[i]<<' '; cout<<'\n';
}


Measured memory_bytes: 6760
#include<stdio.h>
#include<stdlib.h>
#include<math.h>




int main(void){
    char s[4];
    scanf("%s",s);
    int i,counter1 = 0,counter2 = 0;
    for(i=0;i<3;i++){
        counter1 += (int)s[i];
    }
    counter2 = 'a' + 'b' + 'c';
    if(counter1 == counter2){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }
    
    return 0;

}

Measured memory_bytes: 128
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <math.h>

using namespace std;

//conversion
//------------------------------------------
inline long toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline long toLong(string s) {long v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const long double EPS = 1e-12;
const int INF = 10000;


int main(){
	int a,d,n;
	while(cin>>a>>d>>n){
		if(n==0&&a==0&&n==0)break;
		int cnt=0;
		long tmp=a;
		
		while(1){
			bool flag=true;
			for(int i=2;i*i<=tmp;i++)if(tmp%i==0)flag=false;
			if(flag&&tmp!=1){
				cnt++;
				if(cnt==n)break;
			}
			tmp+=d;
		}
		cout<<tmp<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
a1, a2, a3 = map(int, input().split())
case1 = abs(a1 - a2) + abs(a2 - a3)
case2 = abs(a1 - a3) + abs(a3 - a2)
case3 = abs(a2 - a1) + abs(a1 - a3)
print(min(case1, case2, case3))

Measured memory_bytes: 3060
// https://atcoder.jp/contests/abc152/tasks/abc152_c
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define REP(i, n) for(size_t i = 0; i < (n); ++i)

int main()
{
    int N;
    scanf("%d", &N);
    vector<int> P(N);
    REP(i, N) scanf("%d", &P[i]);
    int minp = P[0];
    int ans = 1;
    for (int i = 1; i < N; ++i)
    {
        minp = min(minp, P[i]);
        if (minp >= P[i]) ++ans;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4072
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Sort(a) sort(a.begin(), a.end())
#define Reve(a) reverse(a.begin(), a.end())
#define PI 3.14159265359
typedef long long ll;
const ll MOD = 1e9+7;

ll gcd(ll a, ll b){
  if(b==0) return a;
  return gcd(b, a%b);
}
/*ll myPow(ll x, ll n, ll m){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}*/

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

//素数判定 O(√n)
bool is_prime(int64_t n){
  for(int64_t i = 2; i*i<=n; i++){
    if(n%i==0) return false;
  }
  return n!=1;
}

//約数の列挙 O(√n)
vector<int64_t> dividor(int64_t n){
  vector<int64_t> res;
  for(int64_t i=1; i*i<=n; i++){
    if(n%i==0){
      res.push_back(i);
      if(i != n/i) res.push_back(i);
    }
  }
  return res;
}

//素因数分解 O(√n)
map<int64_t, int64_t> prime_factor(int64_t n){
  map<int64_t, int64_t> res;
  for(int64_t i=2; i*i<=n; i++){
    while(n%i==0){
      res[i]++;
      n /= i;
    }
  }
  if(n != 1) res[n] = 1;
  return res;
}
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(){
  int k, a, b;
  int ch = 0;
  cin >> k >> a >> b;
  for(int i=a; i<=b; i++){
    if(i%k==0){ch = 1; cout << "OK" << endl; break;}
  }  
  if(ch==0) cout << "NG" << endl;
}




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

using namespace std;

#define lli long long
#define ld long double
#define mod 1000000007 
#define set(n) cout << fixed << setprecision(n)    
#define fi first
#define se second
#define mp make_pair
#define pll pair<lli, lli>
#define endl '\n'

const double PI = acos(-1);
const double epsilon = 1e-7;  // floating point precision

signed main(void) {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli x, k, d;
    cin >> x >> k >> d;
    if(x < 0) x = -x;
    lli times = x / d;
    lli pos1, pos2 = 1e18;
    if(times <= k) {
        pos1 = x % d;
        lli curr = pos1, other;
        times ++;
        if(times <= k) {
            pos2 = d - pos1;
            curr = pos2;
            other = pos1;
        }
        else {
            times --;
        }
        if((k - times) % 2 == 0) {
            cout << curr << endl;
        }
        else {
            cout << other << endl;
        }
    }
    else {
        pos1 = x - d * k;
        cout << pos1 << endl;
    }
    return 0;
}


Measured memory_bytes: 3644
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<cstdio>
#include<cmath>
using namespace std;

int main()
{
  string s, t;
  cin >> s >> t;
  int a, b;
  cin >> a >> b;
  string input;
  cin >> input;
  if(input == s) cout << a-1 << " " << b << endl;
  else cout << a << " " << b-1 << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define F first
#define S second
//#define biGinf 9e+18
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define inpv(v) for(auto &x:v) cin>>x
#define otpv(v) for(auto &x:v) cout<<x<<nwl
#define otpv2(v) for(auto &x:v) cout<<x<<" "
#define CASES int tt;cin>>tt; while(tt--)
#define for0(i,n) for(int i=0; i<n; i++)
#define for1(i,n) for(int i=1; i<=n; i++)
#define sz(v) (int)(v).size()
#define vec(x) vector < x >
using vi = vector < int >;
using vvi = vector < vi >;
using pii = pair < int , int >;
using vpii = vector < pii >;
using int64 = long long;
//const int64 biGinf = 9e+18;
//const string yo = "YES", no = "NO";
const int inf = 2e9 + 7;
const char nwl = '\n';

int main() {
// #ifndef ONLINE_JUDGE
// 	if (fopen("input.txt", "r")) {
// 		freopen("input.txt", "r", stdin);
// 		freopen("output.txt", "w", stdout);
// 	}
// #endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//ur code
	int n;
	cin >> n;
	vi v(n);
	inpv(v);
	sort(all(v));
	int64 s = v[n - 1];
	int j = n - 2;
	for (int i = 0; i < n - 2; ) {
		s += (int64)v[j];
		if (i % 2) j--;
		i++;
	}
	cout << s;


	return 0;
}

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

int main(){
    int a, b;
    cin >> a >> b;
    while(a!=0){
    for(int i=1; i<=a;i++){
        for(int j = 1; j<=b; j++){
        cout << "#";
        }
        cout << endl;
        
    }
    cout << endl;
    cin >> a >> b;
    }
    return 0;
}


Measured memory_bytes: 3092
#include<bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
int main(){
  int s,t,n,m;
  cin>>n>>m;

  vector<vector<int> > lis(n+1000);
  list<int> out;  
  vector<bool> V(n+1000,false);
  for(int i=0;i<m;i++){
    cin>>s>>t;
    lis[s].push_back(t);  
  }
  
  //ここから本番
  vector<int> indeg(n+1000,0);

  //隣接リストを参照して、入次数の数を数える
  for(int u=0;u<n;u++){
    for(int i=0;i<lis[u].size();i++){
      int v=lis[u][i];
      indeg[v]++;
    }
  }

  for(int u=0;u<n;u++){
    if(indeg[u]==0 && !V[u]){
      //幅優先探索
      queue<int> que;
      que.push(u);
      V[u]=true;
      while(!que.empty()){
        int u=que.front(); que.pop();
        out.push_back(u);
        for(int i=0;i<lis[u].size();i++){
          int v=lis[u][i];
          indeg[v]--;
          if(indeg[v]==0 && !V[v]){
            V[v]=true;
            que.push(v);
          }
        }
      }
    }
  }

  for(auto it=out.begin();it!=out.end();it++){
    cout<<*it<<'\n';
  }
  return(0);
}


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

int main() {
    int n,l;
    cin >> n >> l;
    int ori = 0;
    rep(i,n) ori += l+i;
    if(l > 0) ori -= l;
    else if (l+n-1 < 0) ori -= l+n-1;
    cout << ori << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define ff first
#define ss second
#define vll vector<ll>
#define sz size()
#define pb emplace_back
#define mp make_pair
#define MOD 1000000007
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);srand(time(NULL))
const int N = 100005;

int main()
{
   string a;
   cin>>a;
   ll n=a.size();
   ll ans=0;
   for(ll i=0;i<n/2;i++)
   {
   	 if(a[i]!=a[n-i-1])
   	 ans++;
   }
   cout<<ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdint.h>
#include <queue>
#include <bitset>
#include <iomanip>
#include <set>
#include <map>

using namespace std;

#define PI (3.14159265358979323846)
#define INF (2147483647)
#define INF_LL (9223372036854775807)
#define DIV_NUM (1000000007)
typedef long long ll;

// 配列初期化テンプレ
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T& val) {
	std::fill((T*)array, (T*)(array + N), val);
}


int main() {

	ll A;
	double B;
	cin >> A >> B;

	ll B_100 = (ll)(round(B * 100.0));


	ll ans = (A * B_100) / (ll)(100);

	cout << ans << endl;

	return 0;

}


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

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

using namespace std;

vector<vector<int>> v;
int h, w, c;

bool init() {
	v.clear();
	cin >> h >> w >> c;
	if (h == 0) return false;
	v.resize(h, vector<int>(w));
	rep(i, h) {
		rep(j, w) {
			cin >> v[i][j];
		}
	}
	return true;
}

int dfs2(int r, int c, vector<vector<int>>& a, int f, int t, vector<vector<int>>& H, int st = 0) {
	assert(f != t);
	if (r < 0 || c < 0 || r >= h || c >= w) return 0;
	if (st == 1 && a[r][c] != t) return 0;
	if (H[r][c]) return 0;
	H[r][c] = 1;
	if (a[r][c] != f && a[r][c] != t) return 0;
	int dr[] = {1, 0, -1, 0};
	int dc[] = {0, 1, 0, -1};
	int res = 1;
	if (a[r][c] == t) st = 1;
	a[r][c] = t;
	rep(i,4) {
		res += dfs2(r+dr[i], c+dc[i], a, f, t, H, st);
	}
	return res;
}

int dfs(int C, int d = 1) {
	auto t = v;
	vector<vector<int>> H;
	H.resize(h, vector<int>(w, 0));
	if (d == 5) {
		if (C != c) return 0;
		if (c == v[0][0]) return 0;
		int res = dfs2(0, 0, v, v[0][0], c, H);
		return res;
	}
	if (C == v[0][0]) return 0;
	int res = dfs2(0, 0, v, v[0][0], C, H);
	if (C != c) res = 0;
	rep(i, 6) {
		res = max(res, dfs(i+1, d+1));
	}
	v = t;
	return res;
}

void solve() {
	int res = 0;
	rep(i, 6) {
		res = max(res, dfs(i+1));
	}
	cout << res << endl;
}

int main() {
	while (init()) {
		solve();
	}
}


Measured memory_bytes: 3196
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=1e5+5;
int n,L,T,i,a[N];long long cnt;
int read(){
	char c=getchar();int k=0;for (;c<48||c>57;c=getchar());
	for (;c>47&&c<58;c=getchar()) k=(k<<3)+(k<<1)+c-48;return k;
}
void write(int x){if (x>9) write(x/10);putchar(x%10+48);}
int main(){
	n=read();L=read();T=read();
	for (i=0;i<n;i++){
		int x=read(),k=read();
		x+=k==1?T:-T;
		cnt+=x/L;x%=L;
		if (x<0) x+=L,cnt--;
		a[i]=x;
	}
	sort(a,a+n);cnt=(cnt%n+n)%n;
	for (i=0;i<n;i++) write(a[(i+cnt)%n]),putchar('\n');
}

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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;

ll G[2][105];
ll dp[2][105];

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

inline bool inside(ll y, ll x, ll H, ll W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  rep(i,2) rep(j,n) cin>>G[i][j];
  
  dp[0][0]=G[0][0];
  
  queue<pll> q;
  q.emplace(0,0);
  while(!q.empty()){
    auto p=q.front(); q.pop();
    ll y=p.first, x=p.second;
    rep(i,2){
      ll ny=y+dy[i], nx=x+dx[i];
      if(inside(ny,nx,2,n)){
        if(dp[ny][nx]==0){
          q.emplace(ny,nx);
        }
        chmax(dp[ny][nx],dp[y][x]+G[ny][nx]);
      }
    }
  }
  cout<<dp[1][n-1]<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <complex>
using namespace std;

typedef long long ll;
typedef pair<int,int> P;

#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp make_pair
#define ERASE(v,i) (v).erase(remove(all(v),i),(v).end())
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define debug(x) cerr<<#x<<" = "<<(x)<<endl;
#define LINE cerr<<"LINE: "<<__LINE__<<endl;

inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T> void preview(T a,T b){for(T it=a;it!=b;++it)cerr<<*it<<" ";cerr<<endl;}

const int INF = 100000000;
const double PI = acos(-1.0), EPS = 1e-10;

int main() {
	for(string line; cin >> line;) {
		rep(i,line.length()) if(line[i] == ',') line[i] = ' ';
		istringstream is(line);
		vector<int> card(5);
		rep(i,5) is >> card[i];
		sort(all(card));

		map<int, int> m;
		rep(i,5) m[card[i]]++;

		// four cards
		{
			bool four_card = false;
			int two_pair = 0;
			bool three_cards = false;
			each(it, m) {
				if(it->second == 4) four_card = true;
				if(it->second == 3) three_cards = true;
				if(it->second == 2) two_pair++;
			}

			bool streat = true;
			for(int i = 1; i < 5; i++) {
				if(card[i] != card[i - 1] + 1) streat = false;
			}
			if(card[0] == 1 && card[1] == 10 && card[2] == 11 && card[3] == 12 && card[4] == 13) streat = true;

			string ans;
			if(four_card) ans = "four card";
			else if(three_cards && two_pair) ans = "full house";
			else if(streat) ans = "straight";
			else if(three_cards) ans = "three card";
			else if(two_pair == 2) ans = "two pair";
			else if(two_pair == 1) ans = "one pair";
			else ans = "null";

			cout << ans << endl;
		}
	}

	return 0;
}

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

int main() {
  while(true) {
    int W, H; cin >> W >> H;
    if(W == 0 && H == 0) break;
    int curX = 1, curY = 1;
    int dir = 0;
    while(true) {
      string comm; cin >> comm;
      if(comm == "STOP") break;
      static int dx[] = { 0, -1, 0, 1 };
      static int dy[] = { 1, 0, -1, 0 };
      if(comm == "FORWARD") {
        int n; cin >> n;
        for(int i = 0; i < n; ++i) {
          int nx = curX + dx[dir];
          int ny = curY + dy[dir];
          if(1 <= nx && nx <= W && 1 <= ny && ny <= H) {
            curX = nx;
            curY = ny;
          }
        }
      }
      else if(comm == "BACKWARD") {
        int n; cin >> n;
        for(int i = 0; i < n; ++i) {
          int nx = curX + dx[(dir + 2) % 4];
          int ny = curY + dy[(dir + 2) % 4];
          if(1 <= nx && nx <= W && 1 <= ny && ny <= H) {
            curX = nx;
            curY = ny;
          }
        }
      }
      else if(comm == "LEFT") {
        dir = (dir + 1) % 4;
      }
      else if(comm == "RIGHT") {
        dir = (dir + 3) % 4;
      }
    }
    cout << curX << ' ' << curY << endl;
  }
}

Measured memory_bytes: 1216
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll> ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <vector <vector<ll> > > vvv;
typedef vector <string> vs;
typedef vector <lf> vf;
#define tr1(x) cerr << #x << ": " << x << endl
#define tr2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl
#define tr3(x,y,z) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define mod 1000000007
#define inf 9999999999999999ll
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    char c;
    cin>>c;
    c++;
    cout<<c<<endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <vector>
using namespace std;

vector<int> sieve(int n) {
	vector<int> res(1, 2);
	vector<bool> prime(n, true);
	for(int i = 3; i < n; i += 2) {
		if(prime[i]) {
			res.push_back(i);
			for(int j = i * 3; j < n; j += i * 2)
				prime[j] = false;
		}
	}

	return res;
}

int main() {
	const int MAX = 50000;
	vector<int> prime = sieve(MAX), cnt(MAX + 1, 0);

	for(int i = 0; i < prime.size(); ++i) {
		for(int j = i; j < prime.size(); ++j) {
			int tmp = prime[i] + prime[j];
			if(tmp > MAX)
				break;

			++cnt[tmp];
		}
	}

	for(int n; scanf("%d", &n), n;)
		printf("%d\n", cnt[n]);

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1272
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

using ll=long long;
using vi=std::vector<int>;
using vvi=std::vector<vi>;
using vll=std::vector<ll>;
using vvll=std::vector<vll>;
template<typename T> using vvec=std::vector<std::vector<T>>;
template<typename T>
auto make_v(size_t sz){return std::vector<T>(sz);}
template<typename T,typename... Ts>
auto make_v(size_t sz,Ts...ts){return std::vector<decltype(make_v<T>(ts...))>(sz,make_v<T>(ts...));}
template<typename T>
void fill_v(T&var,const T&x){var=x;}
template<typename V,typename T>
void fill_v(V&v,const T&x){for(auto&& w:v){fill_v(w,x);}}

template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<std::vector<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<std::deque<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s, const std::set<T>&v){
  s<<"\n";for(auto&& elm:v){s<<elm<<"\t";}s<<"\n";return s;}

inline void scan(int&a){scanf("%d",&a);}
inline void scan(ll&a){scanf("%lld",&a);}
inline void scan(char&a){scanf(" %c",&a);}
inline void scan(double&a){scanf("%lf",&a);}
template<typename T>
inline void scan(std::vector<T>&v){for(auto&& sv:v){scan(sv);}}
template<typename First,typename...Args>
inline void scan(First&f,Args&...args){scan(f);scan(args...);}
inline void scan(std::string&s){char BUF[3000000];scanf(" %s",BUF);s=std::string(BUF);}
inline void print(int a){printf("%d\n",a);}
inline void print(ll a){printf("%lld\n",a);}
inline void print(double a){printf("%.12f\n",a);}
inline void print(std::string s){std::cout<<s<<"\n";}

using namespace std;

void yesno(bool b) {
  if (b) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  exit(0);
}

void solve() {
  int n, m;
  scan(n, m);
  vi a(m);
  scan(a);
  int total = 0;
  rep (i, m) {
    total += a[i];
  }
  int ans = max(-1, n - total);
  print(ans);
}

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


Measured memory_bytes: 3268
//#pragma GCC optimize(2)
// Happy TLE and WA every day!
// by: zxb the vegetable chicken
#include<bits/stdc++.h>
#define mp              make_pair
#define rep(i,n)        for(int i = 0; i < n; i++)
#define foreach(i,c)    for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define BINF            0x7fffffff
#define INF             0x3f3f3f3f
#define LINF            4557430888798830399
#define END(s)          {cout<<s; return 0;}
#define CON(s)          {cout<<s; continue;}
#define BRE(s)          {cout<<s; break;}
#define pb              push_back
#define All(a)          a.begin(), a.end()  //with A in CAPITAL!!!
#define sz(a)           (int)a.size()
#define F               first
#define S               second
#define Time            clock()/CLOCKS_PER_SEC
//#define usingFiles
using namespace std;

typedef unsigned int ui;
typedef pair<int, int> pii;
typedef long long ll;

inline bool Read(int& x){
	x = 0;
	int c;
	int sign = 1;
	while( (c = getchar()) < '0' || c > '9' ) if(c == '-') sign = -1;
	x = c ^ '0';
	while( (c = getchar()) >= '0' && c <= '9' ) x = (x<<3) + (x<<1) + (c ^ '0');
	x *= sign;
	return 1;
}

inline bool Write(int x){
	if(x >= 10) Write(x / 10);
	putchar(x % 10 + '0');
	return 1;
}

const int rp = 666666;
const bool debug = 1;
const bool I_good_vegetable_a = 1;

int n;
int a[100100];
int b[100100];
int diff[100100];
int cnt = 0;
ll sum = 0ll;
ll sum_minus = 0ll;

signed main(){
	ios::sync_with_stdio(false);
	#ifdef usingFiles
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	cin >> n;
	rep(i, n) cin >> a[i];
	rep(i, n) cin >> b[i];
	rep(i, n){
		diff[i] = a[i] - b[i];
		sum += diff[i];
		if(diff[i] < 0) cnt++, sum_minus -= diff[i];
	}
	if(sum < 0){
		cout << "-1\n";
		return 0;
	}
	sort(diff, diff + n);
	int i = n - 1;
	while(sum_minus > 0){
		sum_minus -= diff[i];
		i--;
		cnt++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 1408
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>

int main(void) {


	char word[250];
	char word2[250];
	char *p;
	char *p2;
	char *pTmp;

	int shuffleNum;
	int pos;

	for(;;) {
		scanf("%s", word);
		if (word[0] == '-') {
			break;
		}
		int len = strlen(word);
		scanf("%d", &shuffleNum);
		p = word;
		p2 = word2;
		for (int i = 0; i < shuffleNum; i++) {
			scanf("%d", &pos);
			strncpy(p2, &p[pos], len - pos);
			p2[len - pos] = '\0';
			strncat(p2, p, pos);
			pTmp = p;
			p = p2;
			p2 = pTmp;
		}
		printf("%s\n", p);
	}
	return 0;

}

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

static const int N=100;

main(){
int n,p[N+1],m[N+1][N+1];

cin >> n;

for(int i=1;i<=n;i++){
cin >> p[i-1] >> p[i];
}

for(int i=1;i<=n;i++)m[i][i]=0;
for(int l=2;l<=n;l++){
for(int i=1;i<=n-l+1;i++){
int j=i+l-1;
m[i][j]=(1 << 21);
for(int 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]);
}
}
}

cout << m[1][n] << endl;

return 0;
}

Measured memory_bytes: 3128
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ln(a) cout << (a) << endl
#define debug(a, n) rep(hoge, n) printf("%lld%c", a[hoge], hoge == (n) - 1? '\n' : ' ');
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define INF 1e9
#define LINF 1e18
#define MOD 1000000007
#define EPS 0.00000001

using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;

signed main() {
    int a, b;
    cin >> a >> b;
    if(a > b) {
        int tmp = a;
        a = b;
        b = tmp;
    }
    rep(i, b) cout << a;
    ln("");
}


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

typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define ALL(obj) (obj).begin(), (obj).end()
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; }

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


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

    ll x; cin>>x;
    if(x==0)puts("1");
    else puts("0");

    return 0;

}

Measured memory_bytes: 3632
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
const int MOD = 1000000007;
int main() {
    long long N, K;
    cin >> N >> K;
    int A[2010];
    long long res = 0;
    long long dai = 0;
    long long syo = 0;
    rep(i, 0, N) { cin >> A[i]; }
    rep(i, 0, N) {
        rep(r, 0, N) {
            if(A[i] > A[r]) {
                if(i < r) {
                    dai++;
                }
                syo++;
            }
        }
    }

    res = (dai * K) % MOD;
    long long K1 = K;
    long long K2 = (K - 1);
    if(K % 2 == 0) {
        K1 = K1 / 2;
    } else {
        K2 = K2 / 2;
    }
    long long a = (syo * K1) % MOD;
    long long b = (a * K2) % MOD;
    res = (res + b) % MOD;
    cout << res << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <queue>
using namespace std;

typedef int64_t ll;
const ll INF = 1000000000000000000;
#define fori(i, a, b) for (ll i = (a); i < (b); ++i)
#define ford(i, a, b) for (ll i = (b - 1); (a) <= i; --i)
#define rep(i, n) fori(i, 0, n)
#define vll vector<ll>
#define all(v) v.begin(), v.end()


int main() {
	vll a(3);
	cin >> a[0] >> a[1] >> a[2];
	sort(all(a));
	cout << a[0] + a[1] + a[2] * 10 << endl;

}


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

using namespace std;

int main(){
     int a;
     int k[32] = {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};
     cin >> a;
     cout << k[a - 1] << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
    char s[102];
    scanf("%s", s);
    int i, j;
    char t[8] = "keyence";
    i = j = 0;
    while (s[i] == t[j] && i < strlen(s))
    {
        i++;
        j++;
    }
    i = strlen(s) - 7 + j;
    while (s[i] == t[j] && i < strlen(s))
    {
        i++;
        j++;
    }
    if (i == strlen(s))
        printf("YES\n");
    else
        printf("NO\n");
    return 0;
}

Measured memory_bytes: 256
#![allow(unused)]

use proconio::{input, fastout};
use proconio::marker::{Chars, Usize1};

#[fastout]
fn main() {
    input! {
        mut n: i64,
    }

    let mut s = vec![];

    n -= 1;

    for i in 1.. {
        if n >= 26i64.pow(i) {
            n -= 26i64.pow(i);
        } else {
            for j in 0..i {
                s.push(('a' as u8) + ((n % 26) as u8));
                n /= 26;
            }
            break;
        }
    }

    s.reverse();
    println!("{}", std::str::from_utf8(&s).unwrap());
}


Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  map<char, char> m;
  m['A']='T';
  m['T']='A';
  m['C']='G';
  m['G']='C';
  string s;
  cin>>s;
  for(char c:s) cout<<m[c];
  cout<<endl;
  return 0;
}


Measured memory_bytes: 256
d=[]
v,e,r=list(map(int,input().split()))
edges=[list(map(int,input().split())) for i in range(e)]

def bellman_ford(s):
  global d
  d=[float('inf') for i in range(v)]
  d[s]=0

  for i in range(v-1):
    for s,t,w in edges:
      if d[t] > d[s]+w:
        d[t] = d[s]+w

  for s,t,w in edges:
    if d[s]+ w<d[t]:
      return False
  return True

if bellman_ford(r):
  for w in d:
    if w== float('inf'):
      print('INF')
    else:
      print(w)
else:
  print('NEGATIVE CYCLE')



Measured memory_bytes: 6120
#include <cassert>
#include <cstddef>
#include <utility>
#include <vector>

class UnionFind {

public:
	using difference_type = std::ptrdiff_t;
	using container_type = std::vector<difference_type>;
	using size_type = typename container_type::size_type;

protected:
	container_type c;

public:
	UnionFind() : c() {}
	explicit UnionFind(const size_type size) : c(size, -1) {}

	size_type size() const { return c.size(); }
	bool empty() const { return c.empty(); }

	size_type find(size_type x) {
		assert(x < size());
		while (c[x] >= static_cast<difference_type>(0)) {
			if (c[static_cast<size_type>(c[x])] >= static_cast<difference_type>(0))
				c[x] = c[static_cast<size_type>(c[x])];
			x = static_cast<size_type>(c[x]);
		}
		return x;
	}
	bool same(const size_type x, const size_type y) {
		assert(x < size());
		assert(y < size());
		return find(x) == find(y);
	}
	size_type size(const size_type x) {
		assert(x < size());
		return static_cast<size_type>(-c[find(x)]);
	}

	bool unite(size_type x, size_type y) {
		assert(x < size());
		assert(y < size());
		x = find(x);
		y = find(y);
		if (x == y)
			return false;
		if (c[x] > c[y])
			std::swap(x, y);
		c[x] += c[y];
		c[y] = static_cast<difference_type>(x);
		return true;
	}
};

#include<iostream>

int main() {
	int n, q;
	std::cin >> n >> q;
	UnionFind T(n);
	while (q--) {
		int p, a, b;
		std::cin >> p >> a >> b;
		if (p)
			std::cout << (T.same(a, b) ? "1" : "0") << std::endl;
		else
			T.unite(a, b);
	}
	return 0;
}



Measured memory_bytes: 3184