akhauriyash/Code-Regression huggingface dataset:
/***********************
*  Author: xuziyuan    * 
***********************/

#include <bits/stdc++.h>

#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define replet(c) for(char c='a';c<='z';c++) 
#define LL long long
#define pii pair <int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair
#define sqr(a) ((a)*(a))

using namespace std;

const LL MOD=1e9+7;

struct NUM
{
	int sum,num[20];
}
dp[10010],now;
int n,m,x,co[]={0,2,5,5,4,5,6,3,7,6};
vector <int> v;

bool LESS(NUM a,NUM b)
{
	if(a.sum<b.sum) return true;
	if(a.sum>b.sum) return false;
	for(int i=9;i>0;i--)
	{
		if(a.num[i]<b.num[i]) return true;
		if(a.num[i]>b.num[i]) return false;
	}
	return false;
}

int main()
{
	cin>>n>>m;
	rep(i,m)
	{
		cin>>x;
		v.pb(x);
	}
	repn(i,10005) dp[i].sum=-1;
	rep(i,n-1)
	{
		if(dp[i].sum==-1) continue;
		rep(j,m)
		{
			if(i+co[v[j]]>n) continue;
			now=dp[i];
			now.sum++;
			now.num[v[j]]++;
			if(LESS(dp[i+co[v[j]]],now)) dp[i+co[v[j]]]=now;
		}
	}
	for(int i=9;i>0;i--) rep(j,dp[n].num[i]) cout<<i;
	cout<<endl;
	rt0;
}

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

#define infile "../test/sample-1.in"
#define int long long
// #define INF 2147483647
#define INF 1000000000000000000LL
#define MOD 1000000007LL

// {{{ define basic macro
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)(b-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)

#define foreach(x,a) for(auto& (x) : (a) )
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)

#define all(x) (x).begin(),(x).end()
#define sum(v) accumulate(all(v), 0)
#define sz(x) ((int)(x).size())
template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }
// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
#define fill(x,y) memset(x,y,sizeof(x))
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ten(n) ((int)1e##n)

template <class T = int>
T in() {T x; cin>>x; return (x);}

struct Fast {
  Fast(){
    std::cin.tie(0);
    ios::sync_with_stdio(false);
  }
} fast;
// }}}
//{{{ dump macro
#ifdef PCM
  #include "dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}
//{{{ others
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;
template<typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;

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


int solve(){
  int h,w;cin>>h>>w;
  char m[h][w]; rep(i, h){ rep(j, w){ cin>>m[i][j]; } }

  int b[h]={};
  rep(i, h){
    bool flag = true;
    rep(j, w){
      if (m[i][j]=='#'){
        flag = false;
        break;
      };
    }
    b[i] = flag;
  }
  int c[w]={};
  rep(j, w){
    bool flag = true;
    rep(i, h){
      if (m[i][j]=='#'){
        flag = false;
        break;
      };
    }
    c[j] = flag;
  }
  dump_1d(b, h);
  dump_1d(c, w);
  rep(i, h){
    rep(j, w){
      if (b[i]==0 and c[j]==0) cout << m[i][j];
    }
    if (b[i]==0) cout << endl;
  }

  return 0;
}

int test(){ //{{{
  return 0;
}
//}}}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
#ifdef PCM
  test();
#endif
  solve();
  return 0;
} //}}}


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

using namespace std;

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

#define INF 2<<29
#define F first
#define S second

int main(){
  int x,a,b;
  scanf("%d %d %d",&x,&a,&b);
  if(abs(x-a)<abs(x-b)){
    printf("A\n");
  }else{
    printf("B\n");
  }
	       
  return (0);
}

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

const int MAX_N = 2e5+10;
int n;
int a[MAX_N];
map<int,int> cnt;

void solve()
{
	// a(i) not divisible by other numbers
	sort(a, a+n);
	for(int i=0;i<n;++i)cnt[a[i]]++;
	set<int> seen;
	int ans = n;
	for(int i=0;i<n;++i){
		ll x = a[i];
		bool f = false;
		if(cnt[x] == 1){
			for(ll y=1; y*y<=x; ++y)if(x % y == 0){
				if(seen.count(y) || seen.count(x/y)){
					f=true;
					break;
				}
			}
		}else f=true;
		seen.insert(a[i]);
		if(f) ans--;
	}
	cout << ans << '\n';
}

int main()
{
	cin >> n;
	for(int i=0;i<n;++i) cin >> a[i];
	solve();
	return 0;
}

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

public class Main {
	static BufferedReader br;
	static int cin() throws Exception
	{
		return Integer.valueOf(br.readLine());
	}
	static int[] split() throws Exception
	{
		String[] cmd=br.readLine().split(" ");
		int[] ans=new int[cmd.length];
		for(int i=0;i<cmd.length;i++)
		{
			ans[i]=Integer.valueOf(cmd[i]);
		}
		return ans;
	}
	static long[] splitL() throws IOException
	{
		String[] cmd=br.readLine().split(" ");
		long[] ans=new long[cmd.length];
		for(int i=0;i<cmd.length;i++)
		{
			ans[i]=Long.valueOf(cmd[i]);
		}
		return ans;
	}
	static long mod=1000000007;
	static ArrayList<Integer>[] gr;
	static int[] vis;
	static long[][]dp;
	static long dfs(int node,int col)
	{
		if(dp[node][col]!=-1)
			return dp[node][col];
		long res=1;
		for(int i=0;i<gr[node].size();i++)
		{
			int y=gr[node].get(i);
			if(vis[y]!=0)
				continue;
			vis[y]=1;
			if(col==0)
			{
				res=(res*(dfs(y,1)+dfs(y,0)))%mod;
			}
			else
				res=(res*dfs(y,0))%mod;
			vis[y]=0;
		}
		dp[node][col]=res;
		return res;
	}
	public static void main(String[] args) throws Exception{
		// TODO Auto-generated method stub
		br=new BufferedReader(new InputStreamReader(System.in));
		int n=cin();
		gr=new ArrayList[n+1];
		for(int i=0;i<=n;i++)
		{
			gr[i]=new ArrayList<>();
		}
		for(int i=0;i<n-1;i++)
		{
			int[]ar=split();
			int x=ar[0];
			int y=ar[1];
			gr[x].add(y);
			gr[y].add(x);
		}
		vis=new int[n+1];
		dp=new long[n+1][2];
		for(int i=0;i<=n;i++)
		{
			Arrays.fill(dp[i], -1);
		}
		vis[1]=1;
		long a=dfs(1,0);
		vis=new int[n+1];
		vis[1]=1;
		dp=new long[n+1][2];
		for(int i=0;i<=n;i++)
		{
			Arrays.fill(dp[i], -1);
		}
		long b=dfs(1,1);
//		System.out.println(a+" "+b);
		System.out.println((a+b)%mod);
	}
}


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

typedef double db;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef complex<double> com;

#define endl '\n'
#define eb emplace_back
#define pb push_back
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define unique_sort(x) (sort(x.begin(), x.end()), x.resize(distance(x.begin(), unique(x.begin(), x.end()))))
#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define dbg(x) cout << #x << " = " << x << '\n'
#define dbg2(x,y) cout<<#x<<" = "<<x<<" & "<<#y<<" = "<<y<<endl;

void test()
{
	ll n,k,r;
	cin>>n>>k;

	r=n%k;

	cout<<min(r,k-r);
}

int main()
{   
fast_io();
cout << fixed << setprecision(15);
int t = 1;

//cin>>t;

for(int i = 0; i < t; i++)
{
	test();
}
return 0;
}

Measured memory_bytes: 256
x,y = map(int, input().split())

group1 = [1,3,5,7,8,10,12]
group2 = [4,6,9,11]
group3 = [2]

if ((x in group1 and y in group1) or
   (x in group2 and y in group2) or
   (x in group3 and y in group3)):
      print('Yes')
else:
  print('No')

Measured memory_bytes: 3064
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(I, a, b) for (int i = (a); i < (b); ++i)
using namespace std;
using ll = long long;

int main() {
  ll a,b;
  cin >> a >> b;
 
  REP(i,3){
    if(i+1 != a && i+1 != b){
      cout << i+1 << endl;
      return 0;
    }
  }

  
}

Measured memory_bytes: 3520
#include <string>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <cmath>
#include <limits>
#include <tuple>
#include <queue>
#include <stack>

using namespace std;
typedef long long ll;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()

int main()
{
	int N, K;
	cin >> N >> K;
	vector<int> A(N);
	rep(i, N) {
		cin >> A[i];
	}
	int ans = 0;
	N -= K;
	ans++;
	while (N > 0) {
		N -= (K - 1);
		ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640
/*
  Motto - try hard to become an expert
*/
#include <bits/stdc++.h>
#include <map>
#include <algorithm>
#include <vector>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <chrono>
#include <thread>
#include <iomanip>
 
//define
#define rep(i,n)    for(int i=0;i<n;i++)
#define repu(i,k,n) for(int i=k;i<=n;i++)
#define repd(i,k,n) for(int i=k;i>=n;i--)
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define INF (int)INT_MAX
#define all(v)  v.begin(), v.end()
#define endl "\n"
 
//typedef
typedef long long int ll;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::vector<int> vi;
typedef std::vector< pii > vii;
typedef std::vector< ll > vll;
typedef std::vector< std::pair < pii, int > > vpp;
 
const int N = 3*1e5 +5 ;
const long long MOD = 998244353;
const long long inf = 1e18;
 
using namespace std;
 
ll MAXN=100001;
ll spf[100001]; 
 
ll modpow(ll x,ll n){
    ll res=1;
    while(n>0){
        if(n&1) res=res*x%MOD;
        x=x*x%MOD;
        n>>=1;
    }
    return res;
}
 
ll modFact(ll n, ll p) 
{ 
    if (n >= p) 
        return 0; 
  
    ll result = 1; 
    for (ll i = 1; i <= n; i++) 
        result = (result * i) % p; 
  
    return result;  
} 
 
bool isPrime(int x)
{
    if(x%2==0)
        return 0;
    for(int i=3;i<=sqrt(x);i+=2)
    {
        if(x%i==0)
            return 0;
    }
    return 1;
}
 

 
void solve()
{
	int n ; 
	cin>>n ;
	int a[n]  , b[n]  ,c[n-1] ;
	rep(i , n){
		cin>>a[i] ;
		a[i]--;
	}
	rep(i , n){
		cin>>b[i] ;
	}
	rep(i , n-1){
		cin>>c[i] ;
	}
	int ans  = 0 ;
	ans += b[a[0]] ;
	int pre = a[0] ;
	repu(i ,1,n-1){
		ans += b[a[i]] ;
		if(pre+1==a[i]){
			ans += c[pre] ;
		}
		pre = a[i] ;
	}
	cout<<ans<<endl;
}
 
int main() {
    // #ifndef ONLINE_JUDGE
    //     // for getting input from input.txt
    //     freopen("input.txt", "r", stdin);
    //     // for writing output to output.txt
    //     freopen("output.txt", "w", stdout);
    // #endif
    
    // ios_base::sync_with_stdio(0);
    // cin.tie(NULL);
    int t = 1;
    // cin>>t;
    while(t--)
    {
        solve();
    } 
    // cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

const LL mod = 1000000007;

// ユークリッドの互除法
LL extgcd(LL a, LL b, LL& x, LL& y)
{
	LL g = a; x = 1; y = 0;
	if (b != 0)
	{
		g = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	return g;
}

// 逆元
LL mod_inverse(LL a, LL m)
{
	LL x, y;
	extgcd(a, m, x, y);
	return (m + x % m) % m;
}

// 階乗
std::vector<LL>fact;
void mod_fact(LL n, LL m)
{
	fact.resize(n + 1);
	fact[0] = 1;
	for (LL i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i % m;
}

// nCk mod p
LL mod_comb(LL n, LL k, LL m)
{
	if (n < k) return 0;
	return fact[n] * mod_inverse(fact[k] * fact[n - k] % m, m) % m;
}

int main()
{
	LL X, Y;
	in >> X >> Y;

	if ((X + Y) % 3 != 0)
	{
		out << 0 << std::endl;
		return 0;
	}

	LL n = (X + Y) / 3, k = -1;
	if (n % 2 == std::abs(X - Y) % 2) k = (n - std::abs(X - Y)) / 2;

	if (k < 0) out << 0 << std::endl;
	else
	{
		mod_fact(n, mod);
		out << mod_comb(n, k, mod) << std::endl;
	}
}


Measured memory_bytes: 5504
N = int(input())
musics,minutes=[],[]

for i in range(N):
    music,minute = list(map(str, input().split()))
    musics.append(music)
    minutes.append(int(minute))

X = str(input())

Xidx=musics.index(X)
print(sum(minutes[Xidx+1:]))


Measured memory_bytes: 3060
using System;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using static System.Math;
using Debug = System.Diagnostics.Debug;


static class P
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        var a = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var accum = new long[n + 1];
        long res = long.MaxValue;
        for (int i = 0; i < a.Length; i++) accum[i + 1] = accum[i] + a[i];
        for (int i = 2; i <= n - 2; i++)
        {
            int valid, invalid;
            valid = 0;
            invalid = i;
            while (invalid - valid > 1)
            {
                var mid = (valid + invalid) / 2;
                if (accum[mid] * 2 < accum[i]) valid = mid;
                else invalid = mid;
            }
            var separator1 = valid;
            var separator2 = i;

            valid = i;
            invalid = n;
            while (invalid - valid > 1)
            {
                var mid = (valid + invalid) / 2;
                if ((accum[mid] - accum[i]) * 2 < (accum[n] - accum[i])) valid = mid;
                else invalid = mid;
            }
            var separator3 = valid;

            res = Min(res, CalcScore(accum, separator1, separator2, separator3));
            res = Min(res, CalcScore(accum, separator1 + 1, separator2, separator3));
            res = Min(res, CalcScore(accum, separator1, separator2, separator3 + 1));
            res = Min(res, CalcScore(accum, separator1 + 1, separator2, separator3 + 1));
        }
        Console.WriteLine(res);
    }

    static long CalcScore(long[] accum, int s1, int s2, int s3)
    {
        if (0 >= s1 || s1 >= s2 || s2 >= s3 || s3 >= accum.Length - 1) return long.MaxValue;
        var scores = new long[] { accum[s1], accum[s2] - accum[s1], accum[s3] - accum[s2], accum.Last() - accum[s3] };
        return scores.Max() - scores.Min();
    }
}


Measured memory_bytes: 33500
//
// Created by yamunaku on 2019/11/05.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> mti;
typedef vector<ll> vl;
typedef vector<vector<ll>> mtl;

int main(){
    int n, m;
    cin >> n >> m;
    vi dp(1 << n, IINF);
    dp[0] = 0;
    int a, b, x;
    rep(i, m){
        cin >> a >> b;
        int tmp = 0;
        rep(j, b){
            cin >> x;
            tmp |= (1 << (x - 1));
        }
        dp[tmp] = min(dp[tmp], a);
    }
    rep(i, n){
        per(j, 1 << n){
            if(j & (1 << i));
            else dp[j] = min(dp[j], dp[j ^ (1 << i)]);
        }
    }
    rep(i, 1 << n){
        rep(j, 1 << n){
            if(((1 << n) - i) & j);
            else{
                dp[i] = min(dp[i], dp[j] + dp[i ^ j]);
            }
        }
    }
    if(dp[(1 << n) - 1] == IINF) cout << -1 << endl;
    else cout << dp[(1 << n) - 1] << endl;
    return 0;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

class SCC {
public:
	static const int MV = 2025000;
	vector<vector<int> > SC; int NV,GR[MV];
private:
	vector<int> E[MV], RE[MV], NUM; int vis[MV];
public:
	void init(int NV) { this->NV=NV; for(int i=0;i<NV;i++) { E[i].clear(); RE[i].clear();}}
	void add_edge(int x,int y) { E[x].push_back(y); RE[y].push_back(x); }
	void dfs(int cu) { vis[cu]=1; for(int i=0;i<E[cu].size();i++) if(!vis[E[cu][i]]) dfs(E[cu][i]); NUM.push_back(cu); }
	void revdfs(int cu, int ind) { int i; vis[cu]=1; GR[cu]=ind; SC[ind].push_back(cu);
		FOR(i,RE[cu].size()) if(!vis[RE[cu][i]]) revdfs(RE[cu][i],ind);}
	void scc() {
		int c=0,i; SC.clear(); SC.resize(NV); NUM.clear();
		assert(NV);
		FOR(i,NV) vis[i]=0; FOR(i,NV) if(!vis[i]) dfs(i); FOR(i,NV) vis[i]=0;
		for(int i=NUM.size()-1;i>=0;i--) if(!vis[NUM[i]]){
			SC[c].clear(); revdfs(NUM[i],c); sort(SC[c].begin(),SC[c].end()); c++;
		}
		SC.resize(c);
	}
};

class TwoSat {
	int NV;
	SCC sc;
public:
	vector<int> val;
	void init(int NV) { this->NV=NV*2; sc.init(NV*2); val.resize(NV);}
	void add_edge(int x,int y) { // k+0:normal k+NV:inverse
		sc.add_edge((x+NV/2)%NV,y);
		sc.add_edge((y+NV/2)%NV,x);
	}
	bool sat() { // empty:false 
		sc.scc();
		for(int i=0;i<NV/2;i++) if(sc.GR[i]==sc.GR[i+NV/2]) return false;
		for(int i=0;i<NV/2;i++) val[i]=sc.GR[i]>sc.GR[i+NV/2];
		return true;
	}
};

int N,D;
int X[1010],Y[1010];
TwoSat ts;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>D;
	ts.init(N);
	FOR(i,N) cin>>X[i]>>Y[i];
	FOR(y,N) FOR(x,y) {
		if(abs(X[x]-X[y])<D) ts.add_edge(x+N,y+N);
		if(abs(Y[x]-Y[y])<D) ts.add_edge(x,y);
		if(abs(X[x]-Y[y])<D) ts.add_edge(x+N,y);
		if(abs(Y[x]-X[y])<D) ts.add_edge(x,y+N);
	}
	if(ts.sat()) {
		cout<<"Yes"<<endl;
		FOR(i,N) {
			if(ts.val[i]) cout<<X[i]<<endl;
			else cout<<Y[i]<<endl;
		}
	}
	else {
		cout<<"No"<<endl;
	}
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 98716
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <map>
#define rep(i,n) for(int i=0; i<n; i++)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const ll mod=1e9+7;

int main(){
	ll N,K;
	cin >> N >> K;

	ll ans=1;
	ll bb=-1;
	for(ll j=1; j<K; j++){
		bb+=2*j;
	}
	for(ll i=K; i<N+1; i++){
		// cout << "i" << i << endl;
		ans += N*i;
		ans %= mod;
		// cout << ans << endl;
		ans-=bb;
		ans%=mod;
		bb+=2*i;
	}
		if(ans<0) ans+=mod;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3636
// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        input_inner!{$s, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, bytes) => {
        read_value!($iter, String).into_bytes()
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($exp_input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                let start = std::time::Instant::now();
                let input = solve($exp_input);
                let end = start.elapsed();
                assert_eq!(input, $output, "{}.{:03}", end.as_secs(), end.subsec_millis());
                assert!(end.as_secs() <= 2, "expected_sec: {}sec, actual_sec: {}sec", 2, end.as_secs());
                assert!(end.as_secs() <= 1, "expected_sec: {}sec, actual_sec: {}sec", 1, end.as_secs());
                assert!(end.subsec_millis() <= 10, "expected_ms: {}ms, actual_ms: {}ms", 10, end.subsec_millis());
                assert!(end.subsec_millis() <= 2, "expected_ms: {}ms, actual_ms: {}ms", 2, end.subsec_millis());
            )*
        }
    };
}

test! {
r#"5
2 6 1 4 5"# => r#"YES"#,

r#"6
4 1 3 1 6 2"# => r#"NO"#,
}

fn solve(src: &str) -> String {
    let mut src_iter = src.split_whitespace();
    input! {
        source = src_iter,
        n: usize,
        mut a: [usize; n],
    }

    a.sort();
    a.dedup();

    if n == a.len() {
        "YES"
    } else {
        "NO"
    }.to_string()
}

Measured memory_bytes: 8444
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define pli pair<ll, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
// int mod = 998244353;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template<typename T, typename U> T pow_(T a, U b) { return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { a += b % mod; if (a >= mod) a -= mod; }
template<class T> void operator += (vector<T>& v, vector<T> v2) { rep(i, sz(v2)) v.eb(v2[i]); }

void solve();

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(12); // debuged
  int T;
  T = 1;
  while (T--) solve();
}

const int MAX = 2000005;
ll fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}
// 二項係数計算
ll COM(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

void solve() {
  int k;
  string s;
  cin >> k >> s;

  int sz = k + sz(s);

  ll ans = 0;
  COMinit();
  rep3(i, sz(s), sz + 1) add(ans, COM(sz, i) * modpow(25, sz - i, mod) % mod);
  cout << ans << endl;
}


Measured memory_bytes: 51236
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>

using namespace std;

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

    int beg = 0, end = n;
    cout << beg << endl;
    string begans;
    cin >> begans;
    if (begans == "Vacant") {
        exit(0);
    }
    string endans = begans;
    int cur = 0;

    for (int nqueries = 1; nqueries < 20; nqueries++) {
        //printf("%d..%d\n", beg, end);
        cur = (end - beg) / 2 + beg;
        cout << cur << endl;
        string ans;
        cin >> ans;
        if (ans == "Vacant")
            break;
        if (begans == ans) {
            if ((cur - beg) % 2 == 1) {
                end = cur;
                endans = ans;
            } else {
                beg = cur;
                begans = ans;
            }
        } else {
            if ((cur - beg) % 2 == 1) {
                beg = cur;
                begans = ans;
            } else {
                end = cur;
                endans = ans;
            }
        }
    }
    exit(0);
}


Measured memory_bytes: 852
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();
		int ans = 0;
		for(int i = 0; i < s.length(); i++) {
			if(s.charAt(i) != t.charAt(i)) {
				ans++;
			}
		}
		System.out.println(ans);
		sc.close();
	}

}

Measured memory_bytes: 42568
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
#ifdef LOCAL_TEST
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif
    int n;
    cin >> n;
    vl c(n-1), s(n-1), f(n-1);
    rep(i, n-1) cin >> c[i] >> s[i] >> f[i];
    if(n == 1) {
        cout << 0 << endl;
        return 0;
    }
    rep(i, n) {
        ll t = 0;
        REP(j, i, n-1) {
            t = max(t, s[j]);
            t = (t+f[j]-1)/f[j]*f[j];
            t += c[j];
        }
        cout << t << endl;
    }
    return 0;
}

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

int main() {
  int N, H, W;
  cin >> N >> H >> W;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    int a, b;
    cin >> a >> b;
    if (H <= a && W <= b) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstring>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
using namespace std;

int main() {
  double a, b;
  cin >> a >> b;
  double taxa, taxb;
  for (int price = 1; price <= 1050; price++) {
    taxa = floor(price * 0.08);
    taxb = floor(price * 0.1);
    // cout << taxa << " " << taxb << endl;

    if (a == taxa && b == taxb) {
      printf("%d", price);
      goto end;
    }
  }
  cout << -1;
end:
  return 0;
}


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

int main() {
  int n, k; cin >> n >> k;
  vector<int> p(n);
  rep(i,n) cin >> p[i];
  rep(i,n) p[i]++;
  queue<int> q;
  int sum = 0;
  int mx = 0;
  rep(i,n) {
    sum += p[i];
    q.push(p[i]);
    if (q.size() > k) {
      sum -= q.front(); q.pop();
    }
    if (q.size() == k) {
      mx = max(mx, sum);
    }
  }
  double ans = mx;
  ans /= 2;
  printf("%.10f\n", ans);
  return 0;
}

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

using namespace std;

#define ll long long
#define rep(i,n) for(int i=1;i<=(n);i++)
#define rep0(i,n) for(int i=0;i<(n);i++)

const ll INF=1e9+7;
ll n,g,ans,a[100001],anss;
int main()
{
	/*freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);*/
	cin>>n;
	rep(i,n){
		cin>>a[i];
	}
	if(a[1]>0){
		g=a[1];
		for(int i=2;i<=n;i++){
			if(g>0){
				g+=a[i];
				if(g>-1){
					ans+=g+1;
					g=-1;
				}
			}
			else{
				g+=a[i];
				if(g<1){
					ans+=1-g;
					g=1;
				}
			}
		}
		anss+=a[1]+1;
		g=-1;
		for(int i=2;i<=n;i++){
			if(g>0){
				g+=a[i];
				if(g>-1){
					anss+=g+1;
					g=-1;
				}
			}
			else{
				g+=a[i];
				if(g<1){
					anss+=1-g;
					g=1;
				}
			}
		}
		cout<<min(ans,anss);
	}
	else if(a[1]<0){
		g=a[1];
		for(int i=2;i<=n;i++){
			if(g>0){
				g+=a[i];
				if(g>-1){
					ans+=g+1;
					g=-1;
				}
			}
			else{
				g+=a[i];
				if(g<1){
					ans+=1-g;
					g=1;
				}
			}
		}
		anss+=1-a[1];
		g=1;
		for(int i=2;i<=n;i++){
			if(g>0){
				g+=a[i];
				if(g>-1){
					anss+=g+1;
					g=-1;
				}
			}
			else{
				g+=a[i];
				if(g<1){
					anss+=1-g;
					g=1;
				}
			}
		}
		cout<<min(ans,anss);
	}
	else{
		ans=1;
		g=1;
		for(int i=2;i<=n;i++){
			if(g>0){
				g+=a[i];
				if(g>-1){
					ans+=g+1;
					g=-1;
				}
			}
			else{
				g+=a[i];
				if(g<1){
					ans+=1-g;
					g=1;
				}
			}
		}
		anss=1;
		g=-1;
		for(int i=2;i<=n;i++){
			if(g>0){
				g+=a[i];
				if(g>-1){
					anss+=g+1;
					g=-1;
				}
			}
			else{
				g+=a[i];
				if(g<1){
					anss+=1-g;
					g=1;
				}
			}
		}
		cout<<min(ans,anss);
	}
	return 0;
}

Measured memory_bytes: 1024
import math
def facts(n):
    ans = []
    for  i in range(1, int(math.sqrt(n)+1)):
        if(n%i==0):
            ans.append(i)
            ans.append(n//i)
    ans = sorted(list(dict.fromkeys(ans)))
    if(ans[-1]==n):
        ans = ans[:-1]
    return ans

x,y = map(int, input().split())
ok = False
for i in range(x+1):
    if((x-i)*4 == y-(i*2)):
        ok  =True
        break
if(ok):
    print('Yes')
else:
    print('No')

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

int main() {
    long long A, B, C, K;
    cin >> A >> B >> C >> K;
    if (K < A) cout << K << endl;
    else if (K <= A + B) cout << A << endl;
    else if (K > A + B) cout << A - (K - A - B) << endl;

    return 0;
}

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

char binary_search(int T, int S[], int n){
  int left = 0;
  int right = n;
  while(left < right){
    int mid = (left + right) / 2;
    if(S[mid] == T){
      return 1;
    }
    else if(S[mid] < T){
      left = mid + 1;
    }
    else{
      right = mid;
    }
  }
  return 0;
}

int main(){
  int n;
  scanf("%d",&n);
  int S[100000];
  for(int i=0; i<n; i++){
    scanf("%d",&S[i]);
  }

  int q;
  scanf("%d",&q);
  int T[50000];
  for(int i=0; i<q; i++){
    scanf("%d",&T[i]);
  }

  int counter = 0;
  for(int i=0; i<q; i++){
    counter += binary_search(T[i], S, n);
  }

  printf("%d\n", counter);

  return 0;
}



Measured memory_bytes: 3724
INF = 2 ** 31 - 1


class SegmentTree:
    """
    参考: https://www.creativ.xyz/segment-tree-abstraction-979/
    """
    n = 1
    data = None  # データ
    def_ = None  # 初期値かつ単位元

    def __init__(self, n, _def=INF, _operation=min, _update=lambda x, y: y):
        """
        _def は イミュータブルな値を想定
        """
        self.n = 1
        while self.n < n:
            self.n *= 2
        self.data = [INF for _ in range(self.n * 2 - 1)]

        self.operation = _operation
        self.update = _update
        self.def_ = _def

    def change(self, i, x):
        i += self.n - 1
        self.data[i] = self.update(self.data[i], x)
        while i > 0:
            i = (i - 1) // 2
            self.data[i] = self.operation(self.data[i * 2 + 1], self.data[i * 2 + 2])

    def _query(self, a, b, k, l, r):
        """
        区間 [a,b) のクエリ, コール時はノード k=[l, r) に着目. (蟻本 p.155)
        """
        # print(a, b, k, l, r)
        if r <= a or b <= l: return self.def_

        # 完全に内包
        if a <= l and r <= b: return self.data[k]

        vl = self._query(a, b, k * 2 + 1, l, (l + r) // 2)  # 左の子
        vr = self._query(a, b, k * 2 + 2, (l + r) // 2, r)  # 右の子
        return self.operation(vl, vr)

    def query(self, a, b):
        """
        [a, b) 区間のクエリ
        """
        return self._query(a, b, 0, 0, self.n)

    def get(self, i):
        """
        添字アクセスの代わり
        """
        return self.data[i + self.n - 1]


n, q = [int(_) for _ in input().split()]
seg_t = SegmentTree(n)
for i in range(q):
    c, x, y = [int(_) for _ in input().split()]
    if c == 0:
        seg_t.change(x, y)
    else:
        print(seg_t.query(x, y + 1))
    # print(seg_t.data)



Measured memory_bytes: 9004
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using boost::multiprecision::cpp_int;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ll,pair<ll, ll>> lpll;
typedef pair<ll, int> pli;
typedef pair<int, int> pii;

#define deg_to_rad(deg) (((deg)/360)*2*PI)

const ll LINF = LLONG_MAX;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;

const ld PI = (acos(-1));
const ld EPS = 0.0000000001;
// cout << fixed << setprecision(10) << middle << endl;

int main() {
    // input, ready
    int X,N;
    cin >> X >> N;
    vector<int> p(102,0);
    for (int i=0; i<N; i++) {
        int j;
        cin >> j;
        p[j] = 1;;
    }

    int memoplus,memominus;
    for (int i=X; i<=101; i++) {
        if (p[i]==0) {
            memoplus=i;
            break;
        }
    }
    for (int i=X; i>=0; i--) {
        if (p[i]==0) {
            memominus=i;
            break;
        }
    }

    // output
    if (abs(X-memoplus) < abs(X-memominus)) cout << memoplus << endl;
    else cout << memominus << endl;    

    return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include<vector>
#include<algorithm>
#include<numeric>
using namespace std;
const long long inf=(1<<20);

long long a[inf];
long long cnt[inf];
int main(void){
    int n;
    cin>>n;
    for(int i=0;i<=n;i++){
        cin>>a[i];
    }
    cnt[0]=a[0];
    int l=1;
    for(int i=1;i<n;i++){
        if(cnt[l-1]<a[i]){
            cnt[l++]=a[i];
        }
        else{
            *lower_bound(cnt,cnt+l,a[i])=a[i];
        }
    }
    
    cout<<l<<endl;

    return 0;
}



Measured memory_bytes: 4568
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
const ll mod=1e9+7;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int a,b;
    cin>>a>>b;
    if(a==max(a,b)){
       cout<<a+max(a-1,b)<<endl;
    }
    else{
        cout<<b+max(b-1,a)<<endl;
    }
    return 0;
    }


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

int main(){

    string s = "CODEFESTIVAL2016";
    string t; cin >> t;
    int ans = 0;
    
    for(int i = 0; i < 16; i++){
        ans += (s[i] != t[i]);
    }

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

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(void) {
	int D[1001][1001] = {};
	string s1, s2;
	cin >> s1 >> s2;

	for (int i = 0; i <= s1.length(); i++) {
		for (int j = 0; j <= s2.length(); j++) {
			if (i + j == 0)
				continue;
			else if (i == 0)
				D[i][j] = D[i][j - 1];
			else if (j == 0)
				D[i][j] = D[i - 1][j];
			else
				D[i][j] = min(D[i - 1][j - 1] + ((s1.at(i - 1) != s2.at(j - 1)) ? 1 : 0), min(D[i - 1][j] + 1, D[i][j - 1] + 1));

			if(i == 0 || j == 0) D[i][j]++;
		}
	}
	cout << D[s1.length()][s2.length()] << endl;
}

Measured memory_bytes: 5112
#include<stdio.h>

int main(void){

  int b[2];
  int coin=0;
  scanf("%d%d",&b[0],&b[1]);


  if(b[0]>=b[1]+1){
    coin+=(b[0]*2)-1;
  }else if(b[1]>=b[0]+1){
    coin+=(b[1]*2)-1;
  }else{
    coin+=(b[1]*2);
  }

  printf("%d",coin);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<algorithm>
#define pb push_back
#define ll long long
#define ld long double
#define f first
#define s second

using namespace std;
const int N = 1e5 + 5;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int x, n; cin >> x >> n;
    set<int> a;
    for(int i = 0; i < n; i++)
    {
        int b; cin >> b;
        a.insert(b);
    }
    int ans = 1e9;
    for(int i = -1000; i <= 1000; i++)
    {
        if(a.count(i))continue;
        ans = min(ans, abs(x - i));
    }
    if(a.count(x - ans))cout << x + ans;
    else cout << x - ans;
    return 0;
}




Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int64_t A,B,N,x,y;
  cin>>N>>A>>B;
  x=N/(A+B);
  y=N%(A+B);
  if(y>A)y=A;
  cout<<A*x+y<<endl;
}

Measured memory_bytes: 256
#106

#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
using namespace std;
int main(){
  int N;
  cin >> N;

  int count = 0;
  int ans = 0;
  for(int i = 1; i <= N; i++)
  {
    /* code */ 
    for(int j = 1; j <= i; j++)
    {
      /* code */
      if(i % j  == 0){
        count++;
      }
    }
    if(count == 8 && i % 2 != 0){
      ans++;
    }
    count = 0;
  }
  cout << ans << endl;
  
}


Measured memory_bytes: 256
//I read the news today, oh boy
//About a lucky man who made the grade
 
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(x) ll((x).size())
#define all(v) (v).begin(),(v).end()
#define trace(x) cerr << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define For(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
#define roF(i,a,b) for(ll i = ll(a); i >= ll(b); i--)
using namespace std;

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;

const ll N=1e6;

ll v[N];

int main(){
	fastio;
	int n; cin>>n;
	map<ll,ll> S[2];
	For(i,0,n){
		cin>>v[i];
		S[i&1][v[i]]++;
	}
	int ans = 0;
	if(S[0].size()==1 && S[1].size()==1 && (*S[0].begin()!=*S[1].begin())) ans = 0;
	else{
		if(S[0].size()==1 && S[1].size()==1){
			ans = n/2;
		}else if(S[0].size()==1){
			ll may=0;
			for(auto x: S[1]){
				if(x.ff!=(*S[0].begin()).ff) may = max(x.ss,may);
			}
			ans = n/2-may;
		}else if(S[1].size()==1){
			ll may=0;
			for(auto x: S[0]){
				if(x.ff!=(*S[1].begin()).ff) may = max(x.ss,may);
			}
			ans = n/2-may;
		}else{
			ii best1 = mp(0,0), best2 = mp(0,0);
			for(auto x: S[0]) if(x.ss>best1.ss) best1=x;
			for(auto x: S[1]) if(x.ss>best2.ss) best2=x;
			if(best1.ff!=best2.ff) ans = n - (best1.ss+best2.ss);
			else{
				ii secondbest1 = mp(0,0), secondbest2 = mp(0,0);
				for(auto x: S[0]) if(x.ff!=best1.ff && x.ss>secondbest1.ss)
					secondbest1 = x;
				for(auto x: S[1]) if(x.ff!=best2.ff && x.ss>secondbest2.ss)
					secondbest2 = x;
				ans = n - max(best1.ss+secondbest2.ss,best2.ss+secondbest1.ss);
			}
		}
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 10636
#  ICPC ??????????¨???????????????§??¢

while true
  n = gets.to_i

  break if n == 0

  points = []

  n.times do
    points << gets.to_i
  end

  points.sort!
  points.shift
  points.pop

  ave = points.inject(:+) / points.size
  puts ave.ceil
end

Measured memory_bytes: 6096
x = int(input())
import sys
sys.setrecursionlimit(4000)

import math
p = math.log(1.01, 10)
q = int(math.log(x/100, 10)/p)


def f(n):
  if n == 1:
    return 101
  else:
    return int(f(n-1)*1.01)
n = q
while f(n) < x:
  n += 1
else:
  print(n)

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

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
//using P = pair<int,int>;
//pow(x,n)
//cout << fixed << setprecision(桁数);
//string = to_string(数値)
//int = stoi(文字列)
//(int)(char-'0')
//string = itoa(int)
//円周率: M_PI


int main() {
    int n,k; cin>>n>>k;
    vector<int> h(n+1);
    vector<ll> sum(n+1, INF);
    rep(i,n) cin>>h[i+1];
    sum[0]=0; sum[1]=0;
    for(int i=1;i<=n;++i){
        for(int j=1;j<=k;++j){
            if(i-j<1) continue;
            chmin(sum[i],sum[i-j]+abs(h[i]-h[i-j]));
        }
    }
    cout << sum[n] << endl;
}

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

int main() {
  int N = 0, i = 0, ans = 0;
  cin >> N ;
  
  for (i = 0; i < N; i++) {
    char S;
    cin >> S;
    if (S == 'Y') {
      ans = 1;
      break;
    }
  }
  if (ans == 0) {
    cout << "Three" << endl;
  } else {
    cout << "Four" << endl;
  }
}


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

using namespace std;
using ll = long long;



int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++){cin >> a[i];a[i]--;}
    int cnt = 0;
    for(int i = 0; i < n; i++){
        int cur = a[i];
        if(a[cur] == i)cnt++;
    }
    cout << cnt / 2 << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <utility>
#include <functional>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <sstream>
#include <cctype>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <tuple>
#include <queue>
using namespace std;
#define rep(i,n,x) for(int i=n;i<x;i++)
#define rem(i,n,x) for(int i=n;i>x;i--)
#define SORT(x) sort(x.begin(),x.end())
#define REV(x) reverse(x.begin(),x.end())
#define all(x) x.begin(),x.end()
#define pb push_back
#define setp(x) setprecision(x)
using LL = long long;
using ULL = unsigned long long;

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

	string ans = "No";
	int n = s.size();
	rep(i, 0, n) {
		string a = s;
		if (a == t) ans = "Yes";
		s = s[n - 1] + s;
		s.erase(s.begin() + n);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;
ll N,M;
ll a[100000], b[100000];
ll cnt[100001];
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>N>>M;
    rep(i,0,M){
        cin>>a[i]>>b[i];
        cnt[a[i]]++;
        cnt[b[i]]++;
    }
    rep(i,1,N+1){
        if(cnt[i]%2){
            cout <<"NO"<<"\n";
            return 0;
        }
    }
    cout <<"YES"<<"\n";
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
int main(){
 int n,a,b;
  cin>>n>>a>>b;
  int c1=0,c2=0,c3=0;
  int x;
  for(int i=0;i<n;i++){
    cin>>x;
    if(x<=a)
      c1++;
    else if(x<=b)
      c2++;
    else
      c3++;
  }
  cout<<min(c1,min(c2,c3))<<endl;
  return 0;
}


Measured memory_bytes: 256
use std::io;

fn main() {
    let mut s = String::new();
    let mut t = String::new();
    io::stdin().read_line(&mut s).unwrap();
    io::stdin().read_line(&mut t).unwrap();

    let s = s.trim();
    let t = t.trim();
    let t = &t[..t.len()-1];

    if t == s {
        println!("Yes");
    } else {
        println!("No");
    }
}


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

set<long long> seen;
int N;

void dfs(long long cur, int t, int f, int s)
{
	if(cur >=1 && cur <= N && t && f && s){
		seen.emplace(cur);
	}
	if(cur > N) return;
	dfs(cur*10+3, t+1, f, s);
	dfs(cur*10+5, t, f+1, s);
	dfs(cur*10+7, t, f, s+1);
}

void solve()
{
	dfs(0,0,0,0);
	cout << (int)seen.size() << endl;
}

int main()
{
	cin >> N;
	solve();
}

Measured memory_bytes: 1536
# -*- coding: utf-8 -*-
from operator import itemgetter

n,m = map(int, input().split())
ab = []
for _ in range(m):
    line = list(map(int, input().split()))
    ab.append(line)

ab = sorted(ab, key=itemgetter(1))

cnt = 1
bridge = ab[0][1]-1
for i in range(1,m):
    if ab[i][0]<=bridge and bridge<ab[i][1]:
        continue
    else:
        cnt += 1
        bridge = ab[i][1]-1
print(cnt)


Measured memory_bytes: 29924
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char x = sc.next().toCharArray()[0];
        char y = sc.next().toCharArray()[0];
        if (x == y) {
            System.out.println("=");
        } else if (x > y) {
            System.out.println(">");
        } else {
            System.out.println("<");
        }
    }

}

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


const long long MOD = 998244353;

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

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

    vector<pair<long long,long long> > v(K);
    for(int c=0;c<K;c++) cin>>v[c].first>>v[c].second;

    vector<long long> dp(N+10,0);


    long long offset = 0;
    dp[0]=1;
    dp[1]=-1;
    for(int c=0;c<N;c++) {
        offset += dp[c];
        offset %= MOD;
        //if(offset == 0) continue;
        for(int c2=0;c2<K;c2++) {
            long long a = v[c2].first;
            long long b = v[c2].second;
            if(c+a < dp.size()) {
                dp[c+a] += offset;
                dp[c+a]%=MOD;
            }
            if(c+b+1 < dp.size()) {
                dp[c+b+1] -= offset;
                while(dp[c+b+1] < 0) dp[c+b+1] += MOD;
                dp[c+b+1]%=MOD;
            }
        }

        if(c+1 == N) {
            cout<<offset;
            return 0;
        }
    }
}


Measured memory_bytes: 4752
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    a,b,c = LI()
    print(9*max(a,b,c)+a+b+c)
    return

#B
def B():
    a,b = LI()
    if a*b %2:
        print("Yes")
    else:
        print("No")
    return

#C
def C():
    k = I()
    print(k//2-1)*(k//2)
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#I
def I_():
    return

#J
def J():
    return

#Solve
if __name__ == "__main__":
    B()


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

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<int> a(n + 1);
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }
    int m = 0;
    vector<int> c(n + 1), b;
    for (int i = n; i >= 1; i--){
        int sum = 0;
        int p = 2 * i;
        while(p <= n){
            sum += c[p];
            p += i;
        }
        int t = sum % 2;
        if(t != a[i]){
            c[i] = 1;
            b.emplace_back(i);
            m++;
        }
    }
    cout << m << endl;
    if(m > 0){
        cout << b[0];
        for(int i = 1; i < m; i++){
            cout << " " << b[i];
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3192