akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <iomanip>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define int long long
#define For(i,x,y) for(int i = x; i <= y; ++i)
#define FOR For
#define rev_For(i,x,y) for(int i = x; i >= y; --i)
#define REV_FOR rev_For
#define ll long long
#define Size(v) ((int)v.size())
#define _section "\n--------------------\n"
#define fi first
#define se second
#define pb push_back
using namespace std;
// using namespace __gnu_pbds;


int k;

const int nax = 1e5 + 5;

queue<int> q;

void input() {
	cin >> k;
}

void solve() {
	FOR (i, 1, 9) q.push(i);
	int cnt = 0;
	while (!q.empty()) {
		int u = q.front();
		q.pop();
		++cnt;
		if (cnt == k) {
			cout << u;
			return;
		}
		
		if (u % 10 != 0) q.push(10 * u + (u % 10) - 1);
		q.push(10 * u + (u % 10));
		if (u % 10 != 9) q.push(10 * u + (u % 10) + 1);
	}
}

signed main() {
#ifdef _DEBUG
	// freopen("INPUT.inp", "r", stdin);
	//freopen("OUTPUT.out", "w", stdout);
	clock_t start, end;
	start = clock();
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);
//------------------------------------------------------------------------------------
//----------------------------------MAIN PROGRAM--------------------------------------
	int t = 1;
	while (t--) {
		input();
		solve();
	}
//--------------------------------------END-------------------------------------------
//------------------------------------------------------------------------------------
#ifdef _DEBUG
	end = clock();
	cerr << "\n----------\nTime Elapsed: " << fixed << double(end - start) / double(CLOCKS_PER_SEC) << setprecision(6) << '\n';
#endif
	return 0;
}

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

using namespace std;

int main () {

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

    int p[N + 1];
    for(int i = 0; i < N; i++) {
        cin >> p[i];
    }

    sort(p, p + N);

    int ans = 0;

    for(int i = 0; i < K; i++) {
        ans += p[i];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define rep(i,x,n) for(int i=x; i<(int)(n); i++)
#define rep_eq(i,x,n) for(int i=x; i<=(int)(n); i++)
using namespace std;

int main(){
  int a,b,c; cin >>a >>b >>c;
  cout <<((b-a)==(c-b) ? "YES":"NO") <<endl;
  return 0;
}


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

using ll = long long;

using State = pair<ll, ll>;
map<State, ll> saved;
ll solve(const ll S, const ll X)
{
    if (saved.find({S, X}) != end(saved))
        return saved[{S, X}];

    if (S == 0) return X >= 0;
    else if (S == 1) return (X >= 0) + (X >= 1);
    else
    {
        auto& result = saved[{S, X}];
        result = (solve(S/2, X/2) + solve((S-1)/2, (X-1)/2) + solve((S-2)/2, X/2)) % int(1e9+7);
        return result;
    }
}

int main()
{
    ll N; cin >> N;
    cout << solve(N, N) << endl;
}


Measured memory_bytes: 256
N=int(input())
llie=[[] for i in range(N)]
ltrue=[[] for i in range(N)]
for i in range(N):
    a=int(input())
    for j in range(a):
        x,y=map(int,input().split())
        if y==0:
            llie[i].append(x)
        else:
            ltrue[i].append(x)
ans=0
for i in range(2**N):
    dlie={}
    dtrue={}
    tmpsum=0
    f=0
    for j in range(N):
        if i&1:
            if j+1 in dlie:
                f=1
                break
            else:
                for x in llie[j]:
                    if x in dtrue:
                        f=1
                        break
                    dlie[x]=1
                for x in ltrue[j]:
                    if x in dlie:
                        f=1
                        break
                    dtrue[x]=1
                if f==0:
                    tmpsum+=1
                    dtrue[j+1]=1
                else:
                    break
        else:
            if j+1 in dtrue:
                f=1
                break
            dlie[j+1]=1
        i>>=1
    if f==0:
        ans=max(ans,tmpsum)
print(ans)


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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}


signed main(){
    ll n;
    cin >> n;
    vector<ll> v(n);
    for(auto& i : v) cin >> i;

    sort(all(v), [](auto a, auto b){return a > b;});

    vector<ll> f(n+1), g(n+1);
    f[0] = 1;
    g[0] = 1;

    REP(i, n){
        f[i+1] = (2 * f[i] + g[i]) % MOD;
        g[i+1] = 2 * g[i] % MOD;
    }

    ll ans = 0;

    REP(i, n){
        ll comb = f[i] * g[i+1] % MOD;
        comb *= g[n - i - 1];
        comb %= MOD;
        comb *= g[n - i - 1];
        comb %= MOD;

        ans += v[i] * comb % MOD;
        ans %= MOD;
    }

    cout << ans << endl;

    return 0;
}


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

long long MAGIC = 1000000000000000000LL;
long long N;
long long A[1 << 18];
long long V[1 << 18];
vector<long long> B;

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

void init() {
	long long pow2 = 1;
	for (int i = 0; i <= 18; i++) {
		long long pow5 = 1LL;
		for (int j = 0; j <= 18; j++) {
			B.push_back(pow2 * pow5);
			pow5 *= 5LL;
		}
		pow2 *= 2LL;
	}
	sort(B.begin(), B.end());
	B.erase(unique(B.begin(), B.end()), B.end());
}

int main() {
	// 入力
	init();
	cin >> N;
	for (int i = 1; i <= N; i++) {
		string S; cin >> S;
		int idx = -1;
		for (int j = 0; j < S.size(); j++) {
			if (S[j] == '.') idx = j;
		}
		if (idx == -1) {
			long long val = stoll(S);
			A[i] = 1000000000LL * val;
		}
		else {
			string T1 = S.substr(0, idx);
			string T2 = S.substr(idx + 1, S.size() - (idx + 1));
			while (T2.size() <= 8) T2 = T2 + "0";
			long long val1 = stoll(T1);
			long long val2 = stoll(T2);
			A[i] = 1000000000LL * val1 + val2;
		}
	}
	
	// 計算
	long long Answer = 0;
	for (int i = 1; i <= N; i++) {
		long long T = MAGIC / gcd(MAGIC, A[i]);
		int pos1 = lower_bound(B.begin(), B.end(), T) - B.begin();
		Answer += V[pos1];
		for (int j = 0; j < B.size(); j++) {
			if (A[i] % B[j] == 0) V[j] += 1;
		}
	}
	cout << Answer << endl;
	return 0;
}

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

int main()
{
  string s;
  cin >> s;
  int sum = 0;
  for(int i = 0; i < s.size(); i++)
  {
    sum += s.at(i) - '0';
  }
  if (sum % 9 == 0)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 3716
#include<stdio.h>
int main()
{
int n;
int a[10000];
long int min = 1000000, max = -1000000, sum = 0;
scanf("%d", &n);
if (n == 0) {
printf("%ld %ld %ld\n", 0, 0, 0);
return 0;

}
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
if (min > a[i]) min = a[i];
if (max < a[i]) max = a[i];
sum += a[i];
}
printf("%ld %ld %ld\n", min, max, sum);
return 0;
}


Measured memory_bytes: 2804
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var N = ReadInt();
            var a = ReadSplitInt();
            var c = a.Count(x => x % 4 != 0 && x % 2 == 0);
            var d = a.Count(x => x % 4 == 0);
            var e = a.Count(x => x % 2 == 1);

            if (c == 0 && e <= d + 1)
                Println("Yes");
            else if (c != 0 && e <= d)
                Println("Yes");
            else
                Println("No");
        }

        static List<long> ReadLines(long n)
        {
            var l = new List<long>();
            for (long i = 0; i < n; i++)
            {
                l.Add(ReadLong());
            }
            return l;
        }

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
        static long Lcm(long a, long b) => a / Gcd(a, b) * b;

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}

Measured memory_bytes: 21216
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;

int main(){
    long long n,d,cnt=0;
    cin >> n >> d;
    long long  x,y;
    for(int ix=0;ix<n;ix++){
       cin >> x >> y;
       long long tmp = (x*x+y*y);
       if(tmp<=d*d) cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define pb push_back
const int maxn = 10000;
const int INF32 = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7 = 1'000'000'007;
const int MOD9 = 1'000'000'009;
const int mod = MOD7;

void ERROR(int num) { printf("ERROR%d!\n",num); }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};


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

    ll K;
    cin >> K;

    vector<ll> vec;
    for(ll i=1; i <=9; i++) vec.pb(i);
    
    while(1){
      if(K <= vec.size()){
        cout <<  vec[K-1] << endl;
        break;
      }
      vector<ll> old;
      swap(old,vec); //新しいやつは全部vecに入れる
      for(ll x : old){
        for(ll d=-1; d <=1; d++){
          ll y = x%10 + d;
          if(y<0 || y>9) continue;
          ll v = x*10 + y;
          vec.pb(v);
        }
      }
      K -= old.size();
    }
}

Measured memory_bytes: 1712
from collections import deque

h, w = map(int, input().split())
a = [input() + '#' for _ in range(h)]
b = ['#' * (w + 1)]
r = 0
for i in range(h):
  for j in range(w):
    if a[i][j] == '.':
      b[:-1] = map(list, a)
      b[i][j] = 0
      q = deque([(i, j)])
      while(q):
        i, j = q.popleft()
        r = max(r, b[i][j])
        d = 0
        for i1 in range(i - 1, i + 2):
          for j1 in range(j - d, j + 2, 2):                
            if b[i1][j1] == '.':
              b[i1][j1] = b[i][j] + 1
              q.append((i1, j1))
          d ^= 1
print(r)


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

int main(){
  int n;
  string str;

  while(cin >> n ,n){
    int field = 0 ,p[11] = {0};
    cin >> str;
    int size = str.size() ,t = 0;
    for(int i = 0 ; i < size ; i++){
      switch(str[i]){
      case 'M':
	++p[t++];
	break;
      case 'S':
	field += ++p[t];
	p[t++] = 0;
	break;
      case 'L':
	p[t++] += ++field;
	field = 0;
	break;
      }
      if(t == n) t = 0;
    }
    sort(p,p+n);
    for(int i = 0 ; i < n ; i++){
      cout << p[i] << " ";
    }
    cout << field << endl;
  }

  return 0;
}

Measured memory_bytes: 1228
import java.util.Scanner;
public class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int m = sc.nextInt();
    int A[] = new int[a];
    int B[] = new int[b];
    int pay, min;
    int minA, minB;
    minA = minB = 0;
    for(int i = 0; i < a; i++){
      A[i] = sc.nextInt();
      if(i==0||A[i]<minA){
        minA = A[i];
      }
    }
    for(int i = 0; i < b; i++){
      B[i] = sc.nextInt();
      if(i==0||B[i]<minB){
        minB = B[i];
      }
    }
    min = minA + minB;
    for(int i = 0; i < m; i++){
      pay = A[sc.nextInt()-1]+B[sc.nextInt()-1]-sc.nextInt();
      if(pay<min){
        min = pay;
      }
    }
    System.out.println(min);
  }
}

Measured memory_bytes: 151516
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int ZettaichiNizyou(int a, int b){
        int N = abs(a-b);
        int Ns = N*N;
        return Ns;
    }

int Check(int a){
    double x = (double)a;
    double y = sqrt(x);
    if(ceil(y)==floor(y)){
        return 1;
    }
    return 0;
}

int main(void){
    int N,D;

    scanf("%d%d",&N,&D);
    
    int a[N][D];
    int n;
    int d;

    for(n = 0;n < N;n++){
        for(d=0;d < D; d++){
            scanf("%d",&a[n][d]);
        }
    }

    int n2,d2;
    int ZN =0;
    int checkcount = 0;
    for(n2=0; n2 < N; n2++){
        int counter = 1;
        while(n2+counter < N){
            for(d2=0; d2 < D; d2++){
                ZN += ZettaichiNizyou(a[n2][d2],a[n2+counter][d2]);
            }
            if(Check(ZN) == 1){
                checkcount++;
            }
            ZN=0;
            counter++;
        }
    }
    printf("%d\n",checkcount);
}


Measured memory_bytes: 128
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << "\n";
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << " ";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define dl double
#define wh while
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define tp tuple
#define sc second
#define ve vector
#define tos to_string
#define len length
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define ea(i, n) for(auto&& i: n)
#define so(n) sort(n.begin(), n.end())
#define sp(n) cout << fixed << setprecision(n)
#pragma endregion
// abs 絶対値, rtsq ルート, pow(a, n) aのn乗

int main() {
  int N, M;
  ci(N, M);
  ve<int> s(M), c(M);
  rep(i, M){
    ci(s.at(i), c.at(i));
  }
  rep(i, 1000){
    int A = 0;
    rep(j, M){
      if(tos(i).len() == 1){
        if(s.at(j) == 1 && i % 10 == c.at(j)){
          A++;
        }
      }
      if(tos(i).len() == 2){
        if(s.at(j) == 2 && i % 10 == c.at(j)){
          A++;
        }
        else if(s.at(j) == 1 && (i % 100) / 10 == c.at(j)){
          A++;
        }
      }
      if(tos(i).len() == 3){
        if(s.at(j) == 3 && i % 10 == c.at(j)){
          A++;
        }
        else if(s.at(j) == 2 && (i % 100) / 10 == c.at(j)){
          A++;
        }
        else if(s.at(j) == 1 && i / 100 == c.at(j)){
          A++;
        }
      }
    }
    if(A == M && tos(i).len() == N){
      co(i);
      return 0;
    }
  }
  co(-1);
}

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

int main(int argc, char *argv[]) { ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);

  int a,b;cin>>a>>b;
  if(a<=5)puts("0");
  else if (a<=12)cout<<b/2<<endl;
  else cout<<b<<endl;
  
  return 0;
}


Measured memory_bytes: 3648
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false); cin.tie(0);
typedef long long ll;
ll n , a ;
vector<ll> v ;
const int N = 51 ;
ll dp[N][N*N][N];
ll dfs(ll x,ll cur,ll cnt){
    if ( x == n ){
        if ( cnt != 0 && (cur % cnt == 0 && cur / cnt == a) ) return 1 ;
        return 0 ;
    }
    if ( dp[x][cur][cnt] != -1 ) return dp[x][cur][cnt];
    ll ans = 0;
    ans += dfs(x + 1, cur, cnt);
    ans += dfs(x + 1, cur + v[x], cnt + 1);
    return dp[x][cur][cnt] = ans;
}

int main(){
    fastio
    memset(dp, -1, sizeof dp);
	cin >> n >> a ;
	v.resize(n);
	for(ll i = 0; i < n; i++){
        cin >> v[i] ;
	}
    cout << dfs(0,0,0) << endl;

    return 0 ;
}


Measured memory_bytes: 53120
#include<string>
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using namespace std;
int n, m;

int main() {
	string s;
	cin >> s;
	int res = 0;
	for(int i = 0; i < 3; i++){
		if (s[i] == 'o') {
			res++;
		}
	}
	cout << 700 + res * 100 << endl;
	return 0;
}

Measured memory_bytes: 256
local a = io.read("*n")
local b = io.read("*n")
local c = io.read("*n")
local x = io.read("*n")
local r = 0
for i = 0, 500 do
  for j = 0, (x - 500 * i) / 100 do
    local k = x - 500 * i - 100 * j
    if k % 50 == 0 and c >= k / 50 and a >= i and b >= j then
      r = r + 1
    end
  end
end
return print(r)

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

int main() {
  using namespace std;
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int A, B, C, K;
  cin >> A >> B >> C >> K;
  cout << min(A, K) - max(0, K - A - B) << endl;
}


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

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

    int ans = 0;
    for (unsigned int i = 1; i < 100; i = (i << 1)) {
        if (i > n) break;
        ans = i;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
H,W,N=map(int,input().split())
sr,sc=map(int,input().split())
S=input()
T=input()
#L
pos=sc
for i in range(0,N):
    if S[i]=="L":
        pos-=1
        if pos==0:
            print("NO")
            exit()
    if T[i]=="R" and pos!=W:
        pos+=1

#R
pos=sc
for i in range(0,N):
    if S[i]=="R":
        pos+=1
        if pos==W+1:
            print("NO")
            exit()
    if T[i]=="L" and pos!=1:
        pos-=1

#U
pos=sr
for i in range(0,N):
    if S[i]=="U":
        pos-=1
        if pos==0:
            print("NO")
            exit()
    if T[i]=="D" and pos!=H:
        pos+=1

#D
pos=sr
for i in range(0,N):
    if S[i]=="D":
        pos+=1
        if pos==H+1:
            print("NO")
            exit()
    if T[i]=="U" and pos!=1:
        pos-=1

print("YES")


Measured memory_bytes: 43088
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
const int INF = 1e10;
const long double PI = (acos(-1));


signed main() {
	string S;
	cin >> S;
	string target = "CODEFESTIVAL2016";
	int ans = 0;
	rep(i, 16)if (S[i] != target[i])ans++;
	cout << ans << endl;
}

Measured memory_bytes: 256
/*
* Author:sam51305
*/
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(0);
#define endl '\n'
#define f first
#define s second
#define mp make_pair
#define ll long long
#define pii pair <int, int>
#define pll pair <ll, ll>
#define pb push_back
#define ary array

#define Yes cout << "Yes" <<endl;
#define No cout << "No" << endl;
int main() {
    fastio
    ll n, k;
    cin >> n >> k;
    ll modn = n % k;
    ll dif = abs(modn - k);
    if(dif < modn){
        cout << dif;
    } else {
        cout << modn;
    }
    return 0;
}


Measured memory_bytes: 256
//#pragma GCC target("avx2")
#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << "\n";
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    ll n, x, m;
    cin >> n >> x >> m;

    vi v(m);
    for(ll i = 0; i < m; i++) {
        v[i] = i * i % m;
    }

    vll ord;
    set<ll> idx;
    ll c = x;
    ll last;
    while(1) {
        if (idx.count(c) > 0) {
            last = c;
            break;
        }

        idx.insert(c);
        ord.pb(c);
        c = c * c % m;
    }

    ll ans = 0;

    int i = 0;
    for(; i < ord.size(); ++i) {
        if (ord[i] == last) {
            break;
        }
        ans += ord[i];
    }

    n -= i;

    ll len = ord.size() - i;
    ll p_sum = accumulate(ord.begin() + i, ord.end(), 0LL);

    ans += n / len * p_sum;

    FOR(j, i, i + n % len) {
        ans += ord[j];
    }

    print(ans);
}


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

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

  int n, m; cin >> n >> m;
  vector<vector<int>> s(m);
  rep(i, m) {
    int k; cin >> k;
    rep(j, k) {
      int a; cin >> a;
      s[i].push_back(--a);
    }
  }
  vector<int> p(n);
  rep(i, m) cin >> p[i];

  int ans = 0;
  rep(i, (1<<n)) {
    bool flag = true;
    rep(j, m) {
      int cnt = 0;
      for(auto elem : s[j]) {
        if((1<<elem) & i) cnt++;
      }
      if(cnt%2 != p[j]) flag = false;
    }
    if(flag) ans++;
  }

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


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

ll dp[3030][3030][4];
ll grid[3030][3030];

int main() {
    int r, c, k;
    cin >> r >> c >> k;
    for (int i = 0; i < k; ++i) {
        int ri, ci;
        ll vi;
        cin >> ri >> ci >> vi;
        ri--, ci--;
        grid[ri][ci] = vi;
    }

    for (int i = 0; i < r; ++i) {
        for (int j = 0; j < c; ++j) {
            for (int t = 0; t < 4; ++t) {
                // move vertically by 1, w/o taking anything
                dp[i+1][j+1][0] = max(dp[i+1][j+1][0], dp[i][j+1][t]);

                // move vertically by 1, w/ taking item at (i, j)
                dp[i+1][j+1][1] = max(dp[i+1][j+1][1], dp[i][j+1][t] + grid[i][j]);

                // move horizontally by 1, w/o taking anything
                dp[i+1][j+1][t] = max(dp[i+1][j+1][t], dp[i+1][j][t]);
                
                // move horizontally by 1, w/ taking item at (i, j)
                // whilst incrementing the count by 1
                if(t+1 < 4) {
                    dp[i+1][j+1][t+1] = max(dp[i+1][j+1][t+1], dp[i+1][j][t] + grid[i][j]);
                }
            }
        }
    }

    // for (int t = 0; t < 4; ++t) {
    //     cout << t << endl;
    //     for (int i = 0; i <= r; ++i) {
    //         for (int j = 0; j <= c; ++j) {
    //             cout << dp[i][j][t] << " ";
    //         }
    //         cout << endl;
    //     }
    //     cout << endl;
    // }


    ll ans = 0;
    for (int i = 0; i < 4; ++i) {
        ans = max(ans, dp[r][c][i]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 358596
#include<iostream>
#include<algorithm>
#include<queue>

using namespace std;

const int INF=0x3f3f;

int sx,sy;
int xy[][2]={{1,0},{-1,0},{0,1},{0,-1}};
char map[1005][1005];
int dis[1005][1005];
int H,W,N;

bool judge(int x,int y)
{
	return 0<=x&&x<H&&0<=y&&y<W&&map[x][y]!='X'&&dis[x][y]==INF;
}

typedef pair<int,int> P;

int bfs(char c)
{
	for(int i=0;i<H;i++)
		fill(dis[i],dis[i]+W,INF);
	dis[sx][sy]=0;
	queue<P>q;
	q.push(P(sx,sy));
	while(!q.empty())
	{
		P p=q.front();
		q.pop();
		if(map[p.first][p.second]==c)
		{
			sx=p.first;
			sy=p.second;
			break;
		}
		for(int i=0;i<4;i++)
		{
			int xx=p.first+xy[i][0];
			int yy=p.second+xy[i][1];
			if(judge(xx,yy))
			{
				q.push(P(xx,yy));
				dis[xx][yy]=dis[p.first][p.second]+1;
			}
		}
	}
	return dis[sx][sy];
}

int main()
{
	cin>>H>>W>>N;
	int ans=0;
	for(int i=0;i<H;i++)
	{
		for(int j=0;j<W;j++)
		{
			cin>>map[i][j];
			if(map[i][j]=='S')
			{
				sx=i;
				sy=j;
			}
		}
	}
	for(int i=1;i<=N;i++)
		ans+=bfs('0'+i);
	cout<<ans<<endl;
	return 0;
}


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

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

int main(){
  int n;
  cin >>n;
  ll sum = 0;
  for(int i = 1; i<=n; i++){
    for(int j = 1; j<=n; j++){
      for(int k = 1; k<=n; k++){
        sum += gcd(i,gcd(j,k));
      }
    }
  }
  cout << sum << endl;
  return 0;
}

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

using namespace std;

#define db(x) cout << (x) << '\n';
#define all(x) x.begin(),x.end()
#define UNIQUE(x) sort(all(x)),x.resize(unique(all(x))-x.begin())
#define LB(v,x) lower_bound(all(v),x)
#define UB(v,x) upper_bound(all(v),x)
#define endl "\n"
#define F first
#define S second
#define PB push_back
#define PF push_front
#define int long long
#define double long double
#define trick int m = (l+r)>>1,lc=n<<1,rc=lc|1

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;

int dy[]={0,1,1,1,0,-1,-1,-1};
int dx[]={-1,-1,0,1,1,1,0,-1};
 int maxn = 1e6;
const int OO = 1e18;
const int mod = 1e9 + 7;
const double PI = acos(-1);

void maxself(int &a,int b)
{a=max(a,b);}
void minself(int &a,int b)
{a=min(a,b);}





int32_t main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

//	freopen("name.in","r",stdin);
//	freopen("name.out","w",stdout);

    int n;
    cin >> n;
    vi a(n);
    maxn=0;
    for(int i=0;i<n;i++)
        cin >> a[i],maxn=max(maxn,a[i]);
    vi num(maxn+1,0);
    for(int i=0;i<n;i++)
    {
        for(int j=a[i];j<=maxn;j+=a[i])
            num[j]++;
    }
    int ans = 0;
    for(int i=0;i<n;i++)
    {
        if(num[a[i]] == 1)
        {
            ans++;
        }
    }
    cout << ans;
    return 0;
}



Measured memory_bytes: 12604
using System;

public class B
{
	public static void Main()
	{
		Console.ReadLine();
		string[] s = Console.ReadLine().Split();
		int[] card = new int[s.Length];
		for(int i = 0; i < card.Length; i++)
		{
			card[i] = int.Parse(s[i]);
		}
		Array.Sort(card);
		Array.Reverse(card);
		int result = 0;
		for(int i = 0; i < card.Length; i++)
		{
			if (i % 2 == 0) result += card[i];
			else result -= card[i];
		}
		Console.WriteLine(result);
	}
}

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

int main(){
    int A, B, C;
    cin >> A >> B >> C;
    if (((A == B) && A != C) || ((B == C) && B != A) || ((C == A) && C != B)){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
class UnionFind():
  def __init__(self, n):
    self.n = n
    self.parents = [-1] * n
    
  def find(self, x):
    if self.parents[x] < 0:
      return x
    else:
      self.parents[x] = self.find(self.parents[x])
      return self.parents[x]

  def union(self, x, y):
    x = self.find(x)
    y = self.find(y)

    if x == y:
        return

    if self.parents[x] > self.parents[y]:
        x, y = y, x

    self.parents[x] += self.parents[y]
    self.parents[y] = x

  def size(self, x):
    return -self.parents[self.find(x)]

  def same(self, x, y):
    return self.find(x) == self.find(y)

  def members(self, x):
    root = self.find(x)
    return [i for i in range(self.n) if self.find(i) == root]

  def roots(self):
    return [i for i, x in enumerate(self.parents) if x < 0]

  def group_count(self):
    return len(self.roots())

  def all_group_members(self):
    return {r: self.members(r) for r in self.roots()}

  def __str__(self):
    return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n, m = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(m)]
  
uf = UnionFind(n)
for a, b in AB:
  a -= 1
  b -= 1
  uf.union(a, b)

ans = uf.group_count() - 1
  
print(ans)


Measured memory_bytes: 29408
#include <iostream>

using namespace std;

#define MAX 2000000

int H, A[MAX + 1];


void maxHeapify(int i) {
    int l, r, target;

    l = 2 * i;
    r = 2 * i + 1;

    //从左子节点，自身，右子节点中选出最大的节点值
    if (l <= H && A[l] > A[i])
        target = l;
    else
        target = i;

    if (r <= H && A[target] < A[r])
        target = r;


    if (target != i) {
        swap(A[i], A[target]);
        maxHeapify(target);
    }
}

int main() {
    cin >> H;
    for (int i = 1; i <= H; i++) {
        cin >> A[i];
    }

    for (int i = H / 2; i >= 1; i--)
        maxHeapify(i);

    for (int i = 1; i <= H; i++) {
        cout << " " << A[i];
    }
    cout << endl;

    return 0;
}


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

bool prime(int x)
{
	bool flag = true;

	if (x <= 1) {
		flag = false;
	}
	else if (x % 2 == 0 && x != 2) {
		flag = false;
	}
	else {
		for (int i = 3; i <= sqrt(x); i += 2) {
			if (x%i == 0) {
				flag = false;
			}
		}
	}

	return flag;
}

int M(int N, int P)
{
	vector<int> primes;

	int count = 0;
	int num = N + 1;
	while (count <= 100) {
		if (prime(num) == true) {
			primes.push_back(num);
			count++;
		}

		num++;
	}

	vector<int> answers;
	
	for (int i = 0; i <= 100; i++) {
		for (int j = i; j <= 100; j++) {
			answers.push_back(primes[i] + primes[j]);
		}
	}

	sort(answers.begin(), answers.end());

	return answers[P - 1];
}

int main()
{
	while (true) {
		int N, P;
		cin >> N >> P;

		if(N == -1 && P == -1) {
			break;
		}

		cout << M(N, P) << endl;
	}
}

Measured memory_bytes: 3184
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;

bool cmp(P a,P b){
  return a.second<b.second;
}

int main(){
  int n,m; cin >> n >> m;
  vector<P> a(m);
  for(int i=0;i<m;++i) cin >> a.at(i).first >> a.at(i).second;
  sort(a.begin(),a.end(),cmp);
  int ans=1,right=a.at(0).second;
  for(int i=0;i<m;++i){
    if(a.at(i).first>=right){
      right=a.at(i).second;
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {n: usize, s: String, t: String};
    let s: String = s;
    let t: String = t;

    let mut v: Vec<char> = Vec::new();
    for (i, j) in s.chars().zip(t.chars()) {
        v.push(i);
        v.push(j);
    }

    let s: String = v.into_iter().collect();
    println!("{}", s);
}


Measured memory_bytes: 2116
#include <iostream>
#include <sstream>
#include <algorithm>
using namespace std;

int main()
{
	int n;
	cin >> n;
	for(int i=0;i<n;i++){
		stringstream sst;
		string str;
		int m;
		cin >> str;
		sst << str;
		sst >> m;
		int num[8];
		for(int j=0;j<8;j++){
			num[j] = m%10;
			m/=10;
		}
		sort(num,num+8);
		int max=0,min=0;
		for(int j=0;j<8;j++){
			min += num[j];
			min *=10;
			max +=num[7-j];
			max *=10;
		}
		max/=10;
		min/=10;
		cout << max-min << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    string t=s;
    reverse(s.begin(),s.end());
    if(t != s)cout<<"No"<<endl;
    else{
        reverse(s.begin(),s.end());
    string s1=s.substr(0,(s.size()-1)/2);
    string s2=s.substr((s.size()+3)/2-1);
    reverse(s.begin(),s.end());
    string s3=s.substr((s.size()+3)/2-1);
    string s4=s.substr(0,(s.size()-1)/2);
    if(s1==s3 and s2==s4)cout<<"Yes"<<endl;
    else  cout<<"No"<<endl;
    }
    }


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repi(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
typedef long long ll;
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  cout<<n*n*n;
  return 0;
}


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

int main () {
    int N, M;
    cin >> N >> M;
    int a[100001], b[100001];
    int res[100001] = {0};
    
    for (int i = 0; i < M; i++) {
        cin >> a[i] >> b[i];
        res[a[i] - 1] += 1;
        res[b[i] - 1] += 1;
    }
    
    for (int i = 0; i < M; i++) {
        if (res[i] % 2 == 1) {
            cout << "NO" << endl;
            return 0;
        }
    }
    
    cout << "YES" << endl;
}


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

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

  int x,k,d;
  cin >> x >> k >> d;

  x = abs(x);

  if(k <= x / d) {
    cout << x - k * d << '\n';
    return 0;
  }

  int lower = x / d;
  int upper = lower + 1;

  int s = abs(x - lower * d);
  int t = abs(x - upper * d);

  int answer = 0;

  if(k % 2 == lower % 2) answer = s;
  else answer = t;

  cout << answer << '\n';

}

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

#define INF 1145141919

int N, K;
bool NG[10];

bool check(int t) {
  while (t > 0) {
    if (NG[t % 10]) return false;
    t /= 10;
  }
  return true;
}

int main() {
  cin >> N >> K;
  for (int i=0; i<K; i++) {
    int d;
    cin >> d;
    NG[d] = true;
  }
  for (int i=N; i<INF; i++) {
    if (check(i)) {
      cout << i << "\n";
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<tuple>
#include<map>
#include<set>
#include<algorithm>

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<=n;i++)
#define all(c) c.begin(), c.end()
#define MOD 1000000007
#define MAX 1000000001
#define INF 1410065408
 
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
struct edge{int from, to; ll cost;};

signed main(){
	int N;
	cin >> N;
	vector<int> a;
	rep(N){
		int tmp;
		cin >> tmp;
		a.push_back(tmp);
	}
	sort(all(a));
	a.push_back(0);
	int ii = 0;
	ll sum = 0;
	repp(i, N){
		sum += a[i];
		//cout << 2*sum << " " << a[i+1] << endl;
		if(sum * 2 < a[i+1]) ii = i+1;
	}
	cout << N - ii;
}


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

int main() {
    int K, N;
    cin >> K >> N;
    vector<int> v;
    for(int i = 0; i < N; i++) {
        int tmp;
        cin >> tmp;
        v.push_back(tmp);
    }
    int dist = -1;
    for(int i = 1; i < N; i++) {
        dist = max(dist, v[i]-v[i-1]);
    }
    dist = max(dist, K-v[N-1]+v[0]);
    cout << K-dist << endl;
    return 0;
}

Measured memory_bytes: 4260
import itertools

N = int(input())
d = {}

for i in range(N):
    tmp = list(input())
    k = tmp[0]
    if k in 'MARCH':
        if k in d:
            d[k] += 1
        else:
            d[k] = 1

l = len(d)
ans = 0
key = d.keys()

if l >= 3:
    for a in itertools.combinations(key,3):
        ans += d[a[0]] * d[a[1]] * d[a[2]]

print(ans)

Measured memory_bytes: 3064
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (in i = 0; i < (in)(n); i++)
#define REP(i,a,b) for(in i=(in)(a);i<(in)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const in inf=1e9+7;
using P=pair<in,in>;
vector<in> dx={0,1,-1,0};
vector<in> dy={1,0,0,-1};


int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    in n,m,k;
    cin>>n>>m>>k;
    vector<in> a(n),b(m);
    rep(i,n) cin>>a[i];
    rep(i,m) cin>>b[i];
    vector<in> suma(n+1,0);
    vector<in> sumb(m+1,0);
    rep(i,n) suma[i+1]=suma[i]+a[i];
    rep(i,m) sumb[i+1]=sumb[i]+b[i];
    in ans=0;
    rep(i,n+1){
        if(suma[i]>k) break;
        in cnt=i;
        cnt += upper_bound(all(sumb),k-suma[i])-sumb.begin()-1;
        if(suma[i]+sumb[m]<=k) cnt=i+m;
        ans=max(ans,cnt);
    }
    cout<<ans<<endl;
}/*
./problem.exe
*/

Measured memory_bytes: 9532
#include<stdio.h>

int main() {
	int N;
	int x = scanf("%d", &N);
	while (N) {
		if (N%10 == 7) {
			printf("Yes\n");
			return 0;
		}
		
		N /= 10;
	}

	printf("No\n");
	return 0;
}


Measured memory_bytes: 1656
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <list>
#include <cmath>
using namespace std;
typedef long long ll;
#define rep(i,m,n) for (int i = (int) (m); i < (int) (n); i++)
#define rep1(i,m,n) for (int i = (int) (m); i <= (int) (n); i++)
#define all(x)     (x).begin(), (x).end()
#define SZ(x)      ((int) (x).size())
int kaijyou(int x){
    if(x==0 || x==1)return 1;
    else return x*kaijyou(x-1);
}
int main(void){
    int N,i,j,a=1,b=1,x,y;
    cin>>N;
    vector<int> P(N),Q(N),p(N),q(N);
    rep(i,0,N)cin>>P.at(i);
    rep(i,0,N)cin>>Q.at(i);
    rep(i,0,N){
        p.at(i)=i+1;
        q.at(i)=i+1;
    }
    rep(i,0,N-1){
        x=1;
        y=1;
        rep(j,i,N){
            if(p.at(j)==P.at(i))break;
            x++;
        }
        rep(j,i,N){
            if(q.at(j)==Q.at(i))break;
            y++;
        }
        a+=(x-1)*kaijyou(N-1-i);
        b+=(y-1)*kaijyou(N-1-i);
        rep(j,i,N){
            if(p.at(j)==P.at(i))p.at(j)=0;
            if(q.at(j)==Q.at(i))q.at(j)=0;
        }
        sort(all(p));
        sort(all(q));
    }
    cout<<abs(a-b)<<endl;
}

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

int main(void){
    int d;
    cin >> d;
    
    switch(d){
        case 25: cout << "Christmas" << endl; break;
        case 24: cout << "Christmas Eve" << endl; break;
        case 23: cout << "Christmas Eve Eve" << endl; break;
        case 22: cout << "Christmas Eve Eve Eve" << endl; break;
    }
    
    return 0;
}


Measured memory_bytes: 256
n = int(input())
S = [input() for _ in range(n)]
h = [[0]*26 for _ in range(n)]
for i in range(n):
    for c in S[i]:
        h[i][ord(c)-ord('a')] += 1
print(''.join([chr(i+ord('a'))*min([h[j][i] for j in range(n)]) for i in range(26)]))


Measured memory_bytes: 65228
#include<stdio.h>
int main()
{
   

    int a,b,c;
    
    // 整数の入力
    scanf("%d %d",&b,&c);
    // 文字列の入力
    if(b-(c*2) >= 0){
    printf("%d ",b-(c*2));//printf("%c",s[0])//文字一つ分のみを出力
    }else{
      printf("0");
    }
    return 0;
}

Measured memory_bytes: 128
//
// Created by watemus on 05.06.2020.
//

#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>

using namespace std;

#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define ff first
#define ss second

using ll = long long;
using ld = long double;

template<typename T>
using vec = vector<T>;

template<typename T>
using uset = unordered_set<T>;

template<typename T1, typename T2>
using umap = unordered_map<T1, T2>;

#define int ll

constexpr ll INFL = 1'000'000'000'000'000'228;
constexpr int INFI = 1'000'000'228;
constexpr ld PI = acos(-1);

vector<pair<int, int>> DD = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};

#ifdef LOCAL
#else
#endif

void run() {
    int a,b;
    cin >> a >> b;
    cout << a * b << '\n';
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
*/

signed main() {
#ifdef LOCAL
    std::freopen("input.txt", "r", stdin);
#else
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
#endif
    cout << fixed << setprecision(20);
    int t = 1;
//    cin >> t;
    while (t--) {
        run();
    }
    return 0;
}



Measured memory_bytes: 3664
#include <stdio.h>
#include <stdlib.h>
#define INF 100000000

int n,M[101][101];
 
void dijkstra(){
  int minv,i,v,u;
  int d[101],color[101];
 
  for(i=0;i<n;i++){
    d[i]=INF;
    color[i]=0;
  }
   
  d[0]=0;
  color[0]=1;
  while(1){
    minv=INF;
    u=-1;
    for(i=0;i<n;i++){
      if(minv>d[i] && color[i]!=2){
	u=i;
	minv=d[i];
      }
    }
    if(u==-1) break;
    color[u]=2;
    for(v=0;v<n;v++){
      if(color[v]!=2 && M[u][v]!=INF){
	if(d[v] > d[u]+M[u][v]){
	  d[v]=d[u]+M[u][v];
	  color[v]=1;
	}
      }
    }
  }
  for(i=0;i<n;i++){
    printf("%d ",i);
    if(d[i]==INF){
      printf("1\n");
    }
    else   printf("%d\n",d[i]);
  }
}
 
int main(){
  int i,j,u,k,v,c;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      M[i][j]=INF;
    }
  }
  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d %d",&v,&c);
      M[u][v]=c;
    }
  }
  dijkstra();
  return 0;
}

Measured memory_bytes: 640
//
//  cakes.cpp
//  Competitions
//
//  Created by macbook on 10/23/16.
//  Copyright © 2016 LiorCohen. All rights reserved.
//

#include <iostream>
#include <vector>

using namespace std;

int main() {
    unsigned int K,T;
    cin >> K >> T;
    
    vector<unsigned int> cakes(T);
    unsigned int max_idx = 0;
    for (int i=0; i<T; i++) {
        cin >> cakes[i];
        if (cakes[i] > cakes[max_idx]) {
            max_idx = i;
        }
    }
    
    unsigned int curSum = 0;
    int i;
    for (i=0; i<T && curSum < (cakes[max_idx]-1); i++) {
        if (i == max_idx) {
            continue;
        }
        curSum += cakes[i];
    }
    if (curSum < (cakes[max_idx]-1) && i == T) {
        cout << (cakes[max_idx] - curSum -1) << endl;
    } else {
        cout << 0 << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int f[100001],a[100001];
int main()
{
    int i,n,min_v=INT_MAX;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    	scanf("%d",&a[i]);
    f[2]=abs(a[2]-a[1]);
    for(i=3;i<=n;i++)
    {
    	f[i]=min(abs(a[i-2]-a[i])+f[i-2],abs(a[i-1]-a[i])+f[i-1]); 
	}
	printf("%d",f[n]);
    return 0;
}

Measured memory_bytes: 1024
fun main(args: Array<String>) {

    val teamNum = readLine()!!.toInt()
    val numbers = readLine()!!.split(" ").map { it.toInt() }

    val sortedNumbers = numbers.sortedDescending()

    // LOOK 演算結果が10桁超えがあれば、longにする必要がある。2147483647 = 2の31乗-1
    var result = 0L

    // 0..2だと0, 1, 2で3順するので2回ループしたいのであれば、0 until teamNumだし、1始まりなら、1..teamNumで2回ループ
    // 今回のケースでいえば、sortedNumbersをループして、index0を飛ばして、teamNum回ループする

    // N回分取得する。1,3,5,7...のindexを
    var index = 1
    for (i in 0 until teamNum) {
        result += sortedNumbers[index]
        index += 2
    }
//        for ((index, value) in sortedNumbers.withIndex()) {
//
//            if (index == 0)
//            // 初回オブジェクトには何もしない
//            else if (index == teamNum) {
//                result += value
//                break
//            } else {
//                result += value
//            }
//        }
    println(result)
}

Measured memory_bytes: 87084