akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()
template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}
template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    char c; cin>>c;
    c = c+1;
    cout<< c <<endl;
}

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

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

  int i = 0;
  int sum = 0;
  while(i < N) {
    int l, r;
	cin >> l >> r;  
    sum += r - l + 1;
    i++;
  }
  cout << sum;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>

using namespace std;
typedef long long ll;

ll ans=0;
int n;
string s;

ll combi(int n,int k){
  if(k==3) return 9*9*9*n*(n-1)*(n-2)/3/2/1;
  if(k==2) return 9*9*n*(n-1)/2/1;
  if(k==1) return 9*n/1;
  if(k==0) return 1;
}

int comb(int p,int k){
  if(k==0) return 1;
  if(p==n-1 && k==1) return s[p]-'0';
  if(p==n-1 && k>1) return 0;

  if(s[p]=='0'){
    return comb(p+1,k);
  }else if((s[p]-'0')>0){
    ll ans=0;
    ans+=combi(n-p-1,k);
    ans+=(s[p]-'1')*combi(n-p-1,k-1);
    ans+=comb(p+1,k-1);
    return ans;
  }
}
int main(){

  cin >> s;
  int K;
  cin >> K;
  n=s.size();

  cout << comb(0,K) << endl;

  return 0;
}

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

int get_attack_num(int power, int attack);

int main() {
  int H,A;
  int attack_num;
  cin >> H >> A;
  attack_num = get_attack_num(H,A);
  // cout << attack_num << endl;
  printf("%d",attack_num);
  return 0;
}

int get_attack_num(int power, int attack){
  int extra;
  int num;
  extra = power%attack;
  num = power/attack;
  return (extra>0) ? num+1:num;
}

Measured memory_bytes: 256
function read_Int64()
	return Base.parse(Base.Int64, Base.readline(Base.STDIN))
end

function abc123_A()

	const num_antennas = 5

	# STEP.01
	# read out the coordinates of the each antenna
	coordinate = Base.Array{Base.Int64}(num_antennas)

	for itr in Base.range(1, 1, num_antennas)
		coordinate[itr] = read_Int64()
	end

	# STEP.02
	# read out the maximum distance to communicate
	distance_max = read_Int64()

	for itr_Lv1 in Base.range(1, 1, num_antennas)
	for itr_Lv2 in Base.range(1, 1, num_antennas)
		if Base.abs(coordinate[itr_Lv2] - coordinate[itr_Lv1]) > distance_max
			return ":("
		else
			continue
		end
	end
	end

	return "Yay!"

end

Base.println(Base.STDOUT, Main.abc123_A())

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

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

    while(N>0){
        int n=N%10;
        if(n==9){
            cout<<"Yes"<<endl;
            return 0;
        }
        N/=10;
    }

    cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
def solve(A,N):
    A.sort()
    if N == 1:
        return 1
    elif N == 2:
        if A[1] == A[0]:
            return 0
        elif A[1] % A[0] == 0:
            return 1
        else:
            return 2
    elif A[0] == 1:
        if A[1] >= 2:
            return 1
        else:
            return 0
    else:
        Col = set()
        if A[0] == A[1]:
            Col.add(A[0])
        for i in range(1,N-1):
            if A[i-1] == A[i] or A[i] == A[i+1]:
                Col.add(A[i])
        if A[N-1] == A[N-2]:
            Col.add(A[N-1])

        Mul = set()
        cand = set()
        for i in range(N):
            if A[i] not in Mul:
                if A[i] not in Col:
                    cand.add(A[i])
                for d in range(1,(A[N-1]//A[i])+1):
                    Mul.add(A[i] * d)

        return len(cand)

def main():
    N = int(input())
    A = list(map(int,input().split()))

    print(solve(A,N))

if __name__ == "__main__":
    main()


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

int main()
{
ll n ;
cin >> n ;
vector<vector<ll>> v(10, vector<ll>(10,0) );
rep(i,n){
  ll r=i+1;
  ll a=r%10;
  while(r/10)r/=10;
  v[r][a]++;
}
rep(i,n){
  ll r=i+1;
  ll a=r%10;
  while(r/10)r/=10;
  ans+=v[a][r];
}
cout << ans << endl;
return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
//const long long mod = 1000000007;
//const long long mod = 998244353;

int main() {
	long long N;
	scanf("%lld", &N);
	long long res = N - 1;
	for (long long i = 1; i*i <= N; i++) {
		if (N%i == 0) {
			long long d = i + N / i - 2;
			if (res > d)res = d;
		}
	}
	printf("%lld", res);
	return 0;
}

Measured memory_bytes: 128
N,K,Q = map(int,input().split())
A = list(input() for _ in range(Q))
points = [K for _ in range(N)]

points = list(map(lambda x:x-Q,points))

for i in A:
    points[int(i)-1] += 1

for i in points:
    if(i > 0):
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 14120
/*
   Author: Shivam Shukla
*/
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pair<ll,ll> > vpll;
 
const int MOD=1e9+7;
const int MAX=1e5+5;
const double PI= acos(-1.0);
const long double EPS=1e-10;
const int64_t INF=1e18+10;
 
#define fastio() ios_base::sync_with_stdio(false);cin.tie(0), cout.tie(0)
#define trace(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vi vector<int>
#define vl vector<ll>
#define vs vector<str>
#define vc(x) vector<x>
#define mapll map<ll,ll>
#define mapib map<int,bool>
#define mapiv map<int,vector>
#define mapsi map<string,int>
#define rep(i,j,k) for(ll i=j;i<k;i++)
#define down(i,j,k) for(ll i=j;i>=k;i--)
#define repa(i,n) for(ll i=0;i<n;i++)
#define dowa(i,n) for(ll i=n;i>=0;i--)
#define reps(i,j,k,s) for(ll i=j;i<k;i+=s)
#define downs(i,j,k,s) for(ll i=j;i>=k;i-=s)
#define trv(i,x) for(auto i:x)
#define pb push_back
#define eb emplace_back
#define sz(x) (int)x.size()
#define ff first
#define ss second
#define str string 
#define dub double
#define pqmax priority_queue<ll>
#define pqmin priority_queue<ll,vl,greater<ll> >
 
template<typename t> t lcm(t a, t b) {return (a*b)/__gcd(a,b);}
template<typename t> t gcd(t a, t b) {return __gcd(a,b);}
template<typename t> t mul_mod(t a, t b, t m){t res=((a%m)*(b%m)%m); return res;}
template<typename t> t add_mod(t a, t b, t m){t res=((a%m)+(b%m))%m; return res;}
template<typename t> t pow_mod(t a,t b,t m) {t res=1;while(b){if(b&1) res=mul_mod(res,a,m);a=mul_mod(a,a,m), b>>=1;} return res%m;}
template<typename t> vc(t) num_vec(t num) {t res; while (num) res.pb(num%10), num/=10; return res;}
template<typename t> t vec_num(t vec) {t res=0; ll mul=1; repa(i,sz(vec)) res=vec[i]*mul, mul*=10; return res;}
 

int32_t main(int argc,char** argv){
	fastio();
	auto tstart= clock();
 
    ll n,k, s = 0; cin >> n >> k;
    rep(i, k, (n + 2)) {
    	ll mx = (n * i) - ((i * (i - 1)) >> 1);
    	ll mn = ((i * (i - 1)) >> 1);

    	s = add_mod<ll>(s, (mx - mn + 1), MOD);
    }
    
    cout << s << endl;
    
    cerr<<setprecision(2)<<fixed<<"Time elapsed: "<<(double)(clock() - tstart)/CLOCKS_PER_SEC<<endl; 
    return 0; 
}

Measured memory_bytes: 3792
import java.util.*;

public class Main {

    private static final int up = 1000000;

    private static boolean judge1(int[] a, int[] f) {
        int n = a.length;
        Set<Integer> S = new HashSet();
        for (int i = 0; i < n; i++) {
            List<Integer> list = new ArrayList();
            for (int x = a[i]; x != 1; ) {
                int p = f[x] == 0 ? x : f[x];
                list.add(p);
                if (S.contains(p)) return false;
                x = x / p;
            }
            S.addAll(list);
        }
        return true;
    }

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

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = scan.nextInt();
        int[] flag = new int[up + 1];
        List<Integer> prime = new ArrayList();
        for (int i = 2; i <= up; i++) {
            if (flag[i] == 0) prime.add(i);
            for (int j = 0; i * prime.get(j) <= up; j++) {
                flag[i * prime.get(j)] = prime.get(j);
                if (i % prime.get(j) == 0) break;
            }
        }
        boolean pairwise = judge1(a, flag);
        if (pairwise) System.out.println("pairwise coprime");
        else {
            int ans = a[0];
            for (int i = 1; i < n; i++) ans = gcd(ans, a[i]);
            if (ans == 1) System.out.println("setwise coprime");
            else System.out.println("not coprime");
        }
    }
}


Measured memory_bytes: 68032
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1e9;
const LL LLINF = 1e16;
const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

int main(){
    fastcin();

    LL n, k;
    cin >> n >> k;
    n %= k;
    cout << min(n, -(n-k)) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod 998244353
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3fll
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
int n,k;
vector<int> g[2020];
int dep[2020],sz[2020],fr[2020];
void dfs(int x,int fa)
{
	dep[x]=dep[fa]+1;
	sz[x]=1;
	fr[x]=fa;
	for(int i=0;i<g[x].size();i++)
	{
		int to=g[x][i];
		if(to==fa)continue;
		dfs(to,x);
		sz[x]+=sz[to];
	}
}
int solve(int x)
{
	dep[0]=-1;
	dfs(x,0);
	int cnt=0,mx=0;
	for(int i=1;i<=n;i++)
	{
		if(dep[i]<=k/2)cnt++;
	/*	if(dep[i]==(k+1)/2)
		{
			int has=g[fr[i]].size();
			if(fr[i]!=x)has--;
			mx=max(mx,has);
		}*/
		dep[i]=inf;
	}
	if(k&1)
	{
		dep[x]=0;
		mx=0;
		for(int i=0;i<g[x].size();i++)
		{
			int to=g[x][i];
			dfs(to,x);
			int tmp=0;
			for(int j=1;j<=n;j++)
			{
				if(dep[j]==(k+1)/2)
				{
				//	cout<<j<<endl;
					tmp++;
				}
				dep[j]=inf;
			}
			mx=max(mx,tmp);
		}
		cnt+=mx;
	}
//	cout<<x<<" "<<cnt<<" "<<mx<<endl; 
	return n-cnt;
}
int main()
{
	scanf("%d%d",&n,&k);
	if(k==1)
	{
		printf("%d\n",n-2);
		return 0;
	}
	for(int i=1;i<n;i++)
	{
		int a,b;
		scanf("%d%d",&a,&b);
		g[a].push_back(b);
		g[b].push_back(a);
	}
	int ans=n;
	for(int i=1;i<=n;i++)
	{
		ans=min(ans,solve(i));
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 512
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B, C, K = MAP()

print((A-B)*(-1)**(K%2))


Measured memory_bytes: 5844
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++){
    cin >> a[i];
  }
  int q;
  cin >> q;
  for (int i = 0; i < q; i++){
    int k;
    cin >> k;
    int tv, fv;
    tv = n;
    fv = -1;
    while (tv - fv > 1){
      int mv = (tv + fv) / 2;
      if (a[mv] >= k){
        tv = mv;
      } else {
        fv = mv;
      }
    }
    int l = tv;
    tv = n;
    fv = -1;
    while (tv - fv > 1){
      int mv = (tv + fv) / 2;
      if (a[mv] > k){
        tv = mv;
      } else {
        fv = mv;
      }
    }
    int r = tv;
    cout << l << ' ' << r << endl;
  }
}


Measured memory_bytes: 3116
package main

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

func main() {
  n,c := NextUints()
  x := append([]uint64{0},NextUintArray()...)
  s := make([]uint64,n+1)
  for i:=uint64(1);i<n+1;i++ { s[i] = s[i-1]+x[n-i+1] }
  m := uint64(math.MaxUint64)
  for k:=uint64(1);k<n+1;k++ {
    t := (n+k)*c
    for i:=uint64(1);i<n+1;i+=k {
      u := i+k-1
      if u > n { u = n }
      t += en((i+k-1)/k,s[u]-s[i-1])
    }
    if m > t { m = t }
  }
  fmt.Println(m)
}
func en(i,x uint64) uint64 {
  if i == 1 { return 5*x }
  return (2*i+1)*x
}

var reader = bufio.NewReaderSize(os.Stdin,1000000)
func NextLine() string {
  var buffer []byte
  for {
    line,isPrefix,err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer,line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextUints() (uint64,uint64) {
  s := strings.Split(NextLine()," ")
  n,_ := strconv.ParseUint(s[0],10,64)
  c,_ := strconv.ParseUint(s[1],10,64)
  return n,c
}
func NextUintArray() []uint64 {
  s := strings.Split(NextLine()," ")
  a := make([]uint64,len(s))
  for i:=0;i<len(s);i++ { a[i],_ = strconv.ParseUint(s[i],10,64) }
  return a
}

Measured memory_bytes: 12800
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<string>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;
int a[220];
int main(){
	int n,sum;
	scanf("%d",&n);
	for(int i=1;i<=2*n;i++) scanf("%d",&a[i]);
	sort(a+1,a+2*n+1);
	sum=0;
	for(int i=1;i<=2*n-1;i+=2) sum=sum+a[i];
	printf("%d\n",sum);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
template <typename T> bool chmax(T &u, const T z) { if (u < z) {u = z; return true;} else return false; }
template <typename T> bool chmin(T &u, const T z) { if (u > z) {u = z; return true;} else return false; }
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
typedef pair<ll, ll> P;
const ll INF = 1LL << 60;
//const int MOD = 1000000007;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
//解答写し2次元累積和
int kazu[505][505];
int main(){
  int n,m,q;
  cin>>n>>m>>q;
  rep(i,m){
    int l,r;
    cin>>l>>r;
    kazu[l][r]++;
  }
  for(int i=1;i<505;i++){
    for(int j=1;j<505;j++){
      kazu[i][j]+=kazu[i][j-1];
    }
  }
  for(int j=1;j<505;j++){
    for(int i=1;i<505;i++){
      kazu[i][j]+=kazu[i-1][j];
    }
  }
  rep(i,q){
    int p,q;
    cin>>p>>q;
    int ans=kazu[q][q]-kazu[p-1][q]-kazu[q][p-1]+kazu[p-1][p-1];
    cout<<ans<<endl;
  }
  return 0;
}

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

#define For(i, j, k) for (int i = j; i <= k; i++)
#define Forr(i, j, k) for (int i = j; i >= k; i--)

using namespace std;

const int N = 310;

int n, m, Mod;
int C[N][N], dp[N][N], g[N][N], f[N][N];

int main() {

	scanf("%d%d%d", &n, &m, &Mod);
	For(i, 0, n) {
		C[i][0] = 1;
		For(j, 1, i) C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % Mod;
	}

	For(i, 1, m + 1) f[0][i] = 1;
	For(i, 1, n) {
		For(j, 1, m) dp[i][j] = f[i - 1][j + 1];
		Forr(j, m, 1) g[i][j] = (g[i][j + 1] + dp[i][j]) % Mod;
		For(j, 1, m) For(k, 1, i)
			f[i][j] = (f[i][j] + 1ll * g[k][j] * f[i - k][j] % Mod * C[i - 1][k - 1]) % Mod;
	}
	printf("%d\n", f[n][1]);

	return 0;
}

Measured memory_bytes: 1664
#include <stdio.h>
#include <stdlib.h>
int comp(const void *a, const void *b) {
    return *(int*)a - *(int*)b;
}
int main() {
  int n,k,a[200000],b[200000]={0},i,ans,j;
  scanf("%d %d",&n,&k);
  for (i=0;i<n;i++) {
    scanf("%d",&a[i]);
  }
  for (i=0;i<n;i++) {
    b[a[i]-1]++;
  }
  qsort(b, n, sizeof(int), comp);
  for (i=0;i<n-k;i++) {
    ans+=b[i];
  }
  printf("%d\n",ans);
  return 0;
}

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

//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
template <class T>
T GCD(T a, T b)
{
    T r;
    while (a)
        r = b, b = a, a = r % a;
    return b;
}
template <class T>
T LCM(T a, T b) { return a / GCD(a, b) * b; }

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repd(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (b); i--)
#define FORA(i, I) for (const auto &i : I)

// vector
#define ALL(x) x.begin(), x.end()
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef vector<ll> vl;
#define ERASE(x) x.erase(unique(ALL(x)), x.end()); // erase same elements
#define VEC(type, c, n)     \
    std::vector<type> c(n); \
    for (auto &i : c)       \
        std::cin >> i;

// input
#define INIT                          \
    std::ios::sync_with_stdio(false); \
    std::cin.tie(0);
#define VAR(type, ...) \
    type __VA_ARGS__;  \
    MACRO_VAR_Scan(__VA_ARGS__);

// output
template <typename T>
void MACRO_OUT(const T t) { std::cout << t; }

#define OUT(...) MACRO_OUT(__VA_ARGS__);
#define SP std::cout << " ";
#define TAB std::cout << "\t";
#define BR std::cout << "\n";
#define ENDL std::cout << std::endl;

#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define yes() printf("yes\n")
#define no() printf("no\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
    cout << a;
    ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
    cout << a << ' ';
}

ll ans = 0;
bool check = 0;
string s, t;
int N = 3;
vector<int> v(N);
int a, b, c, d, n;
int x, y;
int sum;
char ch;

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// cout << (conditon ? (result:  == 1 ): (==0)) << endl; <- output result of if
// long long 型が表せる値の上限はおよそ 9 × 10＾18 です．
int main()
{
    INIT;

    cin >> s;
    a = s.length();
    sort(ALL(s));
    ERASE(s);
    if (a == s.length())
        yes();
    else
        no();
    return 0;
}


Measured memory_bytes: 3656
function main(string) {
  const arr = string.split(' ');
  const firstLastStr = function(str) {
    return {'first': str.slice(0,1), 'last': str.slice(-1)};
  }
  const siritori = ((firstLastStr(arr[0]).last === firstLastStr(arr[1]).first) && (firstLastStr(arr[1]).last === firstLastStr(arr[2]).first));
  console.log(siritori ? 'YES' : 'NO');
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


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

// for loop
#define rep(i,a,n) for(int i=(a);i<(n);++i)
#define repe(i,a,n) for(int i=(a);i<=(n);++i)
#define rrep(i,n,a) for(int i=(n);n>(a);--i)
#define rrepe(i,n,a) for(int i=(n);n>=(a);--i)

// abbreviati
#define PB(v) push_back(v)
#define MP make_pair
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define ENDL << "\n"

using ll = long long;
using P = pair<int,int>;
using itn = int;

// constant
const int INF = 1<<30;
const ll INFLL = 1LL << 60;
const ll MOD = 1000000007;
const long double PI =(acos(-1));

/***Snippet***************************************************
ifelse, isprime, torad, todeg, lcm, bfs,chmin,chmax
**************************************************************/

// adjacency list
vector<int> to[100005];

// Graph
using Graph = vector<vector<int>>;

// Grid
int H,W;
vector<vector<int>> field;

// 4方向への移動ベクトル
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n; cin >> n;
    vector<int> l(n);
    rep(i,0,n) cin >> l[i];
    sort(all(l));
    int cnt=0;
    rep(i,0,n){
        rep(j,i+1,n){
            rep(k,j+1,n){
                if(l[i]<l[j] && l[j]<l[k]){
                    //cout << l[i] << "<" << l[j] <<"<"<< l[k] ENDL;
                    if((l[i]+l[j])>l[k]) cnt++;
                }
            }
        }
    }
    cout << cnt ENDL;
    return 0;
}

Measured memory_bytes: 5952
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int MOD = 1000000007;

int main()
{
	int n = 0;
	cin >> n;
	int sum = 0;
	int max_num = 0;
	for (int i = 0; i < n; i++)
	{
		int buf = 0;
		cin >> buf;
		sum += buf;
		max_num = max(buf, max_num);
	}
	string ans = (max_num < (sum - max_num)) ? "Yes" : "No";

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

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
if (s[0] == s[1] && s[1] != s[2] && s[2] == s[3]) cout << "Yes" << endl;
else if (s[0] == s[2] && s[1] != s[2] && s[1] == s[3]) cout << "Yes" << endl;
else if (s[0] == s[3] && s[1] != s[3] && s[1] == s[2]) cout << "Yes" << endl;
else cout << "No" << endl;
}

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

typedef long long ll;

int MOD=1000000007;

int main(void){
  bool ans=true;
  string S,a,b;
  cin >> S;
  for(int i=0; i<S.size(); i++){
    if(S[i]!=S[S.size()-i-1]) ans=false;
  }
  for(int i=0; i<(S.size()-1)/2; i++) a+=S[i];
  for(int i=(S.size()+3)/2-1; i<S.size(); i++) b+=S[i];
  for(int i=0; i<a.size(); i++){
    if(a[i]!=a[a.size()-i-1]) ans=false;
  }
  for(int i=0; i<b.size(); i++){
    if(b[i]!=b[b.size()-i-1]) ans=false;
  }
  if(ans) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
package main

import "fmt"

type point struct {
	x, y int
}

type container struct {
	data []point
}

func (c *container) isEmpty() bool {
	return len(c.data) == 0
}
func (c *container) queue(v point) {
	c.data = append(c.data, v)
}
func (c *container) dequeue(v *point) bool {
	if !c.isEmpty() {
		*v = c.data[0]
		c.data = c.data[1:]
		return true
	}
	return false
}

func main() {
	var H, W int
	fmt.Scan(&H, &W)
	maze := make([]string, H)
	for i := range maze {
		fmt.Scan(&maze[i])
	}
	var dx = [4]int{1, -1, 0, 0}
	var dy = [4]int{0, 0, -1, 1}

	ans := 0
	for i := 0; i < H; i++ {
		for j := 0; j < W; j++ {
			if maze[i][j] == '#' { // スタート地点にできない
				continue
			}
			// (i,j)を開始地点としてBFSする
			d := make([][]int, H)
			for k := 0; k < H; k++ {
				d[k] = make([]int, W)
				for l := 0; l < W; l++ {
					d[k][l] = -1
				}
			}
			var q container
			d[i][j] = 0
			q.queue(point{j, i})
			for !q.isEmpty() {
				var p point
				q.dequeue(&p)
				for k := 0; k < 4; k++ {
					nx := p.x + dx[k]
					ny := p.y + dy[k]
					if 0 <= nx && nx < W && 0 <= ny && ny < H && d[ny][nx] == -1 && maze[ny][nx] == '.' {
						d[ny][nx] = d[p.y][p.x] + 1
						ans = max(ans, d[ny][nx])
						q.queue(point{nx, ny})
					}
				}
			}
		}
	}
	fmt.Println(ans)
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}


Measured memory_bytes: 5504
m=1e9+7,dp[3333][3333]={1};
c,i;
f(j){
	dp[i][j]=~c?*dp[i-1]-dp[i-1][j]:dp[i-1][j];
	j<i&&f(j+1);
	dp[i][j]=(1L*dp[i][j]+dp[i][j+1]+m)%m;
}
main()
{
	dp[0][0]=1;
	for(gets(&c);c=getchar(++i)%3-1;)
	{
		f(0);
	}
	printf("%d",*dp[i-1]);
}

Measured memory_bytes: 28928
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n, k = 0;
    cin >> n;
    int a[n];
    cin >> a[0];
    int d = a[0];
    for (int i = 1; i < n; i++) 
    {
        cin >> a[i];
        d = __gcd(d, a[i]);
    }
    if (d % 2 != 0) cout << '0';
    else
    {
        while (d % 2 == 0)
        {
            d /= 2;
            k++;
        }
        cout << k;
    }
}

Measured memory_bytes: 3592
main = print.f1 =<< readLn
f1 k = f2 k k k k
f2 0 b c k = 0
f2 a 0 c k = f2 (a - 1) k c k
f2 a b 0 k = f2 a (b - 1) k k
f2 a b c k = (gcd a (gcd b c)) + (f2 a b (c - 1) k)

Measured memory_bytes: 461860
#include <iostream>
#include <vector>
#include <string.h>
#include <set>
#include <map>
#include <assert.h>
#include <algorithm>
#include <queue>
#include <bitset>
#include <stack>
#include <chrono>
#include <random>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define ll long long
#define MOD 998244353
#define INF 1000000000000000000
#define uid uniform_int_distribution <int>
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
// Read the question carefully and see all the given sample tests
// Think about the correctness before implementing

ll power(ll a, ll b)
{
	if(b == 0)
		return 1;
	if(a == 0)
		return 0;
	ll res = 1;
	while(b != 0)
	{
		if(b & 1)
			res = (res * a) % MOD;
		a = (a * a) % MOD;
		b /= 2;
	}
	return res;
}
int main()
{
	int n;
	cin >> n;
	vector <int> cnt(n);
	for (int i = 1; i <= n; i++)
	{
		int x;
		cin >> x;
		if((i == 1 && x != 0) || (i > 1 && x == 0))
		{
			cout << 0;
			return 0;
		}
		cnt[x]++;
	}
	ll ans = 1;
	for (int i = 1; i <= n - 1; i++)
	{
		ans *= power(cnt[i - 1], cnt[i]);
		ans %= MOD;
	}
	cout << ans;		
}


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

int main(){
    int n;

    while(cin>>n,n){
        vector<int> v(n);

        for(auto &t:v){
            cin>>t;
        }

        sort(v.begin(),v.end());
        cout << accumulate(v.begin()+1,v.end()-1,0) / (n-2) << endl;
    }
}

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

int main()
{ 
    int h1,m1,h2,m2,k;
    cin>>h1>>m1>>h2>>m2>>k;
    int tot = (h2-h1)*60 + (m2-m1);
    tot -= k;
    cout<<tot<<endl;
}


Measured memory_bytes: 3596
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#include <bitset>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < (n); i++)

using namespace std;

// MOD逆元 非再帰拡張ユークリッド
long modinv(long a){long M=MOD,b=M,u=1,v=0;while(b)u-=a/b*v,swap(u,v),a%=b,swap(a,b);return (u%M+M)%M;}

void solve() {
  long X, Y;
  cin >> X >> Y;

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

  long count = (X + Y) / 3;

  long Y_count = X - count;
  long X_count = count - Y_count;

  if (X_count < 0 or Y_count < 0) {
    cout << 0 << endl;
    return;
  }

  vector<long> kaijo(count + 1);
  kaijo[0] = 1;
  for (long i = 1; i <= count; i++) {
    kaijo[i] = (kaijo[i-1] * i) % MOD;
  }

  long ans = kaijo[count];
  ans = ans * modinv(kaijo[X_count]);
  ans %= MOD;
  ans = ans * modinv(kaijo[Y_count]);
  ans %= MOD;

  cout << ans << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

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

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;
constexpr int mod2 = 998244353;
template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }

template<typename T>
vector<T> makeVector(size_t a, T b) { return (vector<T>(a, b)); }
template<typename... Ts>
auto makeVector(size_t a, Ts... ts) { 
	return (vector<decltype(makeVector(ts...))>(a, makeVector(ts...)));
}

template<typename T>
bool isin(T y, T x, T h, T w) { return (0 <= y && 0 <= x && y < h && x < w); }
template<typename T>
bool isin1(T y, T x, T h, T w) { return (0 < y && 0 < x && y <= h && x <= w); }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	if (v.size()) {
		os << v[0];
		for (int i = 1; i < v.size(); i++) os << " " << v[i];
	}
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u;
	return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}


void Main() {
	string S; cin >> S;
	ll ans = 0;
	string T;
	for (int i = 0; i < S.size(); i++) {
		if (i < (int)S.size()-1 && S[i] == 'B' && S[i+1] == 'C') {
			T += 'D';
			i++;
		} else if (S[i] == 'A') {
			T += 'A';
		} else {
			T += 'B';
		}
	}

	int N = T.size();
	int i = 0;
	while (i < N) {
		ll cnt = 0;
		while (i < N && T[i] != 'B') {
			if (T[i] == 'D') ans += cnt;
			else cnt++;
			i++;
		}
		while (i < N && T[i] == 'B') i++;
	}
	cout << ans << endl;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(20);
	Main();
	return (0);
}


Measured memory_bytes: 3888
s = [list(input()) for i in range(3)]
turn_s = "a"
while(True):
    if turn_s == "a":
        turn = 0
    if turn_s == "b":
        turn = 1
    if turn_s == "c":
        turn = 2
    if s[turn] == []:
        break
    turn_s = s[turn].pop(0)
print(turn_s.upper())


Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include <complex>
#include <string>
#include <sstream>
#include <cmath>
using namespace std;
typedef complex<double> P;

const double pi = acos(-1);

int main() {
  string s;
  double rad = pi/2.0;
  P pos(0,0);
  while(cin >> s) {
    replace(s.begin(), s.end(), ',', ' ');
    stringstream ss(s);
    double n;
    double d;
    ss >> n >> d;
    if(n == 0.0 && d == 0.0) break;
    d = -d*pi/180.0;
    pos += n*P(cos(rad),sin(rad));
    rad += d;
  }
  cout << (int)pos.real() << endl;
  cout << (int)pos.imag() << endl;
  return 0;
}

Measured memory_bytes: 1244
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <numeric>
#include <iomanip>
#include <tuple>

using namespace std;


int main(){
   int n;
   cin>>n;
   vector<int> a(n);
   for(int i=0;i<n;i++)cin>>a[i];
   int ans=0;
   int cnt=1;
   for(int i=0;i<n;i++){
      if(a[i]%2==0)cnt*=2;
      else cnt*=1;
   }
   ans=pow(3,n)-cnt;
   cout<<ans<<endl;
}

   


Measured memory_bytes: 888
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication36
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] a = new int[5];
            for (int r = 0; r < 5; r++)
                a[r] = int.Parse(Console.ReadLine());
            int b = a[1] / a[3];
            if (a[1] % a[3] > 0)
                b++;
            int c = a[2] / a[4];
            if (a[2] % a[4] > 0)
                c++;
            if (b > c)
                b = a[0] - b;
            if (b < c)
                b = a[0] - c;
            if (b == c)
                b = a[0] - b;
            Console.WriteLine(b);
        }
    }
}

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

using namespace std;

int main() {
	cin.sync_with_stdio(false);

	int K, S;
	cin >> K >> S;
	int count=0;
	for (int x = 0;x <= K; x++) {
		for (int y = x;y <= K; y++) {
			for (int z = y;z <= K;z++) {
				if (x + y + z == S) {
					if (x !=y&&y!=z) {
						count += 6;
					}
					else if (x == y&&y == z) {
						count++;
					}
					else {
						count += 3;
					}
				}
			}
		}
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 256
import sys, bisect, math, itertools, string, queue, copy
#import numpy as np
#import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n = inp()
a = inpl()
kosuu = [0]*(200000+1)
cnt = [0]*(200000+1)
ans = [0]*(200000+1)

for i in range(n):
  kosuu[a[i]] += 1

s = 0
for i in kosuu:
  s += i * (i - 1) // 2

for i in range(n):
  tmp = kosuu[a[i]]
  #print(s - cnt[a[i]] + max(0,((tmp - 1)*(tmp - 2)//2)))
  print(s - max(0,tmp-1))

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef vector<vector<int>> Matrix;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int main(){
  int N,K;
  cin >> N >> K;
  int n[N];
  
  rep(i, N){
    n[i] = 0;
  }
  
  rep(i, K){
  	int d;
    cin >> d;
    rep(j,d){
      int k;
      cin >> k;
      k -= 1;
      n[k] += 1;
    }
  }

  int step = 0;
  rep(i, N){
    if(n[i] == 0){
      step++;
      
    }
  }
  
  cout << step << endl;
}


Measured memory_bytes: 3636
from collections import defaultdict

import sys
sys.setrecursionlimit(10**6)
ii = lambda: int(input())
mis = lambda: map(int,input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    n,m=mis()
    a=lmis()
    at=float(sum(a))/float(4*m)
    cnt=0
    for i in range(n):
        if a[i]>=at: cnt+=1
    print('Yes' if cnt>=m else 'No')


if __name__ == "__main__":
    main()

Measured memory_bytes: 3436
N,K,Q = map(int, input().split())

a = []

for i in range(0,Q):
    x = int(input())
    a.append(x)

l = [0] * N

for i in a:
    l[i-1] += 1

for n in range(0, N):
    if l[n] >= (Q-K+1):
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 8592
#include<stdio.h>

int main() {
	int M, D;
	int k;
	while (1) {
		scanf("%d %d", &M, &D);
		if (M == 0)break;
		switch (M)
		{
		case 1:
			k = 3;
			break;
		case 2:
			k = 6;
			break;
		case 3:
			k = 0;
			break;
		case 4:
			k = 3;
			break;
		case 5:
			k = 5;
			break;
		case 6:
			k = 1;
			break;
		case 7:
			k = 3;
			break;
		case 8:
			k = 6;
			break;
		case 9:
			k = 2;
			break;
		case 10:
			k = 4;
			break;
		case 11:
			k = 0;
			break;
		case 12:
			k = 2;
			break;
		default:
			break;
		}
		D = (D + k) % 7;
		switch (D)
		{
		case 0:
			printf("Sunday\n");
			break;
		case 1:
			printf("Monday\n");
			break;
		case 2:
			printf("Tuesday\n");
			break;
		case 3:
			printf("Wednesday\n");
			break;
		case 4:
			printf("Thursday\n");
			break;
		case 5:
			printf("Friday\n");
			break;
		case 6:
			printf("Saturday\n");
			break;

		default:
			break;
		}
	}




	return 0;
}


Measured memory_bytes: 2028
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int A,B;
    cin>>A>>B;
    if(A==B)
        cout<<"Draw\n";
    else if(A>B&&B!=1||A==1)
        cout<<"Alice\n";
    else
        cout<<"Bob\n";

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
string str;
cin>>str;
long long num = 0;
for(int i=0;i<str.length();i++)
{
if(str[i] == '+')
{
num++;
}
else
{
num--;
}
}
cout<<num<<endl;
}

Measured memory_bytes: 3632
#include <iostream>
using namespace std;
char c[6][6];
int main()
{
  int H, W, K;
  cin >> H >> W >> K;
  for (int h = 0; h < H; h++) {
    for (int w = 0; w < W; w++) {
      cin >> c[h][w];
    }
  }
  int ans = 0;
  for (unsigned int sh = 0; sh < (1<<H); sh++) {
    for (int sw = 0; sw < (1<<W); sw++) {
      int blacks = 0;
      for (int h = 0; h < H; h++) {
        if ((sh&(1<<h))!=0) continue;
        for (int w = 0; w < W; w++) {
          if ((sw&(1<<w))!=0) continue;
          if (c[h][w]=='#') blacks++;
        }
      }
      if (blacks == K) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3632
#include <cstdio>
#include <string>
#include <utility>
#include <iostream>
using namespace std;

typedef pair<string, int> P;

P words[110];

int main() {
  int i=0;

  string name; int page;
  while(cin >> name >> page) {
    words[i].first = name;
    words[i].second = page;

    i++;
    // cout << name << page << endl;
  }

  int n = i;

  
  for (int j=0; j<n-1; j++) {
    for (int k=0; k<n-1-j; k++) {
      if (words[k].first > words[k+1].first ||
	  (words[k].first == words[k+1].first &&
	   words[k].second > words[k+1].second)) {
	P temp = words[k];
	words[k] = words[k+1];
	words[k+1] = temp;
      }
    }
  }


  /*
    for (int j=0; j<n; j++) {
    cout << words[j].first << " " << words[j].second << endl;
    }
  */
  
  
  bool cont = false;
  for (int j=0; j<n; j++) {
    if (words[j].first == words[j+1].first) {
      if (!cont) {
	cout << words[j].first << endl;
	cont = true;
      } 
	cout << words[j].second << " ";
    } else {
      if (cont) {
	cout << words[j].second << endl;
	cont = false;
      } else {
	cout << words[j].first << endl << words[j].second << endl;
      }
    }
  }
  
}

Measured memory_bytes: 3152
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner my_scanner = new Scanner(System.in);
        int A = my_scanner.nextInt();
        int B = my_scanner.nextInt();
        int C = my_scanner.nextInt();
        int a_empty = A - B;
        int c_remain = C - a_empty;
        if(c_remain < 0) {
          c_remain = 0;
        }
        System.out.print(c_remain);
    }
}


Measured memory_bytes: 24020
N=int(input())
S=input()
rn,wn=0,0
for i in range(len(S)):
    if S[i]=='R':
        rn+=1
    else:
        wn+=1
winr,rinw=0,0
for i in range(rn):
    if S[i]=='W':
        winr+=1
for i in range(rn,rn+wn):
    if S[i]=='R':
        rinw+=1
#print(rn,wn,rinw,winr)
print(max(winr,rinw))

Measured memory_bytes: 9492
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep3(i, l, n) for (int i = l; i < n; ++i)
#define max(a, b) (a > b ? a : b)
#define min(a, b) (a < b ? a : b)
#define chmax(a, b) a = (a >= b ? a : b)
#define chmin(a, b) a = (a <= b ? a : b)
#define out(a) cout << a << endl
#define outa(a, n) { rep(_, n) cout << a[_] << " "; cout << endl }
#define outp(a, n) { cout << endl; rep(_, n) cout << a[_].F << " " << a[_].S << endl; }
#define SZ(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
#define FIX(a) fixed << setprecision(a)
#define LB(v, n) (int)(lower_bound(all(v), n) - v.begin())
#define UB(v, n) (int)(upper_bound(all(v), n) - v.begin())

int main() {
    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    // sの末尾全探索
    rep(i, SZ(s)) {
        // if (SZ(s) - i > SZ(t)) continue;
        
        rep3(j, i, SZ(s)) {
            if (s[j] != t[j - i]) break;
            if (j == SZ(s) - 1) {
                out(SZ(s) + SZ(t) - (SZ(s) - i));
                return 0;
            }
        }
    }
    out(SZ(s) + SZ(t));
}


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

class Solver {
    Scanner sc = new Scanner();

    public void Solve() {
        var K = sc.nextInt();
        var X = sc.nextInt();
        var ans = new List<string>();
        for (int i = X - K + 1; i < X + K; i++) {
            ans.Add(i.ToString());
        }
        WriteLine(string.Join(" ", ans));
    }
    
}

class Scanner {
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble() {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0) {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Program {
    static void Main(string[] args) {
        Solver s = new Solver();
        s.Solve();
    }
}


Measured memory_bytes: 13268
-- f.hs --- F

-- author: Seong Yong-ju <sei40kr@gmail.com>

main :: IO ()
main = do
  [a, b] <- map (read :: String -> Int) . words <$> getLine
  putStrLn $ case (a + b, a * b) of
    (15, _) -> "+"
    (_, 15) -> "*"
    _ -> "x"


Measured memory_bytes: 508
#include<iostream>

using namespace std;

string mozi
;
int koko
;
// mae ni tukutta raiburari *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
int koubunnkaiseki();
int koubunnkaiseki2();
int koubunnkaiseki3();

int koubunnkaiseki3()
{
  int atai;
  if( mozi[koko] == '(' ) 
    {
      koko = koko + 1;
      atai = koubunnkaiseki();
      koko = koko + 1;
    }
  else
    {
      atai = 0;
      while( koko < mozi.size() && '0' <= mozi[koko] && mozi[koko] <= '9' )
	{
	  atai = atai * 10;
	  atai = atai + ( mozi[koko] - '0' );
	  koko = koko + 1;
	}
    }
  return atai;
}

int koubunnkaiseki2()
{
  int atai = koubunnkaiseki3();
  for(;mozi[koko]=='*'||mozi[koko]=='/';)
    {
      if( mozi[koko] == '*' )
	{
	  koko = koko + 1;
	  atai = atai * koubunnkaiseki3();
	}
      else
	{
	  koko = koko + 1;
	  atai = atai / koubunnkaiseki3();
	}
    }
  return atai;
}

int koubunnkaiseki()
{
  int atai = koubunnkaiseki2();
  for(;mozi[koko]=='+'||mozi[koko]=='-';)
    {
      if( mozi[koko] == '+' ) 
	{
	  koko = koko + 1;
	  atai = atai + koubunnkaiseki2();
	}
      else 
	{
	  koko = koko + 1;
	  atai = atai - koubunnkaiseki2();
	}
    }
  return atai;
}

int main(int argc,char *argv) 
{
  int dataset;
  cin >> dataset;
  for(int kaisuu=0;kaisuu<dataset;kaisuu++)
    {
      cin >> mozi;
      koko = 0;
      cout << koubunnkaiseki() << endl;
    }
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const long long INF = 1LL << 60;
const ll MOD = 1000000007;
using pint = pair<ll, ll>;

int main() {
  string S;
  cin >> S;
  ll K;
  cin >> K;
  bool all1 = true;
  for (int i = 0; i < S.size(); i++) {
    if (S[i] != '1') all1 = false;
  }
  if(all1){
      cout << 1 << endl;
      return 0;
  }


  if(K<=S.size()){
      for(int i = 0; i < K; i++){
          if(S[i]!='1'){
              cout << S[i] << endl;
              return 0;
          }
      }
      cout << 1 << endl;
      return 0;
  }

  for(int i = 0; i < S.size(); i++){
      if(S[i] !='1'){
        cout << S[i] << endl;
        return 0;
      }
  }
}

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

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

    int n = inputStr.length();

    int colorChangeTileCountFirstFix = 0;
    char prevTile = inputStr.at(0);
    for (int i = 1; i < n; ++i)
    {
        if (inputStr.at(i) == prevTile)
        {
            ++colorChangeTileCountFirstFix;

            prevTile = (inputStr.at(i) == '0' ? '1' : '0');
        }
        else
        {
            prevTile = inputStr.at(i);
        }
    }

    int colorChangeTileCountFirstChange = 1;
    prevTile = (inputStr.at(0) == '0' ? '1' : '0');
    for (int i = 1; i < n; ++i)
    {
        if (inputStr.at(i) == prevTile)
        {
            ++colorChangeTileCountFirstChange;

            prevTile = (inputStr.at(i) == '0' ? '1' : '0');
        }
        else
        {
            prevTile = inputStr.at(i);
        }
    }

    cout << min(colorChangeTileCountFirstFix, colorChangeTileCountFirstChange) << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));

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

	int bit[40];
	REP(i, 40) {
		bit[i] = (1LL << (i));
	}
	
	int N;
	cin >> N;
	VI A(N);
	map<int, int>mp;
	REP(i, N) {
		cin >> A[i];
		mp[A[i]]++;
	}
	SORT(A);
	vector<bool> F(N, false);
	int ans = 0;
	for(int i=N-1;i>=0;i--){
		int tmp,a;
		REP(j, 40) {
			if (A[i] < bit[j]) {
				tmp = bit[j];
				break;
			}
		}
		//cout << LB(A, tmp - A[i]) - A.begin() << endl;
		if (mp[A[i]] > 0 && mp[tmp - A[i]]>0) {
			if (A[i] == tmp - A[i]) {
				if (mp[A[i]] <= 1) {
					continue;
				}
			}

			//cout << A[i] << " " << tmp - A[i] << endl;
			ans++;
			mp[A[i]]--;
			mp[tmp - A[i]]--;
		}
	}

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



Measured memory_bytes: 26880
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long
#define MOD 1000000007
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

bool cmp(int a,int b){
    return a>b;
}

int main(){
    FAST;
    ll n,i,sum=0;
    cin>>n;
    ll ar[3*n];
    for( i=0;i<3*n;i++){
        cin>>ar[i];
    }
    sort(ar,ar+(3*n),cmp);
    for(i=1;n;i+=2,n--){
        sum+=ar[i];
    }
    cout<<sum;
}

Measured memory_bytes: 5936