akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  ll n;
  R n;
  ll a[n];
  rep(i,n) R a[i];
  ll dp[n],p[n];
  fill(dp,dp+n,-MAXL);memset(p,-1,sizeof(p));
  rep(i,n) {
    if(dp[i]<a[i]) {
      dp[i]=a[i];
      p[i]=-1;
    }
    for(int j=i+2; j<n; j+=2) {
      if(dp[j]<dp[i]+a[j]) {
        dp[j]=dp[i]+a[j];
        p[j]=i;
      }
    }
  }
  ll ans=-MAXL,x=-1;
  rep(i,n) {
    if(ans<dp[i]) {
      ans=dp[i];
      x=i;
    }
  }
  vector<ll> g;
  for(int i=n-1; i>x; i--) g.pb(i+1);
  while(x!=-1) {
    ll y=p[x];
    if(y>=0) {
      ll d=abs(x-y);
      rep(i,d/2) g.pb(d/2-i+1+y);
    } else {
      rep(i,x) g.pb(1);
    }
    x=y;
  }
  pr(ans);
  pr(g.size());
  rep(i,g.size()) pr(g[i]);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    vector<int> a(m);
    for (int j = 0; j < m; j++) {
        cin >> a[j];
    }
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());

    int b[10] = { 0, 2, 5, 5, 4, 5, 6, 3, 7, 6 };

    vector<int> dp(n + 1, -1 << 30);
    dp[0] = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j < m; j++) {
            int h = i - b[a[j]];
            if (h < 0) continue;
            int d = dp[h] + 1;
            if (d > dp[i]) dp[i] = d;
        }
    }

    char s[5001];
    int i = n, d0 = dp[n];
    for (int d1 = 0; d1 < d0; d1++) {
        for (int j = 0; j < m; j++) {
            int h = i - b[a[j]];
            if (h < 0) continue;
            int d = dp[h] + 1;
            if (d == d0 - d1) {
                s[d1] = '0' + a[j];
                i = h;
                break;
            }
        }
    }
    s[d0] = 0;

    cout << s << endl;

    return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define ll long long
#define REP(i, n) for (ll (i) = 0; (i) < (n); (i)++)
#define REPI(i, a, b) for (ll (i) = (a); (i) < (b); (i)++)
#define int long long
using namespace std;
using P = pair<int, int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;

signed main() {
  int a, b;
  cin >> a >> b;
  if (a * b % 2) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<stdio.h>
#include<vector>
#include<string>
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#include<set>
#define ws " "
#define nl "\n"
#define tc ll test; cin>>test; while(test--)
#define f(i, a, b) for(ll i = a; i<b; i++)
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL)
using namespace std;

#define pid pair<int, double>
bool compare(pid a, pid b)
{
	//for descending order replace with a.roll >b.roll
   if(a.ss < b.ss)
        return 1;
	else
		return 0;
}


void fillPrefixSum(int arr[], int n, int prefixSum[])
{
    prefixSum[0] = arr[0];
    for (int i = 1; i < n; i++)
        prefixSum[i] = prefixSum[i-1] + arr[i];

}

void SieveOfEratosthenes(ll n, bool prime[], bool primesquare[], ll a[])
{
    for (ll i = 2; i <= n; i++)
        prime[i] = true;
    for (ll i = 0; i <= (n * n + 1); i++)
        primesquare[i] = false;
    prime[1] = false;

    for (ll p = 2; p * p <= n; p++) {
        if (prime[p] == true) {
            for (ll i = p * 2; i <= n; i += p)
                prime[i] = false;
        }
    }

    ll j = 0;
    for (ll p = 2; p <= n; p++) {
        if (prime[p]) {
            a[j] = p;

            primesquare[p * p] = true;
            j++;
        }
    }
}

ll countDivisors(ll n)
{
    if (n == 1)
        return 1;

    bool prime[n + 1], primesquare[n * n + 1];

    ll a[n]; // for storing primes upto n
    SieveOfEratosthenes(n, prime, primesquare, a);

    ll ans = 1;

    for (ll i = 0;; i++) {
        if (a[i] * a[i] * a[i] > n)
            break;
        ll cnt = 1; // cnt is power of prime a[i] in n.
        while (n % a[i] == 0) // if a[i] is a factor of n
        {
            n = n / a[i];
            cnt = cnt + 1; // incrementing power
        }

        ans = ans * cnt;
    }
    if (prime[n])
        ans = ans * 2;

    // Second case
    else if (primesquare[n])
        ans = ans * 3;

    // Third casse
    else if (n != 1)
        ans = ans * 4;

    return ans; // Total divisors
}

bool checkLast(ll n)
{
    if(n%10==0)
        return true;
    return false;

}
bool checkPrime(ll n)
{
    // Corner cases
    if (n <= 1)  return false;
    if (n <= 3)  return true;

    // This is checked so that we can skip
    // middle five numbers in below loop
    if (n%2 == 0 || n%3 == 0) return false;

    for (ll i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;

    return true;
}

struct parts{
int start, en;
//bool included;

};

struct c{
ll num;
ll type;
};

int checkFor(ll m, c arr[], int n)
{
    f(i, 0, n)
    {
        if(arr[i].num==m)
            return i;
    }

}
void solve()
{
    int a;
    cin>>a;

    cout<< a + a*a + a*a*a << nl;
}

int main()
{
    fastIO;


 // tc
    solve();
}


Measured memory_bytes: 3652
s = input()
n = len(s) #length s
aa = ['.'] * (n + 1)

if s[0] == '<':
  aa[0] = 0
if s[-1] == '>':
  aa[-1] = 0

for i in range(n-1):
  if s[i] ==  '>' and s[i+1] == '<':
    aa[i+1] = 0 
  elif s[i] == '<' and s[i+1] == '>':
    aa[i+1] = n
    
z = [i for i,x in enumerate(aa) if x == 0]
m = [i for i, x in enumerate(aa) if x == n]


for i in range(len(z)-1):
  aa[m[i]] = max(m[i]-z[i], z[i+1]-m[i])
  aa[m[i]+1] = z[i+1]-m[i]-1
  for j in range(z[i]+1, m[i]):
    aa[j] = aa[j-1] +1
  for k in range(m[i]+2,z[i+1]):
    
    aa[k] = aa[k-1]-1
for i in range(z[-1], n+1):
  if aa[i] == '.':
    aa[i] = aa[i-1]+1
for i in range(z[0]):
  if aa[i] == '.':
    aa[i] = z[0] - i
    

print(sum(aa))


Measured memory_bytes: 29076
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        // ##### 初期読み込み #######################################################################
        // 1行 文字 複数 ----------------------------------------------------------------------------
        String[] stringArray = scanner.nextLine().split(" ");

        long n = Long.parseLong(stringArray[0]);
        long a = Long.parseLong(stringArray[1]);
        long b = Long.parseLong(stringArray[2]);


        // ##### メイン処理 #######################################################################

        long amari = n%(a+b);
        long result = (n-amari)/(a+b)*a;

        if (amari > a) {
            result += a;
        } else {
            result += amari;
        }
        System.out.println(result);
    }
}

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

using namespace std;

const int MaxN = 3005;

int n;
long double a[MaxN], dp[MaxN][MaxN];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }
    int m = n / 2;
    dp[1][0] = a[1], dp[1][1] = 1 - a[1];
    for (int i = 1; i < n; i++)
    {
        for (int j = 0; j <= m; j++)
        {
            dp[i + 1][j] = (dp[i + 1][j] + dp[i][j] * a[i + 1]);
            dp[i + 1][j + 1] = (dp[i + 1][j + 1] + dp[i][j] * (1 - a[i + 1]));
        }
    }
    long double ans = 0;
    for (int i = 0; i <= m; i++)
    {
        ans += dp[n][i];
    }
    cout << fixed << setprecision(9) << ans;
    return 0;
}

Measured memory_bytes: 85996
#include<stdio.h>

int main(void){
	int m[10],i,j;
	int tmp;

	for(i=0;i<10;i++){
		scanf("%d",&m[i]);
	}

	for(i=0;i<10;i++){
		for(j=9;j>i;j--){
			if(m[j]>m[j-1]){
				tmp=m[j];
				m[j]=m[j-1];
				m[j-1]=tmp;
			}
		}
	}
	printf("%d\n%d\n%d\n",m[0],m[1],m[2]);
	return 0;
}

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

int main(void){
    int N,cnt=0,ans=0;
    cin>>N;
    int A[N];
    for(int i=0;i<N;i++){
        cin>>A[i];
        if(A[i]%2==0)
            cnt++;
    }
    while(1){
        if(cnt==N){
            cnt=0;
            ans++;
            for(int i=0;i<N;i++){
                A[i]/=2;
                if(A[i]%2==0)
                    cnt++;
            }
        }
        else{
            break;
        }
    }

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


Measured memory_bytes: 256
/*
1. 只有 "-" 号后面才有 "("
2. 最多只会存在两层嵌套。假设有三层：-(A-(B-(C-D))), 显然 -(C-D) 还是 -(C-D)，可以变化成 -(A-B)-(C-D)，层数变少.

由此得出 DP 解法：f[i, j] 表示结束第 i 个数时，有 j 个左括号尚未匹配的答案，j = 0/1/2
*/
#include <bits/stdc++.h>
#define rep(i, x, y) for (int i = x; i <= y; i++)
using namespace std;

const int N = 1e5 + 10;
typedef long long ll;
ll n, x, f[3];

int read() {
    int x = 0, op = 1; char ch = getchar();
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') op = -1;
    for (; isdigit(ch); ch = getchar()) x = x * 10 + (ch - '0');
    return x * op;
}

int main() {
    cin >> n;
    f[1] = f[2] = -1e18;
    rep(i, 1, n) {
        x = read();
        f[0] += x, f[1] -= x, f[2] += x;
        if (x < 0)
            f[2] = max(f[2], f[1]), f[1] = max(f[1], f[0]);  // 在 x 前加一个 '('
        f[0] = max(f[0], f[1]), f[1] = max(f[1], f[2]);  // 在 x 后加一个 ')'
    }
    printf("%lld\n", f[0]);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int A,B,S=0,i,T;
	scanf("%d %d %d",&A,&B,&T);
	T=T/A;
	S=T*B;
	printf("%d\n",S);
	return 0;
}

Measured memory_bytes: 256
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors


n,k=map(int,input().split())
a=list(map(int,input().split()))

x=sum(a)

lst=make_divisors(x)

lst.reverse()

for can in lst:
    aa=list(map(lambda x:x%can,a))
    aa.sort()

    cnt=0
    l=0
    r=0
    lll=0
    rrr=len(aa)-1
    while lll<=rrr:
        if l<r:
            l+=aa[lll]
            lll+=1
        
        else:
            r+=can-aa[rrr]
            rrr-=1
    
    if (l+r)//2<=k:
        print(can)
        exit()

Measured memory_bytes: 74256
#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
  out << "(" << a.first << "," << a.second << ")";
  return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

int main() {
  string s;
  cin >> s;
  int n = s.size();
  string t;
  for (int i = 0; i < n / 2; ++i) t += "hi";
  cout << (s == t ? "Yes" : "No") << endl;
  return 0;
}


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

long long kMod = 998244353;

class Robot {
  public:
    long long x;
    long long d;
    Robot() {}
};

class Node {
  public:
    vector<Node*> children;
    Node* parent;
    long long p;
    long long x;
    Node(const Robot& robot) {
      parent = nullptr;
      p = -1;
      x = robot.x + robot.d;
    }
    void calc_p() {
      p = 1;
      for (auto ptr : children) {
        ptr->calc_p();
        p *= ptr->p;
        p %= kMod;
      }
      p += 1;
      p %= kMod;
    }
};

bool has_smaller_x(const Robot& a, const Robot& b)
{
  return a.x < b.x;
}

int main()
{
  long long n;
  cin >> n;
  vector<Robot> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v.at(i).x >> v.at(i).d;
  }
  sort(v.begin(), v.end(), has_smaller_x);
  long long res = 1;
  long long largest_x = LLONG_MIN;
  Node* root = nullptr;
  Node* cur = nullptr;
  for (const auto& robot : v) {
    if (largest_x <= robot.x) {
      if (root) {
        root->calc_p();
        res *= root->p;
        res %= kMod;
      }
      root = new Node(robot);
      cur = root;
      largest_x = robot.x + robot.d;
    } else {
      while (cur->x <= robot.x) {
        cur = cur->parent;
        assert(cur != nullptr);
      }
      Node* n = new Node(robot);
      n->parent = cur;
      cur->children.push_back(n);
      cur = n;
      largest_x = max(largest_x, n->x);
    }
  }
  if (root) {
    root->calc_p();
    res *= root->p;
    res %= kMod;
  }
  cout << res << '\n';
  return 0;
}


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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >=0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

typedef long long ll;
#define INF 1e9

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

int N, x;

int main(){
  cin >> N >> x;
  vector<int> a(N);
  ll ans = 0;
  REP(i, N){
    cin >> a[i];
  }
  int suma, sumb;
  // FOR(i, 1, N-1){
  //   suma = a[i-1]+a[i];
  //   if(suma > x){
  //     if(suma - x > a[i]){
  //       ans += suma - x;
  //       a[i] = 0; 
  //     }
  //     else{
  //       ans += suma - x;
  //       a[i] -= suma - x;
  //     }
  //   }
  //   sumb = a[i]+a[i+1];

  // }
  REP(i, N-1){
    suma = a[i] + a[i+1];
    if(suma > x){
      ans += suma -x;
      if(suma - x > a[i+1])
        a[i+1] = 0;
      else{
        a[i+1] -= suma - x;
      }
    }
  }
  cout << ans << endl;


  return 0;
}

Measured memory_bytes: 640
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
//#include <utility>
//#include <memory>
//#include <functional>
//#include <deque>
//#include <cctype>
//#include <ctime>
//#include <numeric>
//#include <list>
//#include <iomanip>

//#if __cplusplus >= 201103L
//#include <array>
//#include <tuple>
//#include <initializer_list>
//#include <forward_list>
//
//#define cauto const auto&
//#else

//#endif

using namespace std;


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

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	int n;
	while(cin>>n,n){
		vector<pair<pii,int>> v(n,mkp(pii(0,0),0));
		vector<char> w(n);
		rep(i,n){
			cin>>w[i];
			string s;
			getline(cin,s);
			stringstream ss;
			ss<<s;
			int t;
			v[i].S=i;
			while(ss>>t){
				if(t==0){
					v[i].F.F--;
				}
				else if(t==2){
					v[i].F.S--;
				}
			}
		}
		sort(ALL(v));
		rep(i,n){
			cout<<w[v[i].S]<<endl;
		}
	}
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

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

using ll=long long;
long long minCost(const int num, const vector<int>& heights) {
    vector<ll> dp(num, LLONG_MAX);
    dp[0] = 0;
    for (int i = 1; i < num; ++ i) {
        if (i == 1) {
            dp[i] = abs(heights[i-1] - heights[i]);
        } else {
            dp[i] = min( dp[i-1]+abs(heights[i-1] - heights[i]), dp[i-2]+ abs(heights[i-2] - heights[i]));
        }
    }
    return dp[num-1];
}

int main(){
    int num;
    cin>>num;
    vector<int> heights (num);
    for (auto& e : heights) {
        cin>>e;
    }
    cout<<minCost(num, heights);
    return 0;
}

Measured memory_bytes: 1408
N, M, X, Y = map(int, input().split())
X_list = list(map(int, input().split()))
Y_list = list(map(int, input().split()))

if max(X_list) < min(Y_list) and X < min(Y_list) and max(X_list) < Y:
    print("No War")
else:
    print("War")

Measured memory_bytes: 38384
import bisect

N = int(input())
L  =list(map(int, input().split()))

count  =0
L.sort()
for i in range(0, N - 1):
  for j in range(i + 1, N):
    index = bisect.bisect_left(L, L[i] + L[j]) #AC:約2.9秒
    count += max(0, index - j - 1)

"""
    失敗:回答は出るがTLE:ランダム配列1000本で約6.2秒
    index = bisect.bisect_left(L[j+1:],L[i] + L[j]) #TLEの原因?
    count += index
"""
print(count)

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

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

    if (a == b) {
        cout << "Draw" << endl;
    } else if (a == 1) {
        cout << "Alice" << endl;
    } else if (b == 1) {
        cout << "Bob" << endl;
    } else if (a > b) {
        cout << "Alice" << endl;
    } else {
        cout << "Bob" << endl;
    }
    return 0;
}


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

int a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
int K;

int main(){
  cin >> K;
  cout << a[K-1] << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int a,b;

    cin >> a >> b;

    if(a < b){
        cout << "a < b" <<endl;
    }else if(a > b){
        cout << "a > b" <<endl;
    }else{
        cout << "a == b" <<endl;
    }

    return 0;
}

Measured memory_bytes: 3068
a,b,m = gets.chomp.split(' ').map(&:to_i)
a_arr = gets.chomp.split(' ').map(&:to_i)
b_arr = gets.chomp.split(' ').map(&:to_i)
min = a_arr.min + b_arr.min
m.times do
  x,y,c = gets.chomp.split(' ').map(&:to_i)
  if a_arr[x-1] + b_arr[y-1] - c < min
    min = a_arr[x-1] + b_arr[y-1] - c
  end
end
puts min

Measured memory_bytes: 25284
//Target for Pupil
//Implementation and Data structures
//Prodip sarker(student_ip)
#define bn begin()
#define en end()
#define mx 5000010
#define pb push_back
#define PI (2.0*acos(0.0))
#define al(a) a.begin(),a.end()
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rep(a,b) for(int a=0;a<b;++a)
#define fastio ios::sync_with_stdio(false)
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<int>  vi;
typedef vector<ll>   vll;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
	int a,b,c,n,i,t,tmp,d,e,f,p;
	cin>>t;
	while(t--)
	{
		cout<<"ACL";
		
	}

	return 0;
}

Measured memory_bytes: 3636
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

constexpr int MOD = 1000000007;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> PLL;

int main() {
    string s;
    cin >> s;
    int count = 0;
    for (int j = 1; j < s.size(); ++j) {
        if (s[j-1] != s[j]) {
            ++count;
        }
    }
    cout << count << endl;

    return 0;
}


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

using namespace std;

typedef struct{
    int name;
    int count;
}num_t;

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

    int a[100000+1];
    for(int i=0;i<100002;i++)a[i] = 0;
    for(int i=0;i<n;i++){
        int tmp;
        cin >> tmp;
        a[tmp-1]++;
        a[tmp]++;
        a[tmp+1]++;
    }
    int ans = 0;
    for(int i=0;i<100002;i++){
        if(ans<a[i])ans = a[i];
    }

    cout << ans << endl;
}


Measured memory_bytes: 640
s=str(input())
a,b=int(s[:2]),int(s[2:])
f,g= 1<=a and a<=12, 1<=b and b<=12
if f and g:
  print("AMBIGUOUS")
elif f:
  print("MMYY")
elif g:
  print("YYMM")
else:
  print("NA")

  


Measured memory_bytes: 2940
input = require('fs').readFileSync('/dev/stdin', 'utf8');
avr = (a=input.split('\n')[1].split(' ')).map(Number).reduce((x,y)=>x+y)/a.length;
i = -1; min = Infinity;a.map((x, y) => {if (Math.abs(x - avr) < min) {min = Math.abs(x - avr); i = y;}});
console.log(i);

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

int main(){
  int N;
  cin >> N;
  
  vector<int> A(N);
  
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());
  
  int Alice = 0;
  int Bob = 0;
  for (int i = 0; i < N; i++) {
    if (i % 2 == 0) {
      Alice += A.at(i);
    }
    else {
      Bob += A.at(i);
    }
  }
  
  cout << Alice - Bob << endl;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn gcd(a: usize, b: usize) -> usize {
    if a == usize::default() {
        b
    } else {
        gcd(b % a, a)
    }
}
fn lcm(a: usize, b: usize) -> usize {
    a * b / gcd(a, b)
}

fn solve() {
    let (a,b,c,d) = get!(usize, usize, usize, usize);

    let g = lcm(c,d);
    println!("{}", b-(b/c+b/d-b/g) - ((a-1)-((a-1)/c+(a-1)/d-(a-1)/g)));
}


Measured memory_bytes: 8572
fun main() {
    var n: Int
    do {
        n = readLine()?.toInt() ?: 0
    } while (n !in 0..999)

    val yomi = when (n % 10) {
        2, 4, 5, 7, 9 -> "hon"
        0, 1, 6, 8 -> "pon"
        else -> "bon"
    }
    print(yomi)
}

Measured memory_bytes: 34448
#include <bits/stdc++.h>
 using namespace std;
 using pii = pair<int, int>;
 using ll = long long;
 #define rep(i, j, n) for(int i = j; i < (int)(n); i++)
 const ll MOD = 1000000007;
 const ll INFL = (1LL << 60);
 const int INFI = (1 << 30);

 int main() {
   int N, M; cin >> N >> M;
   vector<vector<int>> Graph(N);

   rep(i, 0, M) {
     int A, B; cin >> A >> B;
     Graph.at(A - 1).push_back(B - 1);
     Graph.at(B - 1).push_back(A - 1);
   }

   vector<int> dist(N, -1), root(N, INFI);
   queue<int> que;
   dist.at(0) = 0;
   que.push(0);

   while (!que.empty()) {
        int v = que.front(); que.pop();
        for (auto nv : Graph.at(v)) {
            if (dist.at(nv) == -1) {
                dist.at(nv) = dist.at(v) + 1;
                root.at(nv) = v;
                que.push(nv);
            }
        }
    }

    bool ok = true;
    rep(i, 1, N) {
      if (dist.at(i) == -1) {
        ok = false;
        break;
      }
    }

    if (!ok) cout << "No" << endl;

    else {
      cout << "Yes" << endl;
      rep(i, 1, N) {
        cout << root.at(i) + 1 << endl;
      }
    }

 }


Measured memory_bytes: 10728
from collections import defaultdict


def main():
    n = int(input())
    c = 0
    xx = [c]
    for i in map(int, input().split()):
        c += i
        xx.append(c)
    d = defaultdict(int)
    for x in xx:
        d[x] += 1
    ans = 0
    for c in d.values():
        ans += c * (c - 1) // 2
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 34244
mod = 10**9+7

N = int(input())
S = input()
lr = ['L']*(2*N)

for i in range(1,2*N):
    if S[i]==S[i-1]:
        if lr[i-1]=='L':
            lr[i] = 'R'
        else:
            lr[i] = 'L'
    else:
        lr[i] = lr[i-1]

ans = 1
l = 0
for i in range(2*N):
    if lr[i]=='L':
        l += 1
    else:
        ans *= l
        ans %= mod
        l -= 1

for n in range(1,N+1):
    ans *= n
    ans %= mod

l = [i for i in range(2*N) if lr[i]=='L']
r = [i for i in range(2*N) if lr[i]=='R']
s = [0]*(2*N+1)

if len(l)!=len(r):
    ans = 0
else:
    for i in range(N):
        s[l[i]] += 1
        s[r[i]+1] -= 1
    for i in range(2*N):
        s[i+1] += s[i]
        if S[i]=='B':
            s[i] += 1
        if s[i]%2!=0:
            ans = 0

print(ans)

Measured memory_bytes: 55136
using System;
using System.Linq;
class Program
{
	public static void Main()
	{
		while (true)
		{
			var line = Console.ReadLine().Split(' ');
			var a = int.Parse(line[0]);
			var b = int.Parse(line[1]);
			if (a == 0 && b == 0)
			{
				break;
			}
			for (var i = 0; i < a; i++)
			{
				for (var j = 0; j < b; j++)
				{
					
					if (i > 0 && i < a-1 && j > 0 && j < b-1)
					{
						Console.Write(".");
					}
					else
					{
						Console.Write("#");
					}
				}
				Console.WriteLine();
			}
			Console.WriteLine();
			
		}
	}
}


Measured memory_bytes: 15972
import sys

n = int(input())
m = []
for i in range(n):
    inpt = list(map(int, input().split( )))
    m.append(inpt)

lrg = 1000000
DP = [[lrg for i in range(n)] for j in range(n)]


for i in range(n):
    DP[i][i] = 0

if n >= 1:
    for i in range(n-1):
        DP[i][i+1] = m[i][0]*m[i][1]*m[i+1][1]

for d in range(2,n):
    for i in range(n-d):
        for j in range(i+1,i+d):
            DP[i][i+d] = min(DP[i][i+d],DP[i][j]+DP[j+1][i+d]+m[i][0]*m[j][1]*m[i+d][1])

    
print(DP[0][n-1])


Measured memory_bytes: 5688
/*input

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

#define int long long 
#define double long double
#define f first
#define s second
#define mp make_pair
#define pb push_back

#define RE(i,n) for (int i = 1; i <= n; i++)
#define RED(i,n) for (int i = n; i > 0; i--)
#define REPS(i,n) for(int i = 1; (i*i) <= n; i++)
#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 REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)

#define all(v) v.begin(),v.end()
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define print(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout << *it << " "; cout << endl;
#define debug(x) cout << x << endl;
#define debug2(x,y) cout << x << " " << y << endl;
#define debug3(x,y,z) cout << x << " " << y << " " << z << endl;

typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

const int INF = 1e18+1;
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;

int raise(int a,int n,int m = MOD){
  if(n == 0)return 1;
  if(n == 1)return a;
  int x = 1;
    x *= raise(a,n/2,m);
    x %= m;
    x *= x;
    x %= m;
    if(n%2)x*= a;
    x %= m;
    return x;
}

int floor1(int n,int k){
    if(n%k == 0 || n >= 0)return n/k;
    return (n/k)-1;
}

int ceil1(int n,int k){
    return floor1(n+k-1,k);
}

void solve(){
	int len = 10;
	bool br = 0;
  	for(int i = 10;i > 0;i--){
  		cout << "? ";
  		REP(j,i)cout << "9";
  		cout << endl;
  		char x;cin >> x;
  		if(x == 'N'){
  			br = 1;
  			break;
  		}
  		len = i;
  	}

  	for(int i = 12;i > 0;i--){
  		cout << "? ";
  		cout << raise(10,i-1,INF);
  		cout << endl;
  		char x;cin >> x;
  		if(x== 'Y' and !br){
  			len = max(len,i);
  			break;
  		}
  	}
  	if(!br and len == 12){
  		cout << "! 1" << endl;
  		return;
  	}
  	if(len == 10){
  		cout << "! " << (int)1e9 << endl;
  		return;
  	}
  	int lo = raise(10,len-1,INF);
  	int hi = raise(10,len,INF)-1;
  	while(lo < hi){
  		int mid = (lo+hi)/2;
  		cout << "? " << mid*10 << endl;
  		char o;cin >> o;
  		if(o == 'Y')hi = mid;
  		else lo = mid+1;
  	}
  	cout << "! " << lo << endl;
}

signed main(){
  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  //freopen(".in","r",stdin);freopen(".out","w",stdout);
  int t = 1;
  //cin >> t;
  while(t--){
    solve();
  }
  return 0;
}


Measured memory_bytes: 596
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp():
    '''
    一つの整数
    '''
    return int(input())
def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))
def inpl_str():
    '''
    一行に複数の文字
    '''
    return list(input().split())

n=inp()
a = inpl()
sorted_a = sorted(a,reverse=True)
place=dict()
for i in range(n):
    if a[i] not in place:
        place[a[i]]=[i+1]
    else:
        place[a[i]].append(i+1)
ans = 0
dp=[[-INF]*(n+1) for i in range(n+1)]
dp[0][0] = 0
for i in range(n):
    if i!=0 and sorted_a[i] == sorted_a[i - 1]:
        index += 1
    else:
        index = 0
    for j in range(n):
        _place = place[sorted_a[i]][index]
        #右
        dp[i + 1][j] = max(dp[i + 1][j], dp[i][j] + sorted_a[i] * abs(n - (i - j) - _place))
        #左
        dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + sorted_a[i] *  abs(_place - j - 1))

print(max(dp[n]))


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

using namespace std;

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

  if(a > b) {
    cout << "0" << endl;
    return 0;
  }

  if(n == 1) {
    if(a == b) {
      cout << "1" << endl;
    }
    else {
      cout << "0" << endl;
    }
    return 0;
  }
  cout << (long long)(b - a) * (n - 2) + 1 << endl;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

c=[]

for i in range(n):
    c.append(a[i]-b[i])

c=sorted(c)

i=0
minus=0
ans=0
while c[i]<0:
    minus+=c[i]
    i+=1
    ans+=1

i=n-1
plus=0
while plus+minus<0:
    if c[i]<=0:
        print(-1)
        exit(0)
    plus+=c[i]
    i-=1
    ans+=1

print(ans)

Measured memory_bytes: 98336
n = int(input())
d,x = map(int,input().split())
a = [int(input()) for i in range(n)]
ans = len(a)
i = 1
while True:
    k = 1
    for a_ in a:
        if i*a_+1<=d:
            ans += 1
            k = 0
    if k:
        break
    i+=1
print(ans+x)

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

int d[10];

bool good_num(int n){
  while(n){
    if(d[n%10]) return false;
    n = n/10;
  }
  return true;
}

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

  for(int i=0;i<k;i++){
    int num;
    cin >> num;
    d[num] = 1;
  }

  while(!good_num(n)) n++;
  
  cout << n << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf=0x3f3f3f3f;
const int INF=2147483647;
const double pi=3.1415926535897932384626;
inline ll read(){
	ll x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-') f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	return x*f;
}
char ch;
int main(){
	cin>>ch;
	if(ch>='A'&&ch<='Z') printf("A\n");
	else printf("a\n");
	return 0;
}

Measured memory_bytes: 3620
// B - Five Dishes
#include <bits/stdc++.h>
using namespace std;

int main(){
	int time = 0, max_dif = 0;
	for(int i=0; i<5; ++i){
		int a; cin>>a;
		int dif = (a/10 + bool(a%10)) * 10 - a;
		if(max_dif<dif) max_dif = dif;
		time += a + dif;
	};
	cout<< time - max_dif <<endl;
}

Measured memory_bytes: 256
#include <iostream>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repr(i,a,n) for(int i=a;i>=n;i--)
#define INF 999999999
#define INF_M 2147483647
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;

int main() {
    string s;
    int ans = 0;
    while(cin >> s) {
        bool isans = true;
        rep(i,0,s.length() / 2 + 1) {
            if(s[i] != s[s.length() - 1 - i]) isans = false;
        }
        if(isans) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1184
/* In the name of Allah */
#include<bits/stdc++.h>
using namespace std;

const int N = 2e5 + 5, M = 2e3 + 5, P = 1e9 + 7;
int fact[M << 2] = {1}, rev[M << 2] = {1};
int n, a[N], b[N], dp[M << 1][M << 1];

inline int pwr(int a, int b) {
	int ans = 1;
	for ( ; b; a = 1LL * a * a % P, b >>= 1)
		ans = b & 1? 1LL * ans * a % P: ans;
	return ans;
}

inline int C(int a, int b) {
	return 1LL * fact[a] * rev[b] % P * rev[a - b] % P;
}

inline void read_input() {
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i] >> b[i];
}

inline void solve() {
	int ans = 0;
	for (int i = 0; i < n; i++)
		dp[M - a[i]][M - b[i]]++;
	for (int i = 1; i < M << 1; i++)
		for (int j = 1; j < M << 1; j++)
			(dp[i][j] += dp[i - 1][j] + dp[i][j - 1]) %= P;
	for (int i = 1; i < M << 2; i++)
		rev[i] = pwr(fact[i] = 1LL * fact[i - 1] * i % P, P - 2);
	for (int i = 0; i < n; i++)
		(ans += (dp[M + a[i]][M + b[i]] + P - C(a[i] + b[i] << 1, a[i] << 1)) % P) %= P;
	cout << 1LL * ans * rev[2] % P;
}

int main() {
	ios:: sync_with_stdio(0), cin.tie(0), cout.tie(0);
	read_input(), solve();
	return 0;
}


Measured memory_bytes: 64640
#include <bits/stdc++.h>
using namespace std;
int main(){
  long N,M;
  scanf("%lld%lld",&N,&M);
  vector <long> x(N);
  vector <long> y(N);
  vector <long> z(N);
  for(int i = 0;i<N;i++){
    scanf("%lld%lld%lld",&x[i],&y[i],&z[i]);
  }
  long anstemp;
  long ans = 0;
  vector <long> sum(N);
  int xx[] = {-1,1};
  int yy[] = {-1,1};
  int zz[] = {-1,1};
  for(int dx = 0;dx<=1;dx++){
    for(int dy = 0;dy<=1;dy++){
      for(int dz = 0;dz<=1;dz++){
        anstemp = 0;
        for(int gk = 0;gk<N;gk++){
          sum.at(gk) = xx[dx]*x.at(gk)+yy[dy]*y.at(gk)+zz[dz]*z.at(gk);
        }
        sort(sum.begin(),sum.end());
        for(int mem = N-1;mem>N-M-1;mem--){
          anstemp += sum.at(mem);
        }
        if(ans < anstemp){
          ans = anstemp;
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdlib.h>
using namespace std;
struct List{
    int key;
    List *prev, *next;
};
List *head;
void init(){
    head = (List *)malloc(sizeof(List));
    head->prev = head;
    head->next = head;
}
void insert(int key){
    List *x = (List *)malloc(sizeof(List));
    x->key = key;
    x->next = head->next;
    head->next->prev = x;
    head->next = x;
    x->prev = head;
}
List* searchList(int key){
    List *p = head->next;
    while(p != head && p->key != key){
        p = p->next;
    }
    return p;
}
void deleteList(List *t){
    if(t == head) return;
    t->prev->next = t->next;
    t->next->prev = t->prev;
    free(t);
}
void deleteKey(int key){
    deleteList(searchList(key));
}
void deleteFirst(){
    deleteList(head->next);
}
void deleteLast(){
    deleteList(head->prev);
}
void show(){
    List *p = head->next;
    int i = 0;
    while(p != head){
        if(i > 0) cout << " ";
        cout << p->key;
        p = p->next;
        i++;
    }
    cout << endl;
}
int main() {
    int n;
    string command;
    int x;

    init();

    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> command;
        if(command == "insert"){
            cin >> x;
            insert(x);
        }else if(command == "delete"){
            cin >> x;
            deleteKey(x);
        }else if(command == "deleteFirst") deleteFirst();
        else deleteLast();
    }
    show();
    return 0;
}

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

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define INF  numeric_limits<int>::max()
#define NINF numeric_limits<int>::min()

using namespace std;
using ll = long long;

using Edge = struct {
    bool is_valid = false;
    int  weight   = 0;
};

int graph_dfs(int                         vertex,
              const vector<vector<Edge>>& edge,
              vector<bool>&               reached_vertex) {
    if(accumulate(reached_vertex.begin(), reached_vertex.end(), 0) == (int)reached_vertex.size()) {
        return 1;
    }

    int ret = 0;
    REP(i, reached_vertex.size()) {
        if(reached_vertex[i] || !edge[vertex][i].is_valid) {
            continue;
        }

        reached_vertex[i] = true;
        ret += graph_dfs(i, edge, reached_vertex);
        reached_vertex[i] = false;
    }

    return ret;
}

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

    int N, M;
    std::cin >> N >> M;

    vector<vector<Edge>> edge(N, vector<Edge>(N, Edge()));
    vector<bool> reached_vertex(N, false);

    REP(i, M) {
        int a, b;
        std::cin >> a >> b;
        edge[a - 1][b - 1] = edge[b - 1][a - 1] = Edge{true, 1};
    }

    reached_vertex[0] = true;
    std::cout << graph_dfs(0, edge, reached_vertex) << std::endl;

    return 0;
}


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

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
inline int readInt() { int x; scanf("%d", &x); return x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
struct Edge {
    int to, cost;
    Edge(int to, int cost): to(to), cost(cost) {}
};

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<Edge>> AdjList;
AdjList graph;

const int INF = 100000000;



int GCD(int a, int b){
    if(a < b) swap(a, b);
    if(b == 0) return a;
    return GCD(b, a%b);
}

ll a[100010];

bool cmp(const pair<int, int> &a, const pair<int, int> &b){
    if(a.first == b.first) return a.second == b.second;
    return a.first < b.first;
}
vector<pair<int, int>> vp;
int arr[210];
int main() {
    //cout << fixed << setprecision(15);

   ll A, B , C, D; cin >> A >> B >> C >> D;


   ll cnt=0;
    A--;
   ll a1 = B/D;
   ll a2 = B/C;

   ll d = GCD(C, D);
   ll lcm = C/d*D;
   ll a3 = B/lcm;

   ll ans1 = B-(a1+a2-a3);

   ll b1 = A/D;
   ll b2 = A/C;
   ll b3 = A/lcm;

   ll ans2 = A-(b1+b2-b3);

   cout << ans1 - ans2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
#define MAX 10000

bool isprime[MAX + 1];
vector< int > prime;

int setprime(){
  for(int i = 2; i < MAX + 1; i++){
    if(!isprime[i]){
      for(int j = 2; i * j < MAX + 1; j++){
        isprime[i * j] = true;
      }
      prime.push_back(i);
    }
  }
}

int solve(int odd){ //累積和でやった方がいい気がするけどやらない
  int ret = 0;
  for(int i = 0; i < prime.size() ; i++){
    if(odd < prime[i]) break;
    int sum = 0;
    for(int j = i ; j <= prime.size() ; j++){
      sum += prime[j];
      if(sum >= odd){
        if(sum == odd) ret++;
        break;
      }
    }
  }
  return ret;
}

int main(){
  setprime();
  int n;
  while(cin >> n, n){
    cout << solve( n) << endl;
  }
}

Measured memory_bytes: 1236
h,w=map(int,input().split())
mine=[]
mine2=[['_']*(w+2)]
for i in range(h):
  s=input()
  line=[]
  for i in s:
    line.append(i)
  mine.append(line)
  line=['_']+line+['_']
  mine2.append(line)
mine2.append(['_']*(w+2))
#print(mine2)
num=[[0 for i in range(w)]for j in range(h)]
for i in range(1,h+1):
  for j in range(1,w+1):
    count=0
    if mine2[i][j]=='.':
      for a in range(-1,2):
        for b in range(-1,2):
          if mine2[i+a][j+b]=='#':
            count+=1
    num[i-1][j-1]=count
for i in range(h):
  for j in range(w):
    if mine[i][j]=='#':
      print('#',end='')
    else:
      print(num[i][j],end='')
  print()


Measured memory_bytes: 3572
N, M = map(int, input().split())
island = []
for i in range(M):
    island.append(list(map(int, input().split())))

for x in island:
    x.sort()
island.sort(key = lambda t: t[0], reverse = True)

ans = 0
broken = island[0][1]
for x in island:
    if x[0] <= broken < x[1]:
        pass
    else:
        ans += 1
        broken = x[0]
print(ans)

Measured memory_bytes: 29132
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <iomanip>
#define intt long long

int main(){
	intt N, K; std::cin >> N >> K;
	std::vector<intt> A(N);
	std::map<intt, intt> MAP;
	for (auto& r : A) {
		std::cin >> r;
		++MAP[r];
	}
	intt count = 0;
	for (auto& r : MAP)
		++count;
	if (count <= K) {
		std::cout << 0 << std::endl;
	}
	else {
		std::vector<intt> v;
		for (auto& r : MAP)
			v.push_back(r.second);
		std::sort(v.begin(), v.end());
		intt t = count - K;
		intt max = 0;
		for (auto& r : v) {
			max += r;
			--t;
			if (t == 0)
				break;
		}
		std::cout << max << std::endl;
	}

	return 0;
}

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

typedef long long ll;
int ara[60];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n,k,q;
    cin>>n>>k>>q;
    vector<ll>v(n,0);
    for(ll i=0; i<q; i++)
    {
        ll in;
        cin>>in;
        v[in-1]++;
    }
    for(ll i=0; i<n; i++)
    {
        if((k-q+v[i])<=0)
        {
            cout<<"No"<<endl;
        }
        else
        {
            cout<<"Yes"<<endl;
        }
    }
    return 0;
}

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


int main()
{
char a[4];
scanf("%s",&a);
if(a[0]==a[1]&&a[2]==a[3]&&a[0]!=a[2])printf("Yes");
else if(a[0]==a[2]&&a[1]==a[3]&&a[0]!=a[1])printf("Yes");
else if(a[0]==a[3]&&a[1]==a[2]&&a[0]!=a[1]) printf("Yes");
else printf("No");
return 0;

}
 

Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    
    String[] S = sc.nextLine().split(" ");
    int N = Integer.parseInt(S[0]);
    int M = Integer.parseInt(S[1]);
    
    int[] count = new int[M];
    for(int i = 0; i < N; i++){
      String[] T = sc.nextLine().split(" ");
      int K = Integer.parseInt(T[0]);
      for(int j = 1; j <= K; j++){
        int n = Integer.parseInt(T[j]);
        count[n-1]++;
      }
    }
    
    int ans = 0;
    for(int i = 0; i < M; i++){
      if(count[i] == N){
        ans++;
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 23124
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
using namespace std;

char s[15];

int main() 
{
	while(scanf("%s", s + 1) != EOF)
	{
		if(s[1] == 'Y' && s[2] == 'A' && s[3] == 'K' && s[4] == 'I')
			printf("Yes\n");
		else printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 128