akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MAX 500009
#define MOD 1000000007
#define INF 1000000000000000000

int main(){
  int N,K;
  cin>>N>>K;
  vector<int> P(N);
  for(int i=0;i<N;i++){
    cin>>P.at(i);
  }

  int ans=1;
  set<int> s;
  for(int i=0;i<K;i++){
    s.insert(P.at(i));
  }
  for(int i=K;i<N;i++){
    int m=*s.begin();
    s.erase(P.at(i-K));
    s.insert(P.at(i));
    int M=*s.rbegin();
    if(m==P.at(i-K)&&M==P.at(i)){
      continue;
    }else{
      ans++;
    }
  }

  int same=0;
  int count=1;
  for(int i=1;i<N;i++){
    if(P.at(i-1)<P.at(i)){
      count++;
    }else{
      if(count-K>=0){
        same++;
      }
      count=1;
    }
  }
  if(count-K>=0){
    same++;
  }
  ans-=max(same-1,0);

  cout<<ans<<endl;
}


Measured memory_bytes: 10368
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>
#include <queue>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
	#define DBG(X) cout << #X << "=" << (X) << '\n';
	#define SAY(X) cout << (X) << '\n';
#else
	#define DBG(X)
	#define SAY(X)
#endif
 
using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld  = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF  = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for(auto el: v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for(auto& elem: ret) cin >> elem; return ret; }

void solve() {
	ll n = fetch<ll>();
	ll answ = LL_INF;

	for(ll i = 1; i * i <= n; ++i) {
		if(n % i == 0) {
			answ = min(answ, i + n / i);
		}
	}

	cout << answ - 2 << '\n';
}

int main() {
	fast_io();
	solve();

	return 0;
}


Measured memory_bytes: 380
#include <bits/stdc++.h>
using namespace std;
const int N = 110 , mz = 1e9+7;

bool ck(int x){
    return (x/10000) == x%10 && ((x/1000)%10) == ((x/10)%10);
}

int main(){
    int a,b;
    cin>>a>>b;
    int ans = 0;
    for(int i = a ; i <= b ; i++)
        if( ck(i) ) ans++;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.split('\n');
var n = lines[0];

var A = lines[1].split(' ').map(function(i) {
	return i - 0;
});

var cnt = 0;
for (var i = 0; i < n; i++) {
	var min = i;
	for (var j = i; j < n; j++) {
		if (A[j] < A[min])
			min = j;
	}

	if (min == i)
		continue;

	var tmp = A[i];
	A[i] = A[min];
	A[min] = tmp;
	cnt++;
}  

console.log(A.join(' '));
console.log(cnt);

Measured memory_bytes: 7644
S = input()

odd_letter = {'R', 'U', 'D'}
even_letter = {'L', 'U', 'D'}
odds = S[0::2]
evens = S[1::2]

if set(odds) <= odd_letter and set(evens) <= even_letter:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

internal class Program {
    static void Main() => CustomMain();

    static void Solve() {
        int a, b, c;
        ReadMulti(out a, out b, out c);

        string ans = "NO";
        if (b - a == c - b) ans = "YES";

        WriteAnswer(ans);
    }


    static void CustomMain() {
#if DEBUG
        // ファイルからテストケースを読み込む
        ChangeStdIn();
        // 時間計測
        var stopwatch = new Stopwatch();
        stopwatch.Start();
#endif
        // 出力高速化
        var streamWriter = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(streamWriter);
        // 回答
        Solve();
#if DEBUG
        stopwatch.Stop();
        Console.WriteLine(stopwatch.Elapsed);
#endif
        Console.Out.Flush();
    }

    static string ReadString() => Console.ReadLine().Trim();
    static int ReadInt() => int.Parse(ReadString());
    static long ReadLong() => long.Parse(ReadString());
    static float ReadFloat() => float.Parse(ReadString());
    static double ReadDouble => double.Parse(ReadString());

    static string[] ReadStringArray() => ReadString().Split(' ');
    static int[] ReadIntArray() => Array.ConvertAll(ReadString().Split(' '), int.Parse);
    static long[] ReadLongArray() => Array.ConvertAll(ReadString().Split(' '), long.Parse);
    static float[] ReadFloatArray() => Array.ConvertAll(ReadString().Split(' '), float.Parse);
    static double[] ReadDoubleArray() => Array.ConvertAll(ReadString().Split(' '), double.Parse);

    static T TypeConversion<T>(string s) {
        if (typeof(T) == typeof(int)) {
            return (T) Convert.ChangeType(int.Parse(s), typeof(T));
        } else if (typeof(T) == typeof(long)) {
            return (T) Convert.ChangeType(long.Parse(s), typeof(T));
        } else if (typeof(T) == typeof(double)) {
            return (T) Convert.ChangeType(double.Parse(s), typeof(T));
        } else {
            return (T) Convert.ChangeType(s, typeof(T));
        }
    }

    static void ReadMulti<T, U>(out T a, out U b) {
        var str = ReadStringArray();
        a = TypeConversion<T>(str[0]);
        b = TypeConversion<U>(str[1]);
    }

    static void ReadMulti<T, U, V>(out T a, out U b, out V c) {
        var str = ReadStringArray();
        a = TypeConversion<T>(str[0]);
        b = TypeConversion<U>(str[1]);
        c = TypeConversion<V>(str[2]);
    }

    static void WriteAnswer(object ans) => Console.WriteLine(ans);

    static bool IsOdd(long num) {
        return (num & 1) == 1;
    }

    static bool IsEven(long num) {
        return (num & 1) == 0;
    }

    static long GCD(long a, long b) {
        return b != 0 ? GCD(b, a % b) : a;
    }

    static long RoundUp(long a, long b) {
        return (a + b - 1) / b;
    }


    static void ChangeStdIn() {
        var path = "./../../TestCase.txt";
        var exStdIn = new System.IO.StreamReader(path);
        Console.SetIn(exStdIn);
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <string>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;

int main(){
    ll a,b,c;
    cin >> a >> b >> c;
    if (c<=b){
        cout << "delicious" << endl;
    }else if (c-b<=a){
        cout << "safe" << endl;
    }else if(c-b>a){
        cout << "dangerous" << endl;
    }
}


Measured memory_bytes: 256
n = gets.chomp.to_i
ary = gets.chomp.split.map(&:to_i)

ans = ary.join

flag = false
tmp_ary = []
ary.each_with_index do |i, idx|
    if idx+1-i < 0
        flag = true
        break
    end
    tmp_ary << idx+1-i
end
if flag
    puts -1
else
    ans_ary = []
    ary.each_with_index do |i,idx|
        ans_ary.insert(-1*tmp_ary[idx]-1, i)
    end
    puts ans_ary
end




Measured memory_bytes: 3836
/*Bubble Sort*/
/*This program uses the tree structure(Binary Indexed Tree).
We can calculate nuber of exchanges for O(log n)
total order of this program is O(n log n) because of sort(quick sort)*/
#include <cstdio>
#include <algorithm>
using namespace std;

typedef long long Int;
#define SIZE 100001
int bit[SIZE];

int n;

int sum(int i) {
	int res = 0;
	for (int x = i;x > 0;x -= x&-x) {
		res += bit[x];
	}
	return res;
}

void add(int i, int r) {
	for (int x = i;x <= n;x += x&-x)bit[x] += r;
}

int main() {
	int a[SIZE];
	int b[SIZE];
	int lb, ub, mid;
	Int res;

	while (true) {
		scanf("%d", &n);
		if (n == 0)break;
		for (int i = 0;i < n;i++) {
			scanf("%d", &a[i]);
		}

		for (int i = 0;i < n;i++) {
			b[i] = a[i];
		}
		sort(b, b + n);
		for (int i = 0;i < n;i++) {//change a[i] to k(a[i] is k.th largest of the array)
			lb = -1;ub = n;
			while (ub - lb > 1) {
				mid = (ub + lb) / 2;
				if (a[i] > b[mid]) {
					lb = mid;
				}
				else {
					ub = mid;
				}
			}
			a[i] = ub + 1;
		}
		for (int i = 0;i <= n;i++) {
			bit[i] = 0;
		}
		res = 0;
		for (int i = 0;i < n;i++) {
			res += i - sum(a[i]);
			add(a[i], 1);
		}
		printf("%lld\n", res);
	}

	return 0;
}

Measured memory_bytes: 1052
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>

typedef long long ll;
using namespace std;
int main() {
    int n;
    cin>>n;
    int a[n];
    int b;
    ll ans=0;
    int count;
    for(int i=0;i<n;i++){
        cin>>a[i];
        ans += a[i]-1;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <algorithm>
#include <functional>

using namespace std;

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

	int N;
	cin >> N;

	long long result = 0;
	for (int i = 0; i < N; i++)
	{
		long long a;
		cin >> a;

		result += a - 1;
	}

	cout << result;

	return 0;
}

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

int main(){
   int h,w;cin>>h>>w;
   char m[h+2][w+2];
   for(int i=1;i<=h;i++){
       for(int j=1;j<=w;j++){
           cin>>m[i][j];
       }
   }
   int mine=0;
   for(int i=1;i<=h;i++){
       for(int j=1;j<=w;j++){
           if(m[i][j]=='#')mine++;
       }
   }
   int flag=1;
   for(int i=1;i<=h;i++){
       for(int j=1;j<=w;j++){
            if(m[i][j]=='#'){
                if(m[i-1][j]!='#'&&m[i+1][j]!='#'&&m[i][j-1]!='#'&&m[i][j+1]!='#')flag=0;
            }        
       }
   }
   cout<<((flag)?"Yes":"No")<<endl;
}


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

#define rep(i, n) for ( int i = 0; i < (n); ++i )
using namespace std;
using ll =  long long;
using P = pair<ll, ll>;

int main( void )
{
	ll a, b, c, d;
	cin >> a >> b >> c >> d;

	while ( true ) {
		c -= b;
		if ( c <= 0 ) {
			cout << "Yes\n";
			break;
		}

		a -= d;
		if ( a <= 0 ) {
			cout << "No\n";
			break;
		}
	}

	return 0;
}


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

int main(){
    int H,W;

    cin >> H >> W;
    const int dx[4] = {0,0,-1,1};
    const int dy[4] = {-1,1,0,0};

    std::vector<std::vector<char>> graph(H, std::vector<char>(W));
    rep(i,H)
    {
        rep(j,W)
        {
            cin >> graph[i][j];
        }
    }

    bool can = true;

    for(int h=0;h<H;h++)
    {
        for(int w=0;w<W;w++)
        {
            if(graph[h][w] == '.') continue;

            bool exist = false;

            for(int d=0;d<4;d++)
            {
                int y = h + dy[d];
                int x = w + dx[d];
                if(x < 0 || x>=W || y < 0 || y>=H) continue;

                if(graph[y][x] == '#')
                {
                    exist = true;
                }
            }

            if(!exist)
            {
                can = false;
            }

        }
    }

    if(can)
    {
        std::cout << "Yes" << std::endl;
    }else{
        std::cout << "No"  << std::endl;
    }

    return 0;
}

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

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pf push_front
#define iter(v, i) for (__typeof__((v).begin()) i = (v).begin(); i != (v).end(); i++)
#define fast_io_without_cstdio ios_base::sync_with_stdio(false), cin.tie(NULL)
#define all(v) (v).begin(), (v).end()
#define rep(i, s, e) for (int i = s; i < e; i++)

// START for segment tree
#define params int p, int L, int R
#define housekeep int mid = (L + R) >> 1, left = p << 1, right = left | 1
// END

#ifdef __linux__
#define gc getchar_unlocked
#define pc putchar_unlocked
#else
#define gc getchar
#define pc putchar
#endif

#if __cplusplus <= 199711L
template<class BidirIt>
BidirIt prev(BidirIt it, typename iterator_traits<BidirIt>::difference_type n = 1) {
    advance(it, -n);
    return it;
}

template<class ForwardIt>
ForwardIt next(ForwardIt it, typename iterator_traits<ForwardIt>::difference_type n = 1) {
    advance(it, n);
    return it;
}
#endif

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ldouble;

const double EPS = 1e-9;
const double PI = 3.141592653589793238462;

template<typename T>
inline T sq(T a) { return a * a; }

//#ifdef LOCAL_MACHINE
//#endif

int main() {
    //freopen("", "r", stdin);
    //freopen("", "w", stdout);
    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    for (int i = 0; i < n; i++) {
        if (s.substr(i) == t.substr(0, n - i)) {
            printf("%d\n", n + i);
            return 0;
        }
    }
    printf("%d\n", 2 * n);
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

using ll = long long;

int main()
{
	int n, k;
	cin >> n >> k;

	vector<int> x(n), y(n);
	vector<int> xary, yary;

	for (int i = 0; i < n; i++) {
		cin >> x[i] >> y[i];
		xary.push_back(x[i]);
		yary.push_back(y[i]);
	}

	sort(begin(xary), end(xary));
	sort(begin(yary), end(yary));

	ll ans = 1LL * (xary[n - 1] - xary[0]) * (yary[n - 1] - yary[0]);
	
	for (int xi = 0; xi < n; ++xi) {
		for (int xj = xi + 1; xj < n; ++xj) {
			for (int yi = 0; yi < n; ++yi) {
				for (int yj = yi + 1; yj < n; ++yj) {

					int num = 0;
					ll lx = xary[xi], rx = xary[xj];
					ll by = yary[yi], uy = yary[yj];

					for (int i = 0; i < n; i++) {
						if (lx <= x[i] && x[i] <= rx && by <= y[i] && y[i] <= uy) {
							num++;

						}
					}

					if (num >= k) ans = min(ans, 1LL * (rx - lx)*(uy - by));
				}
			}
		}
	}

	cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define fi first
#define se second
#define endl '\n'
#define mx 1e18
#define mod 998244353
#define lb(v,x) lower_bound(v.begin(),v.end(),x)
#define ub(v,x) upper_bound(v.begin(),v.end(),x)
#define pb push_back
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll bino()
{
        vector<ll>inv(200005);vector<ll>fact(200005); vector<ll>inversef(200005);
    inv[0] = 1;inv[1]=1;
for(int i = 2; i < 200005; ++i)
    inv[i] = (inv[mod%i]*(mod-mod/i)) % mod;
    
    fact[0]=1;
    for(int i=1;i<200005;i++)
    fact[i]=(i*fact[i-1])%mod;
   
    inversef[0]=1;inversef[1]=1;
    for(int i=2;i<200005;i++)
    inversef[i]=(inversef[i-1]*inv[i])%mod;
}
ll powe(ll x,ll n)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return powe(((x%mod)*(x%mod))%mod,n/2);
    else                             //n is odd
        return ((x%mod*(powe(((x%mod)*(x%mod))%mod,(n-1)/2))%mod)%mod);
}
vector<vector<ll>>dp(3001,vector<ll>(3001,-1));

ll fun(int i,int j,vector<ll>&a,int n)
{
    if(i==j)dp[i][j]=a[i];
    if(i>n-1)return 0;
    if(j<0)return 0;
   // else if(j==i+1)dp[i][j]= max(a[i],a[j]);
    
    if(dp[i][j]!=-1)return dp[i][j];
    else return dp[i][j]=max(a[i]-fun(i+1,j,a,n),a[j]-(fun(i,j-1,a,n)));
   
  //  else  return dp[i][j]= max(a[i]+min(dp[i+1][j-1],dp[i+2][j]),a[j]+min(dp[i][j-2],dp[i+1][j-1]));
    
}
int main()
{
   io
  int n;cin>>n;vector<ll>a(n);
  for(int i=0;i<n;i++)cin>>a[i];
  cout<<fun(0,n-1,a,n);
}

Measured memory_bytes: 71040
#include <bits/stdc++.h>
#define ALL(x) (x).begin(),(x).end()
#define PB push_back
#define MP make_pair
#define Mod 998244353
#define MOD 1000000007
using namespace std;
using lint = long long;
using vi = vector<lint>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;

// cout << fixed << setprecision(12)

int main(){
  
  lint N; cin >> N;
  vi ans(4,0);
  for(lint i=0; i<N; i++){
    string s; cin >> s;
    if(s=="AC") ans[0]++;
    if(s=="WA") ans[1]++;
    if(s=="TLE") ans[2]++;
    if(s=="RE") ans[3]++;
  }
  cout << "AC x " << ans[0] << endl;
  cout << "WA x " << ans[1] << endl;
  cout << "TLE x " << ans[2] << endl;
  cout << "RE x " << ans[3] << endl; 
}

Measured memory_bytes: 3596
#include<iostream>
using namespace std;
const int BUF = 200005;


int nLeng, nCut;
int leng[BUF];

void read() {
    cin >> nLeng >> nCut;
    for (int i = 0; i < nLeng; ++i) {
        cin >> leng[i];
    }
}


void work() {
    int ng = 0, ok = 1000000000;

    while (ng + 1 < ok) {
        int mid = (ng + ok) / 2;

        int cnt = 0;
        for (int i = 0; i < nLeng; ++i) {
            if (leng[i] > mid) {
                cnt += (leng[i] + mid - 1) / mid - 1;
            }
        }

        if (cnt <= nCut) {
            ok = mid;
        } else {
            ng = mid;
        }
    }

    cout << ok << endl;
}


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


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

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

  ll x = 0;
  rep(i,n.size()){
    x += (int)(n[i] - '0');
  }

  if (x % 9 == 0) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 3752
def resolve():
	(N, M, X), *T = [[*map(int, i.split())] for i in open(0)]
	ans = []
	for i in range(1, 2**N):
		tmp = []
		for j in range(N):
			if i>>j & 1 == 1:
				tmp.append(T[j])
		c, *a = map(sum, zip(*tmp))
		if min(a) >= X:
			ans.append(c)
	if ans:
		print(min(ans))
	else:
		print(-1)
resolve()

Measured memory_bytes: 9224
#include<bits/stdc++.h>
//using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i,a,b) for (int i=(a);i<(b);i++)
#define per(i,a,b) for (int i=(b)-1;i>=a;i--)
#define sz(a) (int) a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
//-----
int main() {
    int k,a,b;scanf("%d%d%d",&k,&a,&b);
    if(k + 1 <= a) return 0*printf("%d\n",k+1);
    ll ans = a;
    k -= a - 1;
    if(b - a > 2) {
        ans += (ll)(b - a) * (k / 2);
        k %= 2;
        ans += k;
    }else {
        ans += k;
    }
    printf("%lld\n",ans);
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <set>
#include <unordered_set>
#include <map>
#include <cmath>
#include <deque>
#include <queue>
#include <string>
#include <cstring>
#include <stack>


using namespace std;
typedef long long ll;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i, a, b) for (int i = a; i < b; i++)
#define V vector

V<V<int> > A;
int n, m, x;
int minCost = 1;
V<int> costs;

int check(int num) {
    V<int> vals(m);
    int r = 0;
    int c = 0;
    while (num > 0) {
        if(num & 1) {
            c += costs[r];
            REP(i, 0, m){
                vals[i] += A[r][i];
            }
        }
        num >>= 1;
        r += 1;
    }
    REP(i, 0, m) {
        if(vals[i] < x) return -1;
    }
    return c;
}

void solve() {
    int max = minCost;
    int t;
    REP(i, 1, 1 << n) {
        t = check(i);
        if(t > 0) minCost = min(minCost, t);
    }
    if(max == minCost) cout << -1;
    else cout << minCost;
    return;
}

int main() {
    cin >> n >> m >> x;
    REP(i, 0, n) {
        int c, t;
        cin >> c;
        minCost += c;
        costs.PB(c);
        V<int> tmp;
        REP(j, 0, m) {
            cin >> t;
            tmp.PB(t);
        }
        A.PB(tmp);
    }
    solve();
    return 0;
}



Measured memory_bytes: 3196
// This is the template example file for programming//
#include<bits/stdc++.h>
//macros
using namespace std;
typedef long long ll;
typedef pair<int, int > Pii;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
typedef vector<ll> Vll;
#define pb push_back
#define rs resize 
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define repll(i, a, b) for(ll i=(a); i<(b); i++)
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define COUT(a) cout << a << endl
#define ALL(a) (a).begin(),(a).end()
const long long int mod = 1e9 + 7;


int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false); 
    string S,T,res="";
    int N;
    cin >> N;
    cin >> S >> T;
    rep(i,0,N){
        res+=S[i];
        res+=T[i];
    }
    cout << res << endl;
}

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

using namespace std;

#define ll long long int
#define prec(n) fixed << setprecision(n)
#define maxpq priority_queue<ll>
#define minpq priority_queue<int, vector<int>, greater<int>>
#define PI 3.14159265
#define pb push_back
#define bits(n) __builtin_popcount(n)

void solve()
{
    int a,b,c;
    cin>>a>>b>>c;
    if((a==b&&b!=c)||(a==c&&c!=b)||(b==c&&a!=c))
    cout<<"Yes";
    else
    {
        cout<<"No";
    }  
    

}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input1.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output1.txt", "w", stdout);
#endif

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

Measured memory_bytes: 3652
function myout(text){console.log(text);}//standard output
function Main(input) {
	//input = parseInt(input);
	//input = input.trim().split(" ");
	input = input.split("\n");
	//input = input.trim().split(" ").map((a)=>Number(a));
	//input = input.trim().split("\n").map((a)=>Number(a));
  var N = parseInt(input[0]);
  var S = input[1];
  var alpha = "abcdefghijklmnopqrstuvwxyz".split("");
  var output = 0;
  for(var i = 1; i < S.length; i++){
    var X = S.slice(0,i);
    var Y = S.slice(i,S.length);
    var count = 0;
    for(var j = 0; j < alpha.length; j++){
      if(X.indexOf(alpha[j]) != -1 && Y.indexOf(alpha[j]) != -1){
         count++;
      }
    }
    output = Math.max(count,output);
  }
  myout(output);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());


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

int main(){
    int w, h;
    while( cin >> w >> h, w&&h ){
        string in;
        int dx[4] = {0,1,0,-1}; // up,right,down,left
        int dy[4] = {1,0,-1,0};
        int px=1, py=1, dir=0;
        while( cin >> in, in!="STOP" ){
            int step;
            if( in == "FORWARD" ){
                cin >> step;
                px += dx[dir]*step;
                py += dy[dir]*step;
                if( px < 1 )    px = 1;
                else if( w < px )  px = w;
                if( py < 1 )    py = 1;
                else if( h < py )   py = h;
            }else if( in == "BACKWARD" ){
                cin >> step;
                px -= dx[dir]*step;
                py -= dy[dir]*step;
                if( px < 1 )    px = 1;
                else if( w < px )  px = w;
                if( py < 1 )    py = 1;
                else if( h < py )   py = h;
            }else if( in == "LEFT" ){
                dir = (dir+3)%4;
            }else if( in == "RIGHT" ){
                dir = (dir+1)%4;
            }
        }
        cout << px << " " << py << endl;
    }
    return 0;
}

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

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

int N;
ll X[51],Y[51];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,N) cin>>X[i]>>Y[i];
	int mi=N;
	FOR(x,N) FOR(y,N) if(x!=y) {
		ll dx=X[x]-X[y];
		ll dy=Y[x]-Y[y];
		int num=0;
		FOR(i,N) {
			int ok=0;
			FOR(j,N) if(i!=j) {
				ll xx=X[j]-X[i];
				ll yy=Y[j]-Y[i];
				if(X[j]-X[i]==dx&&Y[j]-Y[i]==dy) ok=1;
			}
			num+=1-ok;
			
		}
		mi=min(mi,num);
	}
	cout<<mi<<endl;
}


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


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;

struct Edge {
  int from, to;
  double cost;
  Edge() { }
  Edge(int from_, int to_, double cost_) : from(from_), to(to_), cost(cost_) { }
  bool operator <(const Edge &rhs) const {
    return cost < rhs.cost;
  }
};

struct UnionFind {
  vector<int> data;
  UnionFind(int v) : data(v, -1) { };
  int root(int x){
  	return data[x] < 0 ? x : (data[x] = root(data[x]));
  }
  bool same(int x, int y){
  	return root(x) == root(y);
  }
  void merge(int x, int y){
  	x = root(x), y = root(y);
  	if(x != y){
  		if(size(y) > size(x)) swap(x, y);
  		data[x] += data[y]; data[y] = x;
  	}
  }
  int size(int x){
  	return -data[root(x)];
  }
};

double kruskal(const int v, vector<Edge> es) {
	sort(es.begin(), es.end());
	double ans = 0;
	UnionFind uf(v);
	for(int i = 0; i < es.size(); ++i) {
		if(uf.same(es[i].from, es[i].to)) continue;
		uf.merge(es[i].from, es[i].to);
		ans += es[i].cost;
	}
	return ans;
}

int main(){
	int n;
	while (cin>>n, n) {
		vector<double>x(n), y(n), z(n), r(n);
		vector<Edge> e;
		
		for (int i=0; i<n; i++) {
			cin>>x[i]>>y[i]>>z[i]>>r[i];
		}
		for (int i=0; i<n; i++) {
			for (int j=i+1; j<n; j++) {
				if (i != j) {
					double d = sqrt((x[i]-x[j])*(x[i]-x[j]) + (y[i]-y[j])*(y[i]-y[j]) + (z[i]-z[j])*(z[i]-z[j]));
					d -= r[i] + r[j];
					d = max(0.0, d);
					e.push_back(Edge(i, j, d));
				}
			}
		}
		
		cout.setf(ios::fixed); cout.precision(3);
		cout << kruskal(n, e) << endl;		
	}
	return 0;
}

Measured memory_bytes: 1424
#include<bits/stdc++.h>
using namespace std;
/// Macros ---------------------
#define ll long long
#define sz(a) (int)a.size()
#define int long long
#define pb push_back
#define vi vector<int>
#define f first
#define s second
#define ii pair<int,int>
#define lb lower_bound
#define up upper_bound
#define rep(i,x,y) for(int i=(x);i<=(y);i++)
#define ld long double
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
/// Constracts -----------------------------------------------
const int maxn=1e5;
const int INF=(1ll)<<(30ll);
const int inf=1000000000000000000;
const int eps=1e-9;
const int mod=1e9+7;
/// Quick Pow ------------------------------------------------
int qpow(int b,int e)
{
    if( !e ) return 1;
    if( e & 1 ) return qpow(b, e - 1) * b;
    int pwur = qpow(b, e >> 1);
    return pwur * pwur;
}

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

/// My Code ---------------------------------------------------
map<char,int>mp;
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin>>s;
    for(auto i:s)mp[i]++;
    bool fl=1;
    for(auto i:s){
        if(mp[i]%2)fl=0;
    }
    cout<<((fl)?"Yes\n":"No\n");

    return 0;
}


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

int main(void){
    long long int a,b,x;
    cin >> a >> b >> x;
    if(a % x != 0)cout << (b / x) - (a / x) << endl;
    else cout << (b / x) - (a / x) + 1<< endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define pi 3.14159265359
using namespace std;
const long long INF=1e9+7;
const string alp="abcdefghijklmnopqrstuvwxyg"; //26
const string ALP="ABCDEFGHIJKLMNOPQRSTUVWXYG";
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
//const ll MOD=998244353LL;
//const ll MOD=1777777777LL;


int main() {
  ll N;
  cin>>N;
  ll a[N];
  ll sum=0;
  vl count(100000000,0);
  rep(i,N){
    cin>>a[i];
    sum+=a[i];
    count[a[i]]++;
  }
  ll Q;
  cin>>Q;
  ll b[Q],c[Q];
  rep(i,Q) cin>>b[i]>>c[i];
  for(int i=0;i<Q;i++){
    sum+=(c[i]-b[i])*count[b[i]];
    count[c[i]]+=count[b[i]];
    count[b[i]]=0;
    cout<<sum<<endl;
  }
}

Measured memory_bytes: 786764
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
#define N 6
#define eps 0.00001
#define REP(i,b,n) for(int i=(int)b;i<(int)n;i++)
#define rep(i,n)  REP(i,0,n)

double ans = -1;


void solve(int n,int now,bool *used,double *rc,double *lc,double lim,double c,int *weight){
  if ( n-1 == now){
    ans = max(ans,c);
    return;
  }
  
  //left i , right j
  rep(i,n){
    if ( used[i] == true)continue;
    rep(j,n){
      if (i == j)continue;
      if ( used[j] == true)continue;
      double w = weight[i]+weight[j];
      double tmpr=max(weight[i]/w+rc[j],-weight[j]/w+rc[i]);
      double tmpl=max(weight[j]/w+lc[i],-weight[i]/w+lc[j]);

      if ( tmpr+tmpl >lim+eps){continue;}
      double tr=rc[i],tl=lc[i];int tw=weight[i];
      used[j]=true;
      rc[i]=tmpr;
      lc[i]=tmpl;
      weight[i]=weight[i]+weight[j];
      solve(n,now+1,used,rc,lc,lim,tmpr+tmpl,weight);
      rc[i]=tr;
      lc[i]=tl;
      weight[i]=tw;
      used[j]=false;
    }
  }
  
}

main(){
 int te;
 cin>>te;
 while(te--){
   int n;
   double r;
   cin>>r>>n;
   int inp[n];
   rep(i,n)cin>>inp[i];

   double rc[n],lc[n];
   bool used[n];
   rep(i,n)rc[i]=lc[i]=0,used[i]=false;
   ans=-1;

   solve(n,0,used,rc,lc,r,0,inp);
   if ( ans == -1)puts("-1");
   else printf("%.9lf\n",ans);
 }
}

Measured memory_bytes: 980
import sys
import heapq
o=lambda:map(int,raw_input().split());r=range
n=int(raw_input())
e=[[] for _ in r(n+1)]
for _ in r(n-1):a,b=o();e[a]+=[(b,1)];e[b]+=[(a,1)]
k=int(raw_input())
for _ in r(k):v,p=o();e[v]+=[(0,p)];e[0]+=[(v,p)]
vis=[False]*(n+1)
cst=[10**9]*(n+1)
q=[(0,0)]
heapq.heapify(q)
while len(q):
    c,v=heapq.heappop(q)
    vis[v]=True;cst[v]=c
    for (w,d) in e[v]:
        if not vis[w] and c+d<cst[w]:
            heapq.heappush(q,(c+d,w));cst[w]=c+d
for i in r(n):
    for w,d in e[i+1]:
        if w and abs(cst[i+1]-cst[w])!=1:print'No';sys.exit()
print'Yes'
for i in r(n):print cst[i+1]


Measured memory_bytes: 76188
#include <bits/stdc++.h>
#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 ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n; cin >> n;
  cout << (n-2)*180 << endl;

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;
typedef long long int LL;
const int Max_N(100050);
const LL INF(0X3F3F3F3F3F3F3F3FLL);

int N, A[Max_N];
bool can[Max_N];
LL F[Max_N][3];

/*
显然，括号加在+号后面是没有意义的，所以括号只会加在-号后面
假设一个数（考虑符号）之前的未消掉的括号（不考虑和它相邻的左括号）有x个，那么对答案的贡献就是(-1)^x 
同时，当括号层数>= 3时，可以通过一些变换使得括号层数变为<= 2层
所以可以直接dp，F[i][j]表示考虑到第i个数，前面有j个左括号的最优代价。j <= 2，直接转移即可 
*/

void init()
{
	char op[10];
	scanf("%d", &N);
	for (int i = 1;i <= N;++i)
	{
		scanf("%d", A + i);
		if (i + 1 <= N)
		{
			scanf("%s", op);
			can[i] = (*op == '-');
		}
		if (can[i - 1])
			A[i] = -A[i];
	}
}

inline void update(LL &a, const LL &b)
{
	a = max(a, b);
}

int main()
{
	init();
	memset(F, -0X3F, sizeof(F));
	F[0][0] = 0LL;
	for (int i = 1;i <= N;++i)
	{
		for (int j = 0;j <= 2;++j)
			if (F[i - 1][j] != -INF)
				if (j & 1)
					F[i - 1][j] -= A[i];
				else
					F[i - 1][j] += A[i];
		for (int j = 0;j <= 2;++j)
		{
			update(F[i][j], F[i - 1][j]);
			if (can[i - 1] && j + 1 <= 2)
				update(F[i][j + 1], F[i - 1][j]);
		}
		for (int j = 0;j <= 2;++j)
			if (j - 1 >= 0)
				update(F[i][j - 1], F[i][j]);
	}
	printf("%lld", F[N][0]);
	return 0;
}

Measured memory_bytes: 3072
import collections


def main():
    n, m = input_list()
    route = [[] for i in range(n)]
    for _ in range(m):
        a, b = input_list()
        route[a-1].append(b-1)
        route[b-1].append(a-1)

    next_q = collections.deque()
    flags = [-1] * n
    flags[0] = 999
    next_q.append(0)
    while next_q:
        cur = next_q.popleft()
        for room in route[cur]:
            if flags[room] == -1:
                flags[room] = cur
                next_q.append(room)

    print('Yes')
    for i in range(1, n):
        print(flags[i]+1)


def input_list():
    return list(map(int, input().split()))


if __name__ == '__main__':
    main()


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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repp(i, n, m) for(int (i) = (n); (i) < (m); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define ldou long double
#define fi first
#define se second
#define setpre(x) std::cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define outs(x) cout << (x) << " "
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ std::cout << " [LOGGER] " << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , "; logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 300005;

/* ...o(^-^)o... */

int n,k,q;
vector<lint> a;

lint solve(lint x){
    vector<lint> tmp, b;
    rep(i, n){
        if(a[i]<x){
            if(tmp.size()==0) continue;
            sort(all(tmp));
            rep(j, (int)tmp.size()-k+1) b.push_back(tmp[j]);
            tmp.clear(); continue;
        }
        tmp.push_back(a[i]);
    }
    if(tmp.size()!=0){
        sort(all(tmp));
        rep(j, (int)tmp.size()-k+1) b.push_back(tmp[j]);
    }
    sort(all(b));
    if(b.size() < q) return INF;
    return b[q-1];
}

int main(){
    cin>>n>>k>>q;
    a = vector<lint>(n);
    rep(i, n) cin>>a[i];

    lint ans = INF;
    rep(i, n){
        lint x = a[i];
        ans = min(ans, solve(x)-x);
    }
    out(ans);
}


Measured memory_bytes: 384
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)

    return divisors

def f(a,b):
    return max(len(str(a)), len(str(b)))

n = int(input())
divisors = make_divisors(n)
ans = float('INF')
for i in divisors:
    tmp = f(i, n//i)
    if tmp < ans:
        ans = tmp
print(ans)


Measured memory_bytes: 3064
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main(){
    int lis[5]={0,6000,4000,3000,2000};
    for(int i=0;i<4;i++){
        int a,b;
        scanf("%d %d",&a,&b);
        printf("%d\n",lis[a]*b);
    }
    return 0;
}

Measured memory_bytes: 1188
#include <iostream>
#include <vector>

using namespace std;

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

    vector<vector<long long>> c(10, vector<long long>(10, 0));
    for (int i = 1; i <= n; i++) {
        int l = i;
        while (l >= 10) {
            l /= 10;
        }

        int r = i % 10;
        c[l][r]++;
    }

    long long res = 0;
    for (int i = 0; i < 10; i++) {
        for (int j = 0; j < 10; j++) {
            res += c[i][j] * c[j][i];
        }
    }

    cout << res << endl;
}


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

#define fo1(i, n) for (int i = 0; i < n; i++)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int((x).size())
using ll = long long; using vi = vector<int>; using ii = pair<int,int>;
const int oo = 0x3f3f3f3f; const ll OO = ll(oo)*oo;
#ifndef DEBUG
#define endl '\n'
#define debugf(...)
#define debug(...)
#else
#define debugf(...) printf(__VA_ARGS__)
#define debug(...) __VA_ARGS__
#endif
const int N = 100005;

const ll M = 1000000007;

ll fastexp(ll x, ll e) {
	ll ans = 1;
    x %= M;
	for(; e > 0; e >>= 1) {
		if(e&1) { ans *= x; ans %= M; }
		x *= x;
        x %= M;
	}
	return ans;
}

ll fat(ll x) {
    ll ans = 1;
    for (ll i = 2; i <= x; i++) {
        ans *= i;
        ans %= M;
    }
    return ans;
}

ll comb(ll n, ll k) {
    ll x = (fat(k) * fat(n - k)) % M;
    return (fat(n) * fastexp(x, M - 2)) % M;
}

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

    int x, y;
    cin >> x >> y;

    if ((x + y) % 3 != 0 || x == 0 || y == 0) {
        cout << 0 << endl;
        return 0;
    }

    int diag = (x + y) / 3;

    x -= diag;

    if (x < 0) {
        cout << 0 << endl;
        return 0;
    } else if (x > diag) {
        cout << 0 << endl;
        return 0;
    }

    debug(
        fo1(i, 7) {
            fo1(j, i+1) {
                cout << comb(i, j) << ' ';
            }
            cout << endl;
        }
    )

    cout << comb(diag, x) << endl;

    return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef tuple<ll,ll,ll> tlll;
typedef tuple<int,int,int> tiii;
const ll mod=1e9+7;
const int inf=1<<30;

int main(){
  ll a,b,c,x,y;
  cin >> a >> b >> c >> x >> y;
  priority_queue<ll, vector<ll>, greater<ll>> q;
  q.push(a*x+b*y);
  q.push(c*max(x,y)*2);
  q.push(c*min(x,y)*2+a*(x-min(x,y))+b*(y-min(x,y)));
  cout << q.top() << endl;
}

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

long aps(long a, long d, long n) {
  return n * (2 * a + (n - 1) * d) / 2;
}

int main() {
  long N, K, MOD = 1e9+7;
  cin >> N >> K;
  long ans = 0;
  for (long k = K; k <= N + 1; k++) {
    long mi = aps(0, 1, k);
    long mx = aps(N - k + 1, 1, k);
    ans += mx - mi + 1;
    ans %= MOD;
  }
  cout << ans << "\n";
}

Measured memory_bytes: 3672
import java.util.*;
import java.io.*;
import java.text.*;
import java.math.*;
import static java.lang.Integer.*;
import static java.lang.Double.*;
import java.lang.Math.*;

public class Main {

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

	public void run() throws Exception {
		FastIO file = new FastIO();
		int n = file.nextInt();
		int k = file.nextInt();
		long[] a = new long[n];
		for (int i = 0; i < n; i++) a[i] = file.nextLong();
		long[] dp = new long[n];
		for (int i = 1; i < n; i++) {
			dp[i] = Long.MAX_VALUE;
			for (int j = i - 1; j >= 0 && j >= i - k; j--) {
				dp[i] = Math.min(dp[i], dp[j] + Math.abs(a[i] - a[j]));
			}
		}
		file.out.println(dp[n - 1]);
		file.out.flush();
	}

	public static class FastIO {
		BufferedReader br;
		StringTokenizer st;
		PrintWriter out;

		public FastIO() {
			br = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
		}

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

		void print(Object o) {
			out.print(o);
		}

		void println(Object o) {
			out.println(o);
		}

		void printf(String s, Object... o) {
			out.printf(s, o);
		}
	}

	public static long pow(long n, long p, long mod) {
		if (p == 0)
			return 1;
		if (p == 1)
			return n % mod;
		if (p % 2 == 0) {
			long temp = pow(n, p / 2, mod);
			return (temp * temp) % mod;
		} else {
			long temp = pow(n, (p - 1) / 2, mod);
			temp = (temp * temp) % mod;
			return (temp * n) % mod;

		}
	}

	public static long pow(long n, long p) {
		if (p == 0)
			return 1;
		if (p == 1)
			return n;
		if (p % 2 == 0) {
			long temp = pow(n, p / 2);
			return (temp * temp);
		} else {
			long temp = pow(n, (p - 1) / 2);
			temp = (temp * temp);
			return (temp * n);

		}
	}

	public static long gcd(long x, long y) {
		if (x == 0)
			return y;
		else
			return gcd(y % x, x);
	}

	public static boolean isPrime(int n) {
		if (n <= 1)
			return false;
		if (n <= 3)
			return true;

		if (n % 2 == 0 || n % 3 == 0)
			return false;

		for (int i = 5; i * i <= n; i = i + 6)
			if (n % i == 0 || n % (i + 2) == 0)
				return false;

		return true;
	}
}


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

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

    int ans = 1;
    for(int i = 0; i < N; i++){
        char c;
        if(i == 0){
            c = S[0];
            continue;
        }

        if(c != S[i]) {
            c = S[i];
            ans++;
        }
    }
    cout <<ans<<endl;
    

    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n) for(ll i=0;i<(n);i++)
#define For1(i,n) for(ll i=1;i<(n);i++)
#define MOD 1000000007

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

int main(){
    ll n;cin>>n;
    vector<ll> vec(n);
    For(i,n){
        cin>>vec.at(i);
    }
    ll ans=0;
    For1(i,n){
        if(vec.at(i-1)==vec.at(i)){
            vec.at(i)=10000-i;
            ans++;
        }
    }
    cout<<ans<<endl;
}


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

#define ll long long
#define MD 1000000007
#define mod(n) ((n%MD+MD)%MD)
#define max(x, y) (x>y? x : y)
#define min(x, y) (x<y? x : y)
#define mul3(x, y, z) (mod(mod(x*y)*z)) 

ll perm(ll n, ll r){
    ll res = 1;
    for(ll i=0;i<r;i++){
        res = mod(res*(n-i));
    }
    return res;
}

ll modpow(ll x, ll y){
    ll res = 1;
    while(y>0){
        if(y&1) res = mod(res*x);
        x = mod(x*x);
        y >>= 1;
    }
    return res;
}

ll inv(ll n){
    return modpow(n, MD-2);
}

ll fact[1000000*2] = {1};
ll factinv[1000000*2] = {1};
ll conb(ll n, ll r){
    return mul3(fact[n], factinv[r], factinv[n-r]);
}

ll pow25[1000000*2] = {1};
ll pow26[1000000*2] = {1};


int main(){
    ll K;
    char S[1000000];
    scanf("%lld%s", &K, S);
    // end input

    ll s_len = 0;
    for(;s_len<(ll)1e6;s_len++){
        if(!S[s_len]) break;
    }

    for(ll i=1;i<K+s_len;i++){
        fact[i] = mod(fact[i-1]*i);
        factinv[i] = inv(fact[i]);
        pow25[i] = mod(pow25[i-1]*25);
        pow26[i] = mod(pow26[i-1]*26);
    }
    
    ll ans = 0;
    for(ll i=K;i>=0;i--){
        ll t = mul3(conb(s_len+i-1, i), pow25[i], pow26[K-i]);
        //ll t = mul3(conb(s_len+i-1, i), modpow(25, i), modpow(26, K-i));
        ans = mod(ans + t);
    }
    printf("%lld\n", ans);

    return 0;
}



Measured memory_bytes: 65212
/*
 AtCoder AXC 000
 */
 
#include <stdio.h>

int main(void){
	
	int a,b,c,x; //xは50の倍数
	int p=0;
	int i,j,k,n,m;
	int temp_x;
	
	
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	scanf("%d",&x);
	
	temp_x = x;
	
	for(i=0; x >= 500 && i < a; i++) x -= 500;
	for(j=0; x >= 100 && j < b; j++) x -= 100;
	for(k=0; x >=  50 && k < c; k++) x -= 50;
	
	if(x != 0){
		printf("%d",p);
		return 0;
	}
	
	for(; i>=0;i--,j+=5){
		// 500 -> 100*5
		
		for(n=j,m=k; n>=0; n--,m+=2){
			// 100 -> 50*2
			if(i<=a && n<=b && m<=c){
				//printf("(500,100,50) = (%d,%d,%d)\n",i,n,m);
				p++;
			}
		}
	}
	
	printf("%d",p);
	
	return 0;
}

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

int main()
{


	int s,h,m,sm;
	cin >> s;

	h = s / 3600;
	m = s / 60 - h * 60;
	sm = s - h*3600-m * 60;
	cout << h << ":" << m << ":" << sm << endl;


	return 0;
}

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

int main() {
  int n;
  while(cin >> n, n) {
    int count = 0;
    for(int i = 0; i < n / 2; ++i) {
      string op1, op2;
      cin >> op1 >> op2;
      if((op1 == "lu" && op2 == "ru") || (op1 == "ru" && op2 == "lu") || (op1 == "ld" && op2 == "rd") || (op1 == "rd" && op2 == "ld")) ++count;
    }
    if(n % 2) {
      string a;
      cin >> a;
    }
    cout << count << endl;
  }
  return 0;
}

Measured memory_bytes: 1208
#include <iostream>
#include <fstream>
#include <algorithm>
#include <map>
//#define LOCAL
using namespace std;
typedef long long ll;
map<string,ll>m;

int main() {
#ifdef LOCAL
ifstream fin("1.txt");
streambuf*p;
p=cin.rdbuf(fin.rdbuf());
#endif // LOCAL
ll q;
cin>>q;
for(ll i=0;i<q;i++){
    ll a;
    string key;
    cin>>a>>key;
    if(0==a){
        ll x;
        cin>>x;
        m[key]=x;
    }else if(1==a){
        cout<<m[key]<<endl;
    }else if(2==a){
        m.erase(key);
    }
}

#ifdef LOCAL
fin.close();
#endif // LOCAL
}



Measured memory_bytes: 27788
N = int(input())
src = [tuple(map(int,input().split())) for i in range(N)]

ans_t, ans_a = src[0]
for t,a in src[1:]:
    t1 = ans_t + (t - ans_t%t)%t
    a1 = t1 // t * a
    a2 = ans_a + (a - ans_a%a)%a
    t2 = a2 // a * t
    if a1 < ans_a:
        ans_t, ans_a = t2,a2
    else:
        ans_t, ans_a = t1,a1
print(ans_t + ans_a)


Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main() {
int a,b,sum,mul,def;
cin>>a>>b;
sum=a+b;
mul=a*b;
def=a-b;
if(sum==mul || sum==def)
    cout<<sum;
else if(sum>def && sum>mul){
    cout<<sum;
  }
else if(mul>sum && mul>def){
    cout<<mul;
   }
else if(def>sum && def>mul){
    cout<<def;
  }
    return 0;
}


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

using namespace std;

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

int main(){

    int n, tmp, count;
    vector<int> a;
    cin >> n;

    for(int i = 0; i < n; i++)
    {
        cin >> tmp;
        a.push_back(tmp);
    }

    for(int i = 0; i < n; i++)
    {
        tmp = a[i];

        for(int j = 0;; j++)
        {
            if(tmp % 2 == 0) {
                tmp /= 2;
                count++;
            }
            else
            {
                break;
            }

        }

    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
void reads(string &s){
	char ch=getchar();s="";
	for (;ch==' '||ch=='\n';ch=getchar());
	for (;ch!=' '&&ch!='\n';s+=ch,ch=getchar());
}
string s,t;
int n,m,dp[3003][3003],fr[3003][3003][2];
void anspath(int x,int y){
	if (x==0 && y==0) return;
	anspath(fr[x][y][0],fr[x][y][1]);
	if (fr[x][y][0]==x-1 && fr[x][y][1]==y-1)putchar(s[x]);
}
int main(){
	memset (dp,-1,sizeof(dp));
	dp[0][0]=0;
	for (int i=0;i<3003;i++) dp[0][i]=dp[i][0]=0;
	reads(s),reads(t);n=s.size(),m=t.size();s="$"+s,t="$"+t; 
	for (int i=1;i<=n;i++)
		for (int j=1;j<=m;j++){
			dp[i][j]=dp[i-1][j],fr[i][j][0]=i-1,fr[i][j][1]=j;
			if (dp[i][j-1]>dp[i][j])dp[i][j]=dp[i][j-1],fr[i][j][0]=i,fr[i][j][1]=j-1;
			if (s[i]==t[j] && dp[i-1][j-1]+1>dp[i][j]) dp[i][j]=dp[i-1][j-1]+1,fr[i][j][0]=i-1,fr[i][j][1]=j-1;
		}
	anspath(n,m);
}

Measured memory_bytes: 106112