akhauriyash/Code-Regression huggingface dataset:
n=gets.to_i
def mf(i)
  puts i
  $stdout.flush
  s=gets.chomp
  if s=="Male"
    return 1
  elsif s=="Female"
    return 0
  else
    exit
  end
end
u=mf(0)
v=mf(n/2)
if (n/2+u+v).odd?
  l,r=0,n/2
else
  l,r=n/2,n
  u,v=v,u
end
while true
  m=(l+r)/2
  w=mf(m)
  if (l+m+u+w).odd?
    r=m
    v=w
  else
    l=m
    u=w
  end
end


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

int main() {
  int K, A, B;
  cin >> K >> A >> B;

  if ((B % K) == 0 || (A % K) == 0) {
    cout << "OK" << endl;
  }
  else if ((B / K) - (A / K) >= 1) {
    cout << "OK" << endl;    
  }
  else {
    cout << "NG" << endl;
  }
}

Measured memory_bytes: 3632
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MOD2 998244353
#define MAX_N (1 << 17)
#define YES printf("Yes\n")
#define NO printf("No\n")
#define PN printf("\n")



void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll min3(ll a, ll b, ll c){return (a<=b && a<=c) ? a : b<=c ? b : c;}
ll max3(ll a, ll b, ll c){return (a>=b && a>=c) ? a : b>=c ? b : c;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll mod(ll n){return n%=MOD1;}
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

typedef struct{ ll aa , bb;} fr;
int cmp1( const void *p, const void *q ) { return ((fr*)p) ->aa - ((fr*)q)->aa;}

int main(void){
    // char ;
    ll n,h,w;
    scanf("%lld%lld%lld",&h,&w,&n);
    ll a[n],color[n],panel[h][w];
    rep(i,0,n){
        scanf("%lld",&a[i]);
    }
    color[0]=a[0];
    rep(i,1,n){
        color[i]=color[i-1]+a[i];
    }
    ll p=0,c=0;
    rep(i,0,h){
        if(i%2){
            rrep(j,w-1,0){
                if(p>=color[c]){
                    c++;
                }
                panel[i][j]=c+1;
                p++;
            }
        }else{
            rep(j,0,w){
                if(p>=color[c]){
                    c++;
                }
                panel[i][j]=c+1;
                p++;
            }
        }
    }
    rep(i,0,h){
        rep(j,0,w){
            printf("%lld ",panel[i][j]);
        }
        PN;
    }
    // printf("\n");
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int N, M;
int A[1010], B[1010], C[1010];
int dist[101][101];
void Warshall_Floyd(int n) {
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			for (int k = 0; k < n; k++) {
				dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
			}
		}
	}
}
int main() {
	cin >> N >> M;
	for (int i = 0; i <N; i++) {
		for (int j = 0; j <N; j++) {
			if (i == j) dist[i][j] = 0;
			else  dist[i][j] = 100000000;
		}
	}
	pair<int, int> edge[M];
	int C[M];
	for (int i = 0; i < M; i++) {
		int a, b; cin >> a >> b;
		a--; b--;
		edge[i].first = a;
		edge[i].second = b;
		cin >> C[i];
	}
	for (int i = 0; i < M; i++) {
		int a, b;
		a=edge[i].first;
		b = edge[i].second;
		dist[a][b] = min(dist[a][b], C[i]);
		dist[b][a] = min(dist[b][a], C[i]);
	}
	Warshall_Floyd(N);
	int ans = M;
	for (int i = 0; i < M; i++) {
		bool flag = false;
		for (int j = 0; j < N; j++) {
			if (dist[j][edge[i].second] == (dist[j][edge[i].first] + C[i])) flag = true;
		}
		if (flag) ans--;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right

# https://atcoder.jp/contests/abc103/tasks/abc103_b
S = input()
T = input()
S = S + S
print('Yes' if S.count(T) else 'No')


Measured memory_bytes: 38256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		double a[] = new double[N];
		double sum = 0;
		double avg;
		for (int i = 0; i < N; i++) {
			a[i] = sc.nextDouble();
			sum += a[i];
		}
		avg = sum / N;
		double d_min = 1000;
		int ans = 0;
		for (int i = 0; i < N; i++) {
			if (Math.abs(a[i] - avg) < d_min) {
				ans = i;
				d_min = Math.abs(a[i] - avg);
			}
		}

		System.out.println(ans);

		sc.close();
	}

}


Measured memory_bytes: 24404
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define f(i,n) for(int i=0;i<n;++i)
#define pie 3.141592653589793238462643383279
#define mod 1e9+7
signed main(){
	int a,b;
	cin>>a>>b;
	cout<<max(a+b,max(a,b)*2-1)<<endl;
}


Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define Graph vector<vector<int>>
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1000000007;

ll power(ll m, ll n){
    if(n == 0) return 1;
    if(n % 2 == 1) return m * power(m, n - 1) % INF;
    ll tmp = power(m, n/2);
    return tmp * tmp % INF;
}

ll com(vector<ll> &F, vector<ll> &R, ll m, ll n){
    if(m < 0 || n < 0 || m < n) return 0;
    ll tmp = F[m];
    tmp *= R[n];
    tmp %= INF;
    tmp *= R[m - n];
    tmp %= INF;
    return tmp;
}

int main(){
    int N, K;
    cin >> N >> K;
    vector<ll> F(2020, 1), R(2020, 1);
    for(ll i = 1; i <= 2010; i++){
        F[i] = F[i - 1] * i % INF;
        R[i] = power(F[i], INF - 2);
    }

    for(ll i = 1; i <= K; i++){
        cout << com(F, R, K - 1, i - 1) * com(F, R, N - K + 1, i) % INF << endl; 
    }
 
}

Measured memory_bytes: 256
N, M = map(int, input().split())
graph = {}
visited = {}
for v in range(1,N+1):
    graph[v] = []
    visited[v] = False

for i in range(M):
    x, y, z = map(int, input().split())
    graph[x].append(y)
    graph[y].append(x)

def dfs(v):
    Q = [v]
    visited[v] = True
    while Q:
        v = Q.pop()
        for u in graph[v]:
            if not visited[u]:
                visited[u] = True
                Q.append(u)

count = 0
for i in range(1,N+1):
    if not visited[i]:
        dfs(i)
        count += 1
print(count)



Measured memory_bytes: 37660
// -*- coding:utf-8-unix -*-

use proconio::input;

// ABC086C - Traveling
// https://atcoder.jp/contests/abs/fasks/arc089_a

fn main() {
    input! {
        n: String,
    }
    if n.contains("7") {
        println!("Yes")
    } else {
        println!("No")
    }
}


Measured memory_bytes: 2132
using System;
using System.Collections.Generic;

public class CSharp
{
    public static void Main()
    {
        Kyopuro chokudai = new Kyopuro();
        chokudai.AtCoder();
    }
}

public class Kyopuro
{

    int n;
    int[] p;

    public void AtCoder()
    {
        string[] input;
        n = int.Parse(Console.ReadLine());
        input = Console.ReadLine().Split(' ');
        p = new int[n];
        for(int i=0; i<n; i++)
        {
            p[i] = int.Parse(input[i]);
        }
        var x = new List<int>();
        int ans = 0;
        for(int i=1; i<n-1; i++)
        {
            x = new List<int>();
            x.Add(p[i - 1]);
            x.Add(p[i]);
            x.Add(p[i + 1]);
            x.Sort();
            if (x[1] == p[i]) ans++;
        }
        
        Console.WriteLine(ans);
        
    }
    public static void DebugWL(object x) { System.Diagnostics.Debug.WriteLine(x); }
}


Measured memory_bytes: 11220
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long n;
	scanf("%lld",&n);
	for(int i=sqrt(n+1);i>=1;i--){
		if(n%i==0){
			printf("%lld",(i+n/i)-2);
			break;
		}
	}
} 

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

long long n ;

void input ( ) {
    scanf ( "%lld" , &n ) ;
}


void solve ( ) {
    -- n ;
    printf ( "%lld\n" , n * ( n + 1 ) / 2 ) ;
}

int main ( ) {
    ios_base :: sync_with_stdio ( false ) ;
    cin.tie ( NULL ) ;
    input ( ) ;
    solve ( ) ;
    return 0 ;
}


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

const int mod = 1e9 + 7;

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

  int n;
  cin >> n;

  vector<int> a(n);
  rep(i,n) cin >> a[i];

  vector<int> bit(62);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 62; j++) {
      if(1 & (a[i] >> j)) bit[j]++;
    }
  }

  int answer = 0;
  for (int i = 0; i < 62; i++) {
    int x = bit[i];
    int y = n - bit[i];
    answer += (1LL << i) % mod * x % mod * y % mod;
    answer %= mod;
  }
  cout << answer << '\n';
}


Measured memory_bytes: 5556
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int K = scanner.nextInt();
        int[] h = new int[N];
        int[] dp = new int[N];

        for(int i = 0 ; i < N; i++) {
            h[i] = scanner.nextInt();
            dp[i] = Integer.MAX_VALUE;
        }

        dp[0] = 0;
        for(int i = 1; i < N; i++) {
            for(int j = 1; j <= K; j++) {
                if(i-j >= 0) dp[i] = Math.min(dp[i], Math.abs(h[i] - h[i-j]) + dp[i-j]);
            }
        }
        System.out.println(dp[N-1]);
    }
}

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define ALL(v) (v).begin(), (v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x, n) bitset<n>(x)
#define PI 3.14159265358979323846

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

//-------------------------------------------------

int NN, MM;
const int MOD = 1e9 + 7;
const int N = 1e6 + 10;
ll ans = 1;

vector< ll > fc(N + 10), ifc(N + 10);
// 冪乗
ll pow(ll n, int a) {
	ll res = 1;
	while (a > 0) {
		if (a & 1) (res *= n) %= MOD;
		(n *= n) %= MOD;
		a >>= 1;
	}
	return res;
}
//逆元
ll inv(ll n) {
	return pow(n, MOD - 2);
}
void init() {
	fc[0] = 1;
	for (int i = 1; i <= N; i++) fc[i] = fc[i - 1] * i % MOD;
	ifc[N] = inv(fc[N]);
	for (int i = N - 1; i >= 0; i--) ifc[i] = ifc[i + 1] * (i + 1) % MOD;
}

ll comb(int n, int r) {
	if (r < 0 || n < r) return 0;
	return fc[n] * ifc[r] % MOD * ifc[n - r] % MOD;
}


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

	init();
	cin >> NN >> MM;
	int tmp = MM;
	for (int i = 2; i * i <= MM; i++) {
		if (tmp % i == 0) {
			int cnt = 0;
			while(tmp % i == 0) tmp /= i, cnt++;
			(ans *= comb(NN + cnt - 1, NN - 1)) %= MOD;
		}
	}
	if (tmp > 1) (ans *= comb(NN, NN - 1)) %= MOD;
	cout << ans % MOD << endl;

	return 0;
}



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

long long mod = 1000000007;

long long mpow(long long x, long long y){
  if(y==0) return 1;
  
  long long ret = mpow(x,y/2);
  ret *= ret;
  ret %= mod;
  if(y%2==1) ret *= x;
  ret %= mod;
  return ret;
}

int main(){
  long long N;
  cin >> N;
  
  long long ans = mpow(10,N);
  ans += mod;
  ans -= mpow(9,N);
  ans %= mod;
  ans += mod;
  ans -= mpow(9,N);
  ans %= mod;
  ans += mpow(8,N);
  ans %= mod;
  cout << ans << endl;
  return 0;
}


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

int gseqhasher(string);

int main(int argc, char const *argv[])
{

    int maxhashed = gseqhasher("TTTTTTTTTTTT");
    vector<bool> isContained(maxhashed, false);

    int n;
    cin >> n;

    string comm, str;
    for (int i = 0; i < n; i++)
    {
        cin >> comm >> str;
        if (comm.at(0) == 'i')
        {
            isContained[gseqhasher(str)] = true;
        }
        else if (comm.at(0) == 'f')
        {
            if (isContained[gseqhasher(str)])
            {
                cout << "yes" << endl;
            }
            else
            {
                cout << "no" << endl;
            }
        }
    }

    return 0;
}

int gseqhasher(string str)
{
    int res = 0;

    map<char, int> m;
    m['A'] = 1;
    m['C'] = 2;
    m['G'] = 3;
    m['T'] = 4;

    for (int i = 0; i < static_cast<int>(str.length()); i++)
    {
        res += pow(5, i) * m[str.at(i)];
    }

    return res;
}


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

void code()
{
    ll n,r;
    cin>>n>>r;
    if(n>=10)
        cout<<r<<endl;
    else
        cout<<r+100*(10-n)<<endl;
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll t=1;
    // cin>>t;
    while(t--)
    {
        code();
    }
}


Measured memory_bytes: 256
#if 0
date +%Y.%m.%d

不妨设 n > 1 。

如果所有 a[i] 都是奇数，那么先手操作后会有一个偶数，约分后仍然有唯一偶数，
此时后手一定可以对唯一偶数操作，所有数成为奇数，约分后同样如此，
直到所有数都为 1 ，仍然没有偶数，那么当 a[i] 全是奇数时先手必败。

更一般的，假设 n 足够大奇数足够多，如果有偶数个偶数，
先手操作后有奇数个偶数，后手一定可以对偶数操作使得状态还原至奇数个偶数，
也就是说有奇数个偶数时先手必胜，反之先手必败。

特别的是，如果有偶数个偶数且奇数唯一，此时先手对唯一奇数操作后，所有数都是偶数，
此时一定可以约分，并且约分后的结果是难以推断的。
由于这种情况一定可以约分，那么所有数至少缩小一半，也就是最多进行 O(logn) 次，
每次碰到这种情况暴力约分即可，直到转为上述可以直接判断的情况。
#endif
#include <cstdio>
#include <algorithm>
#define debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long ll;

struct {
	inline operator int () { int x; return scanf("%d", &x), x; }
	inline operator ll () { ll x; return scanf("%lld", &x), x; }
	template<class T> inline void operator () (T &x) { x = *this; }
	template<class T, class ...A> inline void operator () (T &x, A &...a)
	{ x = *this; this -> operator ()(a...); }
} read;

const int maxn = 100005;
int a[maxn];

bool game(int n) {
	if(n == 1) return a[1] > 1;

	int even = 0;
	for(int i = 1; i <= n; i ++)
		if(!(a[i] & 1))
			++ even;

	if(even & 1) return 1;
	if(even != n - 1) return 0;

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

	int gcd = a[1];
	for(int i = 2; i <= n; i ++)
		gcd = std::__gcd(gcd, a[i]);

	for(int i = 1; i <= n; i ++)
		a[i] /= gcd;

	return !game(n);
}

int main() {
	int n = read;

	for(int i = 1; i <= n; i ++)
		read(a[i]);

	if(n > 1) {
		int gcd = a[1];
		for(int i = 2; i <= n; i ++)
			gcd = std::__gcd(gcd, a[i]);

		for(int i = 1; i <= n; i ++)
			a[i] /= gcd;
	}


	puts(game(n) ? "First" : "Second");
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(ll i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<ll, ll>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    vector<ll> b(n);
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];
    
    ll ans = 0;
    

    rep(i, 30) {
        ll res = 0;
        vector<ll> mb(n);
        rep(j, n) {
            mb[j] = b[j] % (1LL<<(i+1));
        }
        sort(whole(mb));
        rep(j, n) {
            ll ma = a[j] % (1LL<<(i+1));
            auto it1 = lower_bound(whole(mb), (1LL<<i) - ma);
            auto it2 = lower_bound(whole(mb), (1LL<<(i+1)) - ma);
            auto it3 = lower_bound(whole(mb), (1LL<<i)*3 - ma);
            auto it4 = lower_bound(whole(mb), (1LL<<(i+2)) - ma);
            ll now = it2 - it1;
            now += it4 - it3;
            res += now;
        }
        if (res%2==1) {
            ans += 1LL<<i;
        }
    }
    

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


Measured memory_bytes: 4992
#include <stdio.h>

int ll(int a){
	if(a<0) a=0-a;
	return a;
}

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

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
    int H1,H2,M1,M2,K;
    cin>>H1;
    cin>>M1;
    cin>>H2;
    cin>>M2;
    cin>>K;
    int num=H2*60+M2-(H1*60+M1)-K;
    if(num<0){
        num=0;
    }
    cout<<num;
}

Measured memory_bytes: 3532
#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,a,b,c,d,T;
map<int,int>mp;
int dfs(int x){
	if(mp.find(x)!=mp.end())return mp[x];
//	printf("%d\n",x);
	int res=(1.0*x*d>1e18?1e18:x*d);
	res=min(res,dfs(x>>1)+a+d*(x&1));
	if(x&1)res=min(res,dfs((x>>1)+1)+a+d*(2-(x&1)));
	res=min(res,dfs(x/3)+b+d*(x%3));
	if(x%3)res=min(res,dfs((x/3)+1)+b+d*(3-(x%3)));
	res=min(res,dfs(x/5)+c+d*(x%5));
	if(x%5)res=min(res,dfs((x/5)+1)+c+d*(5-(x%5)));
	return mp[x]=res;
}
signed main(){
	cin>>T;
	while(T--){
		cin>>n>>a>>b>>c>>d;
		mp.clear(),mp[0]=0,mp[1]=d;
		cout<<dfs(n)<<endl;
	}
	return 0;
}

Measured memory_bytes: 4392
N, A, B = map(int, input().split())

A, B = min(A, B), max(A, B)
if (B - A) % 2 == 0:
    print((B - A) // 2)
else:
    L = A - 1
    R = N - B
    if R < L:
        print((R + (N - A) + 1) // 2)
    else:
        print((L + (B - 1) + 1) // 2)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int a[200005];
vector<int>v[200005];
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<n;i++)
	{
		cin>>a[i];
		v[a[i]-1].push_back(i);
	}
	for(int i=0;i<n;i++)
		cout<<v[i].size()<<endl;

	return 0;
}

Measured memory_bytes: 15248
//Solve A

using System;

public class Class
{
	static void Main()
	{
        string input = Console.ReadLine();
        string[] Sinput = input.Split(' ');
        int coin1 = Convert.ToInt32(Sinput[0]);
        int coin2 = Convert.ToInt32(Sinput[1]);
        int value = Convert.ToInt32(Sinput[2]);
        if (coin1 + coin2 >= value)
        {
            Console.Write("Yes");
        }
        else
        {
            Console.Write("No");
        }
	}
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

const int mod = 1e9 + 7;
const int MX = 10000;
ll inv[MX], f[MX], invf[MX];
void calc(){
	inv[0] = inv[1] = f[0] = f[1] = invf[0] = invf[1] = 1;
	for (int i = 2; i < MX; i++){
		inv[i] = mod - mod / i * inv[mod % i] % mod;
		f[i] = f[i - 1] * i % mod;
		invf[i] = invf[i - 1] * inv[i] % mod;
	}
}

ll dp[2][1100], C[1100][1100], grp[1100][1100];

int main(){
	calc();
	rep(i, 1100) rep(j, i+1) C[i][j] = j == 0 || j == i ? 1 : (C[i-1][j] + C[i-1][j-1]) % mod;
	rep(i, 1100) for(int j = 1; j <= i; j++) if(i % j == 0){
		grp[i][j] = f[i] * invf[j] % mod;
		rep(k, j) grp[i][j] = grp[i][j] * invf[i / j] % mod;
	}
	grp[0][0] = 1;
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n, a, b, c, d; cin >> n >> a >> b >> c >> d;
	
	dp[0][n] = 1;
	int cur = 0, next = 1;
	for(int i = a; i <= b; i++){
		memset(dp[next], 0, sizeof(dp[next]));
		for(int j = 0; j <= n; j++) if(dp[cur][j]) for(int k = 0; i * k <= j; k++){
			
			if(!(k == 0 || c <= k && k <= d)) continue;
			dp[next][j - i * k] += dp[cur][j] * C[j][i * k] % mod * grp[i * k][k] % mod;
			dp[next][j - i * k] %= mod;
		}
		swap(cur, next);
	}
	cout << dp[cur][0] << endl;
	return 0;
}

Measured memory_bytes: 18560
/*input
10 1000000000000000000
0 0 1 1 0 0 0 1 1 0
0 0 0 0 0 1 1 1 0 0
0 1 0 0 0 1 0 1 0 1
1 1 1 0 1 1 0 1 1 0
0 1 1 1 0 1 0 1 1 1
0 0 0 1 0 0 1 0 1 0
0 0 0 1 1 0 0 1 0 1
1 0 0 0 1 0 1 0 0 0
0 0 0 0 0 1 0 0 0 0
1 0 1 1 1 0 1 1 1 0

3 3
0 1 0
1 0 1
0 0 0

4 2
0 1 0 0
0 0 1 1
0 0 0 1
1 0 0 0
*/

#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
typedef long long int ll;

const ll inf = 1e9;
const int mod=1000000007;

ll n;
ll K;

vector<vector<ll>>adj;
vector<vector<ll>>answer;
vector<vector<ll>>identity;

vector<vector<ll>>mulmat(vector<vector<ll>>a, vector<vector<ll>>b){
    vector<vector<ll>>ret;
    ret.resize(n, vector<ll>(n, 0));
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < n; ++j){
            for(int k = 0; k < n; ++k){
                ret[i][j] = (ret[i][j] + (a[i][k] * b[k][j]) % mod) % mod;
            }
        }
    }
    return ret;
}

void MatPow_Iterative(vector<vector<ll>>mat, ll k){
    while(k){
        if(k % 2){
            identity = mulmat(identity, mat);
            k--;
        }
        else{
            mat = mulmat(mat, mat);
            k = k / 2;
        }
    }
}

int main(){
    #if ONLINE_JUDGE
        ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
    #endif

    cin >> n >> K;        

    adj.resize(n, vector<ll>(n, 0));

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

    identity.resize(n, vector<ll>(n, 0));

    for(int i = 0; i < n; ++i)
        identity[i][i] = 1;

    MatPow_Iterative(adj, K);

    ll ans = 0;

    for(int i = 0; i < n; ++i){
    	for(int j = 0; j < n; ++j){
            ans = (ans + identity[i][j]) % mod;
    	}
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
long long w[1001],v[1001],f[107][100007];
int main()
{
        long long i,j,n,W,s=0;
            cin>>n>>W;
        for(i=1;i<=n;i++)
        {   cin>>w[i]>>v[i]; s+=v[i]; }
        for(i=1;i<=s;i++)
            f[0][i]=30000000000;
        for(i=1;i<=n;i++)
                for(j=1;j<=s;j++)
                {
                        f[i][j]=f[i-1][j];
                        if(j>=v[i])
                        f[i][j]=min(f[i][j],f[i-1][j-v[i]]+w[i]);
                }
        for(i=s;i>=1;i--)
                if(f[n][i]<=W)
                { cout<<i;  break;}
}


Measured memory_bytes: 80128
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;



void main() {
    int n, k;
    scan(n, k);

    auto mc = ModComb(n * 2);

    foreach (i ; 1 .. k + 1) {
        auto ans = mc.c(k - 1, k - i) * mc.c(n - k + 1, n - k - (i - 1)) % mod;
        writeln(ans);
    }
}



struct ModComb {
    int _N;
    long[] _fact, _factinv;
    long _mod;

    this(int n, long mod = 1_000_000_007L) {
        _N = n;
        _fact = new long[](_N + 1);
        _factinv = new long[](_N + 1);
        _mod = mod;

        _fact[0] = 1;
        foreach (i ; 1 .. _N + 1) {
            _fact[i] = (_fact[i-1] * i) % mod;
        }

        _factinv[_N] = _powmod(_fact[_N], mod - 2);
        foreach_reverse (i ; 0 .. _N) {
            _factinv[i] = (_factinv[i+1] * (i+1)) % mod;
        }
    }

    long c(int n, int k) {
        if (k < 0) return 0;
        return f(n) * finv(n - k) % _mod * finv(k) % _mod;
    }

    long p(int n, int r) {
        return f(n) * finv(n - r) % _mod;
    }

    long f(int n) {
        return _fact[n];
    }

    long finv(int n) {
        return _factinv[n];
    }

    long _powmod(long x, long y) {
        return y > 0 ? _powmod(x, y>>1)^^2 % _mod * x^^(y & 1) % _mod : 1;
    }
}







void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}


Measured memory_bytes: 380
#include "bits/stdc++.h"
using namespace std;

int main() {
	int N, H, MAX, count = 1;
	cin >> N >> MAX;
	for (int i = 1; i < N; i++) {
		cin >> H;
		if (MAX <= H) {
			count++;
			MAX = H;
		}
	}
	cout << count << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n) for(ll i=0;i<(n);i++)
#define For1(i,n) for(ll i=1;i<(n);i++)
int main(){
    ll n,ans=0;cin>>n;
    cout<<(n*(n-1))/2<<endl;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func stdInInt() int {
	var N int
	fmt.Scan(&N)
	return N
}

func stdInSlice() []string {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	stringInput := scanner.Text()
	return strings.Split(stringInput, " ")
}

func stdOutList(list *[]string) {
	str := fmt.Sprintf("%v", *list)
	str = strings.Trim(str, "[]")
	fmt.Println(str)
}

func BubbleSort(A []string, N int) {
	i := 0
	s := 0
	for i < N {
		for j := N - 1; j >= 1; j-- {
			if getNum(A[j]) < getNum(A[j-1]) {
				tmp := A[j]
				A[j] = A[j-1]
				A[j-1] = tmp
				s++
			}
		}
		i++
	}
}

func getNum(str string) int {
	n, _ := strconv.Atoi(str[1:2])
	return n
}

func getSuit(str string) string {
	return str[0:1]
}

func SelectionSort(A []string, N int) {
	i := 0
	s := 0
	for i < N-1 {
		min := i
		for j := i; j < N; j++ {
			if getNum(A[j]) < getNum(A[min]) {
				min = j
			}
		}
		if getNum(A[min]) != getNum(A[i]) {
			tmp := A[min]
			A[min] = A[i]
			A[i] = tmp
			s++
		}
		i++
	}
}

func isStable(A1 []string, A2 []string, N int) bool {
	for i := 0; i < N; i++ {
		if getSuit(A1[i]) != getSuit(A2[i]) {
			return false
		}
	}
	return true
}

func main() {
	N := stdInInt()
	A := stdInSlice()
	A2 := make([]string, N)
	copy(A2, A)
	BubbleSort(A, N)
	stdOutList(&A)
	fmt.Println("Stable")
	SelectionSort(A2, N)
	stdOutList(&A2)
	if isStable(A, A2, N) {
		fmt.Println("Stable")
	} else {
		fmt.Println("Not stable")
	}
}



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

int main() {
  long long X,Y;
  cin >> X >> Y;
  
  long long i = 2;
  int count = 1;
  while(Y/X >= i){
    count++;
    i *= 2;
  }
  
  cout << count << endl;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define MOD 1000000007
#define ll long long int
#define pi pair <ll,ll>
#define vi vector <ll>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define SQ(a) (a)*(a)
#define ordered_set tree<ll, null_type,greater_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>       //greater_equal<ll> or less<ll>
// find_by_key()   order_of_key()
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
/*bool comp(string a, string b) {
if (a.size() != b.size()) return a.size() < b.size();
return a < b;
}*/


int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    /*freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);*/
    ll i,j,c,d,t,l=0,prev=0,max1=0,flag=0,cnt=0,y,min1,q;
    double x,n,m,k;
    cin>>x;
    n=100;
    while(n<x){
        d=n/100;
        n+=d;
        cnt+=1;
    }
    cout<<cnt<<endl;





    return 0;
}


Measured memory_bytes: 3752
#pragma GCC optimize("O3")
#define first x
#define second y
#include <bits/stdc++.h>

using namespace std;

enum {MOD0 = 1000000000, MOD7 = 1000000007, MOD9 = 1000000009};
typedef unsigned short ushort;typedef unsigned int uint;typedef long long ll;typedef unsigned long long ull;
#ifndef CrafterKolyan
#define endl '\n'
#endif

signed main() {
#ifndef CrafterKolyan
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#endif
    int n, mi, ma, x;
    cin >> n;
    cin >> mi;
    ma = mi;
    while (--n) {
        cin >> x;
        mi = min(mi, x);
        ma = max(ma, x);
    }
    cout << ma - mi << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int T = sc.nextInt();
        int A = sc.nextInt();
        double[] diff = new double[N];
        int minIdx = -1;

        for (int i = 0; i < N; i++) {
            double h = sc.nextDouble();
            double t = T - h * 0.006;
            diff[i] = Math.max(A, t) - Math.min(A, t);
        }

        int Idx = 0;
        double tmpDiff = 1e8;
        for (int i = 0; i < N; i++) {
            if (diff[i] < tmpDiff) {
                tmpDiff = diff[i];
                Idx = i;
            }
        }

        System.out.println(Idx + 1);
    }
}


Measured memory_bytes: 26952
#include <bits/stdc++.h>
using namespace std;
  
int main(){
  long long N,M,ans;
  long long mod=1000000007;
  cin >> N >> M;
  ans=1;
  if(abs(N-M)>=2){ans=0;}
  else if(N==M){
    for(int i=1;i<=N;i++){ans=ans*i%mod;}
    ans=ans*ans*2%mod;
  }
  else{
    for(int i=1;i<=N;i++){ans=ans*i%mod;}
    for(int i=1;i<=M;i++){ans=ans*i%mod;}
  }
  cout << ans << endl;
}

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

using namespace std;



int main(){


	long long n; cin >> n;

	map <string, long long> m;


	string s;
	for(long long i = 0; i < n; i++){
		cin >> s;
		sort(s.begin(), s.end());
		m[s]++;
	}

	long long ans = 0;

	for(auto &it : m){
		ans += (it.second * (it.second - 1)) / 2;
	}

	cout << ans << endl;


	return 0;
}

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


void solve(long long N, std::vector<long long> a, long long sum){
  long long mymin = LLONG_MAX;
  long long minidx;

  for(long long i = 0; i < N; i++){
    if(mymin > abs(sum - a[i]*N)) {
      mymin = min(mymin, abs(sum - a[i]*N));
      minidx = i;
    }
  }

  cout << minidx << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N, sum = 0;
  scanf("%lld",&N);
  std::vector<long long> a(N-1-0+1);
  for(int i = 0 ; i < N-1-0+1 ; i++){
    scanf("%lld",&a[i]);
    sum += a[i];
  }
    solve(N, std::move(a), sum);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int no_of_stones;
    cin >> no_of_stones;
    vector <int> height(no_of_stones + 1, 0);
    for(int i = 1; i <= no_of_stones; i++)
    {
        cin >> height[i];
    }
    vector <int> minimum_cost(no_of_stones + 1);
    //minimum_cost[1] = height[1];
    minimum_cost[2] = abs(height[2] - height[1]);
    for(int i = 3; i <= no_of_stones; i++)
    {
        minimum_cost[i] = min(minimum_cost[i - 1] + abs(height[i] - height[i - 1]),minimum_cost[i - 2] + abs(height[i] - height[i - 2]));
    }
    cout << minimum_cost[no_of_stones];
    return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <vector>
#include <cstring>

using namespace std;
using ll = long long;

/**
 * ?????¨?????§??????????????°
 *
 * O(EV)
 */
template<int V>
struct BitMatching {
    vector<int> G[2*V];
    int match[2*V];
    bool used[2*V];
    /// ?????????
    void init() {
        for (int i = 0; i < 2*V; i++) {
            G[i].clear();
        }
    }
    /// ?????´???a????????¨?????´???b?????????????????????
    void add(int a, int b) {
        G[a].push_back(b+V);
        G[b+V].push_back(a);
    }

    bool dfs(int v) {
        used[v] = true;
        for (int i = 0; i < G[v].size(); i++) {
            int u = G[v][i], w = match[u];
            if (w < 0 || (!used[w] && dfs(w))) {
                match[v] = u;
                match[u] = v;
                return true;
            }
        }
        return false;
    }
    /// ?????§??????????????°?????¬??°???????????????
    int exec() {
        int res = 0;
        memset(match, -1, sizeof(match));
        for (int v = 0; v < V; v++) {
            if (match[v] < 0) {
                memset(used, 0, sizeof(used));
                if (dfs(v)) {
                    res++;
                }
            }
        }
        return res;
    }
};

const int MN = 520;
BitMatching<MN> bm;
ll gcd(ll a, ll b) {
    if (b == 0) return a;
    return gcd(b, a%b);
}
int main() {
    while (true) {
        int n, m;
        cin >> n >> m;
        if (!n) break;
        bm.init();
        int a[n], b[m];
        for (int i = 0; i < n; i++) {
            cin >> a[i];
        }
        for (int i = 0; i < m; i++) {
            cin >> b[i];
        }

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                if (gcd(a[i], b[j]) != 1) {
                    bm.add(i, j);
                }
            }
        }
        cout << bm.exec() << endl;
    }
    return 0;
}

Measured memory_bytes: 4900
n=int(input())
a=list(map(int,input().split()))
e=list(set(a))
s=0
t=[0]*200000
for i in a:
    t[i]+=1
for j in e:
    k=t[j]
    s+=(k*(k-1))//2
for u in a:
    print(s-t[u]+1)

Measured memory_bytes: 26140
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int ans=0;
    string s,t;
    cin >>s;
    cin >>t;
    for (int i=0;i<s.length();i++){
        if(s[i]!=t[i]) ans++;
    }
    
    cout << ans <<endl;
}

Measured memory_bytes: 3916
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ldb = long double;
using pa = pair < ll, ll >;
using vec = vector < ll >;
#define pb push_back
#define po pop_back
#define mp make_pair
#define mt make_tuple
#define F  first
#define S  second
#define f(i,x,n) for(ll i=x;i<n;i++) 
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))
#define all(c) c.begin(),c.end()
#define str string
#define edl "\n"
#define add insert
#define cot continue
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
const int MOD = 1e9 + 7, INF = INT_MAX, N = 1e5 + 10;
const double PI = acos(-1);
const ll LINF = LLONG_MAX;




int main() 
{

 fast();
  
  // #ifndef ONLINE_JUDGE
  //   freopen("input.txt", "r", stdin);
  //   freopen("output.txt","w",stdout);
  // #endif
  
  char ch;
  cin>>ch;

  if(ch=='A')
    cout<<"T";
  if(ch=='T')
    cout<<"A";
  if(ch=='C')
    cout<<"G";
  if(ch=='G')
    cout<<"C";

  


    




    cerr << "Time taken: " << int((clock() * 1000.) / CLOCKS_PER_SEC) << "ms\n";
    return 0;
}
 

Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <vector>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
using namespace std;

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

const LL  INF=1<<31;
const LL MOD=1000000007;



int main(){
    LL n,m;
    cin>>n>>m;
    LL ans=0;
    ans+=min(n,m/2);
    LL m2=m-ans*2;
    ans+=m2/4;
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

int main()
{
    ll n, sum, add, ans1, ans2, a[112345], s[112345];
    bool hugou;
    cin >> n;
    sum = 0;
    REP(i, n)
    {
        cin >> a[i];
        if (i == 0)
            s[i] = a[i];
        else
            s[i] = s[i - 1] + a[i];
    }

    ans1 = 0;
    add = 0;
    hugou = true;
    REP(i, n)
    {
        if (hugou && s[i] + add <= 0)
        {
            ans1 += 1 - (s[i] + add);
            add += 1 - (s[i] + add);
        }
        else if (!hugou && s[i] + add >= 0)
        {
            ans1 += s[i] + add - (-1);
            add -= s[i] + add - (-1);
        }

        hugou = !hugou;
    }

    ans2 = 0;
    add = 0;
    hugou = false;
    REP(i, n)
    {
        if (hugou && s[i] + add <= 0)
        {
            ans2 += 1 - (s[i] + add);
            add += 1 - (s[i] + add);
        }
        else if (!hugou && s[i] + add >= 0)
        {
            ans2 += s[i] + add - (-1);
            add -= s[i] + add - (-1);
        }

        hugou = !hugou;
    }

    cout << min(ans1, ans2) << endl;

    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=9000000000000000000;
long double pi=3.14159265358979323846L;
double eps=1e-12;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll popcount(ll n){
    ll ret=0;
    while(n>0){
        ret+=n%2;
        n/=2;
    }
    return ret;
}
ll gya[1000010];
ll kai[1000010];
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll bit[800010];
ll u;
void bitinit(ll n){
    ll y=1;
    rep(i,0,69){
        
        if(y>=n){
            u=y;
            break;
        }
        y*=2;
    }
    fill(bit,bit+u+10,0);
}
void add(ll n,ll x){
    ll i=n;
    bit[i]+=x;
    bit[i]%=mod;
    while(i<u){
        i+=i&(-i);
        bit[i]+=x;
        bit[i]%=mod;
    }
}
ll sum(ll n){
    ll i=n;
    ll ret=0;
    while(i>0){
        ret+=bit[i];
        i-=i&(-i);
        ret%=mod;
    }
    return ret;
}
ll rev(ll n){
    ll ret=0;
    vector<ll> v;
    while(n>0){
        v.push_back(n%10);
        n/=10;
    }
    reverse(v.begin(),v.end());
    ll now=1;
    rep(i,0,v.size()){
        ret+=v[i]*now;
        now*=10;
    }
    return ret;
}
ll dfs(ll d,ll now,ll ue,ll si,ll sum){
    if(now<=0){
        if(d==0)return sum;
        else return 0;
        
    }
    ll ret=0;
    rep(i,-9,10){
        ll yy=d-now*i;
        ll ne=max((ll)0,ue/10-si*10);
        if(abs(yy)>ne*100)continue;
        ll rr=10-abs(i);
        if(si==1&&i>=0)rr=9-i;
        ret+=dfs(d-now*i,ue/10-si*10,ue/10,si*10,sum*rr);
    }
    return ret;
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll d;cin>>d;
    ll ans=0;
    ll now=0;
    rep(i,2,20){
        now*=10;
        now+=9;
        ll ue=now+1;
        ll si=1;
        ll noww=d;
        ll ttt=1;
        if(i%2)ttt=10;
        ans+=dfs(noww,now,ue,si,1)*ttt;
    }
    cout<<ans<<endl;
}




Measured memory_bytes: 256
def resolve():
	h, w = map(int, input().split())
	grid = []
	for _ in range(h):
		grid.append(list(input()))
	for i in range(h):
		removable = True
		for j in range(w):
			if grid[i][j] == '#':
				removable = False
				break
		if removable:
			for j in range(w):
				grid[i][j] = False

	for i in range(w):
		for j in range(h):
			removable = True
			if grid[j][i] == '#':
				removable = False
				break
		if removable:
			for j in range(h):
				grid[j][i] = False
	for r in grid:
		ans = ""
		for el in r:
			if el:
				ans += el
		if ans:
			print(ans)
resolve()

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

public class Main{

	public static void main(String[] args){
		solve();
	}

	public static void solve(){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		if(s.length()>=4 && s.substring(0,4).compareTo("YAKI") == 0){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}
	}
}



Measured memory_bytes: 21972
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned ll
#define db double
#define pint pair<int,int>
#define mk make_pair
#define pb push_back
#define eb emplace_back
#define ins insert
#define fi first
#define se second
#define Rep(x,y,z) for(int x=y;x<=z;x++)
#define Red(x,y,z) for(int x=y;x>=z;x--)
using namespace std;
char buf[1<<12],*pp1=buf,*pp2=buf,nc;int ny;
inline char gc() {return pp1==pp2&&(pp2=(pp1=buf)+fread(buf,1,1<<12,stdin),pp1==pp2)?EOF:*pp1++;}
//inline char gc(){return getchar();}
inline int read(){
	int x=0;for(ny=1;nc=gc(),(nc<48||nc>57)&&nc!=EOF;)if(nc==45)ny=-1;if(nc<0)return nc;
	for(x=nc-48;nc=gc(),47<nc&&nc<58&&nc!=EOF;x=(x<<3)+(x<<1)+(nc^48));return x*ny;
}
int n,k,vis[20];
inline bool check(int x){for(;x;x/=10)if(vis[x%10])return 0;return 1;}
int main(){
//	freopen("std.in","r",stdin);
//	freopen("std.out","w",stdout);
	n=read(),k=read();
	Rep(i,1,k)vis[read()]=1;
	Rep(i,n,n*20)if(check(i)){cout<<i;break;}
	return 0;
}





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


int main(){
	string S;
	cin >> S;


	long long ans = INT_MAX;

	for(char ch = 'a'; ch <= 'z'; ch++){
		//check possible
		bool ok = false;
		for(int i = 0; i < S.size(); i++){
			if(S[i] == ch){
				ok = true;
			}
		}
		if(!ok){
			continue;
		}


		string cur = S;
		string next = "";
		long long tmp = 0;
		while(true){
			bool ok = true;
			for(int i = 0; i < cur.size(); i++){
				if(cur[i] != ch){
					ok = false;
					break;
				}
			}

			if(ok){
				break;
			}
			for(int i = 0; i < cur.size() - 1; i++){
				if(cur[i] == ch || cur[i+1] == ch){
					next += ch;
				}else{
					next += cur[i];
				}
			}


			tmp++;
			cur = next;
			next = "";
		}
		ans = min(ans, tmp);
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main (){
    int a,b,c;
    cin >> a >> b >> c;
    if ((a == b && a == c && c == b) || (a != b && a != c && c != b)){
        cout << "No" << endl;
        
    }else{
        cout << "Yes" << endl;
    }
    return 0;
}

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

#define N 2
void InsertionSort(int* a, int n, int g);
void ShellSort(int* a, int n);

int a[1000005];
int cnt = 0;

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

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

	ShellSort(a, n);


	cout << cnt << endl;

	for(int i=0; i<n; i++){
		printf("%d\n", a[i]);
	}

	return 0;
}

void InsertionSort(int* a, int n, int g){
	for(int i=g; i<n; i++){
		int v = a[i];
		int j = i - g;
		while(j >= 0 && a[j] > v){
			a[j+g] = a[j];
			j = j - g;
			cnt++;
		}
		a[j+g] = v;
	}
}

void ShellSort(int* a, int n){
	int g[100001];
	g[0] = 1;
	int i=0;
	while(g[i] <= n && i<100){
		g[i+1] = g[i] * 3 + 1;
		i++;
	}
	int m = i;
	for(int i=m-1; i>=0; i--){
		InsertionSort(a, n, g[i]);
	}

	cout << m << endl;
	for(int i=m-1; i>0; i--){
		printf("%d ", g[i]);
	}
	printf("%d\n", g[0]);
}

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

int main() {

    ll n; cin >> n;
    vector<ll> a(n);
    for (ll i = 0; i < n; i++) {
        cin >> a[i];
    }
    map<ll, ll> mp; //  < 和, 和をとるインデックスの個数 >
    ll ans = 0;
    for (ll i = 0; i < n; i++) {
        ans += mp[i - a[i]];
        mp[a[i] + i]++;
    }   
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 27328
s=input()
res = ''
if 'N' in s:
    if 'S' not in s:
        res = 'No'
if 'S' in s:
    if 'N' not in s:
        res = 'No'
if 'E' in s:
    if 'W' not in s:
        res = 'No'
if 'W' in s:
    if 'E' not in s:
        res = 'No'
if res == '':
    print('Yes')
else:
    print(res)



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

#define FOR(i, j, k) for (int i = j; i < k; i++)
#define REP(i, j) FOR(i, 0, j)
#define fst first
#define snd second
#define pb push_back
#define eb emplace_back
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;

template <class T> bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

template <typename T> istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec) {
        is >> x;
    }
    return is;
}

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int n, k;
    cin >> n >> k;

    vi a(n);
    cin >> a;

    int s = 0;
    REP(i, n) s += a[i];

    vector<int> d;
    FOR(i, 1, sqrt(s)) {
        if (s % i == 0) {
            d.push_back(s / i);
            d.push_back(i);
        }
    }

    sort(rall(d));

    int ans = 0;
    for (auto i : d) {
        vi b;
        for (auto e : a) {
            e = (e % i) + i;
            e %= i;
            if (e > 0)
                b.push_back(e);
        }
        sort(all(b));

        int l = 0, r = b.size() - 1;
        int kk = 0;
        while (l < r) {
            b[r] = b[r] + b[l];
            kk += b[l];
            b[l] = 0;
            while (l < r and b[r] >= i) {
                b[r - 1] += b[r] % i;
                b[r--] = 0;
            }
            l++;
        }
        if (kk <= k and (b.size() == 0 or b[r] == 0)) {
            ans = i;
            break;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256