akhauriyash/Code-Regression huggingface dataset:
N, M, X, Y = map(int, input().split())

x = list(map(int, input().split()))
y = list(map(int, input().split()))

x_max = max(x)
y_min = min(y)

for z in range(X+1, Y+1):
    if z > x_max and z <= y_min:
        print("No War")
        exit()

print("War")

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

int main(int argc, char const *argv[])
{
	char n;
	while((n = getchar()) != EOF){
		if(n == '1')	printf("9");
		else if(n == '9')	printf("1");
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 128
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

func readDoubles () -> [Double] {
    return readLine()!.split(separator: " ").map { Double($0)! }
}

func readDouble() -> Double{
    return Double(readLine()!)!
}

func readLines() -> [String] {
    return readLine()!.map { String($0) }
}
///最大公約数を返す
func gcd(_ m:Int, _ n:Int) -> Int {
    if n == 0 {return m}
    return gcd(n, m % n)
}

///最大公約数を返す
func gcd(_ array: [Int]) -> Int {
    var value = array[0]
    if array.count > 1 {
        for i in 1..<array.count {
            value = gcd(value, array[i])
        }
    }
    return value
}

///最小公倍数を返す
func lcm(_ m:Int, _ n:Int) -> Int {
    return m * n / gcd(m, n)
}

///素数判定(試し割り)
func isPrime(_ x:Int) -> Bool {
    if x <= 1 || x % 2 == 0 { return false }
    if x == 2 { return true }
    for i in stride(from: 3, to: Int(ceil(sqrt(Double(x)))), by: 2){
        if x % i == 0 {
            return false
        }
    }
    return true
}

//https://program-life.com/669
///実行速度の計測
func exectionTime(action: () -> Void) {
    let startDate = Date()
    action()
    let endDate = Date()
    print(endDate.timeIntervalSince(startDate))
}

//https://riptutorial.com/ja/swift/example/14738/インデックスを知らずに配列から要素を削除する
extension Array where Element: Equatable {
    
    mutating func remove(_ element: Element) {
        _ = firstIndex(of: element).flatMap {
            self.remove(at: $0)
        }
    }
}

func binarySearch(rifgt:Int, key:Int, ary:[String]) -> Int{
    var left = 0
    var right = rifgt
    
    while abs(right - left) > 1 {
        let mid = left + (right - left) / 2
        
        if Int(ary[mid])! < key {
            left = mid
            
        } else {
            right = mid
        }
    }
    return left
}

func arrangement (prev:String, ary:[String], returnVal:[String]) -> [String] {
    var returnVal = returnVal
    if ary.count == 0 {
        returnVal.append(prev)
        return returnVal
    }
    
    for s in ary {
        let wprev = prev + s
        var wary = ary
        wary.remove(s)
        returnVal = arrangement(prev: wprev, ary: wary, returnVal: returnVal)
    }
    return returnVal
}
// https://algo-logic.info/divisor/
/// 約数の配列を返す
func divisor(_ n:Int) -> [Int] {
    var ret = [Int]()
    var i = 1
    while i * i <= n {
        if n % i == 0 {
            ret.append(i)
            if i * i != n {
                ret.append(n / i)
            }
        }
        i += 1
    }
    return ret.sorted()
}

func main() {
    let input = readInts()
    let (X, K, D) = (abs(input[0]), input[1], input[2])
    //＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿ここまで入力
    let cnt = X / D
    if cnt > K {
        print(X - K * D)
    } else if (K - cnt) % 2 == 0{
        print(X - cnt * D)
    } else {
        print((cnt + 1) * D - X)
    }
    
}
main()


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

int main() 
{
    int n;
    cin >> n;
    vector<pair<int,int>> v;
    for (int i=0; i<n; i++)
    {
        int x;
        cin >> x;
        v.push_back(make_pair(x,i));
    }
    sort(v.begin(), v.end());
    vector<int> ans(n);
    for (int i=0; i<n; i++)
    {
        // cout << v[i].first << " " << v[i].second << endl;
        int id = v[i].second;
        int ido = (n-1)/2;
        if (i<n/2)
            ido++;
        ans[id] = v[ido].first;
    }
    for (int i=0; i<n; i++)
        cout << ans[i] << endl;
    return 0;
}

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

typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define V vector<int>
#define M map<int,int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int,V,greater<int>>

#define pb(a) push_back(a)
#define mp make_pair

#define dump(x)  cout << #x << " = " << (x) << "\n";
#define COUT(x) cout<<(x)<<"\n"


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

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

long long func(ll x, ll c, ll d)
{
	ll res = x;
	res -= x / c;
	res -= x / d;
	res += x / lcm(c, d);
	return res;
}

int main()
{
	ll a, b, c, d = 0;
	cin >> a >> b >> c >> d;
	ll ans = func(b, c, d) - func(a - 1, c, d);

	COUT(ans);

	return 0;
}

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

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    if (a < b)
        for (int i=0; i<b; i++) cout << a;
    else
        for (int i=0; i<a; i++) cout << b;
    cout << endl;
}


Measured memory_bytes: 888
h,n=map(int,input().split())
ab=[]
inf=float('inf')
for i in range(n):
    a,b=map(int,input().split())
    ab.append((a,b))
dp=[inf]*(h+1) 
dp[0]=0#left:hp,right:min mp
for i in range(n):
    for j in range(h+1):
        if dp[j]!=inf:
            idx=min(j+ab[i][0],h)
            dp[idx]=min(dp[idx],dp[j]+ab[i][1])
print(dp[-1])

Measured memory_bytes: 50908
a = []
for i in range(3):
    a += list(map(int, input().split()))
bg = [False]*9
n = int(input())
for i in range(n):
    b = int(input())
    if b in a:
        bg[a.index(b)] = True

num = [[0,1,2],[3,4,5],[6,7,8],[0,3,6],[1,4,7],[2,5,8],[0,4,8],[2,4,6]]
for x, y, z in num:
    if bg[x] and bg[y] and bg[z]:
        print('Yes')
        exit()
print('No')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main() {
    int D, G;
    cin >> D >> G;
    vector<int> p(D);
    vector<int> c(D);
    for(int i = 0; i < D; i++) {
        cin >> p.at(i) >> c.at(i);
    }

    int ans = 1e9;  // 取り敢えずバカでかい数字
    // このforの中身がbit全探索を表している。つまりボーナス問題を取るか取らないかの2^D通りを試している
    for(int mask = 0; mask < (1 << D); ++mask) {
        int s = 0, num = 0, rest_max = -1;
        for(int i = 0; i < D; ++i) {
            if(mask >> i & 1) {
                s += 100 * (i+1) * p[i] + c[i];     // この計算はボーナス問題を取るやつは全部問題を解かなきゃいけないって言うのを表している
                num += p[i];
            }else {
                rest_max = i;
            }
        }
        if(s < G) {
            int s1 = 100 * (rest_max + 1);
            int need = (G - s + s1 - 1) / s1;
            if(need >= p[rest_max]) {
                continue;
            }
            num += need;
        }
        ans = min(ans, num);
    }
    cout << ans << endl;
}

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

using namespace std;

const int NMAX = 100000 + 5;

int N;
bool vis[NMAX];
int ans[NMAX];

int query(int where) {
    if (vis[where])
        return ans[where];
    vis[where] = true;
    cout << where - 1 << endl;
    string str;
    cin >> str;
    if (str == "Male")
        ans[where] = 1;
    else if (str == "Female")
        ans[where] = 2;
    else {
        ans[where] = 0;
        exit(0);
    }
    return ans[where];
}

int main()
{
    cin >> N;

    query(1), query(N);

    int l = 1, r = N;
    while (l <= r) {
        int mid = (l + r) / 2;
        if ((mid - l + 1) % 2 == 0 && r - l + 1 > 3)
            -- mid;
        if (query(mid) == query(l))
            l = mid;
        else
            r = mid;
    }
    return 0;
}


Measured memory_bytes: 980
#include <bits/stdc++.h>
using namespace std;
#define int long long 
#define rep(i,N) for(int (i)=0;(i)<(N);++(i))
#define all(v) v.begin(),v.end()
#define MP make_pair
#define pb push_back
const int INF = 1e18;
const int MOD = INF+7;

signed main(){
    string s;
    cin >> s;
    string k = "keyence";
    bool ok = false;

    rep(i,s.size()){
        rep(j,s.size()-i){
            string t = s;
            t.erase(i,j);
            if(k == t) ok = true;
        }
    }

    if(ok) cout << "YES\n";
    else cout << "NO\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//mod逆元を使ったnCkの計算(速)
const int64_t MAX = 510000;
const int64_t MOD = 1000000007;

int64_t 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;
  }
}

// 二項係数計算
int64_t COM(int64_t n, int64_t k){
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
  int64_t H, W, A, B;
  cin >> H >> W >> A >> B;
  COMinit();
  int64_t ans = 0;
  for(int i=B+1; i<=W; i++){
    int64_t x = COM((i-1)+(H-A-1),i-1);
    x *= COM((A-1)+(W-i),A-1);
    x %= MOD;
    ans += x;
    ans %= MOD;
  }
  cout << ans << endl;
}

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

const ll mod=1e9+7;
ll pow_mod(ll a, ll n)
{
    if(n == 0) return 1;
    ll x = pow_mod(a, n/2);
    ll ans = x * x % mod;
    if(n % 2 == 1) ans = ans *a % mod;
    return ans%mod;
}

ll C(ll n,ll m) {
    if(n < m) return 0;
    ll res = 1;
    for(ll i=1; i<=m; i++) {
        ll a = (n+i-m)%mod;
        ll b = i%mod;
        res = res*(a*pow_mod(b,mod-2)%mod)%mod;
    }
    return res;
}

ll Lucas(ll n,ll m) {
    if(m == 0) return 1;
    return C(n%mod, m%mod) * Lucas(n/mod,m/mod)%mod;
}

ll n,a,b;
int main(){
    cin>>n>>a>>b;
    ll ans=pow_mod(2,n)-Lucas(n,a)-Lucas(n,b)-1;
   while(ans<0) {
        ans+=mod;
    }
    cout<<ans%mod;
    return 0;
}


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

int main() {
  string x;
  cin >> x;
  
  if(x.at(2) == x.at(3) && x.at(4) == x.at(5)){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL long long
#define db double
using namespace std;
 
const int MAXN = 200200;
const int MAXE = 400400;
const int INF = 0x3f3f3f3f;
 
template<typename T> inline void CheckMax(T &A, T B) {
	A < B ? A = B : A;
}
 
template<typename T> inline void CheckMin(T &A, T B) {
	A > B ? A = B : A;
}
 
template <typename T> inline void read(T &x) {
    int c = getchar();
    bool f = false;
    for (x = 0; !isdigit(c); c = getchar()) {
        if (c == '-') {
            f = true;
        }
    }
    for (; isdigit(c); c = getchar()) {
        x = x * 10 + c - '0';
    }
    if (f) {
        x = -x;
    }
}

int X, a[MAXN], n;
LL sum[MAXN];

LL diff(int l, int r) {
	return sum[r] - sum[l - 1];
}

signed main() {
	read(n), read(X);
	for(int i = 1; i <= n; i++) read(a[i]);
	for(int i = 1; i <= n; i++) sum[i] = sum[i - 1] + (LL) a[i];
	LL ans = (1LL << 61);
	for(int i = 1; i <= n; i++) {
		LL res = (LL)i * X;
		for(int j = n, k = 1; j && res < ans; k++) {
			int pos = max(j - i + 1, 1);
			res += diff(pos, j) * (LL)(k == 1 ? 5 : (k << 1 | 1));
			j = pos - 1;
		}
		ans = min(ans, res);
	}
	printf("%lld\n", ans + (LL) n * (LL) X);
	return 0;
}

Measured memory_bytes: 2560
#include "bits/stdc++.h"
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
using namespace std;



int main(){
ll N;
cin>>N;
ll ans =-1;
vector<ll> a(N);
vector<ll> b(N,0);
vector<ll> c;
for(ll i=0;i<N;i++){
  cin>>a[i];
}
ll tmp=0,tmp2,tmp3,tmp4;
for(ll i=N-1;i>=0;i--){
  tmp=0;
  tmp2 = i+1;
  tmp3=2;
while(1){
  if(tmp3*tmp2<=N){
    tmp+=b[tmp3*tmp2-1];
    tmp3++;
  }
  else
  break;
}

if(a[i]==0&&(tmp%2==0)){
  b[i]=0;
}
else if(a[i]==0&&(tmp%2==1)){
  b[i]=1;
  c.push_back(i);
}

else if(a[i]==1&&(tmp%2==0)){
  b[i]=1;
    c.push_back(i);
}
else if(a[i]==1&&(tmp%2==1)){
  b[i]=0;
}



}

cout<<c.size()<<endl;
for(ll i=0;i<c.size();i++){
  cout<<c[i]+1<<" ";
}




return 0;
}


Measured memory_bytes: 4980
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e6 + 10;
const ll mod = 1e9 + 7;
int n;
ll ans;
ll fac[maxn], inv[maxn], facinv[maxn], bin[maxn];
void pre()
{
	fac[0] = 1; for(int i = 1; i < maxn; ++i) fac[i] = fac[i - 1] * i % mod;
	inv[1] = 1; for(int i = 2; i < maxn; ++i) inv[i] = (mod - mod / i) * inv[mod % i] % mod;
	facinv[0] = 1; for(int i = 1; i < maxn; ++i) facinv[i] = facinv[i - 1] * inv[i] % mod;
	bin[0] = 1; for(int i = 1; i < maxn; ++i) bin[i] = bin[i - 1] * 2 % mod;
}
ll C(int n, int m) { return n < m ? 0 : fac[n] * facinv[m] % mod * facinv[n - m] % mod;}
ll f(ll r, ll x)
{
	ll t = n - r - x + 1;
	if(t > r - 1 || t < 1) return 0;
	return C(r - 1, 1) * C(r - 1 - 1, n - r - x) % mod;
}
ll g(ll r, ll x)
{
	ll t = x - r;
	return C(r - 1, t);
}
ll fact(ll n) { return n < 0 ? 1 : fac[n];}
int main()
{
	pre();
	scanf("%d", &n);
	if(n == 2) { puts("1"); return 0;}
	for(int i = 1; i <= n - 1; ++i) 
	{
		ll tmp = (f(i, 3) * 2 + f(i, 4) + g(i, n - 2) * 2 + g(i, n - 3) * 2) % mod;
		ans = (ans + tmp * fact(i + 1) % mod % mod * fact(n - 1 - i - 1) % mod) % mod;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 35080
#include<iostream>
using namespace std;
#include<vector>
#include<functional>
template<typename T>
struct lazysegtree{
	using F=function<T(T,T)>;
	using G=function<T(T,T,int,int)>;
	const F calcfn,lazycalcfn;
	const G updatefn;
	int n;
	T defvalue,lazydefvalue;
	vector<T>dat,lazy;
	vector<bool>lazyflag;
	lazysegtree(int n_=0,T defvalue_=0,
		const F calcfn_=[](T a,T b){return a+b;},
		const F lazycalcfn_=[](T a,T b){return a+b;},
		const G updatefn_=[](T a,T b,int l,int r){return a+b*(r-l);},
		T lazydefvalue_=0
	):defvalue(defvalue_),lazydefvalue(lazydefvalue_),
		calcfn(calcfn_),lazycalcfn(lazycalcfn_),updatefn(updatefn_)
	{
		n=1;
		while(n<n_)n<<=1;
		dat.assign(2*n-1,defvalue);
		lazy.assign(2*n-1,lazydefvalue);
		lazyflag.assign(2*n-1,false);
	}
	void copy(const vector<T>&v)
	{
		for(int i=0;i<v.size();i++)dat[i+n-1]=v[i];
		for(int i=n-2;i>=0;i--)dat[i]=calcfn(dat[2*i+1],dat[2*i+2]);
	}
	void eval(int i,int l,int r)
	{
		if(lazyflag[i])
		{
			dat[i]=updatefn(dat[i],lazy[i],l,r);
			if(r-l>1)
			{
				lazy[2*i+1]=lazycalcfn(lazy[2*i+1],lazy[i]);
				lazy[2*i+2]=lazycalcfn(lazy[2*i+2],lazy[i]);
				lazyflag[2*i+1]=lazyflag[2*i+2]=true;
			}
			lazy[i]=lazydefvalue;
			lazyflag[i]=false;
		}
	}
	void update(int a,int b,T x,int k=0,int l=0,int r=-1)//[a,b)
	{
		if(r<0)r=n;
		eval(k,l,r);
		if(b<=l||r<=a)return;
		else if(a<=l&&r<=b)
		{
			lazy[k]=lazycalcfn(lazy[k],x);
			lazyflag[k]=true;
			eval(k,l,r);
		}
		else
		{
			update(a,b,x,2*k+1,l,(l+r)/2);
			update(a,b,x,2*k+2,(l+r)/2,r);
			dat[k]=calcfn(dat[2*k+1],dat[2*k+2]);
		}
	}
	T query(int a,int b,int k=0,int l=0,int r=-1)//[a,b)
	{
		if(r<0)r=n;
		eval(k,l,r);
		if(b<=l||r<=a)return defvalue;
		else if(a<=l&&r<=b)return dat[k];
		else return calcfn(
			query(a,b,2*k+1,l,(l+r)/2),
			query(a,b,2*k+2,(l+r)/2,r)
		);
	}
};
const long mod=998244353;
main()
{
	int N,Q;
	cin>>N>>Q;
	lazysegtree<pair<long,long> >P(N,make_pair(0,0),
		[](pair<long,long>a,pair<long,long>b){return make_pair((a.first+b.first)%mod,0);},
		[](pair<long,long>a,pair<long,long>b){return make_pair(a.first*b.first%mod,(a.second*b.first+b.second)%mod);},
		[](pair<long,long>a,pair<long,long>b,int l,int r){return make_pair((a.first*b.first%mod+b.second*(r-l)%mod)%mod,0);},
	make_pair(1,0));
	vector<pair<long,long> >A(N);
	for(int i=0;i<N;i++)cin>>A[i].first;
	P.copy(A);
	for(int i=0;i<Q;i++)
	{
		int t,l,r;cin>>t>>l>>r;
		if(t==0)
		{
			pair<long,long>q;cin>>q.first>>q.second;
			P.update(l,r,q);
		}
		else
		{
			cout<<P.query(l,r).first<<endl;
		}
	}
}


Measured memory_bytes: 43900
#include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define time_taken_start int begtime = clock();
#define time_taken_end int endtime = clock(); \
cerr << "\n\n" << "Time elapsed: " << \
(endtime - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n"; \
return 0;
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define mod 1000000007
#define inf 1000000000000000007
#define eps 0.0000000001
#define pi acosl(-1)
#define pdd pair<ld,ld>
#define pll pair<ll,ll>
#define ff first
#define ss second
#define vpl vector<pll>
#define vll vector<ll>
#define mseti multiset <ll>
#define msetd multiset <ll,greater<ll>>
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound 
#define stp fixed<<setprecision(20)
#define endl '\n'
ll p[20009];
ll power(ll x,ll y)
{
    ll res=1;
  
    while(y>0)
    {
        if(y&1)
            res=res*x;
        //res%=mod;
        y=y>>1;
        x=x*x;
        //x%=mod;
    } 
    return res; 
}
void solve()
{
    ll val;
    cin>>val;
    for(ll i=0;i<=2000;i++)
    {
        ll x=i-1000;
        p[i]=power(x,5);
    }
    for(ll i=0;i<=2000;i++)
    {
        for(ll j=0;j<=2000;j++)
        {
            if(p[i]-p[j]==val)
            {
                cout<<(i-1000)<<' '<<(j-1000);
                return;
            }
        }
    }
}
int main()
{
    FAST
    #ifdef ayk_16
    freopen("input.txt","rt",stdin);
    freopen("output.txt","wt",stdout);
    #endif
    ll t=1;
    //cin>>t;
    for(ll i=0;i<t;i++)
    {
        //cout<<"Case #"<<i+1<<": ";
        solve();
    }
}

Measured memory_bytes: 3668
//自称高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define MODA 1000000007 

int main() {
    int ans = 0;
	string s;
	cin >> s;
	if (s == "A") cout << "T" << endl;
	if (s == "T") cout << "A" << endl;
	if (s == "G") cout << "C" << endl;
	if (s == "C") cout << "G" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int main () {
	int a , b;
	char op;

	while(1) {
		scanf("%d %c %d" , &a , &op , &b);
		if (op == '?') break;
		switch (op) {
			case '+':
				printf("%d\n" , a + b);
				break;
			case '-':
				printf("%d\n" , a - b);
				break;
			case '*':
				printf("%d\n" , a * b);
				break;
			case '/':
				printf("%d\n" , a / b);
				break;
		}
	}
	return 0;
}

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

using namespace std;
typedef long long ll;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	string s; cin >> s;
	map<char, int> mp;
	for (char x : s)
	{
		++mp[x];
	}
	for (pair<char, int> x : mp)
	{
		if (x.second != 2)
		{
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}

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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const ll mod = 1e9+7;

void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

int main()
{
 
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >>n;
	vector<VI> p(n, VI(11));
	vector<ll> fc(n);
	
	rep(i,n){
		rep(j,10){
			int d; cin >> d;
			if(d ==1) fc[i] |= (1LL << j);
		}
	}
	rep(i,n) rep(j,11) cin >> p[i][j];
	

	ll ans = -1LL *  (1LL<<50);
	rep2(i, 1, 1<<10){
		ll sm  =0;
		rep(j,n){
			int mc = i & fc[j];
			int su = __builtin_popcount(mc);
			sm += p[j][su];
		}
		ans = max<ll>(sm, ans);
	}
	
	cout << ans <<"\n";
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <random>
#include <chrono>
#include <string>
#include <bitset>
#include <cassert>
#include <queue>
#include <memory>

//#pragma comment(linker, "/STACK:16777216")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("unswitch-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,abm,mmx,avx,avx2,popcnt,tune=native")

using namespace std;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

#define ll long long
#define ull unsigned long long
//#define double long double
#define int ll
//#define int ull
//#define int short
//#define int unsigned short
//#define int unsigned int
#define mp make_pair
#define F first
#define S second
#define pii pair<int, int>
#define hash hash228
const int SZ = 1e3 + 4;
const double EPS = 1e-7;
const int mod = 1e9;
const int hashpow = 2;
const int inf = 2e9;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

double r;

void read() {
    cin >> r;
}

void solve() {
    double pi = 3.1415926;
    cout << 2 * pi * r << "\n";
}

signed main() {

#ifdef __LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif

//    int t;
//    cin >> t;
//    for (int i = 0; i < t; ++i) {
        read();
        solve();
//    }

    return 0;
}

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

int main() {
    int r, g, b;
    cin >> r >> g >> b;
    int sum = 100*r + 10*g + b;
    if (sum % 4 == 0){
        cout << "YES" <<endl;
    }
    else cout << "NO" <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int min = 30, N;
  cin >> N;
  
  for (int i = 0; i < N; i++) {
    int A, can = 0; cin >> A;
    while (((A % 2) == 0) && (A > 0)) {
      A /= 2;
      can++;
    }
    
    if (can < min)
      min = can;
    if (min == 0)
      break;
  }
  
  cout << min << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int> 
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fi first
#define se second
#define ppi pair<pii,int> 
#define ff first.first
#define fs first.second
using namespace std;
int n;
int a[100001],b[100001];
pii nod[100001];
ppi ch[200001];
int main(){
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>a[i]>>b[i];
    for(int i=0;i<n;i++){
        ch[2*i]=mp(mp(a[i],i),0);
        ch[2*i+1]=mp(mp(b[i],i),1);
    }
    sort(ch,ch+2*n);
    ll ans=0;
    for(int i=0;i<n;i++){
        if(ch[i].se==0)
            nod[ch[i].fs].fi=1;
        else
            nod[ch[i].fs].se=1;
        ans+=(ll)ch[i].ff;
    }
    bool flag1=0,flag2=1,flag3=1;
    for(int i=0;i<n;i++)
        if(nod[i].fi && nod[i].se){
            flag1=1;break;
        }
    for(int i=0;i<n;i++)
        if(!(nod[i].fi && !nod[i].se)){
            flag2=0;break;
        }
    for(int i=0;i<n;i++)
        if(!(!nod[i].fi && nod[i].se)){
            flag3=0;break;
        }
    if(flag1 || flag2 || flag3){
        cout<<ans<<endl;
        return 0;
    }
    cout<<ans+((ch[n].fs==ch[n-1].fs)?min(ch[n].ff-ch[n-2].ff,ch[n+1].ff-ch[n-1].ff):ch[n].ff-ch[n-1].ff)<<endl;
    //有两种可能的情况：n+1,n-1;n,n-2 
    return 0;
}

Measured memory_bytes: 4096
#include<bits/stdc++.h>
using namespace std;
int main(){
 int n;
 cin>>n;
 int i,p[n],w=0;
for(i=0;i<n;i++){
    cin>>p[i];
   if(p[i]!=(i+1)) w++;
}
if(w>2) cout<<"NO"<<endl;
else cout<<"YES"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<iomanip>
#include<math.h>
using namespace std;

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

using ll = long long;


int main(){
  int N; cin >> N;
  vector<int> a(N);
  int sum = 0;
  rep(i,N){
     cin >> a[i];
     sum += a[i];
  }
  double ave = (double)sum / N;
  vector<pair<double,int>> P(N);
  rep(i,N){
     P[i].first = fabs(ave - (double)a[i]);
     P[i].second = i;
  }
  sort(P.begin(),P.end());

  cout << P[0].second << endl;

  

}



Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl

const int MAX_V = 200000;
vector<vector<int>> to(MAX_V);
vector<int> V, W;
vector<int> col(MAX_V);
int n;
void dfs(int v, int p, int c) {
  if(c == 0)
    V.push_back(v);
  else
    W.push_back(v);
  for(auto x : to[v]) {
    if(x == p) continue;
    dfs(x, v, 1 ^ c);
  }
  return;
}

int main() {
  cin >> n;
  to.resize(n);
  col.resize(n);
  rep(i, n - 1) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  dfs(0, -1, 0);
  if(V.size() < W.size()) {
    vector<int> temp = V;
    V = W;
    W = temp;
  }
  for(auto v : V) dbg(v + 1);
  for(auto w : W) dbg(w + 1);
  vector<int> col(n);
  int c[3] = {3, 1, 2};
  if(W.size() <= n / 3) {
    int iV = 0;
    rep(i, n / 3 - W.size()) {
      col[V[iV++]] = c[0];
      c[0] += 3;
    }
    rep(i, n / 3) {
      col[V[iV++]] = c[1];
      c[1] += 3;
    }
    rep(i, n / 3) {
      col[V[iV++]] = c[2];
      c[2] += 3;
    }
    if(n % 3 != 0) col[V[iV++]] = c[1];
    if(n % 3 == 2) col[V[iV++]] = c[2];

    rep(iW, W.size()) {
      col[W[iW]] = c[0];
      c[0] += 3;
    }

  } else {
    int iV = 0;
    rep(i, n / 3) {
      col[V[iV++]] = c[1];
      c[1] += 3;
    }
    if(n % 3 != 0) col[V[iV++]] = c[1];

    for(; iV < V.size(); iV++) {
      col[V[iV]] = c[0];
      c[0] += 3;
    }
    int iW = 0;
    rep(i, n / 3) {
      col[W[iW++]] = c[2];
      c[2] += 3;
    }
    if(n % 3 == 2) col[W[iW++]] = c[2];
    for(; iW < W.size(); iW++) {
      col[W[iW]] = c[0];
      c[0] += 3;
    }
  }
  rep(i, n) printf("%d%c", col[i], i == n - 1 ? '\n' : ' ');
  return 0;
}

Measured memory_bytes: 22388
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
using namespace std;
typedef pair<int,int> i_i;
int main(){
  int n,w,h;
  int i,j,k;
  int x,y,r;
  vector<i_i> vx;
  vector<i_i> vy;
  i_i a;
  cin >> n >> w >> h;
  for(i=0;i<n;i++){
    cin >> x >> y >> r;
    a.first=x-r;a.second=x+r;
    vx.push_back(a);
    a.first=y-r;a.second=y+r;
    vy.push_back(a);
  }
  //cout << vx.size() << vy.size();
  sort(vx.begin(),vx.end());
  sort(vy.begin(),vy.end());
  int f=0;
  int fi=vx[0].first,se=vx[0].second;
  //cout << fi;
  if(fi>0) {
    f=1;
  }else{
    for(i=0;i<vx.size();i++){
      fi=vx[i].first;
      if(fi>se){
	f=1;
	break;
      }
      se=max(se,vx[i].second);
    }
  }
  //cout << se << endl;
  if(se<w) f=1;
  if(f==0) {
    cout << "Yes" <<endl;
  }else{
    f=0;
    fi=vy[0].first;
    se=vy[0].second;
    //cout << fi;
    if(fi>0) f=1;
    else
      for(i=0;i<vy.size();i++){
	fi=vy[i].first;
	if(fi>se){
	  f=1;
	  break;
	}
	se=max(se,vy[i].second);
      }
    //cout << se << endl;
    if(se<h) f=1;
    if(f==0) cout << "Yes" <<endl;
    else cout << "No" <<endl;
  }
  
}

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

using namespace std;

typedef unsigned short ushort;typedef unsigned int uint;typedef long long ll;typedef unsigned long long ull;
template <typename T> ostream &operator<<(ostream &cout, vector<T> &a){for(size_t i = 0; i < a.size(); ++i) cout << a[i] << " "; return cout;}
template <typename T> ostream &operator<<(ostream &cout, vector<vector<T> > &a){for(size_t i = 0; i < a.size(); ++i) cout << a[i] << endl; return cout;}

ull C(int n, int k){
    if(n == 0)
        return 1;
    if(n - k < k)
        k = n - k;
    ull ans = 1;
    for(int i = 0; i < k; ++i){
        ans *= (n - i);
        ans /= i + 1;
    }
    return ans;
}

int main()
{
    ios_base::sync_with_stdio(0);
    ll n, p;
    cin >> n >> p;
    ll even = 0, odd = 0;
    int a;
    for(int i = 0; i < n; ++i){
        cin >> a;
        if(a % 2)
            odd++;
        else
            even++;
    }
    ull ans = 1;

    if(p == 1){
        if(odd == 0){
            cout << 0 << endl;
            return 0;
        }
    }

    while(even--){
        ans *= 2;
    }
    ull cur = 0;
    for(int i = p; i <= odd; i += 2){
        cur += C(odd, i);
    }
    cout << ans * cur << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll              long long int
#define int             ll
#define ff              first
#define ss              second
#define pb              emplace_back
#define mpair           make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define sbits(x)      __builtin_popcountll(x)
#define zbits(x)      __builtin_popcountlliltin_ctzll(x)
#define w(t)            int t;cin>>t;while(t--)
#define uset            unordered_set
#define dor(i, a, b)    for(int i =(a);i<=(b);i++)
#define mem(a,val)      memset((a),(val),sizeof((a))); 
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__,__VA_ARGS__)
    template <typename Arg1>
     void __f(const char* name,Arg1&& arg1){
        cout<<name<<" : "<<arg1<<std::endl;
     }
     template <typename Arg1, typename... Args>
     void __f(const char* names,Arg1&& arg1,Args&&... args){
        const char* comma = strchr(names+1 ,',');
        cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
     }
#else
#define trace(...)
#endif
/*     
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
*/
double pi = 2.0*acos(0);
void fast(){ios_base::sync_with_stdio(false);cin.tie(NULL);cout<<fixed<<setprecision(10);}
int max2(int a,int b){ if(a>b) return a;return b;}
int min2(int a,int b){ if(a<b)return a;return b;}
int max3(int a,int b,int c){ return max2(a,max2(b,c));}
int min3(int a,int b,int c){ return min2(a,min2(b,c));}

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



void solve()
{
        int h,w;
        cin>>h>>w;
        string s[h];
        for(int  i  = 0;i<h;i++)
        {
           cin>>s[i];
        }

       int dp[h][w];
        dp[0][0] = (s[0][0]=='#')?1:0;
       for(int  i = 0;i<h;i++)
       {
          for(int  j = 0;j<w;j++)
          {
                if(i==0 && j==0)
                  continue;
                dp[i][j] = 1e9;
                if(j>0)
                  dp[i][j] = min(dp[i][j],(s[i][j-1]=='.' && s[i][j]=='#')+dp[i][j-1]);
                if(i>0)
                  dp[i][j] = min(dp[i][j],(s[i-1][j]=='.' && s[i][j]=='#')+dp[i-1][j]);
          }
       }

       cout<<dp[h-1][w-1]<<endl;  

}

signed main(void)
{
      fast();
      //w(t)
      solve();

}


Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <map>
#include <vector>
using namespace std;
typedef pair<string,int>P;
int main(){
  string id;
  vector<P> vs(9);
  vector<P> ma(9);
  for(int i = 0 ; i < 9 ; i++ ){
    int a,b;
    cin >> id >> a >> b;
    ma[i] = P(id,a*200 + b*300);
    vs[i] = P(id,a+b);
  }

  for(int i = 0 ; i < 9 ; i++ ){
    cout << ma[i].first << ' ' << vs[i].second << ' ' <<  ma[i].second<< endl;
}
  return 0;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b)
{
    return b ? gcd(b,a%b):a;
}
ll lcm(ll a,ll b){ return a * b / gcd(a,b);}
int main()
{
    ll n,m;
    cin >> n >> m;
    vector<int>a(n);
    for(int i = 0;i < n;i++)
    {
        cin >> a[i];
        a[i] /= 2;
    }
    ll k = a[0];
    for(int i = 0;i < n;i++)
    {
        k = lcm(k,a[i]);
    }
    int flag = 1;
    for(int i = 0;i < n;i++)
    {
        if(k / a[i] % 2== 0)
        {
            cout <<"0";
            return 0;
        }
    }
    ll ans = m / k ;
    ans = (ans + 1) / 2;
    cout << ans;
    return 0;
}

Measured memory_bytes: 640
n, m = map(int, input().split())
a_pos = [0]*(n+1)
for i in range(m):
    a_pos[int(input())] = 1
mod = 10**9+7
dp = [0]*(n+1)
dp[0] = 1
dp[1] = 0 if a_pos[1] else 1
for i in range(2, n+1):
    if a_pos[i] == 1:
        dp[i] = 0
    else:
        dp[i] = (dp[i-2] + dp[i-1]) % mod

print(dp[-1])


Measured memory_bytes: 44888
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define all(x) (x).begin(), (x).end()
#define endl '\n'
const ll inf = LLONG_MAX;
const long double pi = M_PI;
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
  ll n, k, x, y;
  cin >> n >> k >> x >> y;
  if (n <= k) cout << x * n << endl;
  else cout << x * k + y * (n - k) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
string S,T;
int main(){
	int n;cin>>S>>n;int c=0;
	for(int i=0;i<n;i++){
		cin>>T;T+=T;
		int flag=0;
		for(int i=0;i<T.size()-S.size()+1;i++){
			if(T.substr(i,S.size())==S){flag=1;}
		}
		c+=flag;
	}
	cout<<c<<endl;
	return 0;
}

Measured memory_bytes: 3140
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=2e5+10;
#define fi first
#define se second
#define pb push_back
int main() {
    ios::sync_with_stdio(false);
    int n;cin>>n;
    string a;
    cin>>a;
    int x=unique(a.begin(),a.end())-a.begin();
    cout<<x<<endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define acc(v) accumulate(v.begin(), v.end(), 0)

using namespace std;
typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;

int main()
{
    int n;
    cin >> n;
    n %= 10;
    string s = "hon";
    if(n==0 || n== 1 || n == 6 || n == 8){
        s = "pon";
    }
    if(n==3){
        s = "bon";
    }
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define Fst first
#define Snd second
#define RG register
#define mp make_pair
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long LL;
typedef long double LD;
typedef unsigned int UI;
typedef unsigned long long ULL;
template<typename T> inline void read(T& x) {
	char c = getchar();
	bool f = false;
	for (x = 0; !isdigit(c); c = getchar()) {
		if (c == '-') {
			f = true;
		}
	}
	for (; isdigit(c); c = getchar()) {
		x = x * 10 + c - '0';
	}
	if (f) {
		x = -x;
	}
}
template<typename T, typename... U> inline void read(T& x, U& ... y) {
	read(x), read(y...);
}
const int N=1e5+10,P=1e9+7;
int n;
int LA[N],LB[N],TA[N],TB[N],G[N],F[N];
LL A,B;
LL S[N];
//#define rua
int main() {
//	ios::sync_with_stdio(false);
#ifdef rua
	freopen("GG.in","r",stdin);
#endif
  read(n,A,B);
  int a=0,b=0;
  S[0]=-2e18; S[n+1]=2e18; LB[n+1]=n;
  for(int i=1;i<=n;++i) {
    read(S[i]);
    while(a!=i&&S[i]-S[a+1]>=A) ++a; LA[i]=a;
    while(b!=i&&S[i]-S[b+1]>=B) ++b; LB[i]=b;
    if(i==1) TA[i]=TB[i]=1;
    else {
      if(S[i]-S[i-1]>=A) TA[i]=TA[i-1];
      else TA[i]=i;
      if(S[i]-S[i-1]>=B) TB[i]=TB[i-1];
      else TB[i]=i;
    }
    //printf("#%d %d %d %d\n",LA[i],LB[i],TA[i],TB[i]);
  }
  G[0]=1; F[1]=1; G[1]=2;
  for(int i=2;i<=n;++i) {
    int l=TA[i],r=min(i-1,LB[i+1]+1); 
    //printf("G :%d %d\n",l,r);
    if(l<=r) G[i]=(F[r]-(l?F[l-1]:0)+P)%P;
    l=TB[i-1]-1; r=min(i-2,LA[i]);
    //printf("F :%d %d\n",l,r);
    if(l<=r) F[i]=(G[r]-(l?G[l-1]:0)+P)%P;
    if(S[i+1]-S[i-1]>=B) G[i]=(G[i]+F[i])%P;
    //printf("%d %d\n",G[i],F[i]);
    F[i]=(F[i]+F[i-1])%P; G[i]=(G[i]+G[i-1])%P;
  }
  int res=G[n];
  if(TB[n]>1) res=(res-G[TB[n]-2]+P)%P;
  printf("%d\n",res);
  return 0;
}


Measured memory_bytes: 3328
#include <iostream>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
	
	int x;
	cin>>x;
	if(x==5 || x==3)
	cout<<"YES"<<endl;
	else if(x==7)
	cout<<"YES"<<endl;
	else
	cout<<"NO"<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
  int N,i,j;
  cin >> N;
  cout << N*(N-1)/2-N/2 << endl;
  for(i=0;i<N-1;i++) {
    for(j=i+1;j<N;j++) {
      if(i+j != N/2*2-1)cout << i+1 << " " << j+1 << endl;
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;

int main() {
  int k, x, ans;
  cin >> k >> x;
  ans = x - k + 1;
  for(int i = 0; i < 2*k-1; i++) {
    cout << ans << " ";
    ans++;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define MOD 1000000007
double probs[3000];




int main()
{


	ll n, k;
	cin >> n >> k;
	ll arr[n];

	for (int i = 0; i < n; i++)
		cin >> arr[i];

	bool predict[k + 1];
	memset(predict, false, sizeof(predict));

	predict[0] = false;

	for (int i = 1; i <= k; i++)
	{
		bool sa = true;
		for (int j = 0; j < n; j++)
		{
			if (i - arr[j] >= 0)
				sa = sa && (predict[i - arr[j]]);
		}
		predict[i] = !sa;
	}

	if (predict[k])
		cout << "First" << endl;
	else
		cout << "Second" << endl;

}













Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
const int maxn=1e5+9;
typedef long long ll;
ll a[maxn];
int n;
int main(){
	cin>>n;
	ll s=0;
	int f=1;
	for(int i=1;i<=n;++i){
		cin>>a[i];
		s+=a[i]*f;
		f*=-1;
	}
	for(int i=1;i<=n;++i){
		cout<<s<<" ";
		s=a[i]*2-s;
	}
	return 0;
}


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

int main() {
  int h, w;
  cin >> h >> w;

  char s[h][w];
  for (int i=0; i<h; i++) {
    for (int j=0; j<w; j++) {
      char c;
      cin >> c;

      if (c=='.') c='0';
      s[i][j]=c;
    }
  }

  for (int i=0; i<h; i++) {
    for (int j=0; j<w; j++) {
      if (j!=w-1) {
        if (s[i][j+1]=='#' && s[i][j]!='#') s[i][j]++;
      }
      if (j!=0) {
        if (s[i][j-1]=='#' && s[i][j]!='#') s[i][j]++;
      }
      if (i!=h-1) {
        if (j!=w-1) {
          if (s[i+1][j+1]=='#' && s[i][j]!='#') s[i][j]++;
        }
        if (j!=0) {
          if (s[i+1][j-1]=='#' && s[i][j]!='#') s[i][j]++;
        }
        if (s[i+1][j]=='#' && s[i][j]!='#') s[i][j]++;
      }
      if (i!=0) {
        if (j!=w-1) {
          if (s[i-1][j+1]=='#' && s[i][j]!='#') s[i][j]++;
        }
        if (j!=0) {
          if (s[i-1][j-1]=='#' && s[i][j]!='#') s[i][j]++;
        }
        if (s[i-1][j]=='#' && s[i][j]!='#') s[i][j]++;
      }
    }
  }

  for (int i=0; i<h; i++) {
    for (int j=0; j<w; j++) {
      cout << s[i][j];
    }
    cout << endl;
  }
  
}

Measured memory_bytes: 256
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]

n = INT()
a = STR()
b = STR()
c = STR()
ans = 0
for i in range(n):
    if a[i] != b[i]:
        ans += 1
    if c[i] != b[i] and c[i] != a[i]:
        ans += 1
print(ans)

Measured memory_bytes: 60140
import itertools
import math

N = int(input())

loc = [[int(s) for s in input().split()] for _ in range(N)]

dist = [[0] * N for _ in range(N)]

for i in range(N):
    for j in range(i + 1, N):
        dist[i][j] = math.sqrt((loc[i][0] - loc[j][0])** 2 + (loc[i][1] - loc[j][1])** 2)
        dist[j][i] = dist[i][j]

d_cnt = 0
cnt = 0
for per in itertools.permutations(list(range(N)), N):
    for i, j in zip(per, per[1:]):
        d_cnt += dist[i][j]
    cnt += 1

print(d_cnt / cnt)

Measured memory_bytes: 9160
#include<bits/stdc++.h>
#define pb       push_back
#define mp       make_pair
#define mod      1000000007
#define first    ff
#define second   ss
#define pi       acos(-1.0)
#define test     int t;cin>>t;while(t--)
typedef long long ll;
using namespace std;
vector<int>node[10001];
ll bigmod(ll a,ll b)
{
    ll  res=1;
    a=a%mod;
    if(a==0)
        return 0;
    while(b>0)
    {

           if(b%2)
            res=(res*a)%mod;
            b=b>>1;
            a=(a*a)%mod;
    }
    return res;
}
int main()
{      


     ios::sync_with_stdio(false);
     cin.tie(NULL);
     cout.tie(NULL);
     
     int n;
     cin>>n;

     ll ans=(bigmod(10,n)-(2*bigmod(9,n))%mod+bigmod(8,n))%mod;
     if(ans<0)
        cout<<ans+mod<<endl;
     else
     cout<<ans<<endl;

      return 0;
    
 }   

Measured memory_bytes: 3876
#include<cstdio>
#include<algorithm>
#include<functional>
#include<cstring>
using namespace std;
int main(void)
{
	int r,g,b;
	scanf("%d %d %d",&r,&g,&b);
	if((g*10+b)%4==0)	printf("YES\n");
	else printf("NO\n");
	return 0;
}
	

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

void swap(int *a, int *b){
    int temp = *a;
    *a = *b;
    *b = temp;
}

int main(){
    int w,n;
    cin >> w >> n;
    int i;
    int c[w+1];
    for(i=0; i<=w; i++){
        c[i] = i;
    }
    int a,b;
    for(i=0; i<n; i++){
        scanf("%d,%d", &a, &b);
        swap(&c[a],&c[b]);
    }
    for(i=1; i<=w; i++){
        cout << c[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 3208
import java.util.*;
public class Main{
public static void main(String[]args){
Scanner sc=new Scanner(System.in);
  int n=sc.nextInt();int m=sc.nextInt();
  int count=0;
  for(int i=n;i<=m;i++){
  	String po=i+"";
    if(po.length()%2==0){
    	while(po.length()!=0){
        	if(po.substring(0,1).equals(po.substring(po.length()-1,po.length())))po=po.substring(1,po.length()-1);
          else break;
        }
      if(po.length()==0)count++;
    }
    else{
    while(po.length()!=1){
        	if(po.substring(0,1).equals(po.substring(po.length()-1,po.length())))po=po.substring(1,po.length()-1);
          else break;
        }
      if(po.length()==1)count++;
    }
  }
  System.out.println(count);
}
}

Measured memory_bytes: 40916
// ABC 085 B
#include<bits/stdc++.h>

using namespace std;
//container util
//------------------------------------------
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#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())
#define RSORT(c) sort((c).begin(),(c).end(),greater<int>())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define PB(a) push_back(a)
#define ALL(x) (x).begin(),(x).end()
#define MAX_EL(c) *max_element((c).begin(),(c).end())
#define MIN_EL(c) *min_element((c).begin(),(c).end())
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<long long> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef string str;

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int func(int n){
  int a=0;
  while(n){
    a += n%10;
    n /= 10;
  }
  return a;
}
int main(){
// magic spell------------------------------
  cin.tie(0);
  ios::sync_with_stdio(false);
//------------------------------------------

  int n,tmp=0,ans=0;
  cin >> n;
  VI d(n);
  REP(i,n){
    cin >> d[i];
  }
  SORT(d);
  REP(i,n){
    if(tmp<d[i]){ans++;tmp=d[i];}
  }

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


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

int main(){
  int M, N, H, W;
  int t = 0;
  cin >> N >> H >> W;

  vector<int> A(N);
  vector<int> B(N);
  for(int i = 0; i < N; i++)
    cin >> A.at(i) >> B.at(i);

  for(int i = 0; i < N; i++){
    if(A.at(i) >= H && B.at(i) >= W) t++;
  }
  
  cout << t << endl;
}

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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

template<typename H> void print(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void print(H head, T ...tail) { cout << head << " "; print(tail...); }

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

	int n, m, x; cin >> n >> m >> x;
	vector<int> c(n);
	vector<vi> a(n, vi(m));

	rep(i, 0, n) {
		cin >> c[i];
		rep(j, 0, m) {
			cin >> a[i][j];
		}
	}

	vector<int> cur(n);
	int ans = 9999999;
	auto dfs = [&](auto&& f, int d, int cost = 0) -> void {
		if (d == n) {
			bool ok = true;
			rep(i, 0, m) if (cur[i] < x) ok = false;
			if (ok) ans = min(ans, cost);
			return;
		}
		
		f(f, d + 1, cost);
		rep(i, 0, m) cur[i] += a[d][i];
		f(f, d + 1, cost + c[d]);
		rep(i, 0, m) cur[i] -= a[d][i];
	};

	dfs(dfs, 0, 0);

	cout << (ans == 9999999 ? -1 : ans) << endl;
}


Measured memory_bytes: 3660
N = int(input())

now = 4 # 4文字目から開始

lis = [1] * (4**3)

lis[2 * (4**1) + 1] = 0 #AGCはだめ
lis[1 * (4**1) + 2] = 0 #ACGはだめ
lis[2 * (4**2) + 1] = 0 #GACはだめ


while now <= N:

    nlis = [0] * (4**3)
    
    for i in range(4**3):

        #Aを追加(4で割って桁下げ)

        nlis[ ( i * 4 ) % 64 ] += lis[i]

        #Tを追加(4で割ったのち、3を加える)

        nlis[ (i * 4) % 64 + 3 ] += lis[i]

        #Gを追加(16で割ったあまりが1の時のみ不可)

        if i % 16 != 1:
            nlis[ (i * 4) % 64 + 2 ] += lis[i]

        #Cを追加(16で割ったあまりが2,8は不可/16で割った商が0かつ4で割ったあまり2不可/16で割った商が0かつ4で割った商2不可)

        if (i % 16 not in [2,8] ) and (not( i // 16 == 0 and i % 4 == 2)) and (not(i // 16 == 0 and i // 4 == 2)):

            nlis[ (i * 4) % 64 + 1 ] += lis[i]

    for j in range(4**3):

        lis[j] = nlis[j] % (10 ** 9 + 7)

    #print (lis)
        
    now += 1

print (sum(lis) % (10**9 + 7))


Measured memory_bytes: 39920