akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		for(int i=0;i<1000;i++){
			String s = sc.next();
			boolean flag = true;
			if(s.length()>1){
				for(int j=1;j<s.length();j++){
					int pre = s.codePointAt(j-1);
					int nex = s.codePointAt(j);
					
					if(pre==69 && nex%2==0) continue;
					if(pre%2==0 && nex==69) continue;
					if(pre==65 && (nex==66 || nex==68)) continue;
					if(pre==66 && (nex==65 || nex==67)) continue;
					if(pre==67 && (nex==66 || nex==70)) continue;
					if(pre==68 && (nex==65 || nex==71)) continue;
					if(pre==70 && (nex==67 || nex==73)) continue;	
					if(pre==71 && (nex==68 || nex==72)) continue;	
					if(pre==72 && (nex==71 || nex==73)) continue;	
					if(pre==73 && (nex==70 || nex==72)) continue;
					
					flag = false;
					break;
				}
			}
			if(flag==true) System.out.println(s);
		}
	}

}

Measured memory_bytes: 21556
#include <iostream>
using namespace std;
int gcd(int b,int c){
  while(b%c!=0){
     int a=b%c;
      b=c;
      c=a;
    }
  return c;
}
int main(){
 int n;
  cin >> n;
 long long int ans = 0;
  for(int i = 1; i <= n; i++){
   for(int j = 1; j <= n; j++){
    for(int k = 1; k <=n; k++){
      ans+=gcd(i,gcd(j,k));
		}		
   	}
  }
  cout << ans << endl;
}

Measured memory_bytes: 3112
<?php
$member = (int)trim(fgets(STDIN));
$boss_array = explode(' ', trim(fgets(STDIN)));

foreach ($boss_array as $boss) {
    $boss_count[$boss]++;
}

for ($i = 1; $i <= $member; $i++) {
    if ($boss_count[$i]) {
        echo $boss_count[$i] . "\n";
    } else {
        echo 0 . "\n";
    }
}

Measured memory_bytes: 39732
S=list(input())
max_count=0
count=0
for i in range(len(S)):
    for j in range(i,len(S)):
        if S[j]=='A' or S[j]=='C' or S[j]=='G' or S[j]=='T':
            count+=1
            max_count=max(max_count,count)
        else:
            count=0
            break
    count=0
print(max_count)   

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

int main(){
  string s, t;
  cin >> s >> t;
  int ans = 0;
  rep(i, 3) if (s[i] == t[i]) ans++;
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 3632
N = int(input())

ans = [0 for _ in range(10050)]

for x in range(1,100):
    for y in range(1,100):
        for z in range(1,100):
            a = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if a < 10050:
                ans[a] += 1
for i in range(1,N+1):
    print(ans[i])


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

using namespace std;

using ll = long long;

int main(){
    ll ans = 0;
    string s;
    cin >> s;
    deque<char> q;
    char last;
    q.push_back(s[0]);
    last = s[0];
    for(ll i = 1; i < s.length(); ++i){
        if(last != s[i] && q.size() > 1){
            ans += 2;
            q.pop_back();
            last = q.back();
        }
        else if(last != s[i]){
            if(q.size() == 1){
                q.pop_back();
            }
            ans += 2;
            i++;
            q.push_back(s[i]);
            last = s[i];
        }else{
            q.push_back(s[i]);
            last = s[i];
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

static const int kRem = 1000000007;

tuple<int64_t, int64_t, int64_t> gcd(int64_t x, int64_t y)
{
	assert(0 < x);
	assert(0 <= y);

	if (x < y) swap(x, y);

	if (y == 0) return make_tuple(x, 1, 0);

	tuple<int64_t, int64_t, int64_t> ret = gcd(y, x % y);

	return make_tuple(get<0>(ret), get<2>(ret), get<1>(ret) - (x / y) * get<2>(ret));
}

int64_t divide_rem(int64_t divident, int64_t dividor, int64_t rem)
{
	int64_t ret = get<2>(gcd(rem, dividor));
	while (ret < 0) ret += rem;

	ret *= divident;
	ret %= rem;

	return ret;
}

int64_t nCr(int64_t n, int64_t r, int64_t rem) {
	if (n == 0) return 0;
	if (r > n) return 0;

	if (n - r < r) r = n - r;

	int64_t ret = 1;
	for (int64_t i = 0; i < r; i++) {
		ret *= (n - i);
		ret %= kRem;
		ret = divide_rem(ret, i + 1, rem);
	}

	return ret;
}

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

	int64_t n, m, k; cin >> n >> m >> k;

	int64_t cases = nCr(n * m - 2, k - 2, kRem);

	int64_t val = 0;
	FOR_LT(d, 1, n) {
		int64_t cur = cases;
		cur *= d;
		cur %= kRem;
		cur *= (n - d);
		cur %= kRem;
		cur *= m;
		cur %= kRem;
		cur *= m;
		cur %= kRem;
		val += cur;
		val %= kRem;
	}

	FOR_LT(d, 1, m) {
		int64_t cur = cases;
		cur *= d;
		cur %= kRem;
		cur *= (m - d);
		cur %= kRem;
		cur *= n;
		cur %= kRem;
		cur *= n;
		cur %= kRem;
		val += cur;
		val %= kRem;
	}

	cout << val << endl;

	return 0;
}

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

int main() {
  int H, N; cin >> H >> N;
  vector<int> A(N), B(N);
  for (int i = 0; i < N; i++) cin >> A.at(i) >> B.at(i);
  int INF = 1000000000;
  vector<vector<int>> dp(N+1, vector<int>(H+1, INF));
  for (int i = 0; i <= N; i++) dp.at(i).at(0) = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j <= H; j++) {
      dp.at(i+1).at(j) = min(dp.at(i+1).at(j), dp.at(i).at(j));
      int nj = min(j + A.at(i), H);
      dp.at(i+1).at(nj) = min(dp.at(i+1).at(nj), dp.at(i+1).at(j) + B.at(i));
    }
  }
  cout << dp.at(N).at(H) << endl;
}

Measured memory_bytes: 39424
#include<stdio.h>
#include<string.h>
int main()
{
    char s[3][102];
    int i;
    scanf("%s%s%s", s[0], s[1], s[2]);
    int n = 0;
    char x;
    for (;;)
    {
        x = s[n][0];
        if (x == '\0')
        {
            printf("%c\n", 'A' + n);
            return 0;
        }
        for (i = 1; i < strlen(s[n]); i++)
            s[n][i - 1] = s[n][i];
        s[n][i - 1] = '\0';
        n = x - 'a';
    }
}

Measured memory_bytes: 128
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
#include <tuple>
#include <functional>

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep2(i,a,n) for(int i = a; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl

using namespace std;

typedef long long ll;
typedef pair<ll, ll> PLL;

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

    if(s.size()%2 != 0) {
        cout << "No" << endl;
    } else {
        if(s.substr(0,n/2) == s.substr(n/2, n)) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }

    return 0;
}



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

int main()
{
	string s;
	cin>>s;
	
	int n=s.length()-1;
	if(s[0]=='k'){
		if(s[1]=='e'){
			if(s[2]=='y'){
				if(s[3]=='e'){
					if(s[4]=='n'){
						if(s[5]=='c'){
							if(s.find("e",6)){
								cout<<"YES"<<endl;
								return 0;
							}
						}
						if(s[n-1]=='c'&&s[n]=='e'){
							cout<<"YES"<<endl;
							return 0;
						}
					}
					if(s[n-2]=='n'&&s[n-1]=='c'&&s[n]=='e'){
						cout<<"YES"<<endl;
						return 0;
					}
				}
				if(s[n-3]=='e'&&s[n-2]=='n'&&s[n-1]=='c'&&s[n]=='e'){
					cout<<"YES"<<endl;
					return 0;
				}
			}
			if(s[n-4]=='y'&&s[n-3]=='e'&&s[n-2]=='n'&&s[n-1]=='c'&&s[n]=='e'){
				cout<<"YES"<<endl;
				return 0;
			}
		}
		if(s[n-5]=='e'&&s[n-4]=='y'&&s[n-3]=='e'&&s[n-2]=='n'&&s[n-1]=='c'&&s[n]=='e'){
			cout<<"YES"<<endl;
			return 0;
		}
	}
	if(s[n-6]=='k'&&s[n-5]=='e'&&s[n-4]=='y'&&s[n-3]=='e'&&s[n-2]=='n'&&s[n-1]=='c'&&s[n]=='e'){
		cout<<"YES"<<endl;
		return 0;
	}
	cout<<"NO"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int s,a,b,k;
int main()
{
	ios::sync_with_stdio(false);
    cin>>a>>b;
    for(register int i=0;i<=a;i++)
    {
        for(register int j=0;j<=a;j++)
        {
            k=b-i-j;
            if(k<=a) if(k>=0) s++;
        }
    }
    cout<<s<<endl;
    return 0;
}


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

const ll mod = 1000000007;


int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	int n; cin >> n;
	string s; cin >> s;
	bool ok = true;
	if(n % 2 == 1) cout << "No" << endl;
	else{
	rep(i, n/2){
		if(s.at(i) != s.at(n/2 + i)) ok = false;
	}
	if(ok) cout << "Yes" << endl;
	else cout << "No" << endl;
	}
} 

Measured memory_bytes: 256
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <bitset>
#include <fstream>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()

#pragma region UnionFind
struct UnionFind
{
	vector<int> par;

	UnionFind(int n) : par(n, -1) {}
	void init(int n) { par.assign(n, -1); }

	int root(int x)
	{
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool issame(int x, int y)
	{
		return root(x) == root(y);
	}

	bool merge(int x, int y)
	{
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x)
	{
		return -par[root(x)];
	}
};
#pragma endregion
#pragma region GCD
int gcd(int a, int b)
{
	if (a%b == 0)return b;
	return gcd(b, a%b);
}
#pragma endregion
#pragma region chmin
template<class T> inline bool chmin(T& a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma region chmax
template<class T> inline bool chmax(T& a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma endregion

#pragma region BIT
struct BIT
{
	vector<int> bit;
	int n;
	//i-indexed
	BIT() { init(-1); }
	BIT(int n_) { init(n_); }
	void init(int n_)
	{
		n = n_;
		bit.clear();
		bit.resize(n + 1, 0);
	}
	int sum(int i)
	{
		int s = 0;
		while (i > 0)
		{
			s += bit[i];
			i -= i & -i;
		}
		return s;
	}
	void add(int i, int x)
	{
		if (i == 0)return;
		while (i <= n)
		{
			bit[i] += x;
			i += i & -i;
		}
	}
	int sum0(int i)
	{
		return sum(i + 1);
	}
	void add0(int i, int x)
	{
		add(i + 1, x);
	}
};
#pragma endregion


int main()
{
	int n, q; cin >> n >> q;
	vector<vector<int>> v(500100);
	vector<int> c(n); rep(i, n)cin >> c[i];
	vector<pair<int, int>> query(q);
	vector<vector<int>> u(n);
	rep(i, q)
	{
		int l, r; cin >> l >> r;
		--l, --r;
		query[i] = { l,r };
		u[l].push_back(r);
	}
	map<pair<int, int>, int> mp;
	BIT bit(n);
	rrep(i, n)
	{
		if (v[c[i]].size() > 0)bit.add(v[c[i]].back(), 1);
		v[c[i]].push_back(i);
		for (int x : u[i])
		{
			mp[{i, x}] = x - i + 1 - bit.sum(x);
		}
		
	}
	rep(i, q)cout << mp[{query[i].first, query[i].second}] << endl;
}

Measured memory_bytes: 90916
n = int(input())
list_l = [int(x) for x in input().split()]

count = 0

# 組合せnCpの総当たりforループ（計算速度遅）
for i in range(0, n - 2):
    for j in range(i + 1, n - 1):
        for k in range(j + 1, n):
            if list_l[i] != list_l[j] != list_l[k] and list_l[i] != list_l[k]:
                if list_l[i] < list_l[j] + list_l[k] and list_l[j] < list_l[i] + list_l[k] and list_l[k] < list_l[i] + list_l[j]:
                    
                    count += 1
print(count)

Measured memory_bytes: 9208
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;

int main(){
    
    int n;
    cin >> n;
    vll v(n), c(n);
    for(int i = 0; i < n; i++)cin >> v[i];
    for(int i = 0; i < n; i++)cin >> c[i];
    int ans = 0;
    for(int i = 0; i < n; i++)ans += max(0LL, v[i] - c[i]);
    cout << ans << endl;
    
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <stdlib.h>
#include <algorithm>
using namespace std;
int main(){
    int M,H,x,y,r;
    cin>>M>>H>>x>>y>>r;
    if((x-r)*(x+r)>=0&&(y-r)*(y+r)>=0&&M*(x-r)>=0&&H*(y-r)>=0&&abs(M)>=max(abs(x-r),abs(x+r))&&abs(H)>=max(abs(y-r),abs(y+r)))
        cout<<"Yes"<<endl;
        else
        cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3116
# https://atcoder.jp/contests/abc051/tasks/abc051_c

def course(from_x, from_y, to_x, to_y, short)
  dx = to_x - from_x
  dy = to_y - from_y

  x_char = dx > 0 ? 'R' : 'L'
  y_char = dy > 0 ? 'U' : 'D'

  if short
    y_char * dy.abs + x_char * dx.abs
  else
    opposite_x_char = dx > 0 ? 'L' : 'R'
    opposite_y_char = dy > 0 ? 'D' : 'U'

    opposite_y_char + x_char * (dx.abs + 1) + y_char * (dy.abs + 1) + opposite_x_char
  end
end

sx, sy, tx, ty = gets.split.map(&:to_i)

puts course(sx, sy, tx, ty, true) + course(tx, ty, sx, sy, true) + course(sx, sy, tx, ty, false) + course(tx, ty, sx, sy, false)


Measured memory_bytes: 1916
#include <stdio.h>
#include <math.h>
 
int main(void){
	int ans[55];
	int n;
	int i;
 
	ans[0] = 11;
	ans[1] = 31;
	ans[2] = 41;
	ans[3] = 61;
	ans[4] = 71;
	ans[5] = 101;
	ans[6] = 131;
	ans[7] = 151;
	ans[8] = 181;
	ans[9] = 191;
	ans[10] = 211;
	ans[11] = 241;
	ans[12] = 251;
	ans[13] = 271;
	ans[14] = 281;
	ans[15] = 311;
	ans[16] = 331;
	ans[17] = 401;
	ans[18] = 421;
	ans[19] = 431;
	ans[20] = 491;
	ans[21] = 521;
	ans[22] = 541;
	ans[23] = 571;
	ans[24] = 601;
	ans[25] = 631;
	ans[26] = 641;
	ans[27] = 661;
	ans[28] = 691;
	ans[29] = 701;
	ans[30] = 751;
	ans[31] = 761;
	ans[32] = 811;
	ans[33] = 821;
	ans[34] = 881;
	ans[35] = 911;
	ans[36] = 941;
	ans[37] = 971;
	ans[38] = 991;
	ans[39] = 1021;
	ans[40] = 1031;
	ans[41] = 1051;
	ans[42] = 1061;
	ans[43] = 1091;
	ans[44] = 1151;
	ans[45] = 1201;
	ans[46] = 1231;
	ans[47] = 1291;
	ans[48] = 1301;
	ans[49] = 1321;
	ans[50] = 1361;
	ans[51] = 1381;
	ans[52] = 1451;
	ans[53] = 1471;
	ans[54] = 1481;
 
	scanf("%d",&n);
 
	for(i = 0;i < n-1;i++){
		printf("%d ",ans[i]);
	}	
	printf("%d\n",ans[n-1]);
 
	return 0;
}

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

int main(void){
    int n;
    scanf("%d", &n);
    if(n == 1) printf("Hello World");
    else{
        int a, b;
        scanf("%d", &a);
        scanf("%d", &b);
        printf("%d", a+b);
    }
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#include<unordered_map>
#include<string>
#include<math.h>
#define ll long long
using namespace std;
const ll INF = 1LL << 60;
const int inf = 1 << 30;
const ll N= 1e10;
inline void fastio()
{ 
     ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}
int cnt[10000001];
int main()
{
    ll n;
    cin >> n;
    string ans;
    while(n)
    {
        ans += (n - 1) % 26 + 'a';
        n--;
        n /= 26;
    }
    reverse(ans.begin(), ans.end());
    cout << ans;
    return 0;
}

Measured memory_bytes: 3580
#include<stdio.h>
int main(void){
int x[4][3][10];
int j,i,r,l,t,k,h,n;
for(i=0;i<4;i++){
for(r=0;r<3;r++){
for(l=0;l<10;l++){
x[i][r][l]=0;
}
}
}
scanf("%d",&j);
for(i=0;i<j;i++){
scanf("%d %d %d %d",&t,&k,&h,&n);
x[t-1][k-1][h-1]+=n;
}
for(i=0;i<4;i++){
for(r=0;r<3;r++){
for(l=0;l<10;l++){
printf(" %d",x[i][r][l]);
}
printf("\n");
}
if(i!=3){printf("####################\n");}
}
return 0;
}

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

int main()
{
    int a,b;
    string s;
    cin>>a>>b;
    cin>>s;

    int i;
    for(i=0;i<s.size();i++)
    {
        if(i==a && s[i]!='-')
        break;
        if(i!=a &&(s[i]<48 || s[i]>57))
        break;
    }
    if(i==s.size())
    cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <numeric>
#include <algorithm>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <math.h>
#include <stdio.h>

#define rep(i,m,n) for(unsigned long long int i=(m);i<(n);++i)
#define rem(i,m,n) for(int i=(m);i>(n);--i)
#define MOD 1000000007

using namespace std;

using ll =long long int;
using std::swap;

vector<long long int> v;
vector<long long int> w;


int main() {
	
			int a, b;
			cin >> a >> b;
			int ans = 0;
			if (b != 1){
				b -= a;	ans++;
				while (b > 0) {
					b -= a - 1;
					++ans;
				}
			}
			cout << ans << '\n';
	return 0;
}


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

int main(void){
    int N;
    cin >> N;
    long long res=0;
    int Nfirst = N;
    int Nlast = N % 10;
    int Nnum = 0;
    int Abuf, Bbuf;
    vector<int> Power10buf = {0, 1, 11, 111, 1111, 11111};
    vector<int> Power10 = {1, 10, 100, 1000, 10000, 100000};
    for(Nfirst = N; Nfirst>9; Nfirst/=10)Nnum++;
    for(int i=1; i<10; i++){ //The first digit of A is i
        for(int j=1; j<10; j++){ //The first digit of B is j
            if(i < Nfirst){
                Abuf = Power10buf[Nnum];
            }else if((i == Nfirst) && (j <= Nlast)){
                Abuf = Power10buf[(Nnum-1 < 0 ? 0 : Nnum-1)] + (N-N%10-Nfirst*Power10[Nnum])/10 + 1;
            }else if(i == Nfirst){
                Abuf = Power10buf[(Nnum-1 < 0 ? 0 : Nnum-1)] + (N-N%10-Nfirst*Power10[Nnum])/10;
            }else{
                Abuf = Power10buf[(Nnum-1 < 0 ? 0 : Nnum-1)];
            }
            if(j < Nfirst){
                Bbuf = Power10buf[Nnum];
            }else if((j == Nfirst) && (i <= Nlast)){
                Bbuf = Power10buf[(Nnum-1 < 0 ? 0 : Nnum-1)] + (N-N%10-Nfirst*Power10[Nnum])/10 + 1;
            }else if(j == Nfirst){
                Bbuf = Power10buf[(Nnum-1 < 0 ? 0 : Nnum-1)] + (N-N%10-Nfirst*Power10[Nnum])/10;
            }else{
                Bbuf = Power10buf[(Nnum-1 < 0 ? 0 : Nnum-1)];
            }
            if((i==j) && ((Nnum > 0) || (i < Nfirst))){
                Abuf++;
                Bbuf++;
            }
            res += Abuf*Bbuf;
        }
    }

    std::cout << res << endl;

    return 0;
}

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

long int a, v, b, w, t;

int main()
{
    cin >> a >> v >> b >> w >> t;
    if (a > b) {
        if ((a - b - (v - w) * t) <= 0) {
            cout << "YES" << endl;
        }
        else {
            cout << "NO" << endl;
        }
    }else{
        if ((b - a - (v - w) * t) <= 0) {
            cout << "YES" << endl;
        }
        else {
            cout << "NO" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3636
s = list(input())

a = int(''.join(s[0:2]))
b = int(''.join(s[2:4]))

if 1<=a<=12:
    if 1<=b<=12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
elif 1<=b<=12:
    if 1<=a<=12:
        print('AMBIGUOUS')
    else:
        print('YYMM')
else:
    print('NA')

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

using namespace std;
typedef long long ll;
const int N = 1e5 + 10, M = 2e5 + 10;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const double eps = 1e-6;

int n, m, t;
unordered_map<int, int> mp;

int main()
{
    string s, t;
    cin >> s >> t;
    cin >> n >> m;
    string u;
    cin >> u;
    if (u == s)
        n--;
    else
    {
        m--;
    }
    cout << n << ' ' << m << endl;

    return 0;
}


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

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

  for ( i = 1; i <= 9; ++i )
  for ( j = 1; j <= 9; ++j )
    printf ( "%dx%d=%d\n", i, j, i * j );


  return ( EXIT_SUCCESS );
}

Measured memory_bytes: 520
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = y = 0
for i in range(n):
    x += b[i]-a[i]
    if a[i]<b[i]: y+=(b[i]-a[i]+1)//2
print("YNeos"[y>x::2])

Measured memory_bytes: 4596
pub struct ProconReader<R: std::io::Read> {
    reader: R,
}

impl<R: std::io::Read> ProconReader<R> {
    pub fn new(reader: R) -> Self {
        Self { reader }
    }
    pub fn get<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .reader
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&byte| byte == b' ' || byte == b'\n' || byte == b'\r')
            .take_while(|&byte| byte != b' ' && byte != b'\n' && byte != b'\r')
            .collect::<Vec<_>>();
        std::str::from_utf8(&buf)
            .unwrap()
            .parse()
            .ok()
            .expect("Parse Error.")
    }
}

fn main() {
    let stdin = std::io::stdin();
    let mut rd = ProconReader::new(stdin.lock());

    let h: usize = rd.get();
    let w: usize = rd.get();
    let k: i64 = rd.get();
    let sy: usize = rd.get();
    let sx: usize = rd.get();
    let gy: usize = rd.get();
    let gx: usize = rd.get();
    let a: Vec<Vec<char>> = (0..h)
        .map(|_| rd.get::<String>().chars().collect())
        .collect();

    let sy = sy - 1;
    let sx = sx - 1;
    let gy = gy - 1;
    let gx = gx - 1;

    let dy = vec![-1, 0, 0, 1];
    let dx = vec![0, -1, 1, 0];

    let inf = std::i64::MAX / 3;
    let mut d = vec![vec![vec![inf; 4]; w]; h];
    let mut q = std::collections::BinaryHeap::new();
    use std::cmp::Reverse;
    for p in 0..4 {
        d[sy][sx][p] = 0;
        q.push((Reverse(0), (sy, sx, p)));
    }
    while let Some((Reverse(c), (y, x, p))) = q.pop() {
        if c > d[y][x][p] {
            continue;
        }
        for np in 0..4 {
            let nd = (c + k - 1) / k * k;
            if nd < d[y][x][np] {
                d[y][x][np] = nd;
                q.push((Reverse(nd), (y, x, np)));
            }
        }
        {
            // 同じ方向に進む
            let ny = y as i32 + dy[p];
            let nx = x as i32 + dx[p];
            if nx < 0 || ny < 0 {
                continue;
            }
            let ny = ny as usize;
            let nx = nx as usize;
            if ny >= h || nx >= w || a[ny][nx] == '@' {
                continue;
            }
            if c + 1 < d[ny][nx][p] {
                d[ny][nx][p] = c + 1;
                q.push((Reverse(d[ny][nx][p]), (ny, nx, p)));
            }
        }
    }
    let mut ans = inf;
    for p in 0..4 {
        if d[gy][gx][p] < inf {
            ans = std::cmp::min(ans, (d[gy][gx][p] + k - 1) / k);
        }
    }
    if ans == inf {
        ans = -1;
    }
    println!("{}", ans);
}

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

int main(){
  int e;
  while(cin >> e,e){
    int m = e;
    for(int z=0;z*z*z<=e;z++){
      for(int y=0;y*y+z*z*z<=e;y++){
	m = min(m, z + y + e-y*y-z*z*z);
      }
    }
    cout << m << endl;
  }
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define FAST {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define f(i, a, b) for(ll i=a; i<b; i++)
#define fr(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pll pair<ll,ll>
#define LB lower_bound
#define UB upper_bound
#define endl "\n"
using namespace std;
const int N=3001;
ll dp[N][N][4],m[N][N];

int main()
{
    FAST
    ll r,c,k;cin>>r>>c>>k;
    ll g[r][c];
    memset(g,0,sizeof g);
    f(i,0,k)
    {
        ll x,y,v;cin>>x>>y>>v;
        x--,y--;
        g[x][y]=v;
    }
    memset(dp,0,sizeof dp);
    dp[0][0][1]=dp[0][0][2]=dp[0][0][3]=g[0][0];
    f(j,1,c)
    {
        dp[0][j][1]=max(g[0][j],dp[0][j-1][1]);
        dp[0][j][2]=max({g[0][j]+dp[0][j-1][1],dp[0][j-1][2]});
        dp[0][j][3]=max({g[0][j]+dp[0][j-1][2],dp[0][j-1][3],g[0][j]+dp[0][j-1][1]});
    }
    f(i,1,r)
    {
        dp[i][0][1]=max({g[i][0]+dp[i-1][0][1],g[i][0]+dp[i-1][0][2],g[i][0]+dp[i-1][0][3]});
        dp[i][0][2]=max({g[i][0]+dp[i-1][0][1],g[i][0]+dp[i-1][0][2],g[i][0]+dp[i-1][0][3]});
        dp[i][0][3]=max({g[i][0]+dp[i-1][0][1],g[i][0]+dp[i-1][0][2],g[i][0]+dp[i-1][0][3]});
    }

    f(i,1,r)
    {
        f(j,1,c)
        {
            dp[i][j][1]=max({dp[i][j][1],g[i][j],dp[i][j-1][1]});
            dp[i][j][2]=max({dp[i][j][2],g[i][j]+dp[i][j-1][1],dp[i][j-1][2]});
            dp[i][j][3]=max({dp[i][j][3],g[i][j]+dp[i][j-1][2],dp[i][j-1][3],g[i][j]+dp[0][j-1][1]});

            dp[i][j][1]=max({dp[i][j][1],g[i][j]+dp[i-1][j][1],g[i][j]+dp[i-1][j][2],g[i][j]+dp[i-1][j][3]});
            dp[i][j][2]=max({dp[i][j][2],g[i][j]+dp[i-1][j][1],g[i][j]+dp[i-1][j][2],g[i][j]+dp[i-1][j][3]});
            dp[i][j][3]=max({dp[i][j][3],g[i][j]+dp[i-1][j][1],g[i][j]+dp[i-1][j][2],g[i][j]+dp[i-1][j][3]});
        }
    }
    // f(i,0,r)
    // {
    //     f(j,0,c)
    //     {
    //         cout<<max({dp[i][j][1],dp[i][j][2],dp[i][j][3]})<<" ";
    //     }
    //     cout<<endl;
    // }
    cout<<max({dp[r-1][c-1][1],dp[r-1][c-1][2],dp[r-1][c-1][3]})<<endl;
    
}


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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<P> p(n);
	vector<string> S(n);
	vector<int> N(n);
	rep(i, n) {
		cin >> S[i];
		cin >> N[i];
	}
	rep(i, n) {
		tuple<string, int, int> a = make_tuple(S.at(i), -N.at(i), i);
		p[i] = a;
	}
	sort(p.begin(), p.end());
	rep(i, n) {
		string a;
		int b, c;
		tie(a, b, c) = p[i];
		cout << c + 1 << endl;
	}
}

Measured memory_bytes: 256
//
// Created by 永徳泰明 on 2019-01-20.
//

#include <bits/stdc++.h>

typedef long long ll;

using namespace std;
#define dump(x)  cout << #x << " = " << (x) << endl;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define fill(x, y) memset(x,y,sizeof(x))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int INF = 999999999;

void readFromInputFile() {
#ifdef LOCAL
    static std::ifstream in("/Users/hoo/CLionProjects/for_atcoder/input");
    std::cin.rdbuf(in.rdbuf());
#endif
}

int main() {
    int a,b;
    cin>>a>>b;
    cout<<(a*b)/2<<endl;
    return 0;
}


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

#if MYDEBUG
#include "lib/cp_debug.hpp"
#else
#define DBG(...) ;
#endif
#if __cplusplus <= 201402L
template <typename T>
T gcd(T a, T b) { return ((a % b == 0) ? b : gcd(b, a % b)); }
template <typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }
#endif
using LL = long long;
constexpr LL LINF = 334ll << 53;
constexpr int INF = 15 << 26;
constexpr LL MOD = 1E9 + 7;

namespace Problem {
using namespace std;

class Solver2 {
 public:
  int n, m;
  vector<vector<int>> g;
  vector<int> d, inc, cnt;
  Solver2(LL n, LL m) : n(n), m(m), g(n), d(n, -1), inc(n), cnt(n){};

  void solve() {
    set<int> S;
    for (int i = 0; i < n; ++i) {
      S.insert(i);
    }
    for (int i = 0; i < n + m - 1; ++i) {
      int a, b;
      cin >> a >> b;
      g[--a].push_back(--b);
      S.erase(b);
      inc[b]++;
    }
    int root = *S.begin();
    dfs(root, 0);
    vector<int> ans(n);
    ans[root] = -1;
    DBG(root, d)
    for (int i = 0; i < n; ++i) {
      for (int j : g[i]) {
        if (d[j] == d[i] + 1) {
          ans[j] = i;
        }
      }
    }
    for (int i = 0; i < n; ++i) {
      cout << ans[i] + 1 << endl;
    }
  }
  void dfs(int c, int dep, int p = -1) {
    DBG(c, dep, p)
    cnt[c]++;
    d[c] = max(d[c], dep);
    if (cnt[c] < inc[c]) return;
    for (int x : g[c]) {
      dfs(x, d[c] + 1, c);
    }
  }
};
}  // namespace Problem

int main() {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(12);
  long long n = 0, m;
  std::cin >> n >> m;

  Problem::Solver2 sol(n, m);
  sol.solve();
  return 0;
}


Measured memory_bytes: 12672
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)

N, X = map(int, readline().rstrip().split())
a, p = [1], [1]
for i in range(N):
    a.append(a[i] * 2 + 3)
    p.append(p[i] * 2 + 1)

def f(N, X):
    if N == 0:
        if X <= 0:
            return 0
        else:
            return 1
    elif X <= 1 + a[N-1]: 
        return f(N-1, X-1)
    else:
        return p[N-1] + 1 + f(N-1, X-2-a[N-1])

def main():
    print(f(N, X))

if __name__ == '__main__':
    main()

Measured memory_bytes: 3188
#include<iostream>
#include<vector>

using namespace std;

int abs(int a){
  if (a>0){
    return a;
  }else{
    return a * (-1);
  }
}

int min(int a,int b){
  if (a<b){
    return a;
  }else{
    return b;
  }
}

int max(int a,int b){
  if (a>b){
    return a;
  }else{
    return b;
  }
}

int main(){
  int n,m,x,ans1 = 0,ans2=0,min =0 ;
  cin >> n >> m >> x;
  vector<int> input(m,0);
  for(int i = 0; i<m ;i++){
    cin >> input[i];
  }
  for(int i=x ; i>0;i--){
    for(int j = 0; j<m;j++){
      if(i-1==input[j]&&i>=1){
        ans1 += 1;
      }
    }
  }
  for(int i=x ; i<n+1;i++){
    for(int j = 0; j<m;j++){
      if(i+1==input[j]&&i+1<=n){
        ans2 += 1;
      }
    }
  }
  if(ans1 > ans2){
    cout << ans2 << endl;
  }else{
    cout << ans1 << endl;
  }
  
}


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

int main(){
	long long int a, b;
	cin >> a >> b;
	if(a>0)cout << "Positive" << endl;
	else if(a==0)cout << "Zero" << endl;
	else if(b>=0)cout << "Zero" << endl;
	else if(b<0&&(b-a)%2==0)cout << "Negative" << endl;
	else cout << "Positive" << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
bool isprime(ll a){
  if(a==2)return 1;
  if(!(a&1))return 0;
  for(ll i=3;i*i<=a;i+=2)
    if(a%i==0)return 0;
  return 1;
}
ll mpow(ll base,ll exponent,ll modulus){
  if(modulus==1)return 0;
  long long result = 1;
  base=base%modulus;
  while(exponent){
    if(exponent%2 == 1)
    result=(result*base)%modulus;
    exponent=exponent>>1;
    base=(base*base)%modulus;
  }
  return result;
}
ll minv(ll a,ll mod){
  ll _gcd=gcd(a,mod);
  assert(_gcd==1);
  return mpow(a,mod-2,mod);
}


/*
ll ncr(ll N,ll K){
  if(N<K)return 0;
  if(K==0)return 1;
  if(N==0)return 0;

  ll den=1;
  for(ll i=1;i<=K;i++)den*=i;
  ll num=1;
  while(K--){
    num*=N;
    if(num%den==0){
      num/=den;
      den=1;
    }
    N--;
  }

  return num;
}
*/
ll n,m;
ll sx,sy,ex,ey;
ll d[1005][1005];
char a[1005][1005];
void bfs(){
  deque<pair<int,int> >q;
  q.pb({sx,sy});
  for(ll i=1;i<=n;++i){
    for(ll j=1;j<=m;++j){
      d[i][j] = INF;
    }
  }
  d[sx][sy] = 0;
  while(!q.empty()){
    pll u = q.front();q.pop_front();
    ll x = u.first;
    ll y = u.second;
    for(ll i=-2;i<=2;++i){
      for(ll j=-2;j<=2;++j){
        ll xx = x+i;
        ll yy = y+j;
        if(xx>=1 and yy>=1 and xx<=n and yy<=m and a[xx][yy] == '.'){
          if(abs(xx-x)+abs(yy-y) == 1){
            if(d[xx][yy]>d[x][y]){
              d[xx][yy] = d[x][y];  
              q.push_front({xx,yy});
            }
          }
          else{
            if(d[xx][yy]>d[x][y]+1){
              d[xx][yy] = d[x][y]+1;
              q.push_back({xx,yy});
            }
          }
        }
      }
    }
  }
  return;
}

int main(){FAST;
cin>>n>>m;
cin>>sx>>sy;
cin>>ex>>ey;
for(ll i=1;i<=n;++i)
  for(ll j=1;j<=m;++j)cin>>a[i][j];
    bfs();
// for(ll i=1;i<=n;++i){
//   for(ll j=1;j<=m;++j){
//     cout<<d[i][j]<<' ';
//   }
//   cout<<'\n';
// }
if(d[ex][ey]>=INF)cout<<-1;
else cout<<d[ex][ey];
return 0;
}

/*
 WA? check edge cases, N=1,M=1 etc. Read code fully once and check all variables.
 Read the question again and see what you might have missed.
 Consider changing your solution or find more cases.
 */

Measured memory_bytes: 12384
#include<bits/stdc++.h>
using namespace std;
#define int long long
struct QuickFind{
  vector<int> r,p;
  vector<vector<int> > v;
  QuickFind(){}
  QuickFind(int size){init(size);}
  void init(int size){
    r.resize(size,0);
    p.resize(size,0);
    v.resize(size);
    for(int i=0;i<size;i++){
      r[i]=1,p[i]=i;
      v[i].resize(1,i);
    }
  }
  bool same(int x,int y){
    return p[x]==p[y];
  }
  void unite(int x,int y){
    x=p[x];y=p[y];
    if(x==y) return;
    if(r[x]<r[y]) swap(x,y);
    r[x]+=r[y];
    for(auto e:v[y]){
      p[e]=x;
      v[x].push_back(e);
    }
    v[y].clear();
  }
};
signed main(){
  int n;
  cin>>n;
  vector<int>a(n);
  for(int i=0;i<n;i++) cin>>a[i];
  vector<int>b(a);
  sort(b.begin(),b.end());
  map<int,int>p,q;
  for(int i=0;i<n;i++){
    p[a[i]]=i;
    q[b[i]]=i;
  }
  QuickFind qf(n);
  for(int i=0;i<n;i++)
    qf.unite(i,p[b[i]]);
  int ans=0;
  for(int i=0;i<n;i++){
    int k=qf.v[i].size();
    if(qf.p[i]!=i||k==1) continue;
    int m=a[qf.v[i][0]];
    int tmp=0;
    for(int j=0;j<k;j++){
      tmp+=a[qf.v[i][j]];
      m=min(m,a[qf.v[i][j]]);
    }
    ans+=min(tmp+m*(k-2),tmp+m+b[0]*(k+1));
  }
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 3384
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <iomanip>
using namespace std;

void solve(){
  string s; cin >> s;
  if(s[0] != 'A'){
    cout << "WA\n";
    return;
  }
  int sum = 0, index;
  for(int i = 2; i < s.length() - 1; i++){
    if(s[i] == 'C'){
      sum++;
      index = i;
    }
  }
  if(sum != 1){
    cout << "WA\n";
    return;
  }
  for(int i = 0; i < s.length(); i++){
    if(i == 0 || i == index) continue;
    if(s[i] < 'a' || s[i] > 'z'){
      cout << "WA\n";
      return;
    }
  }
  cout << "AC\n";
  return;
}
int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include<math.h>
using namespace std;
#define INF 11000000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<string,string> P;


int main(){
    int N;
    string s,t;
    P ans[500000];
    ll a;
    cin>>N>>s;
    for(int i=2*N-1;i>=N;i--) t.push_back(s[i]);
    //cout<<t<<endl;

    for(int bit=0;bit<(1<<N); bit++){
        string temp,temp2;
        for(int i=0;i<N;i++){
            if(bit>>i & 1){
                temp.push_back(s[i]);
            }else temp2.push_back(s[i]);
        }

        ans[bit].first=temp; ans[bit].second=temp2;
    }
    sort(ans,ans+(1<<N));

    for(int bit=0;bit<(1<<N); bit++){
        string temp,temp2;
        for(int i=0;i<N;i++){
            if(bit>>i & 1){
                temp.push_back(t[i]);
            }else temp2.push_back(t[i]);
        }
        a+=(int)(upper_bound(ans,ans+(1<<N),P(temp,temp2))-lower_bound(ans,ans+(1<<N),P(temp,temp2)));
        //cout<<a<<endl;
        //cout<<temp<<endl;
    }

    cout<<a<<endl;
}



Measured memory_bytes: 39564
import math
import heapq

x1, y1, x2, y2 = map(int, input().split())
N = int(input())
circles = [(x1, y1, 0), (x2, y2, 0)]
for i in range(N):
    x, y, r = map(int, input().split())
    circles.append((x, y, r))
N += 2

INF = 10 ** 12
dists = [[INF] * N for _ in range(N)]
for i in range(N):
    xi, yi, ri = circles[i]
    for j in range(N):
        xj, yj, rj = circles[j]
        d = math.sqrt(abs(xi - xj) ** 2.0 + abs(yi - yj) ** 2.0) - ri - rj
        dists[i][j] = dists[j][i] = max(d, 0)

mincost = [None] * N
hp = [(0.0, 0)]
while hp:
    mc, node = heapq.heappop(hp)
    if mincost[node] is not None:
        continue
    mincost[node] = mc
    for i in range(N):
        if mincost[i] is None:
            heapq.heappush(hp, (mc + dists[node][i], i))
print(mincost[1])


Measured memory_bytes: 125276
//--------------------------------------------------
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,abm,mmx,avx,avx2,popcnt,fma")
//#pragma GCC optimize("fast-math")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("Ofast")
//--------------------------------------------------
#include <bits/stdc++.h>
#include <chrono>
#include <set>
#include <map>
#include <deque>
#include <cmath>
#include <queue>
#include <cassert>
#include <random>
#include <bitset>
#include <iomanip>
#include <numeric>
#include <time.h>
#include <ctime>
#include <string>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <fstream>
#include <stack>
#include <cstring>
//--------------------------------------------------
#define forn(i, n) for(int i = 0; i < n; i++)
#define forw(i, n) for(int i = n-1; i >= 0; --i)
#define forns(i, n, s) for(int i = s; i < n; i++)
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
//----------------------------------------------------
using namespace std;
//----------------------------------------------------
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef long double ld;
typedef vector<ll> lnum;
typedef complex<ld> comp;
//----------------------------------------------------
const ll mod = 1e9 + 7, mod2 = 998244353;
const ld eps = 1e-6;
const ll inf = 1e18;
const int base = 1e9;
const ld PI = 3.1415926;
//----------------------------------------------------
//#define endl '\n';
#ifdef MY_DEBUG
void deb(ld x) { cerr << x << endl; };
#else
void deb(ld x){};
#endif
//----------------------------------------------------
//----------------------------------------------------
int n, x, y;
vector<int> ans;
//----------------------------------------------------
unsigned int bitcount(ull val) { return __builtin_popcount(val) + __builtin_popcount(val >> 32); }

void local() {
    freopen("test.in", "r", stdin);
}

void remote() {
}

void read() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin >> n >> x >> y;
}


int main() {
#ifdef MY_DEBUG
    local();
#else
    remote();
#endif
    read();

    ans.resize(n, 0);
    x--;y--;

    forn(i, n){
        forns(j, n, i+1){
            int dist = min(j-i, min(abs(x-j) + 1 + abs(i-y), abs(y-j) + 1 + abs(i-x)));
            ans[dist]++;
        }
    }

    forn(i, n-1) cout << ans[i+1] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
typedef pair<ll,ll> p;
const int inf=(1<<30);
#define rep(i,a,n)	for(int i=a;i<n;i++)
#define rrep(i,a,n) for(int i=(a-1);i>=n;i--)
	
	
int main(){
	ll n;
	cin>>n;
	ll sum=1;
	ll a[n];
	rep(i,0,n)cin>>a[i];
	sort(a,a+n);
	rep(i,0,n){
		if(a[i]==0){
			cout<<"0"<<endl;
			return 0;
		}
		else if(a[i]>1000000000000000000/sum){
			cout<<"-1"<<endl;
			return 0;
		}
		else sum*=a[i];
	}
	cout<<sum<<endl;
	
}

Measured memory_bytes: 4376
#include <iostream>
#include <vector>
#include <cstdlib>  
#include <algorithm>
#include <string>
 
using namespace std;
 
int main() {
    string s,t;cin>>s>>t;
    int mka = 0;
    for(int i = 0;i<=s.length()-t.length();i++){
    	char tt[t.length()];
        int kasanari = 0;
        for(int j = 0;j<t.length();j++){
           tt[j] = s[i+j];
           if(tt[j] == t[j]) kasanari += 1;
        }
        mka = max(mka,kasanari);
    }
    cout<<t.length()-mka;
    return 0;
}

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

int main() {
    int a,b,c,k;
    cin >> a >> b >> c;
    cin >> k;
    int max1 = max({a,b,c});
    int test1 = max({a,b,c});
    for(int i=0;i<k;i++){
        max1 *= 2;
    }
    cout << max1 + (a+b+c) - test1 << endl;
}



Measured memory_bytes: 256
#include<stdio.h>
int main()
{
  int N,D,a,X=0,ans=0;
  scanf("%d %d",&N,&D);
  a=2*D+1;
  if(N>a){
    X=N-2*a;
    if(X>0)
    {
      if(X%a!=0){
      ans=3+X/a;
      printf("%d",ans);
      }
      else
      {
        ans=2+X/a;
      printf("%d",ans);
        
      }
    }
    else
    {
      printf("2");
    }
  }
  else
  {
    printf("1");
  }
}

  

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<int, pair<int, int>> PP;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const int INF = 1001001001;
const int mod = 1e+9 + 7;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

vector<ll> S, p;

ll rec(int n, ll x){
    if(n == 0)  return 1;
    ll len = S[n - 1];
    ll patty = p[n - 1];
    if(x == 1)  return 0;
    else if(x <= len + 1)   return rec(n - 1, x - 1);
    else if(x == len + 2)   return patty + 1;
    else if(x <= (len + 1) * 2) return patty + 1 + rec(n - 1, x - len - 2);
    else return patty * 2 + 1;
}

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

    int n;
    ll x;
    cin >> n >> x;

    S.resize(n + 2), p.resize(n + 2);
    S[0] = 1, p[0] = 1;
    for(int i = 0; i <= n; ++i){
        S[i + 1] = S[i] * 2 + 3;
        p[i + 1] = p[i] * 2 + 1;
    }
    cout << rec(n, x) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define endl '\n'
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define debug1(a) cout<<#a<<" "<<(a)<<endl;
#define debug2(a,b) cout<<#a<<" "<<(a)<<" "<<#b<<" "<<(b)<<endl;
#define debug3(a,b,c) cout<<#a<<" "<<(a)<<" "<<#b<<" "<<(b)<<" "#c<<" "<<(c)<<endl;
typedef long double ld;
void solve()
{
	ll n;
	cin >> n;
	string s;
	cin >> s;
	ll count = 0;
	for (int i = 0; i < 1000; i++)
	{
		string val = to_string(i);
		if (val.length() == 1)
		{
			string res = "00";
			res += val;
			val = res;
			//cout << val << endl;
		}
		else if (val.length() == 2)
		{
			string res = "0";
			res += val;
			val = res;
			//cout << val << endl;
		}
		ll k = 0;
		for (int j = 0; j < n; j++)
		{
			if (val[k] == s[j])
			{
				k++;
				if (k == 3)
				{
					//cout << val << endl;
					count++;
					break;
				}
			}
		}
	}
	cout << count << endl;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	t = 1;
	while (t--)
	{
		solve();
	}
}

Measured memory_bytes: 3772
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll mod = 1000000007;
int a, b, c;

ll pow(ll x, ll y)
{
	if (y == 0) return 1;
	if (y % 2)
	{
		return pow(x, y - 1) * x % mod;
	}
	else
	{
		ll yyy = pow(x, y / 2);
		return yyy * yyy % mod;
	}
}

ll div(ll x)
{
	return pow(x, mod - 2);
}

int main(void)
{
	string s;
	int n;
	int C = 0;
	cin >> n >> s;
	for (int i = 0; i < s.length(); i++)
	{
		if (s[i] == 'R') C++;
	}
	if (C > (n - C))
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
	int www;
	cin >> www;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String str = sc.nextLine();
        String[] inputs = str.split(" ");

        Stack<Integer> operands = new Stack<>();

        for (String s : inputs) {
            if (s.equals("+") || s.equals("-") || s.equals("*")) {
                int i1 = operands.pop();
                int i2 = operands.pop();
                switch (s) {
                    case "+":
                        operands.push(i2+i1);
                        break;
                    case "-":
                        operands.push(i2-i1);
                        break;
                    case "*":
                        operands.push(i2*i1);
                        break;
                    default:
                        sc.close();
                        return;
                }
            } else {
                operands.push(Integer.parseInt(s));
            }
        }

        System.out.println(operands.pop());
        
        sc.close();
    }
}



Measured memory_bytes: 26352
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define REPR(i,n) for(int i=n-1; i>=(int)(0); i--)
#define FOR(i,a,b) for(int i=(int)(a); i<(int)(b); i++)
#define FORR(i,a,b) for(int i=(int)(b)-1; i>=(int)(a); i--)
#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()
//**関数リスト**//
int ctoi(char c) {
	switch (c) {
	case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.second < secondElof.second;
}
ll nod(ll F) {
	ll keta = 1;
	while (F / 10 > 0) {
		keta++;
		F /= 10;
	}
	return keta;
}
ll gcd(ll x, ll y) {
	ll r;
	if (x < y) {
		swap(x, y);
	}
	while (y > 0) {
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}
ll lcm(ll x, ll y) {
	return x * y / gcd(x, y);
}
ll isPrime(ll x) {
	ll i;
	if (x < 2) {
		return 0;
	}
	else if (x == 2) {
		return 1;
	}
	else if (x % 2 == 0) {
		return 0;
	}
	else {
		for (i = 3; i * i <= x; i += 2) {
			if (x % 1 == 0) {
				return 0;
			}
		}
		return 1;
	}
}
void eratos(vl isPrime) {
	//(注)isPrimeのサイズはN+1にする！実際にはmain内に配置して使用
	ll i, j;
	REP(i, isPrime.size()) {
		isPrime[i] = 1;
	}
	isPrime[0] = 0; isPrime[1] = 0;
	for (i = 2; i * i <= isPrime.size() - 1; i++) {
		if (isPrime[i] == 1) {
			j = i * 2;
			while (j <= isPrime.size() - 1) {
				isPrime[j] = 0;
				j = j + i;
			}
		}
	}
}
ll modinv(ll a, ll m) {
	ll b = m, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
void bitSearch(ll n) {
	//実際にはコピーして中身を改変して使う
	ll i;
	REP(i, pow(2, n)) {
		ll p = i;
		REP(i, n) {
			cout << p % 2;
			p /= 2;
		}
		cout << endl;
	}
}

void bfs(ll now) {
	//中身は毎回書き換えて使用
	queue<ll> Q;
	Q.push(now);
	ll u;
	while (!Q.empty()) {
		u = Q.front();
		Q.pop();
		//ll v=;
		//Q.push(v);
	}
}
//**定義場所**//
ll i, j, k, l, m, n;
ll N, M, K, H, W;
ll MOD = 1000000007;
ll ans = 0;
//***********//

int main() {
	cin >> N;
	vl V(N);
	for (i = 0; i < N; i++) {
		cin >> V[i];
	}
	sort(V.begin(), V.end());
	double q = 2;
	double P = (V[0] + V[1]) / q;
	for (i = 2; i < N; i++) {
		P = (P + V[i]) / q;
	}
	cout << setprecision(10) << P;
}

Measured memory_bytes: 256
#include<stdio.h>

static const int N = 100;

int main(){
  int M[N][N];
  int n,u,k,v;
  int i,j;
  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++) M[i][j] = 0;
  }

  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    u--;
    for(j=0;j<k;j++){
      scanf("%d",&v);
      v--;
      M[u][v] = 1;
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(j)printf(" ");
      printf("%d",M[i][j]);
    }
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2104