akhauriyash/Code-Regression huggingface dataset:
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.format.ResolverStyle;
import java.util.Scanner;

public class Main {
	final static String YYMM = "YYMM";
	final static String MMYY = "MMYY";
	final static String AMBIGUOUS = "AMBIGUOUS";
	final static String NA = "NA";
	final static String patern = "uuMMdd";
	final static String day = "01";
	public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		sc.close();
		boolean yymm = true, mmyy = true;
		try {
			DateTimeFormatter.ofPattern(patern)
			.withResolverStyle(ResolverStyle.STRICT)
			.parse(S + day, LocalDate::from);
		} catch (Exception e) {
			yymm = false;
		}
		try {
			String y = S.substring(2, 4);
			String m = S.substring(0, 2);
			DateTimeFormatter.ofPattern(patern)
			.withResolverStyle(ResolverStyle.STRICT)
			.parse(y + m + day, LocalDate::from);
		} catch (Exception e) {
			mmyy = false;
		}
		if(yymm && mmyy) System.out.println(AMBIGUOUS);
		else if(yymm) System.out.println(YYMM);
		else if(mmyy) System.out.println(MMYY);
		else System.out.println(NA);
	}
}

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

using namespace std;

#define DUMP(x) std::cout << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++ i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define pb push_back

template<typename T> T DUP(T x, T y) { return (x + y - 1) / y; };
template <typename A, size_t N, typename T> inline void arrayFill(A(&array)[N], const T& val) { std::fill((T*)array, (T*)(array + N), val); }
template <class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template <class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using pll = pair<ll, ll>;
using setint = unordered_set<int32_t>;
using setstr = unordered_set<string>;
using qint = queue<int32_t>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main() {
    int n;
    cin >> n;
    string s;

    if (n == 0) {
        puts("0");
        return;
    }

    while (n != 0) {
        int r = n % 2;
        if (r == -1)r = 1;
        n = (n - r) / (-2);
        s += (r == 0 ? '0' : '1');
    }

    reverse(ALL(s));

    cout << s << endl;
}
 
int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#include <bitset>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

#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()

using namespace std;

typedef int64_t ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tupiii;
typedef tuple<ll, ll, ll> tuplll;

const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INTMAX = 2147483647;
const ll LLMAX = 9223372036854775807;

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; }
void SWAP(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
void SWAP(int& a, int& b) { a ^= b; b ^= a; a ^= b; }


class C {
	string s;
	int a[4];
public:
	C()
	{
		cin >> s;
		REP(i, 4)
			a[i] = s[i] - '0';
	}
	void solve()
	{
		int mask{ 0 };
		int tmp;
		for (; mask <= 0b111; mask++)
		{
			tmp = a[0];
			for (int bit{ 0 }; bit < 3; bit++)
			{
				if (mask & (1 << bit))
					tmp += a[bit + 1];
				else
					tmp -= a[bit + 1];
			}

			if (tmp == 7)
				break;
		}

		cout << a[0];

		REP(i, 3)
		{
			if (mask & (1 << (i)))
				cout << "+" << a[i + 1];
			else
				cout << "-" << a[i + 1];
		}
		cout << "=7" << endl;

	}
};


int main()
{
	C solution;
	solution.solve();

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#include <queue>

using namespace std;
using llint = long long int;
#define int long long int

vector<int> vadd, vxor;

signed main()
{

  int zero = 0;
  int twe = 0;
  int four = 0;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++)
  {
    int x;
    cin >> x;
    if (x % 4 == 0)
    {
      four++;
    }
    else if (x % 2 == 0)
    {
      twe++;
    }
    else
    {
      zero++;
    }
  }

  int res = four + twe / 2;
  if (n / 2 <= res)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#define INF 2147483647
using namespace std;

int n,q;
int com;
int tree[2111111];

void init();
void update(int i, int x);
int segtree_find(int x, int y, int now, int left, int right);

int main(){

  scanf(" %d %d",&n,&q);

  init();

  for(int i=0;i<q; i++){
    scanf(" %d",&com);

    if(com){
      int x,y;
      scanf(" %d %d",&x,&y);
      printf("%d\n",segtree_find(x, y, 0, 0, n-1));
    } else {
      int x, y;
      scanf(" %d %d",&x,&y);
      update(x, y);
    }
  }

  return 0;
}


void init(){

  int m = n;
  n = 1;
  while(n < m)n = (n<<1);

  fill(tree, tree+n*2, INF);

  return;
}

void update(int i, int x){
  i = i + n - 1;
  tree[i] = x;

  while(i > 0){
    i = (i - 1) / 2;
    tree[i] = min(tree[i * 2 + 1], tree[i * 2 + 2]);
  }

  return;
}

int segtree_find(int x, int y, int now, int left, int right){

  if(right < x || y < left)return INF;


  if(x <= left && right <= y)return tree[now];

  if(now > n * 2)return -1;

  int find_left = segtree_find(x, y, (now * 2 + 1), left, ((right + left) / 2));
  int find_right = segtree_find(x, y, (now * 2 + 2), ((right + left) / 2 + 1), right);

  return min(find_left, find_right);
}

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

struct cube {
  enum Face { Top, Front, Right, Left, Back, Bottom };
  int f[6];
  unordered_map<int, string> mp;
  cube(){}
  /*
            1(Top)
    4(Left) 2(Front) 3(Right) 5(Back)
            6(Bottom)
  */
  cube(vector<int> const& vs){ for(int i=0; i<6; i++) f[i] = vs[i]; }
  cube(vector<string> const& vs) { for(int i=0; i<6; i++) mp[i+1] = vs[i]; }
  void roll_z() { roll(1, 2, 4, 3); }
  void roll_y() { roll(0, 2, 5, 3); }
  void roll_x() { roll(0, 1, 5, 4); }
  void roll(int i, int j, int k, int l) {
    int t = f[i]; f[i] = f[j]; f[j] = f[k]; f[k] = f[l]; f[l] = t;
  }

  void roll(int k) {
    if(k == 0) roll_y();
    if(k == 1) roll_x();
    if(k == 2) for(int i=0; i<3; i++) roll_y();
    if(k == 3) for(int i=0; i<3; i++) roll_x();
  }

  bool roll_top_front(int top, int front) {
    for(int k = 0; k < 6; (k & 1 ? roll_y() : roll_x()), k++)
      for(int i = 0; i < 4; roll_z(), ++i)
        if(top == f[Top] && front == f[Front]) return true;
    return false;
  }

  bool operator == (cube const& rhs) const {
    for(int i=0; i<6; i++)
      if(f[i] != rhs.f[i]) return false;
    return true;
  }

  bool isomorphic(cube rhs) const {
    for(int i=0; i<6; i++) {
      for(int j=0; j<4; j++) {
        if(operator==(rhs)) return true;
        rhs.roll_z();
      }
      if(i % 2 == 0) rhs.roll_y();
      else rhs.roll_x();
    }
    return false;
  }

};

int main() {

  cube c; for(int i=0; i<6; i++) cin >> c.f[i];
  string q; cin >> q;
  string d = "WNES";
  rep(i, q.size()) c.roll(d.find(q[i]));
  cout << c.f[0] << endl;
  
  return 0;
}

Measured memory_bytes: 3176
#include<bits/stdc++.h>
#define ll unsigned long long int
using namespace std;
int main()
{
	ll n,i,a=1,b=1,c=1,ans=0,mod=1e9+7;
	cin>>n;
	for(i=1;i<=n;i++)
	{
	  a=((a*10)+mod)%mod;
	  b=((b*9)+mod)%mod;
	  c=((c*8)+mod)%mod; 	
	}
	ans=(a+c-b-b+5*mod)%mod;
	cout<<ans;
	return 0;
}

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

using namespace std;

typedef long long ll;

double getTime() {
  return clock() / (double) CLOCKS_PER_SEC;
}

void read() {};

template<typename T, typename... Args>
void read(T& a, Args&... args) {
  cin >> a;
  read(args...);
}

void print() {};

template <typename T, typename... Args>
void print(T a, Args... args) {
  cout << a << " \n"[sizeof...(args) == 0];
  print(args...);
}

ll get(ll x, ll y) {
  return (x / y);
}

int main() {
  int n; read(n);
  vector <int> a(n), b(n), c(n);
  for(auto &x : a) read(x);
  for(auto &x : b) read(x);
  for(auto &x : c) read(x);
  sort(a.begin(), a.end());
  sort(c.begin(), c.end());
  ll total = 0;
  for(auto x : b) {
    ll p = lower_bound(a.begin(), a.end(), x) - a.begin();
    ll q = c.end() - upper_bound(c.begin(), c.end(), x);
    total += p * q;
  }
  print(total);
}

Measured memory_bytes: 1408
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define BUGAVOID(x) x
#define rep(...) BUGAVOID(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define sz(c) (int)(c.size())
#define all(c) c.begin(),c.end()
#define ms(a,v) memset(a,v,sizeof(a))
#define mp make_pair
#define write(x) cout<<(x)<<endl
using namespace std; typedef long long ll;
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; }
const int INF = 1 << 28; const ll LINF = 1ll << 60;
const int MAX = 1e5 + 5; const int MOD = 1e9 + 7; const double EPS = 1e-6;
const int dy[4] = { 0,1,0,-1 }; const int dx[4] = { 1,0,-1,0 };
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

int N, M;
int K[35], A[35][35];

int main() {
    cin >> N >> M;
    rep(i, N) {
        cin >> K[i];
        rep(j, K[i]) {
            cin >> A[i][j];
        }
    }

    int ans = 0;
    rep(k, 1, M + 1) {
        bool alllike = true;
        rep(i, N) {
            bool like = false;
            rep(j, K[i]) {
                if (A[i][j] == k) {
                    like = true;
                    break;
                }
            }
            if (not like) {
                alllike = false;
                break;
            }
        }
        if (alllike) {
            ans++;
        }
    }

    write(ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#define MOD 1000000007LL
using namespace std;

int main(){
	int h, w;
	cin >> h >> w;
	int frame[h+2][w+2];
	for(int i = 1; i <= h; i++){
		string s;
		cin >> s;
		for(int j = 1; j <= w; j++){
			frame[i][j] = s[j-1];
		}
	}
	for(int i = 0; i < h+2; i++){
		for(int j = 0; j < w+2; j++){
			if(i == 0 || i == h+1 || j == 0 || j == w+1) cout << '#';
			else cout << (char) frame[i][j];
		}
		cout << endl;
	}
	return 0;
}

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

// Common file
#include <ext/pb_ds/assoc_container.hpp>
// Including tree_order_statistics_node_update
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>



#define pb push_back
#define F first
#define S second
#define rep(i,n) for(int i = 0; i < (n); i++)

using ll = long long;
using ld = long double;
using ul = unsigned long long;
using ii = pair<int, int>;
#define Mosta     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ReadFile            freopen("input.in","r",stdin)
#define WriteFile           freopen("output.txt","w",stdout)
const ll mod7 = 1000000007,mod = 1000000000,OO = 0x3f3f3f3f;
const ld EPS = 1e-7;
double Pi=acos(-1);
const ld rad=Pi/180.0;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
            y = y>>1;
            x = (x*x) % p;
    }
    return res;
}
ll nCr (ll n,ll m)
{
    return(m == 0)?1:n*nCr(n-1,m-1)/m;
}

/*****************************************************/

const int N = 105;
int a[N] , n , ans = 0;

int main()
{
    cin >> n;

    for(int i = 1; i <= n; ++i){
        cin >> a[i];
        if(i%2 && a[i]%2)
            ++ans;
    }

    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 3612
#include <cstring>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

unordered_map<ll, ll> mp;

bool is_pow_6(ll n) {
    while (n > 1) {
        if (n % 6 != 0) return false;
        n /= 6;
    }
    return true;
};

bool is_pow_9(ll n) {
    while (n > 1) {
        if (n % 9 != 0) return false;
        n /= 9;
    }
    return true;
};

int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
        mp = unordered_map<ll, ll>();
#pragma clang diagnostic pop
#endif
        ll n;
        cin >> n;
        ll dp[n + 1];
        rep(i, n + 1) dp[i] = inf;
        dp[0] = 0;
        repone(i, n) {
            dp[i] = dp[i - 1] + 1;
            for (int j = 6; j <= i; j *= 6) {
                dp[i] = min(dp[i], dp[i - j] + 1);
            }
            for (int j = 9; j <= i; j *= 9) {
                dp[i] = min(dp[i], dp[i - j] + 1);
            }
        }

        cout << dp[n] << endl;


#ifdef MY_DEBUG
    }
#endif
    return 0;
}

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

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

  int a[2][n];
  for(int i = 0; i < 2; i++){
    for(int j = 0; j < n; j++){
      cin >> a[i][j];
    }
  }

  for(int i = 1; i < n; i++){
    a[0][i] += a[0][i-1]; 
  }

  for(int i = n-2; i >= 0; i--){
    a[1][i] += a[1][i+1]; 
  }

  vector<int> lists(n, 0);
  int ans = 0;
  for(int i = 0; i < n; i++){
    lists[i] = a[0][i] + a[1][i];
    ans = max(ans, lists[i]);
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
from collections import deque
N = int(input())
edge = [[] for _ in range(N + 1)]
for _ in range(N - 1):
    x, y = map(int, input().split())
    edge[x].append(y)
    edge[y].append(x)

mod = 10 ** 9 + 7

parent = [-1] * (N + 1)
node = deque([1])
ts = []
while node:
    s = node.popleft()
    ts.append(s)
    for t in edge[s]:
        if t == parent[s]:
            continue
        parent[t] = s
        node.append(t)

black = [1] * (N + 1)
white = [1] * (N + 1)

while ts:
    s = ts.pop()
    b = 1
    w = 1
    for t in edge[s]:
        if parent[s] == t:
            continue
        b = b * white[t] % mod
        w = w * (white[t] + black[t]) % mod
    black[s] = b
    white[s] = w

print((black[1] + white[1]) % mod)

Measured memory_bytes: 30248
#include<iostream>

int main()
{
  int a, b;
  std::cin >> a >> b;
  if(a < b)std::cout << "a < b";
  else if(a > b)std::cout << "a > b";
  else std::cout << "a == b";
  std::cout << std::endl;
  return 0;
}



Measured memory_bytes: 3096
N,H = [ int(it) for it in input().split() ]
li = [ [int(it) for it in input().split() ] for i in range(N) ]

go = []
for a,b in li:
  go.append( (a,False) )
  go.append( (b,True) )
go.sort( key = lambda x:x[0] )

go.reverse()

s = 0
h = H
for c,flag in go:
  if (h<=0):
    break
  if (flag):
    h -= c
    s += 1
  else:
    kai = (h+c-1)//c
    h -= c*kai
    s += kai
print ( s )
    
  
  

Measured memory_bytes: 83032
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n,k,x,y;
    cin>>n>>k>>x>>y;
    
    if(k>n) k=n;
    ll ans=k*x+(n-k)*y;
    cout1(ans)
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
double a,b,c,d,e,f;
double x,y;
while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f) != EOF){
x = (e*c-b*f) / (e*a-b*d);
y = (c*d-a*f) / (b*d-e*a);
if(x == -0.0) x = 0;
if(y == -0.0) y = 0;
printf("%.3f %.3f\n",x,y);
}
return 0;
}

Measured memory_bytes: 652
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

void solve(){
    ll n,x,t;
    cin >> n >> x >> t;
    print(t*((n+x-1)/x));
    return;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    solve();
    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define PN cout << endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (n-1); i >= (int)(m); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - (a)) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - (a)) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

/*
ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
*/

/*
vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}
*/

/*
ll ncr[100][100];
ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

ll npr[100][100]={};
ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

ll nHr(int n,int r){ret nCr(n+r-1,r);}
*/

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



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

    rep(i,0,sz(s)){
	if(s[i] != t[i]){
	    No;
	    ret 0;
	}
    }
    Yes;
    return  0;
}


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

mod = 10**9+7
def nCr(fact, inv, n, r):
    return fact[n] * inv[r] * inv[n-r] % mod

def main():
    H,W,A,B = map(int,input().split())
    fact = [1]
    for i in range(1, H+W+1):
        fact.append(fact[i-1] * i % mod)
    
    inv = [0] * (H+W+1)
    inv[H+W] = pow(fact[H+W], mod-2, mod) # フェルマーの小定理より a**(mod-2)はaの逆元
    for i in range(H+W, 0, -1):
        inv[i-1] = inv[i] * i % mod

    ans = 0
    for i in range(W-B):
        n0 = H-A-1+B+i
        r0 = H-A-1
        n1 = A-1+W-B-1-i
        r1 = A-1
        ans += nCr(fact, inv, n0, r0) * nCr(fact, inv, n1, r1) % mod
    print(ans%mod)

if __name__ == '__main__':
    main()


Measured memory_bytes: 18860
#include <stdio.h>

#include <algorithm>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>

using namespace std;
typedef long long llong;

void AABCSwap(std::istream& in, std::ostream& out) {
  int a, b, c;
  in >> a >> b >> c;
  out << c << " " << a << " " << b << endl;
}

int main(int argc, char** argv) { AABCSwap(cin, cout); return 0; }


Measured memory_bytes: 888
#include <bits/stdc++.h>    
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//using namespace __gnu_pbds; 
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb  push_back
#define show(x) cout<<(#x)<<" : "<<x<<endl;
#define ll  long long
#define ld  long double
#define fill(a,val) memset(a,val,sizeof(a))
#define mp  make_pair
#define ff  first
#define ss  second
#define pii pair<ll,ll>
#define sq(x) ((x)*(x))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define endl "\n"
#define int long long 
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
const ll MOD     = 1000*1000*1000+7;
const ll INF     = 1ll*1000*1000*1000*1000*1000*1000 + 7;
const ll MOD2    = 998244353;
const ll N       = 1000 * 100 + 10;
const ll N2      = 70;
const ld PI  = 3.141592653589793;
//template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);} 
ll power(ll x,ll y,ll p = LLONG_MAX ){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
ll lcm(ll a , ll b){return (a*b)/gcd(a,b);}
int calc(int n)
{
    int res = n*(n-1);
    res/=2;
    return res;
}
signed main()
{
    fastio();
    //cout<<fixed<<setprecision(20);
    //CHECK for LONG LONG and LONG DOUBLE
    /*comment for all except cc/cf    
    #ifndef ONLINE_JUDGE    
           freopen("input.txt","r",stdin);
           freopen("output.txt","w",stdout);
    #endif//*/
    int n;
    cin>>n;
    int a[n];
    for (int i = 0; i < n; ++i)
    {
        cin>>a[i];
    }
    map<int,int> m;
    for (int i = 0; i < n; ++i)
    {
        m[a[i]]++;
    }
    int ans(0);
    for(auto x : m)
        ans+=calc(x.ss);

    for (int i = 0; i < n; ++i)
    {
        ans-=calc(m[a[i]]);
        m[a[i]]--;
        ans+=calc(m[a[i]]);
        cout<<ans<<endl;
        ans-=calc(m[a[i]]);
        m[a[i]]++;
        ans+=calc(m[a[i]]);
    }

    printclock;
    return 0;
}


Measured memory_bytes: 11136
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <utility>
#include <tuple>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;
using P = pair<int, int>;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }
template<typename T> void print(T a) { cout << a << endl; }
template<typename T, typename... Ts> void print(T a, Ts... ts) { cout << a << ' '; print(ts...); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
// clang-format on

class UnionFind {
public:
    vector<int> par;
    int N;
    UnionFind(int n) {
        par.resize(n, -1);
        N = n;
    }
    int Find(int n) {
        return par[n] < 0 ? n : par[n] = Find(par[n]);
    }
    bool Union(int x, int y) {
        x = Find(x);
        y = Find(y);
        if (x == y) return false;
        if (-par[x] > -par[y]) swap(x, y);
        par[y] += par[x];
        par[x] = y;
        N--;
        return true;
    }
    bool Same(int x, int y) {
        return Find(x) == Find(y);
    }
    int size(int x) {
        return -par[Find(x)];
    }
    int size() {
        return N;
    }
};

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin, n;
    vector<int> x(n + 1, 0);
    vector<int> xx(n);
    vector<int> mapping(n + 1, -1);
    REP(i, 0, n) {
        int a, b;
        cin, a, b;
        x[b] = a;
        xx[a - 1] = b;
        mapping[b] = i;
    }
    vector<int> lis;
    REP(i, 0, n) {
        if (lis.size() == 0 || lis.back() > xx[i]) {
            lis.push_back(xx[i]);
        }
    }
    int sz = lis.size();
    vector<bool> used(n + 1, false);
    REP(i, 0, sz) {
        used[lis[i]] = true;
        dump(lis[i]);
    }
    vector<int> rest;
    for (int t = n; t > 0; t--) {
        if (!used[t]) {
            rest.push_back(t);
        }
    }
    UnionFind uf(n);
    int thre = -1;
    int r = 0;
    REP(i, 0, sz) {
        int v = lis[i];
        if (i && x[v] < thre) {
            uf.Union(mapping[v], mapping[lis[i - 1]]);
            dump("merge", i, thre, mapping[v]);
        }
        while (r < rest.size() && v < rest[r]) {
            uf.Union(mapping[v], mapping[rest[r]]);
            chmax(thre, x[rest[r]]);
            r++;
            dump("call", r);
        }
    }
    REP(i, 0, n) {
        print(uf.size(i));
    }

    return 0;
}


Measured memory_bytes: 7356
#include<iostream>
using namespace std;
main(){
	int a[4],b[4];
	while(cin>>a[0]){
		int hit=0,blow=0;
		for(int i=1;i<4;++i)cin>>a[i];
		for(int i=0;i<4;++i)cin>>b[i];
		for(int i=0;i<4;++i){
			if(a[i]==b[i])++hit;
			for(int j=0;j<4;++j){
				if(a[i]==b[j] && i!=j)++blow;
			}
		}
		cout<<hit<<" "<<blow<<endl;
	}
}

Measured memory_bytes: 1156
#include<stdio.h>
#define N 100

int main(){
  int i,j,n,u,k,U,Adj[N][N];

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

Measured memory_bytes: 644
#![allow(non_snake_case,unused_imports,dead_code)]
use std::io::Read;
use std::cmp::max;
use std::cmp::min;
use std::str::FromStr;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::BinaryHeap;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut buf_it = buf.split_whitespace();

    let S = buf_it.next().unwrap();
    
    println!("{} {}",&S[..4],&S[4..]);
}

Measured memory_bytes: 4352
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;

const int V = 100005;
vector<int> to[V * 2];
VI cnt;
bool vis[V * 2];

void dfs(int v) {
	if (vis[v])return;
	vis[v] = true;
	cnt[v / V]++;
	for (int u : to[v])dfs(u);
}



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

	int N;
	int ans = 0;
	cin >> N;
	REP(i, N) {
		int x, y;
		cin >> x >> y;
		y += V;
		to[x].push_back(y);
		to[y].push_back(x);
	}
	REP(i, V * 2) {
		if (vis[i])continue;
		cnt = VI(2);
		dfs(i);
		ans += cnt[0] * cnt[1];
	}
	ans -= N;
	cout << ans << endl;



	return 0;
}



Measured memory_bytes: 10240
def combinations(n, r):
    res = 1
    for i in range(n - r + 1, n + 1):
        res *= i
    for i in range(2, r + 1):
        res //= i
    return res

N, A, B = map(int,input().split())
v = list(map(int,input().split()))

v.sort(reverse=True)
ans1 = sum(v[0:A]) / A

num1 = v[0:A].count(v[A - 1])
num2 = v[A:N].count(v[A - 1])

ans2 = 0
if v[0] == v[A]:
    for i in range(A, N):
        if v[i] == v[A]:
            idx = i + 1
    for i in range(A, min(B, idx) + 1):
        ans2 += combinations(num1 + num2, i)
else:
    ans2 = combinations(num1 + num2, num1)

print(ans1)
print(ans2)

Measured memory_bytes: 3064
/*	final2
    kumasaka.m.aa
    Masayuki Kumasaka */

#include<stdio.h>
#include<string.h>
#define SIZE 3010

// 2つの文字列の最長部分列(LCS)を求めて出力
void solve(char *s1,char *s2,int len1,int len2){
    int lcs[SIZE][SIZE] = {},i,j,cnt;
    char answer[SIZE];
    // lcs[i][j] := s1のi文字目とs2のj文字目までのLCSの長さ
    // answer := LCS

    // 更新
    for(i = 0;i < len1-1;i ++){
        for(j = 0;j < len2-1;j ++){
            // 同じ文字ならば+1
            if(s1[i]==s2[j]) lcs[i+1][j+1] = lcs[i][j] + 1;
            else {
                // 異るならば大きい方から遷移
                if(lcs[i+1][j] < lcs[i][j+1]) lcs[i+1][j+1] = lcs[i][j+1];
                else lcs[i+1][j+1] = lcs[i+1][j];
            }
        }
    }
    cnt = lcs[len1-1][len2-1];
    i = len1-1;
    j = len2-1;
    while(cnt){
        if(lcs[i][j]!=lcs[i-1][j] && lcs[i][j]!=lcs[i][j-1]){
            answer[cnt-1] = s1[i-1];
            cnt --;
            i --;
            j --;
        }else if(lcs[i][j]==lcs[i-1][j]){
            i --;
        }else{
            j --;
        }
    }
    printf("%s\n",answer);
}

int main(){
    char string1[SIZE],string2[SIZE];

    fgets(string1,SIZE,stdin);
    fgets(string2,SIZE,stdin);

    solve(string1,string2,strlen(string1),strlen(string2));

    return 0;
}

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

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

  int N, X;
  cin >> N >> X;

  int x;
  int ans = 0;

  for (int i = 0; i < N; i++) {
    cin >> x;
    ans = __gcd(ans, X - x);
    X = x;
  }

  cout << abs(ans) << "\n";
}

Measured memory_bytes: 256
// atcoder/abc081/A/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  string s;
  while (cin >> s) {
    cout << count(s.begin(), s.end(), '1') << endl;
  }

  return 0;
}


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

int main(){
    int n,k,x,a,b,ans=0;
    
    cin>>n>>k;
    
    for(int i=1;i<=n;i++){
        cin>>x;
        a=x;
        b=k-x;
        if(a<b)
            ans+=a;
        else
            ans+=b;
    }
    cout<<2*ans<<endl;
}


Measured memory_bytes: 3596
s = input()
n = len(s)
l = [0]
for i in range(n - 1):
    if s[i] != s[i + 1]:
        l.append(i + 1)
l.append(n)
ans = [0] * n
for i in range(1, len(l) - 1, 2):
    p = l[i] - l[i - 1]
    q = l[i + 1] - l[i]
    ans[l[i] - 1] = (p + 1) // 2 + q // 2
    ans[l[i]] = p // 2 + (q + 1) // 2
print(' '.join(map(str, ans)))


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

N = int(input())
aN = [int(input()) for i in range(N)]

# 現在位置を保持する変数を使う
now = 1
for i in range(N):
    now = aN[now-1]
    if now == 2:
        print(i + 1)
        exit()
print(-1)

Measured memory_bytes: 7084
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
//#include <unistd.h>
//#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const ld pi = 3.14159265358;
const ll mod = 1000000007;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b; return true;}return false;}
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b; return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}

ll fac[510000], finv[510000], inv[510000];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < 510000; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
ll nCk(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logN)
ll modpow(ll n,ll m,ll MOD){
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}

//printf("%.10f\n", N);
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/

//    cout << fixed << setprecision(15);

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N;
    cin >> N;
    vector<ll> num(N);rep(i,N)cin >> num[i];
    bool dame = false;
    ll cnt = 0;
    ll ans = 0;
    rep(i,N){
        if(!dame && num[i] == i + 1){
            dame = true;
            cnt++;
        }
        else if(dame && num[i] == i + 1){
            cnt++;
        }
        else if(dame){
            dame = false;
            ans += (cnt + 1) / 2;
            cnt = 0;
        }
    }
    ans += (cnt + 1)/ 2 ;
    cout << ans << endl;
}

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

#define LL long long
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()

int main() {
    int N, C;
    cin >> N >> C;
    vector<vector<int>> d(C, vector<int>(C));
    vector<vector<int>> c(N, vector<int>(N));

    REP(i, C) {
        REP(j, C) {
            cin >> d[i][j];
        }
    }
    REP(i, N) {
        REP(j, N) {
            cin >> c[i][j];
            c[i][j]--;
        }
    }

    vector<vector<int>> memo(3, vector<int>(C, 0));
    REP(m, 3) {
        REP(i, N) {
            REP(j, N) {
                if((i + j)%3 != m)continue;
                REP(k, C) {
                    memo[(i + j)%3][k] += d[c[i][j]][k];
                }
            }
        }
    }
    int res = 1145141919;
    REP(i, C) {
        REP(j, C) {
            REP(k, C) {
                if(i != j && j != k && i != k) {
                    res = min(res, memo[0][i] + memo[1][j] + memo[2][k]);
                }
            }
        }
    }
    cout << res << endl;
    return 0;
}


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

int main() {
	int N;  cin >> N;
	vector<int> a(N);
	fill(a.begin(), a.end(), 0);
	for (int i = 0; i < N; i++) {
		int num = 0;  cin >> num;
		while (num % 2 == 0) {
			a[i]++;
			num /= 2;
		}
	}
	sort(a.begin(), a.end());

	int n0 = upper_bound(a.begin(), a.end(), 0) - a.begin();
	int n2 = N - (upper_bound(a.begin(), a.end(), 1) - a.begin());
	if (n2 >= n0 || (n0 + n2 == N && n0 == n2 + 1)) cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
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(x) push_back(x)

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef std::priority_queue<int> IntPrioQueue; //Z->A
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue; //A->Z

const int MAX = 200000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const int MOD = 1000000007;

vector <int> v;

int gcd(int a, int b) {
    int m = max(a, b), n = min(a, b);
    if (m % n) {
        return gcd(n, m%n);
    }
    else return n;
}

void solve(void){
    int N, K;
    cin >> N >> K;
    rep(N, i) {
        int A; cin >> A;
        v.pb(A);
    }
    sort(all(v));
    if (find(all(v), K) != v.end()) cout << "POSSIBLE" << '\n';
    else if (v[N-1] < K) cout << "IMPOSSIBLE" << '\n';
    else {
        int dif = INF;
        rep(N-1, i) {
            dif = min(dif, gcd(v[i+1], v[0]));
        }
        if ((v[N-1] - K)%dif==0) cout << "POSSIBLE" << '\n';
        else cout << "IMPOSSIBLE" << '\n';
    }
}

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


Measured memory_bytes: 892
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <chrono>
#include <stack>
#include <string>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <tuple>
#include <iomanip>
#include <random>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <fstream>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<bool> vb;

#define pb push_back
#define fi first
#define se second
#define in insert
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

template <class T>
istream& operator>>(istream& ss, vector<T>& v) {
    for (int i = 0; i < v.size(); i++) ss >> v[i];
    return ss;
}

template <class T> 
ostream& operator<<(ostream& ss, const vector<T>& v) {
    for (int i = 0; i < v.size(); i++) ss << v[i] << ' ';
    return ss;
}

ll binpow(ll a, ll n, ll m) {
    ll res = 1;
    while (n) {
        if (n & 1) {
            res *= a;
            res %= m;
        }
        a *= (a % m);
        a %= m;
        n >>= 1;
    }
    return res % m;
}

ll gcd(ll a, ll b) {
    return b ? gcd (b, a % b) : a;
}

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

const int mod = 1e9 + 7;
const int inf = 1e9;
const int N = 2e5 + 5;

void solve() {
    ll a, b;
    double x;
    cin >> a >> x;
    b = x * 100 + 0.5;
    cout << a * b / 100;
}

int main() {
    speed;
    int t = 1;
    //cin >> t;
    for(int i = 1; i <= t; i++){
        solve();
    }
}

Measured memory_bytes: 3696
#include <bits/stdc++.h>
#define rep(i,n) for (int i= 0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const long long INF = 1LL << 60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    int n,m;cin>>n>>m;
    vector<int> x(m);rep(i,m)cin>>x[i];
    sort(x.begin(),x.end());
    vector<int> d(m);
    for(int i =0;i<m-1;++i){
        d[i] = abs(x[i+1]-x[i]);
    }
    ll sum = 0;
    sort(d.begin(),d.end(),greater<int>());
    for(int i =n-1;i<m;++i){
        sum+=d[i];
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 3952
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(ll I = int((B)-1); I >= int(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //ai>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //ai>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;




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

	ll N,M;
	cin >> N >> M;
	vector<ll> v[N+1];
	FOR(i,0,M){
		ll a,b;
		cin >> a >> b;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	bool ok = true;
	queue<ll> Q;
	Q.push(1ll);
	ll v12[N+1] = {};
	v12[1] = 1;
	while(not Q.empty()){
		ll vnow = Q.front();
		Q.pop();
		for(auto x:v[vnow]){
			if(v12[x]==0){
				v12[x] = TO(v12[vnow]==1,2,1);
				Q.push(x);
			}else if(v12[x]==v12[vnow]){
				ok = false;
				break;
			}
		}
		if(not ok)break;
	}
	ll B , W;
	B = W = 0;
	FOR(i,1,N+1){if(v12[i]-1)B++;else W++;}
	if(ok){
		cout << B*W - M << endl;
	}else{
		cout << N*(N-1)/2-M << endl;
	}
}

Measured memory_bytes: 7168
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>

using namespace std;

int main() {
	int H, A;
	cin >> H >> A;
	int count = 0;
	while (H > 0) {
		H -= A;
		count++;
	}
	cout << count << endl;
	return 0;
}

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

int main(){
	int n, m;	cin >> n >> m;
  	vector<int> h(n);
  	for(int i = 0; i < n; i++){cin >> h.at(i);}
  	
  	vector<int> a(m), b(m);
  	for(int i = 0; i < m; i++){cin >> a.at(i) >> b.at(i);}
  	
  	vector<vector<int>> rel(n);
  	for(int i = 0; i < m; i++){
    	rel.at(a.at(i)-1).push_back(h.at(b.at(i)-1));
        rel.at(b.at(i)-1).push_back(h.at(a.at(i)-1));
    }
  	
  	int count = 0;
  	for(int i = 0; i < n; i++){
        if(rel.at(i).size() == 0) count++;
    	else if(h.at(i) > *max_element(rel.at(i).begin(),rel.at(i).end())) count++;
    }
  	cout << count << endl;
  	
}

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

const int mnx = 3e5 + 9;
const int mod = 1e9 + 7;

ll n, ans;
ll a[mnx];

int main(){

cin>>n;

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

for(int i=1; i<=n; i++){
    ans += a[i] / 2;
    if(a[i] % 2 != 0 && a[i+1] != 0){ ans++; a[i+1]--; }
}

cout<<ans<<'\n';

return 0;

}














Measured memory_bytes: 1024