akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
#define all(x) (x).begin(), (x).end()
#define fsp(x) cout << fixed << setprecision(x)
const ll inf = LLONG_MAX;
const long double pi = acos(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

//UnionFind
//0-indexed
//#include <vector>
struct union_find {
	std::vector<long long> parent;
	std::vector<long long> sizes;
	long long num_of_trees;

	//コンストラクタ
	union_find(long long n) {
		for (long long i = 0; i < n; i++) {
			parent.push_back(i);
			sizes.push_back(1);
		}
		num_of_trees = n;
	}

	//頂点nの根
	long long root_of(long long n) {
		if (parent[n] == n) return n;
		return parent[n] = root_of(parent[n]); //パス圧縮
	}

	//頂点nを含む木の頂点数(自身含む)
	long long size_of(long long n) {return sizes[root_of(n)];}

	//頂点a, bが間接的に繋がっているか判定
	bool is_united(long long a, long long b) {return (root_of(a) == root_of(b));}

	//頂点aを含むグラフに頂点bを含むグラフを結合
	void unite(long long a, long long b) {
		if (is_united(a, b)) return;
		num_of_trees--;
		if (size_of(a) < size_of(b)) std::swap(a, b); //マージテク
		sizes[root_of(a)] += size_of(b);
		parent[root_of(b)] = root_of(a);
	}
};

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

	ll n, m;
	cin >> n >> m;
	vll p(n);
	for (ll i = 0; i < n; i++) cin >> p[i];

	union_find uf(n);
	for (ll i = 0; i < m; i++) {
		ll x, y;
		cin >> x >> y;
		uf.unite(x - 1, y - 1);
	}

	ll ans = 0;
	vll q(n);
	for (ll i = 0; i < n; i++) {
		q[p[i] - 1] = i;
	}
	for (ll i = 0; i < n; i++) {
		if (uf.is_united(i, q[i])) ans++;
	}
	cout << ans << endl;
}


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

#define REP(i, n) for(decltype(n) i = 0; i < n; i++)

#define ALL(c)   c.begin(), c.end()
#define SORT(c)  std::sort(ALL(c))
#define RSORT(c) std::sort(ALL(c), std::greater<decltype(c)::value_type>())

using namespace std;
using ll = long long;

const int MOD  = (int)1e9 + 7;
const int INF  = (int)1e9 + 1;
const ll  LINF = (ll)1e18 + 1;

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

    int D;
    std::cin >> D;

    map<int, string> map;
    map.emplace(25, "Christmas");
    map.emplace(24, "Christmas Eve");
    map.emplace(23, "Christmas Eve Eve");
    map.emplace(22, "Christmas Eve Eve Eve");

    std::cout << map[D] << std::endl;

    return 0;
}


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

using namespace std;
using ll = long long int;
using P = pair<int, int>;

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

int main(void){

    int n;
    cin >> n;
    printf("%.20lf", 2*n*acos(-1));

    return 0;
}


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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

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

template< typename T >
struct Compress {
  vector< T > xs;

  Compress() = default;

  Compress(const vector< T > &vs) {
    add(vs);
  }

  Compress(const initializer_list< vector< T > > &vs) {
    for(auto &p : vs) add(p);
  }

  void add(const vector< T > &vs) {
    copy(begin(vs), end(vs), back_inserter(xs));
  }

  void add(const T &x) {
    xs.emplace_back(x);
  }

  void build() {
    sort(begin(xs), end(xs));
    xs.erase(unique(begin(xs), end(xs)), end(xs));
  }

  vector< int > get(const vector< T > &vs) const {
    vector< int > ret;
    transform(begin(vs), end(vs), back_inserter(ret), [&](const T &x) {
      return lower_bound(begin(xs), end(xs), x) - begin(xs);
    });
    return ret;
  }

  int get(const T &x) const {
    return lower_bound(begin(xs), end(xs), x) - begin(xs);
  }

  const T &operator[](int k) const {
    return xs[k];
  }
};

template< typename T >
struct BinaryIndexedTree {
  vector< T > data;

  BinaryIndexedTree(int sz) {
    data.assign(++sz, 0);
  }

  T sum(int k) {
    T ret = 0;
    for(++k; k > 0; k -= k & -k) ret += data[k];
    return (ret);
  }

  void add(int k, T x) {
    for(++k; k < data.size(); k += k & -k) data[k] += x;
  }
};

void func(long long N, long long K, std::vector<long long> a){

    vector<lli> s(N+1);
    s[0] = 0;
    REP(i,0,N)s[i+1] = s[i] + a[i];
    REP(i,0,N+1)s[i] -= K*i;

    Compress<lli> comp(s);
    comp.build();

    BinaryIndexedTree<lli> bit(comp.xs.size());

    lli ans = 0;
    REP(i,0,N+1){
        lli now = comp.get(s[i]);
        ans += bit.sum(now);
        bit.add(now,1);
    }
    cout<<ans<<endl;
    
}

int main(){
    // cout << fixed << setprecision(5);

    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> a(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&a[i]);
    }
    func(N, K, std::move(a));
    return 0;
}


Measured memory_bytes: 6640
#include<bits/stdc++.h>
#define rep(i,n) for(long long i=0;i<(n);i++)
#define ll long long
using namespace std;
int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    bool flg=0;
    while(a > 0 && c > 0){
        a -= d; c -= b;
        if(c <= 0) flg = 1;
        else flg = 0;
    }
    if(flg) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3596
s = input()
k = int(input())

pri = sorted(set(s))[0]
cnt = s.count(pri)
lind = []
ind = -1
for i in range(cnt):
  tmp = s[ind+1:].find(pri)
  lind.append(tmp+ind+1)
  ind = tmp + ind + 1
setdic = set()
for i in lind:
  for j in range(1,k+1):
    setdic.add(s[i:i+j])
if len(setdic) >= k:
  lians = sorted(list(setdic))
  print(lians[k-1])
else:
  sec = sorted(set(s))[1]
  cnt = s.count(sec)
  lind = []
  ind = -1
  for i in range(cnt):
    tmp = s[ind+1:].find(sec)
    lind.append(tmp+ind+1)
    ind = tmp+ind+1
  setdic2 = set()
  for i in lind:
    for j in range(1,k+1):
      setdic2.add(s[i:i+j])
  if len(setdic)+len(setdic2) >= k:
    lians = sorted(list(setdic2))
    print(lians[k-1-len(setdic)])
  else:
    thr = sorted(set(s))[2]
    cnt = s.count(thr)
    lind = []
    ind = -1
    for i in range(cnt):
      tmp = s[ind+1:].find(thr)
      lind.append(tmp+ind+1)
      ind = tmp+ind+1
    setdic3 = set()
    for i in lind:
      for j in range(1,k+1):
        setdic3.add(s[i:i+j])
    lians = sorted(list(setdic3))
    print(lians[k-1-len(setdic)-len(setdic2)])

Measured memory_bytes: 3188
N, K = map(int, input().split())
R, S, P = map(int,input().split())
T = [i for i in input()]

score = 0
hand_score = {'r': R, 's': S, 'p': P}
my_hand_dict = {'r': 'p', 's': 'r', 'p': 's'}
my_hand_list = list()
for i, hand in enumerate(T):
    if i < K:
        my_hand = my_hand_dict[hand]
        score += hand_score[my_hand]
        my_hand_list.append(my_hand)
    else:
        my_hand = my_hand_dict[hand]
        if my_hand != my_hand_list[i-K]:
            score += hand_score[my_hand]
            my_hand_list.append(my_hand)
        else:
            my_hand_list.append('0')

print(score)

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

const long long MOD=1000000007;

int main(){
  int N; cin >> N;
  int d[100000];
  for(int i=0; i<N; i++) cin >> d[i];
  sort(d,d+N);
  cout << d[N/2]-d[N/2-1] << endl;
}

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


int Partition(int A[],int p,int r){
  int x = A[r];
  int i = p-1;
  for(int j=p;j<r;j++){
    if(A[j] <= x){
      i = i+1;
      int h=A[i];
      A[i] = A[j];
      A[j] = h;
    }
  }
  int h = A[i+1];
  A[i+1] = A[r];
  A[r] = h;



  return i+1;
}


int main(){
  int n,index;
  while(scanf("%d",&n) != EOF){
    int *A = new int[n+1];
    for(int i=1;i<=n;i++){
      scanf("%d",&A[i]);
    }
    index = Partition(A,1,n);
    for(int i=1;i<=n;i++){
      if(index == i)printf("[");
      printf("%d",A[i]);
      if(index == i)printf("]");
      if(i != n)printf(" ");
    }
    printf("\n");
    delete [] A;
  }
  return 0;
}



Measured memory_bytes: 3212
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(V) V.begin(),V.end()
#define MOD 1000003

ll modpow(ll x, ll k) {
	ll ans = 1;
	while (k) {
		if (k & 1)ans = ans * x % MOD;
		x = x * x % MOD;
		k /= 2;
	}
	return ans;
}

ll moddiv(ll x, ll y) {
	return x * modpow(y, MOD - 2) % MOD;
}

ll fact[1000005];

int main() {
	fact[0] = 1;
	for (ll i = 1;i < 1000005;i++) {
		fact[i] = fact[i - 1] * i % MOD;
	}
	int Q;
	cin >> Q;
	ll x, d, n, D, XD, d3, ans = 0;
	for (int i = 0;i < Q;i++) {
		cin >> x >> d >> n;
		if (d == 0) {
			cout << modpow(x, n) << endl;
			continue;
		}
		if (x == 0) {
			cout << 0 << endl;
			continue;
		}
		D = moddiv(x, d);
		if (D + n - 1 >= MOD)cout << 0 << endl;
		else 
			cout << moddiv(fact[D + n - 1], fact[D - 1]) * modpow(d, n) % MOD << endl;
	}
}

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

int main() {
  int A, B, C, X;
  cin >> A >> B >> C >> X;
  int count = 0;
  for (int i = 0; i <= A; i++) {
    for (int j = 0; j <= B; j++) {
      for (int k = 0; k <= C; k++) {
        if (500*i + 100*j + 50*k == X) {
          count++;
        }
      }
    }
  }
  cout << count << endl;
}


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

int main(){
	int n;
	cin >> n;
	int a[n];
	REP(i,n) cin >> a[i];
	int cnt = 0;
	REP(i,n){
		while(a[i] % 2 == 0){
			a[i] /= 2;
			cnt++;
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
import math
import collections
import bisect
from collections import deque
from copy import copy, deepcopy
import time

import numpy as np
import numba
from numba import njit, b1, i4, i8, f8
from numba import jit


def main():
    N = int(input())
    count=0
    ans=False
    for i in range(N):
        a,b = map(int,input().split())
        if a==b:
            count += 1
        else:
            count=0
        if count >=3:
            ans=True
    print("Yes" if ans else "No")

if __name__ == '__main__':
    main()

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

int main() {
  string str;
  int arr[26] = {};
  while (getline(cin, str)) {
    for (int i = 0; i < str.size(); i++) {
      if (isalpha(str[i])) {
        if (isupper(str[i])) {
          str[i] = str[i] + 32;
        }
        arr[str[i] - 97] += 1;
      }
    }
  }
  char alpha = 'a';
  for (int i = 0; i < 26; i++) {
    cout << alpha << " : " << arr[i] << endl;
    alpha++;
  }
  return 0;
}


Measured memory_bytes: 3208
using System;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var n =  Int64.Parse(Console.ReadLine().Trim());
            switch (n % 10)
            {
                case 3:
                    Console.WriteLine("bon");
                    break;
                case 0:
                case 1:
                case 6:
                case 8:
                    Console.WriteLine("pon");
                    break;
                default:
                    Console.WriteLine("hon");
                    break;
            }
        }
    }
}


Measured memory_bytes: 17556
#include <iostream>
#include <array>

#define MAX 100

using namespace std;

void selectionSort( array< int, MAX> ary, int N )
{
	int i, j, minj, tmp, exchange = 0;
	int flag = 0;

	for ( i = 0 ; i < N ; i++ ) {
		minj = i;
		flag = 0;
		for ( j = i ; j < N ; j++ ) {
			if ( ary[minj] > ary[j] ) {
				minj = j;
				flag = 1;
			}
		}

		if ( flag == 1 ) { exchange++; }
		tmp = ary[minj];
		ary[minj] = ary[i];
		ary[i] = tmp;
	}
	

	for ( i = 0 ; i < N ; i++ ) {
		if ( i == N-1 ) {
			cout << ary[i] << endl;
		} else {
			cout << ary[i] << " ";
		}
	}
	cout << exchange << endl;
}	

int main()
{
	int N;
	array< int, MAX > ary;

	cin >> N;
	for ( int i = 0 ; i < N ; i++ ) {
		cin >> ary[i];
	}
	selectionSort( ary, N );
	return 0;
}



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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int T[4] = {0, 0, 0, 0};

int main()
{
    string S;
    cin >> S;
    string ans = "Yes";
    REP(i, S.length())
    {
        if (S[i] == 'N')
            T[0]++;
        else if (S[i] == 'W')
            T[1]++;
        else if (S[i] == 'S')
            T[2]++;
        else
            T[3]++;
    }

    REP(i, 2)
    {
        if (T[i] * T[i + 2] == 0 && T[i] + T[i + 2] > 0)
            ans = "No";
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
const int N=2007;
int n,a[N],ed[N],s[N][N],sp[N];
int gcd(int a,int b){
	while(b){a%=b;if(!a)return b;b%=a;}
	return a;
}
void mg(int a,int b){
	memcpy(s[0],s[a],sizeof(int)*sp[a]);
	int*as=s[0],*ap=as+sp[a];
	int*bs=s[b],*bp=bs+sp[b];
	int*p=s[a];
	while(as!=ap&&bs!=bp)*p++=*as>*bs?*as++:*bs++;
	while(as!=ap)*p++=*as++;
	while(bs!=bp)*p++=*bs++;
	sp[a]=p-s[a];
}
void f1(int w){
	ed[w]=1;
	for(int i=1;i<=n;++i)if(!ed[i]&&gcd(a[i],a[w])!=1)f1(i),mg(w,i);
	for(int i=sp[w]++;i;--i)s[w][i]=s[w][i-1];
	s[w][0]=a[w];
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i)scanf("%d",a+i);
	std::sort(a+1,a+n+1);
	for(int i=1;i<=n;++i)if(!ed[i])f1(i),mg(n+1,i);
	for(int i=0;i<n;++i)printf("%d ",s[n+1][i]);
	return 0;
}

Measured memory_bytes: 15488
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#define _USE_MATH_DEFINES
#include <cmath>

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

using namespace std;
typedef long long ll;

const int MAXN = 300100;

int main() {
   int  n, cur;
   int  ans = MAXN;
   char S[MAXN];
   int  cnte[MAXN];

   cin >> n;
   scanf("%s", S);
   cnte[0] = 0;
   for (int i = 1; i <= n; i++) {
      if (S[i - 1] == 'E') cnte[i] = cnte[i - 1] + 1;
      else cnte[i] = cnte[i - 1];
   }
   for (int i = 1; i <= n; i++) {
      cur = i - 1 - cnte[i - 1] + cnte[n] - cnte[i];
      ans = min(ans, cur);
   }
   cout << ans << endl;
   return(0);
}


Measured memory_bytes: 1664
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int max = a +b;
        max = Math.max(max, a -b);
        max = Math.max(max, a * b);
        System.out.println(max);
        
    }
}


Measured memory_bytes: 23124
#include <stdio.h>
#include <stdlib.h>

void maxheapify(int* ,int);
int n;

int main(){
  int A[500000],i;

  scanf("%d",&n);

  for(i = 1; i <= n; i++){
    scanf("%d",&A[i]);
  }
  
  for(i = n/2; i > 0; i--)
    maxheapify(A,i);

  for(i = 1; i <= n; i++){
    printf(" %d",A[i]);
  }
  printf("\n");
  

  return 0;
}

void maxheapify(int *A,int i){
  int l,r,largest,t;
  l = i*2;
  r = i*2+1;

  if(l <= n && A[l] > A[i])
    largest = l;
  else
    largest = i;
  if(r <= n && A[r] > A[largest])
    largest = r;

  if(largest != i){
    t = A[i];
    A[i] = A[largest];
    A[largest] = t;
    maxheapify(A,largest);
  }
}



Measured memory_bytes: 3720
#include<stdio.h>

unsigned long x;
unsigned long i = 0;

int main()
{
    int tmp = 0;

    scanf("%ld", &x);

    i = (x / 11) * 2;
    x = x % 11;

    while(tmp < x){
        i++;
        (i % 2) ? (tmp += 6) : (tmp += 5);
    }

    printf("%lu\n", i);

    return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner in = new Scanner(System.in);
    int a = in.nextInt();
    int b = in.nextInt();
    int c = in.nextInt();
    
    if( a > b ){
      int t = a;
      a = b;
      b = t;
    }
    if( b > c ){
      int t = b;
      b = c;
      c = t;
    }
    if( a > b ){
      int t = a;
      a = b;
      b = t;
    }
    System.out.println(""+a+" "+b+" "+c+"");
  }
}

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

int main( )
{
    int a, b;
    cin >> a >> b;
    if (a == b) {
        cout << "Draw\n";
    }
    else if (a == 1) {
        cout << "Alice\n";
    }
    else if (b == 1) {
        cout << "Bob\n";
    }
    else if (a > b) {
        cout << "Alice\n";
    }
    else {
        cout << "Bob\n";
    }
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
	public class ABC
	{
		private const int mod = 1000000007;  // 10^9+7

		static void Main(string[] args)
		{
			//System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch(); stopwatch.Start();
			//Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });


			//string str = Console.ReadLine();
			//int n = int.Parse(Console.ReadLine());
			//long x = long.Parse(Console.ReadLine());
			int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] vs = Console.ReadLine().Split().Select(long.Parse).ToArray();
			int n = vs[0];
			int m = vs[1];
			int[] num = new int[n];
			for (int i = 0; i < n; i++) {
				num[i] = -1;
			}
			for (int i = 0; i < m; i++) {
				vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
				int s = vs[0] - 1;
				int c = vs[1];
				if (num[s] == -1 || num[s] == c) {
					num[s] = c;
				} else {
					Console.WriteLine("-1");
					return;
				}
			}
			if (num[0] == 0 && n > 1) {
				Console.WriteLine("-1");
				return;
			}
			for (int i = 0; i < n; i++) {
				if (num[i] == -1) {
					if (i == 0 && n > 1) {
						num[i] = 1;
					} else {
						num[i] = 0;
					}
				}
			}
			Console.WriteLine(string.Concat(num));


			//Console.Out.Flush();
			//System.Diagnostics.Debug.WriteLine(stopwatch.Elapsed);
		}
	}
}


Measured memory_bytes: 13396
/*
*
*	AUTHOR :- @soham01
*		// "WORK HARD AND NEVER GIVE UP" //
*
*/
#include "bits/stdc++.h"

using namespace std;

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> //find_by_order(), order_of_key()
#define pb push_back
#define mp make_pair 
#define vi vector<long long int >
#define vb vector<bool>
#define vs vector<string>
#define vd vector<double>
#define vvi vector<vector<long long int> >
#define vp vector<pair<long long int , long long int > >
#define seti set<long long int >
#define setc set<char>
#define setd set<double>
#define mod 1000000009
#define endl '\n'
typedef long long int lli;

// ITS MY REQUEST TO PLEASE PLEASE DO LOOK AT THE CONSTRAINS GIVEN CAREFULLY
// DO CHECK FOR CORNER CASES

/*-------LET THE GAME BEGIN-----------*/

void solve()
{
	lli n,i,j,c=0;
	cin >> n;
	string s;
	set <string> st;
	for(i=0;i<n;i++)
	{
		cin >> s;
		st.insert(s);
	}
	cout << st.size() << endl;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
		solve();
	return 0;
}





Measured memory_bytes: 19280
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#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 <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;

#define all(a) (a).begin(), (a).end()

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

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

    int n, m; cin>>n>>m;

    int head = 2, tail = n;
    vector<P> ans;
    if(n % 2 == 1){
        for(int i=0; i<m; i++){
            ans.emplace_back(head, tail);
            head++, tail--;
        }
    }
    else{
        set<int> length;
        for(int i=0; i<m; i++){
            int over = (n - tail) + head, under = tail - head;
            if(over == under || length.count(over) || length.count(under)) tail--;

            ans.emplace_back(head, tail);
            length.emplace(over);
            length.emplace(under);
            head++, tail--;
        }
    }

    for(auto i : ans) cout << i.first << " " << i.second << endl;

    return 0;
}

Measured memory_bytes: 10292
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i, n) ;for (int i = 0;i < (int)(n);i++)
#define rep2(i, s, n) ;for (int i = s; i < (int)(n);i++)
#define ALL(vec)  (vec).begin(),(vec).end()
#define pi 3.1415926535897932384626433832795
#define MAX_INF 9223372036854775807
#define MIN_INF (922337203685477587+1)
#define sosuu 1000000007
lli combi[105][3];

lli nCr(lli n, lli r)
{
       if(n<r) return 0;
       if(n==r) return combi[n][r] = 1;
       if(r==0) return combi[n][r] = 1;
       if(r==1) return combi[n][r] = n;
       if(combi[n][r]) return combi[n][r];
       return combi[n][r] = nCr(n-1,r) + nCr(n-1,r-1);
}

int main() {
  lli N,M;
  cin >> N >> M;
  cout <<nCr(N,2)+nCr(M,2) << endl;
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;
    cout << (char)toupper(s1.front()) << (char)toupper(s2.front()) << (char)toupper(s3.front()) << endl;
    return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
typedef long long ll;
const ll MOD=1000000007;
using namespace std;
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; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
//---------------------------------------------------------------------------------------------------
typedef pair<int,int> P;

int main(void){
    // Your code here!
    int N; cin >> N;
    string S; cin >> S;
    int Q; cin >> Q;
    while(Q--) {
        int k;cin >> k;
        ll ans = 0,m = 0,c = 0,mc = 0;
        rep(i,k) {
            if (S[i] == 'M') m++;
            if (S[i] == 'C') {
                c++;
                mc += m;
            }
        }
        if (S[0] == 'D') ans += mc;

        rep(i,N-k) {
            // erase left i
            if (S[i] == 'M') {
                m--;
                mc -= c;
            }
            if (S[i] == 'C') {
                c--;
            }
            // add right i + d
            if (S[i+k] == 'M') {
                m++;
            }
            if (S[i+k] == 'C') {
                c++;
                mc += m;
            }
            if (S[i+1] == 'D') {
                ans += mc;
            }
        }

        FOR(i,N-k,N-2) {
            if (S[i] == 'M') {
                m--;
                mc -= c;
            }
            if (S[i] == 'C') {
                c--;
            }
            if (S[i+1] == 'D') {
                ans += mc;
            }
        }
        cout << ans << endl;
    }
}


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

int main() {
  string S, ans;
  
  cin >> S;
  
  if(S[S.size()-1]!='s'){
    ans = S + 's';
  } else{
    ans = S + "es";
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;
const int mod = 1e9+7;

int main() {
    int n; cin >> n;
    int sum = 0;
    vint A(n);
    rep(i,n) {
        int a; cin >> a;
        sum += a;
        A[i] = a;
    }
    int mid = round((double)sum/n);
    int ans = 0;
    rep(i,n) {
        ans += pow(mid-A[i],2);
    }
    cout << ans << endl;
}

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

using namespace std;

const int MAXN = 100010;
int N, M;
vector<int> V[MAXN];
bool vis[MAXN];

int DP[MAXN];

void dfs(int node) {
    vis[node] = true;

    int mx = 0;
    for(auto nxt: V[node]) {
        if (!vis[nxt]) dfs(nxt);

        mx = max(mx, DP[nxt]);
    }

    DP[node] = mx + 1;
}

int main(){

    cin >> N >> M;

    for (int from, to; M--; ) {
        cin >> from >> to;
        V[from].push_back(to);
    }

    for (int i = 1; i <= N; i++) {
        if (!vis[i]) dfs(i);
    }
    int ans = 0;
    for (int i = 1; i <= N; i++) {
        ans = max(ans, DP[i]);
    }
    cout << ans - 1;

    return 0;
}


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

using namespace std;

int main()
{
  int N, D[300000], E[300000];

  scanf("%d", &N);
  int reach = 0;
  for(int i = 0; i < N; i++) {
    scanf("%d", &D[i]);
    E[N - i - 1] = D[i];
  }

  auto check = [&](int *A)
  {
    int reach = 0;
    for(int i = 0; i < N; i++) {
      if(reach < i * 10) return (false);
      reach = max(reach, i * 10 + A[i]);
    }
    return (true);
  };

  puts(check(D) && check(E) ? "yes" : "no");
}

Measured memory_bytes: 5452
temp = True
i = 0
N = []
M = []
while True:
    p,c = map(int, input().strip().split(' '))
    if p == 0 and c == 0:
        break
    if temp:
        n = p
        r = c
        for j in range(n):
            N.append(n-j)
        temp = False
    else:
        for j in range(c):
            M.append(N[p+j-1])
        for j in range(p-1):
            M.append(N[j])
        for j in range(n-c-p+1):
            M.append(N[j+c+p-1])
        N = M
        M = []
        i = i + 1
        if i == r:
            print(N[0])
            temp = True
            N = []
            i = 0


Measured memory_bytes: 5620
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <utility>
#include <numeric>
#include <deque>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <limits>
#include <cassert>
#include <bitset>
#include <list>
#include <iomanip>
#include <cctype>
#include<chrono>
#include<random>

#define for0(i, N)    for (long long i = 0  ; i <  (N); ++i)
#define for1n(i, N)   for (long long i = 1  ; i <= (N); ++i)
#define for1(i, N)    for (long long i = 1  ; i <  (N); ++i)
#define forn(i, N)    for (long long i = 0  ; i <= (N); ++i)
#define forx(i, N, x) for (long long i = (x); i <  (N); ++i)
#define forl(i, N, x, a) for (long long i = (x), a = 0; a < (N);    \
                              i = (i + 1) % (N), ++a)
#define int long long

long double constexpr pi = 3.141592653589793;

template<class T>
constexpr T sigma1(T i, T n){
    return (n - i + 1) * (i + n) / 2;
}

template<class T>
constexpr T sigma2(T i, T n){
    return (i == 1 ? n * (n + 1) * (2 * n + 1) / 6 :
            sigma2(1, n) - sigma2(1, i - 1));
}

template<class T>
constexpr T sigma3(T i, T n){
    if (i == 1) {
        auto temp = sigma1(i, n);
        return temp * temp;
    }
    return sigma2(1, n) - sigma2(1, i - 1);
}

template<size_t i>
std::bitset<i> operator++(std::bitset<i> b, signed){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    return b = (unsigned long long)b + 1;
}

template<size_t i>
std::bitset<i> operator++(std::bitset<i> b){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    auto temp = b;
    b++;
    return temp;
}

template<size_t i>
std::bitset<i> operator--(std::bitset<i> b, signed){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    return b = (unsigned long long)b - 1;
}

template<size_t i>
std::bitset<i> operator--(std::bitset<i> b){
    static_assert(i <= 64, "Cannot cast 64bit int.");
    auto temp = b;
    b--;
    return temp;
}

long long constexpr inf = std::numeric_limits<long long>::max();

using namespace std;

typedef long long ll;
typedef long double ld;
typedef priority_queue<ll> pq;
typedef priority_queue<ll,vector<ll>, greater<ll>> pql;
typedef stack<ll> stk;
typedef queue<ll> qu;
typedef pair<ll, ll> pll;
typedef map<ll, ll> mll;
typedef unordered_map<ll, ll> umll;
typedef set<ll> sll;
typedef unordered_set<ll> usll;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<vector<ll>> vvll;


signed main(void){
    cin.tie(0); ios::sync_with_stdio(false);cout<<fixed<<setprecision(10);

    ll a = 100;

    ll x = 0;

    cin >> x;

    int i = 0;
    while (true) {
        ++i;
        a *= 1.01;
        if (a >= x) {
            cout << i;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (v).size()
#define inf 1e18
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(i,0,n)cout<<v[i]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); 

using namespace std;
using namespace __gnu_pbds;

template<typename T>
using o_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define M 1000010

bool f(ll a){
	if(a==0 || a==1)return true;
	ll t=sqrt(a);
	if(t*t==a)return true;
	return false;
}
int main(){
	IOS;
	ll n,d;cin>>n>>d;
	ll a[n][d];rep(i,0,n)rep(j,0,d)cin>>a[i][j];
	ll ans=0;
	rep(i,0,n-1){
		rep(k,i+1,n){
			ll val=0;
			rep(j,0,d)val+=(a[i][j]-a[k][j])*(a[i][j]-a[k][j]);
			if(f(val))ans++;
		}
	}
	cout<<ans;
	return 0;
}



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

int main(){
  string S;
  cin>>S;
  vector<int> ans(S.size());
  int i=0;
  while(i<S.size()){
    
    if(S.at(i)=='R'){
      int j=i;
      while(j<S.size()&& S.at(j)!='L'){
        ++j;
      }
      ans.at(j-1)+=(j-i+1)/2;
      ans.at(j)+=(j-i)/2;
      i=j;
    }
    
    else if(S.at(i)=='L'){
      int j=i;
      while(j<S.size() && S.at(j)!='R'){
        ++j;
      }
      ans.at(i)+=(j-i+1)/2;
      ans.at(i-1)+=(j-i)/2;
      i=j;
    }
}

   for(int i=0;i<S.size();++i){
    cout<<ans.at(i)<<" ";
   }
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
const double PI = acos(-1.0);
#define MOD 1000000007LL
#define endl "\n"

template<typename T>
struct SegTree{
  const T e = numeric_limits<T>::max(); //単位元
  vector<T> dat;
  int n;
  SegTree(int n_): n(), dat(4*n_, (1LL<<31)-1){
    int x = 1;
    while(n_ > x) x *= 2;
    n = x;
  }

  SegTree(vector<T> v): n(), dat(4*v.size(), e){
    int x = 1;
    int n_ = v.size();
    while(n_ > x) x *= 2;
    n = x;
    for(int i = 0; i < n_; i++) dat.at(i+n-1) = v.at(i);
    for(int i = n-2; i >= 0; i--) dat.at(i) = min(dat.at(2*i+1), dat.at(2*i+2)); //演算
  }

  void set(int i, T x){dat.at(i + n-1) = x;}
  void build(){
    for(int i = n-2; i >= 0; i--) dat.at(i) = min(dat.at(2*i+1), dat.at(2*i+2)); //演算
  }

  void update(int i, T x){
    i += n-1;
    dat.at(i) = x;
    while(i > 0){
      i = (i-1)/2;
      dat.at(i) = min(dat.at(2*i+1), dat.at(2*i+2)); //演算
    }
  }

  T query_sub(int a, int b, int k, int l, int r){
    if(r <= a || b <= l) return e;
    else if(a <= l && r <= b) return dat.at(k);
    else{
      T vl = query_sub(a, b, 2*k+1, l, (l+r)/2);
      T vr = query_sub(a, b, 2*k+2, (l+r)/2, r);
      return min(vl, vr); //演算
    }
  }
  T query(int a, int b){return query_sub(a, b, 0, 0, n);}

  T getval(int i){return dat.at(i+n-1);}
};

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n, q;
  cin >> n >> q;
  SegTree<ll> st(n);
  while(q--){
    int query;
    ll x, y;
    cin >> query;
    cin >> x >> y;
    if(query == 0){
      st.update(x, y);
    }
    else{
      cout << st.query(x, y+1) << endl;
    }
  }
}


Measured memory_bytes: 6000
s = input()

count = 0

for i in range(len(s)):
  if i % 2 == 0:
    if s[i] != 'L':
      count += 1
  else:
    if s[i] != 'R':
      count += 1

if count == len(s):
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3060
n,k=map(int,input().split())
s=list(input())
a=[]
f=1
s.append(2)
for i in range(n):
    if s[i]==s[i+1]:
        f+=1
    else:
        a.append(f)
        f=1
g=len(a)
r=[0]*(g+1)
for i in range(g):
    r[i+1]=r[i]+a[i]
if s[0]=='1':
    ans=sum(a[0:2*k+1])
    if s[-2]=='0':
        ans=max(ans,sum(a[max(0,g-2*k):g]))
    for i in range(g):
        if 2*i+2*k+1<g+1:
            ans=max(ans,r[2*i+2*k+1]-r[2*i])
        else:
            break
    print(ans)
else:
    ans=sum(a[0:2*k])
    if s[-2]=='0':
        ans=max(ans,sum(a[max(0,g-2*k):g]))
    for i in range(g):
        if 2*i+2*k+2<g+1:
            ans=max(ans,r[2*i+2*k+2]-r[2*i+1])
        else:
            break
    print(ans)


Measured memory_bytes: 55024
#include <bits/stdc++.h>
 
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n0,n) for(int i=n0;i<n;i++)
#define Com(i,j,n) for(int i=0;i<n-1;i++)for(int j=i+1;j<n;j++)
const int INF =100100100;
const int MOD = (int)1e9+7;
const double EPS = 1e-9;
typedef long long ll;
typedef long li;
#define pb push_back 
#define mp make_pair

signed main (){	
	string temp;
	cin >> 	temp;
	rep(i,temp.length()){
		if(temp[i]=='1') cout << 9 ;
		else cout << 1;
	}
	cout << endl;
	return 0;
}


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

/* #pragma */
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")


/*alias*/
#define F first
#define S second

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define itn int

/*template*/
template<class T>inline bool amax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>inline bool amin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

/* func */
int32_t GCD(int32_t a, int32_t b){return b ? GCD(b, a%b) : a;}
int64_t GCD(int64_t a, int64_t b){return b ? GCD(b, a%b) : a;}
int32_t LCM(int32_t a, int32_t b){return a * b / GCD(a, b);}
int64_t LCM(int64_t a, int64_t b){return a * b / GCD(a, b);}

/*struct*/
struct aaa {
	aaa() {
		cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);
	};
}aaaaaaa;

/* const */
constexpr int32_t INF = 1001001001;
constexpr int64_t LINF = 1001001001001001001ll;
constexpr int32_t MOD = 1e9 + 7; //10^9
constexpr int64_t EPS = 1e-9;
constexpr int32_t dx[] = { 1, 1, 0, -1, -1, -1, 0, 1 }, dy[] = { 0, 1, 1, 1, 0, -1, -1, -1 };
//constexpr int32_t dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
//Counterclockwise from the 6o'clock direction
//Take the x-axis downward and the y-axis right


//g++ -std=c++14 -Wall --pedantic-errors -o template template.cpp
//g++ -std=c++14 -Wall --pedantic-errors template.cpp
//chcp 65001

/*global*/



//#define int int64_t
signed main()
{
	int n; cin >> n;
	vector<int> a(n+1);
	for(int i = 0, i_len = (int)n+1; i < i_len; ++i) cin >> a[i+1];
	vector<int> b(n+1);

	for(int i = n; i >= 1; --i)
	{
		int sum{};
		//i+iで自分を除くiの倍数
		//2の倍数 2,4,6 == 2, 2+2, 2+2+2
		for(int j = i+i; j <= n; j += i)
		{
			sum ^= b[j];//mod 2. 0なら偶数個ボール入れた.1なら奇数個だから^=
		}
		b[i] = sum^a[i];//a^b=0のとき,a==bより,b[i]=0{sum == a[i]のとき}
		//{1,1}又は{0,0}でないとき1,そうでなければ0を代入
	}	
	vector<int> ans;
	for(int i = 1; i <= n; ++i)
	{
		if(b[i]) ans.emplace_back(i);
	}
	cout << ans.size() << '\n';
	for(int i = 0; i < ans.size(); ++i)
	{
		cout << ans[i] << '\n';
	}
}

/*
 [0][0][0][1][0][1]
i 1  2  3  4  5  6
a 0  0  1  1  0  1

i=6のとき,余りが1よりボールを入れる必要がある.->半分から右は必然的に決まる.
i=3のとき,{3,6}のボールの個数を2で割った余りが1になってほしい.->半分から右にあるやつ次第
ボールの個数を2で割った余りが0か1->入れたボールの偶奇をxorで求めれそう
sum==0スタートなら奇数回入れた->1

xorはスイッチ

3の倍数の内,3より大きいものにボールが偶数個入っている時に3にボールを入れたら余り1
　　　　　　　　　　　　　　　　　　 奇数個入っている時に3にボールを入れたら余り0
になるので,見ている数より大きい倍数を見て偶数か奇数かを取得してa[i]と比較して
右が偶数個(=0)かつa[i]が1ならボールを入れる(ボールを入れる==1)
右が偶数個(=0)かつa[i]が0ならボールを入れない(ボールを入れない==0)
           0       0        ->     0
		   ここもxor使う
		   sum(ボールの偶奇)とa[i](余り)のxorでボールを入れるかスイッチする
*/

Measured memory_bytes: 3192
//
// Created by file on 18/04/21.
//

//#include <stdio.h>
//#include <stdlib.h>
#include <cstdio>
#include <iostream>

using namespace std;

int main() {


    char cha[4];
    std::cin >> cha;
    int ans = 0;

    for (int i = 0; i < sizeof(cha); ++i) {
        if (cha[i] == '+') {
            ans++;
        }
        if (cha[i] == '-') {
            ans--;
        }

    }

    std::cout << ans << endl;
}

Measured memory_bytes: 256
# 2020/05/17
# AtCoder Beginner Contest 168 - C

import math

# Input
a, b, h, m = map(int,input().split())
hdeg = 360 * (h / 12 + (m / 60 / 12))
mdeg = 360 * m / 60
deg = abs(hdeg - mdeg)

# Calc
# 余弦定理: a^2=b^2+c^2−2bccosA
yog = (a ** 2 + b ** 2 - 2 * a * b * math.cos(math.radians(deg))) ** (1/2)
ans = yog

# Output
print(ans)


Measured memory_bytes: 9500
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
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;}
const int inf = 1001001001;

int main() {
    int n;
    string s;
    cin >> n >> s;
    int ans = 1;
    char c = s[0];
    rep2(i,1,s.size()) {
        char nc = s[i];
        if(nc == c) continue;
        c = nc;
        ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
n, m = list(map(int, input().split()))
info = [list(map(int, input().split())) for i in range(m)] 

# 重要な事実としてNの最大値×D_iの最大値はちょうど10^4*10^5 = 10^9 = 座標の幅。
# 「位置関係は全て正しく置けるが、0〜10^9に収まらないのでダメ」という可能性は考慮しなくて良い。
# 辺を通って到達可能か否かで分かれる。→幅優先か深さ優先かUnion-Findだな。
# 迷ったら幅優先で書こう。
# なおエッジを1本ずつ（入力された順に）処理するのはマズい。100個の点からなる塊が2つあって、最後にそれが2つの線で結ばれた場合、無矛盾かどうかどうやって判別するか?

from collections import deque

nei = [[] for _ in range(n)]
for edge in info:
    v0 = edge[0] - 1
    v1 = edge[1] - 1
    nei[v0].append((v1, edge[2]))
    nei[v1].append((v0, -edge[2]))

queue = deque()
visited = [False] * n
pos = [None] * n

for i in range(n):
    if visited[i]:
        continue
    queue.append(i)

    pos[i] = 0  # 相対位置なので、値は何でも良い

    while len(queue) > 0:
        v = queue.popleft()
        visited[v] = True

        for n, diff in nei[v]:
            if pos[n] == None:
                pos[n] = pos[v] + diff
                queue.append(n)

            else:
                # 既に訪問済み→座標が決まっている→整合性チェック
                if pos[n] != pos[v] + diff:
                    print('No')
                    exit()

print('Yes')


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

#define MAX 302

int n;
int m;
map<int,int> mp;
map<int,int> cnt;
map<int,vector<int> > vec;

int main(){
	cin>>n>>m;
	int ans=0;
	for(int i=0;i<n;i++){
		int a;
		scanf("%d",&a);
		mp[a]++;
		vec[a%m].push_back(a);
	}
	for(auto it:mp){
		cnt[it.first%m]+=it.second;
	}
	for(auto &it:cnt){
		int z=m-it.first;
		z%=m;
		if(z==it.first){
			ans+=it.second/2;
			it.second%=2;
			continue;
		}
		int mz=min(it.second,cnt[z]);
		ans+=mz;
		it.second-=mz;
		cnt[z]-=mz;
		//cout<<it.first<<" "<<mz<<endl;
	}
	for(auto &it:cnt){
		int val=it.first;
		int rest=it.second;
		vector<int> &v=vec[val];
		sort(v.begin(),v.end());
		//cout<<rest<<endl;
		for(int i=0;i+1<v.size();i++){
			if(rest<2)break;
			if(v[i]==v[i+1]){
				//cout<<v[i]<<" "<<v[i+1]<<endl;
				ans++;
				rest-=2;
				i++;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 20608
#include<cstdio>
#include<algorithm>
using std::sort;
const int N=300011;
int a[N];
int n,m;
struct kkll
{
    int v,id;
    bool operator < (const kkll a)const{return v<a.v;}
}kll[N];
int pll[N],mar;
int b[N];

bool ck(int x)
{
    for(int i=1;i<=m;i++) if(a[i]<=x) b[i]=0;else b[i]=1;
    int p1=n,p2=n;
    while(p1>1)
    {
        if((b[p1]&b[p1-1])||(b[p2]&b[p2+1])) return 0;
        if(!(b[p1]|b[p1-1])||!(b[p2]|b[p2+1])) return 1;
        p1--,p2++;
    }
    return b[1]^1;
}


int main()
{
    // freopen("triangle.in","r",stdin);
    // freopen("triangle.out","w",stdout);
    scanf("%d",&n);
    m=n*2-1;
    for(int i=1;i<=m;i++) scanf("%d",&a[i]),kll[i].v=a[i],kll[i].id=i;
    sort(kll+1,kll+1+m);
    for(int i=1;i<=m;i++){
        if(kll[i].v!=kll[i-1].v) pll[++mar]=kll[i].v;
        a[kll[i].id]=mar;
    }
    int l=1,r=mar;
    while(l<r)
    {
        int mid=l+r>>1;
        if(ck(mid)) r=mid;
        else l=mid+1;
    }
    printf("%d\n",pll[r]);
    return 0;
}


Measured memory_bytes: 4608
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pi = pair<int, int>;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int m, d;
    int ans = 0;
    cin >> m >> d;
    for(int i=1;i<=d;i++)
    {
        if(i / 10 < 2 || i % 10 < 2) continue;
        ans += ((i / 10) * (i % 10) <= m);
    }
    cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=((ll)n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=((ll)a);i<((ll)n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    vl a(n);cin>>a;
    sort(all(a));
    if(a[0]==0){
        puta(0);
        return 0;
    }
    ll v=1;
    rep(i,n){
        if(v<=1000000000000000000ll/a[i]){
            v *= a[i];
        }else{
            puta(-1);
            return 0;
        }
    }
    puta(v);
    return 0;
}

Measured memory_bytes: 4000
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
using namespace std;
using ll = long long;



int main() {
	int a, b;
	cin >> a >> b;
	if (a * b % 2 == 0) cout << "No" << endl;
	else cout << "Yes" << endl;

	return 0;
}


Measured memory_bytes: 256