akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES

#include <iostream>
#include <iterator>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <unordered_set>
#include <climits>
#include <ctime>

using namespace std;
using ll = long long;
const ll INF = 0x3f3f3f3f3f3f3f3fLL;

void solve() {
	int n;
	cin >> n;
	ll p3n = 1;
	ll p2k = 1;
	for (int i = 0; i < n; ++i) {
		int a;
		cin >> a;
		if (a % 2 == 0)
			p2k *= 2;
		p3n *= 3;
	}
	cout << p3n - p2k;
}

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	solve();

#ifdef LOCAL
	cerr << double(clock()) / CLOCKS_PER_SEC << " sec" << endl;
#endif
	return 0;
}

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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

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

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF   = 1e9;
const ll  INFLL = 1e18;
typedef pair<int, int> PII;
typedef vector<vector<int>> Graph;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

int main()
{
    ios::sync_with_stdio(false);

    vector<int> A(3);
    rep(i, 3) cin >> A[i];
    sort(ALL(A));
    cout << (A[0] == A[1] ? A[2] : A[0]) << endl;
}

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

int main() {
   int S, a, b, c;
   cin >> S;
   a = S/3600;
   int d = S % 3600;
   b = d/60;
   c = d % 60;
   cout << a << ":" << b << ":" << c << endl;
   return 0;
}

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

void fnInput(vector<string>& rvsGrid)
{
  int nHigh, nWide;
  cin >> nHigh >> nWide;

  rvsGrid.resize(nHigh);
  for (int ny = 0; ny < nHigh; ny++)
    cin >> rvsGrid[ny];
}

int fnRepaint(int ny, int nx, const vector<string>& cnrvsGrid)
{
  if (   ny >= 0  && ny < cnrvsGrid.size()
      && nx >= 0  && nx < cnrvsGrid[ny].size())
    if (cnrvsGrid[ny][nx] == '#')
      return 1;
    else;

  return 0;
}

int fnGridRepaint(const vector<string>& cnrvsGrid)
{
  const vector<int> cnvnDy = {-1,  0,  1,  0};
  const vector<int> cnvnDx = { 0, -1,  0,  1};

  for (int ny = 0; ny < cnrvsGrid.size(); ny++)
    for (int nx = 0; nx < cnrvsGrid[ny].size(); nx++)
      if (cnrvsGrid[ny][nx] == '#')
      {
        bool bRslt = false;
        for (int i = 0; i < cnvnDy.size(); i++)
          if (fnRepaint(ny + cnvnDy[i], nx + cnvnDx[i], cnrvsGrid))
            bRslt = true;

        if (!bRslt)  return 0;
      }

  return 1;
}

int main()
{
  vector<string> vsGrid;

  fnInput(vsGrid);
  if (fnGridRepaint(vsGrid))  cout << "Yes" << endl;
  else                        cout << "No"  << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
 
#define mod(cans) cans%10**9+7
#define cin_pl(x,y) for(int i=0;i<x;i++){cin>>y[i];}
#define debug(x) cout << "Debug" << x << "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define prians(Answer) cout<<Answer<<"\n"
#define TF(X) X==1?cout<<"Yes\n":cout<<"No\n"
#define elcon else{continue;}
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<vector<int>> matrix;
typedef pair<int,int> pr;
typedef vector<pr> vpt;
typedef greater<int> gi;
 
int main()
{
    int n,k,q;
    cin>>n>>k>>q;
    vi a(q);
    cin_pl(q,a);
    int point[n]={};
    rep(i,q)
    {
        point[a[i]-1]++;
    }
    rep(i,n)
    {
        if(k+point[i]-q>0)
        {
            cout<<"Yes\n";
        }
        else
        {
            cout<<"No\n";
        }
        
    }

}

Measured memory_bytes: 1408
#include <stdio.h>
int main() {
  int n,i,a[100000],b[100000];
  long long c=0;
  scanf("%d",&n);
  for (i=0;i<n;i++) {
    scanf("%d %d",&a[i],&b[i]);
  }
  while (n--) {
    c+=(b[n]-(a[n]+c)%b[n])%b[n];
  }
  printf("%lld\n",c);
  return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int mod=1000000007;
//const long double PI =3.14159265358979323846264338327950;
//const long double PI =3.141592653589793238462
#define PI 3.14159265358979323846264338327950L
#define INF 1000000000000
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define FOR(i,n) for(int i=0;i<(n);i++)
#define FORA(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define count_1(n)  __builtin_popcountll(n)
#define parity(n)   __builtin_parityll(n)   //Even parity 0 as output
void show    (int a[], int arraysize) { for (int i = 0; i < arraysize; ++i)  {cout << a[i] << " ";}	cout<<endl;}
int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b);}
void sieve(int n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    for (int p=2; p<=n; p++)
       if (prime[p])
          cout << p << " ";
}

int main()
{FAST
ld a,b,h,m,ang;
cin>>a>>b>>h>>m;
ang = PI*2*(h / 12.0 + (m / 60.0) / 12.0 - m / 60.0);
ld k=pow(a,2)+pow(b,2)-2*a*b*cos((ang));
cout << fixed << setprecision(20)<<pow(k,0.5);
return  0;
}





Measured memory_bytes: 4168
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.ABC_127
{
    class A
    {
        static void Main(string[] args)
        {
            Method(args);
        }

        static void Method(string[] args)
        {
            int[] ab = ReadInts();
            int a = ab[0];
            int b = ab[1];
            if (a <= 5) WriteLine(0);
            else if (a <= 12) WriteLine(b / 2);
            else WriteLine(b);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 13140
#!/usr/bin/python
import sys
if sys.version_info[0]>=3: raw_input=input
a=[1,1,2]
for i in range(3,31): a.append(a[i-1]+a[i-2]+a[i-3])
while True:
	n=int(raw_input())
	if n==0: break
	print((a[n]+3649)//3650)

Measured memory_bytes: 4208
#include<iostream>
using namespace std;
int n;
long long int A,B;
int main(){
	int n;
	A=B=1;
	for(cin>>n; n--;){
		long long int X,Y;
		cin>>X>>Y;
		long long int AA = (A-1)/X + 1;
		long long int BB = (B-1)/Y + 1;
		long long int CC = AA>BB?AA:BB;
		A = X * CC;
		B = Y * CC;
	}
	cout<<A+B<<endl;
	return 0;
}


Measured memory_bytes: 256
#define _USE_NATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <random>
#include <tuple>


using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
#define EPS 1e-9
const int INF = 1050000000;
const long long LINF = 1LL << 60;
const ll MOD = 1e9 + 7;
const int MINF = -1050000000;



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

	string abc = "abcdefghijklmnopqrstuvwxyz";
	ll ans = 1;
	ll cnt = 1;
	rep(i, abc.size()) {
		rep(j, s.size()) {
			if (abc[i] == s[j]) cnt++;
		}
		ans *= cnt;
		ans = ans % MOD;
		cnt = 1;
	}
	ans--;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <iomanip>
#include <string>
#include <queue>
#include <numeric>
#include <functional>
#include <array>
#include <map>
#include <set>

#define INF 1000000007 //1000000000000000003
#define MOD 1000000007
#define MAX 2000005

#define ll long long

//printf("%.10f", );
//cout << fixed << setprecision(10) << heikin << endl;
//vector<vector<int>> data(3, vector<int>(4, -1));
//left + 1 < top

using namespace std;
using P = pair<int, int>;
using Pc = pair<double, int>;
using T = tuple<int, int, int>;
using edge = struct { int to; long long dist; };
const double PI = 3.141592653589793;
long long fact[MAX], inv[MAX];
int dx[] = { -1,0,1,0 };
int dy[] = { 0,-1,0,1 };

//////////////////////////////////

vector<vector<int>> bingo(3, vector<int>(3));
vector<vector<int>> tree(100005);
int color[100005];
map<P, int>colorMap;
int m = 0;

struct BridgeInfo {
	int town1;
	int town2;
	int year;
	BridgeInfo(int t1, int t2, int y) {
		town1 = t1;
		town2 = t2;
		year = y;
	}
};

struct People {
	int index;
	int town;
	int year;
	People(int i, int t, int y) {
		index = i;
		town = t;
		year = y;
	}
};

bool compare_by_second(pair<int, int> a, pair<int, int> b) {
	if (a.second != b.second) {
		return a.second < b.second;
	}
	else {
		return a.first < b.first;
	}
}

struct UnionFind {
	vector<int>uf;

	UnionFind(int size) :uf(size, -1) {};

	int root(int target) {
		if (uf[target] < 0)return target;
		else return uf[target] = root(uf[target]);
	}

	void merge(int a, int b) {
		a = root(a);
		b = root(b);
		if (a == b)return;
		if (uf[b] < uf[a])swap(a, b);
		uf[a] += uf[b];
		uf[b] = a;
	}
};

ll CalcPow(ll num, ll power) {
	if (power == 0)return 1;
	if (power % 2 == 0) {
		ll half = CalcPow(num, power / 2);
		return (half * half) % MOD;
	}
	else return (num * CalcPow(num, power - 1)) % MOD;
}

ll combination(ll all, ll select) {
	if (all < select) return 0;
	if (all < 0 || select < 0) return 0;
	return fact[all] * (inv[select] * inv[all - select] % MOD) % MOD;
}

void initCombination(int max) {
	fact[0] = fact[1] = 1;
	for (int i = 2; i <= max; ++i) {
		fact[i] = fact[i - 1] * i % MOD;
	}

	inv[max] = CalcPow(fact[max], MOD - 2);
	for (int i = max - 1; 0 <= i; --i) {
		inv[i] = (inv[i + 1] * (i + 1)) % MOD;
	}
}

struct Connection {
	vector<int>friends;
	vector<int>block;
	vector<int>friendable;
	Connection() {};
};

int main() {

	int K, N;
	cin >> K >> N;

	int md = 0;
	int a1;
	int ba;
	cin >> a1;
	ba = a1;
	for (int i = 1; i < N;++i) {
		int currentA;
		cin >> currentA;
		int d = currentA - ba;
		if (md < d) md = d;
		if (i == N - 1) {
			int d = (K - currentA) + a1;
			if (md < d) md = d;
		}
		ba = currentA;
	}
	int ans = K - md;
	cout << ans << endl;
}



Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
	string s,t;
	cin>>s>>t;
	int res=0;
	for(int i=0;i<3;i++){
		if(s[i]==t[i])
			res++;
	}
	cout<<res<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;

const long long mod = 1000000007;
vector<long long> pos, neg; int zero;

int main()
{
	int n, k; scanf ("%d %d", &n, &k);
	for (int i = 0; i < n; i++){
		int x; scanf ("%d", &x);
		if (x > 0) pos.push_back(x);
		else if (x < 0) neg.push_back(-x);
		else zero++;
	}

	if (pos.size() + neg.size() < k){
		puts("0");
		return 0;
	}

	sort(pos.rbegin(), pos.rend());
	sort(neg.rbegin(), neg.rend());

	int i = 0, j = 0;
	while (i + j < k){
		if (j == neg.size() || i < pos.size() && pos[i] > neg[j]) i++;
		else j++;
	}

	if (j % 2){
		long long u1 = 0, v1 = 1;
		long long u2 = 0, v2 = 1;
		
		if (i < pos.size() && j > 0) u1 = pos[i], v1 = neg[j - 1];
		if (i > 0 && j < neg.size()) u2 = neg[j], v2 = pos[i - 1];
		if (u1 || u2){
			if (u1 * v2 > v1 * u2) i++, j--;
			else i--, j++;
		}
	}

	long long a = 1;
	if (j % 2){
		sort(pos.begin(), pos.end());
		sort(neg.begin(), neg.end());
	}
	for (int p = 0; p < i; p++) a = a * pos[p] % mod;
	for (int n = 0; n < j; n++) a = a * (mod - neg[n]) % mod;
	if (j % 2 && zero) a = 0;

	printf ("%lld\n", a);
	return 0;
}

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

typedef struct {
	int t, h;
} edge;

typedef struct List {
	struct List *next;
	edge *e;
} list;

typedef struct {
	edge *e;
	list **inc;
} graph;

void input_graph(graph *G, int n, int m)
{
	int i;
	list *data = (list*)malloc(sizeof(list) * m * 2);
	G->e = (edge*)malloc(sizeof(edge) * m);
	G->inc = (list**)malloc(sizeof(list*) * (n + 1));
	for (i = 0; i < m; i++) {
		scanf("%d %d", &(G->e[i].t), &(G->e[i].h));
		data[i*2].e = &(G->e[i]);
		data[i*2+1].e = &(G->e[i]);
		data[i*2].next = G->inc[G->e[i].t];
		data[i*2+1].next = G->inc[G->e[i].h];
		G->inc[G->e[i].t] = &(data[i*2]);
		G->inc[G->e[i].h] = &(data[i*2+1]);
	}
}

int main()
{
	int i, N, M;
	graph G;
	scanf("%d %d", &N, &M);
	if (M % 2 == 1) {
		printf("-1\n");
		fflush(stdout);
		return 0;
	}
	input_graph(&G, N, M);
	
	int k = 0, v, tmp, parity[100001] = {}, flag[100001] = {}, q[100001], head, tail;
	edge *prev[100001];
	list *p;
	for (i = 1; i <= N; i++) {
		for (p = G.inc[i]; p != NULL; p = p->next) if (p->e->t == i) parity[i] ^= 1;
	}
	while (1) {
		for (i = 1; i <= N; i++) if (parity[i] == 1) break;
		if (i > N) break;
		
		q[0] = i;
		parity[i] = 0;
		flag[i] = ++k;
		for (head = 0, tail = 1; head < tail; head++) {
			for (p = G.inc[q[head]]; p != NULL; p = p->next) {
				v = (p->e->t == q[head])? p->e->h: p->e->t;
				if (flag[v] < k) {
					flag[v] = k;
					prev[v] = p->e;
					q[tail++] = v;
				}
				if (parity[v] == 1) {
					parity[v] = 0;
					break;
				}
			}
			if (p != NULL) break;
		}
		if (head == tail) {
			printf("-1\n");
			fflush(stdout);
			return 0;
		} else {
			for (; v != i; v = (prev[v]->t == v)? prev[v]->h: prev[v]->t) {
				tmp = prev[v]->h;
				prev[v]->h = prev[v]->t;
				prev[v]->t = tmp;
			}
		}
	}
	
	for (i = 0; i < M; i++) printf("%d %d\n", G.e[i].t, G.e[i].h);
	fflush(stdout);
	return 0;
}

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

using namespace std;
#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
//rep…「0からn-1まで」の繰り返し
#define rep2(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep2…「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=s;i>=(long long)(n);i--)
//repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

const int inf = 1e9+7;
const int mod = 1e9+7;

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

    int xl=0,xr=w,yu=h,yd=0;

    rep(i,n){
        int x,y,a;
        cin>>x>>y>>a;

        if(a==1) xl=max(xl,x);
        else if(a==2) xr=min(xr,x);
        else if(a==3) yd=max(yd,y);
        else if(a==4) yu=min(yu,y);
    }

    cout<<max(0,xr-xl)*max(0,yu-yd)<<endl;

}


Measured memory_bytes: 3632
#include<cstdio>
#include<algorithm>
#include<set>
using namespace std;
int n;
long long X[101000], L[101000], low;
int main() {
	int i;
	scanf("%d", &n);
	long long sum = 0;
	for (i = 1; i <= n; i++) {
		int b, e, d;
		scanf("%d%d", &b, &e);
		d = e - b;
		X[i] = b - sum;
		sum += e - b;
		L[i] = d;
	}
	multiset<long long>S1, S2;
	long long ss = 0;
	for (i = 1; i <= n; i++) {
		long long be, ed;
		if (i != 1) {
			ss += L[i] + L[i - 1];
			ed = *S2.begin();
			be = *S1.rbegin() - ss;
			if (ed < X[i]) {
				low += X[i] - ed;
			}
			if (X[i] < be) {
				low += be - X[i];
			}
		}
		S1.insert(ss + X[i]);
		S2.insert(X[i]);
		auto it = S1.end();
		it--;
		long long z1 = *it - ss;
		long long z2 = *S2.begin();
		if (z1 > z2) {
			S1.erase(it);
			S2.erase(S2.begin());
			S1.insert(z2 + ss);
			S2.insert(z1);
		}
	}
	printf("%lld\n", low);
	return 0;
}

Measured memory_bytes: 11136
// E.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <bitset>

using namespace std;

typedef long long LL;

LL solve(LL n) {
	LL ans = 0;
	if ((n % 2) == 0) {
		n /= 2;
		while (n > 0) {
			n /= 5;
			ans += n;
		}
	}
	return ans;
}

int main(int argc, char* argv[]) {

#ifdef _MSC_VER
	while (true)
#endif
	{
		LL n = -1, ans = 0;
		cin >> n;
		if (n < 0) return 0;
		ans = solve(n);
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include<algorithm>
#include<stdio.h>
#include<string>
#include<math.h>
#include<set>
using namespace std;

void itsvgg() 
{
    ios::sync_with_stdio(0);cin.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt", "w", stdout);
    #endif
} 

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);	
    itsvgg();
	
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    	cin>>a[i];
    long long int dp[n+1][n+1];

    for(int i=n-1;i>-1;i--)
    {
    	for(int j=i;j<n;j++)
    	{
    		if(i==j)
    			dp[i][j]=a[i];
    		else
    		{
                dp[i][j]=max((a[i]-dp[i+1][j]),(a[j]-dp[i][j-1]));
    		}

    	}
    	//cout<<dp[i][n-1]<<endl;

    }



    cout<<dp[0][n-1]<<endl;


}


Measured memory_bytes: 49252
#include <iostream>
#include <string>
#include <vector>

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

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

  const int MOD = 1000000007;

  vector<long long> m(2001, 0);
  m[0] = 1;
  for (int i = 3; i <= S; i++)
  {
    long long num = 0;
    for (int j = 3; j <= i; j++)
    {
      num += m[i - j];
      num %= MOD;
    }
    m[i] = num;
  }

  cout << m[S] << endl;

  return 0;
}


Measured memory_bytes: 3628
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
 
public class Main {
 
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		double n = sc.nextDouble();
		System.out.println(n * 2 * Math.PI);
		;
 
	}
 
	static int getDigit(int n, int d) {
		return n / d != 0 ? 1 + getDigit(n / d, d) : 1;
	}
 
	static class FastScanner {
		private BufferedReader reader;
		private StringTokenizer tokenizer;
 
		public FastScanner(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
			tokenizer = null;
		}
 
		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
 
		public String nextLine() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					return reader.readLine();
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
 
			return tokenizer.nextToken("\n");
		}
 
		public long nextLong() {
			return Long.parseLong(next());
		}
 
		public int nextInt() {
			return Integer.parseInt(next());
		}
 
		public double nextDouble() {
			return Double.parseDouble(next());
		}
 
		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}
	}
}

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

int main()
{
    int n;
    cin>>n;
   // int p=-1;
    int dp[100002][3];
    cin>>dp[0][0]>>dp[0][1]>>dp[0][2];

     int a,b,c;
    for(int i=1;i<n;i++)
    {
         cin>>a>>b>>c;
         dp[i][0]=a+max(dp[i-1][1],dp[i-1][2]);
         dp[i][1]=b+max(dp[i-1][0],dp[i-1][2]);
         dp[i][2]=c+max(dp[i-1][1],dp[i-1][0]);
         
        
       
    }
    cout<<max(max(dp[n-1][1],dp[n-1][2]),max(dp[n-1][1],dp[n-1][0]));


}

Measured memory_bytes: 1408
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;
const int INF=1e9;

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(){
    string s;
    cin>>s;
    vector<int> vec(s.size(),0);
    for(int i=0; i<s.size(); i++){
        if(s[i]=='A'||s[i]=='T'||s[i]=='C'||s[i]=='G'){
            vec[i]=1;
        }
    }
    int ans=0;
    int res=0;
    for(int i=0; i<vec.size(); i++){
        if(vec[i])res++;
        else{
            chmax(ans, res);
            res=0;
        }
    }
    if(res)chmax(ans, res);
    cout<<ans<<endl;
}
    


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL long long
#define maxn 100005

using namespace std;
int jishu(int a,int b,int c)
{
    return a*a+b*b+c*c+a*b+b*c+c*a;
}
int main()
{
   int n;
   cin>>n;
   LL ans[10000+5];
   memset(ans,0,sizeof(ans));
   for(int i=1;i<=100;i++)
   {
       for(int j=i;j<=100;j++)
       {
           for(int k=j;k<=100;k++)
           {
               if(jishu(i,j,k)>10000)
               {
                   break;
               }
               else
               {
                   int tmp=jishu(i,j,k);
                   if(i==j&&j==k)
                   {
                       ans[tmp]++;
                   }
                   else if(i==j||j==k||k==i)
                    ans[tmp]+=3;
                   else
                    ans[tmp]+=6;
               }
           }
       }
   }
   for(int i=1;i<=n;i++)
    cout<<ans[i]<<endl;
}


Measured memory_bytes: 3624
#include<iostream>
#include<cstring>
#include<algorithm>
#include<vector>
#include<cmath>
#include<limits>
#define ll long long
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF_int 2147483647
using namespace std;

int main(){
  int L,R;
  int min = INF_int;
  //cout << min << endl;
  cin >> L >> R;
  // Any interger I is equal to i(mod 2019)
  if(R - L >= 2018){ // Chain >= 2019 <-> R-L >= 2018
    min = 0;
    //cout << 1111 << endl;
  }
  else{
    /*
    Caaes zero-zero p1<p2 p1-zero p1>p2
    */
    L %= 2019;
    R %= 2019;
    if(L == 0 || R == 0){
      min = 0;
      //cout << 2222 << endl;
    }
    else{
      if(L > R){
        min = 0;
        //cout << 3333 << endl;
      }
      else{
        for(int i = L; i <= R; i++){
          for(int j = i + 1; j <= R; j++){
            int k = i * j;
            k %= 2019;
            k < min ? min = k:1;
            //cout << "rep" << i  << " " << j << endl;
          }
        }
      }
    }
  }
  cout << min << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define modulo 998244353
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000000000



int main(){
	
	long long M;
	cin>>M;
	
	long long cnt=0,sum=0;
	
	for(int i=0;i<M;i++){
		long long d,c;
		cin>>d>>c;
		cnt+=c;
		sum+=c*d;
	}
	
	long long ans = 0;
	ans += cnt-1;
	ans += (sum-1)/9;
	
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000009LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

ll fact[3000005];
ll extgcd(ll a,ll b,ll& x,ll &y){
	ll d=a;
	if(b!=0LL){
		d=extgcd(b,a%b,y,x);
		y-=(a/b)*x;
	}else{
		x=1;
		y=0;
	}
	return d;
}

ll mod_inverse(ll a,ll m){
	ll x,y;
	extgcd(a,m,x,y);
	return (m+x%m)%m;
}

ll mod_fact(ll n,ll p,ll &e){
	e=0;
	if(n==0)return 1;
	ll res=mod_fact(n/p,p,e);
	e+=n/p;
	if(n/p%2!=0){
		return res*(p-fact[n%p])%p;
	}
	return res*fact[n%p]%p;
}

ll mod_comb(ll n,ll k,ll p){
	if(n<0 || k<0 || n<k)return 0;
	ll e1,e2,e3;
	ll a1=mod_fact(n,p,e1),a2=mod_fact(k,p,e2),a3=mod_fact(n-k,p,e3);
	if(e1>e2+e3)return 0;
	return a1*mod_inverse(a2*a3%p,p)%p;
}

int n,m;
int a[20],b[20],c[20];
ll dp[1000005];
vector<int> G[3000005];
bool used[3000005];
int siz[5];
int now=0;

void dfs(int v){
	now++;
	used[v]=true;
	for(int i=0;i<G[v].size();i++){
		if(!used[G[v][i]]){
			dfs(G[v][i]);
		}
	}
}

int main(void){
	scanf("%d%d",&n,&m);
	fact[0]=1;
	for(ll i=1;i<=n*3;i++){
		fact[i]=fact[i-1]*i%MOD;
	}
	dp[0]=1;
	for(int i=1;i<=n;i++){
		dp[i]=dp[i-1]*mod_comb(i*3,3,MOD)%MOD;
	}
	for(int i=1;i<=n;i++){
		dp[i]=dp[i]*mod_inverse(fact[i],MOD)%MOD;
	}
	for(int i=0;i<m;i++){
		scanf("%d%d%d",&a[i],&b[i],&c[i]);
		a[i]--;
		b[i]--;
	}
	ll ans=0;
	for(int i=0;i<(1<<m);i++){
		queue<int> que,cla;
		bool flag=true;
		int cnt=0;
		for(int j=0;j<m;j++){
			if(i>>j & 1){
				G[a[j]].push_back(b[j]);
				G[b[j]].push_back(a[j]);
				que.push(a[j]);
				que.push(b[j]);
				cla.push(a[j]);
				cla.push(b[j]);
				if(c[j]==1){
					cnt++;
				}
			}else{
				if(c[j]==0)flag=false;
			}
		}
		if(flag){
			bool ng=false;
			memset(siz,0,sizeof(siz));
			while(que.size()){
				int v=que.front();
				que.pop();
				if(!used[v]){
					now=0;
					dfs(v);
					if(now>=4){
						ng=true;
					}else{
						siz[now]++;
					}
				}
			}
			if(ng)goto bye;
			siz[1]=3*n-siz[2]*2-siz[3]*3;
			ll val=1;
			while(siz[2]>0){
				val=val*siz[1]%MOD;
				siz[1]--;
				siz[2]--;
			}
			val=val*dp[siz[1]/3]%MOD;
			if(cnt%2==0){
				ans=(ans+val)%MOD;
			}else{
				ans=(ans-val+MOD)%MOD;
			}
		}
		bye:
		while(cla.size()){
			int v=cla.front();
			cla.pop();
			used[v]=false;
			G[v].clear();
		}
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 104832
import sys

input = sys.stdin.readline

N = int(input().strip())
Hs = list(map(int, input().strip().split(' ')))

current_max = 0
for i in range(N - 1):
    if Hs[i] > current_max:
        Hs[i] -= 1
        current_max = Hs[i]

    if Hs[i] > Hs[i+1]:
        print('No')
        sys.exit(0)

print('Yes')

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

void show(vector<ll>& vc)
{
    for(auto it:vc)cout<<it<<" ";
    cout<<endl;
}
#define M 300014



/**
int marked[M/64 + 2];

#define on(x) (marked[x/64] & (1<<((x%64)/2)))
#define mark(x)  marked[x/64] |= (1<<((x%64)/2))

void bitwiseSieve() {
  for (int i = 3; i * i <=M; i += 2) {
    if (!on(i)) {
      for (int j = i * i; j <= M; j += i + i) {
        mark(j);
      }
    }
  }
}

bool isPrime(int num) {
  return num > 1 && (num == 2 || ((num & 1) && !on(num)));
}
**/


/**
vector<ll>phi(M+2);
bool p[M+2];

void euler_phi(void)
{

    for(ll i=0;i<=M;i++)phi[i]=i;
    memset(p,0,sizeof p);
    p[1]=1;
    p[0]=1;
    phi[1] = 0;

    for(ll i=2; i<=M; i++)
    {

        if(!p[i])
        {

            for(ll j=i; j<=M; j+=i)
            {
                p[j]=1;
                phi[j]/=i;
                phi[j]*=(i-1);

            }
            p[i]=0;
        }
    }


}
//**/


/**
bool p[M+2];
vector<ll>prime;
void seive(void)
{

    memset(p,0,sizeof p);
    p[1]=1;
    p[0]=1;

    for(ll i=4; i<=M; i+=2)
    {
        p[i]=1;

    }

    for(ll i=3; i*i<=M; i+=2)
    {

        if(!p[i])
        {

            for(ll j=i*i; j<=M; j+=2*i)
            {
                p[j]=1;

            }
        }
    }

    prime.push_back(2);
    for(ll i=3; i<=M; i+=2)prime.push_back(i);
}
//**/


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

/**
typedef pair<ll, ll> pii;
#define x first
#define y second


pii extendedEuclid(ll a, ll b)   // returns x, y | ax + by = gcd(a,b)
{
    if(b == 0) return pii(1, 0);
    else
    {
        pii d = extendedEuclid(b, a % b);
        return pii(d.y, d.x - d.y * (a / b));
    }
}

ll modularInverse(ll a, ll n)
{
    pii ret = extendedEuclid(a, n);
    return ((ret.x % n) + n) % n;
}
//**/


/**
ll bigmod(ll a, ll b, ll c)
{
    if(b==0)return 1;
    if(b%2)
    {
        ll p = bigmod(a,b-1,c);
        return (a*p)%c;
    }
    else
    {
        ll p = bigmod(a,b/2,c);
        return (p*p)%c;
    }
}
//**/



void solve(ll t)
{


    string s;
    cin>>s;
    deque<ll>q;
    for( ll i=0; i<s.size();i++)
    {
        if(s[i]=='0')q.push_back(0);
        else if(s[i]=='1')q.push_back(1);
        else if(s[i]=='B' && q.size())q.pop_back();
    }

    for(auto it: q)cout<<it;
    cout<<endl;




}


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

//    ios_base::sync_with_stdio(false);
//    cin.tie(NULL);

    /**seive();        //**/
    /** euler_phi();    //**/
    /** show(phi);      //**/
    /** bitwiseSieve(); //**/





    ll t=1;
    //scanf("%lld",&t);
    ll T=t;



    while(t--)
    {


        solve(T-t);

    }
    return 0;
}


Measured memory_bytes: 3524
#include <iostream>
#include <string>
using namespace std;
 
int main() {
    string str;
    int A_pos,Z_pos;
    cin >> str;
    A_pos = str.length();
    Z_pos = 0;
    for(int i=0; i<str.length() ; i++){
      if(str[i] == 'A' && A_pos > i+1 ) A_pos = i+1;
      if(str[i] == 'Z' && Z_pos < i+1 ) Z_pos = i+1;
    }
    cout << Z_pos - A_pos + 1 << endl;
}



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

int main()
{
    /*
    int n;
    cin>>n;
    for(int i=0;i<=n;i++)
    {
        int x = i*1.08;
        if(x==n)
        {
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<":("<<endl;
    */
    int n,m,c;
    cin>>n>>m>>c;
    int a[n][m];
    int b[m];
    int count = 0;
    for(int i=0;i<m;i++)
    {
        cin>>b[i];
    }
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            cin>>a[i][j];
        }
    }

    for(int i=0;i<n;i++)
    {
        int sum=0;
        for(int j=0;j<m;j++)
        {
            sum+=a[i][j]*b[j];
        }
        if(sum+c>0)
        {
            count++;
        }
    }

    cout<<count<<endl;

    return 0;
}

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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  cout << fixed << setprecision(12);
  int a,b,c; cin>>a>>b>>c;
  if (a+b+c>=22) cout<<"bust"; else cout<<"win";
  

  return 0;
}


Measured memory_bytes: 256
/*  -*- coding: utf-8 -*-
 *
 * d.cc: D: Black and White Tree
 */

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

/* constant */

const int MAX_N = 100000;
const int INF = 1 << 30;

/* typedef */

typedef vector<int> vi;
typedef queue<int> qi;
typedef pair<int,int> pii;

/* global variables */

vi nbrs[MAX_N];
int cns[MAX_N], ps[MAX_N];
bool used[MAX_N];

/* subroutines */

/* main */

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

  if (n & 1) {
    puts("First");
    return 0;
  }

  for (int i = 0; i < n - 1; i++) {
    int ai, bi;
    scanf("%d%d", &ai, &bi);
    ai--, bi--;
    nbrs[ai].push_back(bi);
    nbrs[bi].push_back(ai);
  }

  ps[0] = -1;
  queue<pii> q0;
  q0.push(pii(0, -1));
  while (! q0.empty()) {
    pii u = q0.front(); q0.pop();
    int &ui = u.first, &up = u.second;
    vi &nbru = nbrs[ui];
    cns[ui] = nbru.size() - (up >= 0 ? 1 : 0);
    
    for (vi::iterator vit = nbru.begin(); vit != nbru.end(); vit++) {
      int &vi = *vit;
      if (vi != up) {
	ps[vi] = ui;
	q0.push(pii(vi, ui));
      }
    }
  }
  //for (int i = 0; i < n; i++) printf("%d: ps=%d, cns=%d\n", i, ps[i], cns[i]);

  qi q1;
  for (int i = 0; i < n; i++)
    if (cns[i] == 0) q1.push(i);
  while (! q1.empty()) {
    int u = q1.front(); q1.pop();
    int &up = ps[u];
    if (up < 0) {
      if (! used[u]) {
	puts("First");
	return 0;
      }
      continue;
    }

    if (used[u]) {
      if (--cns[up] == 0) q1.push(up);
    }
    else {
      if (used[up]) {
	puts("First");
	return 0;
      }
      used[up] = true;
      if (-- cns[up] == 0) q1.push(up);
    }
  }

  puts("Second");
  return 0;
}


Measured memory_bytes: 7040
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<math.h>
#include<iomanip>
#include<stdio.h>
using namespace std;

int main(){

  int n, a[100000], b[100000], cnt=0;
  cin >> n;

  for(int i=0; i<n; i++){
    cin >> a[i] >> b[i]; 
    if(cnt<a[i]){
      cnt=a[i];
    }
  }

  for(int i=0; i<n; i++){
    if(cnt==a[i]){
      cnt+=b[i];
      break;
    }
  }



  cout << cnt << endl;

  return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

constexpr long long MOD = 1000000007;

int main()
{
  int X, A;
  std::cin >> X >> A;
  std::cout << (X < A ? 0 : 10) << std::endl;
  return 0;
}



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

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    rep(i, n) cin >> v[i];
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    int sum = 0;
    rep(i,n){
        sum += (i % 2 == 0? v[i]:-v[i]);
    }
    cout << sum << endl;
}


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

class State{
public:
	int n,cost,r;

	State(int tn,int tcost,int tr){
		n = tn;
		cost = tcost;
		r = tr;
	}

	void show(){
		printf("[%d,%d,%d]\n",n,cost,r);
	}

	bool operator<(const State &st) const {
		return cost > st.cost;
	}
};

int t[101][101];
bool closed[101][11];

int main(void){
	int c,n,m,s,d;

	while(cin>>c>>n>>m>>s>>d && (c||n||m||s||d)){
		memset(t,0,sizeof(t));

		for(int i=0;i<m;i++){
			int from,to,cost;
			cin>>from>>to>>cost;
			t[from][to] = t[to][from] = cost;
		}

		priority_queue<State> open;
		memset(closed,0,sizeof(closed));
		open.push(State(s,0,c));

		int ans = -1;

		while(!open.empty()){
			State st = open.top(); open.pop();
			if(closed[st.n][st.r]) continue;
			closed[st.n][st.r] = true;

			if(st.n == d){
				ans = st.cost;
				break;
			}

			for(int i=1;i<=n;i++){
				if(t[st.n][i] > 0){
					open.push(State(i,st.cost+t[st.n][i],st.r));
					if(st.r > 0) open.push(State(i,st.cost+t[st.n][i]/2,st.r-1));
				}
			}
		}

		cout<<ans<<endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

int main() {
	static int aa[5];
	int k, i, j;

	for (i = 0; i < 5; i++)
		scanf("%d", &aa[i]);
	scanf("%d", &k);
	for (i = 0; i < 5; i++)
		for (j = i + 1; j < 5; j++)
			if (aa[j] - aa[i] > k) {
				printf(":(\n");
				return 0;
			}
	printf("Yay!\n");
	return 0;
}


Measured memory_bytes: 128
n,k=map(int,input().split())
a=list(map(int,input().split()))

for _ in range(min(k,100)):
    s=[0 for _ in range(n)]
    e=[0 for _ in range(n)]
    for i in range(n):
        d=a[i]
        s[max(0,i-d)]+=1
        e[min(n-1,i+d)]+=1
    a[0]=s[0]
    for i in range(1,n):
        s[i]=s[i-1]+s[i]
        e[i]=e[i-1]+e[i]
        a[i]=s[i]-e[i-1]

print(*a)

Measured memory_bytes: 192452
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <stack>
#include <math.h>
#include <string.h>
#include <map>
#include <bitset>

#define Z class
#define ln cout<<'\n'
#define ll long long
#define ld long double
#define rep(i, n) for(int i = 0; i < (n); ++i)
//ASCII a=97, A=65
// int H[N]; rep(i,N) scanf("%d", &H[i]);
// int max_x = *std::max_element(x.begin(), x.end());
// int min_y = *std::min_element(y.begin(), y.end());
// sort(vec.begin(), vec.end()); std::greater<>()
// reverse(vec.begin(), vec.end());
// scanf("%s",s);
// printf("%d\n",end-start+1);
// ceil (a + (b - 1)) / b

//===== グラフ受け取り =====//
/*
    int N, M; cin >> N >> M;
    Graph G(N);
    for (int i = 0; i < M; ++i) {
        int a, b;
        cin >> a >> b;
        G[a].push_back(b);

        // 無向グラフの場合は以下を追加
        // G[b].push_back(a);
    }
    
    // == 重み付きグラフ == //
    
    struct Edge {
        int to; 
        int weight; 
        Edge(int t, int w) : to(t), weight(w) { }
    };
    using Graph = vector<vector<Edge>>;
    int main() {
        int N, M; cin >> N >> M;
        Graph G(N);
        for (int i = 0; i < M; ++i) {
            int from, to, weight;
            cin >> from >> to >> weight;
            G[from].push_back(Edge(to, weight));
        }
    }
*/    

using namespace std;
// using Edge = pair<int, int>;
// using Graph = vector<vector<Edge>>;
// using pll = pair<long long, long long>;

template<class T> inline bool chmax(T& a, T b){ if(a < b) { a=b; return 1; }return 0;}
template<class T> inline bool chmin(T& a, T b){ if(a > b) { a=b; return 1; }return 0;}
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
const long long INF = 1LL << 60;
bool sortbysec(const pair<int,int> &a, const pair<int,int> &b) { 
    return (a.second < b.second); 
} 


int main() {
    int X, A; cin >> X >> A;
    if(X < A) cout << 0 << endl;
    else cout << 10 << endl;
}






Measured memory_bytes: 256
import time
startTimeProblem=time.time()

import fileinput, sys, itertools, functools
from math import *
from bisect import *
from heapq import *
from collections import *

def lcm(a, b):  
    return (a*b)/gcd(a, b)

class InputHelper:
    def __init__(self):
        self.myinput = fileinput.input()

    def isLocal(self):
        return not fileinput.isstdin()

    def int(self):
        return int(self.myinput.readline().rstrip())

    def ints(self):
        return [int(_) for _ in self.myinput.readline().rstrip().split()]

    def str(self):
        return self.myinput.readline().rstrip()

    def strs(self):
        return [_ for _ in self.myinput.readline().rstrip().split()]

class OutputHelper:
    def int(self, a):
        print(a)    

    def ints(self, a):  
        print(" ".join([str(_) for _ in a]))
    
    def intsNL(self, a):
        for _ in a:
            print(_)
    
    def str(self, s):
        print(s)

    def strs(self, s):
        print(" ".join([_ for _ in s]))

    def strsNL(self, s):
        for st in s:
            print(st)

class ListNode:
    def __init__(self, val):
        self.val = val
        self.next = None
        self.prev = None

In = InputHelper()
Out = OutputHelper()

######################################

N = In.int()

there = ["AC", "WA", "TLE", "RE"]
counts = defaultdict(int)
for _ in range(N):
    s = In.str()

    counts[s]+=1

for t in there:
    Out.str(t + " x "+str(counts[t]))


######################################

if len(sys.argv)>2 and sys.argv[2]=="TIMEIT":
    fin = (time.time()-startTimeProblem)*1000
    print("{:.2f}".format(fin) + "ms")

Measured memory_bytes: 75264
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
  int n, a, b, c, d;
  string s;
  cin >> n >> a >> b >> c >> d;
  cin >> s;
  bool flag=true;
  bool flag2=false;
  if(c<d){
    for(int i=a;i<d-1;i++){
      if((s[i]=='#')&&(s[i+1]=='#'))flag=false;
    }
  }else{
    for(int i=a;i<c-1;i++){
      if((s[i]=='#')&&(s[i+1]=='#'))flag=false;
    }
    for(int i=b-2;i<d-1;i++){
      if(((s[i]=='.')&&(s[i+1]=='.'))&&(s[i+2]=='.')) flag2=true;
    }
    if(flag2==false) flag=false;
  }
  if(flag==true)
    {
      cout << "Yes";
    }else{
      cout << "No";
    }
  return 0;
}

Measured memory_bytes: 640
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>


using namespace std;
using ll = long long;
using ull = unsigned long long;

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

#define REP(i, n) for(ll i = 0; i < n; i++)





















int main(){
    ll n, m;
    scanf("%lld %lld", &n, &m);
    ll a[100000];
    for(int i = 0; i < n; i++){
        scanf("%lld", &a[i]);
    }
    sort(a, a + n);
    ll down = 0, up = 200001;
    while(up - down > 1){
        ll mid = (up + down) / 2;
        ll cnt = 0;
        for(int i = 0; i < n; i++){
            ll idx = lower_bound(a, a + n, mid - a[i]) - a;
            cnt += n - idx;
        }
        ((cnt >= m)? down : up) = mid;
    }
    ll aa[100001] = {};
    for(int i = 0; i < n; i++){
        aa[i + 1] = a[i] + aa[i];
    }
    ll ans = 0, cnt = 0;
    for(int i = 0; i < n; i++){
        ll idx = lower_bound(a, a + n, down - a[i]) - a;
        ans += aa[n] - aa[idx] + (n - idx) * a[i];
        cnt += n - idx;
    }
    printf("%lld\n", ans - (cnt - m) * down);
}

Measured memory_bytes: 1792
N,M=map(int,input().split())
set1=set()
L,R=map(int,input().split())
for i in range(L,R+1):
    set1.add(i)
min=min(set1)
max=max(set1)
Flag=True
for i in range(M-1):
    L,R=map(int,input().split())
    if R < min:
        Flag=False
        break
    elif L > max:
        Flag=False
        break
    if L >= min and max >= L:
        min = L
    if R >= min and max >= R:
        max = R
if Flag:
    print(max-min+1)
else:
    print(0)

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

const int MX = 100001;

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

  int ans = 0;

  for(int i=1; i<=n; i++){
    int tmp = i;
    
    //各桁の和を求める
    int tot = 0;
    while(tmp>0){
      tot += tmp % 10;
      tmp /= 10;
    }

    if(a<=tot&&tot<=b) ans += i;
  }

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

Measured memory_bytes: 3644
using namespace std;
#include<iostream>
#include<algorithm>
#include<ctime>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#include<numeric>
#include<queue>
#include<deque>
#include<cfloat>
#include<functional>
#include<tuple>
#include<math.h>
#include<bitset>
#include<stack>
#include<set>
#include<random>
#include<stdlib.h>
#define rip(i,n) for(ll i=0;i<n;i++)
#define Rip(i,n) for(int i=1;i<n;i++)
#define all(V) V.begin(),V.end()
#define ll long long
#define ld long double
#define MOD 1000000007
#define mod 998244353
#define sec setprecision
#define _CRT_SECURE_NO_WARNINGS
#pragma target("avx")
#pragma optimize("O3")
#pragma optimize("unroll-loops")
constexpr double eps = 1e-9;
constexpr double pi = 3.141592653589793238462643383279;
ll gcd(ll a, ll b)
{
	if (a % b == 0)	return(b);
	else return(gcd(b, a % b));
}
ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}
ll pow(ll x, ll n) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return pow(x * x , n / 2);
	else
		return x * pow(x, n - 1);
}
int main() {
	int n;
	cin >> n;
	vector<int>a(n);
	rip(i, n)cin >> a[i];
	ll kotae = 0;
	rip(i, n)kotae ^= a[i];
	vector<int>ans(n);
	rip(i, n)ans[i] = kotae ^ a[i];
	rip(i, n)cout << ans[i] <<" ";
}

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

//問題文より、入力される最大の桁数1000+1(改行文字分)を要素数とする
#define MAXDIGIT 1001

//各桁の和を計算する関数
int get_ans(char *str);

int main(void)
{
	//iはループ変数、countは入力されたデータセット数を格納
	int i, count;
	char num[MAXDIGIT][MAXDIGIT];

	count = 0;
	//データセットの入力(0ならば入力終了)
	do{
		scanf("%s", num[count]);
		count++;
	}while(strcmp(num[count - 1], "0"));

	//最後の入力(0)に対しては出力しない
	count--;
	//結果の出力
	for(i = 0; i < count; i++){
		printf("%d\n", get_ans(num[i]));
	}

	return 0;
}

int get_ans(char *str)
{
	//ansに各桁の和を格納
	int ans;

	ans = 0;
	//文字列の最後まで繰り返す
	while(*str != '\0'){
		//文字を数値に変換して加算する
		ans += (*str - '0');
		str++;
	}

	return ans;
}


Measured memory_bytes: 2112
import sys
S=''.join(list(reversed(input())))
T=''.join(list(reversed(input())))
for i in range(len(S)-len(T)+1):
    for j in range(len(T)):
        if S[i+j]!="?" and T[j]!=S[i+j]:break
    else:
        print(''.join(list(reversed((S[:i]+T+S[i+j+1:]).replace("?","a")))))
        sys.exit()
print("UNRESTORABLE")

Measured memory_bytes: 3064
#include <iostream>
    #include <algorithm>
     
    int main()
    {
      int k, n, a[200010];
      std::cin >> k >> n;
      
      for (int i = 0; i < n; ++i) {
        std::cin >> a[i];
      }
      
      int max = 0;
      for (int i = 1; i < n; ++i) 
      {
        if (a[i] - a[i-1] > max)
          max = a[i] - a[i-1];
      }
      
      if (k+a[0] - a[n-1] > max)
        max = k+a[0] - a[n-1];
      
      std::cout << k-max;
    }

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;

const ll mod = 1000000007;

int main() {
    int x;
    cin >> x;
    if (x) {
        cout << 0 << endl;
    } else {
        cout << 1 << endl;
    }
}


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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

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

    vector<string> s(h,string(w,'w'));
    while(n--)
    {
        int x,y,a;
        cin >>x >>y >>a;

        int lx=0, rx=w, ly=0, ry=h;
        if(a==1) rx=x;
        if(a==2) lx=x;
        if(a==3) ry=y;
        if(a==4) ly=y;

        for(int i=ly; i<ry; ++i)for(int j=lx; j<rx; ++j) s[i][j]='b';
    }

    int ans=0;
    rep(i,h)rep(j,w) ans+=(s[i][j]=='w');
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int S, h, m, s;
	scanf("%d" ,&S);
	s = S % 60;
	h = S / 3600;
	m = S / 60 - h*60;
	printf("%d:%d:%d\n",h ,m ,s);
	return 0;
}

Measured memory_bytes: 592
K = int(input())

lun = [1, 2, 3, 4, 5, 6, 7, 8, 9]
for idx, ll in enumerate(lun, start=1):
    base = int(str(ll)[-1])
    candi = list(filter(lambda x: 0 <= x < 10, [base - 1, base, base + 1]))
    for c in candi:
        target = str(ll) + str(c)
        lun.append(int(target))
    if idx > K:
        break
lun.sort()
# print(lun)
print(lun[K-1])

Measured memory_bytes: 14660
#include <bits/stdc++.h>
#include <assert.h>
using namespace std;
using i64 = long long;

int main()
{
  i64 n;
  cin >> n;
  vector<i64> a(n);
  for (i64 i = 0; i < n; i++)
    cin >> a[i];
  deque<i64> ans;
  for (i64 i = 0; i < n; i++)
  {
    if (i == 0 || a[i] <= *ans.begin())
      ans.push_front(a[i]);
    else
    {
      i64 it = lower_bound(ans.begin(), ans.end(), a[i]) - ans.begin();
      ans.erase(0 <= it - 1 ? ans.begin() + it - 1 : ans.begin());
      ans.insert(upper_bound(ans.begin(), ans.end(), a[i]), a[i]);
    }
  }
  cout << ans.size() << endl;
  return 0;
}


Measured memory_bytes: 1792