akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <complex>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <iomanip>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define put(x) cout << x;
#define putsp(x) cout << x << ' ';
#define putbd cout << "---------------------------------------------" << endl;
#define putln(x) cout << x << endl;
#define debug(x) cerr << #x << "=" << x << endl;
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);
#define yuiyui 0

typedef long long ll;
typedef unsigned long long ul;
typedef pair<int, int> intP;
typedef pair<ll, ll> llP;
typedef pair<ul, ul> ulP;
typedef complex<double> comp;
typedef vector <int> vec;
typedef vector <ll> vecll;
typedef vector <ul> vecul;
typedef vector <double> vecd;
typedef vector <vec> mat;
typedef vector <vecll> matll;
typedef vector <vecul> matul;
typedef vector <vecd> matd;

//vector の中身を出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

const int MAX = 200020;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const ll INFL = 1e18;
const ll MOD = 1e9+7;

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

//********************************template END****************************************//

void solve(void){

	int a,b,c;
	int xs[10] = {0};

	while(~scanf("%d%d%d\n", &a,&b,&c))
	{
		rep(10, i) xs[i] = i+1;
		xs[a-1] = 0;
		xs[b-1] = 0;
		xs[c-1] = 0;

		int r = a+b, cnt = 0;

		rep(10, i)
		{
			if (xs[i] != 0 && r + xs[i] <= 20) cnt++;
		}

		cout << (cnt > 3 ? "YES" : "NO") << endl;

	}

}

int main(void)
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return yuiyui;
}



Measured memory_bytes: 3132
#define _GLIBCXX_DEBUG //test only

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

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
#define INF 1000000000

vector<int> topo_sort1(vector<vector<int>> e)
{
  int n=e.size();
  vector<int> ans(0);
  vector<int> ins(n,0);
  int i,j;
  rep(i,n)
  {
    rep(j,e[i].size())
    {
      ins[e[i][j]]++;
    }
  }
  queue<int> s;
  rep(i,n) if(ins[i]==0)s.push(i);
  while(!s.empty())
  {
    int now=s.front();
    s.pop();
    ans.emplace_back(now);
    rep(i,e[now].size())
    {
      ins[e[now][i]]--;
      if(ins[e[now][i]]==0)
      {
        s.push(e[now][i]);
      }
    }
  }
  return ans;
}

int main()
{
  int n;
  cin >> n;
  vector<vector<int>> a(n,vector<int>(n-1));
  int i,j;
  rep(i,n)rep(j,n-1)
  {
    cin >> a[i][j];
    a[i][j]--;
  }
  vector<vector<int>> e(n*(n-1)/2);
  vector<vector<int>> trans(n,vector<int>(n,-1));
  int num = 0;
  rep(i,n)rep(j,i)
  {
    trans[j][i] = num;
    trans[i][j] = num;
    num++;
  }
  rep(i,n)rep(j,n-2)
  {
    int from = trans[i][a[i][j]];
    int to = trans[i][a[i][j+1]];
    e[from].emplace_back(to);
  }
  vector<int> ans;
  ans = topo_sort1(e);
  if(ans.size() < n*(n-1)/2)
  {
    cout << -1 << endl;
  }
  else
  {
    vector<int> dp(n*(n-1)/2,1);
    for(i=n*(n-1)/2-1;i>=0;i--)
    {
      rep(j,e[ans[i]].size())
      {
        dp[ans[i]] = max(dp[ans[i]], dp[e[ans[i]][j]]+1);
      }
    }
    int ans = 0;
    rep(i,n*(n-1)/2)
    {
      ans = max(ans,dp[i]);
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 98164
import math

A, B, H, M = map(int, input().split())

h_angle = 360*H/12 + 360*M/(12*60)
m_angle = 360*M/60
angle = abs(m_angle - h_angle)
if angle > 180:
    angle = 360 - angle
elif angle < 180:
    pass
C = math.sqrt(A**2 + B**2 - 2*A*B*math.cos(math.radians(angle)))
print(C)

Measured memory_bytes: 9428
/**
 *      ABC 69 A
 *      author  : kyomukyomupurin
 *      created : 2018-09-04 22:27:54
**/

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n, m; cin >> n >> m;
    cout << (n - 1) * (m - 1) << endl;
    return 0;
}

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

int main(){
  int x;
  cin >> x;
  int ans500, ans5;
  ans500 = x/500;
  x -= ans500*500;
  ans5 = x/5;
  int ans= ans500*1000 + ans5*5;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
string s;
bool f[256];
int main()
{
	cin>>s;
	for(int i=0;i<s.size();i++)f[s[i]]=true;
	if(f['N']!=f['S'] || f['W']!=f['E'])printf("No");else printf("Yes");
	return 0;
} 

Measured memory_bytes: 256
N,H = map(int,input().split())

a = []
b = []
finish = 0

for i in range(1,N+1):
    elem1, elem2 = map(int,input().split())
    a.append(elem1)
    b.append(elem2)


b = sorted(b, key=int, reverse=True)

maxB = max(b)
maxA = max(a)
sum = maxB
b.remove(maxB)
count = 1
for elem in b:
    if elem > maxA and sum < H:
        sum = sum + elem
        count += 1
    if sum >= H:
        finish = 1
        break


#print(sum)
if finish == 0:
    dev = int((H - sum)/maxA)
    count = count + dev
    sum = sum + dev * maxA
    if sum < H:
        count += 1

print(count)


Measured memory_bytes: 13224
{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
import           Control.Monad.ST            (ST)
import           Data.Bits                   (shiftR)
import qualified Data.ByteString.Char8       as B
import           Data.Char                   (isSpace)
import           Data.Maybe                  (fromJust)
import qualified Data.Vector.Unboxed         as V
import qualified Data.Vector.Unboxed.Mutable as VM

main :: IO ()
main = do
  [n, m] <- getInts
  xs <- V.unfoldrN m parseInt <$> B.getLine
  print $ solve n m xs

solve :: Int -> Int -> V.Vector Int -> Int
solve n m xs = V.sum $ V.take (m - n) ls'
  where
    xs' = sort' xs
    ls = V.zipWith (-) (V.tail xs') xs'
    ls' = sort' ls

sort' :: V.Vector Int -> V.Vector Int
sort' = V.modify (\v -> quicksort v 0 (VM.length v))

-- https://github.com/as-capabl/haskell-qsort-pfm/blob/master/src/UV.hs
quicksort :: VM.STVector s Int -> Int -> Int -> ST s ()
quicksort work iStart iEnd
    | iEnd - iStart <= 1 = return ()
    | otherwise = do
        pivot <- VM.unsafeRead work (((iEnd - iStart) `shiftR` 1) + iStart)
        med <- divide pivot iStart (iEnd - 1)
        quicksort work iStart med
        quicksort work med iEnd
  where
    divide pivot iS' iE'
        | iS' > iE' = return iS'
        | otherwise = do
            lower <- shrinkLower pivot iS' iE'
            higher <- shrinkHigher pivot lower iE'
            if lower >= higher
              then do
                return lower
              else do
                swapWork lower higher
                divide pivot (lower + 1) (higher - 1)

    shrinkLower pivot iS' iE'
        | iS' > iE' = return iS'
        | otherwise = do
            x <- VM.unsafeRead work iS'
            if x >= pivot
              then
                return iS'
              else
                shrinkLower pivot (iS' + 1) iE'

    shrinkHigher pivot iS' iE'
        | iS' > iE' = return iE'
        | otherwise = do
            x <- VM.unsafeRead work iE'
            if x <= pivot
              then
                return iE'
              else
                shrinkHigher pivot iS' (iE' - 1)

    swapWork i j = VM.unsafeSwap work i j

readInts :: B.ByteString -> [Int]
readInts = map (fst . fromJust . B.readInt) . B.words

getInts :: IO [Int]
getInts = readInts <$> B.getLine

parseInt :: B.ByteString -> Maybe (Int, B.ByteString)
parseInt = B.readInt . B.dropWhile isSpace


Measured memory_bytes: 5500
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rrep(i, n) for(ll i = n - 1; i > -1; i--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define fi first
#define se second
#define debug(V) rep(i, V.size()) cout << V[i] << " ";
const ll INF = 1LL << 61;
const ll MOD = 1000000007 /*988244353*/;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, h, x, y, z, p, q, m, n, t, r, k, w, l, ans, i, j;
string S, T;
vl A, B;
vector<PP> vp;
void solve() {
    priority_queue<PP> pq;

    vp.pb({INF, -INF});
    sort(all(vp));
    a = 0;
    rep(i, m) {
        while(vp[a].fi == i + 1) {
            pq.push({vp[a].se, vp[a].fi});
            a++;
        }

        if(!pq.empty()) {
            x = pq.top().fi;
            pq.pop();
            ans += x;
        }
    }

    cout << ans << endl;
}
int main() {
    // cout<<fixed<<setprecision(15);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m;
    rep(i, n) {
        cin >> x >> y;
        vp.pb({x, y});
    }
    solve();
}

Measured memory_bytes: 4848
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long int64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
const int MAX_NUM = 999999999;
void solve() {
	int n; cin >> n;
	int amari = n % 10;
	if (amari == 2 || amari == 4 || amari == 5 || amari == 7 || amari == 9) {
		cout << "hon" << endl;
	} else if (amari == 0 || amari == 1 || amari == 6 || amari == 8) {
		cout << "pon" << endl;
	} else {
		cout << "bon" << endl;
	}
	return;
}
int main() {
	solve();
	return 0;
}

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

class Program
{
    static void Main(string[] args)
    {
        var sol = new Solve();
        sol.Exec();
    }
}

class Solve
{
    public void Exec()
    {
        var S = Console.ReadLine();
        var N = S.Length;

        if (Kaibun(S, 0, N - 1) && Kaibun(S, 0, (N -1)/2 - 1) && Kaibun(S, (N+3)/2-1, N - 1))
            Console.WriteLine("Yes");
        else
            Console.WriteLine("No");
    }

    private bool Kaibun(string s, int start, int end)
    {
        for (var i = start; i < start + (end - start)/2+1; i++)
        {
            if (s[i] != s[end - i])
                return false;
        }

        return true;
    }
}


Measured memory_bytes: 13140
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap

class Mod:
    def __init__(self, m):
        self.m = m

    def add(self, a, b):
        return (a + b) % self.m

    def sub(self, a, b):
        return (a - b) % self.m

    def mul(self, a, b):
        return ((a % self.m) * (b % self.m)) % self.m

    def div(self, a, b):
        return self.mul(a, pow(b, self.m-2, self.m))

    def pow(self, a, b):
        return pow(a, b, self.m)

@mt
def slv(N, X):
    ans = 1
    M = Mod(10**9+7)
    l = 0
    for i, x in enumerate(X):
        ans = M.mul(ans, i+1 -l)
        if i != N-1:
            l =  max(l, -(-((2*(i) + 1) - x) // 2))
        # print(ans, i+1, x, l)

    return ans


def main():
    N = read_int()
    X = read_int_n()
    print(slv(N, X))


if __name__ == '__main__':
    main()


Measured memory_bytes: 79596
N=int(input())
A=list(map(int,input().split()))
plus=[a for a in A if a>0]
mainus=[a for a in A if a<=0]
plus.sort()
mainus.sort(reverse=True)
if len(mainus)==0:
    print(sum(plus)-2*plus[0])
    now=plus[0]
    for i in range(1,len(plus)-1):
        print(str(now)+" "+str(plus[i]))
        now-=plus[i]
    print(str(plus[-1])+" "+str(now))
elif len(plus)==0:
    print(-1*sum(mainus)+2*mainus[0])
    now=mainus[0]
    for i in range(1,len(mainus)):
        print(str(now)+" "+str(mainus[i]))
        now-=mainus[i]
else:
    print(sum(plus)-sum(mainus))
    now=mainus[0]
    for i in range(len(plus)-1):
        print(str(now)+" "+str(plus[i]))
        now-=plus[i]
    if len(plus)>0:
        print(str(plus[-1])+" "+str(now))
        now=plus[-1]-now
    for i in range(1,len(mainus)):
        print(str(now)+" "+str(mainus[i]))
        now-=mainus[i]

Measured memory_bytes: 14088
#include <iostream>

using namespace std;

int main()
{
  double v;
  while (cin >> v)
  {
    double t = v / 9.8;
    double y = 4.9 * t * t;

    for (int N = 1;; ++N)
      if ((5 * N - 5) > y) {
	cout << N << endl;
	break;
      }
  }
  
  return 0;
}

Measured memory_bytes: 1224
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>

using namespace std;

typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define Fst first
#define Snd second
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
#define repv(t,it,v) for(vector<t>::iterator it = v.begin() ; it != v.end() ; ++it)

typedef long long LL;

const int BIT_MAX = 100010;
const LL mod = 1e9 + 7;

template <class T> class BIT{
	T x[BIT_MAX + 1];
	
public:
	
	BIT(){
		fill(x,x+BIT_MAX+1,0);
	}
	
	void add(int a , T b){
		++a;
		for(; a <= BIT_MAX ; a += a & -a) (x[a] += b) %= mod;
	}
	
	T get(int a){
		++a;
		T b = 0;
		for(; a > 0 ; a -= a & -a) (b += x[a]) %= mod;
		return b;
	}
};

int N;
LL A,B;
LL S[100010];
int ta[100010];
int tb[100010];
BIT<LL> va , vb;
int qa , qb;

int main(){
	scanf("%d%lld%lld" , &N , &A , &B);
	if(A<B) swap(A,B);
	S[0] = -A-3;
	qa = qb = 0;
	repp(i,1,N+1){
		scanf("%lld" , S + i);
		while(S[i] - S[qa+1] >= A) ++qa;
		while(S[i] - S[qb+1] >= B) ++qb;
		ta[i] = qa;
		tb[i] = qb;
	}
	qa = qb = 0;
	va.add(1,1);
	vb.add(1,1);
	repp(i,2,N+1){
		int x = (vb.get(ta[i]+1)-vb.get(qb)+mod)%mod;
		int y = (va.get(tb[i]+1)-va.get(qa)+mod)%mod;
		if(ta[i]+1>qb) va.add(i,x);
		if(tb[i]+1>qa) vb.add(i,y);
		if(S[i]-S[i-1]<A) qa = i-1;
		if(S[i]-S[i-1]<B) qb = i-1;
	}
	printf("%lld\n" , (va.get(N) - va.get(qa) + vb.get(N) - vb.get(qb) + mod + mod) % mod);
	return 0;
}


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

char c[10][10];

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

int doit(int x,int y){
	if( y < 0 || x < 0 || y >= 8 || x >= 8 || c[y][x] == '0' ) return 0;
	c[y][x] = '0';
	for(int i = 0 ; i < 4 ; i++){
		for(int j = 1 ; j <= 3 ; j++){
			doit(x+dx[i]*j,y+dy[i]*j);
		}
	}
}
int main(){
	int T;
	cin >> T;
	for(int t = 1 ; t <= T ; t++){
		cout << "Data " << t << ":" << endl; 
		for(int i = 0 ; i < 8 ; i++)
			for(int j = 0 ; j < 8 ; j++)
				cin >> c[i][j];
		int x,y;
		cin >> x >> y;
		y--,x--;
		doit(x,y);
		for(int i = 0 ; i < 8 ; i++){
			for(int j = 0 ; j < 8 ; j++)cout << c[i][j];
			cout << endl;
		}
	}
	
}

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

int main() {
  string S;
  int z=0;
   cin >> S;
  if (S.at(0)=='1') {
    for (int i=0; i < S.size(); i++) {
      if(i%2 == 0) { 
      if (S.at(i) != '1') z++;
      }
      else {
      if (S.at(i) != '0') z++;
          }
    }
          }
  if (S.at(0)=='0') {
    for (int i=0; i < S.size(); i++) {
      if(i%2 == 0) { 
      if (S.at(i) != '0') z++;
      }
      else {
      if (S.at(i) != '1') z++;
          }
    }
          }

    cout << z << endl;
}

Measured memory_bytes: 512
#include<stdio.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define rep(i,N) for(int i=0;i<(int)N;i++)
static inline char CH()
{
  static char buf[100000],*ptr1=buf,*ptr2=buf;
  return ptr1==ptr2&&(ptr2=(ptr1=buf)+fread(buf,1,100000,stdin),ptr1==ptr2)?EOF:*ptr1++;
}
static inline int IN(void)
{
  int x=0,f=0,c=CH();while(c<48||c>57){f^=c==45,c=CH();}
  while(c>47&&c<58){x=x*10+c-48,c=CH();}return f?-x:x;
}
static inline void OUT(int x){if(x<0)putchar('-'),x=-x;if(x>=10)OUT(x/10);putchar(x%10+48);}
static inline int min(const int a,const int b){return a<b?a:b;}
int main(void)
{
  int N=IN(),a=0,across,d,down,p,q,xy,que[251502],vacant[252525],dist[252525];
  rep(i,N)
  {
    xy=(N+2)*(i+1)+1;across=min(i,N-1-i),down=3;
    rep(j,across){dist[xy++]=down++;}
    rep(j,N-2*across){dist[xy++]=across+3;}
    rep(j,across){dist[xy++]=--down;}
  }
  rep(k,N*N)
  {
    xy=IN();xy+=(xy-1)/N*2+N+2;a+=dist[xy];p=0,q=0;
    que[p++]=xy;vacant[xy]=1;
    while(p>q)
    {
      xy=que[q++],d=dist[xy]-vacant[xy]+1;
      if(dist[xy-N-2]>d){dist[xy-N-2]=d;que[p++]=xy-N-2;}
      if(dist[xy+N+2]>d){dist[xy+N+2]=d;que[p++]=xy+N+2;}
      if(dist[xy-1]>d){dist[xy-1]=d;que[p++]=xy-1;}
      if(dist[xy+1]>d){dist[xy+1]=d;que[p++]=xy+1;}
    }
  }
  OUT(a-3*N*N);return puts(""),0;
}

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

using namespace std;

int n,a,d,t[1000003],zzs=-(1<<30);

int sq(int x,int y)
{
    if(!y) 
		return x;
    return sq(y,x%y);
}
void fj(int x)
{
    for(int i=2;i*i<=x;)
	{
        if(!(x%i))
		{
            t[i]++;
            while(!(x%i)) 
				x/=i;
        }
        else 
			i++;
    }
    if(x>1) 
		t[x]++;
}
int main()
{
    scanf("%d%d",&n,&a);
    d=a;
    for(int i=2;i<=n;i++)
	{
		scanf("%d",&a);
        if(zzs<a) 
			zzs=a;
        d=sq(d,a);
        fj(a);
    }
    if(d==1)
	{
        for(int i=2;i<=zzs;i++)
        {
        	if(t[i]>1) 
			{
				printf("setwise coprime\n");
				return 0;
			}
		}
        printf("pairwise coprime\n");
        return 0;
    }
    else
    {
    	printf("not coprime\n");
    	return 0;
	}
    return 0;
}

Measured memory_bytes: 7552
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
	//try{
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        OutputStream outputStream = System.out;
    	PrintWriter out = new PrintWriter(outputStream);

        int i, n, m, c, k;

		int t = Integer.parseInt(br.readLine());    
        out.print(t*t*t);
	
	out.flush();
	out.close();
	//}catch(Exception e){}
	}
}

Measured memory_bytes: 21460
a = input()

mm = a[:2]
yy = a[2:]

x = int(mm)
y = int(yy)

xm = False
ym = False

if x > 0 and x <= 12:
    xm = True
if y > 0 and y <= 12:
    ym = True

if xm and ym:
    print("AMBIGUOUS")
elif xm:
    print("MMYY")
elif ym:
    print("YYMM")
else:
    print("NA")


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

int main() {
	int n, a;
	vector<int> an;
	vector<vector<int>> AN;
	while (cin >> n) {
		if (n == 0)break;
		for (int i = 0; i < n; i++) {
			cin >> a;
			an.push_back(a);
		}
		AN.push_back(an); an.clear();
	}

	for (int i = 0; i < AN.size(); i++) {
		long long int max = 0, min = INT_MAX, MAX = 0, MIN = 0 , counter = 0, negative = 0;
		for (int j = 0; j < AN[i].size(); j++) {
			if (AN[i][j] >= 0) {
				max += AN[i][j];
				if (MAX < max)MAX = max;
				counter = 1;
				negative = 1;
			}
			
			else {
				if (negative == 0) {
						if(min > abs(AN[i][j]))min=abs(AN[i][j]);
					}
				else if (counter==1){
					if (AN[i][j] + max >= 0)max += AN[i][j];
					else {
						max = 0;
						counter = 0;
					}
				}
			}
		}
		if (negative == 0)cout << -1*min << endl;
		else cout << MAX << endl;
	}
	return 0;
}

Measured memory_bytes: 3144
#include<iostream>
#include<map>
#include<algorithm>
using namespace std;
typedef pair<int,int> P;

int main(){
  int n,m;
  int ho,mi;
  P p[202];
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> ho >> mi;
    p[i].first = ho;
    p[i].second = mi;
  }
  cin >> m;
  for(int i=n;i<n+m;i++){
    cin >> ho >> mi;
    p[i].first = ho;
    p[i].second = mi;
  }
  sort(p,p+(m+n));
  int cou = 0;
  for(int i=0;i<n+m;i++){
    if(i == 0){
      if(p[i].second < 10){
	if(cou==1){
	  cout << " ";
	}
	cou=1;
	cout << p[i].first << ":0" << p[i].second;
      }
      else {
	if(cou==1){
	  cout << " ";
	}
	cou=1;
	cout << p[i].first << ":" << p[i].second;
      }
    }
    else if(p[i].first != p[i-1].first || p[i].second != p[i-1].second){
      if(p[i].second < 10){
	if(cou==1){
	  cout << " ";
	}
	cou=1;
	cout << p[i].first << ":0" << p[i].second;
      }
      else {
	if(cou==1){
	  cout << " ";
	}
	cou=1;
	cout << p[i].first << ":" << p[i].second;
      }
    }
    
  }
  cout << endl;
}

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

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

    int ans = 0;
    rep(i, 4) {
        if (s[i] == '+')
            ans++;
        else
            ans--;
    }

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


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

class Node():
    def __init__(self):
        self.is_leaf = False
        self.val = -1
        self.childs = []
        self.child_num = 0
        self.parent = None

    def win(self):
        if self.is_leaf:
            return self.val // 2 + 1
        tmp = []
        for c in self.childs:
            tmp.append(c.win())
        tmp = sorted(tmp)
        ret = 0
        for i in range(self.child_num//2 + 1):
            ret += tmp[i]
        return ret

def main():
    n = int(input())
    questions = [input().strip() for i in range(n)]

    for q in questions:
        root = Node()
        now = root
        i = 0
        while i < len(q):
            if q[i] == "[":
                tmp = Node()
                tmp.parent = now
                now.childs.append(tmp)
                now.child_num += 1
                now = tmp
                i += 1
            elif q[i] == "]":
                now = now.parent
                i += 1
            else:
                j = i
                while q[j+1] in "0123456789":
                    j += 1
                now.is_leaf = True
                now.val = int(q[i:j+1])
                i = j+1
        print(root.win())

if __name__ == "__main__":
    main()



Measured memory_bytes: 9720
#include<cstdio>
#include<cstring>
#define M 400004
#define N 100002
int S,T,a[N],b[M],c[M],e[N],f[N],g[N],h[N],l,n,o[N],p[N],q[N],r,t,x;bool d[M];
inline void add(int u,int v){b[++t]=a[u],c[a[u]=t]=v,d[t]=true,b[++t]=a[v],c[a[v]=t]=u;}
inline bool bfs()
{
    for(memset(h+1,-1,T<<2),q[l=0]=S,r=1;l<r;)for(int u=q[l++],i=a[u];i;i=b[i])if(d[i]&&h[c[i]]<0)h[q[r++]=c[i]]=h[u]+1;
    return h[T]>=0;
}
bool dfs(int u)
{
    if(u==T)return true;
    for(int&i=e[u];i;i=b[i])if(d[i]&&h[c[i]]==h[u]+1&&dfs(c[i]))return d[i]=false,d[i^1]=true;
    return false;
}
int i,j;
int main()
{
    scanf("%d",&n),t=1,x=n;
    for(i=0;i<n;i++)scanf("%d",o+i);
    for(i=0;i<n;i++)scanf("%d",p+i);
    for(i=0;i<n;i++)if(o[i]!=i&&!f[i])for(j=i,T++;!f[j];j=o[j])f[j]=T;
    for(i=0;i<n;i++)if(p[i]!=i&&!g[i])for(j=i,T++;!g[j];j=p[j])g[j]=T;
    for(i=0,T++;i<n;i++)
    if(o[i]==i&&p[i]==i)x--;
    else if(o[i]==i)add(g[i],T);
    else if(p[i]==i)add(S,f[i]);
    else if(o[i]!=p[i])add(g[i],f[i]);
    else add(f[i],g[i]),add(g[i],f[i]);
    while(bfs())for(memcpy(e,a,T+1<<2);dfs(S);)x--;
    return 0&printf("%d\n",x);
}

Measured memory_bytes: 7168
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = n;i >= m;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define ALL(n) n.begin(),n.end()

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

	cout << a + b / 2 << endl;
}

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

void ReadFirstInput(int *snukesNumber, int *candyTypes)
{
    //printf("Enter the number of Snukes and SnackTypes: \n");
    scanf("%d %d", snukesNumber, candyTypes);
}

void CountTricks(int snukesArray[100], int *snukesNumber)
{
    int counter = 0;
    
    for(int i = 0; i < *snukesNumber; i++)
    {
        if(snukesArray[i] == 0)
        {
            counter++;
        }
    }
    printf("%d \n", counter);
}

void CreateArray(int *snukesNumber, int *candyTypes)
{
    int dArray[250], aArray[250][250], snukesArray[100];
    
    for(int i = 0; i < *candyTypes; i++)
    {
        scanf("%d\n", &dArray[i]);
        for(int j = 0; j < dArray[i]; j++)
        {
            scanf("%d", &aArray[i][j]);
            int snukesWithSnacks = aArray[i][j];
            snukesArray[snukesWithSnacks - 1] = 1;
        }
    }
    
    CountTricks(snukesArray, snukesNumber);
}

int main(int argc, const char * argv[])
{
    int *snukesNumber = malloc(3 * sizeof(int));
    int *candyTypes = malloc(3 * sizeof(int));
    
    ReadFirstInput(snukesNumber, candyTypes);
    CreateArray(snukesNumber, candyTypes);
    
    return 0;
}


Measured memory_bytes: 1808
#include <stdio.h>

int n,A[100][100];

int main(){
  int i,j,k,c,u,v,mv,d[100],cnt[100],U,V;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      A[i][j]=(1<<21);
    }
  }

  for(i=0;i<n;i++){
    scanf("%d%d",&U,&k);
    for(j=0;j<k;j++){
      scanf("%d%d",&V,&c);
      A[U][V]=c;
    }
  }

  for(i=0;i<n;i++){
    d[i]=(1<<21);
    cnt[i]=0;
  }

  d[0]=0;
  cnt[0]=1;
  while(1){
    mv=(1<<21);
    u=-1;
    for(i=0;i<n;i++){
      if(mv>d[i]&&cnt[i]!=2){
	u=i;
	mv=d[i];
      }
    }
    if(u==-1){
      break;
    }
    cnt[u]=2;
    for(v=0;v<n;v++){
      if(cnt[v]!=2&&A[u][v]!=(1<<21)){
	if(d[v]>d[u]+A[u][v]){
	  d[v]=d[u]+A[u][v];
	  cnt[v]=1;
	}
      }
    }
  }

  for(i=0;i<n;i++){
    printf("%d %d\n",i,d[i]==(1<<21)?-1:d[i]);
  }

  return 0;
}


Measured memory_bytes: 2036
#include<stdio.h>
int main(void)
{
	int a, b, c;
	scanf("%d%d", &a, &b);
	if (a <= b) {
		for (c = 1; c <= b; c++) {
			printf("%d", a);
		}
	}
	else {
		for (c = 1; c <= a; c++) {
			printf("%d", b);
		}
	}
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


int main(){
    int N; cin >> N;
    vector<int> A(N);
    rep(i,N) cin >> A[i];
    vector<int> cnt(N+1);
    rep(i,N) cnt[A[i]]++;
    ll ans = 0;
    repr(i,1,N+1){
        ans += (ll)cnt[i]*(cnt[i]-1)/2;
    }
    rep(i,N){
        cout << ans - cnt[A[i]]+1 << endl;
    }

}

Measured memory_bytes: 4096
//https://atcoder.jp/contests/abc100/tasks/abc100_d
//D - Patisserie ABC
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
template<class T>bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1; } return 0;}
template<class T>bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1; } return 0;}
int main() {
#if LOCAL&01
    std::ifstream in("./test/sample-1.in");
    //std::ifstream in("./input.txt");
    std::cin.rdbuf(in.rdbuf());
#else
    cin.tie(0);
    ios::sync_with_stdio(false);
#endif
    ll N,M; cin>>N>>M;
    struct Data{
        Data()=default;
		Data(ll ix, ll iy, ll iz) : val{ix,iy,iz} {}
		std::array<ll,3> val;
        std::array<ll,3> work;
        ll sum() const {
            return (work[0]+work[1]+work[2]);
        }
	};
    vector<Data> xyzn;
    FOR(i,0,N){
        ll x,y,z; cin>>x>>y>>z;
        xyzn.emplace_back(x,y,z);
    }
    ll mask_max=1<<3;
    ll ans=0;
    FOR(mask,0,mask_max){
        ll flag[3]={};
        FOR(i,0,3){
            flag[i] = (mask&(1LL<<i))?-1:1;
        }
        for(auto&& d:xyzn){
            FOR(i,0,3){
                d.work[i] = d.val[i]*flag[i];
            }
        }
        sort(xyzn.begin(),xyzn.end(), [](const auto& a,const auto& b){ return a.sum()>b.sum(); });
        ll sumv=0;
        FOR(i,0,M){
            sumv += xyzn.at(i).sum();
        }
        ans = max(ans,sumv);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size() 

ll power(ll x,ll y,ll p) 
{ 
    ll res = 1;      
    x = x % p;  
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; 
        x = (x*x) % p;   
    } 
    return res; 
} 

int main()
{
    ios_base::sync_with_stdio(false);
	ll n,i,k,x,y,t,m;

	cin >> n;

	double j=(double)n/3.00;
	printf("%.10lf\n",j*j*j);
}

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

//#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int K;
	cin >> K;
	int A, B;
	cin >> A >> B;

	bool ok = false;
	rep(i, A, B + 1)
	{
		if (i%K == 0)ok = true;
	}

	if (ok)
	{
		cout << "OK" << endl;
	}
	else
	{
		cout << "NG" << endl;
	}

	return 0;
}


Measured memory_bytes: 3648
using System;

public class Rectangle
{
    //????????¢?????¢????????¨?????????????±???????
    static void Main(string[] args)
    {
        /*---??£?¨???¨---*/
        int high;
        int side;
        string[] rectangle;
        /*---??£?¨???¨---*/

        /*???????????????????????§????????????*/
        rectangle = Console.ReadLine().Split(' ');
        high = int.Parse(rectangle[0]);
        side = int.Parse(rectangle[1]);

        /*????????¢?????¢????????¨?????????????????§??????*/
        Console.WriteLine("{0} {1}",high*side ,2*high + 2*side);
    }
}

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

using namespace std;
int main()
{
    char s[100];
    int a[100];
    scanf("%s",s);
    int ans,t;
    ans=0;
    t=strlen(s)-1;
    for(int i=0;i<=t;i++)
        ans+=s[i]-'0',a[i]=ans;
    for(int i=0;i<t;i++)
        a[i]+=(t-i)*9-1;
    sort(a,a+t+1);
    if(s[0]=='1') printf("%d\n",max(ans,t*9));
    else printf("%d\n",a[t]);
}


Measured memory_bytes: 256
N,T=map(int,input().split())
t=list(map(int,input().split()))
a=[]
s=t[0]
e=s+T
for i in range(N):
  if e<t[i]:
    a.append(e-s)
    s=t[i]
    e=s+T
  else:
    e=t[i]+T
a.append(e-s)
print(sum(a))

Measured memory_bytes: 26708
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int k = sc.nextInt();


        int count = 0;
        int res = 1;
        for (int i = 100; i > 0; i--) {
            if (a % i == 0 && b % i == 0) {
                count++;
                if (count == k) {
                    res = i;
                }
            }
        }

        System.out.println(res);
    }

}


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

int main() {
    int n, m;
    cin >> n >> m;
    int l_max = 0, r_min = n + 1;
    for (int i = 0; i < m; i++) {
        int l, r;
        cin >> l >> r;
        l_max = max(l, l_max);
        r_min = min(r, r_min);
    }
    cout << max(r_min - l_max + 1, 0) << endl;
    return 0;
}


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

int main(){
    int N; cin>>N;
    vector<int> a(N+1);
    
    for(int i=1; i<=N; i++){
        cin >> a[i];
    }
    
    int ans=0;
    for(int i=1; i<=N; i++){
        if(i%2==1 && a[i]%2==1){
            ans++;
        }
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 3604
import java.util.*;

public class Main {

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

		double third = L / 3.0;
		double ans = Math.pow(third, 3);
		System.out.println(String.format("%.12f", ans));
	}
}


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

int main() {
    string s;
    cin >> s;
    if( s == "A"){
        cout << "A" << endl;
    }
    else if(s == "B" ){
        cout << "A" << endl;
    }
    else if(s == "C" ){
        cout << "A" << endl;
    }  
    else if(s == "D" ){
        cout << "A" << endl;
    }     
    else if(s == "E" ){
        cout << "A" << endl;
    }   
    else if(s == "F" ){
        cout << "A" << endl;
    }   
    else if(s == "G" ){
        cout << "A" << endl;
    }   
    else if(s == "H" ){
        cout << "A" << endl;
    }   
    else if(s == "I" ){
        cout << "A" << endl;
    }   
    else if(s == "J" ){
        cout << "A" << endl;
    }   
    else if(s == "K" ){
        cout << "A" << endl;
    }   
    else if(s == "L" ){
        cout << "A" << endl;
    }   
    else if(s == "M" ){
        cout << "A" << endl;
    }   
    else if(s == "N" ){
        cout << "A" << endl;
    }   
    else if(s == "O" ){
        cout << "A" << endl;
    }   
    else if(s == "P" ){
        cout << "A" << endl;
    }   
    else if(s == "Q" ){
        cout << "A" << endl;
    }   
    else if(s == "R" ){
        cout << "A" << endl;
    }   
    else if(s == "S" ){
        cout << "A" << endl;
    }   
    else if(s == "T" ){
        cout << "A" << endl;
    }   
    else if(s == "U" ){
        cout << "A" << endl;
    }
    else if(s == "V" ){
        cout << "A" << endl;
    }   
    else if(s == "W" ){
        cout << "A" << endl;
    }   
    else if(s == "X" ){
        cout << "A" << endl;
    }   
    else if(s == "Y" ){
        cout << "A" << endl;
    }   
    else if(s == "Z" ){
        cout << "A" << endl;
    }   
    else{
        cout << "a" << endl;
    }
}

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

int main() {
	int N;
	cin >> N;
	vector<vector<int>> p(N, vector<int>(3));
	for (vector<int>& i : p) {
		for (int& j : i) cin >> j;
		sort(i.begin(), i.end());
	}
	sort(p.begin(), p.end());
	p.erase(unique(p.begin(), p.end()), p.end());
	cout << N - p.size() << endl;
}


Measured memory_bytes: 3200
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(), v.end()
#define mem(arr) memset(arr, 0, sizeof(arr))
#define ff first
#define ss second
#define int long long int
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int N = 1e6 + 1;
vector<int> g[N];
vector<int> vis(N);
void solve(){
    vector<string> v = {"MAR", "MAC", "MAH", "ARC", "ACH", "ARH", "RCH", "RMH", "MRC", "MHC"};
    vector<int> cnt(26);
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        string s;
        cin >> s;
        cnt[s[0] - 'A']++;
    }
    int ans = 0;
    for(auto &i : v){
        ans += (cnt[i[0] - 'A'] * cnt[i[1] - 'A'] * cnt[i[2] - 'A']);
    }
    cout << ans << '\n';
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc = 1;
    while(tc--){
        solve();
    }
}

Measured memory_bytes: 34584
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            String a = in.next();
            String b = in.next();

            for (int i = 0; i < a.length(); i++) {
                if (b.equals(a.substring(i, a.length()) + a.substring(0, i))) {
                    out.println("Yes");
                    return;
                }
            }
            out.println("No");
        }

    }

    static class FastScanner {
        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int bufPointer;
        private int bufLength;

        public FastScanner(InputStream in) {
            this.in = in;
        }

        private int readByte() {
            if (bufPointer >= bufLength) {
                if (bufLength == -1)
                    throw new InputMismatchException();

                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (bufLength <= 0)
                    return -1;
            }
            return buffer[bufPointer++];
        }

        private static boolean isPrintableChar(int c) {
            return c >= 33 && c <= 126;
        }

        public String next() {
            StringBuilder sb = new StringBuilder();

            int b = readByte();
            while (!isPrintableChar(b))
                b = readByte();

            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }

            return sb.toString();
        }

    }
}



Measured memory_bytes: 23380
#include<bits/stdc++.h>
using namespace std;
const int  MAX = 1e5;

int main(){
    string S,T;
    cin >> S >> T;
    map<char,char> ma,ima;
    bool ok = true;
    for(int i=0;i<S.size();i++){
        char s=S[i],t=T[i];
        if(ma.count(s)){
            if(ma[s] != t){
                ok = false;
            }
        }
        if(ima.count(t)){
            if(ima[t] != s){
                ok = false;
            }
        }
        ma[s] = t;
        ima[t] = s;
    }
    string ans = "No";
    if(ok) ans = "Yes";
    cout << ans << endl;
}


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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
    return string(1, val);
}

int main(){
    char c; cin >> c;

    if(c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
        cout << "vowel" << endl;
    } else {
        cout << "consonant" << endl;
    }
}

Measured memory_bytes: 768
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define sz size()
using namespace std;
typedef vector<int> vi;
typedef long long ll;

int n;
vi x,y;
int l[110],t[110],r[110],b[110];
ll rec[110][110];
const int dy[] = {-1,0,1,0}, dx[] = {0,1,0,-1};

void dfs(int py, int px, ll col){
  if(rec[py][px] != col)return;
  rec[py][px] = -1;

  rep(i,4){
    int ny = py + dy[i], nx = px + dx[i];
    if(ny<0 || nx<0 || ny>=(int)y.sz || nx>=(int)x.sz)continue;
    dfs(ny,nx,col);
  }
}

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

  while(cin >> n,n){
    x.clear(); y.clear();
    x.pb(-1); y.pb(-1);
    rep(i,n){
      cin >> l[i] >> t[i] >> r[i] >> b[i];
      x.pb(l[i]); x.pb(r[i]);
      y.pb(t[i]); y.pb(b[i]);
    }

    sort(all(x));
    x.erase(unique(all(x)),x.end());
    sort(all(y));
    y.erase(unique(all(y)),y.end());

    memset(rec,0,sizeof(rec));

    rep(i,n){
      l[i] = lower_bound(all(x),l[i]) - x.begin();
      r[i] = lower_bound(all(x),r[i]) - x.begin();
      t[i] = lower_bound(all(y),t[i]) - y.begin();
      b[i] = lower_bound(all(y),b[i]) - y.begin();
      for(int j=b[i];j<t[i];j++){
	for(int k=l[i];k<r[i];k++)rec[j][k] |= 1LL<<i;
      }
    }

    int ans = 0;
    rep(i,y.sz)rep(j,x.sz){
      if(rec[i][j]>=0)dfs(i,j,rec[i][j]), ans++;
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   

typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> isPair;
using vvll = vector< vector<ll> >;
using vll = vector<ll> ;

const ll inf=1e10;
const ll maxs =1e5+5;
const ll mod = 1e9+7;

#define mp make_pair
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define line cout<<endl;
#define fr(i,b) for(ll i=1;i<=b;++i)
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end()) 
#define cpresent(s,x) (find(all(s),x) != s.end()) 
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++) 
#define fastio(); ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

ll n,m,ans;
vll Graph[maxs];
bool visited[maxs];
ll dp[maxs];

void addEdge()
{
    ll s,d;cin>>s>>d;
    Graph[s].pb(d);
}

void dfs(ll s)
{
    visited[s]=true;
    for(auto i:Graph[s])
    {
        if(!visited[i])
            dfs(i);
        dp[s] = max(dp[s], 1 + dp[i]);    
    }        
}


void solve()
{
    memset(dp,0,sizeof dp);
    memset(visited,false,sizeof visited);
    for(ll i=1;i<=n;i++)
        if(!visited[i])
            dfs(i);
            
    ans = -1;
    for(ll i=1;i<=n;i++)
        ans = max(ans,dp[i]);
    cout<<ans;    
}

int main()
{
    fastio();
     ll t=1;
     // cin>>t;
     while(t--){
        cin>>n>>m;
        while(m--)
            addEdge();
        solve();        
     }
    return 0;
}



Measured memory_bytes: 8704
#include <iostream>

int main()
{
    while(1) {
        int H,W;
        std::cin >> H >> W;

        if (H == 0 && W == 0){
            break;
            }

        for (int j = 0; j < H; j++) {
            for (int i = 0; i < W; i++) {

                if (j == 0 || j == H - 1) {
                    std::cout << "#";
                    if (i == W - 1) {
                        std::cout << std::endl;
                    }
                } else {
                    if (i == 0 || i == W - 1) {
                        std::cout << "#";
                    } else {
                        std::cout << ".";
                    }

                    if (i == W - 1) {
                        std::cout << std::endl;
                    }
                }
            }


        }

        std::cout << std::endl;


    }

    return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;

struct Dice{
  int s[6];
  void roll(char c){
    int b;
    if(c=='E'){
      b=s[0];
      s[0]=s[3];
      s[3]=s[5];
      s[5]=s[2];
      s[2]=b;
    }
    if(c=='W'){
      b=s[0];
      s[0]=s[2];
      s[2]=s[5];
      s[5]=s[3];
      s[3]=b;
    }
    if(c=='N'){
      b=s[0];
      s[0]=s[1];
      s[1]=s[5];
      s[5]=s[4];
      s[4]=b;
    }
    if(c=='S'){
      b=s[0];
      s[0]=s[4];
      s[4]=s[5];
      s[5]=s[1];
      s[1]=b;
    }
  }
  int top() {
    return s[0];
  }
};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    Dice dice;
    rep(i,6) cin>>dice.s[i];
    string o; cin>>o;
    for(int i=0; i<o.length(); i++){
        dice.roll(o[i]);
    }
    cout<<dice.top()<<endl;
    return 0;
}



Measured memory_bytes: 3244
import math
import sys
pin=sys.stdin.readline

def main():
  N,X,M=map(int,pin().split())
  A=X
  d=[X]
  su=X
  for i in range(N-1):
    A=(A**2)%M
    if A in d:
      t=d.index(A)
      T=N-i-1
      d=d[t:]
      l=len(d)
      su+=sum(d)*(T//l)
      T=T%(T//l)
      su+=sum(d[:T])
      print(su)
      return
    d.append(A)
    su+=A
  print(su)
  return
main()

Measured memory_bytes: 67640
#include<bits/stdc++.h> 
typedef int LL;
typedef long double DL;
const LL maxn=1e6+9;
//const DL mod=998244353;
LL Read(){
	LL x(0),f(1); char c=getchar();
	while(c<'0' || c>'9'){
		if(c=='-') f=-1; c=getchar();
	}
	while(c>='0' && c<='9'){
		x=(x<<3)+(x<<1)+c-'0'; c=getchar();
	}return x*f;
}
LL N;
int main() {
	N=Read();
	for(LL i=1;i<=9;++i) for(LL j=1;j<=9;++j) if(i*j==N){
		puts("Yes"); return 0;
	}
	puts("No");
	return 0;
}

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

using namespace std;

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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

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

#define MP make_pair
#define EACH(i,c) for(auto i: c)
#define SORT(c) sort((c).begin(),(c).end())

#define ALL(a)  (a).begin(),(a).end()

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int N, K;
	cin >> N >> K;

	cout << N - K + 1 << endl;

	return 0;
}


Measured memory_bytes: 256