akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int N, A, B, C;
int l[100];

int calc(vector<int> v, int target){
  if(v.size()==0) return 1e8;
  int sum=0;
  int cost=10*(v.size()-1);
  for (auto val: v){
    sum+=val;
  }
  cost+=abs(target-sum);
  
  return cost;
}


int dfs (int index, vector<int> a, vector<int> b, vector<int> c){
    if(index==N) {
      return calc(a, A) + calc(b, B) + calc(c, C);
    }
    vector<int> tmp;

    tmp = a;
    tmp.push_back(l[index]);
    int ret1 = dfs(index+1, tmp, b, c);

    tmp = b;
    tmp.push_back(l[index]);
    int ret2 = dfs(index+1, a, tmp, c);
    
    tmp = c;
    tmp.push_back(l[index]);
    int ret3 = dfs(index+1, a, b, tmp);
    
    int ret4 = dfs(index+1, a, b, c);
    
    return min({ret1,ret2,ret3,ret4});
    
}


int main() {
  cin >> N >> A >> B >> C;
  
  for (int i = 0; i < N; i++) {
    cin >> l[i];
  }
  
  vector<int> blank;
  
  cout << dfs(0, blank, blank, blank) << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.util.stream.*;

public class Main {

    static Scanner sc = new Scanner(System.in);
    static int mod = (int)1e9 + 7;

    public static void main(String[] args) {
        String s = sc.next();
        String t = sc.next();
        int ans = 0;
        ans += s.charAt(0) == t.charAt(0) ? 1 : 0;
        ans += s.charAt(1) == t.charAt(1) ? 1 : 0;
        ans += s.charAt(2) == t.charAt(2) ? 1 : 0;
        System.out.println(ans);
    }

}


Measured memory_bytes: 21204
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define ull unsigned long long
#define pii pair<int,int>
#define pb(x) push_back(x)
#define inf 0x3f3f3f3f
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define drep(i,a,b) for(int i=(a); i>=(b);i--)
 
const int maxn = 2e5 + 5;
const int maxm = 5000 + 5;
const int MOD = 1e9 + 7;

vector<int>v[30];
string s,tt;

int main()
{
   ios::sync_with_stdio(false); cin.tie(0);cout.tie(0);
   //#ifndef ONLINE_JUDGE 
   //freopen("input.txt", "r", stdin);
   //#endif // ONLINE_JUDGE 
   cin >> s >> tt; 
   int n = s.size() , m = tt.size() ;
   rep(i,0,n - 1) v[s[i] - 'a'].pb(i);
   ll ans = 0;
   int lst = -1;
   rep(i,0,m - 1){
        int t = tt[i] - 'a';
        if(!v[t].size()){
            ans = -1;
            break;
        }
        int pos = upper_bound(v[t].begin(),v[t].end(),lst) - v[t].begin();
        if(pos == v[t].size()) {
            ans += (n - lst + v[t][0])*1ll;
            lst = v[t][0];
        }
        else {
            ans += (v[t][pos] - lst) * 1ll;
            lst = v[t][pos];
        }
        //cout << ans << " " << lst << endl;
   }
   cout << ans << endl;
   return 0;
}

Measured memory_bytes: 1228
import sys
import copy
N = int(input())
p = list(map(int, input().split()))
A = sorted(p)
if p == A:
  print("YES")
  sys.exit()
  
for i in range(N):
  for j in range(i+1,N):
    newp = copy.copy(p)
    newp[i], newp[j] = newp[j], newp[i]
    if newp == A:
      print("YES")
      sys.exit()
print("NO")

Measured memory_bytes: 3572
#include<bits/stdc++.h>
#define x first
#define y second

using namespace std;

int N, M, mod, s[3009], rgt[3009], dp[3009][3009];
char sir[3009];

void ad (int &i, int j)
{
    i += j;
    if (i >= mod) i -= mod;
}

int main ()
{
//freopen ("input", "r", stdin);
//freopen ("output", "w", stdout);

scanf ("%d %d\n", &N, &M), mod = 1e9 + 7;
scanf ("%s", sir + 1);
for (int i=1; i<=N; i++)
    s[i] = s[i - 1] + (sir[i] == '1');
for (int i=1; i<=N; i++)
    rgt[i] = i;
while (M --)
{
    int x, y;
    scanf ("%d %d", &x, &y);
    if (y > rgt[x]) rgt[x] = y;
}
dp[0][0] = 1;
int R = 0;
for (int i=0; i<N; i++)
{
    for (int j=0; j<=R - i; j++)
    if (dp[i][j])
    {
        //printf ("primele %d si pe [%d, %d] inca %d de 1 -> %d\n", i, i + 1, R, j, dp[i][j]);
        int k1 = j, k0 = (R - i) - j, mk0 = 0, mk1 = 0;
        if (rgt[i + 1] > R) mk1 = s[rgt[i + 1]] - s[R], mk0 = rgt[i + 1] - R - mk1;
        k0 += mk0, k1 += mk1;
        if (k1 >= 1) ad (dp[i + 1][k1 - 1], dp[i][j]);
        if (k0 >= 1) ad (dp[i + 1][k1], dp[i][j]);
    }
    if (rgt[i + 1] > R) R = rgt[i + 1];
}
printf ("%d\n", dp[N][0]);
return 0;
}


Measured memory_bytes: 12544
import java.text.MessageFormat;
import java.util.Scanner;

public class Main {
	public static void koch(int n, double p1x, double p1y, double p2x, double p2y) {
		if (n == 0) {
			return;
		}
		double sx = (2 * p1x + 1 * p2x) / 3;
		double sy = (2 * p1y + 1 * p2y) / 3;
		double tx = (1 * p1x + 2 * p2x) / 3;
		double ty = (1 * p1y + 2 * p2y) / 3;
		double ux = (tx - sx) *(double) Math.cos(Math.toRadians(60)) - (ty - sy) * (double)Math.sin(Math.toRadians(60)) + sx;
		double uy = (tx - sx) * (double)Math.sin(Math.toRadians(60)) +(ty - sy) * (double)Math.cos(Math.toRadians(60)) + sy;

		koch(n - 1, p1x, p1y, sx, sy);
		System.out.println(MessageFormat.format("{0,number,0.00000000}",sx)+" "+MessageFormat.format("{0,number,0.00000000}",sy));
		koch(n - 1, sx, sy, ux, uy);
		System.out.println(MessageFormat.format("{0,number,0.00000000}",ux)+" "+MessageFormat.format("{0,number,0.00000000}",uy));
		koch(n - 1, ux, uy, tx, ty);
		System.out.println(MessageFormat.format("{0,number,0.00000000}",tx)+" "+MessageFormat.format("{0,number,0.00000000}",ty));
		koch(n - 1, tx, ty, p2x, p2y);

	}

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		double p1x = 0;
		double p1y = 0;
		double p2x = 100;
		double p2y = 0;
		System.out.println(MessageFormat.format("{0,number,0.00000000}",p1x)+" "+MessageFormat.format("{0,number,0.00000000}",p1y));
		koch(n, p1x, p1y, p2x, p2y);
		System.out.println(MessageFormat.format("{0,number,0.00000000}",p2x)+" "+MessageFormat.format("{0,number,0.00000000}",p2y));
		scanner.close();

	}

}


Measured memory_bytes: 66768
import java.util.*;
class Main{
	public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
      	int a= scan.nextInt();
      	int b= scan.nextInt();
      	int t= scan.nextInt();
      	int num = 0;
      	while(t>=a){
          	t -= a;
        	num++;
        }
        System.out.println(num*b);
    }
}

Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
const long long mod=1e9+7;
long long res;
long long fact[1000005];
int n;

long long pow_mod(long long a,long long b) {
  long long res=1;
  while(b) {
    if(b&1) {
      res=(res*a)%mod;
    }
    a=(a*a)%mod;
    b>>=1;
  }
  return res;
}


long long comb(int n,int x) {
	return fact[n]*pow_mod(fact[x]*fact[n-x]%mod,mod-2)%mod;
}


int main() {
  scanf("%d",&n);
  fact[0]=1;
  for(int i=1;i<=n;i++) {
  	fact[i]=i*fact[i-1]%mod;
  }
  for(int i=1;i<=n;i++) {
  	res=(res+(pow_mod(2,i)-2+mod)*pow_mod(8,n-i)%mod*comb(n,i))%mod;
  }
  printf("%lld",res);
  return 0;
}

Measured memory_bytes: 11408
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;

/*BigInteger
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/rational.hpp>
namespace xxx = boost::multiprecision;
using Bint = xxx::cpp_int;
using Real = xxx::number<xxx::cpp_dec_float<1024>>;
*/

#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0LL, sizeof(x))
#define mm(x) memset((x), -1LL, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

// debug
#define GET_VAR_NAME(variable) #variable
#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;

// bit_macro
#define Bit(n) (1LL << (n))
#define Bitset(a, b) (a) |= (1LL << (b))
#define Bitunset(a, b) (a) &= ~(1LL << (b))
#define Bitcheck(a, b) ((((a) >> (b)) & 1LL) == 1LL)
#define Bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

//constant
constexpr int INF = (int)1e18;
constexpr int MOD = (int)1e9 + 7;
constexpr double PI = (double)acos(-1);
constexpr double EPS = (double)1e-10;
constexpr int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
constexpr int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};

//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
} Accelerate_Cin;

signed main() {
  int N;
  cin >> N;
  vector<int> a(N), b(N);
  for (int i = 0; i < N; i++) cin >> a[i];
  for (int i = 0; i < N; i++) cin >> b[i];

  vector<int> d(N);
  for (int i = 0; i < N; i++) d[i] = b[i] - a[i];

  int tmp = 0;
  for (auto x : d) {
    if (x > 0) {
      tmp += x / 2;
    } else {
      tmp += x;
    }
  }

  if (tmp >= 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


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

int main() {
  int A,B,C;
  cin >> A >> B >> C;
  if ((A < C && C < B) ||
      (B < C && C < A)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
<?php

fscanf(STDIN, "%s%s%s", $s1, $s2, $s3);

$a = strtoupper(substr($s1,0,1));
$b = strtoupper(substr($s2,0,1));
$c = strtoupper(substr($s3,0,1));

echo $a.$b.$c;


Measured memory_bytes: 4856
#include<stdio.h>
int n,m;
int s[101],t[101];
int sum_s,sum_t;
int wa;
int main(void){
    while(1){
        scanf("%d%d",&n,&m);
        if(n+m==0) break;
        wa=0;
        sum_s=sum_t=0;
        int ans_t=0,ans_h=0;
        for(int i=1;i<=n;i++){
            scanf("%d",&s[i]);
            sum_s+=s[i];
        }
        for(int i=1;i<=m;i++){
            scanf("%d",&t[i]);
            sum_t+=t[i];
        }
        for(int i=1;i<=n;i++){
            for(int j=1;j<=m;j++){
                if((sum_s-s[i]+t[j])==(sum_t+s[i]-t[j])){
                    if(wa==0||wa>s[i]+t[j]){
                        wa=s[i]+t[j];
                        ans_t=s[i]; ans_h=t[j];
                    }
                }
            }
        }
        if(ans_t+ans_h==0) printf("-1\n");
        else printf("%d %d\n",ans_t,ans_h);
    }
}



Measured memory_bytes: 2016
#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<int,int>;

int main(){
    int n, d;
    cin >> n >> d;
    vector<vector<int>> x(n, vector<int>(d));
    rep(i, n){
        rep(j, d) cin >> x[i][j];
    }
    int ans = 0;
    rep(i, n){
        for (int j = i+1; j<n; j++){
            int len = 0;
            for (int k=0; k<d; k++){
                int a = abs(x[i][k] - x[j][k]);
                len += a*a;
            }
            for (int k = 1; k <= len; k++){
                if (len == k*k){
                    ans++;
                }
            }
        }
    }
    cout << ans <<endl;
    return 0;       
}

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

struct UnionFind {
  vector<int> d;
  UnionFind(int n=0): d(n,-1) {}
  int find(int x) {
    if (d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y);}
  int size(int x) { return -d[find(x)];}
};

int main(){
    ll n,m;
    cin >> n >> m;
    ve<P> e(m);
    ve<ll> ans(m);
    rep(i,m){
        int a,b;
        cin >> a >> b;
        a--; b--;
        e[i] = P(a,b);
    }
    reverse(e.begin(), e.end());
    ans[0] = (n-1) * n /2;
    UnionFind uf(n);
    rep(i,m-1){
        if(uf.same(e[i].first, e[i].second)) ans[i+1] = ans[i];
        else ans[i+1] = ans[i] - uf.size(e[i].first) * uf.size(e[i].second);
        uf.unite(e[i].first, e[i].second);
    }
    reverse(ans.begin(), ans.end());
    rep(i,m) cout << ans[i] << endl;
}


Measured memory_bytes: 5884
#include<bits/stdc++.h>
#define lld long long
#define pb push_back
#define mk make_pair
#define MAX (lld)1e18+7
#define lim (lld)1e9+7
#define MAX2 (lld)2e5+9
#define ff first
#define ss second
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
lld inp[3000+3][3000+3];
lld dp[3000+3][3000+3][4];
int main()
{
	fastio
	lld r,c,k;
	cin>>r>>c>>k;

	for(lld i=0;i<k;i++)
	{
		lld x,y,w;
		cin>>x>>y>>w;
		inp[x][y]=w;
	}

	for(lld i=1;i<=r;i++)
	{
		for(lld j=1;j<=c;j++)
		{
			lld mx=0;
			for(lld p=1;p<=3;p++)
			{
				mx=max(mx,dp[i-1][j][p]);
			}

			for(lld k=0;k<=3;k++)
			{
				
				if(k>0)
					dp[i][j][k] = max(max(dp[i][j-1][k-1],mx)+inp[i][j],dp[i][j][k]);
				
				dp[i][j][k] = max(dp[i][j][k],max(dp[i][j-1][k],mx));
			}
		}
	}

	lld ans=0;
	for(lld k=1;k<=3;k++)
		ans=max(ans,dp[r][c][k]);

	cout<<ans<<endl;

}

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

int main(){
    
    map <string,int>m;
    string str1,str2,str;
    int a,b;
    cin>>str1>>str2>>a>>b;
    m[str1]=a;
    m[str2]=b;
    
    cin>>str;
    m[str]--;
    
    cout<<m[str1]<<' '<<m[str2]<<endl;
    
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
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; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
    if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
    }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる



int main(){
  int a,b;
  cin >> a >> b;

  bool ok=true;

  if((4*a-b)%2==1) ok=false;
  if((b-2*a)%2==1) ok=false; 
  if((4*a-b)/2<0) ok=false;
  if((b-2*a)/2<0) ok=false;

  cout << (ok?"Yes":"No") << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i < n; i++)
#define elif else if
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const ll INF = 1e18;

int main(){
    ll N;
    cin >> N;
    ll p[N+1], q[N+1], a[N+1], b[N+1];
    rep2(i, 1, N+1){
        cin >> p[i];
        q[p[i]] = i;
        a[i] = i;
        b[i] = N+1-i;
    }
    ll suml[N+1], sumr[N+1];
    suml[1] = 0;
    rep2(i, 1, N){
        suml[i+1] = suml[i] + N-q[i];
    }
    sumr[N] = 0;
    for(int i = N; i > 1; i--){
        sumr[i-1] = sumr[i] + N-q[i];
    }
    rep2(i, 1, N+1){
        a[i] += suml[i];
        b[i] += sumr[i];
    }
    rep2(i, 1, N) cout << a[i] << ' ';
    cout << a[N] << endl;
    rep2(i, 1, N) cout << b[i] << ' ';
    cout << b[N] << endl;
}

Measured memory_bytes: 1536
// https://atcoder.jp/contests/dp/tasks/
#include <bits/stdc++.h>

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

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

int main() {
    ios::sync_with_stdio(false);

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

    rep(i, n) { cin >> a[i]; }
    sort(a.begin(), a.end());

    int prev = -1;
    rep(i, n) {
        if (a[i] == prev) {
            cout << "NO" << endl;
            return 0;
        }
        prev = a[i];
    }

    cout << "YES" << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
using namespace std;
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 <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;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 2100100100;
const int MOD = 1e9 + 7;

ll N, M, K, Q, W, H, L, R, C;
string S;

int main() {
    cin >> N;
    vector<ll> A(N);
    ll sum = 0;
    for (int i = 0; i < N; i++) {
        cin >> A.at(i);
        sum += A[i];
    }
    A.push_back(A[0]);

    if (sum % (N * (N + 1) / 2) != 0) {
        cout << "NO" << endl;
        return 0;
    }
    ll K = sum / (N * (N + 1) / 2);
    ll ksum = 0;
    for (int i = 0; i < N; i++) {
        ll d = A[i + 1] - A[i];
        if ((K - d) < 0 || (K - d) % N != 0) {
            cout << "NO" << endl;
            return 0;
        } else {
            ksum += (K - d) / N;
        }
    }
    if (K == ksum) {
        cout << "YES" << endl;
        return 0;
    } else {
        cout << "NO" << endl;
        return 0;
    }

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define fast ios::sync_with_stdio(0); cin.tie(0);
#define endl '\n'
#define MOD 1000000007
#define pb push_back
#define int long long int

using namespace std;

int32_t main(void) {
    fast;
    int h, ans=0, i=1; cin>>h;
    while(h) {
        ans += i;
        i<<=1;
        h>>=1;
    }
    cout<<ans;
}



Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
    int a, b, c;

    scanf("%d %d %d", &a, &b, &c);

    if(a < b && b < c)
    {
        printf("%s\n", "Yes");
    }

    else
    {
        printf("%s\n", "No");
    }

    return 0;
}


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

using namespace std;


int main(){
    int n;
    string ans ="No";
    cin >> n; 
    for(int i=1;i<=9;i++){
        for(int j=1;j<=9;j++){
            if(n==i*j){
                ans="Yes";
                break;
            }
        }
    }
        
   
    cout << ans << endl;
    

    
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var A, B, C, K, ans int
	fmt.Scan(&A, &B, &C, &K)
	if K%2 == 0 {
		ans = A - B
	} else {
		ans = B - A
	}
	if ans > 1e18 || ans < -1e18 {
		fmt.Println("Unfair")
	} else {
		fmt.Println(ans)
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
void out_vector(vector<int> v) {
  REP(i,v.size()) { cout << v[i] << '\n'; }
}

int cnt_node(int p[][2], bool visited[], int n, int m, int now){
  bool v[n];
  vector<int> next;
  // out_vector(next);
  copy(visited, visited+n, v);
  v[now] = true;
  REP(i,m){
    if (p[i][0] == now) { if (!v[p[i][1]]) { next.push_back(p[i][1]); } }
    if (p[i][1] == now) { if (!v[p[i][0]]) { next.push_back(p[i][0]); } }
  }
  if (next.size() == 0) {
    REP(i,n) {
      if (!v[i]) return 0;
    }
    return 1;
  }
  int sum = 0;
  REP(i, next.size()) {
    sum += cnt_node(p,v,n,m,next[i]);
  }
  return sum;
}


int main(void) {
  int N, M;
  cin >> N >> M;
  int P[M][2];
  REP(i,M) { cin >> P[i][0] >> P[i][1]; }
  REP(i,M){ P[i][0]--; P[i][1]--; }
  bool visited[N] = {};
  cout << cnt_node(P,visited,N,M,0) << '\n';;
}


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

const ll INF = pow(10,18)+1;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

template<typename T> bool chmin(T& a, T b) {return a > b ? a = b, true : false;}
template<typename T> bool chmax(T& a, T b) {return a < b ? a = b, true : false;}
 
int main(){
    int H, A;
    cin >> H >> A;
    if (H % A == 0) cout << H/A << endl;
    else cout << 1+ H / A << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define gc getchar_unlocked()
#define pc(x) putchar_unlocked(x)
template<typename T> void scan(T &x){x = 0;bool _=0;T c=gc;_=c==45;c=_?gc:c;while(c<48||c>57)c=gc;for(;c<48||c>57;c=gc);for(;c>47&&c<58;c=gc)x=(x<<3)+(x<<1)+(c&15);x=_?-x:x;}
template<typename T> void printn(T n){bool _=0;_=n<0;n=_?-n:n;char snum[65];int i=0;do{snum[i++]=n%10+48;n/= 10;}while(n);--i;if (_)pc(45);while(i>=0)pc(snum[i--]);}
template<typename First, typename ... Ints> void scan(First &arg, Ints&... rest){scan(arg);scan(rest...);}
template<typename T> void print(T n){printn(n);pc(10);}
template<typename First, typename ... Ints> void print(First arg, Ints... rest){printn(arg);pc(32);print(rest...);}

using namespace std;
const int MM = 1e5+2;

int A, B, M, a[MM], b[MM];

int main(){
    scan(A, B, M);
    for(int i = 0; i < A; i++)
        scan(a[i]);
    for(int i = 0; i < B; i++)
        scan(b[i]);
    int ans = *min_element(a, a+A) + *min_element(b, b+B);
    for(int i = 0,x,y,c; i < M; i++){
        scan(x, y, c);
        x--, y--;
        ans = min(ans, a[x] + b[y] - c);
    }
    print(ans);
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    int d[a];
    for(int i=0;i<a;i++){
        cin>>d[i];
        c+=(b-1)/d[i]+1;
    }
    cout<<c<<endl;
}



Measured memory_bytes: 256
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        var w = new int[n + 1];
        string[] line = Console.ReadLine().Trim().Split(' ');
        var count = 0;
        for (int i = 0; i < n; i++)
            w[i + 1] = int.Parse(line[i]);
        for (int i = 1; i <= n; i++)
        {
            if (w[i] == i && i != n    ) { swap(w, i); count++; }
            if (w[i] == i && i == n ) { swap(w, i-1); count++; }
        }
        Console.WriteLine(count);
    }
    public static void swap(int[] w, int a)
    {
        var t = w[a];
        w[a] = w[a + 1];
        w[a + 1] = t;
    }
}

Measured memory_bytes: 16864
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod=1e9+7;

int main(){
    int N;
    cin >> N;
    vector<int> A(N), B(N), C(N-1);
    for(int i=0; i<N; i++){
        cin >> A[i];
    }
    for(int i=0; i<N; i++){
        cin >> B[i];
    }
    for(int i=0; i<N-1; i++){
        cin >> C[i];
    }
    int man=0, before=100;
    for(int i=0; i<N; i++){
        if(A[i]==(before+1)){
            man+=C[before-1];
        }
        man+=B[A[i]-1];
        before = A[i];
    }
    cout << man;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)

	N, K := nextInt(), nextInt()

	ans := 0.0
	for i := 1; i <= N; i++ {
		tmp := 1.0
		nn := i

		for nn < K {
			nn *= 2
			tmp /= 2.0
		}
		ans += tmp

	}

	ans /= float64(N)

	fmt.Printf("%.19f\n", ans)
}


Measured memory_bytes: 640
#ifdef Rahul
#include "RAHUL.h"
#else
#include <bits/stdc++.h>
using namespace std;
#define error(...) 42;
#endif
#define SZ(v) int((v).size())
#define ALL(vec) begin(vec), end(vec)
typedef long long i64;
template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
#define Luv(...) [&] (auto &&u, auto &&v) { return __VA_ARGS__; }
const int MOD = (int) 1e9 + 7;
const i64 INF = (i64) 1e18 + 42;

#include <atcoder/math>

int main() {
  cin.tie(nullptr) -> sync_with_stdio(false);
  
  int q; cin >> q;
  while (q--) {
    i64 n, m, a, b;
    cin >> n >> m >> a >> b;
    cout << atcoder::floor_sum(n, m, a, b) << '\n';
  }
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()
#define let auto const

template<typename... Types>
struct dynarr: std::vector<Types...> {
  using std::vector<Types...>::vector;
  using size_type = typename std::vector<Types...>::size_type;
  auto&& operator[](size_type i) { return this->at(i); }
  auto&& operator[](size_type i) const { return this->at(i); }
};

i64 gcd(i64 a, i64 b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

int main() {
  string s;
  cin >> s;
  i64 ten = 1;
  i64 X = 0;
  i64 ON = false;
  i64 i;
  for(i = 0;i < s.size(); i++) {
    if(s[i] == '(') {
      break;
    }
    if(ON) {
      ten *= 10;
    }
    if(s[i] == '.') {
      ON = true;
    }
    else {
      X = (X * 10 + (i64)(s[i] - '0'));
    }
  }
  if(i == s.size()) {
    i64 g = gcd(X, ten);
    cout << X / g << "/" << ten / g << endl;
  }
  else {
    i64 mm = 1;
    i64 Y = 0;
    i++;
    for(; i < s.size() - 1;i++) {
      Y = (Y * 10 + (i64)(s[i] - '0'));
      mm *= 10;
    }
    i64 a = X * mm + Y - X;
    i64 b = (mm - 1) * ten;
    i64 g = gcd(a, b);
    cout << a / g << "/" << b / g << endl;
  }
}



Measured memory_bytes: 3196
Option Explicit On

Module Module1

    Sub Main()

        Dim tmp As String() = Split(Console.ReadLine(), " ")
        Dim N As Integer = CInt(tmp(0))
        Dim K As Integer = CInt(tmp(1))

        Dim sunuke(N - 1) As Integer
        Dim okasi(K - 1) As Integer

        Dim ans As Integer = N
        For i As Integer = 0 To K - 1
            Dim d As Integer = Console.ReadLine()
            Dim tmp2 As String() = Split(Console.ReadLine(), " ")
            For j As Integer = 0 To d - 1
                If sunuke(CInt(tmp2(j)) - 1) = 0 Then
                    ans -= 1
                    sunuke(CInt(tmp2(j)) - 1) += 1
                End If
            Next
        Next

        Console.WriteLine(ans)
    End Sub

End Module


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

#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, n, m) for(int (i) = (n); (i) < (m); ++(i))

// constexpr int INF = 1e9;
constexpr ll INF = 1LL<<61;
constexpr ll mod = 1e9+7;


int main(){
  int X;
  cin >> X;
  cout << 10 - X / 200 << endl;
  return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<queue>
#include<stdio.h>
#include<string>
#include<stdlib.h>
#include<algorithm>
using namespace std;
int main() {
	int n;
	long x;
	long a[1010];
	cin >> n >> x;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n-1; j++) {
			if (a[j] > a[j + 1]) {
				swap(a[j], a[j + 1]);
			}
		}
	}
	while (true) {
		if (ans == n)break;
		if (ans == n-1) {
			if(x!=a[ans])break;
		}
		if (x >= a[ans]) {
			x -= a[ans];
			ans++;
		}
		else break;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
// Problem : D - Even Relation
// Contest : AtCoder - AtCoder Beginner Contest 126
// URL : https://atcoder.jp/contests/abc126/tasks/abc126_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")

#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,b,a) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
 
#define bug(x) cout<<#x<<"="<<x<<endl; 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const ld pii=3.14159265359; 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 200001; //check the limits, dummy
 
int main() 
{
	// && has higher precedence than ||
	ios_base::sync_with_stdio(0); cin.tie(0);    
	int N;
	cin>>N;
	vi adj[N+1],vis(N+1),ans(N+1);
	map<pi,int> m;
	F0R(x,N)
	{
		int a,b,c;
		cin>>a>>b>>c;
		adj[a].pb(b);
		adj[b].pb(a);
		m[{a,b}]=c;
		m[{b,a}]=c;
	}
	stack<int> S;
	S.push(1);
	ans[1]=1;
	while(sz(S)!=0)
	{
		int n=S.top();
		S.pop();
		vis[n]=1;
		F0R(x,sz(adj[n]))
		{
			int val=adj[n][x];
			if(!vis[val])
			{
				S.push(val);
				if(m[{n,val}]%2==0)
					ans[val]=ans[n];
				else
					ans[val]=1-ans[n];
			}
		}
	}
	FOR(x,1,N+1)
		cout<<ans[x]<<nl;
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 21936
#include <stdio.h>

int main()
{
	char line[8];
	scanf("%s",line);
	int i;
	char swap;
	
	if(line[2] != '\0'){
		swap = line[0];
		line[0]=line[2];
		line[2]=swap;
	}

	printf("%s",line);
	return 0;
}


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

ll Pow(ll x, ll n){
  if(n == 0) return 1;
  if(n % 2 == 0) return Pow(x*x % mod,n/2);
  else return x * Pow(x,n-1) % mod;
}

template <typename T, typename F>
class SegTree{
  int n; T uni; F f;
  vector<T> dat;
public:
  SegTree(int _n, F f, T uni) : f(f), uni(uni) {
    n = 1;
    while(n < _n) n *= 2;
    dat = vector<T>(2*n,uni);
  }
  void set(int k, const T x) {
    dat[k+n] = x;
  }
  void build() {
    for(int i = n-1; i >= 0; i--) {
      dat[i] = f(dat[2*i],dat[2*i+1]);
    }
  }
  void update(int k, T x) {
    k += n;
    dat[k] += x;
    while(k >>= 1){
      dat[k] = f(dat[2*k],dat[2*k+1]);
    }
  }
  T query(int a, int b) {
    T l = uni, r = uni;
    for(a += n, b += n; a < b; a >>= 1, b >>= 1) {
      if(a & 1) l = f(l,dat[a++]);
      if(b & 1) r = f(dat[--b],r);
    }
    return f(l,r);
  }
};

int main(){
  int n;
  cin >> n;
  P p[n];
  ll x[n], y[n];
  rep(i,n) {
    cin >> x[i] >> y[i];
    p[i] = P(x[i],y[i]);
  }
  sort(y,y+n);
  sort(p,p+n);
  map<ll,ll> mp;
  rep(i,n) mp[y[i]] = i;
  rep(i,n) {
    p[i].first = i;
    p[i].second = mp[p[i].second];
  }  
  ll ans = Pow(2,n-1) * n % mod;
  auto f = [](ll a, ll b){return a + b;};
  SegTree<ll,decltype(f)> small(n,f,0), large(n,f,0);
  rep(i,n) large.set(i,1);
  large.build();
  rep(i,n) {
    large.update(p[i].second,-1);
    ll lu = small.query(p[i].second,n);
    ll ld = small.query(0,p[i].second);
    ll ru = large.query(p[i].second,n);
    ll rd = large.query(0,p[i].second);
    small.update(p[i].second,1);
    ll v = (Pow(2,lu)-1) * (Pow(2,rd)-1) % mod; 
    ll u = (Pow(2,ld)-1) * (Pow(2,ru)-1) % mod;
    (ans += v * Pow(2,ld+ru) + u * Pow(2,lu+rd) - v * u) %= mod; 
  } 
  if(ans < 0) ans += mod;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 30104
let cnt = ref 0

let insertion_sort (a : int array) n g =
  for i = g to n - 1 do
    let v = a.(i) in
    let j = ref (i - g) in
    while !j >= 0 && a.(!j) > v do
      a.(!j+g) <- a.(!j);
      j := !j - g;
      incr cnt;
    done;
    a.(!j+g) <- v;
  done

let generate_g n =
  let rec doit i g acc =
    if g > n then acc
    else doit (i + 1) (int_of_float (4.**(float_of_int i) +. 3.*.2.**(float_of_int (i - 1)) +. 1.)) (g :: acc) in
  doit 1 1 []

let shell_sort (a : int array) n =
  cnt := 0;
  let g = generate_g n in
  List.iter (fun g -> insertion_sort a n g) g;
  g

let () =
  let n = read_int () in
  let a = Array.init n (fun _ -> read_int ()) in
  let g = shell_sort a n in
  Printf.printf "%d\n" (List.length g);
  print_int (List.hd g);
  List.iter (fun x -> print_string " "; print_int x) (List.tl g);
  print_newline ();
  Printf.printf "%d\n" !cnt;
  Array.iter (fun n -> Printf.printf "%d\n" n) a

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

int main() {
    int k,n;
    cin>>k>>n;
    vector<int> vi(n+1,0);
    for (size_t i = 0; i < n; i++)
    {
        cin>>vi[i];
    }
    vi[n]=vi[0]+k;
    int max_diff = 0;
    for (size_t i = 0; i < n; i++)
    {
        max_diff = std::max(max_diff, vi[i+1]-vi[i]);
        /* code */
    }
    cout << k-max_diff<<endl;
    
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric>
#include <set>
#include <cstdlib>
#include <queue>
#include <cstring>
using namespace std;

typedef long long llint;
typedef long double ld;
#define inf 1e18
#define mod 1000000007
priority_queue<llint,vector<llint>,greater<llint> > que;
priority_queue<llint> q;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int mp[5][4][11];
void solve(){
	int n;
	cin >> n;
	int b,f,r,v;
	for(int i=0;i<n;i++){
		cin >> b >> f >> r >> v;
		mp[b][f][r]+=v;
	}
	for(int i=1;i<=4;i++){
		for(int j=1;j<=3;j++){
			for(int k=1;k<=10;k++){
				cout << " " << mp[i][j][k];
			}
			cout << endl;
		}
		if(i<4)cout << "####################" << endl;
	}
}

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



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

const ll INF = 1e18;
const ll MOD = 1000000007;
const ll MX = 0; //最大値

#define rep(i,n) for(ll i=0; i<(ll)(n); i++)
#define ALL(x) (x).begin(),(x).end()
#define MAX(x) *max_element(ALL(x))
#define PB push_back
#define F first
#define S second

int main(){
    ll n, k; cin >> n >> k;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    
    rep(i, n-k){
        if(a[i] < a[i+k]) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 4784
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INTINF = 1<<29;
const ll LLINF = 1LL<<61;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int DX[8]={ 0, 1, 0,-1, 1, 1,-1,-1};
const int DY[8]={ 1, 0,-1, 0, 1,-1, 1,-1};

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int w,a,b;
  cin >> w >> a >> b;
  if (a>b)swap(a,b);
  cout << max(b-(a+w),0) << endl;
}


Measured memory_bytes: 256
//--------O&Oo&oO&O---------------

#include<bits/stdc++.h>
#define FAST_IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;

bool isPalindrome(string s)
{
	int l=0;
	int r=s.length()-1;
	while(l<r)
	{
		if(s[l]!=s[r])
			return false;
		l++;
		r--;
	}
	return true;
}

void SOLVE()
{
	
        string s;
        cin>>s;
        int l=s.size();
        string fstr="";
        string sstr="";
        int a=(l-1)/2,b=(l+3)/2;
        for(int i=0;i<l;i++)
        {
        	if(i>=0 && i<a)
        		fstr+=s[i];
        	if(i>=b-1 && i<l)
        		sstr+=s[i];
        }
        if(isPalindrome(s) && isPalindrome(fstr) && isPalindrome(sstr))
        	cout<<"Yes\n";
        else
        	cout<<"No\n";

}

int main()
{
	FAST_IO
	
	SOLVE();

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define dl double
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define mod 1000000007
#define P(a,b) pair<a,b>
#define CIN(V,s,n) for(int i=s;i<n;i++){cin >> V[i];}
#define COUT(V,s,n) for(int i=s;i<n;i++){cout <<  V[i] << " ";}

using namespace std;
bool sortBylen(string &a,string &b)
{
    if(a.size()>b.size())
        return true;
    else if(a.size()==b.size())
    {
        if(a>b)
        {
            return true;
        }
        else
            false;
    }
    else
        return false;
}

vector<vector<ll> > DP(3e3+1,vector<ll> (3e3+1,-1));

ll GT(vector<ll> &V,ll s,ll e,ll &n)
{
    if(s>e)
        return 0;
    if(s==e-1)
        return max(V[s],V[e]);
    if(s==e)
        return V[s];
    if(DP[s+2][e]==-1)
        DP[s+2][e] = GT(V,s+2,e,n);
    if(DP[s+1][e-1]==-1)
        DP[s+1][e-1] = GT(V,s+1,e-1,n);
    if(DP[s][e-2]==-1)
        DP[s][e-2]=GT(V,s,e-2,n);

    return max(V[s]+min(DP[s+2][e],DP[s+1][e-1]),V[e]+ min(DP[s+1][e-1],DP[s][e-2]));
}

int main()
{
ll t=1;
//cin >> t;
while(t--)
{
    ll n,W,i,j,k=2,l1,l2,m;
    ll r,c;
    cin >> n;
    ll ans=0;
    vector<ll> V(n);
    for(i=0;i<n;i++)
    {
        cin >> V[i];
        ans += V[i];
    }

    cout << (2LL*GT(V,0,n-1,n) - ans );
}
	return 0;
}


Measured memory_bytes: 70784
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <cctype>
#include <unordered_map>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i<n; i++)
#define rep_s(i, start, n) for(int i= start;  i<n; i++)
#define rep_down(i, n) for(int i = n-1; i>=0; i--)
#define rep_down_s(i, n, start) for(int i = n-1; i>=start; i--)
#define ALL(a) (a).begin(), (a).end()
#define ALL_str(a) (a).cbegin(), (a).cend()

string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";
string numbers = "0123456789";
/*
for (iterator = hash.begin(); iterator != hash.end(); iterator++)
{
// ここで、要素毎の操作を行います。
std::pair<std::string, CMyClass> element = *iterator;

}
*/
/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int keta_sum(int num){
  int dig, sum = 0;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}

ll binary_search(ll left_key, ll border, ll low, ll high) {
     // 配列 a の左端と右端
    ll mid = (low+high)/2;
    while (high > low+1) {
       mid = (low+high)/2;
        if (left_key*mid>border) high = mid;
        else if (left_key*mid<border) low = mid;
        else {
          mid =mid-1;
          break;
        }
    }
    return mid;
}

bool IsPrime(ll a){
  ll b = sqrt(a);
  b++;
  while(b-->=2){
    if (a%b==0) return false;
  }
  return true;
}

ll gcd(ll a, ll b){
  ll tmp;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }

  ll r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(void){
  ll N, M, A, B, C, D, E, F, K,L, W, H, P, Q, R, X, Y;
  ll ans;
  string S, T;
  cin >>N;
  cin >> S >> T;
  rep(i, N){
    cout << S[i]<<T[i];
  }

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int i = 1;
		while(true){
			int x = sc.nextInt();
			if(x == 0) break;
			System.out.println("Case "+i+": "+x);
			i++;
		}
	}
}

Measured memory_bytes: 42084
using System;
using System.Linq;
namespace atcoder {
    class Program {
        static void Main () {
            var A = new ReadLine ();
            var B = A.String ();
            var cnt = 0;
            var cnt2 = 0;
            try {
                for (int i = 0; i < B.Length; i += 2) {
                    if (B[i] == 'h' && B[i + 1] == 'i') {
                        cnt += 1;
                    }
                    cnt2 += 1;
                }

                if (cnt2 == cnt) {
                    Console.WriteLine ("Yes");
                } else {
                    Console.WriteLine ("No");
                }
            } catch {
                Console.WriteLine ("No");
            }

        }
    }

    class ReadLine {
        public int Number () {
            int vs = int.Parse (Console.ReadLine ());
            return vs;
        }
        public int[] Int () {

            int[] vs = Console.ReadLine ().Split (' ').Select (int.Parse).ToArray ();
            return vs;
        }
        public string String () {

            string vs = Console.ReadLine ();
            return vs;
        }
    }
}

Measured memory_bytes: 13140
sx, sy, tx, ty = list(map(int, input().split(" ")))

dx = tx - sx
dy = ty - sy
ans = 'R'*dx + 'U'*dy 
ans += 'L'*dx + 'D'*dy 
ans += 'L' + 'U'*(dy+1) + 'R'*(dx+1) + 'D'
ans += 'R' + 'D'*(dy+1) + 'L'*(dx+1) + 'U'

print(ans)

Measured memory_bytes: 9132
# coding: utf-8


class BinaryIndexedTree(object):
    def __init__(self, N):
        self.N = N
        self.tree = [0] * (N + 1)

    def add(self, a, w):
        x = a
        while x <= self.N:
            self.tree[x] += w
            x += (x & -x)

    def sum(self, a):
        if a == 0:
            return 0
        s = 0
        x = a
        while x > 0:
            s += self.tree[x]
            x -= (x & -x)
        return s


def main():
    N, Q = map(int, input().split(" "))
    bit = BinaryIndexedTree(N)
    for i in range(Q):
        c, x, y = map(int, input().split(" "))
        if c == 0:
            bit.add(x, y)
            # print(bit.tree)
        elif c == 1:
            print(bit.sum(y) - bit.sum(x-1))



if __name__ == "__main__":
    main()

Measured memory_bytes: 9876
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double PI = acos(-1);

const int MX = 200010;
int bit[MX];
void add(int i, int x){
	for(i++; i < MX; i += i & -i) bit[i] = max(bit[i], x);
}
int sum(int i){
	int res = 0;
	for(i++; i; i -= i & -i) res = max(res, bit[i]);
	return res;
}

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	bool neg = 0;
	int x1, y1, x2, y2, n;
	cin >> x1 >> y1 >> x2 >> y2 >> n;
	if(x1 > x2){
		swap(x1, x2);
		swap(y1, y2);
	}
	if(y1 > y2) neg = 1;
	
	vector<pi> v;
	vi xs = {x1, x2};
	rep(i, n){
		int x, y; cin >> x >> y;
		if(x1 <= x && x <= x2 && (y1 <= y && y <= y2 || y2 <= y && y <= y1)){
			if(neg) y *= -1;
			v.emplace_back(y, x);
			xs.pb(x);
		}
	}
	sort(all(v));
	sort(all(xs)); xs.erase(unique(all(xs)), xs.end());
	int ans = 0;
	for(pi p : v){
		int x = lower_bound(all(xs), p.second) - xs.begin();
		int m = sum(x) + 1;
		ans = max(ans, m);
		add(x, m);
	}
	
	double dist = (abs(y2 - y1) + x2 - x1) * 100.0;
	double shortcut = 5 * PI - 20;
	dist += ans * shortcut;
	
	if(ans >= min(x2 - x1, abs(y2 - y1)) + 1) dist += 5 * PI;
	printf("%.20f\n", dist);
	
	return 0;
}

Measured memory_bytes: 3560
#include <iostream>
    #include <fstream>
    #include <vector>
    #include <stack>
    #include <queue>
    #include <cstring>
    #include <cmath>
    #include <cstdlib>
    #include <cstdio>
    #include <algorithm>
    #include <unordered_map>
    #include <unordered_set>
    #include <map>
    #include <set>
     
    using namespace std;
     
    typedef long long ll;
    typedef pair<int,int> PP;
     
    /*
        freopen("input","r",stdin);
        freopen("output","w",stdout);
    */
     
    int N;
     
    void make(string &s) {
    	int n = N - 1;
    	while (s[n] == '9') n--;
    	s[n]++;
    	for (int i = n + 1;i < N;i++) s[i] = '0';
    	return;
    }
     
    int main() {
        ios::sync_with_stdio(false);
        string s;
        cin >> s;
        N = s.size();
        char pre = s[0];
        int res = 1;
        int p = 0; // Till this digit can be eliminated.
        for (int i = 1;i < N;i++) {
        	char crt = s[i];
        	if (pre == crt) {
        		// p is not changed.
        	}
        	else if (pre < crt) {
        		p = i; // 
        		pre = crt;
        	}
        	else {
        		// Eliminate till p.
        		make(s);
        		p++;
        		i--;
        		pre = s[p];
        		res++;
        	}
        }
        cout << res << endl;
        return 0;
    }

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

int lcs(string X, string Y){
    int C[1001][1001];
    int m = X.size();
    int n = Y.size();
    int maxl = 0;
    X = ' ' + X;
    Y = ' ' + Y;
    for(int i=0; i<=m; i++) C[i][0] = 0;
    for(int i=0; i<=n; i++) C[0][i] = 0;

    for(int i=1; i<=m; i++){
        for(int j=1; j<=n; j++){
            if(X[i]==Y[j]){
                C[i][j] = C[i-1][j-1] + 1;
            }else{
                C[i][j] = max(C[i-1][j], C[i][j-1]);
            }
            maxl = max(maxl, C[i][j]);
        }
    } 
    return maxl;
}

int main(){

    string s1, s2;
    int n;
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> s1 >> s2;
        cout << lcs(s1, s2) << endl;
    }
    return 0;
}


Measured memory_bytes: 7052