akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

using namespace std;

#define int long long
#define ll long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl


// D - 3N Numbers
// https://atcoder.jp/contests/arc074/tasks/arc074_b

signed main(){

	int N;
	cin >> N;
	int a[300000];
	rep(i, 3 * N) cin >> a[i];

	// 前からi個の中での大きい方からN個
	priority_queue<int, vector<int>, greater<int> > ma;
	vector<int> v1(3*N+1, 0);
	// 後ろからi個の中での小さい方からN個
	priority_queue<int> mi;
	vector<int> v2(3*N+1, 0);

	// [0,i)の中での大きい方からN個の和
	rep(i, N){
		ma.push(a[i]);
		v1[i + 1] = v1[i] + a[i];
	}
	for (int i = N; i < 3 * N; i++){
		if (a[i] > ma.top()){
			v1[i + 1] = v1[i] - ma.top() + a[i];
			ma.pop();
			ma.push(a[i]);
		}
		else
			v1[i + 1] = v1[i];
	}

	// [3*N-i,3*N)の中での大きい方からN個の和
	rep(i, N){
		mi.push(a[3*N - i - 1]);
		v2[i + 1] = v2[i] + a[3*N - i - 1];
	}
	for (int i = N; i < 3 * N; i++){
		if (a[3 * N - i - 1] < mi.top()){
			v2[i + 1] = v2[i] - mi.top() + a[3 * N - i - 1];
			mi.pop();
			mi.push(a[3 * N - i - 1]);
		}
		else
			v2[i + 1] = v2[i];
	}

	int ans = -INF;
	for (int i = N; i <= 2 * N; i++){
		ans = max(ans, v1[i] - v2[3*N-i]);
	}
	cout << ans << endl;

	return 0;
}

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

const int INF = 0x3f3f3f3f;
const int MAXN = 15;
char str[MAXN][100];
int dp[1<<MAXN][MAXN];
int a[MAXN][MAXN];

int len[MAXN];
bool f[MAXN];
int main()
{
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	int n;
	while(scanf("%d",&n) == 1 && n)
	{
		for(int i = 0;i < n;i++)
			scanf("%s",str[i]);
		for(int i = 0;i < n;i++)
			len[i] = strlen(str[i]);
		for(int i = 0;i < n;i++)
		{
			f[i] = true;
			for(int j = 0;j < n;j++)
			{
				if(i == j)continue;
				if(len[i] > len[j])continue;
				bool ff = false;
				for(int x = 0;x < len[j];x++)
				{
					if(x + len[i] > len[j])break;
					bool ttt = true;
					for(int y = 0;y < len[i];y++)
						if(str[i][y] != str[j][x+y])
						{
							ttt = false;
							break;
						}
					if(ttt)
					{
						ff = true;
						break;
					}
				}
				if(ff)
				{
					f[i] = false;
					break;
				}
			}

		}
		for(int i = 0;i < n;i++)
			if(f[i] == false)
			{
				swap(str[i],str[n-1]);
				swap(f[i],f[n-1]);
				i--;
				n--;
			}
		for(int i = 0;i < n;i++)
			len[i] = strlen(str[i]);
		for(int i = 0;i < n;i++)
			for(int j = 0;j < n;j++)
			{
				int M = min(len[i],len[j]);
				for(int k = M;k >= 0;k--)
				{
					bool flag = true;
					for(int x = 0;x < k;x++)
						if(str[i][len[i] - k + x] != str[j][x])
						{
							flag = false;
							break;
						}
					if(flag)
					{
						a[i][j] = k;
						break;
					}
				}
			}
		/*
		for(int i = 0;i < n;i++)
		{
			for(int j = 0;j < n;j++)
				printf("%d ",a[i][j]);
			cout<<endl;
		}
		*/
		for(int i = 0;i < (1<<n);i++)
			for(int j =0 ;j < n;j++)
				dp[i][j] = INF;
		for(int i = 0;i < n;i++)
			dp[1<<i][i] = len[i];
		for(int i = 1;i < (1<<n);i++)
			for(int j = 0;j < n;j++)
				if(i &(1<<j))
				{
					for(int k = 0;k < n;k++)
						if((i &(1<<k)) == 0)
						{
							dp[i | (1<<k)][k] = min(dp[i|(1<<k)][k],dp[i][j] + len[k] - a[j][k]);
						}
				}
		int ans = INF;
		for(int i = 0;i < n;i++)
			ans = min(ans,dp[(1<<n) - 1][i]);
		printf("%d\n",ans);

	}
	return 0;
}

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

using namespace std;

int main() {
  long N;
  cin >> N;
  long ans[N + 1];

  for (long i = 0; i < N + 1; i++) {
    ans[i] = 0;
  }

  long sum = 0;
  for (long i = 1; i < N + 1; i++) {
    sum += i;
    if (sum <= N) {
      ans[i] = 1;
    } else {
      ans[i] = 1;
      ans[sum - N] = 0;
      break;
    }
  }

  for (long i = 1; i < N + 1; i++) {
    if (ans[i] == 1) {
      cout << i << endl;
    }
  }
}

Measured memory_bytes: 78336
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final int k = scanner.nextInt();

        final double[] p = new double[1001];
        for (int i = 1; i < 1001; i++) {
            p[i] = i + p[i - 1];
        }

        final double[] array = new double[n];
        for (int i = 0; i < n; i++) {
            array[i] = scanner.nextInt();
        }

        double sum = 0;
        for (int i = 0; i < k; i++) {
            sum += p[(int) array[i]] / array[i];
        }

        double max = sum;
        for (int i = 0; i < n - k; i++) {
            sum = sum - p[(int)array[i]]/array[i] + p[(int)array[k+i]]/array[k+i];
            max = Math.max(sum, max);
        }

        System.out.println(max);
    }
}


Measured memory_bytes: 83716
dx = [0,1,0,-1,1,-1]
dy = [1,0,-1,0,1,-1]
loop do
    t, n = gets.split.map(&:to_i)
    break if t == 0 && n == 0
    blocks = n.times.map{gets.split.map{|c| c.to_i}}
    sy, sx = gets.split.map(&:to_i)
    q = [[sy,sx]]
    visited = Array.new(200).map{Array.new(200,false)}
    visited[sy+50][sx+50] = true
    bl = Array.new(200).map{Array.new(200,false)}
    blocks.each do |b1, b2|
        bl[b1+50][b2+50] = true
    end
    count = 1
    t.times do
        q2 = []
        q.each do |sy,sx|
            for i in 0..5
                cy = sy + dy[i]
                cx = sx + dx[i]
                if !bl[cy+50][cx+50] && !visited[cy+50][cx+50]
                    q2.push([cy,cx])
                    visited[cy+50][cx+50] = true
                    count += 1
                end
            end
        end
        q = q2
    end
    puts count
end

Measured memory_bytes: 12580
#include <iostream>
#include <string>
#include <sstream>
#include <istream>
#include <vector>
using namespace std;


int main()
{
	int N, M;
	cin >> N >> M;
	int count = 0;

	// Even + Even
	count += M * (M-1) /2;

	// Odd + Odd
	count += N * (N-1) /2;

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
using namespace std;
const int mod=1e9+7;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int main(){
    fast;
    int n,m;
    cin>>n>>m;
    ll a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    vector<vector<int> > v(n); 
    int x,y;
    while(m--){
        cin>>x>>y;
        v[x-1].pb(y-1);
        v[y-1].pb(x-1);
    }
    int sum=0;
    bool k=0;
    for(int i=0;i<n;i++){
        k=0;
        if(v[i].size()==0){
            sum++;
            continue;
        }
        for(int j=0;j<v[i].size();j++){
            if(a[i]<=a[v[i][j]]){
                k=1;
                break;
            }
        }
        if(!k) sum++;
    }
    cout<<sum;
}


Measured memory_bytes: 9268
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define itrep(i, a) for (auto i = (a).begin(); i != (a).end(); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()
#define mp(a, b) make_pair((a), (b))

using namespace std;

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

template<class T> void inputVector(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}

struct Edge {
	int a, b, c;
	Edge(int a, int b, int c) {
		this->a = a;
		this->b = b;
		this->c = c;
	}
};

int nextBit(string str, int idx) {
	REP(i, idx + 1, str.size() - 1) {
		if (str[i] == '1') return i;
	}
	return str.size() - 1;
}

signed main() {
	int L;
	cin >> L;

	L--;

	if (L == 1) {
		cout << "2 2" << endl;
		cout << "1 2 0" << endl;
		cout << "1 2 1" << endl;
		return 0;
	}

	bool flag = false;
	string str = "";
	map<int, int> m;
	for (int i = 20; i >= 0; i--) {
		if (!flag && (L & (1LL << i)) == 0) continue;
		flag = true;
		m[str.size()] = 1LL << i;
		str += (L & (1LL << i)) == 0 ? '0' : '1';
	}
	cerr << "str:" << str << endl;

	vector<Edge> ret;

	REP(i, 1, str.size() - 1) {
		ret.push_back(Edge(i, i + 1, 0));
		ret.push_back(Edge(i, i + 1, m[i]));
	}

	int num = 0;
	rep(i, str.size()) {
		if (str[i] == '0') continue;
		num += m[i];
		ret.push_back(Edge(1, nextBit(str, i) + 1, num));
	}

	cout << str.size() << " " << ret.size() << endl;
	itrep(it, ret) {
		cout << it->a << " " << it->b << " " << it->c << endl;
	}

	return 0;
}


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

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

    double ans=v[0];
    for(int i=1;i<n;i++)
    {
        ans=(ans+v[i])/2.0;
    }
    printf("%lf\n",ans);
}

Measured memory_bytes: 128
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <iomanip>
#include <bitset>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>

using namespace std;

const int N = 3005;

int n;
long long arr[N];

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

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

long long f(long long x) {
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    ans += (x % arr[i]);
  }
  return ans;
}

int main() {
  cin >> n;
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    ans += arr[i] - 1;
  }
  /*long long here = arr[0];
  for (int i = 0; i < n; i++) {
    here = lcm(here, arr[i]);
  }
  long long miny = *min_element(arr, arr + n);
  long long ans = -2e18;
  for (long long i = miny - 1; i < here; i += miny) {
    ans = max(ans, f(i));
  }*/
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i <(n) ; ++i)
#define rrep(n,i) for(int i = n-1; i>=0; --i)
#define PI 3.14159265
using namespace std;
using ll = long long;
void self_max(int &a,int b){
	a = max(a,b);
}
void self_min(int &a,int b){
	a = min(a,b);
}

int main(){
	int n; cin >> n;
	vector<int> arr(n+1);
	rep(i,n) cin >> arr[i+1];
	vector<ll> dp(n+1);
	dp[1] = 0;
	dp[2] = abs(arr[2] -arr[1]);

	for(int i = 3; i<=n; i++){
		dp[i] = min((dp[i-2] + abs(arr[i] - arr[i-2])),
			(dp[i-1] + abs(arr[i] - arr[i-1])));
	}	

	cout << dp[n] << endl;
	return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define pa pair<int,int>
const int Maxn=2010;
const int Maxk=10010;
const int inf=2147483647;
int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	return x*f;
}
int n,k;
string s[Maxn];
int len[Maxn],sl[Maxn],l=0;
bool f[Maxn][Maxk];//第i~n个字符串能否拼成j长度的串 
struct Node
{
	int id,pos;
	Node(int _id=0,int _pos=0){id=_id,pos=_pos;}
}List[2][Maxn];
char ans[Maxk];int la=0;
int cnt[30];
int main()
{
	memset(f,false,sizeof(f));
	n=read(),k=read();
	for(int i=1;i<=n;i++)
	{
		cin>>s[i],len[i]=s[i].size();
		for(int j=0;j<len[i];j++)cnt[s[i][j]-'a']++;
	}
	int flag=0,w;
	for(int i=0;i<26;i++)
	if(cnt[i])
	{
		flag++;
		w=i;
	}
	if(flag==1)
	{
		for(int i=1;i<=k;i++)
		printf("%c",w+'a');
		return 0;
	}
	sl[n+1]=0;for(int i=n;i;i--)sl[i]=sl[i+1]+len[i];
	f[n+1][0]=true;
	for(int i=n;i;i--)
	for(int j=0;j<=min(k,sl[i]);j++)
	{
		f[i][j]=f[i+1][j];
		if(j>=len[i])f[i][j]|=f[i+1][j-len[i]];
//		printf("%d %d %d\n",i,j,f[i][j]);
	}
	int now=0;
	for(int i=1;i<=n;i++)
	if(f[i+1][k-len[i]])List[now][++l]=Node(i,0);
	for(int i=1;i<=k;i++)
	{
//		printf("%d %d\n",i,l);
		int mn=inf;
		for(int j=1;j<=l;j++)
		{
			int id=List[now][j].id,pos=List[now][j].pos;
			mn=min(mn,(int)s[id][pos]);
		}
		ans[++la]=mn;//printf("%d ",mn);
		int tl=0,st=inf;
		for(int j=1;j<=l;j++)
		{
			int id=List[now][j].id,pos=List[now][j].pos;
			if(s[id][pos]!=mn)continue;
			if(pos+1!=len[id])List[now^1][++tl]=Node(id,pos+1);
			else st=min(st,id+1);
		}
		for(int j=st;j<=n;j++)
		if(len[j]<=k-i&&f[j+1][k-i-len[j]])List[now^1][++tl]=Node(j,0);
		l=tl;now^=1;
	}
//	printf("\nla=%d\n",la);
	for(int i=1;i<=la;i++)printf("%c",ans[i]);
}

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

int main() {

  string s;
  long long k;
  cin >> s >> k;
  
  int size = s.size();
  
  //cout << size << endl;
  
  int hantei1 = 1, cnt = 0, num = -1;
  
  for ( int i = 0; i < size; i++){
    if ( s[i] != '1' ){
      hantei1 = 0;
      cnt = i;
      num = s[i] - '0';
      //cout << hantei1 << ' ' << cnt << ' ' << num << endl;
      break;
    }
  }
  
  if ( hantei1 == 1 ){
    cout << 1 << endl;
    return 0;
  }
  
  if ( cnt >=  k ){
    cout << 1 << endl;
  }else{
    cout << num << endl;
  }
  
  return 0;

}

Measured memory_bytes: 3604
import Control.Monad
import Data.Maybe
import Data.List
import Text.Printf
import qualified Data.ByteString.Char8 as C

getInts :: IO [Int]
getInts = map (fst . fromJust . C.readInt) . C.words <$> C.getLine

main :: IO ()
main = do
  _ <- getInts
  as <- getInts
  bs <- getInts
  let bs' = reverse bs
      f = zip as bs'
      o = find (\(x, y) -> x == y) f
      p = snd $ fromJust o
      pp = repeat (p, p)
      ans = if isNothing o then Just bs' else g1
      g1 = if l3 > l1 + l5 then Nothing else Just g2
      (f1, f2') = span (\(x, y) -> x /= p && y /= p) f
      (f2, f3') = span (\(x, y) -> (x == p) /= (y == p)) f2'
      (f3, f4') = span (==(p, p)) f3'
      (f4, f5) = span (\(x, y) -> (x == p) /= (y == p)) f4'
      [l1, l2, l3, l4, l5] = map length [f1, f2, f3, f4, f5]
      [l, r] = [min l1 l3, min (l3 - (min l1 l3)) l5]
      (a, b) = splitAt l f1
      (c, d) = splitAt r f5
      g2 = map snd $ concat [take l pp, b, f2, a, c, f4, take r pp, d]
  putStrLn $ if isNothing ans
    then "No"
    else "Yes\n" ++ (concat $ intersperse " " $ map show (fromJust ans))


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

int main(){
  int l = 0;
  int m = 0;
  int h = 0;
  
  int n;
  cin >> n;
  
  int a,b;
  cin >> a >> b;
  
  for(int i=0; i<n; i++){
    int x;
    cin >> x;
    
    if(x > b) ++h;
    else if(x > a) ++m;
    else ++l;
  }
  
  cout << min(l, min(m,h)) << endl;
}

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

typedef long long int ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define sz(x) int(x.size())
const ll mod = 1000000007;
int INF = 1001001001;

int main() {
    int n; cin >> n;
    string s; cin >> s;
    int ans = 1;
    rep(i,n-1) {
        if (s[i] != s[i+1]) ans++;
    }
    cout << ans << endl;
    return 0;
}


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

int N;
int A[100010];
int main() {
    cin >> N;
    for (int i = 0; i < N; ++i) cin >> A[i];

    int bucket[100010] = {0};
    for (int i = 0; i < N; ++i) {
        bucket[A[i]] += 1;
    }

    bool possible = true;
    if (N % 2 == 0) {
        for (int i = 0; i < N; ++i) {
            if (i == 0) {
                if (bucket[i] != 0) possible = false;
            } else if (i % 2 == 0) {
                if (bucket[i] != 0) possible = false;
            } else {
                if (bucket[i] != 2) possible = false;
            }
        }
    } else {
        for (int i = 0; i < N; ++i) {
            if (i == 0) {
                if (bucket[i] != 1) possible = false;
            } else if (i % 2 == 0) {
                if (bucket[i] != 2) possible = false;
            } else {
                if (bucket[i] != 0) possible = false;
            }
        }
    }

    long long ans = 1LL;
    int nn = N / 2;
    if (possible) {
        for (int i = 1; i <= nn; ++i) {
            ans *= 2;
            ans %= 1000000007;
        }
    } else {
        ans = 0;
    }

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

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<numeric>
#include<cmath>

using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	if (b == 100) {
		b = 101;
	}
	cout << b * (int)pow(100, a) << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

#define EPS (1e-10)
#define swap(a, b) {double tmp = a; a = b; b = tmp;}
#define abs(n) ((n) < 0 ? -(n) : (n))

int main(void)
{
	double x1, x2, x3 ,x4;
	double y1, y2, y3, y4;
	
	while (~scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4)){
		double xa, xb;
		double ya, yb;
		
		xa = x2 - x1;
		ya = y2 - y1;
		
		xb = x4 - x3;
		yb = y4 - y3;
		
		if (abs(xa * xb + ya * yb) < EPS){
			puts("YES");
		}
		else {
			puts("NO");
		}
	}
	
	return 0;
}

Measured memory_bytes: 612
a, b = map(int, input().split())
if a <= 0 and b >= 0:
    print("Zero")
elif a > 0 and b > 0:
    print("Positive")
elif a < 0 and b < 0:
    if (b-a+1) % 2 == 0:
        print("Positive")
    else:
        print("Negative")


Measured memory_bytes: 2940
//xtwakioi! xtwddYnoi(双重含义)!
#include <bits/stdc++.h>
#define ri register
#define int long long
#define E (n+1)
using namespace std; const int N=501;
inline int read()
{
    int s=0, w=1; ri char ch=getchar();
    while(ch<'0'||ch>'9') { if(ch=='-') w=-1; ch=getchar(); }
    while(ch>='0'&&ch<='9') s=(s<<3)+(s<<1)+(ch^48), ch=getchar();
    return s*w;
}
int n,S,mi=2e9,F;
struct Node { int w,v; }q[N];
int dp[N][N][N];
signed main()
{
    n=read(), S=read();
    for(ri int i=1;i<=n;i++) q[i].w=read(), q[i].v=read();
    mi=q[1].w;
    for(ri int i=1;i<=n;i++) q[i].w-=mi;
    
    for(ri int i=1;i<=n;i++)
    for(ri int j=0;j<=n;j++)
    for(ri int k=1;k<=n;k++)
    {
        if(j>=q[i].w) dp[i][j][k]=max(dp[i-1][j][k],dp[i-1][j-q[i].w][k-1]+q[i].v);
        else dp[i][j][k]=dp[i-1][j][k];
    }

    int res=0;
    for(ri int i=0;i<=300;i++)
    for(ri int j=0;j<=n;j++)
    if(j*mi+i<=S) res=max(res,dp[n][i][j]);

    printf("%lld\n",res);
    return 0;
}

Measured memory_bytes: 43368
import sys

def solve(a, b):
    if  a <= 8 and b <= 8 :
        return 'Yay!'
    else:
        return ':('
    
def readQuestion():
    line = sys.stdin.readline().rstrip()
    [str_a, str_b] = line.split(' ')
    return (int(str_a), int(str_b))

def main():
    a, b = readQuestion()
    answer = solve(a, b)
    print(answer)
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
$<.readlines.map {|l| l.split.map(&:to_r)}.each do |xa, ya, xb, yb, xc, yc, xd, yd|
  x1, y1 = xb - xa, yb - ya
  x2, y2 = xd - xc, yd - yc
  puts x1 * x2 + y1 * y2 == 0 ? "YES" : "NO"
end


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

using namespace std;
typedef long long ll;

int N;
int A, B;

int ask (int x, int y)
{
    cout << "? " << x << " " << y << endl << flush;
    char c;
    cin >> c;
    return (int) (c - 'N');
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin >> A >> B;

    N = A + B;
    if (A <= B)
    {
        cout << "Impossible\n";
        return 0;
    }

    vector <int> v;
    for (int i = 0; i < N; i++)
    {
        if (!v.size())
        {
            v.push_back(i);
            continue;
        }

        if (ask (i, v.back()))
            v.push_back(i);
        else
            v.pop_back();
    }

    string res = "";
    int aloc = v[0];
    for (int i = 0; i < N; i++)
        if (i == aloc || ask (aloc, i))
        {
            res += '1';
        }
        else
            res += '0';
    cout << "! " << res << "\n";
}

Measured memory_bytes: 848
#include<iostream>
using namespace std;
int main(){
	int n, m, c, ans=0; cin>>n>>m>>c;
	int b[m];  for(int i=0; i<m; i++) cin>>b[i];
	while(n--){
		int a[m], x =c;
		for(int i=0; i<m; i++) {
			cin>>a[i];
			x = x+b[i]*a[i];
		}
		if(x>0) ans++;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define err(args...) {}
#ifdef DEBUG
#include "_debug.cpp"
#endif
using namespace std;
using ll = long long;
template <typename T> using lim = numeric_limits<T>;
template <typename T> istream& operator>>(istream& is, vector<T>& a) { for(T& x : a) { is >> x; } return is; }
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    map<char, int> counter;
    for(char c : s) {
        counter[c]++;
    }
    int ans = 0;
    for(auto& p : counter) {
        ans += p.second == 2;
    }
    cout << (ans == 2 ? "Yes" : "No") << endl;
    return 0;
}


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

using namespace std;

int main(){
    int x,y;
    cin >> x >> y;

    int flag=0;
    for(int i=x; i>=0; i--){
        int total = 4*i + 2*(x-i);
        if(total == y){
            flag = 1;
        }
    }
    if(flag==1){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3564
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>

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

constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1 << 28;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int dx[6] = { 1,0,-1,-1,0,1 };
int dy[6] = { 0,-1,-1,0,1,1 };
int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/

	int kkt = 89;
	while (kkt) {
		ll t, n; scanf("%lld %lld", &t, &n); if (t == 0 && n == 0) break;
		vector<ll> x(n), y(n);
		set<pair<ll, ll>> sp;
		for (int i = 0; i < n; i++) {
			scanf("%lld %lld", &x[i], &y[i]);
			sp.emplace(x[i], y[i]);
		}
		ll sx, sy; scanf("%lld %lld", &sx, &sy);
		map<ll, map<ll, ll>> d;
		d[sx][sy] = 0;
		queue<pair<int, int>> q;
		q.emplace(sx, sy);
		ll res = 0;
		while (!q.empty()) {
			int cx, cy; tie(cx, cy) = q.front();
			q.pop();
			if (d[cx][cy] <= t) res++;
			else continue;
			for (int i = 0; i < 6; i++) {
				int nx = cx + dx[i];
				int ny = cy + dy[i];
				if (sp.find(make_pair(nx,ny)) != sp.end()) continue;
				if (d[nx][ny] != 0 || (nx == sx && ny == sy)) continue;
				d[nx][ny] = d[cx][cy] + 1;
				q.emplace(nx, ny);
			}
		}
		cout << res << "\n";
	}
	return 0;

}


Measured memory_bytes: 3376
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

template<typename T1,typename T2>inline void chmin(T1 &a,const T2 &b){if(a>b) a=b;}
template<typename T1,typename T2>inline void chmax(T1 &a,const T2 &b){if(a<b) a=b;}

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */

int main() {
  
  string s; cin >> s;
  if (s[1] == 'B') s[1] = 'R';
  else s[1] = 'B';
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using Int = long long;  // clang-format off
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define ALL(v) std::begin(v), std::end(v)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef dump
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sun Sep 13 21:07:00 JST 2020
 **/

signed main() {
    Int a, b, c, d;
    std::cin >> a >> b >> c >> d;
    std::cout << std::max({a * c, a * d, b * c, b * d}) << std::endl;
}


Measured memory_bytes: 3636
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int k = sc.nextInt();

        Set<Integer> as = divisor(a);
        Set<Integer> bs = divisor(b);

        List<Integer> bothDivisor = new ArrayList<>();
        for (int i = 1; i <= Math.max(a, b); i++) {
            if (as.contains(i) && bs.contains(i)) {
                bothDivisor.add(i);
            }
        }

        // k番目。ではなく大きい方からk番目
        System.out.println(bothDivisor.get(bothDivisor.size() - k));
    }

    static Set<Integer> divisor(int n) {
        Set<Integer> ret = new HashSet<>();
        for (int i = 1; i * i <= n; i++) {
            if (n % i == 0) {
                ret.add(i);
                if (i != n / i)
                    ret.add(n / i);
            }
        }
        return ret;
    }
}


Measured memory_bytes: 23764
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

S = input()

res = 700
res += S.count('o') * 100
print(res)

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

int main() {
  int N, L;
  cin >> N >> L;
  vector<string> S(N);
  for (int i = 0; i < N; i++) cin >> S[i];
  sort(S.begin(), S.end());
  for (int i = 0; i < N; i++) cout << S[i];
  cout << endl;
}


Measured memory_bytes: 3636
#include <iostream>
using namespace std;
using ll = long long;

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

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

int main(){
    ll N, M;
    string S, T;
    cin >> N >> M >> S >> T;

    ll l = lcd(N, M);
    ll ans = gcd(N, M);
    for(int i = 0; i < l; ++i){
        if(S[i*N/l] != T[i*M/l]){
            cout << -1 << endl;
            return 0;
        }
    }

    cout << ans << endl;
}


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

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


ll X,K,D;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>X>>K>>D;
	X=abs(X);
	
	if(X/D>=K) {
		cout<<X-K*D<<endl;
	}
	else {
		K-=X/D;
		if(K%2==0) {
			cout<<X%D<<endl;
		}
		else {
			cout<<D-X%D<<endl;
		}
	}
	
	
	
}


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


Measured memory_bytes: 3648
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String args[]) {
        FastReader sc = new FastReader();
        int a = sc.nextInt();
        int b = sc.nextInt();
        if (a == b) System.out.println("Draw");
        else if (a == 1 || b != 1 && a > b) System.out.println("Alice");
        else System.out.println("Bob");
    }

    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 21204
use std::io::*;
use std::str::FromStr;

struct Scanner<R: Read> {
    reader: R,
}

impl<R: Read> Scanner<R> {
    fn new(r: R) -> Scanner<R> {
        Scanner { reader: r }
    }
    fn read<T: FromStr>(&mut self) -> T {
        let token = self
            .reader
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok().unwrap()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);
    let n: u32 = sc.read();
    if n == 1 {
        println!("Hello World");
    } else {
        let a: u32 = sc.read();
        let b: u32 = sc.read();
        println!("{}", a+b);
    }
    
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int main() {
    int X, A;
    cin >> X >> A;
    if (X < A) {
        cout << 0 << endl;
    } else {
        cout << 10 << endl;
    }
    return 0;
}



Measured memory_bytes: 256
import java.io.InputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int[] a = nextIntArray1origin(sc, N);

		sc.close();

		int[] ans = new int[N + 1];

		for (int i = N; i > 0; i--) {

			int x = a[i];
			for (int j = i+i; j <= N; j += i) {
				x ^= ans[j];
			}
			ans[i] = x;
		}

		List<String> res = new ArrayList<>();
		for (int i = 1; i <= N; i++) {
			if (ans[i] == 1) {
				res.add(String.valueOf(i));
			}
		}

		out.println(res.size());
		if (res.size() != 0) {
			out.println(String.join(" ", res));
		}
	}

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

	@SuppressWarnings("unused")
	private int[] nextIntArray1origin(Scanner sc, int n) {
		int[] result = new int[n + 1];
		for (int i = 1; i <= n; i++) {
			result[i] = sc.nextInt();
		}
		return result;
	}
}


Measured memory_bytes: 77012
#include <iostream>
#include<vector>
#include<queue>
#include<algorithm>
using namespace std;
int main(){

    int n,q;
    cin>>n>>q;
    
    queue<int> Q[n];
    while(q>0){
        
        int a,b;
        cin>>a>>b;
        if(a==0){
            int c;
            cin>>c;
            Q[b].push(c);
        }else if(a==1){
            if(!Q[b].empty())cout<<Q[b].front()<<endl;
        }else{
            if(!Q[b].empty())Q[b].pop();
        }
        
        
        q--;
    }
    
return 0;
}



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

long long N,W,sm=0;
long long w[200];
long long v[200];
vector<long long> v1,v2,v3,v4;
int i,j,k,l,con;
int cnt[4];

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

  cin >> N >> W;

  REP(i,N){
    cin >> w[i] >> v[i];
    if(i == 0){
      v1.push_back(v[i]);
    }
    if(i>=1){
      con=w[i]-w[0];
      if(con==0)v1.push_back(v[i]);
      if(con==1)v2.push_back(v[i]);
      if(con==2)v3.push_back(v[i]);
      if(con==3)v4.push_back(v[i]);
    }
  }
  sort(v1.begin(), v1.end());
  sort(v2.begin(), v2.end());
  sort(v3.begin(), v3.end());
  sort(v4.begin(), v4.end());

  reverse(v1.begin(), v1.end());
  reverse(v2.begin(), v2.end());
  reverse(v3.begin(), v3.end());
  reverse(v4.begin(), v4.end());

  for(i=0;i<(int)v1.size();i++){
    if(i+1==(int)v1.size())continue;
    v1[i+1]+=v1[i];
  }
  for(i=0;i<(int)v2.size();i++){
    if(i+1==(int)v2.size())continue;
    v2[i+1]+=v2[i];
  }
  for(i=0;i<(int)v3.size();i++){
    if(i+1==(int)v3.size())continue;
    v3[i+1]+=v3[i];
  }
  for(i=0;i<(int)v4.size();i++){
    if(i+1==(int)v4.size())continue;
    v4[i+1]+=v4[i];
  }
  v1.insert(v1.begin(), 0);
  v2.insert(v2.begin(), 0);
  v3.insert(v3.begin(), 0);
  v4.insert(v4.begin(), 0);

  REP(i, (int)v1.size()){
    REP(j, (int)v2.size()){
      REP(k, (int)v3.size()){
        REP(l, (int)v4.size()){
          if(i*w[0]+j*(w[0]+1)+k*(w[0]+2)+l*(w[0]+3) <= W){
            sm = max(sm, v1[i]+v2[j]+v3[k]+v4[l]);
          }
        }
      }
    }
  }
  cout << sm << endl;
  return 0;
}


Measured memory_bytes: 256
program abc163c
  implicit none
  integer :: n, a(200000), ans(200000)
  read *, n
  read *, a(1:n-1)
  ans(1:n) = 0
  ans(a(1:n-1)) = ans(a(1:n-1)) + 1
  print *, ans(1:n)
end program abc163c


Measured memory_bytes: 5428
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<ll,ll> P;
typedef pair<ll,pair<ll,ll>> p;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
static const int MAX_SIZE = 1 << 17; //segment tree のサイズ。この実装では2べきにする必要がある。 2^17 ≒ 1.3 * 10^5

int dp[1<<22];

int main(){
    int N,a[30][30];
    cin>>N;
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            cin>>a[i][j];
        }
    } 
    dp[0]=1;
    for(int S=1;S<(1<<N);S++){
        int i=__builtin_popcount(S);
        for(int j=0;j<N;j++){
            if(bit(S,j)==1 && a[i-1][j]) dp[S]=(dp[S]+dp[S^(1<<j)])%MOD;
        }
    }
    cout<<dp[(1<<N)-1]<<endl;
}



Measured memory_bytes: 10496
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <climits>
#include <bitset>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	string s, t;
	cin >> s >> t;
	if(s.length()<t.length()){
		cout << "UNRESTORABLE" << endl;
		return 0;
	}

	for(int i=s.length()-t.length(); i>=0; i--){
		bool b=true;
		for(int j=0; j<t.length(); j++){
			if(s[i+j]=='?') continue;
			if(s[i+j]!=t[j]) b=false;
		}
		if(b){
			for(int j=0; j<s.length(); j++){
				if(i<=j && j<i+t.length()) cout << t[j-i];
				else if(s[j]=='?') cout << "a";
				else cout << s[j];
			}
			cout << endl;
			return 0;
		}
	}
	cout << "UNRESTORABLE" << endl;
	return 0;
}

Measured memory_bytes: 256
use std::cmp::*;

fn run() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let s: Vec<i64> = s.trim().chars().map(|c| c.to_digit(10).unwrap() as i64).collect();
    let mut dp = (0, 1_000_000_000);// carry あり、なし
    for &d in s.iter().rev() {
        let mut next = (std::i64::MAX, std::i64::MAX);
        for k in 0..10 {
            if k >= d {
                next.0 = min(next.0, k + k - d + dp.0);
                if k > d {
                    next.0 = min(next.0, k + k - d - 1 + dp.1);
                } else {
                    next.1 = min(next.1, k + 10 + k - d - 1 + dp.1);
                }
            } else {
                next.1 = min(next.1, k + 10 + k - d + dp.0);
                next.1 = min(next.1, k + 10 + k - d - 1 + dp.1);
            }
        }
        dp = next;
    }
    let ans = min(dp.0, dp.1 + 1);
    println!("{}", ans);
}

fn main() {
    run();
}


Measured memory_bytes: 14588
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
using namespace std;
inline LL read()
{
	LL f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
template<typename T>inline void write(T x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
template<typename T>inline void pr1(T x){write(x);putchar(' ');}
template<typename T>inline void pr2(T x){write(x);putchar('\n');}
const int MAXN=100005;
int pr[MAXN],plen,is[MAXN];
void init()
{
	for(int i=2;i<MAXN;i++)
	{
		if(!is[i])pr[++plen]=i;
		for(int j=1;j<=plen&&i*pr[j]<MAXN;j++)
		{
			is[i*pr[j]]=1;
			if(!(i%pr[j]))break;
		}
	}
}
int n;LL a[MAXN],fac[MAXN],inv[MAXN];
LL cube(int x){return 1LL*x*x*x;}
map<LL,int> mp;
int main()
{
//	freopen("a.in","r",stdin);
	init();
	n=read();int ans=0;
	for(int i=1;i<=n;i++)
	{
		LL x=a[i]=read();
		for(int j=1;cube(pr[j])<=x;j++)
			while(!(x%cube(pr[j])))x/=cube(pr[j]);
		mp[x]++;fac[i]=x;
		LL temp=1,u=x;
		for(int j=1;cube(pr[j])<=x;j++)if(!(x%pr[j]))
		{
			if(!(x%(1LL*pr[j]*pr[j])))temp*=pr[j];
			else temp*=1LL*pr[j]*pr[j];
			while(!(x%pr[j]))x/=pr[j];
		}
		LL k=sqrt(x);
		while(1LL*k*k<x)++k;while(1LL*k*k>x)--k;
		if(1LL*k*k==x)temp*=k;
		else if(x<=1e9)temp*=1LL*x*x;
		else ++ans,mp[u]--;
		inv[i]=temp;
	}
	for(int i=1;i<=n;i++)if(mp[fac[i]])
	{
		if(fac[i]!=1)
		{
			int u=mp[fac[i]],v=mp[inv[i]];
			ans+=max(u,v);mp[fac[i]]=mp[inv[i]]=0;
		}
		else ans++,mp[fac[i]]=0;
	}
	pr2(ans);
	return 0;
}


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

int main(){
  int n, t; scanf("%d %d", &n, &t);
  v1i v(n); rep(i, n) scanf("%d", &v[i]);
  lint x = 0;
  rep(i, n){
    if(i < n-1 && v[i] + t > v[i+1]) x += v[i+1] - v[i];
    else x += t;
  }
  printf("%lld\n", x);
  return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <vector>
#include <stack>
#include <iostream>
#include <string>
#include <tuple>
#include <random>
#include <map>

using namespace std;
typedef long long ll;

int main(){
	string s;
	cin >> s;
	if(s.size()>=4 && s.substr(0,4) == "YAKI")
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
let n=Int(readLine()!)!
let arr=readLine()!.characters.split{$0==" "}.map{Int(String($0))!}

var i = 0
var ans = 1
var m = arr[0]

for i in 1..<n {
  if (m > arr[i]) {
    ans += 1
  }
  m = min(arr[i], m)
}

print(ans)

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

#define int             long long
#define	ll				long long

#define	mod 			1000000007
#define	inf 			1000000000000000
#define infty			1000000000000000000LL
#define	md				998244353
#define	PI				acos(-1.0)
#define	endl 			"\n"
#define	rr				return
#define	br				cout<<"\n";
long long prime[1000000];

void sieve()
{
	prime[0]=0;
	prime[1]=0;
	for(int i=2;i<1000000;i++)
		prime[i]=1;

	for(int i=2;i*i<1000000;i++)
		if(prime[i]==1)
			for(int j=i*i;j<1000000;j+=i)
				prime[j]=0;
}

bool isPrime(int n)
{
    if (n <= 1)
        return false;
    for (ll i = 2; i <= floor(sqrt(n)); i++)
        if (n % i == 0)
            return false;

    return true;
}

int factorial(int n)
{
    int f=1;
    for(int i = 1;i<=n ; i++)
        f = (f*i)%mod;
    return f;
}

int gcd(int a, int b)
{
	return !b ? a : gcd(b, a % b);
}

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

int fastExponentiation(int n, int x, int modulo)
{
	int res = 1;
	while(x > 0)
       {
          if(x & 1)
          res = (res*n) % modulo;
          x = x >> 1;
          n = (n * n) % modulo;
       }
       return res;
}

int power(int n , int p )
{
	if(p==0)
	   return 1;

	 int res = power((n*n)%mod,p/2);
	 if(p%2==1)
	   res = (n*res)%mod;

	   	 return res;
}

bool isPowerOfTwo(int n)
{
   	return n && (!(n&(n-1)));
}

bool isSet(int n,int i)
{
	// To check if ith bit is set or not in binary representation of n
   	return n & (1 << i);
}

bool valid_coordinate(ll x,ll y,ll n,ll m)
{
    if(x<0 || y<0)
       return false;

   	else if(x>=n || y>=m)
       return false;

   	else
   		return true;
}

int sod(int n)
{
	int sum=0;
	while(n)
	{
		sum+=(n%10);
		n/=10;
	}
	return sum;
}



void solve()
{
	int n;
	cin>>n;
	vector<int>v(1000005);
	for(int i=0;i<n;i++){
		int h;
		cin>>h;
		v[h]++;
	}
	int ans=0;
	vector<int>d(1000005,0);
	for(int i=1;i<=1000000;i++){
		if(v[i]==0 || d[i]!=0){
			continue;
		}
		if(v[i]==1 && d[i]==0)
		ans++;
		for(int j=i;j<=1000000;j+=i)
			d[j]=1;
	}
	cout<<ans;
}

int32_t main()
{

	//int t; cin>>t; while(t--)
	solve();

	return 0;
}


Measured memory_bytes: 18912
from sys import stdin, setrecursionlimit
#input = stdin.buffer.readline
setrecursionlimit(10 ** 7)

from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict, Counter
from itertools import combinations, permutations, combinations_with_replacement
from itertools import accumulate
from math import ceil, sqrt, pi, radians, sin, cos

MOD = 10 ** 9 + 7
INF = 10 ** 18

#N = int(input())
#N, M = map(int, input().split())
#A = list(map(int, input().split()))
#A = [int(input()) for _ in range(N)]
#ABC = [list(map(int, input().split())) for _ in range(N)]
S = input()
T = input()
#S = [input() for _ in range(N)]

d = len(S) - len(T) + 1
len_t = len(T)
answer = INF
for i in range(d):
    tmp = 0
    for j in range(len_t):
        if S[i + j] != T[j]:
            tmp += 1
    answer = min(answer, tmp)
    
print(answer)

Measured memory_bytes: 68100
S = input()
T = input()
S_dic = [0 for _ in range(26)]
T_dic = [0 for _ in range(26)]

alphabet = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
            "l", "m", "n","o", "p", "q", "r", "s", "t", "u", "v", 
            "w", "x", "y", "z"]

for i in range(len(S)):
    s = S[i]
    t = T[i]
    si = alphabet.index(s)
    ti = alphabet.index(t)

    if S_dic[si] == 0:
        S_dic[si] = ti
    elif S_dic[si] != ti:
        print("No")
        exit()

    if T_dic[ti] == 0:
        T_dic[ti] = si
    elif T_dic[ti] != si:
        print("No")
        exit()

print("Yes")


Measured memory_bytes: 3632
// D.

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <vector>

using namespace std;

typedef pair<int, int> II;

int solve(int n, int z, int w, vector<int> &a) {
	int ans = abs(a.back() - w);
	if (n >= 2) {
		ans = max(ans, abs(a[n - 2] - a[n - 1]));
	}
	return ans;
}

int main(int argc, char *argv[])
{
	int n, z, w;
	cin >> n >> z >> w;
	vector<int> a(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	cout << solve(n, z, w, a) << endl;
}


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

array<int,101> factoring(int x){
  array<int,101> ret{};

  for(int i = 2; sqrt(x) >= i; i++){
    while(x % i == 0){
      ret[i]++;
      x/=i;
    }
  }
  if(x > 1) ret[x]++;
  return ret;
}

int main(){
  array<int,101> fac{};
  int n;
  cin >> n;
  for(int i = 1; n >= i; i++){
    auto buf = factoring(i);
    for(int j = 0; 101 > j; j++)
      fac[j] += buf[j];
  }
  int ans = 0;

  for(int i = 1; n >= i; i++){
    if(fac[i] < 2) continue;
  for(int j = 1; n >= j; j++){
    if(fac[j] < 4 ||i==j) continue;
  for(int k = j+1; n >= k; k++){
    if(fac[k] < 4 ||i==k) continue;
    ans++;
  }
  }
  }
  
  for(int i = 1; n >= i; i++){
    if(fac[i] < 4) continue;
  for(int j = 1; n >= j; j++){
    if(fac[j] < 14 ||i==j) continue;
    ans++;
  }
  }
  
  for(int i = 1; n >= i; i++){
    if(fac[i] < 2) continue;
  for(int j = 1; n >= j; j++){
    if(fac[j] < 24 ||i==j) continue;
    ans++;
  }
  }

  for(int i = 1; n >= i; i++){
    if(fac[i] < 74) continue;
    ans++;
  }
  cout << ans << endl;
}

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

int main(){
  char a[2];
  char b[2];

  scanf("%s %s", a, b);

  if(a[0] == b[0]) printf("H\n");
  else printf("D\n");

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;

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

    vl a(n);
    rep(i, n) {
        cin >> a[i];
        a[i]++;
    }

    vl v(n+1);  // v[i] : i番目(iは0-index)の山の一番上の数
    v[n] = INF;
    rep(i, n) {
        // vの中でa[i]未満のものの最大値の位置posを二分探索で高速に求める
        auto pos0 = lower_bound(all(v), a[i]);  // vの中でa[i]以上の値が現れる最初の位置のイテレータ
        pos0--;
        auto pos = pos0 - v.begin();
        v[pos] = a[i];  // pos番目の山にa[i]を置く
    }
    
    ll ans = 0;
    rep(i, n) {
        if(v[i] > 0) {
            ans++;
        }
    }

    out(ans);
    re0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define Rep(i, N) for(int i = 0; i < N; i++)
#define Reps(i, x, N) for(int i = x; i < N; i++)

const int LLINF = 1LL << 60;

string pat[9] = {".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs" , "tuv" , "wxyz"};

signed main()
{
  int N;
  
  cin >> N;
  while(N--) {
    string S, T;
    cin >> S;
    
    int i = 0;
    while(i < S.size()) {
      int cnt = -1, choice = -1;
      while(i < S.size() && S[i] != '0') {
	cnt++; choice = S[i] - '1'; i++;
      }
      if(~choice) {
	T += pat[choice][cnt % pat[choice].size()];
      }
      i++;
    }

    cout << T << endl;
  }

  return 0;
}

Measured memory_bytes: 3208
#include <iostream>

using namespace std;

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

    int A1[N + 2], A2[N + 2];

    fill(A1, A1 + N + 2, 0);
    fill(A2, A2 + N + 2, 0);

    for (int i = 1; i <= N; i++) {
        cin >> A1[i];
        A2[i] = A1[i];
    }

    for (int i = 1, j = N; i <= N; i++, j--) {
        A1[i] = max(A1[i], A1[i - 1]);
        A2[j] = max(A2[j], A2[j + 1]);
    }

    for (int i = 1; i <= N; i++) {
        cout << max(A1[i - 1], A2[i + 1]) << endl;
    }
}

Measured memory_bytes: 3200
N = int(input())
L = list(map(int, input().split()))

# diff = 0
# maxNum = 0
# maxDiffArray = []
# for i in range(len(L)):
#     diffArray = []
#     for j in range(len(L)):
#         if i != j:
#             diff = abs(L[i] - L[j])
#             diffArray.append(diff)
#     maxDiffArray.append(max(diffArray))
# print(max(maxDiffArray))

# 別解：数列の最大値と最小値の差が要素間の差の最大値となることを利用
print(max(L) - min(L))


Measured memory_bytes: 2940