akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
                import java.util.ArrayList;
                import java.util.Collections;
            	import java.util.Arrays;
                 
                public class Main { //クラス名はMain
                    public static void main(String[] args) {
                        //コード
                      Scanner sc = new Scanner(System.in);
                      String c1 = sc.nextLine();
            		  String[] strArray1 = c1.split(" ");
                      boolean b1 = false;		//フラグ
                      //文字列リテラル　→　整数変換
                      Integer[] x = new Integer[strArray1.length];
                		for (int i = 0; i < strArray1.length; i++) {
                    	x[i] = Integer.parseInt(strArray1[i]);
                		}
                      Arrays.sort(x);
                      int syoukin = 0;  //賞金
                      //追加賞金フラグ
                      if (x[0] == 1 && x[1] == 1){
               b1 = true;
              }
              else{
                b1 = false;
              }
                      switch (x[0]) {
        case 1:
            syoukin = syoukin +  300000 ;
            break;
        case 2:
            syoukin = syoukin +  200000 ;
            break;
        case 3:
            syoukin = syoukin +  100000 ;
            break;
      }
                      switch (x[1]){
                case 1:
            syoukin = syoukin +  300000 ;
            break;
        case 2:
            syoukin = syoukin +  200000 ;
            break;
        case 3:
            syoukin = syoukin +  100000 ;
            break;
      }
                      
                      
                      //追加賞金判定
                      
               if (b1 == true){
               System.out.println(syoukin +  400000);
              }
              else{
                System.out.println(syoukin);
              }
                }
                }

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

const int MAXN = 1000 * 1000 + 10;

int n;
int hight[MAXN];
long long dp[MAXN];


int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    //cout << fixed << setprecision(10);

    cin >> n;
    cin >> hight[0];
    dp[0] = 0;

    cin >> hight[1];
    dp[1] = hight[0] > hight[1] ? hight[0] - hight[1] : hight[1] - hight[0];

    for(int i = 2; i < n; i++){
        cin >> hight[i];
        int diff = hight[i] > hight[i - 1] ? hight[i] - hight[i - 1] : hight[i - 1] - hight[i];
        dp[i] = diff + dp[i - 1];
        diff = hight[i] > hight[i - 2] ? hight[i] - hight[i - 2] : hight[i - 2] - hight[i];

        dp[i] = min(dp[i], diff + dp[i - 2]);
    }

    cout << dp[n - 1] << endl;

    return 0;
}



Measured memory_bytes: 4740
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
char a[105];
int i=0;
char *j;
gets(a);
j=a;
while(*j!='\0')
{
j++;
i++;
}
int sum=0;
for(int i=0;i<strlen(a)/2;i++){
	if(a[i]!=a[strlen(a)-1-i]){
		sum++;
	}
}
printf("%d",sum);
return 0;
}



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

#define rep(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define rng(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define rbf(i, v) for (auto& (i) : (v))
#define All(x) (x).begin(),(x).end()
#define COL(x) cout << x << endl
#define CO(x) cout << x
//#define int long long

using LL = long long;
using UL = unsigned long;
using ULL = unsigned long long;
using PII = pair<int, int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using VP = vector<PII>;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const LL INF64 = INT64_MAX >> 1;
const int INF = INT_MAX >> 1;

template<typename T> inline T sqr(T x) { return (x * x); }
inline void printd(double x) { printf("%.10lf\n", x); }
inline void upsort(VI& x) { sort((x).begin(), (x).end()); }
inline void downsort(VI& x) { sort((x).begin(), (x).end(), greater<int>()); }
inline int absdiff(int a, int b) { return (a - b) * (static_cast<int>(a > b)*2 - 1); }
int gcd(int a, int b) { // 最大公約数
	if (a < b) return gcd(b, a);
	int r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
inline int lcm(int a, int b) { return a * b / gcd(a, b); } // 最小公倍数
#pragma endregion

signed main()
{
	int N;
	cin >> N;
	VLL A(N);
	rbf(a, A) {
		cin >> a;
	}
	sort(All(A));
	LL ans = 1, prev = 0;
	const LL lim = static_cast<LL>(1E18);

	rbf(a, A) {
		ans *= a;
		if (ans > lim) {
			ans = -1;
			break;
		}
		if (ans < prev) {
			ans = -1;
			break;
		}
		prev = ans;
	}
	COL(ans);
	return 0;
}

Measured memory_bytes: 3964
#include "bits/stdc++.h"
typedef long long ll;
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> l(n);
    for (int i = 0; i < n; ++i) cin >> l[i];
    sort(l.begin(), l.end());

    int sum = 0;
    for (int i = 0; i < n - 1; ++i) {
        sum += l[i];
    }

    if (l[n-1] < sum) cout << "Yes";
    else cout << "No";

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
typedef unsigned long long ul;
int n, m;
string s;
int c[3000];
ll dp[3001][3001];
int v[3000];
int main() {
	cin >> n >> m >> s;
	rep(i, n) {
		if (i > 0)c[i] = c[i - 1];
		if (s[i] == '1')c[i]++;
	}
	int ri = 0;
	rep(i, n) {
		v[i] = i;
	}
	rep(i, m) {
		int l, r; cin >> l >> r; l--; r--;
		v[l] = max(v[l], r);
	}
	dp[0][0] = 1;
	rep(i, n) {
			rep(j, i-1 - ri + c[ri]) {
				dp[i][j] = 0;
			}
			Rep(j, c[ri] + 1, i + 1) {
				dp[i][j] = 0;
			}
		ri = max(ri, v[i]);
		rep(j, i+1) {
			(dp[i + 1][j + 1] += dp[i][j]) %= mod;
			(dp[i + 1][j] += dp[i][j]) %= mod;
		}
		/*rep(j, i + 1) {
			cout << i << " " << j << " " << dp[i][j] << endl;
		}*/
	}
	cout << dp[n][c[n-1]] << endl;
	//stop
	return 0;
}


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

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

    if(a == b) cout << c << endl;
    if(b == c) cout << a << endl;
    if(c == a) cout << b << endl;
 }

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int a,d,n;
	while(cin>>a>>d>>n,n){
		int cnt=0,f;
		while(1){
			f=0;
			for(int i=2;i*i<=a;i++){
				if(a%i==0){
					f=1;
					break;
				}
			}
			if(f==0 && a!=1){
				cnt++;
			}
			if(cnt==n){
				cout<<a<<endl;;
				break;
			}
			a+=d;
		}
	}
	return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<stack>

#include<string>
#include<map>
using namespace std;

int main(){
  int N,Q;
  string eraname;
  int basedy,westy;
  while(cin >> N >> Q && (N!=0 || Q!=0)){
    string nams[10010];
    int begin[N],end[N];
    for(int i=0;i<N;i++){
      cin >> eraname >> basedy >> westy;
      nams[i]=eraname;
      begin[i]=westy-basedy;
      end[i]=westy;
    }
    for(int i=0;i<Q;i++){
      cin >> westy;
      for(int j=0;j<N;j++){
	if(westy > begin[j] && westy <=end[j]){
	  cout << nams[j] << ' ' << westy-begin[j] <<endl;
	  break;
	}
	if(j==N-1){
	  cout << "Unknown" << endl;
	}
      }
    }
  }

}

Measured memory_bytes: 1348
#!/usr/bin/env python3
import sys
import numpy as np


def solve(A: int, B: int, C: int, K: int):
    if K<=A:
        print(K)
        return
    elif K<=A+B:
        print(A)
        return
    elif K<=A+B+C:
        print(A-(K-A-B))
        return
    else:
        print(A-C)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(A, B, C, K)

if __name__ == '__main__':
    main()


Measured memory_bytes: 27144
void main()
{
    int[] tmp = readln.split.to!(int[]);
    int n = tmp[0], m = tmp[1];

    int[][] services = new int[][](n);
    foreach (i; 0 .. m)
    {
        tmp = readln.split.to!(int[]);
        int a = tmp[0] - 1, b = tmp[1] - 1;
        services[a] ~= b;
        services[b] ~= a;
    }

    bool ok;
    foreach (x; services[0])
    {
        foreach (y; services[x])
        {
            if (y == n - 1)
            {
                ok = true;
            }
        }
    }

    writeln(ok ? "POSSIBLE" : "IMPOSSIBLE");
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

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

LL fac[SIZE], finv[SIZE], inv[SIZE];
void combInit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for( int i = 2; i < SIZE; ++i ) {
        fac[i] = (fac[i - 1] * i) % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = (finv[i - 1] * inv[i]) % MOD;

    }
}

LL comb(int n, int k) {
    if( n < k ) return 0;
    if( n < 0 || k < 0 ) return 0;
    return (fac[n] * (finv[k] * finv[n - k] % MOD)) % MOD;

}

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

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

    string s, t;
    cin >> s >> t;
    cout << t << s << endl;

    return 0;
}



Measured memory_bytes: 256
import Foundation

let input = readLine()!
let array = input.components(separatedBy: " ")
let X = Int(array[0])!
let Y = Int(array[1])!

if Y % 2 == 1 {
    print("No")
}else if 0 <= (Y - 2 * X) / 2 && (Y - 2 * X) / 2 <= X {
    print("Yes")
} else {
    print("No")
}

Measured memory_bytes: 14064
#include <iostream>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <algorithm>
#include <functional>
#include <cstring>
#include <limits.h>
#define FOR(i,k,n)  for (int i=(k); i<(int)(n); ++i)
#define REP(i,n)    FOR(i,0,n)
#define FORIT(i,c)	for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define SZ(i) ((int)i.size())
#define pb          push_back
#define mp          make_pair
#define mt          make_tuple
#define get0(x)     (get<0>(x))
#define get1(x)     (get<1>(x))
#define get2(x)     (get<2>(x))
#define ALL(X)      (X).begin(),(X).end()
#define LLMAX       9223372036854775807LL
#define LLMIN       -9223372036854775808LL
#define IMAX        2147483647
#define IMIN        -2147483648
typedef long long LL;
using namespace std;

int main(void){
    int N;
    vector<int> p;
    cin>>N;
    REP(i,N){
        int a;cin>>a;p.pb(a);
    }
    int ans=0;
    REP(i,N-1){
        if(p[i]==i+1){
            swap(p[i],p[i+1]);
            ans++;
        }
    }
    if(p[N-1]==N)
        ans++;
    cout<<ans<<endl;
     return 0;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<static_cast<int>(n);++i)
#define per(i, n) for(int i=static_cast<int>(n)-1;i>=0;--i)
#define eee(a) (cerr<<"[@"<<__LINE__<<"] "<<(#a)<<": "<<(a)<<'\n');
#define ppp(a) (cout<<(a)<<'\n'); 
#define cop(a) for(auto x:(a)){cerr<<(x)<<'\n';}
using ll = long long;
constexpr int dx[4]={1,0,-1,0};
constexpr int dy[4]={0,1,0,-1};
constexpr ll MOD = 1e9+7;
constexpr ll Mod = 998244353;
constexpr int INF = 1e9;
constexpr ll LINF = 1e18;
constexpr double phi = (1+sqrt(5))/2;
constexpr double pi = 3.14159265358979323846264338327950288;
inline ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline ll inverse(ll n,ll m=MOD){ll a=n,b=m,x=1,y=0;while(b){ll t=a/b;a-=t*b;swap(a,b);x-=t*y;swap(x,y);}return (a%m+m)%m;}
inline void Yes(){puts("Yes");}
inline void No(){puts("No");}
inline void Judge(bool b){b?Yes():No();}
inline void YES(){puts("YES");}
inline void NO(){puts("NO");}
inline void JUDGE(bool b){b?YES():NO();}
inline ll powmod(ll b, ll e, ll m=MOD){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
inline double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));}
inline double d2r(double d){return d*pi/180;}
inline double r2d(double r){return r*180/pi;}
template<class T>inline bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(b<a){a=b;return 1;}return 0;}
template<typename T>inline int bs(int g,int k,T c){while(abs(k-g)>1){int m=(g+k)/2;(c(m)?k:g)=m;}return k;}
template<typename T1,typename T2>ostream& operator<<(ostream& s,const pair<T1, T2>& p){return s <<"("<<p.first<<", "<<p.second<<")";}
template<typename T> ostream& operator<<(ostream& s,const vector<T>& v){s<<'[';for(size_t i=0;i<v.size();++i){s<<v[i];if(i<v.size()-1)s<<", ";}s<<']';return s;}
template<typename T> istream& operator>>(istream& s,vector<T>& v){for(T& x:v)s>>x;return s;}



int dp[100010][3];


int main(){
    cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);
    
    int n;
    cin >> n;
    vector<int> a(n), b(n), c(n);
    for(int i = 0; i < n; ++i){
        cin >> a[i] >> b[i] >> c[i];
    }

    for(int i = 0; i < n; ++i){
        dp[i+1][0] = max(dp[i][1], dp[i][2]) + a[i];
        dp[i+1][1] = max(dp[i][0], dp[i][2]) + b[i];
        dp[i+1][2] = max(dp[i][0], dp[i][1]) + c[i];
    }
    cout << max({dp[n][0], dp[n][1], dp[n][2]}) << '\n';

    return 0;
}


Measured memory_bytes: 2560
#include <cstdio>
#include <iostream>
#include <cstring>
#include <cmath>
#include <climits>
#include <cstdlib>


#define LEN   150

char room[LEN][LEN];
int flag[LEN][LEN];
int w,h;
int ret = 0;
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};


int dfs(int x,int y,char c)
{
  if( (x >= 0 && x < w) &&  (  y >= 0 && y < h ))
    {
      if( room[y][x] == c  &&  flag[y][x] == 0 )
        {
          flag[y][x] = ret;
          for(int i = 0 ; i < 4 ; i++)
            dfs(x+dx[i],y+dy[i],c);
        }
    }
  return 0;
}

int main(int arc,char* argv[])
{
  //freopen("in.txt","r",stdin);

  while(std::cin >> h >> w)
    {
      std::cin.get();
      //std::cin.get();
      //std::cout<<w<<" "<<h<<std::endl;
      if(w==0 &&  h==0) break;
      ret = 0;
      for(int i = 0 ; i < h ; i++)
        std::cin.getline(room[i],LEN);
      memset(flag,0,sizeof(flag));

      for(int i = 0 ; i < h ; i++)
        {
          for(int j = 0 ; j < w ; j++)
            {
              if(flag[i][j] == 0)
                {
                  ret = ret + 1;
                  dfs(j,i,room[i][j]);
                }
            }
        }
      //dfs(w0,h0);

     //for(int i = 0 ; i < h ; i++)
     //   {
     //     for(int j = 0 ; j < w ; j++)
     //       {
     //         std::cout<<flag[i][j];
     //       }
     //     std::cout<<std::endl;
     //   }

      std::cout<<ret<<std::endl;
    }
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define show(x) for(auto i: x){cout << i << " ";}
#define showm(m) for(auto i: m){cout << m.x << " ";}
typedef long long ll;
typedef pair<string, int> P;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}


int main()
{
    int n;
    cin >> n;
    vector<string> s;
    rep(i, n){ string tmp; cin >> tmp; s.push_back(tmp);}

    //O(nlogn)
    sort(s.begin(), s.end());

    // show(s);
    // cout << endl << endl;
    //O(n)
    int maxcnt = 0;
    int cnt = 1;
    vector<P> ans;
    rep(i, n-1){
        if (s[i] == s[i+1]){
            cnt++;
        } else {
            ans.emplace_back(s[i], cnt);
            cnt = 1;
        }
        maxcnt = max(maxcnt, cnt);
    }
    ans.emplace_back(s[n-1], cnt);

    rep(i, ans.size()){
        if (ans[i].second == maxcnt){
            cout << ans[i].first << endl;
        }
    }

}


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

int solve(int A[], int n, int minw) {
	int cnt = 0;
	int B[n], T[10001];
	bool V[n];
	for (int i = 0; i < n; i++) {
		B[i] = A[i];
		V[i] = false;
	}

	sort(B, B + n);
	for (int i = 0; i < n; i++) {
		T[B[i]] = i; //?????????????????????????????§?????????????????????????????????????????????
	}
	for (int i = 0; i < n; i++)	{
		if (V[i]) continue;
		int cur = i, S = 0, m = 10000, an = 0;
		while(1) {
			V[cur] = true; //????????????
			an++; //?°???°?????????????????°
			int v = A[cur];
			m = min(m, v); //?°???°???????????????????°????
			S += v; //????????????
			cur = T[v]; //??¬??\??????????????\????????????
			if (V[cur]) break; //????????????????????????????????????
		}
		cnt += min(S + (an - 2) * m, S + m + (an + 1) * minw); //????????§????????????while????????§??£?¨?
	}
	return cnt;
}

int main() {
	int n;
	cin >> n;
	int A[n];
	int minw = 10000;
	for (int i = 0; i < n; i++)	{
		cin >> A[i];
		minw = min(minw, A[i]);
	}

	int min = solve(A, n, minw);

	cout << min << endl;

	return 0;
}

Measured memory_bytes: 1196
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define yes(n) cout << ((n) ? "yes" : "no"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;
#define FIX cout << fixed << setprecision(15)

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define VVi vector<vector<ll>>
#define Vd vector<double>
#define Vb vector<bool>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

template<class T> inline bool chmin(T& a, T b) {if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if(a<b){a=b;return true;}return false;}

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN2(a,b);
  YES(2*b-1 <= a);
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define EPS (1e-15)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define bet(x, a, b) (a) <= (x) && (x) < (b)
typedef long long ll;
typedef unsigned long long ull;

int main()
{
	int N, M;
	map<int, int> mp;
	bool ans = true;

	cin >> N;
	rep(i, N) {
		int D;
		cin >> D;
		if (mp.count(D) == 0) mp[D] = 1;
		else mp[D]++;
	}
	cin >> M;
	rep(i, M) {
		int T;
		cin >> T;
		if (mp.count(T) == 0) ans = false;
		else if (mp[T] == 0) ans = false;
		else mp[T]--;
	}

	cout << (ans ? "YES" : "NO") << endl;

	return 0;
}


Measured memory_bytes: 9600
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
const ll mod=1000000007;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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 (a>b) { a=b; return 1; } return 0; }
int main(){
while(1){
    int n;
    cin>>n;
    if(n==0)return 0;
    map<int,P> mp;
    ll u=-inf,d=inf,l=inf,r=-inf;
    mp[0]=P(0,0);
    for(int i=0;i<n-1;i++){
        int a,b;cin>>a>>b;
        P tmp=mp[a];
        if(b==0)tmp.fi--;
        if(b==1)tmp.se--;
        if(b==2)tmp.fi++;
        if(b==3) tmp.se++;
        mp[i+1]=tmp;
    }
    for(auto p:mp){
        chmax(u,p.se.se);
        chmin(d,p.se.se);
        chmin(l,p.se.fi);
        chmax(r,p.se.fi);
    }
    cout<<r-l+1<<" "<<u-d+1<<"\n";
}
}


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

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

	if (n <= k) {
		cout << n*x;
	}
	else {
		n = n-k;
		cout << k*x + n*y;
	}
}

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

#define ms multiset < int , greater <int> >
ms slime;
int p,n;

int prepare(){
    cin>>p;
    n=1<<p;
    for(int i=0;i<n;++i){
        int x;cin>>x;
        slime.insert(x);
    }
}

string solve(){
    vector < int > mot;// mothers
    mot.push_back(*slime.begin());
    slime.erase(slime.begin());
    while(!slime.empty()){
        vector < int > nxt;// new born slime
        for(int i=0;i<mot.size();++i){
            int mom=mot[i];
            ms :: iterator son = slime.upper_bound(mom);
            if(son==slime.end()){
                // since total time is p and total number is 2^p.
                // in this case I can say "No".
                return "No";
            }else{
                nxt.push_back(*son);
                slime.erase(son);
            }
        }
        mot.insert(mot.end(),nxt.begin(),nxt.end());
    }
    return "Yes";
}

int main(){
    prepare();
    cout<<solve()<<endl;
    return 0;
}

Measured memory_bytes: 13984
package main

import (
  "fmt"
  "sort"
  )

func main(){
  var a,b,c int
  fmt.Scan(&a,&b,&c)
  s := []int{a,b,c}
  // fmt.Println(s)
  sort.Ints(s)
  // fmt.Println(s)
  max := s[2]
  mid := s[1]
  min := s[0]

  result := 0
  if mid%2 == min%2{
    result += (mid-min)/2
    result += max - mid
  }else{
    max += 1
    min += 1
    result +=1
    result += (mid-min)/2
    result += max - mid
  }
  fmt.Println(result)
}


Measured memory_bytes: 512
n = int(input())
ans = 0
a =[-1]+ [int(input())for _ in range(n)]
visited = [0]*(n+1)

now = 1
while True :
    if visited[now] == 1:
        ans = -1
        break
    visited[now] = 1
    
    if a[now] == 2:
        ans +=1
        break
    ans+=1
    now = a[now]
print(ans)

    




Measured memory_bytes: 7852
# coding: utf-8

import sys
import math
import collections
import itertools
from inspect import currentframe
INF = 10 ** 10
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def MI() : return map(int, input().split())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def chkprint(*args) : names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}; print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))

N = I()
A = LI()

num = 1
ans = 0
for a in A:
    if a != num:
        ans += 1
    else:
        num += 1

print(-1 if ans == N else ans)


Measured memory_bytes: 77340
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <climits>
#include <cmath>
#include <stdio.h>
#include <utility>
using namespace std;
#define ll long long
int main()
{
   int a[3];
   for(int i=0;i<3;i++){
       cin>>a[i];
   }
   sort(a,a+3);
   if(a[0]+a[1]==a[2]){
       cout<<"Yes"<<endl;
   }else{
       cout<<"No"<<endl;   
   }
return 0;
}


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

int main(){
    ll A, B; cin >> A >> B;
    ll taxa, taxb;
    ll ans = -1;
    for(int n = 0; (double)n * 0.08 <= 100; n++){
        taxa = (ll)floor(n * 0.08);
        taxb = (ll)floor(n * 0.10);
        if(taxa == A && taxb == B){
            ans = n;
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

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

	N := int(math.Pow10(5))
	isPrime := make([]bool, N+1)
	for i := 2; i <= N; i++ {
		isPrime[i] = true
	}
	for i := 2; i <= N; i++ {
		if isPrime[i] {
			j := i * 2
			for j <= N {
				isPrime[j] = false
				j += i
			}
		}
	}

	rsum := make([]int, N+1)
	for i := 1; i <= N; i++ {
		if i%2 == 0 {
			rsum[i] = rsum[i-1]
		} else {
			if isPrime[i] && isPrime[(i+1)/2] {
				rsum[i] = rsum[i-1] + 1
			} else {
				rsum[i] = rsum[i-1]
			}
		}
	}

	Q := scanInt()
	for i := 0; i < Q; i++ {
		l, r := scanInt(), scanInt()
		fmt.Println(rsum[r] - rsum[l-1])
	}
}


Measured memory_bytes: 5196
#include<stdio.h>

#define ABMAX 2000000
#define CMAX 10000

long gn;
 
void countingSort( short A[], short B[], short k )
{
	long i,j;
	int C[CMAX+1];

	for( i=0; i<=k; i++ ) {
		C[i]=0;
	}
	for( j=1; j<=gn; j++ ) {
		C[ A[j] ]=C[ A[j] ]+1;
	}

	for( i=1; i<=k; i++ ) {
		C[i]=C[i]+C[ i-1 ];
	}

	for( j=gn; 0<j; j-- ) {
		B[ C[ A[j] ] ]=A[j];
		C[ A[j] ]=C[ A[j] ]-1;
	}

	return;
}


int main( void ) 
{	
	long i;
	short A[ABMAX+1];
	short B[ABMAX+1];
	short k;
		
    scanf( "%ld", &gn );
	k=0;
	for( i=1; i<=gn; i++ ) {
		scanf( "%hd", &A[i] );
		if( k < A[i] ) {
			k=A[i];
		}
	}
	countingSort( A, B, k );
	for( i=1; i<=gn; i++ ) {
		printf( "%hd", B[i] );
		if( i < gn ) {
			printf( " " );
		}
	}
	printf( "\n" );

    return 0;
}



Measured memory_bytes: 9616
///Bismillahir-Rahmanir-Rahim
#include <bits/stdc++.h>
#define        ll                              long long int
#define        FOR(x,y,z)                      for(int x=y;x<z;x++)
#define        pii                             pair<int,int>
#define        pll                             pair<ll,ll>
#define        CLR(a)                          memset(a,0,sizeof(a))
#define        SET(a)                          memset(a,-1,sizeof(a))
#define        N                               1000010
#define        M                               1000000007
#define        pi                              acos(-1.0)
#define        ff                              first
#define        ss                              second
#define        pb                              push_back
#define        inf                              (1e9)+1000
#define        eps                             1e-9
#define        ALL(x)                          x.begin(),x.end()
using namespace std;
int dx[]={0,0,1,-1,-1,-1,1,1};
int dy[]={1,-1,0,0,-1,1,1,-1};
template < class T> inline T biton(T n,T pos){return n |((T)1<<pos);}
template < class T> inline T bitoff(T n,T pos){return n & ~((T)1<<pos);}
template < class T> inline T ison(T n,T pos){return (bool)(n & ((T)1<<pos));}
template < class T> inline T gcd(T a, T b){while(b){a%=b;swap(a,b);}return a;}
template <typename T> string NumberToString ( T Number ) { ostringstream ss; ss << Number; return ss.str(); }
inline int nxt(){int aaa;scanf("%d",&aaa);return aaa;}
inline ll lxt(){ll aaa;scanf("%lld",&aaa);return aaa;}
inline double dxt(){double aaa;scanf("%lf",&aaa);return aaa;}
template <class T> inline T bigmod(T p,T e,T m){T ret = 1;
for(; e > 0; e >>= 1){
    if(e & 1) ret = (ret * p) % m;p = (p * p) % m;
} return (T)ret;}
#ifdef sayed
     #define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template < typename Arg1 >
    void __f(const char* name, Arg1&& arg1){
        cerr << name << " is " << arg1 << std::endl;
    }
    template < typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names+1, ',');
        cerr.write(names, comma - names) << " is " << arg1 <<" | ";
        __f(comma+1, args...);
    }
#else
    #define debug(...)
#endif
///******************************************START******************************************
int ar[N];
int main(){
    #ifdef sayed
    //freopen("out.txt","w",stdout);
    // freopen("in.txt","r",stdin);
    #endif
    //ios_base::sync_with_stdio(false);
    //cin.tie(0);

    int n = nxt();
    int k = nxt();
    cout<<n-k+1<<endl;
    return 0;
}


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

const ll MAX = 510000;
const ll MOD = 1000000007;

struct edge{
  ll u;
  ll v;
  ll cost;
};

class UnionFind{
public:
    //親の番号を格納する。親だった場合は-(その集合のサイズ)
    vector<ll> Parent;

    //作る時はParentの値を全て-1にする
    //こうするとずべてバラバラになる
    UnionFind(ll N){
      Parent = vector<ll>(N,-1);
    }

    //Aがどのグループに属しているのか調べる
    ll root(ll A){
      if(Parent[A]<0) return A;
      return Parent[A] = root(Parent[A]);
    }

    //自分のいるグループの頂点数を調べる
    ll size(ll A){
      return -Parent[root(A)];//親を取ってきたい
    }

    //AとBをくっつける
    bool connect(ll A,ll B){
      //AとBを直すつつなぐのではなく、root(A)にroot(B)をくっつける)
      A = root(A);
      B = root(B);
      if(A==B){
        //すでにくっついているからくっつけない
        return false;
      }
      //大きい方(A)に小さい方(B)をくっつけたい
      //大小が逆だったらひっくり返しちゃう
      if(size(A)<size(B)) swap(A,B);

      //Aのサイズを更新する
      Parent[A] += Parent[B];
      //Bの親をAに変更する
      Parent[B] = A;

      return true;
    }
  };


bool comp(const edge& e1,const edge& e2){
  return e1.cost < e2.cost;
}

edge es[MAX];
ll V , E;                  //頂点数と辺数
// 小さい順に閉路になっていなければ追加するという手法
ll kruskal(){
  sort(es, es + E, comp); //edge.costが小さい順にソートする
  UnionFind Uni(V);
  ll res = 0;
  for (ll i = 0; i < E; i++){
    edge e = es[i];
    if(Uni.root(e.u) != Uni.root(e.v)) {
      Uni.connect(e.u , e.v);
      res += e.cost;
    }
  }
  return res;
}

int main(){
  cin >> V;
  E = 2 * V - 2;
  // aは頂点番号　x軸　y軸　の順番
  vector<pair <P , ll> > a(V);
  vector<pair <P , ll> > b(V);
  rep(i,V){
    ll x, y; cin >> x >> y; x--; y--;
    a[i].sc = i; a[i].fi.fi = x; a[i].fi.sc = y;
    b[i].sc = i; b[i].fi.sc = x; b[i].fi.fi = y;
  }
  SORT(a); SORT(b);

  rep(i,V - 1){
    ll dx = abs(a[i + 1].fi.fi - a[i].fi.fi);
    ll dy = abs(b[i + 1].fi.fi - b[i].fi.fi);
    es[2 * i].u = a[i].sc; es[2 * i].v = a[i + 1].sc; es[2 * i].cost = dx;
    es[2 * i + 1].u = b[i].sc; es[2 * i + 1].v = b[i + 1].sc; es[2 * i + 1].cost = dy;
  }
  /*
  rep(i,E){
    cout << es[i].u << " " << es[i].v << " " << es[i].cost << endl;
  }
  */

  ll ans = kruskal();
  cout << ans << endl;
}


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

#define rep(i,x,y) for(int i=x,i##end=y;i<=i##end;++i)
#define _rep(i,x,y) for(int i=x,i##end=y;i>=i##end;--i)
#define ll long long
#define pk push_back
typedef std::pair<int,int> pii;
#define N 500005
int fa[N],sz[N],x[N],y[N],cpy[N],a[N],mp[N];
std::set<int> s;
int n;
inline int ancestor(int x){
	return fa[x]==x?x:fa[x]=ancestor(fa[x]);
}
inline void merge(int x,int y){
	x=ancestor(x),y=ancestor(y);
	if(x!=y) fa[x]=y,sz[y]+=sz[x];
}
int main(){
	std::ios::sync_with_stdio(0),std::cin.tie(0),std::cout.tie(0);
	std::cin>>n;
	rep(i,1,n) std::cin>>x[i]>>y[i],mp[x[i]]=y[i];
	rep(i,1,n) sz[i]=1,fa[i]=i;
	s.insert(mp[1]);
	rep(i,2,n){
		std::set<int>::iterator it=s.lower_bound(mp[i]);
		if(it==s.begin()){
			s.insert(mp[i]);
			continue;
		}
		int cnt=0;
		for(std::set<int>::iterator j=s.begin();j!=it;j++)
			cpy[++cnt]=*j;
		rep(j,1,cnt-1) merge(cpy[j+1],cpy[j]);
		merge(mp[i],cpy[1]),s.insert(cpy[1]);
	}
	rep(i,1,n) std::cout<<sz[ancestor(y[i])]<<'\n';
	return 0;
}

Measured memory_bytes: 12624
#include<iostream>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<functional>
using namespace std;
vector<int>x[1000000], B[1000000]; int a[300000], b[300000], l[1000000], r[1000000], X[1000000], Y[1000000], n, m;
map<pair<int, int>, int>M;
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>>Q;
map<pair<int, int>, int>used;
vector<pair<int, int>>Vec;
void add_edge() {
	for (int i = 1; i <= n; i++)sort(B[i].begin(), B[i].end());
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j < B[i].size(); j++) { Vec.push_back(make_pair(B[i][j], i)); }
	}
	sort(Vec.begin(), Vec.end()); for (int i = 0; i < Vec.size(); i++) { M[Vec[i]] = i + 1; X[i + 1] = Vec[i].first; Y[i + 1] = Vec[i].second; }
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j < B[i].size() - 1; j++) {
			x[M[make_pair(B[i][j], i)]].push_back(M[make_pair(B[i][j + 1], i)]);
		}
	}
	for (int i = 0; i < m; i++) {
		x[M[make_pair(a[i] * 2, b[i])]].push_back(M[make_pair(a[i] * 2 + 1, b[i] + 1)]);
		x[M[make_pair(a[i] * 2, b[i] + 1)]].push_back(M[make_pair(a[i] * 2 + 1, b[i])]);
	}
}
int main() {
	cin >> n >> m;
	for (int i = 1; i <= n; i++) { B[i].push_back(0); B[i].push_back(500000); }
	for (int i = 0; i < m; i++) {
		cin >> a[i] >> b[i];
		B[b[i]].push_back(a[i] * 2); B[b[i]].push_back(a[i] * 2 + 1);
		B[b[i] + 1].push_back(a[i] * 2); B[b[i] + 1].push_back(a[i] * 2 + 1);
	}
	add_edge();
	for (int i = 0; i < 1000000; i++) { l[i] = 1000000; r[i] = 0; }
	for (int i = 1; i <= n; i++) { Q.push(make_pair(0, M[make_pair(0, i)])); l[M[make_pair(0, i)]] = i; r[M[make_pair(0, i)]] = i; }
	while (!Q.empty()) {
		int a1 = Q.top().second; Q.pop();
		for (int i = 0; i < x[a1].size(); i++) {
			if (X[a1] >= X[x[a1][i]] || used[make_pair(a1, x[a1][i])] == 1)continue;
			Q.push(make_pair(X[x[a1][i]], x[a1][i])); used[make_pair(a1, x[a1][i])] = 1;
			l[x[a1][i]] = min(l[x[a1][i]], min(l[a1], Y[x[a1][i]]));
			r[x[a1][i]] = max(r[x[a1][i]], max(r[a1], Y[x[a1][i]]));
		}
	}
	for (int i = 1; i <= n; i++) { 
		if (i >= 2)cout << ' '; 
		cout << r[M[make_pair(500000, i)]] - l[M[make_pair(500000, i)]] + 1;
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 198560
use proconio::input;
use proconio::marker::{Usize1};

#[allow(dead_code)]
fn type_of<T>(_: T) -> &'static str {
    std::any::type_name::<T>()
}

trait Monoid {
    fn unit() -> Self;
    fn func(self, e: Self) -> Self;
}

struct SegmentTree<T>{
    size: usize,
    data: Vec<T>,
}

impl<T> SegmentTree<T>
where T: std::fmt::Debug
{
    #[allow(dead_code)]
    pub fn dump(&self) -> () {
        eprintln!("{:?}", self.data);
    }
}

impl<T> SegmentTree<T>
where T: Monoid + Clone
{
    pub fn new(size: usize) -> Self {
        SegmentTree{
            size,
            data: vec![T::unit(); 2*size],
        }
    }
}

impl<T> SegmentTree<T>
where T: Monoid + Copy
{
    pub fn update(&mut self, idx: usize, e: T) {
        let mut idx = idx + self.size;
        while idx > 0 {
            self.data[idx] = self.data[idx].func(e);
            idx >>= 1;
        }
    }

    pub fn query(&self, l: usize, r: usize) -> Result<T, &'static str> {
        if r <= l { Err("l < r") }
        else {
            let mut ret = T::unit();
            let mut l = l + self.size;
            let mut r = r + self.size;
            while l < r {
                if l & 1 == 1 { ret = self.data[l].func(ret); l += 1;}
                if r & 1 == 1 { ret = ret.func(self.data[r-1]); r -= 1;}
                l >>= 1;
                r >>= 1;
            }
            Ok(ret)
        }
    }
}

impl Monoid for isize {
    fn unit() -> Self {
        0isize
    }

    fn func(self, e: Self) -> Self {
        self + e
    }
}

fn main() {
    input!{
        n: usize,
        q: usize,
        c: [Usize1; n],
        d: [(Usize1, Usize1); q],
    }

    let mut st = SegmentTree::<isize>::new(n);
    let mut mr = vec![None; n];
    let mut d = d.iter().enumerate().collect::<Vec<_>>();    
    d.sort_by(|&(_, (_, r)), &(_, (_, ro))| r.cmp(&ro));
    let mut mridx = 0usize;
    let mut ans = vec![0isize; q];
    for (idx, &(l, r)) in d {
        while mridx <= r {
            let nc = c[mridx];
            if let Some(pidx) = mr[nc] {
                st.update(pidx, -1);
            }
            mr[nc] = Some(mridx);
            st.update(mridx, 1);
            mridx += 1;
        }
        //eprintln!("case {}: [l, r) = [{}, {})", idx, l, r+1);
        //st.dump();
        ans[idx] = st.query(l, r+1).unwrap();
        //eprintln!("ans: {}", ans[idx]);
    }
    for i in ans {
        println!("{}", i);
    }

}


Measured memory_bytes: 51024
#include <iostream>
using namespace std;
typedef unsigned long long u64;

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  string o, e;
  cin >> o >> e;
  int d=0;
  string password="";
  while (d < o.size()) {
    password+=o[d];
    if (d < e.size()) {
      password+=e[d];
    }
    d++;
  }
  cout << password << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
#include<queue>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

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

int N;
double x,y,ans,sum=1;
vector<int> a;
vector<pair<double,double>> v;

int main(){
    cin>>N;
    rep(i,N){
        cin>>x>>y;
        v.push_back({x,y});
        a.push_back(i);
        sum*=(i+1);
    }
    do{
        rep(i,N-1){
            ans+=sqrt((v[a[i]].first-v[a[i+1]].first)*(v[a[i]].first-v[a[i+1]].first)+(v[a[i]].second-v[a[i+1]].second)*(v[a[i]].second-v[a[i+1]].second));
        }
    }while(next_permutation(ALL(a)));
    printf("%.12f\n",ans/sum);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
template <typename T> using vec = vector<T>;

int main()
{
    int n;
    cin >> n;
    char c;
    char d;
    cin >> c;
    d = c;
    int count = 1;
    while (cin >> c)
    {
        if (d != c)
        {
            count++;
        }
        d = c;
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
string S;
int main(){
    cin>>S;
    if(S=="RRR")cout<<3<<endl;
    else if(S=="RRS"||S=="SRR")cout<<2<<endl;
    else if(S=="RSS"||S=="SRS"||S=="SSR"||S=="RSR")cout<<1<<endl;
    else cout<<0<<endl;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	string s;
	cin>>s;
	if(s[2]==s[3]&&s[4]==s[5])
	{
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int n;
	scanf("%d", &n);
	int i;
	long long int p = 1000000007;
	long long int dp[102][4][4][4][4];
	int j, k, l, m, q;
	if (n == 3)
	{
		printf("61\n");
		return 0;
 
	}
	for (j = 0; j < 4; j++)
		for (k = 0; k < 4; k++)
			for (l = 0; l < 4; l++)
				for (m = 0; m < 4; m++)
					dp[4][j][k][l][m] = 1;
	for (j = 0; j < 4; j++)
	{
		dp[4][j][0][2][1] = 0;
		dp[4][j][2][0][1] = 0;
		dp[4][j][0][1][2] = 0;
		dp[4][0][j][2][1] = 0;
		dp[4][0][2][j][1] = 0;
		dp[4][0][2][1][j] = 0;
		dp[4][2][0][1][j] = 0;
		dp[4][0][1][2][j] = 0;
	}
	for (i = 4; i < n; i++)
	{
		for (j = 0; j < 4; j++)
			for (k = 0; k < 4; k++)
				for (l = 0; l < 4; l++)
					for (m = 0; m < 4; m++)
						dp[i + 1][j][k][l][m] = 0;
		for (j = 0; j < 4; j++)
			for (k = 0; k < 4; k++)
				for (l = 0; l < 4; l++)
					for (m = 0; m < 4; m++)
						for (q = 0; q < 4; q++)
							dp[i + 1][j][k][l][m] += dp[i][q][j][k][l];
		for (j = 0; j < 4; j++)
		{
			dp[i + 1][j][0][2][1] = 0;
			dp[i + 1][j][2][0][1] = 0;
			dp[i + 1][j][0][1][2] = 0;
			dp[i + 1][0][j][2][1] = 0;
			dp[i + 1][0][2][j][1] = 0;
		}
		for (j = 0; j < 4; j++)
			for (k = 0; k < 4; k++)
				for (l = 0; l < 4; l++)
					for (m = 0; m < 4; m++)
						dp[i + 1][j][k][l][m] %= p;
	}
	long long int ans = 0;
	for (j = 0; j < 4; j++)
		for (k = 0; k < 4; k++)
			for (l = 0; l < 4; l++)
				for (m = 0; m < 4; m++)
					ans = (ans + dp[n][j][k][l][m]) % p;
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			char[] s = Console.ReadLine().ToCharArray();
			char[] t = Console.ReadLine().ToCharArray();

			int cntMax = 0;

			for (int i = 0; i <= s.Length - t.Length; i++)
			{
				int cnt = 0;

				for (int j = 0; j < t.Length; j++)
				{
					if (s[i + j].Equals(t[j]))
					{
						cnt++;
					}
				}

				if (cnt > cntMax) cntMax = cnt;
			}

			Console.WriteLine(t.Length - cntMax);
		}

	}

}


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


int main(void) {
  int n, i;
  int pn[200000];
  char str_n[7];
  char str_pn[7];
  int min=200000;
  int ans=0;
  
  scanf("%s", str_n);
  n = atoi(str_n);
  for (i=0; i<n; i++) {
    scanf("%s", str_pn);
	pn[i] = atoi(str_pn);
  }
  
  for(i=0; i<n; i++) {
	if(min >= pn[i]) {
      min = pn[i];
      ans += 1;
    }
  }
  
  printf("%d", ans);
  return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstdint>
using namespace std;

#define REP(i,n) for (int i = 0; i < n; i++)
typedef long long ll;



int main () {

    int N; cin >> N;
    string S1,S2;
    cin >> S1 >> S2;

    ll ans = 1;
    const ll MOD = 1000000007;

    int pos = 0;
    bool prev = false;
    while (pos < N) {
        if (S1[pos] == S2[pos]) {
            if (pos == 0) {
                ans *= 3;
            } else {
                if (prev) {
                    ans *= 1;
                } else {
                    ans *= 2;
                }
            }
            prev = false;
            pos += 1;
        } else {
            if (pos == 0) {
                ans *= 6;
            } else {
                if (prev) {
                    ans *= 3;
                } else {
                    ans *= 2;
                }
            }
            prev = true;
            pos += 2;
        }
        ans %= MOD;
    }
 
    cout << ans << endl;

    return 0;
}


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

int main() {
	int n;
	cin >> n;
	vector<int> a(n), b;
	rep(i, n) cin >> a[i];
	b = a;
	sort(all(a));
	reverse(all(a));
	int mx1 = a[0];
	int mx2 = a[1];
	rep(i, n) {
		if(b[i] == mx1) cout << mx2 << endl;
		else cout << mx1 << endl;
	}
	return 0;
}

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

//#define int long long
typedef long long ll;
//const int INF = 2e9;
//const ll INF = 9e18;

vector<vector<int>> to;
vector<int> dp;
int dfs(int v){
    if (dp[v] != -1) return dp[v];

    int res = 0;
    for (auto u : to[v]){
        res = max(res,dfs(u)+1);
    }
    return dp[v] = res;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, M;
    cin >> N >> M;
    to = vector<vector<int>>(N);
    for (int i=0;i<M;i++){
        int x, y;
        cin >> x >> y;
        x--;y--;
        to[x].push_back(y);
    }
    dp = vector<int>(N,-1);
    for (int i=0;i<N;i++) {
        if (dp[i] == -1) dfs(i);
    }
    int ans = 0;
    for (int i=0;i<N;i++){
        ans = max(ans, dp[i]);
    }
    cout << ans << "\n";
}

Measured memory_bytes: 10972
#include<iostream>
#include<set>
#include<map>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long li;
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define yn(i) print((i)?"Yes":"No")
#define rep(i,n) for(int i=0;i<(n);i++)

#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }
// pair 型
template<class S,class T>
std::ostream& operator<<(std::ostream& os, const pair<T,S>& p){
  cout << "(" << p.first << "," << p.second << ")";
  return os;
}

// Container コンテナ型, map以外
template< template<class ...> class Ctn,class T>
std::ostream& operator<<(std::ostream& os,const Ctn<T>& v){
  auto itr=v.begin();
  while(itr!=v.end()){
    if(itr!=v.begin())cout << " ";
    cout << *(itr++);
  }
  return os;
}
// map 型
template<class S,class T>
std::ostream& operator<<(std::ostream& os, const map<S,T>& mp){
  for(const pair<S,T>& x: mp){
    cout << "[" << x.first << "]=" << x.second << " ";
  }
  return os;
}

int main(){
  li w,h,x,y; cin >>w >>h >>x >>y;
  print(w*h/2.0,(x*2==w and y*2==h));
}





Measured memory_bytes: 3780