akhauriyash/Code-Regression huggingface dataset:
#include<iostream> 
#include<iomanip> 
#include<vector> 
#include<map> 
#include<set> 
#include<algorithm> 
#include<numeric> 
#include<limits> 
#include<bitset> 
#include<functional> 
#include<type_traits> 
#include<queue> 
#include<stack> 
#include<array> 
#include<random> 
#include<utility> 
#include<cstdlib> 
#include<ctime>
#define INT_MAX 2147483647
#define _LIBCPP_DEBUG 0
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (n); ++i)	
using namespace std;

int max(int a,int b) {
	int max;
	if (a > b) max = a;
	else max = b;
	return max;
}
int min(int a, int b) {
	int min;
	if (a < b) min = a;
	else min = b;
	return min;
}


int main() {
	int n;
	cin >> n;
	int t = n;
	int s = 0;
	bool a = false;

	while (t > 0) {
		s += t % 10;
		t /= 10;
	}
	
	if ((n % s) == 0) {
		a = true;
	}
	if (a) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
s = input()

flag = True
for i in range(len(s)):
  if i % 2 == 0:
    if s[i] not in ['R', 'U', 'D']:
      flag = False
      break
  else:
    if s[i] not in ['L', 'U', 'D']:
      flag = False
      break
  
result = 'Yes' if flag else 'No'
print(result)


Measured memory_bytes: 2940
from collections import deque, defaultdict
from functools import reduce
from operator import mul

N = int(input())
MOD = 10**9 + 7

# 素数の一覧
prime_nums = set([2]) if N > 1 else set()
prime_nums = prime_nums.union(set(range(3, N+1, 2)))
queue = deque([i for i in prime_nums if i*i <= N+1])
while queue:
    num = queue.popleft()
    prime_nums.difference_update({i for i in range(num*2, N+1, num)})
prime_nums = sorted(list(prime_nums))

# 素因数分解
factors = defaultdict(int)
for i in range(2, N+1):
    for j in prime_nums:
        while True:
            if i % j == 0:
                factors[j] += 1
                i //= j
            else:
                break

if N == 1:
    ans = 1
else:
    ans = reduce(mul, [(v+1) % MOD for v in factors.values()])
print(ans % MOD)


Measured memory_bytes: 39408
#include <iostream>
#include <vector>
#include <map>
using namespace std;
using ll = long long;
int main(){
  int n;
  cin >> n;
  vector<ll> a(n);
  for(int i=0;i<n;i++) cin >> a[i];

  map<ll,int> mp;
  for(int i=0;i<n;i++){
    auto itr = mp.find(a[i]);
    if(itr != mp.end()){
      itr->second++;
    }else{
      mp.insert(make_pair(a[i],1));
    }
  }

  ll cnt = 0;
  for(auto itr=mp.begin();itr!=mp.end();itr++){
    if(itr->first < itr->second){
      cnt += itr->second - itr->first;
    }else if(itr->first > itr->second){
      cnt += itr->second;
    }
  }

  cout << cnt << endl;
}


Measured memory_bytes: 7040
package main

import (
	"fmt"
)

func main() {
	var a, b int
	fmt.Scanf("%d %d\n", &a, &b)

	index := b - a

	bTall := kaijou(index)

	snow := bTall - b

	fmt.Println(snow)
}

func kaijou(n int) int {
	ans := 0
	for i := 1; i <= n; i++ {
		ans += i
	}
	return ans
}


Measured memory_bytes: 512
// Working program with FastReader
import java.io.BufferedReader; 

import java.io.IOException; 
import java.io.InputStreamReader; 
import java.util.Scanner; 
import java.util.StringTokenizer;
import java.lang.*;
public class Main
{ 
	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; 
		} 
	} 

	long gcd(long a, long b) {
		if(b==0) {
			return a;
		}
		return gcd(b,a%b);
	}
	public static void main(String[] args) {
		FastReader ob = new FastReader();
		long a = ob.nextLong(),b=ob.nextLong();
		long gcd=0;
		Main ob1 = new Main();
		gcd = ob1.gcd(a,b);
		System.out.println(a*b/gcd);
	}

} 


Measured memory_bytes: 21076
W , H , x , y = map(float,input().split())

area = ( W * H ) / 2

'''
b = (H -W + 2*x - 2*y ) / 2

if 0 <= H + x -y -b and H + x - y - b <= H and 0 <= x - y - b and x - y - b <= H:
    if 0 <= W - x + y + b and W -x + y + b <= W and 0 <= y - x + b and y - x + b <= W:
        print(area,1)
    else:
        print(area,0)
else:
    print(area,0)
'''

if x == W/2 and y == H/2 :
    print(area,1)
else:
    print(area,0)

Measured memory_bytes: 3064
local s = io.read()
local k = io.read("*n")
local n = #s
local d = {}
local t = {}
local sub = ""
for i = 1, n do
  local lenmax = math.min(k, n - i + 1)
  for j = 1, lenmax do
    sub = s:sub(i, i + j - 1)
    if d[sub] == nil then
      d[sub] = true
      table.insert(t, sub)
    end
  end
end
table.sort(t)
print(t[k])


Measured memory_bytes: 1340
#include <stdio.h>

int main(void) {
	int n, sum, total;
	scanf("%d %d", &n, &sum);
	for (int i = 0; i <= sum/10000; i++) {
		for (int j = 0; j <= (sum-10000*i)/5000; j++) {
			total = 10000 * i + 5000 * j + 1000 * (n - i - j);
			if (total == sum) {
				printf("%d %d %d\n", i, j, n - i - j);
				return 0;
			}
		}
	}
	printf("-1 -1 -1\n");
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h> 
using namespace std; 
const int MAX = 500005; 
struct Query 
{ 
    int l, r, idx; 
}; 
bool cmp(Query x, Query y) 
{ 
    return x.r < y.r; 
} 
void update(int idx, int val, int bit[], int n) 
{ 
    for (; idx <= n; idx += idx&-idx) 
        bit[idx] += val; 
} 
int query(int idx, int bit[], int n) 
{ 
    int sum = 0; 
    for (; idx>0; idx-=idx&-idx) 
        sum += bit[idx]; 
    return sum; 
} 
void answeringQueries(int arr[], int n, Query queries[], int q) 
{  
    int bit[n+1]; 
    memset(bit, 0, sizeof(bit)); 
    int last_visit[MAX]; 
    memset(last_visit, -1, sizeof(last_visit)); 
    int ans[q]; 
    int query_counter = 0; 
    for (int i=0; i<n; i++) 
    { 
        if (last_visit[arr[i]] !=-1) 
            update (last_visit[arr[i]] + 1, -1, bit, n); 
        last_visit[arr[i]] = i; 
        update(i + 1, 1, bit, n); 
        while (query_counter < q && queries[query_counter].r == i) 
        { 
            ans[queries[query_counter].idx] = query(queries[query_counter].r + 1, bit, n)- query(queries[query_counter].l, bit, n); 
            query_counter++; 
        } 
    }  
    for (int i=0; i<q; i++) 
        cout << ans[i] << endl; 
} 
int main() 
{ 
    int n, q, i,x,y;
    cin >> n >> q;
    int a[n];
    for(i=0;i<n;i++)
        cin >> a[i];
    Query queries[q];
    for(i=0;i<q;i++) { 
        cin >> x >> y;
        queries[i].l = x-1; 
        queries[i].r = y-1; 
        queries[i].idx = i;  
    }
    sort(queries, queries+q, cmp); 
    answeringQueries(a, n, queries, q); 
    return 0; 
} 


Measured memory_bytes: 17392
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <limits>

#define NON_NUM     'N'
#define INVALID_NUM 'I'

static void update(std::string* pStr, int s, int c) {
  std::string& str(*pStr);
  char cc = '0' + c;

  if (str.at(s - 1) == NON_NUM || str.at(s - 1) == cc) {
    str.at(s - 1) = cc;
  }
  else {
    str.at(s - 1) = INVALID_NUM;
  }
}

static bool fin(std::string* pStr) {
  std::string& str(*pStr);
  for (int i = 0; i < str.size(); i++) {
    if (str.at(i) == INVALID_NUM) {
      return false;
    }
    else {
      if (i == 0) {
        if (str.size() >= 2 && str.at(i) == '0') {
          return false;
        }
        else if (str.at(i) == NON_NUM) {
          if (str.size() >= 2) {
            str.at(i) = '1';
          }
          else {
            str.at(i) = '0';
          }
        }
      }
      else {
        if (str.at(i) == NON_NUM) {
          str.at(i) = '0';
        }
      }
    }
  }
  return true;
}

int main(void) {
  int n, m;
  std::cin >> n >> m;
  std::string nstr;
  for (int i = 0; i < n; i++) {
    nstr.push_back(NON_NUM);
  }

  for (int i = 0; i < m; i++) {
    int s, c;
    std::cin >> s >> c;
    update(&nstr, s, c);
  }
  bool ret = fin(&nstr);
  std::cout << (ret ? std::stoi(nstr) : -1) << std::endl;

  return 0;
}

Measured memory_bytes: 256
def resolve():
    s = input()
    if not kaibun(s) :
        print('No')
        return
    n = len(s)
    n1 = (n - 1) // 2
    if not kaibun(s[:n1]) :
        print('No')
        return
    n2 = (n + 3) // 2 - 1
    if not kaibun(s[n2:]) :
        print('No')
        return
    print('Yes')

def kaibun(str):
    return True if str == str[::-1] else False

resolve()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define DEBUG fprintf(stderr, "Passing [%s] line %d\n", __FUNCTION__, __LINE__)
#define File(x) freopen(x".in","r",stdin); freopen(x".out","w",stdout)

using namespace std;

typedef long long LL;
typedef pair <int, int> PII;
typedef pair <int, PII> PIII;

template <typename T>
inline T gi()
{
	T f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f * x;
}

const int INF = 0x3f3f3f3f, N = 100003, M = N << 1;

int n, a[N], b[N], c[N], t[N], tb[N], tc[N];

int main()
{
	//File("");
	n = gi <int> ();
	for (int i = 1; i <= n; i+=1)
	{
		a[i] = gi <int> ();
		++t[a[i]];
		if (i & 1) b[i / 2 + 1] = a[i], ++tb[a[i]];
		else c[i / 2] = a[i], ++tc[a[i]];
	}
	int mxb, mnb, mxc, mnc, mxidb, mxidc;
	mxb = mnb = mxc = mnc = mxidc = mxidb = 0;
	for (int i = 1; i <= 100000; i+=1)
	{
		if (tb[i] > mxb) mnb = mxb, mxb = tb[i], mxidb = i;
		else if (tb[i] > mnb) mnb = tb[i];
		if (tc[i] > mxc) mnc = mxc, mxc = tc[i], mxidc = i;
		else if (tc[i] > mnc) mnc = tc[i];
	}
	if (mxidc != mxidb) printf("%d\n", n - mxc - mxb);
	else printf("%d\n", min(n - mxc - mnb, n - mxb - mnc));
	return 0;
}


Measured memory_bytes: 5708
import java.util.Scanner

object Main {
  def main(args: Array[String]) {
    if (args.length > 0 && args(0) == "TEST") {
      println(test())
    } else {
      val input = io.Source.stdin.getLines().mkString("\n")
      println(solve(input).trim())
    }
  }

  def countMine(x:Int, y: Int, g:Vector[Vector[Char]]): Int = {
    val xMax = g.size
    val yMax = g(0).size
    var mineCount: Int = 0
    for (
      cx <- x - 1 to x + 1 if cx >= 0 && cx < xMax;
      cy <- y - 1 to y + 1 if cy >= 0 && cy < yMax && (cx, cy) != (x, y)
    ) {
      if (g(cx)(cy) == '#') mineCount = mineCount + 1
    }
    mineCount
  }

  def solve(input: String): String = {
    val s: Scanner = new Scanner(input)
    val h,w = s.nextInt
    val g:Vector[Vector[Char]] = Vector.fill(h)(s.next.toCharArray.toVector)
    val ans:Vector[Vector[String]] =
      Vector.tabulate(h, w){(y, x) => if (g(y)(x) == '#') "#" else countMine(y,x,g).toString}
    ans.map(_.mkString("")).mkString("\n")
  }

  val tests = List(
    """3 5
      |.....
      |.#.#.
      |.....
    """.stripMargin ->
      """
        |11211
        |1#2#1
        |11211
      """.stripMargin,
    """3 5
      |#####
      |#####
      |#####
    """.stripMargin ->
    """
      |#####
      |#####
      |#####
    """.stripMargin,
    """6 6
      |#####.
      |#.#.##
      |####.#
      |.#..#.
      |#.##..
      |#.#...
    """.stripMargin ->
    """
      |#####3
      |#8#7##
      |####5#
      |4#65#2
      |#5##21
      |#4#310
    """.stripMargin
  )

  def test(): String = tests.map { case (i, o) => (i.trim(), o.trim()) }
    .zipWithIndex.map {
    case ((input, outputExpect), i) =>
      val output = solve(input).trim()
      val tnum = i + 1
      s"test$tnum:" + (
        if (output == outputExpect) "Passed"
        else s"Failed\nexpect:\n$outputExpect\noutput:\n$output")
  }
    .mkString("\n")
}

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

int main(){
  int N;
  cin>>N;
  vector<int64_t> A(N);
  vector<int64_t> B(N);
  int64_t sum=0;
  for(int i=0;i<N;++i){
    cin>>A[i];
    if(i%2==0) sum += A[i];
    else sum -= A[i];
  }

  for(int i=0;i<N;++i){
    if(i==0){
      B[0]=sum;
      cout<<B[0]<<endl;
    }
    else{
     if(i<N-1){
      B[i]=2*A[i-1]-B[i-1];
      cout<<B[i]<<endl;
    }
     else{
       B[N-1]=2*A[N-1]-B[0];
       cout<<B[N-1]<<endl;
     }
    }
  }
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
#define ls  (n<<1)
#define rs  ((n<<1)|1)
using namespace std;

struct node{int l,r,x,y;};
int n,a[200010],b[200010],t[2][400010];
set <node> S;

bool operator < (node x,node y){return a[x.x]<a[y.x];}

void build(int op,int n,int l,int r)
{
	if (l==r)  t[op][n]=a[2*l-op];
	else
		{
			int mid=(l+r)>>1;
			build(op,ls,l,mid),build(op,rs,mid+1,r);
			t[op][n]=min(t[op][ls],t[op][rs]);
		}
}

int ask(int op,int n,int l,int r,int L,int R)
{
	if ((L<=l)&&(r<=R))  return t[op][n];
	else
		{
			int mid=(l+r)>>1;
			if (mid>=R)  return ask(op,ls,l,mid,L,R);
			if (L>mid)  return ask(op,rs,mid+1,r,L,R);
			return min(ask(op,ls,l,mid,L,R),ask(op,rs,mid+1,r,L,R));
		}
}

void doit(int l,int r)
{
	int x,y;
	if (l&1)
		{
			x=b[ask(1,1,1,n/2,l/2+1,r/2)],y=b[ask(0,1,1,n/2,x/2+1,r/2)];
		}else
		{
			x=b[ask(0,1,1,n/2,l/2,r/2)],y=b[ask(1,1,1,n/2,x/2+1,r/2+1)];
		}
	S.insert((node){l,r,x,y});
}

void work()
{
	scanf("%d",&n);
	for (int i=1; i<=n; i++)  scanf("%d",&a[i]),b[a[i]]=i;
	build(0,1,1,n/2),build(1,1,1,n/2);
	int x=b[ask(1,1,1,n/2,1,n/2)],y=b[ask(0,1,1,n/2,x/2+1,n/2)];
	S.insert((node){1,n,x,y});
	for (node p; S.size(); )
		{
			p=*S.begin(),S.erase(S.begin());
			printf("%d %d ",a[p.x],a[p.y]);
			if (p.l!=p.x)  doit(p.l,p.x-1);
			if (p.x+1!=p.y)  doit(p.x+1,p.y-1);
			if (p.y!=p.r)  doit(p.y+1,p.r);
		}
}

int main()
{
	work();
	return 0;
}


Measured memory_bytes: 8192
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int ll
#define mp make_pair
const int maxinput=100005;
int inf=1e9+7;
#define pii pair <int,int>
signed main()
{
    FAST
    string x,y;cin>>x>>y;
    vector <int> a[26];
    for(int i=0;i<x.length();i++)
        a[(x[i]-'a')].push_back(i);
    
    int n=x.length();
    int ans=0;
    int curr=0;
    for(int i=0;i<y.length();i++)
    {
        int k=int(y[i]-'a');
        if(a[k].size()==0)
        {
            cout<<-1<<endl;
            return(0);
        }
        int idx=lower_bound(a[k].begin(),a[k].end(),curr)-a[k].begin();
        if(idx==int(a[k].size()))
        {
            ans+=n+a[k][0]-curr+1;
            curr=(a[k][0]+1)%n;
        }
        else
        {
            ans+=(a[k][idx]-curr+1);
            curr=(a[k][idx]+1)%n;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1736
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}
template<class A,size_t N,class T>void Fill(A(&a)[N],const T&v){fill((T*)a,(T*)(a+N),v);}

const int MOD = 1e9+7; //998244353;

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m=MOD){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m=MOD){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
//V<ll>Fac,Rac;void setF(int n,int m=MOD){Fac=Rac=V<ll>(++n);Fac[0]=1;FOR(i,1,n)Fac[i]=Fac[i-1]*i%m;Rac[n-1]=modInv(Fac[n-1],m);FORR(i,n-1,1)Rac[i-1]=Rac[i]*i%m;}
//ll comb(int a,int b,int m=MOD){return a<b||b<0?0:Fac[a]*Rac[b]%m*Rac[a-b]%m;}

const int IINF = 1e9+6;
const ll LINF = 1e18;
const int N = 2e5;
int n, c[N];
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  FOR(_, 1, n){
    int a;
    cin >> a;
    c[--a]++;
  }
  FOR(i, 0, n) cout << c[i] << endl;
}

Measured memory_bytes: 4400
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "iomanip"
#include "random"

using namespace std;

const long long int MOD = 1000000007;
const long double EPS = 0.00000001;
const long double PI = 3.1415926535897932384626433;

long long int N, M, K, H, W, L, R;

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

	cin >> N;
	string s;
	cin >> s;
	s += "00";
	int ans = 0;
	for (int i = 0; i < N; i++) {
		if (s[i] == '1') {
			for (int j = i; j < N; j++) {
				if (s[j + 1] == s[j + 2] && s[j + 1] == '0') {
					int box = 0;
					vector<int>place;
					for (int k = i; k <= j; k++) {
						if (s[k] == '0') {
							box++;
							place.push_back(k);
						}
					}
					if (box == 0) {
						i = j + 1;
						break;
					}
					if (box == 1) {
						ans += max(j - place[0], place[0] - i);
						//	cout << ans << endl;
						i = j + 1;
						break;
					}
					vector<int>bf(box);
					vector<int>nx(box);
					bf[0] = place[0] - i;
					nx[0] = place[1] - place[0] - 1;
					for (int k = 1; k < box - 1; k++) {
						bf[k] = nx[k - 1];
						nx[k] = place[k + 1] - place[k] - 1;
					}
					bf[box - 1] = nx[box - 2];
					nx[box - 1] = j - place[box - 1];
					vector<vector<int>>dp(box, vector<int>(5, 0));
					if (nx[0] > 1) {
						dp[0][0] = bf[0];
					}
					else {
						dp[0][1] = bf[0];
					}
					dp[0][2] = nx[0];
					if (nx[0] > 1) {
						dp[0][3] = nx[0] - 1;
					}
					for (int k = 1; k < box; k++) {
						if (nx[k] > 1) {
							dp[k][0] = max({ dp[k - 1][0] - 1 + bf[k], dp[k - 1][4] + bf[k] ,dp[k - 1][3] + 1 });
						}
						else {
							dp[k][1] = max(max(dp[k - 1][0] - 1, dp[k - 1][4]) + bf[k], dp[k - 1][3] + 1);
						}
						dp[k][2] = max({ dp[k - 1][0],dp[k - 1][3],dp[k - 1][4] }) + nx[k];
						if (nx[k] > 1) {
							dp[k][3] = dp[k][2] - 1;
						}
						dp[k][4] = max({ dp[k - 1][0],dp[k - 1][1],dp[k - 1][2],dp[k - 1][3],dp[k - 1][4] });
					}
					ans += max({ dp[box - 1][0],dp[box - 1][1],dp[box - 1][2],dp[box - 1][3],dp[box - 1][4] });
					//	cout << ans << endl;
					i = j + 1;
					break;
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vii;
typedef vector<vi> vvi;
typedef vector<pll> vll;
typedef vector<vl> vvl;

#define fori(i, n) for (int i = 0; i < n; i++)
#define ford(i, n) for (int i = n - 1; i >= 0; i--)
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define repd(i, a, b) for (int i = a; i >= b; i--)
#define trav(x, a) for (auto &x : a)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define eb emplace_back
#define endl '\n'
#define sz(a) (int)(a).size()
#define fi first
#define se second

clock_t time_p = clock();
void time_taken()
{
    time_p = clock() - time_p;
    cerr << "Time Taken : " << (float)(time_p) / CLOCKS_PER_SEC << "\n";
}

const ll mod = 1e9 + 7;
const ll INF = 1e18;

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

    int n;
    cin >> n;
    string s;
    cin >> s;
    int r = 0, w = 0;
    for (char c : s)
        r += (c == 'R'), w += (c == 'W');
    int curr = 0, curw = 0;
    s += 'R';
    int ans = n;
    fori(i, n+1)
    {
        int cur = curw + max(r - curr - curw, 0);
        curr += (s[i] == 'R');
        curw += (s[i] == 'W');
        ans = min(ans, cur);
    }
    cout << ans << endl;

    time_taken();
    return 0;
}

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

int main() {
	while(1) {
		string s;
		cin >> s;
		if(cin.eof()) break;
		int a = 0, b= 0;
		for(int i=0;i<s.size();i++) {
			if(s[i]=='J' and s[i+1]=='O' and s[i+2]=='I') a++;
			if(s[i]=='I' and s[i+1]=='O' and s[i+2]=='I') b++;
		}
		cout << a << endl;
		cout << b << endl;
	}
}


Measured memory_bytes: 3152
#include <iostream>
#include <cstdio>
#include <string>
#define int long long
using namespace std;
const int maxn = 300000;
string s;
int n;
int consecutiveA[maxn+1];
main()
{
	ios_base::sync_with_stdio(0);
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	cin >> s;
	n = s.size();
	s=' '+s;
	int res = 0;
	consecutiveA[0] = 0;
	for (int i=1; i<=n; i++)
	{
		if (i>=3 and s[i-2]=='A' and s[i-1]=='B' and s[i]=='C')
		{
			//cout << i << ' ' << s[i] << '\n';
			res+=consecutiveA[i-2];
			consecutiveA[i]=consecutiveA[i-2];
			s[i]='A';
		}
		else
		if (s[i]!='A')
			consecutiveA[i]=0;
		else
			consecutiveA[i]=consecutiveA[i-1]+1;
		//cout << consecutiveA[i] << ' ';
	}
	
	cout << res;
	
	
	return 0;
}


Measured memory_bytes: 2128
#include<iostream>
#define int long long
using namespace std;
int n;
signed main(){
	int i,j;
	cin>>n;
	int ans=0;
	for(i=0;i<n;i++){
		int u,v;
		cin>>u>>v;
		v++;
		ans+=v-u;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
program prob44
    implicit none
    character(5) :: s
    integer :: i
    read(*,*) s
    do i = 1, 4
        if(s(i:i+1) == "AC") then
            write(*,*) "Yes"
            stop   
        end if
    end do
    write(*,*) "No"

    stop
contains
end program prob44

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

#define ll long long
#define ull long long unsigned
#define vii vector<int>
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pdd pair<double,double>
#define pldld pair<long long double, long long double>
#define ff first
#define ss second
#define pb push_back
#define read freopen("alu.txt","r",stdin);
#define write freopen("vorta.txt","w",stdout);
#define fastio ios::sync_with_stdio(false); cin.tie(NULL);
#define PI 2*acos(0.0)

const int MAX=100005, MOD=1000000007;
const ll inf=1e9;

int arr[MAX];
map<int,bool>mp;
int main(){

    fastio;
    int n;
    cin>>n;
    while(n--){
        int val;
        cin>>val;
        auto it=mp.find(val);
        if(it==mp.end()) mp.insert({val,true});
        else mp.erase(it);
    }
    cout<<mp.size()<<"\n";

}











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

using namespace std;

long long dp[101][100001];

struct predmet
{
    long long w;
    long long v;
};

bool acompare(predmet p1, predmet p2) {return p1.v < p2.v;}

predmet predmeti[101];

long long maxv = 100001;


int main()
{
    long long N, W;
    cin>>N>>W;

    for(int i = 0; i < N; i++)
    {
        cin>>predmeti[i].w>>predmeti[i].v;
    }

    sort(predmeti,predmeti+N,acompare);

    for(int i = 0; i < N; i++)
    {
        for(long long j = 1; j < maxv; j++)
        {
            long long uk_vrednost = j;
            long long tr_vrednost = predmeti[i].v;
            long long tr_tezina = predmeti[i].w;

            if(i == 0)
            {
                if(tr_vrednost == uk_vrednost) dp[i][j] = tr_tezina;
                else dp[i][j] = LONG_LONG_MAX;
            }
            else
            {
                if(uk_vrednost > tr_vrednost)
                {
                    if(dp[i-1][j-tr_vrednost]!= LONG_LONG_MAX) dp[i][j] = min(dp[i-1][j],dp[i-1][j-tr_vrednost]+tr_tezina);
                    else dp[i][j] = dp[i-1][j];
                }
                else
                {
                    if(uk_vrednost == tr_vrednost) dp[i][j] = min(dp[i-1][j],tr_tezina);
                    else dp[i][j] = dp[i-1][j];
                }
            }

        }
    }
/*
    for(int i = 0; i < N; i++)
    {
        for(int j = 1; j <= 29; j++)
        {
            cout << dp[i][j]<<" ";
        }
        cout<<endl;
    }
*/


    for(int i = maxv-1; i >= 0; i--)
    {
        long long pom = dp[N-1][i];

        if(pom <= W && pom > 0)
        {
            cout<< i;
            return 0;
        }
    }

    cout<<0;


    return 0;
}


Measured memory_bytes: 78336
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<iomanip>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

int main(){
  ll N; cin >> N;
  vector<ll> a(N); rep(i,N) cin >> a[i];
  ll Q; cin >> Q;
  vector<ll> b(Q); vector<ll> c(Q);
  rep(i,Q) cin >> b[i] >> c[i];

  ll ans = 0; rep(i,N) ans += a[i];
  map<ll ,ll> m;
  rep(i,N) m[a[i]]++;

  rep(i,Q){
    if(m[b[i]] > 0){
      // 変更あり
      ans += (c[i] - b[i]) * m[b[i]];
      m[c[i]] += m[b[i]];
      m[b[i]] = 0;
    }
    cout << ans << endl;
  }

}


Measured memory_bytes: 11204
a,b,k = map(int,input().split())
flag = True
for _ in range(k):
  if flag:
    flag = False
    if a%2==0:
      b += int(a/2)
      a = int(a/2)
    else:
      b += int((a-1)/2)
      a = int((a-1)/2)
  else:
    flag = True
    if b%2==0:
      a += int(b/2)
      b = int(b/2)
    else:
      a += int((b-1)/2)
      b = int((b-1)/2)
print(a,b)

Measured memory_bytes: 3064
#include<iostream>
 #include<string>
  
  using namespace std;
  
     int main(void){
      string b;
     int length = 0,h_length = 0;

     cin >> b;

      for(int i=0;i<=10;i++){
       if((b[i]=='A') || (b[i]=='T') || (b[i]=='G') || (b[i]=='C')){
            length = length + 1;
       }else{
          if(h_length <= length){
              h_length = length;
            }
          length = 0;
       }
 
       if(b[i] == '\0'){
          break;
       }
    }
 
 
   cout << h_length << endl;

   return 0;
  }


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, BinaryHeap};
#[allow(unused_imports)]
use std::iter::FromIterator;

mod util {
    use std::io::stdin;
    use std::str::FromStr;
    use std::fmt::Debug;

    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn get<T: FromStr>() -> T
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().parse().unwrap()
    }

    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }

    #[allow(dead_code)]
    pub fn get2<T: FromStr, U: FromStr>() -> (T, U)
    where
        <T as FromStr>::Err: Debug,
        <U as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
        )
    }

    #[allow(dead_code)]
    pub fn get3<S: FromStr, T: FromStr, U: FromStr>() -> (S, T, U)
    where
        <S as FromStr>::Err: Debug,
        <T as FromStr>::Err: Debug,
        <U as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
        )
    }
}

#[allow(unused_macros)]
macro_rules! debug {
    ($x: expr) => {
        println!("{}: {:?}", stringify!($x), $x)
    }
}

fn main() {
    let n: usize = util::get();
    let mut a: Vec<usize> = util::gets();
    let mut b: Vec<usize> = util::gets();
    let mut c: Vec<usize> = util::gets();

    a.sort();
    b.sort();
    c.sort();

    let mut ba = vec![0; n];
    let mut i = 0;
    for (k, &x) in b.iter().enumerate() {
        while i < n && a[i] < x {
            i += 1;
        }

        ba[k] = i;
    }

    let mut i = 0;
    let mut sum = 0;
    let mut ans = 0;
    for (k, &x) in c.iter().enumerate() {
        while i < n && b[i] < x {
            sum += ba[i];
            i += 1;
        }

        ans += sum;
    }

    println!("{}", ans);

}


Measured memory_bytes: 13560
s = input()
div = ["dream", "dreamer", "erase", "eraser"]
rev = []
t = ""
s_rev = s[::-1]
for d in div:
    rev.append(d[::-1])

result = True
i = 0
while i < len(s):
    can_divide = False
    for d in rev:
        if len(s_rev) - i >= len(d) and s_rev[i:i + len(d)] == d:
            can_divide = True
            i += len(d)
            break
    if not can_divide:
        result = False
        break

print("YES" if result else "NO")


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

int main(){
  int a,b;
  string day[]={"Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"};
  int months[] = {31,29,31,30,31,30,31,31,30,31,30,31};
  while(cin>>a>>b,a,b){
    a--;b--;
    // --a;--b;
    // cout << a<<b;
    rep(i,a) b+=months[i];
    // cout<<b<<endl;
    cout<<day[b%7]<<endl;
    // rep(i,a) b+=months[i];
  }
  return 0;
}



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


int main(){
    ll N;
    cin >> N;
    string ans = "";

    vector<ll> powers(12, 0);

    for(int i = 1; i < 12; i++){
        powers[i] = powers[i-1]+pow(26,i);
    }

    ll val = 0;
    ll p = 1;

    while(powers[p] < N) p++;

    ll k = N-powers[p-1];
   
    k--;

    vector<int> arr(p);
    for(int sks = p-1; sks >= 0; sks--){
        arr[sks] = k/pow(26,sks);
        k = k%(ll)pow(26,sks);
    }
    for(auto i : arr){
        ans = ((char)(i+'a'))+ans;
    }
    cout << ans << endl;

        
}

Measured memory_bytes: 4100
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int[] t=new int[N];
        int[] x=new int[N];
        int[] y=new int[N];
        for(int i=0;i<N;i++){
            t[i]=sc.nextInt();
            x[i]=sc.nextInt();
            y[i]=sc.nextInt();
        }
        int dx=0;
        int dy=0;
        int dt=0;
        for(int i=0;i<N;i++){
            if(i==0){
                dx=Math.abs(x[i]);
                dy=Math.abs(y[i]);
                dt=t[i];
                if(!(dx+dy<=dt && (((dx+dy)%2==0 && (dt%2)==0) || ((dx+dy)%2!=0 && (dt%2)!=0)))){
                    System.out.println("No");
                    System.exit(0);
                }
            }else{
                dx=Math.abs(x[i]-x[i-1]);
                dy=Math.abs(y[i]-y[i-1]);
                dt=t[i]-t[i-1];
                if(!(dx+dy<=dt && (((dx+dy)%2==0 && (dt%2)==0) || ((dx+dy)%2!=0 && (dt%2)!=0)))){
                    System.out.println("No");
                    System.exit(0);
                }
            }
        }
        System.out.println("Yes");
    }
}

Measured memory_bytes: 91048
#include<iostream>
#include<stdio.h>//printf("%.9f\n",*********);
#include<vector>//文字列.erase(n),vector
#include<algorithm>//next_permutation
#include<set>
#include<string>//char(小文字-32=大文字) to_string,string,char
#include<sstream>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>//min,max
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<locale>
#include<utility>//swap
#define rt "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)//start==1
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)//end==1
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define Yay(ans) if(ans)cout<<"Yay!"<<rt;else cout<<":("<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(s,n) rep(i,n)cin>>s[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())//標準=昇順
#define reve(s) reverse(s.begin(),s.end())//反転
#define str string
#define please return
#define AC 0
#define rapid_pleaseAC_fast cin.tie(0);ios::sync_with_stdio(false)
#define pi 3.1415926535897932384626//pi
#define nine 1000000000//10^9

using namespace std;
typedef vector<int> vint;
typedef long double ldouble;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef vector<double> vdouble;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

unsigned GetDigit(unsigned num) {
	return std::to_string(num).length();
}

int tow(int n) {//2のn乗
	if (n == 0)return 1;
	int x = tow(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;//@domino
}

int SED(int n) { //Sum of Each Digit
	int sum = 0;
	while (n > 0) {
		sum += n % 10; n /= 10;
	}
	return sum;
}

unsigned ND(unsigned num) {//Number of Digits
	return std::to_string(num).length();//outmax=10
}//stringのほうが効率よくないか？

/*

 (char)toupper(a[n])=文字列のn文字目を大文字で出力

  pow(a,b)=aのb乗

  */


int main(void) {
	rapid_pleaseAC_fast;

	int x;
	cin >> x;

	int cnt = 0;

	cnt += (x / 500)*1000;

	x -= (x/500) * 500;

	cnt += x / 5*5;

	cout << cnt << rt;

	please AC;
}

Measured memory_bytes: 256
import java.util.Scanner;

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




Measured memory_bytes: 26272
# 入力
import sys
stdin = sys.stdin

def li(): return [int(x) for x in stdin.readline().split()]
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return [float(x) for x in stdin.readline().split()]
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(ns())
def nf(): return float(ns())

n = ni()
a = li()

unique = set(a)
doub = len(a) - len(unique)

if doub % 2 == 0:
    print(len(unique))
else:
    print(len(unique) - 1)

Measured memory_bytes: 14628
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
def main():
  # 総和 S <= Ai * 4M のほうがやりやすいよ！
  n,m = map(int,input().split())
  a = list(map(int,input().split()))
  
  cnt = 0
  SUM = 0
  for i in range(n):
    SUM += a[i]
  for i in range(n):
    if a[i] * (4*m) >= SUM:
      cnt+=1
  if cnt >= m:
    print('Yes')
  else:
    print('No')
  
if __name__ == '__main__':
  main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
#define fb(i,a,b) for(int (i) = (a); (i) >= (b); --(i))
#define mod 998244353
#define xx first
#define yy second
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define ll long long
#define pii pair<int,int>


using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>,rb_tree_tag, tree_order_statistics_node_update> ordered_set;/// find_by_order(x)(x+1th) , order_of_key() (strictly less)
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());



int main()
{

    ios_base::sync_with_stdio(false); cin.tie(0);
    ll x,y;
    cin >> x >> y;
    if(x < y){
        cout << min(x, y-x) << endl;
        return 0;
    }
    x %= y;
    cout << min(x, y-x) << endl;
    return 0;
}


Measured memory_bytes: 256
program main
implicit none
character(len=1) :: c

read(*,*) c
if( c=='A')then
write(*,'(a1)') 'T'
else if ( c =='T')then
write(*,'(a1)') 'A'
else if ( c == 'C')then
write(*,'(a1)') 'G'
else if ( c == 'G')then
write(*,'(a1)') 'C'
end if


end program main


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
    class Class403
    {
        static char[][] pattern = new char[4][]
        {
            new char[2]{'S','S'},
            new char[2]{'S','W'},
            new char[2]{'W','S'},
            new char[2]{'W','W'}
        };
        static void Main()
        {
            int N = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            for (int j = 0; j < 4; j++)
            {
                char[] ans = new char[N + 2];
                ans[0] = pattern[j][0];
                ans[1] = pattern[j][1];

                for (int i = 1; i < N+1; i++)
                {
                    int num = i % N;

                    if (ans[i] == 'S')
                    {
                        if (s[num] == 'o') ans[i + 1] = ans[i - 1];
                        else ans[i + 1] = Swap(ans[i - 1]);
                    }
                    else
                    {
                        if (s[num] == 'o') ans[i + 1] = Swap(ans[i - 1]);
                        else ans[i + 1] = ans[i - 1];
                    }
                }

                if (ans[0] == ans[N] && ans[1] == ans[N + 1])
                {

                    Console.WriteLine(string.Join("", ans.Take(N)));
                    return;

                }
            }

            Console.WriteLine(-1);
            
        }
        static char Swap(char c)
        {
            if (c == 'S') return 'W';
            else return 'S';
        }
    }
}


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

int main(){
	//input = ツ禿シツ療債つウツづェツづゥツ妥個重
	double input;
	
	while(cin >>input){
		
		if(input == EOF) break;
		
		if(input <= 69.00){
			if(input <= 57.00){
				if(input <= 51.00){
					if(input <= 48.00){
						cout <<"light fly" <<endl;
					} else{
						cout <<"fly" <<endl;
					}
				} else{
					if(input <= 54.00){
						cout <<"bantam" <<endl;
					} else{
						cout <<"feather" <<endl;
					}
				}
			} else{
				if(input <= 64.00){
					if(input <= 60.00){
						cout <<"light" <<endl;
					} else{
						cout <<"light welter" <<endl;
					}
				} else{
					cout <<"welter" <<endl;
				}
			}
		} else{
			if(input <= 81.00){
				if(input <= 75.00){
					cout <<"light middle" <<endl;
				} else{
					cout <<"middle" <<endl;
				}
			} else{
				if(input > 91.00){
					cout <<"heavy" <<endl;
				} else{
					cout <<"light heavy" <<endl;
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 0
const input=require('fs').readFileSync('/dev/stdin', 'utf8').split(/[\s]/);const nin=()=>{const r = input[0];input.shift();return Number(r)};const nrin=(n)=>{const a:number[]=[];rep(n,()=>a.push(nin()));return a};const sin=()=>{const r = input[0];input.shift();return String(r)};const out=(...a)=>{console.log(...a)};const floor=(a)=>{return Math.floor(a)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const rep=(n, callback)=>{for(let i = 0;i < n; i++){callback()}};const strrep=(s, i, v)=>{return s.slice(0, i)+v+s.slice(i+1);};const permutation=({result=[],pre=[],post,n=post.length})=>{if(n>0){post.forEach((_,i)=>{const rest=[...post];const elem=rest.splice(i, 1);permutation({result, pre: [...pre,...elem],post:rest,n:n-1})})}else{result.push(pre)}return result};const sw=(s,a:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<a.length;i+=2){if(op==='=='){if(s==a[i])return a[i+1]}else if(op==='>='){if(s>=a[i])return a[i+1]}else if(op==='<='){if(s<=a[i])return a[i+1]}else if(op==='>'){if(s>a[i])return a[i+1]}else if(op==='<'){if(s<a[i])return a[i+1]}}return a[a.length-1];};const or=(a,...b)=>{for(let i=0;i<b.length;i++)if(a==b[i])return true;return false};const maxindex=(...a)=>{return a.indexOf(Math.max.apply(null,a))};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};const ceil=a=>{return Math.ceil(a)};const srin=s=>{const a:string[]=[];rep(s,()=>a.push(sin()));return a};let ssinteger=-1;const ssin=()=>{ssinteger++;return input[0][ssinteger]};
const main = ()=>{
  let a=sin()
  out(a[0]+a[1]+a[2]+'8'+a[4]+a[5]+a[6]+a[7]+a[8]+a[9])
}
main()


Measured memory_bytes: 7372
#include <cstdio>

const int MOD = 998244353;
const int INV2 = (MOD + 1) >> 1;

int add(int x, int y) {return (x + y >= MOD ? x + y - MOD : x + y);}
int sub(int x, int y) {return (x - y < 0 ? x - y + MOD : x - y);}
int mul(int x, int y) {return 1LL*x*y%MOD;}

int pow_mod(int b, int p) {
	int ret = 1;
	for(int i=p;i;i>>=1,b=mul(b,b))
		if( i & 1 ) ret = mul(ret,b);
	return ret;
}

struct node{
	int k, b;
	node() : k(0), b(0) {}
	node(int _k, int _b) : k(_k), b(_b) {}
	int get(int x) {return add(mul(k, x), b);}
	friend node operator + (node a, node b) {
		return node(add(a.k, b.k), add(a.b, b.b));
	}
	friend node operator - (node a, node b) {
		return node(sub(a.k, b.k), sub(a.b, b.b));
	}
	friend node operator * (node a, int k) {
		return node(mul(a.k, k), mul(a.b, k));
	}
	friend node operator / (node a, int k) {
		return a * pow_mod(k, MOD - 2);
	}
};

void fwt(node *A, int m, int type) {
	int n = (1 << m), f = (type == 1 ? 1 : INV2);
	for(int i=1;i<=m;i++) {
		int s = (1 << i), t = (s >> 1);
		for(int j=0;j<n;j+=s)
			for(int k=0;k<t;k++) {
				node x = A[j+k], y = A[j+k+t];
				A[j+k] = (x + y)*f, A[j+k+t] = (x - y)*f;
			}
	}
}

node A[1<<18], B[1<<18], C[1<<18], f[1<<18];

int main() {
	int N, M, S = 0; scanf("%d", &N), M = (1 << N);
	for(int i=0;i<M;i++) scanf("%d", &A[i].b), S = add(S, A[i].b);
	S = pow_mod(S, MOD - 2);
	for(int i=0;i<M;i++) A[i].b = sub(i == 0 ? 1 : 0, mul(A[i].b, S));
	for(int i=0;i<M;i++) B[i].b = 1;
	C[0].b = MOD - 1;
	fwt(A, N, 1), fwt(B, N, 1), fwt(C, N, 1);
	int tmp = mul(B[0].b, pow_mod(C[0].b, MOD-2));
	for(int i=1;i<M;i++)
		f[i] = (B[i] - C[i]*tmp) / A[i].b;
	f[0].k = 1; fwt(f, N, -1);
	int x = sub(0, mul(pow_mod(f[0].k, MOD-2), f[0].b));
	for(int i=0;i<M;i++) printf("%d\n", f[i].get(x));
}

Measured memory_bytes: 11272
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<utility>
#include<map>
#include<complex>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef vector<int> vec;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define stop char nyaa;cin>>nyaa;

//geometry
typedef long double ld;
typedef complex<ld> Point;
const ld pi = acos(-1.0);
ld dot(Point a, Point b) { return real(conj(a)*b); }
ld cross(Point a, Point b) { return imag(conj(a)*b); }

struct Line {
	Point a, b;
};

Point is_ll(Line s, Line t) {
	Point sv = s.b - s.a;
	Point tv = t.b - t.a;
	return s.a + sv * cross(tv, t.a - s.a) / cross(tv, sv);
}

void solve() {
	int n, k; cin >> n >> k;

	ld theta = 2 * pi / (ld)n;


	Point o = { 0,1 };
	Point a = Point{ cos(k*theta),-sin(k*theta) }*o;
	Line l1 = { o,a };
	Point p = Point{ cos(theta),-sin(theta) }*o;
	Point b = Point{ cos(k*theta),sin(k*theta) }*p;
	Line l2 = { p,b };
	Point c = is_ll(l1, l2);
	ld x = real(c);
	ld ans = x * n;
	cout << ans << endl;
}


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(10);
	solve();
	//stop
		return 0;
}



Measured memory_bytes: 3616
#include<iostream>

using namespace std;

int main() {
    int n, k;

    cin >>n >>k;

    if (k == 0) {
        cout << 1LL * n * n << endl;
    } else {
        long long ans = 0;
        for (int i = k + 1; i <= n; i++) {
            ans += (n / i) * (i - k);
            if (n % i >= k) {
                ans += n % i - k + 1;
            }
        }

        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main (){

int animals, total;

cin >> animals;
cin >> total;
string ans = "No";

for (int i = 0; i<=animals; i++){
    if(((i * 2) + ((animals - i) * 4)) == total){
        ans = "Yes";
        break;
    }
}

cout << ans;

    return 0;
}

Measured memory_bytes: 3640
#include<iostream>
#include<algorithm>
#include<string.h>
using namespace std;

int Sum10(int n);

int main()
{
    // 入力
    int n,k;
    cin >> n >> k;
    
    int x[n];
    for (int i=0;i<n;i++){
        cin >> x[i];
    }
    int ans=1000000000;
    for (int i=0;i+k-1<n;i++){
        if (x[i]<0 && x[i+k-1]<0){
            ans = min(ans,abs(x[i]));
        }else if (x[i]>=0 && x[i+k-1]>=0){
            ans = min(ans,abs(x[i+k-1]));
        }else{
            ans = min(ans,min(x[i+k-1]*2-x[i],x[i+k-1]-2*x[i]));
        }
    }
    cout << ans << endl;
    return 0;
}

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

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

using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fileio freopen("http://in.in", "r", stdin),freopen("out.out", "w", stdout);
#define ll long long
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pll pair<long long ,long long >
#define ppll pair < pll , pll >
#define sd(x1) scanf("%d",&x1)
#define sld(x1) scanf("%lld",&x1)
#define INF 1e18
#define eps 0.00001

#define le length
#define debug(n1) cout << n1 << endl
#define rep(j , n) for(ll i = j ; i <= n ; i++)
#define per(j , n) for(ll i = j ; i >= n ; i--)

int main() {
    SPEED;
 	ll t=1;
 	//cin>>t;
 	//ll arr[30];
 	//arr[0]=2;
 	while(t-->0){
		ll n,a;
		cin>>n;
		a=n/1000;
		ll ans=n-1000*a;
		if(ans==0)cout<<0<<endl;
		else{
		cout<<1000-ans<<endl;
}
	}
}
 		
 
 	
 	



 

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

const int N = 1e6 + 1;
const int mod = 1e9 + 7;

int p[3][N];

int main () {
	p[0][0] = p[1][0] = p[2][0] = 1;
	for (int i = 1; i < N; i ++) {
		p[0][i] = 1ll * p[0][i - 1] * 8 % mod;
		p[1][i] = 1ll * p[1][i - 1] * 9 % mod;
		p[2][i] = 1ll * p[2][i - 1] * 10 % mod;
	}
	int n;
	scanf("%d", &n);
	int ans = (0ll + p[2][n] - p[1][n] - p[1][n] + p[0][n] + 4ll * mod) % mod;
	printf("%d\n", ans);
}

Measured memory_bytes: 15540
n = int(input())
d_list = list(map(int, input().split()))
m = int(input())
t_list = list(map(int, input().split()))

sorted_d = sorted(d_list)
sorted_t = sorted(t_list)

d_index = 0
d_len = len(sorted_d)
for t in sorted_t:
    found = False
    for i in range(d_index, d_len):
        if t < sorted_d[i]:
            print('NO')
            exit()
        if t == sorted_d[i]:
            d_index = i+1
            found = True
            break
    if not found:
        print('NO')
        exit()

print('YES')



Measured memory_bytes: 127572