akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <string.h>
#define ll long long
int main()
{
  int T , X;
  scanf("%d %d",&T,&X);

  float res = (float)T/(float)X;

  printf("%.7lf",res);

}


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

int main() {
  int A, B, C, X;
  cin >> A >> B >> C >> X;
  int ans = 0;
  for (int i = 0; i <= A; i++) {
    for (int j = 0; j <= B; j++) {
      for (int k = 0; k <= C; k++) {
        if (500 * i + 100 * j + 50 * k == X) {
          ans++;
        }
      }
    }
  }
  cout << ans << endl;  
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

#define MOD 1000000007

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int S;
    cin >> S;
    int dp[2005];
    dp[0] = 1;
    dp[1] = dp[2] = 0;
    for (int i = 3; i <= S; i++) {
        dp[i] = (dp[i-1] + dp[i-3])%MOD;
    }
    cout << dp[S]%MOD << '\n';
    return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int N;
vector<pair<int,int>> E[101010];
//---------------------------------------------------------------------------------------------------
int ans[101010];
void dfs(int cu, int pa = -1, int col = 0) {
	set<int> used;
	used.insert(col);
	int c = 1;
	fore(to, E[cu]) if (to.first != pa) {
		while (used.count(c)) c++;
		ans[to.second] = c;
		dfs(to.first, cu, c);
		c++;
	}
}
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N;
	rep(i, 0, N - 1) {
		int a, b; cin >> a >> b;
		a--; b--;

		E[a].push_back({ b, i });
		E[b].push_back({ a, i });
	}

	dfs(0);

	int ma = 0;
	rep(i, 0, N) chmax(ma, (int)E[i].size());
	printf("%d\n", ma);
	rep(i, 0, N - 1) printf("%d\n", ans[i]);

}







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



int main(){
    int N;
    char S[304][304];
    int Ans=0;
    bool c=0;
    cin >> N;
    REP(i,N){
        REP(j,N){
            cin >> S[i][j];
        }
    }
    REP(k,N){
        c=0;
        REP(i,N){
            REP(j,i){
                if(S[(i+k)%N][j]!=S[(j+k)%N][i]){
                    c=1;
                }
            }
        }
        if(c==0){
            Ans+=N;
        }
    }
    cout << Ans << endl;
    return 0;
}


Measured memory_bytes: 384
n = gets.to_i
arr = gets.chomp.split(' ').map(&:to_i)
ans_arr = Array.new(n,0)
k = 0 #arrのk番目の数字番号
while k < n 
  ans_arr[arr[k]-1] = k + 1
  k += 1
end
puts ans_arr.join(' ')

Measured memory_bytes: 23072
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <numeric>
#include <cstdint>
#include <iomanip>
#include <set>
#include <map>
#include <unordered_map>
#include <cassert>
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define fast_io(); std::ios_base::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0);

int main(){
    std::string w;
    std::cin >> w;

    std::vector<bool> alphabet(26,0);
    rep(i,w.size()){
        int j = w[i] - 'a';
        alphabet[j] = alphabet[j] ^ 1;
    }

    rep(i,26){
        if(alphabet[i]){
            std::cout << "No" << "\n";
            return 0;
        }
    }
    std::cout << "Yes" << "\n";
    return 0;
}

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

int main() {
  string s;
  string t = "aeiou";

  cin >> s;

  for (int i = 0; i < t.size(); i++) {
    if (s[0] == t[i]) {
      cout << "vowel" << endl;
      return 0;
    }
  }

  cout << "consonant" << endl;

  return 0;
}


Measured memory_bytes: 256
import math


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


l, r = map(int, input().split(" "))

_min = float("inf")
for i in range(l, r + 1):
    for j in range(i + 1, r + 1):
        v = (i * j) % 2019
        # どっちかに2019の倍数が来るのは最大2019**2だから
        if v == 0:
            print(0)
            exit()
        else:
            _min = min(_min, v)

        #print(i, j, (i * j) % 2019)
        #print(prime_factorize(i), prime_factorize(j))
print(_min)


Measured memory_bytes: 3064
import sys
input = sys.stdin.readline
import numpy as np

num=input()
namae=[]
kazu=[]
for temp in range(int(num)):
    aaa=[i for i in input().split()]
    namae.append(aaa[0])
    kazu.append([aaa[0],int(aaa[1])])
for i,temp in enumerate(kazu):
    kazu[i].append(i+1)
kazu.sort(key = lambda x:(x[0],(x[1])))

itizi = kazu[0][0]
result=[]
for temp in kazu:
    if itizi == temp[0]:
        result.append(temp[2])
    else:
        itizi=temp[0]
        result.reverse()
        for temp2 in result:
            print(temp2)
        result=[temp[2]]
result.reverse()
for temp in result:
    print(temp)

Measured memory_bytes: 12492
import bisect,collections,itertools,math,numpy,string
def I(): return int(input())
def F(): return float(input())
def S(): return input()
def LI(): return list(map(int,input().split()))
##################################################
def main(H,W):
    if H==1 or W==1:
        return 1
    elif H%2==0 and W%2==0:
        return (H*W)//2
    elif H%2==0 and W%2==1:
        return (H//2)*(2*(W//2)+1)
    elif H%2==1 and W%2==0:
        return (2*(H//2)+1)*(W//2)
    else:
        return (H//2)*(2*(W//2)+1)+((W//2)+1)
    
H,W = LI()
print(main(H,W))

Measured memory_bytes: 12088
#include <iostream>

using namespace std;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    int one = n%10;
    if (one==2 || one==4 || one==5 || one==7 || one==9) cout << "hon\n";
    else if (one==0 || one==1 || one==6 || one==8) cout << "pon\n";
    else cout << "bon\n";
    return 0;
}


Measured memory_bytes: 3648
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    private const int INF = 1000000007;
    public struct Pair<T> { public T x, y; public Pair(T x, T y) { this.x = x; this.y = y; } }
    public static void Solve()
    {
        long H = NextLong();
        long W = NextLong();
        int N = NextInt();
        Dictionary<int, Dictionary<int, bool>> d = new Dictionary<int, Dictionary<int, bool>>();
        long[] ans = new long[10];
        ans[0] = (H - 2) * (W - 2);
        for (int i = 0; i < N; i++)
        {
            int a = NextInt();
            int b = NextInt();
            //置く
            if (!d.ContainsKey(a)) d[a] = new Dictionary<int, bool>();
            if (!d[a].ContainsKey(b)) d[a][b] = true;

            //(a,b)を始点に9パターン考えてみる
            for (int x = -1; x <= 1; x++)
            {
                int xx = b + x;
                if (xx < 1 || W < xx) continue;
                for (int y = -1; y <= 1; y++)
                {
                    int yy = a + y;
                    if (yy < 1 || H < yy) continue;
                    int count = 0;
                    for (int dx = -1; dx <= 1; dx++)
                    {
                        int xdx = xx + dx;
                        if(xdx < 1 || W < xdx) { count = -1; break; }
                        for (int dy = -1; dy <= 1; dy++)
                        {
                            if ((yy + dy) < 1 || H < (yy + dy)) { count = -1; break; }
                            if (d.ContainsKey(yy + dy) && d[yy + dy].ContainsKey(xdx)) count++;
                        }
                    }
                    if (count != -1) { ans[count]++; ans[count - 1]--; }
                }
            }
        }
        ans.ToList().ForEach(Console.WriteLine);
    }
    public static void Main()
    {
        var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
    }
}
public class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static char NextChar() { Confirm(); return char.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}


Measured memory_bytes: 44016
#include <stdio.h>

int main(void)
{
	int a[4];
	int b[4];
	
	while(scanf("%d%d%d%d\n%d%d%d%d", &a[0], &a[1], &a[2], &a[3], &b[0], &b[1], &b[2], &b[3])!=EOF) {
		int i, j;
		int hit=0,brow=0;
		
		for(i=0; i<4; i++) {
			for(j=0; j<4; j++) {
				if(a[i]==b[j])  {
					if(i==j) hit++;
					else brow++;
				}
			}
		}
		printf("%d %d\n", hit, brow);
	}
	
	return 0;
}


Measured memory_bytes: 596
//This Code was made by Chinese_zjc_.
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<bitset>
#include<cmath>
#include<queue>
#include<stack>
#include<string>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<map>
#include<set>
#include<time.h>
// #include<windows.h>
#define int long long
#define PI 3.14159265358979323
#define INF 0x3fffffffffffffff
using namespace std;
int n,m,fa[200005],a,b,ans,s[200005];
int find(int now)
{
    return fa[now]==now?now:fa[now]=find(fa[now]);
}
signed main()
{
    ios::sync_with_stdio(false);
    cin>>n>>m;
    for(int i=1;i<=n;++i)
    {
        fa[i]=i;
    }
    for(int i=1;i<=m;++i)
    {
        cin>>a>>b;
        fa[find(a)]=find(b);
    }
    for(int i=1;i<=n;++i)
    {
        ++s[find(i)];
    }
    for(int i=1;i<=n;++i)
    {
        ans=max(s[i],ans);
    }
    cout<<ans<<endl;
    return 0;
}

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

#define GETSTR(p)       fgets((p), sizeof(p), stdin)
#define CHOMP(p)        do{ char *_q = (p) + strlen(p)-1; if(*_q == '\n') *_q = 0;            } while(0)

int main(void){
    char buf[100];
    while(GETSTR(buf)){
        CHOMP(buf);
        int len = strlen(buf);

        const int nn = 'z' - 'a' + 1;

        while(1){
            for(int i = 0; i < len; i++){
                if(isalpha(buf[i])){
                    buf[i] = 'a' + (buf[i] - 'a' + nn + 1) % nn;
                }
            }
            char buf2[100];
            sprintf(buf2, " %s ", buf);
            int l = strlen(buf2);
            for(int i = 0; i < l; i++){
                if(! isalpha(buf2[i])) buf2[i] = ' ';
            }
            if(strstr(buf2, " the ") != NULL) break;
            if(strstr(buf2, " this ") != NULL) break;
            if(strstr(buf2, " that ") != NULL) break;
        }
        puts(buf);
    }

    return 0;
}

Measured memory_bytes: 968
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <complex>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
#include <limits>
#include <time.h>
#include <cstdint>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define rRep(i,a,b) for(ll i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template <class T, class U> inline bool chmax(T& lhs, const U& rhs) { if (lhs < rhs) { lhs = rhs; return 1; } return 0; }
template <class T, class U> inline bool chmin(T& lhs, const U& rhs) { if (lhs > rhs) { lhs = rhs; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
  for(auto i=begin(v); i != end(v); ++i){
    if(i !=begin(v)) os << ' ';
    os << *i;
  }
  return os;
}

ll dp[3][1000007];

int main(){
  string S;
  cin >> S;
  dp[0][0]=0;
  dp[1][0]=1;
  if(S.size()==1){
    ll X=ctoi(S[0]);
    if(X<=5){
      cout << X << endl;
    }
    else{
      cout << 1+10-X << endl;
    }
    return 0;
  }
  ll X=0;
  rep(i,S.size()){
    X=ctoi(S[i]);
    dp[0][i+1]=min(dp[0][i]+X,dp[1][i]+1+X);
    dp[1][i+1]=min(dp[0][i]+X+1,min(dp[1][i]+10-X-1,dp[1][i]+X+2));
  }
  cout << min(dp[0][S.size()],dp[1][S.size()]+1) << endl;
}

Measured memory_bytes: 17668
import sys
N,M=map(int,input().split())
table=[set() for i in range(N)]
for i in range(M):
    a,b=map(int,input().split())
    a,b=a-1,b-1
    table[a].add(b)
for x in table[0]:
    if N-1 in table[x]:
        print('POSSIBLE')
        sys.exit()
print('IMPOSSIBLE')

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

int main(){
    int n;
    cin >> n;
    vector<int> s(n);
    for(int i = 0;i < n;i++){
        cin >> s.at(i);
    }
    /**/
    int ans = 0;
    for(int i = 1;i < n - 1;i++){
        if((s.at(i) > s.at(i - 1))&&(s.at(i) < s.at(i + 1))){
            ans++;
        }
        else if((s.at(i) < s.at(i - 1))&&(s.at(i) > s.at(i + 1))){
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
h,w = map(int, input().split())
from collections import defaultdict
G = defaultdict(list)

def mind(Q, d):
    c = float('inf')
    ret = 0
    for i, j in enumerate(d):
        if c > j and i in Q:
            c = j
            ret = i
    return ret
 
def dijkstra(G, n, start):
    d = [float('inf')] * n
    d[start] = 0
    Q = set(range(n))
    preQ = None
    while len(Q) != 0:
        preQ = Q
        u = mind(Q, d)
        Q = Q - set([u])
        for v in G[u]:
            if d[v] > d[u] + 1:
                d[v] = d[u] + 1
        if Q == preQ:
            break
    return d
s = []

i2num = {}
count = 0
start = 0

for i in range(h):
    r = input()
    s.append([r[j] for j in range(w)])
    count += s[i].count('#')
num=-1
for i in range(h):
    r = s[i]
    for j in range(w):
        if r[j] != '1':
            num += 1
            i2num[(i,j)] = num
        if r[j] == 's':
            start = num
            r[j] = '0'
        elif r[j] == 'g':
            goal = num
            r[j] = '0'
G = defaultdict(list)
r = c = 1
for r in range(h):
    for c in range(w):
        t = s[r][c]
        if t == '#': continue
        num = i2num[(r,c)]
        if r - 1 >= 0 and s[r - 1][c] == '.':
            G[num].append(i2num[(r - 1, c)])
        if r + 1 < h and s[r+1][c] == '.':
            G[num].append(i2num[(r + 1, c)])
        if c - 1 >= 0 and s[r][c - 1] == '.':
            G[num].append(i2num[(r, c - 1)])
        if c + 1 < w and s[r][c + 1] == '.':
            G[num].append(i2num[(r, c + 1)])

d = dijkstra(G, h*w, start)
if d[-1] == float('inf'):
    print('-1')
else:
    print(h*w-(d[-1]+1)-count)

Measured memory_bytes: 4448
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) int ab;cin>>ab;(p).push_back(ab);
#define vecpl2(p) long long ab;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int main() {
	
	int a,b,c;
	cin>>a>>b>>c;
	if(b-a==c-b){
		ce("YES")
	}else{
		ce("NO")
	}
}

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

main(){

  ll n;
  cin>>n;
  vector<pair<ll,ll>> a(n);
  rep(i,n){
    cin>>a[i].first>>a[i].second;
  }
  sort(a.begin(),a.end());
  auto cmp=[&](auto a,auto b){return a.second<b.second;};
  sort(a.begin(),a.end(),cmp);
  ll now=0;
  rep(i,n){
    now+=a[i].first;
    if(now>a[i].second){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;

}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for(int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005
ll dp[60][60][10000];
int main() {
    int n, K;
    cin >> n >> K;
    ll MOD = 1000000007;
    
    rep(i,n+1)rep(j,n+1)rep(k,n*n+1)dp[i][j][k] = 0;
    dp[0][0][0] = 1;
    
    rep(i,n){
        rep(j,n){
            rep(k,n*n){
                if(dp[i][j][k] == 0) continue;
                // 横
                dp[i+1][j][k+j*2] += dp[i][j][k];
                dp[i+1][j][k+j*2] %= MOD;
                // 下下
                dp[i+1][j+1][k+(j+1)*2] += dp[i][j][k];
                dp[i+1][j+1][k+(j+1)*2] %= MOD;

                if(j==0)continue;

                // 上上
                dp[i+1][j-1][k+(j-1)*2] += dp[i][j][k] * j * j % MOD;
                dp[i+1][j-1][k+(j-1)*2] %= MOD;
                // 下上
                dp[i+1][j][k+j*2] += dp[i][j][k] * j % MOD;
                // 上下
                dp[i+1][j][k+j*2] += dp[i][j][k] * j % MOD;
                dp[i+1][j][k+j*2] %= MOD;
            }
        }
    }
    ll ans = dp[n][0][K];
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 65052
/*
   Author : BabaYaga42,
   BITS Pilani, Hyderabad.
   Don't give up ;)
   */
#pragma warning(disable:4996)
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")

#include<bits/stdc++.h>

#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define big long long
using namespace std;

const int N = 1e5+5,MOD = 1000000007;
const long long int INF = 0xFFFFFFFFFFFFFFFL;

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

void IOS()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
   	cout.precision(10);
   	cout << fixed;
}

int32_t main()
{
	IOS();
	int n;
	cin >> n;
	int a,b;
	vector<int> v(n);
	cin >> a >> b;
	for(int i = 0; i < n; i++)cin >> v[i];
	sort(all(v));
	auto it1 = upper_bound(all(v),a);
	auto it2 = upper_bound(all(v),b);
	int ans = min({it1-v.begin(),it2-it1,v.end()-it2});
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int64;
typedef vector<int> vec;
typedef vector<int64> vec64;
#define ss cout << " ";
#define nn cout << "\n";
#define ct(x) cout << x;
#define cts(x) cout << x << " ";
#define ctn(x) cout << x << "\n";
#define db(x) cout << "> " << #x << ": " << x << "\n";
#define qr queries();
void solve();
void YN(bool b){if (b){ctn("YES");}else{ctn ("NO");}};
void yn(bool b){if (b){ctn("Yes");}else{ctn ("No");}};
void queries(){int n;cin >> n;while (n--)solve();}
// // // // // // // // // // // // // // // // // // // // // // 
/*                  TEMPLATE - VANILLA                         */
// // // // // // // // // // // // // // // // // // // // // //
const int maxn = 200200;

void solve(){

    return;
}

bool comp (int a, int b){
    return a > b;
}

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n;
    cin >> n;
    vec arr (n);
    vec srt (n);
    for (int i = 0; i < n; i++){
        cin >> arr[i];
        srt[i] = arr[i];
    }
    sort (srt.begin(), srt.end(), comp);
    // for (auto i: srt){
    //     cts(i);
    // }
    // nn;
    for (int i = 0; i < n; i++){
        bool b = 0;
        int mx = -1;
        for (int j = 0; j < n; j++){
            if (srt[j] == arr[i] && b){
                mx = srt[j];
                break;
            }
            if (srt[j] == arr[i]){
                b = 1;
                continue;
            }
            else{
                mx = srt[j];
                break;
            }
        }
        ctn(mx);
    }
    return 0;
}


Measured memory_bytes: 4712
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz(x) (int)x.size();
#define all(x) (x).begin(), (x).end()
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i, n) for(int i =0 ; i < n; ++i)
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define pii pair < int, int >
typedef vector<int> vi;
typedef  long long ll;
const int inf = int(1e9);
const int mod =1e9+7;
const int N = (int)2e5 + 5;

void solve(){
	ll n,k;
	cin>>n>>k;
	ll z=n/k+(n%k!=0);
	cout<<min(abs(n-(ll)z*k),n);

}
int main(){
	Red;
	int t=1;
	//cin>>t;
	while(t--)
	solve();
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

n = int(input())
mons = list(map(int, input().split()))
hero = list(map(int, input().split()))

NumMonsBegin = sum(mons)

for i in range(0,n):
    if mons[i] >= hero[i]:
        mons[i] = mons[i]-hero[i]
#        print("----")
#        print(mons)
    else:
        yoryoku = hero[i]-mons[i]
        mons[i] = 0
        mons[i+1] = mons[i+1] - yoryoku
        if mons[i+1] < 0:
            mons[i+1] = 0

NumMonsLeft = sum(mons)

print(NumMonsBegin - NumMonsLeft)


Measured memory_bytes: 18624
#include <iostream>
#include <bitset>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <regex>
using namespace std;
using ll = long long int;
using dd = long double;
const ll MOD = 1e9 + 7;

vector<string> dfs(string s, ll depth, vector<char> symbol)
{
    vector<string> ret;
    if (depth == 0)
    {
        ret.push_back(s);
        return ret;
    }

    for (ll i = 0; i < symbol.size(); i++)
    {
        auto vec = dfs(s + symbol[i], depth - 1, symbol);
        for (auto &&e : vec)
        {
            ret.push_back(e);
        }
    }
    return ret;
}

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

int main()
{
    map<ll, ll> mp;
    for (ll i = 0; i < 3; i++)
    {
        ll ai;
        cin >> ai;
        mp[ai] += 1;
    }

    for (auto &&e : mp)
    {
        if (e.second == 1) {
            cout << e.first << endl;
        }
    }
    
    
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <utility>
using namespace std;
using ll = long long;
 
int main() {
	string s;
	int count =0;
	cin >> s;
	if (s[0] == '1') count++;
	if (s[1] == '1') count++;
	if (s[2] == '1') count++;
	cout << count << endl;
	return 0;
}


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

using namespace std;

int main()	{
	int a;
  	map<int, int> freq;
  	for (int i = 0; i < 3; i++)	{
    	cin >> a;
      	freq[a]++;
    }
  	if ((freq[5] != 2 || freq[7] != 1))	{
    	cout << "NO" << endl;
    }
  	else	{
      	cout << "YES" << endl;
    }
	return 0;
}

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

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

  int count=0;
  for (int i = 0; i < K+1; i++) {
    for (int j = 0; j < K+1; j++) {
       int k=S-i-j;
       if (k>=0 && k<=K) count+=1;
    }
  }

  cout << count << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <fstream>
#include <iostream>
#include <list>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <valarray>
#include <vector>

#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#define repeat(i,n)     for(int i=0; i<(n); ++i)
#define repeat1(i,n)    for(int i=1; i<=(n); ++i)
#define range(i,l,r)    for(int i=(l); i<(r); ++i)

using namespace std;
typedef long long llint;

int iin();
llint   lin();
double  fin();

int main() {
    char s[105], t[105];

    int n = iin();

    scanf("%s", s);
    scanf("%s", t);

    int len = strlen(s);
    repeat(i, len) {
        range(j, i, len) {
            if(s[j] == t[j-i] && j == len-1) {
                printf("%d\n", 2*i + (len - i));
                return 0;
            }
            else if(s[j] != t[j-i]) break;
        }
    }
    printf("%d\n", 2*len);
    return 0;
}

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

int iin() {
    int x;
    scanf("%d", &x);
    return  x;
}

llint lin() {
    llint x;
    scanf("%lld", &x);
    return  x;
}

double fin() {
    double  x;
    scanf("%lf", &x);
    return x;
}


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

int main() {
  string a,b;
  cin>>a>>b;
  int x,y;
  x=a.size();
  y=b.size();
  if(x>y) cout<<"GREATER"<<endl;
  else if(x<y) cout<<"LESS"<<endl;
  else{
    if(a>b) cout<<"GREATER"<<endl;
    else if(a<b) cout<<"LESS"<<endl;
    else cout<<"EQUAL"<<endl;
  }
}


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

#define INCANT cin.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define out(a) cout << a << endl
#define PRINT(V) for (auto v : (V)) cout << v << " "

const int MOD = 1000000007;
const double PI = acos(-1.0);

void solve() {
    int A, B, H, M;
    cin >> A >> B >> H >> M;
    double m_rad = (double)M*360/60*PI/180;
    double h_rad = (double)H*360/12*PI/180+(double)M*30/60*PI/180;
    double xa = cos(h_rad)*A;
    double ya = sin(h_rad)*A;
    double xb = cos(m_rad)*B;
    double yb = sin(m_rad)*B;
    out(sqrt(pow(xa-xb, 2.0)+pow(ya-yb, 2.0)));
}
int main() {
    INCANT;
    solve();
    return 0;
}




Measured memory_bytes: 4116
A,B=map(int, input().split())
cnt=0
for i in range(A, B+1):
  j=str(i)
  flg=True
  for k in range(len(j)//2):
    if j[k]!=j[-k-1]:
      flg=False
      break
  if flg:
    cnt+=1
print(cnt)

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

using namespace std;

int main()
{
  string S,T;
  cin >> S >> T;

  int n = S.length();

  T = T+T;

  for(int i=0;i<n;i++)
    {
      bool flg = true;
      for(int j=0;j<n;j++)
	{
	  if( S[j] != T[i+j] )
	    {
	      flg = false;
	      break;
	    }
	}
      if( flg )
	{
	  cout << "Yes" << endl;
	  return 0;
	}
    }
  cout << "No" << endl;
}


Measured memory_bytes: 256
N, M = list(map(int,input().split()))
graph = [[-1 for i in range(N)] for i in range(N)]
for i in range(M):
    a, b = list(map(int,input().split()))
    graph[a - 1][b - 1] = 1
    graph[b - 1][a - 1] = 1
    
def dfs(node, depth):
    global visited
    global ans
    if depth == N - 1:
        if sum(visited) == N:
            ans += 1
        return
    for i in range(1, N):
        if graph[node][i] == 1 and visited[i] == -1:
            visited[i] = 1
            dfs(i, depth + 1)
            visited[i] = -1
            
visited = [-1 for i in range(N)]
visited[0] = 1

ans = 0
dfs(0, 0)

print(ans)

Measured memory_bytes: 45020
#include<bits/stdc++.h>
    using namespace std;
    signed main(){
    int a,b,c=0,d,e;
    cin>>a>>b;
    d= max(a,b);
    e=min(a,b);
    c=d;
    d--;
    c=c+max(d,e);
    cout<<c<<"\n";
    }

Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}

import Data.Array (Array, listArray, accumArray, (!))
import Data.List (sortOn, sortBy, unfoldr)
import Data.Char (isSpace)
import qualified Data.ByteString.Char8 as B


import Data.Array.ST (STUArray, runSTUArray)
import Data.Array.MArray
import Control.Monad.ST (ST, runST)
import Control.Monad (when)


type UnionFind s = (STUArray s Int Int, STUArray s Int Int)

inituf :: (Int,Int) -> ST s (UnionFind s)
inituf (s,t) = (,) <$> newListArray (s,t) [s..] <*> newArray (s,t) 1

find :: UnionFind s -> Int -> ST s Int
find uf@(par,_) x = do
  p <- readArray par x
  if p==x then return x
  else do
    p' <- find uf p
    writeArray par x p'
    return p'

same :: UnionFind s -> Int -> Int -> ST s Bool
same uf x y = (==) <$> find uf x <*> find uf y

union :: UnionFind s -> Int -> Int -> ST s Int
union uf@(par,siz) x y = do
  px <- find uf x
  py <- find uf y
  when (px/=py) $ do
    sx <- readArray siz px
    sy <- readArray siz py
    writeArray par py px
    writeArray siz px (sx+sy)
  return px

size :: UnionFind s -> Int -> ST s Int
size (par,siz) x = readArray par x >>= readArray siz


type T a = (a,a)
f :: [a] -> T a
f [x,y] = (x,y)

permu n 0 = 1
permu n k = n * permu (n-1) (k-1)

choice n k = permu n k `div` permu k k

solv n m xs
  = runST $ do
    uf <- inituf (1,n)
    go uf (reverse xs) (choice n 2)
  where
    go :: UnionFind s -> [T Int] -> Int -> ST s [Int]
    go uf [] _ = return []
    go uf ((a,b):xs) c = do
      ga <- find uf a
      gb <- find uf b
      if ga==gb then (c:) <$> go uf xs c
      else do
        sa <- size uf ga
        sb <- size uf gb
        union uf a b
        let c' = c - sa*sb
        (c:) <$> go uf xs c'

readT :: B.ByteString -> Maybe (T Int, B.ByteString)
readT bs = do
  (x,bs') <- B.readInt . B.dropWhile isSpace $ bs
  (y,bs'') <- B.readInt . B.dropWhile isSpace $ bs'
  return ((x,y),bs'')

main = do
  [n,m] <- map read . words <$> getLine :: IO [Int]
  xs <- take m . unfoldr readT <$> B.getContents :: IO [T Int]
  putStr . unlines . map show . reverse $ solv n m xs


Measured memory_bytes: 29052
import math, sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from copy import deepcopy
from functools import lru_cache
from heapq import heapify, heappop, heappush
from itertools import accumulate, combinations, permutations
input = sys.stdin.readline
p = 10**9 + 7
ns = lambda: input().strip()
ni = lambda: int(input().strip())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

def main():
    n = ni()
    a = nl()

    ans = [0]*n

    for num in a:
        ans[num-1] += 1

    for value in ans:
        print(value)

if __name__ == '__main__':
    main()

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
    ll W, H, x, y;
    cin >> W >> H >> x >> y;
    double s = (double)H * (double)W / 2.0;
    int t = 0;
    if (x + x == W && y + y == H)
        t = 1;
    cout << OF64 << s << " " << t << endl;
    return 0;
}

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

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

	int n;cin>>n;
	string s;cin>>s;
	int ans=0;
	for(int l=0,r=n-1;l<r;){
		if(s[l]=='W'){
			if(s[r]=='R'){
				swap(s[l],s[r]);
				ans++;
				l++;
			}

			r--;
		}else{
			l++;
		}
	}

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

Measured memory_bytes: 3784
/*
Author: Racer5x
 ***************************************   UNAUTHORISED COPYING OF CODE PROHIBITED   **********************************
*/
 
/*#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
 
#include<bits/stdc++.h>
#define int         long long
#define double      long double
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        998244353 
#define PI          3.141592653589
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MAX         1000000000000000000
#define M           1000000000000000007
using namespace std;
 
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int power(int x,int n){
    int result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x) % M;
        x=(x*x)% M;
        n=n/2;
    }
    return result % M;
}

vi adj[100005];
int dp[100005];
bool vis[100005] = {false};

void dfs(int v){
    vis[v] = true;
    for(int x:adj[v]){
        if(!vis[x]){
            dfs(x);
        }
    }
   // cout<<v<<" -> ";
    if(!adj[v].size()) {dp[v] = 0; }//cout<<'t'<<' ';}
    else{
        for(int x:adj[v]) {dp[v] = max(dp[v],dp[x]); }//cout<<dp[x]<<" ";}
            dp[v]++;
            //cout<<" --> "<<dp[v];
    }
    //cout<<endl;
}

signed main()
{
    tezz
 
    memset(dp,0,sizeof(dp));
    int n,m;
    cin>>n>>m;
    int indeg[n+1] = {0};
    while(m--){
        int a,b;
        cin>>a>>b;
        adj[a].pb(b);
        indeg[b]++;
    }
    vi root;
    for(int i=1;i<=n;i++) if(!indeg[i]) root.pb(i);

    for(int x:root) dfs(x);
    int mx=0;
    for(int x:root) mx = max(mx,dp[x]);
        cout<<mx;
}

Measured memory_bytes: 12032
sN = input()
N = int(sN)

ans = 0
for i in range(1, len(sN), 2):
    ans += (10 ** i - 10 ** (i - 1))

if len(sN) % 2 == 1:
    ans += N - 10**(len(sN) - 1) + 1

print(ans)


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

#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L];

//文字から数値に変換
int getChar(char ch){
    if( ch == 'A') return 1;
    else if(ch == 'C') return 2;
    else if(ch == 'G') return 3;
    else if(ch == 'T') return 4;
    else return 0;
}

//文字列から数値へ変換してkey を生成する
long long getKey(char str[]){ // long long は最大64bitまで可能な大きい型
    long long sum =0, p =1,i;
    for(i=0; i<strlen(str); i++){
        sum += p*(getChar(str[i]));
        p *=5;
    }
    return sum;
}
//ハッシュ値の定義(結構意味わからん)
int h1(int key){return key % M;}
int h2(int key){return 1 +(key %(M -1)); }

int find(char str[]){
    long long  key, i, h;
    key = getKey(str);
    for(i = 0;; i++){
        h = (h1(key) +i*h2(key)) % M; // ハッシュ値計算
        if(strcmp(H[h], str) == 0) return 1;
        else if (strlen(H[h]) == 0) return 0;
    }
    return 0;
}

int insert(char str[]){
    long long key, i,h;
    key =getKey(str);
    for(i=0;; i++){
        h = (h1(key) + i *h2(key)) % M;
        if( strcmp(H[h],str) == 0)return 1;
        else if (strlen(H[h]) == 0){
            strcpy(H[h], str);//ハッシュ番地に文字列をコピー
            return 0;
        }
    }
    return 0;
}
int main(){
    int i,n,h;
    char str[L], com[9];
    for (i =0;i<M;i++)H[i][0] = '\0';
    scanf("%d",&n);
    for(i=0; i<n; i++){
        scanf("%s %s", com,str);

        if(com[0] == 'i'){
            insert(str);
        }
        else {
            if( find(str)){
                printf("yes\n");
            }else{
                printf("no\n");
            }
        }
    }
    return 0;
}




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

class Dice
{
public:
	bool st[6][3][3];
	Dice()	{}

	Dice(bool* t)
	{
		for (int i=0; i<54; i++)
			st[i/9][(i%9)/3][(i%9)%3]=t[i];
	}

	void RotU()
	{
		bool n[6][3][3];
		memcpy(n[0], st[5], sizeof(st[5]));
		memcpy(n[4], st[0], sizeof(st[0]));
		for (int i=0; i<3; i++)
		for (int j=0; j<3; j++)
		{
			n[2][i][j] = st[4][2-i][2-j];
			n[5][i][j] = st[2][2-i][2-j];
			n[1][i][j] = st[1][2-j][i];
			n[3][i][j] = st[3][j][2-i];
		}
		memcpy(st, n, sizeof(n));
	}

	void RotD()
	{
		bool n[6][3][3];
		memcpy(n[0], st[4], sizeof(st[4]));
		memcpy(n[5], st[0], sizeof(st[0]));
		for (int i=0; i<3; i++)
		for (int j=0; j<3; j++)
		{
			n[2][i][j] = st[5][2-i][2-j];
			n[4][i][j] = st[2][2-i][2-j];
			n[1][i][j] = st[1][j][2-i];
			n[3][i][j] = st[3][2-j][i];
		}
		memcpy(st, n, sizeof(n));
	}

	void RotL()
	{
		bool n[6][3][3];
		for (int i=0; i<3; i++)
		for (int j=0; j<3; j++)
		{
			n[2][i][j] = st[2][2-j][i];
			n[3][i][j] = st[4][2-j][i];
			n[0][i][j] = st[0][j][2-i];
			n[1][i][j] = st[5][j][2-i];
			n[4][i][j] = st[1][j][2-i];
			n[5][i][j] = st[3][j][2-i];
		}
		memcpy(st, n, sizeof(n));
	}

	void RotR()
	{
		bool n[6][3][3];
		for (int i=0; i<3; i++)
		for (int j=0; j<3; j++)
		{
			n[2][i][j] = st[2][j][2-i];
			n[0][i][j] = st[0][2-j][i];
			n[1][i][j] = st[4][2-j][i];
			n[3][i][j] = st[5][2-j][i];
			n[4][i][j] = st[3][2-j][i];
			n[5][i][j] = st[1][2-j][i];
		}
		memcpy(st, n, sizeof(n));
	}

	bool isGoal()
	{
		bool f = false;
		for (int i=0; i<3; i++)
			if (st[0][2][i]) { f = true; break; }

		if (!f) return f;
		f = false;
		for (int i=0; i<3; i++)
			if (st[2][2][i]) { f = true; break; }

		return f;
	}

	bool operator<(const Dice& d) const {
		for (int k=0; k<6; k++)
		for (int i=0; i<3; i++)
		for (int j=0; j<3; j++)
		{
			if (st[k][i][j] != d.st[k][i][j]) return st[k][i][j] < d.st[k][i][j];
		}

		return false;

	}
};

class Trl
{
public:
	Dice d;
	int n;
	Trl(Dice d, int n): d(d), n(n) {}
};

int main()
{
	char in[6][3][3];
	while (cin >> in[0][0][0], in[0][0][0]!='#')
	{
		bool b[54];
		b[0] = (in[0][0][0]=='*');
		for (int i=1; i<54; i++)
		{
			cin >> in[i/9][(i%9)/3][(i%9)%3];
			b[i] = (in[i/9][(i%9)/3][(i%9)%3]=='*');
		}
		Dice init(b);
		queue<Trl> q;
		q.push(Trl(init, 0));
		set<Dice> v;
		v.insert(init);

		
		while (!q.empty())
		{
			Trl t = q.front(); q.pop();
			
			if (t.d.isGoal())
			{
				cout << t.n << endl;
				break;
			}
			t.n++;

			Dice d;
			d = t.d;
			d.RotD();
			if (v.insert(d).second)
				q.push(Trl(d, t.n));

			d = t.d;
			d.RotU();
			if (v.insert(d).second)
				q.push(Trl(d, t.n));

			d = t.d;
			d.RotR();
			if (v.insert(d).second)
				q.push(Trl(d, t.n));

			d = t.d;
			d.RotL();
			if (v.insert(d).second)
				q.push(Trl(d, t.n));

		}
		
	}

	return 0;
}

Measured memory_bytes: 0
#include <stdlib.h>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <string>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
using namespace std;
using ll = long long;

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

  int A_index=-1,Z_index;
  for(int i=0;i<S.size();++i){
    if(S.at(i)=='A' && A_index==-1) A_index=i;
    if(S.at(i)=='Z') Z_index=i;
  }

  cout << Z_index-A_index+1 << endl;

  return 0;
}


Measured memory_bytes: 3760
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <stack>
#include <cmath>
#include <time.h>
#include <unordered_set>
#include <unordered_map>
#define ll long long
#define LINF 0x3f3f3f3f3f3f3f3f
#define INF 0x3f3f3f3f
#define PI 3.14159265
#define RAND (rand()*rand())
#define MAX(x, y) ((x) > (y) ? (x):(y)) 
#define MIN(x, y) ((x) > (y) ? (y):(x))
#define ABS(x) ((x) > 0 ? (x) : -(x))
#define CEIL(x, y) (((x) + (y) - 1)/(y))
using namespace std;
const int MAXN = 1e5 + 5;
const ll MOD = 1e9 + 7;
int N, M, K, Q, T;
char str[105];

int main()
{
	int i, j;
	scanf("%d%s", &N, str);
	for (i = 0; i < N / 2; ++i) {
		if (str[i] != str[i + N / 2]) break;
	}
	if (N %2 == 1 || i != N / 2) printf("No");
	else printf("Yes");
}

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

int main(){
  int N,M; cin >> N >> M;
  int x = M/N;
  int ans = 1;
  for(int i=1;i*i<=M;i++){
    if(M%i==0){
      int j = M/i;
      if(j<=x) ans = max(ans,j);
      if(i<=x) ans = max(ans,i);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(a-1);i>=(b);i--)
#define all(x) (x).begin(), (x).end()
const int INF = 1e18;
const int MOD = 1e9+7;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<string> vstr;
void print() {cout<<'\n';}template<class Head,class...Tail>void print(Head&&head,Tail&&...tail){cout<<head;if(sizeof...(tail)!=0)cout<<" ";print(forward<Tail>(tail)...);}template<class T>void print(vector<T>&vec){for(auto&a:vec){cout<<a;if(&a!=&vec.back())cout<<" ";}cout<<'\n';}template<class T>void print(vector<vector<T>>&df){for(auto&vec:df){print(vec);}}
template<class T=int>T in() {T x;cin>>x;return(x);}
template<class T=int>vector<T> input_to_vector(int n) {vector<T>x;rep(i,n){T a;cin>>a;x.push_back(a);}return(x);}

signed main(){
    string s = in<string>();
    int min = INF;
    rep(i, s.size()-2) {
        string a{s[i]}, b{s[i+1]}, c{s[i+2]};
        string str = a + b + c;
        int tmp = stoi(str);
        if(abs(753 - tmp) < min) {
            min = abs(753 - tmp);
        }
    }
    print(min);
}

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

const int MAXN=300011;
int a[MAXN], b[MAXN];
vector<int> p, q;
int n, m;

inline void Wrong() {
    puts("No");
    exit(0);
}

inline void Solve(int l, int r) {
    if(l>r) return;
    if(l==r && b[l]==0) Wrong();
    for(int i=l;i<=r;++i) {
        if(a[i]<l || a[i]>r) Wrong();
        if(a[i]>i) p.push_back(a[i]);
        else if(a[i]<i) q.push_back(a[i]);
    }
    for(int i=1;i<(int)p.size();++i) {
        if(p[i]<=p[i-1]) Wrong();
    }
    for(int i=1;i<(int)q.size();++i) {
        if(q[i]<=q[i-1]) Wrong();
    }
    p.clear();
    q.clear();
}

int main() {
    scanf("%d", &n);
    for(int i=1;i<=n;++i) {
        scanf("%d", &a[i]);
    }
    b[0]=-1;
    int las=1;
    for(int i=1;i<=n;++i) {
        if(a[i]==i) b[i]=1;
        else b[i]=0;
        if(b[i]==b[i-1]) {
            Solve(las, i-1);
            las=i;
        }
    }
    Solve(las, n);
    puts("Yes");
    return 0;
}

Measured memory_bytes: 3900
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <cmath>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<25;
const double pi=acos(-1);
const double eps=1e-8;
const vi emp;

string s,t;

int main(){
	cin>>s;
	sort(s.begin(),s.end());
	t=s;
	t.erase(unique(t.begin(),t.end()),t.end());
	for(string::iterator i=t.begin();i!=t.end();++i){
		if((upper_bound(s.begin(),s.end(),*i)-lower_bound(s.begin(),s.end(),*i))%2==1){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {

	var c string
	fmt.Scan(&c)

	if c == "a" || c == "i" || c == "u" || c == "e" || c == "o" {
		fmt.Println("vowel")
	} else {
		fmt.Println("consonant")
	}
}


Measured memory_bytes: 1772
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <map>
#include <unordered_map>
#include <set>
using namespace std;

typedef long long ll;

#define INF 10e17 // 4倍しても(4回足しても)long longを溢れない
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto itr : x) { debug(itr); }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

int main() {
  string s;
  cin >> s;
  map<char, int> mp;
  for (auto itr : s) {
    mp[itr] += 1;
  }

  for (auto itr : mp) {
    if (itr.second != 2) {
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;
}


Measured memory_bytes: 764