akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC144B
{
    class Program
    {
        public static void Main()
        {
            var n = int.Parse(Console.ReadLine());
            var ans = "No";

            for (int i = 1; i <= 9; i++) {
                if (n % i == 0) {
                    if (n / i < 10) {
                        ans = "Yes";
                        break;
                    }
                }
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13140
// ref: https://img.atcoder.jp/arc097/editorial.pdf

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;
using namespace std;

//---

template <typename T>
inline void print(const T& rhs){ std::cout<<" = "<<rhs<<std::endl; }
template <typename T>
inline void print(const std::vector<T>& rhs){
    std::cout<<" = [ ";
    for(uint i=0; i<rhs.size(); ++i){ std::cout<<rhs[i]<<' '; }
    std::cout<<"]"<<std::endl;
}
template <typename T>
inline void print(const std::vector<std::vector<T>>& rhs){
    std::cout<<" = "<<std::endl;
    std::cout<<"[[ ";
    for(uint p=0; p<rhs.size(); ++p){
        if(p!=0){ std::cout<<" [ "; }
        for(uint q=0; q<rhs[p].size(); ++q){
            std::cout<<rhs[p][q]<<' ';
        }
        if(p!=rhs.size()-1){ std::cout<<"]"<<std::endl; }
    }
    std::cout<<"]]"<<std::endl;
}
template <typename TL, typename TR>
inline void print(const std::vector<std::pair<TR,TL>>& rhs){
    std::cout<<" = [";
    uint i=0;
    for(; i<rhs.size()-1; ++i){ std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"], "; }
    std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"]]" << endl;
}
#define printn(var) {printf("%s", #var);print(var);}
#define printn_all(var) {printf("%s(%d): ", __func__, __LINE__);printf("%s", #var);print(var);}

//---

int main(){
    string s; cin >> s;
    uint K; cin >> K;
    
    vector<string> vS;
    for(uint b=0; b<s.size(); ++b){
        for(uint len=1; len<=K && b+len<=s.size(); ++len){
            vS.push_back( s.substr(b, len) );
        }
    }
    sort(vS.begin(), vS.end());
    unique(vS.begin(), vS.end());
    
    cout << vS[K-1] << endl;
    
    return 0;
}

Measured memory_bytes: 1660
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<vector>
#include<cstring>
#include<cmath>
#include<cstring>
#include<string>
#include<map>
#include<set>
#include<unordered_map>
#define db double
#define ui unsigned int
#define ll long long
#define ull unsiged ll
#define rep(i,l,r) for(int i=l;i<=r;i++)
#define per(i,r,l)for(int i=r;i>=l;i--)
#define boots ios::sync_with_stdio(0); cin.tie(0)
#define pb push_back
#define pp pop_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mod 1000000007
#define vii vector<int>
#define vll vector<ll>
#define vpp vector<pii>
#define inf  0x3f3f3f3f
#define lnf LLONG_MAX
#define mii map<int,int>
#define mll map<ll,ll>
#define mil map<int,ll>
#define umii unordered_map<char,int>
#define umll unordered_map<ll,ll>
#define umcc unordered_map<char,char>
#define si(n) scanf("%d",&n)
#define sl(n) scanf("%lld",&n)
#define pf(n) printf("%lld\n",n)
#define sz size()
using namespace std;
const db pi = 3.1415926535898;
const int MX = 5e6 + 7;
const int esp = 1e-6;
ll INV2, INV6;
ll modulo(ll num, ll MOD = mod) { return ((num%MOD) + MOD) % MOD; }
ll gcd(ll a, ll b) { return ((b == 0) ? a : gcd(b, a%b)); }
unordered_map<ui, ll>mp1, mp;
ll phi[MX];
int mu[MX];
char s[MX / 10];
vector<int> pri;
vector<bool> isp(MX, true);
int k;
ll qpow(ll a, ll b)
{
	ll ans = 1;
	while (b)
	{
		if (b & 1)
			ans = ans * a%mod;
		a = a * a%mod;
		b >>= 1;
	}
	return ans;
}
ll INV(ll n)
{
	return qpow(n, mod - 2);
}
ll get_sum(ll d)
{
	if (d == 1)return k - 1;
	return d * d%mod*(qpow(d, k )*INV(d) - 1) % mod*INV(d - 1) % mod;
}
ll get_sum2(int n)
{
	return n * (n + 1) % mod*(2 * n + 1) % mod*INV6%mod;
}
int main()
{
	boots;
	//int n, m;
	//cin >> n >> m;
	//cout << m / n + (m%n>0) << endl;
	string s ,s1;
	cin >> s >> s1;
	int n = 0;
	rep(i,0,2)
	{
		if (s[i] != s1[i])
			n++;
	}
	cout << 3-n << endl;
}

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

using namespace std;

int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = 0;

  for ( int i = 0; i < n; i++ ) {
    int cnt = 0;

    for ( char c = 'a'; c <= 'z'; c++ ) {
      bool left = false, right = false;
      
      for ( int j = 0; j < i; j++ ) {
        if ( s[j] == c ) left = true;
      }
      for ( int j = i; j < n; j++ ) {
        if ( s[j] == c ) right = true;
      }
      if ( left && right ) cnt++;
    }
    ans = max(ans, cnt);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
# import bisect
# from collections import Counter, deque
# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
# from operator import attrgetter, itemgetter
# import math

import sys

# import numpy as np

ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)

def main():
    r, g, b, n = list(map(int,ipti().split()))
    ans = 0
    r_max = n // r

    for rn in range(r_max+1):
        rem = n - r * rn
        g_max = rem // g
        for gn in range(g_max+1):
            rem2 = rem - g * gn
            if rem2 % b == 0:
                ans += 1

    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 39152
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.ascii;


void main()
{
  auto r = readln.chomp.to!int;
  if (r < 1200) {
    writeln("ABC");
  } else if (r < 2800) {
    writeln("ARC");
  } else {
    writeln("AGC");
  }
}


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

int main(){
  long long N;
  cin >> N;
  vector<long long> A(N);
  for(int i=0;i<N;i++) cin >> A[i];
  
  long long ans=0;
  for(int i=1;i<N;i++){
    if(A[i]<A[i-1]){
      ans += A[i-1] - A[i];
      A[i] = A[i-1];
    }
  }
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4836
/*input
6
30 10 60 10 60 50
*/
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define input(str) freopen(str,"r",stdin);
#define output(str) freopen(str,"w",stdout);
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<=n;i++)
#define REP(i,a,n) for(int i=a;i<n;i++)
#define speed ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define INF  3e16+1
#define FF first
#define SS second
#define mp make_pair
#define pb push_back
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld\n",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define modd 1000000007
#define len(x) x.size()
#define all(v) (v.begin(),v.end())
#define ll int
#define pi 3.1415926535897932384626
#define ld double
#define endl '\n'
const int N =6e5+5;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
int powmod(int base,int exp,int mod)
{
	int res=1LL;
	while(exp>0)
	{
		if(exp&1LL)
			res=(res*base)%mod;
		exp/=2LL;
		base=(base*base)%mod;
	}
	return res%mod;
}
int dp[N];
signed main()
{
	int n;
	cin>>n;
	int a[n+1];
	Rep(i,n)
	{
		cin>>a[i];
	}
	dp[1]=0;
	dp[2]=abs(a[2]-a[1]);
	for(int i=3;i<=n;i++)
	{
		dp[i]=min(dp[i-2]+abs(a[i]-a[i-2]),dp[i-1]+abs(a[i]-a[i-1]));
	}
	cout<<dp[n]<<endl;
	return 0;
}

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

int N,M;

int dfs(int i, int cnt,
    bitset<500> cur, vector<bitset<500>> &bs){
    if(N == i) return cur.count() == 0 ? cnt : 0;
    return max(dfs(i+1,cnt,cur,bs), dfs(i+1,cnt+1,cur^bs[i],bs));
}

int main(void){
    while(cin>>N>>M, N|M){
        vector<bitset<500>> bs(N);
        rep(i,N) cin>>bs[i];
        if(N <= 23){
            cout<<dfs(0,0,bitset<500>(""),bs)<<endl;
        }else{
            using P = pair<int,int>;
            vector<P> cur = {{0,0}};
            rep(i,N){
                vector<P> nxt;
                int bit = bs[i].to_ullong();
                for(P p : cur){
                    nxt.push_back(p);
                    int mask = p.first;
                    int cnt = p.second;
                    nxt.push_back({mask^bit, cnt+1});
                }
                sort(all(nxt),greater<P>());
                cur.clear();
                int n = nxt.size();
                cur.push_back(nxt[0]);
                rep(j,n-1){
                    if(nxt[j].first != nxt[j+1].first){
                        cur.push_back(nxt[j+1]);
                    }
                }
            }
            int res = 0;
            for(P p : cur){
                int mask = p.first;
                int cnt = p.second;
                if(mask == 0){
                    res = max(res,cnt);
                }
            }
            cout<<res<<endl;
        }
    }
    return 0;
}



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

int main()
{
	int n;
	cin >> n;
	vector<int> a(n);

	for (int i = 0; i < n; i++)
	{
		cin >> a.at(i);
	}
	sort(a.begin(), a.end());

	int ans = 0;
	for (int i = 0; i < n - 1; i++)
	{
		if (0 < a.at(i + 1) - a.at(i))
		{
			ans++;
		}
	}
	cout << ans + 1 << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		while(true){
			int n=sc.nextInt();
			int r=sc.nextInt();
			if(n==0&&r==0){
				break;
			}
			int[] cards=new int[n];
			for(int i=0;i<n;i++){
				cards[i]=n-i;
			}
			for(int i=0;i<r;i++){
				int p=sc.nextInt();
				int c=sc.nextInt();
				int[] tmp=new int[c];
				for(int j=0;j<c;j++){
					tmp[j]=cards[j+p-1];
				}
				for(int j=p+c-2;j>=c;j--){
					cards[j]=cards[j-c];
				}
				for(int j=0;j<c;j++){
					cards[j]=tmp[j];
				}
			}
			System.out.println(cards[0]);
		}
	}
}


Measured memory_bytes: 37052
h,w=map(int,input().split())
if h==1 or w==1:
    print(1)
elif w%2==0:
    print((w//2)*h)
elif h%2==0:
    print(w*(h//2))
else:
    ans=w*(h//2)+(w//2)+1
    print(int(ans))


Measured memory_bytes: 2940
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

int main()
{
    int h, w;
    cin >> h >> w;
    vector<vector<bool> > check(h+2, vector<bool>(w+2, true));
    for(int y=1; y<=h; ++y){
        for(int x=1; x<=w; ++x){
            char c;
            cin >> c;
            if(c == 'o'){
                for(int i=0; i<3; ++i)
                    check[y][x-1+i] = false;
            }
            else if(c == 'x'){
                for(int i=0; i<9; ++i)
                    check[y-1+i/3][x-1+i%3] = false;
            }
        }
    }

    int ans = 0;
    for(int y=2; y<=h; ++y){
        for(int x=1; x<=w; ++x){
            if(check[y][x])
                ++ ans;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3156
/*
 * selection sort
 *
 *
 */
#include<stdio.h>
int A[100];

//Output function
void printSequence(int length, int num){
    int i;
    for(i=0; i<length; i++){
        if(i!=0)printf(" ");
        printf("%d",A[i]);
    }

    printf("\n");
    printf("%d\n",num);

}

int main(void){
    int key=0, num=0, length, i, j, minj;

    scanf("%d", &length);
    for(i=0; i<length; i++){
        scanf("%d",&A[i]);
    }


    //Selection Sort Algo
    for(i=0; i<=length-2; i++){
        minj = i;
        for(j=i; j<=length-1; j++){
            if(A[j] < A[minj]){
                minj = j;
            }
        }

        if(minj != i){
            key = A[i];
            A[i] = A[minj];
            A[minj] = key;
            num++;

            // printSequence(length, num);
        }
    }

    printSequence(length, num);

    return 0;
}



Measured memory_bytes: 2124
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
int n;
string s, t;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> s>> t;
    int ans=s.size()+t.size();
    for(int i=1;i<=min(s.size(),t.size());i++){
        for(int j=0;j<i;j++){
            if(s[s.size()-i+j]!=t[j])
            break;
            if(j==i-1)
            ans=s.size()+t.size()-i;
        }
    }

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

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){
	string s;
	getline(cin,s);
	int a=s.size();
	for(int i=0;a>i;i++){
		if(s[i] >='A' && s[i] <= 'Z'){
			s[i]=s[i]+32;
		}
		else if(s[i] >='a' && s[i] <= 'z'){
			s[i]=s[i]-32;
		}
	}
	cout<<s<<endl;
}




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

namespace atcoder2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] gu = Console.ReadLine().Split(' ');
            int A = Convert.ToInt32(gu[0]);
            int B = Convert.ToInt32(gu[1]);
            if (A > B)
            {
                Console.WriteLine(A + (A - 1));
            }
            else if (B > A)
            {
                Console.WriteLine(B + (B -1));
            }
            else if (A == B)
            {
                Console.WriteLine(A + B);
            }
            else
            {

            }
            Console.Read();
        }
    }
}


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


vector<long long> nya;

map<long long,int> memo;
int dfs(long long n){
	if( memo.count(n) ) return memo[n];
	if( n == 1 ) return 0;
	if( (n & (n-1)) == 0 ){
		int ans = 0;
		long long m = n;
		while( m != 1) m /= 2, ans++;
		return ans;
	}
	int ans = -1e9;
	for(int i = 0 ; i < nya.size() ; i++){
		if( nya[i] != 2 && nya[i] != 8 && n % nya[i] == 0 ){
			ans = max(ans,dfs(n/nya[i])+1);
		}
	}
	return memo[n] = ans;
}
int main(){
	long long n;
	cin >> n;
	for(int l = 1 ; l <= 18 ; l++){
		for(int i = 0 ; i < (1<<l) ; i++){
			unsigned long long m = 0;
		
			for(int j = 0 ; j < l ; j++){
				m = m * 10 + (i>>j&1?8:2);
			}
			if( n % m == 0 ){
				nya.push_back(m);
			}
		}
	}
	sort(nya.begin(),nya.end());
	int ans = dfs(n);
	if( n == 1 || ans < 0 ){
		cout << -1 << endl;
	}else{
		cout << ans << endl;
	}
}

Measured memory_bytes: 3168
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,y,d;
    cin>>a>>b>>c;
    y = max(a,b);
    d = max(y,c);
   if(d==a)
   {
        if(d-b==c||d-c==b)
    {
        cout<<"Yes";}
         else
    {
        cout<<"No";
    }
    }

    else if(d==b)
   {
        if(d-a==c||d-c==b)
    {
        cout<<"Yes";}
        else
    {
        cout<<"No";
    }
    }
      else if(d==c)
   {
        if(d-a==b||d-b==a)
    {
        cout<<"Yes";}
        else
    {
        cout<<"No";
    }
    }


    return 0;
}


Measured memory_bytes: 256
from math import log

n, k = map(int, input().split())
a = list(map(int, input().split()))
b = []
c = 0.
for i in range(n):
    c += log(a[i])
    if i - k >= 0:
        c -= log(a[i - k])
    if i >= k - 1:
        b.append(c)
for i in range(len(b) - 1):
    print('Yes' if b[i] < b[i + 1] else 'No')

Measured memory_bytes: 102624
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

class Team
{
  public:
    Team(string& name, int win, int draw, int index);

    bool operator<(const Team& other) const;
    void Show();

  private:
    string m_name;
    int m_score;
    int m_index;
};

Team::Team(string& name, int win, int draw, int index) :
  m_name(name), m_index(index)
{
  m_score = win * 3 + draw * 1;
}

bool Team::operator<(const Team& other) const
{
  return m_score == other.m_score ? m_index > other.m_index : m_score < other.m_score;
}

void Team::Show()
{
  cout << m_name << "," << m_score << endl;
}

int main(void)
{
  bool flag = false;
  while (true)
  {
    int n;
    cin >> n;
    if ( n == 0 ) break;
    if (flag) cout << endl;
    flag = true;
    
    vector<Team> teams;
    for (int i = 0; i < n; ++i)
    {
      string name;
      int win, lose, draw;
      cin >> name >> win >> lose >> draw;
      Team buf_team(name, win, draw, i);
      teams.push_back(buf_team);
    }
    sort(teams.rbegin(), teams.rend());
    for (auto team : teams)
    {
      team.Show();
    }
  }
  return 0;
}

Measured memory_bytes: 1224
#include <stdio.h>
#define min(a,b) ((a>b)?b:a)

int sum(int x){
    int i;
    int d_sum = 0;
    for(i=0;i<=6;i++){
        d_sum += x % 10;
        x /= 10;
    }
    return d_sum;
}

int main()
{
    int n;
    scanf("%d", &n);
    int i;
    int min = 1000000;
    for(i=1;i<=n-1;i++){
        min = min(sum(i)+sum(n-i), min);
    }
    printf("%d", min);

    return 0;
}

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

int main() {
    int N; cin >> N;
    int a = 0;
    if(N%2==1) {
        a = (N+2)/2;
    } else {
        a = N/2;
    }
    float ans = (float)a/(float)N;
    cout << fixed << setprecision(10) << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int main()
{
    ll N;
    double D;
    cin >> N >> D;
    int ans = 0;
    REP(i,N){
        double X,Y;
        cin >> X >> Y;
        X = X*X;
        Y = Y*Y;
        if(sqrt(X+Y) <= D)ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3740
# ABC 115

def resolve():
    N, X = map(int, input().split())

    a, p = [1], [1]
    for i in range(N):
        a.append(a[i] * 2 + 3)
        p.append(p[i] * 2 + 1)

    def f(N, X):   # レベルNバーガーの下からX層に含まれるパティの総数
        if N == 0:
            return 0 if X <= 0 else 1
        elif X <= 1 + a[N-1]:    # 真ん中未満
            return f(N-1, X-1)
        else:
            return p[N-1] + 1 + f(N-1, X-2-a[N-1])

    print(f(N, X))

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

struct Value {
	int depth, cost;
	Value() { }
	Value(int depth, int cost) {
		this->depth = depth;
		this->cost = cost;
	}
};

int n, k;
int a[100000];
vector<int> et[100000];

Value dfs(int p, int v) {
	Value ret(0, 0);
	
	for (int i = 0; i < et[v].size(); i++) {
		int nv = et[v][i];
		if (nv == p) continue;
		Value res = dfs(v, nv);
		ret.depth = max(ret.depth, res.depth + 1);
		ret.cost += res.cost;
	}
	
	if (ret.depth == k - 1 && p != 0) {
		ret.depth = -1;
		ret.cost++;
	}
	return ret;
}

int main() {
	int i;
	
	cin >> n >> k;
	rep(i, n) {
		cin >> a[i]; a[i]--;
		if (i != 0) {
			et[a[i]].push_back(i);
		}
	}
	
	int ans = dfs(0, 0).cost;
	if (a[0] != 0) ans++;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 13952
#include <bits/stdc++.h>
#define rep(i,n) for(long long int i = 0; i < n; i++)
#define _rep(i,m,n) for(long long int i = m; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
const int N = 1000000;
const ll mod = 1000000007;
int digits(ll m){
    int count = 0;
    while (m > 0){
        m /= 10;
        count++;
    }
    return count;
}
int main() {
    ll n; cin >> n;
    int digits_sum = 0;
    int ans = INFINITY;
    for (ll i = 1; i <= sqrt(n); ++i) {
        ll j = n / i;
        if(i * j == n) {
            digits_sum = max(digits(i), digits(j));
            ans = min(ans, digits_sum);
        }
    }
    print(ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int N,L;
    cin >> N >> L;
    int ans=0;
    int m=INF;
    for(int i=L;i<=L+N-1;i++){
        ans+=i;
        m=min(m,abs(i));
    }
    if(L<0) cout << ans+m << endl;
    else cout << ans-m << endl;



}


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

int main() {

    char ccc[100];
    cin >> ccc;

    char aaa[] = "ABC";
    char bbb[] = "ARC";

    if (strcmp(ccc, aaa) == 0) {
        cout << bbb;
    } else if (strcmp(ccc, bbb) == 0) {
        cout << aaa;
    }

    return 0;
}

Measured memory_bytes: 3064
N = int(input())
C,S,F = [0]*(N-1),[0]*(N-1),[0]*(N-1)
for i in range(N-1):
    C[i],S[i],F[i] = map(int,input().split())
    
for i in range(N):
    t = 0
    for j in range(i,N-1):
        if t < S[j]:
            t = S[j]
        elif t%F[j] != 0:
            t = t - t%F[j] + F[j] 
            
        t = t + C[j]
    print(t)

Measured memory_bytes: 41708
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}

template <typename T>
vector<T> dijkstra(int s, vector<vector<pair<int, T>>> &G) {
    const T INF = numeric_limits<T>::max();
    using P = pair<T, int>;
    int n = G.size();
    vector<T> d(n, INF);
    vector<int> b(n, -1);
    priority_queue<P, vector<P>, greater<P>> q;
    d[s] = 0;
    q.emplace(d[s], s);
    while (!q.empty()) {
        P p = q.top();
        q.pop();
        int v = p.second;
        if (d[v] < p.first)
            continue;
        for (auto &e : G[v]) {
            int u = e.first;
            T c = e.second;
            if (d[u] > d[v] + c) {
                d[u] = d[v] + c;
                b[u] = v;
                q.emplace(d[u], u);
            }
        }
    }
    return d;
}

int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<pair<int, int>>> edge(n);
    for (int i = 0; i < m; ++i) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        edge[a].emplace_back(b, 1);
        edge[b].emplace_back(a, 1);
    }
    auto dist = dijkstra(0, edge);
    if (dist[n - 1] == 2)
        cout << "POSSIBLE"
             << "\n";
    else
        cout << "IMPOSSIBLE"
             << "\n";
    return 0;
}

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

int main() {

  int N, K;
  cin >> N >> K;

  vector<int> l(N);
  for (int i = 0; i < N; i++) {
    cin >> l[i];
  }

  sort(l.begin(), l.end());

  int answer = 0;

  for (int i = N - 1; N - K <= i; i--) {
    answer += l[i];
  }

  cout << answer << endl;

}

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

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

#define int                                       long long
#define lop(i,s,e)                                for(int i=s;i<(int)e;i++)
#define rlop(i,e,s)                               for(int i=e;i>=s;i--)
#define prvec(v)                                  lop(R15,0,v.size())cout << v[R15] <<" "; cout << endl;
#define prarr(arr,s1,e1)                          lop(R15,s1,e1)cout << arr[R15] << " "; cout << endl;

#define endl                                      '\n'
#define ff                                        first
#define ss                                        second
#define pii                                       pair<int,int>

#define pb                                        push_back
#define all(v)                                    v.begin(),v.end()

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

const int N = 3e6 + 7, M = 1000000007, inf = INT_MAX;
const long long INF = LLONG_MAX;

int n, Q;
int arr[N + 2];


void solve()
{
	cin >> n;
	int x = 0;
	lop(i, 0, n) cin >> arr[i], x = (x ^ arr[i]);

	int res[n];
	lop(i, 0, n) cout << (x ^ arr[i]) << " ";


}

int32_t main()
{
	ios_base::sync_with_stdio(0);   cin.tie(0);   cout.tie(0);

	int test = 1;
	// cin >> test;
	while (test--)solve();


}





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

int main(){
  int N, W; cin >> N >> W;
  vector<pair<long long, long long>> wv(N);
  for (int i=0; i<N; i++) cin >> wv[i].first >> wv[i].second;
  vector<vector<long long>> dp(N+1, vector<long long>(W+1,0));
  for (int i=1; i<=N; i++){
    for (int w=0; w<=W; w++){
      if (wv[i-1].first>w) dp[i][w] = dp[i-1][w];
      else dp[i][w] = max(dp[i-1][w], dp[i-1][w-wv[i-1].first] + wv[i-1].second);
    }
  }
  long long ans = 0;
  for (int w=0; w<=W; w++) ans = max(ans, dp[N][w]);
  cout << ans << endl;
}


Measured memory_bytes: 80256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
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 <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (int i = 0; i < sz(v); i++) {
        os << v[i];
        if (i < sz(v) - 1) os << " ";
    }
    return os;
}
int main() {
    int n;
    string s;
    cin >> n >> s;
    int cnt = 0;
    rep(i, n) cnt += s[i] - '0';
    map<int, int> x;
    for (int d = cnt - 1; d <= cnt + 1; d++) {
        if (d == 0) continue;
        rep(i, n) {
            x[d] <<= 1;
            x[d] += s[i] - '0';
            x[d] %= d;
        }
    }

    map<int, vector<int>> mp;
    for (int d = cnt - 1; d <= cnt + 1; d++) {
        mp[d].resize(n);
        if (d == 0) continue;
        int k = 1;
        rep(i, n) {
            mp[d][i] = k;
            k <<= 1;
            k %= d;
        }
    }

    rep(i, n) {
        if (s[i] == '0') {
            int xx = (x[cnt + 1] + mp[cnt + 1][n - 1 - i]) % (cnt + 1);
            int ans = 1;
            while (xx) {
                xx %= __builtin_popcount(xx);
                ans++;
            }
            cout << ans << endl;
        } else {
            if (cnt == 1) {
                cout << 0 << endl;
                continue;
            }
            int xx =
                (x[cnt - 1] - mp[cnt - 1][n - 1 - i] + cnt - 1) % (cnt - 1);
            int ans = 1;
            while (xx) {
                xx %= __builtin_popcount(xx);
                ans++;
            }
            cout << ans << endl;
        }
    }
}

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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 29)
#define MOD 1000000007
//int dy[4] = {-1,0,0,1};
//int dx[4] = {0,1,-1,0};



int main(){
  
  int n,x,y;
  cin >> n >> x >> y;
  vector<vector<int>> v(n);
  vector<int> res(n);
  REP(i,n-1){
    v[i].push_back(i+1);
    v[i+1].push_back(i);
  }
  v[x-1].push_back(y-1);
  v[y-1].push_back(x-1);
  for(int i = 0;i < n;i++){
    queue<int> que;
    que.push(i);
    int dist[n];
    FILL(dist,n,-1);
    dist[i] = 0;
    while(!que.empty()){
      int ov = que.front();que.pop();
      for(auto nv : v[ov]){
        if(dist[nv] != -1)continue;
        dist[nv] = dist[ov]+1;
        res[dist[nv]-1]++;
        que.push(nv);
      }
    }
  }
  REP(i,n-1)cout << res[i]/2 << endl;
  



  return 0;
}


Measured memory_bytes: 384
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static readonly long Mod = 1000000000 + 7;

        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var N = ReadLine()[0];
            var ai = Sarray();
            WriteLine(ai.Sum() - ai.Count());
            //Out.Flush();
        }
    }
}

Measured memory_bytes: 13396
MOD = int(1e9)+7
def main():
    n, k = map(int, input().split())
    n += 1
    a = [int(i) for i in range(n)]
    s = [0]
    for i in range(n):
        s.append(s[i]+a[i])

    ans = 0 
    for i in range(k, n+1):
        ans += s[n]-s[n-i]-s[i]+1
        ans %= MOD
    print(ans%MOD)
main()

Measured memory_bytes: 27184
def solve(S, T):
    for i in range(len(S) - len(T), -1, -1):
        ok = True
        for j in range(len(T)):
            if not (S[i + j] == "?" or S[i + j] == T[j]):
                ok = False
        if ok:
            return S[:i].replace("?", "a") + T + S[i + len(T) :].replace("?", "a")

    return "UNRESTORABLE"


S = input()
T = input()
print(solve(S, T))


Measured memory_bytes: 3060
import sys

if sys.argv[-1] == "ONLINE_JUDGE":
    from numba.pycc import CC
    cc = CC("solve")

    @cc.export('solve', 'i8(i8)')
    def f(k):
        a = 7 % k
        for i in range(k):
            if a == 0:
                return i + 1
            a = (a * 10 + 7) % k
        else:
            return -1
    cc.compile()
    exit(0)

from solve import solve
print(solve(int(input())))

Measured memory_bytes: 27488
#include<algorithm>
#include<iostream>
#include<cstring>
#include<iomanip>
#include<sstream>
#include<cstdio>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<cmath>
#include<stack>
#include<set>
#include<map>
#define rep(i,x,n) for(int i=x;i<=n;i++)
#define per(i,n,x) for(int i=n;i>=x;i--)
#define sz(a) int(a.size())
#define rson mid+1,r,p<<1|1
#define pii pair<int,int>
#define lson l,mid,p<<1
#define ll long long
#define pb push_back
#define mp make_pair
#define se second
#define fi first
using namespace std;
const double eps=1e-8;
const int mod=1e9+7;
const int N=1e5+10;
const int inf=1e9;
string s,t;
int main(){
	//ios::sync_with_stdio(false);
	//freopen("in","r",stdin);
	cin>>s>>t;
	int n=s.size();
	int ans=0;
	rep(i,0,n-1) if(s[i]!=t[i]) ans++;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3844
N = int(input())

ans = N
for A in range(1,N):
    B = N - A
    A_str = str(A)
    B_str = str(B)
    A_li = [int(A_str[i]) for i in range(len(A_str))]
    B_li = [int(B_str[i]) for i in range(len(B_str))]
    s = sum(A_li) + sum(B_li)
    if s < ans:
        ans = s

print(ans)

Measured memory_bytes: 3064
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		int C = Integer.parseInt(sc.next());
		int X = Integer.parseInt(sc.next());
		int Y = Integer.parseInt(sc.next());
		sc.close();
 
		int cost = Integer.MAX_VALUE;
		//全探索
		for(int i = 0; i <= Math.pow(10, 5); i++) {
			int tmpCost = i * 2 * C + Math.max(0, X - i) * A + Math.max(0, Y - i) * B;
			if(tmpCost < cost) cost = tmpCost;
		}
 
		System.out.println(cost);
	}
 
}

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

using namespace std;
using   ll=long long;

#define fast            ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

#define endl            "\n"
#define pb              push_back
#define mp              make_pair
#define F               first
#define S               second
#define int             long long int
#define pll                pair<int , int>

#define ALL(v)          v.begin(),v.end()
#define ALLR(v)         v.rbegin(),v.rend()
#define pii             3.14159265358979323
#define inf             LLONG_MAX
#define ones(x)         __builtin_popcount(x)
#define fill(a,b)       memset(a,b,sizeof(a))
#define mod             1000000007
#define hell            998244353 

ll mod_pow(ll a,ll b,ll m) 
{
    ll res = 1;
    while(b)    
    {
        if(b&1)     
        {
            res=(res*a) % m;
        }
        a=(a*a) % m;
        b>>=1;
    }
    return res;
}

ll mod_inverse(ll a) 
{
    return mod_pow(a , mod-2 , mod);
}

void solve() 
{
	int x;
	
	cin >> x;
	
	if(x >= 30) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
}

signed main() {
    fast;
    
    int t = 1;
    
    //cin >> t;
    
    while(t--) {
        solve();
    }
 
    return 0;
}


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

using namespace std;

#define pb push_back

#define ll long long int

#define max 1000000

int main(){
    
    int n, k;
    cin>>n>>k;
    vector<int> v;
    for(int i=0; i<n; i++){
        int num;
        cin>>num;
        v.pb(num);
    }
    int ans=0;
    sort(v.begin(), v.end());
    
    for(int i=0; i<k; i++){
        ans+=v[i];
    }
    cout<<ans;
    
    return 0;
}

Measured memory_bytes: 3624
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_D main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif


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

    ll N, W; cin >> N >> W;
    vl w(N+1,0); vl v(N+1,0);
    FOR(i,1,N+1) cin >> w[i] >> v[i];

    ll WMIN = LINF;
    FOR(i,1,N+1) WMIN = min(WMIN, w[i]);    

    vi r(N+1,0);
    FOR(i,1,N + 1) r[i] = w[i] - WMIN;

    vi rs(N+1, 0);
    FOR(i,1,N + 1) rs[i] = rs[i - 1] + r[i];

    const ll RMAX = 300;
    vvl dp(N+MGN, vl(RMAX+MGN, 0));
    // dp[j][k] := max value when taking j items from {s1,s2,...,si} with r-weight le k 

    FOR(i,0,N+1) {
        for(int j=i; j>=0; j--) {
            for (int k = rs[i]; k >= 0; k--) {
                assert(k + r[i] < dp[0].size());
                dp[j+1][k+r[i]] = max(dp[j+1][k+r[i]], dp[j][k]+v[i]);
            }
        }
    }

    ll ans = 0;
    FOR(i,0,N+1) {
        FOR(j,0,rs[N]+1) {
            ll w = WMIN * i + j;
            if (w <= W){
                assert(j < dp[0].size());
                ans = max(ans, dp[i][j]);
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const int INF=INT_MAX,MOD=1e9+7;

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


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
const long long MOD = 1e9 + 7;

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

int main() {
    int N;
    string S;
    cin >> N >> S;
    int ans = 0;

    rep(i, 1000) {
        string l;
        if(i < 10)
            l += "00";
        else if(i < 100)
            l += "0";
        l += to_string(i);
        int f = 0;
        for(auto j : S) {
            if(l[f] == j) f++;
            if(f == 3) {
                ans++;
                break;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3748
#include<stdio.h>
int main(void)
{
	int i,j,k,d,S[6],T[6],C[6];
	int Dice[6][6]={{1,2,3,5,4,6},
					{2,6,3,1,4,5},
					{3,6,5,1,2,4},
					{4,6,2,1,5,3},
					{5,6,4,1,3,2},
					{6,5,3,2,4,1}};
	for(i=0;i<6;i++){scanf("%d",&S[i]);}
	for(i=0;i<6;i++){scanf("%d",&T[i]);}
	for(i=0;i<6;i++)
	{
		for(j=0;j<4;j++)
		{
			for(k=0;k<4;k++){C[k+1]=T[Dice[i][(j+k)%4+1]-1];}
			C[0]=T[Dice[i][0]-1];C[5]=T[Dice[i][5]-1];
			for(d=0,k=0;k<6;k++)
			{
				if(S[Dice[0][k]-1]==C[k])d+=1;
			}
			if(d==6)break;
		}
		if(d==6)break;
	}
	if(d==6){printf("Yes\n");}
	else{printf("No\n");}
	return 0;
}

Measured memory_bytes: 580
#include<bits/stdc++.h>
using namespace std;
template<typename T>
void read(T &x)
{
	char ch=getchar();
	for (x=0;ch<'0'||ch>'9';ch=getchar());
	for (;ch>='0'&&ch<='9';x=x*10+ch-'0',ch=getchar());
}
#define INF 0x3f3f3f3f
vector<int> odd,even;
bool vis[10000010];
int prime[1000010],p_cnt;
int n;
int a[110];
namespace Network
{
	struct edge{
		int s,t,cap,next;
	}e[100010];
	int head[510],cnt;
	void addedge(int s,int t,int cap)
	{
		e[cnt].s=s;e[cnt].t=t;e[cnt].cap=cap;e[cnt].next=head[s];head[s]=cnt++;
		e[cnt].s=t;e[cnt].t=s;e[cnt].cap=0;e[cnt].next=head[t];head[t]=cnt++;
	}
	queue<int> q;
	int s,t;
	int dis[510]; 
	bool bfs()
	{
		q.push(s);
		memset(dis,0x3f,sizeof(dis));
		dis[s]=0;
		while (!q.empty())
		{
			int tmp=q.front();
			q.pop();
			for (int i=head[tmp];i!=-1;i=e[i].next)
				if (e[i].cap && dis[e[i].t]==INF)
				{
					dis[e[i].t]=dis[tmp]+1;
					q.push(e[i].t);
				}
		}
		return dis[t]!=INF;
	}
	int find(int x,int low)
	{
	    if (x==t)
	        return low;
	    int used=0;
	    for (int i=head[x];i!=-1;i=e[i].next)
	        if (e[i].cap>0 && dis[e[i].t]==dis[x]+1)
	        {
	            int flow=find(e[i].t,min(low-used,e[i].cap));
                e[i].cap-=flow;
                e[i^1].cap+=flow;
                used+=flow;
                if (used==low)
                    return low;
	        }
	    if (!used)
	        dis[x]=-1;
	    return used;
	}
	int dinic()
	{
		memset(head,0xff,sizeof(head));
		cnt=0;
		s=0,t=odd.size()+even.size()+1;
		for (int i=0;i<odd.size();i++)
			addedge(s,i+1,1);
		for (int i=0;i<even.size();i++)
			addedge(odd.size()+i+1,t,1);
		for (int i=0;i<odd.size();i++)
			for (int j=0;j<even.size();j++)
				if (!vis[abs(odd[i]-even[j])])
					addedge(i+1,odd.size()+j+1,1);
	    int ans=0;
	    while (bfs())
	        ans+=find(s,INF);
	    return ans;
	}
}
void ins(int x)
{
	if (x&1)
		odd.push_back(x);
	else
		even.push_back(x);
}
void pre()
{
	vis[1]=1; 
    for (int i=2;i<=10000000;i++)
    {
        if (!vis[i])
            prime[++p_cnt]=i;
        for (int j=1;j<=p_cnt&&i*prime[j]<=10000000;j++)
        {
            vis[i*prime[j]]=1;
            if (i%prime[j]==0)
                break;
        }
    }
}
int main()
{
	read(n);
	for (int i=1;i<=n;i++)
		read(a[i]);
	sort(a+1,a+n+1);
	a[0]=-1;
	for (int i=1;i<=n;i++)
	{
		if (a[i-1]!=a[i]-1)
			ins(a[i]);
		if (a[i+1]!=a[i]+1)
			ins(a[i]+1);
	}
	pre();
	int k=Network::dinic();
	printf("%d\n",k+2*((odd.size()-k)/2+(even.size()-k)/2)+3*((odd.size()-k)%2));
	return 0;
}

Measured memory_bytes: 14080
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
#include <climits>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)


int main(){
	int n;
    cin >> n;
    
    switch(n%10){
        case 2:
        case 4:
        case 5:
        case 7:
        case 9:
            cout << "hon\n";
            break;
        case 0:
        case 1:
        case 6:
        case 8:
            cout<< "pon\n";
            break;
        case 3:
            cout << "bon\n";
            break;
    }
	
	return 0;
}

Measured memory_bytes: 3596
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    int n;
    cin >> n;
    ll d[n];
    REP(i,n)cin >> d[i];
    ll answer = 0;
    REP(i,n){
        REP(j,n){
            if(i != j){
                answer += d[i]*d[j];
            }
        }
    }
    cout << answer/2 << endl;
    return 0;
}

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

int main(){

 string s,t;
 cin>>s;
 cin>>t;
 
  
 int N=s.length();
 
 for(int i=0;i<N;i++){

   if(s[i]!=t[i]){cout<<"No"<<endl;return 0;}
   
 }
 
 if(t.length()==N+1){cout<<"Yes"<<endl;return 0;}
 cout<<"No"<<endl;

}


Measured memory_bytes: 3628
x=int(input())

if 400<=x and x<=599:
    print(8)
elif 600<=x and x<=799:
    print(7)
elif 800<=x and x<=999:
    print(6)
elif 1000<=x and x<=1199:
    print(5)
elif 1200<=x and x<=1399:
    print(4)
elif 1400<=x and x<=1599:
    print(3)
elif 1600<=x and x<=1799:
    print(2)
elif 1800<=x and x<=1999:
    print(1)    

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

template <class T>
class LazySegmentTree{
private:
    int n;
    vector<T> dat, lazy;
    vector<bool> flag;
    T def;

    void _eval(int k, int l, int r){
        if(flag[k]){
            dat[k] = (r-l) * lazy[k];
            if(1<r-l){
                lazy[2*k+1] = lazy[k];
                lazy[2*k+2] = lazy[k];
                flag[2*k+1] = true;
                flag[2*k+2] = true;
            }
            flag[k] = false;
        }
    }

    T _query(int a, int b, int k, int l, int r){
        // [a, b), [l, r)
        if(r<=a or b<=l) return def;
        _eval(k, l, r);
        if(a<=l and r<=b) return dat[k];
        else{
            T c1 = _query(a, b, 2*k+1, l, (l+r)/2);
            T c2 = _query(a, b, 2*k+2, (l+r)/2, r);
            return c1 + c2;
        }
    }

    void _change(int a, int b, T x, int k, int l, int r){
        _eval(k, l, r);
        if(b<=l or r<=a) return;
        else if(a<=l and r<=b){
            lazy[k] = x;
            flag[k] = true;
            _eval(k, l, r);
        } else {
            _change(a, b, x, 2*k+1, l, (l+r)/2);
            _change(a, b, x, 2*k+2, (l+r)/2, r);
            dat[k] = dat[2*k+1] + dat[2*k+2];
        }
    }

    int _find(T x, int k, int l, int r){
        if(r-l==1) return k - n + 1;
        _eval(2*k+1, l, (l+r)/2);
        _eval(k, 2*k+2, (l+r)/2, r);
        if(dat[2*k+1]>=x) return _find(x, 2*k+1, l, (l+r)/2);
        else return _find(x, 2*k+2, (l+r)/2, r);
    }

public:
    // [a, b)
    T query(int a, int b){
        return _query(a, b, 0, 0, n);
    }

    void change(int a, int b, T x){
        _change(a, b, x, 0, 0, n);
    }

    int find(T x){
        _eval(0, 0, n);
        if(dat[0]<x) return -1;
        return _find(x, 0, 0, n);
    }

    T operator[](int i){
        return dat[i+n-1];
    }

    LazySegmentTree(size_t _n, T _def)
            : def(_def){
        n = 1;
        while(n < _n){
            n *= 2;
        }
        dat.assign(2*n-1, def);
        flag.assign(2*n-1, false);
        lazy.resize(2*n-1);
    }

    LazySegmentTree(size_t _n, T _def, vector<T>& _v)
            : def(_def){
        n = 1;
        while(n < _n){
            n *= 2;
        }
        dat.assign(2*n-1, def);
        flag.assign(2*n-1, false);
        lazy.resize(2*n-1);
        for(int i=0;i<_n;++i) dat[n-1+i] = _v[i];
        for(int i=n-2;0<=i;--i) dat[i] = dat[2*i+1] + dat[2*i+2];
    }
};

class Task{
public:
    void solve(istream& in, ostream& out){
        int N, tt;
        in>>N>>tt;
        LazySegmentTree<int> ldat(N, 0);
        while(tt--){
            int t;
            in>>t;
            if(t){
                int l, r;
                in>>l>>r;
                out<<ldat.query(l, r+1)<<'\n';
            }else{
                int l, r, x;
                in>>l>>r>>x;
                ldat.change(l, r+1, x);
            }
        }
    }
};

int main(){
    Task solver;
    istream& in(cin);
    ostream& out(cout);
    ios::sync_with_stdio(false);
    in.tie(nullptr), out.tie(nullptr);
    solver.solve(in, out);
    return 0;
}



Measured memory_bytes: 5160
#include <bits/stdc++.h>
using namespace std;
const int N = 305;
int n, m, d[N][N], f[N][N];
int main()
{
	ios::sync_with_stdio(false);
	cin >> n >> m;
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++)
			cin >> d[i][j];
	for(int x = 1; x <= n; x++)
		for(int y = 1; y <= m; y++)
			for(int i = 0; i <= 100; i++)
				for(int j = 0; j <= 100; j++)
					f[i][j] = max(f[i][j], d[x][y] - i * x - j * y);
	for(int x = 1; x <= n; x++)
		for(int y = 1; y <= m; y++)
		{
			int dist = INT_MAX;
			for(int i = 0; i <= 100; i++)
				for(int j = 0; j <= 100; j++)
					dist = min(dist, f[i][j] + i * x + j * y);
			if(d[x][y] != dist) return (cout << "Impossible" << endl) && 0; 
		}
	cout << "Possible" << endl;
	cout << "202 10401" << endl;
	for(int i = 1; i < 101; i++) cout << i << ' ' << i + 1 << ' ' << 'X' << endl;
	for(int i = 102; i < 202; i++) cout << i << ' ' << i + 1 << ' ' << 'Y' << endl;
	for(int i = 0; i <= 100; i++)
		for(int j = 0; j <= 100; j++)
			cout << i + 1 << ' ' << 202 - j << ' ' << f[i][j] << endl;
	cout << "1 202" << endl;
	return 0;
}

Measured memory_bytes: 512